Skip to content

Commit 5ee4ace

Browse files
committed
More Fix
Remove unused entries in classic Fix default values Convert tabs to spaces
1 parent 7f8eab3 commit 5ee4ace

File tree

8 files changed

+104
-551
lines changed

8 files changed

+104
-551
lines changed

Core.lua

+79-141
Original file line numberDiff line numberDiff line change
@@ -58,34 +58,34 @@ local function ResolveCurrency(db, option)
5858
end
5959

6060
local _Migration = {
61-
["%n"] = "["..L["name" ].."]",
61+
["%n"] = "["..L["name" ].."]",
6262
["%N"] = "["..L["name2" ].."]",
63-
["%Z"] = "["..L["zone" ].."]",
63+
["%Z"] = "["..L["zone" ].."]",
6464
["%z"] = "["..L["subzone" ].."]",
65-
["%g"] = "["..L["gold" ].."]",
66-
["%s"] = "["..L["silver" ].."]",
67-
["%c"] = "["..L["copper" ].."]",
68-
["%G"] = "", ["%S"] = "", ["%C"] = "",
69-
["%B"] = "["..L["worldbuff" ].."]",
65+
["%g"] = "["..L["gold" ].."]",
66+
["%s"] = "["..L["silver" ].."]",
67+
["%c"] = "["..L["copper" ].."]",
68+
["%G"] = "", ["%S"] = "", ["%C"] = "",
69+
["%B"] = "["..L["worldbuff" ].."]",
7070
["%T"] = "["..L["cooldown" ].."]",
71-
["%L"] = "["..L["elapsed" ].."]",
72-
["%l"] = "["..L["level" ].."]",
73-
["%e"] = "["..L["expCur" ].."]",
71+
["%L"] = "["..L["elapsed" ].."]",
72+
["%l"] = "["..L["level" ].."]",
73+
["%e"] = "["..L["expCur" ].."]",
7474
["%E"] = "["..L["expMax" ].."]",
7575
["%p"] = "["..L["exp%" ].."]",
76-
["%R"] = "["..L["expRest" ].."]",
76+
["%R"] = "["..L["expRest" ].."]",
7777
["%P"] = "["..L["expRest%" ].."]",
78-
-- ["%F"], ["%I"]
78+
-- ["%F"], ["%I"]
7979
["%f"] = "["..L["color" ].."]",
8080
["%r"] = "|n",
81-
["%%"] = "%" ,
82-
["!n"] = "["..L["instName" ].."]",
81+
["%%"] = "%" ,
82+
["!n"] = "["..L["instName" ].."]",
8383
["!d"] = "["..L["difficulty"].."]",
84-
["!i"] = "["..L["instID" ].."]",
84+
["!i"] = "["..L["instID" ].."]",
8585
["!p"] = "["..L["progress" ].."]",
8686
["!P"] = "["..L["bosses" ].."]",
87-
["!t"] = "["..L["time" ].."]",
88-
["!!"] = "!" ,
87+
["!t"] = "["..L["time" ].."]",
88+
["!!"] = "!" ,
8989
}
9090

