Skip to content

Commit

Permalink
Merge pull request #289 from Bestride/develop
Browse files Browse the repository at this point in the history
Fix Options panel for Cata
  • Loading branch information
DanSheps authored Nov 9, 2024
2 parents f238d23 + 6c298c4 commit 07d87ec
Show file tree
Hide file tree
Showing 17 changed files with 330 additions and 20 deletions.
2 changes: 1 addition & 1 deletion BeStride_Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Versions\Common\BeStride_Debug.lua

libs\embeds.xml

Versions\BeStride_Mainline.xml
Versions\BeStride_Cata.xml
36 changes: 36 additions & 0 deletions Versions/BeStride_Cata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Script file="Common\version.lua"/>
<Script file="..\localization\de-DE.lua"/>
<Script file="..\localization\en-US.lua"/>
<Script file="..\localization\zh-TW.lua"/>
<Script file="..\localization\ko-KR.lua"/>
<Script file="..\localization\fr-FR.lua"/>
<Script file="Common\BeStride_Constants.lua"/>
<Script file="..\BeStride.lua"/>
<Script file="Common\BeStride_Variables.lua"/>
<Script file="Common\BeStride_ActionButton.lua"/>
<Script file="Common\BeStride_Events.lua"/>
<Script file="Common\BeStride_Mount.lua"/>
<Script file="Common\functions.lua"/>
<Script file="Common\mapping.lua"/>
<Script file="Common\logic.class.lua"/>
<Script file="Common\logic.mounts.lua"/>
<Script file="Common\logic.player.lua"/>
<Script file="Common\logic.special.lua"/>
<Script file="Common\logic.zone.lua"/>
<Script file="Common\mount.lua"/>
<Script file="Common\mount.table.lua"/>
<Script file="Common\mounting.checks.lua"/>
<Script file="Common\mounting.class.lua"/>
<Script file="Common\mounting.player.lua"/>
<Script file="Common\mounting.special.lua"/>
<Script file="Common\mounting.zone.lua"/>
<Script file="Common\settings.lua"/>
<Script file="Common\options.lua"/>
<Script file="Cata\bestride.lua"/>
<Script file="Cata\MountTable.lua"/>
<Script file="Cata\logic.lua"/>
<Script file="Common\upgrade.lua"/>
<Script file="Common\bestride.lua"/>
<Script file="Common\opie.lua"/>
</Ui>
Empty file added Versions/Cata/Functions.lua
Empty file.
64 changes: 64 additions & 0 deletions Versions/Cata/MountTable.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
function BeStride:BuildMasterMountTable()
for key,value in pairs(C_MountJournal.GetMountIDs()) do
local name,spellID,icon,isActive,isUsable,sourceType,isFavorite,isFactionSpecific,faction,shouldHideOnChar,isCollected,mountID,isSteadyFlight = C_MountJournal.GetMountInfoByID(value)

if isCollected then
BeStride:AddNewMount(value)
end
end

for _,value in pairs(C_MountJournal.GetCollectedDragonridingMounts()) do
-- With dynamic flying, we can treat any 'dragonriding' mount as a flying mount
-- Note that some mounts can steady flight but NOT dynamic fly (ie. Otterworldy Ottuk)
mountTable["master"][value]["canFly"] = true
end
end



function BeStride:AddNewMount(mountId)
local name,spellID,icon,isActive,isUsable,sourceType,isFavorite,isFactionSpecific,faction,shouldHideOnChar,isCollected,mountID,isSteadyFlight = C_MountJournal.GetMountInfoByID(mountId)
local creatureDisplayInfoID,description,source,isSelfMount,mountTypeID,uiModelSceneID = C_MountJournal.GetMountInfoExtraByID(mountId)

if isFactionSpecific then
faction = faction
else
faction = nil
end

