WoWInterface SVN MountRandomMount

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 18 to Rev 19
    Reverse comparison

Rev 18 → Rev 19

MountRandomMount_GUI.lua
197,7 → 197,8
end
 
function MountRandomMount:ResetOptions()
 
MountRandomMount_SavedTable['ground'] = {}
MountRandomMount_SavedTable['flying'] = {}
end
 
function MountRandomMount:PlayerMounts()
208,6 → 209,27
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()
Bindings.xml
6,8 → 6,9
MountRandomMount:LandOnly()
</Binding>
<Binding name = "MRMTravelTRIGGER" description = "Only use if Druid/Shaman/Pally/Warlock">
localizedClass, englishClass = UnitClass("player")
localizedRace, raceEn = UnitRace("player")
local L = LibStub("AceLocale-3.0"):GetLocale("MountRandomMount")
local localizedClass, englishClass = UnitClass("player")
local 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)
MountRandomMount.lua
33,8 → 33,8
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
51,14 → 51,13
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
local swimmount = MountRandomMount:SwimmingMount(true)
if (swimmount) then
local SeaTurtleName = GetSpellInfo(MountRandomMount_SeaTurtleIRealID)
if MountRandomMount_SeaHorseHave then
local SeaTurtleName = GetSpellInfo(MountRandomMount_SeaHorseID)
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
67,14 → 66,13
end
end
else
local swimmount = MountRandomMount:SwimmingMount(false)
if (swimmount) then
local SeaTurtleName = GetSpellInfo(MountRandomMount_SeaTurtleIRealID)
if MountRandomMount_SeaTurtleHave then
local SeaTurtleName = GetSpellInfo(MountRandomMount_SeaTurtleID)
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
90,68 → 88,6
 
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
171,7 → 107,7
end
 
function MountRandomMount:LandOnly()
if (MountRandomMount_SavedTable.randommountlist == nil) or ( (MountRandomMount_SavedTable['ground'] == nil)) or ((#MountRandomMount_SavedTable['ground'] == 0)) then
if MountRandomMount_SavedTable == nil or MountRandomMount_SavedTable['ground'] == nil or #MountRandomMount_SavedTable['ground'] == 0 then
print(L['MRMNoMounts'])
return
end
254,48 → 190,48
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, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2)
if (name ~= nil) then
if localizedClass == L['MRMShaman'] or localizedClass == L['MRMShamanF'] then
local name2 = GetSpellInfo(2645)
local name = 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)
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2)
if (name ~= nil) then
if IsSwimming() then
local name2 = GetSpellInfo(1066)--Aquatic Form
local name = 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)
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2)
if (name ~= nil) then
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
MountRandomMount.btn:SetAttribute("spell", name)
else
print(L['MRMCatForm'])
end
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
elseif not IsFlyableArea() then
if localizedRace == L['MRMWorgen'] then
local name2 = GetSpellInfo(87840)--Running Wild
local name = GetSpellInfo(name2)
if name ~= nil then
MountRandomMount.btn:SetAttribute("spell", name)
else
print(L['MRMRunningWild'])
end
else
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(783)
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2)
if (name ~= nil) then
local name2 = GetSpellInfo(783)--Travel Form
local name = GetSpellInfo(name2)
if name ~= nil then
MountRandomMount.btn:SetAttribute("spell", name)
else
print(L['MRMTravelForm'])
304,19 → 240,19
else
local fly = MountRandomMount:Flying(true)
if fly then
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(40120)
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2)
if (name ~= nil) then
local name2 = GetSpellInfo(40120)--Swift Flight Form
local name = GetSpellInfo(name2)
if name ~= nil then
MountRandomMount.btn:SetAttribute("spell", name)
else
name2, _, _, _, _, _, _, _, _ = GetSpellInfo(33943)
name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2)
if (name ~= nil) then
name2 = GetSpellInfo(33943)--Flight Form
name = GetSpellInfo(name2)
if name ~= nil then
MountRandomMount.btn:SetAttribute("spell", name)
else
name2, _, _, _, _, _, _, _, _ = GetSpellInfo(783)
name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2)
if (name ~= nil) then
name2 = GetSpellInfo(783)--Travel Form
name = GetSpellInfo(name2)
if name ~= nil then
MountRandomMount.btn:SetAttribute("spell", name)
else
print(MRMFlighForm)
324,18 → 260,18
end
end
else
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
if localizedRace == L['MRMWorgen'] then
local name2 = GetSpellInfo(87840)--Running Wild
local name = GetSpellInfo(name2)
if name ~= nil then
MountRandomMount.btn:SetAttribute("spell", name)
else
print(L['MRMRunningWild'])
end
else
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(783)
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2)
if (name ~= nil) then
local name2 = GetSpellInfo(783)--Travel Form
local name = GetSpellInfo(name2)
if name ~= nil then
MountRandomMount.btn:SetAttribute("spell", name)
else
print(L['MRMTravelForm'])
344,79 → 280,82
end
end
elseif (localizedRace == L['MRMWorgen']) then
local name2, _, _, _, _, _, _, _, _ = GetSpellInfo(87840)
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(name2)
if (name ~= nil) then
local name2 = GetSpellInfo(87840)--Running Wild
local name = 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 id, mntspid
local mntspid, _, creatureName, creatureSpellID, sources, mounts
for i = 1, mountcount do
local _, creatureName, creatureSpellID = GetCompanionInfo("MOUNT", i)
_, 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
local mounttoadd = mntspid
local sources, mounts
for sources, mounts in pairs(MountRandomMount_MountDataList["flying"]) do
table.foreach(mounts, function(k,v)
if foundmount == true then
for _, mounts in pairs(MountRandomMount_MountDataList["flying"]) do
for _, v in pairs(mounts) do
if mntspid == v then
local insert = true
for iSaved, vSaved in pairs(MountRandomMount_SavedTable['flying']) do
insert = true
for _, vSaved in pairs(MountRandomMount_SavedTable['flying']) do
if vSaved == v then
insert = false
break
end
end
if insert then
print(amount.." "..L['MRMFlyingAdded'])
table.insert(MountRandomMount_SavedTable['flying'], v)
end
break
end
end)
end
end
for sources, mounts in pairs(MountRandomMount_MountDataList["ground"]) do
table.foreach(mounts, function(k,v)
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
if mntspid == v then
local insert = true
for iSaved, vSaved in pairs(MountRandomMount_SavedTable['flying']) do
insert = true
for _, vSaved in pairs(MountRandomMount_SavedTable['ground']) do
if vSaved == v then
insert = false
break
end
end
if insert then
print(amount.." "..L['MRMLandAdded'])
table.insert(MountRandomMount_SavedTable['flying'], v)
end
break
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 == GetSpellInfo(vSaved) then
if amount == string.lower(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 == GetSpellInfo(vSaved) then
if amount == string.lower(GetSpellInfo(vSaved)) then
print(amount.." "..L['MRMFlyingRemoved'])
table.remove(MountRandomMount_SavedTable['flying'], iSaved)
break
425,26 → 364,28
end
 
function MountRandomMount:list()
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
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
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..". "..MountRandomMount_SavedTable['flying'][i][1])
print(" "..i..". "..GetSpellInfo(MountRandomMount_SavedTable['flying'][i]))
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..". "..MountRandomMount_SavedTable['ground'][i][1])
print(" "..i..". "..GetSpellInfo(MountRandomMount_SavedTable['ground'][i]))
end
end
end
452,40 → 393,40
 
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
495,7 → 436,7
else
print(L['MRMNotADruid'])
end
elseif (command == "debug") then
elseif command == "debug" then
if MRMDebug then
MRMDebug = false
print("Debugging printing off.")