/trunk
local fly = MountRandomMount:Flying(false) |
if fly then |
if MountRandomMount_SavedTable['flying'] == nil or #MountRandomMount_SavedTable['flying'] == 0 then |
if MountRandomMount_SavedTable['ground'] == nil or #MountRandomMount_SavedTable['ground'] == 0 then |
if (MountRandomMount_SavedTable['flying'] == nil) or (#MountRandomMount_SavedTable['flying'] == 0) then |
if (MountRandomMount_SavedTable['ground'] == nil) or (#MountRandomMount_SavedTable['ground'] == 0) then |
print(L['MRMNoMounts']) |
return |
else |
local zones = {GetMapZones(continent)} |
local zone = GetCurrentMapZone() |
if continent == 2 and ( zones[zone] == L['MRMKelp'] or zones[zone] == L['MRMShimExp'] or zones[zone] == L['MRMAbysDepth']) then |
if MountRandomMount_SeaHorseHave then |
local SeaTurtleName = GetSpellInfo(MountRandomMount_SeaHorseID) |
local swimmount = MountRandomMount:SwimmingMount(true) |
if (swimmount) then |
local SeaTurtleName = GetSpellInfo(MountRandomMount_SeaTurtleIRealID) |
CastSpellByName(SeaTurtleName) |
return |
else |
print("You don't have a swimming mount, calling random land mount.") |
if MountRandomMount_SavedTable['ground'] == nil or #MountRandomMount_SavedTable['ground'] == 0 then |
if (MountRandomMount_SavedTable['ground'] == nil) or (#MountRandomMount_SavedTable['ground'] == 0) then |
print(L['MRMNoMounts']) |
return |
else |
end |
end |
else |
if MountRandomMount_SeaTurtleHave then |
local SeaTurtleName = GetSpellInfo(MountRandomMount_SeaTurtleID) |
local swimmount = MountRandomMount:SwimmingMount(false) |
if (swimmount) then |
local SeaTurtleName = GetSpellInfo(MountRandomMount_SeaTurtleIRealID) |
CastSpellByName(SeaTurtleName) |
return |
else |
print("You don't have a swimming mount, calling random land mount.") |
if MountRandomMount_SavedTable['ground'] == nil or #MountRandomMount_SavedTable['ground'] == 0 then |
if (MountRandomMount_SavedTable['ground'] == nil) or (#MountRandomMount_SavedTable['ground'] == 0) then |
print(L['MRMNoMounts']) |
return |
else |
end |
function MountRandomMount:SwimmingMount(vash) |
local _, creatureSpellID |
if vash then |
MountRandomMount_SeaTurtleIHave = false |
local mountcount = GetNumCompanions("MOUNT") |
for i = 1, mountcount do |
_, _, creatureSpellID = GetCompanionInfo("MOUNT", i) |
if(creatureSpellID == 75207) then |
MountRandomMount_SeaTurtleIHave = true |
MountRandomMount_SeaTurtleID = i |
MountRandomMount_SeaTurtleIRealID = 75207 |
break |
end |
end |
if not MountRandomMount_SeaTurtleIHave then |
local mountcount = GetNumCompanions("MOUNT") |
for i = 1, mountcount do |
_, _, creatureSpellID = GetCompanionInfo("MOUNT", i) |
if(creatureSpellID == 64731) then |
MountRandomMount_SeaTurtleIHave = true |
MountRandomMount_SeaTurtleID = i |
MountRandomMount_SeaTurtleIRealID = 64731 |
break |
end |
end |
end |
return MountRandomMount_SeaTurtleIHave |
else |
MountRandomMount_SeaTurtleIHave = false |
local mountcount = GetNumCompanions("MOUNT") |
for i = 1, mountcount do |
_, _, creatureSpellID = GetCompanionInfo("MOUNT", i) |
if(creatureSpellID == 98718) then |
MountRandomMount_SeaTurtleIHave = true |
MountRandomMount_SeaTurtleID = i |
MountRandomMount_SeaTurtleIRealID = 98718 |
break |
end |
end |
if not MountRandomMount_SeaTurtleIHave then |
for i = 1, mountcount do |
_, _, creatureSpellID = GetCompanionInfo("MOUNT", i) |
if(creatureSpellID == 64731) then |
MountRandomMount_SeaTurtleIHave = true |
MountRandomMount_SeaTurtleID = i |
MountRandomMount_SeaTurtleIRealID = 64731 |
break |
end |
end |
end |
return MountRandomMount_SeaTurtleIHave |
end |
end |
function MountRandomMount:Flying(druid) |
if druid then |
if GetShapeshiftFormID() == 27 then |
end |
function MountRandomMount:LandOnly() |
if MountRandomMount_SavedTable == nil or MountRandomMount_SavedTable['ground'] == nil or #MountRandomMount_SavedTable['ground'] == 0 then |
if (MountRandomMount_SavedTable.randommountlist == nil) or ( (MountRandomMount_SavedTable['ground'] == nil)) or ((#MountRandomMount_SavedTable['ground'] == 0)) then |
print(L['MRMNoMounts']) |
return |
end |
end |
local localizedClass, englishClass = UnitClass("player") |
local localizedRace, raceEn = UnitRace("player") |
if localizedClass == L['MRMShaman'] or localizedClass == L['MRMShamanF'] then |
local name2 = GetSpellInfo(2645) |
local name = GetSpellInfo(name2) |
if name ~= nil then |
if ((localizedClass == L['MRMShaman']) or (localizedClass == L['MRMShamanF'])) then |
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(2645) |
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
print(L['MRMGhostWolf']) |
end |
elseif localizedClass == L['MRMDruid'] then |
elseif (localizedClass == L['MRMDruid']) then |
local isInstance, instanceType = IsInInstance() |
local inside = IsIndoors() |
if IsSwimming() then |
local name2 = GetSpellInfo(1066)--Aquatic Form |
local name = GetSpellInfo(name2) |
if name ~= nil then |
if(IsSwimming()) then |
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(1066) |
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
print(L['MRMAcquaForm']) |
end |
elseif (inside ~= nil or isInstance ~= nil) and MountRandomMount_SavedTable.MRMDruid_CatInside == true then |
local name2 = GetSpellInfo(768)--Cat Form |
local name = GetSpellInfo(name2) |
if name ~= nil then |
elseif ((inside ~= nil) or (isInstance ~= nil)) and (MountRandomMount_SavedTable.MRMDruid_CatInside == true) then |
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(768) |
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
print(L['MRMCatForm']) |
end |
elseif not IsFlyableArea() then |
if localizedRace == L['MRMWorgen'] then |
local name2 = GetSpellInfo(87840)--Running Wild |
local name = GetSpellInfo(name2) |
if name ~= nil then |
elseif( not IsFlyableArea()) then |
if (localizedRace == L['MRMWorgen']) then |
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(87840) |
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
print(L['MRMRunningWild']) |
end |
else |
local name2 = GetSpellInfo(783)--Travel Form |
local name = GetSpellInfo(name2) |
if name ~= nil then |
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(783) |
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
print(L['MRMTravelForm']) |
else |
local fly = MountRandomMount:Flying(true) |
if fly then |
local name2 = GetSpellInfo(40120)--Swift Flight Form |
local name = GetSpellInfo(name2) |
if name ~= nil then |
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(40120) |
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
name2 = GetSpellInfo(33943)--Flight Form |
name = GetSpellInfo(name2) |
if name ~= nil then |
name2, _, _, _, _, _, _, _, _ = GetSpellInfo(33943) |
name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
name2 = GetSpellInfo(783)--Travel Form |
name = GetSpellInfo(name2) |
if name ~= nil then |
name2, _, _, _, _, _, _, _, _ = GetSpellInfo(783) |
name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
print(MRMFlighForm) |
end |
end |
else |
if localizedRace == L['MRMWorgen'] then |
local name2 = GetSpellInfo(87840)--Running Wild |
local name = GetSpellInfo(name2) |
if name ~= nil then |
if (localizedRace == L['MRMWorgen']) then |
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(87840) |
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
print(L['MRMRunningWild']) |
end |
else |
local name2 = GetSpellInfo(783)--Travel Form |
local name = GetSpellInfo(name2) |
if name ~= nil then |
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(783) |
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
print(L['MRMTravelForm']) |
end |
end |
elseif (localizedRace == L['MRMWorgen']) then |
local name2 = GetSpellInfo(87840)--Running Wild |
local name = GetSpellInfo(name2) |
if name ~= nil then |
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(87840) |
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2) |
if (name ~= nil) then |
MountRandomMount.btn:SetAttribute("spell", name) |
else |
print(L['MRMRunningWild']) |
end |
end |
--SetBindingClick("MRMSecureButton") |
end |
function MountRandomMount:add(amount) |
amount = string.lower(amount) |
local foundmount = false |
local insert = false |
local mountcount = GetNumCompanions("MOUNT") |
local mntspid, _, creatureName, creatureSpellID, sources, mounts |
local id, mntspid |
for i = 1, mountcount do |
_, creatureName, creatureSpellID = GetCompanionInfo("MOUNT", i) |
local _, creatureName, creatureSpellID = GetCompanionInfo("MOUNT", i) |
local lowerCN = string.lower(creatureName) |
if amount == lowerCN then |
if (amount == lowerCN) then |
foundmount = true |
id = i |
mntspid = creatureSpellID |
break |
end |
end |
if foundmount == true then |
for _, mounts in pairs(MountRandomMount_MountDataList["flying"]) do |
for _, v in pairs(mounts) do |
if (foundmount == true) then |
local mounttoadd = mntspid |
local sources, mounts |
for sources, mounts in pairs(MountRandomMount_MountDataList["flying"]) do |
table.foreach(mounts, function(k,v) |
if mntspid == v then |
insert = true |
for _, vSaved in pairs(MountRandomMount_SavedTable['flying']) do |
local insert = true |
for iSaved, vSaved in pairs(MountRandomMount_SavedTable['flying']) do |
if vSaved == v then |
insert = false |
break |
end |
end |
break |
if insert then |
print(amount.." "..L['MRMFlyingAdded']) |
table.insert(MountRandomMount_SavedTable['flying'], v) |
end |
end |
end |
end) |
end |
if insert then |
print(amount.." "..L['MRMFlyingAdded']) |
table.insert(MountRandomMount_SavedTable['flying'], mntspid) |
insert = false |
end |
for _, mounts in pairs(MountRandomMount_MountDataList["ground"]) do |
for _, v in pairs(mounts) do |
for sources, mounts in pairs(MountRandomMount_MountDataList["ground"]) do |
table.foreach(mounts, function(k,v) |
if mntspid == v then |
insert = true |
for _, vSaved in pairs(MountRandomMount_SavedTable['ground']) do |
local insert = true |
for iSaved, vSaved in pairs(MountRandomMount_SavedTable['flying']) do |
if vSaved == v then |
insert = false |
break |
end |
end |
break |
if insert then |
print(amount.." "..L['MRMLandAdded']) |
table.insert(MountRandomMount_SavedTable['flying'], v) |
end |
end |
end |
end) |
end |
if insert then |
print(amount.." "..L['MRMLandAdded']) |
table.insert(MountRandomMount_SavedTable['ground'], mntspid) |
end |
end |
end |
function MountRandomMount:remove(amount) |
for iSaved, vSaved in pairs(MountRandomMount_SavedTable['ground']) do |
if amount == string.lower(GetSpellInfo(vSaved)) then |
if amount == GetSpellInfo(vSaved) then |
print(amount.." "..L['MRMLandRemoved']) |
table.remove(MountRandomMount_SavedTable['ground'], iSaved) |
break |
end |
end |
for iSaved, vSaved in pairs(MountRandomMount_SavedTable['flying']) do |
if amount == string.lower(GetSpellInfo(vSaved)) then |
if amount == GetSpellInfo(vSaved) then |
print(amount.." "..L['MRMFlyingRemoved']) |
table.remove(MountRandomMount_SavedTable['flying'], iSaved) |
break |
end |
function MountRandomMount:list() |
if MountRandomMount_SavedTable == nil |
or (MountRandomMount_SavedTable['flying'] == nil and MountRandomMount_SavedTable['ground'] == nil) |
or (#MountRandomMount_SavedTable['flying'] == 0 and #MountRandomMount_SavedTable['ground'] == 0) then |
if (MountRandomMount_SavedTable.randommountlist == nil) or ((MountRandomMount_SavedTable['flying'] == nil) and (MountRandomMount_SavedTable['ground'] == nil)) or ((#MountRandomMount_SavedTable['flying'] == 0) and (#MountRandomMount_SavedTable['ground'] == 0)) then |
print(L['MRMNoMounts']) |
return |
end |
print(L['MRMListTitle']) |
print(L['MRMListFlyingTitle']) |
if #MountRandomMount_SavedTable['flying'] == 0 then |
if (#MountRandomMount_SavedTable['flying'] == 0) then |
print(L['MRMNoFlyingMounts']) |
else |
for i = 1, #MountRandomMount_SavedTable['flying'] do |
print(" "..i..". "..GetSpellInfo(MountRandomMount_SavedTable['flying'][i])) |
print(" "..i..". "..MountRandomMount_SavedTable['flying'][i][1]) |
end |
end |
print(" ") |
print(L['MRMListLandTitle']) |
if #MountRandomMount_SavedTable['ground'] == 0 then |
if (#MountRandomMount_SavedTable['ground'] == 0) then |
print(L['MRMNoLandMounts']) |
else |
for i = 1, #MountRandomMount_SavedTable['ground'] do |
print(" "..i..". "..GetSpellInfo(MountRandomMount_SavedTable['ground'][i])) |
print(" "..i..". "..MountRandomMount_SavedTable['ground'][i][1]) |
end |
end |
end |
SLASH_RANDOMMOUNT1 = "/rdm" |
SlashCmdList["RANDOMMOUNT"] = function(msg) |
if msg then |
if( msg ) then |
local command2 = string.lower(msg); |
local command, rest2 = command2:match("^(%S*)%s*(.-)$") |
local rest |
local ibeg, _= string.find(rest2, "%[") |
local _, iend = string.find(rest2, "%]") |
if ibeg ~= nil and iend ~= nil then |
if (ibeg ~= nil) and (iend ~= nil) then |
rest = string.sub(rest2, ibeg+1, (iend -1)) |
end |
if command == L['MRMRandom'] then |
if (command == L['MRMRandom']) then |
MountRandomMount:MountRandom() |
elseif command == L['MRMLandOnly'] then |
elseif (command == L['MRMLandOnly']) then |
MountRandomMount:LandOnly() |
elseif command == L['MRMAdd'] then |
if rest ~= nil then |
elseif (command == L['MRMAdd']) then |
if(rest ~= nil) then |
MountRandomMount:add(rest) |
else |
print(L['MRMBracketERROR']) |
end |
elseif command == L['MRMRemove'] then |
if rest ~= nil then |
elseif (command == L['MRMRemove']) then |
if(rest ~= nil) then |
MountRandomMount:remove(rest) |
else |
print(L['MRMBracketERROR']) |
end |
elseif command == L['MRMList'] then |
elseif (command == L['MRMList']) then |
MountRandomMount:list() |
elseif command == L['MRMGui'] then |
elseif (command == L['MRMGui']) then |
InterfaceOptionsFrame_OpenToCategory('MountRandomMount') |
return |
elseif command == L['MRMCatInside'] then |
elseif (command == L['MRMCatInside']) then |
local localizedClass, englishClass = UnitClass("player") |
if localizedClass == L['MRMDruid'] then |
if MountRandomMount_SavedTable.MRMDruid_CatInside then |
if (localizedClass == L['MRMDruid']) then |
if (MountRandomMount_SavedTable.MRMDruid_CatInside) then |
print(L['MRMCatInsideFalse']) |
MountRandomMount_SavedTable.MRMDruid_CatInside = false |
else |
else |
print(L['MRMNotADruid']) |
end |
elseif command == "debug" then |
elseif (command == "debug") then |
if MRMDebug then |
MRMDebug = false |
print("Debugging printing off.") |
end |
function MountRandomMount:ResetOptions() |
MountRandomMount_SavedTable['ground'] = {} |
MountRandomMount_SavedTable['flying'] = {} |
end |
function MountRandomMount:PlayerMounts() |
local _, creatureName, creatureSpellID = GetCompanionInfo("MOUNT", i) |
playerMountArray[creatureSpellID] = creatureName |
end |
if playerMountArray[98718] ~= nil then |
_G['MountRandomMount_SeaTurtleID'] = 98718 |
_G['MountRandomMount_SeaTurtleHave'] = true |
elseif playerMountArray[75207] ~= nil then |
_G['MountRandomMount_SeaTurtleID'] = 75207 |
_G['MountRandomMount_SeaTurtleHave'] = true |
else |
_G['MountRandomMount_SeaTurtleHave'] = false |
end |
if playerMountArray[98718] ~= nil then |
_G['MountRandomMount_SeaHorseID'] = 98718 |
_G['MountRandomMount_SeaHorseHave'] = true |
elseif MountRandomMount_SeaTurtleHave then |
_G['MountRandomMount_SeaHorseID'] = MountRandomMount_SeaTurtleID |
_G['MountRandomMount_SeaHorseHave'] = true |
else |
_G['MountRandomMount_SeaHorseHave'] = false |
end |
end |
function MountRandomMount:PLAYER_LOGIN() |
MountRandomMount:LandOnly() |
</Binding> |
<Binding name = "MRMTravelTRIGGER" description = "Only use if Druid/Shaman/Pally/Warlock"> |
local L = LibStub("AceLocale-3.0"):GetLocale("MountRandomMount") |
local localizedClass, englishClass = UnitClass("player") |
local localizedRace, raceEn = UnitRace("player") |
localizedClass, englishClass = UnitClass("player") |
localizedRace, raceEn = UnitRace("player") |
if (localizedClass == L['MRMShaman']) or (localizedClass == L['MRMDruid']) or (localizedClass == L['MRMShamanF']) or (localizedRace== L['MRMWorgen']) then |
MountRandomMount:TravelForm(localizedClass, localizedRace) |