mountTable["master"][mountId] = {
["name"] = name,
["spellID"] = spellID,
["mountID"] = mountID,
["factionLocked"] = isFactionSpecific,
["faction"] = faction,
["description"] = description,
["isActive"] = isActive,
["isUsable"] = isUsable,
["isCollected"] = isCollected,
["icon"] = icon,
["source"] = source,
["sourceType"] = sourceType,
["isSteadyFlight"] = isSteadyFlight,
["type"] = BeStride_Constants.Mount.Types[mountTypeID],
["subtype"] = nil,
}

if BeStride_Constants.Mount.Mounts[spellID] then
mountOverrides = BeStride_Constants.Mount.Mounts[spellID]
if mountOverrides["subtype"] then
mountTable["master"][mountId]["subtype"] = mountOverrides["subtype"]
end
end

end

function BeStride:PrintAllMounts()
for key,value in pairs(C_MountJournal.GetMountIDs()) do
local name,spellID,icon,isActive,isUsable,sourceType,isFavorite,isFactionSpecific,faction,shouldHideOnChar,isCollected,mountID,isSteadyFlight = C_MountJournal.GetMountInfoByID(value)
local creatureDisplayInfoID,description,source,isSelfMount,mountTypeID,uiModelSceneID = C_MountJournal.GetMountInfoExtraByID(mountId)
if isCollected then
print("" + mountID + ":" + name + ":" + spellID + ":" + icon + ":" + isSummoned + ":" + mountTypeID+"")
end
end
end
106 changes: 106 additions & 0 deletions Versions/Cata/bestride.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@

function BeStride:Version_OnEnable()
end

function BeStride:IsClassicEra()
return false
end

function BeStride:IsWrath()
return false
end

function BeStride:IsCata()
return true
end

function BeStride:IsMainline()
return false
end

function BeStride:GetMountInfoBySpellID(id)
local mountID = C_MountJournal.GetMountFromSpell(id)
if mountID then
return self:GetMountInfoByMountID(mountID)
end
end

function BeStride:IsSpellUsable(spell)
if C_Spell.IsSpellUsable then
return C_Spell.IsSpellUsable(spell)
elseif C_Spell.IsUsableSpell then
return C_Spell.IsUsableSpell(spell)
elseif IsUsableSpell then
return IsUsableSpell(spell)
else
return false
end
end

function BeStride:GetSpellInfo(spell)
if C_Spell.GetSpellInfo then
local info = C_Spell.GetSpellInfo(spell)
if info and type(info) == "table" then
return { name = info.name, spellID = info.spellID }
else
local name,_,_,_,_,_,spellID = C_Spell.GetSpellInfo(spell)
return { name = name, spellID = spellID }
end
elseif GetSpellInfo then
local name,_,_,_,_,_,spellID = GetSpellInfo(spell)
return { name = name, spellID = spellID }
else
return nil
end
end

function BeStride:GetSpellOnCooldown(spell)
if C_Spell.GetSpellCooldown then
local info = C_Spell.GetSpellCooldown(spell)
if info and type(info) == "table" then
return info.duration ~= 0
else
local onCooldown, _, _, _ = GetSpellCooldown(195072)
return onCooldown ~= 0
end
elseif GetSpellCooldown then
local onCooldown, _, _, _ = GetSpellCooldown(195072)
return onCooldown ~= 0
else
return nil
end
end

function BeStride:GetMountInfoByMountID(id)
local creatureName,spellID,icon,active,isUsable,sourceType,isFavorite,isFactionSpecific,faction,hideOnChar,isCollected,mountID,isSteadyFlight = C_MountJournal.GetMountInfoByID(id)
return {
creatureName = creatureName,
spellID = spellID,
mountID = mountID,
icon = icon,
active = active,
isUsable = isUsable,
sourceType = sourceType,
isFavorite = isFavorite,
isFactionSpecific = isFactionSpecific,
faction = faction,
hideOnChar = hideOnChar,
isCollected = isCollected,
isSteadyFlight = isSteadyFlight
}
end

