public Glasses() : base(0x2FB8) { this.Weight = 2.0; this.m_AosWeaponAttributes = new AosWeaponAttributes(this); }
public GargishGlasses() : base(0x4644) { this.Layer = Layer.Helm; this.Weight = 2; this.m_AosWeaponAttributes = new AosWeaponAttributes(this); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); SaveFlag flags = (SaveFlag)reader.ReadInt(); if (GetSaveFlag(flags, SaveFlag.WeaponAttributes)) this.m_AosWeaponAttributes = new AosWeaponAttributes(this, reader); else this.m_AosWeaponAttributes = new AosWeaponAttributes(this); }
public static void ApplyAttributesTo(BaseWeapon weapon, bool playerMade, int luckChance, int attributeCount, int min, int max) { int delta; if (min > max) { delta = min; min = max; max = delta; } if (!playerMade && RandomItemGenerator.Enabled) { RandomItemGenerator.GenerateRandomItem(weapon, luckChance, attributeCount, min, max); return; } m_PlayerMade = playerMade; m_LuckChance = luckChance; AosAttributes primary = weapon.Attributes; AosWeaponAttributes secondary = weapon.WeaponAttributes; m_Props.SetAll(false); if (weapon is BaseRanged) { m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon } else { m_Props.Set(25, true); // Only bows can be Balanced m_Props.Set(26, true); // Only bows have Velocity } for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(27); if (random == -1) { break; } switch (random) { case 0: { switch (Utility.Random(5)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); break; case 4: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); break; } break; } case 1: { switch (Utility.Random(4)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); break; } break; } case 2: { switch (Utility.Random(2)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10); break; } break; } case 3: int dmgMin = primary.WeaponDamage; int dmgMax = Math.Max(dmgMin, 50); primary.WeaponDamage = 0; ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, dmgMin, dmgMax); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 10: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); break; case 11: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, Server.SkillHandlers.Imbuing.GetPropRange(weapon, AosWeaponAttribute.HitLeechHits)[1], 2); break; case 12: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); break; case 13: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); break; case 14: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, Server.SkillHandlers.Imbuing.GetPropRange(weapon, AosWeaponAttribute.HitLeechMana)[1], 2); break; case 15: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); break; case 16: ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); break; case 17: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); break; case 18: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); break; case 19: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); break; case 20: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); break; case 21: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); break; case 22: ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); break; case 23: weapon.Slayer = GetRandomSlayer(); break; case 24: ApplyElementalDamage(weapon, min, max); break; case 25: ((BaseRanged)weapon).Balanced = true; break; case 26: ApplyVelocityAttribute((BaseRanged)weapon, min, max, 2, 50, 2); break; } } }
public static void ApplyAttributesTo(BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; AosAttributes primary = weapon.Attributes; AosWeaponAttributes secondary = weapon.WeaponAttributes; m_Props.SetAll(false); if (weapon is BaseRanged) { m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon } else { m_Props.Set(25, true); // Only bows can be Balanced m_Props.Set(26, true); // Only bows have Velocity } for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(27); if (random == -1) { break; } switch (random) { case 0: { switch (Utility.Random(5)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); break; case 4: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); break; } break; } case 1: { switch (Utility.Random(4)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); break; } break; } case 2: { switch (Utility.Random(2)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10); break; } break; } case 3: ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 50); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 10: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); break; case 11: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, 50, 2); break; case 12: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); break; case 13: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); break; case 14: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, 50, 2); break; case 15: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); break; case 16: ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); break; case 17: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); break; case 18: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); break; case 19: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); break; case 20: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); break; case 21: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); break; case 22: ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); break; case 23: weapon.Slayer = GetRandomSlayer(); break; case 24: GetElementalDamages(weapon); break; case 25: BaseRanged brb = weapon as BaseRanged; brb.Balanced = true; break; case 26: BaseRanged brv = weapon as BaseRanged; brv.Velocity = (Utility.RandomMinMax(2, 50)); break; } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 12: { #region Runic Reforging m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt(); m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt(); m_ItemPower = (ItemPower)reader.ReadInt(); m_BlockRepair = reader.ReadBool(); #endregion #region Stygian Abyss m_DImodded = reader.ReadBool(); m_SearingWeapon = reader.ReadBool(); goto case 11; } case 11: { m_TimesImbued = reader.ReadInt(); #endregion goto case 10; } case 10: { m_BlessedBy = reader.ReadMobile(); m_EngravedText = reader.ReadString(); m_Slayer3 = (TalismanSlayerName)reader.ReadInt(); SetFlag flags = (SetFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SetFlag.Attributes)) { m_SetAttributes = new AosAttributes(this, reader); } else { m_SetAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SetFlag.WeaponAttributes)) { m_SetSelfRepair = (new AosWeaponAttributes(this, reader)).SelfRepair; } if (GetSaveFlag(flags, SetFlag.SkillBonuses)) { m_SetSkillBonuses = new AosSkillBonuses(this, reader); } else { m_SetSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SetFlag.Hue)) { m_SetHue = reader.ReadInt(); } if (GetSaveFlag(flags, SetFlag.LastEquipped)) { m_LastEquipped = reader.ReadBool(); } if (GetSaveFlag(flags, SetFlag.SetEquipped)) { m_SetEquipped = reader.ReadBool(); } if (GetSaveFlag(flags, SetFlag.SetSelfRepair)) { m_SetSelfRepair = reader.ReadEncodedInt(); } goto case 5; } case 9: case 8: case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadInt(); if (GetSaveFlag(flags, SaveFlag.DamageLevel)) { m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if (m_DamageLevel > WeaponDamageLevel.Vanq) { m_DamageLevel = WeaponDamageLevel.Ruin; } } if (GetSaveFlag(flags, SaveFlag.AccuracyLevel)) { m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if (m_AccuracyLevel > WeaponAccuracyLevel.Supremely) { m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } } if (GetSaveFlag(flags, SaveFlag.DurabilityLevel)) { m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if (m_DurabilityLevel > WeaponDurabilityLevel.Indestructible) { m_DurabilityLevel = WeaponDurabilityLevel.Durable; } } if (GetSaveFlag(flags, SaveFlag.Quality)) { m_Quality = (WeaponQuality)reader.ReadInt(); } else { m_Quality = WeaponQuality.Regular; } if (GetSaveFlag(flags, SaveFlag.Hits)) { m_Hits = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.MaxHits)) { m_MaxHits = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Slayer)) { m_Slayer = (SlayerName)reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Poison)) { m_Poison = Poison.Deserialize(reader); } if (GetSaveFlag(flags, SaveFlag.PoisonCharges)) { m_PoisonCharges = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { m_Crafter = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Identified)) { m_Identified = (version >= 6 || reader.ReadBool()); } if (GetSaveFlag(flags, SaveFlag.StrReq)) { m_StrReq = reader.ReadInt(); } else { m_StrReq = -1; } if (GetSaveFlag(flags, SaveFlag.DexReq)) { m_DexReq = reader.ReadInt(); } else { m_DexReq = -1; } if (GetSaveFlag(flags, SaveFlag.IntReq)) { m_IntReq = reader.ReadInt(); } else { m_IntReq = -1; } if (GetSaveFlag(flags, SaveFlag.MinDamage)) { m_MinDamage = reader.ReadInt(); } else { m_MinDamage = -1; } if (GetSaveFlag(flags, SaveFlag.MaxDamage)) { m_MaxDamage = reader.ReadInt(); } else { m_MaxDamage = -1; } if (GetSaveFlag(flags, SaveFlag.HitSound)) { m_HitSound = reader.ReadInt(); } else { m_HitSound = -1; } if (GetSaveFlag(flags, SaveFlag.MissSound)) { m_MissSound = reader.ReadInt(); } else { m_MissSound = -1; } if (GetSaveFlag(flags, SaveFlag.Speed)) { if (version < 9) { m_Speed = reader.ReadInt(); } else { m_Speed = reader.ReadFloat(); } } else { m_Speed = -1; } if (GetSaveFlag(flags, SaveFlag.MaxRange)) { m_MaxRange = reader.ReadInt(); } else { m_MaxRange = -1; } if (GetSaveFlag(flags, SaveFlag.Skill)) { m_Skill = (SkillName)reader.ReadInt(); } else { m_Skill = (SkillName)(-1); } if (GetSaveFlag(flags, SaveFlag.Type)) { m_Type = (WeaponType)reader.ReadInt(); } else { m_Type = (WeaponType)(-1); } if (GetSaveFlag(flags, SaveFlag.Animation)) { m_Animation = (WeaponAnimation)reader.ReadInt(); } else { m_Animation = (WeaponAnimation)(-1); } if (GetSaveFlag(flags, SaveFlag.Resource)) { m_Resource = (CraftResource)reader.ReadInt(); } else { m_Resource = CraftResource.Iron; } if (GetSaveFlag(flags, SaveFlag.xAttributes)) { m_AosAttributes = new AosAttributes(this, reader); } else { m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.xWeaponAttributes)) { m_AosWeaponAttributes = new AosWeaponAttributes(this, reader); } else { m_AosWeaponAttributes = new AosWeaponAttributes(this); } if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod(m_SkillMod); } if (version < 7 && m_AosWeaponAttributes.MageWeapon != 0) { m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon; } if (Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile) { m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon); ((Mobile)Parent).AddSkillMod(m_MageMod); } if (GetSaveFlag(flags, SaveFlag.PlayerConstructed)) { m_PlayerConstructed = true; } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses = new AosSkillBonuses(this, reader); } else { m_AosSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SaveFlag.Slayer2)) { m_Slayer2 = (SlayerName)reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.ElementalDamages)) { m_AosElementDamages = new AosElementAttributes(this, reader); } else { m_AosElementDamages = new AosElementAttributes(this); } if (GetSaveFlag(flags, SaveFlag.EngravedText)) { m_EngravedText = reader.ReadString(); } #region Stygian Abyss if (version > 9 && GetSaveFlag(flags, SaveFlag.xAbsorptionAttributes)) { m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader); } else { m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); } #endregion break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if (version == 0) { m_MaxRange = 1; // default } if (version < 5) { m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosElementDamages = new AosElementAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize(reader); m_PoisonCharges = reader.ReadInt(); if (m_StrReq == OldStrengthReq) { m_StrReq = -1; } if (m_DexReq == OldDexterityReq) { m_DexReq = -1; } if (m_IntReq == OldIntelligenceReq) { m_IntReq = -1; } if (m_MinDamage == OldMinDamage) { m_MinDamage = -1; } if (m_MaxDamage == OldMaxDamage) { m_MaxDamage = -1; } if (m_HitSound == OldHitSound) { m_HitSound = -1; } if (m_MissSound == OldMissSound) { m_MissSound = -1; } if (m_Speed == OldSpeed) { m_Speed = -1; } if (m_MaxRange == OldMaxRange) { m_MaxRange = -1; } if (m_Skill == OldSkill) { m_Skill = (SkillName)(-1); } if (m_Type == OldType) { m_Type = (WeaponType)(-1); } if (m_Animation == OldAnimation) { m_Animation = (WeaponAnimation)(-1); } if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod(m_SkillMod); } break; } } #region Mondain's Legacy Sets if (m_SetAttributes == null) { m_SetAttributes = new AosAttributes(this); } if (m_SetSkillBonuses == null) { m_SetSkillBonuses = new AosSkillBonuses(this); } #endregion if (Core.AOS && Parent is Mobile) { m_AosSkillBonuses.AddTo((Mobile)Parent); } int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0)) { Mobile m = (Mobile)Parent; string modName = Serial.ToString(); if (strBonus != 0) { m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero)); } if (dexBonus != 0) { m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero)); } if (intBonus != 0) { m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero)); } } if (Parent is Mobile) { ((Mobile)Parent).CheckStatTimers(); } if (m_Hits <= 0 && m_MaxHits <= 0) { m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); } if (version < 6) { m_PlayerConstructed = true; // we don't know, so, assume it's crafted } }
public override void Deserialize( GenericReader reader ) { base.Deserialize(reader); int version = reader.ReadInt(); switch( version ) { case 11: case 10: case 9: case 8: { if( version <= 9 ) { reader.ReadMobile(); reader.ReadString(); reader.ReadMobile(); } goto case 7; } case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.DamageLevel) ) { m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if( m_DamageLevel > WeaponDamageLevel.Vanq ) m_DamageLevel = WeaponDamageLevel.Ruin; } if( GetSaveFlag(flags, SaveFlag.AccuracyLevel) ) { m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if( m_AccuracyLevel > WeaponAccuracyLevel.Supremely ) m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } if( GetSaveFlag(flags, SaveFlag.DurabilityLevel) ) { m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible ) m_DurabilityLevel = WeaponDurabilityLevel.Durable; } if( GetSaveFlag(flags, SaveFlag.Quality) ) m_Quality = (WeaponQuality)reader.ReadInt(); else m_Quality = WeaponQuality.Regular; if( GetSaveFlag(flags, SaveFlag.Hits) ) m_Hits = reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.MaxHits) ) m_MaxHits = reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.Slayer) ) m_Slayer = (SlayerName)reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.Poison) ) m_Poison = Poison.Deserialize(reader); if( GetSaveFlag(flags, SaveFlag.PoisonCharges) ) m_PoisonCharges = reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.Crafter) ) m_Crafter = reader.ReadMobile(); if( GetSaveFlag(flags, SaveFlag.Identified) ) { if( version <= 10 ) m_Identified = true; else m_Identified = reader.ReadBool(); } if( GetSaveFlag(flags, SaveFlag.StrReq) ) m_StrReq = reader.ReadInt(); else m_StrReq = -1; if( GetSaveFlag(flags, SaveFlag.DexReq) ) m_DexReq = reader.ReadInt(); else m_DexReq = -1; if( GetSaveFlag(flags, SaveFlag.IntReq) ) m_IntReq = reader.ReadInt(); else m_IntReq = -1; if( GetSaveFlag(flags, SaveFlag.MinDamage) ) m_MinDamage = reader.ReadInt(); else m_MinDamage = -1; if( GetSaveFlag(flags, SaveFlag.MaxDamage) ) m_MaxDamage = reader.ReadInt(); else m_MaxDamage = -1; if( GetSaveFlag(flags, SaveFlag.HitSound) ) m_HitSound = reader.ReadInt(); else m_HitSound = -1; if( GetSaveFlag(flags, SaveFlag.MissSound) ) m_MissSound = reader.ReadInt(); else m_MissSound = -1; if( GetSaveFlag(flags, SaveFlag.Speed) ) { if( version < 9 ) m_Speed = reader.ReadInt(); else m_Speed = reader.ReadFloat(); } else m_Speed = -1; if( GetSaveFlag(flags, SaveFlag.MaxRange) ) m_MaxRange = reader.ReadInt(); else m_MaxRange = -1; if( GetSaveFlag(flags, SaveFlag.Skill) ) m_Skill = (SkillName)reader.ReadInt(); else m_Skill = (SkillName)(-1); if( GetSaveFlag(flags, SaveFlag.Type) ) m_Type = (WeaponType)reader.ReadInt(); else m_Type = (WeaponType)(-1); if( GetSaveFlag(flags, SaveFlag.Animation) ) m_Animation = (WeaponAnimation)reader.ReadInt(); else m_Animation = (WeaponAnimation)(-1); if( GetSaveFlag(flags, SaveFlag.Resource) ) m_Resource = (CraftResource)reader.ReadInt(); else m_Resource = CraftResource.Iron; if( GetSaveFlag(flags, SaveFlag.xAttributes) ) m_AosAttributes = new AosAttributes(this, reader); else m_AosAttributes = new AosAttributes(this); if( GetSaveFlag(flags, SaveFlag.xWeaponAttributes) ) m_AosWeaponAttributes = new AosWeaponAttributes(this, reader); else m_AosWeaponAttributes = new AosWeaponAttributes(this); if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod(m_SkillMod); } if( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 ) m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon; if( Core.SE && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile ) { m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon); ((Mobile)Parent).AddSkillMod(m_MageMod); } if( GetSaveFlag(flags, SaveFlag.PlayerConstructed) ) m_PlayerConstructed = true; if( GetSaveFlag(flags, SaveFlag.SkillBonuses) ) m_AosSkillBonuses = new AosSkillBonuses(this, reader); else m_AosSkillBonuses = new AosSkillBonuses(this); if( GetSaveFlag(flags, SaveFlag.Slayer2) ) m_Slayer2 = (SlayerName)reader.ReadInt(); break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if( version == 0 ) m_MaxRange = 1; // default if( version < 5 ) { m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize(reader); m_PoisonCharges = reader.ReadInt(); if( m_StrReq == OldStrengthReq ) m_StrReq = -1; if( m_DexReq == OldDexterityReq ) m_DexReq = -1; if( m_IntReq == OldIntelligenceReq ) m_IntReq = -1; if( m_MinDamage == OldMinDamage ) m_MinDamage = -1; if( m_MaxDamage == OldMaxDamage ) m_MaxDamage = -1; if( m_HitSound == OldHitSound ) m_HitSound = -1; if( m_MissSound == OldMissSound ) m_MissSound = -1; if( m_Speed == OldSpeed ) m_Speed = -1; if( m_MaxRange == OldMaxRange ) m_MaxRange = -1; if( m_Skill == OldSkill ) m_Skill = (SkillName)(-1); if( m_Type == OldType ) m_Type = (WeaponType)(-1); if( m_Animation == OldAnimation ) m_Animation = (WeaponAnimation)(-1); if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod(m_SkillMod); } break; } } if( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo((Mobile)Parent); int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) ) { Mobile m = (Mobile)this.Parent; string modName = this.Serial.ToString(); if( strBonus != 0 ) m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero)); if( dexBonus != 0 ) m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero)); if( intBonus != 0 ) m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero)); } if( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); if( m_Hits <= 0 && m_MaxHits <= 0 ) { m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); } if( version < 6 ) m_PlayerConstructed = true; // we don't know, so, assume it's crafted }
private static void ApplyAttribute( AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, int high ) { attrs[attr] = Scale( min, max, low, high ); }
public BaseWeapon( int itemID ) : base( itemID ) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses(this); // mod to randomly add sockets and socketability features to weapons. These settings will yield // 2% drop rate of socketed/socketable items // 0.1% chance of 5 sockets // 0.5% of 4 sockets // 3% chance of 3 sockets // 15% chance of 2 sockets // 50% chance of 1 socket // the remainder will be 0 socket (31.4% in this case) // uncomment the next line to prevent artifacts from being socketed // if(ArtifactRarity == 0) XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0); m_AosElementDamages = new AosElementAttributes( this ); }
public static void ApplyAttributesTo(BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; AosAttributes primary = weapon.Attributes; AosWeaponAttributes secondary = weapon.WeaponAttributes; AosElementAttributes resistances = weapon.Resistances; m_Props.SetAll(false); if (weapon is BaseRanged || weapon is BaseThrowing) { m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon } if (!(weapon is BaseRanged)) { m_Props.Set(28, true); // Solo los arcos pueden llevar la propiedad Balanced m_Props.Set(29, true); // Solo los arcos pueden llevar la propiedad Velocity } if (isRunicTool) { m_Props.Set(16, true); // Lower requirements don't spawn from runic tools } bool isRunicToolRanged = isRunicTool && weapon is BaseRanged; for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(30); if (random == -1) { break; } switch (random) { case 0: { switch (Utility.Random(5)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); break; case 4: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); break; } break; } case 1: { switch (Utility.Random(4)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); break; } break; } case 2: { switch (Utility.Random(2)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10); break; } break; } case 3: { AosAttribute attr = AosAttribute.WeaponDamage; int oldValue = primary[attr]; ApplyAttribute(primary, min, max, attr, 1, 50); if (oldValue >= primary[attr]) { primary[attr] = oldValue; i--; } break; } case 4: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, isRunicToolRanged ? 25 : 15); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, isRunicToolRanged ? 25 : 15); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, isRunicToolRanged ? 120 : 100); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 10: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); break; case 11: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, 50, 2); break; case 12: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); break; case 13: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); break; case 14: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, 50, 2); break; case 15: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); break; case 16: ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); break; case 17: ApplyAttribute(resistances, min, max, AosElementAttribute.Physical, 1, 15); break; case 18: ApplyAttribute(resistances, min, max, AosElementAttribute.Fire, 1, 15); break; case 19: ApplyAttribute(resistances, min, max, AosElementAttribute.Cold, 1, 15); break; case 20: ApplyAttribute(resistances, min, max, AosElementAttribute.Poison, 1, 15); break; case 21: ApplyAttribute(resistances, min, max, AosElementAttribute.Energy, 1, 15); break; case 22: ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); i--; break; case 23: SlayerName slayer = GetRandomSlayer(); if (weapon.Slayer == SlayerName.None) { weapon.Slayer = slayer; } else { weapon.Slayer2 = slayer; } break; case 24: AssignElementalDamage(weapon, AosElementAttribute.Fire); i--; break; case 25: AssignElementalDamage(weapon, AosElementAttribute.Cold); i--; break; case 26: AssignElementalDamage(weapon, AosElementAttribute.Poison); i--; break; case 27: AssignElementalDamage(weapon, AosElementAttribute.Energy); i--; break; case 28: ApplyAttribute(secondary, min, max, AosWeaponAttribute.Balanced, 1, 1); break; case 29: ApplyAttribute(secondary, min, max, AosWeaponAttribute.Velocity, 10, 50, 1); break; } } }
public static bool CheckMatch(VendorItem vitem, SearchCriteria searchCriteria) { if (vitem == null) { return(false); } Item item = vitem.Item; if (searchCriteria.MinPrice > -1 && vitem.Price < searchCriteria.MinPrice) { return(false); } if (searchCriteria.MaxPrice > -1 && vitem.Price > searchCriteria.MaxPrice) { return(false); } if (!String.IsNullOrEmpty(searchCriteria.SearchName)) { string name = GetItemName(item); if (name == null) { return(false); // TODO? REturn null names? } if (!CheckKeyword(searchCriteria.SearchName, item) && name.ToLower().IndexOf(searchCriteria.SearchName.ToLower()) < 0) { return(false); } } if (searchCriteria.SearchType != Layer.Invalid && searchCriteria.SearchType != item.Layer) { return(false); } if (searchCriteria.Details.Count == 0) { return(true); } foreach (SearchDetail detail in searchCriteria.Details) { object o = detail.Attribute; int value = detail.Value; if (value == 0) { value = 1; } if (o is AosAttribute) { AosAttributes attrs = RunicReforging.GetAosAttributes(item); if (attrs == null || attrs[(AosAttribute)o] < value) { return(false); } } else if (o is AosWeaponAttribute) { AosWeaponAttributes attrs = RunicReforging.GetAosWeaponAttributes(item); if ((AosWeaponAttribute)o == AosWeaponAttribute.MageWeapon) { if (attrs == null || attrs[(AosWeaponAttribute)o] == 0 || attrs[(AosWeaponAttribute)o] > Math.Max(0, 30 - value)) { return(false); } } else if (attrs == null || attrs[(AosWeaponAttribute)o] < value) { return(false); } } else if (o is AosArmorAttribute) { AosArmorAttributes attrs = RunicReforging.GetAosArmorAttributes(item); if (attrs == null || attrs[(AosArmorAttribute)o] < value) { return(false); } } else if (o is SkillName) { if (detail.Category != Category.RequiredSkill) { AosSkillBonuses skillbonuses = RunicReforging.GetAosSkillBonuses(item); if (skillbonuses != null) { bool hasSkill = false; for (int i = 0; i < 5; i++) { SkillName check; double bonus; if (skillbonuses.GetValues(i, out check, out bonus) && check == (SkillName)o && bonus >= value) { hasSkill = true; break; } } if (!hasSkill) { return(false); } } else if (item is SpecialScroll && value >= 105) { if (((SpecialScroll)item).Skill != (SkillName)o || ((SpecialScroll)item).Value < value) { return(false); } } else { return(false); } } else if (!(item is BaseWeapon) || ((BaseWeapon)item).DefSkill != (SkillName)o) { return(false); } } else if (o is SlayerName && (!(item is ISlayer) || ((((ISlayer)item).Slayer != (SlayerName)o && ((ISlayer)item).Slayer2 != (SlayerName)o)))) { return(false); } else if (o is TalismanSlayerName && (!(item is BaseTalisman) || ((BaseTalisman)item).Slayer != (TalismanSlayerName)o)) { return(false); } else if (o is AosElementAttribute) { if (item is BaseWeapon) { BaseWeapon wep = item as BaseWeapon; if (detail.Category == Category.DamageType) { int phys, fire, cold, pois, nrgy, chaos, direct; wep.GetDamageTypes(null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct); switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (phys < value) { return(false); } break; case AosElementAttribute.Fire: if (fire < value) { return(false); } break; case AosElementAttribute.Cold: if (cold < value) { return(false); } break; case AosElementAttribute.Poison: if (pois < value) { return(false); } break; case AosElementAttribute.Energy: if (nrgy < value) { return(false); } break; case AosElementAttribute.Chaos: if (chaos < value) { return(false); } break; case AosElementAttribute.Direct: if (direct < value) { return(false); } break; } } else { switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (wep.WeaponAttributes.ResistPhysicalBonus < value) { return(false); } break; case AosElementAttribute.Fire: if (wep.WeaponAttributes.ResistFireBonus < value) { return(false); } break; case AosElementAttribute.Cold: if (wep.WeaponAttributes.ResistColdBonus < value) { return(false); } break; case AosElementAttribute.Poison: if (wep.WeaponAttributes.ResistPoisonBonus < value) { return(false); } break; case AosElementAttribute.Energy: if (wep.WeaponAttributes.ResistEnergyBonus < value) { return(false); } break; } } } else if (item is BaseArmor && detail.Category == Category.Resists) { BaseArmor armor = item as BaseArmor; switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (armor.PhysicalResistance < value) { return(false); } break; case AosElementAttribute.Fire: if (armor.FireResistance < value) { return(false); } break; case AosElementAttribute.Cold: if (armor.ColdResistance < value) { return(false); } break; case AosElementAttribute.Poison: if (armor.PoisonResistance < value) { return(false); } break; case AosElementAttribute.Energy: if (armor.EnergyResistance < value) { return(false); } break; } } else if (detail.Category != Category.DamageType) { AosElementAttributes attrs = RunicReforging.GetElementalAttributes(item); if (attrs == null || attrs[(AosElementAttribute)o] < value) { return(false); } } else { return(false); } } else if (o is Misc) { switch ((Misc)o) { case Misc.ExcludeFel: break; case Misc.ElvesOnly: if (!IsElf(item)) { return(false); } break; case Misc.NotElvesOnly: if (IsElf(item)) { return(false); } break; case Misc.FactionItem: if (!(item is Server.Factions.IFactionItem)) { return(false); } break; case Misc.PromotionalToken: if (!(item is PromotionalToken)) { return(false); } break; case Misc.Cursed: if (item.LootType != LootType.Cursed) { return(false); } break; case Misc.NotCursed: if (item.LootType == LootType.Cursed) { return(false); } break; case Misc.CannotRepair: if (CheckCanRepair(item)) { return(false); } break; case Misc.NotCannotBeRepaired: if (!CheckCanRepair(item)) { return(false); } break; } } else if (o is string) { string str = o as string; if (str == "WeaponVelocity" && (!(item is BaseRanged) || ((BaseRanged)item).Velocity < value)) { return(false); } if (str == "BalancedWeapon" && (!(item is BaseRanged) || !((BaseRanged)item).Balanced)) { return(false); } if (str == "ArtifactRarity") { bool isarty = false; if (item is BaseWeapon && ((BaseWeapon)item).ArtifactRarity > value) { isarty = true; } else if (item is BaseArmor && ((BaseArmor)item).ArtifactRarity > value) { isarty = true; } else if (item is BaseClothing && ((BaseClothing)item).ArtifactRarity > value) { isarty = true; } else if (item is BaseJewel && ((BaseJewel)item).ArtifactRarity > value) { isarty = true; } else if (item is SimpleArtifact && ((SimpleArtifact)item).ArtifactRarity > value) { isarty = true; } else if (item is Artifact && ((Artifact)item).ArtifactRarity > value) { isarty = true; } if (!isarty) { return(false); } } } } return(true); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 27: case 26: m_BetaNerf = reader.ReadBool(); goto case 25; case 25: m_Components = reader.ReadStrongItemList(); goto case 24; case 24: m_NewCrafting = reader.ReadBool(); m_QualityDefense = reader.ReadInt(); goto case 23; case 23: m_HasHalo = reader.ReadBool(); goto case 22; case 22: case 21: case 20: { m_QualityDamage = reader.ReadInt(); m_QualitySpeed = reader.ReadInt(); m_QualityAccuracy = reader.ReadInt(); goto case 19; } case 19: case 18: case 17: case 16: case 15: case 14: case 13: case 12: case 11: case 10: { m_CraftersOriginalName = reader.ReadString(); goto case 9; } case 9: { m_Engraved1 = reader.ReadString(); m_Engraved2 = reader.ReadString(); m_Engraved3 = reader.ReadString(); goto case 5; } case 8: case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) ) { m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if ( m_DamageLevel > WeaponDamageLevel.Vanq ) m_DamageLevel = WeaponDamageLevel.Ruin; } if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) ) { m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely ) m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) ) { m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible ) m_DurabilityLevel = WeaponDurabilityLevel.Durable; } if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (WeaponQuality)reader.ReadInt(); else m_Quality = WeaponQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Hits ) ) m_Hits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.MaxHits ) ) m_MaxHits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Slayer ) ) m_Slayer = (SlayerName)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Poison ) ) m_Poison = Poison.Deserialize( reader ); if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) ) m_PoisonCharges = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 6 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MinDamage ) ) m_MinDamage = reader.ReadInt(); else m_MinDamage = -1; if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) ) m_MaxDamage = reader.ReadInt(); else m_MaxDamage = -1; if ( GetSaveFlag( flags, SaveFlag.HitSound ) ) m_HitSound = reader.ReadInt(); else m_HitSound = -1; if ( GetSaveFlag( flags, SaveFlag.MissSound ) ) m_MissSound = reader.ReadInt(); else m_MissSound = -1; if ( GetSaveFlag( flags, SaveFlag.Speed ) ) m_Speed = reader.ReadInt(); else m_Speed = -1; if ( GetSaveFlag( flags, SaveFlag.MaxRange ) ) m_MaxRange = reader.ReadInt(); else m_MaxRange = -1; if ( GetSaveFlag( flags, SaveFlag.Skill ) ) m_Skill = (SkillName)reader.ReadInt(); else m_Skill = (SkillName)(-1); if ( GetSaveFlag( flags, SaveFlag.Type ) ) m_Type = (WeaponType)reader.ReadInt(); else m_Type = (WeaponType)(-1); if ( GetSaveFlag( flags, SaveFlag.Animation ) ) m_Animation = (WeaponAnimation)reader.ReadInt(); else m_Animation = (WeaponAnimation)(-1); if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadInt(); else m_Resource = CraftResource.Iron; if ( GetSaveFlag( flags, SaveFlag.xAttributes ) ) m_AosAttributes = new AosAttributes( this, reader ); else m_AosAttributes = new AosAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) ) m_AosWeaponAttributes = new AosWeaponAttributes( this, reader ); else m_AosWeaponAttributes = new AosWeaponAttributes( this ); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 ); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 ) m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon; if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile ) { m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon ); ((Mobile)Parent).AddSkillMod( m_MageMod ); } if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) m_PlayerConstructed = true; if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); else m_AosSkillBonuses = new AosSkillBonuses( this ); if( GetSaveFlag( flags, SaveFlag.Slayer2 ) ) m_Slayer2 = (SlayerName)reader.ReadInt(); if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) ) m_AosElementDamages = new AosElementAttributes( this, reader ); else m_AosElementDamages = new AosElementAttributes( this ); break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if ( version == 0 ) m_MaxRange = 1; // default if ( version < 5 ) { m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosElementDamages = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize( reader ); m_PoisonCharges = reader.ReadInt(); if ( m_StrReq == OldStrengthReq ) m_StrReq = -1; if ( m_DexReq == OldDexterityReq ) m_DexReq = -1; if ( m_IntReq == OldIntelligenceReq ) m_IntReq = -1; if ( m_MinDamage == OldMinDamage ) m_MinDamage = -1; if ( m_MaxDamage == OldMaxDamage ) m_MaxDamage = -1; if ( m_HitSound == OldHitSound ) m_HitSound = -1; if ( m_MissSound == OldMissSound ) m_MissSound = -1; if ( m_Speed == OldSpeed ) m_Speed = -1; if ( m_MaxRange == OldMaxRange ) m_MaxRange = -1; if ( m_Skill == OldSkill ) m_Skill = (SkillName)(-1); if ( m_Type == OldType ) m_Type = (WeaponType)(-1); if ( m_Animation == OldAnimation ) m_Animation = (WeaponAnimation)(-1); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } break; } } if ( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) ) { Mobile m = (Mobile)this.Parent; string modName = this.Serial.ToString(); if ( strBonus != 0 ) m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) ); if ( dexBonus != 0 ) m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) ); if ( intBonus != 0 ) m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) ); } if ( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); if ( m_Hits <= 0 && m_MaxHits <= 0 ) { m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); } if( version < 15 && this is IBoneArmour ) this.Attributes.WeaponSpeed -= 4; if( version < 16 ) FixResource(); if( version < 17 ) { this.m_Speed = -1; this.m_MinDamage = -1; this.m_MaxDamage = -1; if( this.Hue == 2413 ) this.Resource = CraftResource.Copper; if( this.Hue == 2418 ) this.Resource = CraftResource.Bronze; } if( version < 18 ) this.DurabilityLevel = WeaponDurabilityLevel.Regular; if( version < 19 ) { if( this.HitPoints > 175 ) this.HitPoints = 175; if( this.MaxHitPoints > 175 ) this.MaxHitPoints = 175; } if( version < 20 ) FixBonuses(); if( version < 21 ) { if( this is IBoneArmour ) Hue = 0; else Hue = CraftResources.GetHue( this.Resource ); } if( version < 22 ) { Speed = -1; MinDamage = -1; MaxDamage = -1; } if ( version == 26 ) BetaNerf = false; }
public BaseWeapon( int itemID ) : base(itemID) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); m_Components = new List<Item>(); m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_AosElementDamages = new AosElementAttributes( this ); if( this is BaseRanged || this is AzhuranBoomerang || this is DruidStaff || this is ProphetDiviningRod || this is ClericCrook || this is QuarterStaff || this is GnarledStaff || this is SpikedClub || this is Club || this is BlackStaff ) this.Resource = CraftResource.Oak; else { this.Resource = CraftResource.Copper; this.Hue = 2413; } if( this is IBoneArmour ) this.Hue = 0; }
public ElvenGlasses() : base( 0x2FB8 ) { Weight = 2; m_AosWeaponAttributes = new AosWeaponAttributes( this ); }
public BaseWeapon(int itemID) : base(itemID) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); m_AosElementDamages = new AosElementAttributes(this); #region SA m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this ); #endregion #region Mondain's Legacy Sets m_SetAttributes = new AosAttributes(this); m_SetSkillBonuses = new AosSkillBonuses(this); #endregion ItemValue = GearScore.GetItemValue( this ); }
public ElvenGlasses() : base(0x2FB8) { Weight = 2; m_AosWeaponAttributes = new AosWeaponAttributes(this); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 8: case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) ) { m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if ( m_DamageLevel > WeaponDamageLevel.Vanq ) m_DamageLevel = WeaponDamageLevel.Ruin; } if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) ) { m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely ) m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) ) { m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible ) m_DurabilityLevel = WeaponDurabilityLevel.Durable; } if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (WeaponQuality)reader.ReadInt(); else m_Quality = WeaponQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Hits ) ) m_Hits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.MaxHits ) ) m_MaxHits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Slayer ) ) m_Slayer = (SlayerName)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Poison ) ) m_Poison = Poison.Deserialize( reader ); if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) ) m_PoisonCharges = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 6 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MinDamage ) ) m_MinDamage = reader.ReadInt(); else m_MinDamage = -1; if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) ) m_MaxDamage = reader.ReadInt(); else m_MaxDamage = -1; if ( GetSaveFlag( flags, SaveFlag.HitSound ) ) m_HitSound = reader.ReadInt(); else m_HitSound = -1; if ( GetSaveFlag( flags, SaveFlag.MissSound ) ) m_MissSound = reader.ReadInt(); else m_MissSound = -1; if ( GetSaveFlag( flags, SaveFlag.Speed ) ) m_Speed = reader.ReadInt(); else m_Speed = -1; if ( GetSaveFlag( flags, SaveFlag.MaxRange ) ) m_MaxRange = reader.ReadInt(); else m_MaxRange = -1; if ( GetSaveFlag( flags, SaveFlag.Skill ) ) m_Skill = (SkillName)reader.ReadInt(); else m_Skill = (SkillName)(-1); if ( GetSaveFlag( flags, SaveFlag.Type ) ) m_Type = (WeaponType)reader.ReadInt(); else m_Type = (WeaponType)(-1); if ( GetSaveFlag( flags, SaveFlag.Animation ) ) m_Animation = (WeaponAnimation)reader.ReadInt(); else m_Animation = (WeaponAnimation)(-1); if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadInt(); else m_Resource = CraftResource.Iron; if ( GetSaveFlag( flags, SaveFlag.xAttributes ) ) m_AosAttributes = new AosAttributes( this, reader ); else m_AosAttributes = new AosAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) ) m_AosWeaponAttributes = new AosWeaponAttributes( this, reader ); else m_AosWeaponAttributes = new AosWeaponAttributes( this ); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 ); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 ) m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon; if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile ) { m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon ); ((Mobile)Parent).AddSkillMod( m_MageMod ); } if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) m_PlayerConstructed = true; if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); else m_AosSkillBonuses = new AosSkillBonuses(this); // mod to randomly add sockets and socketability features to weapons. These settings will yield // 2% drop rate of socketed/socketable items // 0.1% chance of 5 sockets // 0.5% of 4 sockets // 3% chance of 3 sockets // 15% chance of 2 sockets // 50% chance of 1 socket // the remainder will be 0 socket (31.4% in this case) // uncomment the next line to prevent artifacts from being socketed // if(ArtifactRarity == 0) XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0); if( GetSaveFlag( flags, SaveFlag.Slayer2 ) ) m_Slayer2 = (SlayerName)reader.ReadInt(); if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) ) m_AosElementDamages = new AosElementAttributes( this, reader ); else m_AosElementDamages = new AosElementAttributes( this ); break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if ( version == 0 ) m_MaxRange = 1; // default if ( version < 5 ) { m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosElementDamages = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses(this); // mod to randomly add sockets and socketability features to weapons. These settings will yield // 2% drop rate of socketed/socketable items // 0.1% chance of 5 sockets // 0.5% of 4 sockets // 3% chance of 3 sockets // 15% chance of 2 sockets // 50% chance of 1 socket // the remainder will be 0 socket (31.4% in this case) // uncomment the next line to prevent artifacts from being socketed // if(ArtifactRarity == 0) XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize( reader ); m_PoisonCharges = reader.ReadInt(); if ( m_StrReq == OldStrengthReq ) m_StrReq = -1; if ( m_DexReq == OldDexterityReq ) m_DexReq = -1; if ( m_IntReq == OldIntelligenceReq ) m_IntReq = -1; if ( m_MinDamage == OldMinDamage ) m_MinDamage = -1; if ( m_MaxDamage == OldMaxDamage ) m_MaxDamage = -1; if ( m_HitSound == OldHitSound ) m_HitSound = -1; if ( m_MissSound == OldMissSound ) m_MissSound = -1; if ( m_Speed == OldSpeed ) m_Speed = -1; if ( m_MaxRange == OldMaxRange ) m_MaxRange = -1; if ( m_Skill == OldSkill ) m_Skill = (SkillName)(-1); if ( m_Type == OldType ) m_Type = (WeaponType)(-1); if ( m_Animation == OldAnimation ) m_Animation = (WeaponAnimation)(-1); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } break; } } if ( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) ) { Mobile m = (Mobile)this.Parent; string modName = this.Serial.ToString(); if ( strBonus != 0 ) m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) ); if ( dexBonus != 0 ) m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) ); if ( intBonus != 0 ) m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) ); } if ( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); if ( m_Hits <= 0 && m_MaxHits <= 0 ) { m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); } if ( version < 6 ) m_PlayerConstructed = true; // we don't know, so, assume it's crafted }
public static bool CheckMatch(Item item, int price, SearchCriteria searchCriteria) { if (item is CommodityDeed && ((CommodityDeed)item).Commodity != null) { item = ((CommodityDeed)item).Commodity; } if (searchCriteria.MinPrice > -1 && price < searchCriteria.MinPrice) { return(false); } if (searchCriteria.MaxPrice > -1 && price > searchCriteria.MaxPrice) { return(false); } if (!string.IsNullOrEmpty(searchCriteria.SearchName)) { string name; if (item is CommodityDeed && ((CommodityDeed)item).Commodity is ICommodity) { ICommodity commodity = (ICommodity)((CommodityDeed)item).Commodity; if (!string.IsNullOrEmpty(commodity.Description.String)) { name = commodity.Description.String; } else { name = StringList.GetString(commodity.Description.Number); } } else { name = GetItemName(item); } if (name == null) { return(false); // TODO? REturn null names? } if (!CheckKeyword(searchCriteria.SearchName, item) && name.ToLower().IndexOf(searchCriteria.SearchName.ToLower()) < 0) { return(false); } } if (searchCriteria.SearchType != Layer.Invalid && searchCriteria.SearchType != item.Layer) { return(false); } if (searchCriteria.Details.Count == 0) { return(true); } foreach (SearchDetail detail in searchCriteria.Details) { object o = detail.Attribute; int value = detail.Value; if (value == 0) { value = 1; } if (o is AosAttribute) { AosAttributes attrs = RunicReforging.GetAosAttributes(item); if (attrs == null || attrs[(AosAttribute)o] < value) { return(false); } } else if (o is AosWeaponAttribute) { AosWeaponAttributes attrs = RunicReforging.GetAosWeaponAttributes(item); if ((AosWeaponAttribute)o == AosWeaponAttribute.MageWeapon) { if (attrs == null || attrs[(AosWeaponAttribute)o] == 0 || attrs[(AosWeaponAttribute)o] > Math.Max(0, 30 - value)) { return(false); } } else if (attrs == null || attrs[(AosWeaponAttribute)o] < value) { return(false); } } else if (o is SAAbsorptionAttribute) { SAAbsorptionAttributes attrs = RunicReforging.GetSAAbsorptionAttributes(item); if (attrs == null || attrs[(SAAbsorptionAttribute)o] < value) { return(false); } } else if (o is AosArmorAttribute) { AosArmorAttributes attrs = RunicReforging.GetAosArmorAttributes(item); if (attrs == null || attrs[(AosArmorAttribute)o] < value) { return(false); } } else if (o is SkillName) { if (detail.Category != Category.RequiredSkill) { AosSkillBonuses skillbonuses = RunicReforging.GetAosSkillBonuses(item); if (skillbonuses != null) { bool hasSkill = false; for (int i = 0; i < 5; i++) { SkillName check; double bonus; if (skillbonuses.GetValues(i, out check, out bonus) && check == (SkillName)o && bonus >= value) { hasSkill = true; break; } } if (!hasSkill) { return(false); } } else if (item is SpecialScroll && value >= 105) { if (((SpecialScroll)item).Skill != (SkillName)o || ((SpecialScroll)item).Value < value) { return(false); } } else { return(false); } } else if (!(item is BaseWeapon) || ((BaseWeapon)item).DefSkill != (SkillName)o) { return(false); } } else if (!CheckSlayer(item, o)) { return(false); } else if (o is AosElementAttribute) { if (item is BaseWeapon) { BaseWeapon wep = item as BaseWeapon; if (detail.Category == Category.DamageType) { int phys, fire, cold, pois, nrgy, chaos, direct; wep.GetDamageTypes(null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct); switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (phys < value) { return(false); } break; case AosElementAttribute.Fire: if (fire < value) { return(false); } break; case AosElementAttribute.Cold: if (cold < value) { return(false); } break; case AosElementAttribute.Poison: if (pois < value) { return(false); } break; case AosElementAttribute.Energy: if (nrgy < value) { return(false); } break; case AosElementAttribute.Chaos: if (chaos < value) { return(false); } break; case AosElementAttribute.Direct: if (direct < value) { return(false); } break; } } else { switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (wep.WeaponAttributes.ResistPhysicalBonus < value) { return(false); } break; case AosElementAttribute.Fire: if (wep.WeaponAttributes.ResistFireBonus < value) { return(false); } break; case AosElementAttribute.Cold: if (wep.WeaponAttributes.ResistColdBonus < value) { return(false); } break; case AosElementAttribute.Poison: if (wep.WeaponAttributes.ResistPoisonBonus < value) { return(false); } break; case AosElementAttribute.Energy: if (wep.WeaponAttributes.ResistEnergyBonus < value) { return(false); } break; } } } else if (item is BaseArmor && detail.Category == Category.Resists) { BaseArmor armor = item as BaseArmor; switch ((AosElementAttribute)o) { case AosElementAttribute.Physical: if (armor.PhysicalResistance < value) { return(false); } break; case AosElementAttribute.Fire: if (armor.FireResistance < value) { return(false); } break; case AosElementAttribute.Cold: if (armor.ColdResistance < value) { return(false); } break; case AosElementAttribute.Poison: if (armor.PoisonResistance < value) { return(false); } break; case AosElementAttribute.Energy: if (armor.EnergyResistance < value) { return(false); } break; } } else if (detail.Category != Category.DamageType) { AosElementAttributes attrs = RunicReforging.GetElementalAttributes(item); if (attrs == null || attrs[(AosElementAttribute)o] < value) { return(false); } } else { return(false); } } else if (o is Misc) { switch ((Misc)o) { case Misc.ExcludeFel: break; case Misc.GargoyleOnly: if (!IsGargoyle(item)) { return(false); } break; case Misc.NotGargoyleOnly: if (IsGargoyle(item)) { return(false); } break; case Misc.ElvesOnly: if (!IsElf(item)) { return(false); } break; case Misc.NotElvesOnly: if (IsElf(item)) { return(false); } break; case Misc.FactionItem: return(false); case Misc.PromotionalToken: if (!(item is PromotionalToken)) { return(false); } break; case Misc.Cursed: if (item.LootType != LootType.Cursed) { return(false); } break; case Misc.NotCursed: if (item.LootType == LootType.Cursed) { return(false); } break; case Misc.CannotRepair: if (CheckCanRepair(item)) { return(false); } break; case Misc.NotCannotBeRepaired: if (!CheckCanRepair(item)) { return(false); } break; case Misc.Brittle: NegativeAttributes neg2 = RunicReforging.GetNegativeAttributes(item); if (neg2 == null || neg2.Brittle == 0) { return(false); } break; case Misc.NotBrittle: NegativeAttributes neg3 = RunicReforging.GetNegativeAttributes(item); if (neg3 != null && neg3.Brittle > 0) { return(false); } break; case Misc.Antique: NegativeAttributes neg4 = RunicReforging.GetNegativeAttributes(item); if (neg4 == null || neg4.Antique == 0) { return(false); } break; case Misc.NotAntique: NegativeAttributes neg5 = RunicReforging.GetNegativeAttributes(item); if (neg5 != null && neg5.Antique > 0) { return(false); } break; } } else if (o is string) { string str = o as string; if (str == "WeaponVelocity" && (!(item is BaseRanged) || ((BaseRanged)item).Velocity < value)) { return(false); } if (str == "SearingWeapon" && (!(item is BaseWeapon) || !((BaseWeapon)item).SearingWeapon)) { return(false); } if (str == "ArtifactRarity" && (!(item is IArtifact) || ((IArtifact)item).ArtifactRarity < value)) { return(false); } } } return(true); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); SaveFlag flags = (SaveFlag)reader.ReadInt(); switch ( version ) { case 8: { // turnned off AOS attributes goto case 7; } case 7: { goto case 6; } case 6: { goto case 5; } case 5: { if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) ) m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) ) m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) ) m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (WeaponQuality)reader.ReadInt(); else m_Quality = WeaponQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Hits ) ) m_Hits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.MaxHits ) ) m_MaxHits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Slayer ) ) m_Slayer = (SlayerName)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Poison ) ) m_Poison = Poison.Deserialize( reader ); if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) ) m_PoisonCharges = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 6 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MinDamage ) ) m_MinDamage = reader.ReadInt(); else m_MinDamage = -1; if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) ) m_MaxDamage = reader.ReadInt(); else m_MaxDamage = -1; if ( GetSaveFlag( flags, SaveFlag.HitSound ) ) m_HitSound = reader.ReadInt(); else m_HitSound = -1; if ( GetSaveFlag( flags, SaveFlag.MissSound ) ) m_MissSound = reader.ReadInt(); else m_MissSound = -1; if ( GetSaveFlag( flags, SaveFlag.Speed ) ) m_Speed = reader.ReadInt(); else m_Speed = -1; if ( GetSaveFlag( flags, SaveFlag.MaxRange ) ) m_MaxRange = reader.ReadInt(); else m_MaxRange = -1; if ( GetSaveFlag( flags, SaveFlag.Skill ) ) m_Skill = (SkillName)reader.ReadInt(); else m_Skill = (SkillName)(-1); if ( GetSaveFlag( flags, SaveFlag.Type ) ) m_Type = (WeaponType)reader.ReadInt(); else m_Type = (WeaponType)(-1); if ( GetSaveFlag( flags, SaveFlag.Animation ) ) m_Animation = (WeaponAnimation)reader.ReadInt(); else m_Animation = (WeaponAnimation)(-1); if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadInt(); else m_Resource = CraftResource.Iron; // obsolete from version 8 on if (version < 8) { AosAttributes dmy_AosAttributes; AosWeaponAttributes dmy_AosWeaponAttributes; if ( GetSaveFlag( flags, SaveFlag.xAttributes ) ) dmy_AosAttributes = new AosAttributes( this, reader ); //else //dmy_AosAttributes = new AosAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) ) dmy_AosWeaponAttributes = new AosWeaponAttributes( this, reader ); //else //dmy_AosWeaponAttributes = new AosWeaponAttributes( this ); } if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( SkillName.Tactics, true, (int)m_AccuracyLevel * 5 ); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } /*if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && Parent is Mobile ) { m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -m_AosWeaponAttributes.MageWeapon ); ((Mobile)Parent).AddSkillMod( m_MageMod ); }*/ // erl: made obsolete by PlayerCrafted in version 9 //if (version < 9) //{ //if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) //PlayerCrafted = true; //} break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if ( version == 0 ) m_MaxRange = 1; // default if ( version < 5 ) { m_Resource = CraftResource.Iron; //m_AosAttributes = new AosAttributes( this ); //m_AosWeaponAttributes = new AosWeaponAttributes( this ); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize( reader ); m_PoisonCharges = reader.ReadInt(); if ( m_StrReq == OldStrengthReq ) m_StrReq = -1; if ( m_DexReq == OldDexterityReq ) m_DexReq = -1; if ( m_IntReq == OldIntelligenceReq ) m_IntReq = -1; if ( m_MinDamage == OldMinDamage ) m_MinDamage = -1; if ( m_MaxDamage == OldMaxDamage ) m_MaxDamage = -1; if ( m_HitSound == OldHitSound ) m_HitSound = -1; if ( m_MissSound == OldMissSound ) m_MissSound = -1; if ( m_Speed == OldSpeed ) m_Speed = -1; if ( m_MaxRange == OldMaxRange ) m_MaxRange = -1; if ( m_Skill == OldSkill ) m_Skill = (SkillName)(-1); if ( m_Type == OldType ) m_Type = (WeaponType)(-1); if ( m_Animation == OldAnimation ) m_Animation = (WeaponAnimation)(-1); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( SkillName.Tactics, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } break; } } /* int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) ) { Mobile m = (Mobile)this.Parent; string modName = this.Serial.ToString(); if ( strBonus != 0 ) m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) ); if ( dexBonus != 0 ) m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) ); if ( intBonus != 0 ) m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) ); } */ if ( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); if ( m_Hits <= 0 && m_MaxHits <= 0 ) { m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); } //if ( version < 6 ) //PlayerCrafted = true; // we don't know, so, assume it's crafted }
public static void ApplyAttributesTo(BaseWeapon weapon, int attributeCount, int min, int max) { AosAttributes primary = weapon.Attributes; AosWeaponAttributes secondary = weapon.WeaponAttributes; m_Props.SetAll(false); if (weapon is BaseRanged) { m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon } for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(23); if (random == -1) { break; } switch (random) { case 0: { switch (Utility.Random(5)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); break; case 4: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); break; } break; } case 1: { switch (Utility.Random(4)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); break; } break; } case 2: { switch (Utility.Random(2)) { case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); break; case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 29, 20); break; } break; } case 3: ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 50); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 10: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); break; case 11: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, 50, 2); break; case 12: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); break; case 13: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); break; case 14: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, 50, 2); break; case 15: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); break; case 16: ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); break; case 17: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); break; case 18: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); break; case 19: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); break; case 20: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); break; case 21: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); break; case 22: ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); break; } } }
private static void ApplyAttribute( AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, int high, int scale ) { attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale; }
private static void ApplyAttribute(AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, int high) { attrs[attr] = Scale(min, max, low, high); }
public BaseWeapon( int itemID ) : base(itemID) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); }
private static void ApplyAttribute(AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, int high, int scale) { attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; }
public BaseWeapon(int itemID) : base(itemID) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); m_AosElementDamages = new AosElementAttributes(this); #region Stygian Abyss m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); #endregion #region Mondain's Legacy Sets m_SetAttributes = new AosAttributes(this); m_SetSkillBonuses = new AosSkillBonuses(this); #endregion m_AosSkillBonuses = new AosSkillBonuses(this); // Xml Spawner XmlSockets - SOF // mod to randomly add sockets and socketability features to armor. These settings will yield // 2% drop rate of socketed/socketable items // 0.1% chance of 5 sockets // 0.5% of 4 sockets // 3% chance of 3 sockets // 15% chance of 2 sockets // 50% chance of 1 socket // the remainder will be 0 socket (31.4% in this case) if(XmlSpawner.SocketsEnabled) XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0); }
public BaseWeapon( int itemID ) : base( itemID ) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_AosElementDamages = new AosElementAttributes( this ); #region GeNova: Mondain's Legacy m_SetAttributes = new AosAttributes( this ); m_SetWeaponAttributes = new AosWeaponAttributes( this ); m_SetSkillBonuses = new AosSkillBonuses( this ); m_LastEquipped = false; #endregion }