OK to ask for exploit/Scripting help here...

01/23/2021 07:08 Mad head Trip#286
Quote:
Originally Posted by list comprehension View Post
Chest run bot such as the pong mei or boreal basically does all of that but instead of flowers looks for chests.
hell yeah i didnt even think thank you very much!!!
01/28/2021 17:50 Sky828#287
Anyone know what is causing TargetNearestEnemy() in GWA2 to crash the game? :/

Edit: turn off toolbox....
02/08/2021 15:15 makryno#288
Does anyone know if there's a way to get the event system to work?
It seems to me that some relevant region are it are disabled within the "ModifyMemory" function but so far I couldn't find any working version of GWA2 where this is not the case.
02/12/2021 21:15 Gangstar666#289
hi i would need a working GWA2 for Buying Materials @ Trader
Can anybody help me
02/15/2021 15:27 Pmolik1809#290
Quote:
Originally Posted by Gangstar666 View Post
hi i would need a working GWA2 for Buying Materials @ Trader
Can anybody help me
Yoshikawa91 posted the solution not so long ago on the forum. I invite you to use the search function.
03/12/2021 19:58 Andreonis#291
Hey, im looking for help with
Code:
Func ScanForCharname($aModuleBase, $aModuleSize)
	Local $lCharNameCode = BinaryToString('0x8BF86A03680F0000C08BCFE8')
	ConsoleWrite("$lCharNameCode : " & $lCharNameCode &     [MENTION=3576271]CRLF[/MENTION])
	Local $lCurrentSearchAddress = $aModuleBase
	Local $lMBI[7], $lMBIBuffer = DllStructCreate('dword;dword;dword;dword;dword;dword;dword')
	Local $lSearch, $lTmpMemData, $lTmpAddress, $lTmpBuffer = DllStructCreate('ptr'), $i


	While $lCurrentSearchAddress < $aModuleBase + $aModuleSize
		Local $lMBI[7]
		DllCall($mKernelHandle, 'int', 'VirtualQueryEx', 'int', $mGWProcHandle, 'int', $lCurrentSearchAddress, 'ptr', DllStructGetPtr($lMBIBuffer), 'int', DllStructGetSize($lMBIBuffer))
		For $i = 0 To 6
			$lMBI[$i] = StringStripWS(DllStructGetData($lMBIBuffer, ($i + 1)), 3)
			ConsoleWrite("DllStructGetData($lMBIBuffer, (" & $i & " + 1) : " & DllStructGetData($lMBIBuffer, ($i + 1)) &     [MENTION=3576271]CRLF[/MENTION])
		Next
		 _ArrayDisplay($lMBI, "$lMBI")
		If $lMBI[4] = 4096 Then
			Local $lBuffer = DllStructCreate('byte[' & $lMBI[3] & ']')
			DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $lCurrentSearchAddress, 'ptr', DllStructGetPtr($lBuffer), 'int', DllStructGetSize($lBuffer), 'int', '')

			$lTmpMemData = DllStructGetData($lBuffer, 1)
			$lTmpMemData = BinaryToString($lTmpMemData)
			ConsoleWrite("$lTmpMemData : " & $lTmpMemData &     [MENTION=3576271]CRLF[/MENTION])

			$lSearch = StringInStr($lTmpMemData, $lCharNameCode, 2)
			If $lSearch > 0 Then
				$lTmpAddress = $lCurrentSearchAddress + $lSearch - 1
				DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $lTmpAddress - 0x42, 'ptr', DllStructGetPtr($lTmpBuffer), 'int', DllStructGetSize($lTmpBuffer), 'int', '')
				Return DllStructGetData($lTmpBuffer, 1) - $aModuleBase
			EndIf

			$lCurrentSearchAddress += $lMBI[3]
			ConsoleWrite     [MENTION=3576271]CRLF[/MENTION] & "$lCurrentSearchAddress : " & $lCurrentSearchAddress &     [MENTION=3576271]CRLF[/MENTION])
		EndIf
	 WEnd
	 _ArrayDisplay($lMBI)
	 _WinAPI_DisplayStruct($lMBIBuffer,"")

	Return False
 EndFunc   ;==>ScanForCharname
