Move content to own directory

This commit is contained in:
Blade Barringer
2015-09-06 15:31:08 -05:00
parent 82030a50fb
commit b9bbc3f1ea
5 changed files with 9 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
_ = require 'lodash' _ = require 'lodash'
api = module.exports api = module.exports
moment = require 'moment' moment = require 'moment'
i18n = require './i18n.coffee' i18n = require '../i18n.coffee'
t = (string, vars) -> t = (string, vars) ->
func = (lang) -> func = (lang) ->
vars ?= {a: 'a'} vars ?= {a: 'a'}

View File

@@ -2,7 +2,7 @@
require('coffee-script'); require('coffee-script');
var _ = require('lodash'); var _ = require('lodash');
var content = require('./content.coffee'); var content = require('./content/index.coffee');
var DROP_ANIMALS = _.keys(content.pets); var DROP_ANIMALS = _.keys(content.pets);

View File

@@ -1,6 +1,6 @@
moment = require('moment') moment = require('moment')
_ = require('lodash') _ = require('lodash')
content = require('./content.coffee') content = require('./content/index.coffee')
i18n = require('./i18n.coffee') i18n = require('./i18n.coffee')
api = module.exports = {} api = module.exports = {}
@@ -923,7 +923,7 @@ api.wrap = (user, main=true) ->
item = if key is 'potion' then content.potion item = if key is 'potion' then content.potion
else if key is 'armoire' then content.armoire else if key is 'armoire' then content.armoire
else content.gear.flat[key] 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: 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) return cb?({code:401, message: "You can't buy this item"}) if item.canOwn? and !item.canOwn(user)
armoireResp = undefined armoireResp = undefined
@@ -980,8 +980,8 @@ api.wrap = (user, main=true) ->
buyQuest: (req, cb, analytics) -> buyQuest: (req, cb, analytics) ->
{key} = req.params {key} = req.params
item = content.quests[key] 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} 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.coffee)"}) unless item.category is 'gold' and item.goldValue 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 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) message = i18n.t('messageBought', {itemText: item.text(req.language)}, req.language)
user.items.quests[item.key] ?= 0 user.items.quests[item.key] ?= 0
@@ -1063,7 +1063,7 @@ api.wrap = (user, main=true) ->
fullSet = ~path.indexOf(",") fullSet = ~path.indexOf(",")
cost = cost =
# (Backgrounds) 15G per set, 7G per individual # (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 if fullSet then 3.75 else 1.75
# (Skin, hair, etc) 5G per set, 2G per individual # (Skin, hair, etc) 5G per set, 2G per individual
else else

View File

@@ -6,7 +6,7 @@ var _ = require('lodash');
require('coffee-script'); require('coffee-script');
var shared = require('../../common/script/index.coffee'); 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() { describe('user.fns.buy', function() {
var user; var user;

View File

@@ -302,7 +302,7 @@ module.exports = (swagger, v2) ->
method: 'POST' method: 'POST'
description: "Casts a spell on a target." description: "Casts a spell on a target."
parameters: [ 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 'targetType',"The type of object you're targeting",'string',['party','self','user','task']
query 'targetId',"The ID of the object you're targeting",'string' query 'targetId',"The ID of the object you're targeting",'string'