Skip to content

Commit

Permalink
#85 - added additional logging for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
geoidesic committed Aug 9, 2024
1 parent 65e9ac6 commit fcd4813
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
9 changes: 9 additions & 0 deletions src/helpers/Utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ export const getCompendiumSource = (item) => {
}

export const prepareItemForDrop = async ({ itemData, isLevelUp, isMultiClass }) => {
log.d('prepareItemForDrop');
log.d('isLevelUp? ', isLevelUp);
log.d('isMultiClass? ', isMultiClass);
log.d('itemData', itemData);

let item
if (isLevelUp) {
if (isMultiClass) {
Expand All @@ -183,13 +188,17 @@ export const prepareItemForDrop = async ({ itemData, isLevelUp, isMultiClass })
type: 'Item',
uuid: itemData.uuid,
}
log.d('dropData', dropData);
item = await Item.implementation.fromDropData(dropData);
log.d('item', item);
}
return item;
}

//- used by dropItemRegistry
export const dropItemOnCharacter = async (actor, item) => {
log.d('dropItemOnCharacter');
log.d('actor.sheet._onDropItemCreate fn', actor.sheet._onDropItemCreate);
return await actor.sheet._onDropItemCreate(item);
}

Expand Down
20 changes: 10 additions & 10 deletions src/helpers/store.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writable, get, derived } from 'svelte/store';;
import { dropItemOnCharacter, prepareItemForDrop, isAdvancementsForLevelInItem, log } from "~/src/helpers/Utility";
import { dropItemOnCharacter, prepareItemForDrop, log } from "~/src/helpers/Utility";
const initialTabs = [
{ label: "Abilities", id: "abilities", component: "Abilities" },
{ label: "Race", id: "race", component: "Race" },
Expand Down Expand Up @@ -30,26 +30,26 @@ const arrayOfObjectsStore = () => {
remove,
removeAll: () => set([]),
advanceQueue: async (initial) => {
// log.d('advanceQueue')
// log.d('advanceQueue initial', initial || false)
log.d('advanceQueue')
log.d('advanceQueue initial', initial || false)

const currentStore = get(store);

// log.d('advanceQueue currentStore.length', currentStore.length)
log.d('advanceQueue currentStore.length', currentStore.length)

const next = currentStore[0] || false;
// log.d("advanceQueue next", next);
// log.d('current item to advance: ', next.id)
log.d("advanceQueue next", next);
log.d('current item to advance: ', next.id)
if (!next) {
inProcess.set(false);
// log.d('end of queue')
log.d('end of queue')
return false;
}
inProcess.set(next);
remove(next.id);
// log.d('advanceQueue currentStore.length', currentStore.length)
// log.d('dropping item to character', next)
// log.d(next.itemData);
log.d('advanceQueue currentStore.length', currentStore.length)
log.d('dropping item to character', next)
log.d(next.itemData);
const item = await prepareItemForDrop(next)
dropItemOnCharacter(next.actor, item);

Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import DonationTrackerGameSettings from '~/src/settings/DonationTrackerGameSetti


window.log = log;
log.level = log.DEBUG;
log.level = log.INFO;

Hooks.once("init", (app, html, data) => {
log.i('Initialising', game.version);
Expand All @@ -30,7 +30,7 @@ Hooks.once("init", (app, html, data) => {
if(game.settings.get(MODULE_ID, 'debug')) {
log.level = log.VERBOSE;
}

if(game.settings.get(MODULE_ID, 'debug.hooks')) {
CONFIG.debug.hooks = true;
}
Expand Down

0 comments on commit fcd4813

Please sign in to comment.