Skip to content

Commit 92b0eb3

Browse files
committed
Hotfix /pay, /credit, and wounds/damage
fix #139 fix #138
1 parent 35c9d77 commit 92b0eb3

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

modules/actor/actor-wfrp4e.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,7 @@ export default class ActorWfrp4e extends Actor {
187187
if (data.flags.autoCalcWounds) {
188188
let wounds = this._calculateWounds()
189189
if (data.data.status.wounds.max != wounds) // If change detected, reassign max and current wounds
190-
{
191-
data.data.status.wounds.max = wounds;
192-
data.data.status.wounds.value = wounds;
193-
}
190+
this.update({"data.status.wounds.max" : wounds, "data.status.wounds.value" : wounds});
194191
}
195192

196193
if (data.flags.autoCalcSize) {

modules/hooks/actor.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,20 @@ export default function() {
3030

3131
// Treat the custom default token as a true default token
3232
// If you change the actor image from the default token, it will automatically set the same image to be the token image
33-
Hooks.on("preUpdateActor", (data, updatedData) => {
34-
if (data.data.token.img == "systems/wfrp4e/tokens/unknown.png" && updatedData.img) {
33+
Hooks.on("preUpdateActor", (actor, updatedData) => {
34+
if (actor.data.token.img == "systems/wfrp4e/tokens/unknown.png" && updatedData.img) {
3535
updatedData["token.img"] = updatedData.img;
36-
data.data.token.img = updatedData.img;
36+
actor.data.token.img = updatedData.img;
3737
}
3838
})
39+
40+
41+
Hooks.on("updateActor", (actor, updateData) => {
42+
if (actor.data.flags.autoCalcWounds)
43+
{
44+
let wounds = actor._calculateWounds()
45+
if (actor.data.data.status.wounds.max != wounds) // If change detected, reassign max and current wounds
46+
actor.update({"data.status.wounds.max" : wounds, "data.status.wounds.value" : wounds});
47+
}
48+
})
3949
}

modules/system/dice-wfrp4e.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ export default class DiceWFRP {
11141114
if (!game.user.isGM) {
11151115
let actor = game.user.character;
11161116
if ( actor ) {
1117-
money = MarketWfrp4e.payCommand($(event.currentTarget).attr("data-pay"), actor);
1117+
let money = MarketWfrp4e.payCommand($(event.currentTarget).attr("data-pay"), actor);
11181118
if (money) {
11191119
WFRP_Audio.PlayContextAudio({ item: { "type": "money" }, action: "lose" })
11201120
actor.updateEmbeddedEntity("OwnedItem", money);
@@ -1131,7 +1131,7 @@ export default class DiceWFRP {
11311131
let actor = game.user.character;
11321132
if ( actor ) {
11331133
let dataExchange = $(event.currentTarget).attr("data-amount");
1134-
money = MarketWfrp4e.creditCommand(dataExchange, actor);
1134+
let money = MarketWfrp4e.creditCommand(dataExchange, actor);
11351135
if (money) {
11361136
WFRP_Audio.PlayContextAudio({ item: { type: "money" }, action: "gain" })
11371137
actor.updateEmbeddedEntity("OwnedItem", money);

system.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "wfrp4e",
33
"title": "Warhammer Fantasy Roleplay 4th Edition",
44
"description": "A comprehensive system for running grim and perilious games of Warhammer Fantasy Role-play in the Foundry VTT environment.",
5-
"version": "3.0.1",
5+
"version": "3.0.2",
66
"author": "Moo Man, CatoThe1stElder",
77
"esmodules" : ["wfrp4e.js"],
88
"scripts": ["./libs/pixi-filters.js"],
@@ -38,6 +38,6 @@
3838
"templateVersion":2,
3939
"socket": true,
4040
"manifest" : "https://raw.githubusercontent.com/moo-man/WFRP4e-FoundryVTT/master/system.json",
41-
"download" : "https://github.com/moo-man/WFRP4e-FoundryVTT/releases/download/3.0.1/wfrp4e.zip",
41+
"download" : "https://github.com/moo-man/WFRP4e-FoundryVTT/releases/download/3.0.2/wfrp4e.zip",
4242
"url" : "https://github.com/moo-man/WFRP4e-FoundryVTT"
4343
}

0 commit comments

Comments
 (0)