Mercurial > wow > mylilpony
changeset 5:a4711e3c1eef
Fixed the basic CallMount function to ignore already summoned mounts.
author | syzler |
---|---|
date | Tue, 05 Apr 2011 00:49:50 +0000 |
parents | 7e41cf184b8a |
children | 21d6611a1307 |
files | libMyLilPony/libMyLilPony_mountFunctions.lua |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libMyLilPony/libMyLilPony_mountFunctions.lua Mon Apr 04 04:58:43 2011 +0000 +++ b/libMyLilPony/libMyLilPony_mountFunctions.lua Tue Apr 05 00:49:50 2011 +0000 @@ -16,15 +16,15 @@ -- API functions for calling mounts +--- Summons a random mount. +-- Does nothing if the only available mount is already summoned. +-- @return A Boolean value indicating whether or not a new mount was summoned. function MyLilPony.CallMount() - local countMounts = GetNumCompanions("MOUNT"); - if countMounts > 0 then - local i = random(1, countMounts); + local filter = function (i) local _, _, _, _, summoned = GetCompanionInfo("MOUNT", i); - MyLilPony.CallCompanion("MOUNT", i, not summoned); - return true; + return not summoned; end - return false; + return MyLilPony.CallMountByFilter(filter); end function MyLilPony.CallFlyingMount()