Implemented Features and Items granting effects, actions, attacks and spells
This commit is contained in:
22
rpg-docs/lib/methods/spellUtils.js
Normal file
22
rpg-docs/lib/methods/spellUtils.js
Normal file
@@ -0,0 +1,22 @@
|
||||
Meteor.methods({
|
||||
updateSpell: function (charId, oldSpell, newSpell) {
|
||||
var selector = {_id: charId, "spells._id": oldSpell._id};
|
||||
var setter = {"spells.$": newSpell};
|
||||
Characters.update(
|
||||
selector,
|
||||
{ $set: setter }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
pullSpell = function(id, spell){
|
||||
var pullObject = {};
|
||||
pullObject["spells"] = {_id: spell._id};
|
||||
Characters.update(id, {$pull: pullObject });
|
||||
};
|
||||
|
||||
pushSpell = function(id, spell){
|
||||
var pushObject = {};
|
||||
pushObject["spells"] = spell;
|
||||
Characters.update(id, {$push: pushObject});
|
||||
};
|
||||
Reference in New Issue
Block a user