WoWInterface SVN Livestock

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 137 to Rev 138
    Reverse comparison

Rev 137 → Rev 138

Livestock/Change Log.txt
1,3 → 1,7
Version 3.3.3
 
- Moved dragonriding mounts into their own menu.
 
Version 3.3.2
 
- Minor Druid logic updates.
Livestock/Livestock.toc
2,7 → 2,7
## Title: Livestock
## Notes: Enables easy random summoning of vanity pets and mounts, including the option of "smart mounting"
## Author: Kharthus - Deathwing(US)
## Version: 3.3.2
## Version: 3.3.3
## SavedVariablesPerCharacter: LivestockSettings
 
LibRecompense\RecompenseTools.lua
Livestock/Localizations/Localization-enUS.lua
14,6 → 14,7
L.LIVESTOCK_FONTSTRING_SHOWCRITTERSLABEL = "Critters"
L.LIVESTOCK_FONTSTRING_SHOWLANDLABEL = "Land"
L.LIVESTOCK_FONTSTRING_SHOWFLYINGLABEL = "Flying"
L.LIVESTOCK_FONTSTRING_SHOWDRAGONLABEL = "Dragon"
L.LIVESTOCK_FONTSTRING_SHOWWATERLABEL = "Water"
L.LIVESTOCK_FONTSTRING_SHOWSMARTLABEL = "Smart"
L.LIVESTOCK_FONTSTRING_MACROBUTTONSTITLE = "Please read the documentation before clicking these buttons!"
Livestock/Livestock.xml
85,6 → 85,26
</Scripts>
</ScrollFrame>
 
<ScrollFrame name="LivestockDragonMenuScrollFrameTemplate" inherits="FauxScrollFrameTemplate" virtual="true">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-30" y="8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnVerticalScroll>
FauxScrollFrame_OnVerticalScroll(self, offset, 15, Livestock.DragonMenuUpdate)
</OnVerticalScroll>
</Scripts>
</ScrollFrame>
 
<ScrollFrame name="LivestockWaterMenuScrollFrameTemplate" inherits="FauxScrollFrameTemplate" virtual="true">
<Anchors>
<Anchor point="TOPLEFT">
106,7 → 126,7
</ScrollFrame>
 
<Frame name="LivestockMenuFrame" parent="UIParent" inherits="LivestockBlueFrameTemplate" movable="true" enableMouse="true" frameStrata="TOOLTIP" hidden="true">
<Size x="580" y="40" />
<Size x="695" y="40" />
<Anchors>
<Anchor point="CENTER">
<Offset x="-150" y="250" />
155,7 → 175,7
</Scripts>
</Button>
 
<Button name="LivestockWaterMountMenuButton" inherits="GameMenuButtonTemplate">
<Button name="LivestockDragonMountMenuButton" inherits="GameMenuButtonTemplate">
<Size x="105" y="25"/>
<Anchors>
<Anchor point="LEFT" relativeTo="LivestockFlyingMountMenuButton" relativePoint="RIGHT">
164,6 → 184,20
</Anchors>
<Scripts>
<OnClick>
Livestock.HeaderButtonOnClick("Dragon")
</OnClick>
</Scripts>
</Button>
 
<Button name="LivestockWaterMountMenuButton" inherits="GameMenuButtonTemplate">
<Size x="105" y="25"/>
<Anchors>
<Anchor point="LEFT" relativeTo="LivestockDragonMountMenuButton" relativePoint="RIGHT">
<Offset x="10" y="0" />
</Anchor>
</Anchors>
<Scripts>
<OnClick>
Livestock.HeaderButtonOnClick("Water")
</OnClick>
</Scripts>
Livestock/Livestock.lua
54,7 → 54,7
nagrand = 1, -- Use Garrison Mounts in Nagrand zone
travelform = 0, -- enable / disable including Travel Forms in Smart Mount behavior (for druids only)
partyfave = 0, -- enable / disable using favorite pets / mounts in parties
version = 3.1, -- SL updates (separate enables for the three mount menus)
version = 3.1, -- SL updates (separate enables for the four mount menus)
}
 
