Modding:Gift taste data

From Stardew Valley Wiki
Jump to: navigation, search

Index

This page explains how the game calculates NPC gift tastes. This is an advanced guide for mod developers.

Data

Raw data

NPC gift tastes are stored in Content\Data\NPCGiftTastes.xnb, which can be unpacked using XNB Extract. Here's the raw data (as of 1.1.1) for reference:

content:  #!Dictionary<String,String>
    Universal_Love: "74 446" #!String
    Universal_Like: "-2 -7 -26 -75 -80 72 395 613 634 635 636 637 638 724 459" #!String
    Universal_Neutral: "194 216 262 304" #!String
    Universal_Dislike: "-4 -8 -12 -15 -16 -19 -22 -24 -25 -28 -74 78 169 246 247 305 309 310 311 403 419 423 535 536 537 725 726 749" #!String
    Universal_Hate: "0 -20 -21 92 110 111 112 142 152 153 157 178 105 168 170 171 172 374 376 378 380 397 420 684 721 766 767 772 203 308" #!String
    Robin: " This is for me? Wow, I absolutely love it!!/224 426 636/Thanks! This is really nice!/-6 -79 424 709/Um... why?/16 330/What the...? This is terrible!/2/Thank you. This might come in handy.// " #!String
    Demetrius: " You're giving this to me? This is amazing!/207 232 233 400/Thank you! This is a very interesting specimen./-5 -79 422/...What is this?/80 330/This is disgusting./2/That was very thoughtful of you./-4/ " #!String
    Maru: " Is that...? Oh wow, @! This is spectacular!/72 197 190 215 222 243 336 337 400 787/This is a super gift! Thank you!/-260 62 64 66 68 70 334 335 725 726/Oh... That's for me? I'll just put it over here.../-4 330 414 410 404 724/Yuck! You thought I would like this?/340 342 2 430 416/Thanks.// " #!String
    Sebastian: " I really love this. How did you know?/84 227 236 575 305/Thanks, I like this./267 276/...?/-81 30 -80/...I hate this./-5 2 195 201 240 330 -26/...thanks./-4/ " #!String
    Linus: " This is wonderful! You've really made my day special./88 90 234 242 280/This is a great gift. Thank you!/-5 -6 -79 -81/Hmm... This doesn't really do much for me./-2 330/Why would you give this to me? Do you think I like junk just because I live in a tent? That's terrible./2/A gift? How nice./-4/ " #!String
    Pierre: " This is my all-time favorite! Thank you!/202/That's very kind of you. I like this./-5 -6 -7 18 22 402 418 259/This isn't exactly my favorite.../-2 -81 330/Please, never bring this to me again./167 -4 199 270 229 248/A present? Thanks!// " #!String
    Caroline: " You're giving this... to me? I'm speechless./213 593/Oh, goodness! Are you sure?/-7 18 402 418/No, no, no.../-81 330 300 306 307/This is absolute junk. I'm offended./80 296/Oh, that's sweet. Thank you.// " #!String
    Abigail: " I seriously love this! You're the best, @!/66 128 220 226 276 611/Hey, how'd you know I was hungry? This looks delicious!//What am I supposed to do with this?/-5 -75 -79 16 245 246/What were you thinking? This is awful!/330/You brought me a present? Thanks.// " #!String
    Alex: " Hey, awesome! I love this stuff!/201 212 662 664/This is cool! Thanks./-5/Um... Okay. Thanks./16 330/Are you serious? This is garbage./80/Thanks!// " #!String
    George: " This is my favorite thing! Thank you./20 205/Thanks./18 195 199 200 214 219 223 231 233/That's a terrible gift./-80 16/This is probably the worst gift I've ever seen. Thanks a lot./22 80 330/A gift? Hmm...#$e#Do you want something in return?// " #!String
    Evelyn: " *gasp*... This is absolutely marvelous!$u#$e#You've made an old lady very happy./72 220 239 284 591 595/Oh my, it looks wonderful! That's very kind of you./-6 18 402 418/Um, Where will I put this?/16 80/...it smells awful./225 226 227 228 219 396 397 393 372 248 296 -4 330/How nice. Thank you, dear.// " #!String
    Lewis: " Wow, this is my favorite! Thank you!/200 208 235 260/Thanks, this is great!/-80 24 88 90 192 258 264 272 274 278/Well, I guess it's the thought that counts.../-6 16 330/This makes me sick. What a horrendous gift./80/That's very nice of you. Thanks.// " #!String
    Clint: " Yes! This is exactly what I've been looking for!/60 62 64 66 68 70 336 337 605 649 749/This is a fun gift. Thanks!/334 335/*Sigh*.../-80 2 16 80 /This makes me depressed./4/Thanks./-15/ " #!String
    Penny: " Thank you! I really love this!/60 376 651 72 164 218 230 244 254/Thank you! This looks special./-6 20 22/Uh, it's for me? ...Thanks./-4 80 330 456 457 444 440 422 420/Ugh...I'm sorry, but I absolutely hate this./446 346 348 303 304 398 459/Thanks, this looks nice.// " #!String
    Pam: " Hey, hey! Now this is really something! Thanks a million, kid./24 90 199 208 303 346 459/You did good with this one, kid. Thanks!/-6 -75 -79 18 227 228 231 232 233 234 235 236 238 402 418/This just ain't my thing./-5 16 80 330/Now this is just absolutely despicable.$u#$e#(Is this some kind of mean joke?)/149 151/Thanks, kid./-4/ " #!String
    Emily: " This gift is fabulous! Thank you so much!/60 62 64 66 68 70 241 428 440/Thank you! I'm feeling a positive energy from this gift./18 82 84 86 196 200 207 230 235 402 418/Sorry, @. I don't like this./78 2 232 233 225 226/This gift has a strong negative energy. I can't stand it./212 213 227 228/Thanks!// " #!String
    Haley: " Oh my god, this is my favorite thing!!/221 421 610 88/*gasp*...for me? Thank you!/18 60 62 64 70 88 222 223 232 233 234 402 418/Ugh...that's such a stupid gift./-5 -6 -75 -79 -81 80 -27/Gross!/-4 2 16 330 74/Thank you. I love presents.// " #!String
    Jas: " *gasp*...Wow!! Thank you!$h/221 595 604/I love presents! Thank you!/18 60 64 70 88 232 233 234 222 223 340 344 402 418/Is this a gift? Oh...$s/-5 -81 -75 -79 80/Ew. This is icky.$s/395 -26 2 16 330/Thank you!// " #!String
    Vincent: " Wow, thank you so much! This is terrific!/221 398 612/For me? Wow, thanks!/18 60 64 70 88 232 233 234 222 223 340 344 402 418/This isn't very fun...$s/-5 -75 -79 -81 80/Yuck, what is this?$s/395 -26 2 16 330/Thanks!// " #!String
    Jodi: " Oh, you're such a sweetheart! I really love this!/72 200 211 214 220 222 225 231/Thank you! This makes my day really special./-5 -6 -79 18 402 418/Hmm, well I guess I could always put this in the compost.../-81 80 248 330/*Blech*... I hate this.../18 22 396/That's so nice of you! Thanks.// " #!String
    Kent: " Oh...! Mom used to give me this when I was a young boy. It brings back wonderful memories. Thank you./607 649/Hey, now this is a really great gift. Thanks./-5 -79 18 402 418/Ah... It's a... what is this, exactly? Hmm.../80 330 416/This... They gave this to me in Gotoro prison camp. I've been trying to forget about that. *shudder*/-6 2 227 229 456/That's kind of you. The family will like this.// " #!String
    Sam: " Aw, yea! This is my absolute favorite!/90 206 655 658 562 731/Thanks! I really like this./167 210 213 220 223 224 228 232 233 239 -5/Hmm.. this is... interesting./-81 80 152 330 -75/You really don't get it, huh?/306 307 342 -15 2/You got that for me? Thanks!// " #!String
    Leah: " Oh! This is exactly what I wanted! Thank you!/196 200 348 606 651 650 426 430/This is a really nice gift! Thank you!/-5 -6 -79 -81 18 402 169 406 408 418 86/Hmm... I guess everyone has different tastes./-2 2 152 330 221 223 229 232 233 241 209 194/This is a pretty terrible gift, isn't it?/305 211 210 206 216/Thank you.// " #!String
    Shane: " Oh wow, @! How'd you know this is my favorite?/206 215 260 346/This is great! Thanks!/-5 -79 303/I don't really like this./-81 152 330/Why are you giving me your garbage?/80 342/Oh, you got me something? Thanks!// " #!String
    Marnie: " This is an incredible gift! Thanks!!/72 221 240 608/Thank you!/-5 -6 402 418/Oh. I guess I'll take it./16 152/This is worthless. I don't understand you./330/Thank you! This looks nice.// " #!String
    Elliott: " @, this is a beautiful gift! Thank you!/715 732 218 444 637/This is for me? Marvelous!/727 728 -79 60 80 82 84 149 151 346 348 728/Hmm... I'm not a huge fan of this./16 206 330 -79 -81 -6/This item gives me a terrible feeling. I'll have to dispose of it./80 154 300 296/Oh, a present! Thank you!/-4/ " #!String
    Gus: " You're giving this... to me? I'm speechless./72 213 635 729/Oh, goodness! Are you sure?/348 303 -7 18/No, no, no.../16 330/This is absolute junk. I'm offended./80 167 648/Oh, that's sweet. Thank you.// " #!String
    Dwarf: " Hey, I really love this stuff. You can find great things in the mines./60 62 64 66 68 70 749/Ah, this reminds me of home./82 84 86 96 97 98 99 121 122/Hmm... Is this what humans like?/-5 -6 16 -81 2 4 330/I don't care what species you are. This is worthless garbage.//An offering! Thank you./-28/ " #!String
    Wizard: " Ahh, this is imbued with potent arcane energies. It's very useful for my studies. Thank you!/155 422 769 768/Many thanks. This item has some very interesting properties./-12 72 82 84/This?... I suppose I'll cast it into the flames and see what happens./-5 -6 -81 2 16 330 766/Ughh... These are utterly mundane. Please refrain from bothering me with this in the future.//Thank you. This will prove useful, I think.// " #!String
    Harvey: " It's for me? This is my favorite stuff! It's like you read my mind./348 237 432 395 342/That's such a nice gift. Thank you!/-81 -79 -7 402 418 422 436 438 442 444 422/Hmm... Are you sure this is healthy?/-4 424 426 2 330 233 232 238 234 223 222 221 220 216 211 210 208 206 205/...I think I'm allergic to this./296 245 397 396 394 393 392/Thanks. That's very kind of you.// " #!String
    Sandy: " Ooo! I absolutely love getting flowers from the valley. I'm so happy!~/18 402 418/This looks wonderful. Thanks so much!/-75 -79 88 428 436 438 440/Oh... Um. Thanks./-4 2 330/*sniff* ...what is it?//This is for me? Thank you!// " #!String
    Willy: " This is great! If only me ol' Pappy was around. He'd go nuts for this./72 143 149 154 276 337 698 459/This looks great. Thank you!/66 336 340 699 707 198 202 209 212 213 214 219 225 727 730 728 732/Hmmm... You like stuff like this? Huh./-7 -81 2 4 330/... *sniff*... Well I guess I can toss it into the chum bucket.//A gift! Thanks./-4 227 228 242/ " #!String
    Krobus: " This is an amazing gift. For my people it is a great honor to receive something like this./72 16 276 337 305 308/Thank you very much./66 336 340/Humans have... interesting tastes./-7 -81 2 330/Oh... Um. I guess I'll accept it.//Thank you.// " #!String

