0.8.17 • Published 8 years ago

attribute-generator v0.8.17

Weekly downloads
9
License
MIT
Repository
-
Last release
8 years ago

Synopsis

A simple program to apply modifiers to json (items)

Code Example

var AttributeGenerator = require('attribute-generator');

var ItemArray = AttributeGenerator.ItemArray;
var Modifier = AttributeGenerator.Modifier;
var Item = AttributeGenerator.Item;

var shield = new Item("Shield", {
    name : "Ceramic Shield",
    armor : 5,
    durability : 15
});

var crackedMod = new Modifier("Cracked", {
    name : Modifier.Ops.Prepend("Cracked "),
    armor : Modifier.Ops.Subtract(2),
    durability : Modifier.Ops.Subtract(3)
});

shield.Apply(crackedMod);

console.log(shield.ExportItemObject());
console.log(crackedMod.Serialize());

{ key: 'Shield:Cracked',
  item: { name: 'Cracked Ceramic Shield', armor: 3, durability: 12 } }
{ mods:
   [ { name: 'name', operation: 'Prepend', value: 'Cracked ' },
     { name: 'armor', operation: 'Subtract', value: 2 },
     { name: 'durability', operation: 'Subtract', value: 3 } ],
  name: 'Cracked' }

Motivation

Installation

npm install attribute-generator

API Reference

// Items are JSON objects that can have modifiers applied to them

Tests

None yet /:

Contributors

Alexander Dines /w Black Tower Entertainment

License

MIT

0.8.17

8 years ago

0.8.16

8 years ago

0.8.15

8 years ago

0.8.14

9 years ago

0.8.13

9 years ago

0.8.12

9 years ago

0.8.11

9 years ago

0.8.10

9 years ago

0.8.9

9 years ago

0.8.8

9 years ago

0.8.7

9 years ago

0.8.6

9 years ago

0.8.5

9 years ago

0.8.3

9 years ago

0.8.2

9 years ago

0.8.1

9 years ago

0.0.8

9 years ago