User blog:Skuldomg88/Extracting gift information from the game

Without further ado, here is the link:

 Up to date table with relationship points as of 31.07.2018, ver. 8.0.106803 

These are extracted directly from the game files (Version Alpha 8.0.106803) and processed with scripts I wrote to make them human-readable.

If you want to know more, read on.

The data has been confirmed by analysis of the runtime code (thanks to NetherKitteh on the Discord!), so the above table should be correct, except for human error by myself when writing the extraction script.

Table explanation
The table should be pretty self-explanatory but here's a quick overview along with some stuff I don't fully understand yet.

Column names
 NPC_Name: Name of the NPC Favor_Excellent: List of gifts that the character loves, along with how many relationship points are gained. Favor_Like: List of gifts the character likes ... and so on 

There is no column for Neutral gifts, since every item that is not listed in any of these above columns will default to Neutral. For most characters the relationship gain from neutral items is +1 (except for Ginger where it is +-0 and Pinky where it is -2).

Details and uncertainties
Thanks to User:Bermuda we established that the favor column (which codes how many relationship points are awarded) is structured as such (Favor_Excellent for Arlo):

10|103_20$300_10$301_15$302_20$303_25$304_30$305_35

10 is the base value. Everything that doesn't get assigned a specific value from the following list will give +10 relationship.

Now follows a list of IDs and values (ID_value$ID_value$ID_value$...). The ID is an item ID (a different one than used in TagID_x, hence the initial confusion), the value is the relationship points value.

This column will define relationship points for a whole range of items, not all of which are necessarily loved/liked/whatever by the NPC in question. Only items that can be found both in the TagID_x column and Favor_x column are valid gifts.

What I did
Out of boredom I decided to look up how to get to the innards of Unity games. I found that you can extract Sounds, Textures, etc. relatively easy for example. What I wanted to get to was text however, specifically Gifts, since I know Gift values are knowledge that lots of people want to have (accurate) access to.

After some googling and looking around in the game's code (you can decompile/look at the source code relatively easy with programs like DotPeek), I found out that most of the game's data related to dialogues, values, etc. is stored in a database. The corresponding file is

Program Directory\Portia_Data\StreamingAssets\CccData\LocalDb.bytes

This is just an SQL database. At a first look it seems to be stored in a binary format, however Unity simply renames the database file to work with it. So renaming it back to LocalDb.db (before copying it somewhere else, obviously) lets programs like DB Browser for SQLite access it without any problems.

With that, all the game's data is theoretically wide open. I continued to study the tables for a long time and found all the data that is interesting to us. However the data is always encoded, ie. there will never be a table that tells you directly "Ack loves Bananas", but rather "NPC ID x can be gifted list of items y". You will then have to search where the list of items y is stored, where you will find more IDs that point to more IDs that eventually point to an ID that can be found in a table that contains a clearname (ie. "Ack" or "Banana"). You can then start to trace it back to where you started to piece together the information.

Long story short I wrote a couple of scripts that piece together a list of NPCs in the game with gifts that they can receive and whether they love, like, dislike, hate or refuse them. There is lots more to discover in the game files, if you want to take a look at it yourself I encourage you to do so by downloading the SQLite Browser and looking at the tables. Be aware that you will have to dig yourself into it a little, and experience when it comes to programming/data structures/SQL etc. will definitely help.

Tables of interest and that I used in extracting the gift data:

 Translation_hint: The table that contains IDs and all of the text in the game (dialogue, item names, NPC names, etc.)</li> NPCRepository: This table contains all info about the NPCs. Names are coded with an ID that can be looked up in Translation_hint. Here you will also find the ID for the gift collection the NPC likes along with description info (birthday, height, etc.)</li> Props_total_table: Contains all item info. Items are coded with IDs that correspond to Translation_hint, similar to NPCRepository</li> Gift: Contains the gift code from NPCRepository that points to the list of item IDs the NPC loves/likes/etc.</li> </ul>