Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 953ea32
Author: Veilza <[email protected]>
Date:   Sun Sep 1 01:51:25 2024 -0500

    Fix XP tab appearing on SPC sheets

commit a255c70
Author: Veilza <[email protected]>
Date:   Sun Sep 1 01:04:11 2024 -0500

    Add alphabetical sorting as a setting

commit 3910539
Author: Veilza <[email protected]>
Date:   Sat Aug 31 22:15:41 2024 -0500

    Fix some errors that were coming up while making a new custom type while an actor sheet was open

commit e9fedbc
Author: Veilza <[email protected]>
Date:   Sat Aug 31 20:15:23 2024 -0500

    Add custom gift support

commit 465f012
Author: Veilza <[email protected]>
Date:   Sat Aug 31 17:37:04 2024 -0500

    Realised edges and pools were being done in the same loop

commit 1b01cf5
Author: Veilza <[email protected]>
Date:   Sat Aug 31 17:34:47 2024 -0500

    Perks don't have levels - so we only need to sort them alphabetically

commit 5e199be
Author: Veilza <[email protected]>
Date:   Sat Aug 31 17:28:53 2024 -0500

    Add custom edge functionality

commit ec34a87
Author: Veilza <[email protected]>
Date:   Sat Aug 31 13:57:44 2024 -0500

    Be a little smarter about power sorting

commit 04085b2
Author: Veilza <[email protected]>
Date:   Sat Aug 31 07:15:56 2024 -0500

    Fix an issue where discipline powers weren't sorting

commit 5ee2dd8
Merge: c561c1c 49862b3
Author: Veilza <[email protected]>
Date:   Sat Aug 31 06:11:55 2024 -0500

    Merge pull request #60 from WoD5E-Developers/prerelease-2

    More prerelease 2 fetures (wip)

commit c561c1c
Merge: d5965b6 b259914
Author: Veilza <[email protected]>
Date:   Mon Aug 26 01:04:14 2024 -0500

    Merge pull request #59 from WoD5E-Developers/prerelease-2

    Reduced filesize and improved sanity of storyteller menu code by 60%

commit d5965b6
Merge: 21e61a1 91212a7
Author: Veilza <[email protected]>
Date:   Sun Aug 25 17:29:56 2024 -0500

    Merge pull request #58 from WoD5E-Developers/prerelease-2

    Prerelease 2
  • Loading branch information
