public static bool Slays(TalismanSlayerName name, Mobile m) { if (name == TalismanSlayerName.None) { return(false); } Type[] types = m_Table[name]; if (types == null || m == null) { return(false); } Type type = m.GetType(); for (int i = 0; i < types.Length; i++) { if (types[i] == type) { return(true); } } return(false); }
public static bool Slays(TalismanSlayerName name, Mobile m) { if (!m_Table.ContainsKey(name)) { return(false); } Type[] types = m_Table[name]; if (types == null || m == null) { return(false); } Type type = m.GetType(); for (int i = 0; i < types.Length; i++) { if (types[i].IsAssignableFrom(type)) { return(true); } } return(false); }
public static double GetWeight(this TalismanSlayerName attr) { if (!TalismanSlayerAttrFactors.ContainsKey(attr)) { TalismanSlayerAttrFactors.Add(attr, new AttributeFactors()); } return(TalismanSlayerAttrFactors[attr].Weight); }
public static int GetInc(this TalismanSlayerName attr) { if (!TalismanSlayerAttrFactors.ContainsKey(attr)) { TalismanSlayerAttrFactors.Add(attr, new AttributeFactors()); } return(TalismanSlayerAttrFactors[attr].Inc); }
public static Type[] GetSlayer(TalismanSlayerName name) { if (m_Table == null) { InitSlayer(); } return((Type[])m_Table[name]); }
private static bool HasTalismanSlayer(Item item, string name, TalismanSlayerName attr) { PropertyInfo pi = item.GetType().GetProperty(name, TypeOfTalismanSlayerName); if (pi == null) { return(false); } return((TalismanSlayerName)pi.GetValue(item, null) == attr); }
public static int GetModForAttribute(TalismanSlayerName attr) { foreach (KeyValuePair <int, ImbuingDefinition> kvp in m_Table) { int mod = kvp.Key; ImbuingDefinition def = kvp.Value; if (def.Attribute is TalismanSlayerName && (TalismanSlayerName)def.Attribute == attr) { return(mod); } } return(-1); }
public static void SetMax(this TalismanSlayerName attr, int max) { if (!TalismanSlayerAttrFactors.ContainsKey(attr)) { TalismanSlayerAttrFactors.Add( attr, new AttributeFactors { Max = max }); } else { TalismanSlayerAttrFactors[attr].Max = max; } }
public static void SetInc(this TalismanSlayerName attr, int inc) { if (!TalismanSlayerAttrFactors.ContainsKey(attr)) { TalismanSlayerAttrFactors.Add( attr, new AttributeFactors { Inc = inc }); } else { TalismanSlayerAttrFactors[attr].Inc = inc; } }
public static void SetMin(this TalismanSlayerName attr, int min) { if (!TalismanSlayerAttrFactors.ContainsKey(attr)) { TalismanSlayerAttrFactors.Add( attr, new AttributeFactors { Min = min }); } else { TalismanSlayerAttrFactors[attr].Min = min; } }
public static void SetWeight(this TalismanSlayerName attr, double weight) { if (!TalismanSlayerAttrFactors.ContainsKey(attr)) { TalismanSlayerAttrFactors.Add( attr, new AttributeFactors { Weight = weight }); } else { TalismanSlayerAttrFactors[attr].Weight = weight; } }
public static bool Slays(TalismanSlayerName name, Mobile m) { if (m == null || !m_Table.TryGetValue(name, out var types) || types == null) { return(false); } var type = m.GetType(); for (var i = 0; i < types.Length; i++) { if (types[i].IsAssignableFrom(type)) { return(true); } } return(false); }
public static bool Slays( TalismanSlayerName name, Mobile m ) { if ( !m_Table.ContainsKey( name ) ) return false; Type[] types = m_Table[ name ]; if ( types == null || m == null ) return false; Type type = m.GetType(); for ( int i = 0; i < types.Length; i++ ) { if ( types[ i ] == type ) return true; } return false; }
public static bool Check(TalismanSlayerName name, BaseCreature creature) { Type[] types = GetSlayer(name); if (types == null || creature == null) { return(false); } for (int i = 0; i < types.Length; i++) { Type type = types[i]; if (type == creature.GetType()) { return(true); } } return(false); }
public static bool Slays(TalismanSlayerName name, Mobile m) { if (m.SpecialSlayerMechanics) { if (m.SlayerVulnerabilities.Contains(name.ToString())) { return(true); } else { return(false); } } if (!m_Table.ContainsKey(name)) { return(false); } Type[] types = m_Table[name]; if (types == null || m == null) { return(false); } Type type = m.GetType(); for (int i = 0; i < types.Length; i++) { if (types[i].IsAssignableFrom(type)) { return(true); } } return(false); }
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.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 static bool Slays( TalismanSlayerName name, Mobile m ) { if ( name == TalismanSlayerName.None ) return false; Type[] types = m_Table[ name ]; if ( types == null || m == null ) return false; Type type = m.GetType(); for ( int i = 0; i < types.Length; i++ ) { if ( types[ i ] == type ) return true; } return false; }
public static string ToString(this TalismanSlayerName attr, double val, bool html = true) { return(GetPropertyString(val, html)); }
public static bool IsSuper(this TalismanSlayerName attr) { return(SuperTalismanSlayers.Contains(attr)); }
public static bool HasSlayer(this Item item, TalismanSlayerName attr) { return (HasTalismanSlayer(item, "Slayer", attr) || HasTalismanSlayer(item, "Slayer1", attr) || HasTalismanSlayer(item, "Slayer2", attr) || HasTalismanSlayer(item, "Slayer3", attr) || HasTalismanSlayer(item, "Slayer4", attr)); }
public static bool Slays(TalismanSlayerName name, Mobile m) { if (m == null || !m_Table.TryGetValue(name, out Type[] types) || types == null)
public static bool Slays(TalismanSlayerName name, Mobile m) { if (!m_Table.ContainsKey(name)) return false; Type[] types = m_Table[name]; if (types == null || m == null) return false; Type type = m.GetType(); for (int i = 0; i < types.Length; i++) { if (types[i].IsAssignableFrom(type)) return true; } return false; }
private static bool HasTalismanSlayer(Item item, string name, TalismanSlayerName attr) { var pi = item.GetType().GetProperty(name, TypeOfTalismanSlayerName); if (pi == null) { return false; } return ((TalismanSlayerName)pi.GetValue(item, null) == attr); }
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 static Type[] GetSlayer( TalismanSlayerName name ) { if ( m_Table == null ) InitSlayer(); return (Type[]) m_Table[ name ]; }
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 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 static bool Check( TalismanSlayerName name, BaseCreature creature ) { Type[] types = GetSlayer( name ); if ( types == null || creature == null ) return false; for ( int i = 0; i < types.Length; i ++ ) { Type type = types[ i ]; if ( type == creature.GetType() ) return true; } return false; }
public static bool Slays(TalismanSlayerName name, Mobile m) { if (m.SpecialSlayerMechanics) { if (m.SlayerVulnerabilities.Contains(name.ToString())) return true; else return false; } if (!m_Table.ContainsKey(name)) return false; Type[] types = m_Table[name]; if (types == null || m == null) return false; Type type = m.GetType(); for (int i = 0; i < types.Length; i++) { if (types[i].IsAssignableFrom(type)) return true; } return false; }
public static bool HasSlayer(this Item item, TalismanSlayerName attr) { return(HasTalismanSlayer(item, "Slayer", attr) || HasTalismanSlayer(item, "Slayer1", attr) || HasTalismanSlayer(item, "Slayer2", attr) || HasTalismanSlayer(item, "Slayer3", attr) || HasTalismanSlayer(item, "Slayer4", attr)); }
private static double GetSlayerWeight(TalismanSlayerName attr) { if (attr == TalismanSlayerName.None) { return 0; } return IsSuper(attr) ? 1.3 : 1.1; }
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 static int GetModForAttribute(TalismanSlayerName attr) { foreach (KeyValuePair<int, ImbuingDefinition> kvp in m_Table) { int mod = kvp.Key; ImbuingDefinition def = kvp.Value; if (def.Attribute is TalismanSlayerName && (TalismanSlayerName)def.Attribute == attr) return mod; } return -1; }