예제 #1
0
        public static void DuelWin(ArenaClient winner)
        {
            if (!winner.IsDueling)
            {
                return;
            }

            var stream = ArenaClient.GetStream(ScriptMessages.DuelWin);

            stream.Write((ushort)winner.Character.ID);
            winner.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered);
            if (winner.DuelEnemy.IsConnected)
            {
                winner.DuelEnemy.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered);
            }

            winner.DuelEnemy.DuelDeaths++;
            winner.DuelEnemy.DuelScore--;

            winner.DuelKills++;
            winner.DuelScore += 2;

            winner.DuelEnemy.DuelEnemy = null;
            winner.DuelEnemy           = null;
        }
예제 #2
0
        void SelectTeam(int index)
        {
            if (!TDMMode.IsActive)
            {
                return;
            }

            var teams = TDMMode.ActiveMode.Scenario.Teams;

            if (index < 0 || index >= teams.Length)
            {
                return;
            }

            if ((int)PlayerInfo.HeroInfo.TeamID == index)
            {
                MenuClassSelect.Instance.Open();
                Close();
                return;
            }

            if (!lockTimer.IsReady)
            {
                return;
            }

            var stream = ArenaClient.GetStream(ScriptMessages.TDMTeamSelect);

            stream.Write((byte)index);
            ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);
        }
예제 #3
0
        void SelectClass(int index)
        {
            if (!HordeMode.IsActive || PlayerInfo.HeroInfo.TeamID < TeamIdent.GMSpectator || GameMode.ActiveMode.Phase == GamePhase.FadeOut)
            {
                Close();
                return;
            }

            if (!HordeMode.ActiveMode.Scenario.PlayerClasses.TryGet(index, out NPCClass classDef))
            {
                return;
            }

            if (classDef == NPCClass.Hero)
            {
                Close();
                return;
            }

            if (!lockTimer.IsReady)
            {
                return;
            }

            var stream = ArenaClient.GetStream(ScriptMessages.ModeClassSelect);

            stream.Write((byte)index);
            ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);

            NPCClass.Hero = classDef;

            Close();
        }
예제 #4
0
        void Spectate()
        {
            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.SpectateTeam);
            ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);
            Close();
        }
예제 #5
0
 void Spectate()
 {
     if (PlayerInfo.HeroInfo.TeamID != TeamIdent.GMSpectator)
     {
         var stream = ArenaClient.GetStream(ScriptMessages.ModeSpectate);
         ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered);
     }
     Close();
 }
예제 #6
0
 void Join()
 {
     if (PlayerInfo.HeroInfo.TeamID < TeamIdent.GMPlayer)
     {
         var stream = ArenaClient.GetStream(ScriptMessages.BRJoin);
         ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);
     }
     Close();
 }
예제 #7
0
        static void SendRequest(ArenaClient requester, ArenaClient target)
        {
            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.DuelRequest);
            stream.Write((ushort)requester.Character.ID);
            stream.Write((ushort)target.Character.ID);
            requester.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);
            target.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);
        }
예제 #8
0
        public override void Close()
        {
            base.Close();
            arrow.Hide();

            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.TOTeamCount);
            ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);

            TeamMode.OnPhaseChange -= TOPhaseChanged;
        }
예제 #9
0
        void GameModeStart()
        {
            if (ArenaClient.GMJoined)
            {
                GameMode.ActiveMode.OpenJoinMenu();
                return;
            }

            var stream = ArenaClient.GetStream(ScriptMessages.ModeSpectate);

            ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered);
            Close();
        }
예제 #10
0
        public static void SendRequest(NPCInst target)
        {
            if (!requestTime.IsReady)
            {
                return;
            }

            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.DuelRequest);
            stream.Write((ushort)target.ID);
            ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Unreliable);
        }
예제 #11
0
        static void DuelEnd(ArenaClient client)
        {
            if (!client.IsDueling)
            {
                return;
            }

            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.DuelEnd);
            client.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered);
            client.DuelEnemy.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered);

            client.DuelEnemy.DuelEnemy = null;
            client.DuelEnemy           = null;
        }
예제 #12
0
        static void DuelStart(ArenaClient player1, ArenaClient player2)
        {
            player1.DuelEnemy = player2;
            player2.DuelEnemy = player1;

            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.DuelStart);
            stream.Write((ushort)player2.Character.ID);
            player1.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered);

            stream = ArenaClient.GetScriptMessageStream();
            stream.Write((byte)ScriptMessages.DuelStart);
            stream.Write((ushort)player1.Character.ID);
            player2.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered);
        }
예제 #13
0
        public override void Open()
        {
            if (!TeamMode.IsRunning)
            {
                return;
            }

            base.Open();

            SetTexts();

            tdmName.Text = TeamMode.ActiveTODef.Name.ToUpper();

            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.TOTeamCount);
            ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);

            TeamMode.OnPhaseChange += TOPhaseChanged;
        }
예제 #14
0
        void SelectClass(int index)
        {
            if (TeamMode.TeamDef == null || TeamMode.Phase == TOPhases.None || TeamMode.Phase == TOPhases.Finish)
            {
                Sumpfkraut.Menus.ScreenScrollText.AddText("TeamObjective ist vorüber.", GUCView.Fonts.Menu);
                Close();
                return;
            }

            var classDef = TeamMode.TeamDef.ClassDefs.ElementAtOrDefault(index);

            if (classDef == null)
            {
                return;
            }

            if (classDef == ArenaClient.Client.TOClass)
            {
                Close();
                return;
            }

            if (!lockTimer.IsReady)
            {
                return;
            }

            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.TOSelectClass);
            stream.Write((byte)index);
            ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);

            ArenaClient.Client.TOClass = classDef;

            Close();
        }
예제 #15
0
        void SelectTeam(int index)
        {
            if (!TeamMode.IsRunning || TeamMode.Phase == TOPhases.Finish || TeamMode.Phase == TOPhases.None)
            {
                if (TeamMode.TeamDef == null)
                {
                    Sumpfkraut.Menus.ScreenScrollText.AddText("TeamObjective ist vorüber.", GUCView.Fonts.Menu);
                }
                Close();
                return;
            }

            var team = TeamMode.ActiveTODef.Teams.ElementAtOrDefault(index);

            if (team == null)
            {
                return;
            }

            if (team == TeamMode.TeamDef)
            {
                TOClassMenu.Menu.Open();
                Close();
                return;
            }

            if (!lockTimer.IsReady)
            {
                return;
            }

            var stream = ArenaClient.GetScriptMessageStream();

            stream.Write((byte)ScriptMessages.TOJoinTeam);
            stream.Write((byte)index);
            ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable);
        }