[GWCA++]Bot Developer Helper

02/15/2020 10:18 iTeX-#121
Quote:
Originally Posted by CoderAndy View Post
ok whatever you say bro, i don't think you understand what changed with the last gw update but anyway gl fixing your script.
instead of bitching around you could explain and contribute
02/15/2020 12:06 Zvend#122
Quote:
Originally Posted by iTeX- View Post
instead of bitching around you could explain and contribute
Dont tell people to contribute. It just looks like u see sth is not working and didnt try to deal with it or read why stuff is not working. Also this tool is a Dev-HELPER -- which means it helps u developing bots not developing the 'API' to bot. :)
02/16/2020 12:27 Good Morning#123
If using over 3-4 accounts cpu will be 100%. Hope a net fixes it.
02/16/2020 14:56 iTeX-#124
Quote:
Originally Posted by Zvend View Post
Dont tell people to contribute. It just looks like u see sth is not working and didnt try to deal with it or read why stuff is not working. Also this tool is a Dev-HELPER -- which means it helps u developing bots not developing the 'API' to bot. :)
You are basically right.
I know that this is a helping tool but since i tested it and it seemed to me that all you can do here is printing out memory adresses which you need for basically everything unless you do a pixelbased bot AFAIK.

Anyways. Since im not that into this botting scene i better hold back
02/16/2020 15:21 TheOldy#125
Quote:
Originally Posted by Good Morning View Post
If using over 3-4 accounts cpu will be 100%. Hope a net fixes it.
I don't know your setup, but I'm running 7 clients/accounts with ~50% CPU
02/16/2020 18:12 Zvend#126
Quote:
Originally Posted by TheOldy View Post
I don't know your setup, but I'm running 7 clients/accounts with ~50% CPU
Im curious too
03/06/2020 22:48 Yoshikawa91#127
Hello guys,

First of all, thanks a lot to DerMoench14 for this tools it helps me a lot while playing with GWCA and GWTB.

I managed to create the premises of a salvaging module but I encounter an issue...
Everytime I (re)load a zone, I need to first salvage one item manually in order to use my salvage GWCA function next. If I skip this manual first salvage, GW crashes.

When I use the CtoGS logger, I can't find anything special on first salvage call...

Any idea ?

Thx for your help.
03/07/2020 00:18 list comprehension#128
Quote:
Originally Posted by Yoshikawa91 View Post
Hello guys,

First of all, thanks a lot to DerMoench14 for this tools it helps me a lot while playing with GWCA and GWTB.

I managed to create the premises of a salvaging module but I encounter an issue...
Everytime I (re)load a zone, I need to first salvage one item manually in order to use my salvage GWCA function next. If I skip this manual first salvage, GW crashes.

When I use the CtoGS logger, I can't find anything special on first salvage call...

Any idea ?

Thx for your help.
It is because you need some structs and pointers to them to allow the salvage function to work, otherwise the client gets unknown packets back from the game server. You need to update the following, this isn't fixed but what areas need to be updated of gwa2.
Code:
AddPattern('5F5E5B741A6860EA0000')
	_('ScanSalvageFunction:')
	AddPattern('8BFA8BD9897DF0895DF4')
	_('ScanSalvageGlobal:')

;then the following asm needs to be updated as well
;~ 	_('CommandSalvage:')
;~ 	_('mov ebx,SalvageGlobal')
;~ 	_('mov ecx,dword[eax+4]')
;~ 	_('mov dword[ebx],ecx')
;~ 	_('push ecx')
;~ 	_('mov ecx,dword[eax+8]')
;~ 	_('add ebx,4')
;~ 	_('mov dword[ebx],ecx')
;~ 	_('mov edx,dword[eax+c]')
;~ 	_('mov dword[ebx],ecx')
;~ 	_('call SalvageFunction')
;~ 	_('ljmp CommandReturn')
As you will notice the public gwa2 has the salvage asm commented out as well that needs to be updated. This update would only work for non weapons as well I believe as weapons with mods require dealing with GStoC packets.
03/07/2020 00:35 Yoshikawa91#129
Quote:
Originally Posted by list comprehension View Post
It is because you need some structs and pointers to them to allow the salvage function to work, otherwise the client gets unknown packets back from the game server. You need to update the following, this isn't fixed but what areas need to be updated of gwa2.
Code:
AddPattern('5F5E5B741A6860EA0000')
	_('ScanSalvageFunction:')
	AddPattern('8BFA8BD9897DF0895DF4')
	_('ScanSalvageGlobal:')

