Example #1
0
 public static WandEffect ReadWandType(this BaseWand obj, List <ClilocItemRec> properties)
 {
     return
         (Enum.GetValues(typeof(WandEffect))
          .Cast <WandEffect>()
          .FirstOrDefault(w => ClilocHelper.Contains(properties, (uint)w)));
 }
Example #2
0
        protected override void Parse()
        {
            var x = Enum.GetValues(typeof(WeaponDamageAttribute));

            foreach (var e in x)
            {
                _data.Add((WeaponDamageAttribute)e, 0);
            }

            this[WeaponDamageAttribute.PhysicalDamage] = (ClilocHelper.Contains(_lastmetatable, 1060403))
                ? ClilocHelper.GetParams(_lastmetatable, 1060403)[0]
                : 0;
            this[WeaponDamageAttribute.FireDamage] = (ClilocHelper.Contains(_lastmetatable, 1060405))
                ? ClilocHelper.GetParams(_lastmetatable, 1060405)[0]
                : 0;
            this[WeaponDamageAttribute.ColdDamage] = (ClilocHelper.Contains(_lastmetatable, 1060404))
                ? ClilocHelper.GetParams(_lastmetatable, 1060404)[0]
                : 0;
            this[WeaponDamageAttribute.PoisonDamage] = (ClilocHelper.Contains(_lastmetatable, 1060406))
                ? ClilocHelper.GetParams(_lastmetatable, 1060406)[0]
                : 0;
            this[WeaponDamageAttribute.EnergyDamage] = (ClilocHelper.Contains(_lastmetatable, 1060407))
                ? ClilocHelper.GetParams(_lastmetatable, 1060407)[0]
                : 0;
            this[WeaponDamageAttribute.ChaosDamage] = (ClilocHelper.Contains(_lastmetatable, 1072846))
                ? ClilocHelper.GetParams(_lastmetatable, 1072846)[0]
                : 0;

            base.Parse();
        }
Example #3
0
 public static LootValue ReadLootValue(this ILootValue iv, List <ClilocItemRec> properties)
 {
     return
         (Enum.GetValues(typeof(LootValue))
          .Cast <LootValue>()
          .FirstOrDefault(e => ClilocHelper.Contains(properties, (uint)e)));
 }
Example #4
0
        protected override void Parse()
        {
            var x = Enum.GetValues(typeof(ElementAttribute));

            foreach (var e in x)
            {
                _data.Add((ElementAttribute)e, 0);
            }


            this[ElementAttribute.Physical] = (ClilocHelper.GetIndex(_lastmetatable, 1060448) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1060448)[0]
                : 0;
            this[ElementAttribute.Fire] = (ClilocHelper.GetIndex(_lastmetatable, 1060447) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1060447)[0]
                : 0;
            this[ElementAttribute.Cold] = (ClilocHelper.GetIndex(_lastmetatable, 1060445) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1060445)[0]
                : 0;
            this[ElementAttribute.Poison] = (ClilocHelper.GetIndex(_lastmetatable, 1060449) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1060449)[0]
                : 0;
            this[ElementAttribute.Energy] = (ClilocHelper.GetIndex(_lastmetatable, 1060446) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1060446)[0]
                : 0;
            base.Parse();
        }
Example #5
0
 public static CraftResource ReadCraftResource(this ICraftable obj, List <ClilocItemRec> reader)
 {
     if (ClilocHelper.Contains(reader, 1053099))
     {
         var Value = ClilocHelper.GetParams(reader, 1053099)[0];
         return
             ((from object e in Enum.GetValues(typeof(CraftResource)) where Value.Equals(e) select e)
              .Cast <CraftResource>().FirstOrDefault());
     }
     return(CraftResource.Default);
 }
Example #6
0
 public static int ReadWandCharges(this BaseWand obj, List <ClilocItemRec> properties)
 {
     foreach (
         var w in
         from object w in Enum.GetValues(typeof(WandEffect))
         where ClilocHelper.Contains(properties, (uint)w)
         select w)
     {
         return(ClilocHelper.GetParams(properties, (uint)w)[0]);
     }
     return(0);
 }
