forked from JonBallinger/IC_ShandieDashWait
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IC_ShandieDashWait_Functions.ahk
76 lines (61 loc) · 3.29 KB
/
IC_ShandieDashWait_Functions.ahk
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
global g_ShandieDashWaitUserSettings := g_SF.LoadObjectFromJSON( A_LineFile . "\..\DashWaitSettings.json" )
class IC_ShandieDashWait_SharedFunctions_Class extends IC_BrivSharedFunctions_Class
{
; Waits for the game to be in a ready state
ShouldDashWait()
{
;MsgBox "ShandieDashWait"
ShandieIsInFormation := this.IsChampInFormation( 47, this.Memory.GetCurrentFormation() )
CurrentZone := this.Memory.ReadCurrentZone()
Stacks := this.Memory.ReadSBStacks()
TargetStacks := g_BrivUserSettings[ "AutoCalculateBrivStacks" ] ? (g_BrivGemFarm.TargetStacks - g_BrivGemFarm.LeftoverStacks) : g_BrivUserSettings[ "TargetStacks" ]
; If no Shandie, just exit with false
if (!ShandieIsInFormation) {
;MsgBox "Shandie not detected"
return false
}
; If DashWait is disabled, exit with false
if (g_BrivUserSettings[ "DisableDashWait" ]) {
;MsgBox "Dash wait is disabled"
return false
}
;MsgBox % "CurrentZone: " . CurrentZone . ", g_ShandieDashWaitUserSettings[""ShandieDashWaitAtStart""]:" . g_ShandieDashWaitUserSettings["ShandieDashWaitAtStart"] . ", Expression result: " . ((CurrentZone < 10) AND g_ShandieDashWaitUserSettings["ShandieDashWaitAtStart"])
; Next we check for Dash Wait at start of run
if ((CurrentZone < 10) AND g_ShandieDashWaitUserSettings["ShandieDashWaitAtStart"]) {
;MsgBox "Start run Dash Wait"
return true
}
;MsgBox % "Stacks: " . Stacks . ", g_BrivUserSettings[ ""TargetStacks"" ]:" . g_BrivUserSettings[ "TargetStacks" ] . ", CurrentZone: " . CurrentZone . ", g_BrivUserSettings[ ""StackZone"" ]: " . g_BrivUserSettings[ "StackZone" ] . ", DashWaitPostStack: " . g_ShandieDashWaitUserSettings["ShandieDashWaitPostStack"]
; Then we check for Dash Wait post stack
if ( Stacks > TargetStacks AND CurrentZone >= g_BrivUserSettings[ "StackZone" ] AND g_ShandieDashWaitUserSettings["ShandieDashWaitPostStack"]) {
;MsgBox "Post Stack Dash Wait"
return true
}
return false
}
}
class IC_ShandieDashWait_GemFarm_Class extends IC_BrivGemFarm_Class
{
}
; tried with and without the extends
class IC_ShandieDashWait_SharedData_Class ;extends IC_SharedData_Class
{
ReloadShandieDashWaitSettings() {
MsgBox, , , Shandie settings saved, 1
g_ShandieDashWaitUserSettings := g_SF.LoadObjectFromJSON( A_LineFile . "\..\DashWaitSettings.json" )
If !IsObject( g_ShandieDashWaitUserSettings )
{
g_ShandieDashWaitUserSettings := {}
g_ShandieDashWaitUserSettings["WriteSettings"] := true
}
if ( g_ShandieDashWaitUserSettings["ShandieDashWaitAtStart"] == "" )
g_ShandieDashWaitUserSettings["ShandieDashWaitAtStart"] := 1
if ( g_ShandieDashWaitUserSettings["ShandieDashWaitPostStack"] == "" )
g_ShandieDashWaitUserSettings["ShandieDashWaitPostStack"] := 1
if(g_ShandieDashWaitUserSettings["WriteSettings"] == true)
{
g_ShandieDashWaitUserSettings.Delete("WriteSettings")
g_SF.WriteObjectToJSON( A_LineFile . "\..\DashWaitSettings.json" , g_ShandieDashWaitUserSettings )
}
}
}