public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(GameTeamSelector));

            if (!GameJoinStone.IsNaked(from))
            {
                from.SendMessage("You must be naked to join.");
                return;
            }

            if (m_Game.Deleted)
            {
                return;
            }

            if (info.ButtonID == 0)
            {
                return;
            }

            CTFTeam team = null;

            if (m_RandomTeam)
            {
                team = m_Game.RandomTeam();
            }
            else
            {
                team = m_Game.GetTeam(info.ButtonID - 1);
            }

            if (team != null && team.ActiveMemberCount < m_TeamSize)
            {
                bool freeze = from.Frozen;

                from.Kill();
                if (from.Corpse != null && !from.Corpse.Deleted)
                {
                    from.Corpse.Delete();
                }
                from.Location = team.Home;
                from.Map      = team.Map;
                from.Resurrect();

                from.Frozen = freeze;

                m_Game.SwitchTeams(from, team);

                from.SendMessage("You have joined team {0}!", team.Name);
            }
            else
            {
                from.SendMessage("That team is full, please try again.");
                from.SendGump(new GameTeamSelector(m_Game, m_RandomTeam));
            }
        }
Beispiel #2
0
        public override void OnDamage(int amount, Mobile from, bool willKill)
        {
            if (willKill == true && m_Game != null && from != null)
            {
                CTFTeam team = m_Game.GetTeam(from);

                willKill       = false;
                this.Blessed   = true;
                this.Hidden    = true;
                this.Combatant = null;
                this.Freeze(TimeSpan.FromSeconds(m_Timer + 1));

                from.SendMessage("You killed the {0} orc!", m_Team.Name);
                this.Game.PlayerMessage("{0} ({1}) killed the {2} orc!", from.Name, team.Name, m_Team.Name);
                team.Points += m_Points;

                Timer.DelayCall(TimeSpan.FromSeconds(m_Timer), new TimerCallback(RTimer));
            }

            base.OnDamage(amount, from, willKill);
        }
Beispiel #3
0
        public override void OnResponse(NetState state, int index)
        {
            Mobile from = state.Mobile;

            if (m_Game.Deleted)
            {
                return;
            }

            CTFTeam team = m_Game.GetTeam(index);

            if (team != null && team.ActiveMemberCount < m_TeamSize)
            {
                bool freeze = from.Frozen;

                from.Kill();
                if (from.Corpse != null && !from.Corpse.Deleted)
                {
                    from.Corpse.Delete();
                }
                from.Location = team.Home;
                from.Map      = team.Map;
                from.Resurrect();

                from.Frozen = freeze;

                m_Game.SwitchTeams(from, team);

                from.SendAsciiMessage("You have joined team {0}!", team.Name);
            }
            else
            {
                from.SendAsciiMessage("That team is full, please try again.");
                from.SendMenu(new GameTeamSelector(m_Game));
            }
        }