sun-dragon-cult / fvtt-system-rqg

Runequest Glorantha Foundry VTT system
https://sun-dragon-cult.github.io/
Other
20 stars 2 forks source link

Name generation does not support new journals and roll tables #666

Open Moonpile opened 1 year ago

Moonpile commented 1 year ago

What: Describe the bug

In nameGeneration.ResolveTableResult, tableResult.results[0].data.text should be tableResult.results[0].text.

commons.js:2070 Error: You are accessing the TableResult#data object which is no longer used. Since V10 the Document class and its contained DataModel are merged into a combined data structure. You should now reference keys which were previously contained within the data object directly.
    at logCompatibilityWarning (commons.js:2059:19)
    at TableResult._logV10CompatibilityWarning (commons.js:8544:14)
    at get data [as data] (commons.js:8432:24)
    at nameGeneration.ResolveTableResult (nameGeneration.js:123:33)
    at nameGeneration.GenerateFromRollTable (nameGeneration.js:118:30)

In nameGeneration.GetNameBase, it gets the Journal but the content is no longer at .data.content but is rather at collections.pages[0].value.text.content

Error: You are accessing the RqgJournalEntry#data object which is no longer used. Since V10 the Document class and its contained DataModel are merged into a combined data structure. You should now reference keys which were previously contained within the data object directly.
    at logCompatibilityWarning (commons.js:2059:19)
    at RqgJournalEntry._logV10CompatibilityWarning (commons.js:8544:14)
    at get data [as data] (commons.js:8432:24)
    at nameGeneration.GetNameBase (nameGeneration.js:93:28)
    at async nameGeneration.GenerateFromNameBase (nameGeneration.js:26:22)
    at async nameGeneration.ResolveTableResult (nameGeneration.js:131:30)
    at async nameGeneration.GenerateFromRollTable (nameGeneration.js:118:19)
    at async <anonymous>:1:1

How: To Reproduce

(note that you need to fix the rqid of the roll table and the rqids of the referenced name bases in the roll table entries before this even "fails as expected". See https://github.com/sun-dragon-cult/fvtt-module-wiki-rqg/issues/14)

await game.system.api.names.Generate("rt..names-sartarite-male", 1)

Expected behavior

GetNameBases should return the content from the Journal entry (split based on lines into an array).

await game.system.api.names.Generate("rt..names-sartarite-male", 1) should return a random name

Screenshots

n/a

Environment - please paste the information from foundry settings tab "support" button:

Core Version: 11.315

System: rqg 3.3.0 (Sun Dragon Cult, Wake, Moonpile)

Modules: classic-ui 0.1.0 (mxzf) forien-copy-environment v2.2.0 (Blair McMillan, Forien) lib-wrapper 1.12.13.0 (Rui Pinheiro) mcc 1.4.1 (Arcanist, Michael Leahy (TyphonJS)) monaco-macro-editor 0.0.8 (Naito) moulinette-core 11.6.4 (Sven Werlen) moulinette-gameicons 11.1.1 (Sven Werlen) moulinette-imagesearch 11.0.1 (Sven Werlen) moulinette-scenes 11.1.3 (Sven Werlen) moulinette-sounds 11.8.2 () moulinette-tiles 11.1.0 () popout 2.14 (KaKaRoTo, Posnet) tokenmagic 0.6.5.0 (SecretFire, sPOiDar, Zimm, Lozalojo, Moerill, KLO, dev7355608, Mestre Digital, BrotherSharper-Touge, OsiJr) wiki-en-rqg 1.2.0 (Wake)

List generated with Forien's Copy Environment: https://github.com/League-of-Foundry-Developers/foundryvtt-forien-copy-environment

Additional context

Add any other context about the problem here.