Example #1
0
        public static int GetSlayerTitle(TalisSlayerName npcname)
        {
            if (npcname == TalisSlayerName.None)
            {
                return(0);
            }

            int v = (int)npcname - 1;

            if (v >= 0 && v < m_Table.Length)
            {
                return(m_Table[v].m_Title);
            }

            return(0);
        }
Example #2
0
        public static bool IsSlayer(TalisSlayerName npcname, Mobile m)
        {
            if (npcname == TalisSlayerName.None)
            {
                return(false);
            }

            int v = (int)npcname - 1;

            if (v >= 0 && v < m_Table.Length)
            {
                Type t = m.GetType();

                for (int i = 0; i < m_Table[v].m_NPCs.Length; ++i)
                {
                    if (m_Table[v].m_NPCs[i] == t)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #3
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 4:
                    {
                        m_MaxHitPoints = reader.ReadEncodedInt();
                        m_HitPoints = reader.ReadEncodedInt();

                        goto case 3;
                    }
                case 3:
                    {
                        m_Slayer = (SlayerName) reader.ReadInt();
                        m_Slayer2 = (SlayerName) reader.ReadInt();

                        goto case 2;
                    }
                case 2:
                    {
                        m_Ownable = (bool) reader.ReadBool();
                        m_Owner = (Mobile) reader.ReadMobile();
                        m_CraftBonusRegular = (CraftList) reader.ReadInt();
                        m_CraftBonusRegularValue = reader.ReadInt();
                        m_CraftBonusExcep = (CraftList) reader.ReadInt();
                        m_CraftBonusExcepValue = reader.ReadInt();
                        m_ProtectionEntry = (NPC_Name) reader.ReadInt();
                        m_ProtectionValue = reader.ReadInt();
                        m_KillersEntry = (NPC_Name) reader.ReadInt();
                        m_KillersValue = reader.ReadInt();
                        m_TalisSlayer = (TalisSlayerName) reader.ReadInt();
                        m_TalismanType = (TalismanType) reader.ReadInt();
                        m_Charges = reader.ReadInt();

                        goto case 1;
                    }
                case 1:
                    {
                        m_MagicalAttributes = new MagicalAttributes( this, reader );
                        m_AosResistances = new ElementAttributes( this, reader );
                        m_SkillBonuses = new SkillBonuses( this, reader );

                        if ( Parent is Mobile )
                        {
                            //-------- Charged Time Left -----------

                            m_isequiped = true;
                            InvalidateProperties();

                            //------ FIN Charged Time Left ---------
                            m_SkillBonuses.AddTo( (Mobile) Parent );
                        }

                        int strBonus = m_MagicalAttributes.BonusStr;
                        int dexBonus = m_MagicalAttributes.BonusDex;
                        int intBonus = m_MagicalAttributes.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:
                    {
                        if ( Parent is Mobile )
                        {
                            //-------- Charged Time Left -----------

                            m_isequiped = true;
                            InvalidateProperties();

                            //------ FIN Charged Time Left ---------
                            m_SkillBonuses.AddTo( (Mobile) Parent );
                        }
                        m_MagicalAttributes = new MagicalAttributes( this );
                        m_AosResistances = new ElementAttributes( this );
                        m_SkillBonuses = new SkillBonuses( this );

                        break;
                    }
            }

            if ( version < 2 )
            {
                m_Ownable = (bool) reader.ReadBool();
                m_Owner = (Mobile) reader.ReadMobile();
                m_CraftBonusRegular = (CraftList) reader.ReadInt();
                m_CraftBonusRegularValue = reader.ReadInt();
                m_CraftBonusExcep = (CraftList) reader.ReadInt();
                m_CraftBonusExcepValue = reader.ReadInt();
                m_ProtectionEntry = (NPC_Name) reader.ReadInt();
                m_ProtectionValue = reader.ReadInt();
                m_KillersEntry = (NPC_Name) reader.ReadInt();
                m_KillersValue = reader.ReadInt();
                m_TalisSlayer = (TalisSlayerName) reader.ReadInt();
                m_TalismanType = (TalismanType) reader.ReadInt();
                m_Charges = reader.ReadInt();
            }
        }
Example #4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
            {
                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 3;
            }

            case 3:
            {
                m_Slayer  = (SlayerName)reader.ReadInt();
                m_Slayer2 = (SlayerName)reader.ReadInt();

                goto case 2;
            }

            case 2:
            {
                m_Ownable                = (bool)reader.ReadBool();
                m_Owner                  = (Mobile)reader.ReadMobile();
                m_CraftBonusRegular      = (CraftList)reader.ReadInt();
                m_CraftBonusRegularValue = reader.ReadInt();
                m_CraftBonusExcep        = (CraftList)reader.ReadInt();
                m_CraftBonusExcepValue   = reader.ReadInt();
                m_ProtectionEntry        = (NPC_Name)reader.ReadInt();
                m_ProtectionValue        = reader.ReadInt();
                m_KillersEntry           = (NPC_Name)reader.ReadInt();
                m_KillersValue           = reader.ReadInt();
                m_TalisSlayer            = (TalisSlayerName)reader.ReadInt();
                m_TalismanType           = (TalismanType)reader.ReadInt();
                m_Charges                = reader.ReadInt();

                goto case 1;
            }

            case 1:
            {
                m_MagicalAttributes = new MagicalAttributes(this, reader);
                m_AosResistances    = new ElementAttributes(this, reader);
                m_SkillBonuses      = new SkillBonuses(this, reader);

                if (Parent is Mobile)
                {
                    //-------- Charged Time Left -----------

                    m_isequiped = true;
                    InvalidateProperties();

                    //------ FIN Charged Time Left ---------
                    m_SkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_MagicalAttributes.BonusStr;
                int dexBonus = m_MagicalAttributes.BonusDex;
                int intBonus = m_MagicalAttributes.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:
            {
                if (Parent is Mobile)
                {
                    //-------- Charged Time Left -----------

                    m_isequiped = true;
                    InvalidateProperties();

                    //------ FIN Charged Time Left ---------
                    m_SkillBonuses.AddTo((Mobile)Parent);
                }
                m_MagicalAttributes = new MagicalAttributes(this);
                m_AosResistances    = new ElementAttributes(this);
                m_SkillBonuses      = new SkillBonuses(this);

                break;
            }
            }

            if (version < 2)
            {
                m_Ownable                = (bool)reader.ReadBool();
                m_Owner                  = (Mobile)reader.ReadMobile();
                m_CraftBonusRegular      = (CraftList)reader.ReadInt();
                m_CraftBonusRegularValue = reader.ReadInt();
                m_CraftBonusExcep        = (CraftList)reader.ReadInt();
                m_CraftBonusExcepValue   = reader.ReadInt();
                m_ProtectionEntry        = (NPC_Name)reader.ReadInt();
                m_ProtectionValue        = reader.ReadInt();
                m_KillersEntry           = (NPC_Name)reader.ReadInt();
                m_KillersValue           = reader.ReadInt();
                m_TalisSlayer            = (TalisSlayerName)reader.ReadInt();
                m_TalismanType           = (TalismanType)reader.ReadInt();
                m_Charges                = reader.ReadInt();
            }
        }
Example #5
0
 public TalisSlayerEntry(TalisSlayerName name, int title, params Type[] npcs)
 {
     m_Name  = name;
     m_Title = title;
     m_NPCs  = npcs;
 }
Example #6
0
        public static int GetSlayerTitle( TalisSlayerName npcname )
        {
            if ( npcname == TalisSlayerName.None )
                return 0;

            int v = (int) npcname - 1;

            if ( v >= 0 && v < m_Table.Length )
                return m_Table[v].m_Title;

            return 0;
        }
Example #7
0
 public TalisSlayerEntry( TalisSlayerName name, int title, params Type[] npcs )
 {
     m_Name = name;
     m_Title = title;
     m_NPCs = npcs;
 }
Example #8
0
        public static bool IsSlayer( TalisSlayerName npcname, Mobile m )
        {
            if ( npcname == TalisSlayerName.None )
                return false;

            int v = (int) npcname - 1;

            if ( v >= 0 && v < m_Table.Length )
            {
                Type t = m.GetType();

                for ( int i = 0; i < m_Table[v].m_NPCs.Length; ++i )
                {
                    if ( m_Table[v].m_NPCs[i] == t )
                        return true;
                }
            }

            return false;
        }