First version

This commit is contained in:
DuvelCorp
2026-02-24 23:00:59 +01:00
commit ee8328e903
125 changed files with 140652 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
Version 2.0 ----> Metahunt integration :-)
Version 1.12.14
September 15 - 1.12.14
-Fixed some translation errors
September 12 - 1.12.13
-ZMarkTarget() should no longer lockup some clients
-Fixed some translations
September 9 - 1.12.12
-Should've fixed the AntiDaze lockup, once and for all!
September 8 - 1.12.11
-/zammo has been changed back to a toggle ability
-Added Tame Beast, Beast Training, and Beast Lore to the pet buttons
-Added the function /script ZMarkTarget()
-Altered saved variables for easier patch transitions hopefully (current spell order will be reset)
August 26 - 1.12.10
-Using the ZTrap Key Binding will now put your pet in passive mode as well
-More French translations
-Split up the localization files for ease of use
August 25 - 1.12.9
-ZTrap buttons will now fade when you enter combat
-Added /zhunter to remind you of all of the other slash commands
-You can drag food on the ZPet button to feed your pet
August 25 - 1.12.8
-Fixed an error if you only had 1 of the button spells
August 24 - 1.12.7
-Woops... fixed AntiDaze even further
August 24 - 1.12.6
-Fixed the lock up issue with the AntiDaze feature
August 23 - 1.12.5
-Might've fixed some lockup issues
-Made the buttons overlap the user interface
-More translations
August 23 - 1.12.4
-Added some more translations
-Possibly fixed some button load errors
August 22 - 1.12.3
-Updated for Patch 1.12
-Should've removed the error for ZPet (Although the button probably still won't work because I still don't have the translations. Let me know if theres an error on the English client)
-Added some German translations
August 21 - 1.12.2
-Fixed the aspect bar
August 21 - 1.12.1
-Fixed a problem with the number of buttons displayed
August 21 - 1.12.0
-Altered (and hopefully fixed) all of the spell buttons
-Fixed Smart Ammo to work with all ammo
-Added a Pet Spell action bar
-Added an Anti-Daze feature
-Added a feature to automatically change the frenzy timer based on the boss
-Added a /script IsPetDead() command
+98
View File
@@ -0,0 +1,98 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Binding name="ZAspect Main" header="ZAspectHeader">
zButtonAspect_KeyBinding()
</Binding>
<Binding name="ZAspect 1" header="ZAspectHeader">
zButtonAspect_KeyBinding(1)
</Binding>
<Binding name="ZAspect 2" header="ZAspectHeader">
zButtonAspect_KeyBinding(2)
</Binding>
<Binding name="ZAspect 3" header="ZAspectHeader">
zButtonAspect_KeyBinding(3)
</Binding>
<Binding name="ZAspect 4" header="ZAspectHeader">
zButtonAspect_KeyBinding(4)
</Binding>
<Binding name="ZAspect 5" header="ZAspectHeader">
zButtonAspect_KeyBinding(5)
</Binding>
<Binding name="ZAspect 6" header="ZAspectHeader">
zButtonAspect_KeyBinding(6)
</Binding>
<Binding name="ZTrack Main" header="ZTrackHeader">
zButtonTrack_KeyBinding()
</Binding>
<Binding name="ZTrack 1" header="ZTrackHeader">
zButtonTrack_KeyBinding(1)
</Binding>
<Binding name="ZTrack 2" header="ZTrackHeader">
zButtonTrack_KeyBinding(2)
</Binding>
<Binding name="ZTrack 3" header="ZTrackHeader">
zButtonTrack_KeyBinding(3)
</Binding>
<Binding name="ZTrack 4" header="ZTrackHeader">
zButtonTrack_KeyBinding(4)
</Binding>
<Binding name="ZTrack 5" header="ZTrackHeader">
zButtonTrack_KeyBinding(5)
</Binding>
<Binding name="ZTrack 6" header="ZTrackHeader">
zButtonTrack_KeyBinding(6)
</Binding>
<Binding name="ZTrack 7" header="ZTrackHeader">
zButtonTrack_KeyBinding(7)
</Binding>
<Binding name="ZTrack 8" header="ZTrackHeader">
zButtonTrack_KeyBinding(8)
</Binding>
<Binding name="ZTrack 9" header="ZTrackHeader">
zButtonTrack_KeyBinding(9)
</Binding>
<Binding name="ZTrack 10" header="ZTrackHeader">
zButtonTrack_KeyBinding(10)
</Binding>
<Binding name="ZTrack 11" header="ZTrackHeader">
zButtonTrack_KeyBinding(11)
</Binding>
<Binding name="ZTrap Main" header="ZTrapHeader">
zButtonTrap_KeyBinding()
</Binding>
<Binding name="ZTrap 1" header="ZTrapHeader">
zButtonTrap_KeyBinding(1)
</Binding>
<Binding name="ZTrap 2" header="ZTrapHeader">
zButtonTrap_KeyBinding(2)
</Binding>
<Binding name="ZTrap 3" header="ZTrapHeader">
zButtonTrap_KeyBinding(3)
</Binding>
<Binding name="ZTrap 4" header="ZTrapHeader">
zButtonTrap_KeyBinding(4)
</Binding>
<Binding name="ZTrap 5" header="ZTrapHeader">
zButtonTrap_KeyBinding(5)
</Binding>
<Binding name="ZPet Main" header="ZPetHeader">
zButtonPet_KeyBinding()
</Binding>
<Binding name="ZPet 1" header="ZPetHeader">
zButtonPet_KeyBinding(1)
</Binding>
<Binding name="ZPet 2" header="ZPetHeader">
zButtonPet_KeyBinding(2)
</Binding>
<Binding name="ZPet 3" header="ZPetHeader">
zButtonPet_KeyBinding(3)
</Binding>
<Binding name="ZPet 4" header="ZPetHeader">
zButtonPet_KeyBinding(4)
</Binding>
<Binding name="ZPet 5" header="ZPetHeader">
zButtonPet_KeyBinding(5)
</Binding>
<Binding name="ZPet 6" header="ZPetHeader">
zButtonPet_KeyBinding(6)
</Binding>
</Ui>
+237
View File
@@ -0,0 +1,237 @@
-- Deferred initialization for ZHunterMod
-- This file runs at the END after all frames are created and all Lua is parsed
-- Wrap ZSpellButton_CreateChildren to automatically initialize child buttons
local original_CreateChildren = ZSpellButton_CreateChildren
function ZSpellButton_CreateChildren(parent, name, count)
-- Call original function to create children
original_CreateChildren(parent, name, count)
-- Now initialize each child button's properties
if parent and name and count then
for i = 1, count do
local button = getglobal(name .. i)
if button then
local oldThis = this
local oldEvent = event
this = button
ZSpellButton_OnLoad()
this = oldThis
event = oldEvent
end
end
end
end
local function ZHunterMod_RunButtonInit(frame, onEventFunc)
if not (frame and onEventFunc) then
return
end
local oldThis = this
local oldEvent = event
this = frame
ZSpellButtonParent_OnLoad()
event = "VARIABLES_LOADED"
onEventFunc()
this = oldThis
event = oldEvent
end
local function ZHunterMod_LogDeferred(msg)
local deferredDebug = _G and _G["MTH_ZH_DEFERRED_DEBUG"]
if not (MTH and MTH.debug and deferredDebug) then
return
end
MTH_ZH_Print("[ZHUNTER] " .. tostring(msg), "error")
end
local function ZHunterMod_EnsureButtonFrame(buttonName)
local frame = getglobal(buttonName)
if frame then
return frame
end
if type(CreateFrame) ~= "function" then
return nil
end
local created = CreateFrame("CheckButton", buttonName, UIParent, "ZSpellButtonTemplate")
if created then
created:ClearAllPoints()
if buttonName == "zButtonAspect" then
created:SetPoint("CENTER", UIParent, "CENTER", -60, 0)
elseif buttonName == "zButtonAmmo" then
created:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
elseif buttonName == "zButtonTrack" then
created:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
elseif buttonName == "zButtonTrap" then
created:SetPoint("CENTER", UIParent, "CENTER", 60, 0)
elseif buttonName == "zButtonPet" then
created:SetPoint("CENTER", UIParent, "CENTER", 0, 60)
elseif buttonName == "zButtonMounts" then
created:SetPoint("TOP", UIParent, "TOP", 0, -410)
elseif buttonName == "zButtonCompanions" then
created:SetPoint("TOP", UIParent, "TOP", 0, -464)
elseif buttonName == "zButtonToys" then
created:SetPoint("TOP", UIParent, "TOP", 0, -518)
else
created:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
end
ZHunterMod_LogDeferred("DeferredInit: created missing frame " .. tostring(buttonName))
end
return created
end
function ZHunterMod_DeferredInit()
-- Check if frames were created
local pet = ZHunterMod_EnsureButtonFrame("zButtonPet")
local aspect = ZHunterMod_EnsureButtonFrame("zButtonAspect")
local track = ZHunterMod_EnsureButtonFrame("zButtonTrack")
local trap = ZHunterMod_EnsureButtonFrame("zButtonTrap")
local ammo = ZHunterMod_EnsureButtonFrame("zButtonAmmo")
local mounts = ZHunterMod_EnsureButtonFrame("zButtonMounts")
local companions = ZHunterMod_EnsureButtonFrame("zButtonCompanions")
local toys = ZHunterMod_EnsureButtonFrame("zButtonToys")
ZHunterMod_LogDeferred("DeferredInit: Pet=" .. tostring(pet ~= nil))
ZHunterMod_LogDeferred("DeferredInit: Aspect=" .. tostring(aspect ~= nil))
ZHunterMod_LogDeferred("DeferredInit: Track=" .. tostring(track ~= nil))
ZHunterMod_LogDeferred("DeferredInit: Trap=" .. tostring(trap ~= nil))
ZHunterMod_LogDeferred("DeferredInit: Ammo=" .. tostring(ammo ~= nil))
ZHunterMod_LogDeferred("DeferredInit: Mounts=" .. tostring(mounts ~= nil))
ZHunterMod_LogDeferred("DeferredInit: Companions=" .. tostring(companions ~= nil))
ZHunterMod_LogDeferred("DeferredInit: Toys=" .. tostring(toys ~= nil))
-- Continue with all frames that exist; do not hard-abort when one optional frame is missing.
local missing = {}
if not pet then table.insert(missing, "Pet") end
if not aspect then table.insert(missing, "Aspect") end
if not track then table.insert(missing, "Track") end
if not trap then table.insert(missing, "Trap") end
if not ammo then table.insert(missing, "Ammo") end
if not mounts then table.insert(missing, "Mounts") end
if not companions then table.insert(missing, "Companions") end
if not toys then table.insert(missing, "Toys") end
if table.getn(missing) > 0 then
MTH_ZH_Print("[ZHUNTER] Warning: missing frames: " .. table.concat(missing, ", ") .. ". Continuing with available buttons.", "error")
end
if not (pet or aspect or track or trap or ammo or mounts or companions or toys) then
MTH_ZH_Print("zhunter buttons not created - check for addon conflicts!", "error")
return
end
-- Initialize each button by calling template OnLoad then button-specific OnEvent
-- We set up global 'this' and 'event' for the OnEvent functions (Lua 5.0 style)
local initialized = 0
local function ZHunterMod_SafeRunButtonInit(frame, onEventFunc, buttonTag)
if not (frame and onEventFunc) then
return false
end
local ok, err = pcall(ZHunterMod_RunButtonInit, frame, onEventFunc)
if not ok then
MTH_ZH_Print("[ZHUNTER] DeferredInit failed for " .. tostring(buttonTag) .. ": " .. tostring(err), "error")
return false
end
return true
end
if pet and zButtonPet_OnEvent then
if ZHunterMod_SafeRunButtonInit(pet, zButtonPet_OnEvent, "zButtonPet") then
initialized = initialized + 1
end
end
if aspect and zButtonAspect_OnEvent then
if ZHunterMod_SafeRunButtonInit(aspect, zButtonAspect_OnEvent, "zButtonAspect") then
initialized = initialized + 1
end
end
if track and zButtonTrack_OnEvent then
if ZHunterMod_SafeRunButtonInit(track, zButtonTrack_OnEvent, "zButtonTrack") then
initialized = initialized + 1
end
end
if trap and zButtonTrap_OnEvent then
if ZHunterMod_SafeRunButtonInit(trap, zButtonTrap_OnEvent, "zButtonTrap") then
initialized = initialized + 1
end
end
if ammo and zButtonAmmo_OnEvent then
if ZHunterMod_SafeRunButtonInit(ammo, zButtonAmmo_OnEvent, "zButtonAmmo") then
initialized = initialized + 1
end
end
if mounts and zButtonMounts_OnEvent then
if ZHunterMod_SafeRunButtonInit(mounts, zButtonMounts_OnEvent, "zButtonMounts") then
initialized = initialized + 1
end
end
if companions and zButtonCompanions_OnEvent then
if ZHunterMod_SafeRunButtonInit(companions, zButtonCompanions_OnEvent, "zButtonCompanions") then
initialized = initialized + 1
end
end
if toys and zButtonToys_OnEvent then
if ZHunterMod_SafeRunButtonInit(toys, zButtonToys_OnEvent, "zButtonToys") then
initialized = initialized + 1
end
end
if initialized <= 0 then
MTH_ZH_Print("zhunter buttons not created - check for addon conflicts!", "error")
return
end
if type(MTH_ZH_OnDeferredInitComplete) == "function" then
local ok, err = pcall(MTH_ZH_OnDeferredInitComplete)
if not ok and MTH_DebugFrame and MTH_DebugFrame.AddError then
MTH_ZH_Print("[ZHUNTER] DeferredInit callback error: " .. tostring(err), "error")
end
end
end
-- Smart initialization that handles both initial load and reload
local function TryInitialize()
-- Check if spell data is available (hunters get aspect of monkey at level 4)
-- If player is low level without spells, we still want to initialize
local _, _, _, numSpells = GetNumSpellTabs()
-- Only initialize if we have some basic game data ready
if numSpells and numSpells > 0 then
ZHunterMod_DeferredInit()
return true
end
return false
end
-- Try immediate initialization (works for /reload)
if not TryInitialize() then
-- If immediate init failed, we're on initial game load
-- Set up event-based initialization
local initFrame = CreateFrame("Frame")
initFrame:RegisterEvent("PLAYER_LOGIN")
initFrame:SetScript("OnEvent", function()
if event == "PLAYER_LOGIN" then
-- Delay slightly to ensure spell book is ready
local elapsed = 0
initFrame:SetScript("OnUpdate", function()
elapsed = elapsed + arg1
if elapsed >= 0.3 then
initFrame:SetScript("OnUpdate", nil)
ZHunterMod_DeferredInit()
-- Master options will be initialized on-demand
end
end)
end
end)
else
-- Immediate init succeeded, do not initialize master options here
-- It will be created on-demand when first opened
end
+325
View File
@@ -0,0 +1,325 @@
if not ZHunterMod_Saved then
ZHunterMod_Saved = {}
end
BINDING_HEADER_ZAspectHeader = "ZAspect Buttons"
BINDING_HEADER_ZTrackHeader = "ZTrack Buttons"
BINDING_HEADER_ZTrapHeader = "ZTrap Buttons"
BINDING_HEADER_ZPetHeader = "ZPet Buttons"
function ZHunterMod_AlignButtons()
zButtonTrack:ClearAllPoints()
zButtonTrack:SetPoint("TOP", zButtonAspect, "BOTTOM", 0, -15)
zButtonTrap:ClearAllPoints()
zButtonTrap:SetPoint("TOP", zButtonTrack, "BOTTOM", 0, -15)
if AutoStripDisplay then
AutoStripDisplay:ClearAllPoints()
AutoStripDisplay:SetPoint("TOP", zButtonTrap, "BOTTOM", 0, -10)
end
end
-- ////////////////////////////////////////////////////////////////
-- ENGLISH
-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ZHUNTER_MAGMADAR = "Magmadar"
ZHUNTER_FLAMEGORE = "Flamegore"
ZHUNTER_CHROMMAGUS = "Chrommagus"
ZHUNTER_HUHURAN = "Princess Huhuran"
ZHUNTER_GLUTH = "Gluth"
ZHUNTER_YOU = "You"
ZHUNTER_HUNTER = "Hunter"
ZHUNTER_BOWS = "Bows"
ZHUNTER_CROSSBOWS = "Crossbows"
ZHUNTER_GUNS = "Guns"
ZHUNTER_AFFLICTED_DAZED = "(.+) (.+) afflicted by Dazed"
ZHUNTER_BULLETS_LIGHT = "Light Shot"
ZHUNTER_BULLETS_CRAFTLIGHT = "Crafted Light Shot"
ZHUNTER_BULLETS_FLASH = "Flash Pellet"
ZHUNTER_BULLETS_HEAVY = "Heavy Shot"
ZHUNTER_BULLETS_PEBBLE = "Smooth Pebble"
ZHUNTER_BULLETS_CRAFTHEAVY = "Crafted Heavy Shot"
ZHUNTER_BULLETS_SOLID = "Solid Shot"
ZHUNTER_BULLETS_CRAFTSOLID = "Crafted Solid Shot"
ZHUNTER_BULLETS_EXPLODING = "Exploding Shot"
ZHUNTER_BULLETS_MITHRILSLUG = "Hi-impact Mithril Slugs"
ZHUNTER_BULLETS_ACCURATE = "Accurate Slugs"
ZHUNTER_BULLETS_GYROSHOT = "Mithril Gyro-Shot"
ZHUNTER_BULLETS_ICETHREADED = "Ice Threaded Bullet"
ZHUNTER_BULLETS_THORIUM = "Thorium Shells"
ZHUNTER_BULLETS_ROCKSHARD = "Rockshard Pellets"
ZHUNTER_BULLETS_CANNONBALL = "Miniature Cannon Balls"
ZHUNTER_ARROWS_ROUGH = "Rough Arrow"
ZHUNTER_ARROWS_SHARP = "Sharp Arrow"
ZHUNTER_ARROWS_RAZOR = "Razor Arrow"
ZHUNTER_ARROWS_FEATHER = "Feathered Arrow"
ZHUNTER_ARROWS_PRECISION = "Precision Arrow"
ZHUNTER_ARROWS_JAGGED = "Jagged Arrow"
ZHUNTER_ARROWS_ICETHREADED = "Ice Threaded Arrow"
ZHUNTER_ARROWS_THORIUM = "Thorium Headed Arrow"
ZHUNTER_ARROWS_DOOMSHOT = "Doomshot"
ZHUNTER_RAPIDFIRE = "Rapid Fire"
ZHUNTER_IMPROVEDHAWK = "Quick Shots"
ZHUNTER_BERSERKING = "Berserking"
ZHUNTER_AUTO = "Auto Shot"
ZHUNTER_AIMED = "Aimed Shot"
ZHUNTER_SERPENT = "Serpent Sting"
ZHUNTER_SCORPID = "Scorpid Sting"
ZHUNTER_VIPER = "Viper Sting"
ZHUNTER_ARCANE = "Arcane Shot"
ZHUNTER_CONCUSSIVE = "Concussive Shot"
ZHUNTER_DISTRACTING = "Distracting Shot"
ZHUNTER_VOLLEY = "Volley"
ZHUNTER_TRACK_HUMANOIDS = "Track Humanoids"
ZHUNTER_TRACK_HIDDEN = "Track Hidden"
ZHUNTER_TRACK_BEASTS = "Track Beasts"
ZHUNTER_TRACK_ELEMENTALS = "Track Elementals"
ZHUNTER_TRACK_DEMONS = "Track Demons"
ZHUNTER_TRACK_DRAGONKIN = "Track Dragonkin"
ZHUNTER_TRACK_UNDEAD = "Track Undead"
ZHUNTER_TRACK_GIANTS = "Track Giants"
ZHUNTER_TRACK_MINERALS = "Find Minerals"
ZHUNTER_TRACK_HERBS = "Find Herbs"
ZHUNTER_TRACK_TREASURE = "Find Treasure"
ZHUNTER_TRAP_FREEZING = "Freezing Trap"
ZHUNTER_TRAP_FROST = "Frost Trap"
ZHUNTER_TRAP_IMMOLATION = "Immolation Trap"
ZHUNTER_TRAP_EXPLOSIVE = "Explosive Trap"
ZHUNTER_ASPECT_HAWK = "Aspect of the Hawk"
ZHUNTER_ASPECT_MONKEY = "Aspect of the Monkey"
ZHUNTER_ASPECT_CHEETAH = "Aspect of the Cheetah"
ZHUNTER_ASPECT_BEAST = "Aspect of the Beast"
ZHUNTER_ASPECT_PACK = "Aspect of the Pack"
ZHUNTER_ASPECT_WILD = "Aspect of the Wild"
ZHUNTER_PET_EYES = "Eyes of the Beast"
ZHUNTER_PET_DISMISS = "Dismiss Pet"
ZHUNTER_PET_MEND = "Mend Pet"
ZHUNTER_PET_FEED = "Feed Pet"
ZHUNTER_PET_CALL = "Call Pet"
ZHUNTER_PET_REVIVE = "Revive Pet"
ZHUNTER_PET_LORE = "Beast Lore"
ZHUNTER_PET_TRAINING = "Beast Training"
ZHUNTER_PET_TAMING = "Tame Beast"
--------------------------------------------------------------------
-- Meta 09 Feb 2026
-- Twow spells addition
ZHUNTER_PET_POSITION = "Pet Command: Take Position"
ZHUNTER_ASPECT_WOLF = "Aspect of the Wolf"
ZHUNTER_ASPECT_VIPER = "Aspect of the Viper"
ZHUNTER_STEADY = "Steady Shot"
ZHUNTER_BAITED = "Baited Shot"
ZHUNTER_INTIMIDATION = "Intimidation"
ZHUNTER_KILLCOMMAND = "Kill Command"
ZHUNTER_CARVE = "Carve"
ZHUNTER_LACERATE = "Lacerate"
--------------------------------------------------------------------
-- ////////////////////////////////////////////////////////////////
-- FRENCH
-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-- � = \195\136 � = \195\168
-- � = \195\137 � = \195\169
-- � = \195\138 � = \195\170
-- � = \195\143 � = \195\175
-- � = \195\135 � = \195\167
if ( GetLocale() == "frFR" ) then
--ZHUNTER_MAGMADAR = "Magmadar"
--ZHUNTER_FLAMEGORE = "Flamegore"
--ZHUNTER_CHROMMAGUS = "Chrommagus"
--ZHUNTER_HUHURAN = "Princess Huhuran"
--ZHUNTER_GLUTH = "Gluth"
ZHUNTER_YOU = "Vous"
ZHUNTER_HUNTER = "Chasseur"
--ZHUNTER_BOWS = "Bows"
ZHUNTER_CROSSBOWS = "Arbal\195\168tes"
ZHUNTER_GUNS = "Armes\195\160feus"
--ZHUNTER_AFFLICTED_DAZED = "(.+) (.+) afflicted by Dazed"
ZHUNTER_BULLETS_LIGHT = "Balle l\195\169g\195\168re"
ZHUNTER_BULLETS_CRAFTLIGHT = "Balle l\195\169g\195\168re fabriqu\195\169e"
ZHUNTER_BULLETS_FLASH = "Bille d'\195\169clair"
ZHUNTER_BULLETS_HEAVY = "Balle lourde"
ZHUNTER_BULLETS_PEBBLE = "Caillou lisse"
ZHUNTER_BULLETS_CRAFTHEAVY = "Balle lourde fabriqu\195\169e"
ZHUNTER_BULLETS_SOLID = "Balle dure"
ZHUNTER_BULLETS_CRAFTSOLID = "Balle dure fabriqu\195\169e"
ZHUNTER_BULLETS_EXPLODING = "Balle explosive"
ZHUNTER_BULLETS_MITHRILSLUG = "Balle per\195\167antes en mithril"
ZHUNTER_BULLETS_ACCURATE = "Balles de pr\195\169cision"
ZHUNTER_BULLETS_GYROSHOT = "Balle gyroscopique en mithril"
ZHUNTER_BULLETS_ICETHREADED = "Balle de glace"
ZHUNTER_BULLETS_THORIUM = "Obus en thorium"
ZHUNTER_BULLETS_ROCKSHARD = "Balle de roche"
ZHUNTER_BULLETS_CANNONBALL = "Boulet de canon miniature"
ZHUNTER_ARROWS_ROUGH = "Fl\195\168che grossi\195\168re"
ZHUNTER_ARROWS_SHARP = "Fl\195\168che pointue"
ZHUNTER_ARROWS_RAZOR = "Fl\195\168che rasoir"
ZHUNTER_ARROWS_FEATHER = "Fl\195\168che \195\160 plumes"
ZHUNTER_ARROWS_PRECISION = "Fl\195\168che de pr\195\169cision"
ZHUNTER_ARROWS_JAGGED = "Fl\195\168che barbel\195\169e"
ZHUNTER_ARROWS_ICETHREADED = "Fl\195\168che de glace"
ZHUNTER_ARROWS_THORIUM = "Fl\195\168ches \195\160 pointe de thorium"
ZHUNTER_ARROWS_DOOMSHOT = "Tir maudit"
ZHUNTER_RAPIDFIRE = "Tir rapide"
--ZHUNTER_IMPROVEDHAWK = "Quick Shots"
--ZHUNTER_BERSERKING = "Berserking"
ZHUNTER_AUTO = "Tir automatique"
ZHUNTER_AIMED = "Vis\195\169e"
ZHUNTER_SERPENT = "Morsure de serpent"
ZHUNTER_SCORPID = "Piq\195\187re de scorpide"
ZHUNTER_VIPER = "Morsure de vip\195\168re"
ZHUNTER_ARCANE = "Tir des arcanes"
ZHUNTER_CONCUSSIVE = "Trait de choc"
ZHUNTER_DISTRACTING = "Trait provocateur"
ZHUNTER_TRACK_HUMANOIDS = "Pistage des humano\195\175des"
ZHUNTER_TRACK_HIDDEN = "Pistage des camoufl\195\169s"
ZHUNTER_TRACK_BEASTS = "Pistage des b\195\170tes"
ZHUNTER_TRACK_ELEMENTALS = "Pistage des \195\169l\195\169mentaires"
ZHUNTER_TRACK_DEMONS = "Pistage des d\195\169mons"
ZHUNTER_TRACK_DRAGONKIN = "Pistage des draconiens"
ZHUNTER_TRACK_UNDEAD = "Pistage des morts-vivants"
ZHUNTER_TRACK_GIANTS = "Pistage des g\195\169ants"
--ZHUNTER_TRACK_MINERALS = "Find Minerals"
--ZHUNTER_TRACK_HERBS = "Find Herbs"
--ZHUNTER_TRACK_TREASURE = "Find Treasure"
ZHUNTER_TRAP_FREEZING = "Pi\195\168ge givrant"
ZHUNTER_TRAP_FROST = "Pi\195\168ge de givre"
ZHUNTER_TRAP_IMMOLATION = "Pi\195\168ge d'Immolation"
ZHUNTER_TRAP_EXPLOSIVE = "Pi\195\168ge explosif"
ZHUNTER_ASPECT_HAWK = "Aspect du faucon"
ZHUNTER_ASPECT_MONKEY = "Aspect du singe"
ZHUNTER_ASPECT_CHEETAH = "Aspect du gu\195\169pard"
ZHUNTER_ASPECT_BEAST = "Aspect de la b\195\170te"
ZHUNTER_ASPECT_PACK = "Aspect de la meute"
ZHUNTER_ASPECT_WILD = "Aspect de la nature"
ZHUNTER_PET_EYES = "oeil de la b\195\170te"
--ZHUNTER_PET_DISMISS = "Dismiss Pet"
--ZHUNTER_PET_MEND = "Mend Pet"
--ZHUNTER_PET_FEED = "Feed Pet"
--ZHUNTER_PET_CALL = "Call Pet"
--ZHUNTER_PET_REVIVE = "Revive Pet"
end
-- ////////////////////////////////////////////////////////////////
-- GERMAN
-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-- � = /195/164
-- � = /195/188
-- � = /195/182
if ( GetLocale() == "deDE" ) then
ZHUNTER_MAGMADAR = "Magmadar"
ZHUNTER_FLAMEGORE = "Flammenmaul"
ZHUNTER_CHROMMAGUS = "Chrommagus"
ZHUNTER_HUHURAN = "Prinzessin Huhuran"
--ZHUNTER_GLUTH = "Gluth"
ZHUNTER_YOU = "Ihr"
ZHUNTER_HUNTER = "J\195\164ger"
ZHUNTER_BOWS = "B\195\182gen"
ZHUNTER_CROSSBOWS = "Armbr\195\188ste"
ZHUNTER_GUNS = "Schusswaffen"
ZHUNTER_AFFLICTED_DAZED = "(.+) (.+) ersch\195\188ttert"
ZHUNTER_BULLETS_LIGHT = "Leichtes Geschoss"
ZHUNTER_BULLETS_CRAFTLIGHT = "Gefertigtes leichtes Geschoss"
ZHUNTER_BULLETS_FLASH = "Blitzk\195\188gelchen"
ZHUNTER_BULLETS_HEAVY = "Schweres Geschoss"
ZHUNTER_BULLETS_PEBBLE = "Glatter Kiesel"
ZHUNTER_BULLETS_CRAFTHEAVY = "Gefertigtes schweres Geschoss"
ZHUNTER_BULLETS_SOLID = "Robustes Geschoss"
ZHUNTER_BULLETS_CRAFTSOLID = "Gefertigtes robustes Geschoss"
ZHUNTER_BULLETS_EXPLODING = "Explosivgeschoss"
ZHUNTER_BULLETS_MITHRILSLUG = "Stark einschlagende Mithrilpatronen"
ZHUNTER_BULLETS_ACCURATE = "Genaue Patronen"
ZHUNTER_BULLETS_GYROSHOT = "Gyro-Mithrilgeschoss"
ZHUNTER_BULLETS_ICETHREADED = "Eisgewirkte Kugel"
ZHUNTER_BULLETS_THORIUM = "Thoriumpatronen"
ZHUNTER_BULLETS_ROCKSHARD = "Felssplitterk\195\188gelchen"
ZHUNTER_BULLETS_CANNONBALL = "Miniaturkanonenkugeln"
ZHUNTER_ARROWS_ROUGH = "Rauer Pfeil"
ZHUNTER_ARROWS_SHARP = "Scharfer Pfeil"
ZHUNTER_ARROWS_RAZOR = "Schneidenpfeil"
ZHUNTER_ARROWS_FEATHER = "Gefiederter Pfeil"
ZHUNTER_ARROWS_PRECISION = "Pr\195\164zisionspfeil"
ZHUNTER_ARROWS_JAGGED = "Gezackter Pfeil"
ZHUNTER_ARROWS_ICETHREADED = "Eisgewirkter Pfeil"
ZHUNTER_ARROWS_THORIUM = "Thoriumpfeile"
ZHUNTER_ARROWS_DOOMSHOT = "Verdammnisgeschoss"
ZHUNTER_RAPIDFIRE = "Schnellfeuer"
ZHUNTER_IMPROVEDHAWK = "Schnelle Sch\195\188sse"
ZHUNTER_BERSERKING = "Berserker"
ZHUNTER_AUTO = "Autom. Schuss"
ZHUNTER_AIMED = "Gezielter Schuss"
ZHUNTER_SERPENT = "Schlangenbiss"
ZHUNTER_SCORPID = "Skorpidstich"
ZHUNTER_VIPER = "Vipernbiss"
ZHUNTER_ARCANE = "Arkaner Schuss"
ZHUNTER_CONCUSSIVE = "Ersch\195\188tternder Schuss"
ZHUNTER_DISTRACTING = "Ablenkender Schuss"
ZHUNTER_TRACK_HUMANOIDS = "Humanoide aufsp\195\188ren"
ZHUNTER_TRACK_HIDDEN = "Verborgenes aufsp\195\188ren"
ZHUNTER_TRACK_BEASTS = "Wildtiere aufsp\195\188ren"
ZHUNTER_TRACK_ELEMENTALS = "Elementare aufsp\195\188ren"
ZHUNTER_TRACK_DEMONS = "D\195\164monen aufsp\195\188ren"
ZHUNTER_TRACK_DRAGONKIN = "Drachkin aufsp\195\188ren"
ZHUNTER_TRACK_UNDEAD = "Untote aufsp\195\188ren"
ZHUNTER_TRACK_GIANTS = "Riesen aufsp\195\188ren"
ZHUNTER_TRACK_MINERALS = "Mineraliensuche"
ZHUNTER_TRACK_HERBS = "Kr\195\164utersuche"
ZHUNTER_TRACK_TREASURE = "Schatzsucher"
ZHUNTER_TRAP_FREEZING = "Eisk\195\164ltefalle"
ZHUNTER_TRAP_FROST = "Frostfalle"
ZHUNTER_TRAP_IMMOLATION = "Feuerbrandfalle"
ZHUNTER_TRAP_EXPLOSIVE = "Sprengfalle"
ZHUNTER_ASPECT_HAWK = "Aspekt des Falken"
ZHUNTER_ASPECT_MONKEY = "Aspekt des Affen"
ZHUNTER_ASPECT_CHEETAH = "Aspekt des Geparden"
ZHUNTER_ASPECT_BEAST = "Aspekt des Wildtiers"
ZHUNTER_ASPECT_PACK = "Aspekt des Rudels"
ZHUNTER_ASPECT_WILD = "Aspekt der Wildnis"
ZHUNTER_PET_EYES = "Augen des Wildtiers"
ZHUNTER_PET_DISMISS = "Tier freigeben"
ZHUNTER_PET_MEND = "Tier heilen"
ZHUNTER_PET_FEED = "Tier f\195\188ttern"
ZHUNTER_PET_CALL = "Tier rufen"
ZHUNTER_PET_REVIVE = "Tier wiederbeleben"
ZHUNTER_PET_TAMING = "Wildtier z\195\164hmen"
ZHUNTER_PET_TRAINING = "Wildtierausbildung"
ZHUNTER_PET_POSITION = "Pet Command: Take Position"
end
+149
View File
@@ -0,0 +1,149 @@
if not ZHunterMod_Saved then
ZHunterMod_Saved = {}
end
BINDING_HEADER_ZAspectHeader = "ZAspect Buttons"
BINDING_HEADER_ZTrackHeader = "ZTrack Buttons"
BINDING_HEADER_ZTrapHeader = "ZTrap Buttons"
BINDING_HEADER_ZPetHeader = "ZPet Buttons"
BINDING_HEADER_ZAmmoHeader = "ZAmmo Buttons"
BINDING_HEADER_ZMountsHeader = "ZMounts Buttons"
BINDING_HEADER_ZCompanionsHeader = "ZCompanions Buttons"
BINDING_HEADER_ZToysHeader = "ZToys Buttons"
ZHunterModTooltip = CreateFrame("GameTooltip", "ZHunterModTooltip", nil, "GameTooltipTemplate")
function MTH_ZH_IsModuleEnabled()
if not (MTH and MTH.IsModuleEnabled) then
return true
end
return MTH:IsModuleEnabled("zhunter", true)
end
function MTH_ZH_GetSavedRoot()
if type(ZHunterMod_Saved) ~= "table" then
ZHunterMod_Saved = {}
end
return ZHunterMod_Saved
end
function MTH_ZH_GetSavedTable(key)
local root = MTH_ZH_GetSavedRoot()
if type(key) ~= "string" or key == "" then
return root
end
if type(root[key]) ~= "table" then
root[key] = {}
end
return root[key]
end
local function MTH_ZH_MigrateButtonSavedKeys_Replace()
local root = MTH_ZH_GetSavedRoot()
if type(root) ~= "table" then
return
end
local mapping = {
{"ZHunterButtonAspect", "zButtonAspect"},
{"ZHunterButtonTrack", "zButtonTrack"},
{"ZHunterButtonTrap", "zButtonTrap"},
{"ZHunterButtonAmmo", "zButtonAmmo"},
{"ZHunterButtonPet", "zButtonPet"},
{"ZHunterButtonMounts", "zButtonMounts"},
{"ZHunterButtonCompanions", "zButtonCompanions"},
{"ZHunterButtonToys", "zButtonToys"},
}
for i = 1, table.getn(mapping) do
local oldKey = mapping[i][1]
local newKey = mapping[i][2]
if root[oldKey] ~= nil then
root[newKey] = root[oldKey]
root[oldKey] = nil
end
end
end
MTH_ZH_MigrateButtonSavedKeys_Replace()
function MTH_ZH_Print(message, severity)
if type(MTH_Log) == "function" then
MTH_Log(message, severity)
return
end
if MTH and MTH.Print then
MTH:Print(message, severity)
return
end
if DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.AddMessage then
DEFAULT_CHAT_FRAME:AddMessage("[MetaHunt] " .. tostring(message or ""), 1, 0.9, 0.3)
end
end
function MTH_ZH_HandleDisabledSlash(message, tableKey, fieldKey)
if MTH_ZH_IsModuleEnabled() then
return false
end
if type(tableKey) == "string" and tableKey ~= "" then
if fieldKey then
local tbl = MTH_ZH_GetSavedTable(tableKey)
tbl[fieldKey] = nil
else
local root = MTH_ZH_GetSavedRoot()
root[tableKey] = nil
end
end
if message then
MTH_ZH_Print(message)
end
return true
end
function ZHunterMod_AlignButtons()
zButtonAmmo:ClearAllPoints()
zButtonAmmo:SetPoint("TOP", zButtonAspect, "BOTTOM", 0, -15)
zButtonTrack:ClearAllPoints()
zButtonTrack:SetPoint("TOP", zButtonAmmo, "BOTTOM", 0, -15)
zButtonTrap:ClearAllPoints()
zButtonTrap:SetPoint("TOP", zButtonTrack, "BOTTOM", 0, -15)
zButtonPet:ClearAllPoints()
zButtonPet:SetPoint("TOP", zButtonTrap, "BOTTOM", 0, -15)
zButtonMounts:ClearAllPoints()
zButtonMounts:SetPoint("TOP", zButtonPet, "BOTTOM", 0, -15)
zButtonCompanions:ClearAllPoints()
zButtonCompanions:SetPoint("TOP", zButtonMounts, "BOTTOM", 0, -15)
zButtonToys:ClearAllPoints()
zButtonToys:SetPoint("TOP", zButtonCompanions, "BOTTOM", 0, -15)
if AutoStripDisplay then
AutoStripDisplay:ClearAllPoints()
AutoStripDisplay:SetPoint("TOP", zButtonToys, "BOTTOM", 0, -10)
end
end
function ZMarkTarget()
if not MTH_ZH_IsModuleEnabled() then
return
end
if not UnitExists("target") then return end
for i=1, 40 do
if not UnitDebuff("target", i) then break end
ZHunterModTooltip:SetOwner(UIParent, "ANCHOR_NONE")
ZHunterModTooltip:SetUnitDebuff("target", i)
local spell = ZHunterModTooltipTextLeft1:GetText()
if spell == ZHUNTER_HUNTERSMARK then
return
end
end
CastSpellByName(ZHUNTER_HUNTERSMARK)
return 1
end
SLASH_ZHunterMod1 = "/zhunter"
SlashCmdList["ZHunterMod"] = function(msg)
MTH_ZH_Print("Possible Slash Commands: \"/zammo\", \"/zaspect\", \"/ztrack\", \"/ztrap\", \"/zpet\", \"/zmounts\", \"/zcompanions\", \"/zminipets\", \"/ztoys\", \"/zstrip\", \"/zantidaze\"")
end
+508
View File
@@ -0,0 +1,508 @@
-- MAX_SPELLS = 1024
local function ZSpellButton_ApplySavedVisibility(parent, foundCount)
if not parent then
return
end
local shouldShow = true
if foundCount and tonumber(foundCount) then
if tonumber(foundCount) <= 0 then
shouldShow = false
end
end
if type(MTH_ZH_GetSavedTable) == "function" and parent.name then
local saved = MTH_ZH_GetSavedTable(parent.name)
if saved then
if saved["enabled"] == false or saved["enabled"] == 0 then
shouldShow = false
end
if saved["parent"] and saved["parent"]["hide"] then
shouldShow = false
end
end
end
if shouldShow then
parent:Show()
else
parent:Hide()
end
end
function ZSpellButton_SetButtons(parent, spells)
--DEFAULT_CHAT_FRAME:AddMessage(" Parent = "..parent.name, 0, 1, 1)
if not (parent and parent.count and parent.name and spells) then return end
parent.spells = spells
if type(parent.customSetButtons) == "function" then
local customFound = parent.customSetButtons(parent, spells)
ZSpellButton_ApplySavedVisibility(parent, customFound)
return customFound
end
if not GetSpellName(1, "spell") then
parent:RegisterEvent("SPELLS_CHANGED")
return -1
end
local spell, finished, temp
local info = {}
-- Find All Spell IDs
for i=1, MAX_SPELLS do
spell = GetSpellName(i, "spell")
if not spell or finished then
break
end
finished = 1
for i2=1, table.getn(spells) do
if not info[i2] then
finished = nil
if spells[i2] == spell then
temp = i
while spells[i2] == spell do
temp = temp + 1
spell = GetSpellName(temp, "spell")
end
info[i2] = (temp-1)
break
end
end
end
end
-- Hide All Children
for i=1, parent.count do
local child = getglobal(parent.name..i)
child:Hide()
child.id = nil
child.icon = nil
child.isspell = nil
end
local button
local count = 1
-- Set Children IDs
for i, v in info do
if count > parent.count then break end
button = getglobal(parent.name..count)
button.id = v
button.isspell=1
ZSpellButton_UpdateButton(button)
button:Show()
-- Set The Parent To The First Spell
if count == 1 then
parent.id = v
parent.isspell=1
ZSpellButton_UpdateButton(parent)
parent:Enable()
end
count = count + 1
end
local foundCount = count - 1
ZSpellButton_ApplySavedVisibility(parent, foundCount)
return foundCount
end
local function ZHunterMod_UpdateButtonCount(parent, found)
return
end
function ZSpellButton_SetExpandDirection(parent, direction)
local button = getglobal(parent.name.."1")
local offset = parent:GetWidth() / 36
local circleVisible = true
if type(MTH_ZH_GetSavedTable) == "function" and parent and parent.name then
local saved = MTH_ZH_GetSavedTable(parent.name)
if saved and saved["parent"] and saved["parent"]["circle"] ~= nil then
circleVisible = saved["parent"]["circle"] and true or false
end
end
if parent and parent.circle then
if circleVisible then
parent.circle:Show()
else
parent.circle:Hide()
end
end
if circleVisible then
offset = offset * 5
else
offset = offset * 3
end
button:ClearAllPoints()
if direction == "TOP" then
button:SetPoint("BOTTOM", parent, "TOP", 0, offset)
elseif direction == "BOTTOM" then
button:SetPoint("TOP", parent, "BOTTOM", 0, -1 * offset)
elseif direction == "LEFT" then
button:SetPoint("RIGHT", parent, "LEFT", -1 * offset, 0)
elseif direction == "RIGHT" then
button:SetPoint("LEFT", parent, "RIGHT", offset, 0)
end
end
function ZSpellButton_ArrangeChildren(parent, rows, count, horizontal, vertical)
if not (parent and parent.count and parent.name) then return end
local left, right, top, bottom = "LEFT", "RIGHT", "TOP", "BOTTOM"
local xoffset = parent:GetWidth() / 36
xoffset = xoffset * 3
local yoffset = -1 * xoffset
if horizontal then
left, right = "RIGHT", "LEFT"
xoffset = xoffset * -1
end
if vertical then
top, bottom = "BOTTOM", "TOP"
yoffset = yoffset * -1
end
if count > parent.count then
count = parent.count
end
local cols = ceil(count / rows)
local temp = 1
local button
for i=2, parent.count do
button = getglobal(parent.name..i)
if i > count then
button:Hide()
else
if button.id then
button:Show()
end
button:ClearAllPoints()
if temp >= cols then
button:SetPoint(top, getglobal(parent.name..(i-temp)), bottom, 0, yoffset)
temp = 1
else
button:SetPoint(left, getglobal(parent.name..(i-1)), right, xoffset, 0)
temp = temp + 1
end
end
end
end
function ZSpellButton_SetSize(parent, size, setChildren)
local bgscale = 64 / 36
local cdscale = 0.75 / 36
if setChildren then
local button
for i=1, parent.count do
button = getglobal(parent.name..i)
button:SetHeight(size)
button:SetWidth(size)
button.background:SetWidth(size * bgscale)
button.background:SetHeight(size * bgscale)
button.cooldown:SetModelScale(size * cdscale)
end
else
local cscale = 100/36
local cxscale = 20 / 36
local cyscale = -22 / 36
local circleVisible = true
if type(MTH_ZH_GetSavedTable) == "function" and parent and parent.name then
local saved = MTH_ZH_GetSavedTable(parent.name)
if saved and saved["parent"] and saved["parent"]["circle"] ~= nil then
circleVisible = saved["parent"]["circle"] and true or false
end
end
parent:SetHeight(size)
parent:SetWidth(size)
parent.background:SetWidth(size * bgscale)
parent.background:SetHeight(size * bgscale)
parent.cooldown:SetModelScale(size * cdscale)
parent.circle:SetWidth(size * cscale)
parent.circle:SetHeight(size * cscale)
parent.circle:SetPoint("CENTER", size * cxscale, size * cyscale)
if circleVisible then
parent.circle:Show()
else
parent.circle:Hide()
end
end
end
function ZSpellButton_UpdateButton(button)
local texture
if not button then
button = this
end
if not (button.id and button.icontexture) then
return
end
texture = button.icon or GetSpellTexture(button.id, "spell")
button.icontexture:SetTexture(texture)
button.icontexture:Show()
end
function ZSpellButton_UpdateCooldown(button)
if not button then
button = this
end
if not button.id or not button.isspell then return end
local start, duration, enable = GetSpellCooldown(button.id, "spell")
CooldownFrame_SetTimer(button.cooldown, start, duration, enable)
if not button.customcolor then
local r, g, b = 1.0, 1.0, 1.0
if enable ~= 1 then
r, g, b = 0.4, 0.4, 0.4
end
button.icontexture:SetVertexColor(r, g, b)
end
end
function ZSpellButton_CreateChildren(parent, name, count)
if not (parent and name and count) then return end
parent.children = CreateFrame("Frame", parent:GetName().."Children", UIParent)
parent.count = count
parent.name = name
local button
for i=1, count do
button = CreateFrame("CheckButton", parent.name..i, parent.children, "ZSpellButtonChildTemplate")
button.parent = parent
end
if type(ZSpellButton_ApplyChildrenExpanded) == "function" then
ZSpellButton_ApplyChildrenExpanded(parent)
end
end
function ZSpellButton_OnLoad()
this:RegisterEvent("SPELL_UPDATE_COOLDOWN")
this:RegisterForClicks("LeftButtonUp", "RightButtonUp")
local name = this:GetName()
this.icontexture = getglobal(name.."IconTexture")
this.cooldown = getglobal(name.."Cooldown")
this.background = getglobal(name.."Background")
end
function ZSpellButton_OnEvent()
if event == "SPELL_UPDATE_COOLDOWN" then
ZSpellButton_UpdateCooldown()
end
end
local function ZSpellButton_EnsureParentFlags(parent)
if not (parent and parent.name) then
return
end
local saved = MTH_ZH_GetSavedTable(parent.name)
if parent.tooltip == nil and saved["tooltip"] ~= nil then
parent.tooltip = saved["tooltip"] and true or false
end
if parent.hideonclick == nil and saved["children"] and saved["children"]["hideonclick"] ~= nil then
parent.hideonclick = saved["children"]["hideonclick"] and true or false
end
end
function ZSpellButton_GetChildrenExpanded(parent)
if not (parent and parent.name) then
return true
end
local saved = MTH_ZH_GetSavedTable(parent.name)
if not saved["children"] then
saved["children"] = {}
end
if saved["children"]["expanded"] == nil then
saved["children"]["expanded"] = 1
end
local expanded = saved["children"]["expanded"] ~= false and saved["children"]["expanded"] ~= 0
return expanded
end
function ZSpellButton_SetChildrenExpanded(parent, expanded)
if not (parent and parent.name) then
return
end
local saved = MTH_ZH_GetSavedTable(parent.name)
if not saved["children"] then
saved["children"] = {}
end
if expanded then
saved["children"]["expanded"] = 1
if parent.children then
parent.children:Show()
end
else
saved["children"]["expanded"] = 0
if parent.children then
parent.children:Hide()
end
end
end
function ZSpellButton_ApplyChildrenExpanded(parent)
if not (parent and parent.children) then
return
end
if ZSpellButton_GetChildrenExpanded(parent) then
parent.children:Show()
else
parent.children:Hide()
end
end
function ZSpellButton_OnEnter()
ZSpellButton_EnsureParentFlags(this.parent)
if this.parent.tooltip then
GameTooltip:SetOwner(this, "ANCHOR_TOPRIGHT")
if this.isspell then
GameTooltip:SetSpell(this.id, "spell")
else
GameTooltip:SetText(this.ammocount .. " x "..this.ammolink, 1, 1, 1)
--GameTooltip:AddLine("Q="..this.ammocount)
end
end
end
function ZSpellButton_OnClick()
ZSpellButton_EnsureParentFlags(this.parent)
this:SetChecked(0)
if type(this.parent.beforeclick) == "function" then
if this.parent.beforeclick(this) then
return
end
end
if this.isspell then
CastSpell(this.id, "spell")
else
PickupContainerItem(this.ammobag,this.ammoslot)
EquipCursorItem(0)
-- Update parent button immediately to show newly equipped ammo
if not this.isspell then
this.parent.id = this.ammoid
this.parent.icon = this.icon
this.parent.isspell = nil
this.parent.ammoname = this.ammoname
this.parent.ammobrol = this.ammobrol
this.parent.ammoqual = this.ammoqual
this.parent.ammolvl = this.ammolvl
this.parent.ammotype = this.ammotype
this.parent.ammobag = this.ammobag
this.parent.ammoslot = this.ammoslot
this.parent.ammoid = this.ammoid
this.parent.ammolink = this.ammolink
this.parent.ammocount = this.ammocount
if type(this.parent.customUpdateButton) == "function" then
this.parent.customUpdateButton(this.parent)
else
ZSpellButton_UpdateButton(this.parent)
end
end
end
if type(this.parent.afterclick) == "function" then
if this.parent.afterclick(this) then
return
end
end
if this.parent.hideonclick then
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(this.parent, false)
elseif this.parent.children then
this.parent.children:Hide()
end
end
end
function ZSpellButtonParent_OnLoad()
this:RegisterEvent("SPELL_UPDATE_COOLDOWN")
this:RegisterEvent("LEARNED_SPELL_IN_TAB")
this:RegisterForDrag("LeftButton")
this:RegisterForClicks("LeftButtonUp", "RightButtonUp")
local name = this:GetName()
this.icontexture = getglobal(name.."IconTexture")
this.cooldown = getglobal(name.."Cooldown")
this.background = getglobal(name.."Background")
this.circle = getglobal(name.."Circle")
-- Keep enabled so empty buttons can be moved on low-level characters.
this:Enable()
end
function ZSpellButtonParent_OnEvent()
if event == "SPELL_UPDATE_COOLDOWN" then
ZSpellButton_UpdateCooldown()
elseif event == "LEARNED_SPELL_IN_TAB" then
if this.name and this.count and this.spells then
local found = ZSpellButton_SetButtons(this, this.spells)
ZHunterMod_UpdateButtonCount(this, found)
end
elseif event == "SPELLS_CHANGED" then
this.found = ZSpellButton_SetButtons(this, this.spells)
ZHunterMod_UpdateButtonCount(this, this.found)
if this.found == 0 then
this:Hide()
end
if this.found > -1 then
this:UnregisterEvent("SPELLS_CHANGED")
end
end
end
function ZSpellButtonParent_OnEnter(frame)
if not frame then
frame = this
end
ZSpellButton_EnsureParentFlags(frame)
if frame.tooltip and frame.id then
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
local msg, rank
if frame.isspell then
msg, rank = GetSpellName(frame.id, "spell")
if string.len(rank) > 0 then
msg = msg.." ("..rank..")"
end
else
msg = frame.ammoname
end
GameTooltip:SetText(msg, 1, 1, 1)
GameTooltip:AddLine("Alt+Drag To Move This Button")
GameTooltip:Show()
end
end
function ZSpellButtonParent_OnClick()
ZSpellButton_EnsureParentFlags(this)
this:SetChecked(0)
if arg1 == "RightButton" then
local showChildren = not this.children:IsVisible()
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(this, showChildren)
elseif showChildren then
this.children:Show()
else
this.children:Hide()
end
else
if type(this.beforeclick) == "function" then
if this.beforeclick(this) then
return
end
end
if this.isspell then
if not this.id then
return
end
CastSpell(this.id, "spell")
else
if not (this.ammobag and this.ammoslot) then
return
end
PickupContainerItem(this.ammobag,this.ammoslot)
EquipCursorItem(0)
end
if type(this.afterclick) == "function" then
if this.afterclick(this) then
return
end
end
if this.hideonclick then
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(this, false)
elseif this.children then
this.children:Hide()
end
end
end
end
+124
View File
@@ -0,0 +1,124 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<CheckButton name="ZSpellButtonTemplate" toplevel="true" frameStrata="MEDIUM" movable="true" parent="UIParent" virtual="true">
<Size>
<AbsDimension x="36" y="36"/>
</Size>
<Layers>
<Layer level="BORDER">
<Texture name="$parentIconTexture" setAllPoints="true" hidden="true"/>
</Layer>
<Layer level="ARTWORK">
<Texture name="$parentBackground" file="Interface\Buttons\UI-Quickslot2">
<Size>
<AbsDimension x="64" y="64"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Frames>
<Model name="$parentCooldown" inherits="CooldownFrameTemplate"/>
<Frame setAllPoints="true">
<Layers>
<Layer level="OVERLAY">
<Texture name="$parentCircle" file="Interface\Minimap\MiniMap-TrackingBorder">
<Size>
<AbsDimension x="100" y="100"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="20" y="-22"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
</Frame>
</Frames>
<Scripts>
<OnClick>
ZSpellButtonParent_OnClick()
</OnClick>
<OnEnter>
ZSpellButtonParent_OnEnter()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
<OnMouseUp>
if ( this.isMoving ) then
this:StopMovingOrSizing()
this.isMoving = false
end
</OnMouseUp>
<OnDragStart>
if IsAltKeyDown() then
this:StartMoving()
this.isMoving = true
end
</OnDragStart>
<OnDragStop>
this:StopMovingOrSizing()
this.isMoving = false
</OnDragStop>
</Scripts>
<NormalTexture file=""/>
<PushedTexture file="Interface\Buttons\UI-Quickslot-Depress"/>
<HighlightTexture file="Interface\Buttons\ButtonHilight-Square" alphaMode="ADD"/>
<CheckedTexture file="Interface\Buttons\CheckButtonHilight" alphaMode="ADD"/>
</CheckButton>
<CheckButton name="ZSpellButtonChildTemplate" toplevel="true" frameStrata="MEDIUM" movable="true" hidden="true" virtual="true">
<Size>
<AbsDimension x="36" y="36"/>
</Size>
<Layers>
<Layer level="BORDER">
<Texture name="$parentIconTexture" setAllPoints="true" hidden="true"/>
</Layer>
<Layer level="ARTWORK">
<Texture name="$parentBackground" file="Interface\Buttons\UI-Quickslot2">
<Size>
<AbsDimension x="64" y="64"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Frames>
<Model name="$parentCooldown" inherits="CooldownFrameTemplate"/>
</Frames>
<Scripts>
<OnClick>
ZSpellButton_OnClick()
</OnClick>
<OnEnter>
ZSpellButton_OnEnter()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<NormalTexture file=""/>
<PushedTexture file="Interface\Buttons\UI-Quickslot-Depress"/>
<HighlightTexture file="Interface\Buttons\ButtonHilight-Square" alphaMode="ADD"/>
<CheckedTexture file="Interface\Buttons\CheckButtonHilight" alphaMode="ADD"/>
</CheckButton>
</Ui>
+50
View File
@@ -0,0 +1,50 @@
<!--
zhunter Module Loader
Loads all zhunter addon code and wraps it in the MTH module system
-->
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<!-- Load module wrapper first so module registration is always available -->
<Include file="module.lua"/>
<!-- Load localization first -->
<Include file="Localization.lua"/>
<!-- Load button template XML first (creates frame definitions) -->
<Include file="ZSpellButtonTemplate.xml"/>
<!-- Load individual button XMLs (creates all button frame instances) -->
<Include file="zButtonAspect.xml"/>
<Include file="zButtonTrack.xml"/>
<Include file="zButtonTrap.xml"/>
<Include file="zButtonAmmo.xml"/>
<Include file="zButtonPet.xml"/>
<Include file="zButtonMounts.xml"/>
<Include file="zButtonCompanions.xml"/>
<Include file="zButtonToys.xml"/>
<!-- Load main ZHunterMod.lua FIRST so ZHunterMod_Saved table exists before button files use it -->
<Include file="ZHunterMod.lua"/>
<!-- NOW load all Lua files (which use the frames created above) -->
<Include file="ZSpellButtonTemplate.lua"/>
<!-- Load individual button Lua files -->
<Include file="zButtonAspect.lua"/>
<Include file="zButtonTrack.lua"/>
<Include file="zButtonTrap.lua"/>
<Include file="zButtonAmmo.lua"/>
<Include file="zButtonPet.lua"/>
<Include file="zButtonMounts.lua"/>
<Include file="zButtonCompanions.lua"/>
<Include file="zButtonToys.lua"/>
<!-- Deferred initialization - runs LAST after all parsing is complete -->
<Include file="DeferredInit.lua"/>
</Ui>
+326
View File
@@ -0,0 +1,326 @@
------------------------------------------------------
-- MetaHunt: zhunter Module Wrapper
-- Modern module abstraction for the zhunter addon
------------------------------------------------------
MTH_ZH_MANAGED_HOOKS = true
local MTH_ZHunter = {
name = "zhunter",
enabled = true,
version = "1.0.3",
events = {
"VARIABLES_LOADED",
"PLAYER_ENTERING_WORLD",
"MTH_PET_LIVE_STATE_CHANGED",
},
features = {
aspect = true,
tracking = true,
traps = true,
ammo = true,
pet = true,
}
}
local function MTH_ZH_Log(msg)
if not (MTH and MTH.debug) then
return
end
MTH:Print("[ZH MODULE] " .. tostring(msg), "debug")
end
local MTH_ZH_PostLoginRestoreFrame = nil
local MTH_ZH_BootstrapFrame = nil
local MTH_ZH_SyncSavedVariables
local MTH_ZH_SetButtonsVisible
local MTH_ZH_SetAuxFramesVisible
local MTH_ZH_RestoreRuntimeFeatureFlags
local MTH_ZH_ApplyEnabledRuntimeState
local MTH_ZH_QueuePostLoginRestore
local function MTH_ZH_ApplyDefaultWidgetSpawnLayoutOnce()
local savedRoot = nil
if type(MTH_ZH_GetSavedRoot) == "function" then
savedRoot = MTH_ZH_GetSavedRoot()
elseif type(ZHunterMod_Saved) == "table" then
savedRoot = ZHunterMod_Saved
end
if type(savedRoot) ~= "table" then
return false
end
if savedRoot["_mth_widget_spawn_layout_v1"] then
return false
end
local orderedButtons = {
"zButtonAspect",
"zButtonAmmo",
"zButtonTrack",
"zButtonTrap",
"zButtonPet",
"zButtonMounts",
"zButtonCompanions",
"zButtonToys",
}
local startY = -140
local stepY = -54
local orderedCount = table.getn(orderedButtons)
for i = 1, orderedCount do
if not getglobal(orderedButtons[i]) then
MTH_ZH_Log("skipped one-time default widget spawn layout (missing frame: " .. tostring(orderedButtons[i]) .. ")")
return false
end
end
for i = 1, orderedCount do
local buttonName = orderedButtons[i]
local button = getglobal(buttonName)
if button then
button:ClearAllPoints()
button:SetPoint("TOP", UIParent, "TOP", 0, startY + ((i - 1) * stepY))
end
end
savedRoot["_mth_widget_spawn_layout_v1"] = 1
MTH_ZH_Log("applied one-time default widget spawn layout")
return true
end
function MTH_ZH_OnDeferredInitComplete()
if not (MTH and MTH.IsModuleEnabled and MTH:IsModuleEnabled("zhunter", true)) then
if MTH_ZH_SetButtonsVisible then
MTH_ZH_SetButtonsVisible(false)
end
if MTH_ZH_SetAuxFramesVisible then
MTH_ZH_SetAuxFramesVisible(false)
end
MTH_ZH_Log("deferred init applied disabled-state hide")
return
end
MTH_ZH_SyncSavedVariables()
MTH_ZH_ApplyDefaultWidgetSpawnLayoutOnce()
MTH_ZH_RestoreRuntimeFeatureFlags()
MTH_ZH_QueuePostLoginRestore("deferred-init")
end
MTH_ZH_QueuePostLoginRestore = function(tag)
if not MTH_ZH_PostLoginRestoreFrame then
MTH_ZH_PostLoginRestoreFrame = CreateFrame("Frame", "MTH_ZH_PostLoginRestoreFrame")
if not MTH_ZH_PostLoginRestoreFrame then
return
end
end
MTH_ZH_PostLoginRestoreFrame._mthElapsed = 0
MTH_ZH_PostLoginRestoreFrame:SetScript("OnUpdate", function()
this._mthElapsed = (this._mthElapsed or 0) + (arg1 or 0)
if this._mthElapsed < 0.2 then
return
end
this:SetScript("OnUpdate", nil)
if not (MTH and MTH.IsModuleEnabled and MTH:IsModuleEnabled("zhunter", true)) then
return
end
MTH_ZH_SyncSavedVariables()
MTH_ZH_RestoreRuntimeFeatureFlags()
MTH_ZH_Log("post-login restore applied: " .. tostring(tag))
end)
end
local function MTH_ZH_EnsureBootstrapRestoreFrame()
if MTH_ZH_BootstrapFrame then
return MTH_ZH_BootstrapFrame
end
MTH_ZH_BootstrapFrame = CreateFrame("Frame", "MTH_ZH_BootstrapRestoreFrame")
if not MTH_ZH_BootstrapFrame then
return nil
end
MTH_ZH_BootstrapFrame:RegisterEvent("VARIABLES_LOADED")
MTH_ZH_BootstrapFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
MTH_ZH_BootstrapFrame:SetScript("OnEvent", function()
if not (MTH and MTH.IsModuleEnabled and MTH:IsModuleEnabled("zhunter", true)) then
return
end
if event == "VARIABLES_LOADED" then
MTH_ZH_SyncSavedVariables()
return
end
if event == "PLAYER_ENTERING_WORLD" then
MTH_ZH_ApplyEnabledRuntimeState("bootstrap:" .. tostring(event))
MTH_ZH_QueuePostLoginRestore("bootstrap:" .. tostring(event))
this:UnregisterAllEvents()
this:SetScript("OnEvent", nil)
end
end)
return MTH_ZH_BootstrapFrame
end
MTH_ZH_ApplyEnabledRuntimeState = function(source)
MTH_ZH_SyncSavedVariables()
MTH_ZH_SetButtonsVisible(true)
MTH_ZH_SetAuxFramesVisible(true)
MTH_ZH_RestoreRuntimeFeatureFlags()
end
MTH_ZH_SyncSavedVariables = function()
if not MTH or not MTH.GetModuleCharSavedVariables then
return
end
local moduleStore = MTH:GetModuleCharSavedVariables("zhunter")
if type(ZHunterMod_Saved) == "table" then
if MTH_CharSavedVariables and MTH_CharSavedVariables.modules then
MTH_CharSavedVariables.modules.zhunter = ZHunterMod_Saved
end
elseif type(moduleStore) == "table" then
ZHunterMod_Saved = moduleStore
end
end
MTH_ZH_SetButtonsVisible = function(visible)
local buttonNames = {
"zButtonAspect",
"zButtonTrack",
"zButtonTrap",
"zButtonAmmo",
"zButtonPet",
"zButtonMounts",
"zButtonCompanions",
"zButtonToys",
}
local function MTH_ZH_SetChildButtonsVisible(parentButton, parentName, show)
if not parentButton then
return
end
local showChildren = false
if show then
if type(ZSpellButton_GetChildrenExpanded) == "function" then
showChildren = ZSpellButton_GetChildrenExpanded(parentButton)
else
showChildren = true
end
end
if parentButton.children then
if showChildren then
parentButton.children:Show()
else
parentButton.children:Hide()
end
end
if not parentButton.count then
return
end
local baseName = parentButton.name or parentName
if not baseName then
return
end
for index = 1, parentButton.count do
local child = getglobal(baseName .. index)
if child then
if showChildren then
if child.id then
child:Show()
else
child:Hide()
end
else
child:Hide()
end
end
end
end
for _, buttonName in ipairs(buttonNames) do
local button = getglobal(buttonName)
if button then
MTH_ZH_SetChildButtonsVisible(button, buttonName, visible)
if visible then
button:Show()
else
button:Hide()
end
end
end
end
MTH_ZH_SetAuxFramesVisible = function(visible)
return
end
local function MTH_ZH_ClearRuntimeFeatureFlags()
return
end
MTH_ZH_RestoreRuntimeFeatureFlags = function()
return
end
function MTH_ZHunter:init()
-- ZHunterMod initializes via the game events
-- Features: Aspect, Tracking, Trap, Ammo, Pet management buttons
MTH_ZH_SyncSavedVariables()
MTH_ZH_EnsureBootstrapRestoreFrame()
if self.enabled then
MTH_ZH_SyncSavedVariables()
end
end
function MTH_ZHunter:setEnabled(enabled)
MTH_ZH_SyncSavedVariables()
if enabled then
MTH_ZH_EnsureBootstrapRestoreFrame()
MTH_ZH_ApplyEnabledRuntimeState("setEnabled")
else
MTH_ZH_ClearRuntimeFeatureFlags()
MTH_ZH_SetButtonsVisible(false)
MTH_ZH_SetAuxFramesVisible(false)
end
end
function MTH_ZHunter:onEvent(evt, arg1, arg2)
if not self.enabled then
return
end
if evt == "MTH_PET_LIVE_STATE_CHANGED" then
if type(zButtonPet_RefreshLiveState) == "function" then
zButtonPet_RefreshLiveState(arg1, arg2)
end
return
end
if evt == "VARIABLES_LOADED" then
MTH_ZH_SyncSavedVariables()
MTH_ZH_RestoreRuntimeFeatureFlags()
return
end
if evt == "PLAYER_ENTERING_WORLD" then
MTH_ZH_ApplyEnabledRuntimeState("event:" .. tostring(evt))
MTH_ZH_QueuePostLoginRestore(evt)
end
end
function MTH_ZHunter:cleanup()
-- Cleanup code when module is unloaded
self:setEnabled(false)
end
-- Register with MTH
MTH:RegisterModule("zhunter", MTH_ZHunter)
File diff suppressed because it is too large Load Diff
+14
View File
@@ -0,0 +1,14 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Frame name="zButtonAmmoFrame">
</Frame>
<CheckButton name="zButtonAmmo" inherits="ZSpellButtonTemplate">
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" relativePoint="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Ui>
+281
View File
@@ -0,0 +1,281 @@
local function zButtonAspect_GetRoot()
return MTH_ZH_GetSavedRoot()
end
local root = zButtonAspect_GetRoot()
if not root["zButtonAspect"] then
root["zButtonAspect"] = {}
root["zButtonAspect"]["spells"] = {1, 2, 3, 4, 5, 6, 7}
root["zButtonAspect"]["rows"] = 1
root["zButtonAspect"]["horizontal"] = nil
root["zButtonAspect"]["vertical"] = nil
root["zButtonAspect"]["firstbutton"] = "RIGHT"
root["zButtonAspect"]["enabled"] = 1
root["zButtonAspect"]["tooltip"] = 1
root["zButtonAspect"]["parent"] = {}
root["zButtonAspect"]["parent"]["size"] = 36
root["zButtonAspect"]["parent"]["hide"] = nil
root["zButtonAspect"]["parent"]["circle"] = 1
root["zButtonAspect"]["children"] = {}
root["zButtonAspect"]["children"]["size"] = 36
root["zButtonAspect"]["children"]["hideonclick"] = 1
end
ZHunterMod_Aspect_Spells = {
ZHUNTER_ASPECT_HAWK,
ZHUNTER_ASPECT_MONKEY,
ZHUNTER_ASPECT_WOLF,
ZHUNTER_ASPECT_CHEETAH,
ZHUNTER_ASPECT_PACK,
ZHUNTER_ASPECT_WILD,
ZHUNTER_ASPECT_BEAST
}
local ZHUNTER_ASPECT_MAX = table.getn(ZHunterMod_Aspect_Spells)
local function zButtonAspect_GetSaved()
local currentRoot = zButtonAspect_GetRoot()
if not currentRoot["zButtonAspect"] then
currentRoot["zButtonAspect"] = {}
end
return currentRoot["zButtonAspect"]
end
local function zButtonAspect_EnsureConfig()
local saved = zButtonAspect_GetSaved()
saved["count"] = nil
if saved["rows"] == nil then
saved["rows"] = 1
end
if saved["firstbutton"] == nil then
saved["firstbutton"] = "RIGHT"
end
if saved["enabled"] == nil then
saved["enabled"] = 1
end
if saved["tooltip"] == nil then
saved["tooltip"] = 1
end
if not saved["parent"] then
saved["parent"] = {}
end
if saved["parent"]["size"] == nil then
saved["parent"]["size"] = 36
end
if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1
end
if not saved["children"] then
saved["children"] = {}
end
if saved["children"]["size"] == nil then
saved["children"]["size"] = 36
end
if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1
end
if not saved["spells"] then
saved["spells"] = {}
end
if not saved["visible"] then
saved["visible"] = {}
end
for i = 1, ZHUNTER_ASPECT_MAX do
if not tonumber(saved["spells"][i]) then
saved["spells"][i] = i
end
if saved["visible"][i] == nil then
saved["visible"][i] = 1
end
end
end
local function zButtonAspect_ApplyRuntimeSettings()
if not zButtonAspect then
return
end
local saved = zButtonAspect_GetSaved()
zButtonAspect.tooltip = saved["tooltip"] and true or false
zButtonAspect.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end
function zButtonAspect_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
end
function zButtonAspect_OnEvent()
if event == "VARIABLES_LOADED" then
if not zButtonAspect then
return
end
if UnitClass("player") ~= ZHUNTER_HUNTER then
zButtonAspect:UnregisterAllEvents()
zButtonAspect:Hide()
return
end
zButtonAspect_CreateButtons()
zButtonAspectAdjustment = CreateFrame("Frame", "zButtonAspectAdjustment")
zButtonAspectAdjustment:RegisterEvent("PLAYER_AURAS_CHANGED")
zButtonAspectAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonAspectAdjustment:SetScript("OnEvent", zButtonAspectAdjustment_OnEvent)
zButtonAspect_Tooltip = CreateFrame("GameTooltip", "zButtonAspect_Tooltip", nil, "GameTooltipTemplate")
zButtonAspect_SetupSizeAndPosition()
end
end
function zButtonAspect_CreateButtons()
zButtonAspect_EnsureConfig()
local saved = zButtonAspect_GetSaved()
ZSpellButton_CreateChildren(zButtonAspect, "zButtonAspect", ZHUNTER_ASPECT_MAX)
local info = {}
local infoIndex = 1
for i=1, table.getn(ZHunterMod_Aspect_Spells) do
if not tonumber(saved["spells"][i]) then
info = ZHunterMod_Aspect_Spells
saved["spells"] = {1, 2, 3, 4, 5, 6, 7}
break
end
local spellIndex = saved["spells"][i]
if saved["visible"][spellIndex] ~= false then
info[infoIndex] = ZHunterMod_Aspect_Spells[spellIndex]
infoIndex = infoIndex + 1
end
end
zButtonAspect.found = ZSpellButton_SetButtons(zButtonAspect, info)
zButtonAspect_ApplyRuntimeSettings()
end
function zButtonAspect_SetupSizeAndPosition()
zButtonAspect_EnsureConfig()
local saved = zButtonAspect_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonAspect and zButtonAspect.Hide then
zButtonAspect:Hide()
end
return
end
local displayCount = zButtonAspect.found or ZHUNTER_ASPECT_MAX
if displayCount < 0 then
displayCount = 0
end
ZSpellButton_SetSize(zButtonAspect, saved["parent"]["size"])
ZSpellButton_SetSize(zButtonAspect, saved["children"]["size"], 1)
ZSpellButton_SetExpandDirection(zButtonAspect, saved["firstbutton"])
ZSpellButton_ArrangeChildren(zButtonAspect, saved["rows"],
displayCount, saved["horizontal"],
saved["vertical"])
end
function zButtonAspect_Reset()
local currentRoot = zButtonAspect_GetRoot()
currentRoot["zButtonAspect"] = {}
local saved = zButtonAspect_GetSaved()
saved["spells"] = {1, 2, 3, 4, 5, 6, 7}
saved["rows"] = 1
saved["horizontal"] = nil
saved["vertical"] = nil
saved["firstbutton"] = "RIGHT"
saved["enabled"] = 1
saved["tooltip"] = 1
saved["parent"] = {}
saved["parent"]["size"] = 36
saved["parent"]["hide"] = nil
saved["parent"]["circle"] = 1
saved["children"] = {}
saved["children"]["size"] = 36
saved["children"]["hideonclick"] = 1
saved["visible"] = {1, 1, 1, 1, 1, 1, 1}
zButtonAspect_EnsureConfig()
end
function zButtonAspectAdjustment_OnEvent()
if not zButtonAspect or not zButtonAspect.count then
return
end
if event == "PLAYER_AURAS_CHANGED" or event == "PLAYER_ENTERING_WORLD" then
if not zButtonAspect1.id then
return
end
local buttontextures = {}
local button
for i=1, zButtonAspect.count do
button = getglobal(zButtonAspect.name..i)
button.icon = nil
if button.id then
buttontextures[GetSpellTexture(button.id, "spell")] = button
end
end
local i = 1
local texture = GetSpellTexture(zButtonAspect1.id, "spell")
local buff = UnitBuff("player", i)
local spellname, buffname
zButtonAspect.id = zButtonAspect1.id
while buff do
if texture == buff and zButtonAspect2.id then
zButtonAspect.id = zButtonAspect2.id
end
if buttontextures[buff] then
zButtonAspect_Tooltip:SetOwner(this, "ANCHOR_NONE")
zButtonAspect_Tooltip:SetUnitBuff("player", i)
buffname = zButtonAspect_TooltipTextLeft1:GetText()
spellname = GetSpellName(buttontextures[buff].id, "spell")
if buffname == spellname then
buttontextures[buff].icon = "Interface\\Icons\\Spell_Nature_WispSplode"
end
end
i = i + 1
buff = UnitBuff("player", i)
end
ZSpellButton_UpdateButton(zButtonAspect)
ZSpellButton_UpdateCooldown(zButtonAspect)
for i=1, zButtonAspect.count do
button = getglobal(zButtonAspect.name..i)
if button.id then
ZSpellButton_UpdateButton(button)
end
end
if GameTooltip:IsOwned(zButtonAspect) then
ZSpellButtonParent_OnEnter(zButtonAspect)
end
end
end
function zButtonAspect_KeyBinding(index)
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
end
local button
if index then
button = getglobal("zButtonAspect"..index)
else
button = zButtonAspect
end
if button.id then
CastSpell(button.id, "spell")
if zButtonAspect.hideonclick then
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(zButtonAspect, false)
elseif zButtonAspect.children then
zButtonAspect.children:Hide()
end
end
end
end
SLASH_zButtonAspect1 = "/ZAspect"
SlashCmdList["zButtonAspect"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Aspect button is disabled while module 'zhunter' is disabled.") then
return
end
if msg == "reset" then
zButtonAspect_Reset()
zButtonAspect:ClearAllPoints()
zButtonAspect:SetPoint("CENTER", UIParent, "CENTER", -60, 0)
elseif msg == "options" then
MTH_OpenOptions("Aspect")
else
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"")
end
end
+14
View File
@@ -0,0 +1,14 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Frame name="zButtonAspectFrame">
</Frame>
<CheckButton name="zButtonAspect" inherits="ZSpellButtonTemplate">
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" relativePoint="CENTER">
<Offset>
<AbsDimension x="-60" y="0"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Ui>
+323
View File
@@ -0,0 +1,323 @@
local function zButtonCompanions_GetRoot()
return MTH_ZH_GetSavedRoot()
end
local root = zButtonCompanions_GetRoot()
if not root["zButtonCompanions"] then
root["zButtonCompanions"] = {}
root["zButtonCompanions"]["spells"] = {}
root["zButtonCompanions"]["rows"] = 1
root["zButtonCompanions"]["horizontal"] = nil
root["zButtonCompanions"]["vertical"] = nil
root["zButtonCompanions"]["firstbutton"] = "RIGHT"
root["zButtonCompanions"]["enabled"] = 0
root["zButtonCompanions"]["tooltip"] = 1
root["zButtonCompanions"]["parent"] = {}
root["zButtonCompanions"]["parent"]["size"] = 36
root["zButtonCompanions"]["parent"]["hide"] = nil
root["zButtonCompanions"]["parent"]["circle"] = 1
root["zButtonCompanions"]["children"] = {}
root["zButtonCompanions"]["children"]["size"] = 36
root["zButtonCompanions"]["children"]["hideonclick"] = 1
end
local ZHUNTER_COMPANIONS_BUTTON_MAX = 80
local function zButtonCompanions_GetSaved()
local currentRoot = zButtonCompanions_GetRoot()
if not currentRoot["zButtonCompanions"] then
currentRoot["zButtonCompanions"] = {}
end
return currentRoot["zButtonCompanions"]
end
local function zButtonCompanions_EnsureConfig()
local saved = zButtonCompanions_GetSaved()
saved["count"] = nil
if saved["enabled"] == nil then
saved["enabled"] = 0
end
if saved["tooltip"] == nil then
saved["tooltip"] = 1
end
if not saved["children"] then
saved["children"] = {}
end
if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1
end
if not saved["spells"] then
saved["spells"] = {}
end
if not saved["parent"] then
saved["parent"] = {}
end
if not saved["children"] then
saved["children"] = {}
end
if not saved["parent"]["size"] then
saved["parent"]["size"] = 36
end
if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1
end
if not saved["children"]["size"] then
saved["children"]["size"] = 36
end
if not saved["rows"] or saved["rows"] < 1 then
saved["rows"] = 1
end
if not saved["firstbutton"] then
saved["firstbutton"] = "RIGHT"
end
end
local function zButtonCompanions_ApplyRuntimeSettings()
if not zButtonCompanions then
return
end
local saved = zButtonCompanions_GetSaved()
zButtonCompanions.tooltip = saved["tooltip"] and true or false
zButtonCompanions.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end
local function zButtonCompanions_NormalizeTabName(value)
local text = string.lower(tostring(value or ""))
text = string.gsub(text, "%s+", "")
text = string.gsub(text, "[^%a]", "")
while string.sub(text, 1, 1) == "z" and string.len(text) > 1 do
text = string.sub(text, 2)
end
return text
end
local function zButtonCompanions_FindTabBounds()
if type(GetNumSpellTabs) ~= "function" or type(GetSpellTabInfo) ~= "function" then
return nil, nil
end
local tabCount = GetNumSpellTabs() or 0
for tabIndex = 1, tabCount do
local tabName, _, tabOffset, tabEntries = GetSpellTabInfo(tabIndex)
local normalized = zButtonCompanions_NormalizeTabName(tabName)
if string.find(normalized, "companion", 1, true) or string.find(normalized, "minipet", 1, true) then
return tonumber(tabOffset) or 0, tonumber(tabEntries) or 0
end
end
return nil, nil
end
local function zButtonCompanions_CollectTabSpellIds()
local tabOffset, tabEntries = zButtonCompanions_FindTabBounds()
if not tabOffset or not tabEntries or tabEntries <= 0 then
return {}
end
local spellIds = {}
local bookType = BOOKTYPE_SPELL or "spell"
local maxIndex = tabOffset + tabEntries
for spellIndex = tabOffset + 1, maxIndex do
local spellName = GetSpellName(spellIndex, bookType)
if spellName and spellName ~= "" then
table.insert(spellIds, spellIndex)
end
end
return spellIds
end
local function zButtonCompanions_ApplySpellIds(spellIds)
if not zButtonCompanions then
return 0
end
local parent = zButtonCompanions
local childCount = parent.count or ZHUNTER_COMPANIONS_BUTTON_MAX
for i = 1, childCount do
local child = getglobal("zButtonCompanions" .. i)
if child then
child:Hide()
child.id = nil
child.icon = nil
child.isspell = nil
end
end
local found = 0
for i = 1, table.getn(spellIds) do
if found >= childCount then
break
end
local spellId = spellIds[i]
if spellId then
found = found + 1
local child = getglobal("zButtonCompanions" .. found)
if child then
child.id = spellId
child.isspell = 1
ZSpellButton_UpdateButton(child)
child:Show()
end
end
end
if found > 0 then
parent.id = spellIds[1]
parent.isspell = 1
ZSpellButton_UpdateButton(parent)
parent:Enable()
parent:Show()
else
parent.id = nil
parent:Hide()
end
return found
end
local function zButtonCompanions_RefreshSpells()
if not zButtonCompanions then
return 0
end
local saved = zButtonCompanions_GetSaved()
local spellIds = zButtonCompanions_CollectTabSpellIds()
local spellNames = {}
local bookType = BOOKTYPE_SPELL or "spell"
for i = 1, table.getn(spellIds) do
local n = GetSpellName(spellIds[i], bookType)
if n and n ~= "" then
table.insert(spellNames, n)
end
end
saved["spellIds"] = spellIds
saved["spells"] = spellNames
zButtonCompanions.spells = spellNames
zButtonCompanions.found = zButtonCompanions_ApplySpellIds(spellIds)
zButtonCompanions_ApplyRuntimeSettings()
return zButtonCompanions.found or 0
end
function zButtonCompanions_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
end
function zButtonCompanions_OnEvent()
if event == "VARIABLES_LOADED" then
if not zButtonCompanions then
return
end
if UnitClass("player") ~= ZHUNTER_HUNTER then
zButtonCompanions:UnregisterAllEvents()
zButtonCompanions:Hide()
return
end
zButtonCompanions_CreateButtons()
zButtonCompanionsAdjustment = CreateFrame("Frame", "zButtonCompanionsAdjustment")
zButtonCompanionsAdjustment:RegisterEvent("SPELLS_CHANGED")
zButtonCompanionsAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonCompanionsAdjustment:SetScript("OnEvent", zButtonCompanionsAdjustment_OnEvent)
zButtonCompanions_SetupSizeAndPosition()
end
end
function zButtonCompanions_CreateButtons()
zButtonCompanions_EnsureConfig()
if not zButtonCompanions._mthChildrenCreated then
ZSpellButton_CreateChildren(zButtonCompanions, "zButtonCompanions", ZHUNTER_COMPANIONS_BUTTON_MAX)
zButtonCompanions._mthChildrenCreated = 1
end
zButtonCompanions_RefreshSpells()
end
function zButtonCompanions_SetupSizeAndPosition()
local saved = zButtonCompanions_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonCompanions and zButtonCompanions.Hide then
zButtonCompanions:Hide()
end
return
end
local displayCount = zButtonCompanions.found or 0
if displayCount < 0 then
displayCount = 0
end
ZSpellButton_SetSize(zButtonCompanions, saved["parent"]["size"])
ZSpellButton_SetSize(zButtonCompanions, saved["children"]["size"], 1)
ZSpellButton_SetExpandDirection(zButtonCompanions, saved["firstbutton"])
ZSpellButton_ArrangeChildren(zButtonCompanions, saved["rows"],
displayCount, saved["horizontal"],
saved["vertical"])
end
function zButtonCompanions_Reset()
local currentRoot = zButtonCompanions_GetRoot()
currentRoot["zButtonCompanions"] = {}
local saved = zButtonCompanions_GetSaved()
saved["spells"] = {}
saved["rows"] = 1
saved["horizontal"] = nil
saved["vertical"] = nil
saved["firstbutton"] = "RIGHT"
saved["enabled"] = 1
saved["tooltip"] = 1
saved["parent"] = {}
saved["parent"]["size"] = 36
saved["parent"]["hide"] = nil
saved["parent"]["circle"] = 1
saved["children"] = {}
saved["children"]["size"] = 36
saved["children"]["hideonclick"] = 1
zButtonCompanions_EnsureConfig()
end
function zButtonCompanionsAdjustment_OnEvent()
if not zButtonCompanions then
return
end
zButtonCompanions_RefreshSpells()
zButtonCompanions_SetupSizeAndPosition()
if GameTooltip:IsOwned(zButtonCompanions) then
ZSpellButtonParent_OnEnter(zButtonCompanions)
end
end
function zButtonCompanions_KeyBinding(index)
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
end
local button
if index then
button = getglobal("zButtonCompanions"..index)
else
button = zButtonCompanions
end
if button and button.id then
CastSpell(button.id, "spell")
if zButtonCompanions.hideonclick then
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(zButtonCompanions, false)
elseif zButtonCompanions.children then
zButtonCompanions.children:Hide()
end
end
end
end
SLASH_zButtonCompanions1 = "/ZCompanions"
SLASH_zButtonCompanions2 = "/ZMinipets"
SlashCmdList["zButtonCompanions"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Companions button is disabled while module 'zhunter' is disabled.") then
return
end
if msg == "reset" then
zButtonCompanions_Reset()
zButtonCompanions:ClearAllPoints()
zButtonCompanions:SetPoint("TOP", UIParent, "TOP", 0, -464)
zButtonCompanions_RefreshSpells()
zButtonCompanions_SetupSizeAndPosition()
else
MTH_ZH_Print("Possible Commands: \"reset\"")
end
end
+14
View File
@@ -0,0 +1,14 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Frame name="zButtonCompanionsFrame">
</Frame>
<CheckButton name="zButtonCompanions" inherits="ZSpellButtonTemplate">
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" relativePoint="CENTER">
<Offset>
<AbsDimension x="0" y="-180"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Ui>
+322
View File
@@ -0,0 +1,322 @@
local function zButtonMounts_GetRoot()
return MTH_ZH_GetSavedRoot()
end
local root = zButtonMounts_GetRoot()
if not root["zButtonMounts"] then
root["zButtonMounts"] = {}
root["zButtonMounts"]["spells"] = {}
root["zButtonMounts"]["rows"] = 1
root["zButtonMounts"]["horizontal"] = nil
root["zButtonMounts"]["vertical"] = nil
root["zButtonMounts"]["firstbutton"] = "RIGHT"
root["zButtonMounts"]["enabled"] = 0
root["zButtonMounts"]["tooltip"] = 1
root["zButtonMounts"]["parent"] = {}
root["zButtonMounts"]["parent"]["size"] = 36
root["zButtonMounts"]["parent"]["hide"] = nil
root["zButtonMounts"]["parent"]["circle"] = 1
root["zButtonMounts"]["children"] = {}
root["zButtonMounts"]["children"]["size"] = 36
root["zButtonMounts"]["children"]["hideonclick"] = 1
end
local ZHUNTER_MOUNTS_BUTTON_MAX = 80
local function zButtonMounts_GetSaved()
local currentRoot = zButtonMounts_GetRoot()
if not currentRoot["zButtonMounts"] then
currentRoot["zButtonMounts"] = {}
end
return currentRoot["zButtonMounts"]
end
local function zButtonMounts_EnsureConfig()
local saved = zButtonMounts_GetSaved()
saved["count"] = nil
if saved["enabled"] == nil then
saved["enabled"] = 0
end
if saved["tooltip"] == nil then
saved["tooltip"] = 1
end
if not saved["children"] then
saved["children"] = {}
end
if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1
end
if not saved["spells"] then
saved["spells"] = {}
end
if not saved["parent"] then
saved["parent"] = {}
end
if not saved["children"] then
saved["children"] = {}
end
if not saved["parent"]["size"] then
saved["parent"]["size"] = 36
end
if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1
end
if not saved["children"]["size"] then
saved["children"]["size"] = 36
end
if not saved["rows"] or saved["rows"] < 1 then
saved["rows"] = 1
end
if not saved["firstbutton"] then
saved["firstbutton"] = "RIGHT"
end
end
local function zButtonMounts_ApplyRuntimeSettings()
if not zButtonMounts then
return
end
local saved = zButtonMounts_GetSaved()
zButtonMounts.tooltip = saved["tooltip"] and true or false
zButtonMounts.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end
local function zButtonMounts_NormalizeTabName(value)
local text = string.lower(tostring(value or ""))
text = string.gsub(text, "%s+", "")
text = string.gsub(text, "[^%a]", "")
while string.sub(text, 1, 1) == "z" and string.len(text) > 1 do
text = string.sub(text, 2)
end
return text
end
local function zButtonMounts_FindTabBounds()
if type(GetNumSpellTabs) ~= "function" or type(GetSpellTabInfo) ~= "function" then
return nil, nil
end
local tabCount = GetNumSpellTabs() or 0
for tabIndex = 1, tabCount do
local tabName, _, tabOffset, tabEntries = GetSpellTabInfo(tabIndex)
local normalized = zButtonMounts_NormalizeTabName(tabName)
if string.find(normalized, "mount", 1, true) then
return tonumber(tabOffset) or 0, tonumber(tabEntries) or 0
end
end
return nil, nil
end
local function zButtonMounts_CollectTabSpellIds()
local tabOffset, tabEntries = zButtonMounts_FindTabBounds()
if not tabOffset or not tabEntries or tabEntries <= 0 then
return {}
end
local spellIds = {}
local bookType = BOOKTYPE_SPELL or "spell"
local maxIndex = tabOffset + tabEntries
for spellIndex = tabOffset + 1, maxIndex do
local spellName = GetSpellName(spellIndex, bookType)
if spellName and spellName ~= "" then
table.insert(spellIds, spellIndex)
end
end
return spellIds
end
local function zButtonMounts_ApplySpellIds(spellIds)
if not zButtonMounts then
return 0
end
local parent = zButtonMounts
local childCount = parent.count or ZHUNTER_MOUNTS_BUTTON_MAX
for i = 1, childCount do
local child = getglobal("zButtonMounts" .. i)
if child then
child:Hide()
child.id = nil
child.icon = nil
child.isspell = nil
end
end
local found = 0
for i = 1, table.getn(spellIds) do
if found >= childCount then
break
end
local spellId = spellIds[i]
if spellId then
found = found + 1
local child = getglobal("zButtonMounts" .. found)
if child then
child.id = spellId
child.isspell = 1
ZSpellButton_UpdateButton(child)
child:Show()
end
end
end
if found > 0 then
parent.id = spellIds[1]
parent.isspell = 1
ZSpellButton_UpdateButton(parent)
parent:Enable()
parent:Show()
else
parent.id = nil
parent:Hide()
end
return found
end
local function zButtonMounts_RefreshSpells()
if not zButtonMounts then
return 0
end
local saved = zButtonMounts_GetSaved()
local spellIds = zButtonMounts_CollectTabSpellIds()
local spellNames = {}
local bookType = BOOKTYPE_SPELL or "spell"
for i = 1, table.getn(spellIds) do
local n = GetSpellName(spellIds[i], bookType)
if n and n ~= "" then
table.insert(spellNames, n)
end
end
saved["spellIds"] = spellIds
saved["spells"] = spellNames
zButtonMounts.spells = spellNames
zButtonMounts.found = zButtonMounts_ApplySpellIds(spellIds)
zButtonMounts_ApplyRuntimeSettings()
return zButtonMounts.found or 0
end
function zButtonMounts_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
end
function zButtonMounts_OnEvent()
if event == "VARIABLES_LOADED" then
if not zButtonMounts then
return
end
if UnitClass("player") ~= ZHUNTER_HUNTER then
zButtonMounts:UnregisterAllEvents()
zButtonMounts:Hide()
return
end
zButtonMounts_CreateButtons()
zButtonMountsAdjustment = CreateFrame("Frame", "zButtonMountsAdjustment")
zButtonMountsAdjustment:RegisterEvent("SPELLS_CHANGED")
zButtonMountsAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonMountsAdjustment:SetScript("OnEvent", zButtonMountsAdjustment_OnEvent)
zButtonMounts_SetupSizeAndPosition()
end
end
function zButtonMounts_CreateButtons()
zButtonMounts_EnsureConfig()
if not zButtonMounts._mthChildrenCreated then
ZSpellButton_CreateChildren(zButtonMounts, "zButtonMounts", ZHUNTER_MOUNTS_BUTTON_MAX)
zButtonMounts._mthChildrenCreated = 1
end
zButtonMounts_RefreshSpells()
end
function zButtonMounts_SetupSizeAndPosition()
local saved = zButtonMounts_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonMounts and zButtonMounts.Hide then
zButtonMounts:Hide()
end
return
end
local displayCount = zButtonMounts.found or 0
if displayCount < 0 then
displayCount = 0
end
ZSpellButton_SetSize(zButtonMounts, saved["parent"]["size"])
ZSpellButton_SetSize(zButtonMounts, saved["children"]["size"], 1)
ZSpellButton_SetExpandDirection(zButtonMounts, saved["firstbutton"])
ZSpellButton_ArrangeChildren(zButtonMounts, saved["rows"],
displayCount, saved["horizontal"],
saved["vertical"])
end
function zButtonMounts_Reset()
local currentRoot = zButtonMounts_GetRoot()
currentRoot["zButtonMounts"] = {}
local saved = zButtonMounts_GetSaved()
saved["spells"] = {}
saved["rows"] = 1
saved["horizontal"] = nil
saved["vertical"] = nil
saved["firstbutton"] = "RIGHT"
saved["enabled"] = 1
saved["tooltip"] = 1
saved["parent"] = {}
saved["parent"]["size"] = 36
saved["parent"]["hide"] = nil
saved["parent"]["circle"] = 1
saved["children"] = {}
saved["children"]["size"] = 36
saved["children"]["hideonclick"] = 1
zButtonMounts_EnsureConfig()
end
function zButtonMountsAdjustment_OnEvent()
if not zButtonMounts then
return
end
zButtonMounts_RefreshSpells()
zButtonMounts_SetupSizeAndPosition()
if GameTooltip:IsOwned(zButtonMounts) then
ZSpellButtonParent_OnEnter(zButtonMounts)
end
end
function zButtonMounts_KeyBinding(index)
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
end
local button
if index then
button = getglobal("zButtonMounts"..index)
else
button = zButtonMounts
end
if button and button.id then
CastSpell(button.id, "spell")
if zButtonMounts.hideonclick then
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(zButtonMounts, false)
elseif zButtonMounts.children then
zButtonMounts.children:Hide()
end
end
end
end
SLASH_zButtonMounts1 = "/ZMounts"
SlashCmdList["zButtonMounts"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Mounts button is disabled while module 'zhunter' is disabled.") then
return
end
if msg == "reset" then
zButtonMounts_Reset()
zButtonMounts:ClearAllPoints()
zButtonMounts:SetPoint("TOP", UIParent, "TOP", 0, -410)
zButtonMounts_RefreshSpells()
zButtonMounts_SetupSizeAndPosition()
else
MTH_ZH_Print("Possible Commands: \"reset\"")
end
end
+14
View File
@@ -0,0 +1,14 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Frame name="zButtonMountsFrame">
</Frame>
<CheckButton name="zButtonMounts" inherits="ZSpellButtonTemplate">
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" relativePoint="CENTER">
<Offset>
<AbsDimension x="0" y="-120"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Ui>
+454
View File
@@ -0,0 +1,454 @@
local function zButtonPet_GetRoot()
return MTH_ZH_GetSavedRoot()
end
local root = zButtonPet_GetRoot()
-- Initialize with defaults only if not already configured
if not root["zButtonPet"] then
root["zButtonPet"] = {}
root["zButtonPet"]["pet"] = {}
root["zButtonPet"]["pet"]["happiness"] = nil
root["zButtonPet"]["pet"]["status"] = nil
root["zButtonPet"]["pet"]["dead"] = nil
root["zButtonPet"]["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
root["zButtonPet"]["rows"] = 1
root["zButtonPet"]["horizontal"] = nil
root["zButtonPet"]["vertical"] = nil
root["zButtonPet"]["firstbutton"] = "RIGHT"
root["zButtonPet"]["enabled"] = 1
root["zButtonPet"]["tooltip"] = 1
root["zButtonPet"]["parent"] = {}
root["zButtonPet"]["parent"]["size"] = 36
root["zButtonPet"]["parent"]["hide"] = nil
root["zButtonPet"]["parent"]["circle"] = 1
root["zButtonPet"]["children"] = {}
root["zButtonPet"]["children"]["size"] = 36
root["zButtonPet"]["children"]["hideonclick"] = 1
end
root["zButtonPet"]["food"] = {}
ZHunterMod_Pet_Spells = {
ZHUNTER_PET_EYES,
ZHUNTER_PET_DISMISS,
ZHUNTER_PET_MEND,
ZHUNTER_PET_FEED,
ZHUNTER_PET_CALL,
ZHUNTER_PET_REVIVE,
ZHUNTER_PET_LORE,
ZHUNTER_PET_TRAINING,
ZHUNTER_PET_TAMING,
ZHUNTER_PET_POSITION
}
local ZHUNTER_PET_MAX = table.getn(ZHunterMod_Pet_Spells)
local function zButtonPet_GetSaved()
local currentRoot = zButtonPet_GetRoot()
if not currentRoot["zButtonPet"] then
currentRoot["zButtonPet"] = {}
end
return currentRoot["zButtonPet"]
end
local function zButtonPet_EnsureConfig()
local saved = zButtonPet_GetSaved()
saved["count"] = nil
if not saved["pet"] then
saved["pet"] = {}
end
if saved["pet"]["happiness"] == nil then
saved["pet"]["happiness"] = nil
end
if saved["pet"]["status"] == nil then
saved["pet"]["status"] = nil
end
if saved["pet"]["dead"] == nil then
saved["pet"]["dead"] = nil
end
if not saved["parent"] then
saved["parent"] = {}
end
if saved["parent"]["size"] == nil then
saved["parent"]["size"] = 36
end
if saved["parent"]["hide"] == nil then
saved["parent"]["hide"] = nil
end
if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1
end
if saved["enabled"] == nil then
saved["enabled"] = 1
end
if saved["tooltip"] == nil then
saved["tooltip"] = 1
end
if saved["rows"] == nil then
saved["rows"] = 1
end
if saved["horizontal"] == nil then
saved["horizontal"] = nil
end
if saved["vertical"] == nil then
saved["vertical"] = nil
end
if saved["firstbutton"] == nil then
saved["firstbutton"] = "RIGHT"
end
if not saved["children"] then
saved["children"] = {}
end
if saved["children"]["size"] == nil then
saved["children"]["size"] = 36
end
if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1
end
if saved["food"] == nil then
saved["food"] = {}
end
if not saved["spells"] then
saved["spells"] = {}
end
if not saved["visible"] then
saved["visible"] = {}
end
for i = 1, ZHUNTER_PET_MAX do
if not tonumber(saved["spells"][i]) then
saved["spells"][i] = i
end
if saved["visible"][i] == nil then
saved["visible"][i] = 1
end
end
end
local function zButtonPet_ApplyRuntimeSettings()
if not zButtonPet then
return
end
local saved = zButtonPet_GetSaved()
zButtonPet.tooltip = saved["tooltip"] and true or false
zButtonPet.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end
function zButtonPet_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
end
function zButtonPet_OnEvent()
if event == "VARIABLES_LOADED" then
if not zButtonPet then
return
end
if UnitClass("player") ~= ZHUNTER_HUNTER then
zButtonPet:UnregisterAllEvents()
zButtonPet:Hide()
return
end
zButtonPet_CreateButtons()
zButtonPet.beforeclick = zButtonPetAdjustment_BeforeClick
zButtonPet.afterclick = zButtonPet_AfterClick
zButtonPetAdjustment = CreateFrame("Frame", "zButtonPetAdjustment")
zButtonPetAdjustment:RegisterEvent("UNIT_HEALTH")
zButtonPetAdjustment:RegisterEvent("UNIT_HAPPINESS")
zButtonPetAdjustment:RegisterEvent("UNIT_PET")
zButtonPetAdjustment:RegisterEvent("PET_BAR_UPDATE")
zButtonPetAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonPetAdjustment:RegisterEvent("SPELLS_CHANGED")
zButtonPetAdjustment:SetScript("OnEvent", zButtonPetAdjustment_OnEvent)
zButtonPet_Tooltip = CreateFrame("GameTooltip", "zButtonPet_Tooltip", nil, "GameTooltipTemplate")
zButtonPet_SetupSizeAndPosition()
zButtonPetAdjustment_OnEvent()
end
end
function zButtonPet_CreateButtons()
zButtonPet_EnsureConfig()
local saved = zButtonPet_GetSaved()
ZSpellButton_CreateChildren(zButtonPet, "zButtonPet", ZHUNTER_PET_MAX)
local info = {}
local infoIndex = 1
for i=1, table.getn(ZHunterMod_Pet_Spells) do
if not tonumber(saved["spells"][i]) then
info = ZHunterMod_Pet_Spells
saved["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
break
end
local spellIndex = saved["spells"][i]
if saved["visible"][spellIndex] ~= false then
info[infoIndex] = ZHunterMod_Pet_Spells[spellIndex]
infoIndex = infoIndex + 1
end
end
zButtonPet.found = ZSpellButton_SetButtons(zButtonPet, info)
zButtonPet_ApplyRuntimeSettings()
end
function zButtonPet_SetupSizeAndPosition()
local saved = zButtonPet_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonPet and zButtonPet.Hide then
zButtonPet:Hide()
end
return
end
local displayCount = zButtonPet.found or ZHUNTER_PET_MAX
if displayCount < 0 then
displayCount = 0
end
ZSpellButton_SetSize(zButtonPet, saved["parent"]["size"])
ZSpellButton_SetSize(zButtonPet, saved["children"]["size"], 1)
ZSpellButton_SetExpandDirection(zButtonPet, saved["firstbutton"])
ZSpellButton_ArrangeChildren(zButtonPet, saved["rows"],
displayCount, saved["horizontal"],
saved["vertical"])
end
function zButtonPet_Reset()
local currentRoot = zButtonPet_GetRoot()
currentRoot["zButtonPet"] = {}
local saved = zButtonPet_GetSaved()
saved["pet"] = {}
saved["pet"]["happiness"] = nil
saved["pet"]["status"] = nil
saved["pet"]["dead"] = nil
saved["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
saved["rows"] = 1
saved["horizontal"] = nil
saved["vertical"] = nil
saved["firstbutton"] = "RIGHT"
saved["enabled"] = 1
saved["tooltip"] = 1
saved["parent"] = {}
saved["parent"]["size"] = 36
saved["parent"]["hide"] = nil
saved["parent"]["circle"] = 1
saved["children"] = {}
saved["children"]["size"] = 36
saved["children"]["hideonclick"] = 1
saved["visible"] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
zButtonPet_EnsureConfig()
end
function IsPetDead()
local saved = zButtonPet_GetSaved()
return saved["pet"] and saved["pet"]["dead"]
end
local function zButtonPet_GetCorePetInfo()
if type(MTH_GetCurrentPetInfo) == "function" then
local info = MTH_GetCurrentPetInfo()
if type(info) == "table" then
return info
end
end
return nil
end
local function zButtonPet_RefreshSavedPetState(saved, corePetInfo)
local hasLivePet = false
if type(UnitExists) == "function" then
hasLivePet = UnitExists("pet") and true or false
elseif type(corePetInfo) == "table" and corePetInfo.liveExists ~= nil then
hasLivePet = corePetInfo.liveExists and true or false
end
if not hasLivePet then
saved["pet"]["status"] = nil
saved["pet"]["dead"] = nil
saved["pet"]["happiness"] = nil
return false
end
local currentHealth = (corePetInfo and tonumber(corePetInfo.health)) or (type(UnitHealth) == "function" and UnitHealth("pet")) or nil
local currentHealthMax = (corePetInfo and tonumber(corePetInfo.healthMax)) or (type(UnitHealthMax) == "function" and UnitHealthMax("pet")) or nil
local isDead = (corePetInfo and corePetInfo.dead) and true or false
if not isDead and type(UnitIsDead) == "function" then
isDead = UnitIsDead("pet") and true or false
end
if isDead then
saved["pet"]["dead"] = 1
else
saved["pet"]["dead"] = nil
end
local happiness = corePetInfo and corePetInfo.happiness or nil
if happiness == nil and type(GetPetHappiness) == "function" then
happiness = GetPetHappiness()
end
saved["pet"]["happiness"] = happiness
if isDead then
saved["pet"]["status"] = 1
elseif currentHealth and currentHealthMax and currentHealthMax > 0 then
if (currentHealth / currentHealthMax) > 0.75 then
saved["pet"]["status"] = 2
else
saved["pet"]["status"] = 1
end
else
saved["pet"]["status"] = 2
end
return true
end
local function zButtonPet_FindSpellIdByName(spellName)
if not spellName or spellName == "" then
return nil
end
local maxSpells = tonumber((_G and _G["MAX_SPELLS"]) or nil) or 1024
for i = 1, maxSpells do
local current = GetSpellName(i, "spell")
if not current then
break
end
if current == spellName then
return i
end
end
return nil
end
function zButtonPetAdjustment_BeforeClick()
if CursorHasItem() then
DropItemOnUnit("pet")
return 1
end
end
local function zButtonPet_RefreshParentSpell()
if not zButtonPet or not zButtonPet.count then
return
end
zButtonPet_EnsureConfig()
local saved = zButtonPet_GetSaved()
local corePetInfo = zButtonPet_GetCorePetInfo()
local hasCurrentPet = nil
local hasLivePet = nil
if type(corePetInfo) == "table" and corePetInfo.exists ~= nil then
hasCurrentPet = corePetInfo.exists and true or false
end
if type(corePetInfo) == "table" and corePetInfo.liveExists ~= nil then
hasLivePet = corePetInfo.liveExists and true or false
end
zButtonPet_RefreshSavedPetState(saved, corePetInfo)
local status, happiness, dead
local spells = {}
local name
local choice
for i=1, zButtonPet.count do
local button
button = getglobal(zButtonPet.name..i)
if button and button.id then
name = GetSpellName(button.id, "spell")
spells[name] = button
if not choice and (name == ZHUNTER_PET_DISMISS or name == ZHUNTER_PET_EYES or name == ZHUNTER_PET_POSITION) then
choice = button
end
end
end
status = saved["pet"]["status"]
happiness = saved["pet"]["happiness"]
dead = saved["pet"]["dead"]
local id = zButtonPet.id
name = nil
if hasCurrentPet == false and hasLivePet == false then
name = ZHUNTER_PET_TAMING
elseif not status then
name = ZHUNTER_PET_CALL
elseif dead then
name = ZHUNTER_PET_REVIVE
elseif status == 1 then
name = ZHUNTER_PET_MEND
elseif happiness ~= 3 then
name = ZHUNTER_PET_FEED
elseif choice then
id = choice.id
end
if name and spells[name] then
id = spells[name].id
elseif name then
local fallbackId = zButtonPet_FindSpellIdByName(name)
if fallbackId then
id = fallbackId
end
end
zButtonPet.id = id
ZSpellButton_UpdateButton(zButtonPet)
ZSpellButton_UpdateCooldown(zButtonPet)
if GameTooltip:IsOwned(zButtonPet) then
ZSpellButtonParent_OnEnter(zButtonPet)
end
end
function zButtonPet_AfterClick()
zButtonPet_RefreshParentSpell()
end
function zButtonPet_RefreshLiveState(_liveState, _source)
zButtonPet_RefreshParentSpell()
end
function zButtonPetAdjustment_OnEvent()
if not zButtonPet or not zButtonPet.count then
return
end
if (event == "UNIT_HEALTH" or event == "UNIT_HAPPINESS") and arg1 and arg1 ~= "pet" then
return
end
if event == "UNIT_PET" and arg1 and arg1 ~= "player" then
return
end
zButtonPet_RefreshParentSpell()
end
function zButtonPet_KeyBinding(index)
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
end
local button
if index then
button = getglobal("zButtonPet"..index)
else
button = zButtonPet
end
if button.id then
CastSpell(button.id, "spell")
if zButtonPet.hideonclick then
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(zButtonPet, false)
elseif zButtonPet.children then
zButtonPet.children:Hide()
end
end
end
end
function zButtonPet_FeedPet()
end
SLASH_zButtonPet1 = "/ZPet"
SlashCmdList["zButtonPet"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Pet button is disabled while module 'zhunter' is disabled.") then
return
end
if msg == "reset" then
zButtonPet_Reset()
zButtonPet:ClearAllPoints()
zButtonPet:SetPoint("CENTER", UIParent, "CENTER", 0, 60)
elseif msg == "options" then
MTH_OpenOptions("Pet")
else
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"")
end
end
+14
View File
@@ -0,0 +1,14 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Frame name="zButtonPetFrame">
</Frame>
<CheckButton name="zButtonPet" inherits="ZSpellButtonTemplate">
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" relativePoint="CENTER">
<Offset>
<AbsDimension x="0" y="60"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Ui>
+322
View File
@@ -0,0 +1,322 @@
local function zButtonToys_GetRoot()
return MTH_ZH_GetSavedRoot()
end
local root = zButtonToys_GetRoot()
if not root["zButtonToys"] then
root["zButtonToys"] = {}
root["zButtonToys"]["spells"] = {}
root["zButtonToys"]["rows"] = 1
root["zButtonToys"]["horizontal"] = nil
root["zButtonToys"]["vertical"] = nil
root["zButtonToys"]["firstbutton"] = "RIGHT"
root["zButtonToys"]["enabled"] = 0
root["zButtonToys"]["tooltip"] = 1
root["zButtonToys"]["parent"] = {}
root["zButtonToys"]["parent"]["size"] = 36
root["zButtonToys"]["parent"]["hide"] = nil
root["zButtonToys"]["parent"]["circle"] = 1
root["zButtonToys"]["children"] = {}
root["zButtonToys"]["children"]["size"] = 36
root["zButtonToys"]["children"]["hideonclick"] = 1
end
local ZHUNTER_TOYS_BUTTON_MAX = 80
local function zButtonToys_GetSaved()
local currentRoot = zButtonToys_GetRoot()
if not currentRoot["zButtonToys"] then
currentRoot["zButtonToys"] = {}
end
return currentRoot["zButtonToys"]
end
local function zButtonToys_EnsureConfig()
local saved = zButtonToys_GetSaved()
saved["count"] = nil
if saved["enabled"] == nil then
saved["enabled"] = 0
end
if saved["tooltip"] == nil then
saved["tooltip"] = 1
end
if not saved["children"] then
saved["children"] = {}
end
if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1
end
if not saved["spells"] then
saved["spells"] = {}
end
if not saved["parent"] then
saved["parent"] = {}
end
if not saved["children"] then
saved["children"] = {}
end
if not saved["parent"]["size"] then
saved["parent"]["size"] = 36
end
if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1
end
if not saved["children"]["size"] then
saved["children"]["size"] = 36
end
if not saved["rows"] or saved["rows"] < 1 then
saved["rows"] = 1
end
if not saved["firstbutton"] then
saved["firstbutton"] = "RIGHT"
end
end
local function zButtonToys_ApplyRuntimeSettings()
if not zButtonToys then
return
end
local saved = zButtonToys_GetSaved()
zButtonToys.tooltip = saved["tooltip"] and true or false
zButtonToys.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end
local function zButtonToys_NormalizeTabName(value)
local text = string.lower(tostring(value or ""))
text = string.gsub(text, "%s+", "")
text = string.gsub(text, "[^%a]", "")
while string.sub(text, 1, 1) == "z" and string.len(text) > 1 do
text = string.sub(text, 2)
end
return text
end
local function zButtonToys_FindTabBounds()
if type(GetNumSpellTabs) ~= "function" or type(GetSpellTabInfo) ~= "function" then
return nil, nil
end
local tabCount = GetNumSpellTabs() or 0
for tabIndex = 1, tabCount do
local tabName, _, tabOffset, tabEntries = GetSpellTabInfo(tabIndex)
local normalized = zButtonToys_NormalizeTabName(tabName)
if string.find(normalized, "toy", 1, true) then
return tonumber(tabOffset) or 0, tonumber(tabEntries) or 0
end
end
return nil, nil
end
local function zButtonToys_CollectTabSpellIds()
local tabOffset, tabEntries = zButtonToys_FindTabBounds()
if not tabOffset or not tabEntries or tabEntries <= 0 then
return {}
end
local spellIds = {}
local bookType = BOOKTYPE_SPELL or "spell"
local maxIndex = tabOffset + tabEntries
for spellIndex = tabOffset + 1, maxIndex do
local spellName = GetSpellName(spellIndex, bookType)
if spellName and spellName ~= "" then
table.insert(spellIds, spellIndex)
end
end
return spellIds
end
local function zButtonToys_ApplySpellIds(spellIds)
if not zButtonToys then
return 0
end
local parent = zButtonToys
local childCount = parent.count or ZHUNTER_TOYS_BUTTON_MAX
for i = 1, childCount do
local child = getglobal("zButtonToys" .. i)
if child then
child:Hide()
child.id = nil
child.icon = nil
child.isspell = nil
end
end
local found = 0
for i = 1, table.getn(spellIds) do
if found >= childCount then
break
end
local spellId = spellIds[i]
if spellId then
found = found + 1
local child = getglobal("zButtonToys" .. found)
if child then
child.id = spellId
child.isspell = 1
ZSpellButton_UpdateButton(child)
child:Show()
end
end
end
if found > 0 then
parent.id = spellIds[1]
parent.isspell = 1
ZSpellButton_UpdateButton(parent)
parent:Enable()
parent:Show()
else
parent.id = nil
parent:Hide()
end
return found
end
local function zButtonToys_RefreshSpells()
if not zButtonToys then
return 0
end
local saved = zButtonToys_GetSaved()
local spellIds = zButtonToys_CollectTabSpellIds()
local spellNames = {}
local bookType = BOOKTYPE_SPELL or "spell"
for i = 1, table.getn(spellIds) do
local n = GetSpellName(spellIds[i], bookType)
if n and n ~= "" then
table.insert(spellNames, n)
end
end
saved["spellIds"] = spellIds
saved["spells"] = spellNames
zButtonToys.spells = spellNames
zButtonToys.found = zButtonToys_ApplySpellIds(spellIds)
zButtonToys_ApplyRuntimeSettings()
return zButtonToys.found or 0
end
function zButtonToys_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
end
function zButtonToys_OnEvent()
if event == "VARIABLES_LOADED" then
if not zButtonToys then
return
end
if UnitClass("player") ~= ZHUNTER_HUNTER then
zButtonToys:UnregisterAllEvents()
zButtonToys:Hide()
return
end
zButtonToys_CreateButtons()
zButtonToysAdjustment = CreateFrame("Frame", "zButtonToysAdjustment")
zButtonToysAdjustment:RegisterEvent("SPELLS_CHANGED")
zButtonToysAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonToysAdjustment:SetScript("OnEvent", zButtonToysAdjustment_OnEvent)
zButtonToys_SetupSizeAndPosition()
end
end
function zButtonToys_CreateButtons()
zButtonToys_EnsureConfig()
if not zButtonToys._mthChildrenCreated then
ZSpellButton_CreateChildren(zButtonToys, "zButtonToys", ZHUNTER_TOYS_BUTTON_MAX)
zButtonToys._mthChildrenCreated = 1
end
zButtonToys_RefreshSpells()
end
function zButtonToys_SetupSizeAndPosition()
local saved = zButtonToys_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonToys and zButtonToys.Hide then
zButtonToys:Hide()
end
return
end
local displayCount = zButtonToys.found or 0
if displayCount < 0 then
displayCount = 0
end
ZSpellButton_SetSize(zButtonToys, saved["parent"]["size"])
ZSpellButton_SetSize(zButtonToys, saved["children"]["size"], 1)
ZSpellButton_SetExpandDirection(zButtonToys, saved["firstbutton"])
ZSpellButton_ArrangeChildren(zButtonToys, saved["rows"],
displayCount, saved["horizontal"],
saved["vertical"])
end
function zButtonToys_Reset()
local currentRoot = zButtonToys_GetRoot()
currentRoot["zButtonToys"] = {}
local saved = zButtonToys_GetSaved()
saved["spells"] = {}
saved["rows"] = 1
saved["horizontal"] = nil
saved["vertical"] = nil
saved["firstbutton"] = "RIGHT"
saved["enabled"] = 1
saved["tooltip"] = 1
saved["parent"] = {}
saved["parent"]["size"] = 36
saved["parent"]["hide"] = nil
saved["parent"]["circle"] = 1
saved["children"] = {}
saved["children"]["size"] = 36
saved["children"]["hideonclick"] = 1
zButtonToys_EnsureConfig()
end
function zButtonToysAdjustment_OnEvent()
if not zButtonToys then
return
end
zButtonToys_RefreshSpells()
zButtonToys_SetupSizeAndPosition()
if GameTooltip:IsOwned(zButtonToys) then
ZSpellButtonParent_OnEnter(zButtonToys)
end
end
function zButtonToys_KeyBinding(index)
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
end
local button
if index then
button = getglobal("zButtonToys"..index)
else
button = zButtonToys
end
if button and button.id then
CastSpell(button.id, "spell")
if zButtonToys.hideonclick then
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(zButtonToys, false)
elseif zButtonToys.children then
zButtonToys.children:Hide()
end
end
end
end
SLASH_zButtonToys1 = "/ZToys"
SlashCmdList["zButtonToys"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Toys button is disabled while module 'zhunter' is disabled.") then
return
end
if msg == "reset" then
zButtonToys_Reset()
zButtonToys:ClearAllPoints()
zButtonToys:SetPoint("TOP", UIParent, "TOP", 0, -518)
zButtonToys_RefreshSpells()
zButtonToys_SetupSizeAndPosition()
else
MTH_ZH_Print("Possible Commands: \"reset\"")
end
end
+14
View File
@@ -0,0 +1,14 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Frame name="zButtonToysFrame">
</Frame>
<CheckButton name="zButtonToys" inherits="ZSpellButtonTemplate">
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" relativePoint="CENTER">
<Offset>
<AbsDimension x="0" y="-240"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Ui>
+260
View File
@@ -0,0 +1,260 @@
local function zButtonTrack_GetRoot()
return MTH_ZH_GetSavedRoot()
end
local root = zButtonTrack_GetRoot()
if not root["zButtonTrack"] then
root["zButtonTrack"] = {}
root["zButtonTrack"]["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
root["zButtonTrack"]["rows"] = 1
root["zButtonTrack"]["horizontal"] = nil
root["zButtonTrack"]["vertical"] = nil
root["zButtonTrack"]["firstbutton"] = "RIGHT"
root["zButtonTrack"]["enabled"] = 1
root["zButtonTrack"]["tooltip"] = 1
root["zButtonTrack"]["parent"] = {}
root["zButtonTrack"]["parent"]["size"] = 36
root["zButtonTrack"]["parent"]["hide"] = nil
root["zButtonTrack"]["parent"]["circle"] = 1
root["zButtonTrack"]["children"] = {}
root["zButtonTrack"]["children"]["size"] = 36
root["zButtonTrack"]["children"]["hideonclick"] = 1
end
ZHunterMod_Track_Spells = {
ZHUNTER_TRACK_HIDDEN,
ZHUNTER_TRACK_HUMANOIDS,
ZHUNTER_TRACK_UNDEAD,
ZHUNTER_TRACK_BEASTS,
ZHUNTER_TRACK_DEMONS,
ZHUNTER_TRACK_ELEMENTALS,
ZHUNTER_TRACK_DRAGONKIN,
ZHUNTER_TRACK_GIANTS,
ZHUNTER_TRACK_MINERALS,
ZHUNTER_TRACK_HERBS,
ZHUNTER_TRACK_TREASURE
}
local ZHUNTER_TRACK_MAX = table.getn(ZHunterMod_Track_Spells)
local function zButtonTrack_GetSaved()
local currentRoot = zButtonTrack_GetRoot()
if not currentRoot["zButtonTrack"] then
currentRoot["zButtonTrack"] = {}
end
return currentRoot["zButtonTrack"]
end
local function zButtonTrack_EnsureConfig()
local saved = zButtonTrack_GetSaved()
saved["count"] = nil
if saved["rows"] == nil then
saved["rows"] = 1
end
if saved["firstbutton"] == nil then
saved["firstbutton"] = "RIGHT"
end
if saved["enabled"] == nil then
saved["enabled"] = 1
end
if saved["tooltip"] == nil then
saved["tooltip"] = 1
end
if not saved["parent"] then
saved["parent"] = {}
end
if saved["parent"]["size"] == nil then
saved["parent"]["size"] = 36
end
if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1
end
if not saved["children"] then
saved["children"] = {}
end
if saved["children"]["size"] == nil then
saved["children"]["size"] = 36
end
if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1
end
if not saved["spells"] then
saved["spells"] = {}
end
if not saved["visible"] then
saved["visible"] = {}
end
for i = 1, ZHUNTER_TRACK_MAX do
if not tonumber(saved["spells"][i]) then
saved["spells"][i] = i
end
if saved["visible"][i] == nil then
saved["visible"][i] = 1
end
end
end
local function zButtonTrack_ApplyRuntimeSettings()
if not zButtonTrack then
return
end
local saved = zButtonTrack_GetSaved()
zButtonTrack.tooltip = saved["tooltip"] and true or false
zButtonTrack.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end
function zButtonTrack_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
end
function zButtonTrack_OnEvent()
if event == "VARIABLES_LOADED" then
if not zButtonTrack then
return
end
if UnitClass("player") ~= ZHUNTER_HUNTER then
zButtonTrack:UnregisterAllEvents()
zButtonTrack:Hide()
return
end
zButtonTrack_CreateButtons()
zButtonTrackAdjustment = CreateFrame("Frame", "zButtonTrackAdjustment")
zButtonTrackAdjustment:RegisterEvent("PLAYER_AURAS_CHANGED")
zButtonTrackAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonTrackAdjustment:RegisterEvent("SPELLS_CHANGED")
zButtonTrackAdjustment:RegisterEvent("CHARACTER_POINTS_CHANGED")
zButtonTrackAdjustment:SetScript("OnEvent", zButtonTrackAdjustment_OnEvent)
zButtonTrack_SetupSizeAndPosition()
end
end
function zButtonTrack_CreateButtons()
zButtonTrack_EnsureConfig()
local saved = zButtonTrack_GetSaved()
ZSpellButton_CreateChildren(zButtonTrack, "zButtonTrack", ZHUNTER_TRACK_MAX)
local info = {}
local infoIndex = 1
for i=1, table.getn(ZHunterMod_Track_Spells) do
if not tonumber(saved["spells"][i]) then
info = ZHunterMod_Track_Spells
saved["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
break
end
local spellIndex = saved["spells"][i]
if saved["visible"][spellIndex] ~= false then
info[infoIndex] = ZHunterMod_Track_Spells[spellIndex]
infoIndex = infoIndex + 1
end
end
zButtonTrack.found = ZSpellButton_SetButtons(zButtonTrack, info)
zButtonTrack_ApplyRuntimeSettings()
end
function zButtonTrack_SetupSizeAndPosition()
zButtonTrack_EnsureConfig()
local saved = zButtonTrack_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonTrack and zButtonTrack.Hide then
zButtonTrack:Hide()
end
return
end
local displayCount = zButtonTrack.found or ZHUNTER_TRACK_MAX
if displayCount < 0 then
displayCount = 0
end
ZSpellButton_SetSize(zButtonTrack, saved["parent"]["size"])
ZSpellButton_SetSize(zButtonTrack, saved["children"]["size"], 1)
ZSpellButton_SetExpandDirection(zButtonTrack, saved["firstbutton"])
ZSpellButton_ArrangeChildren(zButtonTrack, saved["rows"],
displayCount, saved["horizontal"],
saved["vertical"])
end
function zButtonTrack_Reset()
local currentRoot = zButtonTrack_GetRoot()
currentRoot["zButtonTrack"] = {}
local saved = zButtonTrack_GetSaved()
saved["spells"] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
saved["rows"] = 1
saved["horizontal"] = nil
saved["vertical"] = nil
saved["firstbutton"] = "RIGHT"
saved["enabled"] = 1
saved["tooltip"] = 1
saved["parent"] = {}
saved["parent"]["size"] = 36
saved["parent"]["hide"] = nil
saved["parent"]["circle"] = 1
saved["children"] = {}
saved["children"]["size"] = 36
saved["children"]["hideonclick"] = 1
saved["visible"] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
zButtonTrack_EnsureConfig()
end
function zButtonTrackAdjustment_OnEvent()
if not zButtonTrack or not zButtonTrack.count then
return
end
if event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" then
zButtonTrack_CreateButtons()
zButtonTrack_SetupSizeAndPosition()
end
if event == "PLAYER_AURAS_CHANGED" or event == "PLAYER_ENTERING_WORLD"
or event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" then
local i = 1
local texture = zButtonTrack1IconTexture:GetTexture()
local buff = GetTrackingTexture()
if texture == buff and zButtonTrack2.id then
zButtonTrack.id = zButtonTrack2.id
else
zButtonTrack.id = zButtonTrack1.id
end
ZSpellButton_UpdateButton(zButtonTrack)
ZSpellButton_UpdateCooldown(zButtonTrack)
if GameTooltip:IsOwned(zButtonTrack) then
ZSpellButtonParent_OnEnter(zButtonTrack)
end
end
end
function zButtonTrack_KeyBinding(index)
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
end
local button
if index then
button = getglobal("zButtonTrack"..index)
else
button = zButtonTrack
end
if button.id then
CastSpell(button.id, "spell")
if zButtonTrack.hideonclick then
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(zButtonTrack, false)
elseif zButtonTrack.children then
zButtonTrack.children:Hide()
end
end
end
end
SLASH_zButtonTrack1 = "/ZTrack"
SlashCmdList["zButtonTrack"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Track button is disabled while module 'zhunter' is disabled.") then
return
end
if msg == "reset" then
zButtonTrack_Reset()
zButtonTrack:ClearAllPoints()
zButtonTrack:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
elseif msg == "options" then
MTH_OpenOptions("Track")
else
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"")
end
end
+14
View File
@@ -0,0 +1,14 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Frame name="zButtonTrackFrame">
</Frame>
<CheckButton name="zButtonTrack" inherits="ZSpellButtonTemplate">
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" relativePoint="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Ui>
+262
View File
@@ -0,0 +1,262 @@
local function zButtonTrap_GetRoot()
return MTH_ZH_GetSavedRoot()
end
local root = zButtonTrap_GetRoot()
if not root["zButtonTrap"] then
root["zButtonTrap"] = {}
root["zButtonTrap"]["spells"] = {1, 2, 3, 4}
root["zButtonTrap"]["rows"] = 1
root["zButtonTrap"]["horizontal"] = nil
root["zButtonTrap"]["vertical"] = nil
root["zButtonTrap"]["firstbutton"] = "RIGHT"
root["zButtonTrap"]["enabled"] = 1
root["zButtonTrap"]["tooltip"] = 1
root["zButtonTrap"]["parent"] = {}
root["zButtonTrap"]["parent"]["size"] = 36
root["zButtonTrap"]["parent"]["hide"] = nil
root["zButtonTrap"]["parent"]["circle"] = 1
root["zButtonTrap"]["children"] = {}
root["zButtonTrap"]["children"]["size"] = 36
root["zButtonTrap"]["children"]["hideonclick"] = 1
end
ZHunterMod_Trap_Spells = {
ZHUNTER_TRAP_FREEZING,
ZHUNTER_TRAP_FROST,
ZHUNTER_TRAP_IMMOLATION,
ZHUNTER_TRAP_EXPLOSIVE
}
local ZHUNTER_TRAP_MAX = table.getn(ZHunterMod_Trap_Spells)
local function zButtonTrap_GetSaved()
local currentRoot = zButtonTrap_GetRoot()
if not currentRoot["zButtonTrap"] then
currentRoot["zButtonTrap"] = {}
end
return currentRoot["zButtonTrap"]
end
local function zButtonTrap_EnsureConfig()
local saved = zButtonTrap_GetSaved()
saved["count"] = nil
if saved["rows"] == nil then
saved["rows"] = 1
end
if saved["firstbutton"] == nil then
saved["firstbutton"] = "RIGHT"
end
if saved["enabled"] == nil then
saved["enabled"] = 1
end
if saved["tooltip"] == nil then
saved["tooltip"] = 1
end
if not saved["parent"] then
saved["parent"] = {}
end
if saved["parent"]["size"] == nil then
saved["parent"]["size"] = 36
end
if saved["parent"]["circle"] == nil then
saved["parent"]["circle"] = 1
end
if not saved["children"] then
saved["children"] = {}
end
if saved["children"]["size"] == nil then
saved["children"]["size"] = 36
end
if saved["children"]["hideonclick"] == nil then
saved["children"]["hideonclick"] = 1
end
if not saved["spells"] then
saved["spells"] = {}
end
if not saved["visible"] then
saved["visible"] = {}
end
for i = 1, ZHUNTER_TRAP_MAX do
if not tonumber(saved["spells"][i]) then
saved["spells"][i] = i
end
if saved["visible"][i] == nil then
saved["visible"][i] = 1
end
end
end
local function zButtonTrap_ApplyRuntimeSettings()
if not zButtonTrap then
return
end
local saved = zButtonTrap_GetSaved()
zButtonTrap.tooltip = saved["tooltip"] and true or false
zButtonTrap.hideonclick = saved["children"] and saved["children"]["hideonclick"] and true or false
end
function zButtonTrap_OnLoad()
this:RegisterEvent("VARIABLES_LOADED")
end
function zButtonTrap_OnEvent()
if event == "VARIABLES_LOADED" then
if not zButtonTrap then
return
end
if UnitClass("player") ~= ZHUNTER_HUNTER then
zButtonTrap:UnregisterAllEvents()
zButtonTrap:Hide()
return
end
zButtonTrap_CreateButtons()
zButtonTrapAdjustment = CreateFrame("Frame", "zButtonTrapAdjustment")
zButtonTrapAdjustment:RegisterEvent("PLAYER_REGEN_ENABLED")
zButtonTrapAdjustment:RegisterEvent("PLAYER_REGEN_DISABLED")
zButtonTrapAdjustment:RegisterEvent("PLAYER_ENTERING_WORLD")
zButtonTrapAdjustment:RegisterEvent("SPELLS_CHANGED")
zButtonTrapAdjustment:RegisterEvent("CHARACTER_POINTS_CHANGED")
zButtonTrapAdjustment:SetScript("OnEvent", zButtonTrapAdjustment_OnEvent)
zButtonTrap_SetupSizeAndPosition()
end
end
function zButtonTrap_CreateButtons()
zButtonTrap_EnsureConfig()
local saved = zButtonTrap_GetSaved()
ZSpellButton_CreateChildren(zButtonTrap, "zButtonTrap", ZHUNTER_TRAP_MAX)
local info = {}
local infoIndex = 1
for i=1, table.getn(ZHunterMod_Trap_Spells) do
if not tonumber(saved["spells"][i]) then
info = ZHunterMod_Trap_Spells
saved["spells"] = {1, 2, 3, 4}
break
end
local spellIndex = saved["spells"][i]
if saved["visible"][spellIndex] ~= false then
info[infoIndex] = ZHunterMod_Trap_Spells[spellIndex]
infoIndex = infoIndex + 1
end
end
zButtonTrap.found = ZSpellButton_SetButtons(zButtonTrap, info)
zButtonTrap_ApplyRuntimeSettings()
end
function zButtonTrap_SetupSizeAndPosition()
zButtonTrap_EnsureConfig()
local saved = zButtonTrap_GetSaved()
if saved["enabled"] == false or saved["enabled"] == 0 then
if zButtonTrap and zButtonTrap.Hide then
zButtonTrap:Hide()
end
return
end
local displayCount = zButtonTrap.found or ZHUNTER_TRAP_MAX
if displayCount < 0 then
displayCount = 0
end
ZSpellButton_SetSize(zButtonTrap, saved["parent"]["size"])
ZSpellButton_SetSize(zButtonTrap, saved["children"]["size"], 1)
ZSpellButton_SetExpandDirection(zButtonTrap, saved["firstbutton"])
ZSpellButton_ArrangeChildren(zButtonTrap, saved["rows"],
displayCount, saved["horizontal"],
saved["vertical"])
end
function zButtonTrap_Reset()
local currentRoot = zButtonTrap_GetRoot()
currentRoot["zButtonTrap"] = {}
local saved = zButtonTrap_GetSaved()
saved["spells"] = {1, 2, 3, 4}
saved["rows"] = 1
saved["horizontal"] = nil
saved["vertical"] = nil
saved["firstbutton"] = "RIGHT"
saved["enabled"] = 1
saved["tooltip"] = 1
saved["parent"] = {}
saved["parent"]["size"] = 36
saved["parent"]["hide"] = nil
saved["parent"]["circle"] = 1
saved["children"] = {}
saved["children"]["size"] = 36
saved["children"]["hideonclick"] = 1
saved["visible"] = {1, 1, 1, 1}
zButtonTrap_EnsureConfig()
end
function zButtonTrapAdjustment_OnEvent()
if not zButtonTrap or not zButtonTrap.count then
return
end
if event == "SPELLS_CHANGED" or event == "CHARACTER_POINTS_CHANGED" then
zButtonTrap_CreateButtons()
zButtonTrap_SetupSizeAndPosition()
end
local nextbutton
local button
local combat = event == "PLAYER_REGEN_DISABLED"
for i=1, zButtonTrap.count do
button = getglobal(zButtonTrap.name..i)
button.customcolor = nil
if button.id then
if not nextbutton then
nextbutton = button
end
if combat then
button.icontexture:SetVertexColor(0.4, 0.4, 0.4)
button.customcolor = 1
else
button.icontexture:SetVertexColor(1.0, 1.0, 1.0)
end
end
end
zButtonTrap.id = nextbutton and nextbutton.id or zButtonTrap1.id
ZSpellButton_UpdateButton(zButtonTrap)
ZSpellButton_UpdateCooldown(zButtonTrap)
if GameTooltip:IsOwned(zButtonTrap) then
ZSpellButtonParent_OnEnter(zButtonTrap)
end
end
function zButtonTrap_KeyBinding(index)
if MTH_ZH_IsModuleEnabled and not MTH_ZH_IsModuleEnabled() then
return
end
local button
if index then
button = getglobal("zButtonTrap"..index)
else
button = zButtonTrap
end
if button.id then
CastSpell(button.id, "spell")
if zButtonTrap.hideonclick then
if type(ZSpellButton_SetChildrenExpanded) == "function" then
ZSpellButton_SetChildrenExpanded(zButtonTrap, false)
elseif zButtonTrap.children then
zButtonTrap.children:Hide()
end
end
end
end
SLASH_zButtonTrap1 = "/ZTrap"
SlashCmdList["zButtonTrap"] = function(msg)
if MTH_ZH_HandleDisabledSlash and MTH_ZH_HandleDisabledSlash("Trap button is disabled while module 'zhunter' is disabled.") then
return
end
if msg == "reset" then
zButtonTrap_Reset()
zButtonTrap:ClearAllPoints()
zButtonTrap:SetPoint("CENTER", UIParent, "CENTER", 60, 0)
elseif msg == "options" then
MTH_OpenOptions("Trap")
else
MTH_ZH_Print("Possible Commands: \"options\", \"reset\"")
end
end
+14
View File
@@ -0,0 +1,14 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Frame name="zButtonTrapFrame">
</Frame>
<CheckButton name="zButtonTrap" inherits="ZSpellButtonTemplate">
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" relativePoint="CENTER">
<Offset>
<AbsDimension x="60" y="0"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Ui>