feat: Added Sky class

+ changed file structure in the python module
+ fixed static method binding for PyDaedalus class
This commit is contained in:
AURUMVORXX
2024-11-07 02:29:19 +03:00
parent 6e76960158
commit 15b34c3f40
11 changed files with 185 additions and 16 deletions

15
g2o/classes/daedalus.py Normal file
View File

@@ -0,0 +1,15 @@
import sqg2o
class Daedalus:
@staticmethod
def index(value : str) -> int:
return sqg2o.Daedalus.index(value)
@staticmethod
def symbol(value : str) -> dict:
return sqg2o.Daedalus.symbol(value)
@staticmethod
def instance(value : str) -> dict:
return sqg2o.Daedalus.instance(value)

86
g2o/classes/damage.py Normal file
View File

@@ -0,0 +1,86 @@
import sqg2o
class DamageDescription(sqg2o.DamageDescription):
"""
This class represents damage information.
Original: [DamageDescription](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-classes/item/DamageDescription//)
## `int` flags
Represents the damage flags.
## `int` damage
Represents the total damage taken.
## `str` item_instance *(read-only)*
!!! note
Can be empty if there is no weapon.
Represents the weapon instance used to deal damage.
## `int` distance
Represents the total distance, calculated from origin point to target.
## `int` spell_id
Represents the spell id.
## `int` spell_level
Represents the level of chargeable spells.
## `str` node
!!! note
Can be empty if there was no projectile.
Represents the name of the node hit by a point projectile.
"""
def __init__(self):
return super().__init__()
@property
def item_instance(self):
return super().item_instance
@property
def flags(self):
return super().flags
@flags.setter
def flags(self, value):
super().flags = value
@property
def damage(self):
return super().damage
@damage.setter
def damage(self, value):
super().damage = value
@property
def distance(self):
return super().distance
@distance.setter
def distance(self, value):
super().distance = value
@property
def spell_id(self):
return super().spell_id
@spell_id.setter
def spell_id(self, value):
super().spell_id = value
@property
def spell_level(self):
return super().spell_level
@spell_level.setter
def spell_level(self, value):
super().spell_level = value
@property
def node(self):
return super().node
@node.setter
def node(self, value):
super().node = value

64
g2o/classes/items.py Normal file
View File

@@ -0,0 +1,64 @@
import sqg2o
class ItemGround(sqg2o.ItemGround):
"""
This class represents item on the ground.
Original: [ItemGround](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-classes/item/ItemGround//)
## `int` id *(read-only)*
Represents the unique id of the item ground.
## `str` instance *(read-only)*
Represents the item instance of the item ground.
## `int` amount *(read-only)*
Represents the item amount of item ground.
## `str` world *(read-only)*
Represents the item ground world (.ZEN file path).
## `int` virtualWorld
Represents the virtual world of item ground.
"""
def __init__(self):
return super().__init__()
def getPosition() -> tuple:
"""
This method will get the item ground position on the world.
**Returns `tuple(float, float, float)`:**
`X-Y-Z` item ground position on the world.
"""
return super().getPosition()
def getRotation() -> tuple:
"""
This method will get the item ground rotation on the world.
**Returns `tuple(float, float, float)`:**
`X-Y-Z` item ground roration on the world.
"""
return super().getRotation()
@property
def id(self):
return super().id
@property
def instance(self):
return super().instance
@property
def amount(self):
return super().amount
@property
def world(self):
return super().world
@property
def virtualWorld(self):
return super().virtualWorld
@virtualWorld.setter
def virtualWorld(self, value):
super().virtualWorld = value

196
g2o/classes/packets.py Normal file
View File

