From abc2f59b57a1f9be610e7149eff3367708c84eb5 Mon Sep 17 00:00:00 2001 From: Alice Harris Date: Fri, 12 Sep 2014 10:59:28 +1000 Subject: [PATCH] allow the free weapon_warrior_0 equipment to be lost on death so that new players can experience equipment loss --- dist/habitrpg-shared.js | 2 +- script/index.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index 06e50d985b..74b136fb04 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -14171,7 +14171,7 @@ api.wrap = function(user, main) { if (v && k !== 'toObject') { itm = content.gear.flat['' + k]; if (itm) { - if (itm.value > 0 && (itm.klass === cl || (itm.klass === 'special' && (!itm.specialClass || itm.specialClass === cl)))) { + if ((itm.value > 0 || k === 'weapon_warrior_0') && (itm.klass === cl || (itm.klass === 'special' && (!itm.specialClass || itm.specialClass === cl)))) { m['' + k] = '' + k; } } diff --git a/script/index.coffee b/script/index.coffee index 2e3b92eab0..d7d91a3d7f 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -410,7 +410,7 @@ api.wrap = (user, main=true) -> user.stats[lostStat]-- if lostStat # Lose a gear piece - # Free items (value:0) cannot be lost to avoid "pay to win". Subscribers have more free (Mystery) items and so would have a higher chance of losing a free one. + # Free items (value:0) cannot be lost to avoid "pay to win". Subscribers have more free (Mystery) items and so would have a higher chance of losing a free one. The only exception is that the weapon_warrior_0 free item can be lost so that a new player who dies does experience equipment loss. # Note ""+k string-casting. Without this, when run on the server Mongoose returns funny objects cl = user.stats.class lostItem = user.fns.randomVal _.reduce(user.items.gear.owned, ((m,v,k)-> @@ -418,7 +418,7 @@ api.wrap = (user, main=true) -> # 'toObject' appears as first key when run on server. No idea why. itm = content.gear.flat[''+k] if itm - if itm.value > 0 && ( itm.klass == cl || ( itm.klass == 'special' && (! itm.specialClass || itm.specialClass == cl) ) ) + if (itm.value > 0 || k == 'weapon_warrior_0') && ( itm.klass == cl || ( itm.klass == 'special' && (! itm.specialClass || itm.specialClass == cl) ) ) m[''+k]=''+k # else # console.log "Can't get item for " + k