Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(character sheet): add basic actions list #22

Merged
merged 10 commits into from
Aug 23, 2024
17 changes: 3 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,10 @@ export default {
copy({
targets: [
{ src: 'src/system.json', dest: 'build' },
{ src: 'src/templates/*.hbs', dest: 'build/templates/' },
{
src: 'src/templates/actors/*.hbs',
dest: 'build/templates/actors/',
},
{
src: 'src/templates/roll/*.hbs',
dest: 'build/templates/roll/',
},
{
src: 'src/templates/item/dialog/*.hbs',
dest: 'build/templates/item/dialog/',
},
{ src: 'src/lang/*.json', dest: 'build/lang/' }
{ src: 'src/templates/**/*.hbs', dest: 'build/' },
{ src: 'src/lang/*.json', dest: 'build/' }
],
flatten: false
}),
],
};
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
type Mixin<
declare type Mixin<
MixinClass extends new (...args: any[]) => any,
BaseClass extends abstract new (...args: any[]) => any,
> = MixinClass & BaseClass;
> = BaseClass & MixinClass;

declare function _ClientDocumentMixin<
Schema extends foundry.abstract.DataModel = foundry.abstract.DataModel,
Parent extends foundry.abstract.Document | null = null,
BaseClass extends typeof foundry.abstract.Document<Schema, Parent>,
>(base: BaseClass): Mixin<ClientDocument, BaseClass>;
>(base: BaseClass): Mixin<BaseClass, typeof _ClientDocument>;

