/** * * 客户端选择服务器发送 * 服务器IP * 服务器端口号 * sessionID * * */ private static void Handle_ServerSelected(ArcheAgeConnection net, PacketReader reader) { //net.SendAsync(new NP_EditMessage2("systemTest")); //return; reader.Offset += 8; //00 00 00 00 00 00 00 00 Undefined Data byte serverId = reader.ReadByte(); //serverId =1; GameServer server = GameServerController.CurrentGameServers.FirstOrDefault(n => n.Value.Id == serverId).Value; if (server != null && server.CurrentConnection != null) { if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { //create session Random random = new Random(); int num = random.Next(255) + random.Next(255) + random.Next(255) + random.Next(255); net.CurrentAccount.Session = num = 1323126619;//指定session net.movedToGame = true; GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); server.CurrentConnection.SendAsync(new NET_AccountInfo(net.CurrentAccount)); server.CurrentAuthorized.Add(net.CurrentAccount.AccountId); net.SendAsync(new NP_SendGameAuthorization(server, num)); } } else { Logger.Trace("请求了不存在的服务器ID:" + serverId); net.Dispose(); } }
/** * * 客户端选择服务器发送 * 服务器IP * 服务器端口号 * sessionID * * */ private static void Handle_ServerSelected(ArcheAgeConnection net, PacketReader reader) { //net.SendAsyncHex(new NP_Hex("6f000c005100006700e682a8e79a84e5b8b3e8999fe59ba0e98195e58f8de9818ae688b2e7aea1e79086e8a68fe7aba0e88887e6a29de4be8be69585e5819ce6ac8a34e697a52c20e5a682e69c89e79691e5958fe8ab8be6b4bde5aea2e69c8de4b8ade5bf83313a31e8a9a2e5958f2e01")); //return; reader.Offset += 8; //00 00 00 00 00 00 00 00 Undefined Data byte serverId = reader.ReadByte(); //serverId =1; GameServer server = GameServerController.CurrentGameServers.FirstOrDefault(n => n.Value.Id == serverId).Value; if (server != null && server.CurrentConnection != null) { if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { //create session Random random = new Random(); int num = random.Next(255) + random.Next(255) + random.Next(255) + random.Next(255); net.CurrentAccount.Session = num = 1323126619;//指定session net.movedToGame = true; GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); server.CurrentConnection.SendAsync(new NET_AccountInfo(net.CurrentAccount)); server.CurrentAuthorized.Add(net.CurrentAccount.AccountId); net.SendAsync(new NP_SendGameAuthorization(server, num)); } } else { Logger.Trace("no server ID:" + serverId); net.Dispose(); } }
/** * * Client selects server to send * * Server IP * * Server port number * sessionID * */ private static void Handle_ServerSelected(ArcheAgeConnection net, PacketReader reader) { //net.SendAsync(new NP_EditMessage2("systemTest")); //return; reader.Offset += 8; //00 00 00 00 00 00 00 00 Undefined Data byte serverId = reader.ReadByte(); //serverId =1; GameServer server = GameServerController.CurrentGameServers.FirstOrDefault(n => n.Value.Id == serverId).Value; if (server != null && server.CurrentConnection != null) { if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { //create session //Random random = new Random(); //int num = random.Next(255) + random.Next(255) + random.Next(255) + random.Next(255); //net.CurrentAccount.Session = num= 1323126619;//Specify session // генерируем cookie Random random = new Random(); int cookie = random.Next(255); cookie += random.Next(255) << 8; cookie += random.Next(255) << 16; cookie += random.Next(255) << 24; net.CurrentAccount.Session = cookie; //Designated session net.movedToGame = true; GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); server.CurrentConnection.SendAsync(new NET_AccountInfo(net.CurrentAccount)); server.CurrentAuthorized.Add(net.CurrentAccount.AccountId); net.SendAsync(new NP_SendGameAuthorization(server, cookie)); } } else { Logger.Trace("Requested a non-existent server ID:" + serverId); net.Dispose(); } }
private static void Handle_ServerSelected(ArcheAgeConnection net, PacketReader reader) { reader.Offset += 8; //00 00 00 00 00 00 00 00 Undefined Data byte serverId = reader.ReadByte(); GameServer server = GameServerController.CurrentGameServers.FirstOrDefault(n => n.Value.Id == serverId).Value; if (server.CurrentConnection != null) { if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { net.movedToGame = true; GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); server.CurrentConnection.SendAsync(new NET_AccountInfo(net.CurrentAccount)); net.SendAsync(new NP_SendGameAuthorization(server, net.CurrentAccount.AccountId)); server.CurrentAuthorized.Add(net.CurrentAccount.AccountId); } } else { net.Dispose(); } }
private static void Handle_CAEnterWorld_0x0B(ArcheAgeConnection net, PacketReader reader) { //net.SendAsyncHex(new NP_Hex("13000A008D0EC89A0E003132372E302E302E31D704")); //0B00 0D00 00000000 00000000 01 int p_from = reader.ReadLEInt32(); int p_to = reader.ReadLEInt32(); byte serverId = reader.ReadByte(); //serverId GameServer server = GameServerController.CurrentGameServers.FirstOrDefault(n => n.Value.Id == serverId).Value; if (server != null && server.CurrentConnection != null) { if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { net.CurrentAccount.LastEnteredTime = Utility.CurrentTimeMilliseconds(); net.CurrentAccount.LastIp = net.ToString(); // IP // генерируем cookie Random random = new Random(); int cookie = random.Next(255); cookie += random.Next(255) << 8; cookie += random.Next(255) << 16; cookie += random.Next(255) << 24; net.CurrentAccount.Session = cookie; //Designated session //Передаем управление Гейм серверу net.MovedToGame = true; GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); //отсылаем Гейм серверу информацию об аккаунте server.CurrentConnection.SendAsync(new NET_AccountInfo(clientVersion, net.CurrentAccount)); server.CurrentAuthorized.Add(net.CurrentAccount.AccountId); //отсылаем Клиенту информацию о куках net.SendAsync(new AcWorldCookie_0X0A(clientVersion, server, cookie)); } } else { Logger.Trace("No serverID requested:" + serverId); net.Dispose(); } }
/// <summary> /// Client choose server to send serverIP, server port number, sessionID ///</summary>> private static void Handle_CARequestReconnect_0X0D(ArcheAgeConnection net, PacketReader reader) { /* * [7] C>s 0ms. 23:56:45 .957 10.03.18 * ------------------------------------------------------------------------------- * TType: ArcheageServer: undef Parse: 6 EnCode: off * ------- 0 1 2 3 4 5 6 7 - 8 9 A B C D E F ------------------- * 000000 0B 00 0D 00 00 00 00 00 | 00 00 00 00 01 ............. * ------------------------------------------------------------------------------- * Archeage: "CARequestReconnect" size: 13 prot: 2 $002 * Addr: Size: Type: Description: Value: * 0000 2 word psize 11 | $000B * 0002 2 word ID 13 | $000D * 0004 4 integer p_from 0 | $00000000 * 0008 4 integer p_to 0 | $00000000 * 000C 1 byte serverId 1 | $01 * 4 integer cookie * ? WideStr[byte] MAC */ //0B00 0D00 00000000 00000000 01 //reader.Offset += 8; //Undefined Data int p_from = reader.ReadLEInt32(); int p_to = reader.ReadLEInt32(); byte serverId = reader.ReadByte(); //serverId GameServer server = GameServerController.CurrentGameServers.FirstOrDefault(n => n.Value.Id == serverId).Value; if (server != null && server.CurrentConnection != null) { if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { net.CurrentAccount.LastEnteredTime = Utility.CurrentTimeMilliseconds(); net.CurrentAccount.LastIp = net.ToString(); // IP //net.CurrentAccount.AccountId = net.CurrentAccount.AccountId; // //create session (cookie) ///var cookie = 128665876; //$07AB4914 - для теста ///net.CurrentAccount.Session = cookie; //AccountHolder.AccountList.FirstOrDefault(n => n.AccId == Convert.ToInt32(cookie)); // генерируем cookie Random random = new Random(); int cookie = random.Next(255); cookie += random.Next(255) << 8; cookie += random.Next(255) << 16; cookie += random.Next(255) << 24; net.CurrentAccount.Session = cookie; //Designated session //Передаем управление Гейм серверу net.movedToGame = true; GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); //отсылаем Гейм серверу информацию об аккаунте server.CurrentConnection.SendAsync(new NET_AccountInfo(net.CurrentAccount)); server.CurrentAuthorized.Add(net.CurrentAccount.AccountId); //отсылаем Клиенту информацию о куках net.SendAsync(new AcWorldCookie_0X0A(server, cookie)); } } else { Logger.Trace("No serverID requested:" + serverId); net.Dispose(); } }
private static void Handle_ServerSelected(ArcheAgeConnection net, PacketReader reader) { reader.Offset += 8; //00 00 00 00 00 00 00 00 Undefined Data byte serverId = reader.ReadByte(); GameServer server = GameServerController.CurrentGameServers.FirstOrDefault(n => n.Value.Id == serverId).Value; if (server.CurrentConnection != null) { if (GameServerController.AuthorizedAccounts.ContainsKey(net.CurrentAccount.AccountId)) { net.movedToGame = true; GameServerController.AuthorizedAccounts.Remove(net.CurrentAccount.AccountId); server.CurrentConnection.SendAsync(new NET_AccountInfo(net.CurrentAccount)); net.SendAsync(new NP_SendGameAuthorization(server, net.CurrentAccount.AccountId)); server.CurrentAuthorized.Add(net.CurrentAccount.AccountId); } } else net.Dispose(); }