Skip to content

Commit

Permalink
Improve spell parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPrimate committed Oct 27, 2020
1 parent 377bc1f commit 8a17b6f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ Main differences:

- Can use supplied SRD items where available.
- You can choose to use matching SRD icons.
- Parsing is done remotely. It will cache your characters data for 15 minutes.
- Parsing is remote, this is because of the nature of the calls made to the dndbeyond api that can't be done browser side. It will cache your characters data for around 15 minutes, more if the service is busy.
- There maybe an option to remove this restriction to patreon supporters in the future.
- If you set the Cobalt Cookie setting to the value of your D&DBeyond `CobaltSession` cookie, you can import full spell lists for Druids and Clerics, ot just spells prepared.

You CAN use this alongside the vtta-dndbeyond extension, two icons will show up.
You CAN use this alongside the vtta-dndbeyond extension, two icons will show up. This extension has yellow text on the B symbol.

## Support

Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ddb-importer",
"title": "D&D Beyond Importer",
"description": "Import your dndbeyond.com characters and munch monsters at super speed!",
"version": "0.0.1",
"version": "0.0.2",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.5",
"authors": [
Expand Down
1 change: 1 addition & 0 deletions src/character/import.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
</p><p>
Importing using SRD will not include features like fighting style and divine smite in damage calculations.
</p>
<p>Set your cobalt cookie in settings to get full spell imports for Clerics.</p>
</div>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions src/character/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ const filterItemsByUserSelection = (result, sections) => {
*/

async function getCharacterData(characterId) {
// const cobalt_cookie = game.settings.get("ddb-importer", "cobalt-cookie");
// const body = { cobalt: cobalt_cookie };
const body = {};
const cobalt_cookie = game.settings.get("ddb-importer", "cobalt-cookie");
const body = { cobalt: cobalt_cookie };
// const body = {};
return new Promise((resolve, reject) => {
fetch(`${PARSING_API}/parseCharacter/${characterId}`, {
method: "POST",
Expand All @@ -200,9 +200,9 @@ async function getCharacterData(characterId) {

async function getAlwaysPreparedSpellsOnly(data) {
return new Promise((resolve, reject) => {
// const cobalt_cookie = game.settings.get("ddb-importer", "cobalt-cookie");
// const body = { cobalt: cobalt_cookie, data: data };
const body = { data: data };
const cobalt_cookie = game.settings.get("ddb-importer", "cobalt-cookie");
const body = { cobalt: cobalt_cookie, data: data };
//const body = { data: data };
fetch(`${PARSING_API}/alwaysPreparedSpells`, {
method: "POST",
mode: "cors", // no-cors, *cors, same-origin
Expand Down

0 comments on commit 8a17b6f

Please sign in to comment.