Example #7
0
 public static double GetFillState(this IHasQuantity obj, List <ClilocItemRec> properties)
 {
     if (ClilocHelper.Contains(properties, 1042974)) // It's nearly empty.
     {
         return(33.33);
     }
     if (ClilocHelper.Contains(properties, 1042973)) // It's half full.
     {
         return(66.66);
     }
     return(ClilocHelper.Contains(properties, 1042972) ? 100.0 : 0.0);
 }
Example #8
0
        public static int[] ReadArcaneCharges(this IArcaneEquip obj, List <ClilocItemRec> reader)
        {
            if (!ClilocHelper.Contains(reader, 1061837))
            {
                return new[] { 0, 0 }
            }
            ;

            var Params  = ClilocHelper.GetParams(reader, 1061837);
            var charges = new int[] { Params[0], Params[1] };

            return(charges);
        }
Example #9
0
        public static int[] ReadDurability(this IDurability obj, List <ClilocItemRec> properties)
        {
            if (!ClilocHelper.Contains(properties, 1060639))
            {
                return new[] { 0, 0 }
            }
            ;

            var Params = ClilocHelper.GetParams(properties, 1060639);
            var dura   = new int[] { Params[0], Params[1] };

            return(dura);
        }
Example #10
0
        public static int[] ReadWeaponDamage(this IWeapon ic, List <ClilocItemRec> properties)
        {
            if (!ClilocHelper.Contains(properties, 1061168))
            {
                return new[] { 0, 0 }
            }
            ;

            var Params  = ClilocHelper.GetParams(properties, 1061168);
            var damages = new int[] { Params[0], Params[1] };

            return(damages);
        }
Example #11
0
        public static string ReadDescription(this Runebook rb, List <ClilocItemRec> attrib)
        {
            uint ClilocID = 0;

            switch (XConfig.Engine)
            {
            case ShardEngine.Broadsword:
                ClilocID = 1070722;
                break;

            case ShardEngine.RebirthUO:
                ClilocID = 1042971;
                break;
            }
            return(!ClilocHelper.Contains(attrib, ClilocID) ? String.Empty : ClilocHelper.GetParams(attrib, ClilocID)[0]);
        }
Example #12
0
        public static dynamic[] ReadSkillBonus(this SkillBonuses attrib, uint ClilocID, List <ClilocItemRec> properties)
        {
            var result = new dynamic[2];

            if ((ClilocHelper.GetIndex(properties, ClilocID) > -1))
            {
                var p = ClilocHelper.GetParams(properties, ClilocID);
                result[0] = (SkillName)p[0];
                result[1] = p[1];
            }
            else
            {
                result[0] = SkillName.Invalid;
                result[1] = 0.0;
            }
            return(result);
        }
Example #13
0
        protected override void Parse()
        {
            var x = Enum.GetValues(typeof(AbsorptionAttribute));

            foreach (var e in x)
            {
                _data.Add((AbsorptionAttribute)e, 0);
            }

            this[AbsorptionAttribute.KineticEater] = (ClilocHelper.GetIndex(_lastmetatable, 1113597) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113597)[0]
                : 0;
            this[AbsorptionAttribute.FireEater] = (ClilocHelper.GetIndex(_lastmetatable, 1113593) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113593)[0]
                : 0;
            this[AbsorptionAttribute.ColdEater] = (ClilocHelper.GetIndex(_lastmetatable, 1113594) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113594)[0]
                : 0;
            this[AbsorptionAttribute.PoisonEater] = (ClilocHelper.GetIndex(_lastmetatable, 1113595) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113595)[0]
                : 0;
            this[AbsorptionAttribute.EnergyEater] = (ClilocHelper.GetIndex(_lastmetatable, 1113596) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113596)[0]
                : 0;
            this[AbsorptionAttribute.DamageEater] = (ClilocHelper.GetIndex(_lastmetatable, 1113598) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113598)[0]
                : 0;
            this[AbsorptionAttribute.KineticResonance] = (ClilocHelper.GetIndex(_lastmetatable, 1113695) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113695)[0]
                : 0;
            this[AbsorptionAttribute.FireResonance] = (ClilocHelper.GetIndex(_lastmetatable, 1113691) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113691)[0]
                : 0;
            this[AbsorptionAttribute.ColdResonance] = (ClilocHelper.GetIndex(_lastmetatable, 1113692) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113692)[0]
                : 0;
            this[AbsorptionAttribute.PoisonResonance] = (ClilocHelper.GetIndex(_lastmetatable, 1113693) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113693)[0]
                : 0;
            this[AbsorptionAttribute.EnergyResonance] = (ClilocHelper.GetIndex(_lastmetatable, 1113694) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113694)[0]
                : 0;
            base.Parse();
        }
