Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
v 0.2.3
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
rinnocenti committed Feb 1, 2021
1 parent 99dc266 commit 6a2095a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# v0.2.2
# v.0.2.3
* Bug fix in individual currency values.
* Log errors for live token and mistake for looting self token.

# v.0.2.2

* Support for multiple currency values drawn in roll tables
* Suport for avoid equipped items
Expand Down
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"noToken": "No token is targeted",
"novalidLoot": " not a valid Loot",
"invalidDistance": "The maximum distance for this interaction is: {dist} grids",
"invalidCheck": "{token} already been looted"
"invalidCheck": "{token} already been looted",
"isalive": "The target is alive!",
"thesame": "the looting token is the same as the loot token"
},
"Looting.Settings": {
"percentWeapon": "Weapons Loot (%)",
Expand Down
3 changes: 2 additions & 1 deletion lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"noToken": "Nenhum token esta marcado como alvo",
"novalidLoot": " não é um baú válido",
"invalidDistance": "A distancia minima para esta interação é: {dist} quadros",
"invalidCheck": "{token} já foi pilhado"
"invalidCheck": "{token} já foi pilhado",
"isalive": "O alvo ainda esta vivo!"
},
"Looting.Settings": {
"percentWeapon": "Pilhagem de Armas (%)",
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Innocenti Looting",
"description": "<p>Modules for loot from monsters and Npcs</p>",
"author": "Renato innocenti",
"version": "0.2.2",
"version": "0.2.3",
"minimumCoreVersion": "0.7.0",
"compatibleCoreVersion": "0.7.9",
"systems": [ "dnd5e" ],
Expand Down
4 changes: 0 additions & 4 deletions packs/item-currency.db

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions scripts/ActionLoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ActionLoot {
async Check() {
for (let entity of this.targets) {
//this.targets.map(entity => {
if (entity.id == canvas.tokens.controlled[0].id) return;
if (entity.id == canvas.tokens.controlled[0].id) return ui.notifications.warn(game.i18n.localize('Looting.Errors.thesame'));
if (this.CheckDistance(entity) != true) return;
this.data.targetid = entity.id;
let titleChat = "";
Expand All @@ -39,6 +39,7 @@ export class ActionLoot {
if (entity.getFlag(SETTINGS.MODULE_NAME, SETTINGS.LOOT)) return ui.notifications.warn(game.i18n.format("Looting.Errors.invalidCheck", { token: entity.name })); // já foi lootiado.
await this.LootNPC(entity.actor, this.actor);
} else {
ui.notifications.warn(game.i18n.localize('Looting.Errors.isalive'))
// vivo - Roubar
if (entity.actor.getFlag(SETTINGS.MODULE_LOOT_SHEET, SETTINGS.LOOT_SHEET)) return; // não é um bau ou mercador.
//this.AttempPickpocket(entity.actor, this.actor);
Expand Down Expand Up @@ -101,7 +102,10 @@ export class ActionLoot {
} else if (game.settings.get(SETTINGS.MODULE_NAME, "lootSystem") == "mode3") {

}
await tokenactor.createEmbeddedEntity("OwnedItem", this.loots);
this.loots.map(a => {
a._data.data.equipped = false;
});
await tokenactor.createEmbeddedEntity("OwnedItem", this.loots, { noHook: true });
await tokenactor.update({ "data.currency": this.data.currency });
}

Expand Down Expand Up @@ -132,15 +136,14 @@ export class ActionLoot {
let agio = (game.settings.get(SETTINGS.MODULE_NAME, "lootEquipable")) ? game.settings.get(SETTINGS.MODULE_NAME, "lootEquipableAgil") : 0;
// weapon equipment consumable
if (!game.settings.get(SETTINGS.MODULE_NAME, "lootEquipable") && item.data.data.equipped) return;
item._data.data.equipped = false;
if (item.type === "weapon") {
if (item.data.data.weaponType == "siege" || item.data.data.weaponType == "natural") return;
if (!check && (Math.floor(Math.random() * 100) + 1) <= game.settings.get(SETTINGS.MODULE_NAME, "perWeapons") + agio) return;
item.data.data.equipped = false;
if (!check && (Math.floor(Math.random() * 100) + 1) <= game.settings.get(SETTINGS.MODULE_NAME, "perWeapons") + agio) return;
}
if (item.type === "equipment") {
if (item.data.data.equipmentType == "vehicle" || item.data.data.equipmentType == "natural") return;
if (!check && (Math.floor(Math.random() * 100) + 1) <= game.settings.get(SETTINGS.MODULE_NAME, "perEquipment") + agio) return;
item.data.data.equipped = false;
}
if (item.type === "consumable") {
if (!check && (Math.floor(Math.random() * 100) + 1) <= game.settings.get(SETTINGS.MODULE_NAME, "perConsumable") + agio) return;
Expand All @@ -149,7 +152,8 @@ export class ActionLoot {
//if (this.ConvertItens2Coins(item)) return;
let matches = item.name.match(/\([a-z]{1,2}\)$/gs);
if (matches) {
this.ConvertItens2Coins(coin, item);
this.ConvertItens2Coins(matches, item);
return;
}
let tmatches = item.name.match(/Table:([\w\s\S]+)/gis);
if (tmatches) {
Expand Down Expand Up @@ -205,8 +209,8 @@ export class ActionLoot {
}
}
}
console.log("items", nItems);
console.log(this.lootCurrency);
//console.log("items", nItems);
//console.log(this.lootCurrency);
return nItems;
}

Expand All @@ -223,7 +227,7 @@ export class ActionLoot {
ResultChat(titleChat, items, targetName, currency) {
let title = titleChat + '- ' + targetName;
let table_content = ``;
console.log(currency)
//console.log(currency)
//console.log("result chat", items);
for (let item of items) {
table_content += `<div><img src="${item.img}" height="35px"/> ${item.name} <div>`;
Expand Down

0 comments on commit 6a2095a

Please sign in to comment.