LIVESTOCK_VERSION = GetAddOnMetadata("Livestock", "Version")
97,6 → 97,7
["LivestockCritterMenuButton"] = L.LIVESTOCK_FONTSTRING_SHOWCRITTERSLABEL,
["LivestockLandMountMenuButton"] = L.LIVESTOCK_FONTSTRING_SHOWLANDLABEL,
["LivestockFlyingMountMenuButton"] = L.LIVESTOCK_FONTSTRING_SHOWFLYINGLABEL,
["LivestockDragonMountMenuButton"] = L.LIVESTOCK_FONTSTRING_SHOWDRAGONLABEL,
["LivestockWaterMountMenuButton"] = L.LIVESTOCK_FONTSTRING_SHOWWATERLABEL,
["LivestockCritterMacroButton"] = L.LIVESTOCK_FONTSTRING_SHOWCRITTERSLABEL,
["LivestockLandMountMacroButton"] = L.LIVESTOCK_FONTSTRING_SHOWLANDLABEL,
169,11 → 170,12
local debug = false
local modelcounter, LivestockClass = 0
local mountfail, critterfail
local crittersText, landText, flyingText, waterText, mountstable, critterstable, temp = {}, {}, {}, {}, {}, {}, {} -- tables that will be reused
local crittersText, landText, flyingText, dragonText, 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
["CRITTER"] = {token = "Critter", text = crittersText, settings = LivestockSettings.Critters},
["LAND"] = {token = "Land", text = landText, settings = LivestockSettings.Mounts},
["FLYING"] = { token = "Flying", text = flyingText, settings = LivestockSettings.Mounts},
["DRAGON"] = { token = "Dragon", text = dragonText, settings = LivestockSettings.Mounts},
["WATER"] = { token = "Water", text = waterText, settings = LivestockSettings.Mounts},
}
local menuLength = 30
221,6 → 223,7
if LivestockSettings.Mounts[k].show == 1 then
LivestockSettings.Mounts[k].enableLand = 1
LivestockSettings.Mounts[k].enableFlying = 1
LivestockSettings.Mounts[k].enableDragon = 1
LivestockSettings.Mounts[k].enableWater = 1
 
local name2 = strconcat(k, "-")
231,10 → 234,14
elseif LivestockSettings.Mounts[k].show == 0 then
LivestockSettings.Mounts[k].enableLand = 0
LivestockSettings.Mounts[k].enableFlying = 0
LivestockSettings.Mounts[k].enableDragon = 0
LivestockSettings.Mounts[k].enableWater = 0
 
LivestockSettings.Mounts[k].show = nil
end
if LivestockSettings.Mounts[k].enableDragon == nil then
LivestockSettings.Mounts[k].enableDragon = 1
end
end
LivestockSettings.version = defaults.version
elseif LivestockSettings.version < defaults.version then
329,13 → 336,17
Livestock.BuildMenu("FLYING")
end
 
function Livestock.DragonMenuUpdate()
Livestock.BuildMenu("DRAGON")
end
 
function Livestock.WaterMenuUpdate()
Livestock.BuildMenu("WATER")
end
 
-- Menu creation:
 
function Livestock.BuildMenu(kind) -- type is a string, either "CRITTER", "LAND", "FLYING", or "WATER"
function Livestock.BuildMenu(kind) -- type is a string, either "CRITTER", "LAND", "FLYING", "DRAGON", or "WATER"
kind = string.upper(kind)
local token = buildtable[kind].token -- buildtable contains references and variables that are specific to each type of menu, indexed by the same string as the variable type
local settings, mounts, critters = LivestockSettings.Mounts
363,12 → 374,21
elseif kind == "FLYING" then -- code is the same for flying mounts with the appropriate changes; perhaps this could be a function call?
mounts = 0
for k in orderedPairs(settings) do
if (settings[k].type == "flying" or settings[k].type == "combo" or settings[k].type == "dragon") then
if (settings[k].type == "flying" or settings[k].type == "combo") then
mounts = mounts + 1
tinsert(mountstable, settings[k].index)
end
end
 
elseif kind == "DRAGON" then -- code is the same for dragon mounts with the appropriate changes; perhaps this could be a function call?
mounts = 0
for k in orderedPairs(settings) do
if (settings[k].type == "dragon") then
mounts = mounts + 1
tinsert(mountstable, settings[k].index)
end
end
 
