feat: changes due to G2O 0.3.0.6

+ added function getPlayerUID
+ changed event onPlayerSpellCast
This commit is contained in:
AURUMVORXX
2024-12-23 17:48:17 +03:00
parent cbd432a1e7
commit 74ad2e6abc
8 changed files with 26 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ Original: [onPlayerSpellCast](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0
* `dict` **kwargs**: * `dict` **kwargs**:
* `int` **playerid**: the id of the player who casts the spell. * `int` **playerid**: the id of the player who casts the spell.
* `str | null` **instance**: the item instance from Daedalus scripts. * `str | null` **instance**: the item instance from Daedalus scripts.
* `int` **spellLevel**: the level of charged spell.
## Usage ## Usage
```python ```python

View File

@@ -0,0 +1,2 @@
#`function` getPlayerUID
::: g2o.functions.player.getPlayerUID

View File

@@ -699,6 +699,22 @@ def getPlayerTalent(id : int, talentId : int) -> int:
""" """
return sqg2o.getPlayerTalent(id, talentId) return sqg2o.getPlayerTalent(id, talentId)
def getPlayerUID(id : int) -> str:
"""
This function will get the player pc unique identifier.
Original: [getPlayerUID](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/player/getPlayerUID/)
## Declaration
```python
def getPlayerUID(id : int) -> str
```
## Parameters
`int` **id**: the player id.
## Returns
`str`: the player UID.
"""
return sqg2o.getPlayerUID(id)
def getPlayerVirtualWorld(id : int) -> int: def getPlayerVirtualWorld(id : int) -> int:
""" """
This function will get the player virtual world. This function will get the player virtual world.

View File

@@ -284,12 +284,14 @@ SQInteger sq_onPlayerSpellCast(HSQUIRRELVM vm)
{ {
SQInteger playerid; SQInteger playerid;
const SQChar* instance; const SQChar* instance;
SQInteger spellLevel;
nonut::sqGetValue(vm, 2, &playerid); nonut::sqGetValue(vm, 2, &playerid);
if (sq_gettype(vm, 3) != OT_NULL) if (sq_gettype(vm, 3) != OT_NULL)
nonut::sqGetValue(vm, 3, &instance); nonut::sqGetValue(vm, 3, &instance);
nonut::sqGetValue(vm, 4, &spellLevel);
py::dict kwargs = py::dict("playerid"_a=playerid, "instance"_a=instance); py::dict kwargs = py::dict("playerid"_a=playerid, "instance"_a=instance, "spellLevel"_a=spellLevel);
callEvent("onPlayerSpellCast", kwargs); callEvent("onPlayerSpellCast", kwargs);
return 0; return 0;

View File

@@ -133,6 +133,7 @@ int py_getPlayerSkillWeapon(int id, int skillId)
std::string py_getPlayerSpell(int id, int slotId) { return SERVERFUNC->getPlayerSpell(id, slotId); } std::string py_getPlayerSpell(int id, int slotId) { return SERVERFUNC->getPlayerSpell(id, slotId); }
int py_getPlayerStrength(int id) { return SERVERFUNC->getPlayerStrength(id); } int py_getPlayerStrength(int id) { return SERVERFUNC->getPlayerStrength(id); }
int py_getPlayerTalent(int id, int talentId) { return SERVERFUNC->getPlayerTalent(id, talentId); } int py_getPlayerTalent(int id, int talentId) { return SERVERFUNC->getPlayerTalent(id, talentId); }
std::string py_getPlayerUID(int id) { return SERVERFUNC->getPlayerUID(id); }
int py_getPlayerVirtualWorld(int id) { return SERVERFUNC->getPlayerVirtualWorld(id); } int py_getPlayerVirtualWorld(int id) { return SERVERFUNC->getPlayerVirtualWorld(id); }
py::dict py_getPlayerVisual(int id) { return SERVERFUNC->getPlayerVisual(id).data; } py::dict py_getPlayerVisual(int id) { return SERVERFUNC->getPlayerVisual(id).data; }
int py_getPlayerWeaponMode(int id) { return SERVERFUNC->getPlayerWeaponMode(id); } int py_getPlayerWeaponMode(int id) { return SERVERFUNC->getPlayerWeaponMode(id); }

View File

@@ -88,6 +88,7 @@ int py_getPlayerSkillWeapon(int, int);
std::string py_getPlayerSpell(int, int); std::string py_getPlayerSpell(int, int);
int py_getPlayerStrength(int); int py_getPlayerStrength(int);
int py_getPlayerTalent(int, int); int py_getPlayerTalent(int, int);
std::string py_getPlayerUID(int);
int py_getPlayerVirtualWorld(int); int py_getPlayerVirtualWorld(int);
py::dict py_getPlayerVisual(int); py::dict py_getPlayerVisual(int);
int py_getPlayerWeaponMode(int); int py_getPlayerWeaponMode(int);

View File

@@ -86,6 +86,7 @@ namespace nonut
FUNCTION_CTOR(getPlayerSpell), FUNCTION_CTOR(getPlayerSpell),
FUNCTION_CTOR(getPlayerStrength), FUNCTION_CTOR(getPlayerStrength),
FUNCTION_CTOR(getPlayerTalent), FUNCTION_CTOR(getPlayerTalent),
FUNCTION_CTOR(getPlayerUID),
FUNCTION_CTOR(getPlayerVirtualWorld), FUNCTION_CTOR(getPlayerVirtualWorld),
FUNCTION_CTOR(getPlayerVisual), FUNCTION_CTOR(getPlayerVisual),
FUNCTION_CTOR(getPlayerWeaponMode), FUNCTION_CTOR(getPlayerWeaponMode),

View File

@@ -99,6 +99,7 @@ namespace nonut
Function<String, Int, Int> getPlayerSpell; Function<String, Int, Int> getPlayerSpell;
Function<Int, Int> getPlayerStrength; Function<Int, Int> getPlayerStrength;
Function<Int, Int, Int> getPlayerTalent; Function<Int, Int, Int> getPlayerTalent;
Function<String, Int> getPlayerUID;
Function<Int, Int> getPlayerVirtualWorld; Function<Int, Int> getPlayerVirtualWorld;
Function<SqDict, Int> getPlayerVisual; Function<SqDict, Int> getPlayerVisual;
Function<Int, Int> getPlayerWeaponMode; Function<Int, Int> getPlayerWeaponMode;