예제 #1
0
        public void CreateChallenge(UnturnedPlayer p, DateTime expiry, Arena arena)
        {
            ExtraPlayer ep = p.GetComponent <ExtraPlayer>();

            ep.challenges.Add(Player.CSteamID.m_SteamID, new Challenge(Player, p, arena, expiry));
            UnturnedChat.Say(p, Util.Translate("extraduel_challenge", arena.name, Player.DisplayName), Color.yellow);
        }
예제 #2
0
        public void Execute(IRocketPlayer caller, string[] args)
        {
            if (args.Length != 1)
            {
                UnturnedChat.Say(caller, Syntax, Color.red);
                return;
            }

            UnturnedPlayer challenger = UnturnedPlayer.FromName(args[0]);

            if (challenger == null)
            {
                UnturnedChat.Say(caller, Util.Translate("extraduel_invalid_player"), Color.red);
                return;
            }

            ExtraPlayer ep = ((UnturnedPlayer)caller).GetComponent <ExtraPlayer>();

            if (!ep.challenges.ContainsKey(challenger.CSteamID.m_SteamID))
            {
                UnturnedChat.Say(caller, Util.Translate("extraduel_no_challenge"), Color.red);
                return;
            }

            ep.TryTerminateChallenge(challenger.CSteamID.m_SteamID, ExtraPlayer.TerminationReasons.DENIED);
            UnturnedChat.Say(caller, Util.Translate("extraduel_challenge_deny_success"), Color.green);
        }
예제 #3
0
        private void PlayerUpdatedPosition(UnturnedPlayer p, Vector3 pos)
        {
            ExtraPlayer ep = p.GetComponent <ExtraPlayer>();

            if (!ArenaCheck(p, pos, ep.lastPosition))
            {
                ep.lastPosition = pos;
            }
        }
예제 #4
0
        public void Execute(IRocketPlayer caller, string[] args)
        {
            ExtraPlayer ep = ((UnturnedPlayer)caller).GetComponent <ExtraPlayer>();

            if (ep.challenges.Count <= 0)
            {
                UnturnedChat.Say(caller, Util.Translate("extraduel_challenges_none"), Color.yellow);
                return;
            }

            foreach (ulong c in ep.challenges.Keys)
            {
                UnturnedPlayer player = UnturnedPlayer.FromCSteamID(new CSteamID(c));
                UnturnedChat.Say(caller, Util.Translate("extraduel_challenges_message", player), Color.green);
            }
        }
예제 #5
0
        public void Execute(IRocketPlayer caller, string[] args)
        {
            if (args.Length != 2)
            {
                UnturnedChat.Say(caller, Syntax, Color.red);
                return;
            }

            UnturnedPlayer challenged = UnturnedPlayer.FromName(args[0]);

            if (challenged == null)
            {
                UnturnedChat.Say(caller, Util.Translate("extraduel_invalid_player"), Color.red);
                return;
            }

            UnturnedPlayer p = (UnturnedPlayer)caller;

            if (challenged.CSteamID.m_SteamID == p.CSteamID.m_SteamID)
            {
                UnturnedChat.Say(caller, Util.Translate("extraduel_self_invoke"), Color.red);
                return;
            }

            ExtraPlayer ep = challenged.GetComponent <ExtraPlayer>();

            if (!ep.acceptingChallengers)
            {
                UnturnedChat.Say(caller, Util.Translate("extraduel_challenges_off"), Color.red);
                return;
            }
            if (!ExtraDuel.ArenaExists(args[1]))
            {
                UnturnedChat.Say(caller, Util.Translate("extraduel_removearena_fail_not_found"), Color.red);
                return;
            }

            if (ep.challenges.ContainsKey(p.CSteamID.m_SteamID))
            {
                UnturnedChat.Say(caller, Util.Translate("extraduel_already_challenged"), Color.red);
                return;
            }

            ep.CreateChallenge(challenged, DateTime.Now.AddSeconds(20), ExtraDuel.ArenaFromName(args[1]));
            UnturnedChat.Say(caller, Util.Translate("extraduel_challenge_success", challenged.DisplayName), Color.green);
        }
예제 #6
0
        public void Execute(IRocketPlayer caller, string[] args)
        {
            if (args.Length != 1)
            {
                UnturnedChat.Say(caller, Syntax, Color.red);
                return;
            }

            UnturnedPlayer uPlayer = (UnturnedPlayer)caller;

            if (Int32.TryParse(args[0], out int posNumber))
            {
                switch (posNumber)
                {
                case 1:
                {
                    Vector3     position = uPlayer.Position;
                    ExtraPlayer player   = uPlayer.GetComponent <ExtraPlayer>();
                    player.selectedPos1 = position;
                    UnturnedChat.Say(Util.Translate("extraduel_setposition_success", 1, position.ToString()),
                                     Color.green);
                    break;
                }

                case 2:
                {
                    Vector3     position = uPlayer.Position;
                    ExtraPlayer player   = uPlayer.GetComponent <ExtraPlayer>();
                    player.selectedPos2 = position;
                    UnturnedChat.Say(Util.Translate("extraduel_setposition_success", 2, position.ToString()),
                                     Color.green);
                    break;
                }

                default:
                    UnturnedChat.Say(caller, Syntax, Color.red);
                    break;
                }
            }
            else
            {
                UnturnedChat.Say(caller, Syntax, Color.red);
            }
        }
예제 #7
0
        public void Execute(IRocketPlayer caller, string[] args)
        {
            if (args.Length != 1)
            {
                UnturnedChat.Say(caller, Syntax, Color.red);
                return;
            }

            ExtraPlayer player = ((UnturnedPlayer)caller).GetComponent <ExtraPlayer>();

            if (player.selectedPos1 == null || player.selectedPos2 == null)
            {
                UnturnedChat.Say(caller, Util.Translate("extraduel_no_position_set"), Color.red);
                return;
            }

            Arena newArena = new Arena(player.selectedPos1, player.selectedPos2, args[0]);

            foreach (Arena a in ExtraDuel.instance.arenaList)
            {
                if (a.rect.Overlaps(newArena.rect))
                {
                    UnturnedChat.Say(caller, Util.Translate("extraduel_definearena_fail_overlap"), Color.red);
                    return;
                }

                if (a.name != newArena.name)
                {
                    continue;
                }

                UnturnedChat.Say(caller, Util.Translate("extraduel_definearena_fail_same_name"), Color.red);
                return;
            }

            ExtraDuel.instance.arenaList.Add(newArena);
            UnturnedChat.Say(caller, Util.Translate("extraduel_definearena_success"), Color.green);
            ExtraDuel.instance.SerializeArena(ExtraDuel.arenaPath);
        }