Skip to content

Commit

Permalink
added the skeleton of a D&D 3.5 system, with some data.
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgul committed Dec 11, 2024
1 parent 496d1d5 commit 1ccd1ce
Show file tree
Hide file tree
Showing 23 changed files with 1,331 additions and 2,733 deletions.
201 changes: 201 additions & 0 deletions src/common/models/systems/dnd35.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
//----------------------------------------------------------------------------------------------------------------------
// Dungeons and Dragons 3.5 Models
//----------------------------------------------------------------------------------------------------------------------

import { Supplement } from '../supplement.js';

//----------------------------------------------------------------------------------------------------------------------

export interface Dnd35Race extends Supplement
{
id : number;
name : string;
size : 'T' | 'S' | 'M' | 'L' | 'H' | 'G';
speed ?: number;
description ?: string;
traits : {
name : string;
description : string;
}[];
}

export interface Dnd35Class extends Supplement
{
id : number;
name : string;
description ?: string;
features : {
name : string;
type ?: string;
description : string;
}[];
}

export interface Dnd35Feat extends Supplement
{
id : number;
name : string;
prerequisite ?: string;
benefit ?: string;
normal ?: string;
special ?: string;
}

export interface Dnd35Spell extends Supplement
{
id : number;
name : string;
school : string;
subSchool ?: string;
typeDescriptor ?: string;
level : {
level : number;
class : string;
}[];
components : string[];
castingTime : string;
range : string;
target ?: string;
effect ?: string;
area ?: string;
duration ?: string;
savingThrow ?: string;
spellResistance ?: string;
description ?: string;
arcaneFocus ?: string;
}

export interface DnD35SystemDetails
{
id : string;
classes : {
classID : string;
level : number;
}[];
raceID ?: string;
age ?: number;
height ?: string;
gender ?: 'M' | 'F' | 'O';
alignment ?: 'LG' | 'NG' | 'CG' | 'LN' | 'N' | 'CN' | 'LE' | 'NE' | 'CE';
speed ?: number;
languages : string[];
strength ?: number;
dexterity ?: number;
constitution ?: number;
intelligence ?: number;
wisdom ?: number;
charisma ?: number;
hp ?: {
max : number;
nonlethal : number;
current : number;
temp : number;
};
damageReduction : {
amount : number;
type : string;
}[];
baseAttackBonus ?: number;
spellResistance ?: number;
attacks : {
name : string;
attackBonus : number;
damage : number;
critical : string;
range : string;
type : string;
ammunition : number;
notes : string;
}[];
experience ?: number;
wealth ?: number;
skills : {
name : string;
ability : 'strength' | 'dexterity' | 'constitution' | 'intelligence' | 'wisdom' | 'charisma';
ranks : number;
armorPenalty ?: boolean;
untrained ?: boolean;
hidden ?: boolean;
}[];
bonuses : {
name : string;
type : string;
value : number;
source ?: string;
stacks ?: boolean;
}[];
feats : {
featID : string;
notes ?: string;
}[];
specialAbilities : {
name : string;
type ?: string;
description : string;
source : string;
notes ?: string;
}[];
spells : {
spellID : string;
preparations ?: number;
notes ?: string;
}[];
spellSave ?: number;
spellFailure ?: number;
spellLevels : {
level : number;
spellsKnown ?: number;
spellsPerDay ?: number;
spellSaveDC ?: number;
bonusSpells ?: number;
}[];
armor ?: {
name ?: string;
acBonus ?: number;
maxDex ?: number;
checkPenalty ?: number;
spellFailure ?: number;
speed ?: number;
weight ?: number;
special ?: string;
};
shield ?: {
name ?: string;
acBonus ?: number;
maxDex ?: number;
checkPenalty ?: number;
spellFailure ?: number;
special ?: string;
};
protectiveItem1 ?: {
name ?: string;
acBonus ?: number;
weight ?: number;
special ?: string;
};
protectiveItem2 ?: {
name ?: string;
acBonus ?: number;
weight ?: number;
special ?: string;
};
items : {
name : string;
price ?: number;
weight ?: number;
}[];
rolls : {
name : string;
expression : string;
}[];
notes : {
name : string;
content : string;
}[];
conditions : {
condition : string;
duration ?: string;
}[];
}

//----------------------------------------------------------------------------------------------------------------------
110 changes: 110 additions & 0 deletions src/server/knex/migrations/20241211013146_dnd35.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
//----------------------------------------------------------------------------------------------------------------------
// D&D 3.5 DB Tables
//----------------------------------------------------------------------------------------------------------------------

import type { Knex } from 'knex';

//----------------------------------------------------------------------------------------------------------------------

export async function up(knex : Knex) : Promise<Knex.QueryBuilder>
{
await knex.schema.createTable('dnd35_reference', (table) =>
{
table.string('name').primary();
table.string('abbr').notNullable()
.unique()
.index();
table.string('product_code');
});

await knex.schema.createTable('dnd35_class', (table) =>
{
table.increments('id').primary();
table.string('name').notNullable();
table.text('description');
table.jsonb('features').notNullable();
table.text('reference').notNullable();
table.boolean('official').notNullable()
.defaultTo(false);
table.integer('owner');
table.string('scope')
.notNullable()
.defaultTo('user');
});

await knex.schema.createTable('dnd35_race', (table) =>
{
table.increments('id').primary();
table.string('name').notNullable();
table.string('size').notNullable();
table.integer('speed');
table.text('description');
table.jsonb('traits').notNullable();
table.text('reference').notNullable();
table.boolean('official').notNullable()
.defaultTo(false);
table.integer('owner');
table.string('scope')
.notNullable()
.defaultTo('user');
});

await knex.schema.createTable('dnd35_feat', (table) =>
{
table.increments('id').primary();
table.string('name').notNullable();
table.text('prerequisite');
table.text('benefit');
table.text('normal');
table.text('special');
table.text('reference').notNullable();
table.boolean('official').notNullable()
.defaultTo(false);
table.integer('owner');
table.string('scope')
.notNullable()
.defaultTo('user');
});

await knex.schema.createTable('dnd35_spell', (table) =>
{
table.increments('id').primary();
table.string('name').notNullable();
table.string('school').notNullable();
table.string('subSchool');
table.string('typeDescriptor');
table.jsonb('level').notNullable();
table.jsonb('components').notNullable();
table.string('castingTime').notNullable();
table.string('range').notNullable();
table.string('target');
table.string('effect');
table.string('area');
table.string('duration');
table.string('savingThrow');
table.string('spellResistance');
table.text('description');
table.string('arcaneFocus');
table.text('reference').notNullable();
table.boolean('official').notNullable()
.defaultTo(false);
table.integer('owner');
table.string('scope')
.notNullable()
.defaultTo('user');
});
}

//----------------------------------------------------------------------------------------------------------------------

export async function down(knex : Knex) : Promise<Knex.QueryBuilder>
{
await knex.schema.dropTable('dnd35_reference');
await knex.schema.dropTable('dnd35_class');
await knex.schema.dropTable('dnd35_race');
await knex.schema.dropTable('dnd35_feat');
await knex.schema.dropTable('dnd35_spell');
}

//----------------------------------------------------------------------------------------------------------------------

Loading

0 comments on commit 1ccd1ce

Please sign in to comment.