forked from kahluamods/kore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKKoreKonfer.lua
752 lines (640 loc) · 19.6 KB
/
KKoreKonfer.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
--[[
KahLua Kore - loot distribution handling.
WWW: http://kahluamod.com/kore
Git: https://github.com/kahluamods/kore
IRC: #KahLua on irc.freenode.net
E-mail: [email protected]
Please refer to the file LICENSE.txt for the Apache License, Version 2.0.
Copyright 2008-2020 James Kean Johnston. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]
local KKOREKONFER_MAJOR = "KKoreKonfer"
local KKOREKONFER_MINOR = 4
local KK, oldminor = LibStub:NewLibrary(KKOREKONFER_MAJOR, KKOREKONFER_MINOR)
if (not KK) then
return
end
KK.debug_id = KKOREKONFER_MAJOR
local K, KM = LibStub:GetLibrary("KKore")
assert(K, "KKoreKonfer requires KKore")
assert(tonumber(KM) >= 4, "KKoreKonfer requires KKore r4 or later")
K.RegisterExtension(KK, KKOREKONFER_MAJOR, KKOREKONFER_MINOR)
local KUI, KM = LibStub:GetLibrary("KKoreUI")
assert(KUI, "KKoreKonfer requires KKoreUI")
assert(tonumber(KM) >= 4, "KKoreKonfer requires KKoreUI r4 or later")
local H, KM = LibStub:GetLibrary("KKoreHash")
assert(H, "KKoreKonfer requires KKoreHash")
assert(tonumber(KM) >= 4, "KKoreKonfer requires KKoreHash r4 or later")
local KRP, KM = LibStub:GetLibrary("KKoreParty")
assert(KRP, "KKoreKonfer requires KKoreParty")
assert(tonumber(KM) >= 4, "KKoreKonfer requires KKoreParty r4 or later")
local L = LibStub("AceLocale-3.0"):GetLocale("KKore")
local function debug(lvl,...)
K.debug("kore", lvl, ...)
end
KK.addons = {}
KK.valid_callbacks = {
}
local printf = K.printf
local tsort = table.sort
local tinsert = table.insert
local strfmt = string.format
local MakeFrame= KUI.MakeFrame
-- A static table with the list of possible player roles (from a konfer point
-- of view - not to be confused with the in-game raid or player roles). This
-- is used to restrict certain items to a particular type of raider. We also
-- define constants for each role name.
KK.ROLE_UNSET = 0
KK.ROLE_HEALER = 1
KK.ROLE_MELEE = 2
KK.ROLE_RANGED = 3
KK.ROLE_CASTER = 4
KK.ROLE_TANK = 5
KK.rolenames = {
[KK.ROLE_UNSET] = L["Not Set"],
[KK.ROLE_HEALER] = L["Healer"],
[KK.ROLE_MELEE] = L["Melee DPS"],
[KK.ROLE_RANGED] = L["Ranged DPS"],
[KK.ROLE_CASTER] = L["Spellcaster"],
[KK.ROLE_TANK] = L["Tank"],
}
-- The different configuration types supported, mainly for intra-mod comms.
-- Currently there is only need for two types: guild and PUG.
KK.CFGTYPE_GUILD = 1
KK.CFGTYPE_PUG = 2
--
-- Global list of all Konfer modules.
--
_G["KKonfer"] = _G["KKonfer"] or {}
local KKonfer = _G["KKonfer"]
KKonfer["..."] = KKonfer["..."] or {}
local function check_duplicate_modules(me, insusp)
local kchoice = KKonfer["..."]
local tstr = strfmt("%s (v%s) - %s", me.title, me.version, me.desc)
if (not insusp and kchoice.selected and kchoice.selected ~= me.handle) then
KK.SetSuspended(me.handle, true)
return
end
local nactive = 0
for k,v in pairs(KKonfer) do
if (k ~= "...") then
if (not KK.IsSuspended(k)) then
if (KK.OpenOnLoot(k)) then
nactive = nactive + 1
end
end
end
end
if (nactive <= 1) then
return
end
--
-- We have more than one KahLua Konfer module that is active for raids
-- and set to auto-open on loot. We need to select which one is going to
-- be the active one. Pop up the Konfer selection dialog.
--
if (insusp) then
kchoice.actdialog.which:SetText(tstr)
kchoice.actdialog.mod = me.handle
kchoice.seldialog:Hide()
kchoice.actdialog:Show()
else
kchoice.seldialog.RefreshList(me.party, me.raid)
kchoice.actdialog:Hide()
kchoice.seldialog:Show()
end
end
function KK.IsSuspended(handle)
if (not handle or handle == "") then
return true
end
local me = KKonfer[handle]
if (not me) then
return true
end
return me.is_suspended(handle) or false
end
function KK.SetSuspended(handle, onoff)
if (not handle or handle == "") then
return
end
local me = KKonfer[handle]
if (not me) then
return
end
local cs = me.is_suspended(handle) or false
local ts = onoff or false
if (cs == ts) then
return
end
me.set_suspended(handle, ts)
local ds = L["KONFER_SUSPENDED"]
if (not ts) then
ds = L["KONFER_ACTIVE"]
check_duplicate_modules(me, true)
end
K.printf(K.icolor, "%s: |cffffffff%s|r.", me.title, ds)
end
function KK.OpenOnLoot(handle)
if (not handle or handle == "") then
return false
end
local me = KKonfer[handle]
if (not me) then
return false
end
return me.open_on_loot(handle) or false
end
local function create_konfer_dialogs()
local kchoice = KKonfer["..."]
assert(kchoice)
local ks = "|cffff2222<" .. K.KAHLUA ..">|r"
local arg = {
x = "CENTER", y = "MIDDLE", name = "KKonferModuleSelector",
title = strfmt(L["KONFER_SEL_TITLE"], ks),
canmove = true,
canresize = false,
escclose = true,
xbutton = false,
width = 450,
height = 180,
framelevel = 64,
titlewidth = 300,
border = true,
blackbg = true,
}
kchoice.seldialog = KUI:CreateDialogFrame(arg)
local ksd = kchoice.seldialog
arg = {
x = "CENTER", y = 0, width = 400, height = 96, autosize = false,
font = "GameFontNormal",
text = strfmt(L["KONFER_SEL_HEADER"], ks),
}
ksd.header = KUI:CreateStringLabel(arg, ksd)
arg = {
name = "KKonferModSelDD",
x = 35, y = -105, dwidth = 350, justifyh = "CENTER",
mode = "SINGLE", itemheight = 16, items = KUI.emptydropdown,
}
ksd.seldd = KUI:CreateDropDown(arg, ksd)
ksd.seldd:Catch("OnValueChanged", function(this, evt, val, usr)
if (not usr) then
return
end
local kkonfer = _G["KKonfer"]
assert(kkonfer)
for k,v in pairs(kkonfer) do
if (k ~= "..." and k ~= val) then
KK.SetSuspended(k, true)
end
end
KK.SetSuspended(val, false)
kkonfer["..."].seldialog:Hide()
ksd.selected = val
end)
ksd.RefreshList = function(party, raid)
local kkonfer = _G["KKonfer"] or {}
local items = {}
local kd = kkonfer["..."].seldialog.seldd
tinsert(items, {
text = L["KONFER_SEL_DDTITLE"], value = "", title = true,
})
for k,v in pairs(kkonfer) do
if (k ~= "...") then
if ((party and v.party) or (raid and v.raid)) then
local item = {
text = strfmt("%s (v%s) - %s", v.title, v.version, v.desc),
value = k, checked = false,
}
tinsert(items, item)
end
end
end
kd:UpdateItems(items)
kd:SetValue("", true)
end
arg = {
x = "CENTER", y = "MIDDLE", name = "KKonferModuleDisable",
title = strfmt(L["KONFER_SEL_TITLE"], ks),
canmove = true,
canresize = false,
escclose = false,
xbutton = false,
width = 450,
height = 240,
framelevel = 64,
titlewidth = 300,
border = true,
blackbg = true,
okbutton = {},
cancelbutton = {},
}
kchoice.actdialog = KUI:CreateDialogFrame(arg)
kchoice.actdialog:Catch("OnAccept", function(this, evt)
for k,v in pairs(KKonfer) do
if (k ~= "..." and k ~= this.mod) then
KK.SetSuspended(k, true)
end
end
end)
arg = {
x = "CENTER", y = 0, autosize = false, border = true,
width = 400, font = "GameFontHighlight", justifyh = "CENTER",
}
kchoice.actdialog.which = KUI:CreateStringLabel(arg, kchoice.actdialog)
arg = {
x = "CENTER", y = -24, width = 400, height = 128, autosize = false,
font = "GameFontNormal",
text = strfmt(L["KONFER_SUSPEND_OTHERS"], ks),
}
kchoice.actdialog.msg = KUI:CreateStringLabel(arg, kchoice.actdialog)
end
function KK:OnLateInit()
if (KK.initialised) then
return
end
create_konfer_dialogs()
KK.initialised = true
end
function KK.TimeStamp()
local tDate = date("*t")
local mo = tDate["month"]
local dy = tDate["day"]
local yr = tDate["year"]
local hh, mm = GetGameTime()
return strfmt("%04d%02d%02d%02d%02d", yr, mo, dy, hh, mm), yr, mo, dy, hh, mm
end
function KK.CreateNewID(strtohash)
local _, y, mo, d, h, m = KK.TimeStamp()
local ts = strfmt("%02d%02d%02d", y-2000, mo, d)
local crc = H:CRC32(ts, nil, false)
crc = H:CRC32(tostring(h), crc, false)
crc = H:CRC32(tostring(m), crc, false)
crc = H:CRC32(strtohash, crc, true)
ts = ts .. K.hexstr(crc)
return ts
end
function KK.IsSenderMasterLooter(sender)
if (KRP.in_party and KRP.master_looter and KRP.master_looter == sender) then
return true
end
return false
end
function KK.OldProtoDialog(self)
if (self.old_proto) then
return
end
self.old_proto = true
local arg = {
name = self.konfer.handle .. "OldProtoDialog",
x = "CENTER", y = "MIDDLE", border = true, blackbg = true,
okbutton = { text = K.OK_STR }, canmove = false, canresize = false,
escclose = false, width = 450, height = 100, title = self.title,
}
local dlg = KUI:CreateDialogFrame(arg)
dlg.OnAccept = function(this)
this:Hide()
end
dlg.OnCancel = function(this)
this:Hide()
end
arg = {
x = 8, y = -10, width = 410, height = 64, autosize = false,
color = { r = 1, g = 0, b = 0, a = 1},
text = self.konfer.title .. ": " .. strfmt(L["your version of %s is out of date. Please update it."], self.konfer.title), font = "GameFontNormal",
justifyv = "TOP",
}
dlg.str1 = KUI:CreateStringLabel(arg, dlg)
if (self.mainwin and self.mainwin:IsShown()) then
self.mainwin:Hide()
end
dlg:Show()
end
--
-- Communications functions that are mixed in to the calling mod. This allows
-- these functions to look up the calling mod for various parameters which in
-- turn asllows us to share these functions with all Konfer mods. The only
-- caveat is that these functions must be called thus:
-- mod:FunctionName()
-- so that the base mod is passed along as self.
--
local function send_addon_msg(self, cfg, cmd, prio, dist, target, ...)
local konf = self.konfer
assert(konf)
local proto = self.protocol
local rcmd = cmd
if (type(cmd) == "table") then
assert(cmd.proto)
assert(cmd.cmd)
proto = cmd.proto
rcmd = cmd.cmd
end
local cfg = cfg or self.currentid or "0"
local prio = prio or "BULK"
local fs = strfmt("%02x:%s:%s:", proto, rcmd, cfg)
local crc = H:CRC32(fs, nil, false)
local ndata = K.Serialise(...)
crc = H:CRC32(ndata, crc, true)
fs = fs .. K.hexstr(crc) .. ":" .. ndata
K:SendCommMessage(self.CHAT_MSG_PREFIX, fs, dist, target, prio)
end
local function send_to_raid_or_party_am_c(self, cfg, cmd, prio, ...)
local cfgt = KK.CFGTYPE_PUG
local cfg = cfg or self.currentid
if (cfg and self.configs and self.configs[cfg]) then
cfgt = self.configs[cfg].cfgtype or KK.CFGTYPE_PUG
end
local dist = nil
if (cfgt == KK.CFGTYPE_GUILD and K.player.is_guilded) then
dist = "GUILD"
else
if (KRP.in_party and self.konfer.party) then
dist = "PARTY"
end
if (KRP.in_raid and self.konfer.raid) then
dist = "RAID"
end
end
if (not dist) then
return
end
send_addon_msg(self, cfg, cmd, prio, dist, nil, ...)
end
local function send_to_raid_or_party_am(self, cmd, prio, ...)
send_to_raid_or_party_am_c(self, nil, cmd, prio, ...)
end
local function send_to_guild_am_c(self, cfg, cmd, prio, ...)
if (K.player.is_guilded) then
send_addon_msg(self, cfg, cmd, prio, "GUILD", nil, ...)
end
end
local function send_to_guild_am(self, cmd, prio, ...)
if (K.player.is_guilded) then
send_addon_msg(self, nil, cmd, prio, "GUILD", nil, ...)
end
end
local function send_whisper_am_c(self, cfg, target, cmd, prio, ...)
send_addon_msg(self, cfg, cmd, prio, "WHISPER", target, ...)
end
local function send_whisper_am(self, target, cmd, prio, ...)
send_addon_msg(self, nil, cmd, prio, "WHISPER", target, ...)
end
local function send_plain_message(self, text)
if (not KRP.in_party) then
return
end
local dist = "PARTY"
if (KRP.in_raid) then
dist = "RAID"
end
SendChatMessage(text, dist)
end
local function send_guild_message(self, text)
if (not K.player.is_guilded) then
return
end
SendChatMessage(text, "GUILD")
end
local function send_whisper_message(self, text, target)
SendChatMessage(text, "WHISPER", nil, target)
end
local function send_raid_warning(self, text)
if (KRP.in_raid) then
if (KRP.is_aorl) then
SendChatMessage(text, "RAID_WARNING")
else
SendChatMessage("{skull}{skull} " .. text .. " {skull}{skull}", "RAID")
end
else
SendChatMessage("{skull}{skull} " .. text .. " {skull}{skull}", "PARTY")
end
end
--
-- Shared dialog for version checks.
--
local function vlist_newitem(objp, num)
local kk = objp:GetParent():GetParent():GetParent().kkmod
local bname = kk.konfer.handle .. "KKVCheckListButton" .. tostring(num)
local rf = MakeFrame("Button", bname, objp.content)
local nfn = "GameFontNormalSmallLeft"
local hfn = "GameFontHighlightSmallLeft"
local htn = "Interface/QuestFrame/UI-QuestTitleHighlight"
rf:SetWidth(325)
rf:SetHeight(16)
rf:SetHighlightTexture(htn, "ADD")
local who = rf:CreateFontString(nil, "BORDER", nfn)
who:ClearAllPoints()
who:SetPoint("TOPLEFT", rf, "TOPLEFT", 0, -2)
who:SetPoint("BOTTOMLEFT", rf, "BOTTOMLEFT", 0, -2)
who:SetWidth(168)
who:SetJustifyH("LEFT")
who:SetJustifyV("TOP")
rf.who = who
local version = rf:CreateFontString(nil, "BORDER", nfn)
version:ClearAllPoints()
version:SetPoint("TOPLEFT", who, "TOPRIGHT", 4, 0)
version:SetPoint("BOTTOMLEFT", who, "BOTTOMRIGHT", 4, 0)
version:SetWidth(95)
version:SetJustifyH("LEFT")
version:SetJustifyV("TOP")
rf.version = version
local raid = rf:CreateFontString(nil, "BORDER", nfn)
raid:ClearAllPoints()
raid:SetPoint("TOPLEFT", version, "TOPRIGHT", 4, 0)
raid:SetPoint("BOTTOMLEFT", version, "BOTTOMRIGHT", 4, 0)
raid:SetWidth(50)
raid:SetJustifyH("LEFT")
raid:SetJustifyV("TOP")
rf.raid = raid
rf.SetText = function(self, who, vers, raid)
self.who:SetText(who)
self.version:SetText(vers)
if (raid) then
self.raid:SetText(K.YES_STR)
else
self.raid:SetText(K.NO_STR)
end
end
return rf
end
local function vlist_setitem(objp, idx, slot, btn)
local kk = objp:GetParent():GetParent():GetParent().kkmod
if (not kk or not kk.vcdlg or not kk.vcdlg.vcreplies) then
return
end
local vcent = kk.vcdlg.vcreplies[idx]
if (not vcent) then
return
end
local name = kk.shortaclass(vcent)
local vers = tonumber(vcent.version)
local fn = kk.green
if (vers < kk.version) then
fn = kk.red
end
btn:SetText(name, fn(tostring(vers)), vcent.raid)
btn:SetID(idx)
btn:Show()
end
local function sort_vcreplies(self)
tsort(self.vcdlg.vcreplies, function(a, b)
if (a.raid and not b.raid) then
return true
end
if (b.raid and not a.raid) then
return false
end
if (a.version < b.version) then
return true
end
if (b.version < a.version) then
return false
end
return strlower(a.name) < strlower(b.name)
end)
self.vcdlg.slist.itemcount = #self.vcdlg.vcreplies
self.vcdlg.slist:UpdateList()
end
local function kk_version_check(self)
local vcdlg = self.vcdlg
if (not vcdlg) then
local ks = "|cffff2222<" .. K.KAHLUA ..">|r"
local arg = {
x = "CENTER", y = "MIDDLE",
name = self.konfer.handle .. "KKVersionCheck",
title = strfmt(L["VCTITLE"], ks, self.konfer.title),
canmove = true,
canresize = false,
escclose = true,
xbutton = false,
width = 400,
height = 350,
framelevel = 64,
titlewidth = 270,
border = true,
blackbg = true,
okbutton = { text = K.OK_STR },
}
vcdlg = KUI:CreateDialogFrame(arg)
vcdlg.kkmod = self
vcdlg.OnAccept = function(this)
this:Hide()
if (this.mainshown) then
this.kkmod.mainwin:Show()
end
this.mainshown = nil
this.vcreplies = nil
end
vcdlg.OnCancel = vcdlg.OnAccept
arg = {
x = 5, y = 0, text = L["Who"], font = "GameFontNormal",
}
vcdlg.str1 = KUI:CreateStringLabel(arg, vcdlg)
arg.x = 175
arg.text = L["Version"]
vcdlg.str2 = KUI:CreateStringLabel(arg, vcdlg)
arg.x = 275
arg.text = L["In Raid"]
vcdlg.str3 = KUI:CreateStringLabel(arg, vcdlg)
vcdlg.sframe = MakeFrame("Frame", nil, vcdlg.content)
vcdlg.sframe:ClearAllPoints()
vcdlg.sframe:SetPoint("TOPLEFT", vcdlg.content, "TOPLEFT", 5, -18)
vcdlg.sframe:SetPoint("BOTTOMRIGHT", vcdlg.content, "BOTTOMRIGHT", 0, 0)
arg = {
name = self.konfer.handle .. "KKVersionScrollList",
itemheight = 16, newitem = vlist_newitem, setitem = vlist_setitem,
selectitem = function(objp, idx, slot, btn, onoff) return end,
highlightitem = function(objp, idx, slot, btn, onoff)
return KUI.HighlightItemHelper(objp, idx, slot, btn, onoff)
end,
}
vcdlg.slist = KUI:CreateScrollList(arg, vcdlg.sframe)
self.vcdlg = vcdlg
end
--
-- Populate the expected replies with all current raid members and if we
-- are in a guild, with all currently online guild members. We set the
-- version to 0 to indicate no reply yet. As replies come in we change the
-- version number and re-sort and refresh the list.
--
vcdlg.vcreplies = {}
if (KRP.players) then
for k, v in pairs(KRP.players) do
local vce = { name = k, class = v.class, version = 0, raid = true }
if (k == K.player.name) then
vce.version = self.version
end
tinsert(vcdlg.vcreplies, vce)
end
end
if (K.player.is_guilded) then
for k, v in pairs(K.guild.roster.id) do
if ((not KRP.players or not KRP.players[v.name]) and v.online) then
local vce = { name = v.name, class = v.class, version = 0, raid = false }
if (v.name == K.player.name) then
vce.version = self.version
end
tinsert(vcdlg.vcreplies, vce)
end
end
end
sort_vcreplies(self)
vcdlg.mainshown = self.mainwin:IsShown()
self.mainwin:Hide()
vcdlg:Show()
self:SendAM({proto = 2, cmd = "VCHEK"}, nil)
if (K.player.is_guilded) then
self:SendGuildAM({proto = 2, cmd = "VCHEK"}, nil)
end
end
function kk_version_check_reply(self, sender, version)
if (not self.vcdlg or not self.vcdlg.vcreplies) then
return
end
for k, v in pairs(self.vcdlg.vcreplies) do
if (v.name == sender) then
v.version = version
sort_vcreplies(self)
return
end
end
end
--
-- Register a new addon (like KSK) with the base Konfer system. The single
-- argument to this function is a table with various parameters, as described
-- below. Returns a handle to the mod, which is a table.
--
function KK.RegisterKonfer(kmod)
local targ = kmod.konfer
if (not targ or type(targ) ~= "table") then
error("Invalid call to RegisterKonfer.", 2)
end
local me = KKonfer[targ.handle]
if (me ~= nil) then
return me
end
assert(kmod.protocol)
kmod.konfer = targ
kmod.CSendAM = send_to_raid_or_party_am_c
kmod.SendAM = send_to_raid_or_party_am
kmod.CSendGuildAM = send_to_guild_am_c
kmod.SendGuildAM = send_to_guild_am
kmod.CSendWhisperAM = send_whisper_am_c
kmod.SendWhisperAM = send_whisper_am
kmod.SendText = send_plain_message
kmod.SendGuildText = send_guild_message
kmod.SendWhisper = send_whisper_message
kmod.SendWarning = send_raid_warning
kmod.VersionCheck = kk_version_check
kmod.VersionCheckReply = kk_version_check_reply
KKonfer[targ.handle] = targ
check_duplicate_modules(targ, false)
end