From 57e7fc93d7f8d32fba22f3c6685b153a734149a8 Mon Sep 17 00:00:00 2001 From: Alys Date: Wed, 12 Aug 2015 16:01:53 +1000 Subject: [PATCH 1/5] prevent Orb of Rebirth removing free equipment (gear that has zero gold cost) - partial fix for https://github.com/HabitRPG/habitrpg/issues/5750 --- common/script/index.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/script/index.coffee b/common/script/index.coffee index 4cdde33b0b..7eeea96cf2 100644 --- a/common/script/index.coffee +++ b/common/script/index.coffee @@ -567,8 +567,8 @@ api.wrap = (user, main=true) -> gear[type].shield = 'shield_base_0' if user.items.currentPet then user.ops.equip({params:{type: 'pet', key: user.items.currentPet}}) if user.items.currentMount then user.ops.equip({params:{type: 'mount', key: user.items.currentMount}}) - # Strip owned gear down to the training sword, but preserve purchase history so user can re-purchase limited edition equipment - _.each gear.owned, (v, k) -> if gear.owned[k] then gear.owned[k] = false; true + # Strip owned gear down to the training sword and free items (zero gold value), but preserve purchase history so user can re-purchase limited edition equipment + _.each gear.owned, (v, k) -> if gear.owned[k] and content.gear.flat[k].value then gear.owned[k] = false; true gear.owned.weapon_warrior_0 = true user.markModified? 'items.gear.owned' user.preferences.costume = false From 87c81df3750727795acac6edabcb557513040f81 Mon Sep 17 00:00:00 2001 From: Alys Date: Sun, 16 Aug 2015 13:04:48 +1000 Subject: [PATCH 2/5] add test for Orb of Rebirth not removing free equipment (zero gold cost gear) --- test/common/algos.mocha.coffee | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/common/algos.mocha.coffee b/test/common/algos.mocha.coffee index 5be39a7ae3..5b9719a471 100644 --- a/test/common/algos.mocha.coffee +++ b/test/common/algos.mocha.coffee @@ -366,6 +366,30 @@ describe 'User', -> shared.content.gear.flat.head_special_nye.event.end = moment().add(5,'days') expect(shared.content.gear.flat.head_special_nye.canOwn(user)).to.be true + describe 'Rebirth', -> + user = undefined + it 'removes correct gear', -> + user = newUser() + user.stats.lvl = 100 + user.items.gear.owned = { + "weapon_warrior_0": true, + "weapon_warrior_1": true, + "armor_warrior_1": false, + "armor_mystery_201402": true, + "back_mystery_201402": false, + "head_mystery_201402": true, + "weapon_armoire_basicCrossbow": true, + } + user.ops.rebirth() + expect(user.items.gear.owned).to.eql { + "weapon_warrior_0": true, + "weapon_warrior_1": false, + "armor_warrior_1": false, + "armor_mystery_201402": true, + "back_mystery_201402": false, + "head_mystery_201402": true, + "weapon_armoire_basicCrossbow": false, + } describe 'store', -> it 'recovers hp buying potions', -> From a94dd0d6a36161b24a453ab772e18269b684c2b2 Mon Sep 17 00:00:00 2001 From: Alys Date: Sun, 16 Aug 2015 13:12:53 +1000 Subject: [PATCH 3/5] adjust Orb of Rebirth modal to state that you keep free equipment --- common/locales/en/rebirth.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/locales/en/rebirth.json b/common/locales/en/rebirth.json index 9ad01828da..9f0f75b299 100644 --- a/common/locales/en/rebirth.json +++ b/common/locales/en/rebirth.json @@ -4,7 +4,7 @@ "rebirthBegin": "Rebirth: Begin a New Adventure", "rebirthStartOver": "Rebirth starts your character over from Level 1, as if you had created a new account.", "rebirthAdvList1": "You return to full Health.", - "rebirthAdvList2": "You have no Experience, Gold, or equipment.", + "rebirthAdvList2": "You have no Experience, Gold, or Equipment (with the exception of free items like Mystery items).", "rebirthAdvList3": "Your Habits, Dailies, and To-Dos reset to yellow, and streaks reset.", "rebirthAdvList4": "You have the starting class of Warrior until you earn a new class.", "rebirthInherit": "Your new character inherits a few things from their predecessor:", From c957fa476ef0c473f04709db61bff0b574a9b29e Mon Sep 17 00:00:00 2001 From: Alys Date: Sun, 16 Aug 2015 13:17:10 +1000 Subject: [PATCH 4/5] remove text about unlocking Item Shop because it is now available to new players --- common/locales/en/limited.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/locales/en/limited.json b/common/locales/en/limited.json index a69d693811..8078b00285 100644 --- a/common/locales/en/limited.json +++ b/common/locales/en/limited.json @@ -29,7 +29,7 @@ "seasonalShopClosedText": "The Seasonal Shop is currently closed!! I don't know where the Seasonal Sorceress is now, but I bet she'll be back during the next Grand Gala!", "seasonalShopText": "Welcome to the Seasonal Shop!! We're stocking springtime Seasonal Edition goodies at the moment. Everything here will be available to purchase during the Spring Fling event each year, but we're only open until April 30th, so be sure to stock up now, or you'll have to wait a year to buy these items again!", "seasonalShopSummerText": "Welcome to the Seasonal Shop!! We're stocking summertime Seasonal Edition goodies at the moment. Everything here will be available to purchase during the Summer Splash event each year, but we're only open until July 31st, so be sure to stock up now, or you'll have to wait a year to buy these items again!", - "seasonalShopRebirth": "If you've used the Orb of Rebirth, you can repurchase this equipment in the Rewards Column after you unlock the Item Shop. Initially, you'll only be able to purchase the items for your current class (Warrior by default), but fear not, the other class-specific items will become available if you switch to that class.", + "seasonalShopRebirth": "If you've used the Orb of Rebirth, you can repurchase this equipment in the Rewards Column. Initially, you'll only be able to purchase the items for your current class (Warrior by default), but fear not, the other class-specific items will become available if you switch to that class.", "candycaneSet": "Candy Cane (Mage)", "skiSet": "Ski-sassin (Rogue)", "snowflakeSet": "Snowflake (Healer)", From 3d47f3f8353cfe8445aa8c03ce8a677f677121db Mon Sep 17 00:00:00 2001 From: Alys Date: Sun, 23 Aug 2015 17:43:33 +1000 Subject: [PATCH 5/5] remove "as if you had created a new account" from Orb of Rebirth description --- common/locales/en/rebirth.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/locales/en/rebirth.json b/common/locales/en/rebirth.json index 9f0f75b299..becadbefe5 100644 --- a/common/locales/en/rebirth.json +++ b/common/locales/en/rebirth.json @@ -2,7 +2,7 @@ "rebirthNew": "Rebirth: New Adventure Available!", "rebirthUnlock": "You've unlocked Rebirth! This special Market item allows you to begin a new game at level 1 while keeping your tasks, achievements, pets, and more. Use it to breathe new life into Habitica if you feel you've achieved it all, or to experience new features with the fresh eyes of a beginning character!", "rebirthBegin": "Rebirth: Begin a New Adventure", - "rebirthStartOver": "Rebirth starts your character over from Level 1, as if you had created a new account.", + "rebirthStartOver": "Rebirth starts your character over from Level 1.", "rebirthAdvList1": "You return to full Health.", "rebirthAdvList2": "You have no Experience, Gold, or Equipment (with the exception of free items like Mystery items).", "rebirthAdvList3": "Your Habits, Dailies, and To-Dos reset to yellow, and streaks reset.",