OctarineSourcerer / cyberpunk2020

A FoundryVTT system for Cyberpunk 2020. It's playable now! There's a lot of hole, because there's a LOT of system to cover, but it should be mostly usable <3
23 stars 21 forks source link

Importing Items to Cyberpunk2020 #64

Closed drowzero0 closed 3 years ago

drowzero0 commented 3 years ago

I am not sure if this issue is part of the cyberpunk2020 pakage or something i have to ask the developer of the module i am using for imports. the description of my case: i am trying to use the follwing module for importing multiple items: https://foundryvtt.com/packages/data-toolbox i created a json and a csv for testing. the CSV looks like this:

title;flavor;notes;cost;weight;weaponType;accuracy;Concealability;availability;ammoType;damage;shotsLeft;shots;rof;reliability;range;attackType;attackSkill
AMT Automag V;Very heavy semi-auto pistol made in USA - Source: Cyberpunk 2021;;500;0;Pistol;1;Long coat;Poor;.50 AE;5D6;7;7;1;Unreliable;50;Auto;Handgun

my Json looks like this:

{ 
 "name": "{{title}}",
  "type": "weapon",
  "data": {
    "name": "Common",
    "flavor": "{{flavor}}",
    "notes": "",
    "cost": "{{cost}}",
    "weight": 0,
    "equipped": true,
    "weaponType": "{{weaponType}}",
    "accuracy": "{{accuracy}}",
    "concealability": "",
    "availability": "{{availability }}",
    "ammoType": "{{ammoType}}",
    "damage": "{{damage}}",
    "ap": false,
    "shotsLeft": "{{shotsLeft}}",
    "shots": "{{shots}}",
    "rof": "{{rof}}",
    "reliability": "{{reliability}}",
    "range": "{{range}}",
    "attackType": "{{attackType}}",
    "attackSkill": "{{attackskill}}"
  },
  "sort": 600000,
  "flags": {
    "exportSource": {
      "world": "cyberpunk_2020",
      "system": "cyberpunk2020",
      "coreVersion": "0.7.9",
      "systemVersion": "0.2.3"
    }
  },
  "img": "icons/svg/mystery-man.svg",
  "effects": []
}

the module provides an interface to import those data: image choosable entitiys are item, actor and JournalArticle

the import runs as it should, so my json seems to be at least fine enough to run. the csv format seems to fit enough too. but the result is the following: image

do i miss something to set those items for the extra item-weapon.sheets in cyberpunk2020?

sorry to bother you, if you think this is related to the other moduledev i will ask there.

OctarineSourcerer commented 3 years ago

Hmm I'm actually not sure! I'll have a shot with those files, see what happens on my end

OctarineSourcerer commented 3 years ago

Aha! So I've found the issue - at first I thought that one of the columns in the CSV file was the culprit, as deleting most of the columns in that worked. But that wasn't the case, though it took a bit to find out.

The issue here is that data-toolbox doesn't work if your csv file is separated with ;, which yours is. The spreadsheet editor I used had, on saving, saved with it all separated by ,, which worked fine. So, to succeed with this import, your file would look like:

title,flavor,notes,cost,weight,weaponType,accuracy,Concealability,availability,ammoType,damage,shotsLeft,shots,rof,reliability,range,attackType,attackSkill
AMT Automag V,Very heavy semi-auto pistol made in USA - Source: Cyberpunk 2021,,500,0,Pistol,1,ConcealLongcoat,Poor,.50 AE,5D6,7,7,1,Unreliable,50,Auto,Handgun

You may want to raise an issue on data-toolbox's repo if using ; is important to you, otherwise see if you can find the option in whatever program you're using to separate with , instead.

As an extra addendum, any dropdowns an item or actor have in this system will have their options drawn from the localization keys in en.json, and some of them are a little weird; most of the time, the text itself without spaces works fine, but concealability has some long and gnarly text: Pocket/Pants Leg, Can't be hidden, etc. The keys for those are a little different:

"CYBERPUNK.ConcealPocket": "Pocket/Pants Leg/Sleeve",
"CYBERPUNK.ConcealJacket": "Jacket/Coat/Shoulder Rig",
"CYBERPUNK.ConcealLongcoat": "Long Coat",
"CYBERPUNK.ConcealNoHide": "Can't be hidden",

So in this case, Concealability can be any of:

ConcealPocket
ConcealJacket
ConcealLongcoat
ConcealNoHide

Again, for most fields this isn't an issue, but for concealability, yeaaah. Not sure if I made the right decision with the names of the localisation keys there. In any case, if you try importing an item and whatever you put for a field it seems to still be the default option (and check for importing that property works by just setting notes to its content), search in en.json for the text and you'll find the options :) oh, and having a look at the default templates provided with that module, anything that's a number, you don't want in quotes - otherwise it'll store as a string instead. That shouldn't cause issues, but it might and it'll be inconsistent with system-created items. So for example, shots should, instead of being

"shotsLeft": "{{shotsLeft}}",
"shots": "{{shots}}",

it should be

"shotsLeft": {{shotsLeft}},
"shots": {{shots}},

I know JSON parsers don't like it, but that seems to be what's in their examples, and it does mean they're stored as numbers. Same applies with rof, range, accuracy, cost and weight in this case.

Whew. Hope that helps!

drowzero0 commented 3 years ago

thanks a lot! you are really great! this will make the creation of the DB a little faster! as you can see i stopped importing bookrelated flavor or notes, and do not use any images. guess its usable as a "default" one when i am done

OctarineSourcerer commented 3 years ago

Yeah, having the stats etc is still a lot better than nothing :) And anything to speed up creating the DB helps!