multi-locale support for autoshift

This commit is contained in:
shagu
2016-08-15 20:41:24 +02:00
parent d9ca439ee2
commit f55eb8b9be
7 changed files with 103 additions and 50 deletions
+11
View File
@@ -10,6 +10,17 @@ pfLocaleClass["deDE"] = {
["Schurke"] = "ROGUE",
}
pfLocaleShift["deDE"] = {
['BattleStance'] = "Kampfhaltung",
['DefensiveStance'] = "Verteidigungshaltung",
['BerserkerStance'] = "Berserkerhaltung",
['wantBattleStance'] = "Muss in Kampfhaltung sein.",
['wantDefensiveStance'] = "Muss in Verteidigungshaltung sein.",
['wantBerserkerStance'] = "Muss in Berserkerhaltung sein.",
['wantBattleDefStance'] = "Muss in Kampfhaltung, Verteidigungshaltung sein.",
['wantBattleBerserkStance'] = "Muss in Kampfhaltung, Berserkerhaltung sein.",
}
pfLocaleSpellEvents["deDE"] = {
['SPELL_GAINS'] = "(.+) bekommt (.+).",
['SPELL_CAST'] = "(.+) beginnt (.+) zu wirken.",
+11
View File
@@ -10,6 +10,17 @@ pfLocaleClass["enUS"] = {
["Rogue"] = "ROGUE",
}
pfLocaleShift["enUS"] = {
['BattleStance'] = "Battle Stance",
['DefensiveStance'] = "Defensive Stance",
['BerserkerStance'] = "Berserker Stance",
['wantBattleStance'] = "Must be in Battle Stance",
['wantDefensiveStance'] = "Must be in Defensive Stance",
['wantBerserkerStance'] = "Must be in Berserker Stance",
['wantBattleDefStance'] = "Must be in Battle Stance, Defensive Stance",
['wantBattleBerserkStance'] = "Must be in Battle Stance, Berserker Stance",
}
pfLocaleSpellEvents["enUS"] = {
['SPELL_GAINS'] = "(.+) gains (.+).",
['SPELL_CAST'] = "(.+) begins to cast (.+).",
+11
View File
@@ -10,6 +10,17 @@ pfLocaleClass["frFR"] = {
["Voleur"] = "ROGUE",
}
pfLocaleShift["frFR"] = { -- TODO
['BattleStance'] = "Battle Stance",
['DefensiveStance'] = "Defensive Stance",
['BerserkerStance'] = "Berserker Stance",
['wantBattleStance'] = "Must be in Battle Stance",
['wantDefensiveStance'] = "Must be in Defensive Stance",
['wantBerserkerStance'] = "Must be in Berserker Stance",
['wantBattleDefStance'] = "Must be in Battle Stance, Defensive Stance",
['wantBattleBerserkStance'] = "Must be in Battle Stance, Berserker Stance",
}
pfLocaleSpellEvents["frFR"] = { -- TODO
['SPELL_GAINS'] = "(.+) gains (.+).",
['SPELL_CAST'] = "(.+) begins to cast (.+).",
+11
View File
@@ -10,6 +10,17 @@ pfLocaleClass["ruRU"] = {
["Разбойница"] = "ROGUE",
}
pfLocaleShift["ruRU"] = { -- TODO
['BattleStance'] = "Battle Stance",
['DefensiveStance'] = "Defensive Stance",
['BerserkerStance'] = "Berserker Stance",
['wantBattleStance'] = "Must be in Battle Stance",
['wantDefensiveStance'] = "Must be in Defensive Stance",
['wantBerserkerStance'] = "Must be in Berserker Stance",
['wantBattleDefStance'] = "Must be in Battle Stance, Defensive Stance",
['wantBattleBerserkStance'] = "Must be in Battle Stance, Berserker Stance",
}
pfLocaleSpellEvents["ruRU"] = { -- TODO
['SPELL_GAINS'] = "(.+) gains (.+).",
['SPELL_CAST'] = "(.+) begins to cast (.+).",
+11
View File
@@ -10,6 +10,17 @@ pfLocaleClass["zhCN"] = {
["盗贼"] = "ROGUE",
}
pfLocaleShift["zhCN"] = { -- TODO
['BattleStance'] = "Battle Stance",
['DefensiveStance'] = "Defensive Stance",
['BerserkerStance'] = "Berserker Stance",
['wantBattleStance'] = "Must be in Battle Stance",
['wantDefensiveStance'] = "Must be in Defensive Stance",
['wantBerserkerStance'] = "Must be in Berserker Stance",
['wantBattleDefStance'] = "Must be in Battle Stance, Defensive Stance",
['wantBattleBerserkStance'] = "Must be in Battle Stance, Berserker Stance",
}
pfLocaleSpellEvents["zhCN"] = { -- TODO
['SPELL_GAINS'] = "(.+) gains (.+).",
['SPELL_CAST'] = "(.+) begins to cast (.+).",
+47 -50
View File
@@ -2,88 +2,85 @@ pfUI:RegisterModule("autoshift", function ()
pfUI.autoshift = CreateFrame("Frame")
pfUI.autoshift:RegisterEvent("UI_ERROR_MESSAGE")
pfUI.autoshift.LastErr = ""
Hook_CastSpell = CastSpell
Hook_CastSpellByName = CastSpellByName
Hook_UseAction = UseAction
-- deDE
pfUI.autoshift.wantBattleStance = "Muss in Kampfhaltung sein."
pfUI.autoshift.wantBattleDefStance = "Muss in Kampfhaltung, Verteidigungshaltung sein."
pfUI.autoshift.BattleStance = "Kampfhaltung"
pfUI.autoshift.BattleStance = "Kampfhaltung"
pfUI.autoshift.wantBerserkerStance = "Muss in Berserkerhaltung sein."
pfUI.autoshift.BerserkerStance = "Berserkerhaltung"
pfUI.autoshift.wantDefensiveStance = "Muss in Verteidigungshaltung sein."
pfUI.autoshift.DefensiveStance = "Verteidigungshaltung"
pfUI.autoshift.lastError = ""
pfUI.autoshift.hookCastSpell = CastSpell
pfUI.autoshift.hookCastSpellByName = CastSpellByName
pfUI.autoshift.hookUseAction = UseAction
function CastSpell(spellId, spellbookTabNum)
if pfUI.autoshift.LastErr == pfUI.autoshift.wantBattleStance then
Hook_CastSpellByName(pfUI.autoshift.BattleStance)
elseif pfUI.autoshift.LastErr == pfUI.autoshift.wantBattleDefStance then
Hook_CastSpellByName(pfUI.autoshift.BattleStance)
elseif pfUI.autoshift.LastErr == pfUI.autoshift.wantBerserkerStance then
Hook_CastSpellByName(pfUI.autoshift.BerserkerStance)
elseif pfUI.autoshift.LastErr == pfUI.autoshift.wantDefensiveStance then
Hook_CastSpellByName(pfUI.autoshift.DefensiveStance)
if pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleDefStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleBerserkStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBerserkerStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantDefensiveStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['DefensiveStance'])
end
pfUI.autoshift.LastErr = ""
pfUI.autoshift.lastError = ""
Hook_CastSpell(spellId, spellbookTabNum)
pfUI.autoshift.hookCastSpell(spellId, spellbookTabNum)
end
function CastSpellByName(spellName, onSelf)
if pfUI.autoshift.LastErr == pfUI.autoshift.wantBattleStance then
Hook_CastSpellByName(pfUI.autoshift.BattleStance)
elseif pfUI.autoshift.LastErr == pfUI.autoshift.wantBattleDefStance then
Hook_CastSpellByName(pfUI.autoshift.BattleStance)
elseif pfUI.autoshift.LastErr == pfUI.autoshift.wantBerserkerStance then
Hook_CastSpellByName(pfUI.autoshift.BerserkerStance)
elseif pfUI.autoshift.LastErr == pfUI.autoshift.wantDefensiveStance then
Hook_CastSpellByName(pfUI.autoshift.DefensiveStance)
if pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleDefStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleBerserkStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBerserkerStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantDefensiveStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['DefensiveStance'])
end
pfUI.autoshift.LastErr = ""
pfUI.autoshift.lastError = ""
Hook_CastSpellByName(spellName, onSelf)
pfUI.autoshift.hookCastSpellByName(spellName, onSelf)
end
function UseAction(slot, checkCursor, onSelf)
if pfUI.autoshift.LastErr == pfUI.autoshift.wantBattleStance then
Hook_CastSpellByName(pfUI.autoshift.BattleStance)
elseif pfUI.autoshift.LastErr == pfUI.autoshift.wantBattleDefStance then
Hook_CastSpellByName(pfUI.autoshift.BattleStance)
elseif pfUI.autoshift.LastErr == pfUI.autoshift.wantBerserkerStance then
Hook_CastSpellByName(pfUI.autoshift.BerserkerStance)
elseif pfUI.autoshift.LastErr == pfUI.autoshift.wantDefensiveStance then
Hook_CastSpellByName(pfUI.autoshift.DefensiveStance)
if pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleDefStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BattleStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBattleBerserkStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantBerserkerStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['BerserkerStance'])
elseif pfUI.autoshift.lastError == pfLocaleShift[pfUI.cache["locale"]]['wantDefensiveStance'] then
pfUI.autoshift.hookCastSpellByName(pfLocaleShift[pfUI.cache["locale"]]['DefensiveStance'])
end
pfUI.autoshift.LastErr = ""
pfUI.autoshift.lastError = ""
Hook_UseAction(slot, checkCursor, onSelf)
pfUI.autoshift.hookUseAction(slot, checkCursor, onSelf)
end
pfUI.autoshift.Buffs = { "spell_nature_swiftness", "_mount_", "_qirajicrystal_",
pfUI.autoshift.buffs = { "spell_nature_swiftness", "_mount_", "_qirajicrystal_",
"ability_racial_bearform", "ability_druid_catform", "ability_druid_travelform",
"spell_nature_forceofnature", "ability_druid_aquaticform", "spell_shadow_shadowform",
"spell_nature_spiritwolf" }
pfUI.autoshift.Errors = { SPELL_FAILED_NOT_MOUNTED, ERR_ATTACK_MOUNTED, ERR_TAXIPLAYERALREADYMOUNTED,
pfUI.autoshift.errors = { SPELL_FAILED_NOT_MOUNTED, ERR_ATTACK_MOUNTED, ERR_TAXIPLAYERALREADYMOUNTED,
SPELL_FAILED_NOT_SHAPESHIFT, SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED, SPELL_NOT_SHAPESHIFTED,
SPELL_NOT_SHAPESHIFTED_NOSPACE, ERR_CANT_INTERACT_SHAPESHIFTED, ERR_NOT_WHILE_SHAPESHIFTED,
ERR_NO_ITEMS_WHILE_SHAPESHIFTED, ERR_TAXIPLAYERSHAPESHIFTED,ERR_MOUNT_SHAPESHIFTED,
ERR_EMBLEMERROR_NOTABARDGEOSET }
pfUI.autoshift:SetScript("OnEvent", function()
pfUI.autoshift.LastErr = arg1
pfUI.autoshift.lastError = arg1
for id, errorstring in pairs(pfUI.autoshift.Errors) do
for id, errorstring in pairs(pfUI.autoshift.errors) do
if arg1 == errorstring then
for i=0,15,1 do
currBuffTex = GetPlayerBuffTexture(i);
if (currBuffTex) then
for id, bufftype in pairs(pfUI.autoshift.Buffs) do
for id, bufftype in pairs(pfUI.autoshift.buffs) do
if string.find(string.lower(currBuffTex), bufftype) then
CancelPlayerBuff(i);
CancelPlayerBuff(i)
return
end
end
end
+1
View File
@@ -46,6 +46,7 @@ pfUI.cache = {}
pfUI.module = {}
pfUI.modules = {}
pfLocaleClass = {}
pfLocaleShift = {}
pfLocaleSpells = {}
pfLocaleSpellEvents = {}
pfLocaleSpellInterrupts = {}