From 6b14b820a637f26e9be9a8c9a00c3e8648c88fb9 Mon Sep 17 00:00:00 2001 From: Thaum Date: Wed, 25 Mar 2015 09:54:16 +0000 Subject: [PATCH] Added coin pouch as a default item for characters --- rpg-docs/Model/Inventory/Items.js | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/rpg-docs/Model/Inventory/Items.js b/rpg-docs/Model/Inventory/Items.js index a0bd679c..9287f807 100644 --- a/rpg-docs/Model/Inventory/Items.js +++ b/rpg-docs/Model/Inventory/Items.js @@ -66,3 +66,55 @@ makeChild(Items); //children of containers makeParent(Items, ['name', 'enabled']); //parents of effects and attacks Items.allow(CHARACTER_SUBSCHEMA_ALLOW); + +//give characters default items +Characters.after.insert(function (userId, char) { + if(Meteor.isServer){ + var containerId = Containers.insert({ + name: "Coin Pouch", + charId: char._id, + isCarried: true, + description: "A sturdy pouch for coins", + color: "d" + }); + Items.insert({ + name: "Gold piece", + plural: "Gold pieces", + charId: char._id, + quantity: 0, + weight: 0.02, + value: 1, + color: "n", + parent: { + id: containerId, + collection: "Containers" + } + }); + Items.insert({ + name: "Silver piece", + plural: "Silver pieces", + charId: char._id, + quantity: 0, + weight: 0.02, + value: 0.1, + color: "n", + parent: { + id: containerId, + collection: "Containers" + } + }); + Items.insert({ + name: "Copper piece", + plural: "Copper pieces", + charId: char._id, + quantity: 0, + weight: 0.02, + value: 1, + color: "n", + parent: { + id: containerId, + collection: "Containers" + } + }); + } +});