Skip to content

Commit

Permalink
hunterbar: add range based auto paging
Browse files Browse the repository at this point in the history
  • Loading branch information
shagu committed Dec 30, 2016
1 parent 697bfad commit dc3c89b
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 0 deletions.
5 changes: 5 additions & 0 deletions env/locales_deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pfLocaleSpellInterrupts["deDE"] = {
["Erdschock"] = true;
}

pfLocaleHunterbars["deDE"] = {
["MELEE"] = "Raptorstoß",
["RANGED"] = "Arkaner Schuss",
}

pfLocaleSpells["deDE"] = {
['Eisenherz nimmt wieder Huhngestalt an'] = {t=1000, icon="Ability_Racial_BearForm" };
['Monstrositätenspucke'] = {t=2500, icon="Spell_Nature_CorrosiveBreath" };
Expand Down
5 changes: 5 additions & 0 deletions env/locales_enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pfLocaleSpellInterrupts["enUS"] = {
["Earth Shock"] = true;
}

pfLocaleHunterbars["enUS"] = {
["MELEE"] = "Raptor Strike",
["RANGED"] = "Arcane Shot",
}

pfLocaleSpells["enUS"] = {
['"Plucky" Resumes Chicken Form'] = {t=1000, icon="Ability_Racial_BearForm" };
['Abomination Spit'] = {t=2500, icon="Spell_Nature_CorrosiveBreath" };
Expand Down
5 changes: 5 additions & 0 deletions env/locales_frFR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pfLocaleSpellInterrupts["frFR"] = {
["Horion de terre"] = true;
}

pfLocaleHunterbars["frFR"] = {
["MELEE"] = "Attaque du raptor",
["RANGED"] = "Tir des Arcanes",
}

pfLocaleSpells["frFR"] = {
['Le Brave reprend sa forme de poulet'] = {t=1000, icon="Ability_Racial_BearForm" };
['Crachat d\'abomination'] = {t=2500, icon="Spell_Nature_CorrosiveBreath" };
Expand Down
5 changes: 5 additions & 0 deletions env/locales_ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pfLocaleSpellInterrupts["ruRU"] = {
["Земной шок"] = true;
}

pfLocaleHunterbars["ruRU"] = {
["MELEE"] = "Удар ящера",
["RANGED"] = "Чародейский выстрел",
}

pfLocaleSpells["ruRU"] = {
['"Отчаянный" снова принимает облик цыпленка"'] = {t=1000, icon="Ability_Racial_BearForm" };
['Плевок мясника'] = {t=2500, icon="Spell_Nature_CorrosiveBreath" };
Expand Down
5 changes: 5 additions & 0 deletions env/locales_zhCN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pfLocaleSpellInterrupts["zhCN"] = {
["地震术"] = true;
}

pfLocaleHunterbars["zhCN"] = {
["MELEE"] = "猛禽一击",
["RANGED"] = "奥术射击",
}

pfLocaleSpells["zhCN"] = {
['"Plucky" Resumes Chicken Form'] = {t=1000, icon="Ability_Racial_BearForm" };
['憎恶喷吐'] = {t=2500, icon="Spell_Nature_CorrosiveBreath" };
Expand Down
1 change: 1 addition & 0 deletions modules/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("bars", nil, "background", "1")
pfUI:UpdateConfig("bars", nil, "glowrange", "1")
pfUI:UpdateConfig("bars", nil, "rangecolor", "1,0.1,0.1,1")
pfUI:UpdateConfig("bars", nil, "hunterbar", "1")
pfUI:UpdateConfig("bars", nil, "hide_time", "1")
pfUI:UpdateConfig("bars", nil, "hide_actionmain", "0")
pfUI:UpdateConfig("bars", nil, "hide_bottomleft", "0")
Expand Down
2 changes: 2 additions & 0 deletions modules/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,8 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.bar, "Show actionbar backgrounds", pfUI_config.bars, "background", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.bar, "Use colored icon as range indicator", pfUI_config.bars, "glowrange", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.bar, "Range indicator Color", pfUI_config.bars, "rangecolor", "color")
pfUI.gui:CreateConfig(pfUI.gui.bar, "Range based auto paging (Hunter)", pfUI_config.bars, "hunterbar", "checkbox")

pfUI.gui:CreateConfig(pfUI.gui.bar, "Seconds to wait until hide bars", pfUI_config.bars, "hide_time")
pfUI.gui:CreateConfig(pfUI.gui.bar, "Autohide main actionbar", pfUI_config.bars, "hide_actionmain", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.bar, "Autohide bottomleft actionbar", pfUI_config.bars, "hide_bottomleft", "checkbox")
Expand Down
48 changes: 48 additions & 0 deletions modules/hunterbar.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
pfUI:RegisterModule("hunterbar", function ()
local _,class = UnitClass("player")
if class ~= "HUNTER" or pfUI_config.bars.hunterbar == "0" then return end

pfUI.hunterbar = CreateFrame("Frame", "pfHunterBar", UIParent)
pfUI.hunterbar.scanner = CreateFrame("GameTooltip", "pfHunterBarScanner", UIParent, "GameTooltipTemplate")
pfUI.hunterbar.scanner:SetOwner(pfUI.hunterbar, "ANCHOR_NONE")

pfUI.hunterbar.melee = nil
pfUI.hunterbar.ranged = nil
pfUI.hunterbar.current = 1

pfUI.hunterbar:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
pfUI.hunterbar:RegisterEvent("PLAYER_ENTERING_WORLD")
pfUI.hunterbar:SetScript("OnEvent", function()
for i=1,120 do
if pfUI.hunterbar.melee and pfUI.hunterbar.ranged then return end

pfUI.hunterbar.scanner:ClearLines()
pfUI.hunterbar.scanner:SetAction(i)
if pfHunterBarScannerTextLeft1 then
if pfHunterBarScannerTextLeft1:GetText() == pfLocaleHunterbars[pfUI.cache["locale"]]["MELEE"] then
pfUI.hunterbar.melee = i
elseif pfHunterBarScannerTextLeft1:GetText() == pfLocaleHunterbars[pfUI.cache["locale"]]["RANGED"] then
pfUI.hunterbar.ranged = i
end
end
end
end)

pfUI.hunterbar:SetScript("OnUpdate", function()
if not pfUI.hunterbar.melee or not pfUI.hunterbar.ranged then return end

if IsActionInRange(pfUI.hunterbar.melee) == 1 and IsActionInRange(pfUI.hunterbar.ranged) == 0 then
if pfUI.hunterbar.current ~= 0 then
CURRENT_ACTIONBAR_PAGE = 9
ChangeActionBarPage()
pfUI.hunterbar.current = 0
end
else
if pfUI.hunterbar.current ~= 1 then
CURRENT_ACTIONBAR_PAGE = 1
ChangeActionBarPage()
pfUI.hunterbar.current = 1
end
end
end)
end)
1 change: 1 addition & 0 deletions pfUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pfLocaleShift = {}
pfLocaleSpells = {}
pfLocaleSpellEvents = {}
pfLocaleSpellInterrupts = {}
pfLocaleHunterbars = {}

pfUI:SetScript("OnEvent", function()
if arg1 == "pfUI" then
Expand Down
1 change: 1 addition & 0 deletions pfUI.toc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ modules\gui.lua
modules\pixelperfect.lua
modules\hoverbind.lua
modules\actionbar.lua
modules\hunterbar.lua
modules\chat.lua
modules\font.lua
modules\addons.lua
Expand Down

0 comments on commit dc3c89b

Please sign in to comment.