Esempio n. 1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            PlayerMobile player = sender.Mobile as PlayerMobile;

            if (player == null)
            {
                return;
            }

            if (player == null)
            {
                return;
            }
            if (player.Deleted)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            bool closeGump = true;

            switch (info.ButtonID)
            {
            //UOACZ Guide Website
            case 1:
                string url = "http://forum.uoancorp.com/threads/the-monstrous-uoacz-guide.10635/";
                player.LaunchBrowser(url);

                closeGump = false;
                break;

            //Human Team
            case 2:
                player.m_UOACZAccountEntry.m_TeamSelectIndex = 0;
                player.SendSound(UOACZSystem.selectionSound);

                closeGump = false;
                break;

            //Undead Team
            case 3:
                player.m_UOACZAccountEntry.m_TeamSelectIndex = 1;
                player.SendSound(UOACZSystem.selectionSound);

                closeGump = false;
                break;

            //Confirm Team Change
            case 4:
                if ((player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Human && player.m_UOACZAccountEntry.m_TeamSelectIndex == 1) ||
                    (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Undead && player.m_UOACZAccountEntry.m_TeamSelectIndex == 0))
                {
                    if (UOACZPersistance.Active)
                    {
                        if (player.m_UOACZAccountEntry.NextTeamSwitchAllowed <= DateTime.UtcNow)
                        {
                            if (player.LastPlayerCombatTime + UOACZSystem.TeamSwitchPvPThreshold > DateTime.UtcNow)
                            {
                                string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.LastPlayerCombatTime + UOACZSystem.TeamSwitchPvPThreshold, false, true, true, true, true);

                                player.SendMessage("You have been in PvP too recently to switch teams. You must wait another " + timeRemaining + ".");
                            }

                            else if (player.Frozen || player.CantWalk)
                            {
                                player.SendMessage("You are currently frozen and must wait a few moments before you may switch teams.");
                            }

                            else
                            {
                                if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Human)
                                {
                                    UOACZSystem.SwitchTeams(player, true);
                                }

                                else if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Undead)
                                {
                                    UOACZSystem.SwitchTeams(player, false);
                                }
                            }
                        }
                    }

                    else
                    {
                        if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Human)
                        {
                            UOACZSystem.SwitchTeams(player, true);
                        }

                        else if (player.m_UOACZAccountEntry.CurrentTeam == UOACZAccountEntry.ActiveProfileType.Undead)
                        {
                            UOACZSystem.SwitchTeams(player, false);
                        }
                    }
                }

                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                player.SendGump(new UOACZOverviewGump(player));
            }

            else
            {
                player.CloseGump(typeof(UOACZOverviewGump));
                player.SendSound(UOACZSystem.closeGumpSound);
            }
        }