feat: Added python binding to all functions
+ added docs to all functions
This commit is contained in:
0
g2o/functions/__init__.py
Normal file
0
g2o/functions/__init__.py
Normal file
81
g2o/functions/chat.py
Normal file
81
g2o/functions/chat.py
Normal file
@@ -0,0 +1,81 @@
|
||||
import sqg2o
|
||||
|
||||
def sendMessageToAll(r : int, g : int, b : int, text : str):
|
||||
"""
|
||||
This function will send a chat message to every connected player.
|
||||
Sending a message triggers client side event [onPlayerMessage](../../defaultEvents/player/onPlayerMessage.md) with playerid set as `-1`.
|
||||
Original: [sendMessageToAll](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/chat/sendMessageToAll/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def sendMessageToAll(r : int, g : int, b : int, text : str)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `int` **r**: the red color component in RGB model.
|
||||
* `int` **g**: the green color component in RGB model.
|
||||
* `int` **b**: the blue color component in RGB model.
|
||||
* `str` **text**: that will be send.
|
||||
"""
|
||||
return sqg2o.sendMessageToAll(*locals())
|
||||
|
||||
def sendMessageToPlayer(playerid : int, r : int, g : int, b : int, text : str):
|
||||
"""
|
||||
This function will send a chat message to specific player.
|
||||
Sending a message triggers client side event [onPlayerMessage](../../defaultEvents/player/onPlayerMessage.md) with playerid set as `-1`.
|
||||
Original: [sendMessageToPlayer](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/chat/sendMessageToPlayer/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def sendMessageToPlayer(playerid : int, r : int, g : int, b : int, text : str)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `int` **playerid**: the id of the player which will receive a message.
|
||||
* `int` **r**: the red color component in RGB model.
|
||||
* `int` **g**: the green color component in RGB model.
|
||||
* `int` **b**: the blue color component in RGB model.
|
||||
* `str` **text**: that will be send.
|
||||
"""
|
||||
return sqg2o.sendMessageToPlayer(*locals())
|
||||
|
||||
def sendPlayerMessageToAll(senderid : int, r : int, g : int, b : int, text : str):
|
||||
"""
|
||||
This function will send a chat message from one player to every player. Sending a message
|
||||
Sending a message triggers client side event [onPlayerMessage](../../defaultEvents/player/onPlayerMessage.md) with playerid set as **senderid**.
|
||||
Original: [sendPlayerMessageToAll](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/chat/sendPlayerMessageToAll/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def sendPlayerMessageToAll(senderid : int, r : int, g : int, b : int, text : str)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `int` **senderid**: the id of the player which will send a message.
|
||||
* `int` **r**: the red color component in RGB model.
|
||||
* `int` **g**: the green color component in RGB model.
|
||||
* `int` **b**: the blue color component in RGB model.
|
||||
* `str` **text**: that will be send.
|
||||
"""
|
||||
return sqg2o.sendPlayerMessageToAll(*locals())
|
||||
|
||||
def sendPlayerMessageToPlayer(senderid : int, receiverid : int, r : int, g : int, b : int, text : str):
|
||||
"""
|
||||
This function will send a chat message from one player to another player.
|
||||
Sending a message triggers client side event [onPlayerMessage](../../defaultEvents/player/onPlayerMessage.md) with playerid set as **senderid**.
|
||||
Original: [sendPlayerMessageToPlayer](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/chat/sendPlayerMessageToPlayer/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
sendPlayerMessageToPlayer(senderid : int, receiverid : int, r : int, g : int, b : int, text : str)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `int` **senderid**: the id of the player which will send a message.
|
||||
* `int` **receiverid**: the id of the player which will receive a message.
|
||||
* `int` **r**: the red color component in RGB model.
|
||||
* `int` **g**: the green color component in RGB model.
|
||||
* `int` **b**: the blue color component in RGB model.
|
||||
* `str` **text**: that will be send.
|
||||
"""
|
||||
return sqg2o.sendPlayerMessageToAll(*locals())
|
||||
248
g2o/functions/event.py
Normal file
248
g2o/functions/event.py
Normal file
@@ -0,0 +1,248 @@
|
||||
|
||||
eventList = {}
|
||||
disabledEventList = []
|
||||
|
||||
def callEvent(evtName : str, **kwargs : dict):
|
||||
"""
|
||||
This function will notify (call) every handler bound to specified event.
|
||||
Original: [callEvent](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/event/callEvent/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def callEvent(evtName : str, **kwargs : dict)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `str` **name**: the name of the event
|
||||
* `**dict` **kwargs**: the variable number of arguments.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
g2o.addEvent('testEvt')
|
||||
|
||||
@g2o.event('testEvt')
|
||||
def onTestEvent(**kwargs):
|
||||
print(f'{kwargs['name']} called my beautiful test event')
|
||||
|
||||
g2o.callEvent('testEvt', name = 'Diego')
|
||||
```
|
||||
"""
|
||||
|
||||
isEventCancelled = False
|
||||
|
||||
if evtName in eventList and evtName not in disabledEventList:
|
||||
for event in eventList[evtName]:
|
||||
|
||||
event['function'].eventName = evtName
|
||||
event['function'].cancelled = isEventCancelled
|
||||
result = event['function'](**kwargs)
|
||||
|
||||
if result != None:
|
||||
isEventCancelled = not result
|
||||
|
||||
return isEventCancelled
|
||||
|
||||
def addEvent(name : str):
|
||||
"""
|
||||
This function will register a new event with specified name.
|
||||
Events can be used to notify function(s) when something will happen, like player joins the server, etc.
|
||||
Original: [addEvent](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/event/addEvent/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def addEvent(name)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `str` **name**: the name of the event
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
g2o.addEvent('testEvt')
|
||||
```
|
||||
"""
|
||||
if not name in eventList:
|
||||
eventList[name] = []
|
||||
|
||||
def event(name : str, priority : int = 9999):
|
||||
"""
|
||||
This function will bind function to specified event.
|
||||
Original: [addEventHandler](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/event/addEventHandler/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def event(name : str, priority : int = 9999)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `str` **name**: the name of the event
|
||||
* `int` **priority**: the function priority. The lower the value, the sooner the function/handler will be called.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onInit')
|
||||
def onInitEventHandler(**kwargs):
|
||||
print('Called onInit event')
|
||||
```
|
||||
"""
|
||||
def inlineEvt(func):
|
||||
if name not in eventList:
|
||||
return None
|
||||
|
||||
eventList[name].append({'function': func, 'priority': priority})
|
||||
eventList[name].sort(key = lambda x: x['priority'])
|
||||
return func
|
||||
return inlineEvt
|
||||
|
||||
def removeEventHandler(name : str, func : object):
|
||||
"""
|
||||
This function will unbind function from specified event.
|
||||
Original: [removeEventHandler](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/event/removeEventHandler/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def removeEventHandler(name : str, func : object)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `str` **name**: the name of the event
|
||||
* `object` **func**: the reference to a function which is currently bound to specified event.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onTime')
|
||||
def onTimeEvt(**kwargs):
|
||||
print('Calling only once')
|
||||
g2o.removeEventHandler('onTime', onTimeEvt)
|
||||
```
|
||||
"""
|
||||
if not name in eventList:
|
||||
pass
|
||||
|
||||
for index, item in enumerate(eventList[name]):
|
||||
if item['function'] == func:
|
||||
del eventList[name][index]
|
||||
|
||||
def toggleEvent(name : str, toggle : bool):
|
||||
'''
|
||||
!!! note
|
||||
By default every event is toggled `on` (enabled).
|
||||
|
||||
This function will toggle event (enable or disable it globally). By toggling event off, you can completely disable certain event from calling it's handlers.
|
||||
Original: [toggleEvent](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/event/toggleEvent/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def toggleEvent(name : str, toggle : bool)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `str` **name**: the name of the event
|
||||
* `bool` **toggle**: `false` if you want to disable the event, otherwise true.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onTime')
|
||||
def onTimeEvt(**kwargs):
|
||||
print('Calling only once')
|
||||
g2o.toggleEvent('onTime', false)
|
||||
```
|
||||
'''
|
||||
if not toggle and name not in disabledEventList:
|
||||
disabledEventList.append(name)
|
||||
elif toggle and name in disabledEventList:
|
||||
disabledEventList.remove(name)
|
||||
|
||||
def removeEvent(name : str):
|
||||
'''
|
||||
!!! warning
|
||||
Removing an event also cause all event handlers to unregister.
|
||||
This function will unregister an event with specified name.
|
||||
Original: [removeEvent](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/event/removeEvent/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def removeEvent(name : str)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `str` **name**: the name of the event
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onTime')
|
||||
def onTimeEvt(**kwargs):
|
||||
print('Calling only once')
|
||||
g2o.removeEvent('onTime')
|
||||
```
|
||||
'''
|
||||
if name in eventList:
|
||||
eventList.pop(name)
|
||||
|
||||
## registering default events
|
||||
|
||||
addEvent('onInit')
|
||||
addEvent('onExit')
|
||||
addEvent('onTick')
|
||||
addEvent('onTime')
|
||||
addEvent('onBan')
|
||||
addEvent('onUnban')
|
||||
|
||||
addEvent('onPlayerChangeColor')
|
||||
addEvent('onPlayerChangeFocus')
|
||||
addEvent('onPlayerChangeHealth')
|
||||
addEvent('onPlayerChangeMana')
|
||||
addEvent('onPlayerChangeMaxHealth')
|
||||
addEvent('onPlayerChangeMaxMana')
|
||||
addEvent('onPlayerChangeWeaponMode')
|
||||
addEvent('onPlayerChangeWorld')
|
||||
|
||||
addEvent('onPlayerCommand')
|
||||
addEvent('onPlayerDamage')
|
||||
addEvent('onPlayerDead')
|
||||
addEvent('onPlayerDisconnect')
|
||||
addEvent('onPlayerDropItem')
|
||||
addEvent('onPlayerEnterWorld')
|
||||
addEvent('onPlayerJoin')
|
||||
addEvent('onPlayerMessage')
|
||||
addEvent('onPlayerMobInteract')
|
||||
addEvent('onPlayerRespawn')
|
||||
addEvent('onPlayerShoot')
|
||||
addEvent('onPlayerSpellCast')
|
||||
addEvent('onPlayerSpellSetup')
|
||||
addEvent('onPlayerTakeItem')
|
||||
addEvent('onPlayerTeleport')
|
||||
addEvent('onPlayerToggleFaceAni')
|
||||
|
||||
addEvent('onPlayerEquipAmulet')
|
||||
addEvent('onPlayerEquipArmor')
|
||||
addEvent('onPlayerEquipBelt')
|
||||
addEvent('onPlayerEquipHandItem')
|
||||
addEvent('onPlayerEquipHelmet')
|
||||
addEvent('onPlayerEquipMeleeWeapon')
|
||||
addEvent('onPlayerEquipRangedWeapon')
|
||||
addEvent('onPlayerEquipRing')
|
||||
addEvent('onPlayerEquipShield')
|
||||
addEvent('onPlayerEquipSpell')
|
||||
|
||||
addEvent('onPacket')
|
||||
|
||||
addEvent('onPlayerUseCheat')
|
||||
|
||||
addEvent('onNpcActionFinished')
|
||||
addEvent('onNpcActionSent')
|
||||
addEvent('onNpcChangeHostPlayer')
|
||||
addEvent('onNpcCreated')
|
||||
addEvent('onNpcDestroyed')
|
||||
223
g2o/functions/game.py
Normal file
223
g2o/functions/game.py
Normal file
@@ -0,0 +1,223 @@
|
||||
import sqg2o
|
||||
|
||||
def getHostname() -> str:
|
||||
"""
|
||||
This function will get the hostname of the server.
|
||||
Original: [getHostname](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/game/getHostname/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getHostname() -> str
|
||||
```
|
||||
## Returns
|
||||
`str`: Server hostname.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onInit')
|
||||
def evtInit(**kwargs):
|
||||
print('Server hostname:', g2o.getHostname())
|
||||
```
|
||||
"""
|
||||
return sqg2o.getHostname()
|
||||
|
||||
def getMaxSlots() -> int:
|
||||
"""
|
||||
This function will get the max number of slots available on the server.
|
||||
Original: [getMaxSlots](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/game/getMaxSlots/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getMaxSlots() -> int
|
||||
```
|
||||
## Returns
|
||||
`int`: Max slots number on the server.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onInit')
|
||||
def evtInit(**kwargs):
|
||||
print('Server max slots:', g2o.getMaxSlots())
|
||||
```
|
||||
"""
|
||||
return sqg2o.getMaxSlots()
|
||||
|
||||
def getPlayersCount() -> int:
|
||||
"""
|
||||
This function will get the max number of slots available on the server.
|
||||
Original: [getPlayersCount](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/game/getPlayersCount/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getPlayersCount() -> int
|
||||
```
|
||||
## Returns
|
||||
`int`: Number of players on the server.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onInit')
|
||||
def evtInit(**kwargs):
|
||||
print('Players online:', g2o.getPlayersCount())
|
||||
```
|
||||
"""
|
||||
return sqg2o.getPlayersCount()
|
||||
|
||||
def exit(exitCode : int = 0):
|
||||
"""
|
||||
This function will close the server with specified exit code.
|
||||
Original: [exit](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/exit/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def exit(exitCode : int = 0)
|
||||
```
|
||||
## Parameters
|
||||
* `int` **exitCode**: exit status for g2o server.
|
||||
"""
|
||||
return sqg2o.exit(*locals())
|
||||
|
||||
def getDayLength() -> float:
|
||||
"""
|
||||
The function is used to get the day length in miliseconds.
|
||||
Original: [getDayLength](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/getDayLength/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getDayLength() -> float
|
||||
```
|
||||
## Returns
|
||||
`float`: the current day length in miliseconds.
|
||||
"""
|
||||
return sqg2o.getDayLength()
|
||||
|
||||
def getServerDescription() -> str:
|
||||
"""
|
||||
This function will get the description of the server.
|
||||
Original: [getServerDescription](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/getServerDescription/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getServerDescription() -> str
|
||||
```
|
||||
## Returns
|
||||
`str`: Server description.
|
||||
"""
|
||||
return sqg2o.getServerDescription()
|
||||
|
||||
def getServerWorld() -> str:
|
||||
"""
|
||||
The function is used to get the path of the default world on the server.
|
||||
Original: [getServerWorld](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/getServerWorld/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getServerWorld() -> str
|
||||
```
|
||||
## Returns
|
||||
`str`: The world path name.
|
||||
"""
|
||||
return sqg2o.getServerWorld()
|
||||
|
||||
def getTime() -> dict:
|
||||
"""
|
||||
The function is used to get the path of the default world on the server.
|
||||
Original: [getTime](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/getTime/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getTime() -> dict
|
||||
```
|
||||
## Returns
|
||||
`dict {day, hour, min}`: The current time in the game.
|
||||
"""
|
||||
return sqg2o.getTime()
|
||||
|
||||
def serverLog(text : str):
|
||||
"""
|
||||
This function will log the text into server.log file.
|
||||
Original: [serverLog](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/serverLog/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def serverLog(text : str)
|
||||
```
|
||||
## Parameters
|
||||
`str` **text**: the text message that you want to append to server.log file.
|
||||
"""
|
||||
return sqg2o.serverLog(*locals())
|
||||
|
||||
def setDayLength(miliseconds : float):
|
||||
"""
|
||||
!!! note
|
||||
Day length can't be smaller than 10 000 miliseconds.
|
||||
|
||||
This function will set the day length in miliseconds.
|
||||
Original: [setDayLength](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/setDayLength/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def setDayLength(miliseconds : float)
|
||||
```
|
||||
## Parameters
|
||||
`float` **miliseconds**: day length in miliseconds.
|
||||
"""
|
||||
return sqg2o.setDayLength(*locals())
|
||||
|
||||
def setServerDescription(description : str):
|
||||
"""
|
||||
This function will set the description of the server.
|
||||
Original: [setServerDescription](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/setServerDescription/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def setServerDescription(description : str)
|
||||
```
|
||||
## Parameters
|
||||
`str` **description**: the server description.
|
||||
## Returns
|
||||
`bool`: `true` if server description was set successfully, otherwise `false`.
|
||||
"""
|
||||
return sqg2o.setServerDescription(*locals())
|
||||
|
||||
def setServerWorld(world : str):
|
||||
"""
|
||||
!!! note
|
||||
The server world limit is set to 32 characters.
|
||||
|
||||
!!! note
|
||||
If the target world path is written with backslashes instead of normal slashes, you need to escape it with another backslashes e.g. "NEWWORLD\\NEWWORLD.ZEN".
|
||||
|
||||
This function will change the default world to which players will enter after joining.
|
||||
Original: [setServerWorld](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/setServerWorld/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def setServerWorld(world : str)
|
||||
```
|
||||
## Parameters
|
||||
`str` **world**: the path to the target world.
|
||||
"""
|
||||
return sqg2o.setServerWorld(*locals())
|
||||
|
||||
def setTime(hour : int, min : int, day : int = 0):
|
||||
"""
|
||||
This function will set the current time in the game to the given time, for all the players.
|
||||
Original: [setTime](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/game/setTime/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def setTime(hour : int, min : int, day : int = 0)
|
||||
```
|
||||
## Parameters
|
||||
`int` **hour**: the hour of new time (in the range between 0-23).
|
||||
`int` **min**: the minute of new time (in the range between 0-59).
|
||||
`int` **day**: the day of new time.
|
||||
"""
|
||||
return sqg2o.setTime(*locals())
|
||||
247
g2o/functions/npc.py
Normal file
247
g2o/functions/npc.py
Normal file
@@ -0,0 +1,247 @@
|
||||
import sqg2o
|
||||
|
||||
def clearNpcActions(npc_id : int):
|
||||
"""
|
||||
This function clears remote NPC actions queue. Remote NPCs uses actions queue to execute thier tasks.
|
||||
Original: [clearNpcActions](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/clearNpcActions/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
clearNpcActions(npc_id : int)
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the npc identifier.
|
||||
"""
|
||||
return sqg2o.clearNpcActions(*locals())
|
||||
|
||||
def createNpc(name : str, instance : str = 'PC_HERO') -> int:
|
||||
"""
|
||||
!!! note
|
||||
By default npcs won't be added to world. In order to do that, you have to call **TBD**.
|
||||
!!! note
|
||||
Remote NPC id will always begins from max slots value.
|
||||
This function creates remote NPC.
|
||||
Original: [createNpc](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/createNpc/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def createNpc(name : str, instance : str = 'PC_HERO') -> int
|
||||
```
|
||||
## Parameters
|
||||
`str` **name**: the displayed name of the npc.
|
||||
`str` **instance**: the instance name of for the npc.
|
||||
"""
|
||||
return sqg2o.createNpc(*locals())
|
||||
|
||||
def destroyNpc(npc_id : int) -> bool:
|
||||
"""
|
||||
This function destroys remote NPC.
|
||||
Original: [destroyNpc](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/destroyNpc/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def destroyNpc(npc_id : int) -> bool
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the identifier of npc.
|
||||
## Returns
|
||||
`bool`: `true` when npc was successfully destroyed, otherwise false`.
|
||||
"""
|
||||
return sqg2o.destroyNpc(*locals())
|
||||
|
||||
def getNpcAction(npc_id : int, index : int) -> dict:
|
||||
"""
|
||||
This function gets information about element on specified index in NPC action queue.
|
||||
Original: [getNpcAction](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/getNpcAction/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
getNpcAction(npc_id : int, index : int) -> dict
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the identifier of npc.
|
||||
`int` **index**: the index of element in the queue.
|
||||
## Returns
|
||||
`dict {type, id, status}`: The table containing information about selected element.
|
||||
"""
|
||||
return sqg2o.getNpcAction(*locals())
|
||||
|
||||
def getNpcActions(npc_id : int) -> list:
|
||||
"""
|
||||
This function gets informations about elements in NPC action queue.
|
||||
Original: [getNpcActions](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/getNpcActions/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getNpcActions(npc_id : int) -> list
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the identifier of npc.
|
||||
## Returns
|
||||
`list [{type, id}]`: The array containing information about queue elements.
|
||||
"""
|
||||
return sqg2o.getNpcActions(*locals())
|
||||
|
||||
def getNpcActionsCount(npc_id : int) -> int:
|
||||
"""
|
||||
This function gets elements count in NPC action queue.
|
||||
Original: [getNpcActionsCount](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/getNpcActionsCount/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getNpcActionsCount(npc_id : int) -> int
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the identifier of npc.
|
||||
## Returns
|
||||
`int`: The count of elements inside queue, otherwise `-1`.
|
||||
"""
|
||||
return sqg2o.getNpcActionsCount(*locals())
|
||||
|
||||
def getNpcHostPlayer(npc_id : int) -> int:
|
||||
"""
|
||||
This function gets NPC host player id.
|
||||
Original: [getNpcHostPlayer](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/getNpcHostPlayer/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
getNpcHostPlayer(npc_id : int) -> int
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the identifier of npc.
|
||||
## Returns
|
||||
`int`: the host player identifier. If there is no host player `-1` is returned instead.
|
||||
"""
|
||||
return sqg2o.getNpcHostPlayer(*locals())
|
||||
|
||||
def getNpcLastActionId(npc_id : int) -> int:
|
||||
"""
|
||||
This function gets last action identifier, that was enqued to the NPC action queue. Every action in queue has associated unique id, by which can be identified.
|
||||
Original: [getNpcLastActionId](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/getNpcLastActionId/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
getNpcLastActionId(npc_id : int) -> int
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the identifier of npc.
|
||||
## Returns
|
||||
`int`: The last finished action identifier, otherwise `-1`.
|
||||
"""
|
||||
return sqg2o.getNpcLastActionId(*locals())
|
||||
|
||||
def isNpc(npc_id : int) -> bool:
|
||||
"""
|
||||
This function checks whether id related to given object is remote NPC.
|
||||
Original: [isNpc](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/isNpc/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def isNpc(npc_id : int) -> bool
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the identifier of npc.
|
||||
## Returns
|
||||
`bool`: `true` when object is NPC, otherwise `false`.
|
||||
"""
|
||||
return sqg2o.isNpc(*locals())
|
||||
|
||||
def isNpcActionFinished(npc_id : int, action_id : int) -> bool:
|
||||
"""
|
||||
This function checks whether specified NPC action was finished.
|
||||
Original: [isNpcActionFinished](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/isNpcActionFinished/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def isNpcActionFinished(npc_id : int, action_id : int) -> bool
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the identifier of npc.
|
||||
`int` **action_id**: the unique action identifier.
|
||||
## Returns
|
||||
`bool`: `true` if specified action identifier was already finished, otherwise `false`.
|
||||
"""
|
||||
return sqg2o.isNpcActionFinished(*locals())
|
||||
|
||||
def npcAttackMelee(attacker_id : int, enemy_id : int, attack_type : int, combo : int):
|
||||
"""
|
||||
!!! note
|
||||
Combo is internal Gothic value. Its behaviour can be sometimes undefined. For example -1 value doesn't work for not humanoid NPCs.
|
||||
|
||||
This function enqueues attack melee action to the remote NPC action queue.
|
||||
Original: [npcAttackMelee](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/npcAttackMelee/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def npcAttackMelee(attacker_id : int, enemy_id : int, attack_type : int, combo : int)
|
||||
```
|
||||
## Parameters
|
||||
`int` **attacker_id**: the remote npc id.
|
||||
`int` **enemy_id**: the remote npc or player id.
|
||||
`int` **attack_type**: the type of attack.
|
||||
`int` **combol**: the combo sequence. For `-1` execute next command immediately.
|
||||
"""
|
||||
return sqg2o.npcAttackMelee(*locals())
|
||||
|
||||
def npcAttackRanged(attacker_id : int, enemy_id : int):
|
||||
"""
|
||||
This function enqueues attack ranged action to the remote NPC action queue.
|
||||
Original: [npcAttackRanged](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/npcAttackRanged/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def npcAttackRanged(attacker_id : int, enemy_id : int)
|
||||
```
|
||||
## Parameters
|
||||
`int` **attacker_id**: the remote npc id.
|
||||
`int` **enemy_id**: the remote npc or player id.
|
||||
"""
|
||||
return sqg2o.npcAttackRanged(*locals())
|
||||
|
||||
def npcSpellCast(attacker_id : int, enemy_id : int):
|
||||
"""
|
||||
This function enqueues spell cast action to the remote NPC action queue.
|
||||
Original: [npcSpellCast](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/npcSpellCast/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def npcSpellCast(attacker_id : int, enemy_id : int)
|
||||
```
|
||||
## Parameters
|
||||
`int` **attacker_id**: the remote npc id.
|
||||
`int` **enemy_id**: the remote npc or player id.
|
||||
"""
|
||||
return sqg2o.npcSpellCast(*locals())
|
||||
|
||||
def npcUseClosestMob(npc_id : int, sceme : str, target_state : int):
|
||||
"""
|
||||
This function enqueues use closest mob action to the remote NPC action queue.
|
||||
Original: [npcUseClosestMob](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/npcUseClosestMob/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def npcUseClosestMob(npc_id : int, sceme : str, target_state : int)
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the npc identifier.
|
||||
`str` **sceme**: the animation sceme name, e.g: `"BENCH"` when you want to interact with bench.
|
||||
`int` **target_state**: the target state, use `1` if you want to start interaction and `-1` to end it.
|
||||
"""
|
||||
return sqg2o.npcUseClosestMob(*locals())
|
||||
|
||||
def setNpcHostPlayer(npc_id : int, host_id : int) -> bool:
|
||||
"""
|
||||
This function sets new NPC host player.
|
||||
Original: [setNpcHostPlayer](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/npc/setNpcHostPlayer/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def setNpcHostPlayer(npc_id : int, host_id : int) -> bool
|
||||
```
|
||||
## Parameters
|
||||
`int` **npc_id**: the npc identifier.
|
||||
`int` **host_id**: the player host identifier.
|
||||
## Returns
|
||||
`bool`: `true` if host was successfully changed, otherwise `false`.
|
||||
"""
|
||||
return sqg2o.setNpcHostPlayer(*locals())
|
||||
1462
g2o/functions/player.py
Normal file
1462
g2o/functions/player.py
Normal file
File diff suppressed because it is too large
Load Diff
52
g2o/functions/streamer.py
Normal file
52
g2o/functions/streamer.py
Normal file
@@ -0,0 +1,52 @@
|
||||
import sqg2o
|
||||
|
||||
def findNearbyPlayers(position : dict, radius : int, world : str, virtual_world : int = 0) -> list:
|
||||
"""
|
||||
This function will search for nearest players, that matches given query arguments.
|
||||
Original: [findNearbyPlayers](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/streamer/findNearbyPlayers/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def findNearbyPlayers(position : dict, radius : int, world : str, virtual_world : int = 0) -> list
|
||||
```
|
||||
## Parameters
|
||||
`dict {x, y, z}` **position**: the centroid position.
|
||||
`int` **radius**: the maximum radius to search from centroid.
|
||||
`str` **world**: the world used to find players.
|
||||
`int` **virtual_world**: the virtual world used to find players.
|
||||
## Returns
|
||||
`list [int]`: ids of nearby players.
|
||||
"""
|
||||
return sqg2o.findNearbyPlayers(*locals())
|
||||
|
||||
def getSpawnedPlayersForPlayer(id : int) -> list:
|
||||
"""
|
||||
This function is used to retrieve currently spawned players for given player.
|
||||
Original: [getSpawnedPlayersForPlayer](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/streamer/getSpawnedPlayersForPlayer/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getSpawnedPlayersForPlayer(id : int) -> list
|
||||
```
|
||||
## Parameters
|
||||
`int` **id**: the player id.
|
||||
## Returns
|
||||
`list [int]`: ids of spawned players.
|
||||
"""
|
||||
return sqg2o.getSpawnedPlayersForPlayer(*locals())
|
||||
|
||||
def getStreamedPlayersByPlayer(id : int) -> list:
|
||||
"""
|
||||
This function is used to retrieve currently streamed players by given player. More details: Streamed players are basically clients, that has spawned given player in their game. Please notice, that player can be spawned only one way. Which means that there are situation were player 1 is spawned for player 2, but not the other way arount. Simple examples: - Invisible players cannot be seen, but they can see everyone nearby. - Flying around world using camera.
|
||||
Original: [getStreamedPlayersByPlayer](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/streamer/getStreamedPlayersByPlayer/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getStreamedPlayersByPlayer(id : int) -> list
|
||||
```
|
||||
## Parameters
|
||||
`int` **id**: the player id.
|
||||
## Returns
|
||||
`list [int]`: ids of streamed players.
|
||||
"""
|
||||
return sqg2o.getStreamedPlayersByPlayer(*locals())
|
||||
37
g2o/functions/waypoint.py
Normal file
37
g2o/functions/waypoint.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import sqg2o
|
||||
|
||||
def getNearestWaypoint(world : str, x : int, y : int, z : int) -> dict:
|
||||
"""
|
||||
This function is used to retrieve the information about nearest waypoint from the specified position.
|
||||
Original: [getNearestWaypoint](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/waypoint/getNearestWaypoint/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getNearestWaypoint(world : str, x : int, y : int, z : int) -> dict
|
||||
```
|
||||
## Parameters
|
||||
`str` **world**: the world name in which the waypoint exists.
|
||||
`int` **x**: the position in the world on the x axis.
|
||||
`int` **y**: the position in the world on the y axis.
|
||||
`int` **z**: the position in the world on the z axis.
|
||||
## Returns
|
||||
`dict {name, x, y, z}`: Waypoint information.
|
||||
"""
|
||||
return sqg2o.getNearestWaypoint(*locals())
|
||||
|
||||
def getWaypoint(world : str, name : str) -> dict:
|
||||
"""
|
||||
This function is used to retrieve the position of specified waypoint.
|
||||
Original: [getWaypoint](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/waypoint/getWaypoint/)
|
||||
|
||||
## Declaration
|
||||
```python
|
||||
def getWaypoint(world : str, name : str) -> dict
|
||||
```
|
||||
## Parameters
|
||||
`str` **world**: the world name in which the waypoint exists.
|
||||
`str` **name**: the name of the waypoint.
|
||||
## Returns
|
||||
`dict {x, y, z}`: The position of waypoint.
|
||||
"""
|
||||
return sqg2o.getWaypoint(*locals())
|
||||
Reference in New Issue
Block a user