From 3caaacc110eb20eda5263afa1fc30c67fadedeb2 Mon Sep 17 00:00:00 2001 From: Alar of Runetotem Date: Sun, 22 Jan 2017 16:20:10 +0100 Subject: [PATCH] Fix: used followers cache now accounts per follower type --- FollowerCache.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/FollowerCache.lua b/FollowerCache.lua index 90dae5d..f869f50 100644 --- a/FollowerCache.lua +++ b/FollowerCache.lua @@ -28,6 +28,8 @@ local cache={} --#cache local followerTypes={} local cacheTypes={LE_FOLLOWER_TYPE_GARRISON_6_0,LE_FOLLOWER_TYPE_SHIPYARD_6_2,LE_FOLLOWER_TYPE_GARRISON_7_0} local EMPTY={} +local GMCUsedFollowers={} +local GMCUsedFollowersCount=0 function module:OnInitialized() self:RegisterEvent("GARRISON_FOLLOWER_REMOVED","OnEvent") self:RegisterEvent("GARRISON_FOLLOWER_ADDED","OnEvent") @@ -281,3 +283,18 @@ end function addon:GetCache(followerTypeID) return module.caches[followerTypeID] end +function addon:GMCBusy(followerID,value) + if not followerID then + GMCUsedFollowersCount=0 + wipe(GMCUsedFollowers) + return + end + if value and not GMCUsedFollowers[followerID] then + GMCUsedFollowers[followerID]=true + GMCUsedFollowersCount=GMCUsedFollowersCount+1 + end + return GMCUsedFollowers[followerID] +end +function addon:GMCBusyCount() + return GMCUsedFollowersCount +end \ No newline at end of file -- 1.7.9.5