9191
local _TranslationTable = {
@@ -105,9 +105,6 @@ local _TranslationTable = {
105105
["gold" ] = function(db) return ResolveCurrency(db, L["gold" ]) end,
106106
["silver" ] = function(db) return ResolveCurrency(db, L["silver" ]) end,
107107
["copper" ] = function(db) return ResolveCurrency(db, L["copper" ]) end,
108-
["g" ] = function(db) return ResolveCurrency(db, L["gold" ]) end,
109-
["s" ] = function(db) return ResolveCurrency(db, L["silver" ]) end,
110-
["c" ] = function(db) return ResolveCurrency(db, L["copper" ]) end,
111108
["name" ] = "coloredName",
112109
["name2" ] = "name",
113110
["zone" ] = "zone",
@@ -140,9 +137,6 @@ local _TranslationTable = {
140137
[L["gold" ] ] = "gold",
141138
[L["silver" ] ] = "silver",
142139
[L["copper" ] ] = "copper",
143-
[L["g" ] ] = "g",
144-
[L["s" ] ] = "s",
145-
[L["c" ] ] = "c",
146140
[L["name" ] ] = "name",
147141
[L["name2" ] ] = "name2",
148142
[L["zone" ] ] = "zone",
@@ -212,10 +206,8 @@ function SavedClassic:OnInitialize()
212206
if not self.db.global.version then
213207
self:ResetWholeDB()
214208
else
215-
if self.db.global.version:match("1.4.") then
209+
if not self.db.global.version:match("1.15.6.") then
216210
self:Migrate()
217-
-- p(L["Reset due to update"](self.db.global.version, self.version))
218-
-- self:ResetWholeDB()
219211
end
220212
end
221213

@@ -330,20 +322,20 @@ function SavedClassic:InitPlayerDB()
330322
playerdb.info1_2 = format("\n[%s:%s/ffee99]", L["currency"], L["gold"])
331323
playerdb.info2 = true
332324
playerdb.info2_1 = ""
325+
playerdb.info2_2 = ""
333326

334327
if UnitLevel("player") < GetMaxPlayerLevel() then
335328
playerdb.info1_1 = format("\n[%s/00ff00]■[%s] [[%s/ffffff]:[%s]] [%s] [%s/ffffff]([%s]: [%s])[%s]",
336329
L["color"], L["color"], L["level"], L["name"], L["ilvl"], L["color"], L["zone"], L["subzone"], L["color"])
337330
playerdb.info2_1 = format(" [%s/cc66ff][%s]/[%s] ([%s]%%)[%s] [%s/66ccff]+[%s] ([%s]%%)[%s]",
338331
L["color"], L["expCur"], L["expMax"], L["exp%"], L["color"], L["color"], L["expRest"], L["expRest%"], L["color"])
339-
playerdb.info2_2 = format("[%s/ffffff][%s:%s][%s]",
340-
L["color"], L["currency"], L["JP"], L["color"] )
341332
else
342333
playerdb.info1_1 = format("\n[%s/00ff00]■[%s] [[%s]] [%s] [%s/ffffff]([%s]: [%s])[%s]",
343334
L["color"], L["color"], L["name"], L["ilvl"], L["color"], L["zone"], L["subzone"], L["color"])
344-
playerdb.info2_1 = format(" [%s/ffffff][%s:%s] [%s:%s] [%s:%s] [%s:%s] [%s:%s][%s]",
345-
L["color"], L["currency"], L["VP"], L["currency"], L["JP"], L["currency"], L["conquest"], L["currency"], L["honor"], L["currency"], L["FS"], L["color"])
346-
playerdb.info2_2 = format("[%s/ffffff][%s]/[%s][%s]", L["color"], L["dqCom"], L["dqMax"], L["color"])
335+
playerdb.info2_1 = format(" [%s/ffffff][%s][%s]", L["color"], L["worldbuff"], L["color"])
336+
end
337+
if class == "WARLOCK" then
338+
playerdb.info2_2 = format("[%s:%s/cc66cc]", L["item"], "6265")
347339
end
348340

349341
playerdb.info3 = true
@@ -476,22 +468,22 @@ function SavedClassic:PLAYER_XP_UPDATE()
476468
end
477469

478470
function SavedClassic:PLAYER_UPDATE_RESTING(...)
479-
if IsResting() then
480-
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
481-
else
482-
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
483-
end
471+
if IsResting() then
472+
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
473+
else
474+
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
475+
end
484476
end
485477

486478
function SavedClassic:COMBAT_LOG_EVENT_UNFILTERED(...)
487-
local playerGUID = UnitGUID("player")
488-
local _, combatEvent, _, _, _, _, _, destGUID, _, _, _,
489-
spellId = CombatLogGetCurrentEventInfo()
490-
if combatEvent == "SPELL_AURA_APPLIED" and destGUID == playerGUID then
491-
if self.wb[spellId] then
492-
self:SaveWorldBuff()
493-
end
494-
end
479+
local playerGUID = UnitGUID("player")
480+
local _, combatEvent, _, _, _, _, _, destGUID, _, _, _,
481+
spellId = CombatLogGetCurrentEventInfo()
482+
if combatEvent == "SPELL_AURA_APPLIED" and destGUID == playerGUID then
483+
if self.wb[spellId] then
484+
self:SaveWorldBuff()
485+
end
486+
end
495487
end
496488

497489
function SavedClassic:PLAYER_EQUIPMENT_CHANGED()
@@ -502,28 +494,28 @@ function SavedClassic:PLAYER_EQUIPMENT_CHANGED()
502494
end
503495

504496
function SavedClassic:SaveWorldBuffs()
505-
local db = self.db.realm[player]
506-
db.worldBuffs = {}
507-
db.chrono = {}
508-
for i=1,64 do
509-
local _, _, _, _, _, expire, _, _, _, id = UnitBuff("player", i)
510-
if id and self.wb[id] then
511-
table.insert(db.worldBuffs, { id = id, remain = floor((expire-GetTime())/60) })
512-
end
513-
if id == 349981 then
514-
self:SaveChronoBuff(i)
515-
end
516-
end
517-
table.sort(db.worldBuffs, function(a,b) return (a.remain or 0) > (b.remain or 0) end)
497+
local db = self.db.realm[player]
498+
db.worldBuffs = {}
499+
db.chrono = {}
500+
for i=1,64 do
501+
local _, _, _, _, _, expire, _, _, _, id = UnitBuff("player", i)
502+
if id and self.wb[id] then
503+
table.insert(db.worldBuffs, { id = id, remain = floor((expire-GetTime())/60) })
504+
end
505+
if id == 349981 then
506+
self:SaveChronoBuff(i)
507+
end
508+
end
509+
table.sort(db.worldBuffs, function(a,b) return (a.remain or 0) > (b.remain or 0) end)
518510
end
519511

520512
function SavedClassic:SaveChronoBuff(numBuff)
521-
local db = self.db.realm[player]
522-
local displacer = { UnitBuff("player", numBuff) }
523-
for i=1,#self.cd do
524-
table.insert(db.chrono, {id = self.cd[i], remain = floor(displacer[16 + i]/60) })
525-
end
526-
table.sort(db.chrono, function(a,b) return (a.remain or 0) > (b.remain or 0) end)
513+
local db = self.db.realm[player]
514+
local displacer = { UnitBuff("player", numBuff) }
515+
for i=1,#self.cd do
516+
table.insert(db.chrono, {id = self.cd[i], remain = floor(displacer[16 + i]/60) })
517+
end
518+
table.sort(db.chrono, function(a,b) return (a.remain or 0) > (b.remain or 0) end)
527519
end
528520

529521
function SavedClassic:SaveZone()
@@ -593,21 +585,6 @@ function SavedClassic:PLAYER_MONEY()
593585
end
594586

595587
function SavedClassic:CurrencyUpdate()
596-
-- local db = self.db.realm[player]
597-
-- for _, currencyID in pairs(self.currencies.order) do
598-
-- local info = SavedClassic_GetCurrencyInfo(currencyID)
599-
-- if info then
600-
-- db.currencyCount[currencyID] = { quantity = tonumber(info.quantity) }
601-
-- if info.useTotalEarnedForMaxQty then
602-
-- db.currencyCount[currencyID]["totalEarned"] = info.totalEarned or 0
603-
-- --db.currencyCount[currencyID]["maxQuantity"] = info.maxQuantity
604-
-- if info.maxQuantity and info.maxQuantity > 0 then
605-
-- self.db.global.maxQty = self.db.global.maxQty or {}
606-
-- self.db.global.maxQty[currencyID] = info.maxQuantity
607-
-- end
608-
-- end
609-
-- end
610-
-- end
611588
self:PLAYER_MONEY()
612589
end
613590

@@ -651,36 +628,35 @@ function SavedClassic:ShowInstanceInfo(tooltip, character)
651628
local currentTime = time()
652629

653630
local wbstr = ""
654-
if db.worldBuffs then
655-
for _,b in ipairs(db.worldBuffs) do
656-
if b.id and b.remain then
657-
local icon = GetSpellTexture(b.id) or ""
658-
wbstr = wbstr .. "|T".. icon ..":14:14|t".. b.remain ..L["minites"].." "
659-
end
660-
end
661-
end
662-
wbstr = wbstr.."|T133881:14:14|t"..(db.itemCount[184937] or 0)
663-
if db.chrono then
664-
local cdstr = ""
665-
for i,b in ipairs(db.chrono) do
666-
if b.id and b.remain and b.remain > 0 then
667-
local icon = GetSpellTexture(b.id) or ""
668-
cdstr = cdstr .. "|T".. icon ..":14:14|t".. b.remain ..L["minites"].." "
669-
end
670-
end
671-
if cdstr ~= "" then
672-
cdstr = string.sub(cdstr,1,-2) -- trim trailing space
673-
wbstr = wbstr.."("..cdstr..")"
674-
end
675-
end
631+
if db.worldBuffs then
632+
for _,b in ipairs(db.worldBuffs) do
633+
if b.id and b.remain then
634+
local icon = GetSpellTexture(b.id) or ""
635+
wbstr = wbstr .. "|T".. icon ..":14:14|t".. b.remain ..L["minites"].." "
636+
end
637+
end
638+
end
639+
wbstr = wbstr.."|T133881:14:14|t"..(db.itemCount[184937] or 0)
640+
if db.chrono then
641+
local cdstr = ""
642+
for i,b in ipairs(db.chrono) do
643+
if b.id and b.remain and b.remain > 0 then
644+
local icon = GetSpellTexture(b.id) or ""
645+
cdstr = cdstr .. "|T".. icon ..":14:14|t".. b.remain ..L["minites"].." "
646+
end
647+
end
648+
if cdstr ~= "" then
649+
cdstr = string.sub(cdstr,1,-2) -- trim trailing space
650+
wbstr = wbstr.."("..cdstr..")"
651+
end
652+
end
653+
db.wbstr = wbstr
676654

677655
local tsstr = ""
678-
local ts_icon, ts_cooldown = "", "" -- for Tailoring cooldowns integration
679656
if db.tradeSkills then
680657
for id, cooldown in pairs(db.tradeSkills) do
681658
local ts = self.ts[id]
682659
if ts and cooldown and cooldown.ends then
683-
--if ts.share then ts = self.ts[ts.share] end
684660
local remain = cooldown.ends - currentTime
685661
if remain > 0 then
686662
local hh, mm = floor(remain / 3600), floor(remain % 3600 / 60)
@@ -690,12 +666,6 @@ function SavedClassic:ShowInstanceInfo(tooltip, character)
690666
else
691667
cooldown_str = format("%02d:%02d", hh, mm)
692668
end
693-
if ts.tailoring then
694-
ts_icon = ts_icon..(ts.icon or ts.altName or "")
695-
ts_cooldown = cooldown_str
696-
else
697-
tsstr = tsstr..(ts.icon or ts.altName or "")..cooldown_str
698-
end
699669
else
700670
db.tradeSkills[id] = nil
701671
end
@@ -704,7 +674,7 @@ function SavedClassic:ShowInstanceInfo(tooltip, character)
704674
end
705675
end
706676
end
707-
db.tsstr = tsstr..ts_icon..ts_cooldown
677+
db.tsstr = tsstr
708678

709679
if db.dqResetReal and currentTime > db.dqResetReal then
710680
db.dqComplete = 0
@@ -767,35 +737,6 @@ function SavedClassic:ShowInstanceInfo(tooltip, character)
767737
end
768738
end
769739
end
770-
--[[
771-
db.heroics = db.heroics or {}
772-
if db.info4 then
773-
if db.info4oneline then
774-
local oneline = ""
775-
for i = 1, #db.heroics do
776-
local instance = db.heroics[i]
777-
local remain = SecondsToTime(instance.reset - time())
778-
if remain and ( remain ~= "" ) then
779-
oneline = oneline.." "..(self.abbr.heroic[instance.name] or instance.name)
780-
end
781-
end
782-
if oneline ~= "" then
783-
oneline = oneline:gsub("^ ","") -- trim leading space
784-
tooltip:AddLine("|cffffff99 "..oneline.."|r")
785-
end
786-
else
787-
for i = 1, #db.heroics do
788-
local instance = db.heroics[i]
789-
local remain = SecondsToTime(instance.reset - time())
790-
if remain and ( remain ~= "" ) then
791-
local line4_1 = self:TranslateInstance(db.info4_1, instance)
792-
local line4_2 = self:TranslateInstance(db.info4_2, instance)
793-
tooltip:AddDoubleLine(line4_1, line4_2)
794-
end
795-
end
796-
end
797-
end
798-
--]]
799740
end
800741

801742
function SavedClassic:TranslateCharacter(line, db)
@@ -1427,9 +1368,6 @@ function SavedClassic:BuildOptions()
14271368
tdb.info3 = rdb[ch].info3
14281369
tdb.info3_1 = rdb[ch].info3_1
14291370
tdb.info3_2 = rdb[ch].info3_2
1430-
tdb.info4 = rdb[ch].info4
1431-
tdb.info4_1 = rdb[ch].info4_1
1432-
tdb.info4_2 = rdb[ch].info4_2
14331371
end,
14341372
confirm = function() return L["Confirm copy"] end,
14351373
order = 92

0 commit comments

Comments
 (0)