Format

The file contains two types of data:

  • Universal tastes apply to all villagers. Their key is Universal_{taste}, and their value is a space-delimited array of reference IDs (item ID if ≥0, category ID is <0). For example, consider this entry:
    Universal_Like: "-2 -7 -26 -75 -80 72 395 613 634 635 636 637 638 724 459"
    
    This data means villagers should have a universal like for category -2, item 72, etc.
  • Personal tastes apply to a specific villager. Their key is the villager's internal name (like Abigail), and their value alternates dialogue text with a list of reference IDs in this order: love, like, dislike, hate, and neutral. For example, consider Abigail's gift tastes:
      Abigail: " I seriously love this! You're the best, @!/66 128 220 226 276 611/Hey, how'd you know I was hungry? This looks delicious!//What am I supposed to do with this?/-5 -75 -79 16 245 246/What were you thinking? This is awful!/330/You brought me a present? Thanks.// "
    

    By splitting the string with / as the delimiter, we can extract this data:

    index taste reaction dialogue reference IDs
    0, 1 love I seriously love this! You're the best, @! 66 128 220 226 276 611
    2, 3 like Hey, how'd you know I was hungry? This looks delicious! none
    4, 5 dislike What am I supposed to do with this? -5 -75 -79 16 245 246
    6, 7 hate What were you thinking? This is awful! 330
    8, 9 neutral You brought me a present? Thanks. none
    This data means she should personally love item 66, dislikes category -5, etc.

