Skip to content

Commit

Permalink
v1.14.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
drewg13 committed Oct 30, 2021
1 parent 6ecd430 commit 7e4046b
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,5 @@ v1.9.4 Fix Trauma tooltip z-indexing
1.13.1 Clean up Universe sheet

1.13.2 Updates for V9d1, simplified NPC sheet, remove item logic fields and functions

1.14.0 Adds chat notifications for changes to Ship resources
27 changes: 26 additions & 1 deletion module/sav-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class SaVHelpers {
static async addDefaultAbilities(item_data, actor) {

let def_abilities = item_data.data.def_abilities || {};

let abil_list = def_abilities.split(', ');
let item_type = "";
let items_to_add = [];
Expand Down Expand Up @@ -226,5 +226,30 @@ export class SaVHelpers {

}

/* -------------------------------------------- */

/**
* Creates a chat notification on a resource change
*
* @param {string} actor
* actor on which change occurred
* @param {string} resource
* localized resource name
* @param {int} oldValue
* original resource value
* @param {int} newValue
* new resource value
*/
static chatNotify( actor, resource, oldValue, newValue ) {
let change;
if ( newValue > oldValue ) {
change = '+' + String (newValue - oldValue);
} else {
change = String (newValue - oldValue);
}
let color = newValue >= oldValue ? 'green' : 'red'
let message = `<div class="resource-chat-notification">${actor}<table><tr><td>${resource}</td><td class="value">${oldValue}</td><td class="arrow"><i class="fas fa-arrow-right"></i></td><td class="value"><span class="${color}">${newValue}</span></td><td><span class="small">(${change})</span></td></tr></table></div>`;
ChatMessage.create({content: message});
}

}
26 changes: 26 additions & 0 deletions module/sav-ship-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,32 @@ export class SaVShipSheet extends SaVSheet {
item?.sheet.render(true, {"renderContext": "xp"});
});

html.find('.coins').click(ev => {
let actor = this.actor.name;
let newValue = ev.target.value;
let oldValue, resource;
switch( ev.target.name ) {
case "data.coins": {
resource = game.i18n.localize("BITD.Coin");
oldValue = this.actor.data.data.coins;
break;
}
case "data.debt": {
resource = game.i18n.localize("BITD.Debt");
oldValue = this.actor.data.data.debt;
break;
}
case "data.gambits.value": {
resource = game.i18n.localize("BITD.Gambits");
oldValue = this.actor.data.data.gambits.value;
break;
}
}
if ( resource !== undefined ) {
SaVHelpers.chatNotify(actor, resource, oldValue, newValue);
}
})

// manage active effects
html.find(".effect-control").click(ev => onManageActiveEffect(ev, this.actor));
}
Expand Down
18 changes: 18 additions & 0 deletions styles/sav.css

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

4 changes: 2 additions & 2 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"authors": ["megastruktur", "Andrew Garinger [agaringer#6498]"],
"url": "https://github.com/drewg13/foundryvtt-scum-and-villainy/",
"flags": {},
"version": "1.13.2",
"version": "1.14.0",
"minimumCoreVersion": "0.7.9",
"compatibleCoreVersion": "9.226",
"system": [],
"dependencies": [],
"socket": false,
"manifest": "https://raw.githubusercontent.com/drewg13/foundryvtt-scum-and-villainy/master/system.json",
"download": "https://github.com/drewg13/foundryvtt-scum-and-villainy/archive/v1.13.2.zip",
"download": "https://github.com/drewg13/foundryvtt-scum-and-villainy/archive/v1.14.0.zip",
"protected": false,
"scripts": [],
"esmodules": [
Expand Down

0 comments on commit 7e4046b

Please sign in to comment.