function BeStride:GetMountInfoByIndex(index)
return nil
end

function BeStride:GetKnownMountFromTarget()
for i=1,40,1 do
local info = C_UnitAuras.GetBuffDataByIndex("target", i)
if not info then return end
local mountId = C_MountJournal.GetMountFromSpell(info.spellId)
if mountId ~= nil then
return self:isMountUsable(mountId)
end
end
end
45 changes: 45 additions & 0 deletions Versions/Cata/logic.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
BeStride_Game = "Mainline"

local class = UnitClass("player")

function BeStride:isMountUsable(mount)
local name,spellID,icon,isActive,isUsable,sourceType,isFavorite,isFactionSpecific,faction,shouldHideOnChar,isCollected,mountID = C_MountJournal.GetMountInfoByID(mount)

return spellID,mountID,isUsable
end

function BeStride:isZoneMount(mountId)
spellId = mountTable.master[mountId].spellID
if mountTable.master[mountId].type == "zone" and BeStride_Constants.Mount.Mounts[spellId] ~= nil and BeStride_Constants.Mount.Mounts[spellId].zone ~= nil then
return true
elseif BeStride_Game == "Mainline" and mountTable.master[mountId].type == "zone" and BeStride_Constants.Mount.Mounts[mountId] ~= nil and BeStride_Constants.Mount.Mounts[mountId].zone ~= nil then
return true
end

return false
end

function BeStride:GetProfessions()
return GetProfessions()
end

function BeStride:GetRidingSkill()
local ridingSkillLevel = 0
local ridingSpells = {}


for spellID,skill in pairsByKeys(BeStride_Constants.Riding.Skill) do
if IsSpellKnown(spellID) and skill.level ~= nil and skill.level > ridingSkillLevel then
ridingSkillLevel = skill.level
ridingSpells[spellID] = true
elseif IsSpellKnown(spellID) and skill.level == nil then
ridingSpells[spellID] = true
end
end

return ridingSkillLevel,ridingSpells
end

function BeStride:CanWraithWalk()
return true
end
4 changes: 4 additions & 0 deletions Versions/Classic/bestride.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ function BeStride:IsWrath()
return false
end

function BeStride:IsCata()
return false
end

function BeStride:IsMainline()
return false
end
Expand Down
1 change: 1 addition & 0 deletions Versions/Common/BeStride_Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ BeStride_Constants = {
}
},
Types = {
[229] = "flying",
[230] = "ground",
[231] = "swimming",
[232] = "zone",
Expand Down
27 changes: 22 additions & 5 deletions Versions/Common/bestride.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,22 @@ function BeStride:ChatCommand(input)
elseif command == "spellID" then
mount = BeStride:GetMountInfoBySpellID(args)
print(mount.creatureName)
elseif command == "mount" then
BeStride:GetMountInfoByName(args)
elseif command == "mounts" then
LibStub("AceConfigDialog-3.0"):Open("BeStride-Mounts")
elseif command == "options" then
if self.IsMainline() then

Settings.OpenToCategory(self.configDialogs.options.id)
else
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.options.frame)
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.options.frame)
InterfaceOptionsFrame_OpenToCategory("BeStride")
end
elseif command == "profiles" then
if self.IsMainline() then
Settings.OpenToCategory(self.configDialogs.profiles.id)
else
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.profiles.frame)
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.profiles.frame)
InterfaceOptionsFrame_OpenToCategory("BeStride")
end
elseif command == "debug" or input == "bug" then
LibStub("AceConfigDialog-3.0"):Open("BeStride-Debug")
Expand Down Expand Up @@ -213,20 +214,36 @@ function BeStride:ChatCommand(input)
print("Classic")
elseif self:IsWrath() then
print("Wrath")
elseif self:IsCata() then
print("Cata")
elseif self:IsMainline() then
print("Mainline")
else
print("Other")
end
else
Settings.OpenToCategory(self.configDialogs.mounts.id)
if self.IsMainline() then
Settings.OpenToCategory(self.configDialogs.mounts.id)
else
InterfaceOptionsFrame_OpenToCategory("BeStride")
end
end
end

