diff --git a/locales/en/gear.json b/locales/en/gear.json index d1edac2f64..fbcd90bb17 100644 --- a/locales/en/gear.json +++ b/locales/en/gear.json @@ -1,4 +1,6 @@ { + "weapon": "weapon", + "weaponBase0Text": "No Weapon", "weaponBase0Notes": "No Weapon.", @@ -123,6 +125,8 @@ "weaponMystery301404Text": "Steampunk Cane", "weaponMystery301404Notes": "Excellent for taking a turn about town. March 3015 Subscriber Item. Confers no benefit.", + "armor": "armor", + "armorBase0Text": "Plain Clothing", "armorBase0Notes": "Ordinary clothing. Confers no benefit.", @@ -246,6 +250,8 @@ "armorMystery301404Text": "Steampunk Suit", "armorMystery301404Notes": "Dapper and dashing, wot! Confers no benefit. February 3015 Subscriber Item.", + "headgear": "headgear", + "headBase0Text": "No Helm", "headBase0Notes": "No headgear.", @@ -367,6 +373,8 @@ "headMystery301405Text": "Basic Top Hat", "headMystery301405Notes": "A basic top hat, just begging to be paired with some fancy head accessories. Confers no benefit. May 3015 Subscriber Item.", + "offhand": "off-hand item", + "shieldBase0Text": "No Off-Hand Equipment", "shieldBase0Notes": "No shield or second weapon.", diff --git a/locales/en/generic.json b/locales/en/generic.json index 2e6d70be77..55ad98e9c1 100644 --- a/locales/en/generic.json +++ b/locales/en/generic.json @@ -35,6 +35,7 @@ "neverMind": "Never mind", "buyMoreGems": "Buy More Gems", "notEnoughGems": "Not enough Gems", + "alreadyHave": "Whoops! You already have this item. No need to buy it again!", "delete": "Delete", "gems": "Gems", "moreInfo": "More Info", diff --git a/locales/en/limited.json b/locales/en/limited.json index 30cf66ff83..663c372fe7 100644 --- a/locales/en/limited.json +++ b/locales/en/limited.json @@ -16,5 +16,11 @@ "jackolantern": "Jack-O-Lantern", "seasonalShop": "Seasonal Shop", "seasonalShopClosedTitle": "<%= linkStart %>Siena Leslie<%= linkEnd %>", - "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 <%= linkStart %>Grand Gala<%= linkEnd %>!" -} \ No newline at end of file + "seasonalShopTitle": "<%= linkStart %>Seasonal Sorceress<%= linkEnd %>", + "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 <%= linkStart %>Grand Gala<%= linkEnd %>!", + "seasonalShopText": "Welcome to the Seasonal Shop! From now until January 31st, we're stocking lots of seasonal edition winter goodies. After that, these items won't be back for another year, so get them while they're hot!! Or, er, cold.", + "candycaneSet": "Candy Cane (Mage)", + "skiSet": "Ski-sassin (Rogue)", + "snowflakeSet": "Snowflake (Healer)", + "yetiSet": "Yeti Tamer (Warrior)" +} diff --git a/script/index.coffee b/script/index.coffee index b6c2d24c6c..b2ff70a6a8 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -690,7 +690,7 @@ api.wrap = (user, main=true) -> user.markModified? 'items.special' cb? null, _.pick(user,$w 'items stats') - # buy is for gear, purchase is for gem-purchaseables (i know, I know...) + # buy is for using Gold, purchase is for Gems (I know, I know...) purchase: (req, cb, ga) -> {type,key} = req.params @@ -705,13 +705,21 @@ api.wrap = (user, main=true) -> user.stats.gp -= convRate return cb? {code:200,message:"+1 Gems"}, _.pick(user,$w 'stats balance') - return cb?({code:404,message:":type must be in [hatchingPotions,eggs,food,quests,special]"},req) unless type in ['eggs','hatchingPotions','food','quests','special'] - item = content[type][key] + return cb?({code:404,message:":type must be in [eggs,hatchingPotions,food,quests,gear]"},req) unless type in ['eggs','hatchingPotions','food','quests','gear'] + if type is 'gear' + item = content.gear.flat[key] + return cb?({code:401, message: i18n.t('alreadyHave', req.language)}) if user.items.gear.owned[key] + price = (if item.twoHanded then 2 else 1) / 4 + else + item = content[type][key] + price = item.value / 4 return cb?({code:404,message:":key not found for Content.#{type}"},req) unless item - return cb?({code:401, message: i18n.t('notEnoughGems', req.language)}) if user.balance < (item.value / 4) - user.items[type][key] = 0 unless user.items[type][key] > 0 - user.items[type][key]++ - user.balance -= (item.value / 4) + return cb?({code:401, message: i18n.t('notEnoughGems', req.language)}) if user.balance < price + user.balance -= price + if type is 'gear' then user.items.gear.owned[key] = true + else + user.items[type][key] = 0 unless user.items[type][key] > 0 + user.items[type][key]++ cb? null, _.pick(user,$w 'items balance') ga?.event('purchase', key).send()