From a2f33847f352407cb3919380091300dc1eeeac8f Mon Sep 17 00:00:00 2001 From: Dylan Date: Wed, 26 Feb 2020 19:41:40 +0100 Subject: [PATCH 1/3] Update version, add new handler to world --- Comun/Frames/Autentificacion/AccountLogin.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Comun/Frames/Autentificacion/AccountLogin.cs b/Comun/Frames/Autentificacion/AccountLogin.cs index 2fd9ee1c3..df95b96df 100644 --- a/Comun/Frames/Autentificacion/AccountLogin.cs +++ b/Comun/Frames/Autentificacion/AccountLogin.cs @@ -25,7 +25,7 @@ public void GetWelcomeKeyAsync(TcpClient prmClient, string prmPacket) account.AccountState = AccountStates.CONNECTED; account.welcomeKey = prmPacket.Substring(2); - prmClient.SendPacket("1.30.14"); + prmClient.SendPacket("1.31.2"); prmClient.SendPacket(prmClient.account.accountConfig.accountUsername + "\n" + Hash.Crypt_Password(prmClient.account.accountConfig.accountPassword, prmClient.account.welcomeKey)); prmClient.SendPacket("Af"); } @@ -111,5 +111,13 @@ public void GetServerSelection(TcpClient prmClient, string prmPacket) prmClient.account.gameTicket = prmPacket.Substring(14); prmClient.account.SwitchToGameServer(Hash.Decrypt_IP(prmPacket.Substring(3, 8)), Hash.Decrypt_Port(prmPacket.Substring(11, 3).ToCharArray())); } + + [PaqueteAtributo("AYK")] + public void GetServerSelectionRemastered(TcpClient prmClient, string prmPacket) + { + string[] DataPackage = prmPacket.Substring(3).Split(';'); + prmClient.account.gameTicket = DataPackage[1]; + prmClient.account.SwitchToGameServer(DataPackage[0], 443); + } } } From b134b7d5eea49835c16324baecbe7d576db46ad6 Mon Sep 17 00:00:00 2001 From: Dylan Date: Wed, 26 Feb 2020 19:42:00 +0100 Subject: [PATCH 2/3] Apply the hotfix for bank --- .../Almacenamiento/StoreAllObjectsAction.cs | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/Otros/Scripts/Acciones/Almacenamiento/StoreAllObjectsAction.cs b/Otros/Scripts/Acciones/Almacenamiento/StoreAllObjectsAction.cs index 87a488265..271b240ea 100644 --- a/Otros/Scripts/Acciones/Almacenamiento/StoreAllObjectsAction.cs +++ b/Otros/Scripts/Acciones/Almacenamiento/StoreAllObjectsAction.cs @@ -8,39 +8,34 @@ class StoreAllObjectsAction : ScriptAction internal override async Task process(Account account) { Task[] tasks = new Task[account.hasGroup ? account.group.members.Count + 1 : 1]; - tasks[0] = cleanInventory(account); - + int idCapture = account.script.getCaptureIdAndQuantity().Key; + int idCAC = account.script.getCACId(); + tasks[0] = cleanInventory(account, idCapture, idCAC); if (account.hasGroup && account.isGroupLeader) { foreach (var follower in account.group.members) { - tasks[account.group.members.IndexOf(follower) + 1] = cleanInventory(follower); + tasks[account.group.members.IndexOf(follower) + 1] = cleanInventory(follower, idCapture, idCAC); } } Task.WaitAll(tasks); return ResultadosAcciones.HECHO; } - private async Task cleanInventory(Account account) + private async Task cleanInventory(Account account,int idcapture = 0, int idCAC = 0) { InventoryClass inventario = account.game.character.inventario; - int idCapture = account.script.getCaptureIdAndQuantity().Key; - int quantityCapture = account.script.getCaptureIdAndQuantity().Value; + foreach (InventoryObject objeto in inventario.objetos) { - if (!objeto.objeto_esta_equipado() && objeto.id_modelo != idCapture) + if (!objeto.objeto_esta_equipado() && idcapture != objeto.id_modelo && idCAC != objeto.id_modelo) { account.connexion.SendPacket($"EMO+{objeto.id_inventario}|{objeto.cantidad}"); inventario.eliminar_Objeto(objeto, 0, false); await Task.Delay(300); } - if(objeto.id_modelo == idCapture && objeto.cantidad< quantityCapture) - { - int quantite = quantityCapture - objeto.cantidad; - account.Logger.LogInfo("SCRIPT", $"On récupére " + quantite +" captures dans la banque"); - account.connexion.SendPacket($"EMO-{objeto.id_inventario}|{quantite}"); - } + } } } From 491e4b393a885b7305d9643e07fe1a592e863050 Mon Sep 17 00:00:00 2001 From: Dylan Date: Wed, 26 Feb 2020 19:46:30 +0100 Subject: [PATCH 3/3] add log on handler --- Comun/Frames/Autentificacion/AccountLogin.cs | 23 +++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Comun/Frames/Autentificacion/AccountLogin.cs b/Comun/Frames/Autentificacion/AccountLogin.cs index df95b96df..b11d9f7ef 100644 --- a/Comun/Frames/Autentificacion/AccountLogin.cs +++ b/Comun/Frames/Autentificacion/AccountLogin.cs @@ -44,7 +44,7 @@ public void GetServerState(TcpClient prmClient, string prmPacket) GameServer server = account.game.server; bool firstTime = true; - foreach(string sv in serverList) + foreach (string sv in serverList) { string[] separator = sv.Split(';'); @@ -64,7 +64,7 @@ public void GetServerState(TcpClient prmClient, string prmPacket) } } - if(!firstTime && server.serverState == ServerStates.ONLINE) + if (!firstTime && server.serverState == ServerStates.ONLINE) prmClient.SendPacket("Ax"); } @@ -90,7 +90,7 @@ public void GetServerList(TcpClient prmClient, string prmPacket) if (serverId == account.game.server.serverId) { - if(account.game.server.serverState == ServerStates.ONLINE) + if (account.game.server.serverState == ServerStates.ONLINE) { picked = true; account.game.character.evento_Servidor_Seleccionado(); @@ -101,7 +101,7 @@ public void GetServerList(TcpClient prmClient, string prmPacket) counter++; } - if(picked) + if (picked) prmClient.SendPacket($"AX{account.game.server.serverId}", true); } @@ -116,8 +116,19 @@ public void GetServerSelection(TcpClient prmClient, string prmPacket) public void GetServerSelectionRemastered(TcpClient prmClient, string prmPacket) { string[] DataPackage = prmPacket.Substring(3).Split(';'); - prmClient.account.gameTicket = DataPackage[1]; - prmClient.account.SwitchToGameServer(DataPackage[0], 443); + + if (DataPackage.Length != 0) + { + prmClient.account.gameTicket = DataPackage[1]; + prmClient.account.SwitchToGameServer(DataPackage[0], 443); + prmClient.account.Logger.LogInfo("[BOT]", "Connexion au world server"); + } + else + { + prmClient.account.Logger.LogError("[BOT]", "Redirection world impossible"); + prmClient.account.Disconnect(); + prmClient.account.Logger.LogError("[BOT]", "Déconnexion effectuée"); + } } } }