public ArmourBackpack() : base(0xE75) { Layer = Layer.Backpack; Weight = 3.0; m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); }
public BaseJewel( int itemID, Layer layer ) : base(itemID) { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_Resource = CraftResource.Iron; m_GemType = GemType.None; Layer = layer; }
public BaseOtherEquipable( int itemID ) : base(itemID) { m_Quality = CraftQuality.Regular; Resource = DefaultResource; m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_OriginalWeight = Weight; }
public BaseJewel( int itemID, Layer layer ) : base(itemID) { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_Resource = CraftResource.Iron; m_GemType = GemType.None; Layer = layer; m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); }
public BaseArmor( int itemID ) : base(itemID) { m_Quality = CraftQuality.Regular; m_Durability = DurabilityLevel.Regular; m_Crafter = null; m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); this.Layer = (Layer)ItemData.Quality; m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); }
public BaseJewel(int itemID, Layer layer, JewelEffect effect, int minCharges, int maxCharges) : base(itemID) { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_Resource = CraftResource.Iron; m_GemType = GemType.None; m_IDList = new List<Mobile>(); Layer = layer; Weight = 1.0; Effect = effect; Charges = Utility.RandomMinMax( minCharges, maxCharges ); m_Identified = false; }
public BaseClothing(int itemID, Layer layer, int hue) : base(itemID) { this.Layer = layer; this.Hue = hue; this.m_Resource = this.DefaultResource; this.m_Quality = ClothingQuality.Regular; this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.m_AosAttributes = new AosAttributes(this); this.m_AosClothingAttributes = new AosArmorAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); this.m_AosResistances = new AosElementAttributes(this); }
public BaseArmor(int itemID) : base(itemID) { this.m_Quality = ArmorQuality.Regular; this.m_Durability = ArmorDurabilityLevel.Regular; this.m_Crafter = null; this.m_Resource = this.DefaultResource; this.Hue = CraftResources.GetHue(this.m_Resource); this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.Layer = (Layer)this.ItemData.Quality; this.m_AosAttributes = new AosAttributes(this); this.m_AosArmorAttributes = new AosArmorAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); if (!(this is TomeOfEnlightenment || this is TomeOfLostKnowledge)) { LootType = LootType.Blessed; } int version = reader.ReadInt(); switch (version) { case 3: { m_Crafter_Name = reader.ReadString(); m_Crafter = reader.ReadMobile(); m_Quality = (SpellbookQuality)reader.ReadEncodedInt(); goto case 2; } case 2: { m_Slayer = (SlayerName)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); if (this is TomeOfEnlightenment) { Attributes.BonusInt = 5; Attributes.SpellDamage = 10; Attributes.CastSpeed = 1; } else if (this is TomeOfLostKnowledge) { SkillBonuses.SetValues(0, SkillName.Magery, 15.0); Attributes.BonusInt = 8; Attributes.SpellDamage = 15; Attributes.LowerManaCost = 15; } else { FixAttributes(); } goto case 0; } case 0: { m_Content = reader.ReadULong(); m_Count = reader.ReadInt(); break; } } if (m_AosAttributes == null) { m_AosAttributes = new AosAttributes(this); } if (m_AosSkillBonuses == null) { m_AosSkillBonuses = new AosSkillBonuses(this); } 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(); } }
// Version 5 (pre-codegen) private void Deserialize(IGenericReader reader, int version) { var flags = (OldSaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, OldSaveFlag.Resource)) { _rawResource = (CraftResource)reader.ReadEncodedInt(); } else { _rawResource = DefaultResource; } Attributes = new AosAttributes(this); if (GetSaveFlag(flags, OldSaveFlag.Attributes)) { Attributes.Deserialize(reader); } ClothingAttributes = new AosArmorAttributes(this); if (GetSaveFlag(flags, OldSaveFlag.ClothingAttributes)) { ClothingAttributes.Deserialize(reader); } SkillBonuses = new AosSkillBonuses(this); if (GetSaveFlag(flags, OldSaveFlag.SkillBonuses)) { SkillBonuses.Deserialize(reader); } Resistances = new AosElementAttributes(this); if (GetSaveFlag(flags, OldSaveFlag.Resistances)) { Resistances.Deserialize(reader); } if (GetSaveFlag(flags, OldSaveFlag.MaxHitPoints)) { _maxHitPoints = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.HitPoints)) { _hitPoints = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.Crafter)) { var crafter = reader.ReadEntity <Mobile>(); Timer.StartTimer(() => _crafter = crafter?.RawName); } if (GetSaveFlag(flags, OldSaveFlag.Quality)) { _quality = (ClothingQuality)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.StrReq)) { _strReq = reader.ReadEncodedInt(); } PlayerConstructed = GetSaveFlag(flags, OldSaveFlag.PlayerConstructed); }
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 override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 1: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Attributes)) { m_AosAttributes = new AosAttributes(this, reader); } else { m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.ArmorAttributes)) { m_AosArmorAttributes = new AosArmorAttributes(this, reader); } else { m_AosArmorAttributes = new AosArmorAttributes(this); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { m_Crafter = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Quality)) { m_Quality = (CraftQuality)reader.ReadEncodedInt(); } else { m_Quality = CraftQuality.Regular; } if (GetSaveFlag(flags, SaveFlag.Resource)) { m_Resource = (CraftResource)reader.ReadEncodedInt(); } else { m_Resource = DefaultResource; } if (m_Resource == CraftResource.None) { m_Resource = DefaultResource; } if (GetSaveFlag(flags, SaveFlag.StrReq)) { m_StrReq = reader.ReadEncodedInt(); } else { m_StrReq = -1; } if (GetSaveFlag(flags, SaveFlag.DexReq)) { m_DexReq = reader.ReadEncodedInt(); } else { m_DexReq = -1; } if (GetSaveFlag(flags, SaveFlag.IntReq)) { m_IntReq = reader.ReadEncodedInt(); } else { m_IntReq = -1; } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses = new AosSkillBonuses(this, reader); } if (GetSaveFlag(flags, SaveFlag.PlayerConstructed)) { m_PlayerConstructed = true; } if (GetSaveFlag(flags, SaveFlag.BonusRandomAttributes)) { m_BonusRandomAttributes = new BonusAttribute[reader.ReadInt()]; for (int i = 0; i < m_BonusRandomAttributes.Length; i++) { m_BonusRandomAttributes[i] = new BonusAttribute(reader); } } break; } case 0: { m_InheritsItem = true; m_OldVersion = version; m_AosAttributes = new AosAttributes(this); m_AosArmorAttributes = new AosArmorAttributes(this); m_Quality = CraftQuality.Regular; m_Resource = DefaultResource; m_PlayerConstructed = true; break; } } if (m_AosSkillBonuses == null) { m_AosSkillBonuses = new AosSkillBonuses(this); } if (Core.AOS && Parent is Mobile) { m_AosSkillBonuses.AddTo((Mobile)Parent); } if (Parent is Mobile) { ((Mobile)Parent).CheckStatTimers(); } }
public static void ApplyAttributesTo(Spellbook spellbook, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; AosAttributes primary = spellbook.Attributes; AosSkillBonuses skills = spellbook.SkillBonuses; m_Props.SetAll(false); for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(16); if (random == -1) { break; } switch (random) { case 0: case 1: case 2: case 3: { ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); for (int j = 0; j < 4; ++j) { m_Props.Set(j, true); } break; } case 4: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 3); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); break; case 8: ApplySkillBonus(skills, min, max, 0, 1, 15); break; case 9: ApplySkillBonus(skills, min, max, 1, 1, 15); break; case 10: ApplySkillBonus(skills, min, max, 2, 1, 15); break; case 11: ApplySkillBonus(skills, min, max, 3, 1, 15); break; case 12: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break; case 13: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break; case 14: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break; case 15: spellbook.Slayer = GetRandomSlayer(); break; } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 5: { m_Quality = (BookQuality)reader.ReadByte(); goto case 4; } case 4: { m_EngravedText = reader.ReadString(); goto case 3; } case 3: { m_Crafter = reader.ReadMobile(); goto case 2; } case 2: { m_Slayer = (SlayerName)reader.ReadInt(); m_Slayer2 = (SlayerName)reader.ReadInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); goto case 0; } case 0: { m_Content = reader.ReadULong(); m_Count = reader.ReadInt(); break; } } if (m_AosAttributes == null) { m_AosAttributes = new AosAttributes(this); } if (m_AosSkillBonuses == null) { m_AosSkillBonuses = new AosSkillBonuses(this); } 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(); } }
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 GetProperties(ObjectPropertyList list) { base.GetProperties(list); if (this.Blessed) { if (this.BlessedFor != null) { list.Add(1072304, !String.IsNullOrEmpty(this.BlessedFor.Name) ? this.BlessedFor.Name : "Unnamed Warrior"); // Owned by ~1_name~ } else { list.Add(1072304, "Nobody"); // Owned by ~1_name~ } } if (this.Parent is Mobile && this.m_MaxChargeTime > 0) { if (this.m_ChargeTime > 0) { list.Add(1074884, this.m_ChargeTime.ToString()); // Charge time left: ~1_val~ } else { list.Add(1074883); // Fully Charged } } list.Add(1075085); // Requirement: Mondain's Legacy if (this.m_Killer != null && !this.m_Killer.IsEmpty && this.m_Killer.Amount > 0) { list.Add(1072388, "{0}\t{1}", this.m_Killer.Name != null ? this.m_Killer.Name.ToString() : "Unknown", this.m_Killer.Amount); // ~1_NAME~ Killer: +~2_val~% } if (this.m_Protection != null && !this.m_Protection.IsEmpty && this.m_Protection.Amount > 0) { list.Add(1072387, "{0}\t{1}", this.m_Protection.Name != null ? this.m_Protection.Name.ToString() : "Unknown", this.m_Protection.Amount); // ~1_NAME~ Protection: +~2_val~% } if (this.m_ExceptionalBonus != 0) { list.Add(1072395, "#{0}\t{1}", AosSkillBonuses.GetLabel(this.m_Skill), this.m_ExceptionalBonus); // ~1_NAME~ Exceptional Bonus: ~2_val~% } if (this.m_SuccessBonus != 0) { list.Add(1072394, "#{0}\t{1}", AosSkillBonuses.GetLabel(this.m_Skill), this.m_SuccessBonus); // ~1_NAME~ Bonus: ~2_val~% } this.m_AosSkillBonuses.GetProperties(list); int prop; if ((prop = this.m_AosAttributes.WeaponDamage) != 0) { list.Add(1060401, prop.ToString()); // damage increase ~1_val~% } if ((prop = this.m_AosAttributes.DefendChance) != 0) { list.Add(1060408, prop.ToString()); // defense chance increase ~1_val~% } if ((prop = this.m_AosAttributes.BonusDex) != 0) { list.Add(1060409, prop.ToString()); // dexterity bonus ~1_val~ } if ((prop = this.m_AosAttributes.EnhancePotions) != 0) { list.Add(1060411, prop.ToString()); // enhance potions ~1_val~% } if ((prop = this.m_AosAttributes.CastRecovery) != 0) { list.Add(1060412, prop.ToString()); // faster cast recovery ~1_val~ } if ((prop = this.m_AosAttributes.CastSpeed) != 0) { list.Add(1060413, prop.ToString()); // faster casting ~1_val~ } if ((prop = this.m_AosAttributes.AttackChance) != 0) { list.Add(1060415, prop.ToString()); // hit chance increase ~1_val~% } if ((prop = this.m_AosAttributes.BonusHits) != 0) { list.Add(1060431, prop.ToString()); // hit point increase ~1_val~ } if ((prop = this.m_AosAttributes.BonusInt) != 0) { list.Add(1060432, prop.ToString()); // intelligence bonus ~1_val~ } if ((prop = this.m_AosAttributes.LowerManaCost) != 0) { list.Add(1060433, prop.ToString()); // lower mana cost ~1_val~% } if ((prop = this.m_AosAttributes.LowerRegCost) != 0) { list.Add(1060434, prop.ToString()); // lower reagent cost ~1_val~% } if ((prop = this.m_AosAttributes.Luck) != 0) { list.Add(1060436, prop.ToString()); // luck ~1_val~ } if ((prop = this.m_AosAttributes.BonusMana) != 0) { list.Add(1060439, prop.ToString()); // mana increase ~1_val~ } if ((prop = this.m_AosAttributes.RegenMana) != 0) { list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~ } if ((prop = this.m_AosAttributes.NightSight) != 0) { list.Add(1060441); // night sight } if ((prop = this.m_AosAttributes.ReflectPhysical) != 0) { list.Add(1060442, prop.ToString()); // reflect physical damage ~1_val~% } if ((prop = this.m_AosAttributes.RegenStam) != 0) { list.Add(1060443, prop.ToString()); // stamina regeneration ~1_val~ } if ((prop = this.m_AosAttributes.RegenHits) != 0) { list.Add(1060444, prop.ToString()); // hit point regeneration ~1_val~ } if ((prop = this.m_AosAttributes.SpellChanneling) != 0) { list.Add(1060482); // spell channeling } if ((prop = this.m_AosAttributes.SpellDamage) != 0) { list.Add(1060483, prop.ToString()); // spell damage increase ~1_val~% } if ((prop = this.m_AosAttributes.BonusStam) != 0) { list.Add(1060484, prop.ToString()); // stamina increase ~1_val~ } if ((prop = this.m_AosAttributes.BonusStr) != 0) { list.Add(1060485, prop.ToString()); // strength bonus ~1_val~ } if ((prop = this.m_AosAttributes.WeaponSpeed) != 0) { list.Add(1060486, prop.ToString()); // swing speed increase ~1_val~% } if (Core.ML && (prop = this.m_AosAttributes.IncreasedKarmaLoss) != 0) { list.Add(1075210, prop.ToString()); // Increased Karma Loss ~1val~% } if (this.m_MaxCharges > 0) { list.Add(1060741, this.m_Charges.ToString()); // charges: ~1_val~ } if (this.m_Slayer != TalismanSlayerName.None) { if (this.m_Slayer == TalismanSlayerName.Wolf) { list.Add(1075462); } else if (this.m_Slayer == TalismanSlayerName.Goblin) { list.Add(1095010); } else if (this.m_Slayer == TalismanSlayerName.Undead) { list.Add(1060479); } else { list.Add(1072503 + (int)this.m_Slayer); } } }
public virtual string GetNameLocalized() => $"#{AosSkillBonuses.GetLabel(Skill)}";
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 3: { m_MaxHitPoints = reader.ReadEncodedInt(); m_HitPoints = reader.ReadEncodedInt(); goto case 2; } case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosResistances = new AosElementAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); 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(); } break; } case 0: { m_AosAttributes = new AosAttributes(this); m_AosResistances = new AosElementAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); 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) // 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); // Xml Spawner XmlSockets - EOF break; } } if (version < 2) { m_Resource = CraftResource.Iron; m_GemType = GemType.None; } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 4: m_PlayerConstructed = reader.ReadBool(); m_LowerStatReq = reader.ReadInt(); goto case 3; case 3: m_UsesRemaining = reader.ReadInt(); m_ShowUsesRemaining = reader.ReadBool(); goto case 2; case 2: m_OriginalHue = reader.ReadInt(); int idx = reader.ReadInt(); m_BaitType = FishInfo.GetTypeFromIndex(idx); m_HookType = (HookType)reader.ReadInt(); m_HookUses = reader.ReadInt(); m_BaitUses = reader.ReadInt(); m_EnhancedBait = reader.ReadBool(); SaveFlag flags = (SaveFlag)reader.ReadInt(); if (GetSaveFlag(flags, SaveFlag.xAttributes)) { m_AosAttributes = new AosAttributes(this, reader); } else { m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses = new AosSkillBonuses(this, reader); } else { m_AosSkillBonuses = new AosSkillBonuses(this); } break; case 1: m_AosAttributes = new AosAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); break; } if (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_BaitType != null && m_BaitUses <= 0) { BaitType = null; } if (m_HookType != HookType.None && m_HookUses <= 0) { HookType = HookType.None; } if (version < 3 && m_Crafter != null) { m_PlayerConstructed = true; if (m_Resource == CraftResource.None) { Resource = CraftResource.RegularWood; } else { DistributeMaterialBonus(); } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 2: IsArrowAmmo = reader.ReadBool(); goto case 1; case 1: { if (version == 1) { IsArrowAmmo = (Ammo == null || Ammo is Arrow); } m_AosSkillBonuses = new AosSkillBonuses(this, reader); m_Resistances = new AosElementAttributes(this, reader); goto case 0; } case 0: { if (version == 0) { m_AosSkillBonuses = new AosSkillBonuses(this); m_Resistances = new AosElementAttributes(this); } SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Attributes)) { this.m_Attributes = new AosAttributes(this, reader); } else { this.m_Attributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.LowerAmmoCost)) { this.m_LowerAmmoCost = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.WeightReduction)) { this.m_WeightReduction = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.DamageIncrease)) { this.m_DamageIncrease = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { this.m_Crafter = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Quality)) { this.m_Quality = (ClothingQuality)reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Capacity)) { this.m_Capacity = reader.ReadInt(); } #region Mondain's Legacy Sets if (GetSaveFlag(flags, SaveFlag.SetAttributes)) { this.m_SetAttributes = new AosAttributes(this, reader); } else { this.m_SetAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SetSkillAttributes)) { this.m_SetSkillBonuses = new AosSkillBonuses(this, reader); } else { this.m_SetSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SaveFlag.SetHue)) { this.m_SetHue = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.LastEquipped)) { this.m_LastEquipped = reader.ReadBool(); } if (GetSaveFlag(flags, SaveFlag.SetEquipped)) { this.m_SetEquipped = reader.ReadBool(); } #endregion break; } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Attributes)) { m_AosAttributes = new AosAttributes(this, reader); } else { m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses = new AosSkillBonuses(this, reader); } if (GetSaveFlag(flags, SaveFlag.Owner)) { m_Owner = reader.ReadMobile(); } m_Protection = new TalismanAttribute(); if (GetSaveFlag(flags, SaveFlag.Protection)) { m_Protection.Deserialize(reader); } else { m_Protection = null; } m_Killer = new TalismanAttribute(); if (GetSaveFlag(flags, SaveFlag.Killer)) { m_Killer.Deserialize(reader); } else { m_Killer = null; } m_Summoner = new TalismanAttribute(); if (GetSaveFlag(flags, SaveFlag.Summoner)) { m_Summoner.Deserialize(reader); } else { m_Summoner = null; } if (GetSaveFlag(flags, SaveFlag.Removal)) { m_Removal = (TalismanRemoval)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.KarmaLoss)) { m_KarmaLoss = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Skill)) { m_Skill = (SkillName)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.SuccessBonus)) { m_SuccessBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.ExceptionalBonus)) { m_ExceptionalBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.MaxCharges)) { m_MaxCharges = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Charges)) { m_Charges = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.MaxChargeTime)) { m_MaxChargeTime = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.ChargeTime)) { m_ChargeTime = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Slayer)) { m_Slayer = (TalismanSlayerName)reader.ReadEncodedInt(); } m_Blessed = GetSaveFlag(flags, SaveFlag.Blessed); break; } } if (Parent is Mobile && ChargeTime > 0) { StartTimer(); } if (m_AosSkillBonuses == null) { m_AosSkillBonuses = new AosSkillBonuses(this); } 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(); } }
public void DrawSkill() { for (int i = 0; i < m_CraftItem.Skills.Count; i++) { CraftSkill skill = m_CraftItem.Skills.GetAt(i); double minSkill = skill.MinSkill, maxSkill = skill.MaxSkill; if (minSkill < 0) { minSkill = 0; } string textminSkills = "Débutant"; if (minSkill >= 30 && minSkill < 40) { textminSkills = "Néophite"; } else if (minSkill >= 40 && minSkill < 50) { textminSkills = "Novice"; } else if (minSkill >= 50 && minSkill < 60) { textminSkills = "Apprenti"; } else if (minSkill >= 60 && minSkill < 70) { textminSkills = "Compagnon"; } else if (minSkill >= 70 && minSkill < 80) { textminSkills = "Expert"; } else if (minSkill >= 80 && minSkill < 90) { textminSkills = "Adepte"; } else if (minSkill >= 90 && minSkill < 100) { textminSkills = "Maître"; } else if (minSkill >= 100 && minSkill < 110) { textminSkills = "Grand Maître"; } AddHtmlLocalized(170, 132 + (i * 20), 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor, false, false); if (m_From.AccessLevel >= AccessLevel.GameMaster) { AddLabel(430, 132 + (i * 20), LabelHue, String.Format("{0:F1}", minSkill)); } else { AddLabel(430, 132 + (i * 20), LabelHue, String.Format("{0}", textminSkills)); } } CraftSubResCol res = (m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes); int resIndex = -1; CraftContext context = m_CraftSystem.GetContext(m_From); if (context != null) { resIndex = (m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex); } bool allRequiredSkills = true; double chance = m_CraftItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null, m_CraftSystem, false, ref allRequiredSkills); double excepChance = m_CraftItem.GetExceptionalChance(m_CraftSystem, chance, m_From); m_Chance = chance; // Scriptiz : on stocke la chance if (chance < 0.0) { chance = 0.0; } else if (chance > 1.0) { chance = 1.0; } string textchance = "Nulle"; if (chance > 0 && chance <= 0.2) { textchance = "Faible"; } else if (chance > 0.2 && chance <= 0.4) { textchance = "Possible"; } else if (chance > 0.4 && chance <= 0.6) { textchance = "Moyenne"; } else if (chance > 0.6 && chance <= 0.8) { textchance = "Favorable"; } else if (chance > 0.8 && chance < 1) { textchance = "Grande"; } else if (chance == 1) { textchance = "Aisée"; } AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor, false, false); if (m_From.AccessLevel >= AccessLevel.GameMaster) { AddLabel(430, 80, LabelHue, String.Format("{0:F1}%", chance * 100)); } else { AddLabel(430, 80, LabelHue, String.Format("{0}", textchance)); } if (m_ShowExceptionalChance) { if (excepChance < 0.0) { excepChance = 0.0; } else if (excepChance > 1.0) { excepChance = 1.0; } if (m_From.AccessLevel >= AccessLevel.GameMaster) { AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false); // Exceptional Chance: AddLabel(430, 100, LabelHue, String.Format("{0:F1}%", excepChance * 100)); } } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 7: { m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader); goto case 6; } case 6: { if (version == 6) m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); m_MaxHitPoints = reader.ReadEncodedInt(); m_HitPoints = reader.ReadEncodedInt(); goto case 5; } //personal bless deed case 5: { m_BlessedBy = reader.ReadMobile(); goto case 4; } #region Mondain's Legacy Sets case 4: { m_LastEquipped = reader.ReadBool(); m_SetEquipped = reader.ReadBool(); m_SetHue = reader.ReadEncodedInt(); m_SetAttributes = new AosAttributes( this, reader ); m_SetSkillBonuses = new AosSkillBonuses( this, reader ); goto case 3; } #endregion #region Mondain's Legacy case 3: { m_Crafter = reader.ReadMobile(); m_Quality = (ArmorQuality) reader.ReadInt(); goto case 2; } #endregion case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes( this, reader ); m_AosResistances = new AosElementAttributes( this, reader ); m_AosSkillBonuses = new AosSkillBonuses( this, reader ); 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(); break; } case 0: { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); 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 ( version < 2 ) { m_Resource = CraftResource.Iron; m_GemType = GemType.None; } }
public void DrawSkill() { for (int i = 0; i < m_CraftItem.Skills.Count; i++) { CraftSkill skill = m_CraftItem.Skills.GetAt(i); double minSkill = skill.MinSkill, maxSkill = skill.MaxSkill; if (minSkill < 0) { minSkill = 0; } AddHtmlLocalized(170, 155 + (i * 20), 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor, false, false); AddLabel(430, 155 + (i * 20), LabelHue, String.Format("{0:F1}", minSkill)); } CraftSubResCol res = (m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes); int resIndex = -1; CraftContext context = m_CraftSystem.GetContext(m_From); if (context != null) { resIndex = (m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex); } bool allRequiredSkills = true; double successChance = m_CraftItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null, m_CraftSystem, false, ref allRequiredSkills); double exceptionalChance = m_CraftItem.GetExceptionalChance(m_CraftSystem, successChance, m_From); bool skillGainPossible = false; if (successChance < 0.0) { successChance = 0.0; } else if (successChance > 1.0) { successChance = 1.0; } if (exceptionalChance < 0.0) { exceptionalChance = 0.0; } else if (exceptionalChance > 1.0) { exceptionalChance = 1.0; } if (successChance > 0 && successChance < 1.0) { skillGainPossible = true; } int startY = 80; AddHtmlLocalized(170, startY, 250, 18, 1044057, LabelColor, false, false); // Success Chance: AddLabel(430, startY, LabelHue, String.Format("{0:F1}%", successChance * 100)); startY += 20; if (m_ShowExceptionalChance) { if (exceptionalChance < 0.0) { exceptionalChance = 0.0; } else if (exceptionalChance > 1.0) { exceptionalChance = 1.0; } AddHtmlLocalized(170, startY, 250, 18, 1044058, 32767, false, false); // Exceptional Chance: AddLabel(430, startY, LabelHue, String.Format("{0:F1}%", exceptionalChance * 100)); startY += 20; } if (skillGainPossible) { AddLabel(169, startY, 2599, "Skill Gain Possible"); } }
public BaseTalisman(int itemID) : base(itemID) { this.Layer = Layer.Talisman; this.Weight = 1.0; this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.m_Protection = new TalismanAttribute(); this.m_Killer = new TalismanAttribute(); this.m_Summoner = new TalismanAttribute(); this.m_AosAttributes = new AosAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 11: { m_SetPhysicalBonus = reader.ReadInt(); m_SetFireBonus = reader.ReadInt(); m_SetColdBonus = reader.ReadInt(); m_SetPoisonBonus = reader.ReadInt(); m_SetEnergyBonus = reader.ReadInt(); goto case 10; } case 10: { m_PlayerConstructed = reader.ReadBool(); goto case 9; } case 9: { m_TalismanProtection = new TalismanAttribute(reader); goto case 8; } case 8: { _VvVItem = reader.ReadBool(); _Owner = reader.ReadMobile(); _OwnerName = reader.ReadString(); goto case 7; } case 7: { m_IsImbued = reader.ReadBool(); goto case 6; } case 6: { m_NegativeAttributes = new NegativeAttributes(this, reader); goto case 5; } case 5: { #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_GorgonLenseCharges = reader.ReadInt(); m_GorgonLenseType = (LenseType)reader.ReadInt(); goto case 4; } case 4: { m_TimesImbued = reader.ReadEncodedInt(); m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader); #endregion m_BlessedBy = reader.ReadMobile(); m_LastEquipped = reader.ReadBool(); m_SetEquipped = reader.ReadBool(); m_SetHue = reader.ReadEncodedInt(); m_SetAttributes = new AosAttributes(this, reader); m_SetSkillBonuses = new AosSkillBonuses(this, reader); m_Crafter = reader.ReadMobile(); m_Quality = (ItemQuality)reader.ReadInt(); goto case 3; } case 3: { m_MaxHitPoints = reader.ReadEncodedInt(); m_HitPoints = reader.ReadEncodedInt(); goto case 2; } case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosResistances = new AosElementAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); 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(); } break; } case 0: { m_AosAttributes = new AosAttributes(this); m_AosResistances = new AosElementAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); break; } } if (m_NegativeAttributes == null) { m_NegativeAttributes = new NegativeAttributes(this); } if (m_TalismanProtection == null) { m_TalismanProtection = new TalismanAttribute(); } #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 (version < 2) { m_Resource = CraftResource.Iron; m_GemType = GemType.None; } }
public virtual string GetNameLocalized() { return(String.Concat("#", AosSkillBonuses.GetLabel(m_Skill).ToString())); }
public static void ApplyAttributesTo(FishingPole pole, bool playerMade, int luckChance, int attributeCount, int min, int max) { int delta; if (min > max) { delta = min; min = max; max = delta; } m_PlayerMade = playerMade; m_LuckChance = luckChance; AosAttributes primary = pole.Attributes; AosSkillBonuses skills = pole.SkillBonuses; m_Props.SetAll(false); for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(21); switch (random) { case 0: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 1: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 2: ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 1); break; case 3: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 4: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 8); break; case 10: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break; case 11: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); break; case 12: ApplyAttribute(primary, min, max, AosAttribute.BonusStr, 1, 8); break; case 13: ApplyAttribute(primary, min, max, AosAttribute.BonusDex, 1, 8); break; case 14: ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); break; case 15: ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); break; case 16: ApplySkillBonus(skills, min, max, 0, 1, 15); break; case 17: ApplySkillBonus(skills, min, max, 1, 1, 15); break; case 18: ApplySkillBonus(skills, min, max, 2, 1, 15); break; case 19: ApplySkillBonus(skills, min, max, 3, 1, 15); break; case 20: ApplySkillBonus(skills, min, max, 4, 1, 15); break; } } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { #region Personal Bless Deed case 9: { m_BlessedBy = reader.ReadMobile(); goto case 8; } #endregion #region Mondain's Legacy Sets case 8: SetFlag sflags = (SetFlag) reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.Attributes ) ) m_SetAttributes = new AosAttributes( this, reader ); else m_SetAttributes = new AosAttributes( this ); if ( GetSaveFlag( sflags, SetFlag.ArmorAttributes ) ) m_SetSelfRepair = (new AosArmorAttributes( this, reader )).SelfRepair; if ( GetSaveFlag( sflags, SetFlag.SkillBonuses ) ) m_SetSkillBonuses = new AosSkillBonuses( this, reader ); else m_SetSkillBonuses = new AosSkillBonuses( this ); if ( GetSaveFlag( sflags, SetFlag.PhysicalBonus ) ) m_SetPhysicalBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.FireBonus ) ) m_SetFireBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.ColdBonus ) ) m_SetColdBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.PoisonBonus ) ) m_SetPoisonBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.EnergyBonus ) ) m_SetEnergyBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.Hue ) ) m_SetHue = reader.ReadEncodedInt(); if ( GetSaveFlag( sflags, SetFlag.LastEquipped ) ) m_LastEquipped = reader.ReadBool(); if ( GetSaveFlag( sflags, SetFlag.SetEquipped ) ) m_SetEquipped = reader.ReadBool(); if ( GetSaveFlag( sflags, SetFlag.SetSelfRepair ) ) m_SetSelfRepair = reader.ReadEncodedInt(); goto case 7; #endregion case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Attributes ) ) m_AosAttributes = new AosAttributes( this, reader ); else m_AosAttributes = new AosAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) ) m_AosArmorAttributes = new AosArmorAttributes( this, reader ); else m_AosArmorAttributes = new AosArmorAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) ) m_PhysicalBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.FireBonus ) ) m_FireBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.ColdBonus ) ) m_ColdBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.PoisonBonus ) ) m_PoisonBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.EnergyBonus ) ) m_EnergyBonus = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 7 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.MaxHitPoints ) ) m_MaxHitPoints = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.HitPoints ) ) m_HitPoints = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (ArmorQuality)reader.ReadEncodedInt(); else m_Quality = ArmorQuality.Regular; if ( version == 5 && m_Quality == ArmorQuality.Low ) m_Quality = ArmorQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Durability ) ) { m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt(); if ( m_Durability > ArmorDurabilityLevel.Indestructible ) m_Durability = ArmorDurabilityLevel.Durable; } if ( GetSaveFlag( flags, SaveFlag.Protection ) ) { m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt(); if ( m_Protection > ArmorProtectionLevel.Invulnerability ) m_Protection = ArmorProtectionLevel.Defense; } if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadEncodedInt(); else m_Resource = DefaultResource; if ( m_Resource == CraftResource.None ) m_Resource = DefaultResource; if ( GetSaveFlag( flags, SaveFlag.BaseArmor ) ) m_ArmorBase = reader.ReadEncodedInt(); else m_ArmorBase = -1; if ( GetSaveFlag( flags, SaveFlag.StrBonus ) ) m_StrBonus = reader.ReadEncodedInt(); else m_StrBonus = -1; if ( GetSaveFlag( flags, SaveFlag.DexBonus ) ) m_DexBonus = reader.ReadEncodedInt(); else m_DexBonus = -1; if ( GetSaveFlag( flags, SaveFlag.IntBonus ) ) m_IntBonus = reader.ReadEncodedInt(); else m_IntBonus = -1; if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadEncodedInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadEncodedInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadEncodedInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MedAllowance ) ) m_Meditate = (AMA)reader.ReadEncodedInt(); else m_Meditate = (AMA)(-1); if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) m_PlayerConstructed = true; #region SA if ( version > 7 && GetSaveFlag( flags, SaveFlag.xAbsorptionAttributes ) ) m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this, reader ); else m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this ); #endregion break; } case 4: { m_AosAttributes = new AosAttributes( this, reader ); m_AosArmorAttributes = new AosArmorAttributes( this, reader ); goto case 3; } case 3: { m_PhysicalBonus = reader.ReadInt(); m_FireBonus = reader.ReadInt(); m_ColdBonus = reader.ReadInt(); m_PoisonBonus = reader.ReadInt(); m_EnergyBonus = reader.ReadInt(); goto case 2; } case 2: case 1: { m_Identified = reader.ReadBool(); goto case 0; } case 0: { m_ArmorBase = reader.ReadInt(); m_MaxHitPoints = reader.ReadInt(); m_HitPoints = reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Quality = (ArmorQuality)reader.ReadInt(); m_Durability = (ArmorDurabilityLevel)reader.ReadInt(); m_Protection = (ArmorProtectionLevel)reader.ReadInt(); AMT mat = (AMT)reader.ReadInt(); if ( m_ArmorBase == RevertArmorBase ) m_ArmorBase = -1; /*m_BodyPos = (ArmorBodyType)*/reader.ReadInt(); if ( version < 4 ) { m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); } if ( version < 3 && m_Quality == ArmorQuality.Exceptional ) DistributeBonuses( 6 ); if ( version >= 2 ) { m_Resource = (CraftResource)reader.ReadInt(); } else { OreInfo info; switch ( reader.ReadInt() ) { default: case 0: info = OreInfo.Iron; break; case 1: info = OreInfo.DullCopper; break; case 2: info = OreInfo.ShadowIron; break; case 3: info = OreInfo.Copper; break; case 4: info = OreInfo.Bronze; break; case 5: info = OreInfo.Gold; break; case 6: info = OreInfo.Agapite; break; case 7: info = OreInfo.Verite; break; case 8: info = OreInfo.Valorite; break; } m_Resource = CraftResources.GetFromOreInfo( info, mat ); } m_StrBonus = reader.ReadInt(); m_DexBonus = reader.ReadInt(); m_IntBonus = reader.ReadInt(); m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); if ( m_StrBonus == OldStrBonus ) m_StrBonus = -1; if ( m_DexBonus == OldDexBonus ) m_DexBonus = -1; if ( m_IntBonus == OldIntBonus ) m_IntBonus = -1; if ( m_StrReq == OldStrReq ) m_StrReq = -1; if ( m_DexReq == OldDexReq ) m_DexReq = -1; if ( m_IntReq == OldIntReq ) m_IntReq = -1; m_Meditate = (AMA)reader.ReadInt(); if ( m_Meditate == OldMedAllowance ) m_Meditate = (AMA)(-1); if ( m_Resource == CraftResource.None ) { if ( mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather ) m_Resource = CraftResource.RegularLeather; else if ( mat == ArmorMaterialType.Spined ) m_Resource = CraftResource.SpinedLeather; else if ( mat == ArmorMaterialType.Horned ) m_Resource = CraftResource.HornedLeather; else if ( mat == ArmorMaterialType.Barbed ) m_Resource = CraftResource.BarbedLeather; else m_Resource = CraftResource.Iron; } if ( m_MaxHitPoints == 0 && m_HitPoints == 0 ) m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); 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 ( m_AosSkillBonuses == null ) m_AosSkillBonuses = new AosSkillBonuses( this ); if ( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); int strBonus = ComputeStatBonus( StatType.Str ); int dexBonus = ComputeStatBonus( StatType.Dex ); int intBonus = ComputeStatBonus( StatType.Int ); 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 ( version < 7 ) 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 4: { _VvVItem = reader.ReadBool(); _Owner = reader.ReadMobile(); _OwnerName = reader.ReadString(); goto case 3; } case 3: case 2: IsArrowAmmo = reader.ReadBool(); goto case 1; case 1: { if (version == 1) { IsArrowAmmo = (Ammo == null || Ammo is Arrow); } m_AosSkillBonuses = new AosSkillBonuses(this, reader); m_Resistances = new AosElementAttributes(this, reader); goto case 0; } case 0: { if (version == 0) { m_AosSkillBonuses = new AosSkillBonuses(this); m_Resistances = new AosElementAttributes(this); } SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Attributes)) { m_Attributes = new AosAttributes(this, reader); } else { m_Attributes = new AosAttributes(this); } if (version < 3 && GetSaveFlag(flags, SaveFlag.LowerAmmoCost)) { m_Attributes.LowerAmmoCost = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.WeightReduction)) { m_WeightReduction = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.DamageIncrease)) { m_DamageIncrease = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { m_Crafter = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Quality)) { m_Quality = (ItemQuality)reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Capacity)) { m_Capacity = reader.ReadInt(); } #region Mondain's Legacy Sets if (GetSaveFlag(flags, SaveFlag.SetPhysical)) { m_SetPhysicalBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.SetFire)) { m_SetFireBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.SetCold)) { m_SetColdBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.SetPoison)) { m_SetPoisonBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.SetEnergy)) { m_SetEnergyBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.SetAttributes)) { m_SetAttributes = new AosAttributes(this, reader); } else { m_SetAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SetSkillAttributes)) { m_SetSkillBonuses = new AosSkillBonuses(this, reader); } else { m_SetSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SaveFlag.SetHue)) { m_SetHue = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.LastEquipped)) { m_LastEquipped = reader.ReadBool(); } if (GetSaveFlag(flags, SaveFlag.SetEquipped)) { m_SetEquipped = reader.ReadBool(); } if (GetSaveFlag(flags, SaveFlag.ElvesOnly)) { _ElvesOnly = reader.ReadBool(); } #endregion break; } } int strBonus = ComputeStatBonus(StatType.Str); int dexBonus = ComputeStatBonus(StatType.Dex); int intBonus = ComputeStatBonus(StatType.Int); 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) { m_AosSkillBonuses.AddTo((Mobile)Parent); ((Mobile)Parent).CheckStatTimers(); } }
public static void ApplyAttributesTo(BaseJewel jewelry, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; AosAttributes primary = jewelry.Attributes; AosElementAttributes resists = jewelry.Resistances; AosSkillBonuses skills = jewelry.SkillBonuses; m_Props.SetAll(false); for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(24); if (random == -1) { break; } switch (random) { case 0: ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); break; case 1: ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15); break; case 2: ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15); break; case 3: ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15); break; case 4: ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15); break; case 5: ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 25); break; case 6: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 7: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.BonusStr, 1, 8); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.BonusDex, 1, 8); break; case 10: ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); break; case 11: ApplyAttribute(primary, min, max, AosAttribute.EnhancePotions, 5, 25, 5); break; case 12: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; case 13: ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 3); break; case 14: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break; case 15: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break; case 16: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 17: ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); break; case 18: ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); break; case 19: ApplySkillBonus(skills, min, max, 0, 1, 15); break; case 20: ApplySkillBonus(skills, min, max, 1, 1, 15); break; case 21: ApplySkillBonus(skills, min, max, 2, 1, 15); break; case 22: ApplySkillBonus(skills, min, max, 3, 1, 15); break; case 23: ApplySkillBonus(skills, min, max, 4, 1, 15); break; } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 3: { m_Crafter = reader.ReadMobile(); goto case 2; } case 2: { m_Slayer = (SlayerName)reader.ReadInt(); m_Slayer2 = (SlayerName)reader.ReadInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); goto case 0; } case 0: { m_Content = reader.ReadULong(); m_Count = reader.ReadInt(); break; } } if (m_AosAttributes == null) { m_AosAttributes = new AosAttributes(this); } if (m_AosSkillBonuses == null) { m_AosSkillBonuses = new AosSkillBonuses(this); } 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(); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 5: { m_MaxHitPoints = reader.ReadEncodedInt(); m_HitPoints = reader.ReadEncodedInt(); goto case 4; } #region Mondain's Legacy Sets case 4: { m_LastEquipped = reader.ReadBool(); m_SetEquipped = reader.ReadBool(); m_SetHue = reader.ReadEncodedInt(); m_SetAttributes = new AosAttributes(this, reader); m_SetSkillBonuses = new AosSkillBonuses(this, reader); goto case 3; } #endregion #region Mondain's Legacy case 3: { m_Crafter = reader.ReadMobile(); m_Quality = (ArmorQuality)reader.ReadInt(); goto case 2; } #endregion case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosResistances = new AosElementAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); 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(); } break; } case 0: { m_AosAttributes = new AosAttributes(this); m_AosResistances = new AosElementAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); 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 (version < 2) { m_Resource = CraftResource.Iron; m_GemType = GemType.None; } }
private static void ApplySkillBonus(AosSkillBonuses attrs, int min, int max, int index, int low, int high) { SkillName[] possibleSkills = m_PossibleBonusSkills; if (attrs.Owner is BaseShield) { possibleSkills = m_PossibleShieldSkills; } else if (attrs.Owner is BaseArmor) { possibleSkills = m_PossibleFightSkills; } else if (attrs.Owner is BaseWeapon) { BaseWeapon bm = (BaseWeapon)attrs.Owner; if (bm.Skill == SkillName.Swords) { possibleSkills = m_PossibleWepSwordsSkills; } else if (bm.Skill == SkillName.Archery) { possibleSkills = m_PossibleWepArcherySkills; } else if (bm.Skill == SkillName.Fencing) { possibleSkills = m_PossibleWepFencingSkills; } else if (bm.Skill == SkillName.Macing) { possibleSkills = m_PossibleWepMacingSkills; } else if (bm.Skill == SkillName.Wrestling) { possibleSkills = m_PossibleWepWrestlingSkills; } } else if (attrs.Owner is Spellbook) { possibleSkills = m_PossibleSpellbookSkills; } else if (attrs.Owner is BaseInstrument) { possibleSkills = m_PossibleBardSkills; } int count = possibleSkills.Length; SkillName sk, check; double bonus; bool found; do { found = false; sk = possibleSkills[Utility.Random(count)]; for (int i = 0; !found && i < 5; ++i) { found = (attrs.GetValues(i, out check, out bonus) && check == sk); } } while (found); attrs.SetValues(index, sk, Scale(min, max, low, high)); }
// =========== Check if Choosen Attribute Replaces Another ================= public static TextDefinition WhatReplacesWhat(int id, Item item) { if (Imbuing.GetValueForID(item, id) > 0) { return(ItemPropertyInfo.GetAttributeName(id)); } if (item is BaseWeapon) { BaseWeapon i = item as BaseWeapon; // Slayers replace Slayers if (id >= 101 && id <= 127) { if (i.Slayer != SlayerName.None) { return(GetNameForAttribute(i.Slayer)); } if (i.Slayer2 != SlayerName.None) { return(GetNameForAttribute(i.Slayer2)); } } // OnHitEffect replace OnHitEffect if (id >= 35 && id <= 39) { if (i.WeaponAttributes.HitMagicArrow > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitMagicArrow)); } else if (i.WeaponAttributes.HitHarm > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitHarm)); } else if (i.WeaponAttributes.HitFireball > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireball)); } else if (i.WeaponAttributes.HitLightning > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitLightning)); } else if (i.WeaponAttributes.HitDispel > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitDispel)); } } // OnHitArea replace OnHitArea if (id >= 30 && id <= 34) { if (i.WeaponAttributes.HitPhysicalArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPhysicalArea)); } else if (i.WeaponAttributes.HitColdArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireArea)); } else if (i.WeaponAttributes.HitFireArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitColdArea)); } else if (i.WeaponAttributes.HitPoisonArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPoisonArea)); } else if (i.WeaponAttributes.HitEnergyArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitEnergyArea)); } } } if (item is BaseJewel) { BaseJewel jewel = item as BaseJewel; if (id >= 151 && id <= 183) { AosSkillBonuses bonuses = jewel.SkillBonuses; SkillName[] group = Imbuing.GetSkillGroup((SkillName)ItemPropertyInfo.GetAttribute(id)); for (int i = 0; i < 5; i++) { if (bonuses.GetBonus(i) > 0 && group.Any(sk => sk == bonuses.GetSkill(i))) { return(GetNameForAttribute(bonuses.GetSkill(i))); } } } // SkillGroup1 replace SkillGroup1 /*if (id >= 151 && id <= 155) * { * if (i.SkillBonuses.GetBonus(0) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(0) == sk) * return GetNameForAttribute(sk); * } * } * } * // SkillGroup2 replace SkillGroup2 * if (id >= 156 && id <= 160) * { * if (i.SkillBonuses.GetBonus(1) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(1) == sk) * return GetNameForAttribute(sk); * } * } * } * // SkillGroup3 replace SkillGroup3 * if (id >= 161 && id <= 166) * { * if (i.SkillBonuses.GetBonus(2) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(2) == sk) * return GetNameForAttribute(sk); * } * } * } * // SkillGroup4 replace SkillGroup4 * if (id >= 167 && id <= 172) * { * if (i.SkillBonuses.GetBonus(3) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(3) == sk) * return GetNameForAttribute(sk); * } * } * } * // SkillGroup5 replace SkillGroup5 * if (id >= 173 && id <= 178) * { * if (i.SkillBonuses.GetBonus(4) > 0) * { * foreach (SkillName sk in Imbuing.PossibleSkills) * { * if (i.SkillBonuses.GetSkill(4) == sk) * return GetNameForAttribute(sk); * } * } * }*/ } return(null); }
public override void Deserialize(GenericReader reader) { base.Deserialize( reader ); int version = reader.ReadInt(); switch( version ) { case 12: case 11: case 10: case 9: case 8: case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.Attributes ) ) m_AosAttributes = new AosAttributes( this, reader ); else m_AosAttributes = new AosAttributes( this ); if( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) ) m_AosArmorAttributes = new AosArmorAttributes( this, reader ); else m_AosArmorAttributes = new AosArmorAttributes( this ); if( GetSaveFlag( flags, SaveFlag.BluntBonus ) ) m_BluntBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.SlashingBonus ) ) m_SlashingBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.PiercingBonus ) ) m_PiercingBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) ) m_PhysicalBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.FireBonus ) ) m_FireBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.ColdBonus ) ) m_ColdBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.PoisonBonus ) ) m_PoisonBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.EnergyBonus ) ) m_EnergyBonus = reader.ReadEncodedInt(); if( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 7 || reader.ReadBool() ); if( GetSaveFlag( flags, SaveFlag.Protection ) ) { m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt(); if( m_Protection > ArmorProtectionLevel.Invulnerability ) m_Protection = ArmorProtectionLevel.Defense; } if( GetSaveFlag( flags, SaveFlag.BaseArmor ) ) m_ArmorBase = reader.ReadEncodedInt(); else m_ArmorBase = -1; if( GetSaveFlag( flags, SaveFlag.HitsMaxBonus ) ) m_HitsMaxBonus = reader.ReadEncodedInt(); else m_HitsMaxBonus = -1; if( GetSaveFlag( flags, SaveFlag.StamMaxBonus ) ) m_StamMaxBonus = reader.ReadEncodedInt(); else m_StamMaxBonus = -1; if( GetSaveFlag( flags, SaveFlag.ManaMaxBonus ) ) m_ManaMaxBonus = reader.ReadEncodedInt(); else m_ManaMaxBonus = -1; if( GetSaveFlag( flags, SaveFlag.StrBonus ) ) m_StrBonus = reader.ReadEncodedInt(); else m_StrBonus = -1; if( GetSaveFlag( flags, SaveFlag.DexBonus ) ) m_DexBonus = reader.ReadEncodedInt(); else m_DexBonus = -1; if( GetSaveFlag( flags, SaveFlag.IntBonus ) ) m_IntBonus = reader.ReadEncodedInt(); else m_IntBonus = -1; if( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadEncodedInt(); else m_StrReq = -1; if( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadEncodedInt(); else m_DexReq = -1; if( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadEncodedInt(); else m_IntReq = -1; if( GetSaveFlag( flags, SaveFlag.MedAllowance ) ) m_Meditate = (AMA)reader.ReadEncodedInt(); else m_Meditate = (AMA)( -1 ); if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); break; } case 4: { m_AosAttributes = new AosAttributes( this, reader ); m_AosArmorAttributes = new AosArmorAttributes( this, reader ); goto case 3; } case 3: { m_PhysicalBonus = reader.ReadInt(); m_FireBonus = reader.ReadInt(); m_ColdBonus = reader.ReadInt(); m_PoisonBonus = reader.ReadInt(); m_EnergyBonus = reader.ReadInt(); goto case 2; } case 2: case 1: { m_Identified = reader.ReadBool(); goto case 0; } case 0: { m_ArmorBase = reader.ReadInt(); m_Protection = (ArmorProtectionLevel)reader.ReadInt(); if( m_ArmorBase == RevertArmorBase ) m_ArmorBase = -1; reader.ReadInt(); if( version < 4 ) { m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); } m_HitsMaxBonus = reader.ReadInt(); m_StamMaxBonus = reader.ReadInt(); m_ManaMaxBonus = reader.ReadInt(); m_StrBonus = reader.ReadInt(); m_DexBonus = reader.ReadInt(); m_IntBonus = reader.ReadInt(); m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); if( m_HitsMaxBonus == OldHitsMaxBonus ) m_HitsMaxBonus = -1; if( m_StamMaxBonus == OldStamMaxBonus ) m_StamMaxBonus = -1; if( m_ManaMaxBonus == OldManaMaxBonus ) m_ManaMaxBonus = -1; if( m_StrBonus == OldStrBonus ) m_StrBonus = -1; if( m_DexBonus == OldDexBonus ) m_DexBonus = -1; if( m_IntBonus == OldIntBonus ) m_IntBonus = -1; if( m_StrReq == OldStrReq ) m_StrReq = -1; if( m_DexReq == OldDexReq ) m_DexReq = -1; if( m_IntReq == OldIntReq ) m_IntReq = -1; m_Meditate = (AMA)reader.ReadInt(); if( m_Meditate == OldMedAllowance ) m_Meditate = (AMA)( -1 ); break; } } if( m_AosSkillBonuses == null ) m_AosSkillBonuses = new AosSkillBonuses( this ); if( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); int hitsmaxBonus = ComputeStatBonus( StatType.HitsMax ); int stammaxBonus = ComputeStatBonus( StatType.StamMax ); int manamaxBonus = ComputeStatBonus( StatType.ManaMax ); int strBonus = ComputeStatBonus( StatType.Str ); int dexBonus = ComputeStatBonus( StatType.Dex ); int intBonus = ComputeStatBonus( StatType.Int ); if( Parent is Mobile && ( strBonus != 0 || dexBonus != 0 || intBonus != 0 || hitsmaxBonus != 0 || stammaxBonus != 0 || manamaxBonus != 0 ) ) { Mobile m = (Mobile)Parent; string modName = Serial.ToString(); if( hitsmaxBonus != 0 ) m.AddStatMod( new StatMod( StatType.HitsMax, modName + "HitsMax", hitsmaxBonus, TimeSpan.Zero ) ); if( stammaxBonus != 0 ) m.AddStatMod( new StatMod( StatType.StamMax, modName + "StamMax", stammaxBonus, TimeSpan.Zero ) ); if( manamaxBonus != 0 ) m.AddStatMod( new StatMod( StatType.ManaMax, modName + "ManaMax", manamaxBonus, TimeSpan.Zero ) ); 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( version < 12 ) { if( this.ParentEntity != null && this.ParentEntity is PlayerMobile ) { PlayerMobile pm = this.ParentEntity as PlayerMobile; Attributes.WeaponSpeed = 0; Attributes.WeaponDamage = 0; Attributes.AttackChance = 0; Attributes.DefendChance = 0; } } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 6: m_OldJewel = reader.ReadBool(); goto case 5; case 5: m_Seal = reader.ReadString(); goto case 4; case 4: case 3: { m_Crafter = reader.ReadMobile(); m_CraftersOriginalName = reader.ReadString(); m_Quality = (WeaponQuality)reader.ReadInt(); goto case 2; } case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes( this, reader ); m_AosResistances = new AosElementAttributes( this, reader ); m_AosSkillBonuses = new AosSkillBonuses( this, reader ); 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(); break; } case 0: { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); break; } } if ( version < 2 ) { m_Resource = CraftResource.Iron; m_GemType = GemType.None; } if( version < 4 ) Hue = 0; if (!String.IsNullOrEmpty(m_Seal) && !Seals.Contains(m_Seal)) Seals.Add(m_Seal); }
public BaseJewel( int itemID, Layer layer ) : base( itemID ) { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_Resource = CraftResource.Iron; m_GemType = GemType.None; Layer = layer; // 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); }
public BaseJewel( int itemID, Layer layer ) : base( itemID ) { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_Resource = CraftResource.Iron; m_GemType = GemType.None; Layer = layer; m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); #region Mondain's Legacy Sets m_SetAttributes = new AosAttributes( this ); m_SetSkillBonuses = new AosSkillBonuses( this ); #endregion #region SA m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this ); #endregion ItemValue = GearScore.GetItemValue( this ); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 7: { this.m_IsImbued = reader.ReadBool(); goto case 6; } case 6: { m_NegativeAttributes = new NegativeAttributes(this, reader); goto case 5; } case 5: { #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_GorgonLenseCharges = reader.ReadInt(); m_GorgonLenseType = (LenseType)reader.ReadInt(); goto case 4; } case 4: { this.m_TimesImbued = reader.ReadEncodedInt(); this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader); #endregion this.m_BlessedBy = reader.ReadMobile(); this.m_LastEquipped = reader.ReadBool(); this.m_SetEquipped = reader.ReadBool(); this.m_SetHue = reader.ReadEncodedInt(); this.m_SetAttributes = new AosAttributes(this, reader); this.m_SetSkillBonuses = new AosSkillBonuses(this, reader); this.m_Crafter = reader.ReadMobile(); this.m_Quality = (ArmorQuality)reader.ReadInt(); goto case 3; } case 3: { this.m_MaxHitPoints = reader.ReadEncodedInt(); this.m_HitPoints = reader.ReadEncodedInt(); goto case 2; } case 2: { this.m_Resource = (CraftResource)reader.ReadEncodedInt(); this.m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { this.m_AosAttributes = new AosAttributes(this, reader); this.m_AosResistances = new AosElementAttributes(this, reader); this.m_AosSkillBonuses = new AosSkillBonuses(this, reader); if (Core.AOS && this.Parent is Mobile) this.m_AosSkillBonuses.AddTo((Mobile)this.Parent); int strBonus = this.m_AosAttributes.BonusStr; int dexBonus = this.m_AosAttributes.BonusDex; int intBonus = this.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 (this.Parent is Mobile) ((Mobile)this.Parent).CheckStatTimers(); break; } case 0: { this.m_AosAttributes = new AosAttributes(this); this.m_AosResistances = new AosElementAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); break; } } if (m_NegativeAttributes == null) m_NegativeAttributes = new NegativeAttributes(this); #region Mondain's Legacy Sets if (this.m_SetAttributes == null) this.m_SetAttributes = new AosAttributes(this); if (this.m_SetSkillBonuses == null) this.m_SetSkillBonuses = new AosSkillBonuses(this); #endregion if (version < 2) { this.m_Resource = CraftResource.Iron; this.m_GemType = GemType.None; } }
private static void ApplySkillBonus( AosSkillBonuses attrs, int min, int max, int index, int low, int high ) { SkillName[] possibleSkills = ( attrs.Owner is Spellbook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills ); int count = ( Core.SE ? possibleSkills.Length : possibleSkills.Length - 2 ); SkillName sk, check; double bonus; bool found; do { found = false; sk = possibleSkills[Utility.Random( count )]; for ( int i = 0; !found && i < 5; ++i ) found = ( attrs.GetValues( i, out check, out bonus ) && check == sk ); } while ( found ); attrs.SetValues( index, sk, 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); }
public Spellbook(ulong content, int itemID) : base(itemID) { m_AosAttributes = new AosAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); Weight = 3.0; Layer = Layer.OneHanded; LootType = LootType.Blessed; Content = content; }
public BaseTalisman(int itemID) : base(itemID) { Layer = Layer.Talisman; Weight = 1.0; m_Protection = new TalismanAttribute(); m_Killer = new TalismanAttribute(); m_Summoner = new TalismanAttribute(); m_AosAttributes = new AosAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(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; AosSkillBonuses skills = weapon.SkillBonuses; 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(26); 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: ApplySkillBonus(skills, min, max, 0, 1, 15); break; } } }
// Version 7 (pre-codegen) private void Deserialize(IGenericReader reader, int version) { var flags = (OldSaveFlag)reader.ReadEncodedInt(); Attributes = new AosAttributes(this); if (GetSaveFlag(flags, OldSaveFlag.Attributes)) { Attributes.Deserialize(reader); } ArmorAttributes = new AosArmorAttributes(this); if (GetSaveFlag(flags, OldSaveFlag.ArmorAttributes)) { ArmorAttributes.Deserialize(reader); } if (GetSaveFlag(flags, OldSaveFlag.PhysicalBonus)) { _physicalBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.FireBonus)) { _fireBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.ColdBonus)) { _coldBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.PoisonBonus)) { _poisonBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.EnergyBonus)) { _energyBonus = reader.ReadEncodedInt(); } _identified = GetSaveFlag(flags, OldSaveFlag.Identified); if (GetSaveFlag(flags, OldSaveFlag.MaxHitPoints)) { _maxHitPoints = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.HitPoints)) { _hitPoints = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.Crafter)) { var crafter = reader.ReadEntity <Mobile>(); Timer.StartTimer(() => _crafter = crafter?.RawName); } if (GetSaveFlag(flags, OldSaveFlag.Quality)) { _quality = (ArmorQuality)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.Durability)) { _durability = (ArmorDurabilityLevel)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.Protection)) { _protection = (ArmorProtectionLevel)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.Resource)) { _rawResource = (CraftResource)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.BaseArmor)) { _armorBase = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.StrBonus)) { _strBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.DexBonus)) { _dexBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.IntBonus)) { _intBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.StrReq)) { _strReq = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.DexReq)) { _dexReq = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.IntReq)) { _intReq = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, OldSaveFlag.MedAllowance)) { _meditate = (AMA)reader.ReadEncodedInt(); } SkillBonuses = new AosSkillBonuses(this); if (GetSaveFlag(flags, OldSaveFlag.SkillBonuses)) { SkillBonuses.Deserialize(reader); } PlayerConstructed = GetSaveFlag(flags, OldSaveFlag.PlayerConstructed); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { #region ItemID_Mods case (3): { m_Identified = reader.ReadBool(); goto case 2; } #endregion case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes( this, reader ); m_AosResistances = new AosElementAttributes( this, reader ); m_AosSkillBonuses = new AosSkillBonuses( this, reader ); 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(); break; } case 0: { m_AosAttributes = new AosAttributes( this ); m_AosResistances = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); break; } } if ( version < 2 ) { m_Resource = CraftResource.Iron; m_GemType = GemType.None; } }
public static void ApplyAttributesTo(BaseArmor armor, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; AosAttributes primary = armor.Attributes; AosArmorAttributes secondary = armor.ArmorAttributes; AosSkillBonuses skills = armor.SkillBonuses; m_Props.SetAll(false); bool isShield = (armor is BaseShield); int baseCount = (isShield ? 7 : 20); int baseOffset = (isShield ? 0 : 4); if (!isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All) { m_Props.Set(3, true); // remove mage armor from possible properties } if (armor.Resource >= CraftResource.RegularLeather && armor.Resource <= CraftResource.BarbedLeather) { m_Props.Set(0, true); // remove lower requirements from possible properties for leather armor m_Props.Set(2, true); // remove durability bonus from possible properties } if (armor.RequiredRace == Race.Elf) { m_Props.Set(7, true); // elves inherently have night sight and elf only armor doesn't get night sight as a mod } for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(baseCount); if (random == -1) { break; } random += baseOffset; switch (random) { /* Begin Shields */ case 0: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break; case 1: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; case 2: if (Utility.RandomMinMax(1, 2) == 1) { ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); } else { ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); } break; case 3: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break; /* Begin Armor */ case 4: if (Utility.RandomMinMax(1, 2) == 1) { ApplySkillBonus(skills, min, max, 0, 1, 15); } else { ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); } break; case 5: if (Utility.RandomMinMax(1, 2) == 1) { ApplySkillBonus(skills, min, max, 0, 1, 15); } else { ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); } break; case 6: ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); break; /* End Shields */ case 7: ApplyAttribute(secondary, min, max, AosArmorAttribute.MageArmor, 1, 1); break; case 8: ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); break; case 9: ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); break; case 10: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break; case 11: ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); break; case 12: ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); break; case 13: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); break; case 14: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break; case 15: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break; case 16: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break; case 17: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break; case 18: ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); break; case 19: ApplyResistance(armor, min, max, ResistanceType.Physical, 1, 15); break; case 20: ApplyResistance(armor, min, max, ResistanceType.Fire, 1, 15); break; case 21: ApplyResistance(armor, min, max, ResistanceType.Cold, 1, 15); break; case 22: ApplyResistance(armor, min, max, ResistanceType.Poison, 1, 15); break; case 23: ApplyResistance(armor, min, max, ResistanceType.Energy, 1, 15); break; /* End Armor */ } } }
public BaseJewel(int itemID, Layer layer) : base(itemID) { this.m_AosAttributes = new AosAttributes(this); this.m_AosResistances = new AosElementAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); this.m_Resource = CraftResource.Iron; this.m_GemType = GemType.None; this.Layer = layer; this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.m_SetAttributes = new AosAttributes(this); this.m_SetSkillBonuses = new AosSkillBonuses(this); this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); m_NegativeAttributes = new NegativeAttributes(this); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Attributes)) { m_AosAttributes = new AosAttributes(this, reader); } else { m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses = new AosSkillBonuses(this, reader); } else { m_AosSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SaveFlag.Owner)) { m_Owner = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Protection)) { m_Protection = new TalismanAttribute(reader); } else { m_Protection = new TalismanAttribute(); } if (GetSaveFlag(flags, SaveFlag.Killer)) { m_Killer = new TalismanAttribute(reader); } else { m_Protection = new TalismanAttribute(); } if (GetSaveFlag(flags, SaveFlag.Summoner)) { m_Summoner = new TalismanAttribute(reader); } else { m_Protection = new TalismanAttribute(); } if (GetSaveFlag(flags, SaveFlag.Removal)) { m_Removal = (TalismanRemoval)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.KarmaLoss)) { m_KarmaLoss = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Skill)) { m_Skill = (SkillName)reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.SuccessBonus)) { m_SuccessBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.ExceptionalBonus)) { m_ExceptionalBonus = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.MaxCharges)) { m_MaxCharges = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Charges)) { m_Charges = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.MaxChargeTime)) { m_MaxChargeTime = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.ChargeTime)) { m_ChargeTime = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Slayer)) { m_Slayer = (TalismanSlayerName)reader.ReadEncodedInt(); } m_Blessed = GetSaveFlag(flags, SaveFlag.Blessed); break; } } if (Parent is Mobile) { Mobile m = (Mobile)Parent; m_AosAttributes.AddStatBonuses(m); m_AosSkillBonuses.AddTo(m); if (m_ChargeTime > 0) { StartTimer(); } } }
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 }
// =========== Check if Choosen Attribute Replaces Another ================= public static TextDefinition WhatReplacesWhat(int id, Item item) { if (Imbuing.GetValueForID(item, id) > 0) { return(ItemPropertyInfo.GetAttributeName(id)); } if (item is BaseWeapon) { BaseWeapon i = item as BaseWeapon; // Slayers replace Slayers if (id >= 101 && id <= 127) { if (i.Slayer != SlayerName.None) { return(GetNameForAttribute(i.Slayer)); } if (i.Slayer2 != SlayerName.None) { return(GetNameForAttribute(i.Slayer2)); } } // OnHitEffect replace OnHitEffect if (id >= 35 && id <= 39) { if (i.WeaponAttributes.HitMagicArrow > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitMagicArrow)); } else if (i.WeaponAttributes.HitHarm > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitHarm)); } else if (i.WeaponAttributes.HitFireball > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireball)); } else if (i.WeaponAttributes.HitLightning > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitLightning)); } else if (i.WeaponAttributes.HitDispel > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitDispel)); } } // OnHitArea replace OnHitArea if (id >= 30 && id <= 34) { if (i.WeaponAttributes.HitPhysicalArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPhysicalArea)); } else if (i.WeaponAttributes.HitColdArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitFireArea)); } else if (i.WeaponAttributes.HitFireArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitColdArea)); } else if (i.WeaponAttributes.HitPoisonArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitPoisonArea)); } else if (i.WeaponAttributes.HitEnergyArea > 0) { return(GetNameForAttribute(AosWeaponAttribute.HitEnergyArea)); } } } if (item is BaseJewel) { BaseJewel jewel = item as BaseJewel; if (id >= 151 && id <= 183) { AosSkillBonuses bonuses = jewel.SkillBonuses; SkillName[] group = Imbuing.GetSkillGroup((SkillName)ItemPropertyInfo.GetAttribute(id)); for (int i = 0; i < 5; i++) { if (bonuses.GetBonus(i) > 0 && group.Any(sk => sk == bonuses.GetSkill(i))) { return(GetNameForAttribute(bonuses.GetSkill(i))); } } } } return(null); }
public BaseArmor(int itemID) : base(itemID) { this.m_Quality = ArmorQuality.Regular; this.m_Durability = ArmorDurabilityLevel.Regular; this.m_Crafter = null; this.m_Resource = this.DefaultResource; this.Hue = CraftResources.GetHue(this.m_Resource); this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); this.Layer = (Layer)this.ItemData.Quality; this.m_AosAttributes = new AosAttributes(this); this.m_AosArmorAttributes = new AosArmorAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); #region Mondain's Legacy Sets this.m_SetAttributes = new AosAttributes(this); this.m_SetSkillBonuses = new AosSkillBonuses(this); #endregion this.m_AosSkillBonuses = new AosSkillBonuses(this); // 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) // 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); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Attributes)) { m_Attributes = new AosAttributes(this, reader); } else { m_Attributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.DamageModifier)) { m_DamageModifier = new AosElementAttributes(this, reader); } else { m_DamageModifier = new AosElementAttributes(this); } if (GetSaveFlag(flags, SaveFlag.LowerAmmoCost)) { m_LowerAmmoCost = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.WeightReduction)) { m_WeightReduction = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.DamageIncrease)) { m_DamageIncrease = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { m_Crafter = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Quality)) { m_Quality = (ClothingQuality)reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.PlayerConstructed)) { m_PlayerConstructed = reader.ReadBool(); } if (GetSaveFlag(flags, SaveFlag.Capacity)) { m_Capacity = reader.ReadInt(); } #region Mondain's Legacy Sets if (GetSaveFlag(flags, SaveFlag.SetAttributes)) { m_SetAttributes = new AosAttributes(this, reader); } else { m_SetAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SetSkillAttributes)) { m_SetSkillBonuses = new AosSkillBonuses(this, reader); } else { m_SetSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SaveFlag.SetHue)) { m_SetHue = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.LastEquipped)) { m_LastEquipped = reader.ReadBool(); } if (GetSaveFlag(flags, SaveFlag.SetEquipped)) { m_SetEquipped = reader.ReadBool(); } #endregion if (version == 1) { Layer = Layer.Cloak; } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Attributes)) m_AosAttributes = new AosAttributes(this, reader); else m_AosAttributes = new AosAttributes(this); if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) m_AosSkillBonuses = new AosSkillBonuses(this, reader); else m_AosSkillBonuses = new AosSkillBonuses(this); // Backward compatibility if (GetSaveFlag(flags, SaveFlag.Owner)) BlessedFor = reader.ReadMobile(); if (GetSaveFlag(flags, SaveFlag.Protection)) m_Protection = new TalismanAttribute(reader); else m_Protection = new TalismanAttribute(); if (GetSaveFlag(flags, SaveFlag.Killer)) m_Killer = new TalismanAttribute(reader); else m_Killer = new TalismanAttribute(); if (GetSaveFlag(flags, SaveFlag.Summoner)) m_Summoner = new TalismanAttribute(reader); else m_Summoner = new TalismanAttribute(); if (GetSaveFlag(flags, SaveFlag.Removal)) m_Removal = (TalismanRemoval)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.OldKarmaLoss)) m_AosAttributes.IncreasedKarmaLoss = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Skill)) m_Skill = (SkillName)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.SuccessBonus)) m_SuccessBonus = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.ExceptionalBonus)) m_ExceptionalBonus = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.MaxCharges)) m_MaxCharges = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Charges)) m_Charges = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.MaxChargeTime)) m_MaxChargeTime = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.ChargeTime)) m_ChargeTime = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Slayer)) m_Slayer = (TalismanSlayerName)reader.ReadEncodedInt(); m_Blessed = GetSaveFlag(flags, SaveFlag.Blessed); break; } } if (Parent is Mobile) { Mobile m = (Mobile)Parent; m_AosAttributes.AddStatBonuses(m); m_AosSkillBonuses.AddTo(m); if (m_ChargeTime > 0) StartTimer(); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 3: { m_MaxHitPoints = reader.ReadEncodedInt(); m_HitPoints = reader.ReadEncodedInt(); goto case 2; } case 2: { m_Resource = (CraftResource)reader.ReadEncodedInt(); m_GemType = (GemType)reader.ReadEncodedInt(); goto case 1; } case 1: { m_AosAttributes = new AosAttributes(this, reader); m_AosResistances = new AosElementAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); 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(); } break; } case 0: { m_AosAttributes = new AosAttributes(this); m_AosResistances = new AosElementAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); break; } } if (version < 2) { m_Resource = CraftResource.Iron; m_GemType = GemType.None; } }
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 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 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 (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.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: 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; 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 == "BalancedWeapon" && (!(item is BaseRanged) || !((BaseRanged)item).Balanced)) * return false;*/ if (str == "SearingWeapon" && (!(item is BaseWeapon) || !((BaseWeapon)item).SearingWeapon)) { 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 BaseArmor( int itemID ) : base( itemID ) { m_Quality = ArmorQuality.Regular; m_Durability = ArmorDurabilityLevel.Regular; m_Crafter = null; m_Resource = DefaultResource; Hue = CraftResources.GetHue( m_Resource ); m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); this.Layer = (Layer)ItemData.Quality; m_AosAttributes = new AosAttributes( this ); m_AosArmorAttributes = new AosArmorAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this ); #region Mondain's Legacy Sets m_SetAttributes = new AosAttributes( this ); m_SetSkillBonuses = new AosSkillBonuses( this ); #endregion }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 5: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Resource)) { m_Resource = (CraftResource)reader.ReadEncodedInt(); } else { m_Resource = DefaultResource; } if (GetSaveFlag(flags, SaveFlag.Attributes)) { m_AosAttributes = new AosAttributes(this, reader); } else { m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.ClothingAttributes)) { m_AosClothingAttributes = new AosArmorAttributes(this, reader); } else { m_AosClothingAttributes = new AosArmorAttributes(this); } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses = new AosSkillBonuses(this, reader); } else { m_AosSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SaveFlag.Resistances)) { m_AosResistances = new AosElementAttributes(this, reader); } else { m_AosResistances = new AosElementAttributes(this); } if (GetSaveFlag(flags, SaveFlag.MaxHitPoints)) { m_MaxHitPoints = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.HitPoints)) { m_HitPoints = reader.ReadEncodedInt(); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { m_Crafter = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Quality)) { m_Quality = (ClothingQuality)reader.ReadEncodedInt(); } else { m_Quality = ClothingQuality.Regular; } if (GetSaveFlag(flags, SaveFlag.StrReq)) { m_StrReq = reader.ReadEncodedInt(); } else { m_StrReq = -1; } if (GetSaveFlag(flags, SaveFlag.PlayerConstructed)) { m_PlayerConstructed = true; } break; } case 4: { m_Resource = (CraftResource)reader.ReadInt(); goto case 3; } case 3: { m_AosAttributes = new AosAttributes(this, reader); m_AosClothingAttributes = new AosArmorAttributes(this, reader); m_AosSkillBonuses = new AosSkillBonuses(this, reader); m_AosResistances = new AosElementAttributes(this, reader); goto case 2; } case 2: { m_PlayerConstructed = reader.ReadBool(); goto case 1; } case 1: { m_Crafter = reader.ReadMobile(); m_Quality = (ClothingQuality)reader.ReadInt(); break; } case 0: { m_Crafter = null; m_Quality = ClothingQuality.Regular; break; } } if (version < 2) { m_PlayerConstructed = true; // we don't know, so, assume it's crafted } if (version < 3) { m_AosAttributes = new AosAttributes(this); m_AosClothingAttributes = new AosArmorAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); m_AosResistances = new AosElementAttributes(this); } if (version < 4) { m_Resource = DefaultResource; } if (m_MaxHitPoints == 0 && m_HitPoints == 0) { m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits); } Mobile parent = Parent as Mobile; if (parent != null) { if (Core.AOS) { m_AosSkillBonuses.AddTo(parent); } AddStatBonuses(parent); parent.CheckStatTimers(); } }