Example #14
0
 public static SkillName ReadSkillRequirements(this IWeapon obj, List <ClilocItemRec> properties)
 {
     if (ClilocHelper.Contains(properties, 1061172))
     {
         return(SkillName.Swords);
     }
     if (ClilocHelper.Contains(properties, 1061173))
     {
         return(SkillName.Macing);
     }
     if (ClilocHelper.Contains(properties, 1061174))
     {
         return(SkillName.Fencing);
     }
     if (ClilocHelper.Contains(properties, 1061175))
     {
         return(SkillName.Archery);
     }
     return(ClilocHelper.Contains(properties, 1112075) ? SkillName.Throwing : SkillName.Invalid);
 }
Example #15
0
        protected override void Parse()
        {
            var x = Enum.GetValues(typeof(ArmorAttribute));

            foreach (var e in x)
            {
                _data.Add((ArmorAttribute)e, 0);
            }

            this[ArmorAttribute.MageArmor]  = (ClilocHelper.Contains(_lastmetatable, 1060437));
            this[ArmorAttribute.SelfRepair] = (ClilocHelper.GetIndex(_lastmetatable, 1060450) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1060450)[0]
                : 0;
            this[ArmorAttribute.SoulCharge] = (ClilocHelper.GetIndex(_lastmetatable, 1113630) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1113630)[0]
                : 0;
            this[ArmorAttribute.ReactiveParalyze] = (ClilocHelper.Contains(_lastmetatable, 1112364));
            this[ArmorAttribute.LowerStatReq]     = (ClilocHelper.GetIndex(_lastmetatable, 1061170) > -1)
                ? ClilocHelper.GetParams(_lastmetatable, 1061170)[0]
                : 0;

            base.Parse();
        }
