mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-17 10:10:50 +00:00
cache locales on startup, set enUS as default
This commit is contained in:
+9
-9
@@ -255,27 +255,27 @@ pfUI:RegisterModule("castbar", function ()
|
|||||||
|
|
||||||
pfUI.castbar.target:SetScript("OnEvent", function()
|
pfUI.castbar.target:SetScript("OnEvent", function()
|
||||||
if (arg1 ~= nil) then
|
if (arg1 ~= nil) then
|
||||||
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[GetLocale()]['SPELL_CAST']) do
|
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_CAST']) do
|
||||||
pfUI.castbar.target:Action(mob, spell, "casts")
|
pfUI.castbar.target:Action(mob, spell, "casts")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[GetLocale()]['SPELL_PERFORM']) do
|
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_PERFORM']) do
|
||||||
pfUI.castbar.target:Action(mob, spell, "performs")
|
pfUI.castbar.target:Action(mob, spell, "performs")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[GetLocale()]['SPELL_GAINS']) do
|
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_GAINS']) do
|
||||||
pfUI.castbar.target:Action(mob, spell, "gains")
|
pfUI.castbar.target:Action(mob, spell, "gains")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[GetLocale()]['SPELL_AFFLICTED']) do
|
for mob, spell in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_AFFLICTED']) do
|
||||||
pfUI.castbar.target:Action(mob, spell, "afflicted")
|
pfUI.castbar.target:Action(mob, spell, "afflicted")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for spell, mob in string.gfind(arg1, pfLocaleSpellEvents[GetLocale()]['SPELL_HIT']) do
|
for spell, mob in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['SPELL_HIT']) do
|
||||||
pfUI.castbar.target:Action(mob, spell, "hit")
|
pfUI.castbar.target:Action(mob, spell, "hit")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for spell, mob in string.gfind(arg1, pfLocaleSpellEvents[GetLocale()]['OTHER_SPELL_HIT']) do
|
for spell, mob in string.gfind(arg1, pfLocaleSpellEvents[pfUI.cache["locale"]]['OTHER_SPELL_HIT']) do
|
||||||
pfUI.castbar.target:Action(mob, spell, "hit")
|
pfUI.castbar.target:Action(mob, spell, "hit")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -314,9 +314,9 @@ pfUI:RegisterModule("castbar", function ()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function pfUI.castbar.target:Action(mob, spell, special)
|
function pfUI.castbar.target:Action(mob, spell, special)
|
||||||
if pfLocaleSpells[GetLocale()][spell] ~= nil then
|
if pfLocaleSpells[pfUI.cache["locale"]][spell] ~= nil then
|
||||||
casttime = pfLocaleSpells[GetLocale()][spell].t / 1000
|
casttime = pfLocaleSpells[pfUI.cache["locale"]][spell].t / 1000
|
||||||
icon = pfLocaleSpells[GetLocale()][spell].icon
|
icon = pfLocaleSpells[pfUI.cache["locale"]][spell].icon
|
||||||
pfUI.castbar.target.casterDB[mob] = {cast = spell, starttime = GetTime(), casttime = casttime, icon = icon}
|
pfUI.castbar.target.casterDB[mob] = {cast = spell, starttime = GetTime(), casttime = casttime, icon = icon}
|
||||||
if UnitExists("target") and pfUI.castbar.target.casterDB[UnitName("target")] then
|
if UnitExists("target") and pfUI.castbar.target.casterDB[UnitName("target")] then
|
||||||
pfUI.castbar.target:Show()
|
pfUI.castbar.target:Show()
|
||||||
|
|||||||
+8
-8
@@ -110,8 +110,8 @@ pfUI:RegisterModule("chat", function ()
|
|||||||
local Name, Class, Level
|
local Name, Class, Level
|
||||||
for i = 1, GetNumFriends() do
|
for i = 1, GetNumFriends() do
|
||||||
Name, Level, Class = GetFriendInfo(i)
|
Name, Level, Class = GetFriendInfo(i)
|
||||||
if pfLocaleClass[GetLocale()] and pfLocaleClass[GetLocale()][Class] then
|
if pfLocaleClass[pfUI.cache["locale"]] and pfLocaleClass[pfUI.cache["locale"]][Class] then
|
||||||
Class = pfLocaleClass[GetLocale()][Class]
|
Class = pfLocaleClass[pfUI.cache["locale"]][Class]
|
||||||
end
|
end
|
||||||
pfUI_playerDB[Name] = { class = Class, level = Level }
|
pfUI_playerDB[Name] = { class = Class, level = Level }
|
||||||
end
|
end
|
||||||
@@ -119,8 +119,8 @@ pfUI:RegisterModule("chat", function ()
|
|||||||
local Name, Class, Level
|
local Name, Class, Level
|
||||||
for i = 1, GetNumGuildMembers() do
|
for i = 1, GetNumGuildMembers() do
|
||||||
Name, _, _, Level, Class = GetGuildRosterInfo(i)
|
Name, _, _, Level, Class = GetGuildRosterInfo(i)
|
||||||
if pfLocaleClass[GetLocale()] and pfLocaleClass[GetLocale()][Class] then
|
if pfLocaleClass[pfUI.cache["locale"]] and pfLocaleClass[pfUI.cache["locale"]][Class] then
|
||||||
Class = pfLocaleClass[GetLocale()][Class]
|
Class = pfLocaleClass[pfUI.cache["locale"]][Class]
|
||||||
end
|
end
|
||||||
if Name and Level and Class and pfUI_playerDB then
|
if Name and Level and Class and pfUI_playerDB then
|
||||||
pfUI_playerDB[Name] = { class = Class, level = Level }
|
pfUI_playerDB[Name] = { class = Class, level = Level }
|
||||||
@@ -131,8 +131,8 @@ pfUI:RegisterModule("chat", function ()
|
|||||||
local Name, Class, SubGroup, Level
|
local Name, Class, SubGroup, Level
|
||||||
for i = 1, GetNumRaidMembers() do
|
for i = 1, GetNumRaidMembers() do
|
||||||
Name, _, SubGroup, Level, Class = GetRaidRosterInfo(i)
|
Name, _, SubGroup, Level, Class = GetRaidRosterInfo(i)
|
||||||
if pfLocaleClass[GetLocale()] and pfLocaleClass[GetLocale()].Class then
|
if pfLocaleClass[pfUI.cache["locale"]] and pfLocaleClass[pfUI.cache["locale"]].Class then
|
||||||
Class = pfLocaleClass[GetLocale()][Class]
|
Class = pfLocaleClass[pfUI.cache["locale"]][Class]
|
||||||
end
|
end
|
||||||
pfUI_playerDB[Name] = { class = Class, level = Level }
|
pfUI_playerDB[Name] = { class = Class, level = Level }
|
||||||
end
|
end
|
||||||
@@ -157,8 +157,8 @@ pfUI:RegisterModule("chat", function ()
|
|||||||
local Name, Class, Level
|
local Name, Class, Level
|
||||||
for i = 1, GetNumWhoResults() do
|
for i = 1, GetNumWhoResults() do
|
||||||
Name, _, Level, _, Class, _ = GetWhoInfo(i)
|
Name, _, Level, _, Class, _ = GetWhoInfo(i)
|
||||||
if pfLocaleClass[GetLocale()] and pfLocaleClass[GetLocale()][Class] then
|
if pfLocaleClass[pfUI.cache["locale"]] and pfLocaleClass[pfUI.cache["locale"]][Class] then
|
||||||
Class = pfLocaleClass[GetLocale()][Class]
|
Class = pfLocaleClass[pfUI.cache["locale"]][Class]
|
||||||
end
|
end
|
||||||
pfUI_playerDB[Name] = { class = Class, level = Level }
|
pfUI_playerDB[Name] = { class = Class, level = Level }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,6 +20,16 @@ end
|
|||||||
pfUI = CreateFrame("Frame",nil,UIParent)
|
pfUI = CreateFrame("Frame",nil,UIParent)
|
||||||
pfUI:RegisterEvent("ADDON_LOADED")
|
pfUI:RegisterEvent("ADDON_LOADED")
|
||||||
pfUI:SetScript("OnEvent", function()
|
pfUI:SetScript("OnEvent", function()
|
||||||
|
|
||||||
|
pfUI.cache["locale"] = GetLocale()
|
||||||
|
if pfUI.cache["locale"] ~= "enUS" and
|
||||||
|
pfUI.cache["locale"] ~= "frFR" and
|
||||||
|
pfUI.cache["locale"] ~= "deDE" and
|
||||||
|
pfUI.cache["locale"] ~= "zhCN" and
|
||||||
|
pfUI.cache["locale"] ~= "ruRU" then
|
||||||
|
pfUI.cache["locale"] = "enUS"
|
||||||
|
end
|
||||||
|
|
||||||
pfUI:LoadConfig()
|
pfUI:LoadConfig()
|
||||||
if arg1 == "pfUI" then
|
if arg1 == "pfUI" then
|
||||||
pfUI:Debug("pfUI module loader:")
|
pfUI:Debug("pfUI module loader:")
|
||||||
@@ -32,6 +42,7 @@ pfUI:SetScript("OnEvent", function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
pfUI.cache = {}
|
||||||
pfUI.module = {}
|
pfUI.module = {}
|
||||||
pfUI.modules = {}
|
pfUI.modules = {}
|
||||||
pfLocaleClass = {}
|
pfLocaleClass = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user