Endstar LUA API Documentation
Loading...
Searching...
No Matches
Player Class Reference

This class gives access to all the player specific things like inventory Checkout Game for ways to get access to the player object. More...

Public Member Functions

void SetInventorySize (Context instigator, int count)
 Set the amount of slots in the player's inventory.
 
int GetInventorySize ()
 Get the player's current inventory slot count.
 
bool PlayerHasItem (InventoryLibraryReference reference)
 Check to see if player's inventory contains an instance of an item type.
 
bool PlayerHasItem (InventoryLibraryReference reference, int quantity)
 Check to see if player's inventory contains an instance of an item type.
 
bool ConsumeItem (Context instigator, InventoryLibraryReference itemToConsume)
 Try to consume an item based on an item type. Successfully consumed items remove one from the stack count or are destroyed if not stacked.
 
bool ConsumeItem (Context instigator, InventoryLibraryReference itemToConsume, int quantity)
 Try to consume an item based on an item type. Successfully consumed items remove one from the stack count or are destroyed if not stacked.
 
Endless.Gameplay.LuaClasses.Inventory GetInventory ()
 
void ClearAllItems (Context instigator)
 Remove all items from this player's inventory.
 
void ClearAllItems (Context instigator, bool includeLockedItems)
 Remove all items from this player's inventory.
 
bool AttemptGiveItem (Context instigator, InventoryLibraryReference itemToGrant)
 Attempt to give player an item.
 
bool AttemptGiveItem (Context instigator, InventoryLibraryReference itemToGrant, int quantity)
 Attempt to give player an item.
 
bool AttemptGiveItem (Context instigator, InventoryLibraryReference itemToGrant, bool lockItem)
 Attempt to give player an item.
 
bool AttemptGiveItem (Context instigator, InventoryLibraryReference itemToGrant, bool lockItem, int stackableQuantity)
 Attempt to give player an item.
 
int GetPlayerSlot ()
 Get the player slot (runtime identifier) associated with this player.
 
string GetPlayerName ()
 Gets the player's user name! This is unreliable immediately after spawning the character, as it may take some time to populate.
 
void SetInputSettings (Context instigator, int value)
 Set the player's allowed input.
 
CharacterCosmeticProfile GetCurrentCosmeticProfile ()
 Get currently active character cosmetic profile. Returns current override or player's preferred cosmetic profile if none exists.
 
CharacterCosmeticProfile GetPlayerPreferenceCosmeticProfile ()
 Get player's preferred cosmetic profile.
 
void SetCharacterCosmeticsOverride (Context instigator, CharacterCosmeticProfile value)
 Overrides the player's preferred cosmetics.
 
void ClearCharacterCosmeticsOverride (Context instigator)
 Clear any cosmetic override on the player. Returning player to their preferred cosmetics.
 

Detailed Description

This class gives access to all the player specific things like inventory Checkout Game for ways to get access to the player object.

Member Function Documentation

◆ AttemptGiveItem() [1/4]

bool AttemptGiveItem ( Context instigator,
InventoryLibraryReference itemToGrant )

Attempt to give player an item.

Parameters
instigatorThe source context triggering this change
itemToGrantThe InventoryLibraryReference of the item type to give
Returns
True if the item was successfully added to the player's inventory

◆ AttemptGiveItem() [2/4]

bool AttemptGiveItem ( Context instigator,
InventoryLibraryReference itemToGrant,
bool lockItem )

Attempt to give player an item.

Parameters
instigatorThe source context triggering this change
itemToGrantThe InventoryLibraryReference of the item type to give
lockItemLock this item into the player's inventory
Returns
True if the item was successfully added to the player's inventory

◆ AttemptGiveItem() [3/4]

bool AttemptGiveItem ( Context instigator,
InventoryLibraryReference itemToGrant,
bool lockItem,
int stackableQuantity )

Attempt to give player an item.

Parameters
instigatorThe source context triggering this change
itemToGrantThe InventoryLibraryReference of the item type to give
lockItemLock this item into the player's inventory
stackableQuantityQuantity to give if stackable.
Returns
True if the item was successfully added to the player's inventory

