Mod Server API: Difference between revisions

From Eco - English Wiki
[unchecked revision][unchecked revision]
Salbris (talk | contribs)
Created page with "== Introduction == This page provides some tips for how to interact with the Server API when you create mod that needs to interact with the game's runtime state or behaviour. A full comprehensive list of the entire API can be found at https://docs.play.eco/api/server/index.html. == Player == The User and Player class contain references to the Player's owned objects, inventories, their stats, professions, etc. If you have a User and need to get a Player instance it's as..."
 
Salbris (talk | contribs)
Updated Player and Player Inventory sections
Line 1: Line 1:
== Introduction ==
== Introduction ==
This page provides some tips for how to interact with the Server API when you create mod that needs to interact with the game's runtime state or behaviour. A full comprehensive list of the entire API can be found at https://docs.play.eco/api/server/index.html.
This page provides some tips for how to interact with the Server API when you create mod that needs to interact with the game's runtime state or behaviour. A full comprehensive list of the entire API can be found at https://docs.play.eco/api/server/index.html.
== Player ==
== Player ==
The User and Player class contain references to the Player's owned objects, inventories, their stats, professions, etc. If you have a User and need to get a Player instance it's as simple as:
The <code>User</code> and <code>Player</code> class contain references to information about a specific player. The <code>User</code> class contains references to the player's owned objects, inventories, their stats, professions, etc. While the <code>Player</code> class has references to their location, technical server properties, player name, etc. If you have a <code>User</code> and need to get a <code>Player</code> instance it's as simple as:
 
user.Player
<nowiki>user.Player</nowiki>
Or vice-versa:
player.User


=== Accessing the Player's Inventory ===
=== Accessing the Player's Inventory ===
 
All of a player's inventory is referenced by the <code>UserInventory</code> class which is accessed by the Inventory property:
<nowiki>player.Inventory.Backpack</nowiki>
user.Inventory
The player's backpack, action bar, carried items and clothing can be accessed through this object:
user.Inventory.Backpack
user.Inventory.ActionBar
user.Inventory.Carried
user.Inventory.Clothing

Revision as of 21:40, 11 February 2022

Introduction

This page provides some tips for how to interact with the Server API when you create mod that needs to interact with the game's runtime state or behaviour. A full comprehensive list of the entire API can be found at https://docs.play.eco/api/server/index.html.

Player

The User and Player class contain references to information about a specific player. The User class contains references to the player's owned objects, inventories, their stats, professions, etc. While the Player class has references to their location, technical server properties, player name, etc. If you have a User and need to get a Player instance it's as simple as:

user.Player

Or vice-versa:

player.User

Accessing the Player's Inventory

All of a player's inventory is referenced by the UserInventory class which is accessed by the Inventory property:

user.Inventory

The player's backpack, action bar, carried items and clothing can be accessed through this object:

user.Inventory.Backpack
user.Inventory.ActionBar
user.Inventory.Carried
user.Inventory.Clothing