-
Notifications
You must be signed in to change notification settings - Fork 1
/
GDKPd.lua
3541 lines (3518 loc) · 133 KB
/
GDKPd.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
-- GLOBALS: GDKPd, GDKPd_PotData, GDKPd_Anchor, GDKPd_BalanceData, SlashCmdList, SLASH_GDKPD1, SLASH_GDKPD2
-- fetch all used functions into locals to improve performance
local table, tinsert, tremove, pairs, ipairs, unpack, math, tostring, tonumber, select, _G, strlen, setmetatable, string, print, next, type, rawget, date =
table, tinsert, tremove, pairs, ipairs, unpack, math, tostring, tonumber, select, _G, strlen, setmetatable, string, print, next, type, rawget, date
local SendAddonMessage, SendChatMessage, UnitIsRaidOfficer, UnitIsUnit, UnitIsGroupLeader, GetMasterLootCandidate, GetNumLootItems, GetLootSlotLink, GiveMasterLoot, UnitName, GetUnitName, CreateFrame, GetCVar, GetCVarBool, GetTime, StaticPopup_Show, GetItemInfo, GameTooltip, LibStub, ITEM_QUALITY_COLORS, InCombatLockdown, ERR_TRADE_COMPLETE, GetPlayerTradeMoney, GetTargetTradeMoney, GetItemIcon, ClearCursor, GetNumGroupMembers, GetRaidRosterInfo, GetLootThreshold, GetLootSlotType, GetLootSlotInfo, EditBox_HandleTabbing, GetCursorInfo, PickupItem, IsInRaid, IsInGroup, SendMail, SetSendMailMoney, ClearSendMail =
C_ChatInfo.SendAddonMessage, SendChatMessage, UnitIsRaidOfficer, UnitIsUnit, UnitIsGroupLeader, GetMasterLootCandidate, GetNumLootItems, GetLootSlotLink, GiveMasterLoot, UnitName, GetUnitName, CreateFrame, GetCVar, GetCVarBool, GetTime, StaticPopup_Show, GetItemInfo, GameTooltip, LibStub, ITEM_QUALITY_COLORS, InCombatLockdown, ERR_TRADE_COMPLETE, GetPlayerTradeMoney, GetTargetTradeMoney, GetItemIcon, ClearCursor, GetNumGroupMembers, GetRaidRosterInfo, GetLootThreshold, GetLootSlotType, GetLootSlotInfo, EditBox_HandleTabbing, GetCursorInfo, PickupItem, IsInRaid, IsInGroup, SendMail, SetSendMailMoney, ClearSendMail
local _
local UIParent, MailFrame =
UIParent, MailFrame
-- Fetch all the different realm separators into a table
local REALM_SEPARATOR_LIST = {}
for s in REALM_SEPARATORS:gmatch(".") do tinsert(REALM_SEPARATOR_LIST,s) end
-- table handling to prevent any memory leakage from accumulating.
local emptytable = select(2,...).emptytable
local DEBUGFORCEVERSION
--[===[@debug@
DEBUGFORCEVERSION="2.0.0"
--@end-debug@]===]
-- fetch locale data
local L = LibStub("AceLocale-3.0"):GetLocale("GDKPd")
-- versioning info
local VERSIONING_STRINGS = {
VERSION_NONFUNCTIONAL = L["This version of GDKPd was never functional due to internal errors."],
INCOMPATIBLE_AUCTIONSTART = L["This version will be unable to recognize auctions started by you."],
INCOMPATIBLE_DISTRIBUTE = L["This version's player balance window will be unable to recognize distributions by you."],
INCOMPATIBLE_AUCTIONCANCEL = L["This version will be unable to recognize auctions cancelled by you."],
INCOMPATIBLE_VERSIONCHECK = L["This version will be unable to recognize version check requests by you. Version check requests sent by this version of GDKPd will not be answered."],
}
local COMPATIBLE_VERSIONS = {
["2.0.0"]=true,
}
local INCOMPATIBLE_VERSIONS = {
["beta-1"]={"INCOMPATIBLE_AUCTIONSTART","INCOMPATIBLE_AUCTIONCANCEL","INCOMPATIBLE_DISTRIBUTE"},
}
-- define a few old API functions that I can't be bothered to replace everywhere
local function IsRaidOfficer()
return IsInRaid() and UnitIsRaidOfficer("player")
end
local function IsRaidLeader()
return IsInRaid() and UnitIsGroupLeader("player")
end
local function LootSlotIsItem(i)
return (GetLootSlotType(i) == 1)
end
-- static popup dialog definition
StaticPopupDialogs["GDKPD_RESETPOT"] = {
text=L["Do you want to save your pot or reset without saving? You can also add a note to the pot."],
button1=SAVE.." & "..RESET,
button2=RESET,
button3=CANCEL,
hasEditBox=true,
EditBoxOnEnterPressed=function(self) self:GetParent().button1:Click() end,
OnAccept=function(self)
tinsert(GDKPd_PotData.history, {size=GDKPd_PotData.potAmount, date=date(), items=GDKPd_PotData.curPotHistory, note=(strlen(self.editBox:GetText()) > 0 and self.editBox:GetText())})
GDKPd_PotData.potAmount = 0
GDKPd_PotData.prevDist = 0
GDKPd_PotData.curPotHistory = {}
GDKPd_PotData.playerBalance = setmetatable({},{__index=function() return 0 end})
GDKPd.status:Update()
GDKPd.balance:Update()
if GDKPd.history:IsShown() then
GDKPd.history:Update()
end
end,
OnCancel=function(self)
GDKPd_PotData.potAmount = 0
GDKPd_PotData.prevDist = 0
GDKPd_PotData.curPotHistory = {}
GDKPd_PotData.playerBalance = setmetatable({},{__index=function() return 0 end})
GDKPd.status:Update()
GDKPd.balance:Update()
end,
timeout=0,
}
StaticPopupDialogs["GDKPD_SLIMMLWARN"] = {
text=L["WARNING!\n\nIf you use the slim bidding frame, you will be unable to cancel auctions and revert bids!\nAre you certain you want to do this?"],
button1=YES,
button2=NO,
OnShow=function(self)
--elevate it above aceconfig
self:SetFrameStrata("FULLSCREEN_DIALOG")
self.button1:SetFrameLevel(10000)
self.button2:SetFrameLevel(10000)
end,
OnAccept=function()
GDKPd.opt.slimML = true
GDKPd.opt.slimMLConfirmed=true
end,
OnHide=function(self)
self:SetFrameStrata("DIALOG")
end,
timeout=0,
hideOnEscape=true,
whileDead=true,
showAlert=true,
cancels="GDKPD_SLIMMLWARN",
}
StaticPopupDialogs["GDKPD_ADDTOPOT"] = {
text=L["Enter the amount you want to add to the pot:"],
button1=ADD,
button2=CANCEL,
hasEditBox=true,
OnShow=function(self)
self.button1:Disable()
end,
EditBoxOnEnterPressed=function(self) self:GetParent().button1:Click() end,
EditBoxOnTextChanged = function(self)
if strlen(self:GetText()) > 0 then
self:GetParent().button1:Enable()
else
self:GetParent().button1:Disable()
end
end,
OnAccept=function(self)
GDKPd_PotData.potAmount = (tonumber(self.editBox:GetText()) or 0)+GDKPd_PotData.potAmount
tinsert(GDKPd_PotData.curPotHistory, tonumber(self.editBox:GetText()) or 0)
GDKPd.status:Update()
end,
timeout=0,
whileDead=true,
}
StaticPopupDialogs["GDKPD_REMFROMPOT"] = {
text=L["Enter the amount you want to subtract from the pot:"],
button1=REMOVE,
button2=CANCEL,
hasEditBox=true,
OnShow=function(self)
self.button1:Disable()
end,
EditBoxOnEnterPressed=function(self) self:GetParent().button1:Click() end,
EditBoxOnTextChanged=function(self)
if strlen(self:GetText()) > 0 then
self:GetParent().button1:Enable()
else
self:GetParent().button1:Disable()
end
end,
OnAccept = function(self)
GDKPd_PotData.potAmount = math.max(0, GDKPd_PotData.potAmount-(tonumber(self.editBox:GetText()) or 0))
tinsert(GDKPd_PotData.curPotHistory, (tonumber(self.editBox:GetText()) or 0)*(-1))
GDKPd.status:Update()
end,
timeout=0,
whileDead=true,
}
StaticPopupDialogs["GDKPD_ADDTOPLAYER"] = {
text=L["Enter the amount you want to add to player %s:"],
button1=ADD,
button2=CANCEL,
hasEditBox=true,
OnShow=function(self)
self.button1:Disable()
end,
EditBoxOnEnterPressed=function(self) self:GetParent().button1:Click() end,
EditBoxOnTextChanged=function(self)
if strlen(self:GetText()) > 0 then
self:GetParent().button1:Enable()
else
self:GetParent().button1:Disable()
end
end,
OnAccept = function(self, data)
GDKPd_PotData.playerBalance[data] = (GDKPd_PotData.playerBalance[data]+(tonumber(self.editBox:GetText()) or 0))
SendAddonMessage("GDKPD MANADJ",tostring((tonumber(self.editBox:GetText()) or 0)*(-1)),"WHISPER",data)
GDKPd.balance:Update()
if GDKPd.opt.linkBalancePot then
GDKPd_PotData.potAmount = math.max(0, GDKPd_PotData.potAmount-(tonumber(self.editBox:GetText()) or 0))
tinsert(GDKPd_PotData.curPotHistory, (tonumber(self.editBox:GetText()) or 0)*(-1))
GDKPd.status:Update()
end
end,
timeout=0,
whileDead=true,
}
StaticPopupDialogs["GDKPD_REMFROMPLAYER"] = {
text=L["Enter the amount you want to subtract from player %s:"],
button1=REMOVE,
button2=CANCEL,
hasEditBox=true,
OnShow=function(self)
self.button1:Disable()
end,
EditBoxOnEnterPressed=function(self) self:GetParent().button1:Click() end,
EditBoxOnTextChanged=function(self)
if strlen(self:GetText()) > 0 then
self:GetParent().button1:Enable()
else
self:GetParent().button1:Disable()
end
end,
OnAccept = function(self, data)
GDKPd_PotData.playerBalance[data] = (GDKPd_PotData.playerBalance[data]-(tonumber(self.editBox:GetText()) or 0))
SendAddonMessage("GDKPD MANADJ",tostring(tonumber(self.editBox:GetText()) or 0),"WHISPER",data)
GDKPd.balance:Update()
if GDKPd.opt.linkBalancePot then
GDKPd_PotData.potAmount = GDKPd_PotData.potAmount+(tonumber(self.editBox:GetText()) or 0)
tinsert(GDKPd_PotData.curPotHistory, tonumber(self.editBox:GetText()) or 0)
GDKPd.status:Update()
end
end,
timeout=0,
whileDead=true,
}
StaticPopupDialogs["GDKPD_MAILGOLD"]={
text=L["Are you sure you want to mail %s gold to player %s?"],
button1=L["Mail money"],
button2=CANCEL,
OnAccept=function(self,data)
GDKPd:MailBalanceGold(data)
end,
timeout=0,
whileDead=true,
showAlert=true,
hideOnEscape=true,
}
StaticPopupDialogs["GDKPD_WIPEHISTORY"]={
text=L["This will completely wipe your auction history and is IRREVERSIBLE.\nAre you completely SURE you want to do this?"],
button1=L["Wipe history"],
button2=CANCEL,
OnAccept=function()
table.wipe(GDKPd_PotData.history)
if GDKPd.history:IsShown() then
GDKPd.history:Update()
end
end,
timeout=0,
hideOnEscape=true,
whileDead=true,
showAlert=true,
cancels="GDKPD_WIPEHISTORY",
}
StaticPopupDialogs["GDKPD_AUTOBID"] = {
text=L["Enter the maximum amount of money you want to bid on %s:"],
button1=BID,
button2=CANCEL,
hasEditBox=true,
OnShow=function(self)
self.button1:Disable()
end,
EditBoxOnEnterPressed=function(self) self:GetParent().button1:Click() end,
EditBoxOnTextChanged = function(self)
if strlen(self:GetText()) > 0 then
self:GetParent().button1:Enable()
else
self:GetParent().button1:Disable()
end
end,
OnAccept=function(self, data)
data.maxAutoBid = tonumber(self.editBox:GetText())
if (data.curbidismine == false) and data.maxAutoBid then
local newBid = data.curbidamount + data.bidIncrement
if newBid <= data.maxAutoBid then
if data.isMultiBid then
SendChatMessage(data.itemlink.." "..newBid,"RAID")
else
SendChatMessage(tostring(newBid),"RAID")
end
end
end
data.autobid:Hide()
data.stopautobid:Show()
end,
timeout=0,
}
StaticPopupDialogs["GDKPD_CURPOTCLICK"]={
text=L["You have selected the current pot, size %d gold.\nWhat do you want to do with this pot?"],
button1=L["Export"],
button2=DELETE,
button3=CANCEL,
OnShow=function(self) self.button3:Disable() end,
OnAccept=function(self)
GDKPd.exportframe:Show()
GDKPd.exportframe:Set("", GDKPd_PotData.curPotHistory)
end,
timeout=0,
whileDead=true,
}
StaticPopupDialogs["GDKPD_HISTORYCLICK"] = {
text="%s",
button1=L["Export"],
button2=DELETE,
button3=CANCEL,
OnAccept=function(self, data)
print("onaccept")
local output = "GDKPd pot data for "..data.date.."\nPot size: "..data.size.." gold"
if data.note then
output = output.."\nNote: "..data.note
end
--[[if data.items then
for _, aucdata in ipairs(data.items) do
if type(aucdata) == "table" then
output = output.."\n"..(aucdata.item:match("(|h.+|h)"))..": "..aucdata.name.." ("..aucdata.bid.." gold)"
else
output = output.."\n"..L["Manual adjustment"]..": "..(aucdata > 0 and "+" or "")..aucdata.." gold"
end
end
end--]]
GDKPd.exportframe:Show()
GDKPd.exportframe:Set(output,data.items)
end,
OnCancel=function(self, data,clickType)
if clickType == "override" then return end
for num, t in ipairs(GDKPd_PotData.history) do
if t == data then
tremove(GDKPd_PotData.history, num)
break
end
end
GDKPd.history:Update()
end,
timeout=0,
whileDead=0,
}
StaticPopupDialogs["GDKPD_CUSTOMSETTINGSID"]={
text=L["Please enter the itemID of an item you want to drop here:"],
button1=OKAY,
button2=CANCEL,
hasEditBox=true,
OnShow=function(self)
self.button1:Disable()
end,
EditBoxOnEnterPressed=function(self) self:GetParent().button1:Click() end,
hideOnEscape=true,
EditBoxOnTextChanged = function(self)
if (tonumber(self:GetText())) and (tonumber(self:GetText()) >= 0) and (not GDKPd.opt.customItemSettings[tonumber(self:GetText())]) then
self:GetParent().button1:Enable()
else
self:GetParent().button1:Disable()
end
end,
OnAccept=function(self)
GDKPd.opt.customItemSettings[tonumber(self.editBox:GetText())] = {}
GDKPd.itemsettings:Update()
end,
timeout=0,
}
StaticPopupDialogs["GDKPD_42_ADDONMSG"]={
text=L["Due to the changes to the addon message system implemented in patch 4.2, GDKPd is no longer able to communicate using its old version checking standard.\nThus, this version of GDKPd will only be able to send and receive version checks from and to versions 1.2.0 and above of GDKPd.\nWhile all other functionalities of GDKPd should still be compatible with previous versions, we |cffff0000strongly recommend updating GDKPd to version 1.2.0 or above|r."],
button1=OKAY,
showAlert=true,
hideOnEscape=false,
timeout=0,
}
local function round(num, places)
return tonumber(string.format("%."..(places or 0).."f",num))
end
-- if GetUnitName cannot parse the name as a unitID, that means they're from our realm - parse manually
local function localNameOnly(name)
for _,s in ipairs(REALM_SEPARATOR_LIST) do
local i = name:find(s,1,true)
if i then name=name:sub(1,i-1) end
end
return name
end
local function pruneCrossRealm(name) -- only use for people in the raid group!
return GetUnitName(name,true) or localNameOnly(name)
end
GDKPd = CreateFrame("Frame")
local GDKPd = GDKPd
GDKPd.frames = {}
GDKPd.curAuction = {}
GDKPd.curAuctions = {}
GDKPd.auctionList = {}
GDKPd.ignoredLinks = {}
GDKPd.versions = {}
GDKPd:Hide()
GDKPd:SetScript("OnUpdate", function(self, elapsed)
if (not self.curAuction.item) and (not next(self.curAuctions)) then self:Hide() return end
if not self.opt.allowMultipleAuctions then
-- old code for single auctions
local curPot = math.floor(self.curAuction.timeRemains/self.opt.countdownTimerJump)
self.curAuction.timeRemains = self.curAuction.timeRemains-elapsed
if (curPot ~= math.floor(self.curAuction.timeRemains/self.opt.countdownTimerJump)) and (curPot*self.opt.countdownTimerJump < self.opt.auctionTimer) and (not (next(self.curAuction.bidders,nil) and (curPot*self.opt.countdownTimerJump == self.opt.auctionTimerRefresh))) and (curPot > 0) then
SendChatMessage("[Caution] "..(curPot*self.opt.countdownTimerJump).." seconds remaining!","RAID")
end
if self.curAuction.timeRemains <= 0 then
self:Hide()
self:FinishAuction()
end
else
-- new code for multiple auctions
local auctionsToFinish = emptytable()
for item,aucdata in pairs(self.curAuctions) do
local curPot = math.floor(aucdata.timeRemains/self.opt.countdownTimerJump)
aucdata.timeRemains = aucdata.timeRemains-elapsed
if (curPot ~= math.floor(aucdata.timeRemains/self.opt.countdownTimerJump)) and (curPot*self.opt.countdownTimerJump < self.opt.auctionTimer) and (not (next(aucdata.bidders,nil) and (curPot*self.opt.countdownTimerJump == self.opt.auctionTimerRefresh))) and (curPot > 0) then
SendChatMessage("[Caution] "..(curPot*self.opt.countdownTimerJump).." seconds remaining for item "..item.."!","RAID")
end
if aucdata.timeRemains <= 0 then
tinsert(auctionsToFinish, item)
end
end
if #auctionsToFinish > 0 then
for _, link in ipairs(auctionsToFinish) do
self:FinishAuction(link)
end
end
auctionsToFinish:Release()
-- there are no keys
if not next(self.curAuctions) then
self:Hide()
end
end
end)
local anchor = CreateFrame("Frame", "GDKPd_Anchor", UIParent)
anchor:SetClampedToScreen(true)
anchor:EnableMouse(true)
anchor:SetScript("OnMouseDown", function(self)
self:StartMoving()
end)
anchor:SetMovable(true)
anchor:SetScript("OnMouseUp", function(self)
self:StopMovingOrSizing()
GDKPd.opt.point.point, _, GDKPd.opt.point.relative, GDKPd.opt.point.x, GDKPd.opt.point.y = self:GetPoint()
end)
anchor:SetSize(300,60)
anchor:SetFrameStrata("DIALOG")
anchor:Hide()
anchor.movetx = anchor:CreateTexture()
anchor.movetx:SetAllPoints()
anchor.movetx:SetTexture(0.3,0.3,0.9)
anchor.movetx:SetAlpha(0.5)
anchor.movetx.text = anchor:CreateFontString()
anchor.movetx.text:SetFontObject(GameFontHighlightLarge)
anchor.movetx.text:SetText(L["GDKPd: Drag to move\n/gdkpd and check \"Lock\" to hide"])
anchor.movetx.text:SetAllPoints()
GDKPd.status = CreateFrame("Frame", "GDKPd_Status", UIParent)
local status = GDKPd.status
status:SetSize(200, 90)
status:Hide()
status:SetBackdrop({
bgFile="Interface\\DialogFrame\\UI-DialogBox-Gold-Background",
edgeFile="Interface\\DialogFrame\\UI-DialogBox-Gold-Border",
tileSize=32,
edgeSize=24,
tile=true,
insets={
top=6,
bottom=6,
right=6,
left=6,
},
})
function status:UpdateVisibility(forceCombat)
if GDKPd.opt.hide then
self:Hide()
return
end
if ((not GDKPd.opt.hideCombat.status) or (not (forceCombat ~= nil and forceCombat or InCombatLockdown()))) and GDKPd:PlayerIsML((UnitName("player")),true) then
self:Show()
else
self:Hide()
end
end
status.header = CreateFrame("Button", nil, status)
status.header:SetNormalTexture("Interface\\DialogFrame\\UI-DialogBox-Gold-Header")
status.header:SetSize(133,34)
status.header.text = status.header:CreateFontString()
status.header.text:SetPoint("TOP",0,-7)
status.header.text:SetFont("Fonts\\FRIZQT__.TTF", 8, "")
status.header.text:SetTextColor(1,1,1)
status.header.text:SetText("GDKPd")
status.header:SetMovable(true)
status.header:SetScript("OnMouseDown", function(self)
self:StartMoving()
end)
status.header:SetScript("OnMouseUp", function(self)
self:StopMovingOrSizing()
GDKPd.opt.statuspoint.point, _, GDKPd.opt.statuspoint.relative, GDKPd.opt.statuspoint.x, GDKPd.opt.statuspoint.y = self:GetPoint()
end)
status:SetPoint("TOP", status.header, "TOP", 0, -6)
status:SetScript("OnShow", function(self)
self:UpdateSize()
end)
status.text = status:CreateFontString()
status.text:SetFont("Fonts\\FRIZQT__.TTF", 8, "")
status.text:SetTextColor(1,1,1)
status.text:SetPoint("TOPLEFT", 15, -15)
status.text:SetJustifyH("LEFT")
status.distribute = CreateFrame("Button", nil, status, "UIPanelButtonTemplate")
status.distribute:SetSize(65, 15)
status.distribute:SetPoint("TOPLEFT", status.text, "BOTTOMLEFT", 0, -5)
status.distribute:SetText(L["Distribute"])
status.distribute:SetScript("OnClick", function(self)
GDKPd:DistributePot()
end)
status.reset = CreateFrame("Button", nil, status, "UIPanelButtonTemplate")
status.reset:SetSize(65, 15)
status.reset:SetPoint("LEFT", status.distribute, "RIGHT")
status.reset:SetText(RESET)
status.reset:SetScript("OnClick", function(self)
StaticPopup_Show("GDKPD_RESETPOT")
end)
status.add = CreateFrame("Button", nil, status, "UIPanelButtonTemplate")
status.add:SetSize(15,15)
status.add:SetPoint("LEFT", status.reset, "RIGHT",10,0)
status.add:SetText("+")
status.add:SetScript("OnClick", function(self)
StaticPopup_Show("GDKPD_ADDTOPOT")
end)
status.rem = CreateFrame("Button", nil, status, "UIPanelButtonTemplate")
status.rem:SetSize(15,15)
status.rem:SetPoint("LEFT", status.add, "RIGHT")
status.rem:SetText("-")
status.rem:SetScript("OnClick", function(self)
StaticPopup_Show("GDKPD_REMFROMPOT")
end)
status.rules = CreateFrame("Button", nil, status, "UIPanelButtonTemplate")
status.rules:SetSize(170, 15)
status.rules:SetPoint("TOPLEFT", status.distribute, "BOTTOMLEFT")
status.rules:SetText(L["Broadcast rules"])
status.rules:SetScript("OnClick",function()
local announceStrings = emptytable("")
for line in string.gmatch(GDKPd.opt.rulesString,"[^\n]+") do
for word in string.gmatch(line, "%S+") do
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
SendChatMessage(msg, "RAID")
end
announceStrings:Release()
end)
status.rules:Disable()
status.itemhistory = CreateFrame("Button", nil, status, "UIPanelButtonTemplate")
status.itemhistory:SetSize(170, 15)
status.itemhistory:SetPoint("TOPLEFT", status.rules, "BOTTOMLEFT")
status.itemhistory:SetText(L["Auction history"])
status.itemhistory:SetScript("OnEnter", function(self)
GameTooltip:ClearAllPoints()
GameTooltip:ClearLines()
GameTooltip:SetOwner(self, "ANCHOR_NONE")
GameTooltip:AddLine(L["GDKPd auction history"],1,1,1)
for _, aucdata in ipairs(GDKPd_PotData.curPotHistory) do
if type(aucdata) == "table" then
GameTooltip:AddDoubleLine("|T"..GetItemIcon(aucdata.item)..":12|t "..aucdata.item, aucdata.name.." ("..aucdata.bid.."|cffffd100g|r)",1,1,1,1,1,1)
else
GameTooltip:AddDoubleLine("|T:12|t "..L["Manual adjustment"], (aucdata > 0 and "+" or "")..aucdata.."|cffffd100g|r",1,1,1,1,1,1)
end
end
GameTooltip:SetPoint("BOTTOM", self, "TOP", 0, 5)
GameTooltip:Show()
end)
status.itemhistory:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
status.itemhistory:SetScript("OnClick", function()
GDKPd.history:Show()
end)
status.announcetext = status:CreateFontString()
status.announcetext:SetFont("Fonts\\FRIZQT__.TTF", 8, "")
status.announcetext:SetTextColor(1,1,1)
status.announcetext:SetPoint("TOPLEFT", status.itemhistory, "BOTTOMLEFT", 0, -5)
status.announcetext:SetJustifyH("LEFT")
status.announcetext:SetText(L["You have looted a monster!\nDo you want GDKPd to announce loot?"])
status.announcetext:Hide()
status.announce1 = CreateFrame("Button", nil, status, "UIPanelButtonTemplate")
status.announce1:SetSize(170,15)
status.announce1:SetPoint("TOPLEFT", status.announcetext, "BOTTOMLEFT", 0, -5)
status.announce1:SetText(L["Announce & auto-auction"])
status.announce1:SetScript("OnClick", function(self)
GDKPd:AnnounceLoot(true)
status.announcetext:Hide()
self:Hide()
status.announce2:Hide()
status.noannounce:Hide()
status:UpdateSize()
end)
status.announce1:Hide()
status.announce2 = CreateFrame("Button", nil, status, "UIPanelButtonTemplate")
status.announce2:SetSize(170,15)
status.announce2:SetPoint("TOPLEFT", status.announce1, "BOTTOMLEFT", 0, -5)
status.announce2:SetText(L["Announce loot"])
status.announce2:SetScript("OnClick", function(self)
GDKPd:AnnounceLoot(false)
status.announcetext:Hide()
status.announce1:Hide()
self:Hide()
status.noannounce:Hide()
status:UpdateSize()
end)
status.announce2:Hide()
status.noannounce = CreateFrame("Button", nil, status, "UIPanelButtonTemplate")
status.noannounce:SetSize(170,15)
status.noannounce:SetPoint("TOPLEFT", status.announce2, "BOTTOMLEFT", 0, -5)
status.noannounce:SetText(L["Do not announce"])
status.noannounce:SetScript("OnClick", function(self)
status.announcetext:Hide()
status.announce1:Hide()
status.announce2:Hide()
self:Hide()
status:UpdateSize()
end)
status.noannounce:Hide()
function status:UpdateSize()
local height = 80
height = height+status.text:GetHeight()
if status.announcetext:IsShown() then
height=height+status.announcetext:GetHeight()+5
end
if status.announce1:IsShown() then
height=height+20
end
if status.announce2:IsShown() then
height=height+20
end
if status.noannounce:IsShown() then
height=height+20
end
self:SetHeight(height)
end
function status:Update()
local potAmount = (GDKPd_PotData.potAmount or 0)
local lastDist = (GDKPd_PotData.prevDist or 0)
if lastDist > 0 then
self.text:SetText(L["Pot size: %d|cffffd100g|r"]:format(potAmount)..L[" |cffaa0000(Distribute: %dg)|r"]:format(potAmount-lastDist))
else
self.text:SetText(L["Pot size: %d|cffffd100g|r"]:format(potAmount))
end
self:UpdateSize()
end
GDKPd.history = CreateFrame("Frame", "GDKPd_History", UIParent)
local history = GDKPd.history
history:SetSize(200,95)
history:Hide()
history:SetBackdrop({
bgFile="Interface\\DialogFrame\\UI-DialogBox-Gold-Background",
edgeFile="Interface\\DialogFrame\\UI-DialogBox-Gold-Border",
tileSize=32,
edgeSize=24,
tile=true,
insets={
top=6,
bottom=6,
right=6,
left=6,
},
})
history.header = CreateFrame("Button", nil, history)
history.header:SetNormalTexture("Interface\\DialogFrame\\UI-DialogBox-Gold-Header")
history.header:SetSize(133,34)
history.header:SetHitRectInsets(31.5,31.5,4.5,14.5)
history.header.text = history.header:CreateFontString()
history.header.text:SetPoint("TOP",0,-7)
history.header.text:SetFont("Fonts\\FRIZQT__.TTF", 8, "")
history.header.text:SetTextColor(1,1,1)
history.header.text:SetText(L["History"])
history.header:SetMovable(true)
history.header:SetScript("OnMouseDown", function(self)
self:StartMoving()
end)
history.header:SetScript("OnMouseUp", function(self)
self:StopMovingOrSizing()
end)
history.header:SetPoint("CENTER",UIParent,"CENTER")
history:SetPoint("TOP", history.header, "TOP", 0, -6)
history:SetScript("OnShow", function(self)
self:Update()
end)
history.entries = setmetatable({},{__index=function(t,v)
local f = CreateFrame("Button", nil, history)
if v > 1 then
f:SetPoint("TOPLEFT", t[v-1], "BOTTOMLEFT", 0, -5)
f:SetPoint("TOPRIGHT", t[v-1], "BOTTOMRIGHT", 0, -5)
else
f:SetPoint("TOPLEFT", 15, -15)
f:SetPoint("TOPRIGHT", -15, -15)
end
function f:UpdateHeight()
self:SetHeight(f.date:GetHeight())
end
f.date = f:CreateFontString()
f.date:SetFont("Fonts\\FRIZQT__.TTF", 8,"")
f.date:SetTextColor(1,1,1)
f.date:SetPoint("TOPLEFT")
f.date:SetWidth(55)
f.amount = f:CreateFontString()
f.amount:SetFont("Fonts\\FRIZQT__.TTF", 8, "")
f.amount:SetTextColor(1,1,1)
f.amount:SetPoint("TOPLEFT", f.date, "TOPRIGHT", 5, 0)
f.amount:SetPoint("BOTTOMLEFT", f.date, "BOTTOMRIGHT", 5, 0)
f.amount:SetWidth(40)
f.amount:SetJustifyH("RIGHT")
f.note = f:CreateFontString()
f.note:SetFont("Fonts\\FRIZQT__.TTF", 8, "")
f.note:SetTextColor(1,1,1)
f.note:SetPoint("BOTTOMLEFT", f.amount, "BOTTOMRIGHT", 5, 0)
f.note:SetPoint("TOPRIGHT")
f.note:SetJustifyH("LEFT")
function f:SetDataTable(data)
self.date:SetText(data.date:match("%S+"))
self.rawdate = data.date
self.amount:SetText(data.size.."|cffffd100g|r")
self.rawamount = data.size
self.note:SetText(data.note)
self.itemtable = data.items
self.data = data
self:UpdateHeight()
end
function f:SetRawData(date,amount,note,items)
self.date:SetText(date)
self.rawdate = date
self.amount:SetText(amount.."|cffffd100g|r")
self.rawamount = amount
self.note:SetText(note)
self.itemtable = items
self:UpdateHeight()
end
f:SetScript("OnEnter", function(self)
GameTooltip:ClearAllPoints()
GameTooltip:ClearLines()
GameTooltip:SetOwner(self, "ANCHOR_NONE")
if self.itemtable then
GameTooltip:AddLine(L["GDKPd auction history for %s"]:format(self.rawdate),1,1,1)
if self.note:GetText() then
GameTooltip:AddLine(L["Auction note: %s"]:format(self.note:GetText()),1,1,1)
end
for _, aucdata in ipairs(self.itemtable) do
if type(aucdata) == "table" then
GameTooltip:AddDoubleLine("|T"..GetItemIcon(aucdata.item)..":12|t "..aucdata.item, aucdata.name.." ("..aucdata.bid.."|cffffd100g|r)",1,1,1,1,1,1)
else
GameTooltip:AddDoubleLine("|T:12|t "..L["Manual adjustment"], (aucdata > 0 and "+" or "")..aucdata.."|cffffd100g|r",1,1,1,1,1,1)
end
end
else
GameTooltip:AddLine(L["GDKPd: No detailed data available"],1,1,1)
end
GameTooltip:SetPoint("TOPRIGHT", self, "LEFT", -5, 0)
GameTooltip:Show()
end)
f:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
f:SetScript("OnClick", function(self)
ClearCursor()
if self.data then
StaticPopup_Show("GDKPD_HISTORYCLICK", L["You have selected the following pot:\n%s, dated %s, size %d gold.\nWhat do you want to do with this pot?"]:format(self.note:GetText(), self.date:GetText(), self.rawamount)).data = self.data
else
StaticPopup_Show("GDKPD_CURPOTCLICK", GDKPd_PotData.potAmount)
end
end)
t[v]=f
return f
end})
history.hide = CreateFrame("Button", nil, history, "UIPanelButtonTemplate")
history.hide:SetSize(170,15)
history.hide:SetPoint("BOTTOM", 0, 15)
history.hide:SetText(L["Hide"])
history.hide:SetScript("OnClick", function() history:Hide() end)
function history:Update()
for _, f in ipairs(self.entries) do
f:Hide()
end
local c = 1
local size = 45
for _, potdata in ipairs(GDKPd_PotData.history) do
local f = self.entries[c]
f:Show()
f:SetDataTable(potdata)
size=size+f:GetHeight()+5
c=c+1
end
if GDKPd_PotData.potAmount > 0 then
local f = self.entries[c]
f:Show()
f:SetRawData("Current pot", GDKPd_PotData.potAmount, nil, GDKPd_PotData.curPotHistory)
size=size+f:GetHeight()+5
c=c+1
end
self:SetHeight(size)
end
GDKPd.itemsettings = CreateFrame("Frame", "GDKPd_ItemSettings", UIParent)
local itemsettings = GDKPd.itemsettings
itemsettings:SetWidth(250)
itemsettings:Hide()
itemsettings:SetBackdrop({
bgFile="Interface\\DialogFrame\\UI-DialogBox-Gold-Background",
edgeFile="Interface\\DialogFrame\\UI-DialogBox-Gold-Border",
tileSize=32,
edgeSize=24,
tile=true,
insets={
top=6,
bottom=6,
right=6,
left=6,
},
})
itemsettings.header = CreateFrame("Button", nil, itemsettings)
itemsettings.header:SetNormalTexture("Interface\\DialogFrame\\UI-DialogBox-Gold-Header")
itemsettings.header:SetSize(133,34)
itemsettings.header:SetHitRectInsets(31.5,31.5,4.5,14.5)
itemsettings.header.text = itemsettings.header:CreateFontString()
itemsettings.header.text:SetPoint("TOP", 0, -7)
itemsettings.header.text:SetFont("Fonts\\FRIZQT__.TTF", 8, "")
itemsettings.header.text:SetTextColor(1,1,1)
itemsettings.header.text:SetText(L["Item settings"])
itemsettings.header:SetMovable(true)
itemsettings.header:SetScript("OnMouseDown", function(self)
self:StartMoving()
end)
itemsettings.header:SetScript("OnMouseUp", function(self)
self:StopMovingOrSizing()
end)
itemsettings.header:SetPoint("CENTER", UIParent, "CENTER")
itemsettings:SetPoint("TOP", itemsettings.header, "TOP", 0, -6)
itemsettings:SetScript("OnShow", function(self)
self:Update()
end)
itemsettings.thead = CreateFrame("Frame", nil, itemsettings)
itemsettings.thead:SetPoint("TOPLEFT", 15, -15)
itemsettings.thead:SetPoint("TOPRIGHT", -15, -15)
itemsettings.thead:SetHeight(15)
itemsettings.thead.item = itemsettings.thead:CreateFontString()
itemsettings.thead.item:SetFont("Fonts\\FRIZQT__.TTF", 10)
itemsettings.thead.item:SetTextColor(1,0.82,0)
--itemsettings.thead.item:SetText(L["Itm"])
itemsettings.thead.item:SetPoint("LEFT")
itemsettings.thead.item:SetWidth(15)
itemsettings.thead.startbid = itemsettings.thead:CreateFontString()
itemsettings.thead.startbid:SetFont("Fonts\\FRIZQT__.TTF", 10)
itemsettings.thead.startbid:SetTextColor(1,0.82,0)
itemsettings.thead.startbid:SetText(L["Starting bid"])
itemsettings.thead.startbid:SetPoint("LEFT", itemsettings.thead.item, "RIGHT")
itemsettings.thead.startbid:SetWidth(102.5)
itemsettings.thead.minincre = itemsettings.thead:CreateFontString()
itemsettings.thead.minincre:SetFont("Fonts\\FRIZQT__.TTF", 10)
itemsettings.thead.minincre:SetTextColor(1,0.82,0)
itemsettings.thead.minincre:SetText(L["Minimum increment"])
itemsettings.thead.minincre:SetPoint("LEFT", itemsettings.thead.startbid, "RIGHT")
itemsettings.thead.minincre:SetPoint("RIGHT")
itemsettings.scroll = CreateFrame("ScrollFrame", nil, itemsettings)
itemsettings.scroll:SetPoint("TOPLEFT", itemsettings.thead, "BOTTOMLEFT", 0, -5)
itemsettings.scroll.child = CreateFrame("Frame", nil, itemsettings.scroll)
itemsettings.scroll.child:EnableMouseWheel(true)
itemsettings.scroll.child:SetScript("OnMouseWheel", function(self, delta)
if delta == 1 then
itemsettings.scroll:SetVerticalScroll(math.max(itemsettings.scroll:GetVerticalScroll()-10,0))
else
itemsettings.scroll:SetVerticalScroll(math.min(itemsettings.scroll:GetVerticalScroll()+10,itemsettings.scroll:GetVerticalScrollRange()))
end
end)
itemsettings.scroll.child:SetWidth(itemsettings.scroll:GetWidth())
itemsettings.scroll:SetScrollChild(itemsettings.scroll.child)
itemsettings.scroll:SetScript("OnSizeChanged", function(self, width)
self.child:SetWidth(width)
self:UpdateScrollChildRect()
end)
itemsettings.entries = setmetatable({}, {__index=function(t,v)
local f = CreateFrame("Frame", nil, itemsettings.scroll.child)
if v > 1 then
f:SetPoint("TOPLEFT", t[v-1], "BOTTOMLEFT", 0, -5)
f:SetPoint("TOPRIGHT", t[v-1], "BOTTOMRIGHT", 0, -5)
else
f:SetPoint("TOPLEFT"--[[, itemsettings.thead, "BOTTOMLEFT", 0, -5--]])
f:SetPoint("TOPRIGHT"--[[, itemsettings.thead, "BOTTOMRIGHT", 0, -5--]])
end
f:SetHeight(15)
f.itemicon = CreateFrame("Button", nil, f)
f.itemicon:SetScript("OnEnter", function()
if not f.itemID then return end
GameTooltip:ClearAllPoints()
GameTooltip:ClearLines()
GameTooltip:SetOwner(f, "ANCHOR_NONE")
GameTooltip:SetHyperlink("item:"..f.itemID)
GameTooltip:SetPoint("RIGHT", itemsettings, "LEFT", -5, 0)
GameTooltip:Show()
end)
f.itemicon:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
f.itemicon:SetSize(15,15)
f.itemicon:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
f.itemicon:SetPoint("LEFT")
f.itemicon:SetScript("OnMouseUp", function(self)
if (select(1,GetCursorInfo())) == "item" then
local id = (select(2, GetCursorInfo()))
if GDKPd.opt.customItemSettings[id] then ClearCursor() return end
if f.itemID then
GDKPd.opt.customItemSettings[id] = GDKPd.opt.customItemSettings[f.itemID]
GDKPd.opt.customItemSettings[f.itemID] = nil
else
GDKPd.opt.customItemSettings[id] = {}
end
ClearCursor()
itemsettings:Update()
else
if f.itemID then
local cis = GDKPd.opt.customItemSettings[f.itemID]
if cis.minBid or cis.minIncrement then
PickupItem(f.itemID)
else
GDKPd.opt.customItemSettings[f.itemID] = nil
itemsettings:Update()
end
else
StaticPopup_Show("GDKPD_CUSTOMSETTINGSID")
end
end
end)
f.itemicon:EnableMouse(true)
f.minBid = CreateFrame("EditBox", nil, f)
f.minBid:SetMultiLine(nil)
f.minBid:SetScript("OnEditFocusGained", function(self) if not f.itemID then self:ClearFocus() end end)
f.minBid:SetScript("OnEnterPressed", function(self) GDKPd.opt.customItemSettings[f.itemID].minBid = self:GetNumber() > 0 and self:GetNumber() or nil self:ClearFocus() itemsettings:Update() end)
f.minBid:SetScript("OnEscapePressed", function(self) self:SetNumber(GDKPd.opt.customItemSettings[f.itemID].minBid) self:ClearFocus() end)
f.minBid:SetFont("Fonts\\FRIZQT__.TTF", 10)
f.minBid:SetTextColor(1,1,1)
f.minBid:SetPoint("TOPLEFT", f.itemicon, "TOPRIGHT")
f.minBid:SetPoint("BOTTOMLEFT", f.itemicon, "BOTTOMRIGHT")
f.minBid:SetJustifyH("RIGHT")
f.minBid:SetAutoFocus(false)
f.minBid:SetWidth(102.5)
f.minBid:SetTextInsets(5,5,2,2)
f.minBid:SetNumeric(true)
f.minBid:SetScript("OnTextChanged", function(self, userInput)
if strlen(self:GetText()) > 0 then
self.g:Show()
else
self.g:Hide()
end
end)
f.minBid.g = f:CreateFontString()
f.minBid.g:SetFont("Fonts\\FRIZQT__.TTF", 10)
f.minBid.g:SetTextColor(1,0.82,0)
f.minBid.g:SetText("g")
f.minBid.g:SetPoint("TOPRIGHT", f.itemicon, "TOPRIGHT", 102.5, 0)
f.minBid.g:SetPoint("BOTTOMRIGHT", f.itemicon, "BOTTOMRIGHT", 102.5, 0)
f.minBid:SetPoint("RIGHT", f.minBid.g, "LEFT")
f.minBid.tex = f:CreateTexture(nil,"BACKGROUND")
f.minBid.tex:SetPoint("TOPLEFT",f.minBid,20,0)
f.minBid.tex:SetPoint("BOTTOMRIGHT",f.minBid.g)
f.minBid.tex:SetAlpha(0.2)
f.minBid.tex:SetTexture(0.5,0.5,0.5)
f.minIncrement = CreateFrame("EditBox", nil, f)
f.minIncrement:SetMultiLine(nil)
f.minIncrement:SetScript("OnEditFocusGained", function(self) if not f.itemID then self:ClearFocus() end end)
f.minIncrement:SetScript("OnEnterPressed", function(self) GDKPd.opt.customItemSettings[f.itemID].minIncrement = self:GetNumber() > 0 and self:GetNumber() or nil self:ClearFocus() itemsettings:Update() end)
f.minIncrement:SetScript("OnEscapePressed", function(self) if GDKPd.opt.customItemSettings[f.itemID].minIncrement then self:SetNumber(GDKPd.opt.customItemSettings[f.itemID].minIncrement) else self:SetText("") end self:ClearFocus() end)
f.minIncrement:SetFont("Fonts\\FRIZQT__.TTF", 10)
f.minIncrement:SetTextColor(1,1,1)
f.minIncrement:SetPoint("TOPLEFT", f.minBid.g, "TOPRIGHT")
f.minIncrement:SetPoint("BOTTOMLEFT", f.minBid.g, "BOTTOMRIGHT")
f.minIncrement:SetJustifyH("RIGHT")
f.minIncrement:SetAutoFocus(false)
--f.minIncrement:Setp(102.5)
f.minIncrement:SetTextInsets(5,5,2,2)
f.minIncrement:SetScript("OnTextChanged", function(self, userInput)
if strlen(self:GetText()) > 0 then
self.g:Show()
else
self.g:Hide()
end
end)
f.minIncrement.g = f:CreateFontString()
f.minIncrement.g:SetFont("Fonts\\FRIZQT__.TTF", 10)
f.minIncrement.g:SetTextColor(1,0.82,0)
f.minIncrement.g:SetText("g")
f.minIncrement.g:SetPoint("TOPRIGHT", f.minBid.g, "TOPRIGHT", 102.5, 0)
f.minIncrement.g:SetPoint("BOTTOMRIGHT", f.minBid.g, "BOTTOMRIGHT", 102.5, 0)
f.minIncrement:SetPoint("TOPRIGHT", f.minIncrement.g, "TOPLEFT")
f.minIncrement:SetPoint("BOTTOMRIGHT", f.minIncrement.g, "BOTTOMLEFT")
f.minIncrement.tex = f:CreateTexture(nil,"BACKGROUND")
f.minIncrement.tex:SetPoint("TOPLEFT",f.minIncrement,20,0)
f.minIncrement.tex:SetPoint("BOTTOMRIGHT",f.minIncrement.g,"BOTTOMRIGHT")
f.minIncrement.tex:SetAlpha(0.2)
f.minIncrement.tex:SetTexture(0.5,0.5,0.5)
function f:SetItemID(itemID)
if (not itemID) or (not GDKPd.opt.customItemSettings[itemID]) then
self.itemicon:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up")
self.minBid:SetText("")
self.minIncrement:SetText("")
self.itemID = nil
else
self.itemicon:SetNormalTexture((select(10, GetItemInfo(itemID))))
if GDKPd.opt.customItemSettings[itemID].minBid then
self.minBid:SetText(GDKPd.opt.customItemSettings[itemID].minBid)
else
self.minBid:SetText("")
end
if GDKPd.opt.customItemSettings[itemID].minIncrement then
self.minIncrement:SetText(GDKPd.opt.customItemSettings[itemID].minIncrement)