Merge branch 'develop' into #49-draggable-items
This commit is contained in:
+360
-154
@@ -104,6 +104,78 @@ export class M5Character extends Actor {
|
||||
spells: {},
|
||||
kampfkuenste: {},
|
||||
} as M5CharacterCalculatedData;
|
||||
derivedData(
|
||||
skip: {
|
||||
mods?: boolean;
|
||||
skills?: boolean;
|
||||
items?: boolean;
|
||||
spells?: boolean;
|
||||
effects?: boolean;
|
||||
containers?: boolean;
|
||||
kampfkuenste?: boolean;
|
||||
encumbrance?: boolean;
|
||||
} = {}
|
||||
): M5CharacterCalculatedData {
|
||||
let ret: M5CharacterCalculatedData = {
|
||||
level: 0,
|
||||
attributes: {
|
||||
st: { value: 0, bonus: 0, mods: [] },
|
||||
gs: { value: 0, bonus: 0, mods: [] },
|
||||
gw: { value: 0, bonus: 0, mods: [] },
|
||||
ko: { value: 0, bonus: 0, mods: [] },
|
||||
in: { value: 0, bonus: 0, mods: [] },
|
||||
zt: { value: 0, bonus: 0, mods: [] },
|
||||
au: { value: 0, bonus: 0, mods: [] },
|
||||
pa: { value: 0, bonus: 0, mods: [] },
|
||||
wk: { value: 0, bonus: 0, mods: [] },
|
||||
},
|
||||
stats: {
|
||||
lp: { value: 0, mods: [] },
|
||||
ap: { value: 0, mods: [] },
|
||||
lpProtection: { value: 0, mods: [] },
|
||||
apProtection: { value: 0, mods: [] },
|
||||
defense: { value: 0, mods: [] },
|
||||
damageBonus: { value: 0, mods: [] },
|
||||
attackBonus: { value: 0, mods: [] },
|
||||
defenseBonus: { value: 0, mods: [] },
|
||||
movement: { value: 0, mods: [] },
|
||||
resistanceMind: { value: 0, mods: [] },
|
||||
resistanceBody: { value: 0, mods: [] },
|
||||
spellCasting: { value: 0, mods: [] },
|
||||
brawl: { value: 0, mods: [] },
|
||||
brawlFw: 0,
|
||||
poisonResistance: { value: 0, mods: [] },
|
||||
enduranceBonus: 0,
|
||||
perception: { value: 0, mods: [] },
|
||||
perceptionFW: 0,
|
||||
drinking: { value: 0, mods: [] },
|
||||
drinkingFW: 0,
|
||||
hoard: 0,
|
||||
encumbrance: 0,
|
||||
load: 0,
|
||||
heavyLoad: 0,
|
||||
thrustLoad: 0,
|
||||
loadMax: 0,
|
||||
},
|
||||
skillMods: {},
|
||||
skills: {
|
||||
innate: {},
|
||||
general: {},
|
||||
combat: {},
|
||||
language: {},
|
||||
custom: {},
|
||||
},
|
||||
gear: {
|
||||
weapons: {},
|
||||
defensiveWeapons: {},
|
||||
armor: {},
|
||||
items: {},
|
||||
containers: {},
|
||||
effects: {},
|
||||
},
|
||||
spells: {},
|
||||
kampfkuenste: {},
|
||||
} as M5CharacterCalculatedData;
|
||||
|
||||
const context = this as any;
|
||||
if (!context) return null;
|
||||
@@ -137,65 +209,39 @@ export class M5Character extends Actor {
|
||||
ret.attributes.pa.bonus = M5Character.attributeBonus(data.attributes.pa);
|
||||
ret.attributes.wk.bonus = M5Character.attributeBonus(data.attributes.wk);
|
||||
|
||||
ret.stats.lp = this.modResult(data.lp);
|
||||
ret.stats.ap = this.modResult(data.ap);
|
||||
ret.stats.lpProtection = this.modResult(0);
|
||||
ret.stats.apProtection = this.modResult(0);
|
||||
ret.stats.defense = this.modResult(M5Character.defenseFromLevel(ret.level));
|
||||
ret.stats.damageBonus = this.modResult(
|
||||
Math.floor(ret.attributes.st.value / 20) +
|
||||
Math.floor(ret.attributes.gs.value / 30) -
|
||||
3,
|
||||
);
|
||||
ret.stats.attackBonus = this.modResult(ret.attributes.gs.bonus);
|
||||
ret.stats.defenseBonus = this.modResult(ret.attributes.gw.bonus);
|
||||
ret.stats.movement = this.modResult(data.movement);
|
||||
ret.stats.resistanceMind = this.modResult(
|
||||
(data.info.magicUsing ? 2 : 0) +
|
||||
ret.stats.defense.value +
|
||||
(data.info.race === "Mensch"
|
||||
? ret.attributes.in.bonus
|
||||
: this.raceBonus(data.info.race)),
|
||||
);
|
||||
ret.stats.resistanceBody = this.modResult(
|
||||
(data.info.magicUsing ? 2 : 1) +
|
||||
ret.stats.defense.value +
|
||||
(data.info.race === "Mensch"
|
||||
? ret.attributes.ko.bonus
|
||||
: this.raceBonus(data.info.race)),
|
||||
);
|
||||
ret.stats.spellCasting = this.modResult(
|
||||
(data.info.magicUsing
|
||||
? M5Character.spellCastingFromLevel(ret.level)
|
||||
: 3) + ret.attributes.zt.bonus,
|
||||
);
|
||||
ret.stats.brawl = this.modResult(
|
||||
Math.floor((ret.attributes.st.value + ret.attributes.gw.value) / 20),
|
||||
);
|
||||
ret.stats.brawlFw =
|
||||
ret.stats.brawl.value +
|
||||
ret.stats.attackBonus.value +
|
||||
(data.info.race === "Zwerg" ? 1 : 0);
|
||||
ret.stats.poisonResistance = this.modResult(
|
||||
30 + Math.floor(ret.attributes.ko.value / 2),
|
||||
);
|
||||
ret.stats.enduranceBonus =
|
||||
Math.floor(ret.attributes.ko.value / 10) +
|
||||
Math.floor(ret.attributes.st.value / 20);
|
||||
ret.stats.perception = this.modResult(0);
|
||||
ret.stats.perceptionFW = 6;
|
||||
ret.stats.drinking = this.modResult(0);
|
||||
ret.stats.drinkingFW = Math.floor(ret.attributes.ko.value / 10);
|
||||
ret.stats.hoardMin = M5Character.levelThreshold.at(ret.level - 1) / 2;
|
||||
ret.stats.hoardNext = M5Character.levelThreshold.at(ret.level) / 2;
|
||||
ret.stats.wealth = parseFloat(
|
||||
(
|
||||
data.info.gold +
|
||||
data.info.silver / 10 +
|
||||
data.info.copper / 100
|
||||
).toPrecision(3),
|
||||
);
|
||||
ret.stats.hoard = 0;
|
||||
ret.stats.lp = this.modResult(data.lp);
|
||||
ret.stats.ap = this.modResult(data.ap);
|
||||
ret.stats.lpProtection = this.modResult(0);
|
||||
ret.stats.apProtection = this.modResult(0);
|
||||
ret.stats.defense = this.modResult(M5Character.defenseFromLevel(ret.level));
|
||||
ret.stats.damageBonus = this.modResult(Math.floor(ret.attributes.st.value / 20) + Math.floor(ret.attributes.gs.value / 30) - 3);
|
||||
ret.stats.attackBonus = this.modResult(ret.attributes.gs.bonus);
|
||||
ret.stats.defenseBonus = this.modResult(ret.attributes.gw.bonus);
|
||||
ret.stats.movement = this.modResult(data.movement);
|
||||
ret.stats.resistanceMind = this.modResult(
|
||||
(data.info.magicUsing ? 2 : 0) + ret.stats.defense.value + (data.info.race === "Mensch" ? ret.attributes.in.bonus : this.raceBonus(data.info.race))
|
||||
);
|
||||
ret.stats.resistanceBody = this.modResult(
|
||||
(data.info.magicUsing ? 2 : 1) + ret.stats.defense.value + (data.info.race === "Mensch" ? ret.attributes.ko.bonus : this.raceBonus(data.info.race))
|
||||
);
|
||||
ret.stats.spellCasting = this.modResult((data.info.magicUsing ? M5Character.spellCastingFromLevel(ret.level) : 3) + ret.attributes.zt.bonus);
|
||||
ret.stats.brawl = this.modResult(Math.floor((ret.attributes.st.value + ret.attributes.gw.value) / 20));
|
||||
ret.stats.brawlFw = ret.stats.brawl.value + ret.stats.attackBonus.value + (data.info.race === "Zwerg" ? 1 : 0);
|
||||
ret.stats.poisonResistance = this.modResult(30 + Math.floor(ret.attributes.ko.value / 2));
|
||||
ret.stats.enduranceBonus = Math.floor(ret.attributes.ko.value / 10) + Math.floor(ret.attributes.st.value / 20);
|
||||
ret.stats.perception = this.modResult(0);
|
||||
ret.stats.perceptionFW = 6;
|
||||
ret.stats.drinking = this.modResult(0);
|
||||
ret.stats.drinkingFW = Math.floor(ret.attributes.ko.value / 10);
|
||||
ret.stats.hoardMin = M5Character.levelThreshold.at(ret.level - 1) / 2;
|
||||
ret.stats.hoardNext = M5Character.levelThreshold.at(ret.level) / 2;
|
||||
ret.stats.wealth = parseFloat((data.info.gold + data.info.silver / 10 + data.info.copper / 100).toPrecision(3));
|
||||
ret.stats.hoard = 0;
|
||||
ret.stats.load = M5Character.loadValue(data.attributes.st);
|
||||
ret.stats.heavyLoad = M5Character.heavyLoadValue(data.attributes.st);
|
||||
ret.stats.loadMax = M5Character.maxLoadValue(data.attributes.st);
|
||||
ret.stats.thrustLoad = M5Character.thrustLoadValue(data.attributes.st);
|
||||
ret.stats.encumbrance = 0;
|
||||
|
||||
if (!skip?.mods) {
|
||||
const aggregate = new M5ModAggregate(data, ret);
|
||||
@@ -355,30 +401,85 @@ export class M5Character extends Actor {
|
||||
.sort((a, b) => a?.sort - b?.sort)
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label += "*";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += parseFloat(this.calculateValue(item.system.value * item.system.quantity, item.system.currency).toPrecision(3));
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += parseFloat(this.calculateValue(item.system.value * item.system.quantity, item.system.currency).toPrecision(3));
|
||||
}
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label +=
|
||||
"*(" +
|
||||
(item.system.stats.attackBonus < 0 ? "" : "+") +
|
||||
item.system.stats.attackBonus +
|
||||
"/" +
|
||||
(item.system.stats.damageBonus < 0 ? "" : "+") +
|
||||
item.system.stats.damageBonus +
|
||||
")";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(
|
||||
item.system.value * item.system.quantity,
|
||||
item.system.currency,
|
||||
);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(
|
||||
item.system.value * item.system.quantity,
|
||||
item.system.currency,
|
||||
);
|
||||
}
|
||||
if (!!item.system.containerId) {
|
||||
ret.gear.containers[item.system.containerId].weight += parseFloat((item.system.weight * item.system.quantity).toPrecision(4));
|
||||
if (ret.gear.containers[item.system.containerId].equipped) {
|
||||
ret.stats.encumbrance += (item.system.weight * item.system.quantity);
|
||||
}
|
||||
} else if (item.system.equipped) {
|
||||
ret.stats.encumbrance += (item.system.weight * item.system.quantity);
|
||||
}
|
||||
|
||||
let icon = item.img;
|
||||
let rollable = false;
|
||||
|
||||
// console.log(item.system.rolls.formulas.map((p) => p.enabled));
|
||||
for (let key in item.system.rolls.formulas) {
|
||||
rollable = item.system.rolls.formulas[key]?.enabled;
|
||||
if (rollable) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret.gear.items[item.id] = {
|
||||
label: label,
|
||||
icon: icon,
|
||||
magic: item.system.magic,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
valuable: item.system?.valuable,
|
||||
hoarded: item.system?.hoarded,
|
||||
weight: item.system.weight || 0,
|
||||
containerId: item.system.containerId || "",
|
||||
value: item.system.value || 0,
|
||||
currency: item.system.currency || "",
|
||||
quantity: item.system.quantity || 0,
|
||||
rollExist: rollable,
|
||||
};
|
||||
});
|
||||
|
||||
context.items
|
||||
?.filter((item) => item.type === "weapon")
|
||||
.sort((a, b) => a?.sort - b?.sort)
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label +=
|
||||
"*(" +
|
||||
(item.system.stats.attackBonus < 0 ? "" : "+") +
|
||||
item.system.stats.attackBonus +
|
||||
"/" +
|
||||
(item.system.stats.damageBonus < 0 ? "" : "+") +
|
||||
item.system.stats.damageBonus +
|
||||
")";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (!!item.system.containerId) {
|
||||
ret.gear.containers[item.system.containerId].weight += item.system.weight;
|
||||
if (ret.gear.containers[item.system.containerId].equipped) {
|
||||
ret.stats.encumbrance += item.system.weight;
|
||||
}
|
||||
} else if (item.system.equipped) {
|
||||
ret.stats.encumbrance += item.system.weight || 0;
|
||||
}
|
||||
|
||||
ret.gear.weapons[item.id] = {
|
||||
label: label,
|
||||
@@ -404,42 +505,40 @@ export class M5Character extends Actor {
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label +=
|
||||
"*(" +
|
||||
(item.system.stats.defenseBonus < 0 ? "" : "+") +
|
||||
item.system.stats.defenseBonus +
|
||||
")";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(
|
||||
item.system.value * item.system.quantity,
|
||||
item.system.currency,
|
||||
);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(
|
||||
item.system.value * item.system.quantity,
|
||||
item.system.currency,
|
||||
);
|
||||
}
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label += "*(" + (item.system.stats.defenseBonus < 0 ? "" : "+") + item.system.stats.defenseBonus + ")";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (!!item.system.containerId) {
|
||||
ret.gear.containers[item.system.containerId].weight += item.system.weight;
|
||||
if (ret.gear.containers[item.system.containerId].equipped) {
|
||||
ret.stats.encumbrance += item.system.weight;
|
||||
}
|
||||
} else if (item.system.equipped) {
|
||||
ret.stats.encumbrance += item.system.weight || 0;
|
||||
}
|
||||
|
||||
ret.gear.defensiveWeapons[item.id] = {
|
||||
label: label,
|
||||
skillId: item.system.skillId,
|
||||
magic: item.system.magic,
|
||||
valuable: item.system?.valuable,
|
||||
hoarded: item.system?.hoarded,
|
||||
value: item.system.value || 0,
|
||||
currency: item.system.currency || "",
|
||||
defenseBonus: item.system.stats.defenseBonus,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
}
|
||||
ret.gear.defensiveWeapons[item.id] = {
|
||||
label: label,
|
||||
skillId: item.system.skillId,
|
||||
magic: item.system.magic,
|
||||
valuable: item.system?.valuable,
|
||||
hoarded: item.system?.hoarded,
|
||||
value: item.system.value || 0,
|
||||
currency: item.system.currency || "",
|
||||
defenseBonus: item.system.stats.defenseBonus,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
weight: item.system.weight || 0,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
|
||||
if (!skip?.armor) {
|
||||
context.items
|
||||
@@ -448,37 +547,132 @@ export class M5Character extends Actor {
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label += "*";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(
|
||||
item.system.value * item.system.quantity,
|
||||
item.system.currency,
|
||||
);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(
|
||||
item.system.value * item.system.quantity,
|
||||
item.system.currency,
|
||||
);
|
||||
}
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label += "*";
|
||||
}
|
||||
if (item.system.valuable) {
|
||||
ret.stats.wealth += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (item.system.hoarded) {
|
||||
ret.stats.hoard += this.calculateValue(item.system.value * item.system.quantity, item.system.currency);
|
||||
}
|
||||
if (!!item.system.containerId) {
|
||||
ret.gear.containers[item.system.containerId].weight += item.system.weight;
|
||||
if (ret.gear.containers[item.system.containerId].equipped) {
|
||||
ret.stats.encumbrance += item.system.weight;
|
||||
}
|
||||
} else if (item.system.equipped) {
|
||||
ret.stats.encumbrance += 0;
|
||||
} else {
|
||||
ret.stats.encumbrance += item.system.weight || 0;
|
||||
}
|
||||
|
||||
ret.gear.armor[item.id] = {
|
||||
label: label,
|
||||
magic: item.system.magic,
|
||||
valuable: item.system?.valuable,
|
||||
hoarded: item.system?.hoarded,
|
||||
value: item.system.value || 0,
|
||||
currency: item.system.currency || "",
|
||||
lpProtection: item.system.lpProtection,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
}
|
||||
ret.gear.armor[item.id] = {
|
||||
label: label,
|
||||
magic: item.system.magic,
|
||||
valuable: item.system?.valuable,
|
||||
hoarded: item.system?.hoarded,
|
||||
value: item.system.value || 0,
|
||||
currency: item.system.currency || "",
|
||||
lpProtection: item.system.lpProtection,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped,
|
||||
weight: item.system.weight || 0,
|
||||
containerId: item.system.containerId || "",
|
||||
};
|
||||
});
|
||||
|
||||
if (!skip?.encumbrance) {
|
||||
const item = context.items.filter((x) => x.name === "Belastung");
|
||||
if (ret.stats.encumbrance > ret.stats.heavyLoad) {
|
||||
if (item.length === 0) {
|
||||
this.createEffect("Belastung", [{ id: "movement", operation: M5ModOperation.DIVISION, type: M5ModType.STAT, value: 2 }]);
|
||||
} else if (item.length === 1) {
|
||||
item[0].update({
|
||||
data: {
|
||||
equipped: true,
|
||||
},
|
||||
});
|
||||
} else if (item.length === 2) {
|
||||
item[1]?.delete();
|
||||
}
|
||||
} else if (ret.stats.encumbrance <= ret.stats.heavyLoad) {
|
||||
if (item.length === 1) {
|
||||
item[0].update({
|
||||
data: {
|
||||
equipped: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!skip?.encumbrance) {
|
||||
const item = context.items.filter((x) => x.name === "Höchstlast");
|
||||
if (ret.stats.encumbrance > ret.stats.loadMax) {
|
||||
if (item.length === 0) {
|
||||
let messageContent = `Höchstlast wurde überschritten: 1 AP Schaden durch Belastung alle 10 Minuten abziehen!`;
|
||||
let chatData = {
|
||||
speaker: ChatMessage.getSpeaker({actor: Actor.name}),
|
||||
content: messageContent,
|
||||
};
|
||||
ChatMessage.create(chatData, {});
|
||||
ui.notifications.warn(messageContent);
|
||||
this.createEffect("Höchstlast", [{ id: "ap", operation: M5ModOperation.SUBTRACT, type: M5ModType.STAT, value: 1 }]);
|
||||
} else if (item.length === 2) {
|
||||
item[1]?.delete();
|
||||
} else if (item.length === 1) {
|
||||
item[0].update({
|
||||
data: {
|
||||
equipped: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
} else if (ret.stats.encumbrance < ret.stats.loadMax) {
|
||||
if (item.length === 1) {
|
||||
item[0]?.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!skip?.effects) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "effect")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
|
||||
let label = item.name;
|
||||
if (item.system.magic) {
|
||||
label += "*";
|
||||
}
|
||||
|
||||
ret.gear.effects[item.id] = {
|
||||
label: label,
|
||||
magic: item.system.magic,
|
||||
calc: item.system.calc,
|
||||
equipped: item.system?.equipped || false,
|
||||
duration: item.system?.duration || { time: 0, unit: "" },
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (!skip?.skills) {
|
||||
context.items
|
||||
?.filter((item) => item.type === "skill")
|
||||
.forEach((item) => {
|
||||
item.prepareDerivedData();
|
||||
const skillMap = ret.skills[item.system.type];
|
||||
skillMap[item.id] = {
|
||||
label: item.name,
|
||||
fw: item.system.fw,
|
||||
attribute: item.system.attribute,
|
||||
pp: item.system.pp,
|
||||
calc: item.system.calc,
|
||||
} as M5SkillCalculated;
|
||||
});
|
||||
}
|
||||
|
||||
if (!skip?.spells) {
|
||||
context.items
|
||||
@@ -639,13 +833,25 @@ export class M5Character extends Actor {
|
||||
data: options,
|
||||
};
|
||||
|
||||
return (this as any)
|
||||
.createEmbeddedDocuments("Item", [itemData])
|
||||
.then((docs) => {
|
||||
const item = docs[0];
|
||||
return item;
|
||||
});
|
||||
}
|
||||
return (this as any).createEmbeddedDocuments("Item", [itemData]).then((docs) => {
|
||||
const item = docs[0];
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
async createEffect(itemName: string, mods: M5ItemMod[]): Promise<M5Item> {
|
||||
const itemData = {
|
||||
name: itemName,
|
||||
type: "effect",
|
||||
|
||||
system: { mods: mods, equipped: true },
|
||||
};
|
||||
|
||||
return (this as any).createEmbeddedDocuments("Item", [itemData]).then((docs) => {
|
||||
const item = docs[0];
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
getItem(itemId: string): any {
|
||||
if (!(this as any).items) return null;
|
||||
|
||||
Reference in New Issue
Block a user