Refactor: Eliminate code duplication for currency conversion and item pricing
- Add static calculateItemValueSC() and getItemValueSC() helpers to MournbladeCYD2Utility to centralize currency conversion logic (1 PO = 100 SC, 1 PA = 10 SC) - Refactor computeRichesse() and computeValeurEquipement() in Actor to use shared helpers - Add localizeAllegiance Handlebars helper to display allegiance values localized (tous->Tous, chaos->Chaos, loi->Loi, betes->Bêtes, elementaires->Élémentaires) - Add joinPredilections helper to fix comma display after single Predilection - Create BaseItemWithPriceDataModel base class for items with pricing fields (prixpo, prixca, prixsc, rarete, quantite, equipped) - Update arme, equipement, protection, monnaie models to extend base class - Update actor-sheet and creature-sheet templates to use new helpers - Update partial-item-prix.hbs to display total item value in SC - Add item-base-sheet.hbs template for future item sheet inheritance Fixes: - Allegiance values now display properly localized in Dons & Pactes tabs - Predilections no longer show trailing comma with single entry - Equipment value totals now update correctly when items are added/modified - Currency conversion logic centralized and consistent across the system Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -273,11 +273,7 @@
|
||||
data-attr-key="tochoose">{{skill.name}}</a></span>
|
||||
|
||||
<span class="predilection-text">
|
||||
{{#each skill.system.predilections as |pred key|}}
|
||||
{{#if (and pred.acquise (not pred.used))}}
|
||||
{{pred.name}}{{#unless (eq key (subtract skill.system.predilections.length 1))}}, {{/unless}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{joinPredilections skill.system.predilections}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -336,7 +332,7 @@
|
||||
<li class="item flexrow " data-item-id="{{don._id}}" data-item-type="don">
|
||||
<img class="item-name-img" src="{{don.img}}" />
|
||||
<span class="item-name-label competence-name">{{don.name}}</span>
|
||||
<span class="item-field-label-short">{{don.system.allegeance}}</span>
|
||||
<span class="item-field-label-short">{{localizeAllegiance don.system.allegeance}}</span>
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control" data-action="editItem" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||
@@ -365,7 +361,7 @@
|
||||
<li class="item flexrow " data-item-id="{{pacte._id}}" data-item-type="pacte">
|
||||
<img class="item-name-img" src="{{pacte.img}}" />
|
||||
<span class="item-name-label competence-name">{{pacte.name}}</span>
|
||||
<span class="item-field-label-short">{{pacte.system.allegeance}}</span>
|
||||
<span class="item-field-label-short">{{localizeAllegiance pacte.system.allegeance}}</span>
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control" data-action="editItem" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||
|
||||
Reference in New Issue
Block a user