Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Func Marketplace()
- Local Const $PurpleBags = "res/marketplace_purplebags.bmp"
- Local $RegistrationCountOffset[4] = [70, -9, 110, 5]
- Local $RefreshOffset[2] = [-440, 480]
- Local $x, $y, $IS
- Local $Diff[4]
- Local $timer
- $ResOffset = DetectFullscreenToWindowedOffset()
- $IS = _ImageSearchArea($PurpleBags, 1, $ResOffset[0], $ResOffset[1], $ResOffset[2], $ResOffset[3], $x, $y, 0, 0)
- If $IS = False Then
- SetGUIStatus("No PurpleBags found. Stopping.")
- $Marketplace = False
- EndIf
- Local $count = 0, $breakout = 0
- While $Marketplace
- SetGUIStatus("Waiting for Registration Count change")
- $number = FastFindBidBuy($x, $y)
- If $number >= 0 Then BuyItem($x, $y, $number)
- $Diff[$count] = PixelChecksum($x + $RegistrationCountOffset[0], $y + $RegistrationCountOffset[1], $x + $RegistrationCountOffset[2], $y + $RegistrationCountOffset[3])
- For $i = 0 To UBound($Diff) - 1
- If $Diff[0] <> $Diff[$i] Then
- If TimerDiff($timer) > 1000 Then
- SetGUIStatus("Refresh (Registration Count change)")
- MouseClick("left", $x + $RefreshOffset[0], $y + $RefreshOffset[1], 1, 0)
- $timer = TimerInit()
- Sleep(50)
- ExitLoop
- Else
- $breakout += 1
- If $breakout > 10 Then
- $IS = _ImageSearchArea($PurpleBags, 1, $x - 10, $y - 10, $x + 10, $y + 10, $x, $y, 0, 0)
- If $IS = False Then
- SetGUIStatus("No PurpleBags found. Stopping.")
- $Marketplace = False
- Else
- $breakout = 0
- EndIf
- EndIf
- EndIf
- EndIf
- Next
- If TimerDiff($timer) > 30000 Then
- SetGUIStatus("Refresh (30s no change detected)")
- MouseClick("left", $x + $RefreshOffset[0], $y + $RefreshOffset[1], 1, 0)
- $timer = TimerInit()
- Sleep(50)
- EndIf
- Sleep(50)
- $count += 1
- If $count = 4 Then $count = 0
- WEnd
- EndFunc ;==>Marketplace
- Func FastFindBidBuy($x, $y)
- Local $Valid[2] = [0x979292, 0xB8B8B8]
- Local $SSN = 1, $FF
- Local $BidR[3] = [21, 12, 21]
- Local $Buy[3] = [3, 12, 21]
- Local $Bid[3] = [4, 12, 21]
- Local $BuyOffset[3] = [78, 54, 62] ; x, y, height 7
- Local $ButtonRegion[4] = [$x + $BuyOffset[0] - 15, $y + $BuyOffset[1] - 15, $x + $BuyOffset[0] + 15, $y + $BuyOffset[1] + 15]
- Local $count
- FFSnapShot($ButtonRegion[0], $ButtonRegion[1], $ButtonRegion[2], $ButtonRegion[3] + $BuyOffset[2] * 6, $SSN)
- For $i = 0 To 6
- $count = 0
- For $yBid = $Bid[1] To $Bid[2]
- $FF = FFGetPixel($ButtonRegion[0] + $Bid[0], $ButtonRegion[1] + $yBid + $BuyOffset[2] * $i, $SSN)
- If $FF = $Valid[0] Or $FF = $Valid[1] Then
- $count += 1
- EndIf
- Next
- If $count > 9 Then
- SetGUIStatus("Bid " & $i)
- MouseClick("left", $x + $BuyOffset[0], $y + $BuyOffset[1] + $i * $BuyOffset[2], 2, 0)
- CoSe("{SPACE}")
- EndIf
- Next
- For $i = 0 To 6
- $count = 0
- For $yBuy = $Buy[1] To $Buy[2]
- $FF = FFGetPixel($ButtonRegion[0] + $Buy[0], $ButtonRegion[1] + $yBuy + $BuyOffset[2] * $i, $SSN)
- If $FF = $Valid[0] Or $FF = $Valid[1] Then
- $count += 1
- EndIf
- Next
- If $count > 9 Then
- SetGUIStatus("Buy " & $i)
- Return ($i)
- EndIf
- $count = 0
- For $yBidR = $BidR[1] To $BidR[2]
- $FF = FFGetPixel($ButtonRegion[0] + $BidR[0], $ButtonRegion[1] + $yBidR + $BuyOffset[2] * $i, $SSN)
- If $FF = $Valid[0] Or $FF = $Valid[1] Then
- $count += 1
- EndIf
- Next
- If $count > 9 Then
- SetGUIStatus("BidR " & $i)
- Return ($i)
- EndIf
- Next
- Return -1
- EndFunc ;==>FastFindBidBuy
- Func BuyItem($x, $y, $number)
- Local $MaxOffset[2] = [-111, 297]
- Local $BuyOffset[3] = [78, 54, 62] ; x, y, height
- MouseClick("left", $x + $BuyOffset[0], $y + $BuyOffset[1] + $number * $BuyOffset[2], 2, 0) ; buy
- MouseClick("left", $x + $MaxOffset[0] - 30, $y + $MaxOffset[1], 1, 0) ; amount
- CoSe("f") ; max
- CoSe("r") ; confirm
- CoSe("{SPACE}") ; yes
- $buycount = $buycount + 1
- SetCountStatus($buycount)
- EndFunc ;==>BuyItem
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement