Skip to content

Commit

Permalink
version 1.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
p4535992 committed Apr 9, 2023
1 parent c0abf3c commit fdead2a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 24 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## Changelog
### 1.0.11

- Some bug fix

### 1.0.10

- Removed lazuHp Feature
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "lazymoney",
"title": "Lazy Money",
"description": "Easily add or remove currency with automatic conversion and no overdraft.",
"version": "1.0.10",
"version": "1.0.11",
"main": "main.js",
"scripts": {
"publish": "gulp publish --update",
Expand Down
6 changes: 3 additions & 3 deletions src/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "lazymoney",
"title": "Lazy Money",
"description": "Easily add or remove currency with automatic conversion and no overdraft.",
"version": "1.1.10",
"version": "1.1.11",
"authors": [
{
"name": "DeVelox",
Expand Down Expand Up @@ -70,8 +70,8 @@
"url": "https://github.com/p4535992/foundryvtt-lazymoney-dnd5e",
"manifest": "https://github.com/p4535992/foundryvtt-lazymoney-dnd5e/releases/latest/download/module.json",
"download": "https://github.com/p4535992/foundryvtt-lazymoney-dnd5e/releases/latest/download/module.zip",
"readme": "https://github.com/p4535992/foundryvtt-lazymoney-dnd5e/blob/v1.1.10/README.md",
"changelog": "https://github.com/p4535992/foundryvtt-lazymoney-dnd5e/blob/v1.1.10/CHANGELOG.md",
"readme": "https://github.com/p4535992/foundryvtt-lazymoney-dnd5e/blob/v1.1.11/README.md",
"changelog": "https://github.com/p4535992/foundryvtt-lazymoney-dnd5e/blob/v1.1.11/CHANGELOG.md",
"bugs": "https://github.com/p4535992/foundryvtt-lazymoney-dnd5e/issues",
"allowBugReporter": true,
"relationships": {
Expand Down
69 changes: 49 additions & 20 deletions src/scripts/lazymoney.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,35 @@ function _onChangeCurrency(ev) {
break;
}
}
} else {
switch (sign) {
case signCase.add: {
newAmount[denom] = money[denom] + delta;
chatLog(actor, `${game.user?.name} on ${actor.name} has added ${delta} ${denom}.`);
break;
}
case signCase.subtract: {
newAmount[denom] = money[denom] - delta;
chatLog(actor, `${game.user?.name} on ${actor.name} has removed ${delta} ${denom}.`);
break;
}
case signCase.equals: {
newAmount[denom] = money[denom];
chatLog(
actor,
`${game.user?.name} on ${actor.name} has replaced ${money[denom]} ${denom} with ${delta} ${denom}.`
);
break;
}
default: {
newAmount[denom] = money[denom];
chatLog(
actor,
`${game.user?.name} on ${actor.name} has replaced ${money[denom]} ${denom} with ${delta} ${denom}.`
);
break;
}
}
}
if (Object.keys(newAmount).length > 0) {
sheet.submitOnChange = false;
Expand Down Expand Up @@ -659,24 +688,24 @@ export function applyLazyMoney(app, html, actorData) {
);
}

Hooks.on("preUpdateActor", function (actorEntity, update, options, userId) {
if (!game.settings.get(CONSTANTS.MODULE_NAME, "enable")) {
return;
}
// The module already do the job so for avoid redundance...
if (game.modules.get("lazymoney")?.active) {
return;
}
if (!actorEntity) {
return;
}
// Hooks.on("preUpdateActor", function (actorEntity, update, options, userId) {
// if (!game.settings.get(CONSTANTS.MODULE_NAME, "enable")) {
// return;
// }
// // The module already do the job so for avoid redundance...
// if (game.modules.get("lazymoney")?.active) {
// return;
// }
// if (!actorEntity) {
// return;
// }

if (hasProperty(update, "system.currency")) {
const currency = getProperty(update, "system.currency");
if (isEmptyObject(currency)) {
// Do nothing
} else {
update.system.currency = patchCurrency(update.system.currency);
}
}
});
// if (hasProperty(update, "system.currency")) {
// const currency = getProperty(update, "system.currency");
// if (isEmptyObject(currency)) {
// // Do nothing
// } else {
// update.system.currency = patchCurrency(update.system.currency);
// }
// }
// });

0 comments on commit fdead2a

Please sign in to comment.