;then the following asm needs to be updated as well
;~ 	_('CommandSalvage:')
;~ 	_('mov ebx,SalvageGlobal')
;~ 	_('mov ecx,dword[eax+4]')
;~ 	_('mov dword[ebx],ecx')
;~ 	_('push ecx')
;~ 	_('mov ecx,dword[eax+8]')
;~ 	_('add ebx,4')
;~ 	_('mov dword[ebx],ecx')
;~ 	_('mov edx,dword[eax+c]')
;~ 	_('mov dword[ebx],ecx')
;~ 	_('call SalvageFunction')
;~ 	_('ljmp CommandReturn')
As you will notice the public gwa2 has the salvage asm commented out as well that needs to be updated. This update would only work for non weapons as well I believe as weapons with mods require dealing with GStoC packets.
Thanks but I am not actually using GWA2 but GWCA.
I succeeded to salvage non weapon item with this code :
Code:
    void Items::SalvageMaterials(uint32_t itemId) {
        Item* salvageKit = FindSalvageKit();
        if (salvageKit) {
            uint16_t salvageSessionId16bit = GameContext::instance()->world->salvage_session_id;
            GW::CtoS::SendPacket(0x10, GAME_CMSG_ITEM_SALVAGE_SESSION_OPEN
                , salvageSessionId16bit
                , salvageKit->item_id
                , itemId
            );
        }
    }
But unfortunately, it only works if I do a manual salvage within the game before calling this function to mass salvage the rest of the inventory.

Without the prior "manual salvage within the game", GW crashes right after the first call of the above function. :'(
With the prior "manual salvage within the game", items are salvaged like a charm.

By the way I placed some hooks on :
* GW::Packet::StoC::ItemGeneralInfo (0x0165)
* GW::Packet::StoC::SalvageSessionStart (0x0167)
* GW::Packet::StoC::SixteenA (0x016A)
* GW::Packet::StoC::InventoryItemQuantity (0x0013C)
* GW::Packet::StoC::ChatMessageCore (0x005D)
* GW::Packet::StoC::ChatMessageServer (0x005E)

Hooks are working well but it still does not solve my problem...
03/07/2020 03:57 phat34#130
try to call GW::Packet::StoC::SalvageSessionStart (0x0167) then a delay then try your salvage function
03/07/2020 11:53 Yoshikawa91#131
Quote:
Originally Posted by phat34 View Post
try to call (0x0167) then a delay then try your salvage function
I can't call a Server to Client packet. I however can place an hook on it, which I did.

Code:
GW::HookEntry SalvageSessionStart_Entry;
GW::StoC::RegisterPacketCallback<GW::Packet::StoC::SalvageSessionStart>(&SalvageSessionStart_Entry,
		[this](GW::HookStatus*, GW::Packet::StoC::SalvageSessionStart* packet) -> void {
			GW::Chat::WriteChat(GW::Chat::CHANNEL_MODERATOR, "SalvageSessionStart Hooked !");
		});
When I do the first manual salvage within the game , chat is displaying "SalvageSessionStart Hooked !". This tells me that the hook is working fine.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

But when my first salvage come from a GWCA call, I still crash...
03/07/2020 12:05 MissingInformation#132
thanks man
03/07/2020 20:15 Zvend#133
Quote:
Originally Posted by Yoshikawa91 View Post
I can't call a Server to Client packet. I however can place an hook on it, which I did.

Code:
GW::HookEntry SalvageSessionStart_Entry;
GW::StoC::RegisterPacketCallback<GW::Packet::StoC::SalvageSessionStart>(&SalvageSessionStart_Entry,
		[this](GW::HookStatus*, GW::Packet::StoC::SalvageSessionStart* packet) -> void {
			GW::Chat::WriteChat(GW::Chat::CHANNEL_MODERATOR, "SalvageSessionStart Hooked !");
		});
When I do the first manual salvage within the game , chat is displaying "SalvageSessionStart Hooked !". This tells me that the hook is working fine.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

But when my first salvage come from a GWCA call, I still crash...
you crash because there is an global array of size 2x 4Bytes which need to be prepared before calling salvage. GW needs the globals in order to react on a successful salvage. His BotDev tool wont help you with it. you will need to dig into xdbg or IDA in order to understand what is happening.
You need to see whats on the stack and whats in the registers.

If the global from GW is not filled with the right values your salvage session will take the old values from last salvage session. if the old session contained the same items like ur new session (e.g. if u salvage the same stack with the same kit) then it wont create any crash if u use ur code after ur manual salvage.

Just if you wanted to understand ur crash :)
03/11/2020 20:39 3vangelist#134
Code:
GW::GameThread::Enqueue([item, kit]() {
  SalvageUIMessage s = { item->item_id, kit->item_id };
  GW::UI::SendUIMessage(0x10000000 | 0x100, &s);
  GW::CtoS::SendPacket(0x10, GAME_CMSG_ITEM_SALVAGE_SESSION_OPEN, GW::GameContext::instance()->world->salvage_session_id, s.kit_id, s.item_id);
  });
03/11/2020 21:10 Yoshikawa91#135
Quote:
Originally Posted by 3vangelist View Post
Code:
GW::GameThread::Enqueue([item, kit]() {
  SalvageUIMessage s = { item->item_id, kit->item_id };
  GW::UI::SendUIMessage(0x10000000 | 0x100, &s);
  GW::CtoS::SendPacket(0x10, GAME_CMSG_ITEM_SALVAGE_SESSION_OPEN, GW::GameContext::instance()->world->salvage_session_id, s.kit_id, s.item_id);
  });
Many thanks 3vangelist.
You saved me precious hours of sleep. :handsdown: