diff libMyLilPony/libMyLilPony_mountFunctions.lua @ 52:64e8f8e5fa41

Simplified some functions since mount type is can be determined from slot ID
author syzler
date Sat, 07 Mar 2015 14:15:17 -0500
parents 22011265a16f
children d3d070ea6341
line wrap: on
line diff
--- a/libMyLilPony/libMyLilPony_mountFunctions.lua	Sat Mar 07 02:55:27 2015 -0500
+++ b/libMyLilPony/libMyLilPony_mountFunctions.lua	Sat Mar 07 14:15:17 2015 -0500
@@ -1,4 +1,4 @@
--- Copyright (c) 2011, Syzler
+-- Copyright (c) 2015, Syzler
 -- All rights reserved.
 --
 -- Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,7 @@
 function MyLilPony.CallFlyingMount()
     local filter = function (i)
         local _, id, _, summoned = C_MountJournal.GetMountInfo(i);
-        return not summoned and MyLilPony.IsFlyingMount(id);
+        return not summoned and MyLilPony.IsFlyingMountSlot(i);
     end
     return MyLilPony.CallMountByFilter(filter);
 end
@@ -65,7 +65,7 @@
 function MyLilPony.CallGroundMount()
     local filter = function (i)
         local _, id, _, summoned = C_MountJournal.GetMountInfo(i);
-        return not summoned and MyLilPony.IsGroundMount(id);
+        return not summoned and MyLilPony.IsGroundMountSlot(i);
     end
     return MyLilPony.CallMountByFilter(filter);
 end
@@ -76,7 +76,7 @@
 function MyLilPony.CallAquaticMount()
     local filter = function (i)
         local _, id, _, summoned = C_MountJournal.GetMountInfo(i);
-        return not summoned and MyLilPony.IsAquaticMount(id);
+        return not summoned and MyLilPony.IsAquaticMountSlot(i);
     end
     return MyLilPony.CallMountByFilter(filter);
 end
@@ -89,7 +89,7 @@
     local countMounts = C_MountJournal.GetNumMounts();
     if slotNumber > 0 and slotNumber < countMounts+1 then
         local _, _, _, summoned = C_MountJournal.GetMountInfo(i);
-        MyLilPony.CallCompanion("MOUNT", slotNumber, not summoned);
+        MyLilPony.CallMount(slotNumber, not summoned);
         return true;
     end
     return false;
@@ -104,7 +104,7 @@
     for i in MyLilPony.EnumerateKnownMountSlotIDs() do
         local name, _, _, summoned = C_MountJournal.GetMountInfo(i);
         if name == mountName then
-            MyLilPony.CallCompanion("MOUNT", i, not summoned);
+            MyLilPony.CallMount(i, not summoned);
             result = true;
             do break end
         end
@@ -135,7 +135,7 @@
         local _, spellId, _, summoned = C_MountJournal.GetMountInfo(i);
         local creatureId = C_MountJournal.GetMountInfoExtra(i);
         if id == creatureId or id == spellId then
-            MyLilPony.CallCompanion("MOUNT", i, not summoned);
+            MyLilPony.CallMount(i, not summoned);
             result = true;
             do break end
         end
@@ -152,7 +152,7 @@
     for i in MyLilPony.EnumerateKnownMountSlotIDs() do
         local _, id, _, summoned = C_MountJournal.GetMountInfo(i);
         if id == spellId then
-            MyLilPony.CallCompanion("MOUNT", i, not summoned);
+            MyLilPony.CallMount(i, not summoned);
             result = true;
             do break end
         end
@@ -170,7 +170,7 @@
         local _, _, _, summoned = C_MountJournal.GetMountInfo(i);
         local id = C_MountJournal.GetMountInfoExtra(i);
         if id == creatureId then
-            MyLilPony.CallCompanion("MOUNT", i, not summoned);
+            MyLilPony.CallMount(i, not summoned);
             result = true;
             do break end
         end
@@ -191,7 +191,7 @@
     for i in MyLilPony.EnumerateKnownMountSlotIDs() do
         local _, id, _, summoned = C_MountJournal.GetMountInfo(i);
         if unitBuffs[id] ~= nil then
-            MyLilPony.CallCompanion("MOUNT", i, not summoned);
+            MyLilPony.CallMount(i, not summoned);
             result = true;
             do break end
         end
@@ -221,7 +221,7 @@
     if x > 0 then
         local i = mounts[random(1, x)];
         local _, _, _, summoned =  C_MountJournal.GetMountInfo(i);
-        MyLilPony.CallCompanion("MOUNT", i, not summoned);
+        MyLilPony.CallMount(i, not summoned);
         return true;
     end
     return false;