-
Notifications
You must be signed in to change notification settings - Fork 46
/
jputils.lua
executable file
·516 lines (488 loc) · 17.7 KB
/
jputils.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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
--[[
JPS - WoW Protected Lua DPS AddOn
Copyright (C) 2011 Jp Ganis
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]--
--------------------------
-- LOCALIZATION
--------------------------
local L = MyLocalizationTable
---------------------------
-- FUNCTION HARMSPELL For Checking Inrange Enemy
---------------------------
-- isHarmful = IsHarmfulSpell(index, "bookType") or IsHarmfulSpell("name")
-- name, texture, offset, numEntries, isGuild, offspecID = GetSpellTabInfo(tabIndex)
-- tabIndex Number - The index of the tab, ascending from 1.
-- numTabs = GetNumSpellTabs() -- numTabs Number - number of ability tabs in the player's spellbook (e.g. 4 -- "General", "Arcane", "Fire", "Frost")
-- Name, Subtext = GetSpellBookItemName(index, "bookType") or GetSpellBookItemName("spellName")
-- Name - Name of the spell. (string)
-- skillType, spellId = GetSpellBookItemInfo(index, "bookType") or GetSpellBookItemInfo("spellName") -- spellId - The global spell id (number)
local harmSpells = {}
function jps.GetHarmfulSpell()
local HarmSpell = nil
local HarmSpell40 = {}
local HarmSpell30 = {}
local HarmSpell20 = {}
local _, _, offset, numSpells, _ = GetSpellTabInfo(2)
local booktype = "spell"
for index = offset+1, numSpells+offset do
-- Get the Global Spell ID from the Player's spellbook
-- local spellname,rank,icon,cost,isFunnel,powerType,castTime,minRange,maxRange = GetSpellInfo(spellID)
local name = select(1,GetSpellBookItemName(index, booktype))
local spellID = select(2,GetSpellBookItemInfo(index, booktype))
local maxRange = select(6,GetSpellInfo(spellID))
local minRange = select(5,GetSpellInfo(spellID))
local harmful = IsHarmfulSpell(index, booktype)
if minRange ~= nil and maxRange ~= nil and harmful ~= nil then
if (maxRange > 39) and (harmful == true) and (minRange == 0) then
table.insert(HarmSpell40,name)
elseif (maxRange > 29) and (harmful == true) and (minRange == 0) then
table.insert(HarmSpell30,name)
elseif (maxRange > 19) and (harmful == true) and (minRange == 0) then
table.insert(HarmSpell20,name)
end
end
end
if HarmSpell40[1] then
HarmSpell = HarmSpell40[1]
elseif HarmSpell30[1] then
HarmSpell = HarmSpell30[1]
else
HarmSpell = HarmSpell20[1]
end
if HarmSpell ~= nil then
harmSpells[HarmSpell] = true
end
return HarmSpell
end
function jps.getUsableHarmSpells(searchNew)
local HarmSpell = nil
local _, _, offset, numSpells, _ = GetSpellTabInfo(2)
local booktype = "spell"
for index = offset+1, numSpells+offset do
-- Get the Global Spell ID from the Player's spellbook
-- local spellname,rank,icon,cost,isFunnel,powerType,castTime,minRange,maxRange = GetSpellInfo(spellID)
local name = select(1,GetSpellBookItemName(index, booktype))
local spellID = select(2,GetSpellBookItemInfo(index, booktype))
local harmful = IsHarmfulSpell(index, booktype)
if harmSpells[name] == nil and searchNew == true then
isUsable, noMana = IsUsableSpell(name)
if harmful == true and (isUsable == true or (isUsable == false and noMana == true )) then
HarmSpell = name
end
end
end
if HarmSpell ~= nil then
harmSpells[HarmSpell] = true
end
return HarmSpell
end
function jps.getHarmSpellTable(spellCount)
if not spellcount then spellCount = 3 end
tableBody = 'spelltableSpec = {};'
local p = 1;
for i=1, spellCount+1 do
spell = jps.getUsableHarmSpells(true)
if spell ~= nil then
tableBody = tableBody..'spelltableSpec['..p..'] = {"'..spell..'",not jps.myDebuff("'..spell..'") and jps.canCast("'..spell..'","target") and jps.IsSpellInRange("'..spell..'","target"),"target"};'
p = p +1
end
end
tableBody = tableBody..'return parseSpellTable(spelltableSpec)';
jps.customRotationFunc = tableBody
assert(loadstring('function jps.customRotation() '.. jps.customRotationFunc..' end'))()
end
---------------------------
-- GET CLASS COOLDOWNS
---------------------------
--[[[
@function jps.getDPSRacial
@description
get players dps racial (berserking, blood fury)
[br][i]Usage:[/i][br]
[code]
jps.getDPSRacial()
[/code]
@returns string: players DPS racials or nil
]]--
function jps.getDPSRacial()
-- Trolls n' Orcs
if jps.DPSRacial ~= nil then return jps.DPSRacial end -- no more checks needed
if jps.Race == nil then jps.Race = UnitRace("player") end
if jps.Race == "Troll" then
return "Berserking"
elseif jps.Race == "Orc" then
return "Blood Fury"
end
return nil
end
function jps.getDeffRacial()
-- Trolls n' Orcs
if jps.DPSRacial ~= nil then return jps.DPSRacial end -- no more checks needed
if jps.Race == nil then jps.Race = UnitRace("player") end
if jps.Race == "Dwarf" then
return "Stoneform"
end
return nil
end
function jps.setClassCooldowns()
local options = {}
jps.DPSRacial = nil
jps.DPSRacial = jps.getDPSRacial()
if jps.DPSRacial then table.insert(options,"DPS Racial") end
-- Add spells
for i,spell in pairs(options) do
if jpsDB[jpsRealm][jpsName][spell] == nil then
jpsDB[jpsRealm][jpsName][spell] = true
jps[spell] = true
end
end
end
---------------------------
-- TABLES
---------------------------
--JPTODO: jputils debuffs below line 129 are outdated!
jps_DebuffToDispel_Name =
{
L["Death Coil"] ,
L["Dragon's Breath"] ,
L["Polymorph"] ,
L["Frost Nova"] ,
L["Fear"] ,
L["Psychic Scream"] ,
L["Freeze"] ,
L["Deep Freeze"] ,
L["Howl of Terror"] ,
L["Counterspell"] ,
L["Entangling Roots"] ,
L["Hammer of Justice"] ,
L["Cyclone"] ,
L["Chilled"] ,
L["Earthbind"] ,
L["Ring of Frost"] ,
L["Living Bomb"] ,
L["Combustion"] ,
L["Repentance"] ,
L["Freezing Trap"] ,
}
jps_BuffToDispel_Name =
{
L["Archangel"] ,
-- L["Frost Armor"] , --Dispel type n/a
L["Power Word: Shield"] ,
L["Fear Ward"] ,
L["Hand of Protection"] ,
L["Incanter's Ward"] ,
-- L["Avenging Wrath"] , -- Dispel type n/a
L["Predatory Swiftness"] ,
L["Ice Barrier"] , -- Dispel type Magic
}
jps_Dispels = {
["Deathwing"] = {
"Plasma incendiaire", -- Boss Debuff
"Searing Plasma",
},
["Yor'sahj"] = {
"Corruption profonde", -- Boss Debuff
"Deep Corruption",
},
["Magic"] = {
"Static Disruption", -- Akil'zon
"Consuming Darkness", -- Argaloth
"Emberstrike", -- Erunak Stonespeaker
"Binding Shadows", -- Erudax
"Divine Reckoning", -- Temple Guardian Anhuur
"Static Cling", -- Asaad
"Pain and Suffering", -- Baron Ashbury
"Cursed Veil", -- Baron Silverlaine
},
["Poison"] = {
"Viscous Poison", -- Lockmaw
},
["Disease"] = {
"Plague of Ages", -- High Prophet Barim
},
["Curse"] = {
"Curse of Blood", -- High Priestess Azil
"Cursed Bullets", -- Lord Godfrey
},
}
---------------------------
-- LOSE CONTROL TABLES -- Credits - to LoseControl Addon
---------------------------
jps_SpellControl = {
-- Death Knight
[108194] = "CC", -- Asphyxiate
[115001] = "CC", -- Remorseless Winter
[47476] = "Silence", -- Strangulate
[96294] = "Root", -- Chains of Ice (Chilblains)
[45524] = "Snare", -- Chains of Ice
[50435] = "Snare", -- Chilblains
--[43265] = "Snare", -- Death and Decay (Glyph of Death and Decay) - no way to distinguish between glyphed spell and normal. :(
[115000] = "Snare", -- Remorseless Winter
[115018] = "Immune", -- Desecrated Ground
[48707] = "ImmuneSpell", -- Anti-Magic Shell
[48792] = "Other", -- Icebound Fortitude
[49039] = "Other", -- Lichborne
--[51271] = "Other", -- Pillar of Frost
-- Death Knight Ghoul
[91800] = "CC", -- Gnaw
[91797] = "CC", -- Monstrous Blow (Dark Transformation)
[91807] = "Root", -- Shambling Rush (Dark Transformation)
-- Druid
[113801] = "CC", -- Bash (Force of Nature - Feral Treants)
[102795] = "CC", -- Bear Hug
[33786] = "CC", -- Cyclone
[99] = "CC", -- Disorienting Roar
[2637] = "CC", -- Hibernate
[22570] = "CC", -- Maim
[5211] = "CC", -- Mighty Bash
[9005] = "CC", -- Pounce
[102546] = "CC", -- Pounce (Incarnation)
[114238] = "Silence", -- Fae Silence (Glyph of Fae Silence)
[81261] = "Silence", -- Solar Beam
[339] = "Root", -- Entangling Roots
[113770] = "Root", -- Entangling Roots (Force of Nature - Balance Treants)
[19975] = "Root", -- Entangling Roots (Nature's Grasp)
[45334] = "Root", -- Immobilized (Wild Charge - Bear)
[102359] = "Root", -- Mass Entanglement
[50259] = "Snare", -- Dazed (Wild Charge - Cat)
[58180] = "Snare", -- Infected Wounds
[61391] = "Snare", -- Typhoon
[127797] = "Snare", -- Ursol's Vortex
--[???] = "Snare", -- Wild Mushroom: Detonate
-- Druid Symbiosis
[110698] = "CC", -- Hammer of Justice (Paladin)
[113004] = "CC", -- Intimidating Roar [Fleeing in fear] (Warrior)
[113056] = "CC", -- Intimidating Roar [Cowering in fear] (Warrior)
[110693] = "Root", -- Frost Nova (Mage)
--[110610] = "Snare", -- Ice Trap (Hunter)
[110617] = "Immune", -- Deterrence (Hunter)
[110715] = "Immune", -- Dispersion (Priest)
[110700] = "Immune", -- Divine Shield (Paladin)
[110696] = "Immune", -- Ice Block (Mage)
[110570] = "ImmuneSpell", -- Anti-Magic Shell (Death Knight)
[110788] = "ImmuneSpell", -- Cloak of Shadows (Rogue)
[113002] = "ImmuneSpell", -- Spell Reflection (Warrior)
[110791] = "Other", -- Evasion (Rogue)
[110575] = "Other", -- Icebound Fortitude (Death Knight)
[122291] = "Other", -- Unending Resolve (Warlock)
-- Hunter
[117526] = "CC", -- Binding Shot
[3355] = "CC", -- Freezing Trap
[1513] = "CC", -- Scare Beast
[19503] = "CC", -- Scatter Shot
[19386] = "CC", -- Wyvern Sting
[34490] = "Silence", -- Silencing Shot
[19185] = "Root", -- Entrapment
[128405] = "Root", -- Narrow Escape
[35101] = "Snare", -- Concussive Barrage
[5116] = "Snare", -- Concussive Shot
[61394] = "Snare", -- Frozen Wake (Glyph of Freezing Trap)
[13810] = "Snare", -- Ice Trap
[19263] = "Immune", -- Deterrence
-- Hunter Pets
[90337] = "CC", -- Bad Manner (Monkey)
[24394] = "CC", -- Intimidation
[126246] = "CC", -- Lullaby (Crane)
[126355] = "CC", -- Paralyzing Quill (Porcupine)
[126423] = "CC", -- Petrifying Gaze (Basilisk)
[50519] = "CC", -- Sonic Blast (Bat)
[56626] = "CC", -- Sting (Wasp)
[96201] = "CC", -- Web Wrap (Shale Spider)
[50541] = "Disarm", -- Clench (Scorpid)
[91644] = "Disarm", -- Snatch (Bird of Prey)
[90327] = "Root", -- Lock Jaw (Dog)
[50245] = "Root", -- Pin (Crab)
[54706] = "Root", -- Venom Web Spray (Silithid)
[4167] = "Root", -- Web (Spider)
[50433] = "Snare", -- Ankle Crack (Crocolisk)
[54644] = "Snare", -- Frost Breath (Chimaera)
[54216] = "Other", -- Master's Call (root and snare immune only)
-- Mage
[118271] = "CC", -- Combustion Impact
[44572] = "CC", -- Deep Freeze
[31661] = "CC", -- Dragon's Breath
[118] = "CC", -- Polymorph
[61305] = "CC", -- Polymorph: Black Cat
[28272] = "CC", -- Polymorph: Pig
[61721] = "CC", -- Polymorph: Rabbit
[61780] = "CC", -- Polymorph: Turkey
[28271] = "CC", -- Polymorph: Turtle
[82691] = "CC", -- Ring of Frost
[102051] = "Silence", -- Frostjaw (also a root)
[55021] = "Silence", -- Silenced - Improved Counterspell
[122] = "Root", -- Frost Nova
[111340] = "Root", -- Ice Ward
[121288] = "Snare", -- Chilled (Frost Armor)
[120] = "Snare", -- Cone of Cold
[116] = "Snare", -- Frostbolt
[44614] = "Snare", -- Frostfire Bolt
[113092] = "Snare", -- Frost Bomb
[31589] = "Snare", -- Slow
[45438] = "Immune", -- Ice Block
[115760] = "ImmuneSpell", -- Glyph of Ice Block
-- Mage Water Elemental
[33395] = "Root", -- Freeze
-- Monk
[123393] = "CC", -- Breath of Fire (Glyph of Breath of Fire)
[126451] = "CC", -- Clash
[122242] = "CC", -- Clash (not sure which one is right)
[119392] = "CC", -- Charging Ox Wave
[120086] = "CC", -- Fists of Fury
[119381] = "CC", -- Leg Sweep
[115078] = "CC", -- Paralysis
[117368] = "Disarm", -- Grapple Weapon
[140023] = "Disarm", -- Ring of Peace
[137461] = "Disarm", -- Disarmed (Ring of Peace)
[137460] = "Silence", -- Silenced (Ring of Peace)
[116709] = "Silence", -- Spear Hand Strike
[116706] = "Root", -- Disable
[113275] = "Root", -- Entangling Roots (Symbiosis)
[123407] = "Root", -- Spinning Fire Blossom
[116095] = "Snare", -- Disable
[118585] = "Snare", -- Leer of the Ox
[123727] = "Snare", -- Dizzying Haze
[123586] = "Snare", -- Flying Serpent Kick
[131523] = "ImmuneSpell", -- Zen Meditation
-- Paladin
[105421] = "CC", -- Blinding Light
[115752] = "CC", -- Blinding Light (Glyph of Blinding Light)
[105593] = "CC", -- Fist of Justice
[853] = "CC", -- Hammer of Justice
[119072] = "CC", -- Holy Wrath
[20066] = "CC", -- Repentance
[10326] = "CC", -- Turn Evil
[31935] = "Silence", -- Avenger's Shield
[110300] = "Snare", -- Burden of Guilt
[63529] = "Snare", -- Dazed - Avenger's Shield
[20170] = "Snare", -- Seal of Justice
[642] = "Immune", -- Divine Shield
[31821] = "Other", -- Aura Mastery
[1022] = "Other", -- Hand of Protection
-- Priest
[113506] = "CC", -- Cyclone (Symbiosis)
[605] = "CC", -- Dominate Mind
[88625] = "CC", -- Holy Word: Chastise
[64044] = "CC", -- Psychic Horror
[8122] = "CC", -- Psychic Scream
[113792] = "CC", -- Psychic Terror (Psyfiend)
[9484] = "CC", -- Shackle Undead
[87204] = "CC", -- Sin and Punishment
[15487] = "Silence", -- Silence
[64058] = "Disarm", -- Psychic Horror
[113275] = "Root", -- Entangling Roots (Symbiosis)
[87194] = "Root", -- Glyph of Mind Blast
[114404] = "Root", -- Void Tendril's Grasp
[15407] = "Snare", -- Mind Flay
[47585] = "Immune", -- Dispersion
[114239] = "ImmuneSpell", -- Phantasm
-- Rogue
[2094] = "CC", -- Blind
[1833] = "CC", -- Cheap Shot
[1776] = "CC", -- Gouge
[408] = "CC", -- Kidney Shot
[113953] = "CC", -- Paralysis (Paralytic Poison)
[6770] = "CC", -- Sap
[1330] = "Silence", -- Garrote - Silence
[51722] = "Disarm", -- Dismantle
[115197] = "Root", -- Partial Paralysis
[3409] = "Snare", -- Crippling Poison
[26679] = "Snare", -- Deadly Throw
[119696] = "Snare", -- Debilitation
[31224] = "ImmuneSpell", -- Cloak of Shadows
[45182] = "Other", -- Cheating Death
[5277] = "Other", -- Evasion
--[76577] = "Other", -- Smoke Bomb
[88611] = "Other", -- Smoke Bomb
-- Shaman
[76780] = "CC", -- Bind Elemental
[77505] = "CC", -- Earthquake
[51514] = "CC", -- Hex
[118905] = "CC", -- Static Charge (Capacitor Totem)
[113287] = "Silence", -- Solar Beam (Symbiosis)
[64695] = "Root", -- Earthgrab (Earthgrab Totem)
[63685] = "Root", -- Freeze (Frozen Power)
[3600] = "Snare", -- Earthbind (Earthbind Totem)
[77478] = "Snare", -- Earthquake (Glyph of Unstable Earth)
[8034] = "Snare", -- Frostbrand Attack
[8056] = "Snare", -- Frost Shock
[51490] = "Snare", -- Thunderstorm
[8178] = "ImmuneSpell", -- Grounding Totem Effect (Grounding Totem)
-- Shaman Primal Earth Elemental
[118345] = "CC", -- Pulverize
-- Warlock
[710] = "CC", -- Banish
[137143] = "CC", -- Blood Horror
[54786] = "CC", -- Demonic Leap (Metamorphosis)
[5782] = "CC", -- Fear
[118699] = "CC", -- Fear
[130616] = "CC", -- Fear (Glyph of Fear)
[5484] = "CC", -- Howl of Terror
[22703] = "CC", -- Infernal Awakening
[6789] = "CC", -- Mortal Coil
[132412] = "CC", -- Seduction (Grimoire of Sacrifice)
[30283] = "CC", -- Shadowfury
[104045] = "CC", -- Sleep (Metamorphosis)
[132409] = "Silence", -- Spell Lock (Grimoire of Sacrifice)
[31117] = "Silence", -- Unstable Affliction
[18223] = "Snare", -- Curse of Exhaustion
[47960] = "Snare", -- Shadowflame
[110913] = "Other", -- Dark Bargain
[104773] = "Other", -- Unending Resolve
-- Warlock Pets
[89766] = "CC", -- Axe Toss (Felguard/Wrathguard)
[115268] = "CC", -- Mesmerize (Shivarra)
[6358] = "CC", -- Seduction (Succubus)
[115782] = "Silence", -- Optical Blast (Observer)
[24259] = "Silence", -- Spell Lock (Felhunter)
[118093] = "Disarm", -- Disarm (Voidwalker/Voidlord)
-- Warrior
[7922] = "CC", -- Charge Stun
[118895] = "CC", -- Dragon Roar
[5246] = "CC", -- Intimidating Shout (aoe)
[20511] = "CC", -- Intimidating Shout (targeted)
[132168] = "CC", -- Shockwave
[107570] = "CC", -- Storm Bolt
[132169] = "CC", -- Storm Bolt
[105771] = "CC", -- Warbringer
[18498] = "Silence", -- Silenced - Gag Order (PvE only)
[676] = "Disarm", -- Disarm
[107566] = "Root", -- Staggering Shout
[1715] = "Snare", -- Hamstring
[12323] = "Snare", -- Piercing Howl
[129923] = "Snare", -- Sluggish (Glyph of Hindering Strikes)
[137637] = "Snare", -- Warbringer
[46924] = "Immune", -- Bladestorm
[23920] = "ImmuneSpell", -- Spell Reflection
[114028] = "ImmuneSpell", -- Mass Spell Reflection
[18499] = "Other", -- Berserker Rage
-- Other
[30217] = "CC", -- Adamantite Grenade
[67769] = "CC", -- Cobalt Frag Bomb
[30216] = "CC", -- Fel Iron Bomb
[107079] = "CC", -- Quaking Palm
[13327] = "CC", -- Reckless Charge
[20549] = "CC", -- War Stomp
[25046] = "Silence", -- Arcane Torrent (Energy)
[28730] = "Silence", -- Arcane Torrent (Mana)
[50613] = "Silence", -- Arcane Torrent (Runic Power)
[69179] = "Silence", -- Arcane Torrent (Rage)
[80483] = "Silence", -- Arcane Torrent (Focus)
[129597] = "Silence", -- Arcane Torrent (Chi)
[39965] = "Root", -- Frost Grenade
[55536] = "Root", -- Frostweave Net
[13099] = "Root", -- Net-o-Matic
[1604] = "Snare", -- Dazed
-- PvE
--[123456] = "PvE", -- This is just an example, not a real spell
}