diff --git a/rpg-docs/.meteor/packages b/rpg-docs/.meteor/packages
index c6eeb581..af74137b 100644
--- a/rpg-docs/.meteor/packages
+++ b/rpg-docs/.meteor/packages
@@ -14,4 +14,6 @@ dburles:collection-helpers
reactive-var
cw4gn3r:jquery-event-drag
underscore
+aldeed:collection2
+aldeed:autoform
diff --git a/rpg-docs/.meteor/versions b/rpg-docs/.meteor/versions
index 1d900c5c..34f08f31 100644
--- a/rpg-docs/.meteor/versions
+++ b/rpg-docs/.meteor/versions
@@ -2,6 +2,9 @@ accounts-base@1.1.2
accounts-password@1.0.4
accounts-ui-unstyled@1.1.4
accounts-ui@1.1.3
+aldeed:autoform@3.2.0
+aldeed:collection2@2.2.0
+aldeed:simple-schema@1.0.3
application-configuration@1.0.3
autopublish@1.0.1
autoupdate@1.1.3
@@ -48,7 +51,9 @@ meteor@1.1.3
minifiers@1.1.2
minimongo@1.0.5
mobile-status-bar@1.0.1
+mongo-livedata@1.0.6
mongo@1.0.8
+mrt:moment@2.6.0
npm-bcrypt@0.7.7
observe-sequence@1.0.3
ordered-dict@1.0.1
diff --git a/rpg-docs/Model/Character/Characters.js b/rpg-docs/Model/Character/Characters.js
index 678fd8e5..e8ef9d4b 100644
--- a/rpg-docs/Model/Character/Characters.js
+++ b/rpg-docs/Model/Character/Characters.js
@@ -1,164 +1,18 @@
//set up the collection for characters
Characters = new Meteor.Collection("characters");
-var attributes = [
- {name: "strength"},
- {name: "dexterity"},
- {name: "constitution"},
- {name: "intelligence"},
- {name: "wisdom"},
- {name: "charisma"},
- {name: "hitPoints"},
- {name: "experience"},
- {name: "proficiencyBonus",
- add: [
- new Effect("Level 1", 2)
- ]
- },
- {name: "speed",
- add: [
- new Effect("Base Speed", 30)
- ]
- },
- {name: "armor",
- add: [
- new Effect("Base Armor Class", 10),
- new Effect("Dexterity Modifier", "skillMod skills.dexterityArmor")
- ]
- },
- {name: "weight"},
- {name: "weightCarried"},
- {name: "age"},
- {name: "ageRate"},
- {name: "level1SpellSlots"},
- {name: "level2SpellSlots"},
- {name: "level3SpellSlots"},
- {name: "level4SpellSlots"},
- {name: "level5SpellSlots"},
- {name: "level6SpellSlots"},
- {name: "level7SpellSlots"},
- {name: "level8SpellSlots"},
- {name: "level9SpellSlots"},
- {name: "ki"},
- {name: "sorceryPoints"},
- {name: "rages"}
-];
+Schemas.Character = new SimpleSchema({
+ strings: { type: Schemas.Strings },
+ attributes: { type: Schemas.Attributes },
+ skills: { type: Schemas.Skills },
+ vulerabilities: { type: Schemas.Vulnerabilities },
+ proficiencies: { type: Schemas.Proficiencies }
-var skills = [
- {skill: "strengthSave", ability: "strength"},
- {skill: "dexteritySave", ability: "dexterity"},
- {skill: "constitutionSave", ability: "constitution"},
- {skill: "intelligenceSave", ability: "intelligence"},
- {skill: "wisdomSave", ability: "wisdom"},
- {skill: "charismaSave", ability: "charisma"},
+ //TODO add permission stuff for owner, readers and writers
+ //TODO hit dice
+});
- {skill: "acrobatics", ability: "dexterity"},
- {skill: "animalHandling", ability: "wisdom"},
- {skill: "arcana",ability: "intelligence"},
- {skill: "athletics", ability: "strength"},
- {skill: "deception", ability: "charisma"},
- {skill: "history", ability: "intelligence"},
- {skill: "insight", ability: "wisdom"},
- {skill: "intimidation", ability: "charisma"},
- {skill: "investigation", ability: "intelligence"},
- {skill: "medicine", ability: "wisdom"},
- {skill: "nature", ability: "intelligence"},
- {skill: "perception", ability: "wisdom"},
- {skill: "performance", ability: "charisma"},
- {skill: "persuasion", ability: "charisma"},
- {skill: "religion", ability: "intelligence"},
- {skill: "sleightOfHand", ability: "dexterity"},
- {skill: "stealth", ability: "dexterity"},
- {skill: "survival", ability: "wisdom"},
-
- {skill: "initiative", ability: "dexterity"},
-
- {skill: "strengthAttack", ability: "strength", proficiency: 1},
- {skill: "dexterityAttack", ability: "dexterity", proficiency: 1},
- {skill: "constitutionAttack", ability: "constitution", proficiency: 1},
- {skill: "intelligenceAttack", ability: "intelligence", proficiency: 1},
- {skill: "wisdomAttack", ability: "wisdom", proficiency: 1},
- {skill: "charismaAttack", ability: "charisma", proficiency: 1},
- {skill: "rangedAttack", ability: "dexterity", proficiency: 1},
-
- {skill: "dexterityArmor", ability: "dexterity"}
-
-];
-
-//Plain text fields for the character
-var strings = [
- "name",
- "alignment",
- "gender",
- "race",
- "class",
- "description",
- "personality",
- "ideals",
- "bonds",
- "flaws",
- "backstory",
- "notes"
-];
-
-//Data structure for the character
-//no functions can be added to this constructor
-Character = function(owner){
- //attributes
- this.attributes = {};
- for(var i = 0, l = attributes.length; i < l; i++){
- this.attributes[attributes[i].name] = new Attribute(0);
- this.attributes[attributes[i].name].add = attributes[i].add || [];
- this.attributes[attributes[i].name].mul = attributes[i].mul || [];
- this.attributes[attributes[i].name].min = attributes[i].min || [];
- this.attributes[attributes[i].name].max = attributes[i].max || [];
- }
-
- //skills
- this.skills = {};
- for(var i = 0, l = skills.length; i < l; i++){
- this.skills[skills[i].skill] = new Skill(skills[i].ability);
- if(skills[i].proficiency)
- this.skills[skills[i].skill].proficiency.push(skills[i].proficiency);
- }
-
- this.deathSave = {
- pass : 0,
- fail: 0,
- canDeathSave: true
- };
-
- this.strings = {};
- for(var i = 0, l = strings.length; i < l; i++){
- this.strings[strings[i]] = "";
- };
-
- this.weaponProficiencies = [];
- this.toolProficiencies = [];
- this.languages = [];
-
- /*
- //anything that needs to be edited rather than added or removed
- //needs its own collection.
- this.hitDice = [];
-
- this.features = [];
-
- this.spells = [];
- */
-
- this.vulnerability = {};
- for(var i = 0, l = DamageTypes.length; i < l; i++){
- this.vulnerability[DamageTypes[i]] = new Attribute(1);
- this.vulnerability[DamageTypes[i]].min.push({name: "Resistance doesn't stack", value: 0.5});
- this.vulnerability[DamageTypes[i]].max.push({name: "Vulnerability doesn't stack", value: 2});
- }
-
- //admin
- this.owner = owner;
- this.readers = [];
- this.writers = [];
-}
+Characters.attachSchema(Schemas.Character);
//functions and calculated values go here
Characters.helpers({
@@ -266,8 +120,9 @@ Characters.helpers({
var mod = +getMod(this.attributeValue(attribute));
return 10 + mod;
},
-
+
pushEffects : function(effectName, effectsArray){
+ throw "this function is not implemented correctly for buffs->effects"
//check that the arguments are of the right for
check(effectName, String);
check(effectsArray, [{ _id: String, stat: String, value: Number}]);
@@ -286,6 +141,7 @@ Characters.helpers({
},
pullEffects : function(effectsArray){
+ throw "this function is not implemented correctly for buffs->effects"
//check that the arguments are of the right form
check(effectsArray, [{ _id: String, stat: String, value: Number}]);
@@ -322,4 +178,4 @@ getMod = function(score){
signedString = function(number){
return number > 0? "+" + number : "" + number;
-}
+}
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/Constructors/Attribute.js b/rpg-docs/Model/Character/Constructors/Attribute.js
deleted file mode 100644
index c5191954..00000000
--- a/rpg-docs/Model/Character/Constructors/Attribute.js
+++ /dev/null
@@ -1,12 +0,0 @@
-//Attributes are numerical values
-Attribute = function(base){
- //the unmodified value of the attribute
- //should be zero for most attributes after a long rest
- this.base = base;
- //effects of the form {name: "Ring of Protection", value: 1}
- this.add = []; //bonuses added to the attribute
- this.mul = []; //multipliers to the attribute (after adding bonuses)
- this.min = []; //effects setting the minimum value of the attribute
- this.max = []; //effects setting the maximum value of the attribute
- this.conditional = []; //conditional modifiers
-}
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/Constructors/Effect.js b/rpg-docs/Model/Character/Constructors/Effect.js
deleted file mode 100644
index 0057e648..00000000
--- a/rpg-docs/Model/Character/Constructors/Effect.js
+++ /dev/null
@@ -1,5 +0,0 @@
-Effect = function(stat, value){
- this.stat = stat;
- this.value = value;
- this._id = Random.id();
-}
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/Constructors/HitDice.js b/rpg-docs/Model/Character/Constructors/HitDice.js
deleted file mode 100644
index 4731a1c6..00000000
--- a/rpg-docs/Model/Character/Constructors/HitDice.js
+++ /dev/null
@@ -1,6 +0,0 @@
-HitDice = function(sides){
- this.sides = sides;
- this.bonus = 0;
- this.number = 0;
- this.max = 0;
-}
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/Constructors/Skill.js b/rpg-docs/Model/Character/Constructors/Skill.js
deleted file mode 100644
index 5d381e59..00000000
--- a/rpg-docs/Model/Character/Constructors/Skill.js
+++ /dev/null
@@ -1,18 +0,0 @@
-//Skills are bonuses to rolls: "+2" etc.
-//They are based off of some ability
-Skill = function(ability){
- //proficiencies of the form {name: "Jack of all Trades", value: 0.5}
- //only the highest is used
- this.proficiency = [];
- //ability name that this skill uses as base for roll
- this.ability = ability;
- this.add = [];
- this.mul = [];
- this.min = [];
- this.max = [];
- this.advantage = []; //effects granting advantage
- this.disadvantage = [];
- this.passiveAdd = []; //only added to passive checks
- this.fail = []; //all checks are failed
- this.conditional = []; //conditional modifiers
-}
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/Constructors/Spell.js b/rpg-docs/Model/Character/Constructors/Spell.js
deleted file mode 100644
index 4a15ebe2..00000000
--- a/rpg-docs/Model/Character/Constructors/Spell.js
+++ /dev/null
@@ -1,11 +0,0 @@
-Spell = function(name){
- this.name = name;
- this.level = 0;
- this.school = "";
- this.range = "";
- this.verbal = false;
- this.somatic = false;
- this.material = false;
- this.duration = "";
- this.description = "";
-}
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/SubSchemas/Attributes.js b/rpg-docs/Model/Character/SubSchemas/Attributes.js
new file mode 100644
index 00000000..d2c59b53
--- /dev/null
+++ b/rpg-docs/Model/Character/SubSchemas/Attributes.js
@@ -0,0 +1,50 @@
+Schemas.Attribute = new SimpleSchema({
+ //the unmodified value of the attribute
+ //should be zero for most attributes after a long rest
+ base: {
+ type: Number,
+ defaultValue: 0
+ },
+ //effect arrays
+ add: { type: [Schemas.Effect], defaultValue: [] },
+ mul: { type: [Schemas.Effect], defaultValue: [] },
+ min: { type: [Schemas.Effect], defaultValue: [] },
+ max: { type: [Schemas.Effect], defaultValue: [] },
+ conditional:{ type: [Schemas.Effect], defaultValue: [] }
+});
+
+Schemas.Attributes = new SimpleSchema({
+ strength: {type: Schemas.Attribute},
+ dexterity: {type: Schemas.Attribute},
+ constitution: {type: Schemas.Attribute},
+ intelligence: {type: Schemas.Attribute},
+ wisdom: {type: Schemas.Attribute},
+ charisma: {type: Schemas.Attribute},
+ hitPoints: {type: Schemas.Attribute},
+ experience: {type: Schemas.Attribute},
+ proficiencyBonus: {type: Schemas.Attribute},
+ speed: {type: Schemas.Attribute},
+ weight: {type: Schemas.Attribute},
+ weightCarried: {type: Schemas.Attribute},
+ age: {type: Schemas.Attribute},
+ ageRate: {type: Schemas.Attribute},
+ level1SpellSlots: {type: Schemas.Attribute},
+ level2SpellSlots: {type: Schemas.Attribute},
+ level3SpellSlots: {type: Schemas.Attribute},
+ level4SpellSlots: {type: Schemas.Attribute},
+ level5SpellSlots: {type: Schemas.Attribute},
+ level6SpellSlots: {type: Schemas.Attribute},
+ level7SpellSlots: {type: Schemas.Attribute},
+ level8SpellSlots: {type: Schemas.Attribute},
+ level9SpellSlots: {type: Schemas.Attribute},
+ ki: {type: Schemas.Attribute},
+ sorceryPoints: {type: Schemas.Attribute},
+ rages: {type: Schemas.Attribute},
+ armor: {type: Schemas.Attribute},
+ "armor.add": {
+ type: [Schemas.Effect],
+ defaultValue: [
+ new Effect("Dexterity Modifier", "skillMod skills.dexterityArmor")
+ ]
+ }
+});
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/SubSchemas/DeathSaves.js b/rpg-docs/Model/Character/SubSchemas/DeathSaves.js
new file mode 100644
index 00000000..17ac17d5
--- /dev/null
+++ b/rpg-docs/Model/Character/SubSchemas/DeathSaves.js
@@ -0,0 +1,18 @@
+Schemas.DeathSave = new SimpleSchema({
+ pass: {
+ type: Number,
+ min: 0,
+ max: 3,
+ defaultValue: 0
+ },
+ fail: {
+ type: Number,
+ min: 0,
+ max: 3,
+ defaultValue: 0
+ },
+ canDeathSave: {
+ type: Boolean,
+ defaultValue: true
+ }
+});
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/SubSchemas/Effect/Buff.js b/rpg-docs/Model/Character/SubSchemas/Effect/Buff.js
new file mode 100644
index 00000000..75c9eb6c
--- /dev/null
+++ b/rpg-docs/Model/Character/SubSchemas/Effect/Buff.js
@@ -0,0 +1,17 @@
+/*
+ * A buff becomes an effect when applied on a creature.
+ * It is the effect plus the stat to which it should be applied
+ */
+Schemas.Buff = new SimpleSchema({
+ stat: {
+ type: String
+ },
+ effect: {
+ type: Schemas.Effect
+ }
+});
+
+Buff = function(name, stat, value){
+ this.stat = stat;
+ this.effect = new Effect(name, value);
+};
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/SubSchemas/Effect/Effect.js b/rpg-docs/Model/Character/SubSchemas/Effect/Effect.js
new file mode 100644
index 00000000..698a9650
--- /dev/null
+++ b/rpg-docs/Model/Character/SubSchemas/Effect/Effect.js
@@ -0,0 +1,35 @@
+/*
+ * Effects are reason-value pairs attached to skills and abilities
+ * that modify their final value or presentation in some way
+ */
+Schemas.Effect = new SimpleSchema({
+ _id: {
+ type: String,
+ regEx: SimpleSchema.RegEx.Id,
+ autoValue: function(){
+ if(!isSet) return Random.id();
+ }
+ },
+ name: {
+ type: String
+ },
+ value: {
+ type: Number,
+ decimal: true,
+ optional: true
+ },
+ calculation: {
+ type: String,
+ optional: true
+ }
+});
+
+Effect = function(name, value){
+ this._id = Random.id();
+ this.name = name;
+ if (typeof value === "string"){
+ this.calculation = value;
+ } else if (typeof valye === "number"){
+ this.value = value;
+ }
+};
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/SubSchemas/Proficiencies b/rpg-docs/Model/Character/SubSchemas/Proficiencies
new file mode 100644
index 00000000..e229f836
--- /dev/null
+++ b/rpg-docs/Model/Character/SubSchemas/Proficiencies
@@ -0,0 +1,10 @@
+Schemas.Proficiency = new simpleSchema({
+ name: {type: String},
+ source: {type: String}
+})
+
+Schemas.Proficiencies = new SimpleSchema({
+ weapons: {type: [Schemas.Proficiency]},
+ tools: {type: [Schemas.Proficiency]},
+ languages: {type: [Schemas.Proficiency]}
+});
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/SubSchemas/Skills.js b/rpg-docs/Model/Character/SubSchemas/Skills.js
new file mode 100644
index 00000000..3377c047
--- /dev/null
+++ b/rpg-docs/Model/Character/SubSchemas/Skills.js
@@ -0,0 +1,159 @@
+Schemas.Skill = new SimpleSchema({
+ //attribute name that this skill used as base mod for roll
+ ability: { type: String, defaultValue: "" },
+ //multiplied by profBonus and added to base mod
+ //only highest value proficiency is used
+ proficiency: { type: [Schemas.Effect], defaultValue: [] },
+ //added to base mod
+ add: { type: [Schemas.Effect], defaultValue: [] },
+ //multiplied by base + adds
+ mul: { type: [Schemas.Effect], defaultValue: [] },
+ //lower bounds, highest used
+ min: { type: [Schemas.Effect], defaultValue: [] },
+ //upper bounds, lowest used
+ max: { type: [Schemas.Effect], defaultValue: [] },
+ //things giving advantage
+ advantage: { type: [Schemas.Effect], defaultValue: [] },
+ //things giving disadvantage
+ disadvantage: { type: [Schemas.Effect], defaultValue: [] },
+ //added to passive checks only
+ passiveAdd: { type: [Schemas.Effect], defaultValue: [] },
+ //things causing all rolls to fail
+ fail: { type: [Schemas.Effect], defaultValue: [] },
+ //things that only apply sometimes
+ conditional: { type: [Schemas.Effect], defaultValue: [] }
+});
+
+Schemas.Skills = new SimpleSchema({
+ //saves
+ strengthSave: {type: Schemas.Skill},
+ "strengthSave.ability": { type: String, defaultValue: "strength" },
+
+ dexteritySave: {type: Schemas.Skill},
+ "dexteritySave.ability": { type: String, defaultValue: "dexterity" },
+
+ constitutionSave:{type: Schemas.Skill},
+ "constitutionSave.ability": { type: String, defaultValue: "constitution" },
+
+ intelligenceSave:{type: Schemas.Skill},
+ "intelligenceSave.ability": { type: String, defaultValue: "intelligence" },
+
+ wisdomSave: {type: Schemas.Skill},
+ "wisdomSave.ability": { type: String, defaultValue: "wisdom" },
+
+ charismaSave: {type: Schemas.Skill},
+ "charismaSave.ability": { type: String, defaultValue: "charisma" },
+
+
+ //skill skills
+ acrobatics: {type: Schemas.Skill},
+ "acrobatics.ability": { type: String, defaultValue: "dexterity" },
+
+ animalHandling: {type: Schemas.Skill},
+ "animalHandling.ability": { type: String, defaultValue: "wisdom" },
+
+ arcana: {type: Schemas.Skill},
+ "arcana.ability": { type: String, defaultValue: "intelligence" },
+
+ athletics: {type: Schemas.Skill},
+ "athletics.ability": { type: String, defaultValue: "strength" },
+
+ deception: {type: Schemas.Skill},
+ "deception.ability": { type: String, defaultValue: "charisma" },
+
+ history: {type: Schemas.Skill},
+ "history.ability": { type: String, defaultValue: "intelligence" },
+
+ insight: {type: Schemas.Skill},
+ "insight.ability": { type: String, defaultValue: "wisdom" },
+
+ intimidation: {type: Schemas.Skill},
+ "intimidation.ability": { type: String, defaultValue: "charisma" },
+
+ investigation: {type: Schemas.Skill},
+ "investigation.ability": { type: String, defaultValue: "intelligence" },
+
+ medicine: {type: Schemas.Skill},
+ "medicine.ability": { type: String, defaultValue: "wisdom" },
+
+ nature: {type: Schemas.Skill},
+ "nature.ability": { type: String, defaultValue: "intelligence" },
+
+ perception: {type: Schemas.Skill},
+ "perception.ability": { type: String, defaultValue: "wisdom" },
+
+ performance: {type: Schemas.Skill},
+ "performance.ability": { type: String, defaultValue: "charisma" },
+
+ persuasion: {type: Schemas.Skill},
+ "persuasion.ability": { type: String, defaultValue: "charisma" },
+
+ religion: {type: Schemas.Skill},
+ "religion.ability": { type: String, defaultValue: "intelligence" },
+
+ sleightOfHand: {type: Schemas.Skill},
+ "sleightOfHand.ability": { type: String, defaultValue: "dexterity" },
+
+ stealth: {type: Schemas.Skill},
+ "stealth.ability": { type: String, defaultValue: "dexterity" },
+
+ survival: {type: Schemas.Skill},
+ "survival.ability": { type: String, defaultValue: "wisdom" },
+
+
+ //Mechanical Skills
+ initiative: {type: Schemas.Skill},
+ "initiative.ability": { type: String, defaultValue: "dexterity" },
+
+ strengthAttack: {type: Schemas.Skill},
+ "strengthAttack.ability": {type: String,defaultValue: "strength"},
+ "strengthAttack.proficiency": {
+ type: [Schemas.Effect],
+ defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
+ },
+
+ dexterityAttack: {type: Schemas.Skill},
+ "dexterityAttack.ability": { type: String, defaultValue: "dexterity" },
+ "dexterityAttack.proficiency": {
+ type: [Schemas.Effect],
+ defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
+ },
+
+ constitutionAttack: {type: Schemas.Skill},
+ "constitutionAttack.ability":{ type: String, defaultValue: "constitution" },
+ "constitutionAttack.proficiency": {
+ type: [Schemas.Effect],
+ defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
+ },
+
+ intelligenceAttack: {type: Schemas.Skill},
+ "intelligenceAttack.ability":{ type: String, defaultValue: "intelligence" },
+ "intelligenceAttack.proficiency": {
+ type: [Schemas.Effect],
+ defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
+ },
+
+ wisdomAttack: {type: Schemas.Skill},
+ "wisdomAttack.ability": { type: String, defaultValue: "wisdom" },
+ "wisdomAttack.proficiency": {
+ type: [Schemas.Effect],
+ defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
+ },
+
+ charismaAttack: {type: Schemas.Skill},
+ "charismaAttack.ability": { type: String, defaultValue: "charisma" },
+ "charismaAttack.proficiency": {
+ type: [Schemas.Effect],
+ defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
+ },
+
+ rangedAttack: {type: Schemas.Skill},
+ "rangedAttack.ability": { type: String, defaultValue: "dexterity" },
+ "rangedAttack.proficiency": {
+ type: [Schemas.Effect],
+ defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
+ },
+
+ dexterityArmor: {type: Schemas.Skill},
+ "dexterityArmor.ability": { type: String, defaultValue: "dexterity" }
+});
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/SubSchemas/Strings.js b/rpg-docs/Model/Character/SubSchemas/Strings.js
new file mode 100644
index 00000000..ad58247e
--- /dev/null
+++ b/rpg-docs/Model/Character/SubSchemas/Strings.js
@@ -0,0 +1,13 @@
+Schemas.Strings = new SimpleSchema({
+ name: { type: String, defaultValue: "" },
+ alignment: { type: String, defaultValue: "" },
+ gender: { type: String, defaultValue: "" },
+ race: { type: String, defaultValue: "" },
+ description:{ type: String, defaultValue: "" },
+ personality:{ type: String, defaultValue: "" },
+ ideals: { type: String, defaultValue: "" },
+ bonds: { type: String, defaultValue: "" },
+ flaws: { type: String, defaultValue: "" },
+ backstory: { type: String, defaultValue: "" },
+ notes: { type: String, defaultValue: "" },
+});
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/SubSchemas/Vulnerabilities.js b/rpg-docs/Model/Character/SubSchemas/Vulnerabilities.js
new file mode 100644
index 00000000..a4d2f34b
--- /dev/null
+++ b/rpg-docs/Model/Character/SubSchemas/Vulnerabilities.js
@@ -0,0 +1,24 @@
+Schemas.Vulnerability = _.extend({
+ "min.defaultValue": [
+ new Effect("Resistance doesn't stack", 0.5)
+ ],
+ "max.defaultValue": [
+ new Effect("Vulnerability doesn't stack", 2)
+ ]
+}, Schemas.Attribute);
+
+Schemas.Vulnerabilities = new SimpleSchema({
+ acid: {type: Schemas.Vulnerability},
+ bludgeoning:{type: Schemas.Vulnerability},
+ cold: {type: Schemas.Vulnerability},
+ fire: {type: Schemas.Vulnerability},
+ force: {type: Schemas.Vulnerability},
+ lightning: {type: Schemas.Vulnerability},
+ necrotic: {type: Schemas.Vulnerability},
+ piercing: {type: Schemas.Vulnerability},
+ poison: {type: Schemas.Vulnerability},
+ psychic: {type: Schemas.Vulnerability},
+ radiant: {type: Schemas.Vulnerability},
+ slashing: {type: Schemas.Vulnerability},
+ thunder: {type: Schemas.Vulnerability}
+});
\ No newline at end of file
diff --git a/rpg-docs/Model/Inventory/Containers.js b/rpg-docs/Model/Inventory/Containers.js
index cde2994d..c04a98e2 100644
--- a/rpg-docs/Model/Inventory/Containers.js
+++ b/rpg-docs/Model/Inventory/Containers.js
@@ -1,7 +1,10 @@
-Containers = new Meteor.Collection('containers');
+//set up the collection for containers
+Containers = new Meteor.Collection("containers");
-Container = function(name, owner){
- this.name = name;
- this.owner = owner;
- this.isCarried = true;
-};
\ No newline at end of file
+Schemas.Container = new SimpleSchema({
+ name: { type: String },
+ owner: { type: String, regEx: SimpleSchema.RegEx.Id},
+ isCarried: { type: Boolean }
+});
+
+Containers.attachSchema(Schemas.Container);
\ No newline at end of file
diff --git a/rpg-docs/Model/Inventory/Items.js b/rpg-docs/Model/Inventory/Items.js
index b2a310e7..b0ba3f4f 100644
--- a/rpg-docs/Model/Inventory/Items.js
+++ b/rpg-docs/Model/Inventory/Items.js
@@ -1,23 +1,26 @@
Items = new Meteor.Collection('items');
-Item = function(name, container){
- this.name = name;
- this.container = container;
- this.quantity = 1;
- this.weight = 0.0;
- //value in gold pieces
- this.value = 0;
- this.description = "";
- //is this item a coin, letter of credit, ect.
- this.tradeGood = false;
- this.stakcable = false;
- this.effects = [];
-}
+Schemas.Item = new SimpleSchema({
+ name: {type: String},
+ description:{type: String},
+ container: {type: String, regEx: SimpleSchema.RegEx.Id},
+ quantity: {type: Number, min: 0, defaultValue: 1},
+ weight: {type: Number, min: 0, defaultValue: 0, decimal: true},
+ value: {type: Number, min: 0, defaultValue: 0, decimal: true},
+ tradeGood: {type: Boolean, defaultValue: false},
+ stackable: {type: Boolean, defaultValue: false},
+ buffs: {type: [Schemas.Buff]}
+});
+
+Items.attachSchema(Schemas.Item);
Items.helpers({
totalValue: function(){
return this.value * this.quantity;
},
+ totalWeight: function(){
+ return this.weight * this.quantity;
+ },
pluralName: function(){
if(this.stackable && this.plural && this.quantity > 1){
return this.plural;
@@ -25,31 +28,4 @@ Items.helpers({
return this.name;
}
}
-});
-
-if(Meteor.isClient){
- Template.registerHelper("valueString", function(value){
- var resultArray = [];
- //sp
- var gp = Math.floor(value);
- if(gp > 0) resultArray.push(gp + "gp");
- //sp
- var sp = Math.floor(10 * (value % 1));
- if(sp > 0) resultArray.push(sp + "sp");
- //cp
- var cp = 10 * ((value * 10) % 1);
- cp = Math.round(cp * 1000) / 1000;
- if(cp > 0) resultArray.push(cp + "cp");
-
- //build string with correct spacing
- var result = "";
- for(var i = 0; i < resultArray.length; i++){
- //add a space between values
- if(i !== 0){
- result += " ";
- }
- result += resultArray[i];
- }
- return result;
- });
-}
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/rpg-docs/client/globalHelpers/valueString.js b/rpg-docs/client/globalHelpers/valueString.js
new file mode 100644
index 00000000..4b845ac6
--- /dev/null
+++ b/rpg-docs/client/globalHelpers/valueString.js
@@ -0,0 +1,24 @@
+Template.registerHelper("valueString", function(value){
+ var resultArray = [];
+ //sp
+ var gp = Math.floor(value);
+ if(gp > 0) resultArray.push(gp + "gp");
+ //sp
+ var sp = Math.floor(10 * (value % 1));
+ if(sp > 0) resultArray.push(sp + "sp");
+ //cp
+ var cp = 10 * ((value * 10) % 1);
+ cp = Math.round(cp * 1000) / 1000;
+ if(cp > 0) resultArray.push(cp + "cp");
+
+ //build string with correct spacing
+ var result = "";
+ for(var i = 0; i < resultArray.length; i++){
+ //add a space between values
+ if(i !== 0){
+ result += " ";
+ }
+ result += resultArray[i];
+ }
+ return result;
+});
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/textField/textField.js b/rpg-docs/client/views/character/textField/textField.js
index eeae2660..e91ffd11 100644
--- a/rpg-docs/client/views/character/textField/textField.js
+++ b/rpg-docs/client/views/character/textField/textField.js
@@ -31,7 +31,10 @@ Template.textField.events({
//TODO sanitise the html
var setter = {};
setter["strings."+this.field] = text;
- Characters.update(this.character._id, {$set: setter});
+ Characters.update(this.character._id, {$set: setter}, function(error, result) {
+ console.log(error);
+ console.log(result);
+ });
},
"click #textOutput": function(){
Template.instance().editing.set(true);
diff --git a/rpg-docs/client/views/home/home.html b/rpg-docs/client/views/home/home.html
index 562a9a94..5ff2521c 100644
--- a/rpg-docs/client/views/home/home.html
+++ b/rpg-docs/client/views/home/home.html
@@ -6,5 +6,5 @@
{{/each}}
-
+ {{> quickForm collection="Characters" id="insertCharacterForm" type="insert"}}
\ No newline at end of file
diff --git a/rpg-docs/Model/Character/Constructors/Conditions.js b/rpg-docs/lib/constants/Conditions.js
similarity index 100%
rename from rpg-docs/Model/Character/Constructors/Conditions.js
rename to rpg-docs/lib/constants/Conditions.js
diff --git a/rpg-docs/lib/constants/Schemas.js b/rpg-docs/lib/constants/Schemas.js
new file mode 100644
index 00000000..33163227
--- /dev/null
+++ b/rpg-docs/lib/constants/Schemas.js
@@ -0,0 +1 @@
+Schemas = {};
\ No newline at end of file
diff --git a/rpg-docs/Model/Utility/dice.js b/rpg-docs/lib/functions/dice.js
similarity index 100%
rename from rpg-docs/Model/Utility/dice.js
rename to rpg-docs/lib/functions/dice.js
diff --git a/rpg-docs/Model/Utility/evaluateString.js b/rpg-docs/lib/functions/evaluateString.js
similarity index 100%
rename from rpg-docs/Model/Utility/evaluateString.js
rename to rpg-docs/lib/functions/evaluateString.js
diff --git a/rpg-docs/Model/Utility/math.js b/rpg-docs/lib/functions/math.js
similarity index 100%
rename from rpg-docs/Model/Utility/math.js
rename to rpg-docs/lib/functions/math.js
diff --git a/rpg-docs/Model/Character/Utilities.js/pop.js b/rpg-docs/lib/functions/pop.js
similarity index 100%
rename from rpg-docs/Model/Character/Utilities.js/pop.js
rename to rpg-docs/lib/functions/pop.js