Mercurial > wow > mylilpony
comparison libMyLilPony/libMyLilPony_mountFunctions.lua @ 5:a4711e3c1eef
Fixed the basic CallMount function to ignore already summoned mounts.
author | syzler |
---|---|
date | Tue, 05 Apr 2011 00:49:50 +0000 |
parents | 7dfbf42c2d60 |
children | 21d6611a1307 |
comparison
equal
deleted
inserted
replaced
4:7e41cf184b8a | 5:a4711e3c1eef |
---|---|
14 -- You should have received a copy of the GNU General Public License | 14 -- You should have received a copy of the GNU General Public License |
15 -- along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 -- along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
17 -- API functions for calling mounts | 17 -- API functions for calling mounts |
18 | 18 |
19 --- Summons a random mount. | |
20 -- Does nothing if the only available mount is already summoned. | |
21 -- @return A Boolean value indicating whether or not a new mount was summoned. | |
19 function MyLilPony.CallMount() | 22 function MyLilPony.CallMount() |
20 local countMounts = GetNumCompanions("MOUNT"); | 23 local filter = function (i) |
21 if countMounts > 0 then | |
22 local i = random(1, countMounts); | |
23 local _, _, _, _, summoned = GetCompanionInfo("MOUNT", i); | 24 local _, _, _, _, summoned = GetCompanionInfo("MOUNT", i); |
24 MyLilPony.CallCompanion("MOUNT", i, not summoned); | 25 return not summoned; |
25 return true; | 26 end |
26 end | 27 return MyLilPony.CallMountByFilter(filter); |
27 return false; | |
28 end | 28 end |
29 | 29 |
30 function MyLilPony.CallFlyingMount() | 30 function MyLilPony.CallFlyingMount() |
31 local filter = function (i) | 31 local filter = function (i) |
32 local _, _, id, _, summoned = GetCompanionInfo("MOUNT", i); | 32 local _, _, id, _, summoned = GetCompanionInfo("MOUNT", i); |