actor class cleaning
This commit is contained in:
@@ -85,45 +85,16 @@ export class VermineCharacterSheet extends VermineActorSheet {
|
||||
* @return {undefined}
|
||||
*/
|
||||
_prepareItems(context) {
|
||||
// Initialize containers.
|
||||
const gear = [];
|
||||
const features = [];
|
||||
const spells = {
|
||||
0: [],
|
||||
1: [],
|
||||
2: [],
|
||||
3: [],
|
||||
4: [],
|
||||
5: [],
|
||||
6: [],
|
||||
7: [],
|
||||
8: [],
|
||||
9: []
|
||||
};
|
||||
|
||||
// Iterate through items, allocating to containers
|
||||
for (let i of context.items) {
|
||||
i.img = i.img || DEFAULT_TOKEN;
|
||||
// Append to gear.
|
||||
if (i.type === 'item') {
|
||||
gear.push(i);
|
||||
}
|
||||
// Append to features.
|
||||
else if (i.type === 'feature') {
|
||||
features.push(i);
|
||||
}
|
||||
// Append to spells.
|
||||
else if (i.type === 'spell') {
|
||||
if (i.system.spellLevel != undefined) {
|
||||
spells[i.system.spellLevel].push(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Assign and return
|
||||
context.gear = gear;
|
||||
context.features = features;
|
||||
context.spells = spells;
|
||||
context.gear = this.actor.itemTypes['item'];
|
||||
context.weapons = this.actor.itemTypes['weapon'];
|
||||
context.defenses = this.actor.itemTypes['defense'];
|
||||
context.traits = this.actor.itemTypes['trait'];
|
||||
context.specialties = this.actor.itemTypes['specialty'];
|
||||
context.abilities = this.actor.itemTypes['ability'];
|
||||
context.evolutions = this.actor.itemTypes['evolution'];
|
||||
context.traumas = this.actor.itemTypes['trauma'];
|
||||
context.backgrounds = this.actor.itemTypes['background'];
|
||||
context.rumors = this.actor.itemTypes['rumor'];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -131,36 +102,9 @@ export class VermineCharacterSheet extends VermineActorSheet {
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Render the item sheet for viewing/editing prior to the editable check.
|
||||
html.find('.item-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
const item = this.actor.items.get(li.data("itemId"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.isEditable) return;
|
||||
|
||||
// Add and delete Inventory Item
|
||||
// already configured in parents listeners
|
||||
|
||||
// Rollable abilities.
|
||||
html.find('.rollable').click(this._onRoll.bind(this));
|
||||
|
||||
// Choose Totem
|
||||
// Choose Totem
|
||||
html.find('.chooseTotem').click(this._onTotemButton.bind(this));
|
||||
|
||||
// Drag events for macros.
|
||||
if (this.actor.isOwner) {
|
||||
let handler = ev => this._onDragStart(ev);
|
||||
html.find('li.item').each((i, li) => {
|
||||
if (li.classList.contains("inventory-header")) return;
|
||||
li.setAttribute("draggable", true);
|
||||
li.addEventListener("dragstart", handler, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user