Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: weapons now showing in monster inventory #88

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/module/actor/monster-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class OseActorSheetMonster extends OseActorSheet {
const attackPatterns = {};

// Partition items by category
let [items, armors, spells, containers] = itemsData.reduce(
let [weapons, items, armors, spells, containers] = itemsData.reduce(
(arr, item) => {
// Classify items into types
const containerId = item?.data?.data?.containerId;
Expand All @@ -58,16 +58,16 @@ export class OseActorSheetMonster extends OseActorSheet {
if (attackPatterns[item.data.data.pattern] === undefined)
attackPatterns[item.data.data.pattern] = [];
attackPatterns[item.data.data.pattern].push(item);
return arr;
}
// Classify items into types
if (item.type === "item") arr[0].push(item);
else if (item.type === "armor") arr[1].push(item);
else if (item.type === "spell") arr[2].push(item);
else if (item.type === "container") arr[3].push(item);
if (item.type === "weapon") arr[0].push(item);
else if (item.type === "item") arr[1].push(item);
else if (item.type === "armor") arr[2].push(item);
else if (item.type === "spell") arr[3].push(item);
else if (item.type === "container") arr[4].push(item);
return arr;
},
[[], [], [], []]
[[], [], [], [], []]
);
// Sort spells by level
var sortedSpells = {};
Expand Down Expand Up @@ -97,6 +97,7 @@ export class OseActorSheetMonster extends OseActorSheet {
});
// Assign and return
data.owned = {
weapons: weapons,
items: items,
containers: containers,
armors: armors,
Expand Down