Example #16
0
        public Weapon(BaseWeapon Item, uint ContainerID)
        {
            Item.UpdateLocalizedProperties();
            Item.UpdateTextProperties();

            //General
            ID = Item.Serial.Value;
            this.ContainerID = ContainerID;
            ItemName         = Item.Tooltip.Split('|')[0];
            Splintering      = (sbyte)Item.WeaponAttributes.SplinteringWeapon;
            HLA            = (sbyte)Item.WeaponAttributes.HitLowerAttack;
            HLD            = (sbyte)Item.WeaponAttributes.HitLowerDefend;
            SC             = Item.Attributes.SpellChanneling;
            Balanced       = Item.WeaponAttributes.Balanced;
            UBWS           = Item.WeaponAttributes.UseBestSkill;
            MageWeapon     = Item.WeaponAttributes.MageWeapon * -1;
            BloodDrinker   = Item.WeaponAttributes.BloodDrinker;
            Velocity       = (sbyte)Item.WeaponAttributes.Velocity;
            BattleLust     = Item.WeaponAttributes.BattleLust;
            DI             = (sbyte)Item.Attributes.WeaponDamage;
            SSI            = (sbyte)Item.Attributes.WeaponSpeed;
            FC             = (sbyte)Item.Attributes.CastSpeed;
            FCR            = (sbyte)Item.Attributes.CastRecovery;
            SDI            = (sbyte)Item.Attributes.SpellDamage;
            RPD            = (sbyte)Item.Attributes.ReflectPhysical;
            DCI            = (sbyte)Item.Attributes.DefendChance;
            HCI            = (sbyte)Item.Attributes.AttackChance;
            STR            = (sbyte)Item.Attributes.BonusStr;
            DEX            = (sbyte)Item.Attributes.BonusDex;
            INTEL          = (sbyte)Item.Attributes.BonusInt;
            HP             = (sbyte)Item.Attributes.BonusHits;
            Stam           = (sbyte)Item.Attributes.BonusStam;
            Mana           = (sbyte)Item.Attributes.BonusMana;
            HPRegen        = (sbyte)Item.Attributes.RegenHits;
            StamRegen      = (sbyte)Item.Attributes.RegenStam;
            ManaRegen      = (sbyte)Item.Attributes.RegenMana;
            EnhancePotions = (sbyte)Item.Attributes.EnhancePotions;
            Luck           = (short)Item.Attributes.Luck;
            Brittle        = Item.Brittle;
            SkillType      = Item.RequiredSkill.ToString();
            WeaponTypeNum  = Item.ObjectType;
            HitSpell       = "none";
            HitArea        = "none";

            Handed = "";
            if (Item.ReadHandingType(Item.Properties).Equals(Layer.TwoHanded))
            {
                Handed = "Two";
            }
            else
            {
                Handed = "One";
            }

            Added = DateTime.Now;

            //abiliites
            GetTypes(typeof(BaseWeapon));
            var _testObj    = (BaseWeapon)Activator.CreateInstance(FinalType, new Serial(ID));
            var _tempType   = _testObj.ToString();
            var _tempString = _tempType.Substring(_tempType.IndexOf("\"", 1));

            WeaponType       = _tempString.Trim('\"', '\\');
            PrimaryAbility   = _testObj.PrimaryAbility.ToString();
            SecondaryAbility = _testObj.SecondaryAbility.ToString();
            Abilities        = PrimaryAbility + " " + SecondaryAbility;

            //elemental damage
            ElementalDamage = "";
            var _itemRec = Stealth.Client.GetClilocRec(Item.Serial.Value);

            if (ClilocHelper.Contains(_itemRec, 1060403))
            {
                ElementalDamage += "Physical Damage " + ClilocHelper.GetParams(_itemRec, 1060403)[0] + " ";
            }
            if (ClilocHelper.Contains(_itemRec, 1060404))
            {
                ElementalDamage += "Fire Damage " + ClilocHelper.GetParams(_itemRec, 1060404)[0] + " ";
            }
            if (ClilocHelper.Contains(_itemRec, 1060405))
            {
                ElementalDamage += "Cold Damage " + ClilocHelper.GetParams(_itemRec, 1060405)[0] + " ";
            }
            if (ClilocHelper.Contains(_itemRec, 1060406))
            {
                ElementalDamage += "Poison Damage " + ClilocHelper.GetParams(_itemRec, 1060406)[0] + " ";
            }
            if (ClilocHelper.Contains(_itemRec, 1060407))
            {
                ElementalDamage += "Energy Damage " + ClilocHelper.GetParams(_itemRec, 1060407)[0];
            }


            //hit spell
            HitSpell = "";
            if (Item.WeaponAttributes.HitFatigue > 0)
            {
                HitSpell += Item.WeaponAttributes.HitFatigue + " Hit Fatigue ";
            }
            if (Item.WeaponAttributes.HitHarm > 0)
            {
                HitSpell += Item.WeaponAttributes.HitHarm + " Hit Harm ";
            }
            if (Item.WeaponAttributes.HitDispel > 0)
            {
                HitSpell += Item.WeaponAttributes.HitDispel + " Hit Dispel ";
            }
            if (Item.WeaponAttributes.HitLightning > 0)
            {
                HitSpell += Item.WeaponAttributes.HitLightning + " Hit Lightning ";
            }
            if (Item.WeaponAttributes.HitFireball > 0)
            {
                HitSpell += Item.WeaponAttributes.HitFireball + " Hit Fireball ";
            }
            if (Item.WeaponAttributes.HitMagicArrow > 0)
            {
                HitSpell += Item.WeaponAttributes.HitMagicArrow + " Hit Magic Arrow ";
            }

            //hit area
            HitArea = "";
            if (Item.WeaponAttributes.HitFireArea > 0)
            {
                HitArea = Item.WeaponAttributes.HitFireArea + " Hit Fire Area";
            }
            if (Item.WeaponAttributes.HitColdArea > 0)
            {
                HitArea = Item.WeaponAttributes.HitColdArea + " Hit Cold Area";
            }
            if (Item.WeaponAttributes.HitPoisonArea > 0)
            {
                HitArea = Item.WeaponAttributes.HitPoisonArea + " Hit Poison Area";
            }
            if (Item.WeaponAttributes.HitEnergyArea > 0)
            {
                HitArea = Item.WeaponAttributes.HitEnergyArea + " Hit Energy Area";
            }

            //item rating
            if (RPD > 0)
            {
                Rating += (RPD / 5);
            }
            if (DI >= 0)
            {
                Rating += (DI / 5) + (DI / 10);
            }
            if (HCI > 0)
            {
                Rating += (HCI / 2) + (HCI / 3);
            }
            if (DCI > 0)
            {
                Rating += (DCI / 2) + (DCI / 3);
            }
            if (HPRegen > 0)
            {
                Rating += (HPRegen * 4);
            }
            if (ManaRegen > 0)
            {
                Rating += (ManaRegen * 4);
            }
            if (StamRegen > 0)
            {
                Rating += (StamRegen * 3);
            }
            if (INTEL > 0)
            {
                Rating += (INTEL / 2) + (INTEL / 3);
            }
            if (DEX > 0)
            {
                Rating += (DEX / 2) + (DEX / 3);
            }
            if (STR > 0)
            {
                Rating += (STR / 2) + (STR / 3);
            }
            if (HP > 0)
            {
                Rating += (HP / 2) + (HP / 3);
            }
            if (Stam > 0)
            {
                Rating += (Stam / 2) + (Stam / 3);
            }
            if (Mana > 0)
            {
                Rating += (Mana / 2) + (Mana / 3);
            }
            if (FC > 0)
            {
                Rating += (FC * 6);
            }
            if (FCR > 0)
            {
                Rating += (FCR * 6);
            }
            if (SSI > 0)
            {
                Rating += (SSI / 3) + (SSI / 10);
            }
            if (SDI > 0)
            {
                Rating += (SDI / 2);
            }
            if (Luck > 0)
            {
                Rating += (Luck / 11) + (Luck / 15);
            }
            if (EnhancePotions > 0)
            {
                Rating += (EnhancePotions / 6);
            }
        }
