public void Process(C.ObserverRequest p) { if (!Config.AllowObservation && (Account == null || (!Account.TempAdmin && !Account.Observer))) { return; } PlayerObject player = SEnvir.GetPlayerByCharacter(p.Name); if (player == null || player == Player) { return; } if (!player.Character.Observable && (Account == null || (!Account.TempAdmin && !Account.Observer))) { return; } if (Stage == GameStage.Game) { Player.StopGame(); } if (Stage == GameStage.Observer) { Observed.Observers.Remove(this); Observed = null; } player.SetUpObserver(this); }
public void EndObservation() { Observed.Observers.Remove(this); Observed = null; if (Account != null) { Stage = GameStage.Select; Enqueue(new S.GameLogout { Characters = Account.GetSelectInfo() }); } else { Stage = GameStage.Login; Enqueue(new S.SelectLogout()); } }
public void CleanUp() { Stage = GameStage.Disconnected; if (Account != null && Account.Connection == this) { Account.TempAdmin = false; Account.Connection = null; } Account = null; Player?.StopGame(); Player = null; Observed?.Observers.Remove(this); Observed = null; // ItemList.Clear(); // MagicList.Clear(); }