-
Notifications
You must be signed in to change notification settings - Fork 24
/
OutfitterScripting.lua
1978 lines (1700 loc) · 58.8 KB
/
OutfitterScripting.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
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
----------------------------------------
-- Modular scripting
----------------------------------------
--[[
Script modules:
* Druid: Shapeshift
* Death Knight: Presence
* Hunter: Aspect
* Mage: Invisble
* Mage: Evocate
* Paladin: Aura
* Priest: Shadowform
* Rogue/Druid: Stealth
* Shaman: Ghost wolf
* Warrior: Stance
* Warlock: Metamorphosis
* Tooltip has text/color
* Minimap tracking mode
* In combat
* PvP flagged
* Health below/above
* Mana below/above
* Has buff
* Has debuff
* Five-second rule
* Boss yell/emote
* Player whisper/say/yell
* In party/raid/battleground
* In zone/city
* Resting
* Mounted
* Falling
* Swimming
* Fishing
* Eating/drinking
A script module consists of the source code fragments for each block of the script. The header
fragment will be inserted above the current script and the footer below. This allows the script
to exit early, exit late, or enclose the current script in a block, which provides the flexibility
of controlling the operation of the script without knowing the contents of the current source.
Scripts can support equip/unequip or disable or both.
]]
----------------------------------------
Outfitter.ScriptModules = {}
----------------------------------------
function Outfitter:GenerateEquipModule(pModule, pSettings, pExistingScript)
local vScript = pExistingScript or ""
if pModule.GetEquipHeader then
vScript = pModule:GetEquipHeader(pSettings).."\n"..vScript
end
if pModule.EquipHeader then
vScript = pModule.EquipHeader.."\n"..vScript
end
if pModule.GetEquipFooter then
vScript = vScript.."\n"..pModule:GetEquipFooter(pSettings)
end
if pModule.EquipFooter then
vScript = vScript.."\n"..pModule.EquipFooter
end
return vScript
end
function Outfitter:GenerateDisableModule(pModule, pSettings, pExistingScript)
local vScript = pExistingScript or ""
if pModule.GetDisableHeader then
vScript = pModule:GetDisableHeader(pSettings)..vScript
end
if pModule.GetDisableFooter then
vScript = vScript..pModule:GetDisableFooter(pSettings)
end
return vScript
end
----------------------------------------
Outfitter.ScriptModules.DruidShapeshift = {}
----------------------------------------
Outfitter.ScriptModules.DruidShapeshift.ModuleName = "Druid: Shapeshift"
Outfitter.ScriptModules.DruidShapeshift.Classes = {"DRUID"}
Outfitter.ScriptModules.DruidShapeshift.Settings =
{
{id = "Caster", type = "boolean", label = "Caster form"},
{id = "Bear", type = "boolean", label = "Bear form"},
{id = "Cat", type = "boolean", label = "Cat form"},
{id = "Travel", type = "boolean", label = "Travel form"},
{id = "Moonkin", type = "boolean", label = "Moonkin form"},
{id = "Tree", type = "boolean", label = "Tree form"},
{id = "Flight", type = "boolean", label = "Swift Flight form"},
}
Outfitter.ScriptModules.DruidShapeshift.Events =
{
Caster = "CASTER_FORM",
Bear = "BEAR_FORM",
Cat = "CAT_FORM",
Travel = "TRAVEL_FORM",
Moonkin = "MOONKIN_FORM",
Tree = "TREE_FORM",
Flight = "SWIFT_FLIGHT_FORM"
}
function Outfitter.ScriptModules.DruidShapeshift:GetEquipHeader(pSettings)
local vResult = ""
for vSetting, vValue in pairs(pSettings) do
if vValue then
local vEvent = self.Events[vSetting]
vResult = vResult..
[[-- $EVENTS ]]..vEvent.." NOT_"..vEvent..[[
if event == "]]..vEvent..[[" then
equip= true
elseif event == "NOT_]]..vEvent..[[" then
equip = false
end
]]
end
end
return vResult
end
function Outfitter.ScriptModules.DruidShapeshift:GetDisableHeader(pSettings)
local vResult = ""
for vSetting, vValue in pairs(pSettings) do
if vValue then
vResult = vResult..
[[if self.SpecialState.]]..vSetting..[[ then return end
]]
end
end
return vResult
end
----------------------------------------
Outfitter.ScriptModules.RogueStealth = {}
----------------------------------------
Outfitter.ScriptModules.RogueStealth.ModuleName = Outfitter.cRogueStealth
Outfitter.ScriptModules.RogueStealth.Classes = {"ROGUE"}
Outfitter.ScriptModules.RogueStealth.EquipHeader =
[[
-- $EVENTS STEALTH NOT_STEALTH
-- Equip on stealth, unequip when leaving stealth
if event == "STEALTH" then
equip = true
elseif event == "NOT_STEALTH" then
equip = false
end
]]
Outfitter.ScriptModules.RogueStealth.DisableHeader =
[[
-- Disable while stealthed
if Outfitter.SpecialState.Stealth then
return
end
]]
----------------------------------------
Outfitter.ScriptModules.AutoLootOnEquip =
----------------------------------------
{
ModuleName = "Auto Loot",
EquipFooter =
[[
-- $EVENTS OUTFIT_EQUIPPED OUTFIT_UNEQUIPPED
-- $SETTING EnableAutoLoot={type="boolean", label="Enable auto loot while equipped"}
-- Enable auto-loot while equipped
if event == "OUTFIT_EQUIPPED" then
if setting.EnableAutoLoot then
setting.savedAutoLoot = GetCVar("autoLootDefault")
SetCVar("autoLootDefault", "1")
setting.didSetAutoLoot = true
end
-- Turn auto looting back off if the outfit is being unequipped and we turned it on
elseif event == "OUTFIT_UNEQUIPPED" then
if setting.EnableAutoLoot and setting.didSetAutoLoot then
SetCVar("autoLootDefault", setting.savedAutoLoot)
setting.didSetAutoLoot = nil
setting.savedAutoLoot = nil
end
end
]]
}
----------------------------------------
--
----------------------------------------
Outfitter.ScriptContexts = {}
Outfitter.OutfitScriptEvents = {}
function Outfitter:GenerateScriptHeader(pEventIDs, pDescription)
local vDescription
if pDescription then
vDescription = '-- $DESC '..pDescription..'\n'
else
vDescription = ''
end
if type(pEventIDs) == "table" then
pEventIDs = table.concat(pEventIDs, " ")
end
return '-- $EVENTS '..pEventIDs..'\n'..vDescription..'\n'
end
function Outfitter:GenerateSimpleScript(pEventID, pDescription)
return
self:GenerateScriptHeader(pEventID.." NOT_"..pEventID, pDescription)..
[[
-- If the activation event fires, equip the outfit
if event == "]]..pEventID..[[" then
equip = true
-- Otherwise it must be the deactivation event so unequip it
else
equip = false
end
]]
end
function Outfitter:GenerateSmartUnequipScript(pEventID, pDescription, pUnequipDelay, pIncludeSpecEnables)
local vScript
local vEventIDs
pIncludeSpecEnables = false
vEventIDs = pEventID.." NOT_"..pEventID
if pIncludeSpecEnables then
vEventIDs = vEventIDs.." ACTIVE_TALENT_GROUP_CHANGED"
end
vScript = self:GenerateScriptHeader(vEventIDs, pDescription)
if pIncludeSpecEnables then
vScript = vScript ..
[[
-- $SETTING Tree1={type="boolean", label=Outfitter:GetTalentTreeName(1), default=true}
-- $SETTING Tree2={type="boolean", label=Outfitter:GetTalentTreeName(2), default=true}
-- $SETTING Tree3={type="boolean", label=Outfitter:GetTalentTreeName(3), default=true}
-- $SETTING Tree4={type="boolean", label=Outfitter:GetTalentTreeName(4), default=true}
-- Unequip and return if they're not in an enabled spec
if not setting.Tree1 and GetSpecialization() == 1
or not setting.Tree2 and GetSpecialization() == 2
or not setting.Tree3 and GetSpecialization() == 3
or not setting.Tree4 and GetSpecialization() == 4 then
equip = false
return
end
]]
end
vScript = vScript ..
[[
-- If the activation event fires, equip the outfit
if event == "]]..pEventID..[[" then
equip = true
-- Otherwise it must be the deactivation event so unequip
-- the outfit.
-- Note that if you manually equipped the outfit the script
-- will not unequip it for you. This allows you to avoid excess
-- outfit changes, for example when entering and exiting
-- battlegrounds repeatedly. Remove the didEquip condition
-- to change the behavior to always unequip.
elseif didEquip then
equip = false
]]..((pUnequipDelay and (" delay = "..pUnequipDelay)) or "")..[[
end
]]
return vScript
end
function Outfitter:GenerateShapeshiftScript(pEventID, pDescription, pAllowCompleteUnequip)
return
self:GenerateScriptHeader({pEventID, 'NOT_'..pEventID, "OUTFIT_EQUIPPED"}, pDescription)..
[[
-- $SETTING DisableBG={type="boolean", label="Disable in Battlegrounds", default=false}
-- $SETTING DisablePVP={type="boolean", label="Disable while PvP flagged", default=false}
-- $SETTING UnequipComplete={type="boolean", label="Allow Complete outfits to unequip", default=false}
-- $SETTING Tree1={type="boolean", label=Outfitter:GetTalentTreeName(1), default=true}
-- $SETTING Tree2={type="boolean", label=Outfitter:GetTalentTreeName(2), default=true}
-- $SETTING Tree3={type="boolean", label=Outfitter:GetTalentTreeName(3), default=true}
-- $SETTING Tree4={type="boolean", label=Outfitter:GetTalentTreeName(4), default=true}
-- Just return if they're PvP'ing and don't want the outfit changing
if (setting.DisableBG and Outfitter:InBattlegroundZone())
or (setting.DisablePVP and UnitIsPVP("player")) then
return
end
-- Return if they're not in an enabled spec
if not setting.Tree1 and GetSpecialization() == 1
or not setting.Tree2 and GetSpecialization() == 2
or not setting.Tree3 and GetSpecialization() == 3
or not setting.Tree4 and GetSpecialization() == 4 then
return
end
-- Return if the user isn't in full control
if not Outfitter.IsDead and not HasFullControl() then
return
end
-- If the outfit is being equipped then let Outfitter know
-- which layer it's representing
if event == "OUTFIT_EQUIPPED" then
layer = "shapeshift"
-- Equip and set the layer if entering the stance
elseif event == "]]..pEventID..[[" then
if isEquipped then
return
end
equip = true
layer = "shapeshift"
-- Just unequip if leaving the stance
elseif setting.UnequipComplete
or outfit.CategoryID ~= "Complete" then
equip = false
end
]]
end
function Outfitter:GenerateDruidShapeshiftScript(pEventID, pDescription)
return
self:GenerateScriptHeader({pEventID, 'NOT_'..pEventID, 'OUTFIT_EQUIPPED'}, pDescription)..
[[
-- $SETTING DisableBG={type="boolean", label="Don't equip in Battlegrounds", default=false}
-- $SETTING DisablePVP={type="boolean", label="Don't equip while PvP flagged", default=false}
-- $SETTING UnequipComplete={type="boolean", label="Allow Complete outfits to unequip", default=false}
-- $SETTING Tree1={type="boolean", label=Outfitter:GetTalentTreeName(1), default=true}
-- $SETTING Tree2={type="boolean", label=Outfitter:GetTalentTreeName(2), default=true}
-- $SETTING Tree3={type="boolean", label=Outfitter:GetTalentTreeName(3), default=true}
-- $SETTING Tree4={type="boolean", label=Outfitter:GetTalentTreeName(4), default=true}
-- Just return if they're PvP'ing and don't want the outfit changing
if (setting.DisableBG and Outfitter:InBattlegroundZone())
or (setting.DisablePVP and UnitIsPVP("player")) then
return
end
-- Return if they're not in an enabled spec
if not setting.Tree1 and GetSpecialization() == 1
or not setting.Tree2 and GetSpecialization() == 2
or not setting.Tree3 and GetSpecialization() == 3
or not setting.Tree4 and GetSpecialization() == 4 then
return
end
-- Return if the user isn't in full control
if not Outfitter.IsDead and not HasFullControl() then
return
end
-- If the user is manually equipping the outfit, let
-- Outfitter know which layer it's representing
if event == "OUTFIT_EQUIPPED" then
layer = "shapeshift"
-- Equip and set the layer if entering the form
elseif event == "]]..pEventID..[[" then
if isEquipped then
return
end
equip = true
layer = "shapeshift"
-- Unequip if leaving the form. If they're in combat also
-- add a 2 second delay so they have time to start casting
-- a heal on themselves without triggering the global cooldown
elseif event == "NOT_]]..pEventID..[[" then
if setting.UnequipComplete
or outfit.CategoryID ~= "Complete" then
equip = false
if Outfitter.InCombat then
delay = 2
end
end
end
]]
end
function Outfitter:GenerateGatheringScript(pTooltipGatherMessage, pDescription)
return
[[
-- $EVENTS GAMETOOLTIP_SHOW GAMETOOLTIP_HIDE
-- $DESC ]]..(pDescription or "")..[[
-- $SETTING ignoreDifficulty = {label="Ignore difficulty", type="boolean"}
-- If the tooltip is being shown see if the outfit should be equipped
if event == "GAMETOOLTIP_SHOW" then
-- Check the tooltip for an orange or red tradeskill message
-- and equip the outfit if there is one
local hasText, isDifficult, isExact, lineNumber = Outfitter:TooltipContainsLine(GameTooltip, "]]..pTooltipGatherMessage..[[")
if hasText and isExact and lineNumber > 1 and (setting.ignoreDifficulty or isDifficult) then
equip = true
end
-- The tooltip isn't being shown so it's being hidden.
-- A one second delay is used so that the outfit doesn't
-- unequip if the user momentarily moves the cursor off
-- the node
elseif didEquip then
equip = false
delay = 1
end
]]
end
function Outfitter:GenerateLockpickingScript(pDescription)
return [[
-- $EVENTS GAMETOOLTIP_SHOW GAMETOOLTIP_HIDE
-- $DESC ]]..(pDescription or "")..[[
-- If the tooltip is being shown see if the outfit should be equipped
if event == "GAMETOOLTIP_SHOW" or event == "TIMER" then
if event == "GAMETOOLTIP_SHOW" then
self:RegisterEvent("TIMER")
end
if not SpellIsTargeting() then
return
end
-- Check the tooltip for an orange or red tradeskill message
-- and equip the outfit if there is one
local hasText, isDifficult = Outfitter:TooltipContainsLine(GameTooltip, Outfitter.cRequiresLockpicking)
if hasText and isDifficult then
equip=true
end
-- The tooltip isn't being shown so it's being hidden.
-- A one second delay is used so that the outfit doesn't
-- unequip if the user momentarily moves the cursor off
-- the node
else
self:UnregisterEvent("TIMER")
if didEquip then -- GAME_TOOLTIP_HIDE
equip=false; delay=1
end
end
]]
end
Outfitter.PresetScripts =
{
{
Name = Outfitter.cHerbalismOutfit,
ID = "HERBALISM",
Category = "TRADE",
Script = Outfitter:GenerateGatheringScript(Outfitter.LBI["Herbalism"], Outfitter.cHerbalismDescription),
},
{
Name = Outfitter.cMiningOutfit,
ID = "MINING",
Category = "TRADE",
Script = Outfitter:GenerateGatheringScript(Outfitter.LBI["Mining"], Outfitter.cMiningDescription),
},
{
Name = Outfitter.cSkinningOutfit,
ID = "SKINNING",
Category = "TRADE",
Script = Outfitter:GenerateGatheringScript(UNIT_SKINNABLE_LEATHER, Outfitter.cSkinningDescription),
},
{
Name = Outfitter.cLockpickingOutfit,
ID = "LOCKPICKING",
Category = "TRADE",
Class = "ROGUE",
Script = Outfitter:GenerateLockpickingScript(Outfitter.cLockpickingDescription),
},
{
Name = Outfitter.cPvPFlaggedOutfit,
ID = "PVP_FLAGGED",
Category = "PVP",
Script =
[[
-- $EVENTS PLAYER_FLAGS_CHANGED PLAYER_ENTERING_WORLD
-- $DESC ]]..Outfitter.cPvPFlaggedDescription..[[
local isPvP = UnitIsPVP("player")
if isPvP == outfit.wasPvP then
return
end
outfit.wasPvP = isPvP
if isPvP then
equip = true
else
equip = false
end
]],
},
{
Name = Outfitter.cInDungeonOutfit,
ID = "IN_DUNGEON",
Category = "GENERAL",
Script =
[[
-- $EVENTS PLAYER_ENTERING_WORLD
-- $DESC ]]..Outfitter.cInDungeonDescription..[[
-- $SETTING Enable5Man ={type="boolean", label="Equip in 5-man instances", default=true}
-- $SETTING EnableRaid={type="boolean", label="Equip in Raid instances", default=false}
-- $SETTING EnableBG={type="boolean", label="Equip in Battleground instances", default=false}
-- $SETTING EnableArena={type="boolean", label="Equip in Arena instances", default=false}
local inInstance, instanceType = IsInInstance()
if inInstance
and ((setting.Enable5Man and instanceType == "party")
or (setting.EnableRaid and instanceType == "raid")
or (setting.EnableBG and instanceType == "pvp")
or (setting.EnableBG and instanceType == "arena")) then
equip = true
else
equip = false
end
]],
},
{
Name = "Trinket Queue",
ID = "TRINKET_QUEUE",
Category = "GENERAL",
Script =
[[
-- $EVENTS TIMER
-- $DESC The highest trinket in the list that isn't on cooldown will automatically be equipped for you
-- $SETTING Buffcheck={label="Not if Buff", type="stringtable"}
-- $SETTING Trinkets={label="Upper slot", type="stringtable"}
-- $SETTING Trinkets2={label="Lower slot", type="stringtable"}
if outfit.StoredInEM then
Outfitter:ErrorMessage("Can't use the Trinket Queue script on the outfit %s because that outfit is stored in the Equipment Manager", tostring(outfit.Name))
Outfitter:SetScriptEnabled(outfit, false)
return
end
if not isEquipped then
return
end
if setting.Buffcheck and #setting.Buffcheck > 0 then
local i = 1
local buff = UnitBuff("player", i)
while buff do
for j=0,#setting.Buffcheck,1 do
if buff == setting.Buffcheck[j] then return end
end;
i = i + 1
buff = UnitBuff("player", i)
end
end
local itemInfo0, itemInfo1
if setting.Trinkets and #setting.Trinkets > 0 then
itemInfo0 = Outfitter:FindNextCooldownItem(setting.Trinkets, true)
end
if setting.Trinkets2 and #setting.Trinkets2 > 0 then
itemInfo1 = Outfitter:FindNextCooldownItem(setting.Trinkets2, true)
end
if itemInfo0
and (Outfitter:GetInventoryCache():ItemsAreSame(itemInfo0, outfit.Items.Trinket0Slot)
or Outfitter:InventoryItemIsActive("Trinket0Slot")) then
itemInfo0 = nil
end
if itemInfo1
and (Outfitter:GetInventoryCache():ItemsAreSame(itemInfo1, outfit.Items.Trinket1Slot)
or Outfitter:InventoryItemIsActive("Trinket1Slot")) then
itemInfo1 = nil
end
if itemInfo0 or itemInfo1 then
Outfitter:BeginEquipmentUpdate()
if itemInfo0 then
outfit:SetItem("Trinket0Slot", itemInfo0)
end
if itemInfo1 then
outfit:SetItem("Trinket1Slot", itemInfo1)
end
Outfitter.EquippedNeedsUpdate = true
Outfitter:EndEquipmentUpdate()
end
]],
},
{
Name = "Rocket Boots",
ID = "FEET_QUEUE",
Category = "GENERAL",
Script =
[[
-- $EVENTS TIMER
-- $DESC The boots in the list with the earliest availability will automatically be equipped
-- $SETTING Boots={label="Boots", type="stringtable"}
if not isEquipped then
return
end
local itemInfo = Outfitter:FindNextCooldownItem(setting.Boots)
if itemInfo
and not Outfitter:GetInventoryCache():ItemsAreSame(itemInfo, outfit.Items.FeetSlot) then
Outfitter:BeginEquipmentUpdate()
outfit:SetItem("FeetSlot", itemInfo)
Outfitter.EquippedNeedsUpdate = true
Outfitter:EndEquipmentUpdate()
end
]],
},
{
Name = Outfitter.cInZonesOutfit,
ID = "IN_ZONES",
Category = "GENERAL",
Script = Outfitter:GenerateScriptHeader("ZONE_CHANGED_INDOORS ZONE_CHANGED ZONE_CHANGED_NEW_AREA", Outfitter.cInZonesOutfitDescription)..
[[
-- $SETTING zoneList={type="zonelist", label="Zones"}
-- $SETTING minimapZoneList={type="zonelist", zonetype="MinimapZone", label="Minimap zones"}
local currentZone = GetZoneText()
for _, zoneName in ipairs(setting.zoneList) do
if zoneName == currentZone then
equip = true
break
end
end
if not equip then
currentZone = GetMinimapZoneText()
for _, zoneName in ipairs(setting.minimapZoneList) do
if zoneName == currentZone then
equip = true
break
end
end
end
if didEquip and equip == nil then
equip = false
end
]],
},
{
Name = Outfitter.cRidingOutfit,
ID = "Riding",
Category = "TRADE",
Script = Outfitter:GenerateScriptHeader("MOUNTED NOT_MOUNTED", Outfitter.cRidingOutfitDescription)..
[[
-- $SETTING DisableBG={type="boolean", label="Don't equip in Battlegrounds", default=true}
-- $SETTING DisableInstance={type="boolean", label="Don't equip in dungeons", default=true}
-- $SETTING DisablePVP={type="boolean", label="Don't equip while PvP flagged", default=false}
-- $SETTING StayEquippedWhileFalling={type="boolean", label="Leave equipped while falling", default=false}
-- $SETTING UnequipDelay={type="number", label="Wait", suffix="seconds before unequipping", default=0}
-- Equip on mount unless it's disabled
if event == "MOUNTED" then
-- The disable options are only checked inside the mounting handler. This way
-- the outfit won't equip automatically, but if the player chooses to
-- manually equip it after mounting, then Outfitter will still unequip
-- it for them when they dismount
local inInstance, instanceType = IsInInstance()
if (setting.DisableInstance and inInstance and (instanceType == "raid" or instanceType == "party"))
or (setting.DisableBG and Outfitter:InBattlegroundZone())
or (setting.DisablePVP and UnitIsPVP("player")) then
return
end
equip = true
-- Unequip on dismount
elseif event == "NOT_MOUNTED" then
if not setting.StayEquippedWhileFalling then
equip = false
else
self.UnequipWhenNotFalling = true
self.DismountTime = GetTime()
self:RegisterEvent("TIMER")
end
if setting.UnequipDelay then
delay = setting.UnequipDelay
end
-- Check to see if the player is no longer falling
elseif event == "TIMER" then
-- Unequip if the player was falling when dismounted and has now landed
if self.UnequipWhenNotFalling
and GetTime() >= self.DismountTime + 1
and not IsFalling() then
equip = false
self.UnequipWhenNotFalling = nil
end
if not self.UnequipWhenNotFalling then
self:UnregisterEvent("TIMER")
end
end
]],
},
{
Name = Outfitter.cSwimmingOutfit,
ID = "Swimming",
Category = "TRADE",
Script = Outfitter:GenerateScriptHeader("SWIMMING NOT_SWIMMING", Outfitter.cSwimmingOutfitDescription)..
[[
-- $SETTING DisableInstance={type="boolean", label="Don't equip in dungeons", default=false}
-- $SETTING DisableBG={type="boolean", label="Don't equip in Battlegrounds", default=false}
-- $SETTING DisablePVP={type="boolean", label="Don't equip while PvP flagged", default=false}
-- $SETTING DisableVashjir={type="boolean", label="Don't equip in Vashj'ir", default=true}
-- Just return if they're PvP'ing and don't want the outfit changing
local inInstance, instanceType = IsInInstance()
if (setting.DisableInstance and inInstance and (instanceType == "raid" or instanceType == "party"))
or (setting.DisableBG and Outfitter:InBattlegroundZone())
or (setting.DisablePVP and UnitIsPVP("player")) then
return
end
local bestMapID = C_Map.GetBestMapForUnit("PLAYER")
if setting.DisableVashjir
and (bestMapID == 204 -- Abyssal Depths
or bestMapID == 201 -- Kelp'thar Forest
or bestMapID == 205) then -- Shimmering Expanse
return
end
if event == "SWIMMING" then
equip = true
elseif didEquip then
equip = false
delay = 2.5 -- Use a delay since hitting spacebar temporarily makes the player not swimming
end
]],
},
{
Name = Outfitter.cFishingOutfit,
ID = "Fishing",
Category = "TRADE",
Script = Outfitter:GenerateScriptHeader("OUTFIT_EQUIPPED OUTFIT_UNEQUIPPED", Outfitter.cFishingOutfitDescription)..
[[
-- $SETTING EnableFishTracking={type="boolean", label="Select Track Fish while equipped", default=true}
-- $SETTING EnableAutoLoot={type="boolean", label="Enable auto loot while equipped"}
-- $SETTING DisableEnemyNamePlates={type="boolean", label="Disable enemy name bars while equiped", default=false}
-- $SETTING DisableClicktoMove={type="boolean", label="Disable Click-to-Move while equipped", default=true}
-- $SETTING ChangeActionBar={type="boolean", label="Switch action bars while equipped", default=false}
-- $SETTING ActionBarNumber={type="number", label="Action bar (1 - 6)", default=1}
-- Enable auto looting if the outfit is being equipped and EnableAutoLoot is on
if event == "OUTFIT_EQUIPPED" then
if setting.EnableAutoLoot then
setting.savedAutoLoot = GetCVar("autoLootDefault")
SetCVar("autoLootDefault", "1")
setting.didSetAutoLoot = true
end
if setting.EnableFishTracking then
local _, vIndex = Outfitter:GetTrackingEnabled(133888)
if vIndex then
setting.savedTracking = Outfitter:GetCurrentSpellTrackingEnabled()
Outfitter:SetTrackingEnabled(133888, 1)
setting.didSetTracking = true
end
end
if setting.DisableClicktoMove then
setting.savedMove = GetCVar("autointeract")
SetCVar("autointeract", "0")
setting.didSetMove = true
end
if setting.ChangeActionBar then
setting.savedActionBar = GetActionBarPage()
ChangeActionBarPage(setting.ActionBarNumber)
setting.didChangeActionBar = true
end
if setting.DisableEnemyNamePlates then
setting.savedShowEnemies = GetCVar("nameplateShowEnemies")
SetCVar("nameplateShowEnemies", 0)
setting.didChangeShowEnemies = true
end
-- Turn auto looting back off if the outfit is being unequipped and we turned it on
elseif event == "OUTFIT_UNEQUIPPED" then
if setting.EnableAutoLoot and setting.didSetAutoLoot then
SetCVar("autoLootDefault", setting.savedAutoLoot)
setting.didSetAutoLoot = nil
setting.savedAutoLoot = nil
end
if setting.EnableFishTracking and setting.didSetTracking then
if setting.savedTracking then
Outfitter:SetTrackingEnabled(setting.savedTracking, true)
else
Outfitter:SetTrackingEnabled(133888, false) -- no spell tracking was enabled
end
setting.didSetTracking = nil
setting.savedTracking = nil
end
if setting.DisableClicktoMove and setting.didSetMove then
SetCVar("autointeract", setting.savedMove)
setting.didSetMove = nil
setting.savedMove = nil
end
if setting.didChangeActionBar then
ChangeActionBarPage(setting.savedActionBar)
setting.didChangeActionBar = nil
setting.savedActionBar = nil
end
if setting.didChangeShowEnemies then
SetCVar("nameplateShowEnemies", setting.savedShowEnemies)
setting.didChangeShowEnemies = nil
setting.savedShowEnemies = nil
end
end
if equip == equipped then
equip = nil
end
]],
},
{
Name = Outfitter.cDiningOutfit,
ID = "Dining",
Category = "TRADE",
Script = Outfitter:GenerateSmartUnequipScript("DINING", Outfitter.cDiningOutfitDescription),
},
{
Name = Outfitter.cCityOutfit,
ID = "City",
Category = "ENTERTAIN",
Script = Outfitter:GenerateSimpleScript("CITY", Outfitter.cCityOutfitDescription),
},
{
Name = Outfitter.cBattlegroundOutfit,
ID = "Battleground",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND", Outfitter.cBattlegroundOutfitDescription, nil, true),
},
{
Name = Outfitter.cABOutfit,
ID = "AB",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_AB", Outfitter.cArathiBasinOutfitDescription, nil, true),
},
{
Name = Outfitter.cAVOutfit,
ID = "AV",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_AV", Outfitter.cAlteracValleyOutfitDescription, nil, true),
},
{
Name = Outfitter.cWSGOutfit,
ID = "WSG",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_WSG", Outfitter.cWarsongGulchOutfitDescription, nil, true),
},
{
Name = Outfitter.cEotSOutfit,
ID = "EotS",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_EOTS", Outfitter.cEotSOutfitDescription, nil, true),
},
{
Name = Outfitter.cSotAOutfit,
ID = "SotA",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_SOTA", Outfitter.cSotAOutfitDescription, nil, true),
},
{
Name = Outfitter.cIoCOutfit,
ID = "IoC",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_IOC", Outfitter.cIoCOutfitDescription, nil, true),
},
{
Name = Outfitter.cWintergraspOutfit,
ID = "Wintergrasp",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_WG", nil, nil, true),
},
{
Name = Outfitter.cSewersOutfit,
ID = "Sewers",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_SEWERS", nil, nil, true),
},
{
Name = Outfitter.cGilneasOutfit,
ID = "Gilneas",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_GILNEAS", nil, nil, true),
},
{
Name = Outfitter.cTwinPeaksOutfit,
ID = "TwinPeaks",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_TWINPEAKS", nil, nil, true),
},
{
Name = Outfitter.cArenaOutfit,
ID = "Arena",
Category = "PVP",
Script = Outfitter:GenerateSmartUnequipScript("BATTLEGROUND_ARENA", Outfitter.cArenaOutfitDescription, nil, true),
},
{
Name = "Spirit Regen",
ID = "Spirit",
Category = "GENERAL",
Script = Outfitter:GenerateSmartUnequipScript("SPIRIT_REGEN", Outfitter.SpiritRegenOutfitDescription, 0.5),
},
{
Name = Outfitter.cDruidCasterForm,
ID = "Caster",
Class = "DRUID",
Script = Outfitter:GenerateScriptHeader("CASTER_FORM NOT_CASTER_FORM OUTFIT_EQUIPPED", Outfitter.cDruidCasterFormDescription)..
[[
-- $SETTING DisableInstance={type="boolean", label="Don't equip in dungeons", default=false}
-- $SETTING DisableBG={type="boolean", label="Don't equip in Battlegrounds", default=false}
-- $SETTING DisablePVP={type="boolean", label="Don't equip while PvP flagged", default=false}
-- $SETTING Tree1={type="boolean", label=Outfitter:GetTalentTreeName(1), default=true}
-- $SETTING Tree2={type="boolean", label=Outfitter:GetTalentTreeName(2), default=true}
-- $SETTING Tree3={type="boolean", label=Outfitter:GetTalentTreeName(3), default=true}
-- $SETTING Tree4={type="boolean", label=Outfitter:GetTalentTreeName(4), default=true}
-- Just return if they're PvP'ing and don't want the outfit changing
local inInstance, instanceType = IsInInstance()
if (setting.DisableInstance and inInstance and (instanceType == "raid" or instanceType == "party"))