Example #17
0
        protected override void Parse()
        {
            var x = Enum.GetValues(typeof(WeaponAttribute));

            foreach (var e in x)
            {
                _data.Add((WeaponAttribute)e, 0);
            }

            this[WeaponAttribute.BloodDrinker] = (ClilocHelper.Contains(_lastmetatable, 1113591));
            this[WeaponAttribute.BattleLust]   = (ClilocHelper.Contains(_lastmetatable, 1113710));
            this[WeaponAttribute.Balanced]     = (ClilocHelper.Contains(_lastmetatable, 1072792));
            this[WeaponAttribute.Velocity]     = (ClilocHelper.Contains(_lastmetatable, 1072793))
                ? ClilocHelper.GetParams(_lastmetatable, 1072793)[0]
                : 0;
            this[WeaponAttribute.UseBestSkill] = (ClilocHelper.Contains(_lastmetatable, 1060400));
            this[WeaponAttribute.HitColdArea]  = (ClilocHelper.Contains(_lastmetatable, 1060416))
                ? ClilocHelper.GetParams(_lastmetatable, 1060416)[0]
                : 0;
            this[WeaponAttribute.HitDispel] = (ClilocHelper.Contains(_lastmetatable, 1060417))
                ? ClilocHelper.GetParams(_lastmetatable, 1060417)[0]
                : 0;
            this[WeaponAttribute.HitEnergyArea] = (ClilocHelper.Contains(_lastmetatable, 1060418))
                ? ClilocHelper.GetParams(_lastmetatable, 1060418)[0]
                : 0;
            this[WeaponAttribute.HitFireArea] = (ClilocHelper.Contains(_lastmetatable, 1060419))
                ? ClilocHelper.GetParams(_lastmetatable, 1060419)[0]
                : 0;
            this[WeaponAttribute.HitFireball] = (ClilocHelper.Contains(_lastmetatable, 1060420))
                ? ClilocHelper.GetParams(_lastmetatable, 1060420)[0]
                : 0;
            this[WeaponAttribute.HitHarm] = (ClilocHelper.Contains(_lastmetatable, 1060421))
                ? ClilocHelper.GetParams(_lastmetatable, 1060421)[0]
                : 0;
            this[WeaponAttribute.HitCurse] = (ClilocHelper.Contains(_lastmetatable, 1113712))
                ? ClilocHelper.GetParams(_lastmetatable, 1113712)[0]
                : 0;
            this[WeaponAttribute.HitFatigue] = (ClilocHelper.Contains(_lastmetatable, 1113700))
                ? ClilocHelper.GetParams(_lastmetatable, 1113700)[0]
                : 0;
            this[WeaponAttribute.HitManaDrain] = (ClilocHelper.Contains(_lastmetatable, 1113699))
                ? ClilocHelper.GetParams(_lastmetatable, 1113699)[0]
                : 0;
            this[WeaponAttribute.SplinteringWeapon] = (ClilocHelper.Contains(_lastmetatable, 1112857))
                ? ClilocHelper.GetParams(_lastmetatable, 1112857)[0]
                : 0;
            this[WeaponAttribute.HitLeechHits] = (ClilocHelper.Contains(_lastmetatable, 1060422))
                ? ClilocHelper.GetParams(_lastmetatable, 1060422)[0]
                : 0;
            this[WeaponAttribute.HitLightning] = (ClilocHelper.Contains(_lastmetatable, 1060423))
                ? ClilocHelper.GetParams(_lastmetatable, 1060423)[0]
                : 0;
            this[WeaponAttribute.HitLowerAttack] = (ClilocHelper.Contains(_lastmetatable, 1060424))
                ? ClilocHelper.GetParams(_lastmetatable, 1060424)[0]
                : 0;
            this[WeaponAttribute.HitLowerDefend] = (ClilocHelper.Contains(_lastmetatable, 1060425))
                ? ClilocHelper.GetParams(_lastmetatable, 1060425)[0]
                : 0;
            this[WeaponAttribute.HitMagicArrow] = (ClilocHelper.Contains(_lastmetatable, 1060426))
                ? ClilocHelper.GetParams(_lastmetatable, 1060426)[0]
                : 0;
            this[WeaponAttribute.HitLeechMana] = (ClilocHelper.Contains(_lastmetatable, 1060427))
                ? ClilocHelper.GetParams(_lastmetatable, 1060427)[0]
                : 0;
            this[WeaponAttribute.HitPhysicalArea] = (ClilocHelper.Contains(_lastmetatable, 1060428))
                ? ClilocHelper.GetParams(_lastmetatable, 1060428)[0]
                : 0;
            this[WeaponAttribute.HitPoisonArea] = (ClilocHelper.Contains(_lastmetatable, 1060429))
                ? ClilocHelper.GetParams(_lastmetatable, 1060429)[0]
                : 0;
            this[WeaponAttribute.HitLeechStam] = (ClilocHelper.Contains(_lastmetatable, 1060430))
                ? ClilocHelper.GetParams(_lastmetatable, 1060430)[0]
                : 0;
            this[WeaponAttribute.MageWeapon] = (ClilocHelper.Contains(_lastmetatable, 1060438))
                ? ClilocHelper.GetParams(_lastmetatable, 1060438)[0]
                : 0;
            this[WeaponAttribute.SelfRepair] = (ClilocHelper.Contains(_lastmetatable, 1060450))
                ? ClilocHelper.GetParams(_lastmetatable, 1060450)[0]
                : 0;


            //this[ArmorAttribute.SelfRepair] = (ClilocHelper.GetIndex(_lastmetatable, 1060450) > -1)? ClilocHelper.GetParams(_lastmetatable, 1060450)[0]: 0;

            base.Parse();
        }
