-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAngleurCata.lua
More file actions
927 lines (880 loc) · 36.4 KB
/
AngleurCata.lua
File metadata and controls
927 lines (880 loc) · 36.4 KB
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
local colorDebug = CreateColor(0.24, 0.76, 1) -- angleur blue
local auraIDHolders = {
raft,
oversizedBobber,
crateBobber
}
local helpTipCloseText = "|cnHIGHLIGHT_FONT_COLOR:The |r|cnNORMAL_FONT_COLOR:Interact Key|r|cnHIGHLIGHT_FONT_COLOR: allows you to interact with NPCs and objects using a keypress|n|n|r|cnRED_FONT_COLOR:Assign an Interact Key binding under Control options|r"
angleurDelayers = CreateFramePool("Frame", angleurDelayers, nil, function(framePool, frame)
frame:ClearAllPoints()
frame:SetScript("OnUpdate", nil)
frame:Hide()
end)
AngleurConfig = {
angleurKey,
angleurKeyModifier,
angleurKeyMain,
raftEnabled,
chosenRaft = {toyID = 0, name = 0, dropDownID = 0},
baitEnabled,
chosenBait = {itemID = 0, name = 0, dropDownID = 0},
oversizedEnabled,
crateEnabled,
chosenCrateBobber = {toyID = 0, name = 0, dropDownID = 0},
chosenMethod,
doubleClickChosenID = 2,
visualHidden,
visualLocation,
ultraFocusAudioEnabled,
ultraFocusAutoLootEnabled,
ultraFocusTurnOffInteract,
ultraFocusingAudio,
ultraFocusingAutoLoot,
}
AngleurCharacter = {
sleeping = false,
angleurSet = false
}
Angleur_CVars = {
ultraFocus = {musicOn, ambienceOn, dialogOn, effectsOn, effectsVolume, masterOn, masterVolume, backgroundOn},
autoLoot
}
AngleurMinimapButton = {
hide
}
local function Init_AngleurSavedVariables()
if AngleurConfig.ultraFocusAudioEnabled == nil then
AngleurConfig.ultraFocusAudioEnabled = false
end
if AngleurConfig.ultraFocusAutoLootEnabled == nil then
AngleurConfig.ultraFocusAutoLootEnabled = false
end
if AngleurConfig.chosenBait == nil then
AngleurConfig.chosenBait = {itemID = 0, name = 0, dropDownID = 0}
end
if AngleurCharacter.sleeping == nil then
AngleurCharacter.sleeping = false
end
if Angleur_TinyOptions.turnOffSoftInteract == nil then
Angleur_TinyOptions.turnOffSoftInteract = false
end
if Angleur_TinyOptions.allowDismount == nil then
Angleur_TinyOptions.allowDismount = false
end
if Angleur_TinyOptions.doubleClickWindow == nil then
Angleur_TinyOptions.doubleClickWindow = 0.4
end
if Angleur_TinyOptions.visualScale == nil then
Angleur_TinyOptions.visualScale = 1
end
if Angleur_TinyOptions.ultraFocusMaster == nil then
Angleur_TinyOptions.ultraFocusMaster = 1
end
if Angleur_TinyOptions.loginDisabled == nil then
Angleur_TinyOptions.loginDisabled = false
end
if Angleur_TinyOptions.errorsDisabled == nil then
Angleur_TinyOptions.errorsDisabled = true
end
if AngleurMinimapButton.hide == nil then
AngleurMinimapButton.hide = false
end
if AngleurTutorial.part == nil then
AngleurTutorial.part = 1
end
end
local function SetOverrideBinding_Custom(owner, isPriority, key, command)
if not key then return end
SetOverrideBinding(owner, isPriority, key, command)
end
local function SetOverrideBindingClick_Custom(owner, isPriority, key, buttonName)
if not key then return end
SetOverrideBindingClick(owner, isPriority, key, buttonName)
end
local function SetOverrideBindingSpell_Custom(owner, isPriority, key, spell)
if not key then return end
SetOverrideBindingSpell(owner, isPriority, key, spell)
end
function Angleur_RaiseError(value)
error("Angleur ERROR pertaining to:")
DevTools_Dump(value)
end
function Angleur_OnLoad(self)
self.toyButton:SetAttribute("type", "macro")
self.toyButton:RegisterForClicks("AnyDown", "AnyUp")
self:RegisterEvent("ADDON_LOADED")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PLAYER_LOGOUT")
self:RegisterEvent("ADDONS_UNLOADING")
self:RegisterEvent("PLAYER_STARTED_MOVING")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:SetScript("OnEvent", Angleur_EventLoader)
self:SetScript("OnUpdate", Angleur_OnUpdate)
end
local erapusuThreshold = 0.3
local erapusuCounter = 0
function Angleur_OnUpdate(self, elapsed)
erapusuCounter = erapusuCounter + elapsed
if erapusuCounter < erapusuThreshold then
return
end
Angleur_StuckFix()
if InCombatLockdown() then return end
if AngleurCharacter.sleeping then return end
erapusuCounter = 0
Angleur_ActionHandler(self)
end
--**************************[1]****************************
--**Events Relating to the Loading and unloading of stuff**
--**************************[1]****************************
function Angleur_EventLoader(self, event, unit, ...)
local arg4, arg5 = ...
if event == "ADDON_LOADED" and unit == "AngleurCata" then
Angleur_SetTab1(self.configPanel.tab1.contents)
Angleur_SetTab3(self.configPanel.tab3.contents)
self.visual.texture:SetTexture("Interface/AddOns/AngleurCata/imagesClassic/UI_Profession_Fishing")
elseif event == "PLAYER_ENTERING_WORLD" then
if unit == false and arg4 == false then return end
local color1 = CreateColor(1.0, 0.82, 0.0)
local color2 = CreateColor(0.61, 0.85, 0.92)
if unit == true then
if AngleurCharacter.sleeping == false then
Angleur_EquipAngleurSet(false)
end
if not Angleur_TinyOptions.loginDisabled then
print(color2:WrapTextInColorCode("Angleur: ") .. "Thank you for using Angleur!")
--print("Please report any bugs and issues you run into on the AddOn's curseforge page, or message me there directly.")
print("To access the configuration menu, type " .. color1:WrapTextInColorCode("/angleur ") .. "or " .. color1:WrapTextInColorCode("/angang") .. ".")
if AngleurCharacter.sleeping == true then
print(color2:WrapTextInColorCode("Angleur: ") .. "Sleeping. To continue using, type " .. color1:WrapTextInColorCode("/angsleep ") .. "again,")
print("or " .. color1:WrapTextInColorCode("Right-Click ") .. "the Visual Button." )
elseif AngleurCharacter.sleeping == false then
print(color2:WrapTextInColorCode("Angleur: ") .. "Is awake. To temporarily disable, type " .. color1:WrapTextInColorCode("/angsleep "))
print("or " .. color1:WrapTextInColorCode("Right-Click ") .. "the Visual Button." )
end
end
elseif arg4 == true then
if AngleurCharacter.sleeping == true then
if not Angleur_TinyOptions.loginDisabled then
print(color2:WrapTextInColorCode("Angleur: ") .. "Sleeping. To continue using, type " .. color1:WrapTextInColorCode("/angsleep ") .. "again,")
print("or " .. color1:WrapTextInColorCode("Right-Click ") .. "the Visual Button." )
end
end
end
if AngleurConfig.ultraFocusingAudio then Angleur_UltraFocusAudio(false) end
if AngleurConfig.ultraFocusingAutoLoot then Angleur_UltraFocusAutoLoot(false) end
Init_AngleurSavedVariables()
if GetCVar("autoLootDefault") == "1" then
Angleur.configPanel.tab1.contents.ultraFocus.autoLoot:greyOut()
AngleurConfig.ultraFocusAutoLootEnabled = false
end
Init_AngleurVisual()
--Angleur_HandleCVars()
HelpTip:Hide(UIParent, helpTipCloseText)
Angleur_CombatDelayer(function()Angleur_LoadToys()end)
Angleur_LoadItems()
Angleur_LoadExtraItems(Angleur.configPanel.tab2.contents.extraItems)
--Angleur_Auras()
Angleur_ExtraToyAuras()
Angleur_ExtraItemAuras()
if AngleurMinimapButton.hide == false then
Angleur_InitMinimapButton()
end
Angleur_BaitEnchant()
Angleur_EquipmentManager()
AngleurClassic_CheckFishingPoleEquipped()
Angleur_SetSleep()
if AngleurTutorial.part > 1 and AngleurConfig.chosenMethod == "oneKey" and not AngleurConfig.angleurKey then
Angleur.configPanel:Show()
Angleur.configPanel.tab1.contents.fishingMethod.oneKey.contents.angleurKey.warning:Show()
end
Angleur_FirstInstall()
elseif event == "PLAYER_LOGOUT" then
if AngleurConfig.ultraFocusAudioEnabled == true and AngleurCharacter.sleeping == false then
Angleur_UltraFocusBackground(false)
end
--Angleur_UnequipAngleurSet(false)
elseif event == "PLAYER_REGEN_DISABLED" then
ClearOverrideBindings(self)
Angleur_ToyBoxOverlay_Deactivate()
Angleur_AdvancedAnglingPanel:Hide()
elseif event == "PLAYER_REGEN_ENABLED" then
end
end
--***********[~]**********
--**Events watcher that determines logic variables**
--***********[~]**********
local iceFishing = false
local mounted = false
local swimming = false
local midFishing = false
local fishingSpellTable = {
7620,
7731,
7732,
18248,
33095,
51294,
88868
}
local fishingPoleTable = {
6256,
6365,
6366,
6367,
12225,
19022,
19970,
25978,
44050,
45120,
45858,
45991,
45992,
46337,
52678
}
local function CheckTable(table ,spell)
matchFound = false
for i, value in pairs(table) do
if spell == value then
matchFound = true
break
end
end
return matchFound
end
function AngleurClassic_CheckFishingPoleEquipped()
local itemLoc = ItemLocation:CreateFromEquipmentSlot(16)
if not C_Item.DoesItemExist(itemLoc) then
AngleurCharacter.sleeping = true
Angleur_SetSleep()
Angleur_UnequipAngleurSet(true)
return
end
local id = C_Item.GetItemID(itemLoc)
--local name = C_Item.GetItemName(itemLoc)
--print(id, name)
if CheckTable(fishingPoleTable, id) then
if AngleurCharacter.sleeping == true then
AngleurCharacter.sleeping = false
Angleur_SetSleep()
Angleur_EquipAngleurSet(true)
if AngleurConfig.visualHidden == false then
Angleur.visual:Show()
end
elseif AngleurCharacter.sleeping == false then
end
else
AngleurCharacter.sleeping = true
Angleur_SetSleep()
Angleur_UnequipAngleurSet(true)
end
end
local function isChosenKeyDown()
if AngleurConfig.chosenMethod == "doubleClick" then
if not AngleurConfig.doubleClickChosenID then
return false
elseif IsKeyDown(angleurDoubleClick.iDtoButtonName[AngleurConfig.doubleClickChosenID]) then
Angleur_BetaPrint(colorDebug:WrapTextInColorCode("isChosenKeyDown ") .. ": mouse held")
return true
end
elseif AngleurConfig.chosenMethod == "oneKey" then
if not AngleurConfig.angleurKey then
return false
end
local keybind = AngleurConfig.angleurKey
if AngleurConfig.angleurKeyModifier then
if AngleurConfig.angleurKeyMain then
keybind = AngleurConfig.angleurKeyMain
else
print("Angleur unexpected error: Modifier exists, but main key doesn't. Please let the author know.")
end
end
if keybind == "MOUSEWHEELUP" or keybind == "MOUSEWHEELDOWN" then
return false
end
if IsKeyDown(keybind) == false then
Angleur_BetaPrint(colorDebug:WrapTextInColorCode("isChosenKeyDown ") .. ": main key released")
return false
end
Angleur_BetaPrint(colorDebug:WrapTextInColorCode("isChosenKeyDown ") .. ": oneKey held")
return true
end
return false
end
function Angleur_LogicVariableHandler(self, event, unit, ...)
local arg4, arg5, arg6 = ...
-- Needed for when player zones into dungeon while mounted. Zone changes but no reload, and mount journal change doesn"t register.
if event == "PLAYER_ENTERING_WORLD" then
if IsMounted() then
mounted = true
else
mounted = false
if IsSwimming() then
swimming = true
else
swimming = false
end
end
elseif event == "PLAYER_SOFT_INTERACT_CHANGED" then
if arg4 then
local subbed = string.gsub(arg4, "%-0%-3767%-2444%-2424%-", "")
if subbed then
--print("found first pattern")
if string.match(arg4, "%-377944%-") then
iceFishing = true
elseif string.match(arg4, "%-192631%-") or string.match(arg4, "%-197596%-")then
iceFishing = true
elseif string.match(arg4, "%-35591%-") then
midFishing = true
end
end
elseif iceFishing == true then
iceFishing = false
end
elseif event == "UNIT_SPELLCAST_SENT" and unit == "player" then
if not CheckTable(fishingSpellTable, arg6) then return end
midFishing = true
Angleur_ActionHandler(Angleur)
elseif event == "UNIT_SPELLCAST_CHANNEL_START" and unit == "player" then
if not CheckTable(fishingSpellTable, arg5) then return end
midFishing = true
Angleur_ActionHandler(Angleur)
if AngleurConfig.ultraFocusAudioEnabled then Angleur_UltraFocusAudio(true) end
if AngleurConfig.ultraFocusAutoLootEnabled then Angleur_UltraFocusAutoLoot(true) end
if Angleur_TinyOptions.turnOffSoftInteract then Angleur_UltraFocusInteractOff(true) end
elseif event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_FAILED_QUIET" then
if unit ~= "player" then return end
if not CheckTable(fishingSpellTable, arg5) then return end
midFishing = false
Angleur_ActionHandler(Angleur)
elseif event == "UNIT_SPELLCAST_CHANNEL_STOP" and unit == "player" then
if not CheckTable(fishingSpellTable, arg5) then return end
if AngleurConfig.ultraFocusingAudio then Angleur_UltraFocusAudio(false) end
if AngleurConfig.ultraFocusingAutoLoot then Angleur_UltraFocusAutoLoot(false) end
if Angleur_TinyOptions.turnOffSoftInteract then Angleur_UltraFocusInteractOff(false) end
if isChosenKeyDown() == false then
midFishing = false
else
Angleur_PoolDelayer(1, 0, 0.2, angleurDelayers, function()
if isChosenKeyDown() == false then
midFishing = false
return true
end
end, function()
midFishing = false
end)
end
Angleur_SetCursorForGamePad(false)
elseif event == "PLAYER_MOUNT_DISPLAY_CHANGED" then
if IsMounted() then
mounted = true
else
mounted = false
if IsSwimming() then
swimming = true
else
swimming = false
end
end
elseif event == "MOUNT_JOURNAL_USABILITY_CHANGED" then
--The delay, and checking swimming here is necessary. If we constantly check on update for swimming a constant jumping bug occurs. Only happens when the AngleurKey is set to: SPACE
Angleur_PoolDelayer(1, 0, 0.2, angleurDelayers, function()
if IsSwimming() then
swimming = true
else
swimming = false
end
end)
elseif event == "PLAYER_EQUIPMENT_CHANGED" and unit == 16 then
AngleurClassic_CheckFishingPoleEquipped()
elseif event == "UNIT_AURA" and unit == "player" then
--Angleur_Auras()
Angleur_ExtraToyAuras()
Angleur_ExtraItemAuras()
elseif event == "UNIT_INVENTORY_CHANGED" and unit == "player" then
Angleur_BaitEnchant()
end
end
local logicVarFrame = CreateFrame("Frame")
logicVarFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
logicVarFrame:RegisterEvent("PLAYER_SOFT_INTERACT_CHANGED")
logicVarFrame:RegisterEvent("UNIT_SPELLCAST_SENT")
logicVarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
logicVarFrame:RegisterEvent("UNIT_SPELLCAST_FAILED")
logicVarFrame:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET")
logicVarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
logicVarFrame:RegisterEvent("PLAYER_MOUNT_DISPLAY_CHANGED")
logicVarFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED")
logicVarFrame:RegisterEvent("MOUNT_JOURNAL_USABILITY_CHANGED")
logicVarFrame:RegisterEvent("UNIT_AURA")
logicVarFrame:RegisterEvent("UNIT_INVENTORY_CHANGED")
logicVarFrame:RegisterEvent("CURSOR_CHANGED")
logicVarFrame:SetScript("OnEvent", Angleur_LogicVariableHandler)
--***********[~]**********
--***********[~]**********
--**Functions that check Auras**
--***********[~]**********
local rafted = false
local oversizedBobbered = false
local crateBobbered = false
function Angleur_Auras()
--Checks for raft aura
rafted = false
auraIDHolders.raft = nil
for i, raft in pairs(angleurToys.raftPossibilities) do
if C_UnitAuras.GetPlayerAuraBySpellID(raft.spellID) then
rafted = true
auraIDHolders.raft = raft.spellID
--print("Raft is applied")
break
end
end
--Checks for oversized bobber aura
oversizedBobbered = false
auraIDHolders.oversizedBobber = nil
if C_UnitAuras.GetPlayerAuraBySpellID(397827) then
oversizedBobbered = true
auraIDHolders.oversizedBobber = 397827
--print("OVERSIZED is applied")
end
--Checks for Crate Bobber aura
crateBobbered = false
auraIDHolders.crateBobber = nil
for i, crateBobber in pairs(angleurToys.crateBobberPossibilities) do
if C_UnitAuras.GetPlayerAuraBySpellID(crateBobber.spellID) then
crateBobbered = true
auraIDHolders.crateBobber = crateBobber.spellID
--print("Crate bobber is applied")
break
end
end
end
function Angleur_ExtraToyAuras()
--Checks for Extra Toy Auras
for i, slottedToy in pairs(Angleur_SlottedExtraToys) do
slottedToy.auraActive = false
if C_UnitAuras.GetPlayerAuraBySpellID(slottedToy.spellID) then
slottedToy.auraActive = true
--print("Slotted toy aura is active")
end
end
end
function Angleur_ExtraItemAuras()
--Checks for Extra Toy Auras
for i, slottedItem in pairs(Angleur_SlottedExtraItems) do
slottedItem.auraActive = false
local spellAuraID
if slottedItem.spellID ~= 0 then
spellAuraID = slottedItem.spellID
elseif slottedItem.macroSpellID ~= 0 then
spellAuraID = slottedItem.macroSpellID
end
if spellAuraID then
local name = GetSpellInfo(spellAuraID)
--doesn't work
--print("Non passive: ", C_UnitAuras.GetPlayerAuraBySpellID(spellAuraID))
if C_UnitAuras.GetAuraDataBySpellName("player", name) then
slottedItem.auraActive = true
local link = C_Spell.GetSpellLink(spellAuraID)
Angleur_BetaPrint(colorDebug:WrapTextInColorCode("Angleur_ExtraItemAuras ") .. ": Slotted item/macro aura is active:", link)
end
end
end
end
--***********[~]**********
local baitApplied = false
local baitEnchantIDTable = {
263,
264,
265,
266,
3868,
4225
}
function Angleur_BaitEnchant()
if GetWeaponEnchantInfo() then
local _, _, _, enchantID = GetWeaponEnchantInfo()
if CheckTable(baitEnchantIDTable, enchantID) then
baitApplied = true
else
baitApplied = false
end
else
baitApplied = false
end
end
--***********[~]**********
--**Decides which action to perform**
--***********[~]**********
function Angleur_ActionHandler(self)
--print("WorldFrame Dragging: ", WorldFrame:IsDragging())
if InCombatLockdown() then return end
local assignKey = nil
if AngleurConfig.chosenMethod == "oneKey" then
if not AngleurConfig.angleurKey then
ClearOverrideBindings(self)
self.visual.texture:SetTexture("")
return end
assignKey = AngleurConfig.angleurKey
elseif AngleurConfig.chosenMethod == "doubleClick" then
if angleurDoubleClick.watching then
assignKey = angleurDoubleClick.iDtoButtonName[AngleurConfig.doubleClickChosenID]
end
end
ClearOverrideBindings(self)
if midFishing then
SetOverrideBinding_Custom(self, true, assignKey, "INTERACTMOUSEOVER")
self.visual.texture:SetTexture("Interface/AddOns/AngleurCata/imagesClassic/misc_arrowlup")
Angleur_SetCursorForGamePad(true)
elseif swimming then
--print("I am swimming")
if mounted and Angleur_TinyOptions.allowDismount == false then
ClearOverrideBindings(self)
self.visual.texture:SetTexture("")
elseif angleurToys.selectedRaftTable.hasToy == true and AngleurConfig.raftEnabled and angleurToys.selectedRaftTable.loaded then
if rafted then
local remainingAuraDuration = C_UnitAuras.GetPlayerAuraBySpellID(auraIDHolders.raft).expirationTime - GetTime()
if remainingAuraDuration < 60 then
SetOverrideBindingClick_Custom(self, true, assignKey, "Angleur_ToyButton")
self.toyButton:SetAttribute("macrotext", "/cast " .. angleurToys.selectedRaftTable.name)
self.visual.texture:SetTexture(angleurToys.selectedRaftTable.icon)
else
ClearOverrideBindings(self)
self.visual.texture:SetTexture("")
end
else
SetOverrideBindingClick_Custom(self, true, assignKey, "Angleur_ToyButton")
self.toyButton:SetAttribute("macrotext", "/cast " .. angleurToys.selectedRaftTable.name)
self.visual.texture:SetTexture(angleurToys.selectedRaftTable.icon)
end
else
ClearOverrideBindings(self)
self.visual.texture:SetTexture("")
end
elseif not swimming then
if mounted and Angleur_TinyOptions.allowDismount == false then
ClearOverrideBindings(self)
self.visual.texture:SetTexture("")
else
if rafted then
local remainingAuraDuration = C_UnitAuras.GetPlayerAuraBySpellID(auraIDHolders.raft).expirationTime - GetTime()
if remainingAuraDuration < 60 and AngleurConfig.raftEnabled and angleurToys.selectedRaftTable.loaded then
SetOverrideBindingClick_Custom(self, true, assignKey, "Angleur_ToyButton")
self.toyButton:SetAttribute("macrotext", "/cast " .. angleurToys.selectedRaftTable.name)
self.visual.texture:SetTexture(angleurToys.selectedRaftTable.icon)
return
end
end
--local _, cooldownOversized = C_Container.GetItemCooldown(angleurToys.selectedOversizedBobberTable.toyID)
--local _, cooldownCrate = C_Container.GetItemCooldown(angleurToys.selectedCrateBobberTable.toyID)
local baitCount = C_Item.GetItemCount(AngleurConfig.chosenBait.itemID)
if angleurItems.selectedBaitTable.hasItem == true and AngleurConfig.baitEnabled and angleurItems.selectedBaitTable.loaded and baitApplied == false and baitCount > 0 then
SetOverrideBindingClick_Custom(self, true, assignKey, "Angleur_ToyButton")
self.toyButton:SetAttribute("macrotext", "/cast " .. angleurItems.selectedBaitTable.name)
self.visual.texture:SetTexture(angleurItems.selectedBaitTable.icon)
elseif Angleur_ActionHandler_ExtraToys(self, assignKey) then
--ALREADY HANDLED WITHIN THE FUNCTION
elseif Angleur_ActionHandler_ExtraItems(self, assignKey) then
--ALREADY HANDLED WITHIN THE FUNCTION
elseif iceFishing then
SetOverrideBinding_Custom(self, true, assignKey, "INTERACTMOUSEOVER")
self.visual.texture:SetTexture("Interface/AddOns/AngleurCata/imagesClassic/misc_arrowlup")
Angleur_SetCursorForGamePad(true)
else
SetOverrideBindingSpell_Custom(self, true, assignKey, PROFESSIONS_FISHING)
self.visual.texture:SetTexture("Interface/AddOns/AngleurCata/imagesClassic/UI_Profession_Fishing")
end
end
end
end
local cursorControlEnabled = false
function Angleur_SetCursorForGamePad(activate)
if C_GamePad.IsEnabled() == false then return end
if activate == true then
if IsGamePadFreelookEnabled() == false then return end
SetGamePadCursorControl(true)
cursorControlEnabled = true
elseif activate == false then
if cursorControlEnabled == false then return end
SetGamePadCursorControl(false)
cursorControlEnabled = false
end
end
function Angleur_ActionHandler_ExtraToys(self, assignKey)
local returnValue = false
for i, slot in pairs(Angleur_SlottedExtraToys) do
local _, cooldown = C_Container.GetItemCooldown(slot.toyID)
if slot.name ~= 0 and cooldown == 0 and slot.auraActive == false then
local isUsable = C_Spell.IsSpellUsable(slot.spellID)
if isUsable then
SetOverrideBindingClick_Custom(self, true, assignKey, "Angleur_ToyButton")
self.toyButton:SetAttribute("macrotext", "/cast " .. slot.name)
self.visual.texture:SetTexture(slot.icon)
returnValue = true
break
end
end
end
return returnValue
end
local function checkUsabilityItem(itemID)
if not C_Item.IsUsableItem(itemID) then return false end
local _, cooldown = C_Container.GetItemCooldown(itemID)
if cooldown ~= 0 then return false end
local itemCount = C_Item.GetItemCount(itemID)
if not (itemCount > 0) then return false end
if C_Item.IsEquippableItem(itemID) then
if not C_Item.IsEquippedItem(itemID) then return false end
end
return true
end
local function parseMacroConditions(macroBody)
local returnValue = 0
for conditionBracket in string.gmatch (macroBody, "(%[.-%])") do
if SecureCmdOptionParse(conditionBracket) == nil then
if returnValue == 0 then
returnValue = false
end
else
returnValue = true
end
end
if returnValue == 0 then
returnValue = true
end
return returnValue
end
local lastPrint = 0 -- only used for debug mode, so the prints aren't too frequent
local function checkConditions(self, slot, assignKey)
if slot.delay ~= 0 and slot.delay ~= nil and slot.lastUsed ~= 0 and slot.lastUsed ~= nil then
if (GetTime() > slot.lastUsed + slot.delay) then
Angleur_BetaPrint(colorDebug:WrapTextInColorCode("checkConditions ") .. ": Timer ran out, usable again: ", C_Spell.GetSpellLink(slot.spellID))
slot.lastUsed = 0
else
local remaining = GetTime() - (slot.lastUsed + slot.delay)
remaining = string.format("%.0f", remaining)
if remaining ~= lastPrint then
lastPrint = remaining
Angleur_BetaPrint(colorDebug:WrapTextInColorCode("checkConditions ") .. ": Delay time remaining: ", remaining)
end
return false
end
end
if slot.name ~= 0 and slot.auraActive == false then
if checkUsabilityItem(slot.itemID) == false then return false end
SetOverrideBindingClick_Custom(self, true, assignKey, "Angleur_ToyButton")
self.toyButton:SetAttribute("macrotext", "/cast " .. slot.name)
self.visual.texture:SetTexture(slot.icon)
return true
elseif slot.macroName ~= 0 then
if slot.macroBody == "" then return false end
if slot.macroItemID ~= 0 and slot.macroItemID ~= nil then
if checkUsabilityItem(slot.macroItemID) == false then return false end
end
if slot.macroSpellID ~= 0 and C_Spell.DoesSpellExist(slot.macroSpellID) and IsUsableSpell(slot.macroSpellID) then
local _, spellCooldown = GetSpellCooldown(slot.macroSpellID)
if spellCooldown ~= 0 or slot.auraActive == true then return false end
if parseMacroConditions(slot.macroBody) == true then
SetOverrideBindingClick_Custom(self, true, assignKey, "Angleur_ToyButton")
self.toyButton:SetAttribute("macrotext", slot.macroBody)
self.visual.texture:SetTexture(slot.macroIcon)
return true
end
end
end
end
function Angleur_ActionHandler_ExtraItems(self, assignKey)
local returnValue = false
for i, slot in pairs(Angleur_SlottedExtraItems) do
if checkConditions(self, slot, assignKey) == true then return true end
end
return returnValue
end
--***********[~]**********
function Angleur_SetSleep()
if AngleurCharacter.sleeping == true then
--no need to do combat delay, angleur clears override bindings when entering combat anyway
if not InCombatLockdown() then ClearOverrideBindings(Angleur) end
Angleur.visual.texture:SetTexture("Interface/AddOns/AngleurCata/imagesClassic/UI_Profession_Fishing")
Angleur.visual.texture:SetDesaturated(true)
Angleur.configPanel.tab1:DesaturateHierarchy(1)
Angleur.configPanel.tab2:DesaturateHierarchy(1)
Angleur.configPanel.wakeUpButton:Show()
Angleur.configPanel.decoration:Hide()
if Angleur_TinyOptions.turnOffSoftInteract == true then
Angleur_UltraFocusInteractOff(false)
end
if AngleurConfig.ultraFocusAudioEnabled == true then
Angleur_UltraFocusBackground(false)
end
elseif AngleurCharacter.sleeping == false then
Angleur.visual.texture:SetDesaturated(false)
Angleur.configPanel.tab1:DesaturateHierarchy(0)
Angleur.configPanel.tab2:DesaturateHierarchy(0)
Angleur.configPanel.wakeUpButton:Hide()
Angleur.configPanel.decoration:Show()
if AngleurConfig.ultraFocusAudioEnabled == true then
Angleur_UltraFocusBackground(true)
end
end
Angleur_SetMinimapSleep()
end
function Angleur_UltraFocusBackground(activate)
if activate == true then
Angleur_CVars.ultraFocus.backgroundOn = GetCVar("Sound_EnableSoundWhenGameIsInBG")
SetCVar("Sound_EnableSoundWhenGameIsInBG", 1)
Angleur_BetaPrint(colorDebug:WrapTextInColorCode("Angleur_UltraFocusBackground ") .. ": BG Sound set to: ", GetCVar("Sound_EnableSoundWhenGameIsInBG"))
elseif activate == false then
if Angleur_CVars.ultraFocus.backgroundOn ~= nil then SetCVar("Sound_EnableSoundWhenGameIsInBG", Angleur_CVars.ultraFocus.backgroundOn) end
Angleur_BetaPrint(colorDebug:WrapTextInColorCode("Angleur_UltraFocusBackground ") .. ": BG Sound restored to previous value, which was: ", Angleur_CVars.ultraFocus.backgroundOn)
end
end
--SetCVar("Sound_EnableMusic", 0)
function Angleur_UltraFocusAudio(activate)
if activate == true then
Angleur_CVars.ultraFocus.musicOn = GetCVar("Sound_EnableMusic")
SetCVar("Sound_EnableMusic", 0)
Angleur_CVars.ultraFocus.ambienceOn = GetCVar("Sound_EnableAmbience")
SetCVar("Sound_EnableAmbience", 0)
Angleur_CVars.ultraFocus.dialogOn = GetCVar("Sound_EnableDialog")
SetCVar("Sound_EnableDialog", 0)
Angleur_CVars.ultraFocus.effectsOn = GetCVar("Sound_EnableSFX")
SetCVar("Sound_EnableSFX", 1)
Angleur_CVars.ultraFocus.effectsVolume = GetCVar("Sound_SFXVolume")
SetCVar("Sound_SFXVolume", 1.0)
Angleur_CVars.ultraFocus.masterOn = GetCVar("Sound_EnableAllSound")
SetCVar("Sound_EnableAllSound", 1)
Angleur_CVars.ultraFocus.masterVolume = GetCVar("Sound_MasterVolume")
SetCVar("Sound_MasterVolume", Angleur_TinyOptions.ultraFocusMaster)
AngleurConfig.ultraFocusingAudio = true
--[[
print("Music: " , Angleur_CVars.ultraFocus.musicOn)
print("Ambience: " , Angleur_CVars.ultraFocus.ambienceOn)
print("Dialog: " , Angleur_CVars.ultraFocus.dialogOn)
print("SFX: " , Angleur_CVars.ultraFocus.effectsOn)
print("SFX-Volume: " , Angleur_CVars.ultraFocus.effectsVolume)
]]--
elseif activate == false then
if Angleur_CVars.ultraFocus.musicOn ~= nil then SetCVar("Sound_EnableMusic", Angleur_CVars.ultraFocus.musicOn) end
if Angleur_CVars.ultraFocus.ambienceOn ~= nil then SetCVar("Sound_EnableAmbience", Angleur_CVars.ultraFocus.ambienceOn) end
if Angleur_CVars.ultraFocus.dialogOn ~= nil then SetCVar("Sound_EnableDialog", Angleur_CVars.ultraFocus.dialogOn) end
if Angleur_CVars.ultraFocus.effectsOn ~= nil then SetCVar("Sound_EnableSFX", Angleur_CVars.ultraFocus.effectsOn) end
if Angleur_CVars.ultraFocus.effectsVolume ~= nil then SetCVar("Sound_SFXVolume", Angleur_CVars.ultraFocus.effectsVolume) end
if Angleur_CVars.ultraFocus.masterOn ~= nil then SetCVar("Sound_EnableAllSound", Angleur_CVars.ultraFocus.masterOn) end
if Angleur_CVars.ultraFocus.masterVolume ~= nil then SetCVar("Sound_MasterVolume", Angleur_CVars.ultraFocus.masterVolume) end
AngleurConfig.ultraFocusingAudio = false
--print("Ultra Focus Disabled")
end
end
function Angleur_UltraFocusAutoLoot(activate)
if activate == true then
local autoLootBefore = GetCVar("autoLootDefault")
if autoLootBefore == 1 then return end
AngleurConfig.ultraFocusingAutoLoot = true
Angleur_CVars.autoLoot = autoLootBefore
SetCVar("autoLootDefault", 1)
elseif activate == false then
AngleurConfig.ultraFocusingAutoLoot = false
if Angleur_CVars.autoLoot ~= nil then
SetCVar("autoLootDefault", Angleur_CVars.autoLoot)
Angleur_CVars.autoLoot = false
end
end
end
function Angleur_UltraFocusInteractOff(activate)
if activate == true then
C_CVar.SetCVar("SoftTargetInteract", 3)
elseif activate == false then
C_CVar.SetCVar("SoftTargetInteract", 1)
end
end
--[[ Disabled for Classic
function Angleur_HandleCVars()
Angleur_UltraFocusInteractOff(not Angleur_TinyOptions.turnOffSoftInteract)
end
]]--
function Angleur_SingleDelayer(delay, timeElapsed, elapsedThreshhold, delayFrame, cycleFunk, endFunk)
delayFrame:SetScript("OnUpdate", function(self, elapsed)
timeElapsed = timeElapsed + elapsed
if timeElapsed > elapsedThreshhold then
if cycleFunk then
if cycleFunk() == true then
print("Breaking delayer")
self:SetScript("OnUpdate", nil)
return
end
end
delay = delay - timeElapsed
timeElapsed = 0
end
if delay <= 0 then
self:SetScript("OnUpdate", nil)
endFunk()
return
end
end)
end
angleurCombatDelayFrame = CreateFrame("Frame")
angleurCombatDelayFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
angleurFunctionsQueueTable = {}
function Angleur_CombatDelayer(funk)
if InCombatLockdown() then
--print("triggered")
table.insert(angleurFunctionsQueueTable, funk)
angleurCombatDelayFrame:SetScript("OnEvent", function()
for i, funktion in pairs(angleurFunctionsQueueTable) do
funktion()
--print("executed: ", funktion)
end
angleurFunctionsQueueTable = {}
angleurCombatDelayFrame:SetScript("OnEvent", nil)
end)
else
funk()
end
end
function Angleur_PoolDelayer(delay, timeElapsed, elapsedThreshhold, delayFramePool, cycleFunk, endFunk)
local delayFrame = delayFramePool:Acquire()
delayFrame:Show()
delayFrame:SetScript("OnUpdate", function(self, elapsed)
timeElapsed = timeElapsed + elapsed
if timeElapsed > elapsedThreshhold then
if cycleFunk then
if cycleFunk() == true then
delayFramePool:Release(self)
return
end
end
delay = delay - timeElapsed
timeElapsed = 0
end
if delay <= 0 then
if endFunk then endFunk() end
delayFramePool:Release(self)
return
end
end)
end
function Angleur_BetaPrint(text, ...)
if Angleur_TinyOptions.errorsDisabled == false then
print(text, ...)
end
end
function Angleur_BetaDump(dump)
if Angleur_TinyOptions.errorsDisabled == false then
DevTools_Dump(dump)
end
end
function Angleur_BetaTableToString(tbl)
if Angleur_TinyOptions.errorsDisabled == false then
local tableToString = ""
for i, v in pairs(tbl) do
local element = "[" .. tostring(i) .. ":" .. tostring(v) .. "]"
tableToString = tableToString .. " " .. element
end
print(tableToString)
end
end