Example #1
0
        /// <summary>
        ///		Counts the quantiy of the specified Item that are in the Chest.
        /// </summary>
        /// <param name="x">Chest X location in tile coords.</param>
        /// <param name="y">Chest Y location in tile coords.</param>
        /// <param name="itemType">Item name.</param>
        /// <param name="prefix">Item prefix.</param>
        /// <returns>Total Item count.</returns>
        public static int CountChestItem(int x, int y, string itemType, byte prefix = 0)
        {
            var id = ItemFunctions.GetItemIdFromName(itemType);

            if (id == null)
            {
                return(0);
            }

            return(CountChestItem(x, y, (int)id, prefix));
        }
Example #2
0
        public int IndexOf(string itemType, int prefix)
        {
            var id = ItemFunctions.GetItemIdFromName(itemType);

            if (id == null)
            {
                return(-1);
            }

            return(IndexOf((int)id, prefix));
        }
Example #3
0
        public void Set(string itemType, int stack, int prefix)
        {
            var id = ItemFunctions.GetItemIdFromName(itemType);

            if (id == null)
            {
                return;
            }

            Set((int)id, stack, prefix);
        }
Example #4
0
        /// <summary>
        ///     Puts an item into the chest at the specified coordinates.
        /// </summary>
        /// <param name="x">The X coordinate, which must be within the bounds of the world.</param>
        /// <param name="y">The Y coordinate, which must be within the bounds of the world.</param>
        /// <param name="itemType">The item type.</param>
        /// <param name="stack">The stack.</param>
        /// <param name="prefix">The prefix.</param>
        public static void PutItemIntoChest(int x, int y, string itemType, int stack = 1, byte prefix = 0)
        {
            var id = ItemFunctions.GetItemIdFromName(itemType);

            if (id == null)
            {
                //CustomQuestsPlugin.Instance.LogPrint($"Can't put item in chest. No id found for '{itemType}'.", TraceLevel.Error);
                return;
            }

            PutItemIntoChest(x, y, (int)id, stack, prefix);
        }
Example #5
0
        public override string ToString()
        {
            if (Stack > 0)
            {
                var itemName = ItemFunctions.GetItemNameFromId(Id) ?? "N/A";

                if (Prefix > 0)
                {
                    return($"{itemName} x {Stack} ({(ItemPrefix)Prefix})");
                }
                else
                {
                    return($"{itemName} x {Stack}");
                }
            }
            else
            {
                return($"Empty Slot");
            }
        }
Example #6
0
        public bool Contains(string itemType, int prefix)
        {
            var id = ItemFunctions.GetItemIdFromName(itemType);

            return(id != null?Contains((int)id, prefix) : false);
        }