-
Notifications
You must be signed in to change notification settings - Fork 6
/
GAA_MenuMain.psc
128 lines (108 loc) · 2.91 KB
/
GAA_MenuMain.psc
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
Scriptname GAA_MenuMain extends SKI_ConfigBase
INT FUNCTION GetVersion()
return 1
ENDFUNCTION
EVENT OnVersionUpdate(int a_version)
;Debug.Notification("Updating Signature Arms MCM menu")
refreshPages()
ENDEVENT
EVENT OnConfigInit()
refreshPages()
ENDEVENT
FUNCTION refreshPages()
Pages = new string[2]
Pages[0] = "Settings"
Pages[1] = "Perks"
ENDFUNCTION
EVENT OnPageReset(string page)
refreshPages()
IF page == "Perks"
ELSE
SetCursorFillMode(TOP_TO_BOTTOM)
AddHeaderOption("Hotkeys")
AddKeyMapOptionST("ARMOR_OID","Armor Ability Key",varArmorKey)
SetCursorPosition(1)
AddTextOption("Coming Soon!","")
ENDIF
ENDEVENT
STATE ARMOR_OID
EVENT OnKeyMapChangeST(int a_keyCode, string a_conflictControl, string a_conflictName)
varArmorKey = a_keyCode
registerKeys()
SetKeyMapOptionValueST(a_keyCode)
ENDEVENT
EVENT OnDefaultST()
varArmorKey = -1
SetKeyMapOptionValueST(-1)
ENDEVENT
ENDSTATE
INT PROPERTY varArmorKey AUTO
SPELL[] PROPERTY AbilitySpells AUTO
FLOAT[] PROPERTY AbilityCosts AUTO
FLOAT[] PROPERTY AbilityCooldowns AUTO
FLOAT[] PROPERTY AbilityTime AUTO
FORM[] PROPERTY AbilitySounds AUTO
GSA_MenuMain PROPERTY UILib AUTO
IMPORT input
EVENT OnKeyDown(Int KeyCode)
IF ( Game.IsLookingControlsEnabled() && !Utility.IsInMenuMode() && !((UILib as FORM) as UILIB_GRIMY).IsMenuOpen())
INT akIndex = ((UILib as FORM) as UILIB_GRIMY).ShowList("Armor Abilities", AbilityList(), 0, 0) - 1
IF akIndex >= 0
IF ( Utility.GetCurrentRealTime() - AbilityTime[akIndex] ) < AbilityCooldowns[akIndex]
Debug.Notification("That ability is still on cooldown")
RETURN
ENDIF
IF AbilitySpells[akIndex] && ( PlayerRef.GetAV("Stamina") > AbilityCosts[akIndex] )
AbilityTime[akIndex] = Utility.GetCurrentRealTime()
PlayerRef.DamageAV("Stamina",AbilityCosts[akIndex])
AbilitySpells[akIndex].Cast(PlayerRef)
IF AbilitySounds[akIndex]
(AbilitySounds[akIndex] AS SOUND).Play(PlayerRef)
ENDIF
ENDIF
ENDIF
ENDIF
ENDEVENT
STRING[] FUNCTION AbilityList()
STRING[] retVal = new String[6]
INT i = 0
int j = 0
WHILE i < 5
STRING tempName = AbilityName(i)
IF tempName != "~"
retVal[i] = tempName
j += 1
ENDIF
i += 1
ENDWHILE
retVal[j] = "Cancel"
RETURN retVal
ENDFUNCTION
STRING FUNCTION AbilityName(INT akIndex)
IF AbilitySpells[akIndex]
RETURN AbilitySpells[akIndex].GetName()
ELSE
RETURN "~"
ENDIF
ENDFUNCTION
FUNCTION registerKeys()
UnregisterForAllKeys()
RegisterForKey(varArmorKey)
ENDFUNCTION
ACTOR PROPERTY PlayerRef AUTO
INT FUNCTION GetHeavyArmorCount(ACTOR akActor)
INT result = 0
result += isHeavy(akActor.GetWornForm(0x00000002))
result += isHeavy(akActor.GetWornForm(0x00000004))
result += isHeavy(akActor.GetWornForm(0x00000008))
result += isHeavy(akActor.GetWornForm(0x00000080))
RETURN result
ENDFUNCTION
INT FUNCTION isHeavy(FORM akForm)
IF akForm AS ARMOR
IF (akForm AS ARMOR).GetWeightClass() == 1
RETURN 1
ENDIF
ENDIF
RETURN 0
ENDFUNCTION