Skip to content

Commit

Permalink
Add global data for connected realms
Browse files Browse the repository at this point in the history
Add WoW Version info to title
  • Loading branch information
b-morgan committed May 19, 2021
1 parent fd56499 commit 4fdd25f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
39 changes: 38 additions & 1 deletion Skillet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Skillet.L = L

-- Get version info from the .toc file
local MAJOR_VERSION = GetAddOnMetadata("Skillet-Classic", "Version");
local ADDON_BUILD = ((select(4, GetBuildInfo())) < 20000 and "Classic") or ((select(4, GetBuildInfo())) < 80000 and "TBC") or "Retail"
local ADDON_BUILD = ((select(4, GetBuildInfo())) < 20000 and "Classic") or ((select(4, GetBuildInfo())) < 80000 and "BCC") or "Retail"
Skillet.version = MAJOR_VERSION
Skillet.build = ADDON_BUILD
Skillet.project = WOW_PROJECT_ID
Expand Down Expand Up @@ -505,6 +505,18 @@ function Skillet:InitializeDatabase(player, clean)
if not self.data.skillIndexLookup[player] or clean then
self.data.skillIndexLookup[player] = {}
end
if not self.db.realm.faction then
self.db.realm.faction = {}
end
if not self.db.realm.guid then
self.db.realm.guid = {}
end
if not self.db.global.faction then
self.db.global.faction = {}
end
if not self.db.global.server then
self.db.global.server = {}
end
if player == UnitName("player") then
if not self.db.realm.inventoryData then
self.db.realm.inventoryData = {}
Expand Down Expand Up @@ -683,12 +695,37 @@ function Skillet:PLAYER_ENTERING_WORLD()
local player = UnitName("player")
local realm = GetRealmName()
local faction = UnitFactionGroup("player")
local guid = UnitGUID("player") -- example: guid="Player-970-0002FD64" kind=="Player" server=="970" ID="0002FD64"
--
-- Store some identifying data in the per character saved variables file
--
SkilletWho.player = player
SkilletWho.realm = realm
SkilletWho.faction = faction
SkilletWho.guid = guid
if guid then
local kind, server, ID = strsplit("-", guid)
DA.DEBUG(1,"player="..tostring(player)..", faction="..tostring(faction)..", guid="..tostring(guid)..", server="..tostring(server))
--
-- If we support data sharing across connected realms, then
-- Skillet.db.realm.* data needs to move to
-- Skillet.db.global.* data indexed by server.
--
self.db.realm.guid[player]= guid
self.db.realm.faction[player] = faction
if (server) then
self.data.server = server
self.data.realm = realm
if not self.db.global.server[server] then
self.db.global.server[server] = {}
end
self.db.global.server[server][realm] = player
if not self.db.global.faction[server] then
self.db.global.faction[server] = {}
end
self.db.global.faction[server][player] = faction
end
end
end

function Skillet:ADDON_ACTION_BLOCKED()
Expand Down
4 changes: 2 additions & 2 deletions UI/MainFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function Skillet:CreateTradeSkillWindow()
titletext:SetShadowColor(0,0,0)
titletext:SetShadowOffset(1,-1)
titletext:SetTextColor(1,1,1)
titletext:SetText(L["Skillet Trade Skills"].." "..Skillet.version)
titletext:SetText(L["Skillet Trade Skills"].." "..Skillet.version.." ("..Skillet.wowVersion..")")
local label = _G["SkilletSearchLabel"]
label:SetText(L["Search"])
local label = _G["SkilletFilterLabel"]
Expand Down Expand Up @@ -933,7 +933,7 @@ function Skillet:UpdateTradeSkillWindow()
if not tradeName then tradeName = "" end
local title = _G["SkilletTitleText"];
if title then
title:SetText(L["Skillet Trade Skills"] .. " "..self.version..": " .. self.currentPlayer .. "/" .. tradeName)
title:SetText(L["Skillet Trade Skills"] .. " "..self.version.." ("..Skillet.wowVersion.."): " .. self.currentPlayer .. "/" .. tradeName)
end
local sortedSkillList = self.data.sortedSkillList[skillListKey]
local rank,maxRank = 0,0
Expand Down

0 comments on commit 4fdd25f

Please sign in to comment.