Example #18
0
 public static bool ReadCursedState(this IDurability ic, List <ClilocItemRec> properties)
 {
     return(ClilocHelper.Contains(properties, 1049643));
 }
Example #19
0
 public static int ReadLowerStrRequirement(this IWeapon ic, List <ClilocItemRec> properties)
 {
     return(!ClilocHelper.Contains(properties, 1061170) ? 0 : ClilocHelper.GetParams(properties, 1061170)[0]);
 }
Example #20
0
 public static bool ReadAntiqueState(this IDurability ic, List <ClilocItemRec> properties)
 {
     return(ClilocHelper.Contains(properties, 1152714));
 }
Example #21
0
 public static bool ReadCannotRepairedState(this IDurability ic, List <ClilocItemRec> properties)
 {
     return(ClilocHelper.Contains(properties, 1151782));
 }
Example #22
0
        /// <summary>
        /// Generic Search for Item.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="Locations"></param>
        /// <param name="SubSearch"></param>
        /// <returns></returns>
        public static List <Item> Find(Type type, List <uint> Locations, bool SubSearch)
        {
            if (type == null)
            {
                return(new List <Item>());
            }
            if ((!typeof(Item).IsAssignableFrom(type)) && (!(type.IsInterface)))
            {
                return(new List <Item>());
            }

            if (Locations == null)
            {
                return(new List <Item>());
            }
            if (Locations.Count < 1)
            {
                return(new List <Item>());
            }

            try
            {
                if (!type.IsInterface)
                {
                    var tester = (Item)Activator.CreateInstance(type, new Serial(0));
                    if (tester == null)
                    {
                        return(new List <Item>());
                    }
                }
            }
            catch
            {
                return(new List <Item>());
            }

            var cattributes = type.GetCustomAttributes(false);

            var _sublist = new List <Item>();


            foreach (var attrib in cattributes)
            {
                if (attrib is QuerySearchAttribute)
                {
                    var x = (QuerySearchAttribute)attrib;

                    var xlist = Scanner.Find <Item>(x.Graphics, x.Colors, Locations, SubSearch);

                    var handle = true;

                    var labels = x.Labels;

                    labels.Remove(0);

                    if (x.Labels.Count > 0)
                    {
                        xlist  = xlist.Where(i => ClilocHelper.ContainsAny(i.Properties, x.Labels)).ToList();
                        handle = xlist.Count > 0;
                    }

                    if (handle)
                    {
                        _sublist.AddRange(xlist.Select(xo => Activator.CreateInstance(type, xo.Serial) as Item));
                    }
                }
                else if (attrib is QueryTypeAttribute)
                {
                    var x = (QueryTypeAttribute)attrib;

                    foreach (var a in x.Types)
                    {
                        var xlist = Find(a, Locations, SubSearch);
                        if (xlist.Count > 0)
                        {
                            _sublist.AddRange(xlist);
                        }
                    }
                }
            }

            var rlist = new List <Item>();

            if (_sublist.Count > 0)
            {
                rlist.AddRange(_sublist);
            }

            return(rlist.Distinct().ToList());
        }
