refactor: Refactorized whole project structure
This commit is contained in:
30
python/docs/defaultEvents/general/onBan.md
Normal file
30
python/docs/defaultEvents/general/onBan.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# `event` onBan
|
||||
> [!TIP] This event can be cancelled
|
||||
!!! note
|
||||
If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added.
|
||||
If timestamp doesn't exist, then ban was permanent.
|
||||
|
||||
This event is triggered when new ban is being added.
|
||||
|
||||
Original: [onBan](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/general/onBan/)
|
||||
|
||||
## Parameters
|
||||
* `dict` **kwargs**:
|
||||
* `str` **mac**: MAC address of the banned player.
|
||||
* `str` **ip**: IP address of the banned player.
|
||||
* `str` **serial**: serial of the banned player.
|
||||
* `str` **name**: nickname of the banned player.
|
||||
* `int` **timestamp**: timestamp when the ban expires.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
from datetime import datetime
|
||||
|
||||
@g2o.event('onBan')
|
||||
def onBan(**kwargs):
|
||||
print(f'Player {kwargs['name']} has been banned.')
|
||||
if ('timestamp' in kwargs):
|
||||
banExpires = datetime.fromtimestamp(kwargs['timestamp'])
|
||||
print(f'Ban expires at {banExpires}')
|
||||
```
|
||||
17
python/docs/defaultEvents/general/onExit.md
Normal file
17
python/docs/defaultEvents/general/onExit.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# `event` onExit
|
||||
This event is triggered when server is going to shut down.
|
||||
You can use it, to save some data before closing up, or do something else.
|
||||
|
||||
Original: [onExit](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/general/onExit/)
|
||||
|
||||
## Parameters
|
||||
No parameters.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onExit')
|
||||
def onExitEvt(**kwargs):
|
||||
print('Bye')
|
||||
```
|
||||
16
python/docs/defaultEvents/general/onInit.md
Normal file
16
python/docs/defaultEvents/general/onInit.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# `event` onInit
|
||||
This event is triggered when server successfully starts up.
|
||||
|
||||
Original: [onExit](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/general/onInit/)
|
||||
|
||||
## Parameters
|
||||
No parameters.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onInit')
|
||||
def onInitEventHandler(**kwargs):
|
||||
print('Called onInit event')
|
||||
```
|
||||
16
python/docs/defaultEvents/general/onTick.md
Normal file
16
python/docs/defaultEvents/general/onTick.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# `event` onTick
|
||||
This event is triggered in every server main loop iteration.
|
||||
|
||||
Original: [onExit](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/general/onTick/)
|
||||
|
||||
## Parameters
|
||||
No parameters.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onTick')
|
||||
def onTickEvt(**kwargs):
|
||||
print('Tock')
|
||||
```
|
||||
22
python/docs/defaultEvents/general/onTime.md
Normal file
22
python/docs/defaultEvents/general/onTime.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# `event` onTime
|
||||
This event is triggered each time when game time minute passes.
|
||||
|
||||
Original: [onExit](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/general/onTime/)
|
||||
|
||||
## Parameters
|
||||
* `dict` **kwargs**:
|
||||
* `int` **day**: the current ingame day.
|
||||
* `int` **hour**: the current ingame hour.
|
||||
* `int` **min**: the current ingame minutes.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onTick')
|
||||
def onTickEvt(**kwargs):
|
||||
day = kwargs['day']
|
||||
hour = kwargs['hour']
|
||||
mins = kwargs['min']
|
||||
print(f'Current time: Day {day}, Hour {hour}, Min {mins}')
|
||||
```
|
||||
26
python/docs/defaultEvents/general/onUnban.md
Normal file
26
python/docs/defaultEvents/general/onUnban.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# `event` onUnban
|
||||
> [!TIP] This event can be cancelled
|
||||
!!! note
|
||||
If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added.
|
||||
If timestamp doesn't exist, then ban was permanent.
|
||||
|
||||
This event is triggered when ban with specified info is being removed.
|
||||
|
||||
Original: [onExit](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/general/onUnban/)
|
||||
|
||||
## Parameters
|
||||
* `dict` **kwargs**:
|
||||
* `str` **mac**: MAC address of the banned player.
|
||||
* `str` **ip**: IP address of the banned player.
|
||||
* `str` **serial**: serial of the banned player.
|
||||
* `str` **name**: nickname of the banned player.
|
||||
* `int` **timestamp**: timestamp when the ban expires.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onUnban')
|
||||
def onUnban(**kwargs):
|
||||
print(f'Player {kwargs['name']} has been unbanned.')
|
||||
```
|
||||
Reference in New Issue
Block a user