forked from 29988122/Fate-Grand-Order_Lua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_auto_gift_exchange.lua
50 lines (42 loc) · 1.21 KB
/
_auto_gift_exchange.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
dir = scriptPath()
setImagePath(dir)
GameRegion = "EN"
package.path = package.path .. ";" .. dir .. 'modules/?.lua'
GeneralImagePath = "image_" .. GameRegion .. "/"
local IMAGE_WIDTH = 1280
local IMAGE_HEIGHT = 720
local SCRIPT_WIDTH = 2560
local SCRIPT_HEIGHT = 1440
-- imports
local scaling = require("scaling")
scaling.ApplyAspectRatioFix(SCRIPT_WIDTH, SCRIPT_HEIGHT, IMAGE_WIDTH, IMAGE_HEIGHT)
-- consts
local SpinClick = Location(834, 860)
local FinishedLotteryBoxRegion = Region(575, 860, 70, 100)
local FullPresentBoxRegion = Region(1280, 720, 1280, 720)
local ResetClick = Location(2200, 480)
local ResetConfirmationClick = Location(1774, 1122)
local ResetCloseClick = Location(1270, 1120)
-- script
local function spin()
continueClick(SpinClick,480)
end
local function reset()
click(ResetClick)
wait(0.5)
click(ResetConfirmationClick)
wait(3)
click(ResetCloseClick)
wait(2)
end
FinishedLotteryBoxPattern = Pattern(GeneralImagePath .. "lottery.png")
FinishedLotteryBoxPattern:similar(0.65)
while(true) do
if FinishedLotteryBoxRegion:exists(FinishedLotteryBoxPattern) then
reset()
elseif FullPresentBoxRegion:exists(GeneralImagePath .. "StopGifts.png") then
scriptExit("Present Box Full")
else
spin()
end
end