Beispiel #1
0
        public static float GetMaxDurability(NWItem item)
        {
            int maxDurability = item.GetItemPropertyValueAndRemove(ItemPropertyType.MaxDurability);

            if (maxDurability <= -1)
            {
                return(item.GetLocalFloat("DURABILITY_MAX") <= 0 ? DefaultDurability : item.GetLocalFloat("DURABILITY_MAX"));
            }
            SetMaxDurability(item, maxDurability);
            return(maxDurability);
        }
Beispiel #2
0
        public static float GetMaxDurability(NWItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            int maxDurability = item.GetItemPropertyValueAndRemove((int)CustomItemPropertyType.MaxDurability);

            if (maxDurability <= -1)
            {
                return(item.GetLocalFloat("DURABILITY_MAX") <= 0 ? DefaultDurability : item.GetLocalFloat("DURABILITY_MAX"));
            }
            SetMaxDurability(item, maxDurability);
            return(maxDurability);
        }
Beispiel #3
0
        public static float GetDurability(NWItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            int durability = item.GetItemPropertyValueAndRemove(ItemPropertyType.Durability);

            if (durability <= -1)
            {
                InitializeDurability(item);
                return(item.GetLocalFloat("DURABILITY_CURRENT"));
            }

            SetDurability(item, durability);
            return(durability);
        }