Merge pull request #5798 from Alys/rebirth-keeps-free-gear-2015-08-12

prevent Orb of Rebirth from removing free gear (equipment that has zero gold cost) - partial fix for https://github.com/HabitRPG/habitrpg/issues/5750
This commit is contained in:
Alys
2015-08-26 22:01:29 +10:00
4 changed files with 29 additions and 5 deletions

View File

@@ -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 <a href='http://habitica.wikia.com/wiki/Grand_Galas' target='_blank'>Grand Gala</a>!",
"seasonalShopText": "Welcome to the Seasonal Shop!! We're stocking springtime <a href='http://habitica.wikia.com/wiki/Item_Availability' target='_blank'>Seasonal Edition</a> 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 <a href='http://habitica.wikia.com/wiki/Item_Availability' target='_blank'>Seasonal Edition</a> 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)",

View File

@@ -2,9 +2,9 @@
"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.",
"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:",

View File

@@ -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

View File

@@ -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', ->