Quote:
Originally Posted by fury90723
Ok I will be brief, I want to "request a quote" to a Material Trader Merchant (for example to know the price of bones, the non rare one) to sell an item to them.
I found a way to do that, but doing so crashes the game at the moment.
The latest GWA2.au3 offers the function
Func TraderRequestSell($aItem)
but using it as below crashes the game
PHP Code:
Local $Item_ExtraID_Bones = 921
Do
Local $quote = TraderRequestSell($Item_ExtraID_Bones)
If TraderSell() Then $lHowMany += 1
Until $lHowMany = 1
Do you guys have any suggestions or experience with this
and how did you make it work?
|
You should need 2 Func for that
Here is an Example how it could look in script:
Code:
While GetGoldCharacter() > 20*1000
TraderRequest(930)
Sleep(500 + 3 * GetPing())
TraderBuy()
WEnd
Code:
Func TraderRequest($aModelID, $aExtraID = -1)
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')
Local $lOffset[4] = [0, 0x18, 0x40, 0xC0]
Local $lItemArraySize = MemoryReadPtr($mBasePointer, $lOffset)
Local $lOffset[5] = [0, 0x18, 0x40, 0xB8, 0]
Local $lItemPtr, $lItemID
Local $lFound = False
Local $lQuoteID = MemoryRead($mTraderQuoteID)
For $lItemID = 1 To $lItemArraySize[1]
$lOffset[4] = 0x4 * $lItemID
$lItemPtr = MemoryReadPtr($mBasePointer, $lOffset)
If $lItemPtr[1] = 0 Then ContinueLoop
DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $lItemPtr[1], 'ptr', DllStructGetPtr($lItemStruct), 'int', DllStructGetSize($lItemStruct), 'int', '')
If DllStructGetData($lItemStruct, 'ModelID') = $aModelID And DllStructGetData($lItemStruct, 'bag') = 0 And DllStructGetData($lItemStruct, 'AgentID') == 0 Then
If $aExtraID = -1 Or DllStructGetData($lItemStruct, 'ExtraID') = $aExtraID Then
$lFound = True
ExitLoop
EndIf
EndIf
Next
If Not $lFound Then Return False
DllStructSetData($mRequestQuote, 2, DllStructGetData($lItemStruct, 'ID'))
Enqueue($mRequestQuotePtr, 8)
Local $lDeadlock = TimerInit()
$lFound = False
Do
Sleep(20)
$lFound = MemoryRead($mTraderQuoteID) <> $lQuoteID
Until $lFound Or TimerDiff($lDeadlock) > GetPing() + 5000
Return $lFound
EndFunc ;==>TraderRequest
Func TraderBuy()
If Not GetTraderCostID() Or Not GetTraderCostValue() Then Return False
Enqueue($mTraderBuyPtr, 4)
Return True
EndFunc ;==>TraderBuy
idk if these gwa2 func still work i didnt use that for years but at least you see how it should work