Skip to content

Commit

Permalink
Merge pull request #55 from MichelBen/Cof_V9
Browse files Browse the repository at this point in the history
add COF system support version 9
  • Loading branch information
mclemente authored Sep 28, 2022
2 parents ceab681 + 30b64cf commit 1db5e75
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 1 deletion.
22 changes: 22 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@

"DND5E": {
"Traits": "Traits"
},

"cof": {
"attributes": {
"melee": {
"abbrev": "Cont"
},
"ranged": {
"abbrev": "Rang"
},
"magic": {
"abbrev": "Mag"
},
"size": {
"label": "Size",
"abbrev": "Size"
},
"level": {
"label": "Level",
"abbrev": "NLvl"
}
}
}
}
}
72 changes: 72 additions & 0 deletions lang/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"party-overview": {
"EnablePlayerAccess": {
"Name": "Donner accès à l'overview aux joueurs ?",
"Hint": "Permet de donner accès à la fenêtre Party aux joueurs."
},
"SystemProvider": {
"Name": "System Provider",
"choices": {
"module": "Module {name}",
"native": "Generic",
"system": "System {name}"
}
},
"filter": {
"0": "Tout (Scène, non filtré)",
"1": "Tout (Scène)",
"2": "Caché (Scène)",
"3": "Tous ceux possédés",
"4": "Tous ceux sélectionnés"
},
"keybinds": {
"open": {
"name": "Ouvrir Party Overview",
"hint": "Ouvre Party Overview."
},
"close": {
"name": "Fermer Party Overview",
"hint": "Ferme Party Overview."
},
"toggle": {
"name": "Bascule Party Overview",
"hint": "Ouvre ou ferme Party Overview."
}
},
"GENERAL": "Général",
"LIMIT": "Limite",
"NAME": "Nom",
"SKILLS": "Talents",
"PROFICIENCIES": "Compétences",
"TOTAL": "Total",
"WEALTH": "Richesse",
"EXPERIENCE": "Experience",
"XP": "XP",

"DND5E": {
"Traits": "Traitx"
},

"cof": {
"attributes": {
"melee": {
"abbrev": "Cont"
},
"ranged": {
"abbrev": "Dist"
},
"magic": {
"abbrev": "Mag"
},
"size": {
"label": "Taille",
"abbrev": "Taille"
},
"level": {
"label": "Niveau",
"abbrev": "Niv"
}
}
}
}
}
5 changes: 5 additions & 0 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
"lang": "ja",
"name": "日本語",
"path": "lang/ja.json"
},
{
"lang": "fr",
"name": "Français",
"path": "lang/fr.json"
}
],
"esmodules": ["party-overview.js"],
Expand Down
66 changes: 66 additions & 0 deletions module/SystemProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,7 @@ export class CoC7Provider extends SystemProvider {
};
}
}