Do you guys know what exacly parts of memory should i look for and add an offset to base adress to get nickname of account characters or the one that is already logged in?
Thats so far what i've got.

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

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

EDIT:

I managed to fix it. Basicaly function returns currently logged in character or if in switch characters window it returns lastly logged-in character. Returns empty String if you are not logged-in into account. I also found the way to return all character names out of logged-in account. For interested:
Code:
 Func MemoryRead($aAddress, $aType = 'dword')
	Local $lBuffer = DllStructCreate($aType)
	DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $aAddress, 'ptr', DllStructGetPtr($lBuffer), 'int', DllStructGetSize($lBuffer), 'int', '')
	Return DllStructGetData($lBuffer, 1)
 EndFunc   ;==>MemoryRead

Func GetModuleInfo(ByRef $aModuleBase, ByRef $aModuleSize)
	Local $lProcName = _WinAPI_GetProcessName($mGWProcId)
	Local $lProcNameLength = StringLen($lProcName)

	Local $lModules = _WinAPI_EnumProcessModules($mGWProcId)
	;_ArrayDisplay($lModules, "$lModules")
	For $i = 1 To $lModules[0][0]
		Local $lModuleName = StringRight($lModules[$i][1], $lProcNameLength)
		ConsoleWrite [MENTION=3576271]CRLF[/MENTION] & "$lModuleName : " & $lModuleName & [MENTION=3576271]CRLF[/MENTION])
		If StringCompare($lModuleName, $lProcName, $STR_NOCASESENSE) = 0 Then
			Local $lModuleInfo = _WinAPI_GetModuleInformation($mGWProcHandle, $lModules[$i][0])
			ConsoleWrite [MENTION=3576271]CRLF[/MENTION] & "$lModuleInfoEntryPoint : " & DllStructGetData($lModuleInfo, "EntryPoint") & [MENTION=3576271]CRLF[/MENTION])
			$aModuleBase = DllStructGetData($lModuleInfo, 'BaseOfDll')
			$aModuleSize = DllStructGetData($lModuleInfo, 'SizeOfImage')
			Return True
		EndIf
	Next
	Return False
 EndFunc   ;==>GetModuleInfo

 Func MyScanForCurrentlyLoggedIn($aModuleBase)
   Local $lCurrentSearchAddress = $aModuleBase + 0x6292D0
   Local $lLoggedInCharacter = MemoryRead($lCurrentSearchAddress,'wchar[30]')
   ;ConsoleWrite("Found logged-in character: " & $lLoggedInCharacter &  [MENTION=3576271]CRLF[/MENTION])
   Return $lLoggedInCharacter
EndFunc	;==>MyScanForCurrentlyLoggedIn
03/16/2021 16:49 ssinandy#292
Turn to a tool to buy and disassemble materials
[Only registered and activated users can see links. Click Here To Register...]
thank you!
03/28/2021 18:36 phat34#293
what?
04/06/2021 13:03 turtlelover1#294
Im looking to add a func to use merch stones for vaettir bot but im not sure how to go about writing it as im newer to coding with 0 background any help would be wonderful. The issue I have is its telling me that on the endfunc its got no matching If Statment but idn where it needs one...Here is what i have so far


