Skip to content

Commit

Permalink
Support for Roll method indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
drewg13 committed Jun 11, 2024
1 parent 0a03869 commit 4881b99
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,7 @@ v1.9.4 Fix Trauma tooltip z-indexing
2.3.0 Updates for V12, EOL for V10/V11 support, deprecation fixes, planet and clock texture fixes

2.3.1 Re-enable V11 support (most of those changes were unexpectedly back-compatible!), add setting for exposing the Actor name fields on Faction Status sheets, fix logic for assigning default Token art

2.3.2 Use getDefaultArtwork for assigning default img instead

2.4.0 Add support for Roll method indicators
8 changes: 7 additions & 1 deletion module/sav-roll.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ async function showChatRollMessage(r, zeromode, attribute_name = "", position =
let speaker = ChatMessage.getSpeaker();
if( speaker_name ) { speaker.alias = speaker_name }
let rolls = (r.terms)[0].results;
let method = {};
method.type = (r.terms)[0].method;
if( method.type ) {
method.icon = CONFIG.Dice.fulfillment.methods[method.type].icon;
method.label = CONFIG.Dice.fulfillment.methods[method.type].label;
}
let attribute_label;
if( attribute_name === "fortune"){
attribute_label = game.i18n.localize("BITD.Fortune");
Expand Down Expand Up @@ -98,7 +104,7 @@ async function showChatRollMessage(r, zeromode, attribute_name = "", position =
effect_localize = 'BITD.EffectStandard'
}

let result = await renderTemplate("systems/scum-and-villainy/templates/sav-roll.html", {rolls: rolls, roll_status: roll_status, attribute_label: attribute_label, position: position, position_localize: position_localize, effect: effect, effect_localize: effect_localize, stress_result_display: stress_result_display, vice_result: vice_result, zeromode: zeromode, purpose: purpose});
let result = await renderTemplate("systems/scum-and-villainy/templates/sav-roll.html", {rolls: rolls, method: method, roll_status: roll_status, attribute_label: attribute_label, position: position, position_localize: position_localize, effect: effect, effect_localize: effect_localize, stress_result_display: stress_result_display, vice_result: vice_result, zeromode: zeromode, purpose: purpose});

let messageData = {
speaker: speaker,
Expand Down
5 changes: 5 additions & 0 deletions styles/sav.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion system.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"url": "#{URL}#",
"flags": {
"hotReload": {
"extensions": ["css", "html", "json", "js"]
"extensions": ["css", "html", "json", "js"],
"paths": ["module", "templates", "lang", "styles"]
}
},
"version": "#{VERSION}#",
Expand Down
15 changes: 10 additions & 5 deletions templates/sav-roll.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,16 @@

<ol class="dice-rolls">
{{#each this.rolls}}
{{#if this.result}}
<li class="roll die savd6"{{#if (eq this.result 6)}} style="color: var(--holoblue);"{{/if}}{{#if (lteq this.result 3)}} style="color: red;"{{/if}}{{#if (eq this.result 4)}} style="color: var(--almost_white);"{{/if}}{{#if (eq this.result 5)}} style="color: var(--almost_white);"{{/if}}>{{{this.result}}}</li>
{{else}}
<li class="roll die savd6"{{#if (eq this.roll 6)}} style="color: var(--holoblue);"{{/if}}{{#if (lteq this.roll 3)}} style="color: red;"{{/if}}{{#if (eq this.result 4)}} style="color: var(--almost_white);"{{/if}}{{#if (eq this.result 5)}} style="color: var(--almost_white);"{{/if}}>{{{this.roll}}}</li>
{{/if}}
{{#if this.result}}
<li class="roll die savd6"{{#if (eq this.result 6)}} style="color: var(--holoblue);"{{/if}}{{#if (lteq this.result 3)}} style="color: red;"{{/if}}{{#if (eq this.result 4)}} style="color: var(--almost_white);"{{/if}}{{#if (eq this.result 5)}} style="color: var(--almost_white);"{{/if}}>{{{this.result}}}</li>
{{else}}
<li class="roll die savd6"{{#if (eq this.roll 6)}} style="color: var(--holoblue);"{{/if}}{{#if (lteq this.roll 3)}} style="color: red;"{{/if}}{{#if (eq this.result 4)}} style="color: var(--almost_white);"{{/if}}{{#if (eq this.result 5)}} style="color: var(--almost_white);"{{/if}}>{{{this.roll}}}</li>
{{/if}}
{{/each}}
{{#if @root.method}}
{{#unless (eq @root.method.type "mersenne")}}
<li class="roll method" data-tooltip="{{localize @root.method.label}}">{{{ @root.method.icon }}}</li>
{{/unless}}
{{/if}}
</ol>
</div>

0 comments on commit 4881b99

Please sign in to comment.