export class GURPSProvider extends SystemProvider {
get template() {
return "/modules/party-overview/templates/gurps.hbs";
Expand Down Expand Up @@ -1444,3 +1445,68 @@ export class GURPSProvider extends SystemProvider {
return 750;
}
}

export class cofSystemProvider extends SystemProvider {
get width() {
return 600;
}
getActorDetails(actor) {
const data = actor.data.data;
return {
id: actor.id ?? "not found",

// general
// name_label : game.i18n.localize("COF.details.name"),
name: actor.name ?? "not found",
profileName: actor.data.items.find((item) => item.type === "profile")?.name,
speciesName: actor.data.items.find((item) => item.type === "species")?.name,
size: data.details.size,
level: data.level?.value ?? "not found",

// xp : data.xp.value??"not found",
// xp_label : game.i18n.localize("COF.attributes.xp.label"),
// xp_abbrev : game.i18n.localize("COF.attributes.xp.abbrev"),

// tab "stats
hp: data.attributes?.hp ?? "not found",
hd: data.attributes?.hd ?? "not found", // dè de vie
str: data.stats?.str ?? "not found",
dex: data.stats?.dex ?? "not found",
con: data.stats?.con ?? "not found",
int: data.stats?.int ?? "not found",
wis: data.stats?.wis ?? "not found",
cha: data.stats?.cha ?? "not found",

// tab Attack
melee: data.attacks?.melee ?? "not found",
ranged: data.attacks?.ranged ?? "not found",
magic: data.attacks?.magic ?? "not found",
init: data.attributes?.init ?? "not found",
def: data.attributes?.def ?? "not found",
dr: data.attributes?.dr ?? "not found", // dommage reduce
rp: data.attributes?.rp ?? "not found",
fp: data.attributes?.fp ?? "not found", // points de chance
mp: data.attributes?.mp ?? "not found", // points de mana

// tab currency
pp: data.currency?.pp ?? "not found",
gp: data.currency?.gp ?? "not found",
sp: data.currency?.sp ?? "not found",
cp: data.currency?.cp ?? "not found",

xpLevel: actor.xp?.level?.value ?? "not found",
};
}

get tabs() {
return {
stats: { id: "stats", visible: true, localization: "COF.tabs.stats" },
attacks: { id: "attack", visible: true, localization: "COF.tabs.combat" },
currency: { id: "currency", visible: true, localization: "COF.category.currency" },
};
}

get template() {
return "/modules/party-overview/templates/cof.hbs";
}
}
6 changes: 5 additions & 1 deletion module/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// prettier-ignore
import { SystemProvider, archmageProvider, bitdProvider, dccProvider, dnd35eProvider, dnd4eProvider, dnd5eProvider, pf1Provider, pf2eProvider,
scumAndVillainyProvider, sfrpgProvider, swadeProvider, tormenta20Provider, wfrp4eProvider, cyphersystemProvider, CoC7Provider, GURPSProvider} from "./SystemProvider.js";
scumAndVillainyProvider, sfrpgProvider, swadeProvider, tormenta20Provider, wfrp4eProvider, cyphersystemProvider, CoC7Provider, GURPSProvider,
cofsystemProvider} from "./SystemProvider.js";

