diff --git a/common/script/content.coffee b/common/script/content/index.coffee similarity index 99% rename from common/script/content.coffee rename to common/script/content/index.coffee index f4bf479d1e..28d13f4c30 100644 --- a/common/script/content.coffee +++ b/common/script/content/index.coffee @@ -1,7 +1,7 @@ _ = require 'lodash' api = module.exports moment = require 'moment' -i18n = require './i18n.coffee' +i18n = require '../i18n.coffee' t = (string, vars) -> func = (lang) -> vars ?= {a: 'a'} diff --git a/common/script/count.js b/common/script/count.js index a48fcd42d9..de2bbf1227 100644 --- a/common/script/count.js +++ b/common/script/count.js @@ -2,7 +2,7 @@ require('coffee-script'); var _ = require('lodash'); -var content = require('./content.coffee'); +var content = require('./content/index.coffee'); var DROP_ANIMALS = _.keys(content.pets); diff --git a/common/script/index.coffee b/common/script/index.coffee index f0dd2536fa..8e5094b7f2 100644 --- a/common/script/index.coffee +++ b/common/script/index.coffee @@ -1,6 +1,6 @@ moment = require('moment') _ = require('lodash') -content = require('./content.coffee') +content = require('./content/index.coffee') i18n = require('./i18n.coffee') api = module.exports = {} @@ -923,7 +923,7 @@ api.wrap = (user, main=true) -> item = if key is 'potion' then content.potion else if key is 'armoire' then content.armoire else content.gear.flat[key] - return cb?({code:404, message:"Item '#{key} not found (see https://github.com/HabitRPG/habitrpg/blob/develop/common/script/content.coffee)"}) unless item + return cb?({code:404, message:"Item '#{key} not found (see https://github.com/HabitRPG/habitrpg/blob/develop/common/script/content/index.coffee)"}) unless item return cb?({code:401, message: i18n.t('messageNotEnoughGold', req.language)}) if user.stats.gp < item.value return cb?({code:401, message: "You can't buy this item"}) if item.canOwn? and !item.canOwn(user) armoireResp = undefined @@ -980,8 +980,8 @@ api.wrap = (user, main=true) -> buyQuest: (req, cb, analytics) -> {key} = req.params item = content.quests[key] - return cb?({code:404, message:"Quest '#{key} not found (see https://github.com/HabitRPG/habitrpg/blob/develop/common/script/content.coffee)"}) unless item - return cb?({code:404, message:"Quest '#{key} is not a Gold-purchasable quest (see https://github.com/HabitRPG/habitrpg/blob/develop/common/script/content.coffee)"}) unless item.category is 'gold' and item.goldValue + return cb?({code:404, message:"Quest '#{key} not found (see https://github.com/HabitRPG/habitrpg/blob/develop/common/script/content/index.coffee)"}) unless item + return cb?({code:404, message:"Quest '#{key} is not a Gold-purchasable quest (see https://github.com/HabitRPG/habitrpg/blob/develop/common/script/content/index.coffee)"}) unless item.category is 'gold' and item.goldValue return cb?({code:401, message: i18n.t('messageNotEnoughGold', req.language)}) if user.stats.gp < item.goldValue message = i18n.t('messageBought', {itemText: item.text(req.language)}, req.language) user.items.quests[item.key] ?= 0 @@ -1063,7 +1063,7 @@ api.wrap = (user, main=true) -> fullSet = ~path.indexOf(",") cost = # (Backgrounds) 15G per set, 7G per individual - if ~path.indexOf('background.') # FIXME, store prices of things in content.coffee instead of hard-coded here? + if ~path.indexOf('background.') # FIXME, store prices of things in content/index.coffee instead of hard-coded here? if fullSet then 3.75 else 1.75 # (Skin, hair, etc) 5G per set, 2G per individual else diff --git a/test/common/user.fns.buy.test.js b/test/common/user.fns.buy.test.js index be07d69a91..c79d5ea828 100644 --- a/test/common/user.fns.buy.test.js +++ b/test/common/user.fns.buy.test.js @@ -6,7 +6,7 @@ var _ = require('lodash'); require('coffee-script'); var shared = require('../../common/script/index.coffee'); -var Content = require('../../common/script/content.coffee'); +var Content = require('../../common/script/content/index.coffee'); describe('user.fns.buy', function() { var user; diff --git a/website/src/routes/apiv2.coffee b/website/src/routes/apiv2.coffee index 22babced8f..396747fcf4 100644 --- a/website/src/routes/apiv2.coffee +++ b/website/src/routes/apiv2.coffee @@ -302,7 +302,7 @@ module.exports = (swagger, v2) -> method: 'POST' description: "Casts a spell on a target." parameters: [ - path 'spell',"The key of the spell to cast (see ../../common#content.coffee)",'string' + path 'spell',"The key of the spell to cast (see ../../common#content/index.coffee)",'string' query 'targetType',"The type of object you're targeting",'string',['party','self','user','task'] query 'targetId',"The ID of the object you're targeting",'string'