diff libMyLilPony/libMyLilPony_miscFunctions.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 81145a681a59
line wrap: on
line diff
--- a/libMyLilPony/libMyLilPony_miscFunctions.lua	Sat Mar 07 02:55:27 2015 -0500
+++ b/libMyLilPony/libMyLilPony_miscFunctions.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
@@ -39,7 +39,7 @@
 
 --- Gets a hashtable of buffs on the specified unit.
 -- @param unit The unit frame name (e.g. "target", "player", "focus") of the unit whose buffs are to be retrieved.
--- @returns a hashtable of buff spell IDs keyed on the ID.
+-- @returns A hashtable of buff spell IDs keyed on the ID.
 function MyLilPony.GetUnitBuffs(unit)
     local buffs = {};
     for i = 1, 40 do
@@ -74,13 +74,23 @@
 end
 
 --- Calls a mount if a specified condition checks out.
+-- @param slotID The slot ID of the mount to be called.
+-- @param condition An optional Boolean condition.
+-- @returns True if a mount was summoned, or False otherwise.
+function MyLilPony.CallMount(slotID, condition)
+    if condition == nil or condition then
+        C_MountJournal.Summon(slotID);
+        return true;
+    end
+    return false;
+end
+
+--- OBSOLETE. Calls a mount if a specified condition checks out.
 -- @param unused The type of companion to be called (e.g. "MOUNT").
 -- @param slotID The slot ID of the mount to be called.
 -- @param condition An optional Boolean condition.
 function MyLilPony.CallCompanion(unused, slotID, condition)
-    if condition == nil or condition then
-        C_MountJournal.Summon(slotID);
-    end
+    MyLilPony.CallMount(slotID, condition);
 end
 
 --- Iterates over all known and non-hidden (i.e. not dead or opposite faction) mount slot IDs.