Code:
Func UseMercantile()
	If $UseMercantile = True Then
   out("Using Merchant-Stone selected")
   Else
   out("No Merchant-Stone selected")
   EndIf
   GetNumberOfFreeSlots <= 10 Then
   If CountItemInBagsByModelID(31154) > 0 Then
	useitem(31154)
	Sleep(500
    out("Cleaning Ineventory")
   EndIf
    $i = 0;
	  Do
		If FindIDKit() = 0 Then
			EndIf
			BuyIDKit()
			Do
				Sleep(200)
			Until FindIDKit() <> 0
	GetNumberOfFreeSlots = 10 Then
	       Ident()
		Sleep(GetPing())
		$i += 1
	Until FindIDKit() <> 0 Or $i > 4
	Sell()
    Sleep(300)
   EndIf
   If GetGoldCharacter() > 97000 Then
		Out("Buying Lockpick")
		BuyLockPick
	Sleep(GetPing()+500) EndIf
	If GetGoldCharacter() > 10000 Then
 EndFunc
04/13/2021 13:01 YueNiu#295
Quote:
Originally Posted by turtlelover1 View Post
Im looking to add a func to use merch stones for vaettir bot but im not sure how to go about writing it as im newer to coding with 0 background any help would be wonderful. The issue I have is its telling me that on the endfunc its got no matching If Statment but idn where it needs one...Here is what i have so far


If GetGoldCharacter() > 97000 Then
Out("Buying Lockpick")
BuyLockPick
Sleep(GetPing()+500) EndIf
If GetGoldCharacter() > 10000 Then
EndFunc[/code]
What did you want to do with last If? You might not even need it.

I have added this function to an old bot i had and whenever i activate it, rendering is off BUT bot also stops at that location. Am i doing something wrong or did something change in gw?


Code:
Func ToggleRendering()
    $RenderingEnabled = Not $RenderingEnabled
    If $RenderingEnabled Then
        EnableRendering()
        WinSetState(GetWindowHandle(), "", [MENTION=330060]Sw_[/MENTION]SHOW)
    Else
        DisableRendering()
        WinSetState(GetWindowHandle(), "", [MENTION=330060]Sw_[/MENTION]HIDE)
        ClearMemory()
    EndIf
EndFunc   ;==>ToggleRendering
04/15/2021 23:55 turtlelover1#296
Quote:
Originally Posted by YueNiu View Post
What did you want to do with last If? You might not even need it.

I have added this function to an old bot i had and whenever i activate it, rendering is off BUT bot also stops at that location. Am i doing something wrong or did something change in gw?


Code:
Func ToggleRendering()
    $RenderingEnabled = Not $RenderingEnabled
    If $RenderingEnabled Then
        EnableRendering()
        WinSetState(GetWindowHandle(), "", [MENTION=330060]Sw_[/MENTION]SHOW)
    Else
        DisableRendering()
        WinSetState(GetWindowHandle(), "", [MENTION=330060]Sw_[/MENTION]HIDE)
        ClearMemory()
    EndIf
EndFunc   ;==>ToggleRendering
What i was aiming to do is make it so if the gold value is 10k then end the func for merch stone
04/16/2021 08:41 YueNiu#297
Quote:
Originally Posted by turtlelover1 View Post
What i was aiming to do is make it so if the gold value is 10k then end the func for merch stone
Put option to stop in your buylockpick function.

Code:
If gold > 97k then
    buylockpick()
EndIf
Code:
func buylockpick
    while GetGoldCharacter() > 10000
         buy 1 lockpick part
    WEnd
Endfunc
06/14/2021 11:46 natanders#298
i'd like to setup a func to pull multiple item from inventory to chest (white item)

I have all Global Const ID and Func Canpickup ....

but need help how to pull them from inv to chest

Any help is really appreciated
06/16/2021 10:51 Yoshikawa91#299
Quote:
Originally Posted by natanders View Post
i'd like to setup a func to pull multiple item from inventory to chest (white item)

I have all Global Const ID and Func Canpickup ....

but need help how to pull them from inv to chest

Any help is really appreciated
To do so, you need to go through your inventory in order to detect white item, then find the first available slot in your storage and then move item into this slot.

It should look something like this :
Code:
Func StoreWhiteItems()
	Local $aItem
	Local $slot
	Local $full = False
	For $bagIndex = 1 To 4
		For $slotIndex = 1 To DllStructGetData(GetBag($bagIndex), 'Slots')
			$aItem = GetItemBySlot($bagIndex, $slotIndex)

			If DllStructGetData($aItem, 'ID') = 0 Then ContinueLoop

			If GetRarity($aItem) == $RARITY_White Then ;2621
				For $storePan = 8 To 12
					$slot = FindEmptySlot($storePan)
					If $slot <> 0 Then
						ExitLoop
					EndIf
				Next
				If $slot <> 0 Then
					MoveItem($aItem, $storePan, $slot)
					Sleep(GetPing()+500)
				Else
					ExitLoop 2 ;Full storage...
				EndIf
			EndIf
		Next
	Next
EndFunc   ;==>StoreWhiteItems


Func FindEmptySlot($bagIndex)
	Local $aItem
	For $slotIndex = 1 To DllStructGetData(GetBag($bagIndex), 'Slots')
		$aItem= GetItemBySlot($bagIndex, $slotIndex)
		If DllStructGetData($aItem, 'ID') = 0 Then ;Means empty slot
			Return $slotIndex
		EndIf
	Next
	Return 0
EndFunc   ;==>FindEmptySlot
08/09/2021 16:33 spittingllama#300
Hey let's hope this thread is still active.

Here is my issue : I'm using a public version of GWA2 and i'm trying to get the name of an item in my inventory (similar to what TB is doing in the info window)

As far as I can see there are no function to directly get the item name. After some digging here what I understand :

When I use getitembyslot() to select an item in my inventory I can access the following informations :

Code:
Local $lItemStruct = DllStructCreate('long Id;long AgentId;byte Unknown1[4];ptr Bag;ptr ModStruct;long ModStructSize;ptr Customized;byte unknown2[4];byte Type;byte unknown4;short ExtraId;short Value;byte unknown4[2];short Interaction;long ModelId;ptr ModString;byte unknown5[4];ptr NameString;ptr SingleItemName;byte Unknown4[10];byte IsSalvageable;byte Unknown6;byte Quantity;byte Equiped;byte Profession;byte Type2;byte Slot')
I can compare it with the code from GWCA guithub :

Code:
    struct Item { // total: 0x54/84
        /* +h0000 */ uint32_t       item_id;
        /* +h0004 */ uint32_t       agent_id;
        /* +h0008 */ Bag           *bag_equipped; // Only valid if Item is a equipped Bag
        /* +h000C */ Bag           *bag;
        /* +h0010 */ ItemModifier  *mod_struct; // Pointer to an array of mods.
        /* +h0014 */ uint32_t       mod_struct_size; // Size of this array.
        /* +h0018 */ wchar_t       *customized;
        /* +h001C */ uint32_t       model_file_id;
        /* +h0020 */ uint8_t        type;
        /* +h0021 */ uint8_t        h0021;
        /* +h0022 */ uint16_t       extra_id;
        /* +h0024 */ uint16_t       value;
        /* +h0026 */ uint16_t       h0026;
        /* +h0028 */ uint32_t       interaction;
        /* +h002C */ uint32_t       model_id;
        /* +h0030 */ wchar_t       *info_string;
        /* +h0034 */ wchar_t       *name_enc;
        /* +h0038 */ wchar_t       *complete_name_enc; // with color, quantity, etc.
        /* +h003C */ wchar_t       *single_item_name; // with color, w/o quantity, named as single item
        /* +h0040 */ uint8_t        h0040[10];
        /* +h004A */ uint8_t        is_material_salvageable; // Only valid for type 11 (Materials)
        /* +h004B */ uint8_t        h004B; // probably used for quantity extension for new material storage
        /* +h004C */ uint16_t       quantity;
        /* +h004E */ uint8_t        equipped;
        /* +h004F */ uint8_t        profession;
        /* +h0050 */ uint8_t        slot;

In other word :

ModString(GWA2)=*InfoString(GWCA)
unknown5[4]=*name_enc;
NameString=*complete_name_enc
SingleItemName=*single_item_name

Now to get the name of an item, i would need to extract the information on NameString or SingleItemName.

As far as I understand DllStructGetData($aItem, 'NameString') or DllStructGetData($aItem, 'singleItemName') will only return a pointer and not the information I need.

I have no clue how to exactly read that pointer so I tried to copy what was going on with fonctions involving a pointer : GetRarity() and GetModStruct()

Here what I have tried so far :
Code:
MemoryRead(DllStructGetData($aItem, 'singleItemName'),'dword')
MemoryRead(DllStructGetData($aItem, 'singleItemName'),'STR')
MemoryRead(DllStructGetData($aItem, 'singleItemName'),'WSTR')
I also tried some random number of byte and wchar (x) :

Code:
MemoryRead(DllStructGetData($aItem, 'singleItemName'),'Byte[x]')
MemoryRead(DllStructGetData($aItem, 'singleItemName'),'wchar[x]')
But I didn't get any readable results.

Another thing that I tried is to get the item to an agent then to use the GetAgentName() fonction. But it appears to be bugged in my version to GWA2 as it's not returning anything (doesn't return anything when the agent is a random mob and doesn't return anything when the agent is an item).


Any help would be greatly apreciated.