mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-13 08:50:50 +00:00
api: rework of locale system
This commit is contained in:
+30
-30
@@ -6,46 +6,46 @@ pfUI:RegisterModule("autoshift", function ()
|
||||
pfUI.autoshift.CastSpellByName = _G["CastSpellByName"]
|
||||
|
||||
Hook("CastSpell", function(spellId, spellbookTabNum)
|
||||
if pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleDefStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleBerserkStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBerserkerStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantDefensiveStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['DefensiveStance'])
|
||||
if pfUI.autoshift.lastError == L["stances"]['wantBattleStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantBattleDefStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantBattleBerserkStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantBerserkerStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantDefensiveStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['DefensiveStance'])
|
||||
end
|
||||
pfUI.autoshift.lastError = ""
|
||||
end)
|
||||
|
||||
Hook("CastSpellByName", function(spellName, onSelf)
|
||||
if pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleDefStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleBerserkStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBerserkerStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantDefensiveStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['DefensiveStance'])
|
||||
if pfUI.autoshift.lastError == L["stances"]['wantBattleStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantBattleDefStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantBattleBerserkStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantBerserkerStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantDefensiveStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['DefensiveStance'])
|
||||
end
|
||||
pfUI.autoshift.lastError = ""
|
||||
end)
|
||||
|
||||
Hook("UseAction", function(slot, checkCursor, onSelf)
|
||||
if pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleDefStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleBerserkStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBerserkerStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantDefensiveStance'] then
|
||||
pfUI.autoshift.CastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['DefensiveStance'])
|
||||
if pfUI.autoshift.lastError == L["stances"]['wantBattleStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantBattleDefStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BattleStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantBattleBerserkStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantBerserkerStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['BerserkerStance'])
|
||||
elseif pfUI.autoshift.lastError == L["stances"]['wantDefensiveStance'] then
|
||||
pfUI.autoshift.CastSpellByName(L["stances"]['DefensiveStance'])
|
||||
end
|
||||
pfUI.autoshift.lastError = ""
|
||||
end)
|
||||
|
||||
+2
-2
@@ -312,8 +312,8 @@ pfUI:RegisterModule("bags", function ()
|
||||
local _, _, id = strfind(GetInventoryItemLink("player", ContainerIDToInventoryID(bag)) or "", "item:(%d+)")
|
||||
if id then
|
||||
local _, _, _, _, itemType, subType = GetItemInfo(id)
|
||||
bagtype = pfLocaleBagtypes[pfUI.cache["locale"]][itemType]
|
||||
bagsubtype = pfLocaleBagtypes[pfUI.cache["locale"]][subType]
|
||||
bagtype = L["bagtypes"][itemType]
|
||||
bagsubtype = L["bagtypes"][subType]
|
||||
|
||||
if bagsubtype == "SOULBAG" then
|
||||
bagtype = "SOULBAG"
|
||||
|
||||
+6
-6
@@ -78,8 +78,8 @@ pfUI:RegisterModule("castbar", function ()
|
||||
local scanner = CreateFrame("GameTooltip", "pfSpellScanner", nil, "GameTooltipTemplate")
|
||||
scanner:SetOwner(WorldFrame, "ANCHOR_NONE")
|
||||
|
||||
local aimedshot = pfCustomCastbar[pfUI.cache["locale"]]["AIMEDSHOT"]
|
||||
local multishot = pfCustomCastbar[pfUI.cache["locale"]]["MULTISHOT"]
|
||||
local aimedshot = L["customcast"]["AIMEDSHOT"]
|
||||
local multishot = L["customcast"]["MULTISHOT"]
|
||||
|
||||
pfUI.castbar.player[aimedshot] = function(begin)
|
||||
if begin then
|
||||
@@ -473,9 +473,9 @@ pfUI:RegisterModule("castbar", function ()
|
||||
end)
|
||||
|
||||
function pfUI.castbar.target:Action(mob, spell)
|
||||
if pfLocaleSpells[pfUI.cache["locale"]][spell] ~= nil then
|
||||
local casttime = pfLocaleSpells[pfUI.cache["locale"]][spell].t / 1000
|
||||
local icon = pfLocaleSpells[pfUI.cache["locale"]][spell].icon
|
||||
if L["spells"][spell] ~= nil then
|
||||
local casttime = L["spells"][spell].t / 1000
|
||||
local icon = L["spells"][spell].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 C.castbar.target.hide_pfui == "1" then
|
||||
@@ -490,7 +490,7 @@ pfUI:RegisterModule("castbar", function ()
|
||||
end
|
||||
|
||||
function pfUI.castbar.target:StopAction(mob, spell)
|
||||
if pfUI.castbar.target.casterDB[mob] and pfLocaleSpellInterrupts[pfUI.cache["locale"]][spell] ~= nil then
|
||||
if pfUI.castbar.target.casterDB[mob] and L["interrupts"][spell] ~= nil then
|
||||
pfUI.castbar.target.casterDB[mob] = nil
|
||||
end
|
||||
end
|
||||
|
||||
+8
-8
@@ -402,8 +402,8 @@ pfUI:RegisterModule("chat", function ()
|
||||
local Name, Class, Level
|
||||
for i = 1, GetNumFriends() do
|
||||
Name, Level, Class = GetFriendInfo(i)
|
||||
if pfLocaleClass[pfUI.cache["locale"]] and pfLocaleClass[pfUI.cache["locale"]][Class] then
|
||||
Class = pfLocaleClass[pfUI.cache["locale"]][Class]
|
||||
if L["class"] and L["class"][Class] then
|
||||
Class = L["class"][Class]
|
||||
end
|
||||
pfUI_playerDB[Name] = { class = Class, level = Level }
|
||||
end
|
||||
@@ -411,8 +411,8 @@ pfUI:RegisterModule("chat", function ()
|
||||
local Name, Class, Level
|
||||
for i = 1, GetNumGuildMembers() do
|
||||
Name, _, _, Level, Class = GetGuildRosterInfo(i)
|
||||
if pfLocaleClass[pfUI.cache["locale"]] and pfLocaleClass[pfUI.cache["locale"]][Class] then
|
||||
Class = pfLocaleClass[pfUI.cache["locale"]][Class]
|
||||
if L["class"] and L["class"][Class] then
|
||||
Class = L["class"][Class]
|
||||
end
|
||||
if Name and Level and Class and pfUI_playerDB then
|
||||
pfUI_playerDB[Name] = { class = Class, level = Level }
|
||||
@@ -423,8 +423,8 @@ pfUI:RegisterModule("chat", function ()
|
||||
local Name, Class, SubGroup, Level
|
||||
for i = 1, GetNumRaidMembers() do
|
||||
Name, _, SubGroup, Level, Class = GetRaidRosterInfo(i)
|
||||
if pfLocaleClass[pfUI.cache["locale"]] and pfLocaleClass[pfUI.cache["locale"]].Class then
|
||||
Class = pfLocaleClass[pfUI.cache["locale"]][Class]
|
||||
if L["class"] and L["class"].Class then
|
||||
Class = L["class"][Class]
|
||||
end
|
||||
pfUI_playerDB[Name] = { class = Class, level = Level }
|
||||
end
|
||||
@@ -449,8 +449,8 @@ pfUI:RegisterModule("chat", function ()
|
||||
local Name, Class, Level
|
||||
for i = 1, GetNumWhoResults() do
|
||||
Name, _, Level, _, Class, _ = GetWhoInfo(i)
|
||||
if pfLocaleClass[pfUI.cache["locale"]] and pfLocaleClass[pfUI.cache["locale"]][Class] then
|
||||
Class = pfLocaleClass[pfUI.cache["locale"]][Class]
|
||||
if L["class"] and L["class"][Class] then
|
||||
Class = L["class"][Class]
|
||||
end
|
||||
pfUI_playerDB[Name] = { class = Class, level = Level }
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pfUI:RegisterModule("eqcompare", function ()
|
||||
local loc = pfUI.cache["locale"]
|
||||
for key, value in pairs(pfLocaleInvtypes[loc]) do setglobal(key, value) end
|
||||
for key, value in pairs(L["itemtypes"]) do setglobal(key, value) end
|
||||
INVTYPE_WEAPON_OTHER = INVTYPE_WEAPON.."_other";
|
||||
INVTYPE_FINGER_OTHER = INVTYPE_FINGER.."_other";
|
||||
INVTYPE_TRINKET_OTHER = INVTYPE_TRINKET.."_other";
|
||||
|
||||
@@ -23,9 +23,9 @@ pfUI:RegisterModule("hunterbar", function ()
|
||||
pfUI.hunterbar.scanner:SetAction(i)
|
||||
|
||||
if pfHunterBarScannerTextLeft1 and pfHunterBarScannerTextLeft1:GetText() then
|
||||
if pfHunterBarScannerTextLeft1:GetText() == pfLocaleHunterbars[pfUI.cache["locale"]]["MELEE"] then
|
||||
if pfHunterBarScannerTextLeft1:GetText() == L["hunterpaging"]["MELEE"] then
|
||||
pfUI.hunterbar.melee = i
|
||||
elseif pfHunterBarScannerTextLeft1:GetText() == pfLocaleHunterbars[pfUI.cache["locale"]]["RANGED"] then
|
||||
elseif pfHunterBarScannerTextLeft1:GetText() == L["hunterpaging"]["RANGED"] then
|
||||
pfUI.hunterbar.ranged = i
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user