protected override void OnTick()
        {
            m_Count--;
            if (m_Count == 0)
            {
                if (m_Item.ChallengeTeam.Count == 0)
                {
                    m_ChallengerMobile.SendMessage(43, "Timer has expired, try again later.");
                    m.IsInChallenge = false;
                }
                foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                {
                    opponent.SendMessage(43, String.Format(Error));
                }
                foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                {
                    challenger.SendMessage(43, String.Format(Error));
                }
                m_Item.ClearAll();
                m_ChallengerMobile.CloseGump(typeof(FinalGump));
                m_ChallengerMobile.CloseGump(typeof(PartnerGump));
                Stop();
            }

            if (m_ChallengerMobile.NetState == null)
            {
                m_Item.ClearAll();
                Stop();
            }
        }
Exemple #2
0
            protected override void OnTick()
            {
                m_Seconds--;
                m_Count = (m_Seconds / 60);

                if ((m_Count % 5) == 0 && m_Count <= 30 && (double)m_Count == (double)m_Seconds / 60)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        pm.SendMessage("The Duel will end in {0} minutes ", m_Count);
                    }
                }
                else if (m_Count == 1 && (double)m_Count == (double)m_Seconds / 60)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        pm.SendMessage("1 minute left");
                    }
                }
                else if (m_Seconds <= 10)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        pm.SendMessage("{0}", m_Seconds);
                    }
                }
                else if (m_Count == 0)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        pm.SendMessage(43, "You failed to kill your opponent. The game is ending...");
                        pm.SendMessage(43, "Don't forget to retreive your items from the bank!!");
                        attrib(pm as Mobile);
                    }

                    foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                    {
                        challenger.Location = m_Item.m_ChallengerExitPointDest;
                    }

                    foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                    {
                        opponent.Location = m_Item.m_OpponentExitPointDest;
                    }

                    m_Item.ClearAll();
                    Stop();
                }
                foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                {
                    if (!challenger.Alive)
                    {
                        if (!m_Item.ChallengerDead.Contains(challenger))
                        {
                            m_Item.AddChallengerDead(challenger);
                        }
                    }
                }
                foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                {
                    if (!opponent.Alive)
                    {
                        if (!m_Item.OpponentDead.Contains(opponent))
                        {
                            m_Item.AddOpponentDead(opponent);
                        }
                    }
                }
                if (m_Item.ChallengerDead.Count == m_Item.ChallengeTeam.Count || m_Item.OpponentDead.Count == m_Item.OpponentTeam.Count)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        attrib(pm as Mobile);
                    }
                    foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                    {
                        if (challenger.NetState != null)
                        {
                            challenger.Location = m_Item.m_ChallengerExitPointDest;
                        }
                        else
                        {
                            challenger.LogoutLocation = new Point3D(1416, 1700, 1);
                        }
                    }
                    foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                    {
                        if (opponent.NetState != null)
                        {
                            opponent.Location = m_Item.m_OpponentExitPointDest;
                        }
                        else
                        {
                            opponent.LogoutLocation = new Point3D(1416, 1700, 1);
                        }
                    }
                    if (m_Item.ChallengerDead.Count == m_Item.ChallengeTeam.Count && m_Item.OpponentDead.Count == m_Item.OpponentTeam.Count)
                    {
                        foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                        {
                            challenger.SendMessage(63, "Neither side lost, due to all fighters being dead..");
                        }

                        foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                        {
                            opponent.SendMessage(63, "Neither side lost, due to all fighters being dead..");
                        }
                    }
                    if (m_Item.ChallengerDead.Count == m_Item.ChallengeTeam.Count)
                    {
                        foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                        {
                            Account killerAccount = opponent.Account as Account;

                            foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                            {
                                Account victimAccount = challenger.Account as Account;

                                ArrayList killerList;
                                ArrayList victimList;

                                killerList = new ArrayList(killerAccount.LoginIPs);
                                victimList = new ArrayList(victimAccount.LoginIPs);

                                for (int i = 0; i < killerList.Count; i++)
                                {
                                    for (int j = 0; j < victimList.Count; j++)
                                    {
                                        if (Convert.ToString(victimList[j] as IPAddress) == Convert.ToString(killerList[i] as IPAddress))
                                        {
                                            m_Item.m_SameAccount = true;
                                            break;
                                        }
                                    }
                                    if (m_Item.m_SameAccount)
                                    {
                                        break;
                                    }
                                }
                                if (m_Item.m_SameAccount)
                                {
                                    break;
                                }
                            }
                            if (m_Item.m_SameAccount)
                            {
                                break;
                            }
                        }

                        foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                        {
                            for (int i = 0; i < m_Item.ChallengeTeam.Count; i++)
                            {
                                PlayerMobile challenger = (PlayerMobile)(m_Item.ChallengeTeam[i]);
                                if (opponent.Name == challenger.Name)
                                {
                                    m_Item.m_LastKiller = true;
                                }
                            }
                            winner(opponent);
                        }
                        foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                        {
                            loser(challenger);
                        }
                    }
                    if (m_Item.OpponentDead.Count == m_Item.OpponentTeam.Count)
                    {
                        foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                        {
                            Account killerAccount = opponent.Account as Account;

                            foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                            {
                                Account victimAccount = challenger.Account as Account;

                                ArrayList killerList;
                                ArrayList victimList;

                                killerList = new ArrayList(killerAccount.LoginIPs);
                                victimList = new ArrayList(victimAccount.LoginIPs);

                                for (int i = 0; i < killerList.Count; i++)
                                {
                                    for (int j = 0; j < victimList.Count; j++)
                                    {
                                        if (Convert.ToString(victimList[j] as IPAddress) == Convert.ToString(killerList[i] as IPAddress))
                                        {
                                            m_Item.m_SameAccount = true;
                                            break;
                                        }
                                    }
                                    if (m_Item.m_SameAccount)
                                    {
                                        break;
                                    }
                                }
                                if (m_Item.m_SameAccount)
                                {
                                    break;
                                }
                            }
                            if (m_Item.m_SameAccount)
                            {
                                break;
                            }
                        }

                        foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                        {
                            for (int i = 0; i < m_Item.OpponentTeam.Count; i++)
                            {
                                PlayerMobile opponent = (PlayerMobile)(m_Item.OpponentTeam[i]);
                                if (challenger.Name == opponent.Name)
                                {
                                    m_Item.m_LastKiller = true;
                                }
                            }
                            winner(challenger);
                        }
                        foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                        {
                            loser(opponent);
                        }
                    }
                    m_Item.ClearAll();
                    Stop();
                }
                else if (m_Count != 0)
                {
                    bool someoneleft = false;
                    foreach (PlayerMobile pm in m_Players)
                    {
                        if (pm.Region.Name != "DuelPit")
                        {
                            someoneleft = true;
                            break;
                        }
                    }

                    if (someoneleft)
                    {
                        foreach (PlayerMobile pm in m_Players)
                        {
                            pm.SendMessage(43, "Someone lost connection. The game is ending...");
                            pm.SendMessage(43, "Don't forget to retreive your items from the bank!!");
                            attrib(pm as Mobile);
                        }

                        foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                        {
                            challenger.Location = m_Item.m_ChallengerExitPointDest;
                        }

                        foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                        {
                            opponent.Location = m_Item.m_OpponentExitPointDest;
                        }

                        m_Item.ClearAll();
                        Stop();
                    }
                }
            }
