BaseItem
BaseItem is the class you have to extend when scripting a new custom game item.
Properties
public GameObject itemObject
This will return the GameObject instance representing the item's Archetipus in game. It's set if the item is actually present on the scene (on the ground basically). Will return null if the item is in some inventory.
public string itemArchetipus
Returns the item's archetipus instance. It's set if the item is actually present on the scene (on the ground basically). Will return null if the item is in some inventory.
public ItemPanelManager itemPanel
Returns a reference to the item's ui panel if currently open. Otherwise it will return null.
public const int ITEM_QUALITY_WORST = 0
public const int ITEM_QUALITY_POOR = 1
public const int ITEM_QUALITY_NORMAL = 2
public const int ITEM_QUALITY_GOOD = 3
public const int ITEM_QUALITY_EXCELLENT = 4
The items constant values to refer to quality levels of game items.
public string itemType
The items class, referring the custom class name to be instantiated when dealing with this item.
public string itemId
The id given to this kind of items
public string itemName
Its an alias to itemId
public string itemSpriteName
Will contain the item's sprite name as set in the json file.
public Sprite itemSprite
Will conitain the Sprite object for this item.
public string itemProxySpriteName
Will contain the proxy sprite for this item, if any.
public Sprite itemProxySprite
Will conitain the Sprite object for the proxy sprite of this item.
public string itemEffectOnEquip
Will contain the PlayerEffect to activate when the item is equipped by the player.
public string itemEffectOnUse
Will contain the PlayerEffect to activate when the item is used by the player.
public int itemExpiration
Will contain the time in game minutes before the items expires. 0 is for non expirating items.
public int creationTime
Will contain the time in game absolute minutes (absolute minutes in game time from game starting) of the moment this object was first spawned.
public string achievementsOnCraft
public string achievementsOnUse
public string achievementsOnSteal
public string achievementsOnBuy
In this properties there will be the id of any achivement to fire at the designated action, if any.
public PlayerEffectStatModifier[] effectModifiers
Effect modifiers to apply to PlayerEffects for this king of items. If any.
public BaseItemDataExtra[] extras
Will contain the initialization values for custom class properties defined by the user in the custom class extending the Base class.
public int maxStackable
Will contain the max number of items that can be stacked in a inventory slot.
public float itemInteractionDistance
The distance at which this item can be interacted with.
public List<QuestItem> itemsLeftOnUse
Will contain items spawned by the using of this item.
public float quality
Will contain the quality value of this item
public string rootItemPath
Will contain the physical path to the Sprites folder in the local machine.
public bool Expirated
Returns if the item is expirated or not.
Public Methods
public virtual Dictionary<string, string> GetStatsAsDictionary()
This will return a Dictionary containing every stat and value of the item. Useful for displaying ui purposes.
public void SpawnObject(Vector2 itemPosition, float radiusOfSpawnFromOwner = 1.5f)
This will spawn the item's gameobject to the floor.
public void DisposeObject()
Disposes of the object into nothingness.
public string GetQualityLabel()
Gets the item quality in a verbose manner.
public virtual void PrimaryAction(PlayerManager playerManager)
This is called when the primary action (LMouse) is used on the item. Defaults to opening the item panel and it should not need to be overridden.
public virtual void SecondaryAction(PlayerManager playerManager)
This is called when the player clicks with the secondary action button on the item. It can be implemented or not as the modder sees fit. It defaults to picking up the item. Most of the times it should not be overridden.
public virtual void PickupItem(PlayerManager playerManager)
This is called to pick up an item to the player's inventory. Most of the times it should not be overridden unless you don't want to script an item that performs some action on pickup (a poisoned item maybe?).
public virtual void DropItem()
Drop the item to the floor from whatever inventory is it in.
public virtual void UseItem(PlayerManager playerManager)
This is expected to be overridden most of the times. It manages what happens when a user uses an item.
It defaults to putting the item in the user equip inventory:
public virtual void UseItem(PlayerManager playerManager) { Utilities.UnlockAchievements(playerManager, achievementsOnUse); InventoryTransferService.TransferItem(this, playerManager.equipInventory, this.inventoryContext); }
public virtual void OpenItemPanel(PlayerManager playerManager)
Opens the item panel.
public virtual void DisposeItemPanel()
Disposes of the item panel.
public string GetExpirationLabel()
Gets a readable, localized string representation of the countdown representing the expiration time.
public void Expirate()
May be overridden to make occur any action during expiration of the item (an explosion?).
public void DisposeItem()
Disposes of the item into nothingness.
public PlayerEffect GetEffectOnUse(bool replaceId = false)
Gets the PlayerEffect associated with the use action of the item. Can replace the effect id with the one of the item. Useful for displaying purposes.
public PlayerEffect GetEffectOnEquip(bool replaceId = false)
Gets the PlayerEffect associated with the equip action of the item. Can replace the effect id with the one of the item. Useful for displaying purposes.
public virtual BaseItem Duplicate()
Returns a duplicate of this item.
public virtual BaseInventory ReturnInventory()
If the item contains an inventory (like a container) this function must be overriddem returning the proper inventory.
public float GetEffectModifier(string statId)
TODO