-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobBossMods.lua
1524 lines (1407 loc) · 43.9 KB
/
RobBossMods.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
-- Please DONT change the following
--
-- RobBossMods Author: Robert Hartmann
-- Pîc on Thrall
-- feel free to change the explanations but email me them because
-- i will distribute the addon on curse.com and wowinterface.com
--
-- please never remove this comment, many thanks!
local L
local precombat = false
local incombat = false
local lastinstance = nil
local frame = CreateFrame("Frame")
local lastSpoken = {}
local lastboss = nil
local lastbossplot = 0
local aktiv = 1
local myname = ""
local mytime = 0
local sendbool = 0
local partymember = 0
local mynumber = math.random(50000)
local rbm_version = 0.40
local rbm_displayversion = tostring(rbm_version).." beta"
local update_told = 0
local lastping = 0
local already_told = {}
local lang = ""
local ldb
local havetotell = false
local dataobj
rbm_elang = rbm_elang
frame:RegisterEvent("PLAYER_TARGET_CHANGED")
frame:RegisterEvent("CHAT_MSG_PARTY")
frame:RegisterEvent("CHAT_MSG_PARTY_LEADER")
frame:RegisterEvent("CHAT_MSG_WHISPER")
frame:RegisterEvent("CHAT_MSG_ADDON")
frame:RegisterEvent("PARTY_MEMBERS_CHANGED")
frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("INSTANCE_LOCK_START")
frame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
frame:RegisterEvent("PLAYER_REGEN_ENABLED")
frame:RegisterEvent("PLAYER_REGEN_DISABLED")
SLASH_RBM1, SLASH_RBM2 = '/rbm', '/robbossmods';
--menu thing
local bzone = LibStub("LibBabble-Zone-3.0")
local BL = bzone:GetLookupTable()
local bboss = LibStub("LibBabble-Boss-3.0")
local BB = bboss:GetLookupTable()
local boss_dead = {}
local function resetCustomTactics()
rbm_customTactics = {}
end
local raid_zones = {
[BL["Blackwing Descent"]] = { 41570, 42180, 41378, 41442, 43296, 41376 },
[BL["The Bastion of Twilight"]] = { 44600, 45992, 43735, 43324 },
[BL["Baradin Hold"]] = { 47120 },
[BL["Throne of the Four Winds"]] = { 45871, 46753 }
}
local zones = {
["Zul'Aman"] = { 23574, 23576, 23578, 23577, 24239, 23863 },
["Zul'Gurub"] = { 52155, 52151, 52271, 52059, 52053, 52148 },
[BL["The Stonecore"]] = { 43438, 43214, 42188, 42333 },
[BL["Throne of the Tides"]] = {40586, 40765, 40825, 40792 },
[BL["Blackrock Caverns"]] = { 39665 , 39679, 39698, 39700, 39705 },
[BL["Grim Batol"]] = { 39625, 40177, 40319, 40484 },
[BL["Halls of Origination"]] = { 39425, 39428, 39788, 39587, 39731, 39732, 39378},
[BL["Lost City of the Tol'vir"]] = { 44577, 43614, 43612, 44819},
[BL["The Vortex Pinnacle"]] = { 43878, 43873, 43875 },
[BL["The Deadmines"]] = { 47162, 47297, 43778, 47626, 47739, 49541},
[BL["Shadowfang Keep"]] = { 46962, 3887, 4278, 46963, 46964 }
}
local boss_label = {
[3887] = BB["Baron Silverlaine"],
[39378] = BB["Rajh"],
[39425] = BB["Temple Guardian Anhuur"],
[39428] = BB["Earthrager Ptah"],
[39587] = BB["Isiset"],
[39625] = BB["General Umbriss"],
[39665] = BB["Rom'ogg Bonecrusher"],
[39679] = BB["Corla, Herald of Twilight"],
[39698] = BB["Karsh Steelbender"],
[39700] = BB["Beauty"],
[39705] = BB["Ascendant Lord Obsidius"],
[39731] = BB["Ammunae"],
[39732] = BB["Setesh"],
[39788] = BB["Anraphet"],
[40177] = BB["Forgemaster Throngus"],
[40319] = BB["Drahga Shodowburner"],
[40484] = BB["Erudax"],
[40586] = BB["Lady Naz'jar"],
[40765] = BB["Commander Ulthok"],
[40792] = "Neptulon",
[40825] = BB["Erunak Stonespeaker"],
[42188] = BB["Ozruk"],
[42333] = BB["High Priestess Azil"],
[4278] = BB["Commander Springvale"],
[43214] = BB["Slabhide"],
[43438] = BB["Corborus"],
[43612] = BB["High Prophet Barim"],
[43614] = BB["Lockmaw"],
[43778] = BB["Foe Reaper 5000"],
[43873] = BB["Altarius"],
[43875] = "Asaad",
[43878] = BB["Grand Vizier Ertan"],
[44577] = BB["General Husam"],
[44819] = BB["Siamat, Lord of South Wind"],
[46962] = BB["Baron Ashbury"],
[46963] = BB["Lord Walden"],
[46964] = BB["Lord Godfrey"],
[47162] = BB["Glubtok"],
[47297] = BB["Helix Gearbreaker"],
[47626] = BB["Admiral Ripsnarl"],
[47739] = BB["Cookie"],
[49541] = BB["Vanessa VanCleef"],
[41570] = BB["Magmaw"],
[42180] = BB["Omnitron Defense System"],
[41378] = BB["Maloriak"],
[41442] = BB["Atramedes"],
[43296] = BB["Chimaeron"],
[41376] = BB["Nefarian"],
[44600] = BB["Halfus Wyrmbreaker"],
[45992] = BB["Valiona"],
[43735] = BB["Ascendant Council"],
[43324] = BB["Cho'gall"],
[47120] = BB["Argaloth"],
[45871] = BB["Conclave of Wind"],
[46753] = BB["Al'Akir"],
[52155] = "High Priest Venoxis",
[52151] = "Bloodlord Mandokir",
[52271] = "Edge of Madness",
[52059] = "High Priestess Kilnara" ,
[52053] = "Zanzil" ,
[52148] = "Jin'do the Godbreaker",
[23574] = "Akil'zon" ,
[23576] = "Nalorakk" ,
[23578] = "Jan'alai" ,
[23577] = "Halazzi" ,
[24239] = "Hex Lord Malacrass",
[23863] = "Daakara"
}
--local menuFrame = CreateFrame("Frame", "ExampleMenuFrame", UIParent, "UIDropDownMenuTemplate")
--minimap symbolbutton
function RBMMinimapButton_OnDragStart(self)
MinimapButton_OnMouseUp(self);
if IsShiftKeyDown()then
self:SetScript("OnUpdate", RBMMinimapButton_OnUpdate);
self.Dragging = true;
RBMMinimapButton_OnLeave(self);
end
end
function RBMMinimapButton_OnDragStop(self)
if self.Dragging then
self:SetScript("OnUpdate", nil);
self:StopMovingOrSizing();
self.Dragging = nil;
self.Moving = nil;
end
end
local function prepSpell(tmsg)
local repstring = ""
local lastbegin = 1
local inSpell = false
for i=1,#tmsg,1 do
if tmsg:byte(i) == 93 then
inSpell = false
lastbegin = i
end
if inSpell then
if tmsg:byte(i) == 32 then
repstring = repstring.."_"
else
repstring = repstring..string.char(tmsg:byte(i))
end
end
if tmsg:byte(i) == 91 then
inSpell= true
repstring = repstring..tmsg:sub(lastbegin,i)
end
end
if lastbegin < #tmsg then
repstring = repstring..tmsg:sub(lastbegin);
end
return repstring
end
function RBMMinimapButton_OnUpdate(self)
local MapScale = Minimap:GetEffectiveScale();
local CX, CY = GetCursorPosition();
local X, Y = (Minimap:GetRight() - 70) * MapScale, (Minimap:GetTop() - 70) * MapScale;
local Dist = sqrt(math.pow(X - CX, 2) + math.pow(Y - CY, 2)) / MapScale;
local Scale = self:GetEffectiveScale();
if(Dist <= 90)and Minimap:IsVisible()then
if self.Moving then
self:StopMovingOrSizing();
self.Moving = nil;
end
local Angle = atan2(CY - Y, X - CX) - 90;
self:ClearAllPoints();
self:SetPoint("CENTER", Minimap, "TOPRIGHT", (sin(Angle) * 80 - 70) * MapScale / Scale, (cos(Angle) * 77 - 73) * MapScale / Scale);
rbm_minimapcords = { 2 , (sin(Angle) * 80 - 70) * MapScale / Scale, (cos(Angle) * 77 - 73) * MapScale / Scale }
elseif not self.Moving then
self:ClearAllPoints();
rbm_minimapcords = { 1 , CX / Scale, CY / Scale }
self:SetPoint("CENTER", UIParent, "BOTTOMLEFT",CX / Scale, CY / Scale);
self:StartMoving();
self.Moving = true;
end
end
function RBMMinimapButton_OnEnter(self)
if self.Dragging then
return;
end
GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT");
if lastboss ~= nil then
GameTooltip:AddLine("Rob Boss Mods - "..L["CURRENTBOSS"]..": "..boss_label[lastboss]);
else
GameTooltip:AddLine("Rob Boss Mods - "..L["CURRENTBOSS"]..": "..L["NOBOSS"]);
end
GameTooltip:AddLine(L["LEFTCLICK"],1,1,1);
GameTooltip:AddLine(L["RIGHTCLICK"],1,1,1);
GameTooltip:AddLine(L["DRAG"],1,1,1);
GameTooltip:Show();
end
function RBM_Tooltip_OnEnter(self)
GameTooltip:SetOwner(RBM_Mainframe, "ANCHOR_CURSOR");
GameTooltip:AddLine(L["CLOSE_OPT_DESC"],1,1,1);
GameTooltip:Show();
end
function RBM_Tooltip_OnLeave()
GameTooltip:Hide();
end
function RBMMinimapButton_OnLeave()
GameTooltip:Hide();
end
function RBMButton_OnLoad(self)
self:RegisterForClicks("LeftButtonUp","RightButtonUp");
self:RegisterForDrag("LeftButton");
self:SetScript("OnClick", RBMButton_OnClick);
self:SetScript("OnEnter", RBMMinimapButton_OnEnter);
self:SetScript("OnLeave", RBMMinimapButton_OnLeave);
self:SetScript("OnDragStart", RBMMinimapButton_OnDragStart);
self:SetScript("OnDragStop", RBMMinimapButton_OnDragStop);
end
--end of menu
local function checkUpdate()
SendAddonMessage( "RBMVersion", rbm_version, "GUILD" );
if UnitInParty("player") then
SendAddonMessage( "RBMVersion", rbm_version, "PARTY" );
end
end
local function resetLang()
StaticPopupDialogs["RBM_LANGC1"] = {
text = "RBM: In What language do you want the boss explanation to appear?",
button1 = "English",
button2 = "German",
OnAccept = function()
rbm_elang = "en"
StaticPopup_Show ("RBM_LANGCONFIRM")
end,
OnCancel = function()
rbm_elang = "de"
StaticPopup_Show ("RBM_LANGCONFIRM")
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
}
StaticPopupDialogs["RBM_LANGCONFIRM"] = {
text = "The Language change wont take effect until you restart UI. Restart UI now?",
button1 = "Reload UI",
button2 = "No, I'll do that later",
OnAccept = function()
ReloadUI();
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
}
StaticPopup_Show ("RBM_LANGC1")
end
local function spelllinkBreak(line)
local tag = false
local nline = ""
for i = 1, #line do
local c = line:sub(i,i)
if c == "[" then
tag = true
nline = nline..c
elseif c == "]" then
tag = false
nline = nline..c
elseif tag and c == " " then
nline = nline.."_"
else
nline = nline..c
end
end
local wordlist = string.gmatch(nline, "%S+")
local count = 1
local ret = {}
for word in wordlist do
ret[count] = string.gsub(word, "_", " ")
count = count +1
end
return ret
end
local function parseSpellID(text)
local s = text:find("SPELL")
if s == nil then
return text
end
local e = text:find(")",s)
local temps = text:sub(s,e)
local spellid = tonumber(temps:match("%d+"))
---
local s2 = text:find("SPELL",e)
if s2 == nil then
if e+1 > #text then
return text:sub(1,s-1)..GetSpellLink(spellid)
else
return text:sub(1,s-1)..GetSpellLink(spellid)..text:sub(e+1)
end
else
--rekursion
return text:sub(1,s-1)..GetSpellLink(spellid)..parseSpellID(text:sub(e+1))
end
end
local function getLastDeadBoss()
local _,_, encountersTotal,enN = GetInstanceLockTimeRemaining();
print(enN.."/"..encountersTotal);
for i= encountersTotal, 1, -1 do
local bname,asdf,BisKilled = GetInstanceLockTimeRemainingEncounter(i);
local toprint = i.." "..bname.." "
if BisKilled then toprint = toprint.."true" else toprint = toprint.."false" end
print(toprint);
if BisKilled then
print("tot");
if i < encountersTotal then
return i
else
for j=1,encountersTotal,1 do
_,_,isKilled2 = GetInstanceLockTimeRemainingEncounter(j);
if not isKilled2 then
return (isKilled2-1)
end
end
end
end
end
return 0
end
local function handler(msg, editbox)
if msg == "status" or msg == "state" then
if aktiv == 1 then
ChatFrame1:AddMessage(L["ENABLED"]);
else
ChatFrame1:AddMessage(L["DISABLED"]);
end
elseif msg == "off" or msg == "aus" then
aktiv = 0
elseif msg == "on" or msg == "ein" then
aktiv = 1
elseif msg == "check" then
checkUpdate();
elseif msg:find("setzahl") ~= nil then
local setv = tonumber(msg:sub(9));
mynumber = setv
elseif msg == "zahl" or msg == "number" then
ChatFrame1:AddMessage(mynumber);
elseif msg == "getlang" then
ChatFrame1:AddMessage("Language: "..rbm_elang);
elseif msg == "author" or msg == "autor" then
ChatFrame1:AddMessage(L["AUTHOR1"]);
ChatFrame1:AddMessage(L["AUTHOR2"]);
elseif msg == "test" then
--print(getLastDeadBoss());
print(RBM_Mainframe:IsVisible());
elseif msg == "checks" then
SendAddonMessage( "RBMCheck", "foo" , "GUILD" );
if GetNumPartyMembers() > 0 then
SendAddonMessage( "RBMCheck", "foo" , "PARTY" );
SendAddonMessage( "RBMCheck", "foo" , "RAID" );
end
elseif msg == "resetlang" then
resetLang();
elseif msg == "toggle" then
if RBM_Mainframe:IsVisible() then
RBM_Mainframe:Hide();
else
RBM_Mainframe:Show();
end
elseif msg == "show" then
RBM_Mainframe:Show();
elseif msg == "hide" then
RBM_Mainframe:Hide();
elseif msg == "minioff" then
rbm_showminimap = false
RBMMinimapButton:Hide()
elseif msg == "minion" then
rbm_showminimap = true
RBMMinimapButton:Show()
else
ChatFrame1:AddMessage("RobBossMods Version "..rbm_displayversion);
ChatFrame1:AddMessage(L["MENU_RESETLANG"]);
ChatFrame1:AddMessage(L["MENU_AUTHOR"]);
ChatFrame1:AddMessage(L["MENU_HINT1"]);
ChatFrame1:AddMessage(L["MENU_MINIMAP_OFF"]);
ChatFrame1:AddMessage(L["MENU_MINIMAP_ON"]);
ChatFrame1:AddMessage(L["MENU_FRAME_ON"]);
ChatFrame1:AddMessage(L["MENU_FRAME_OFF"]);
ChatFrame1:AddMessage(L["MENU_FRAME_TOGGLE"]);
end
end
local final_bosses = { 39705, 40484, 42333, 49541, 43875, 44819, 39378, 40792, 46964 , 52148, 23863}
local bosses = { 39665 , 39679, 39698, 39700, 39705 , -1 ,
39625, 40177, 40319, 40484, -1,
43438, 43214, 42188, 42333, -1,
47162, 47297, 43778, 47626, 47739, 49541, -1 ,
43878, 43873, 43875, -1 ,
44577, 43614, 43612, 44819, -1,
39425, 39428, 39788, 39587, 39731, 39732, 39378, -1,
40586, 40765, 40825, 40792, -1,
46962, 3887, 4278, 46963, 46964 , -1 ,
52155, 52151, 52271, 52059, 52053, 52148, -1 ,
23574, 23576, 23578, 23577, 24239, 23863, -1 }
-- Functions Section
local bosses_label
local function getType(ggx)
local B = tonumber(string.sub(ggx,5,5), 16);
local maskedB = B % 8;
return maskedB
end
local function getNPCId(ggg)
local B = tonumber(string.sub(ggg,-12,-9), 16);
local maskedB = B % 8;
return B
end
local function doBossPost(channel,reci)
if lastboss == nil then
StaticPopupDialogs["RBM_NOBOSS"] = {
text = L["NOBOSS"],
button1 = "okay",
timeout = 0,
whileDead = true,
hideOnEscape = true,
}
if channel ~= "WHISPER" then
StaticPopup_Show ("RBM_NOBOSS")
end
return
end
--bosses
local toPostString
if rbm_customTactics["T"..tostring(lastboss)] == nil then
toPostString = L["T"..tostring(lastboss)]
else
toPostString = rbm_customTactics["T"..tostring(lastboss)]
end
if channel == "MYSELF" then
ChatFrame1:AddMessage(L["TACTICS"]..boss_label[lastboss]..": ");
else
SendChatMessage(L["TACTICS"]..boss_label[lastboss]..": ", channel, nil, reci);
end
toPostString = parseSpellID(toPostString);
--announce an split
local announceStrings = {""}
for line in string.gmatch(toPostString,"[^\n]+") do
local iarr = spelllinkBreak(line)
for i=1,#iarr,1 do
local word = iarr[i]
if strlen(announceStrings[#announceStrings])+1+strlen(word) > 255 then
tinsert(announceStrings, word)
else
if strlen(announceStrings[#announceStrings]) > 0 then
announceStrings[#announceStrings] = announceStrings[#announceStrings].." "..word
else
announceStrings[#announceStrings] = word
end
end
end
tinsert(announceStrings, "")
end
for _, msg in ipairs(announceStrings) do
if channel == "MYSELF" then
ChatFrame1:AddMessage(msg);
else
SendChatMessage(msg, channel, nil, reci);
end
end
end
local function IsEndboss(bo)
local gefunden = false
for i,v in ipairs(final_bosses) do
if bo == v then
gefunden = true
end
end
return gefunden
end
--DEV
--ENDDEV
function RBM_tellHint()
if rbm_tellgrid ~= nil then
if rbm_tellgrid["hintonce"] == nil then
SendChatMessage(L["DONTKNOW"], "PARTY",nil,nil)
else
SendChatMessage(rbm_tellgrid["hintonce"], "PARTY",nil,nil)
end
else
SendChatMessage(L["DONTKNOW"], "PARTY",nil,nil)
end
end
local info = {}
function RBM_SetBossLabel()
if lastboss == nil then
print(L["NOBOSS"]);
RBM_CurrentBoss_Frame:SetText(L["NOBOSS"]);
else
RBM_CurrentBoss_Frame:SetText(boss_label[lastboss]);
end
end
local menuFrame2 = CreateFrame("Frame", "RBM_TitleDropDownMenuRight")
menuFrame2.displayMode = "MENU"
menuFrame2.initialize = function(self, level)
if not level then return end
wipe(info)
if level == 1 then
-- Create the title of the menu
info.isTitle = 1
info.text = "RobBossMods"
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
info.isTitle = 1
if lastboss == nil then
info.text = L["CURRENTBOSS"]..": "..L["NONE"]
else
info.text = L["CURRENTBOSS"]..": "..boss_label[lastboss]
end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
info.disabled = nil
info.isTitle = nil
info.notCheckable = nil
info.hasArrow = 1
for k,_ in pairs(zones) do
info.text = k
info.value = "N-"..k
UIDropDownMenu_AddButton(info, level)
end
info.isTitle = nil
info.text = "Raid"
info.value = "raid"
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
-- Close menu item
info.hasArrow = nil
info.value = nil
info.notCheckable = 1
info.text = CLOSE
info.func = self.HideMenu
UIDropDownMenu_AddButton(info, level)
elseif level == 2 then
if UIDROPDOWNMENU_MENU_VALUE == "raid" then
for k,_ in pairs(raid_zones) do
info.hasArrow = 1
info.text = k
info.value = "R-"..k
UIDropDownMenu_AddButton(info, level)
end
elseif UIDROPDOWNMENU_MENU_VALUE:sub(1,1) == "N" then
for k,v in pairs(zones[UIDROPDOWNMENU_MENU_VALUE:sub(3)]) do
info.text = boss_label[v]
info.func = function()
lastboss = v,
RBM_CurrentBoss_Frame:SetText(boss_label[v]);
CloseDropDownMenus()
end
UIDropDownMenu_AddButton(info, level)
end
end
elseif level == 3 then
for k,v in pairs(raid_zones[UIDROPDOWNMENU_MENU_VALUE:sub(3)]) do
info.text = boss_label[v]
info.func = function()
lastboss = v,
RBM_CurrentBoss_Frame:SetText(boss_label[v]);
CloseDropDownMenus()
end
UIDropDownMenu_AddButton(info, level)
end
end
end
function RBM_UncheckAll(self)
RBM_Check_Party:SetChecked(false);
RBM_Check_Guild:SetChecked(false);
RBM_Check_Myself:SetChecked(false);
RBM_Check_Officer:SetChecked(false);
self:SetChecked(true);
end
function RBMButton_OnClick(self, button)
if(button=="LeftButton")then
--nuFrame = CreateFrame("Frame", "ExampleMenuFrame", UIParent, "UIDropDownMenuTemplate")
--ToggleDropDownMenu(1, nil, menuFrame1, self:GetName(), 0, 0)
if RBM_Mainframe:IsVisible() then
RBM_Mainframe:Hide();
else
RBM_Mainframe:Show();
end
else
--ToggleDropDownMenu(1, nil menuFrame2, self:GetName(), 0, 0)
InterfaceOptionsFrame_OpenToCategory("RobBossMods");
end
end
function RBMButton1_OnClick(self, button)
ToggleDropDownMenu(1, nil, menuFrame2, self:GetName(), 0, 0)
end
function frame:OnEvent(event,...)
-- I log in and greet the guild, depending which time it is, see below
if event == "PLAYER_LOGIN" then
RegisterAddonMessagePrefix("RBMPing")
RegisterAddonMessagePrefix("RBMPong")
RegisterAddonMessagePrefix("RBMCheckA")
RegisterAddonMessagePrefix("RBMVersion")
RegisterAddonMessagePrefix("RBMCheck")
--if rbm_tellnextboss == nil then
rbm_tellnextboss = false
--end
if rbm_showminimap == nil then
rbm_showminimap = true
end
if rbm_telleveryboss == nil then
rbm_telleveryboss = false
end
if rbm_whispermode == nil then
rbm_whispermode = false
end
if rbm_tellgrid == nil then
rbm_tellgrid = {}
end
if rbm_showframe == nil then
rbm_showframe = false
end
if rbm_nevershow == nil then
rbm_nevershow = false
end
--[[if rbm_oncetold == nil and (rbm_elang=="de" or GetLocale()== "deDE") then
rbm_oncetold = 1
StaticPopupDialogs["RBM_ONCE"] = {
text = "Hallo an alle deutschen Spieler.\n\nIch habe ein persoenliches Anliegen. Ich (Magier) einen Horderaid.\nIch wuerde gern auf einen Server gehen, auf dem "..
"die Horde Seite nicht so leer ist und die Stimmung nicht ganz so kiddy like ist. \n\nDesweiteren ist es mir egal ob PVP oder PVE Server. Ich moechte maximal 2 mal in der Woche raiden. Am besten ware auch wenn ein Hunter oder Shami Heal Platz noch frei waere dann wuerde noch ein oder zwei Freunde mit kommen\n\n"..
"Solltet ihr also einen PVP oder PVE Server kennen, der auf Horde Seite gut gefuellt ist und es eine Gilde geben, die oben genannten Klassen sucht, waere es toll wenn ihr euch meldet unter [email protected]\n\ndetaillierte Bewerbungen schreiben wir dann natuerlich ( alle seit Classic Erfahrung)",
button1 = "OK",
--button2 = "No, I'll do that later",
timeout = 0,
whileDead = true,
hideOnEscape = true,
}
StaticPopup_Show ("RBM_ONCE")
end--]]
if rbm_showminimap then
RBMMinimapButton:Show()
else
RBMMinimapButton:Hide()
end
L = LibStub("AceLocale-3.0"):GetLocale("RobBossMods")
if rbm_minimapcords ~= nil then
if rbm_minimapcords[1] == 1 then
RBMMinimapButton:SetPoint("CENTER", UIParent, "BOTTOMLEFT",rbm_minimapcords[2], rbm_minimapcords[3]);
else
RBMMinimapButton:SetPoint("CENTER", Minimap, "TOPRIGHT", rbm_minimapcords[2], rbm_minimapcords[3]);
end
end
RBM_Mainframe_Init();
RBM_createBlizzOptions();
ldb = LibStub:GetLibrary("LibDataBroker-1.1")
dataobj = ldb:NewDataObject("RobBossMods", {
type = "launcher",
label = "Rob Boss Mods",
icon = "Interface\\Icons\\Spell_Nature_StormReach",
tooltiptext = "RobBossMods",
OnClick = function(clickedframe, button)
if button == "LeftButton" then
if RBM_Mainframe:IsVisible() then
RBM_Mainframe:Hide();
else
RBM_Mainframe:Show();
end
else
InterfaceOptionsFrame_OpenToCategory("RobBossMods");
end
end,
})
myname = UnitName("player");
lang = GetLocale();
if GetNumPartyMembers() > 0 then
aktiv = 1
SendAddonMessage( "RBMPing", mynumber, "PARTY" );
end
if rbm_elang == nil and lang == "enUS" then
StaticPopupDialogs["RBM_LANGC"] = {
text = "RBM: You run the UK or US Client. In What language do you want the boss explanation to appear?",
button1 = "English",
button2 = "German",
OnAccept = function()
rbm_elang = lang:sub(1,2)
StaticPopup_Show ("RBM_LANGCONFIRM")
end,
OnCancel = function()
rbm_elang = "de"
StaticPopup_Show ("RBM_LANGCONFIRM")
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
}
--hint to reloadui after changed the global var
StaticPopupDialogs["RBM_LANGCONFIRM"] = {
text = "The Language change wont take effect until you restart UI. Restart UI now?",
button1 = "Reload UI",
button2 = "No, I'll do that later",
OnAccept = function()
ReloadUI();
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
}
StaticPopup_Show ("RBM_LANGC")
elseif rbm_elang == nil and lang == "deDE" then
rbm_elang = "de"
end
elseif event == "INSTANCE_LOCK_START" then
--print(getLastDeadBoss());
elseif event == "PLAYER_REGEN_ENABLED" then
if rbm_showframe and (GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0) and precombat ~=nil then
RBM_Mainframe:Show();
end
incombat = false
elseif event == "PLAYER_REGEN_DISABLED" then
incombat = true
precombat = RBM_Mainframe:IsVisible();
RBM_Mainframe:Hide();
elseif event == "ZONE_CHANGED_NEW_AREA" then
local whereami = GetInstanceInfo();
local temp_zones = {}
local visited_place = false
for k,v in pairs(zones) do temp_zones[k] = v end
for k,v in pairs(raid_zones) do temp_zones[k] = v end
for k,_ in pairs(temp_zones) do
if k == whereami then
visited_place = true
if rbm_showframe then
RBM_Mainframe:Show();
end
local bossdown = 0
for k = 1,GetNumSavedInstances(),1 do
local name, id, reset, difficulty, locked, extended, instanceIDMostSig, isRaid, maxPlayers, difficultyName, numEncounters, encounterProgress = GetSavedInstanceInfo(k)
if (reset > 0 or locked) and encounterProgress > 0 and name == GetInstanceInfo() and encounterProgress < numEncounters then
bossdown = encounterProgress
checkUpdate();
ChatFrame1:AddMessage(name.." "..encounterProgress.."/"..numEncounters);
end
end
for i = 1, bossdown, 1 do
boss_dead[temp_zones[k][i]] = 1
end
lastboss = temp_zones[k][bossdown+1]
RBM_CurrentBoss_Frame:SetText(boss_label[temp_zones[k][bossdown+1]]);
ChatFrame1:AddMessage("RobBossMods: "..k.." loaded.");
havetotell = true
end
end
if not visited_place then
RBM_Mainframe:Hide();
end
--[[local whereami, itype = GetInstanceInfo();
-- 5 man instances
if itype == "party" then
if lastinstance == nil then
lastinstance = whereami
end
ChatFrame1:AddMessage(whereami.." "..itype.." "..lastinstance);
if lastinstance ~= whereami then
--reset the progressCounter
local bossdown = 0
lastboss = zones[whereami][bossdown+1]
if lastboss == nil then
lastboss = 0
ChatFrame1:AddMessage("RobBossMods: "..whereami.." not implemented. ");
else
ChatFrame1:AddMessage("RobBossMods: "..whereami.." loaded. ");
end
else
--count dead bosses
local encounterProgress = 0
local lastdead = nil
local limes = 0
if zones[whereami] ~= nil then
limes = #zones[whereami]
end
for k= limes, 1,-1 do
if boss_dead[zones[whereami][k]] --[[ == 1 then
encounterProgress = encounterProgress + 1
if lastdead == nil then
lastdead = k
end
end
end
if lastdead == nil then
lastdead = 0
end
if lastdead < limes and zones[whereami] ~= nil then
lastboss = zones[whereami][lastdead+1]
elseif lastdead >= limes and zones[whereami] ~= nil then
lastboss = zones[whereami][#zones[whereami]] --[[
end
if limes > 0 then
ChatFrame1:AddMessage("RobBossMods: "..whereami.." ("..encounterProgress.."/"..limes..") loaded. ");
else
ChatFrame1:AddMessage("RobBossMods: "..whereami.." not implemented (yet?). ");
end
end
elseif itype == "raid" then
for k,_ in pairs(raid_zones) do
if k == whereami then
local bossdown = 0
for k = 1,GetNumSavedInstances(),1 do
local name, id, reset, difficulty, locked, extended, instanceIDMostSig, isRaid, maxPlayers, difficultyName, numEncounters, encounterProgress = GetSavedInstanceInfo(k)
if (reset > 0 or locked) and encounterProgress > 0 and name == GetInstanceInfo() then
bossdown = encounterProgress
checkUpdate();
ChatFrame1:AddMessage(name.." "..encounterProgress.."/"..numEncounters);
end
end
for i = 1, bossdown, 1 do
boss_dead[raid_zones[k][i]]--[[ = 1
end
lastboss = raid_zones[k][bossdown+1]
ChatFrame1:AddMessage("RobBossMods: "..k.." loaded.");
havetotell = true
end
end
end--]]
elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then
local a,b,c,d,e,f,g,h = ...
if b == "UNIT_DIED" then
local nid = getNPCId(g);
--ChatFrame1:AddMessage(g.." ist gestorben ID "..nid);
local gefunden = false
for i,v in ipairs(bosses) do
if nid == v then
gefunden = true
boss_dead[nid] = 1
if IsEndboss(nid) and aktiv == 1 and rbm_tellnextboss then
SendChatMessage(boss_label[bosses[i]]..L["LASTBOSS"], "PARTY", nil, reci);
elseif nid ~= 47297 then
lastboss = bosses[i+1]
RBM_CurrentBoss_Frame:SetText(boss_label[bosses[i+1]]);
if aktiv == 1 and rbm_tellnextboss == true then
SendChatMessage(boss_label[bosses[i]]..L["BOSS_DEAD1"]..boss_label[bosses[i+1]]..L["BOSS_DEAD2"], "PARTY", nil, reci);
end
end
if bosses[i] == 47626 then
lastboss = 47739
RBM_CurrentBoss_Frame:SetText(boss_label[47739]);
end
end
end
if gefunden == false then
if nid == 42172 and aktiv == 1 and rbm_tellnextboss then
SendChatMessage(L["S_OZUMAT"], "PARTY", nil, reci);
elseif nid == 40788 and aktiv == 1 and rbm_tellnextboss then
lastboss = 40792
RBM_CurrentBoss_Frame:SetText(boss_label[40792]);
SendChatMessage(L["S_GHUR"], "PARTY", nil, reci);
elseif nid == 47296 and aktiv == 1 and rbm_tellnextboss then
lastboss = 43778
RBM_CurrentBoss_Frame:SetText(boss_label[43778]);
SendChatMessage(L["S_HELIX"], "PARTY", nil, reci);
end
end
end
elseif event == "PARTY_MEMBERS_CHANGED" then
already_told = {}
if GetNumPartyMembers() == 0 then
boss_dead = {}
aktiv = 1
--ChatFrame1:AddMessage("RobBossMods: aktiv")
else
aktiv = 1
--aushandeln
SendAddonMessage( "RBMPing", mynumber, "PARTY" );
partymember = GetNumPartyMembers()
end
elseif event == "CHAT_MSG_ADDON" then
local pref,msg1,kanal,sender = ...
--ChatFrame1:AddMessage(pref.." "..msg1.." "..kanal);
--if sender == "RobBossMods" then
if pref == "RBMPing" then
lastping = GetTime();
--ChatFrame1:AddMessage("Empfange Ping mache pong" );
aktiv = 1
SendAddonMessage( "RBMPong", mynumber, "PARTY" );
elseif pref == "RBMPong" then
--ChatFrame1:AddMessage("Empfange pong von "..sender.." mit Wert: "..tonumber(msg1) );
--auswerten
local rndtime = tonumber(msg1)
if tonumber(msg1) < mynumber then
--ChatFrame1:AddMessage("schalte mich ab");
aktiv = 0
else
--ChatFrame1:AddMessage("bleibe aktiv");
end
elseif pref == "RBMCheckA" then
local wer,was = string.split("#",msg1)
if wer == myname then
ChatFrame1:AddMessage(sender.."("..kanal.."): "..was);
end
elseif pref == "RBMCheck" then
SendAddonMessage("RBMCheckA", sender.."#"..tostring(rbm_version), kanal);
--update
elseif pref == "RBMVersion" and sender ~= myname then
--message("L: "..rbm_version.." R: "..tonumber(msg1));
if tonumber(msg1) > rbm_version and update_told == 0 then