diff --git a/env/locales_deDE.lua b/env/locales_deDE.lua index 2a85f7aa..3f417960 100644 --- a/env/locales_deDE.lua +++ b/env/locales_deDE.lua @@ -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.", diff --git a/env/locales_enUS.lua b/env/locales_enUS.lua index a56326cf..eff5404a 100644 --- a/env/locales_enUS.lua +++ b/env/locales_enUS.lua @@ -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 (.+).", diff --git a/env/locales_frFR.lua b/env/locales_frFR.lua index a0f20e32..79ee5485 100644 --- a/env/locales_frFR.lua +++ b/env/locales_frFR.lua @@ -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 (.+).", diff --git a/env/locales_ruRU.lua b/env/locales_ruRU.lua index a51a4cda..36a62a78 100644 --- a/env/locales_ruRU.lua +++ b/env/locales_ruRU.lua @@ -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 (.+).", diff --git a/env/locales_zhCN.lua b/env/locales_zhCN.lua index 6f9ef786..1c8924a0 100644 --- a/env/locales_zhCN.lua +++ b/env/locales_zhCN.lua @@ -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 (.+).", diff --git a/modules/autoshift.lua b/modules/autoshift.lua index fe81498b..6d997e9b 100644 --- a/modules/autoshift.lua +++ b/modules/autoshift.lua @@ -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 diff --git a/pfUI.lua b/pfUI.lua index 5afdfd2d..8bc67170 100644 --- a/pfUI.lua +++ b/pfUI.lua @@ -46,6 +46,7 @@ pfUI.cache = {} pfUI.module = {} pfUI.modules = {} pfLocaleClass = {} +pfLocaleShift = {} pfLocaleSpells = {} pfLocaleSpellEvents = {} pfLocaleSpellInterrupts = {}