public static void OnPlayerOnline(int playerid, int consortiaID, int areaid, bool isSend) { WorldMgr.ChangePlayerState(playerid, true, consortiaID); if (isSend) { List <BattleServer> servers = BattleMgr.GetAllBattles(); foreach (BattleServer server in servers) { if (server != null && server.IsOpen) { server.Connector.SendKitOffPlayer(playerid, areaid); } } } }
public static void SendMessages(GSPacketIn pkg) { GSPacketIn packetClone = pkg.Clone(); string guid = pkg.ReadString(); if (MessageMgr.AddMessageRecord(guid, pkg.Parameter1)) { GSPacketIn clentPacket = pkg.ReadPacket(); GamePlayer[] players = WorldMgr.GetAllPlayers(); GamePlayer[] array = players; for (int i = 0; i < array.Length; i++) { GamePlayer player = array[i]; player.Out.SendTCP(clentPacket); } GameServer.Instance.LoginServer.SendTCP(packetClone); List <BattleServer> servers = BattleMgr.GetAllBattles(); foreach (BattleServer server in servers) { server.Connector.SendTCP(packetClone); } } }
public bool OnCommand(BaseClient client, string[] args) { if (args.Length > 1) { switch (args[1]) { case "-c": Console.WriteLine("client list:"); Console.WriteLine("-------------------------------"); GameClient[] cs = GameServer.Instance.GetAllClients(); foreach (GameClient cl in cs) { Console.WriteLine(cl.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", cs.Length)); break; case "-p": Console.WriteLine("player list:"); Console.WriteLine("-------------------------------"); GamePlayer[] ps = WorldMgr.GetAllPlayers(); foreach (GamePlayer player in ps) { Console.WriteLine(player.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", ps.Length)); break; case "-r": Console.WriteLine("room list:"); Console.WriteLine("-------------------------------"); List <BaseRoom> rs = RoomMgr.GetAllUsingRoom(); foreach (BaseRoom room in rs) { Console.WriteLine(room.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", rs.Count)); break; case "-g": Console.WriteLine("game list:"); Console.WriteLine("-------------------------------"); List <BaseGame> gs = GameMgr.GetAllGame(); foreach (BaseGame g in gs) { Console.WriteLine(g.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", gs.Count)); break; case "-b": Console.WriteLine("battle list:"); Console.WriteLine("-------------------------------"); List <BattleServer> bs = BattleMgr.GetAllBattles(); foreach (BattleServer battleSvr in bs) { Console.WriteLine(battleSvr.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", bs.Count)); break; default: DisplaySyntax(client); break; } } else { DisplaySyntax(client); } return(true); }
public bool OnCommand(BaseClient client, string[] args) { if (args.Length > 1) { string a; if ((a = args[1]) != null) { if (a == "-c") { Console.WriteLine("client list:"); Console.WriteLine("-------------------------------"); GameClient[] allClients = GameServer.Instance.GetAllClients(); GameClient[] array = allClients; for (int i = 0; i < array.Length; i++) { GameClient gameClient = array[i]; Console.WriteLine(gameClient.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", allClients.Length)); return(true); } if (a == "-p") { Console.WriteLine("player list:"); Console.WriteLine("-------------------------------"); GamePlayer[] allPlayers = WorldMgr.GetAllPlayers(); GamePlayer[] array2 = allPlayers; for (int j = 0; j < array2.Length; j++) { GamePlayer gamePlayer = array2[j]; Console.WriteLine(gamePlayer.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", allPlayers.Length)); return(true); } if (a == "-r") { Console.WriteLine("room list:"); Console.WriteLine("-------------------------------"); List <BaseRoom> allUsingRoom = RoomMgr.GetAllUsingRoom(); foreach (BaseRoom current in allUsingRoom) { Console.WriteLine(current.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", allUsingRoom.Count)); return(true); } if (a == "-g") { Console.WriteLine("game list:"); Console.WriteLine("-------------------------------"); List <BaseGame> allGame = GameMgr.GetAllGame(); foreach (BaseGame current2 in allGame) { Console.WriteLine(current2.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", allGame.Count)); return(true); } if (a == "-b") { Console.WriteLine("battle list:"); Console.WriteLine("-------------------------------"); List <BattleServer> allBattles = BattleMgr.GetAllBattles(); foreach (BattleServer current3 in allBattles) { Console.WriteLine(current3.ToString()); } Console.WriteLine("-------------------------------"); Console.WriteLine(string.Format("total:{0}", allBattles.Count)); return(true); } } this.DisplaySyntax(client); } else { this.DisplaySyntax(client); } return(true); }