export const availableSystemProviders = {};
export let currentSystemProvider = undefined;
Expand Down Expand Up @@ -91,6 +92,9 @@ export function initApi() {
case "gurps":
systemProviders.push(new GURPSProvider("native.gurps"));
break;
case "cof":
systemProviders.push(new cofSystemProvider("native.cof"));
break;
default:
systemProviders.push(new SystemProvider("native"));
break;
Expand Down
126 changes: 126 additions & 0 deletions templates/cof.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<div>
{{> "modules/party-overview/templates/parts/Tabs.html"}}
<section class="content">
<!-- GENERAL : ======================================= -->
<div class="tab" data-tab="general" data-group="party">
<div class="table-row header">
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
<div class="text">{{ localize "COF.details.name" }}</div>
<div class="text">{{ localize "ITEM.TypeProfile"}}</div>
<div class="text">{{ localize "ITEM.TypeSpecies"}}</div>
<div class="text">{{ localize "COF.details.size"}}</div>
<div class="text">{{ localize "COF.attributes.level.label"}}</div>
</div>

{{#each actors as | actor | }}
<div class="table-row">
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="text">{{ actor.name }}</div>
<div class="text">{{ actor.profileName }}</div>
<div class="text">{{ actor.speciesName }}</div>
<div class="text">{{ actor.size }}</div>
<div class="text">{{ level }}</div>
</div>
{{/each}}
</div>
<!-- stat ======================================= -->
<div class="tab" data-tab="stats" data-group="party">
<div class="table-row header">
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
<div class="text">{{ localize "COF.details.name" }}</div>
<div class="num" title="{{ localize "COF.attributes.hp.label"}}" style="background-color:#44a12b; color:white;"><i class="fas fa-heart"></i></div>
<div class="num" title="{{ localize "COF.stats.str.label" }}" style="background-color:#003c1e; color:white;">{{ localize "COF.stats.str.abbrev" }}</div>
<div class="num" title="{{ localize "COF.stats.dex.label" }}" style="background-color:#003c1e; color:white;">{{ localize "COF.stats.dex.abbrev" }}</div>
<div class="num" title="{{ localize "COF.stats.con.label" }}" style="background-color:#003c1e; color:white;">{{ localize "COF.stats.con.abbrev" }}</div>
<div class="num" title="{{ localize "COF.stats.int.label" }}" style="background-color:#003c1e; color:white;">{{ localize "COF.stats.int.abbrev" }}</div>
<div class="num" title="{{ localize "COF.stats.wis.label" }}" style="background-color:#003c1e; color:white;">{{ localize "COF.stats.wis.abbrev" }}</div>
<div class="num" title="{{ localize "COF.stats.cha.label" }}" style="background-color:#003c1e; color:white;">{{ localize "COF.stats.cha.abbrev" }}</div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>
</div>

{{#each actors as | actor | }}
<div class="table-row">
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="text">{{ actor.name }}</div>
<div class="num">{{ actor.hp.value }}/{{ actor.hp.max }}</div>
<div class="num">{{ actor.str.value }}</div>
<div class="num">{{ actor.dex.value }}</div>
<div class="num">{{ actor.con.value }}</div>
<div class="num">{{ actor.int.value }}</div>
<div class="num">{{ actor.wis.value }}</div>
<div class="num">{{ actor.cha.value }}</div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>
</div>
{{/each}}
</div>
<!-- ATTACK ======================================= -->
<div class="tab" data-tab="attack" data-group="party">
<div class="table-row header">
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
<div class="text">{{ localize "COF.details.name" }}</div>
<div class="num" title="{{ localize "COF.attacks.melee.label" }}" style="background-color:#cd071e; color:white;">{{ localize "party-overview.cof.attributes.melee.abbrev" }}</div>
<div class="num" title="{{ localize "COF.attacks.ranged.label" }}" style="background-color:#cd071e; color:white;">{{ localize "party-overview.cof.attributes.ranged.abbrev" }}</div>
<div class="num" title="{{ localize "COF.attacks.magic.label" }}" style="background-color:#cd071e; color:white;">{{ localize "party-overview.cof.attributes.magic.abbrev" }}</div>
<div class="num" title="{{ localize "COF.attributes.init.label"}}" style="background-color:#cd071e; color:white;">{{ localize "COF.attributes.init.abbrev"}}</div>
<div class="num" title="{{ localize "COF.attributes.def.label" }}" style="background-color:#009ee0; color:white;">{{ localize "COF.attributes.def.abbrev" }}</div>
<div class="num" title="{{ localize "COF.attributes.dr.label" }}" style="background-color:#009ee0; color:white;">{{ localize "COF.attributes.dr.abbrev" }}</div>
<div class="num" title="{{ localize "COF.attributes.rp.label" }}" style="background-color:#44a12b; color:white;">{{ localize "COF.attributes.rp.abbrev" }}</div>
<div class="num" title="{{ localize "COF.attributes.mp.label" }}" style="background-color:darkslategray; color:white;">{{ localize "COF.attributes.mp.abbrev" }}</div>
<div class="num" title="{{ localize "COF.attributes.fp.label" }}" style="background-color:darkslategray; color:white;">{{ localize "COF.attributes.fp.abbrev" }}</div>

</div>

{{#each actors as | actor | }}
<div class="table-row">
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="text">{{ actor.name }}</div>
<div class="num">{{ actor.melee.mod }}</div>
<div class="num">{{ actor.ranged.mod }}</div>
<div class="num">{{ actor.magic.mod }}</div>
<div class="num">{{ actor.init.value }}</div>
<div class="num">{{ actor.def.value }}</div>
<div class="num">{{ actor.dr.value }}</div>
<div class="num">{{ actor.rp.value }}</div>
<div class="num">{{ actor.mp.value }}</div>
<div class="num">{{ actor.fp.value }}</div>
</div>
{{/each}}
</div>

<!-- Argent ======================================= -->
<div class="tab" data-tab="currency" data-group="party">
<div class="table-row header">
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
<div class="text">{{ localize "COF.details.name" }}</div>
<div class="num" title="{{ actors.0.pp_label}}"><i class="fas fa-coins" style="color:dimgray"></i></div>
<div class="num" title="{{ actors.0.gp_label}}"><i class="fas fa-coins" style="color:goldenrod"></i></div>
<div class="num" title="{{ actors.0.sp_label}}"><i class="fas fa-coins" style="color:silver"></i></div>
<div class="num" title="{{ actors.0.cp_label}}"><i class="fas fa-coins" style="color:saddlebrown"></i></div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>
</div>

{{#each actors as | actor | }}
<div class="table-row">
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="text">{{ actor.name }}</div>
<div class="num">{{ actor.pp.qty }}</div>
<div class="num">{{ actor.gp.qty }}</div>
<div class="num">{{ actor.sp.qty }}</div>
<div class="num">{{ actor.cp.qty }}</div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>
<div class="num" >&nbsp;</div>

</div>
{{/each}}
</div>
</section>
</div>

0 comments on commit 1db5e75

Please sign in to comment.