spacemandev-git / fvtt-card-support

Adds programmatic deck support to FoundryVTT
MIT License
10 stars 10 forks source link

In some instances, the deck seem to "unlink" from the cards, and becomes disfunctional. #6

Closed zeel01 closed 4 years ago

zeel01 commented 4 years ago

In some situations, all basic functions of the deck are lost completely. It seems that while some functions seem to fail without errors being thrown, if you reload the game they will begin to throw errors.

Discard: Error happens without refresh

Uncaught (in promise) Either this card isn't part of this deck, or it's not been properly drawn yet!

Post refresh:

Draw: Draw dialog opens, but after choosing "take cards" this error is thrown

Uncaught (in promise) TypeError: Cannot read property 'drawCard' of undefined
    at tileHud.js:145
    at Generator.next (<anonymous>)
    at tileHud.js:7
    at new Promise (<anonymous>)
    at __awaiter (tileHud.js:3)
    at Object.callback (tileHud.js:127)
    at Dialog.submit (foundry.js:13537)
    at Dialog._onClickButton (foundry.js:13498)
    at HTMLButtonElement.dispatch (jquery.min.js:2)
    at HTMLButtonElement.v.handle (jquery.min.js:2)

View discard pile

Uncaught (in promise) TypeError: Cannot read property '_discard' of undefined
    at tileHud.js:156
    at Generator.next (<anonymous>)
    at tileHud.js:7
    at new Promise (<anonymous>)
    at __awaiter (tileHud.js:3)
    at showDiscard (tileHud.js:154)
    at HTMLElement.<anonymous> (tileHud.js:94)
    at HTMLElement.dispatch (jquery.min.js:2)
    at HTMLElement.v.handle (jquery.min.js:2)

Reset

Uncaught (in promise) TypeError: Cannot read property 'resetDeck' of undefined
    at tileHud.js:162
    at Generator.next (<anonymous>)
    at tileHud.js:7
    at new Promise (<anonymous>)
    at __awaiter (tileHud.js:3)
    at resetDeck (tileHud.js:161)
    at HTMLElement.<anonymous> (tileHud.js:98)
    at HTMLElement.dispatch (jquery.min.js:2)
    at HTMLElement.v.handle (jquery.min.js:2)

Shuffle

Uncaught (in promise) TypeError: Cannot read property 'shuffle' of undefined
    at tileHud.js:166
    at Generator.next (<anonymous>)
    at tileHud.js:7
    at new Promise (<anonymous>)
    at __awaiter (tileHud.js:3)
    at shuffleDeck (tileHud.js:165)
    at HTMLElement.<anonymous> (tileHud.js:102)
    at HTMLElement.dispatch (jquery.min.js:2)
    at HTMLElement.v.handle (jquery.min.js:2)

View Deck

Uncaught (in promise) TypeError: Cannot read property '_state' of undefined
    at tileHud.js:175
    at Generator.next (<anonymous>)
    at tileHud.js:7
    at new Promise (<anonymous>)
    at __awaiter (tileHud.js:3)
    at viewDeck (tileHud.js:169)
    at HTMLElement.<anonymous> (tileHud.js:105)
    at HTMLElement.dispatch (jquery.min.js:2)
    at HTMLElement.v.handle (jquery.min.js:2)

Additional info

At this point as well, having refreshed the page, the "Discard" button no longer functions at all (no error), and doesn't appear to have an event listener attached. The "hand" persists, the cards can be flipped, played to the table, returned from the table to hand, reordered, etc.

But the deck is totally broken. Deleting the deck from the scene, and dropping it on again from the Journal doesn't fix it, in fact it can not be dropped onto the scene again. Doing so does output a log:

DragEvent {isTrusted: true, dataTransfer: DataTransfer, screenX: 4712, screenY: 1595, clientX: 872, …}altKey: falsebubbles: truebutton: 0buttons: 0cancelBubble: falsecancelable: trueclientX: 872clientY: 413composed: truectrlKey: falsecurrentTarget: nulldataTransfer: DataTransfer {dropEffect: "none", effectAllowed: "all", items: DataTransferItemList, types: Array(0), files: FileList}defaultPrevented: truedetail: 0eventPhase: 0fromElement: nullisTrusted: truelayerX: 872layerY: 413metaKey: falsemovementX: 0movementY: 0offsetX: 872offsetY: 413pageX: 872pageY: 413path: (5) [canvas#board, body.vtt.game, html, document, Window]relatedTarget: nullreturnValue: falsescreenX: 4712screenY: 1595shiftKey: falsesourceCapabilities: InputDeviceCapabilities {firesTouchEvents: false}srcElement: canvas#boardtarget: canvas#boardtimeStamp: 458149.2950001266toElement: canvas#boardtype: "drop"view: Window {parent: Window, opener: null, top: Window, length: 0, frames: Window, …}which: 1x: 872y: 413__proto__: DragEvent
drop.js:19 CardTS:  

However nothing appears in the scene.

The only remedy is to delete the journal folder for the deck, and re-import it. However the issue returns later.

zeel01 commented 4 years ago

Additional Information:

zeel01 commented 4 years ago

It would appear that deck becomes undefined after a page refresh in all cases. Even just importing the deck, then reloading, results in the deck no longer functioning.

Norc commented 4 years ago

Zeel, we are hoping that this was fixed with a recent update. I haven't been able to reproduce this behavior recently any longer.

Can you confirm whether or not you are still seeing this? Thanks!!

Norc commented 4 years ago

Can not confirm in recent testing, closing.

zeel01 commented 4 years ago

Yes, this seems to be resolved now. The multiple folders called "Decks" problem seems to have been the root cause.