Модификации:Подарки

Материал из Stardew Valley Wiki
Перейти к навигации Перейти к поиску

Индекс

На этой странице объясняется, как игра вычисляет вкусы подарков NPC. Это расширенное руководство для разработчиков модов.

Данные

Источник

Вкусы подарков NPC хранятся в Content\Data\Furniture.xnb, могут быть извлечены для редактирования. Вот исходные данные по состоянию на 1.5.1 для примера:

Данные 
{
  "Universal_Love": "74 446 797 373 279",
  "Universal_Like": "-2 -7 -26 -75 -80 72 395 613 634 635 636 637 638 724 459 873",
  "Universal_Neutral": "194 216 262 304 815",
  "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 271",
  "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 265 909 910",
  "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.//",
  "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/",
  "Maru": "Is that...? Oh wow, @! This is spectacular!/72 197 190 215 222 243 336 337 400 787 910/This is a super gift! Thank you!/-260 62 64 66 68 70 334 335 725 726 909/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.//",
  "Sebastian": "I really love this. How did you know?/84 227 236 575 305/Thanks, I like this./267 614 276/...?/-81 30 -80/...I hate this./-5 2 459 195 201 240 330 -26 873/...thanks./-4/",
  "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/",
  "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!//",
  "Caroline": "You're giving this... to me? I'm speechless./213 614 593 907/Oh, goodness! Are you sure?/-7 18 815 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.//",
  "Abigail": "I seriously love this! You're the best, @!/66 128 220 226 276 611 904/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.//",
  "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!//",
  "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?//",
  "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.//",
  "Lewis": "Wow, this is my favorite! Thank you!/200 208 235 614 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.//",
  "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/",
  "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 873/Thanks, this looks nice.//",
  "Pam": "Hey, hey! Now this is really something! Thanks a million, kid./24 90 199 208 303 346 459 873/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/",
  "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!//",
  "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.//",
  "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 903/Is this a gift? Oh...$s/-5 -81 -75 -79 80/Ew. This is icky.$s/253 395 459 -26 2 16 330 873/Thank you!//",
  "Vincent": "Wow, thank you so much! This is terrific!/221 398 612 721 903/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/253 395 459 -26 2 16 330 873/Thanks!//",
  "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.//",
  "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 873/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.//",
  "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!//",
  "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.//",
  "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!//",
  "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.//",
  "Elliott": "@, this is a beautiful gift! Thank you!/715 732 218 444 637 814/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/",
  "Gus": "You're giving this... to me? I'm speechless./72 213 635 729 907/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.//",
  "Dwarf": "Hey, I really love this stuff. You can find great things in the mines./554 60 62 64 66 68 70 749/Ah, this reminds me of home./78 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/",
  "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.//",
  "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 614 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.//",
  "Sandy": "Ooo! I absolutely love getting flowers from the valley. I'm so happy!~/18 402 418 905/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!//",
  "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 265/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/",
  "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 265 336 340/Humans have... interesting tastes./-7 -81 2 330/Oh... Um. I guess I'll accept it.//Thank you.//",
  "Leo": "I love this. I'm going to put it in my nest./444 289 834 906/Are you sure? This is so nice.../852 396 392 394 397/Oh... I don't know if I can digest this.../-7 -81 2 330 303 459 342 346 348/*sniff* *sniff*... Why are you giving this to me? Do you want me to bury it for you?/257 253 247 271 283 304 303 346 873 348 459 167/I accept your gift./-4/"
}

Формат

Файл содержит два типа данных:

  • Универсальные вкусы применяется ко всем жителям. Их ключ - Universal_Taste, и их значение представляет собой массив ID, разделенных пробелами (ID объектов если ≥0, ID категории, если <0). Например, рассмотрим эту запись:
      "Universal_Like": "-2 -7 -26 -75 -80 72 395 613 634 635 636 637 638 724 459"
    
    Эти данные означают, что жители должны иметь универсальную запись для категории -2, предмет 72, и т.д.
  • Личные вкусы обратитесь к конкретному жителю. Их ключ - это внутреннее имя жителя(например, Abigail), и их значение чередует текст диалога со списком ID в следующем порядке: Любит, Нравится, Не нравится, Ненавидит и Равнодушна. Например, рассмотрим вкусы подарков Абигейл:
      "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.// "
    

    Разделив строку с помощью / в качестве разделителя вы можете извлечь эти данные:

    Индекс Вкус Реакция ID
    0, 1 Любит I seriously love this! You're the best, @! 66 128 220 226 276 611
    2, 3 Нравится Hey, how'd you know I was hungry? This looks delicious! none
    4, 5 Не нравится What am I supposed to do with this? -5 -75 -79 16 245 246
    6, 7 Ненавидит What were you thinking? This is awful! 330
    8, 9 Равнодушна You brought me a present? Thanks. none
    Эти данные означают, что она должна любить предмет 66 (Аметист), не любить категорию -5 (яйца), и т.д.

Как определяется вкус подарка

Формат данных позволяет вкусам конфликтовать несколькими способами:

  • между ID ID предмета и ID категории;
  • между универсальным вкусом и личным вкусом;
  • между конфликтующими ценностями (например, Джоди и любит, и ненавидит Нарциссы (ID предмета 18) в частности);
  • и любая комбинация из вышеперечисленного ("например", между универсальным ID предмета и ID категории).

В игре используется довольно сложный алгоритм для определения того, насколько NPC нравится подарок (смотри NPC::getGiftTasteForThisItem). Вот очищенная версия алгоритма в псевдокоде:

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

// часть I: универсальный вкус по категориям
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

// часть II: универсальный вкус по 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

// часть III: переопределите нейтральный, если он из универсальной категории
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

// часть IV: иногда преобладают личные вкусы
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

// часть V: верните вкус, если не отменено
return TASTE