public void HarmfulSpell(IDamageable d) { if (d is BaseCreature creature) { creature.OnHarmfulSpell(m_Caster); } else if (d is IDamageableItem item) { item.OnHarmfulSpell(m_Caster); } NegativeAttributes.OnCombatAction(Caster); if (d is Mobile mobile) { if (mobile != m_Caster) { NegativeAttributes.OnCombatAction(mobile); } EvilOmenSpell.TryEndEffect(mobile); } }
public void HarmfulSpell(IDamageable d) { if (d is BaseCreature) { ((BaseCreature)d).OnHarmfulSpell(m_Caster); } else if (d is IDamageableItem) { ((IDamageableItem)d).OnHarmfulSpell(m_Caster); } NegativeAttributes.OnCombatAction(Caster); if (d is Mobile) { if ((Mobile)d != m_Caster) { NegativeAttributes.OnCombatAction((Mobile)d); } EvilOmenSpell.TryEndEffect((Mobile)d); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 12: 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: { if (version == 11) { 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(); if (version == 11 && reader.ReadBool()) { m_NegativeAttributes.NoRepair = 1; } #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 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; } }
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); }
private static bool CheckCanRepair(Item item) { NegativeAttributes neg = RunicReforging.GetNegativeAttributes(item); return(neg != null && neg.NoRepair != 0); }
public static bool CheckMatch(Item item, int price, SearchCriteria searchCriteria) { if (item is CommodityDeed && ((CommodityDeed)item).Commodity != null) { item = ((CommodityDeed)item).Commodity; } if (searchCriteria.MinPrice > -1 && price < searchCriteria.MinPrice) { return(false); } if (searchCriteria.MaxPrice > -1 && price > searchCriteria.MaxPrice) { return(false); } if (!string.IsNullOrEmpty(searchCriteria.SearchName)) { string name; if (item is CommodityDeed && ((CommodityDeed)item).Commodity is ICommodity) { var commodity = (ICommodity)((CommodityDeed)item).Commodity; if (!string.IsNullOrEmpty(commodity.Description.String)) { name = commodity.Description.String; } else { name = StringList.GetString(commodity.Description.Number); } } else { name = GetItemName(item); } if (name == null) { return(false); // TODO? REturn null names? } if (!CheckKeyword(searchCriteria.SearchName, item) && name.ToLower().IndexOf(searchCriteria.SearchName.ToLower()) < 0) { return(false); } } if (searchCriteria.SearchType != Layer.Invalid && searchCriteria.SearchType != item.Layer) { return(false); } if (searchCriteria.Details.Count == 0) { return(true); } foreach (SearchDetail detail in searchCriteria.Details) { object o = detail.Attribute; int value = detail.Value; if (value == 0) { value = 1; } if (o is AosAttribute) { AosAttributes attrs = RunicReforging.GetAosAttributes(item); if (attrs == null || attrs[(AosAttribute)o] < value) { return(false); } } else if (o is AosWeaponAttribute) { AosWeaponAttributes attrs = RunicReforging.GetAosWeaponAttributes(item); if ((AosWeaponAttribute)o == AosWeaponAttribute.MageWeapon) { if (attrs == null || attrs[(AosWeaponAttribute)o] == 0 || attrs[(AosWeaponAttribute)o] > Math.Max(0, 30 - value)) { return(false); } } else if (attrs == null || attrs[(AosWeaponAttribute)o] < value) { return(false); } } else if (o is SAAbsorptionAttribute) { SAAbsorptionAttributes attrs = RunicReforging.GetSAAbsorptionAttributes(item); if (attrs == null || attrs[(SAAbsorptionAttribute)o] < value) { return(false); } } else if (o is AosArmorAttribute) { AosArmorAttributes attrs = RunicReforging.GetAosArmorAttributes(item); if (attrs == null || attrs[(AosArmorAttribute)o] < value) { return(false); } } else if (o is SkillName) { if (detail.Category != Category.RequiredSkill) { AosSkillBonuses skillbonuses = RunicReforging.GetAosSkillBonuses(item); if (skillbonuses != null) { bool hasSkill = false; for (int i = 0; i < 5; i++) { if (skillbonuses.GetValues(i, out SkillName check, out double bonus) && check == (SkillName)o && bonus >= value) { hasSkill = true; break; } } if (!hasSkill) { return(false); } } else if (item is SpecialScroll && value >= 105) { if (((SpecialScroll)item).Skill != (SkillName)o || ((SpecialScroll)item).Value < value) { return(false); } } else { return(false); } } else if (!(item is BaseWeapon) || ((BaseWeapon)item).DefSkill != (SkillName)o) { return(false); } } else if (!CheckSlayer(item, o)) { return(false); } else if (o is AosElementAttribute) { if (item is BaseWeapon) { BaseWeapon wep = item as BaseWeapon; if (detail.Category == Category.DamageType) { wep.GetDamageTypes(null, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int 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 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 == "SearingWeapon" && (!(item is BaseWeapon) || !((BaseWeapon)item).SearingWeapon)) { return(false); } if (str == "ArtifactRarity" && (!(item is IArtifact) || ((IArtifact)item).ArtifactRarity < value)) { return(false); } } } return(true); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 6: { m_NegativeAttributes = new NegativeAttributes(this, reader); m_MaxHitPoints = reader.ReadInt(); m_HitPoints = reader.ReadInt(); _VvVItem = reader.ReadBool(); _Owner = reader.ReadMobile(); _OwnerName = reader.ReadString(); goto case 5; } 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 (m_NegativeAttributes == null) { m_NegativeAttributes = new NegativeAttributes(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 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); m_NegativeAttributes = new NegativeAttributes(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) if(XmlSpawner.SocketsEnabled) 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(); switch ( version ) { case 10: { this.m_IsImbued = reader.ReadBool(); goto case 9; } case 9: { #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(); m_PhysImbuing = reader.ReadInt(); m_FireImbuing = reader.ReadInt(); m_ColdImbuing = reader.ReadInt(); m_PoisonImbuing = reader.ReadInt(); m_EnergyImbuing = reader.ReadInt(); goto case 8; } case 8: { this.m_TimesImbued = reader.ReadInt(); #endregion this.m_BlessedBy = reader.ReadMobile(); SetFlag sflags = (SetFlag)reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.Attributes)) this.m_SetAttributes = new AosAttributes(this, reader); else this.m_SetAttributes = new AosAttributes(this); if (GetSaveFlag(sflags, SetFlag.ArmorAttributes)) this.m_SetSelfRepair = (new AosArmorAttributes(this, reader)).SelfRepair; if (GetSaveFlag(sflags, SetFlag.SkillBonuses)) this.m_SetSkillBonuses = new AosSkillBonuses(this, reader); else this.m_SetSkillBonuses = new AosSkillBonuses(this); if (GetSaveFlag(sflags, SetFlag.PhysicalBonus)) this.m_SetPhysicalBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.FireBonus)) this.m_SetFireBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.ColdBonus)) this.m_SetColdBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.PoisonBonus)) this.m_SetPoisonBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.EnergyBonus)) this.m_SetEnergyBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.Hue)) this.m_SetHue = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.LastEquipped)) this.m_LastEquipped = reader.ReadBool(); if (GetSaveFlag(sflags, SetFlag.SetEquipped)) this.m_SetEquipped = reader.ReadBool(); if (GetSaveFlag(sflags, SetFlag.SetSelfRepair)) this.m_SetSelfRepair = reader.ReadEncodedInt(); goto case 5; } case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.NegativeAttributes)) m_NegativeAttributes = new NegativeAttributes(this, reader); else m_NegativeAttributes = new NegativeAttributes(this); if (GetSaveFlag(flags, SaveFlag.Attributes)) this.m_AosAttributes = new AosAttributes(this, reader); else this.m_AosAttributes = new AosAttributes(this); if (GetSaveFlag(flags, SaveFlag.ArmorAttributes)) this.m_AosArmorAttributes = new AosArmorAttributes(this, reader); else this.m_AosArmorAttributes = new AosArmorAttributes(this); if (GetSaveFlag(flags, SaveFlag.PhysicalBonus)) this.m_PhysicalBonus = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.FireBonus)) this.m_FireBonus = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.ColdBonus)) this.m_ColdBonus = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.PoisonBonus)) this.m_PoisonBonus = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.EnergyBonus)) this.m_EnergyBonus = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Identified)) this.m_Identified = (version >= 7 || reader.ReadBool()); if (GetSaveFlag(flags, SaveFlag.MaxHitPoints)) this.m_MaxHitPoints = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.HitPoints)) this.m_HitPoints = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Crafter)) this.m_Crafter = reader.ReadMobile(); if (GetSaveFlag(flags, SaveFlag.Quality)) this.m_Quality = (ArmorQuality)reader.ReadEncodedInt(); else this.m_Quality = ArmorQuality.Regular; if (version == 5 && this.m_Quality == ArmorQuality.Low) this.m_Quality = ArmorQuality.Regular; if (GetSaveFlag(flags, SaveFlag.Durability)) { this.m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt(); if (this.m_Durability > ArmorDurabilityLevel.Indestructible) this.m_Durability = ArmorDurabilityLevel.Durable; } if (GetSaveFlag(flags, SaveFlag.Protection)) { this.m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt(); if (this.m_Protection > ArmorProtectionLevel.Invulnerability) this.m_Protection = ArmorProtectionLevel.Defense; } if (GetSaveFlag(flags, SaveFlag.Resource)) this.m_Resource = (CraftResource)reader.ReadEncodedInt(); else this.m_Resource = this.DefaultResource; if (this.m_Resource == CraftResource.None) this.m_Resource = this.DefaultResource; if (GetSaveFlag(flags, SaveFlag.BaseArmor)) this.m_ArmorBase = reader.ReadEncodedInt(); else this.m_ArmorBase = -1; if (GetSaveFlag(flags, SaveFlag.StrBonus)) this.m_StrBonus = reader.ReadEncodedInt(); else this.m_StrBonus = -1; if (GetSaveFlag(flags, SaveFlag.DexBonus)) this.m_DexBonus = reader.ReadEncodedInt(); else this.m_DexBonus = -1; if (GetSaveFlag(flags, SaveFlag.IntBonus)) this.m_IntBonus = reader.ReadEncodedInt(); else this.m_IntBonus = -1; if (GetSaveFlag(flags, SaveFlag.StrReq)) this.m_StrReq = reader.ReadEncodedInt(); else this.m_StrReq = -1; if (GetSaveFlag(flags, SaveFlag.DexReq)) this.m_DexReq = reader.ReadEncodedInt(); else this.m_DexReq = -1; if (GetSaveFlag(flags, SaveFlag.IntReq)) this.m_IntReq = reader.ReadEncodedInt(); else this.m_IntReq = -1; if (GetSaveFlag(flags, SaveFlag.MedAllowance)) this.m_Meditate = (AMA)reader.ReadEncodedInt(); else this.m_Meditate = (AMA)(-1); if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) this.m_AosSkillBonuses = new AosSkillBonuses(this, reader); if (GetSaveFlag(flags, SaveFlag.PlayerConstructed)) this.m_PlayerConstructed = true; if (version > 7 && GetSaveFlag(flags, SaveFlag.xAbsorptionAttributes)) this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader); else this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); break; } case 4: { this.m_AosAttributes = new AosAttributes(this, reader); this.m_AosArmorAttributes = new AosArmorAttributes(this, reader); goto case 3; } case 3: { this.m_PhysicalBonus = reader.ReadInt(); this.m_FireBonus = reader.ReadInt(); this.m_ColdBonus = reader.ReadInt(); this.m_PoisonBonus = reader.ReadInt(); this.m_EnergyBonus = reader.ReadInt(); goto case 2; } case 2: case 1: { this.m_Identified = reader.ReadBool(); goto case 0; } case 0: { this.m_ArmorBase = reader.ReadInt(); this.m_MaxHitPoints = reader.ReadInt(); this.m_HitPoints = reader.ReadInt(); this.m_Crafter = reader.ReadMobile(); this.m_Quality = (ArmorQuality)reader.ReadInt(); this.m_Durability = (ArmorDurabilityLevel)reader.ReadInt(); this.m_Protection = (ArmorProtectionLevel)reader.ReadInt(); AMT mat = (AMT)reader.ReadInt(); if (this.m_ArmorBase == this.RevertArmorBase) this.m_ArmorBase = -1; /*m_BodyPos = (ArmorBodyType)*/reader.ReadInt(); if (version < 4) { this.m_AosAttributes = new AosAttributes(this); this.m_AosArmorAttributes = new AosArmorAttributes(this); } if (version < 3 && this.m_Quality == ArmorQuality.Exceptional) this.DistributeBonuses(6); if (version >= 2) { this.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; } this.m_Resource = CraftResources.GetFromOreInfo(info, mat); } this.m_StrBonus = reader.ReadInt(); this.m_DexBonus = reader.ReadInt(); this.m_IntBonus = reader.ReadInt(); this.m_StrReq = reader.ReadInt(); this.m_DexReq = reader.ReadInt(); this.m_IntReq = reader.ReadInt(); if (this.m_StrBonus == this.OldStrBonus) this.m_StrBonus = -1; if (this.m_DexBonus == this.OldDexBonus) this.m_DexBonus = -1; if (this.m_IntBonus == this.OldIntBonus) this.m_IntBonus = -1; if (this.m_StrReq == this.OldStrReq) this.m_StrReq = -1; if (this.m_DexReq == this.OldDexReq) this.m_DexReq = -1; if (this.m_IntReq == this.OldIntReq) this.m_IntReq = -1; this.m_Meditate = (AMA)reader.ReadInt(); if (this.m_Meditate == this.OldMedAllowance) this.m_Meditate = (AMA)(-1); if (this.m_Resource == CraftResource.None) { if (mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather) this.m_Resource = CraftResource.RegularLeather; else if (mat == ArmorMaterialType.Spined) this.m_Resource = CraftResource.SpinedLeather; else if (mat == ArmorMaterialType.Horned) this.m_Resource = CraftResource.HornedLeather; else if (mat == ArmorMaterialType.Barbed) this.m_Resource = CraftResource.BarbedLeather; else this.m_Resource = CraftResource.Iron; } if (this.m_MaxHitPoints == 0 && this.m_HitPoints == 0) this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); break; } } #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 (this.m_AosSkillBonuses == null) this.m_AosSkillBonuses = new AosSkillBonuses(this); if (Core.AOS && this.Parent is Mobile) this.m_AosSkillBonuses.AddTo((Mobile)this.Parent); int strBonus = this.ComputeStatBonus(StatType.Str); int dexBonus = this.ComputeStatBonus(StatType.Dex); int intBonus = this.ComputeStatBonus(StatType.Int); 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(); if (version < 7) this.m_PlayerConstructed = true; // we don't know, so, assume it's crafted }
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); this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); m_NegativeAttributes = new NegativeAttributes(this); #region Mondain's Legacy Sets this.m_SetAttributes = new AosAttributes(this); this.m_SetSkillBonuses = new AosSkillBonuses(this); #endregion }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch ( version ) { case 8: { this.m_IsImbued = reader.ReadBool(); goto case 7; } case 7: { m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader); #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(); m_PhysImbuing = reader.ReadInt(); m_FireImbuing = reader.ReadInt(); m_ColdImbuing = reader.ReadInt(); m_PoisonImbuing = reader.ReadInt(); m_EnergyImbuing = reader.ReadInt(); goto case 6; } case 6: { if(version == 6) m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); this.m_TimesImbued = reader.ReadInt(); #endregion this.m_BlessedBy = reader.ReadMobile(); #region Mondain's Legacy Sets SetFlag sflags = (SetFlag)reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.Attributes)) this.m_SetAttributes = new AosAttributes(this, reader); else this.m_SetAttributes = new AosAttributes(this); if (GetSaveFlag(sflags, SetFlag.ArmorAttributes)) this.m_SetSelfRepair = (new AosArmorAttributes(this, reader)).SelfRepair; if (GetSaveFlag(sflags, SetFlag.SkillBonuses)) this.m_SetSkillBonuses = new AosSkillBonuses(this, reader); else this.m_SetSkillBonuses = new AosSkillBonuses(this); if (GetSaveFlag(sflags, SetFlag.PhysicalBonus)) this.m_SetPhysicalBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.FireBonus)) this.m_SetFireBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.ColdBonus)) this.m_SetColdBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.PoisonBonus)) this.m_SetPoisonBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.EnergyBonus)) this.m_SetEnergyBonus = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.SetHue)) this.m_SetHue = reader.ReadEncodedInt(); if (GetSaveFlag(sflags, SetFlag.LastEquipped)) this.m_LastEquipped = reader.ReadBool(); if (GetSaveFlag(sflags, SetFlag.SetEquipped)) this.m_SetEquipped = reader.ReadBool(); if (GetSaveFlag(sflags, SetFlag.SetSelfRepair)) this.m_SetSelfRepair = reader.ReadEncodedInt(); #endregion goto case 5; } case 5: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.NegativeAttributes)) m_NegativeAttributes = new NegativeAttributes(this, reader); else m_NegativeAttributes = new NegativeAttributes(this); if (GetSaveFlag(flags, SaveFlag.Resource)) this.m_Resource = (CraftResource)reader.ReadEncodedInt(); else this.m_Resource = this.DefaultResource; if (GetSaveFlag(flags, SaveFlag.Attributes)) this.m_AosAttributes = new AosAttributes(this, reader); else this.m_AosAttributes = new AosAttributes(this); if (GetSaveFlag(flags, SaveFlag.ClothingAttributes)) this.m_AosClothingAttributes = new AosArmorAttributes(this, reader); else this.m_AosClothingAttributes = new AosArmorAttributes(this); if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) this.m_AosSkillBonuses = new AosSkillBonuses(this, reader); else this.m_AosSkillBonuses = new AosSkillBonuses(this); if (GetSaveFlag(flags, SaveFlag.Resistances)) this.m_AosResistances = new AosElementAttributes(this, reader); else this.m_AosResistances = new AosElementAttributes(this); if (GetSaveFlag(flags, SaveFlag.MaxHitPoints)) this.m_MaxHitPoints = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.HitPoints)) this.m_HitPoints = reader.ReadEncodedInt(); if (GetSaveFlag(flags, SaveFlag.Crafter)) this.m_Crafter = reader.ReadMobile(); if (GetSaveFlag(flags, SaveFlag.Quality)) this.m_Quality = (ClothingQuality)reader.ReadEncodedInt(); else this.m_Quality = ClothingQuality.Regular; if (GetSaveFlag(flags, SaveFlag.StrReq)) this.m_StrReq = reader.ReadEncodedInt(); else this.m_StrReq = -1; if (GetSaveFlag(flags, SaveFlag.PlayerConstructed)) this.m_PlayerConstructed = true; break; } case 4: { this.m_Resource = (CraftResource)reader.ReadInt(); goto case 3; } case 3: { this.m_AosAttributes = new AosAttributes(this, reader); this.m_AosClothingAttributes = new AosArmorAttributes(this, reader); this.m_AosSkillBonuses = new AosSkillBonuses(this, reader); this.m_AosResistances = new AosElementAttributes(this, reader); goto case 2; } case 2: { this.m_PlayerConstructed = reader.ReadBool(); goto case 1; } case 1: { this.m_Crafter = reader.ReadMobile(); this.m_Quality = (ClothingQuality)reader.ReadInt(); break; } case 0: { this.m_Crafter = null; this.m_Quality = ClothingQuality.Regular; break; } } #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_PlayerConstructed = true; // we don't know, so, assume it's crafted if (version < 3) { this.m_AosAttributes = new AosAttributes(this); this.m_AosClothingAttributes = new AosArmorAttributes(this); this.m_AosSkillBonuses = new AosSkillBonuses(this); this.m_AosResistances = new AosElementAttributes(this); } if (version < 4) this.m_Resource = this.DefaultResource; if (this.m_MaxHitPoints == 0 && this.m_HitPoints == 0) this.m_HitPoints = this.m_MaxHitPoints = Utility.RandomMinMax(this.InitMinHits, this.InitMaxHits); Mobile parent = this.Parent as Mobile; if (parent != null) { if (Core.AOS) this.m_AosSkillBonuses.AddTo(parent); this.AddStatBonuses(parent); parent.CheckStatTimers(); } }
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); m_NegativeAttributes = new NegativeAttributes(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 override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 14: { m_IsImbued = reader.ReadBool(); goto case 13; } case 13: 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; if(version < 13) flags = (SaveFlag)reader.ReadInt(); else flags = (SaveFlag)reader.ReadLong(); 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); } if (version >= 13 && GetSaveFlag(flags, SaveFlag.xNegativeAttributes)) { m_NegativeAttributes = new NegativeAttributes(this, reader); } else { m_NegativeAttributes = new NegativeAttributes(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 ProcessKill(Mobile victim, Mobile killer) { PlayerMobile pm = killer as PlayerMobile; BaseCreature bc = victim as BaseCreature; if (pm == null || bc == null || bc.NoKillAwards || !pm.Alive) { return; } //Make sure its a boss we killed!! bool boss = bc is Impaler || bc is DemonKnight || bc is DarknightCreeper || bc is FleshRenderer || bc is ShadowKnight || bc is AbysmalHorror; if (!boss) { return; } int luck = Math.Max(0, pm.RealLuck); AwardPoints(pm, (int)Math.Max(0, (bc.Fame * (1 + Math.Sqrt(luck) / 100)) / 2)); double gpoints = GetPoints(pm); const double A = 0.000863316841; const double B = 0.00000425531915; double chance = A * Math.Pow(10, B * gpoints); double roll = Utility.RandomDouble(); if (chance > roll) { Item i = null; int ran = Utility.Random(m_RewardTable.Length + 1); if (ran >= m_RewardTable.Length) { i = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(killer), LootPackEntry.IsMondain(killer), LootPackEntry.IsStygian(killer)); RunicReforging.GenerateRandomArtifactItem(i, luck, Utility.RandomMinMax(800, 1200)); NegativeAttributes attrs = RunicReforging.GetNegativeAttributes(i); if (attrs != null) { attrs.Prized = 1; } } else { Type[] list = m_RewardTable[ran]; Type t = list.Length == 1 ? list[0] : list[Utility.Random(list.Length)]; i = Activator.CreateInstance(t) as Item; } if (i != null) { pm.SendLocalizedMessage(1062317); // For your valor in combating the fallen beast, a special artifact has been bestowed on you. pm.PlaySound(0x5B4); if (!pm.PlaceInBackpack(i)) { if (pm.BankBox != null && pm.BankBox.TryDropItem(killer, i, false)) { pm.SendLocalizedMessage(1079730); // The item has been placed into your bank box. } else { pm.SendLocalizedMessage(1072523); // You find an artifact, but your backpack and bank are too full to hold it. i.MoveToWorld(pm.Location, pm.Map); } } SetPoints(pm, 0); } } }
public override void OnConfirmed(CollectionItem citem, int index) { Item item; if (citem.Type == typeof(VvVPotionKeg)) { PotionType type; switch (index) { default: case 0: type = PotionType.GreaterStamina; break; case 1: type = PotionType.Supernova; break; case 2: type = PotionType.StatLossRemoval; break; case 3: type = PotionType.AntiParalysis; break; } item = new VvVPotionKeg(type); } else if (citem.Type == typeof(VvVSteedStatuette)) { SteedType type = index == 5 || index == 6 ? SteedType.WarHorse : SteedType.Ostard; item = new VvVSteedStatuette(type, citem.Hue); } else if (citem.Type == typeof(VvVTrapKit)) { TrapType type; switch (index - 11) { default: case 0: type = TrapType.Poison; break; case 1: type = TrapType.Cold; break; case 2: type = TrapType.Energy; break; case 3: type = TrapType.Blade; break; case 4: type = TrapType.Explosion; break; } item = new VvVTrapKit(type); } else if (citem.Type == typeof(VvVRobe) || citem.Type == typeof(VvVHairDye)) { item = Activator.CreateInstance(citem.Type, citem.Hue) as Item; } else if (citem.Type == typeof(ScrollofTranscendence)) { item = ScrollofTranscendence.CreateRandom(10, 10); } else { item = Activator.CreateInstance(citem.Type) as Item; } if (item != null) { if (item is IOwnerRestricted) { ((IOwnerRestricted)item).Owner = User; } if (item is IAccountRestricted && User.Account != null) { ((IAccountRestricted)item).Account = User.Account.Username; } NegativeAttributes neg = RunicReforging.GetNegativeAttributes(item); if (neg != null) { neg.Antique = 1; if (item is IDurability && ((IDurability)item).MaxHitPoints == 0) { ((IDurability)item).MaxHitPoints = 255; ((IDurability)item).HitPoints = 255; } } ViceVsVirtueSystem.Instance.AddVvVItem(item); if (User.Backpack == null || !User.Backpack.TryDropItem(User, item, false)) { User.SendLocalizedMessage(1074361); // The reward could not be given. Make sure you have room in your pack. item.Delete(); } else { if (User.AccessLevel == AccessLevel.Player) { PointsSystem.ViceVsVirtue.DeductPoints(User, citem.Points); } User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack. User.PlaySound(0x5A7); } } }
public void StockInventory() { if (Backpack == null) { AddItem(new Backpack()); } foreach (CollectionItem item in VvVRewards.Rewards) { if (item.Tooltip == 0) { if (Backpack.GetAmount(item.Type) > 0) { Item itm = Backpack.FindItemByType(item.Type); if (itm is IVvVItem) { ((IVvVItem)itm).IsVvVItem = true; } continue; } Item i = Activator.CreateInstance(item.Type) as Item; if (i != null) { if (i is IOwnerRestricted) { ((IOwnerRestricted)i).OwnerName = "Your Player Name"; } if (i is IVvVItem) { ((IVvVItem)i).IsVvVItem = true; } if (i is VesperOrderShield) { i.Name = "Order Shield"; ((VesperOrderShield)i).Attributes.CastSpeed = 0; } NegativeAttributes neg = RunicReforging.GetNegativeAttributes(i); if (neg != null) { neg.Antique = 1; if (i is IDurability && ((IDurability)i).MaxHitPoints == 0) { ((IDurability)i).MaxHitPoints = 255; ((IDurability)i).HitPoints = 255; } } Backpack.DropItem(i); } } } }