From 4fdd25f4a4a0dce1972ce5ccc2d486d140f31527 Mon Sep 17 00:00:00 2001 From: Brad Morgan Date: Wed, 19 May 2021 15:35:25 -0600 Subject: [PATCH] Add global data for connected realms Add WoW Version info to title --- Skillet.lua | 39 ++++++++++++++++++++++++++++++++++++++- UI/MainFrame.lua | 4 ++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/Skillet.lua b/Skillet.lua index de8b063..5eef57c 100644 --- a/Skillet.lua +++ b/Skillet.lua @@ -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 @@ -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 = {} @@ -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() diff --git a/UI/MainFrame.lua b/UI/MainFrame.lua index 22cb316..5f71a71 100644 --- a/UI/MainFrame.lua +++ b/UI/MainFrame.lua @@ -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"] @@ -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