Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aliharu committed Jun 9, 2024
1 parent 28dfd5f commit 62aba86
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 25 deletions.
20 changes: 12 additions & 8 deletions module/actor/actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ export class ExaltedThirdActorSheet extends ActorSheet {
endings: 0,
}
// Iterate through items, allocating to containers
for (let i of actorData.items) {
for (let i of sheetData.items) {
i.img = i.img || DEFAULT_TOKEN;
if (i.type === 'item') {
gear.push(i);
Expand Down Expand Up @@ -580,20 +580,24 @@ export class ExaltedThirdActorSheet extends ActorSheet {
else if (i.type === 'shape') {
shapes.push(i);
}
else if (i.type === 'spell') {
if (i.system.circle !== undefined) {
spells[i.system.circle].list.push(i);
spells[i.system.circle].visible = true;
spells[i.system.circle].collapse = this.actor.spells ? this.actor.spells[i.system.circle].collapse : true;
}
}
else if (i.type === 'action') {
actions.push(i);
}
if (i.system.active) {
activeItems.push(i);
}
}
let actorSpells = actorData.items.filter((item) => item.type === 'spell');
actorSpells = actorSpells.sort(function (a, b) {
return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
});
for (let i of actorSpells) {
if (i.system.circle !== undefined) {
spells[i.system.circle].list.push(i);
spells[i.system.circle].visible = true;
spells[i.system.circle].collapse = this.actor.spells ? this.actor.spells[i.system.circle].collapse : true;
}
}

let actorCharms = actorData.items.filter((item) => item.type === 'charm');
actorCharms = actorCharms.sort(function (a, b) {
Expand Down
43 changes: 30 additions & 13 deletions module/apps/character-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,41 +592,47 @@ export default class CharacterBuilder extends FormApplication {

html.find(".add-item").on("click", async (event) => {
const type = event.currentTarget.dataset.type;
let listIndex = 0;
let indexAdd = "0";
let indexType = type;
if(type === 'weapons') {
indexType = 'randomWeapons';
}
for (const key of Object.keys(this.object.character[indexType])) {
if (key !== listIndex.toString()) {
break;
}
listIndex++;
}
indexAdd = listIndex.toString();

if (type === 'specialties') {
this.object.character.specialties[Object.entries(this.object.character['specialties']).length] = {
this.object.character.specialties[indexAdd] = {
name: 'Specialty',
system: {
ability: 'archery',
}
};
}
else if (type === 'weapons') {
this.object.character.randomWeapons[Object.entries(this.object.character['randomWeapons']).length] = {
this.object.character.randomWeapons[indexAdd] = {
type: "random",
weaponType: "any",
weight: "any",
artifact: false,
};
}
else if (type === 'intimacies') {
this.object.character[type][Object.entries(this.object.character[type]).length] = {
this.object.character[type][indexAdd] = {
name: 'Name',
system: {
strength: 'minor',
intimacytype: 'tie',
}
};
}
else if (type === 'merits') {
this.object.character[type][Object.entries(this.object.character[type]).length] = {
name: 'Name',
system: {
points: 0,
}
};
}
else {
this.object.character[type][Object.entries(this.object.character[type]).length] = {
this.object.character[type][indexAdd] = {
name: 'Name',
system: {
points: 0,
Expand Down Expand Up @@ -903,7 +909,18 @@ export default class CharacterBuilder extends FormApplication {
}
}
else {
this.object.character[type][Object.entries(this.object.character[type]).length] = newItem;
if (newItem) {
let listIndex = 0;
let indexAdd = "0";
for (const key of Object.keys(this.object.character[type])) {
if (key !== listIndex.toString()) {
break;
}
listIndex++;
}
indexAdd = listIndex.toString();
this.object.character[type][indexAdd] = newItem;
}
}

this.onChange(ev);
Expand Down
4 changes: 2 additions & 2 deletions module/apps/dice-roller.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,15 @@ export class RollForm extends FormApplication {
if (this.actor.merits.some(merit => Object.keys(merit.system.triggers.dicerollertriggers)?.length > 0)) {
this.object.charmList['merits'] = {
name: game.i18n.localize("Ex3.Merits"),
list: this.actor.merits.filter(merit => Object.keys(merit.system.triggers.dicerollertriggers)?.length > 0),
list: this.actor.items.filter(merit => merit.type === 'merit' && Object.keys(merit.system.triggers.dicerollertriggers)?.length > 0),
visible: true,
collapse: true,
}
}
if (this.actor.specialabilities.some(merit => Object.keys(merit.system.triggers.dicerollertriggers)?.length > 0)) {
this.object.charmList['specialabilities'] = {
name: game.i18n.localize("Ex3.SpecialAbilities"),
list: this.actor.specialabilities.filter(merit => Object.keys(merit.system.triggers.dicerollertriggers)?.length > 0),
list: this.actor.items.filter(merit => merit.type === 'specialability' && Object.keys(merit.system.triggers.dicerollertriggers)?.length > 0),
visible: true,
collapse: true,
}
Expand Down
4 changes: 2 additions & 2 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Unofficial Exalted third edition system module for FoundryVTT! Portions of the materials are the copyrights and trademarks of Paradox Interactive AB, and are used with permission. All rights reserved. For more information please visit worldofdarkness.com.",
"url": "https://github.com/Aliharu/Foundry-Ex3",
"license": "LICENSE.txt",
"version": "2.9.4",
"version": "2.9.5",
"compatibility": {
"minimum": "11",
"verified": "12",
Expand Down Expand Up @@ -49,7 +49,7 @@
],
"relationships": [],
"manifest": "https://raw.githubusercontent.com/Aliharu/Foundry-Ex3/master/system.json",
"download": "https://github.com/Aliharu/Foundry-Ex3/releases/download/v2.9.4/release2.9.4.zip",
"download": "https://github.com/Aliharu/Foundry-Ex3/releases/download/v2.9.5/release2.9.5.zip",
"bugs": "https://github.com/Aliharu/Foundry-Ex3/issues",
"gridDistance": 5,
"gridUnits": "ft",
Expand Down

0 comments on commit 62aba86

Please sign in to comment.