Veilza committed Sep 1, 2024
1 parent 49862b3 commit cde164d
Show file tree
Hide file tree
Showing 28 changed files with 650 additions and 479 deletions.
10 changes: 6 additions & 4 deletions display/shared/actors/parts/navbar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
<i class="fa-regular fa-chart-line"></i>
</div>
</div>
<div class="item" data-tab="experience" title="{{localize "WOD5E.Tabs.Experience"}}">
<div class="navicon">
<i class="fa-solid fa-file-contract"></i>
{{#ifnoteq actor.type 'spc'}}
<div class="item" data-tab="experience" title="{{localize "WOD5E.Tabs.Experience"}}">
<div class="navicon">
<i class="fa-solid fa-file-contract"></i>
</div>
</div>
</div>
{{/ifnoteq}}
<!-- Splat-specific tabs -->
{{#ifeq actor.type 'vampire'}}
<div class="item" data-tab="disciplines" title="{{localize "WOD5E.VTM.Disciplines"}}">
Expand Down
44 changes: 44 additions & 0 deletions display/ui/parts/storyteller-menu/custom-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,48 @@
</div>
</div>
</div>

<div class="config-category">
<h2>{{localize 'WOD5E.Settings.CustomEdges'}}</h2>
<div class="subcategory">
<p class="notes">{{localize 'WOD5E.Settings.CustomEdgesHint'}}</p>
<div class="grid grid-2col">
<div class="mod-header">{{localize 'WOD5E.Label'}}</div>
</div>
{{#each customEdges as |edge id|}}
<div class="customization-row grid grid-2col" data-type="edge" data-id="{{edge.id}}">
<div class="mod-label">
<i class="fas fa-trash remove-custom-button" data-type="edge" data-id="{{edge.id}}"></i>
<input type="text" class="label" placeholder="New Edge" value="{{edge.label}}">
</div>
</div>
{{/each}}
<div class="mod-footer">
<hr>
<div class="add-custom-button addition-button" data-type="edge">{{localize 'WOD5E.Settings.AddCustomEdge'}}</div>
</div>
</div>
</div>

<div class="config-category">
<h2>{{localize 'WOD5E.Settings.CustomGifts'}}</h2>
<div class="subcategory">
<p class="notes">{{localize 'WOD5E.Settings.CustomGiftsHint'}}</p>
<div class="grid grid-2col">
<div class="mod-header">{{localize 'WOD5E.Label'}}</div>
</div>
{{#each customGifts as |gift id|}}
<div class="customization-row grid grid-2col" data-type="gift" data-id="{{gift.id}}">
<div class="mod-label">
<i class="fas fa-trash remove-custom-button" data-type="gift" data-id="{{gift.id}}"></i>
<input type="text" class="label" placeholder="New Gift" value="{{gift.label}}">
</div>
</div>
{{/each}}
<div class="mod-footer">
<hr>
<div class="add-custom-button addition-button" data-type="gift">{{localize 'WOD5E.Settings.AddCustomGift'}}</div>
</div>
</div>
</div>
</div>
52 changes: 52 additions & 0 deletions display/ui/parts/storyteller-menu/modification-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,56 @@
</div>
</div>
</div>

<div class="config-category">
<h2>{{localize 'WOD5E.Settings.ModifiedEdges'}}</h2>
<div class="subcategory">
<p class="notes">{{localize 'WOD5E.Settings.ModifiedEdgesHint'}}</p>
<div class="grid grid-3col">
<div class="mod-header">{{localize 'WOD5E.HTR.Edge'}}</div>
<div class="mod-header">{{localize 'WOD5E.Settings.Rename'}}</div>
<div class="mod-header">{{localize 'WOD5E.Settings.Hidden'}}</div>
</div>
{{#each edgeModifications as |edge id|}}
<div class="modification-row grid grid-3col" data-type="edge" data-id="{{edge.id}}" data-label="{{edge.label}}">
<div class="mod-label">
<i class="fas fa-trash remove-mod-button" data-type="edge" data-id="{{edge.id}}"></i>
{{edge.label}}
</div>
<input type="text" class="mod-rename" placeholder="{{edge.label}}" value="{{edge.rename}}">
<input type="checkbox" data-type="edge" class="mod-hidden"{{#if edge.hidden}} checked{{/if}}/>
</div>
{{/each}}
<div class="mod-footer">
<hr>
<div class="add-mod-button addition-button" data-type="edge">{{localize 'WOD5E.Settings.AddEdgeModification'}}</div>
</div>
</div>
</div>

<div class="config-category">
<h2>{{localize 'WOD5E.Settings.ModifiedGifts'}}</h2>
<div class="subcategory">
<p class="notes">{{localize 'WOD5E.Settings.ModifiedGiftsHint'}}</p>
<div class="grid grid-3col">
<div class="mod-header">{{localize 'WOD5E.HTR.Gift'}}</div>
<div class="mod-header">{{localize 'WOD5E.Settings.Rename'}}</div>
<div class="mod-header">{{localize 'WOD5E.Settings.Hidden'}}</div>
</div>
{{#each giftModifications as |gift id|}}
<div class="modification-row grid grid-3col" data-type="gift" data-id="{{gift.id}}" data-label="{{gift.label}}">
<div class="mod-label">
<i class="fas fa-trash remove-mod-button" data-type="gift" data-id="{{gift.id}}"></i>
{{gift.label}}
</div>
<input type="text" class="mod-rename" placeholder="{{gift.label}}" value="{{gift.rename}}">
<input type="checkbox" data-type="gift" class="mod-hidden"{{#if gift.hidden}} checked{{/if}}/>
</div>
{{/each}}
<div class="mod-footer">
<hr>
<div class="add-mod-button addition-button" data-type="gift">{{localize 'WOD5E.Settings.AddGiftModification'}}</div>
</div>
</div>
</div>
</div>
55 changes: 10 additions & 45 deletions display/wta/actors/parts/gifts-rites.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
<div class="gift category">
<div class="flexrow item-header">
<div class="item-name">
{{gift.label}}
{{#if (ne key "rite")}}
{{gift.label}}
{{else}}
{{localize "WOD5E.WTA.Rites"}}
{{/if}}
</div>
<!-- Item controls for gift sections -->
<div class="item-controls">
Expand Down Expand Up @@ -55,7 +59,11 @@
<div class="gift category">
<div class="flexrow item-header">
<div class="item-name">
{{localize "WOD5E.WTA.StringGifts" string=gift.label}}
{{#if (ne key "rite")}}
{{localize "WOD5E.WTA.StringGifts" string=gift.label}}
{{else}}
{{localize "WOD5E.WTA.Rites"}}
{{/if}}
</div>
<!-- Item controls for gift power sections -->
<div class="item-controls">
Expand Down Expand Up @@ -101,49 +109,6 @@
</div>
{{/if}}
{{/each}}
<!-- Rites List -->
<div class="gift category">
<div class="flexrow item-header">
<div class="item-name">
{{localize "WOD5E.WTA.Rites"}}
</div>
<!-- Item controls for gift power sections -->
<div class="item-controls">
<!-- Add new gift power -->
<a class="item-control item-create" title="{{localize 'WOD5E.WTA.AddRite'}}" data-type="gift" data-subtype="rite">
<i class="fas fa-plus"></i>
</a>
</div>
</div>
{{#each actor.system.rites as |power key|}}
<div class="flexrow power item" data-item-id="{{power._id}}">
<div class="item-image">
<img src="{{power.img}}">
</div>
<div class="item-name">{{power.name}}</div>
<div class="item-controls">
<!-- Icon to edit the power -->
<a class="item-control item-edit" title="{{localize 'WOD5E.Edit'}}">
<i class="fas fa-edit"></i>
</a>
<!-- Icon to roll the power's dicepool -->
{{#if (isNotEmpty power.system.dicepool)}}
<a class="item-control rollable-item" data-item-uuid="{{power.uuid}}">
<i class="fa-solid fa-dice-d10"></i>
</a>
{{/if}}
<!-- Icon to display the power in chat -->
<a class="item-control item-chat" title="{{localize 'WOD5E.ItemsList.ShowToChat'}}">
<i class="fas fa-comment-alt"></i>
</a>
<!-- Icon to delete the power -->
<a class="item-control item-delete" title="{{localize 'WOD5E.Delete'}}">
<i class="fas fa-trash"></i>
</a>
</div>
</div>
{{/each}}
</div>
</div>
</div>
</div>
70 changes: 14 additions & 56 deletions system/actor/htr/hunter-actor-sheet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* global game, foundry, TextEditor, WOD5E, WOD5E */
/* global game, foundry */

import { WoDActor } from '../wod-v5-sheet.js'
import { prepareEdges, prepareEdgePowers } from './scripts/prepare-data.js'
import { _onAddEdge, _onRemoveEdge, _onEdgeToChat } from './scripts/edges.js'
import { _onToggleDespair } from './scripts/toggle-despair.js'

Expand Down Expand Up @@ -43,9 +44,6 @@ export class HunterActorSheet extends WoDActor {
// Prepare items
await this._prepareItems(data)

// Prepare edge data
data.actor.system.edges = await this._prepareEdgeData(data)

return data
}

Expand All @@ -58,69 +56,29 @@ export class HunterActorSheet extends WoDActor {
const actorData = sheetData.actor
const actor = this.actor

// Secondary variables
const edges = actor.system.edges

// Track whether despair is toggled on or not
if (actor.system.despair.value > 0) {
actorData.system.despairActive = true
}

for (const edgeType in edges) {
// Localize the edge name
edges[edgeType].label = WOD5E.api.generateLabelAndLocalize({ string: edgeType, type: 'edge' })

// Wipe old perks so they doesn't duplicate
edges[edgeType].perks = []

// Wipe old edge pools so they doesn't duplicate
edges[edgeType].pools = []
}
// Prepare edge data
actorData.system.edges = await prepareEdges(actorData)

// Iterate through items, allocating to containers
for (const i of sheetData.items) {
// Make sure the item is a perk and has an edge set
if (i.type === 'perk') {
if (i.system.edge !== undefined) {
edges[i.system.edge].perks.push(i)
}
} else if (i.type === 'edgepool') {
if (i.system.edge !== undefined) {
edges[i.system.edge].pools.push(i)
}
// Make sure the item is a perk and has a edge
if (i.type === 'perk' && actorData.system.edges[i.system.edge]) {
if (!actorData.system.edges[i.system.edge]?.perks) actorData.system.edge[i.system.edge].perks = []
// Append to edges list
actorData.system.edges[i.system.edge].perks.push(i)
} else if (i.type === 'edgepool' && actorData.system.edges[i.system.edge]) {
if (!actorData.system.edges[i.system.edge]?.pools) actorData.system.edges[i.system.edge].pools = []
actorData.system.edges[i.system.edge].pools.push(i)
}
}

return sheetData
}

// Handle edge data so we can display it on the actor sheet
async _prepareEdgeData (sheetData) {
const edges = sheetData.actor.system.edges

// Sort the edge containers by the level of the perk instead of by creation date
// and enrich any Edge/Perk descriptions
for (const edgeType in edges) {
// If there's perks for this Edge, then make sure it's visible and sort them
if (edges[edgeType].perks.length > 0) {
if (!edges[edgeType].visible) edges[edgeType].visible = true

edges[edgeType].perks = edges[edgeType].perks.sort(function (perk1, perk2) {
// If the levels are the same, sort alphabetically instead
if (perk1.system.level === perk2.system.level) {
return perk1.name.localeCompare(perk2.name)
}

// Sort by level
return perk1.system.level - perk2.system.level
})
}

// Enrich edge description
edges[edgeType].enrichedDescription = await TextEditor.enrichHTML(edges[edgeType].description)
}

return edges
// Sort edge perks
actorData.system.edges = await prepareEdgePowers(actorData.system.edges)
}

/* -------------------------------------------- */
Expand Down
Loading

0 comments on commit cde164d

Please sign in to comment.