declare class _ClientDocument {
/**
* Lazily obtain a FormApplication instance used to configure this Document, or null if no sheet is available.
*/
get sheet(): Application | foundry.applications.api.ApplicationV2 | null;

declare class ClientDocument {
/**
* Apply transformations of derivations to the values of the source data object.
* Compute data fields whose values are not stored to the database.
Expand Down
2 changes: 1 addition & 1 deletion src/declarations/foundry/client/data/documents/actor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare class Actor<
public readonly name: string;
public readonly system: D;

get items(): I[];
get items(): Collection<I>;

public getRollData(): object;
}
2 changes: 2 additions & 0 deletions src/declarations/foundry/common/abstract/data.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ namespace foundry {
*/
get uuid(): string;

get id(): string;

/* --- Model permissions --- */

/**
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import COSMERE from './system/config';

import './style.scss';

import './system/util/handlebars';
import { preloadHandlebarsTemplates } from './system/util/handlebars';

import * as applications from './system/applications';
import * as dataModels from './system/data';
Expand All @@ -19,7 +19,7 @@ declare global {
}
}

Hooks.once('init', () => {
Hooks.once('init', async () => {
CONFIG.COSMERE = COSMERE;

CONFIG.Actor.dataModels = dataModels.actor.config;
Expand Down Expand Up @@ -48,4 +48,7 @@ Hooks.once('init', () => {
// @league-of-foundry-developers/foundry-vtt-types/src/foundry/client-esm/dice/terms/term.d.mts
// @ts-expect-error see note
CONFIG.Dice.rolls.push(dice.D20Roll);

// Load templates
await preloadHandlebarsTemplates();
});
147 changes: 129 additions & 18 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"ActionCosts": {
"Action": "Action",
"Reaction": "Reaction",
"FreeAction": "Free Action"
"FreeAction": "Free Action",
"Special": "Special"
},
"Attribute": {
"name": "Attribute",
Expand Down Expand Up @@ -150,6 +151,18 @@
"Type": {
"Humanoid": "Humanoid",
"Animal": "Animal"
},
"Sheet": {
"Actions": {
"label": "Actions"
},
"Inventory": {
"label": "Inventory",
"Item": {
"Quantity": "Quantity",
"Weight": "Weight"
}
}
}
},
"AttributeGroup": {
Expand All @@ -168,13 +181,42 @@
},
"Item": {
"Type": {
"Weapon": "Weapon",
"Armor": "Armor",
"Equipment": "Equipment",
"Ancestry": "Ancestry",
"Path": "Path",
"Talent": "Talent",
"Action": "Action"
"Weapon": {
"label": "Weapon",
"label_plural": "Weapons"
},
"Armor": {
"label": "Armor",
"label_plural": "Armor"
},
"Equipment": {
"label": "Equipment",
"label_plural": "Equipment"
},
"Ancestry": {
"label": "Ancestry",
"label_plural": "Ancestries"
},
"Path": {
"label": "Path",
"label_plural": "Paths"
},
"Talent": {
"label": "Talent",
"label_plural": "Talents"
},
"Action": {
"label": "Action",
"label_plural": "Actions"
},
"Trait": {
"label": "Trait",
"label_plural": "Traits"
},
"Injury": {
"label": "Injury",
"label_plural": "Injuries"
}
},
"Weapon": {
"Type": {
Expand Down Expand Up @@ -213,16 +255,29 @@
"Presentable": "Presentable"
}
},
"Action": {
"Type": {
"Basic": {
"label": "Basic Action",
"label_plural": "Basic Actions"
}
}
},
"Activation": {
"ConsumeType": {
"Resource": "Resource",
"Charge": "Charge",
"Item": "Item"
"Type": {
"Action": "Action",
"SkillTest": "Skill Test",
"Utility": "Utility"
},
"Resources": {
"Charge": {
"Singular": "Charge",
"Plural": "Charges"
"ConsumeType": {
"ActorResource": {
"Label": "Actor Resource"
},
"ItemResource": {
"Label": "Item Resource"
},
"Item": {
"Label": "Item"
}
}
},
Expand All @@ -238,14 +293,64 @@
"Death": "Death"
}
},
"DefaultFlavor": "[actor] uses their [item]"
"Resources": {
"Charge": {
"Singular": "Charge",
"Plural": "Charges"
},
"Use": {
"Singular": "Use",
"Plural": "Uses"
},
"Recharge": {
"PerScene": "Per scene"
}
},
"Equip": {
"Types": {
"Wear": {
"Label": "Worn"
},
"Hold": {
"Label": "Held"
}
},
"Hold": {
"MainHand": {
"Label": "Main Hand"
},
"OffHand": {
"Label": "Off Hand"
},
"TwoHanded": {
"Label": "Two Handed"
}
},
"Equip": {
"Label": "Equip"
},
"Unequip": {
"Label": "Unequip"
},
"Unequipped": {
"Label": "Unequipped"
}
},
"DefaultFlavor": "[actor] uses [item]"
},
"Attack": {
"Type": {
"Melee": "Melee",
"Ranged": "Ranged"
}
},
"DamageTypes": {
"Energy": "Energy",
"Impact": "Impact",
"Keen": "Keen",
"Spirit": "Spirit",
"Vital": "Vital"
"Vital": "Vital",
"Healing": "Healing"
}
},
"DICE": {
Expand All @@ -259,6 +364,11 @@
"None": "None",
"Advantage": "Advantage",
"Disadvantage": "Disadvantage"
},
"Damage": {
"Label": "Damage",
"Apply": "Apply",
"Graze": "Graze"
}
},
"DIALOG": {
Expand All @@ -272,6 +382,7 @@
"None": "None",
"Formula": "Formula",
"SkillTest": "Skill Test",
"Cost": "Cost",
"DistanceUnit": "ft.",
"Button": {
"Roll": "Roll",
Expand Down
11 changes: 11 additions & 0 deletions src/style.scss
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
@import './style/sheets/module.scss';
// @import './style/chat/module.scss';

@font-face {
font-family: 'cosmere-dingbats';
src: url("https://dl.dropboxusercontent.com/scl/fi/9909gen4fd0oveyzfposx/CosmereDingbats-Regular.otf?rlkey=ig6odq9hxyo1st8kt3ujp1czz&st=72qrads3&raw=1")
}

i.cosmere-icon {
font-family: 'cosmere-dingbats';
font-style: normal;
}
23 changes: 22 additions & 1 deletion src/style/sheets/actor/character.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
.label,
p {
text-align: center;
font-size: 10pt;
font-size: 8pt;
}
}

Expand All @@ -123,3 +123,24 @@
font-weight: normal;
}
}

.documents {
flex: 1;
display: flex;
flex-direction: row;

.favorites {
width: 33%;
}

.tabs {
flex: 1;
display: flex;
flex-direction: column;
align-items: unset;

.tab-body {
flex: 1;
}
}
}
Loading