Exemple #3
0
            protected override void OnTick()
            {
                m_Seconds--;
                m_Count = (m_Seconds / 60);

                if ((m_Count % 5) == 0 && m_Count <= 30 && (double)m_Count == (double)m_Seconds / 60)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        pm.SendMessage("The Duel will end in {0} minutes ", m_Count);
                    }
                }
                else if (m_Count == 1 && (double)m_Count == (double)m_Seconds / 60)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        pm.SendMessage("1 minute left");
                    }
                }
                else if (m_Seconds <= 10)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        pm.SendMessage("{0}", m_Seconds);
                    }
                }
                else if (m_Count == 0)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        pm.SendMessage(43, "You failed to kill your opponent. The game is ending...");
                        pm.SendMessage(43, "Don't forget to retreive your items from the bank!!");
                        attrib(pm as Mobile);
                    }

                    foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                    {
                        challenger.Location = m_Item.m_ChallengerExitPointDest;
                        challenger.Map      = m_Item.m_MapOrig;
                    }

                    foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                    {
                        opponent.Location = m_Item.m_OpponentExitPointDest;
                        opponent.Map      = m_Item.m_MapOrig;
                    }

                    m_Item.ClearAll();
                    Stop();
                }
                foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                {
                    if (!challenger.Alive)
                    {
                        if (!m_Item.ChallengerDead.Contains(challenger))
                        {
                            m_Item.AddChallengerDead(challenger);
                        }
                    }
                }
                foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                {
                    if (!opponent.Alive)
                    {
                        if (!m_Item.OpponentDead.Contains(opponent))
                        {
                            m_Item.AddOpponentDead(opponent);
                        }
                    }
                }
                if (m_Item.ChallengerDead.Count == m_Item.ChallengeTeam.Count || m_Item.OpponentDead.Count == m_Item.OpponentTeam.Count)
                {
                    foreach (PlayerMobile pm in m_Players)
                    {
                        attrib(pm as Mobile);
                    }
                    foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                    {
                        if (challenger.NetState != null)
                        {
                            challenger.Location = m_Item.m_ChallengerExitPointDest;
                            challenger.Map      = m_Item.m_MapOrig;
                        }
                        else
                        {
                            challenger.LogoutLocation = m_Item.m_ChallengerExitPointDest;
                        }
                    }
                    foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                    {
                        if (opponent.NetState != null)
                        {
                            opponent.Location = m_Item.m_OpponentExitPointDest;
                            opponent.Map      = m_Item.m_MapOrig;
                        }
                        else
                        {
                            opponent.LogoutLocation = m_Item.m_OpponentExitPointDest;
                        }
                    }
                    if (m_Item.ChallengerDead.Count == m_Item.ChallengeTeam.Count && m_Item.OpponentDead.Count == m_Item.OpponentTeam.Count)
                    {
                        foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                        {
                            challenger.SendMessage(63, "Neither side lost, due to all fighters being dead..");
                        }

                        foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                        {
                            opponent.SendMessage(63, "Neither side lost, due to all fighters being dead..");
                        }
                    }
                    if (m_Item.ChallengerDead.Count == m_Item.ChallengeTeam.Count)
                    {
                        foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                        {
                            winner(opponent);
                        }
                        foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                        {
                            loser(challenger);
                        }
                    }
                    if (m_Item.OpponentDead.Count == m_Item.OpponentTeam.Count)
                    {
                        foreach (PlayerMobile challenger in m_Item.ChallengeTeam)
                        {
                            winner(challenger);
                        }
                        foreach (PlayerMobile opponent in m_Item.OpponentTeam)
                        {
                            loser(opponent);
                        }
                    }
                    m_Item.ClearAll();
                    Stop();
                }
            }
 protected override void OnCantSeeTarget(Mobile from, object target)
 {
     m_Item.ClearAll();
 }