/trunk
Dismount() |
return |
end |
--CallCompanion("MOUNT", MountRandomMount_SavedTable['ground'][(random(#MountRandomMount_SavedTable['ground']))][2]) |
CastSpellByName(GetSpellInfo(MountRandomMount_SavedTable['ground'][(random(#MountRandomMount_SavedTable['ground']))])) |
end |
} |
} |
local MRM_OptionsTable_Ground = {} |
--POPULATE GROUND MOUNTS OPTIONS |
function MountRandomMount:GroundFrame() |
local playerMountArray = {} |
local optionTable = {} |
local allmounts = {} |
local allMountsOrder = {} |
local mountcount = GetNumCompanions("MOUNT") |
local sources, mounts, k, v, i, j |
for i = 1, mountcount do |
local _, creatureName, creatureSpellID = GetCompanionInfo("MOUNT", i) |
playerMountArray[creatureSpellID] = creatureName |
end |
local sources, mounts, k, v, j |
j = 1 |
local allmounts = {} |
for sources, mounts in pairs(MountRandomMount_MountDataList["ground"]) do |
local optionTableMount = {} |
table.foreach(mounts, function(k,v) |
order = k, |
name = spellName, |
type = "toggle", |
disabled = function() |
if playerMountArray[v] == nil or not(IsUsableSpell(v)) then |
hidden = function() |
if playerMountArray[v] == nil then |
return true |
else |
return false |
return false |
end |
} |
allmounts[GetSpellInfo(v)] = optionTableMount[GetSpellInfo(v)] |
table.insert(allMountsOrder, spellName) |
allmounts[spellName] = optionTableMount[spellName] |
else |
print('The mount '..v..' does not exist') |
end |
} |
end |
end |
table.sort(allMountsOrder) |
j=1 |
table.foreach(allMountsOrder, function(k,v) |
allmounts[v].order = j |
j=j+1 |
end) |
optionTable['All'] = { |
name = L['All'], |
order = 0, |
} |
end |
local MRM_OptionsTable_Flying = {} |
--POPULATE FLYING MOUNTS OPTIONS |
function MountRandomMount:FlyingFrame() |
local playerMountArray = {} |
local optionTable = {} |
local mountcount = GetNumCompanions("MOUNT") |
local sources, mounts, k, v, i, j |
for i = 1, mountcount do |
local _, creatureName, creatureSpellID = GetCompanionInfo("MOUNT", i) |
playerMountArray[creatureSpellID] = creatureName |
end |
local allmounts = {} |
local allMountsOrder = {} |
local sources, mounts, k, v, j |
j = 1 |
for sources, mounts in pairs(MountRandomMount_MountDataList["flying"]) do |
local optionTableMount = {} |
order = k, |
name = spellName, |
type = "toggle", |
disabled = function() |
if playerMountArray[v] == nil or not(IsUsableSpell(v)) then |
hidden = function() |
if playerMountArray[v] == nil then |
return true |
else |
return false |
return false |
end |
} |
allmounts[GetSpellInfo(v)] = optionTableMount[GetSpellInfo(v)] |
table.insert(allMountsOrder, spellName) |
allmounts[spellName] = optionTableMount[spellName] |
else |
print('The mount '..v..' does not exist') |
end |
end |
end |
table.sort(allMountsOrder) |
j=1 |
table.foreach(allMountsOrder, function(k,v) |
allmounts[v].order = j |
j=j+1 |
end) |
optionTable['All'] = { |
name = L['All'], |
order = 0, |
end |
function MountRandomMount:PlayerMounts() |
_G['playerMountArray'] = {} |
local mountcount = GetNumCompanions("MOUNT") |
local i |
for i = 1, mountcount do |
local _, creatureName, creatureSpellID = GetCompanionInfo("MOUNT", i) |
playerMountArray[creatureSpellID] = creatureName |
end |
end |
function MountRandomMount:PLAYER_LOGIN() |
MountRandomMount:MountDataListFill() |
if(MountRandomMount_SavedTable['ground'] == nil)then |
MountRandomMount_SavedTable['flying'] = {} |
end |
MountRandomMount:PlayerMounts() |
AceConfig:RegisterOptionsTable("MountRandomMount", MRM_OptionsTable) |
AceConfig:RegisterOptionsTable("MountRandomMount_Ground", MountRandomMount:GroundFrame()) |
AceConfig:RegisterOptionsTable("MountRandomMount_Flying", MountRandomMount:FlyingFrame()) |