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); }
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(); }
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; }
void Spectate() { if (PlayerInfo.HeroInfo.TeamID != TeamIdent.GMSpectator) { var stream = ArenaClient.GetStream(ScriptMessages.ModeSpectate); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); } Close(); }
void Join() { if (PlayerInfo.HeroInfo.TeamID < TeamIdent.GMPlayer) { var stream = ArenaClient.GetStream(ScriptMessages.BRJoin); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); } Close(); }
protected void SetPhase(GamePhase phase) { this.Phase = phase; Log.Logger.Log("Set Phase " + phase); // send phase update to clients var stream = ArenaClient.GetStream(ScriptMessages.ModePhase); stream.Write((byte)Phase); ArenaClient.ForEach(c => c.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered)); }
protected virtual void Start(GameScenario scenario) { this.Scenario = scenario; var stream = ArenaClient.GetStream(ScriptMessages.ModeStart); stream.Write(scenario.Name); ArenaClient.ForEach(c => c.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered)); Phase = GamePhase.None; phaseTimer.Stop(); }
void GameModeStart() { if (ArenaClient.GMJoined) { GameMode.ActiveMode.OpenJoinMenu(); return; } var stream = ArenaClient.GetStream(ScriptMessages.ModeSpectate); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); Close(); }
void HordeFadeOut(bool playersWon) { if (Phase == GamePhase.FadeOut) { return; } standSpawnTimer.Stop(); standTimer.Stop(); if (playersWon) { var stream = ArenaClient.GetStream(ScriptMessages.HordeWin); players.ForEach(p => { p.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); if (p.IsCharacter) { p.Character.LiftUnconsciousness(); } }); var agent = CreateAgent(); foreach (var npc in AmbientNPCs) { npc.BaseInst.SetNeedsClientGuide(true); agent.Add(npc); } } else { var stream = ArenaClient.GetStream(ScriptMessages.HordeLoss); players.ForEach(p => { p.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); if (p.IsCharacter) { p.Character.SetHealth(0); } }); ClearAgents(); } base.FadeOut(); }
protected override void FadeOut() { int max = teams.Max(t => t.Score); int count = teams.Count(t => t.Score == max); var stream = ArenaClient.GetStream(ScriptMessages.TDMWin); stream.Write((byte)count); for (byte i = 0; i < teams.Count; i++) { if (teams[i].Score == max) { stream.Write(i); } } players.ForEach(p => p.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable)); base.FadeOut(); respawnTimer.Stop(); NPCInst.sOnHit -= OnHit; }