From ec1681fce460a332285e84b17932ef3d68fb05d5 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Mon, 18 Nov 2013 16:07:23 +0100 Subject: [PATCH] add countPets helper --- dist/habitrpg-shared.js | 15 +++++++++++++++ script/helpers.coffee | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index ec0c437387..dde08163ff 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -9991,6 +9991,21 @@ var process=require("__browserify_process");(function() { return i.defense; } }, + countPets: function(originalCount, pets) { + var count; + + count = originalCount || _.size(pets); + if (pets["Wolf-Veteran"]) { + count--; + } + if (pets["Wolf-Cerberus"]) { + count--; + } + if (pets["Dragon-Hydra"]) { + count--; + } + return count; + }, /* ---------------------------------------------------------------------- Derby-specific helpers. Will remove after the rewrite, need them here for now diff --git a/script/helpers.coffee b/script/helpers.coffee index 840e71353c..15534f6193 100644 --- a/script/helpers.coffee +++ b/script/helpers.coffee @@ -307,8 +307,6 @@ module.exports = return false unless messages?.length > 0 messages?[0] and (messages[0].id != lastMessageSeen) - - ### are any tags active? ### @@ -353,6 +351,12 @@ module.exports = i = items.getItem(type, item) if type is 'weapon' then i.strength else i.defense + countPets: (originalCount, pets) -> + count = originalCount or _.size(pets); + count-- if pets["Wolf-Veteran"] + count-- if pets["Wolf-Cerberus"] + count-- if pets["Dragon-Hydra"] + count ### ----------------------------------------------------------------------