Example #23
0
 public static bool ReadEnchantment(this IWeapon obj, List <ClilocItemRec> reader)
 {
     return(ClilocHelper.Contains(reader, 1080125));
 }
Example #24
0
 public static Layer ReadHandingType(this IWeapon ic, List <ClilocItemRec> properties)
 {
     return(ClilocHelper.Contains(properties, 1061171) ? Layer.TwoHanded : Layer.OneHanded);
 }
Example #25
0
 public static PoisonLevel ReadPoisonLevel(this IPoisonable obj, List <ClilocItemRec> reader)
 {
     return
         ((from PoisonLevel x in Enum.GetValues(typeof(PoisonLevel)) where !x.Equals(PoisonLevel.None) select x)
          .FirstOrDefault(x => ClilocHelper.Contains(reader, (uint)x)));
 }
Example #26
0
 public static int ReadWeaponRange(this IRangeWeapon ic, List <ClilocItemRec> properties)
 {
     return(!ClilocHelper.Contains(properties, 1061169) ? 1 : ClilocHelper.GetParams(properties, 1061169)[0]);
 }
Example #27
0
 public static SlayerName GetSlayer(this ISlayer obj, List <ClilocItemRec> reader, int Index = 1)
 {
     return
         ((from SlayerName x in Enum.GetValues(typeof(SlayerName)) where !x.Equals(SlayerName.None) select x)
          .FirstOrDefault(x => ClilocHelper.Contains(reader, (uint)x)));
 }
Example #28
0
 public static double ReadWeaponSpeed(this IWeapon ic, List <ClilocItemRec> properties)
 {
     return(!ClilocHelper.Contains(properties, 1061167) ? 1.0 : ClilocHelper.GetParams(properties, 1061167)[0]);
 }
Example #29
0
 public static int ReadArtifactRarity(this IArtifactRarity obj, List <ClilocItemRec> reader)
 {
     return(ClilocHelper.Contains(reader, 1061078) ? 0 : ClilocHelper.GetParams(reader, 1061078)[0]);
 }
Example #30
0
 public static bool ReadImmolation(this IWeapon obj, List <ClilocItemRec> reader)
 {
     return(ClilocHelper.Contains(reader, 1111917));
 }