Skip to content

static class ItemGround


This class represents item on the ground.
Original: 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.

Source code in src/pyg2o/classes/items.py
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
class 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):
        self._id = -1
        self._instance = ''
        self._amount = -1
        self._world = -1
        self._virtualWorld = -1
        self._position = -1
        self._rotation = -1

    def getPosition(self) -> dict:
        """
        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 self._position

    def getRotation(self) -> dict:
        """
        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 self._rotation

    async def setPosition(self, x: float, y: float, z: float):
        """
        This method will set the item ground position in the world.
        **Parameters:**
        * `float` **x**: the position in the world on the x axis.
        * `float` **y**: the position in the world on the y axis.
        * `float` **z**: the position in the world on the z axis.
        """
        data = f'return ItemsGround.getById({self.id}).setPosition({x}, {y}, {z})'

        server = await PythonWebsocketServer.get_server()
        result = await server.make_request(data)
        return result

    async def setRotation(self, x: float, y: float, z: float):
        """
        This method will set the item ground rotation in the world.
        **Parameters:**
        * `float` **x**: the rotation in the world on the x axis.
        * `float` **y**: the rotation in the world on the y axis.
        * `float` **z**: the rotation in the world on the z axis.
        """
        data = f'return ItemsGround.getById({self.id}).setRotation({x}, {y}, {z})'

        server = await PythonWebsocketServer.get_server()
        result = await server.make_request(data)
        return result

    async def get_physicsEnabled(self) -> bool:
        """
        This method will get the item ground physicsEnabled flag.
        **Returns:**
        * `bool`: ``true`` if physics is enabled, otherwise ``false``
        """
        data = f'return ItemsGround.getById({self.id}).physicsEnabled'

        server = await PythonWebsocketServer.get_server()
        result = await server.make_request(data)
        return result

    async def set_physicsEnabled(self, enabled: bool):
        """
        This method will set the item ground physicsEnabled flag.
        **Parameters:**
        * `bool` **enabled**: represents the state of physicsEnabled flag
        """
        data = f'return ItemsGround.getById({self.id}).physicsEnabled = {enabled}'

        server = await PythonWebsocketServer.get_server()
        result = await server.make_request(data)
        return result

    @property
    def id(self) -> int:
        return self._id

    @property
    def instance(self) -> str:
        return self._instance

    @property
    def amount(self) -> int:
        return self._amount

    @property
    def world(self) -> str:
        return self._world

    @property
    def virtualWorld(self) -> int:
        return self._virtualWorld

    @virtualWorld.setter
    def virtualWorld(self, value):
        self._virtualWorld = value

    def _initialize(self, **kwargs):
        self.__dict__.update(kwargs)

getPosition()

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.

Source code in src/pyg2o/classes/items.py
91
92
93
94
95
96
97
def getPosition(self) -> dict:
    """
    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 self._position

getRotation()

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.

Source code in src/pyg2o/classes/items.py
 99
100
101
102
103
104
105
def getRotation(self) -> dict:
    """
    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 self._rotation

get_physicsEnabled() async

This method will get the item ground physicsEnabled flag.
Returns:
* bool: true if physics is enabled, otherwise false

Source code in src/pyg2o/classes/items.py
135
136
137
138
139
140
141
142
143
144
145
async def get_physicsEnabled(self) -> bool:
    """
    This method will get the item ground physicsEnabled flag.
    **Returns:**
    * `bool`: ``true`` if physics is enabled, otherwise ``false``
    """
    data = f'return ItemsGround.getById({self.id}).physicsEnabled'

    server = await PythonWebsocketServer.get_server()
    result = await server.make_request(data)
    return result

setPosition(x, y, z) async

This method will set the item ground position in the world.
Parameters:
* float x: the position in the world on the x axis.
* float y: the position in the world on the y axis.
* float z: the position in the world on the z axis.

Source code in src/pyg2o/classes/items.py
107
108
109
110
111
112
113
114
115
116
117
118
119
async def setPosition(self, x: float, y: float, z: float):
    """
    This method will set the item ground position in the world.
    **Parameters:**
    * `float` **x**: the position in the world on the x axis.
    * `float` **y**: the position in the world on the y axis.
    * `float` **z**: the position in the world on the z axis.
    """
    data = f'return ItemsGround.getById({self.id}).setPosition({x}, {y}, {z})'

    server = await PythonWebsocketServer.get_server()
    result = await server.make_request(data)
    return result

setRotation(x, y, z) async

This method will set the item ground rotation in the world.
Parameters:
* float x: the rotation in the world on the x axis.
* float y: the rotation in the world on the y axis.
* float z: the rotation in the world on the z axis.

Source code in src/pyg2o/classes/items.py
121
122
123
124
125
126
127
128
129
130
131
132
133
async def setRotation(self, x: float, y: float, z: float):
    """
    This method will set the item ground rotation in the world.
    **Parameters:**
    * `float` **x**: the rotation in the world on the x axis.
    * `float` **y**: the rotation in the world on the y axis.
    * `float` **z**: the rotation in the world on the z axis.
    """
    data = f'return ItemsGround.getById({self.id}).setRotation({x}, {y}, {z})'

    server = await PythonWebsocketServer.get_server()
    result = await server.make_request(data)
    return result

set_physicsEnabled(enabled) async

This method will set the item ground physicsEnabled flag.
Parameters:
* bool enabled: represents the state of physicsEnabled flag

Source code in src/pyg2o/classes/items.py
147
148
149
150
151
152
153
154
155
156
157
async def set_physicsEnabled(self, enabled: bool):
    """
    This method will set the item ground physicsEnabled flag.
    **Parameters:**
    * `bool` **enabled**: represents the state of physicsEnabled flag
    """
    data = f'return ItemsGround.getById({self.id}).physicsEnabled = {enabled}'

    server = await PythonWebsocketServer.get_server()
    result = await server.make_request(data)
    return result