@@ -0,0 +1,196 @@
import sqg2o
class Packet(sqg2o.Packet):
"""
This class represents data packet that gets send over the network.
Original: [Packet](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-classes/network/Packet/)
## `int` bitsUsed *(read-only)*
Represents the total number of bits used by the script packet data.
## `int` bytesUsed *(read-only)*
Represents the total number of bytes used by the script packet data.
"""
def __init__(self):
return super().__init__()
def reset(self):
"""
This method will clear the packet data, making it empty.
"""
return super().reset()
def send(self, playerid : int, reliability : int):
"""
This method will send the packet data to the specified player.
**Parameters:**
* `int` **playerid**: the id of the player to whom you want to send the packet.
* `int` **reliability**: the reliability type, for more information see [Reliability](../../constants/reliability.md).
"""
return super().send(playerid, reliability)
def sendToAll(self, reliability : int):
"""
This method will send the packet data to the specified player.
**Parameters:**
* `int` **reliability**: the reliability type, for more information see [Reliability](../../constants/reliability.md).
"""
return super().send(playerid, reliability)
def writeInt8(self, value : int):
"""
This method will append signed int8 value to the packet. (1 byte)
**Parameters:**
* `int` **value**: the number value in range -128 to 127.
"""
return super().writeInt8(value)
def writeUInt8(self, value : int):
"""
This method will append unsigned int8 value to the packet. (1 byte)
**Parameters:**
* `int` **value**: the number value in range 0 to 255.
"""
return super().writeInt8(value)
def writeInt16(self, value : int):
"""
This method will append signed int16 value to the packet. (2 bytes)
**Parameters:**
* `int` **value**: the number value in range -32768 to 32767.
"""
return super().writeInt16(value)
def writeUInt16(self, value : int):
"""
This method will append unsigned int16 value to the packet. (2 bytes)
**Parameters:**
* `int` **value**: the number value in range 0 to 65535.
"""
return super().writeInt16(value)
def writeInt32(self, value : int):
"""
This method will append signed int32 value to the packet. (4 bytes)
**Parameters:**
* `int` **value**: the number value in range -2147483648 to 2147483647.
"""
return super().writeInt32(value)
def writeUInt32(self, value : int):
"""
!!! note
By default squirrel uses int32 values, which means that this method behaves exactly the same as [writeInt32](Packet.md#g2o.packets.Packet.writeInt32) in scripts.
This method will append unsigned int32 value to the packet. (4 bytes)
**Parameters:**
* `int` **value**: the number value in range 0 to 4294967295.
"""
return super().writeInt32(value)
def writeBool(self, value : bool):
"""
This method will append boolean value to the packet. (1 bit)
**Parameters:**
* `bool` **value**: the boolean value.
"""
return super().writeBool(value)
def writeFloat(self, value : float):
"""
This method will append float value to the packet. (4 bytes)
**Parameters:**
* `float` **value**: the number value.
"""
return super().writeFloat(value)
def writeString(self, value : str):
"""
!!! note
The amount of bytes appended to the packet depends on the length of string, 1 byte = 1 char.
This method will append string value to the packet.
**Parameters:**
* `str` **value**: the text value.
"""
return super().writeString(value)
def readInt8(self,) -> int:
"""
This method will get signed int8 value from the packet. (1 byte)
**Returns `int`:**
the number value in range -128 to 127.
"""
return super().readInt8()
def readUInt8(self,) -> int:
"""
This method will get unsigned int8 value from the packet. (1 byte)
**Returns `int`:**
the number value in range 0 to 255.
"""
return super().readInt8()
def readInt16(self) -> int:
"""
This method will get signed int16 value from the packet. (2 bytes)
**Returns `int`:**
the number value in range -32768 to 32767.
"""
return super().readInt16()
def readUInt16(self) -> int:
"""
This method will get unsigned int16 value from the packet. (2 bytes)
**Returns `int`:**
the number value in range 0 to 65535.
"""
return super().readInt16()
def readInt32(self) -> int:
"""
This method will get signed int32 value from the packet. (4 bytes)
**Returns `int`:**
the number value in range -2147483648 to 2147483647.
"""
return super().readInt32()
def readUInt32(self) -> int:
"""
This method will get unsigned int32 value from the packet. (4 bytes)
**Returns `int`:**
the number value in range 0 to 4294967295.
"""
return super().readInt32()
def readBool(self) -> bool:
"""
This method will get signed int8 value from the packet. (1 byte)
**Returns `bool`:**
the boolean value.
"""
return super().readBool()
def readFloat(self) -> float:
"""
This method will get float value from the packet. (4 bytes)
**Returns `float`:**
the number value.
"""
return super().readFloat()
def readString(self) -> str:
"""
!!! note
The amount of bytes appended to the packet depends on the length of string, 1 byte = 1 char.
This method will get string value from the packet.
**Returns `str`:**
the text value.
"""
return super().readString()
@property
def bitsUsed(self):
return super().bitsUsed
@property
def bytesUsed(self):
return super().bytesUsed

61
g2o/classes/sky.py Normal file
View File

@@ -0,0 +1,61 @@
import sqg2o
class SkyMeta(type):
@property
def weather(self):
return sqg2o.Sky.weather
@weather.setter
def weather(self, value):
sqg2o.Sky.weather
@property
def raining(self):
return sqg2o.Sky.raining
@raining.setter
def raining(self, value):
sqg2o.Sky.raining = value
@property
def renderLightning(self):
return sqg2o.Sky.renderLightning
@renderLightning.setter
def renderLightning(self, value):
sqg2o.Sky.renderLightning = value
@property
def windScale(self):
return sqg2o.Sky.windScale
@windScale.setter
def windScale(self, value):
sqg2o.Sky.windScale = value
@property
def dontRain(self):
return sqg2o.Sky.dontRain
@dontRain.setter
def dontRain(self, value):
sqg2o.Sky.dontRain = value
class Sky(metaclass=SkyMeta):
@staticmethod
def setRainStartTime(hour : int, minute : int):
sqg2o.Sky.setRainStartTime(hour, minute)
@staticmethod
def setRainStopTime(hour : int, minute : int):
sqg2o.Sky.setRainStopTime(hour, minute)
@staticmethod
def getRainStartTime() -> dict:
return sqg2o.Sky.getRainStartTime()
@staticmethod
def getRainStopTime() -> dict:
return sqg2o.Sky.getRainStopTime()