public void HandleRequestPacket(PangyaPacketsEnum PacketID, Packet ProcessPacket) { WriteConsole.WriteLine($"[PLAYER_REQUEST_PACKET] --> [{PacketID}, {this.GetLogin}]"); switch (PacketID) { case PangyaPacketsEnum.PLAYER_LOGIN: HandlePlayerLogin(ProcessPacket); break; case PangyaPacketsEnum.PLAYER_SELECT_SERVER: { var ID = ProcessPacket.ReadInt32(); WriteConsole.WriteLine($"[PLAYER_SELECT_SERVER] --> [{ID}, {this.GetLogin}]"); this.SendGameAuthKey(); } break; case PangyaPacketsEnum.PLAYER_DUPLCATE_LOGIN: this.HandleDuplicateLogin(); break; case PangyaPacketsEnum.PLAYER_SET_NICKNAME: this.CreateCharacter(ProcessPacket); break; case PangyaPacketsEnum.PLAYER_CONFIRM_NICKNAME: this.NicknameCheck(ProcessPacket); break; case PangyaPacketsEnum.PLAYER_SELECT_CHARACTER: RequestCharacaterCreate(ProcessPacket); break; case PangyaPacketsEnum.PLAYER_RECONNECT: HandlePlayerReconnect(ProcessPacket); break; case PangyaPacketsEnum.NOTHING: default: { StringBuilder sb = new StringBuilder(); for (int i = 0; i < ProcessPacket.GetRemainingData.Length; i++) { if ((i + 1) == ProcessPacket.GetRemainingData.Length) { sb.Append("0x" + ProcessPacket.GetRemainingData[i].ToString("X2") + ""); } else { sb.Append("0x" + ProcessPacket.GetRemainingData[i].ToString("X2") + ", "); } } WriteConsole.WriteLine("{Unknown Packet} -> " + sb.ToString(), ConsoleColor.Red); Disconnect(); } break; } }
// Get group-range int[] GroupPos(string group = "") { if (group == "") { return(new[] { 0, 0 });// No Group. } string lowerline; int[] ret = new[] { -1, -1 }; for (int i = 0; i < lines.Length; i++) { lowerline = lines[i].ToLower(); if (ret[0] < 0) { if (lowerline.Contains("[" + group.ToLower() + "]")) { ret[0] = i; // Group found. } } else { if (lowerline.StartsWith("[") || i == lines.Length - 1) // next group or end of file. { ret[1] = --i; // End of group found. return(ret); } } } WriteConsole.WriteLine($"[INI_FILE_ERROR]: Unable to find Group '" + group + "' in configuration file '" + fn + "'."); return(ret); // Group not found. }
public ChannelCollection(IniFile Ini) { //GameInformation gameInfo; byte i; try { var LobbyCount = Ini.ReadByte("Channel", "ChannelCount", 0); for (i = 1; i <= LobbyCount; i++) { string name = Ini.ReadString("Channel", $"ChannelName_{i}", $"#Lobby {i}"); ushort maxuser = Ini.ReadUInt16("Channel", $"ChannelMaxUser_{i}", 100); byte Id = Ini.ReadByte("Channel", $"ChannelID_{i}", i); uint flag = Ini.ReadUInt32("Channel", $"ChannelFlag_{i}", 2048); var lobby = new Channel(name, maxuser, Id, flag); Add(lobby); } } catch { } finally { if (Ini != null) { Ini.Dispose(); } } WriteConsole.WriteLine("[SERVER_SYSTEM_CHANNEL]: Canais foram carregados !", ConsoleColor.Green); }
public void Handle(ProjectG client, MessengerResponseEnum packetID, ClientPacket packet) { WriteConsole.WriteLine($"[BOT_LOGIN_PACKET]: {packetID}", ConsoleColor.Cyan); switch (packetID) { case MessengerResponseEnum.PLAYER_CONNECTION: { var key = packet.Message[8]; Console.WriteLine("Key =>" + key); client.GetKey = key; client.Response.Write(new byte[] { 0x12, 0x00 }); client.Response.Write(client.GetUID); client.Response.Write(client.GetLogin); } break; default: { WriteConsole.WriteLine($"[BOT_MESSENGER_PACKETLOG]: {packet.GetLog()}", ConsoleColor.Cyan); packet.Save(); } break; } }
public Server(string localIPAddress, int listenPort) : base(localIPAddress, listenPort) { Options = new ServerOptions(Flags.ServerOptionFlag.MAINTENANCE_FLAG_PAPELSHOP, 1); IFFEntry.Load(); WriteConsole.WriteLine($"[GAMESERVER]: START {localIPAddress}:{listenPort}", ConsoleColor.Green); LobbyList = new LobbyCollection(new Lobby(name: "#Lobby Test", maxPlayers: 100, id: 1, flag: 0)); }
public void PlayMemorialGacha(GPlayer player, Packet packet) { uint RandInt, TypeID; TypeID = packet.ReadUInt32(); if (!IffEntry.MemorialCoin.IsExist(TypeID)) { player.SendResponse(new byte[] { 0x64, 0x02, 0x85, 0x073, 0x55, 0x00 }); WriteConsole.WriteLine("PlayerPlayerMemorialGacha: coin was not found", ConsoleColor.Red); } var RemoveData = player.Inventory.Remove(TypeID, 1); if (!RemoveData.Status) { player.SendResponse(new byte[] { 0x64, 0x02, 0x85, 0x073, 0x55, 0x00 }); WriteConsole.WriteLine("PlayerPlayerMemorialGacha: Player don''t have that coin TypeID", ConsoleColor.Red); } RandInt = Rand.NextUInt(150); if (RandInt <= 20) { GetRareItem(player, TypeID); } else { GetNormalItem(player, TypeID); } }
/// <summary> /// Construtor /// </summary> /// <param name="ip">IP do servidor (Local ou Global)</param> /// <param name="port">Porta</param> /// <param name="maxConnections"> /// Número máximo de conexões /// Quando o Player se conecta ao Game-server, automaticamente ele é desconectado do LoginServer pois não necessita mais desta comunicação /// </param> public AuthServer() { try { var Ini = new IniFile(ConfigurationManager.AppSettings["Config"]); Data = new ServerSettings() { Name = Ini.ReadString("Config", "Name", "AuthServer"), Version = Ini.ReadString("Config", "Version", "SV_AT_Release_2.0"), UID = Ini.ReadUInt32("Config", "UID", 7997), MaxPlayers = Ini.ReadUInt32("Config", "MaxPlayers", 3000), Port = Ini.ReadUInt32("Config", "Port", 7997), IP = Ini.ReadString("Config", "IP", "127.0.0.1"), Type = AuthClientTypeEnum.AuthServer }; _server = new TcpListener(IPAddress.Parse(Data.IP), (int)Data.Port); db = new PangyaEntities(); } catch (Exception erro) { WriteConsole.WriteLine($"ERRO_START: {erro.Message}"); Console.ReadKey(); Environment.Exit(0); } }
public override void ServerStart() { try { Data.InsertServer(); _isRunning = true; _server.Start((int)Data.MaxPlayers); if (DateTime.Now == EndTime || (DateTime.Now.Month == EndTime.Month && DateTime.Now.Day == EndTime.Day)) { _isRunning = false; } WriteConsole.WriteLine($"[SERVER_START]: PORT {Data.Port}", ConsoleColor.Green); //Inicia os Lobby's Ini = new IniFile(ConfigurationManager.AppSettings["ChannelConfig"]); LobbyList = new ChannelCollection(Ini); //Inicia a leitura dos arquivos .iff new IffBaseManager();//is 100% work? test for iff //Inicia Thread para escuta de clientes var WaitConnectionsThread = new Thread(new ThreadStart(HandleWaitConnections)); WaitConnectionsThread.Start(); } catch (Exception erro) { new GameTools.ClearMemory().FlushMemory(); WriteConsole.WriteLine($"[ERROR_START]: {erro.Message}"); Console.ReadKey(); Environment.Exit(1); } }
public override void DisconnectPlayer(Player Player) { var Client = (GPlayer)Player; if (Client != null && Client.Connected) { var PLobby = Client.Lobby; if (PLobby != null) { PLobby.RemovePlayer(Client); } Client.PlayerLeave(); //{ push player to offline } Players.Remove(Client); //{ remove from player lists } Player.Connected = false; Player.Dispose(); Player.Tcp.Close(); } WriteConsole.WriteLine(string.Format("[PLAYER_DISCONNECT]: {0} is disconnected", Client?.GetLogin), ConsoleColor.Red); UpdateServer(); Console.Title = $"Pangya Fresh Up! GameServer - {Data.Name} - Players: {Players.Count} "; new GameTools.ClearMemory().FlushMemory(); }
public override void OnException(PClient player, Exception ex) { WriteConsole.WriteLine("[BOT_EXCEPTION]: {0}", ex.ToString(), ConsoleColor.Red); OnDisconnectBot(player); Console.ReadKey(); Environment.Exit(0); }
public override PClient OnConnectBot(TcpClient tcp) { ProjectG player = null; if (ServerType == FakeProjectG.Defines.ServerTypeEnum.Login) { player = new ProjectG(tcp) { Conn = this }; Clients.Add(player); } else if (ServerType == FakeProjectG.Defines.ServerTypeEnum.Game) { player = (ProjectG)Clients.First(); Clients.RemoveAt(0); player.Tcp = tcp; player.Conn = this; player.ServerType = FakeProjectG.Defines.ServerTypeEnum.Game; Clients.Add(player); } else if (ServerType == FakeProjectG.Defines.ServerTypeEnum.Message) { player = (ProjectG)Clients.First(); Clients.RemoveAt(0); player.Tcp = tcp; player.Conn = this; player.ServerType = FakeProjectG.Defines.ServerTypeEnum.Message; Clients.Add(player); } WriteConsole.WriteLine($"[BOT_{player.ServerType}_CONNECTED]: Sucess", ConsoleColor.Green); return(player); }
public void ShowChannel() { foreach (var lobby in this) { WriteConsole.WriteLine($"[SHOW_LOBBY_INFO]: LobbyPlayers [{lobby.Players.Count}/{lobby.MaxPlayers}] LobbyID [{lobby.Id}] LobbyName [{lobby.Name}]", ConsoleColor.Green); } }
public static void CharacaterCreate(this LPlayer session, Packet ClientPacket) { if (!ClientPacket.ReadUInt32(out uint CHAR_TYPEID)) { return; } if (!ClientPacket.ReadUInt16(out ushort HAIR_COLOR)) { return; } try { WriteConsole.WriteLine($"[PLAYER_CREATE_CHARACTER]: {IFFEntry.GetIff.GetName(CHAR_TYPEID).ToUpper()}"); if (string.IsNullOrEmpty(session.UserInfo.GetNickname) == false) { session.LoginSucess(); } else { session.Disconnect(); return; } } catch { session.Disconnect(); } }
public void Start(IPAddress IP, int Port) { try { if (ServerType == ServerTypeEnum.Login) { TcpLogin.Connect(IP, Port); OnClient = TcpLogin; } else if (ServerType == ServerTypeEnum.Game) { TcpGame.Connect(IP, Port); OnClient = TcpGame; } else if (ServerType == ServerTypeEnum.Message) { TcpMessenge.Connect(IP, Port); OnClient = TcpMessenge; } running = true; //Inicia Thread para escuta de OnClientes var WaitConnectionsThread = new Thread(new ThreadStart(HandleClient)); WaitConnectionsThread.Start(); } catch { WriteConsole.WriteLine("[BOT_EXCEPTION]: SERVER OFFLINE", ConsoleColor.Red); Console.ReadKey(); Environment.Exit(0); } }
private void ClientConnected(AuthClient Server) { //Chama evento OnClientConnected OnClientConnected?.Invoke(Server); WriteConsole.WriteLine($"[CLIENT_CONNECTED]: {Server.Data.Name} | Type: {Server.Data.Type}", ConsoleColor.Green); UpdateServer(); }
//02 : The Room is full //03 : The Room is not exist //04 : wrong password //05 : you cannot get in this room level //07 : can not create game //08 : game is in progress public void PlayerCreateGame(GPlayer player, Packet packet) { GameInformation GameData; GameData = new GameInformation { Unknown1 = packet.ReadByte(), //1 VSTime = packet.ReadUInt32(), //5/ GameTime = packet.ReadUInt32(), //9 MaxPlayer = packet.ReadByte(), //10 GameType = (GAME_TYPE)packet.ReadByte(), //11 HoleTotal = packet.ReadByte(), //12 Map = packet.ReadByte(), //13 Mode = packet.ReadByte(), //14 NaturalMode = packet.ReadUInt32(), //18 }; //Course = 63, hole repeted = 68, chip-in = 73 if (GameData.GameType == GAME_TYPE.HOLE_REPEAT && packet.GetSize == 68) { packet.Skip(5); GameData.HoleNumber = 1; GameData.LockHole = 7; GameData.NaturalMode = 0; GameData.Mode = (byte)TGAME_MODE.GAME_MODE_REPEAT; } if (GameData.GameType == GAME_TYPE.HOLE_REPEAT && packet.GetSize == 63) { GameData.HoleNumber = 0; GameData.LockHole = 0; } packet.ReadPStr(out GameData.Name); packet.ReadPStr(out GameData.Password); packet.ReadUInt32(out GameData.Artifact); GameData.GP = false; GameData.GPTypeID = 0; GameData.GPTypeIDA = 0; GameData.GPTime = 0; // { GM Event } && { Chat Room } if (player.GetCapability == 4 && GameData.MaxPlayer >= 100 || GameData.GameType == GAME_TYPE.CHAT_ROOM && player.GetCapability == 4) { GameData.GMEvent = true; } var GameHandle = CreateGame(player, GameData); if (GameHandle != null) { WriteConsole.WriteLine($"[CREATE ROOM]: GAMERESULT = Sucess, Type: {GameData.GameType}", ConsoleColor.Green); } else { WriteConsole.WriteLine($"[CREATE ROOM]: GAMERESULT = Failed, Type: {GameData.GameType} ", ConsoleColor.Red); } }
private static void Server_OnPacketReceived(Player player, Packet packet) { var Client = (GPlayer)player; if ((TGAMEPACKET)packet.Id != TGAMEPACKET.PLAYER_LOGIN) { WriteConsole.WriteLine($"[PLAYER_CALL_PACKET]: [{(TGAMEPACKET)packet.Id},{player.GetLogin}]", ConsoleColor.Cyan); } Client.HandleRequestPacket((TGAMEPACKET)packet.Id, packet); }
public void AddItems(ItemRandom itemInfo) { if (itemInfo.Active) { this.Add(itemInfo); } else { WriteConsole.WriteLine("Falied To add {0} IsNoValid {1}", ConsoleColor.Red, new object[] { itemInfo.TypeId, itemInfo.Active }); } }
public override void PlayerLoading(GPlayer player, Packet packet) { byte Process; Process = packet.ReadByte(); Send(ShowGameLoading(player.ConnectionID, Process)); player.GameInfo.Versus.LoadComplete = (Process * 10 >= 80); WriteConsole.WriteLine($"[PLAYER_LOADING]: {player.GetNickname}:{Process * 10}%"); }
public override void PlayerShotData(GPlayer player, Packet packet) { TShotData S; player.GameInfo.Versus.ShotSync = false; var decrypted = DecryptShot(packet.GetRemainingData); packet.SetReader(new PangyaBinaryReader(new MemoryStream(decrypted))); S = (TShotData)packet.Read(new TShotData()); if (S.ShotType == TShotType.Success) { if (player.GameInfo.GameData.Pang - S.Pang > 4000 || player.GameInfo.GameData.BonusPang - S.BonusPang > 4000) { player.Close(); return; } player.GameInfo.GameData.Pang = S.Pang; player.GameInfo.GameData.BonusPang = S.BonusPang; player.GameInfo.GameData.HoleComplete = true; player.GameInfo.GameData.HoleCompletedCount += 1; player.GameInfo.UpdateScore(player.GameInfo.GameData.HoleComplete); if (player.GameInfo.GameData.HoleCompletedCount >= fGameData.HoleTotal) { player.GameInfo.GameCompleted = true; } WriteConsole.WriteLine(player.GameInfo.GameData.Score.ToString()); } else if (S.ShotType == TShotType.OB) { player.GameInfo.GameData.ShotCount += 2; player.GameInfo.GameData.TotalShot += 2; } else { player.GameInfo.GameData.ShotCount += 1; player.GameInfo.GameData.TotalShot += 1; player.GameInfo.GameData.Pang = S.Pang; player.GameInfo.GameData.BonusPang = S.BonusPang; } var result = new PangyaBinaryWriter(); result.Write(new byte[] { 0x64, 0x00 }); result.WriteStruct(S); Send(result.GetBytes()); player.GameInfo.Versus.HoleDistance = S.Pos.HoleDistance(player.GameInfo.HolePos3D); Console.WriteLine("[PLAYER_HOLE_DISTANCE]: " + player.GameInfo.Versus.HoleDistance); }
public virtual void DisconnectClient(AuthClient Server) { Clients.Model.Remove(Server); UpdateClient(Server); Server.Dispose(); WriteConsole.WriteLine($"[CLIENT_DISCONNECTED]: <{Server?.Data.Name}>", ConsoleColor.Red); Console.Title = string.Format("Pangya Fresh Up! AuthServer - LOGIN: {0}, GAMES: {1}, MESSENGER: {2}", Clients.Count, Clients.Model.Where(c => c.Data.Type == AuthClientTypeEnum.LoginServer).ToList().Count, Clients.Model.Where(c => c.Data.Type == AuthClientTypeEnum.GameServer).ToList().Count, Clients.Model.Where(c => c.Data.Type == AuthClientTypeEnum.MessengerServer).ToList().Count); UpdateServer(); }
static ScratchCardSystem() { ItemRandom ItemInfo; uint[] SupplyTypeID; RandomWeight = new ItemRandomClass(); try { if (File.Exists("Json/ScratchCard.json")) { SupplyTypeID = new uint[4]; foreach (var item in JsonValue.ParseFile("Json/ScratchCard.json")["ScratchCardData"].AsJsonArray) { SupplyTypeID[0] = (uint)item["SupplyTypeID"].AsInteger; SupplyTypeID[1] = (uint)item["SupplyTypeID2"].AsInteger; SupplyTypeID[2] = (uint)item["SupplyTypeID3"].AsInteger; SupplyTypeID[3] = (uint)item["SupplyTypeID4"].AsInteger; foreach (var Reward in item["Items"].AsJsonArray) { ItemInfo = new ItemRandom() { TypeId = (uint)Reward["TypeID"].AsInteger, MaxQuantity = (uint)Reward["MaxQuan"].AsInteger, RareType = (uint)Reward["TypeRare"].AsInteger, Probs = (ushort)Reward["Probability"].AsInteger, Active = Reward["Valid"].AsBoolean }; RandomWeight.AddItems(ItemInfo); } } RandomWeight.AddSupply(SupplyTypeID[0]); RandomWeight.AddSupply(SupplyTypeID[1]); RandomWeight.AddSupply(SupplyTypeID[2]); RandomWeight.AddSupply(SupplyTypeID[3]); RandomWeight.SetCanDup(false); } else { throw new Exception(" ScratchCard.json file in folder not found !"); } } catch (Exception ex) { WriteConsole.WriteLine(ex.Message, ConsoleColor.Red); Console.ReadKey(); Environment.Exit(0); } }
public override void DisconnectPlayer(Player Player) { var player = (LPlayer)Player; if (player.Connected) { player.Connected = false; player.Dispose(); player.Tcp.Close(); Players.Remove(player); } WriteConsole.WriteLine($"[PLAYER_DISCONNECT]: User {player?.GetLogin}"); UpdateServer(); }
internal static bool CheckVersion(string version) { switch (version) { case "727.00": { return(true); } default: WriteConsole.WriteLine("[CLIENT_ERROR]: Client Version Incompartible => " + version); return(false); } }
protected override Player OnConnectPlayer(TcpClient tcp, uint ConnectionID) { var player = new LPlayer(tcp) { Server = this, ConnectionID = ConnectionID }; SendKey(player); var GetAdress = player.GetAdress; var GetPort = player.GetPort; WriteConsole.WriteLine($"[NEW_PLAYER_CONNECT] => {GetAdress}:{GetPort}", ConsoleColor.Cyan); return(player); }
public override void DisconnectPlayer(Player Player) { var Client = (MPlayer)Player; if (Client != null && Client.Connected) { Players.Remove(Client); //{ remove from player lists } Player.Connected = false; Player.Dispose(); Player.Tcp.Close(); } WriteConsole.WriteLine(string.Format("[PLAYER_DISCONNECT]: {0} is disconnected", Client?.GetLogin), ConsoleColor.Red); UpdateServer(); Console.Title = $"Pangya Fresh Up! MessengerServer - Players: {Players.Count} "; }
private static void OnPacketReceived(Player client, Packet packet) { var player = (LPlayer)client; WriteConsole.WriteLine($"[PLAYER_PACKET_LOG]: {player.GetAdress}:{player.GetPort}", ConsoleColor.Green); packet.Log(); switch ((LoginPacketFlag)packet.Id) { case LoginPacketFlag.PLAYER_LOGIN: if (player.LoginResult(packet)) { player.LoginSucess(); } break; case LoginPacketFlag.PLAYER_SELECT_SERVER: player.SelectServer(packet); break; case (LoginPacketFlag.PLAYER_DUPLCATE_LOGIN): break; case (LoginPacketFlag.PLAYER_SET_NICKNAME): player.SetNickName(packet); break; case LoginPacketFlag.PLAYER_CONFIRM_NICKNAME: player.ConfirmNickName(packet); break; case LoginPacketFlag.PLAYER_SELECT_CHARACTER: player.CharacaterCreate(packet); break; case LoginPacketFlag.PLAYER_RECONNECT: break; case LoginPacketFlag.NOTHING: default: { Console.WriteLine(BitConverter.ToString(packet.Message)); player.SendResponse(new byte[0]); player.Disconnect(); } break; } }
public override void AcquireData(GPlayer player) { WriteConsole.WriteLine($"[PLAYER_REQUEST_ACQUIRE_DATA]: {player.GetNickname}"); player.GameInfo.GameData.Reverse(); player.GameInfo.ConnectionID = player.ConnectionID; player.GameInfo.UID = player.GetUID; player.GameInfo.GameCompleted = false; player.GameInfo.Versus.LoadHole = false; player.GameInfo.Versus.LoadComplete = false; player.GameInfo.Versus.ShotSync = false; var packet = new PangyaBinaryWriter(); packet.Write(new byte[] { 0x76, 0x00 }); packet.Write((byte)GameType);//game type packet.Write((byte)Players.Count); foreach (var P in Players) { packet.Write(P.GetGameInfoVS()); } player.SendResponse(packet.GetBytes()); packet = new PangyaBinaryWriter(); packet.Write(new byte[] { 0x45, 0x00, }); packet.Write(player.Statistic()); packet.Write(player.Inventory.GetTrophyInfo()); packet.Write(uint.MaxValue); packet.Write(uint.MaxValue); packet.Write(uint.MaxValue); player.SendResponse(packet); packet = new PangyaBinaryWriter(); packet.Write(new byte[] { 0x52, 0x00 }); packet.Write(fGameData.Map); //mapa packet.Write((byte)fGameData.GameType); //type game packet.Write(fGameData.Mode); //mode game packet.Write(fGameData.HoleTotal); //hole total packet.Write(0); //id do trofeu packet.Write(fGameData.VSTime); packet.Write(fGameData.GameTime); packet.Write(GetHoleBuild()); player.SendResponse(packet); player.SendResponse(new byte[] { 0x6A, 0x01, 0x92, 0x06, 0x00, 0x00 }); }
void AddShopItem(GPlayer PL, ShopItemRequest shop) { var ListSet = IffEntry.SetItem.SetList(shop.IffTypeId); AddData ItemAddedData; AddItem ItemAddData; TBuyItem DataBuy; //group set item if (GetItemGroup(shop.IffTypeId) == 9) { if (ListSet.Count <= 0)// ## should not be happened { PL.SendResponse(ShowBuyItemSucceed(TGAME_SHOP.BUY_FAIL)); WriteConsole.WriteLine("Something strange happened (T.T)"); return; } else { foreach (var datas in ListSet) { ItemAddData = new AddItem { ItemIffId = datas.FirstOrDefault().Key, Quantity = datas.FirstOrDefault().Value, Transaction = false, Day = 0 }; ItemAddedData = PL.AddItem(ItemAddData); DataBuy = CheckData(ItemAddedData); PL.SendResponse(ShowBuyItem(ItemAddedData, DataBuy, PL.GetPang, PL.GetCookie)); } } } else { ItemAddData = new AddItem { ItemIffId = shop.IffTypeId, Quantity = IffEntry.GetRealQuantity(shop.IffTypeId, shop.IffQty), Transaction = false, Day = shop.IffDay }; ItemAddedData = PL.AddItem(ItemAddData); DataBuy = CheckData(ItemAddedData); PL.SendResponse(ShowBuyItem(ItemAddedData, DataBuy, PL.GetPang, PL.GetCookie)); } }
public GameServer() { try { Ini = new IniFile(ConfigurationManager.AppSettings["ServerConfig"]); Data = new ServerSettings { Name = Ini.ReadString("Config", "Name", "Pippin"), Version = Ini.ReadString("Config", "Version", "SV_GS_Release_2.0"), UID = Ini.ReadUInt32("Config", "UID", 20201), MaxPlayers = Ini.ReadUInt32("Config", "MaxPlayers", 3000), Port = Ini.ReadUInt32("Config", "Port", 20201), IP = Ini.ReadString("Config", "IP", "127.0.0.1"), Property = Ini.ReadUInt32("Config", "Property", 2048), BlockFunc = Ini.ReadInt64("Config", "BlockFuncSystem", 0), EventFlag = Ini.ReadInt16("Config", "EventFlag", 0), ImgNo = Ini.ReadInt16("Config", "Icon", 1), GameVersion = "829.01", Type = AuthClientTypeEnum.GameServer, AuthServer_Ip = Ini.ReadString("Config", "AuthServer_IP", "127.0.0.1"), AuthServer_Port = Ini.ReadInt32("Config", "AuthServer_Port", 7997), Key = "3493ef7ca4d69f54de682bee58be4f93" }; ShowLog = Ini.ReadBool("Config", "PacketLog", false); Messenger_Active = Ini.ReadBool("Config", "Messenger_Server", false); Console.Title = $"Pangya Fresh Up! GameServer - {Data.Name} - Players: {Players.Count} "; if (ConnectToAuthServer(AuthServerConstructor()) == false) { new GameTools.ClearMemory().FlushMemory(); WriteConsole.WriteLine("[ERROR_START_AUTH]: Não foi possível se conectar ao AuthServer"); Console.ReadKey(); Environment.Exit(1); } _server = new TcpListener(IPAddress.Parse(Data.IP), (int)Data.Port); } catch (Exception erro) { new GameTools.ClearMemory().FlushMemory(); WriteConsole.WriteLine($"[ERROR_START]: {erro.Message}"); Console.ReadKey(); Environment.Exit(0); } }