function BeStride:GetMountInfoByName(mount)
for key,value in pairs(C_MountJournal.GetMountIDs()) do
local name,spellID,icon,isActive,isUsable,sourceType,isFavorite,isFactionSpecific,faction,shouldHideOnChar,isCollected,mountID,isSteadyFlight = C_MountJournal.GetMountInfoByID(value)
if name == mount then
self:PrintMount(value)
end
end
end

function BeStride:PrintMount(mountId)
local name,spellID,icon,isActive,isUsable,sourceType,isFavorite,isFactionSpecific,faction,shouldHideOnChar,isCollected,mountID,isSteadyFlight = C_MountJournal.GetMountInfoByID(mountId)
local creatureDisplayInfoID,description,source,isSelfMount,mountTypeID,uiModelSceneID = C_MountJournal.GetMountInfoExtraByID(mountId)
print(name)
print(" mountId: " .. tostring(mountId))
print(" spellID: " .. tostring(spellID))
print(" icon: " .. tostring(icon))
print(" isActive: " .. tostring(isActive))
Expand Down
4 changes: 2 additions & 2 deletions Versions/Common/logic.special.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ function BeStride:IsRepairable()


for i = 0, 4 do
if self.IsMainline() then
if self.IsMainline() or self.IsCata() then
local bagSlots = C_Container.GetContainerNumSlots(i)
else
local bagSlots = GetContainerNumSlots(i)
end

for j = 0, bagSlots do
local current, maximum = 0, 0
if self.IsMainline() then
if self.IsMainline() or self.IsCata() then
local current, maximum = C_Container.GetContainerItemDurability(i, j)
else
local current, maximum = GetContainerItemDurability(i, j)
Expand Down
5 changes: 3 additions & 2 deletions Versions/Common/mount.table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ function BeStride:AddCommonMount(mountId)
--print("Adding Mount: " .. mount["name"] .. " Id: " .. mountId .. " Type: " .. mount["type"])
table.insert(mountTable["swimming"],mountId)
elseif mount.type and mount["type"] == "zone" then
--print("Adding Mount: " .. mount["name"] .. " Id: " .. mountId .. " Type: " .. mount["type"])
if mountId == 373 then
print("Adding Mount: " .. mount["name"] .. " Id: " .. mountId .. " Type: " .. mount["type"])
if mountTable.subtype == "swimming" then
print("Adding Mount: " .. mount["name"] .. " Id: " .. mountId .. " Type: swimming" )
table.insert(mountTable["swimming"],mountId)
end
table.insert(mountTable["zone"],mountId)
Expand Down
4 changes: 2 additions & 2 deletions Versions/Common/opie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local function addBeStrideRingToOpie()
"macrotext",
"/click BeStride_ABPassengerMount",
_u = "p", -- passenger
icon = BeStride:IsMainline() and "Interface/Icons/inv_misc_stonedragonorange" or
icon = (BeStride:IsMainline() or BeStride:IsCata()) and "Interface/Icons/inv_misc_stonedragonorange" or
"Interface/Icons/ability_mount_mammoth_black"
})
end
Expand All @@ -37,7 +37,7 @@ local function addBeStrideRingToOpie()
"macrotext",
"/click BeStride_ABGroundMount",
_u = "g", -- ground
icon = BeStride:IsMainline() and "Interface/Icons/misc_arrowdown" or
icon = (BeStride:IsMainline() or BeStride:IsCata()) and "Interface/Icons/misc_arrowdown" or
"Interface/Icons/ability_mount_dreadsteed"
})

Expand Down
Loading

0 comments on commit 07d87ec

Please sign in to comment.