2014-05-19 17:20:50 -04:00
|
|
|
CocoModel = require './CocoModel'
|
2014-06-16 08:27:16 -04:00
|
|
|
utils = require '../lib/utils'
|
2014-05-19 17:20:50 -04:00
|
|
|
|
|
|
|
module.exports = class Achievement extends CocoModel
|
|
|
|
@className: 'Achievement'
|
|
|
|
@schema: require 'schemas/models/achievement'
|
2014-05-24 14:45:53 -04:00
|
|
|
urlRoot: '/db/achievement'
|
|
|
|
|
2014-05-26 12:21:56 -04:00
|
|
|
isRepeatable: ->
|
2014-06-17 15:42:27 -04:00
|
|
|
@get('proportionalTo')?a
|
2014-06-03 06:40:47 -04:00
|
|
|
|
|
|
|
# TODO logic is duplicated in Mongoose Achievement schema
|
|
|
|
getExpFunction: ->
|
2014-06-14 14:12:17 -04:00
|
|
|
kind = @get('function')?.kind or jsonschema.properties.function.default.kind
|
|
|
|
parameters = @get('function')?.parameters or jsonschema.properties.function.default.parameters
|
2014-06-12 13:39:45 -04:00
|
|
|
return utils.functionCreators[kind](parameters) if kind of utils.functionCreators
|