-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGEO_Lib.lua
309 lines (268 loc) · 11.2 KB
/
GEO_Lib.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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
version = "3.0"
pName = player.name
-- Saying hello
windower.add_to_chat(8,'----- Welcome back to your GEO.lua, '..pName..' -----')
runspeedslot = 'feet'
--------------------------------------------------------------------------------------------------------------
-- HUD STUFF
--------------------------------------------------------------------------------------------------------------
meleeing = M('AUTO', 'OFF', 'ON')
lock = M('OFF', 'ON')
mBurst = M(false)
runspeed = M('OFF', 'ON')
oldElement = elements.current
mBurstOldValue = mBurst.value
matchsc = M('AUTO', 'OFF', 'ON')
MB_Window = 0
time_start = 0
luopanMode = 'me' -- me or pan (me = no luopan, pan = luopan is out)
setupTextWindow()
function precast(spell)
if meleeing.value == "AUTO" then
if player.tp >= lockWeaponTP then
lock:set('ON')
else
lock:set('OFF')
end
lockMainHand(lock.value, pet)
end
-- Auto use Echo Drops if you are trying to cast while silenced --
if spell.action_type == 'Magic' and buffactive['Silence'] then
cancel_spell()
send_command('input /item "Echo Drops" <me>')
add_to_chat(123, '****** ['..spell.name..' CANCELED - Using Echo Drops] ******')
end
if spell.type == 'WhiteMagic' or spell.type == 'BlackMagic' or spell.type == 'Geomancy' then
-- Stoneskin Precast
if spell.name == 'Stoneskin' then
windower.ffxi.cancel_buff(37)--[[Cancels stoneskin, not delayed incase you get a Quick Cast]]
equip(sets.precast.stoneskin)
-- Cure Precast
elseif spell.name:match('Cure') or spell.name:match('Cura') then
equip(sets.precast.cure)
-- Enhancing Magic
elseif spell.skill == 'Magic' then
equip(sets.precast.enhancing)
if spell.name == 'Sneak' then
windower.ffxi.cancel_buff(71)--[[Cancels Sneak]]
end
elseif spell.type == 'Geomancy' then
equip(sets.precast.geomancy)
else
-- For everything else we go with max fastcast
equip(sets.precast.casting)
end
end
-- Job Abilities
-- We use a catch all here, if the set exists for an ability, use it
-- This way we don't need to write a load of different code for different abilities, just make a set
if sets.precast[spell.name] then
equip(sets.precast[spell.name])
end
end
function midcast(spell)
-- Get the spell mapping, since we'll be passing it to various functions and checks.
local spellMap = get_spell_map(spell)
-- No need to annotate all this, it's fairly logical. Just equips the relevant sets for the relevant magic
if spell.name:match('Cure') or spell.name:match('Cura') then
if spell.element == world.weather_element or spell.element == world.day_element then
equip(sets.midcast.cure.weather)
else
equip(sets.midcast.cure.normal)
end
elseif spell.skill == 'Enhancing Magic' then
equip(sets.midcast.enhancing)
if spell.name:match('Protect') or spell.name:match('Shell') then
equip({rring="Sheltered Ring"})
elseif spell.name:match('Refresh') then
equip(sets.midcast.refresh)
elseif spell.name:match('Regen') then
equip(sets.midcast.regen)
elseif spell.name:match('Aquaveil') then
equip(sets.midcast.aquaveil)
end
elseif spell.skill == 'Enfeebling Magic' and spell.type == 'BlackMagic' then -- to do: better rule for this.
equip(sets.midcast.IntEnfeebling)
elseif spell.skill == 'Enfeebling Magic' and spell.type == 'WhiteMagic' then -- to do: better rule for this.
equip(sets.midcast.MndEnfeebling)
elseif spell.type == 'BlackMagic' then
if mBurst.value == true then
equip(sets.midcast.MB[nukeModes.current])
else
equip(sets.midcast.nuking[nukeModes.current])
end
-- casting is basically enfeeble set.
elseif spell.name:match('Geo') then
equip(sets.midcast.geo)
elseif spell.name:match('Indi') then
-- check for entrust
if buffactive['Entrust'] then
equip(sets.midcast.entrust)
else
equip(sets.midcast.indi)
end
else
equip(sets.midcast.casting)
end
-- And our catch all, if a set exists for this spell name, use it
if sets.midcast[spell.name] then
equip(sets.midcast[spell.name])
-- Catch all for tiered spells (use mapping), basically if no set for spell name, check set for spell mapping. AKA Drain works for all Drain tiers.
elseif sets.midcast[spellMap] then
equip(sets.midcast[spellMap])
-- Remember those WS Sets we defined? :) sets.me["Insert Weaponskill"] are basically how I define any non-magic spells sets, aka, WS, JA, Idles, etc.
elseif sets.me[spell.name] then
equip(sets.me[spell.name])
end
-- Obi up for matching weather / day
if spell.element == world.weather_element and spellMap ~= 'Helix'then
equip(sets.midcast.Obi)
end
if spell.element == world.day_element and spellMap ~= 'Helix'then
equip(sets.midcast.Obi)
end
-- This needs to be here for if you cast stoneskin on earthsday if doesnt swap to obi --___--;
if spell.name:match('Stoneskin') then
equip(sets.midcast.stoneskin)
end
end
function aftercast(spell)
-- Then initiate idle function to check which set should be equipped
idle(pet)
end
function pet_change(pet, gain)
-- When we cast a luopan
idle(pet)
end
function idle(pet)
-- This function is called after every action, and handles which set to equip depending on what we're doing
-- We check if we're meleeing because we don't want to idle in melee gear when we're only engaged for trusts
if pet.isvalid then
luopanMode = 'pan'
else
luopanMode = 'me'
end
if ( meleeing.value == 'ON' or meleeing.value == 'AUTO' ) and player.status=='Engaged' then
-- We're both 'engaged' and 'meleeing' is not off
equip(sets[luopanMode].melee)
else
-- We're not meleeing
equip(sets[luopanMode].idle[idleModes.value])
end
validateTextInformation()
end
function status_change(new,old)
if new == 'Engaged' then
-- If we engage check our meleeing status
idle(pet)
elseif new=='Resting' then
-- We're resting
equip(sets.me.resting)
else
idle(pet)
end
end
function self_command(command)
hud_command(command)
local commandArgs = command
if #commandArgs:split(' ') >= 2 then
commandArgs = T(commandArgs:split(' '))
if commandArgs[1] == 'toggle' then
if commandArgs[2] == 'melee' then
-- //gs c toggle melee will toggle melee mode on and off.
-- This basically locks the slots that will cause you to lose TP if changing them,
-- As well as equip your melee set if you're engaged
meleeing:cycle()
lockMainHand(meleeing.value, pet)
elseif commandArgs[2] == 'mb' then
-- //gs c toggle mb will toggle mb mode on and off.
-- You need to toggle prioritisation yourself
mBurst:toggle()
updateMB(mBurst.value)
elseif commandArgs[2] == 'runspeed' then
runspeed:cycle()
updateRunspeedGear(runspeed.value, runspeedslot, pet)
elseif commandArgs[2] == 'idlemode' then
idleModes:cycle()
idle(pet)
elseif commandArgs[2] == 'regenmode' then
regenModes:cycle()
elseif commandArgs[2] == 'nukemode' then
nukeModes:cycle()
elseif commandArgs[2] == 'matchsc' then
matchsc:cycle()
end
validateTextInformation()
end
if commandArgs[1]:lower() == 'nuke' then
if not commandArgs[2] then
windower.add_to_chat(123,'No element type given.')
return
end
local nuke = commandArgs[2]:lower()
if (nuke == 'cycle' or nuke == 'cycledown') then
if nuke == 'cycle' then
elements:cycle()
oldElement = elements.current
elseif nuke == 'cycledown' then
elements:cycleback()
oldElement = elements.current
end
validateTextInformation()
elseif (nuke == 'air' or nuke == 'ice' or nuke == 'fire' or nuke == 'water' or nuke == 'lightning' or nuke == 'earth' or nuke == 'light' or nuke == 'dark') then
local newType = commandArgs[2]
elements:set(newType)
validateTextInformation()
elseif not nukes[nuke] then
windower.add_to_chat(123,'Unknown element type: '..tostring(commandArgs[2]))
return
else
-- Leave out target; let Shortcuts auto-determine it.
send_command('@input /ma "'..nukes[nuke][elements.current]..'"')
end
end
if commandArgs[1]:lower() == 'geo' then
if not commandArgs[2] then
windower.add_to_chat(123,'No element type given.')
return
end
local geo = commandArgs[2]:lower()
if (geo == 'geocycle' or geo == 'geocycledown') then
if geo == 'geocycle' then
geomancy:cycle()
elseif geo == 'geocycledown' then
geomancy:cycleback()
end
validateTextInformation()
elseif geo == 'indicycle' or geo == 'indicycledown' then
if geo == 'indicycle' then
indicolure:cycle()
elseif geo == 'indicycledown' then
indicolure:cycleback()
end
validateTextInformation()
elseif geo == 'entrustcycle' or geo == 'entrustcledown' then
if geo == 'entrustcycle' then
entrustindi:cycle()
elseif geo == 'entrustcledown' then
entrustindi:cycleback()
end
validateTextInformation()
else
if geo == 'geo' then
-- Leave out target; let Shortcuts auto-determine it.
send_command('@input /ma "'..geomancy.current..'"')
elseif geo == 'indi' then
-- If Entrust is used then it'll use from the entrust list instead.
if buffactive['Entrust'] then
-- Leave out target; let Shortcuts auto-determine it.
send_command('@input /ma "'..entrustindi.current..'"')
else
-- Leave out target; let Shortcuts auto-determine it.
send_command('@input /ma "'..indicolure.current..'"')
end
end
end
end
end
end