/trunk/Livestock
mb8:SetText(LivestockLocalizations.LIVESTOCK_FONTSTRING_SHOWLANDLABEL) |
mb8:SetPoint("TOP", 0, -180) |
mb8:SetScript("OnClick", function() |
CreateMacro("LandMounts", "INV_Misc_QuestionMark", "/click LivestockLandMountsButton LeftButton", 1) |
CreateMacro("LandMounts", "INV_Misc_QuestionMark", "/click LivestockLandMountsButton LeftButton 1", 1) |
DEFAULT_CHAT_FRAME:AddMessage(LivestockLocalizations.LIVESTOCK_INTERFACE_LANDMACROCREATED) |
end) |
mb9:SetText(LivestockLocalizations.LIVESTOCK_FONTSTRING_SHOWFLYINGLABEL) |
mb9:SetPoint("TOP", 133, -180) |
mb9:SetScript("OnClick", function() |
CreateMacro("FlyingMounts", "INV_Misc_QuestionMark", "/click LivestockFlyingMountsButton LeftButton", 1) |
CreateMacro("FlyingMounts", "INV_Misc_QuestionMark", "/click LivestockFlyingMountsButton LeftButton 1", 1) |
DEFAULT_CHAT_FRAME:AddMessage(LivestockLocalizations.LIVESTOCK_INTERFACE_FLYINGMACROCREATED) |
end) |
mb10:SetText(LivestockLocalizations.LIVESTOCK_FONTSTRING_SHOWSMARTLABEL) |
mb10:SetPoint("TOP", 0, -210) |
mb10:SetScript("OnClick", function() |
CreateMacro("ComboMounts", "INV_Misc_QuestionMark", "/click LivestockComboButton LeftButton", 1) |
CreateMacro("ComboMounts", "INV_Misc_QuestionMark", "/click LivestockSmartButton LeftButton 1", 1) |
DEFAULT_CHAT_FRAME:AddMessage(LivestockLocalizations.LIVESTOCK_INTERFACE_SMARTMACROCREATED) |
end) |
</Anchors> |
<Attributes> |
<Attribute name="type" value="macro" /> |
<Attribute name="macrotext" value="/click LivestockComboButton LeftButton" /> |
<Attribute name="macrotext" value="/click LivestockComboButton LeftButton 1" /> |
</Attributes> |
<Layers> |
<Layer level="OVERLAY" > |
local eastereggtext, currentcritter, createdMaps |
local donotsummon = true |
local debug = false |
local modelcounter, class = 0 |
local modelcounter, LivestockClass = 0 |
local mountfail, critterfail |
local crittersText, landText, flyingText, waterText, mountstable, critterstable, temp = {}, {}, {}, {}, {}, {}, {} -- tables that will be reused |
local buildtable = { -- this table contains information that we will use for building and rebuilding menus as well as hiding menus |
-- if event == "PET_JOURNAL_LIST_UPDATE" or event == "COMPANION_LEARNED" or event == "PET_JOURNAL_PET_DELETED" or event == "UPDATE_SUMMONPETS_ACTION" then print(event) end |
if event == "PLAYER_LOGIN" then -- when the player logs in, make sure the map is set right for Smart Detection and sort out the companions |
class = select(2, UnitClass("player")) |
LivestockClass = select(2, UnitClass("player")) |
return |
elseif event == "COMPANION_LEARNED" or event == "PET_JOURNAL_PET_DELETED" or event == "UPDATE_SUMMONPETS_ACTION" then -- when a new companion is learned, sort out the companions again and then rebuild the three menus |
if debug then |
Livestock.ClickedAutoSummon() |
end |
if class ~= "DRUID" and class ~= "SHAMAN" and class ~= "HUNTER" and class ~= "PRIEST" and class ~= "ROGUE" and class ~= "MONK" then |
if LivestockClass ~= "DRUID" and LivestockClass ~= "SHAMAN" and LivestockClass ~= "HUNTER" and LivestockClass ~= "PRIEST" and LivestockClass ~= "ROGUE" and LivestockClass ~= "MONK" then |
LivestockSmartPreferencesFrameToggleCombatFormsText:SetTextColor(0.4, 0.4, 0.4) |
end |
if class ~= "DRUID" and class ~= "SHAMAN" then |
if LivestockClass ~= "DRUID" and LivestockClass ~= "SHAMAN" then |
LivestockSmartPreferencesFrameToggleMovingFormsText:SetTextColor(0.4, 0.4, 0.4) |
end |
if class ~= "DRUID" then -- Gray out the text for the druid-only options if the player isn't a druid. The disabling of the button is done in the buttons' OnLoad scripts. |
if LivestockClass ~= "DRUID" then -- Gray out the text for the druid-only options if the player isn't a druid. The disabling of the button is done in the buttons' OnLoad scripts. |
LivestockSmartPreferencesFrameDruidToggleText:SetTextColor(0.4, 0.4, 0.4) |
LivestockSmartPreferencesFrameSmartCatFormText:SetTextColor(0.4, 0.4, 0.4) |
LivestockSmartPreferencesFrameMoonkinText:SetTextColor(0.4, 0.4, 0.4) |
LivestockSmartPreferencesFrameTravelFormText:SetTextColor(0.4, 0.4, 0.4) |
end |
if class ~= "HUNTER" and class ~= "PRIEST" and class ~= "ROGUE" and class ~= "MONK" then |
if LivestockClass ~= "HUNTER" and LivestockClass ~= "PRIEST" and LivestockClass ~= "ROGUE" and LivestockClass ~= "MONK" then |
LivestockSmartPreferencesFrameIndoorSpeedText:SetTextColor(0.4, 0.4, 0.4) |
LivestockSmartPreferencesFrameMovingSpeedText:SetTextColor(0.4, 0.4, 0.4) |
end |
if class ~= "MAGE" and class ~= "PRIEST" then |
if LivestockClass ~= "MAGE" and LivestockClass ~= "PRIEST" then |
LivestockSmartPreferencesFrameSlowFallWhileFallingText:SetTextColor(0.4, 0.4, 0.4) |
end |
if class ~= "MONK" then |
if LivestockClass ~= "MONK" then |
LivestockSmartPreferencesFrameZenFlightText:SetTextColor(0.4, 0.4, 0.4) |
end |
local text = format(L.LIVESTOCK_FONTSTRING_WATERWALKINGLABEL, (class == "PRIEST" and L.LIVESTOCK_SPELL_LEVITATE) or (class == "DEATHKNIGHT" and L.LIVESTOCK_SPELL_PATHOFFROST) or L.LIVESTOCK_SPELL_WATERWALKING) |
local text = format(L.LIVESTOCK_FONTSTRING_WATERWALKINGLABEL, (LivestockClass == "PRIEST" and L.LIVESTOCK_SPELL_LEVITATE) or (LivestockClass == "DEATHKNIGHT" and L.LIVESTOCK_SPELL_PATHOFFROST) or L.LIVESTOCK_SPELL_WATERWALKING) |
LivestockSmartPreferencesFrameToggleWaterWalkingText:SetText(text) |
if class ~= "SHAMAN" and class ~= "DEATHKNIGHT" and class ~= "PRIEST" then |
if LivestockClass ~= "SHAMAN" and LivestockClass ~= "DEATHKNIGHT" and LivestockClass ~= "PRIEST" then |
LivestockSmartPreferencesFrameToggleWaterWalkingText:SetTextColor(0.4, 0.4, 0.4) |
end |
self:SetAttribute("catspell", L.LIVESTOCK_SPELL_CATFORM) |
self:SetAttribute("travelspell", L.LIVESTOCK_SPELL_TRAVELFORM) |
self:SetAttribute("wolfspell", L.LIVESTOCK_SPELL_GHOSTWOLF) |
self:SetAttribute("waterwalking", (class == "SHAMAN" and L.LIVESTOCK_SPELL_WATERWALKING) or (class == "PRIEST" and L.LIVESTOCK_SPELL_LEVITATE) or (class == "DEATHKNIGHT" and L.LIVESTOCK_SPELL_PATHOFFROST)) |
self:SetAttribute("waterwalking", (LivestockClass == "SHAMAN" and L.LIVESTOCK_SPELL_WATERWALKING) or (LivestockClass == "PRIEST" and L.LIVESTOCK_SPELL_LEVITATE) or (LivestockClass == "DEATHKNIGHT" and L.LIVESTOCK_SPELL_PATHOFFROST)) |
self:SetAttribute("aotc", L.LIVESTOCK_SPELL_CHEETAH) |
self:SetAttribute("waterwalkingtoggle", LivestockSettings.waterwalking) |
self:SetAttribute("combatformstoggle", LivestockSettings.combatforms) |
self:SetAttribute("type", nil) |
self:SetAttribute("spell", nil) |
if value == 1 then |
if class == "DRUID" then |
if LivestockClass == "DRUID" then |
if catform == 1 then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", catspell) |
end |
elseif class == "HUNTER" then |
elseif LivestockClass == "HUNTER" then |
if indoorspeed == 1 then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", aotc) |
end |
elseif class == "SHAMAN" then |
elseif LivestockClass == "SHAMAN" then |
if movingform == 1 then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", wolfspell) |
self:SetAttribute("mounttype", nil) |
elseif value == 3 then |
if combatformstoggle == 1 then |
if class == "DRUID" then |
if LivestockClass == "DRUID" then |
self:SetAttribute("type", "macro") |
self:SetAttribute("macrotext", "/cast !"..travelspell) |
elseif class == "SHAMAN" then |
elseif LivestockClass == "SHAMAN" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", wolfspell) |
elseif class == "HUNTER" then |
elseif LivestockClass == "HUNTER" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", aotc) |
elseif class == "PRIEST" then |
elseif LivestockClass == "PRIEST" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", shieldspell) |
elseif class == "MONK" then |
elseif LivestockClass == "MONK" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", rollspell) |
elseif class == "ROGUE" then |
elseif LivestockClass == "ROGUE" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", sprintspell) |
end |
elseif value == 4 or value == 5 then |
elseif value == 6 then |
if tonumber(waterwalkingtoggle) == 1 and (class == "SHAMAN" or class == "PRIEST" or class == "DEATHKNIGHT") then |
if tonumber(waterwalkingtoggle) == 1 and (LivestockClass == "SHAMAN" or LivestockClass == "PRIEST" or LivestockClass == "DEATHKNIGHT") then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", waterwalkingspell) |
self:SetAttribute("unit", "player") |
if IsFalling() and LivestockSettings.slowfall == 1 then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", (class == "PRIEST" and L.LIVESTOCK_SPELL_LEVITATE) or L.LIVESTOCK_SPELL_SLOWFALL) |
self:SetAttribute("spell", (LivestockClass == "PRIEST" and L.LIVESTOCK_SPELL_LEVITATE) or L.LIVESTOCK_SPELL_SLOWFALL) |
self:SetAttribute("unit", "player") |
return |
end |
if not InCombatLockdown() then |
if class == "SHAMAN" then -- Clear out Ghost Wolf from combat if it's there |
if LivestockClass == "SHAMAN" then -- Clear out Ghost Wolf from combat if it's there |
if not IsIndoors() and self:GetAttribute("spell") == L.LIVESTOCK_SPELL_GHOSTWOLF then |
self:SetAttribute("spell", nil) |
end |
elseif (class == "PRIEST" or class == "DEATHKNIGHT") and state ~= 6 then -- clear out any possible remnant of underwater spells if we're out of the water. No need to compare to the spell because these classes only ever have one spell in their Smart Button. |
elseif (LivestockClass == "PRIEST" or LivestockClass == "DEATHKNIGHT") and state ~= 6 then -- clear out any possible remnant of underwater spells if we're out of the water. No need to compare to the spell because these classes only ever have one spell in their Smart Button. |
if self:GetAttribute("spell") then |
self:SetAttribute("spell", nil) |
end |
elseif class == "HUNTER" then -- clear out Aspects if we're not inside |
elseif LivestockClass == "HUNTER" then -- clear out Aspects if we're not inside |
if not IsIndoors() and self:GetAttribute("spell") then |
self:SetAttribute("spell", nil) |
end |
if state == 1 then |
if LivestockSettings.indoorspeed == 1 then |
if class == "HUNTER" then |
if LivestockClass == "HUNTER" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_CHEETAH) |
self.mounttype = nil |
elseif class == "PRIEST" then |
elseif LivestockClass == "PRIEST" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_PWSHIELD) |
self.mounttype = nil |
elseif class == "MONK" then |
elseif LivestockClass == "MONK" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_ROLL) |
self.mounttype = nil |
elseif class == "ROGUE" then |
elseif LivestockClass == "ROGUE" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_SPRINT) |
self.mounttype = nil |
end |
elseif class == "SHAMAN" then |
elseif LivestockClass == "SHAMAN" then |
if LivestockSettings.movingform == 1 and GetUnitSpeed("player") ~= 0 then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_GHOSTWOLF) |
end |
elseif state == 2 then -- if mounted, clear out any mounted attributes and return, which will lead to a dismount (in the Click handler) and nothing in the PostClick. Druids go to flight form or travel form if they have it. |
self.mounttype = Livestock.LandOrFlying() |
if class == "DRUID" and not InCombatLockdown() then |
if LivestockClass == "DRUID" and not InCombatLockdown() then |
if Livestock.LandOrFlying() == "FLYING" and LivestockSettings.druidlogic == 1 or Livestock.LandOrFlying() == "LAND" and LivestockSettings.travelform == 1 then |
if GetSpellInfo(L.LIVESTOCK_SPELL_TRAVELFORM) then |
self:SetAttribute("type", "spell") |
self.mounttype = Livestock.LandOrFlying() |
if LivestockSettings.movingspeed == 1 and GetUnitSpeed("player") ~= 0 then |
if class == "HUNTER" then |
if LivestockClass == "HUNTER" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_CHEETAH) |
self.mounttype = nil |
elseif class == "PRIEST" then |
elseif LivestockClass == "PRIEST" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_PWSHIELD) |
self.mounttype = nil |
elseif class == "ROGUE" then |
elseif LivestockClass == "ROGUE" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_SPRINT) |
self.mounttype = nil |
end |
end |
if class == "MONK" then |
if LivestockClass == "MONK" then |
if LivestockSettings.zenflight == 1 and GetUnitSpeed("player") ~= 0 and self.mounttype == "FLYING" then |
if GetSpellInfo(L.LIVESTOCK_SPELL_ZENFLIGHT) then |
self:SetAttribute("type", "spell") |
self.mounttype = Livestock.LandOrFlying() |
if LivestockSettings.movingspeed == 1 and GetUnitSpeed("player") ~= 0 then |
if class == "HUNTER" then |
if LivestockClass == "HUNTER" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_CHEETAH) |
self.mounttype = nil |
elseif class == "PRIEST" then |
elseif LivestockClass == "PRIEST" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_PWSHIELD) |
self.mounttype = nil |
elseif class == "ROGUE" then |
elseif LivestockClass == "ROGUE" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_SPRINT) |
self.mounttype = nil |
end |
end |
if class == "MONK" then |
if LivestockClass == "MONK" then |
if LivestockSettings.zenflight == 1 and GetUnitSpeed("player") ~= 0 and self.mounttype == "FLYING" then |
if GetSpellInfo(L.LIVESTOCK_SPELL_ZENFLIGHT) then |
self:SetAttribute("type", "spell") |
Livestock.DismissCritter() |
end |
if class == "SHAMAN" then |
if LivestockClass == "SHAMAN" then |
if LivestockSettings.movingform == 1 and GetUnitSpeed("player") ~= 0 then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_GHOSTWOLF) |
end |
end |
if class == "DRUID" then |
if LivestockClass == "DRUID" then |
if LivestockSettings.movingform == 1 and GetUnitSpeed("player") ~= 0 or (LivestockSettings.druidlogic == 1 and self.mounttype == "FLYING") or (LivestockSettings.travelform == 1 and self.mounttype == "LAND") then |
if AuraUtil.FindAuraByName(L.LIVESTOCK_SPELL_TRAVELFORM, "player") and LivestockSettings.moonkin == 1 and GetSpellInfo(L.LIVESTOCK_SPELL_MOONKINFORM) then |
self:SetAttribute("type", "spell") |
self.mounttype = nil |
else |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", (class == "SHAMAN" and L.LIVESTOCK_SPELL_GHOSTWOLF) or GetSpellInfo(L.LIVESTOCK_SPELL_TRAVELFORM) or L.LIVESTOCK_SPELL_CATFORM) |
self:SetAttribute("spell", (LivestockClass == "SHAMAN" and L.LIVESTOCK_SPELL_GHOSTWOLF) or GetSpellInfo(L.LIVESTOCK_SPELL_TRAVELFORM) or L.LIVESTOCK_SPELL_CATFORM) |
self.mounttype = nil |
self.clearmovingform = true |
end |
elseif LivestockSettings.movingspeed == 1 and GetUnitSpeed("player") ~= 0 then |
if class == "HUNTER" then |
if LivestockClass == "HUNTER" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_CHEETAH) |
self.mounttype = nil |
elseif class == "PRIEST" then |
elseif LivestockClass == "PRIEST" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_PWSHIELD) |
self.mounttype = nil |
elseif class == "MONK" then |
elseif LivestockClass == "MONK" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_ROLL) |
self.mounttype = nil |
elseif class == "ROGUE" then |
elseif LivestockClass == "ROGUE" then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_SPRINT) |
self.mounttype = nil |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_RUNNINGWILD) |
self.mounttype = nil |
elseif class == "DRUID" then |
elseif LivestockClass == "DRUID" then |
if AuraUtil.FindAuraByName(L.LIVESTOCK_SPELL_MOONKINFORM, "player") then |
else |
self:SetAttribute("type", "macro") |
return |
elseif state == 6 then -- swimming |
if class == "DRUID" and GetUnitSpeed("player") ~= 0 and GetSpellInfo(L.LIVESTOCK_SPELL_TRAVELFORM) then |
if LivestockClass == "DRUID" and GetUnitSpeed("player") ~= 0 and GetSpellInfo(L.LIVESTOCK_SPELL_TRAVELFORM) then |
self:SetAttribute("type", "spell") |
self:SetAttribute("spell", L.LIVESTOCK_SPELL_TRAVELFORM) |
self.mounttype = nil |
end |
elseif state == 7 then -- flying |
self.mounttype = "FLYING" |
if class == "DRUID" and not InCombatLockdown() and LivestockSettings.safeflying == 0 then |
if LivestockClass == "DRUID" and not InCombatLockdown() and LivestockSettings.safeflying == 0 then |
self.mounttype = nil |
local spellName = AuraUtil.FindAuraByName(L.LIVESTOCK_SPELL_TRAVELFORM, "player") |
if LivestockSettings.moonkin == 1 and spellName and GetSpellInfo(L.LIVESTOCK_SPELL_MOONKINFORM) then |
self.typeofmount = "land" |
end |
if class == "SHAMAN" then |
if LivestockClass == "SHAMAN" then |
local name = AuraUtil.FindAuraByName(L.LIVESTOCK_SPELL_GHOSTWOLF, "player") |
if name then -- name will be the name of the form at this point |
self:SetAttribute("type", "spell") |
end |
end |
if class == "DRUID" then -- see if we need to cancel a form to summon a mount. |
if LivestockClass == "DRUID" then -- see if we need to cancel a form to summon a mount. |
if AuraUtil.FindAuraByName(L.LIVESTOCK_SPELL_BEARFORM, "player") or |
AuraUtil.FindAuraByName(L.LIVESTOCK_SPELL_CATFORM, "player") or |
AuraUtil.FindAuraByName(L.LIVESTOCK_SPELL_TRAVELFORM, "player") or |
Version 3.2.5 |
- Updates for patch 10.0.2 |
Version 3.2.4 |
- Another fix for dismounting issues |
## Interface: 100000 |
## Interface: 100002 |
## Title: Livestock |
## Notes: Enables easy random summoning of vanity pets and mounts, including the option of "smart mounting" |
## Author: Kharthus - Deathwing(US) |
## Version: 3.2.4 |
## Version: 3.2.5 |
## SavedVariablesPerCharacter: LivestockSettings |
LibRecompense\RecompenseTools.lua |