AngeliA
Search Results for

    Show / Hide Table of Contents

    Class ItemSystem

    Core system that handles item related logic

    Properties

    ItemPoolReady

    True if the system is ready to use

    Declaration
    public static bool ItemPoolReady { get; }

    ItemUnlockReady

    True if the item unlock data is loaded

    Declaration
    public static bool ItemUnlockReady { get; }

    Methods

    CanUseItem(int, Character)

    True if the item can be use by the given character

    Declaration
    public static bool CanUseItem(int id, Character target)

    ClearCombination()

    Reset the system craft combination pool

    Declaration
    public static void ClearCombination()

    DropItemFor(Entity)

    Perform an item drop the target entity when the entity is destroyed

    Declaration
    public static bool DropItemFor(Entity entity)
    Returns
    Type Description
    bool

    True if the item drop successfuly performs

    DropItemFor(int, int, int)

    Perform an item drop the target entity when the entity is destroyed

    Declaration
    public static bool DropItemFor(int sourceID, int x, int y)
    Parameters
    Type Name Description
    int sourceID

    ID of the target entity

    int x

    Position X of the item holder appears in global space

    int y

    Position Y of the item holder appears in global space

    Returns
    Type Description
    bool

    True if the item drop successfuly performs

    ForAllCombinations()

    Iterate through all crafting combination inside the pool

    Declaration
    public static IEnumerable<KeyValuePair<Int4, int>> ForAllCombinations()
    Examples
    using AngeliA;
    
    namespace AngeliaGame;
    
    public class Example {
    
    	[OnGameInitializeLater(4096)]
    	internal static void OnGameUpdate () {
    		Debug.Log("All item combinations inside this game:");
    		foreach (var com in ItemSystem.ForAllCombinations()) {
    			string name0 = ItemSystem.GetItemDisplayName(com.Key.x);
    			string name1 = ItemSystem.GetItemDisplayName(com.Key.y);
    			string name2 = ItemSystem.GetItemDisplayName(com.Key.z);
    			string name3 = ItemSystem.GetItemDisplayName(com.Key.w);
    			string nameResult = ItemSystem.GetItemDisplayName(com.Value);
    			Debug.Log($"{name0} + {name1} + {name2} + {name3} = {nameResult}");
    		}
    	}
    
    }

    GetItem(int)

    Get global single instance of the item from given ID

    Declaration
    public static Item GetItem(int id)

    GetItemDescription(int)

    Get description from the language system from the given item ID

    Declaration
    public static string GetItemDescription(int id)

    GetItemDisplayName(int)

    Get display name from the language system from the given item ID

    Declaration
    public static string GetItemDisplayName(int id)

    GetItemMaxStackCount(int)

    Get stack count limit of the given item in inventory panel

    Declaration
    public static int GetItemMaxStackCount(int id)

    GetRelatedCombinations(Int4, List<Int4>, int)

    Get all craft combination that include the given combination. This is for making a helper list for the user to know what items can they craft.

    Declaration
    public static void GetRelatedCombinations(Int4 combination, List<Int4> output, int materialCountLimit)
    Parameters
    Type Name Description
    Int4 combination

    Current combination the user putted into the crafting fields

    List<Int4> output

    The helper list data

    int materialCountLimit

    Combinations which have more source items than this number will be ignored

    GetSortedCombination(int, int, int, int)

    Sort the given combination to make it always unique no matter what order the source items are

    Declaration
    public static Int4 GetSortedCombination(int a, int b, int c, int d)
    Parameters
    Type Name Description
    int a

    Crafting source item ID

    int b

    Crafting source item ID

    int c

    Crafting source item ID

    int d

    Crafting source item ID

    Returns
    Type Description
    Int4

    Sorted combination ID

    HasItem(int)

    True if there is an item inside the system pool for the given ID

    Declaration
    public static bool HasItem(int id)

    IsEquipment(int)

    True if the given item is equipment type

    Declaration
    public static bool IsEquipment(int itemID)

    IsEquipment(int, out EquipmentType)

    True if the given item is equipment type

    Declaration
    public static bool IsEquipment(int itemID, out EquipmentType type)

    IsItemUnlocked(int)

    True if the given item is unlocked. Locked items will display as "?" in crafting UI helper menu

    Declaration
    public static bool IsItemUnlocked(int itemID)

    SetItemUnlocked(int, bool)

    Set given item into locked or unlocked. Locked items will display as "?" in crafting UI helper menu

    Declaration
    public static void SetItemUnlocked(int itemID, bool unlocked)

    SpawnItem(int, int, int, int, bool)

    Spawn an item holder entity that holds the given item.

    Declaration
    public static ItemHolder SpawnItem(int itemID, int x, int y, int count = 1, bool jump = true)
    Parameters
    Type Name Description
    int itemID

    Target item id

    int x

    Position X of the item holder in global space

    int y

    Position Y of the item holder in global space

    int count

    Count of the target item inside the item holder. This function always spawn only one item holder entity.

    bool jump

    True if the item holder entity jump up when it spawns

    Returns
    Type Description
    ItemHolder

    Instance of the item holder entity

    TryGetCombination(int, int, int, int, out int, out int, out int, out int, out int, out int)

    Get item crafting combination data of the given item ID pair

    Declaration
    public static bool TryGetCombination(int item0, int item1, int item2, int item3, out int result, out int resultCount, out int keep0, out int keep1, out int keep2, out int keep3)
    Parameters
    Type Name Description
    int item0

    Source item ID

    int item1

    Source item ID

    int item2

    Source item ID

    int item3

    Source item ID

    int result

    Result item ID that the given pair will craft into

    int resultCount

    How many result item does a single craft will get

    int keep0

    Source item ID which do not get consume after craft

    int keep1

    Source item ID which do not get consume after craft

    int keep2

    Source item ID which do not get consume after craft

    int keep3

    Source item ID which do not get consume after craft

    Returns
    Type Description
    bool

    True if it is a valid craft combination

    Back to top ๐Ÿ„๐Ÿฆโ€โฌ›๐Ÿงฆ๐Ÿˆ๐ŸŽƒ๐Ÿ’“๐ŸŒนโ˜•๐Ÿดโ€โ˜ ๏ธ๐Ÿค