-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathnetherbot.lua
964 lines (814 loc) · 37.4 KB
/
netherbot.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
NetherBot.InitLocale()
local i18n = NetherBot.I18n
-- Create the Main frame
local frame = CreateFrame("Frame", "NetherbotFrame", UIParent)
frame:SetSize(200, 200)
frame:SetPoint("CENTER", UIParent, "CENTER")
local title = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
title:SetPoint("TOP", frame, "TOP", 0, -10)
title:SetText(i18n("NetherBot - NPCBOT Tool"))
-- Set the background color and transparency for MainFrame "Frame"
frame:SetBackdrop({
bgFile = "Interface/Buttons/WHITE8X8",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
frame:SetBackdropColor(0.35, 0.14, 0.73, 0.25)
frame:SetBackdropBorderColor(0.53, 0.07, 0.89, 1)
-- Make the frame movable
frame:SetMovable(true)
frame:EnableMouse(true)
-- Create the adminFrame
local adminFrame = CreateFrame("Frame", "NetherbotAdminFrame", UIParent)
adminFrame:SetSize(200, 200)
adminFrame:SetPoint("RIGHT", frame, "LEFT", -10, 0)
adminFrame:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
adminFrame:SetBackdropColor(1, 0, 0, 0.2)
adminFrame:SetBackdropBorderColor(0, 1, 0, 1)
adminFrame:Hide()
local adminTitle = adminFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
adminTitle:SetPoint("TOP", adminFrame, "TOP", 0, -10)
adminTitle:SetText(i18n("Admin"))
-- Handle frame movement
frame:SetScript("OnMouseDown", function(self, button)
if button == "LeftButton" then
self:StartMoving()
end
end)
-- Stop frame movement
frame:SetScript("OnMouseUp", function(self, button)
if button == "LeftButton" then
self:StopMovingOrSizing()
end
end)
-- Create the buttons
-- Your addon's namespace and variables
local NetherBot = {}
NetherbotDB = {} -- Your saved variables table
-- Create a function to set and save the scale
local function SetAndSaveScale(scale)
frame:SetScale(scale)
NetherbotDB.scale = scale
end
-- Add UI scale buttons
local increaseScaleButton = CreateFrame("Button", "NetherbotIncreaseScaleButton", frame)
increaseScaleButton:SetSize(20, 20)
increaseScaleButton:SetPoint("TOPLEFT", frame, "TOPLEFT", 5, -5)
increaseScaleButton:SetNormalFontObject("GameFontNormal")
local increaseButtonText = increaseScaleButton:CreateFontString(nil, "OVERLAY")
increaseButtonText:SetFont("Fonts\\FRIZQT__.TTF", 20, "OUTLINE")
increaseButtonText:SetText("")
increaseButtonText:SetPoint("CENTER", 0, 0)
increaseButtonText:SetTextColor(1, 1, 0)
increaseScaleButton:RegisterForClicks("LeftButtonUp")
increaseScaleButton:SetScript("OnClick", function()
local currentScale = frame:GetScale()
local newScale = currentScale + 0.1
SetAndSaveScale(newScale)
end)
local decreaseScaleButton = CreateFrame("Button", "NetherbotDecreaseScaleButton", frame)
decreaseScaleButton:SetSize(20, 20)
decreaseScaleButton:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -5, -5)
decreaseScaleButton:SetNormalFontObject("GameFontNormal")
local decreaseButtonText = decreaseScaleButton:CreateFontString(nil, "OVERLAY")
decreaseButtonText:SetFont("Fonts\\FRIZQT__.TTF", 20, "OUTLINE")
decreaseButtonText:SetText("")
decreaseButtonText:SetPoint("CENTER", 0, 0)
decreaseButtonText:SetTextColor(1, 1, 0)
decreaseScaleButton:RegisterForClicks("LeftButtonUp")
decreaseScaleButton:SetScript("OnClick", function()
local currentScale = frame:GetScale()
local newScale = currentScale - 0.1
SetAndSaveScale(newScale)
end)
-- Event handler for addon loading
local function OnAddonLoaded(self, event, addonName)
if addonName == "NetherBot" then
-- Check if the scale is saved in the saved variables
if NetherbotDB and NetherbotDB.scale then
frame:SetScale(NetherbotDB.scale)
end
end
end
local addonLoadedFrame = CreateFrame("Frame")
addonLoadedFrame:RegisterEvent("ADDON_LOADED")
addonLoadedFrame:SetScript("OnEvent", OnAddonLoaded)
-- Add texture to the increase button
local increaseTexture = increaseScaleButton:CreateTexture(nil, "BACKGROUND")
increaseTexture:SetTexture("Interface\\Icons\\spell_chargepositive")
increaseTexture:SetAllPoints()
increaseScaleButton:SetNormalTexture(increaseTexture)
-- Add texture to the decrease button
local decreaseTexture = decreaseScaleButton:CreateTexture(nil, "BACKGROUND")
decreaseTexture:SetTexture("Interface\\Icons\\spell_chargenegative")
decreaseTexture:SetAllPoints()
decreaseScaleButton:SetNormalTexture(decreaseTexture)
-- Follow Button
local followButton = CreateFrame("Button", "NetherbotFollowButton", frame, "ActionButtonTemplate")
followButton:SetPoint("TOPLEFT", frame, "TOPLEFT", 8, -35)
followButton:SetSize(42, 42)
local followButtonText = followButton:CreateFontString(nil, "OVERLAY")
followButtonText:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE") -- Use the "OUTLINE" flag for text outline
followButtonText:SetText("Follow")
followButtonText:SetPoint("CENTER", 0, 0)
followButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local followTexture = followButton:CreateTexture(nil, "BACKGROUND")
followTexture:SetTexture("Interface\\Icons\\Ability_Tracking")
followTexture:SetAllPoints()
followButton:SetNormalTexture(followTexture)
local followpushedTexture = followButton:CreateTexture(nil, "BACKGROUND")
followpushedTexture:SetTexture("Interface\\Icons\\Ability_Tracking")
followpushedTexture:SetAllPoints()
followButton:SetPushedTexture(followpushedTexture)
-- StandStill Button
local standstillButton = CreateFrame("Button", "NetherbotStandstillButton", frame, "ActionButtonTemplate")
standstillButton:SetPoint("LEFT", followButton, "RIGHT", 5, 0)
standstillButton:SetSize(42, 42)
local standstillButtonText = standstillButton:CreateFontString(nil, "OVERLAY")
standstillButtonText:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE") -- Use the "OUTLINE" flag for text outline
standstillButtonText:SetText("Stand")
standstillButtonText:SetPoint("CENTER", 0, 0)
standstillButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local standstillTexture = standstillButton:CreateTexture(nil, "BACKGROUND")
standstillTexture:SetTexture("Interface\\Icons\\Inv_misc_map_01")
standstillTexture:SetAllPoints()
standstillButton:SetNormalTexture(standstillTexture)
local standstillpushedTexture = standstillButton:CreateTexture(nil, "BACKGROUND")
standstillpushedTexture:SetTexture("Interface\\Icons\\Inv_misc_map_01")
standstillpushedTexture:SetAllPoints()
standstillButton:SetPushedTexture(standstillpushedTexture)
--FullStop Button
local fullstopButton = CreateFrame("Button", "NetherbotfullstopButton", frame, "ActionButtonTemplate")
fullstopButton:SetPoint("LEFT", standstillButton, "RIGHT", 5, 0)
fullstopButton:SetSize(42, 42)
local fullstopButtonText = fullstopButton:CreateFontString(nil, "OVERLAY")
fullstopButtonText:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE") -- Use the "OUTLINE" flag for text outline
fullstopButtonText:SetText("Stop")
fullstopButtonText:SetPoint("CENTER", 0, 0)
fullstopButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local fullstopTexture = fullstopButton:CreateTexture(nil, "BACKGROUND")
fullstopTexture:SetTexture("Interface\\Icons\\Spell_chargenegative")
fullstopTexture:SetAllPoints()
fullstopButton:SetNormalTexture(fullstopTexture)
local fullstoppushedTexture = fullstopButton:CreateTexture(nil, "BACKGROUND")
fullstoppushedTexture:SetTexture("Interface\\Icons\\Spell_chargenegative")
fullstoppushedTexture:SetAllPoints()
fullstopButton:SetPushedTexture(fullstoppushedTexture)
-- Slack Button
local followOnlyButton = CreateFrame("Button", "NetherbotFollowOnlyButton", frame, "ActionButtonTemplate")
followOnlyButton:SetPoint("LEFT", fullstopButton, "RIGHT", 5, 0)
followOnlyButton:SetSize(42, 42)
local followOnlyButtonText = followOnlyButton:CreateFontString(nil, "OVERLAY")
followOnlyButtonText:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE") -- Use the "OUTLINE" flag for text outline
followOnlyButtonText:SetText("Slack")
followOnlyButtonText:SetPoint("CENTER", 0, 0)
followOnlyButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local followOnlyTexture = followOnlyButton:CreateTexture(nil, "BACKGROUND")
followOnlyTexture:SetTexture("Interface\\Icons\\Spell_Nature_Sleep")
followOnlyTexture:SetAllPoints()
followOnlyButton:SetNormalTexture(followOnlyTexture)
local followOnlyPushedTexture = followOnlyButton:CreateTexture(nil, "BACKGROUND")
followOnlyPushedTexture:SetTexture("Interface\\Icons\\Spell_Nature_Sleep")
followOnlyPushedTexture:SetAllPoints()
followOnlyButton:SetPushedTexture(followOnlyPushedTexture)
-- Show Button
local ShowNPCButton = CreateFrame("Button", "NetherbotShow3Button", frame, "ActionButtonTemplate")
ShowNPCButton:SetPoint("TOPLEFT", followButton, "BOTTOMLEFT", 0, -5)
ShowNPCButton:SetSize(42, 42)
local ShowButtonText = ShowNPCButton:CreateFontString(nil, "OVERLAY")
ShowButtonText:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE") -- Use the "OUTLINE" flag for text outline
ShowButtonText:SetText("UnHide")
ShowButtonText:SetPoint("CENTER", 0, 0)
ShowButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local ShowNPCTexture = ShowNPCButton:CreateTexture(nil, "BACKGROUND")
ShowNPCTexture:SetTexture("Interface\\Icons\\ability_hunter_beastcall")
ShowNPCTexture:SetAllPoints()
ShowNPCButton:SetNormalTexture(ShowNPCTexture)
local ShowNPCpushedTexture = ShowNPCButton:CreateTexture(nil, "BACKGROUND")
ShowNPCpushedTexture:SetTexture("Interface\\Icons\\ability_hunter_beastcall")
ShowNPCpushedTexture:SetAllPoints()
ShowNPCButton:SetPushedTexture(ShowNPCpushedTexture)
-- Hide Button
local HideNPCButton = CreateFrame("Button", "NetherbotShow3Button", frame, "ActionButtonTemplate")
HideNPCButton:SetPoint("LEFT", ShowNPCButton, "RIGHT", 5, 0)
HideNPCButton:SetSize(42, 42)
local HideButtonText = HideNPCButton:CreateFontString(nil, "OVERLAY")
HideButtonText:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE") -- Use the "OUTLINE" flag for text outline
HideButtonText:SetText("Hide")
HideButtonText:SetPoint("CENTER", 0, 0)
HideButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local HideNPCTexture = HideNPCButton:CreateTexture(nil, "BACKGROUND")
HideNPCTexture:SetTexture("Interface\\Icons\\ability_stealth")
HideNPCTexture:SetAllPoints()
HideNPCButton:SetNormalTexture(HideNPCTexture)
local HideNPCpushedTexture = HideNPCButton:CreateTexture(nil, "BACKGROUND")
HideNPCpushedTexture:SetTexture("Interface\\Icons\\ability_stealth")
HideNPCpushedTexture:SetAllPoints()
HideNPCButton:SetPushedTexture(HideNPCpushedTexture)
-- Recall Button
local RecallNPCButton = CreateFrame("Button", "NetherbotShow3Button", frame, "ActionButtonTemplate")
RecallNPCButton:SetPoint("LEFT", HideNPCButton, "RIGHT", 5, 0)
RecallNPCButton:SetSize(42, 42)
local RecallButtonText = RecallNPCButton:CreateFontString(nil, "OVERLAY")
RecallButtonText:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE") -- Use the "OUTLINE" flag for text outline
RecallButtonText:SetText("Recall")
RecallButtonText:SetPoint("CENTER", 0, 0)
RecallButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local RecallNPCTexture = RecallNPCButton:CreateTexture(nil, "BACKGROUND")
RecallNPCTexture:SetTexture("Interface\\Icons\\Inv_misc_rune_01")
RecallNPCTexture:SetAllPoints()
RecallNPCButton:SetNormalTexture(RecallNPCTexture)
local RecallNPCpushedTexture = RecallNPCButton:CreateTexture(nil, "BACKGROUND")
RecallNPCpushedTexture:SetTexture("Interface\\Icons\\Inv_misc_rune_01")
RecallNPCpushedTexture:SetAllPoints()
RecallNPCButton:SetPushedTexture(RecallNPCpushedTexture)
-- Unbind Button
local unbindButton = CreateFrame("Button", "NetherbotUnbindButton", frame, "ActionButtonTemplate")
unbindButton:SetPoint("LEFT", RecallNPCButton, "RIGHT", 5, 0) -- Positioning it to the right of the Recall button
unbindButton:SetSize(42, 42)
local unbindButtonText = unbindButton:CreateFontString(nil, "OVERLAY")
unbindButtonText:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE")
unbindButtonText:SetText("Unbind")
unbindButtonText:SetPoint("CENTER", 0, 0)
unbindButtonText:SetTextColor(1, 1, 0)
local unbindTexture = unbindButton:CreateTexture(nil, "BACKGROUND")
unbindTexture:SetTexture("Interface\\Icons\\INV_Misc_Key_14") -- Example texture, change as needed
unbindTexture:SetAllPoints()
unbindButton:SetNormalTexture(unbindTexture)
local unbindPushedTexture = unbindButton:CreateTexture(nil, "BACKGROUND")
unbindPushedTexture:SetTexture("Interface\\Icons\\INV_Misc_Key_14") -- Example texture, change as needed
unbindPushedTexture:SetAllPoints()
unbindButton:SetPushedTexture(unbindPushedTexture)
-- Unbind Button Function
unbindButton:SetScript("OnClick", function()
SendChatMessage(".npcbot command unbind", "SAY")
end)
local distanceLabel = standstillButton:CreateFontString(nil, "ARTWORK", "GameFontNormal")
distanceLabel:SetPoint("BOTTOM", standstillButton, "BOTTOM", 20, -63)
distanceLabel:SetText(i18n("Follow Distance:"))
-- Distance1 Button
local distance1Button = CreateFrame("Button", "Netherbotdistance1Button", frame, "ActionButtonTemplate")
distance1Button:SetPoint("TOPLEFT", followButton, "BOTTOMLEFT", 10, -65)
distance1Button:SetSize(50, 25)
local distance1ButtonText = distance1Button:CreateFontString(nil, "OVERLAY")
distance1ButtonText:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE") -- Use the "OUTLINE" flag for text outline
distance1ButtonText:SetText(i18n("Low"))
distance1ButtonText:SetPoint("CENTER", 0, 0)
distance1ButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local distance1Texture = distance1Button:CreateTexture(nil, "BACKGROUND")
distance1Texture:SetTexture("Interface\\Icons\\Inv_misc_punchcards_red")
distance1Texture:SetAllPoints()
distance1Button:SetNormalTexture(distance1Texture)
local distance1pushedTexture = distance1Button:CreateTexture(nil, "BACKGROUND")
distance1pushedTexture:SetTexture("Interface\\Icons\\Inv_misc_punchcards_red")
distance1pushedTexture:SetAllPoints()
distance1Button:SetPushedTexture(distance1pushedTexture)
-- Distance2 Button
local distance2Button = CreateFrame("Button", "Netherbotdistance2Button", frame, "ActionButtonTemplate")
distance2Button:SetPoint("LEFT", distance1Button, "RIGHT", 5, 0)
distance2Button:SetSize(50, 25)
local distance2ButtonText = distance2Button:CreateFontString(nil, "OVERLAY")
distance2ButtonText:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE") -- Use the "OUTLINE" flag for text outline
distance2ButtonText:SetText(i18n("Medium"))
distance2ButtonText:SetPoint("CENTER", 0, 0)
distance2ButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local distance2Texture = distance2Button:CreateTexture(nil, "BACKGROUND")
distance2Texture:SetTexture("Interface\\Icons\\Inv_misc_punchcards_red")
distance2Texture:SetAllPoints()
distance2Button:SetNormalTexture(distance2Texture)
local distance2pushedTexture = distance2Button:CreateTexture(nil, "BACKGROUND")
distance2pushedTexture:SetTexture("Interface\\Icons\\Inv_misc_punchcards_red")
distance2pushedTexture:SetAllPoints()
distance2Button:SetPushedTexture(distance2pushedTexture)
-- Distance3 Button
local distance3Button = CreateFrame("Button", "Netherbotdistance3Button", frame, "ActionButtonTemplate")
distance3Button:SetPoint("LEFT", distance2Button, "RIGHT", 5, 0)
distance3Button:SetSize(50, 25)
local distance3ButtonText = distance3Button:CreateFontString(nil, "OVERLAY")
distance3ButtonText:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE") -- Use the "OUTLINE" flag for text outline
distance3ButtonText:SetText(i18n("High"))
distance3ButtonText:SetPoint("CENTER", 0, 0)
distance3ButtonText:SetTextColor(1, 1, 0) -- Set text color (yellow in this case)
local distance3Texture = distance3Button:CreateTexture(nil, "BACKGROUND")
distance3Texture:SetTexture("Interface\\Icons\\Inv_misc_punchcards_red")
distance3Texture:SetAllPoints()
distance3Button:SetNormalTexture(distance3Texture)
local distance3pushedTexture = distance3Button:CreateTexture(nil, "BACKGROUND")
distance3pushedTexture:SetTexture("Interface\\Icons\\Inv_misc_punchcards_red")
distance3pushedTexture:SetAllPoints()
distance3Button:SetPushedTexture(distance3pushedTexture)
local adminButton = CreateFrame("Button", "NetherbotAdminButton", frame, "UIPanelButtonTemplate")
adminButton:SetSize(60, 20)
adminButton:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -10, 10) -- position the button in the bottom right of the frame
adminButton:SetText(i18n("Admin"))
adminButton:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
local raidButton = CreateFrame("Button", "NetherbotRaidButton", frame, "UIPanelButtonTemplate")
raidButton:SetSize(70, 20)
raidButton:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -120, 10) -- position the button in the bottom right of the frame
raidButton:SetText("RaidFrame")
raidButton:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
-- Add Revive Button
local reviveButton = CreateFrame("Button", "NetherbotReviveButton", frame, "UIPanelButtonTemplate")
reviveButton:SetSize(50, 20)
reviveButton:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -70, 10) -- Position between RaidFrame and Admin
reviveButton:SetText("Revive")
reviveButton:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
-- Revive Button Function
reviveButton:SetScript("OnClick", function()
SendChatMessage(".npcbot revive", "SAY")
end)
-- Adjust the position of the Admin button to accommodate the new Revive button
adminButton:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -10, 10) -- position the button in the bottom right of the frame
-- Create Admin Buttons
local buttonAdd = CreateFrame("Button", "NetherbotButtonAdd", adminFrame, "UIPanelButtonTemplate")
buttonAdd:SetSize(56, 22)
buttonAdd:SetPoint("TOPLEFT", adminFrame, "TOPLEFT", 10, -35)
buttonAdd:SetText(i18n("Add"))
buttonAdd:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
local buttonRemove = CreateFrame("Button", "NetherbotButtonRemove", adminFrame, "UIPanelButtonTemplate")
buttonRemove:SetSize(65, 22)
buttonRemove:SetPoint("TOP", buttonAdd, "BOTTOM", 25, -5)
buttonRemove:SetText(i18n("Remove"))
buttonRemove:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
local buttonRecall = CreateFrame("Button", "NetherbotButtonRecall", adminFrame, "UIPanelButtonTemplate")
buttonRecall:SetSize(59, 22)
buttonRecall:SetPoint("LEFT", buttonAdd, "RIGHT", 3, 0)
buttonRecall:SetText(i18n("Recall"))
buttonRecall:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
local buttonBotinfo = CreateFrame("Button", "NetherbotButtonBotInfo", adminFrame, "UIPanelButtonTemplate")
buttonBotinfo:SetSize(62, 22)
buttonBotinfo:SetPoint("LEFT", buttonRecall, "RIGHT", 2, 0)
buttonBotinfo:SetText(i18n("Bot-Info"))
buttonBotinfo:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
local buttonMove = CreateFrame("Button", "NetherbotButtonMove", adminFrame, "UIPanelButtonTemplate")
buttonMove:SetSize(65, 22)
buttonMove:SetPoint("LEFT", buttonRemove, "RIGHT", 5, 0)
buttonMove:SetText(i18n("Move"))
buttonMove:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
local buttonDelete = CreateFrame("Button", "NetherbotButtonDelete", adminFrame, "UIPanelButtonTemplate")
buttonDelete:SetSize(60, 22)
buttonDelete:SetPoint("BOTTOMRIGHT", adminFrame, "BOTTOMRIGHT", -10, 10)
buttonDelete:SetText(i18n("Delete"))
buttonDelete:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
local redemptionButton = CreateFrame("Button", "NetherbotRedemptionButton", adminFrame, "SecureActionButtonTemplate")
redemptionButton:SetSize(30, 30)
redemptionButton:SetPoint("BOTTOMLEFT", adminFrame, "BOTTOMLEFT", 10, 10)
local redemptionIcon = redemptionButton:CreateTexture(nil, "BACKGROUND")
redemptionIcon:SetAllPoints()
redemptionIcon:SetTexture(select(3, GetSpellInfo(7328)))
redemptionButton:SetNormalTexture(redemptionIcon)
redemptionButton:SetAttribute("type", "spell")
redemptionButton:SetAttribute("spell", 7328)
-- Create the "botLookupButton" button
local botLookupButton = CreateFrame("Button", "NetherbotBotLookupButton", adminFrame, "UIPanelButtonTemplate")
botLookupButton:SetSize(65, 22)
botLookupButton:SetPoint("BOTTOM", adminFrame, "BOTTOM", 0, 10)
botLookupButton:SetText(i18n("Lookup"))
botLookupButton:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
-- Main Frame Button Functions:
followButton:SetScript("OnClick", function()
SendChatMessage(".npcbot command follow", "SAY")
end)
standstillButton:SetScript("OnClick", function()
SendChatMessage(".npcbot command standstill", "SAY")
end)
fullstopButton:SetScript("OnClick", function()
SendChatMessage(".npcbot command stopfully", "SAY")
end)
distance1Button:SetScript("OnClick", function()
SendChatMessage(".npcbot distance 30", "SAY")
end)
distance2Button:SetScript("OnClick", function()
SendChatMessage(".npcbot distance 50", "SAY")
end)
distance3Button:SetScript("OnClick", function()
SendChatMessage(".npcbot distance 85", "SAY")
end)
ShowNPCButton:SetScript("OnClick", function()
SendChatMessage(".npcbot unhide", "SAY")
end)
HideNPCButton:SetScript("OnClick", function()
SendChatMessage(".npcbot hide", "SAY")
end)
RecallNPCButton:SetScript("OnClick", function()
SendChatMessage(".npcbot recal teleport", "SAY")
end)
followOnlyButton:SetScript("OnClick", function()
SendChatMessage(".npcbot command follow only", "SAY")
end)
adminButton:SetScript("OnClick", function()
if adminFrame:IsShown() then
adminFrame:Hide()
else
adminFrame:Show()
end
end)
-- Admin Frame Button Functions
buttonAdd:SetScript("OnClick", function()
local target = UnitName("target")
if target then
-- Target is selected, run command ".npcbot add target"
ChatFrame1:AddMessage(".npcbot add " .. target)
SendChatMessage(".npcbot add ", "SAY")
else
-- Target is not selected, prompt input and run command ".npcbot add (input value)"
StaticPopupDialogs["ADD_NPC"] = {
text = "Enter NPCBOT ID:",
button1 = "Ok",
button2 = "Cancel",
hasEditBox = true,
timeout = 0,
whileDead = true,
hideOnEscape = true,
OnAccept = function(self)
local npc = self.editBox:GetText()
ChatFrame1:AddMessage(".npcbot add " .. npc)
SendChatMessage(".npcbot add " .. npc, "SAY")
end,
}
StaticPopup_Show("ADD_NPC")
end
end)
buttonRemove:SetScript("OnClick", function()
local target = UnitName("target")
if target then
-- Target is selected, run command ".npcbot remove target"
ChatFrame1:AddMessage(".npcbot remove " .. target)
SendChatMessage(".npcbot remove ", "SAY")
else
-- Target is not selected, prompt input and run command ".npcbot remove (input value)"
StaticPopupDialogs["REMOVE_NPC"] = {
text = "Enter NPCBOT ID:",
button1 = "Ok",
button2 = "Cancel",
hasEditBox = true,
timeout = 0,
whileDead = true,
hideOnEscape = true,
OnAccept = function(self)
local npc = self.editBox:GetText()
ChatFrame1:AddMessage(".npcbot remove " .. npc)
SendChatMessage(".npcbot remove " .. npc, "SAY")
end,
}
StaticPopup_Show("REMOVE_NPC")
end
end)
buttonRecall:SetScript("OnClick", function()
SendChatMessage(".npcbot recall", "SAY")
end)
buttonBotinfo:SetScript("OnClick", function()
SendChatMessage(".npcbot info", "SAY")
DoEmote("BONK")
end)
buttonMove:SetScript("OnClick", function()
SendChatMessage(".npcbot move", "SAY")
end)
buttonDelete:SetScript("OnClick", function()
StaticPopupDialogs["CONFIRM_DELETE"] = {
text = "Are you sure you want to delete?",
button1 = "Yes",
button2 = "No",
timeout = 0,
whileDead = true,
hideOnEscape = true,
OnAccept = function()
local target = UnitName("target")
if target then
-- Target is selected, run command ".npcbot delete target"
ChatFrame1:AddMessage(".npcbot delete " .. target)
SendChatMessage(".npcbot delete ", "SAY")
else
-- Target is not selected, prompt input and run command ".npcbot delete (input value)"
StaticPopupDialogs["DELETE_NPC"] = {
text = "Enter NPCBOT ID:",
button1 = "Ok",
button2 = "Cancel",
hasEditBox = true,
timeout = 0,
whileDead = true,
hideOnEscape = true,
OnAccept = function(self)
local npc = self.editBox:GetText()
ChatFrame1:AddMessage(".npcbot delete " .. npc)
SendChatMessage(".npcbot delete " .. npc, "SAY")
end,
}
StaticPopup_Show("DELETE_NPC")
end
end,
}
StaticPopup_Show("CONFIRM_DELETE")
end)
redemptionButton:SetScript("OnClick", function()
ChatFrame1:AddMessage(".npcbot revive")
SendChatMessage(".npcbot revive", "SAY")
end)
redemptionButton:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText(i18n("Revive Bots"))
GameTooltip:Show()
end)
redemptionButton:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- Create the lookup frame
local lookupFrame = CreateFrame("Frame", "NetherbotLookupFrame", UIParent)
lookupFrame:SetSize(200, 200)
lookupFrame:SetPoint("CENTER", UIParent, "CENTER")
lookupFrame:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
lookupFrame:SetBackdropColor(0, 0, 1, 0.3)
lookupFrame:SetBackdropBorderColor(0, 0, 1,1)
lookupFrame:Hide()
local lookupTitle = lookupFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
lookupTitle:SetPoint("TOPLEFT", lookupFrame, "TOPLEFT", 10, -10)
lookupTitle:SetText(i18n("Select class:"))
-- Create the scrollframe for the list
local lookupScrollFrame = CreateFrame("ScrollFrame", "NetherbotLookupScrollFrame", lookupFrame, "UIPanelScrollFrameTemplate")
lookupScrollFrame:SetPoint("TOPLEFT", lookupFrame, "TOPLEFT", 4, -25)
lookupScrollFrame:SetPoint("BOTTOMRIGHT", lookupFrame, "BOTTOMRIGHT", -4, 4)
-- Create the list frame
local lookupList = CreateFrame("Frame", "NetherbotLookupList", lookupScrollFrame)
lookupList:SetSize(lookupScrollFrame:GetWidth(), lookupScrollFrame:GetHeight())
lookupScrollFrame:SetScrollChild(lookupList)
-- Create the key-value store
local classTable = {
["Warrior"] = 1,
["Paladin"] = 2,
["Hunter"] = 3,
["Rogue"] = 4,
["Priest"] = 5,
["Death Knight"] = 6,
["Shaman"] = 7,
["Mage"] = 8,
["Warlock"] = 9,
["Druid"] = 11,
["Blademaster"] = 12,
["Sphynx"] = 13,
["Archmage"] = 14,
["Dreadlord"] = 15,
["Spellbreaker"] = 16,
["DarkRanger"] = 17,
["Necromancer"] = 18,
["SeaWitch"] = 19
}
-- Create the buttons for the list items
for key, value in pairs(classTable) do
local button = CreateFrame("Button", "NetherbotLookupButton"..value, lookupList, "UIPanelButtonTemplate")
button:SetSize(180, 25)
button:SetPoint("TOPLEFT", lookupList, "TOPLEFT", 10, -10 - (value-1)*30)
button:SetText(i18n(key))
button:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
-- Handle the button's click event
button:SetScript("OnClick", function()
SendChatMessage(".npcbot lookup " .. value, "SAY")
-- You can add your custom functionality here like running a command or doing some other action
end)
end
-- Create the "hideLookup" button
local hideLookupButton = CreateFrame("Button", "NetherbotHideLookupButton", lookupFrame, "UIPanelButtonTemplate")
hideLookupButton:SetSize(21, 20)
hideLookupButton:SetPoint("TOPRIGHT", lookupFrame, "TOPRIGHT", -10, -8)
hideLookupButton:SetText(i18n("X"))
hideLookupButton:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
-- Create the spawnFrame
local spawnFrame = CreateFrame("Frame", "NetherbotSpawnFrame", lookupFrame)
spawnFrame:SetSize(200, 60)
spawnFrame:SetPoint("BOTTOM", lookupFrame, "BOTTOM", 0, -70)
spawnFrame:SetBackdrop({
bgFile = "Interface/BUTTONS/WHITE8X8",
edgeFile = "Interface/BUTTONS/WHITE8X8",
edgeSize = 1,
insets = {left = 0, right = 0, top = 0, bottom = 0}})
spawnFrame:SetBackdropColor(0, 0, 1, 0.3)
spawnFrame:SetBackdropBorderColor(0, 0, 1,1)
-- Create the title
local spawnTitle = spawnFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
spawnTitle:SetPoint("TOPLEFT", spawnFrame, "TOPLEFT", 10, -10)
spawnTitle:SetText(i18n("Spawn BOT ID:"))
-- Create the "buttonSpawnBot" button
local buttonSpawnBot = CreateFrame("Button", "NetherbotButtonSpawnBot", spawnFrame, "UIPanelButtonTemplate")
buttonSpawnBot:SetSize(80, 25)
buttonSpawnBot:SetPoint("BOTTOMLEFT", spawnFrame, "BOTTOMLEFT", 10, 10)
buttonSpawnBot:SetText(i18n("Spawn Bot"))
buttonSpawnBot:GetNormalTexture():SetVertexColor(0.10,1.00,0.10)
-- Create the "classInput" input box
local classInput = CreateFrame("EditBox", "NetherbotClassInput", spawnFrame, "InputBoxTemplate")
classInput:SetSize(80, 25)
classInput:SetPoint("BOTTOMLEFT", buttonSpawnBot, "BOTTOMRIGHT", 10, 0)
classInput:SetAutoFocus(false)
-- Handle the buttons click event
buttonSpawnBot:SetScript("OnClick", function()
local input = classInput:GetText()
if input ~= "" then
SendChatMessage(".npcbot spawn "..input, "GUILD")
classInput:SetText(i18n(""))
classInput:ClearFocus()
else
print("Please enter an ID:")
end
end)
-- Handle Lookup buttons click event
hideLookupButton:SetScript("OnClick", function()
lookupFrame:Hide()
end)
-- Handle the Lookup buttons click event
botLookupButton:SetScript("OnClick", function()
if lookupFrame:IsShown() then
lookupFrame:Hide()
else
lookupFrame:Show()
end
end)
-- Handle lookupframe movement
-- Make the frame movable
lookupFrame:SetMovable(true)
lookupFrame:EnableMouse(true)
lookupFrame:SetScript("OnMouseDown", function(self, button)
if button == "LeftButton" then
self:StartMoving()
end
end)
-- Stop lookupframe movement.
lookupFrame:SetScript("OnMouseUp", function(self, button)
if button == "LeftButton" then
self:StopMovingOrSizing()
end
end)
-- Slash command to show-hide netherbot.
SLASH_NETHERBOT1 = "/netherbot"
function SlashCmdList.NETHERBOT(msg, editbox)
if msg == "show" then
frame:Show()
elseif msg == "hide" then
frame:Hide()
adminFrame:Hide()
lookupFrame:Hide()
end
end
-- RAID FRAMES:
-- Create main frame
local TeamFrame = CreateFrame("Frame", "TeamFrame", UIParent)
TeamFrame:SetSize(350, 600)
TeamFrame:SetPoint("CENTER")
-- Make the frame draggable
TeamFrame:SetMovable(true)
TeamFrame:EnableMouse(true)
TeamFrame:RegisterForDrag("LeftButton")
TeamFrame:SetScript("OnDragStart", TeamFrame.StartMoving)
TeamFrame:SetScript("OnDragStop", TeamFrame.StopMovingOrSizing)
TeamFrame:Hide()
-- Create tables to store information
local memberFrames = {}
local healthBars = {}
local manaBars = {}
local nameTexts = {}
local groupFrames = {}
-- Initialize frames and bars
local function initializeFramesAndBars()
-- Check if the necessary data is ready
if not RAID_CLASS_COLORS then
return -- Data is not ready, exit the function
end
-- Clear old frames and bars
for i = 1, #memberFrames do
memberFrames[i]:Hide()
end
memberFrames = {}
healthBars = {}
manaBars = {}
nameTexts = {}
-- Loop over the raid members
local numRaidMembers = GetNumRaidMembers()
for i = 1, numRaidMembers do
-- Calculate the group (1-8) and position within the group (1-5) of this member
local group = math.ceil(i / 5)
local position = i - ((group - 1) * 5)
-- If this is the first member of the group, create a group frame with a title
if position == 1 then
local groupFrame = CreateFrame("Frame", nil, TeamFrame)
groupFrame:SetSize(80, 20) -- Adjust as needed
-- Calculate the column (0-1) and row (0-7) of the group
local column = (group - 1) % 2
local row = math.floor((group - 1) / 2)
groupFrame:SetPoint("TOPLEFT", TeamFrame, "TOP", 175 * (column - 1), 10 - row * 230)
-- Set border to the frame
groupFrame:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
TeamFrame:SetBackdropBorderColor(1, 0, 0, 0.5)
-- Add group title
local groupTitle = groupFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
groupTitle:SetPoint("TOP", 0, -3)
groupTitle:SetText("Group: "..group)
groupTitle:SetTextColor(1, 1, 1) -- White color
-- Store the group frame
groupFrames[group] = groupFrame
end
-- Calculate the column (0-1) and row (0-7) of the group
local column = (group - 1) % 2
local row = math.floor((group - 1) / 2)
-- Create a subframe for each raid member
local memberFrame = CreateFrame("Button", nil, TeamFrame, "SecureUnitButtonTemplate")
memberFrame:SetSize(150, 42) -- Adjust size to better fit the new layout
memberFrame:SetPoint("TOPLEFT", TeamFrame, "TOPLEFT", 10 + 175 * column, -10 - ((row * 230) + (position - 1) * 42)) -- Adjusted offset to better fit the new layout
memberFrame:SetAttribute("unit", "raid"..i)
memberFrame:RegisterForClicks("AnyUp")
SecureUnitButton_OnLoad(memberFrame, "raid"..i)
-- Set border to the frame
memberFrame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
local playerClass, charClass, classIndex = UnitClass("raid"..i)
local classColor = RAID_CLASS_COLORS[charClass] or { r = 1, g = 1, b = 1 } -- Use a default color if characterClass is not found in RAID_CLASS_COLOR - Workaround for the delay of bots spawning
memberFrame:SetBackdropBorderColor(classColor.r, classColor.g, classColor.b, 0.8) -- Set the border color to class color
memberFrame:SetBackdropColor(classColor.r, classColor.g, classColor.b, 0.2)
-- Add the player's name
local playerName, playerRealm = UnitName("raid"..i)
local playerClass, charClass, classIndex = UnitClass("raid"..i)
local classColor = RAID_CLASS_COLORS[charClass] or { r = 1, g = 1, b = 1 }
local nameText = memberFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
nameText:SetPoint("TOP", 5, -5)
nameText:SetText(playerName)
nameText:SetTextColor(classColor.r, classColor.g, classColor.b)
-- Add the health bar
local healthBar = CreateFrame("StatusBar", nil, memberFrame)
healthBar:SetStatusBarTexture("Interface\\TARGETINGFRAME\\UI-StatusBar")
healthBar:SetPoint("TOP", nameText, "BOTTOM", 0, -2)
healthBar:SetSize(100, 8)
healthBar:SetMinMaxValues(0, UnitHealthMax("raid"..i))
healthBar:SetValue(UnitHealth("raid"..i))
-- Add the mana bar
local manaBar = CreateFrame("StatusBar", nil, memberFrame)
manaBar:SetStatusBarTexture("Interface\\TARGETINGFRAME\\UI-StatusBar")
manaBar:SetStatusBarColor(0, 0, 1)
manaBar:SetPoint("TOP", healthBar, "BOTTOM", 0, 0)
manaBar:SetSize(100, 8)
manaBar:SetMinMaxValues(0, UnitPowerMax("raid"..i))
manaBar:SetValue(UnitPower("raid"..i))
-- Add frames, bars, and texts to the tables
memberFrames[i] = memberFrame
healthBars[i] = healthBar
manaBars[i] = manaBar
nameTexts[i] = nameText
end
end
-- Event handler for unit health and mana changes
local function updateHealthAndMana(self, event, unit)
for i = 1, #healthBars do
if unit == "raid"..i then
healthBars[i]:SetMinMaxValues(0, UnitHealthMax(unit))
healthBars[i]:SetValue(UnitHealth(unit))
manaBars[i]:SetMinMaxValues(0, UnitPowerMax(unit))
manaBars[i]:SetValue(UnitPower(unit))
end
end
end
-- Event handler for raid composition changes
local function updateRaidComposition(self, event, ...)
initializeFramesAndBars()
end
-- Event handler for BotSpawn delay
local function OnEvent(self, event, ...)
if event == "PLAYER_ENTERING_WORLD" or event == "RAID_ROSTER_UPDATE" or event == "ADDON_LOADED" then
initializeFramesAndBars()
else
updateHealthAndMana(self, event, ...)
end
end
-- Register events
TeamFrame:RegisterEvent("UNIT_HEALTH")
TeamFrame:RegisterEvent("UNIT_POWER_UPDATE")
TeamFrame:RegisterEvent("RAID_ROSTER_UPDATE")
TeamFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
TeamFrame:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_ENTERING_WORLD" or event == "RAID_ROSTER_UPDATE" then
initializeFramesAndBars()
else
updateHealthAndMana(self, event, ...)
end
end)
TeamFrame:SetScript("OnEvent", OnEvent)
raidButton:SetScript("OnClick", function()
if TeamFrame:IsShown() then
TeamFrame:Hide()
else
initializeFramesAndBars()
TeamFrame:Show()
end
end)