elseif kind == "WATER" then -- code is the same for water mounts with the appropriate changes; perhaps this could be a function call?
mounts = 0
for k in orderedPairs(settings) do
390,6 → 410,8
header = "LivestockLandMountMenuButton"
elseif kind == "FLYING" then
header = "LivestockFlyingMountMenuButton"
elseif kind == "DRAGON" then
header = "LivestockDragonMountMenuButton"
elseif kind == "WATER" then
header = "LivestockWaterMountMenuButton"
end
427,7 → 449,7
index = critterstable[buttonplusoffset]
petID, _, _, _, _, _, _, name = C_PetJournal.GetPetInfoByIndex(index)
_, _, _, _, _, creatureID = C_PetJournal.GetPetInfoByPetID(petID)
elseif kind == "LAND" or kind == "FLYING" or kind == "WATER" then
elseif kind == "LAND" or kind == "FLYING" or kind == "DRAGON" or kind == "WATER" then
index = mountstable[buttonplusoffset]
name = C_MountJournal.GetMountInfoByID(index)
creatureID = C_MountJournal.GetMountInfoExtraByID(index)
462,6 → 484,7
if name and text and (kind == "CRITTER" and settings[name].show == 1) or
(kind == "LAND" and settings[name].enableLand == 1) or
(kind == "FLYING" and settings[name].enableFlying == 1) or
(kind == "DRAGON" and settings[name].enableDragon == 1) or
(kind == "WATER" and settings[name].enableWater == 1) then -- if the name isn't nil (Blizzard bug sometimes returns nil for companion names >:o) and the settings say this companion is selected then
if text.SetTextColor ~= nil then
text:SetTextColor(1, 1, 1) -- set the color of the text to be white
735,6 → 758,13
else
text:SetTextColor(0.4, 0.4, 0.4) -- color the fontstring according to the new setting
end
elseif companionType == "DRAGON" and name then
settings[name].enableDragon = 1 - settings[name].enableDragon -- toggle the shown setting
if settings[name].enableDragon == 1 then
text:SetTextColor(1, 1, 1)
else
text:SetTextColor(0.4, 0.4, 0.4) -- color the fontstring according to the new setting
end
elseif companionType == "WATER" and name then
settings[name].enableWater = 1 - settings[name].enableWater -- toggle the shown setting
if settings[name].enableWater == 1 then
756,6 → 786,9
if companionType == "FLYING" then
settings[k].enableFlying = 1
end
if companionType == "DRAGON" then
settings[k].enableDragon = 1
end
if companionType == "WATER" then
settings[k].enableWater = 1
end
776,6 → 809,9
if companionType == "FLYING" then
settings[k].enableFlying = 0
end
if companionType == "DRAGON" then
settings[k].enableDragon = 0
end
if companionType == "WATER" then
settings[k].enableWater = 0
end
1119,6 → 1155,7
LivestockSettings.Mounts[name] = { -- save the index and set the default show value to on
enableLand = 1,
enableFlying = 1,
enableDragon = 1,
enableWater = 1,
index = i,
spellID = spellID,
1127,6 → 1164,7
if LivestockSettings.newmount == 1 then
LivestockSettings.Mounts[name].enableLand = 0
LivestockSettings.Mounts[name].enableFlying = 0
LivestockSettings.Mounts[name].enableDragon = 0
LivestockSettings.Mounts[name].enableWater = 0
end
mountstable[name] = true
1918,7 → 1956,7
Livestock.RecycleTable(temp)
 
for k in pairs(LivestockSettings.Mounts) do -- go through the dragon mounts and add the ones that are selected to the temp table
if (LivestockSettings.Mounts[k].type == "dragon" and LivestockSettings.Mounts[k].enableFlying == 1) then
if (LivestockSettings.Mounts[k].type == "dragon" and LivestockSettings.Mounts[k].enableDragon == 1) then
local _, _, _, _, isUsable = C_MountJournal.GetMountInfoByID(LivestockSettings.Mounts[k].index)
if isUsable == true then
tinsert(temp, LivestockSettings.Mounts[k].index)
1936,7 → 1974,7
if (debug) then
local name = C_MountJournal.GetMountInfoByID(number)
local _, _, _, _, mountType = C_MountJournal.GetMountInfoExtraByID(number)
print(format("MOUNT: flying mount is '%s', index '%s', mountType '%s'", name, number, mountType))
print(format("MOUNT: dragonriding mount is '%s', index '%s', mountType '%s'", name, number, mountType))
end
 
C_MountJournal.SummonByID(number)
2160,11 → 2198,13
if cmd == "nomount" then
LivestockSettings.Mounts[spellName].enableLand = 0
LivestockSettings.Mounts[spellName].enableFlying = 0
LivestockSettings.Mounts[spellName].enableDragon = 0
LivestockSettings.Mounts[spellName].enableWater = 0
print(format(L.LIVESTOCK_INTERFACE_CONFIRMREMOVE, spellName))
else
LivestockSettings.Mounts[spellName].enableLand = 1
LivestockSettings.Mounts[spellName].enableFlying = 1
LivestockSettings.Mounts[spellName].enableDragon = 1
LivestockSettings.Mounts[spellName].enableWater = 1
print(format(L.LIVESTOCK_INTERFACE_CONFIRMADD, spellName))
end