diff --git a/common/script/index.js b/common/script/index.js index aac0735846..a29a8c1e53 100644 --- a/common/script/index.js +++ b/common/script/index.js @@ -2063,23 +2063,33 @@ api.wrap = function(user, main) { return content.gear.flat[type + "_base_0"]; } return item; - }, + }, handleTwoHanded: function(item, type, req) { - var message, ref, weapon; + var message, ref, weapon, shield; if (type == null) { type = 'equipped'; } if (item.type === "shield" && ((ref = (weapon = content.gear.flat[user.items.gear[type].weapon])) != null ? ref.twoHanded : void 0)) { user.items.gear[type].weapon = 'weapon_base_0'; - message = i18n.t('messageTwoHandled', { + message = [i18n.t('messageTwoHandled', { gearText: weapon.text(req.language) - }, req.language); + }, req.language)]; + message.push(i18n.t('messageUnEquipped', { + itemText: weapon.text(req.language) + }, req.language)); } if (item.twoHanded) { - user.items.gear[type].shield = "shield_base_0"; - message = i18n.t('messageTwoHandled', { - gearText: item.text(req.language) - }, req.language); + shield = content.gear.flat[user.items.gear.equipped.shield]; + if(shield && user.items.gear.equipped.shield != "shield_base_0"){ + user.items.gear[type].shield = "shield_base_0"; + + message = [i18n.t('messageTwoHandled', { + gearText: item.text(req.language) + }, req.language)]; + message.push(i18n.t('messageUnEquipped', { + itemText: shield.text(req.language) + }, req.language)); + } } return message; }, diff --git a/common/script/public/userServices.js b/common/script/public/userServices.js index 67d705e8b7..59614eca4a 100644 --- a/common/script/public/userServices.js +++ b/common/script/public/userServices.js @@ -107,10 +107,14 @@ angular.module('habitrpg') if (err) { var message = err.code ? err.message : err; console.log(message); - if (MOBILE_APP) Notification.push({type:'text',text:message}); - else Notification.text(message); - // In the case of 200s, they're friendly alert messages like "Your pet has hatched!" - still send the op - if ((err.code && err.code >= 400) || !err.code) return; + if (typeof message === 'string') + message = [message]; + _.each(message, (msg) => { + if (MOBILE_APP) Notification.push({type:'text',text:msg}); + else Notification.text(msg); + // In the case of 200s, they're friendly alert messages like "Your pet has hatched!" - still send the op + if ((err.code && err.code >= 400) || !err.code) return; + }); } userServices.log({op:k, params: req.params, query:req.query, body:req.body}); });