◆ AttemptGiveItem() [4/4]

bool AttemptGiveItem ( Context instigator,
InventoryLibraryReference itemToGrant,
int quantity )

Attempt to give player an item.

Parameters
instigatorThe source context triggering this change
itemToGrantThe InventoryLibraryReference of the item type to give
quantityQuantity to give.
Returns
True if the item was successfully added to the player's inventory

◆ ClearAllItems() [1/2]

void ClearAllItems ( Context instigator)

Remove all items from this player's inventory.

Parameters
instigatorThe source context of this change

◆ ClearAllItems() [2/2]

void ClearAllItems ( Context instigator,
bool includeLockedItems )

Remove all items from this player's inventory.

Parameters
instigatorThe source context of this change
includeLockedItemsShould locked items be included?

◆ ClearCharacterCosmeticsOverride()

void ClearCharacterCosmeticsOverride ( Context instigator)

Clear any cosmetic override on the player. Returning player to their preferred cosmetics.

Parameters
instigatorThe source context triggering this change

◆ ConsumeItem() [1/2]

bool ConsumeItem ( Context instigator,
InventoryLibraryReference itemToConsume )

Try to consume an item based on an item type. Successfully consumed items remove one from the stack count or are destroyed if not stacked.

Parameters
instigatorThe source context triggering this change
itemToConsumeThe InventoryLibraryReference of the item type to check
Returns
True if the item was successfully consumed

◆ ConsumeItem() [2/2]

bool ConsumeItem ( Context instigator,
InventoryLibraryReference itemToConsume,
int quantity )

Try to consume an item based on an item type. Successfully consumed items remove one from the stack count or are destroyed if not stacked.

Parameters
instigatorThe source context triggering this change
itemToConsumeThe InventoryLibraryReference of the item type to check
quantityThe amount to consume
Returns
True if the item was successfully consumed

◆ GetCurrentCosmeticProfile()

CharacterCosmeticProfile GetCurrentCosmeticProfile ( )

Get currently active character cosmetic profile. Returns current override or player's preferred cosmetic profile if none exists.

Returns
CharacterCosmeticProfile

◆ GetInventory()

◆ GetInventorySize()

int GetInventorySize ( )

Get the player's current inventory slot count.

Returns
Current inventory size

◆ GetPlayerName()

string GetPlayerName ( )

Gets the player's user name! This is unreliable immediately after spawning the character, as it may take some time to populate.

Returns

◆ GetPlayerPreferenceCosmeticProfile()

CharacterCosmeticProfile GetPlayerPreferenceCosmeticProfile ( )

Get player's preferred cosmetic profile.

Returns
CharacterCosmeticProfile

◆ GetPlayerSlot()

int GetPlayerSlot ( )

Get the player slot (runtime identifier) associated with this player.

Returns
Player slot runtime identifier

◆ PlayerHasItem() [1/2]

bool PlayerHasItem ( InventoryLibraryReference reference)

Check to see if player's inventory contains an instance of an item type.

Parameters
referenceThe InventoryLibraryReference of the item type to check
Returns
True if player's inventory contains the item.

◆ PlayerHasItem() [2/2]

bool PlayerHasItem ( InventoryLibraryReference reference,
int quantity )

Check to see if player's inventory contains an instance of an item type.

Parameters
referenceThe InventoryLibraryReference of the item type to check
quantityThe quantity to check for
Returns
True if player's inventory contains the item.

◆ SetCharacterCosmeticsOverride()

void SetCharacterCosmeticsOverride ( Context instigator,
CharacterCosmeticProfile value )

Overrides the player's preferred cosmetics.

Parameters
instigatorThe source context triggering this change
valueCharacterCosmeticProfile

◆ SetInputSettings()

void SetInputSettings ( Context instigator,
int value )

Set the player's allowed input.

///

Parameters
instigatorThe source context triggering this change
valueValue as Input Settings

◆ SetInventorySize()

void SetInventorySize ( Context instigator,
int count )

Set the amount of slots in the player's inventory.

Parameters
instigatorThe source context triggering this change
countTarget inventory size (0-10)