How a gift taste is determined

The data format allows tastes to conflict in multiple ways:

  • between an item ID and category ID;
  • between a universal taste and personal taste;
  • between conflicting values (e.g. Jodi both loves and hates Daffodils specifically);
  • and any combination of the above (e.g. between a universal item ID and personal category ID).

The game uses a rather complicated algorithm to determine how much an NPC likes an gift (see NPC::getGiftTasteForThisItem). Here's a cleaned up version of the algorithm in pseudocode:

var TASTE = neutral
bool HAS_UNIVERSAL_ID = false
bool HAS_UNIVERSAL_NEUTRAL_ID = false

// part I: universal taste by category
if category is universally loved:
   TASTE = love
else if category is universally hated:
   TASTE = hate
else if category is universally liked:
   TASTE = like
else if category is universally disliked:
   TASTE = dislike

// part II: universal taste by item ID
if itemID is universally loved:
   TASTE = love
   HAS_UNIVERSAL_ID = true
else if itemID is universally hated:
   TASTE = hate
   HAS_UNIVERSAL_ID = true
else if itemID is universally liked:
   TASTE = like
   HAS_UNIVERSAL_ID = true
else if itemID is universally disliked:
   TASTE = dislike
   HAS_UNIVERSAL_ID = true
else if itemID is universally neutral:
   TASTE = neutral
   HAS_UNIVERSAL_ID = true
   HAS_UNIVERSAL_NEUTRAL_ID = true

// part III: override neutral if it's from universal category
if TASTE is neutral and not HAS_UNIVERSAL_NEUTRAL_ID:
   if item is edible but tastes bad (-300 > edibility < 0):
      TASTE = hate
   else if item has a price < 20g:
      TASTE = dislike

// part IV: sometimes override with personal tastes
if ((npc loves itemID OR (item has a category AND npc loves category)) AND (item has no category OR npc doesn't personally love category OR no universal taste for itemID)
   return love
if ((npc hates itemID OR (item has a category AND npc hates category)) AND (item has no category OR npc doesn't personally hate category OR no universal taste for itemID)
   return hate
if ((npc like itemID OR (item has a category AND npc likes category)) AND (item has no category OR npc doesn't personally like category OR no universal taste for itemID)
   return like
if ((npc dislikes itemID OR (item has a category AND npc dislikes category)) AND (item has no category OR npc doesn't personally dislike category OR no universal taste for itemID)
   return dislike
if ((npc neutrals itemID OR (item has a category AND npc neutrals category)) AND (item has no category OR npc doesn't personally neutral category OR no universal taste for itemID)
   return neutral

// part V: return taste if not overridden
return TASTE