Made character arrays of objects into their own collections

This commit is contained in:
Thaum
2015-01-28 10:20:23 +00:00
parent 80c2c3249d
commit 4f205eb970
8 changed files with 59 additions and 40 deletions

View File

@@ -1,13 +1,12 @@
Actions = new Meteor.Collection("actions");
/*
* Actions are given to a character by items and features
*/
Schemas.Action = new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: function(){
if(!this.isSet) return Random.id();
}
charId: {
type: String,
regEx: SimpleSchema.RegEx.Id
},
name: {
type: String
@@ -20,10 +19,10 @@ Schemas.Action = new SimpleSchema({
allowedValues: ["action, bonus, reaction, free"],
defaultValue: "action"
},
selfBuffs: {
type: [Schemas.Buff], defaultValue: []
},
selfAdjustments: {
//the immediate impact of doing this action (eg. -1 rages)
adjustments: {
type: [Schemas.Adjustment], defaultValue: []
}
});
});
Actions.attachSchema(Schemas.Action);

View File

@@ -1,13 +1,12 @@
Attacks = new Meteor.Collection("attacks");
/*
* Attacks are given to a character by items and features
*/
Schemas.Attack = new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: function(){
if(!this.isSet) return Random.id();
}
charId: {
type: String,
regEx: SimpleSchema.RegEx.Id
},
name: {
type: String
@@ -28,4 +27,6 @@ Schemas.Attack = new SimpleSchema({
allowedValues: ["acid", "bludgeoning", "cold", "fire", "force", "lightning", "necrotic",
"piercing", "poison", "psychic", "radiant", "slashing", "thunder"]
}
});
});
Attacks.attachSchema(Schemas.Attack);

View File

@@ -1,3 +1,5 @@
Buffs = new Meteor.Collection("buffs");
//buffs are temporary once applied and store things which expire and their expiry time
Schemas.Buff = new SimpleSchema({
//buff id
@@ -7,8 +9,13 @@ Schemas.Buff = new SimpleSchema({
autoValue: function(){
if(!this.isSet) return Random.id();
}},
charId: {
type: String,
regEx: SimpleSchema.RegEx.Id
},
//expiry time
expiry: { type: Number, optional: true},
duration: { type: Number }
});
Buffs.attachSchema(Schemas.Buff);

View File

@@ -180,17 +180,10 @@ Schemas.Character = new SimpleSchema({
dexterityArmor: {type: Schemas.Skill},
"dexterityArmor.ability": { type: String, defaultValue: "dexterity" },
//proficiencies
weaponsProficiencies: { type: [Schemas.Proficiency], defaultValue: [] },
toolsProficiencies: { type: [Schemas.Proficiency], defaultValue: [] },
languages: { type: [Schemas.Proficiency], defaultValue: [] },
//mechanics
actions: { type: [Schemas.Action], defaultValue: []},
deathSave: { type: Schemas.DeathSave },
time: { type: Number, min: 0, decimal: true, defaultValue: 0},
initiativeOrder:{ type: Number, min: 0, max: 1, decimal: true, defaultValue: 0},
buffs: { type: [Schemas.Buff], defaultValue: []}
initiativeRoll: { type: Number, min: 0, max: 1, decimal: true, defaultValue: 0},
//TODO add permission stuff for owner, readers and writers
//TODO add per-character settings
});

View File

@@ -0,0 +1,25 @@
Proficiencies = new Meteor.Collection("proficiencies");
Schemas.Proficiency = new SimpleSchema({
charId: {
type: String,
regEx: SimpleSchema.RegEx.Id
},
name: {
type: String
},
//indicates what type of thing proficiency originated from
type: {
type: String,
defaultValue: "editable",
allowedValues: ["editable", "feature", "buff", "equipment", "inate"]
},
//the id of the feature, buff or item that created this effect
sourceId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
optional: true
},
});
Proficiencies.attachSchema(Schemas.Proficiency);

View File

@@ -1,11 +1,7 @@
Spells = new Meteor.Collection("spells");
Schemas.Spell = new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: function(){
if(!isSet) return Random.id();
}
},
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
name: {type: String},
description:{type: String},
castingTime:{type: String},
@@ -19,4 +15,6 @@ Schemas.Spell = new SimpleSchema({
selfBuffs: {type: [Schemas.Buff], defaultValue: []},
level: {type: Number},
class: {type: String}
});
});
Spells.attachSchema(Schemas.Spell);

View File

@@ -22,4 +22,4 @@ Schemas.Adjustment = new SimpleSchema({
type: String,
optional: true
}
});
});

View File

@@ -1,4 +0,0 @@
Schemas.Proficiency = new SimpleSchema({
name: {type: String},
source: {type: String}
})