Changed how levels are handled

This commit is contained in:
Thaum
2015-03-02 19:38:53 +00:00
parent 80d44ff310
commit 88dbaccfc5
14 changed files with 110 additions and 66 deletions

View File

@@ -433,8 +433,8 @@ Characters.helpers({
var mod = +getMod(this.attributeValue(attribute));
return 10 + mod;
},
level: function(){
xpLevel: function(){
var xp = this.experience();
var xpTable = [0, 300, 900, 2700, 6500, 14000, 23000, 34000, 48000, 64000,
85000, 100000, 120000, 140000, 165000, 195000, 225000, 265000,
@@ -447,6 +447,14 @@ Characters.helpers({
if(xp > 355000) return 20;
return 0;
},
level: function(){
var level = 0;
Classes.find({charId: this._id}).forEach(function(cls){
level += cls.level;
})
return level;
},
experience: function(){
var xp = 0;

View File

@@ -3,6 +3,7 @@ Classes = new Meteor.Collection("classes");
Schemas.Class = new SimpleSchema({
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
name: {type: String, trim: false},
level: {type: Number},
createdAt: {
type: Date,
autoValue: function() {
@@ -15,6 +16,7 @@ Schemas.Class = new SimpleSchema({
}
}
},
color: {type: String, allowedValues: _.pluck(colorOptions, "key"), defaultValue: "q"}
});
Classes.attachSchema(Schemas.Class);

View File

@@ -33,7 +33,7 @@ Schemas.Effect = new SimpleSchema({
type: {
type: String,
defaultValue: "editable",
allowedValues: ["editable", "feature", "level", "buff", "equipment", "racial", "inate"]
allowedValues: ["editable", "feature", "class", "buff", "equipment", "racial", "inate"]
},
//the id of the feature, buff or item that created this effect
sourceId: {

View File

@@ -1,9 +0,0 @@
Levels = new Meteor.Collection("levels");
Schemas.Level = new SimpleSchema({
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
classId: {type: String, regEx: SimpleSchema.RegEx.Id},
value: {type: Number}
});
Levels.attachSchema(Schemas.Level);