Skip to content

Commit

Permalink
Merge pull request #232 from Bestride/develop
Browse files Browse the repository at this point in the history
Add helpers for checking mount status
  • Loading branch information
DanSheps committed Dec 2, 2022
2 parents 24d5286 + 111e213 commit dc2042a
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 19 deletions.
12 changes: 12 additions & 0 deletions Versions/Classic/bestride.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ end
function BeStride:IsMainline()
return false
end

function BeStride:GetMountInfoBySpellID()
return nil
end

function BeStride:GetMountInfoByMountID()
return nil
end

function BeStride:GetMountInfoByIndex()
return nil
end
35 changes: 21 additions & 14 deletions Versions/Common/bestride.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,56 +107,63 @@ function BeStride:SetKeyBindingsOverrides(button)
end

function BeStride:ChatCommand(input)
if input == "help" then
local command,args = strsplit(" ", input, 2)
if command == "help" then
print("/br - Open Main Configuration Dialog")
print("/br about - Open about Dialog")
print("/br help - This help")
print("/br reload - Rebuild the mount table")
print("/br map - Print the current map layers")
elseif input == "locale" then
elseif command == "locale" then
local L = LibStub("AceLocale-3.0"):GetLocale("BeStride")
print(L["Open.GUI"])
elseif input == "speed" then
elseif command == "speed" then
print(BeStride:SpeedCheck())
elseif input == "mountdb" then
elseif command == "mountdb" then
self:ListMountDB()
elseif input == "mountsTable" then
elseif command == "mountsTable" then
self:ListGameMounts()
elseif input == "reload" then
elseif command == "reload" then
BeStride:buildMountTables()
elseif input == "map" then
elseif command == "map" then
local locID = C_Map.GetBestMapForUnit("player")
print("mapID:name:mapType:parentMapID")
local map = self:GetMapUntil(locID,0,true)
print("Final: ")
print(map.mapID .. ":" .. map.name .. ":" .. map.mapType .. ":" .. map.parentMapID)
elseif input == "maplast" then
elseif command == "maplast" then
local locID = C_Map.GetBestMapForUnit("player")
print("mapID:name:mapType:parentMapID")
local map = self:GetMapUntilLast(locID,0,true)
print("Final: ")
print(map.mapID .. ":" .. map.name .. ":" .. map.mapType .. ":" .. map.parentMapID)
elseif input == "underwater" then
elseif command == "underwater" then
BeStride:IsUnderwater()
elseif input == "mounts" then
elseif command == "mountID" then
mount = BeStride:GetMountInfoByMountID(args)
print(mount.creatureName)
elseif command == "spellID" then
mount = BeStride:GetMountInfoBySpellID(args)
print(mount.creatureName)
elseif command == "mounts" then
LibStub("AceConfigDialog-3.0"):Open("BeStride-Mounts")
elseif input == "options" then
elseif command == "options" then
if self.IsMainline() then
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.configuration.frame)
else
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.options.frame)
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.options.frame)
end
elseif input == "profiles" then
elseif command == "profiles" then
if self.IsMainline() then
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.configuration.frame)
else
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.profiles.frame)
InterfaceOptionsFrame_OpenToCategory(self.configDialogs.profiles.frame)
end
elseif input == "debug" or input == "bug" then
elseif command == "debug" or input == "bug" then
LibStub("AceConfigDialog-3.0"):Open("BeStride-Debug")
elseif input == "about" then
elseif command == "about" then
LibStub("AceConfigDialog-3.0"):Open("BeStride")
else
print("/br - Open Main Configuration Dialog and print help")
Expand Down
11 changes: 7 additions & 4 deletions Versions/Common/mount.table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,26 @@ function BeStride:AddCommonMount(mountId)
table.insert(mountTable["swimming"],mountId)
end
else
if mount["type"] == "ground" then
if mount.type and mount["type"] == "ground" then
--print("Adding Mount: " .. mount["name"] .. " Id: " .. mountId .. " Type: " .. mount["type"])
table.insert(mountTable["ground"],mountId)
elseif mount["type"] == "flying" then
elseif mount.type and mount["type"] == "flying" then
--print("Adding Mount: " .. mount["name"] .. " Id: " .. mountId .. " Type: " .. mount["type"])
table.insert(mountTable["flying"],mountId)
elseif mount["type"] == "swimming" then
elseif mount.type and mount["type"] == "swimming" then
--print("Adding Mount: " .. mount["name"] .. " Id: " .. mountId .. " Type: " .. mount["type"])
table.insert(mountTable["swimming"],mountId)
elseif mount["type"] == "dragonriding" then
--print("Adding Mount: " .. mount["name"] .. " Id: " .. mountId .. " Type: " .. mount["type"])
table.insert(mountTable["dragonriding"],mountId)
elseif mount["type"] == "zone" then
elseif mount.type and mount["type"] == "zone" then
--print("Adding Mount: " .. mount["name"] .. " Id: " .. mountId .. " Type: " .. mount["type"])
if mountId == 373 then
table.insert(mountTable["swimming"],mountId)
end
table.insert(mountTable["zone"],mountId)
else
print("Not Adding Mount")
end
end
end
Expand Down
30 changes: 30 additions & 0 deletions Versions/Mainline/bestride.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,34 @@ end

function BeStride:IsMainline()
return true
end

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

function BeStride:GetMountInfoByMountID(id)
local creatureName,spellID,icon,active,isUsable,sourceType,isFavorite,isFactionSpecific,faction,hideOnChar,isCollected,mountID,isForDragonriding = 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,
isForDragonriding = isForDragonriding
}
end

function BeStride:GetMountInfoByIndex(index)
return nil
end
37 changes: 37 additions & 0 deletions Versions/Wrath/bestride.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,40 @@ end
function BeStride:IsMainline()
return false
end

function BeStride:GetMountInfoBySpellID(id)
for i=1, GetNumCompanions("MOUNT") do
mount = self:GetMountInfoByIndex(i)
if mount.spellID == id then
return mount
end
end
end

function BeStride:GetMountInfoByMountID(id)
for i=1, GetNumCompanions("MOUNT") do
mount = self:GetMountInfoByIndex(i)
if mount.mountID == id then
return mount
end
end
end

function BeStride:GetMountInfoByIndex(index)
local mountID,creatureName,spellID,icon,isSummoned = GetCompanionInfo("MOUNT", index)
return {
creatureName = creatureName,
spellID = spellID,
mountID = mountID,
icon = icon,
active = nil,
isUsable = nil,
sourceType = nil,
isFavorite = nil,
isFactionSpecific = nil,
faction = nil,
hideOnChar = nil,
isCollected = true,
isForDragonriding = nil
}
end
2 changes: 1 addition & 1 deletion localization/ko-KR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ L["GUI.TAB.Profiles"] = "프로필"
L["GUI.TAB.About"] = "정보"
L["GUI.TAB.Mounts.Ground"] = "지상"
L["GUI.TAB.Mounts.Flying"] = "비행"
L["GUI.TAB.Mounts.Dragonriding"] = "드래곤라이딩",
L["GUI.TAB.Mounts.Dragonriding"] = "드래곤라이딩"
L["GUI.TAB.Mounts.Repair"] = "수리"
L["GUI.TAB.Mounts.Swimming"] = "수영"
L["GUI.TAB.Mounts.Passenger"] = "다인승"
Expand Down

0 comments on commit dc2042a

Please sign in to comment.