コード例 #1
0
        public void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();
            m_DuelType = reader.ReadInt();
            m_Potions = reader.ReadBool();
            m_Summoning = reader.ReadBool();
            m_Looting = reader.ReadBool();
            m_player1 = reader.ReadMobile();
            m_player2 = reader.ReadMobile();
            m_start = reader.ReadDateTime();
            m_end = reader.ReadDateTime();
            m_winner = reader.ReadInt();
            m_Arena = (ArenaControl)reader.ReadItem();

            int duelTicks = reader.ReadInt();
            if (duelTicks > 0)
            {
                m_DuelTimer = new DuelTimer(this, duelTicks);
                m_DuelTimer.Start();
            }

            int countTicks = reader.ReadInt();
            if (countTicks > 0)
            {
                m_CountTimer = new CountTimer(this, countTicks);
                m_CountTimer.Start();
            }
        }
コード例 #2
0
/*
		private bool WeapAllowed(BaseWeapon weap)
		{
			bool poisoned = weap.Poison != null && weap.PoisonCharges > 0;
			bool magic = weap.AccuracyLevel != WeaponAccuracyLevel.Regular || weap.DamageLevel != WeaponDamageLevel.Regular || weap.DurabilityLevel != WeaponDurabilityLevel.Regular;
			bool typeBanned = m_DuelType == 1 && !(weap is Dagger);
			bool factionItem = weap is IFactionItem && ((IFactionItem)weap).FactionItemState != null;
			bool tribal = weap is TribalSpear;

			return !poisoned && !magic && !typeBanned && !factionItem && !tribal;
		}

*/
        public void StartDuel()
        {

            BitArray m_RestrictedSpells = m_Arena.RestrictedSpells;
            BitArray m_RestrictedSkills = m_Arena.RestrictedSkills;

            // Set permissions
            for (int i = 0; i < m_RestrictedSpells.Length; i++)
            {						// Teleport		Recall		Mark	GateTravel					Summonings
                m_RestrictedSpells[i] = i == 21 || i == 31 || i == 44 || i == 51 || (!m_Summoning && i == 39 || i == 59 || i == 60 || i == 61 || i == 62 || i == 63) || !m_Magery;
            }

            for (int i = 0; i < m_RestrictedSkills.Length; i++)
            {
                if (m_DuelType == 1)
                {
                    m_RestrictedSkills[i] = i != (int)SkillName.Magery && i != (int)SkillName.Meditation && i != (int)SkillName.Wrestling &&
                        i != (int)SkillName.EvalInt && i != (int)SkillName.MagicResist;
                }
                else //if (m_DuelType == 2)
                {
                    m_RestrictedSkills[i] = false;
                }
            }

            // Set arena flags
            m_Arena.AllowBenifitPlayer = true;
            m_Arena.AllowHarmPlayer = true;
            m_Arena.CanBeDamaged = true;
            m_Arena.CanHeal = true;
            m_Arena.CanRessurect = true;
            m_Arena.AllowBenifitNPC = m_Summoning;
            m_Arena.AllowHarmNPC = m_Summoning;
            m_Arena.CanLootPlayerCorpse = m_Looting;
            m_Arena.CanLootNPCCorpse = m_Looting;
            m_Arena.CanUsePotions = m_Potions;

            m_player1.Frozen = false;
            m_player2.Frozen = false;

            m_DuelTimer = new DuelTimer(this, 15);
            m_DuelTimer.Start();
        }