2.0.0-rc.2 • Published 4 months ago

coh-content-db v2.0.0-rc.2

Weekly downloads
4
License
Unlicense
Repository
github
Last release
4 months ago

coh-content-db

GitHub Actions Workflow Status Codecov GitHub Tag NPM Version GitHub License

City of Heroes Content Database

Installation

npm install coh-content-db

Usage

There are two ways to use this package; As a data provider, or a db consumer.

As a data provider

Data providers utilize the various -Data interfaces provided in this package to construct server group data packages that can be loaded into the db for consumption by DB consumers such as Badger.

For an example data package, see the coh-content-db-homecoming project.

Defining archetypes, map, badges, etc.

To define content, create a new instance using the appropriate Data interface and provide values for the required fields:

///test-badge.ts
import {BadgeData} from 'coh-content-db'

export const TEST_BADGE: BadgeData = {
    key: 'test-badge',
    type: 'ACHIEVEMENT',
    name: [{value: 'Test Badge'}, {alignment: 'P', value: 'My Badge for Praetorians'}],
    alignment: ['H', 'V', 'P'],
}

Then, create a ServerGroupData instance and load your content into the appropriate field.

import {ServerGroupData} from 'coh-content-db'
import {TEST_BADGE} from './test-badge'

export const TEST_SERVER_GROUP: ServerGroupData = {
    key: 'my-server-group',
    name: 'My Server Group',
    badges: [TEST_BADGE],
}

As a DB consumer

Create a new database instance, then load a server-group data pack, such as coh-content-db-homecoming:

import {CohContentDatabase} from 'coh-content-db';
import {Homecoming} from 'coh-content-db-homecoming';

const db = new CohContentDatabase();
db.loadServerGroupData(new Homecoming());

Once loaded, you can start retrieving the loaded data using the keys associated with the various content:

List loaded server groups:

db.listServerGroups();

Get a server group by key and list the badges:

const sg = db.getServerGroup("server-group-key");
for (const badge of sg.badges) {
    console.log(badge.key)
}

Publish

Tags matching the pattern v<X>.<Y>.<Z> will attempt to publish to npm (this can only be achieved by the package manager (n15g).

npm version 1.4.x
npm run push
2.0.0-rc.2

4 months ago

2.0.0-rc.1

4 months ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago