forked from E-riCA0/StawdewValley
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNPC.cs
4249 lines (4128 loc) · 187 KB
/
NPC.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Decompiled with JetBrains decompiler
// Type: StardewValley.NPC
// Assembly: Stardew Valley, Version=1.2.6400.27469, Culture=neutral, PublicKeyToken=null
// MVID: 77B7094A-F6F0-4ACC-91F4-E335E2733EDB
// Assembly location: D:\SteamLibrary\steamapps\common\Stardew Valley\Stardew Valley.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley.BellsAndWhistles;
using StardewValley.Buildings;
using StardewValley.Characters;
using StardewValley.Locations;
using StardewValley.Menus;
using StardewValley.Objects;
using StardewValley.Projectiles;
using StardewValley.TerrainFeatures;
using StardewValley.Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;
using xTile.Dimensions;
using xTile.ObjectModel;
using xTile.Tiles;
namespace StardewValley
{
public class NPC : Character, IComparable
{
protected int idForClones = -1;
private Stack<StardewValley.Dialogue> currentDialogue = new Stack<StardewValley.Dialogue>();
public int id = -1;
public int daysUntilBirthing = -1;
public int daysAfterLastBirth = -1;
[XmlIgnore]
public bool breather = true;
public bool followSchedule = true;
protected int scheduleTimeToTry = 9999999;
private string nameOfTodaysSchedule = "";
private int married = -1;
public const int minimum_square_pause = 6000;
public const int maximum_square_pause = 12000;
public const int portrait_width = 64;
public const int portrait_height = 64;
public const int portrait_neutral_index = 0;
public const int portrait_happy_index = 1;
public const int portrait_sad_index = 2;
public const int portrait_custom_index = 3;
public const int portrait_blush_index = 4;
public const int portrait_angry_index = 5;
public const int startingFriendship = 0;
public const int defaultSpeed = 2;
public const int maxGiftsPerWeek = 2;
public const int friendshipPointsPerHeartLevel = 250;
public const int maxFriendshipPoints = 2500;
public const int gift_taste_love = 0;
public const int gift_taste_like = 2;
public const int gift_taste_neutral = 8;
public const int gift_taste_dislike = 4;
public const int gift_taste_hate = 6;
public const int textStyle_shake = 0;
public const int textStyle_fade = 1;
public const int textStyle_none = 2;
public const int adult = 0;
public const int teen = 1;
public const int child = 2;
public const int neutral = 0;
public const int polite = 1;
public const int rude = 2;
public const int outgoing = 0;
public const int shy = 1;
public const int positive = 0;
public const int negative = 1;
public const int male = 0;
public const int female = 1;
public const int undefined = 2;
public const int other = 0;
public const int desert = 1;
public const int town = 2;
private Dictionary<int, SchedulePathDescription> schedule;
private Dictionary<string, string> dialogue;
private SchedulePathDescription directionsToNewLocation;
private int directionIndex;
private int lengthOfWalkingSquareX;
private int lengthOfWalkingSquareY;
private int squarePauseAccumulation;
private int squarePauseTotal;
private int squarePauseOffset;
protected Microsoft.Xna.Framework.Rectangle lastCrossroad;
public string defaultMap;
public string loveInterest;
public string birthday_Season;
private Texture2D portrait;
private Vector2 defaultPosition;
private Vector2 nextSquarePosition;
protected int defaultFacingDirection;
protected int shakeTimer;
private bool isWalkingInSquare;
private bool isWalkingTowardPlayer;
private static List<List<string>> routesFromLocationToLocation;
protected string textAboveHead;
protected int textAboveHeadPreTimer;
protected int textAboveHeadTimer;
protected int textAboveHeadStyle;
protected int textAboveHeadColor;
protected float textAboveHeadAlpha;
public int age;
public int manners;
public int socialAnxiety;
public int optimism;
public int gender;
public int homeRegion;
public int birthday_Day;
private string extraDialogueMessageToAddThisMorning;
[XmlIgnore]
public PathFindController temporaryController;
[XmlIgnore]
public GameLocation currentLocation;
[XmlIgnore]
public bool updatedDialogueYet;
[XmlIgnore]
public bool uniqueSpriteActive;
[XmlIgnore]
public bool uniquePortraitActive;
[XmlIgnore]
public bool hideShadow;
[XmlIgnore]
public bool hasPartnerForDance;
[XmlIgnore]
public bool immediateSpeak;
[XmlIgnore]
public bool ignoreScheduleToday;
public int moveTowardPlayerThreshold;
[XmlIgnore]
public float rotation;
[XmlIgnore]
public float yOffset;
[XmlIgnore]
public float swimTimer;
[XmlIgnore]
public float timerSinceLastMovement;
[XmlIgnore]
public string mapBeforeEvent;
[XmlIgnore]
public Vector2 positionBeforeEvent;
[XmlIgnore]
public Vector2 lastPosition;
public bool isInvisible;
public bool datable;
public bool datingFarmer;
public bool divorcedFromFarmer;
private bool hasBeenKissedToday;
private int timeAfterSquare;
[XmlIgnore]
public bool doingEndOfRouteAnimation;
[XmlIgnore]
public bool goingToDoEndOfRouteAnimation;
private int[] routeEndIntro;
private int[] routeEndAnimation;
private int[] routeEndOutro;
[XmlIgnore]
public string endOfRouteMessage;
[XmlIgnore]
public string nextEndOfRouteMessage;
private string endOfRouteBehaviorName;
private Point previousEndPoint;
protected int squareMovementFacingPreference;
private const int NO_TRY = 9999999;
private bool returningToEndPoint;
private bool hasSaidAfternoonDialogue;
public int daysMarried;
[XmlIgnore]
public SchedulePathDescription DirectionsToNewLocation
{
get
{
return this.directionsToNewLocation;
}
set
{
this.directionsToNewLocation = value;
}
}
[XmlIgnore]
public int DirectionIndex
{
get
{
return this.directionIndex;
}
set
{
this.directionIndex = value;
}
}
public int DefaultFacingDirection
{
get
{
return this.defaultFacingDirection;
}
set
{
this.defaultFacingDirection = value;
}
}
[XmlIgnore]
public Dictionary<string, string> Dialogue
{
get
{
return this.dialogue;
}
set
{
this.dialogue = value;
}
}
public string DefaultMap
{
get
{
return this.defaultMap;
}
set
{
this.defaultMap = value;
}
}
public Vector2 DefaultPosition
{
get
{
return this.defaultPosition;
}
set
{
this.defaultPosition = value;
}
}
[XmlIgnore]
public Texture2D Portrait
{
get
{
return this.portrait;
}
set
{
this.portrait = value;
}
}
[XmlIgnore]
public Dictionary<int, SchedulePathDescription> Schedule
{
get
{
return this.schedule;
}
set
{
this.schedule = value;
}
}
public bool IsWalkingInSquare
{
get
{
return this.isWalkingInSquare;
}
set
{
this.isWalkingInSquare = value;
}
}
public bool IsWalkingTowardPlayer
{
get
{
return this.isWalkingTowardPlayer;
}
set
{
this.isWalkingTowardPlayer = value;
}
}
[XmlIgnore]
public Stack<StardewValley.Dialogue> CurrentDialogue
{
get
{
return this.currentDialogue;
}
set
{
this.currentDialogue = value;
}
}
public NPC()
{
}
public NPC(AnimatedSprite sprite, Vector2 position, int facingDir, string name, LocalizedContentManager content = null)
: base(sprite, position, 2, name)
{
this.faceDirection(facingDir);
sprite.standAndFaceDirection(facingDir);
this.defaultPosition = position;
this.defaultFacingDirection = facingDir;
this.lastCrossroad = new Microsoft.Xna.Framework.Rectangle((int) position.X, (int) position.Y + Game1.tileSize, Game1.tileSize, Game1.tileSize);
if (content == null)
return;
try
{
this.portrait = content.Load<Texture2D>("Portraits\\" + name);
}
catch (Exception ex)
{
}
}
public NPC(AnimatedSprite sprite, Vector2 position, string defaultMap, int facingDirection, string name, bool datable, Dictionary<int, int[]> schedule, Texture2D portrait)
: this(sprite, position, defaultMap, facingDirection, name, schedule, portrait, false)
{
this.datable = datable;
}
public NPC(AnimatedSprite sprite, Vector2 position, string defaultMap, int facingDir, string name, Dictionary<int, int[]> schedule, Texture2D portrait, bool eventActor)
: base(sprite, position, 2, name)
{
this.portrait = portrait;
this.faceDirection(facingDir);
if (sprite != null)
sprite.faceDirectionStandard(facingDir);
this.defaultPosition = position;
this.defaultMap = defaultMap;
this.currentLocation = Game1.getLocationFromName(defaultMap);
this.defaultFacingDirection = facingDir;
if (!eventActor)
{
if ((name.Equals("Lewis") || name.Equals("Robin")) && (Game1.NPCGiftTastes.ContainsKey(name) && !Game1.player.friendships.ContainsKey(name)))
Game1.player.friendships.Add(name, new int[6]);
this.loadSeasonalDialogue();
this.lastCrossroad = new Microsoft.Xna.Framework.Rectangle((int) position.X, (int) position.Y + Game1.tileSize, Game1.tileSize, Game1.tileSize);
}
try
{
Dictionary<string, string> source = Game1.content.Load<Dictionary<string, string>>("Data\\NPCDispositions");
if (!source.ContainsKey(name))
return;
string[] strArray = source[name].Split('/');
string str1 = strArray[0];
if (!(str1 == nameof (teen)))
{
if (str1 == nameof (child))
this.age = 2;
}
else
this.age = 1;
string str2 = strArray[1];
if (!(str2 == nameof (rude)))
{
if (str2 == nameof (polite))
this.manners = 1;
}
else
this.manners = 2;
string str3 = strArray[2];
if (!(str3 == nameof (shy)))
{
if (str3 == nameof (outgoing))
this.socialAnxiety = 0;
}
else
this.socialAnxiety = 1;
string str4 = strArray[3];
if (!(str4 == nameof (positive)))
{
if (str4 == nameof (negative))
this.optimism = 1;
}
else
this.optimism = 0;
string str5 = strArray[4];
if (!(str5 == nameof (female)))
{
if (str5 == nameof (undefined))
this.gender = 2;
}
else
this.gender = 1;
string str6 = strArray[5];
if (!(str6 == nameof (datable)))
{
if (str6 == "not-datable")
this.datable = false;
}
else
this.datable = true;
this.loveInterest = strArray[6];
string str7 = strArray[7];
if (!(str7 == "Desert"))
{
if (!(str7 == "Other"))
{
if (str7 == "Town")
this.homeRegion = 2;
}
else
this.homeRegion = 0;
}
else
this.homeRegion = 1;
if (strArray.Length > 8)
{
this.birthday_Season = strArray[8].Split(' ')[0];
this.birthday_Day = Convert.ToInt32(strArray[8].Split(' ')[1]);
}
for (int index = 0; index < source.Count; ++index)
{
if (source.ElementAt<KeyValuePair<string, string>>(index).Key.Equals(name))
{
this.id = index;
break;
}
}
this.displayName = strArray[11];
}
catch (Exception ex)
{
}
}
protected override string translateName(string name)
{
// ISSUE: reference to a compiler-generated method
uint stringHash = \u003CPrivateImplementationDetails\u003E.ComputeStringHash(name);
if (stringHash <= 2721151973U)
{
if (stringHash <= 2668186459U)
{
if ((int) stringHash != 689942318)
{
if ((int) stringHash != 764468226)
{
if ((int) stringHash == -1626780837 && name == "Mister Qi")
return Game1.content.LoadString("Strings\\NPCNames:MisterQi");
}
else if (name == "Grandpa")
return Game1.content.LoadString("Strings\\NPCNames:Grandpa");
}
else if (name == "Old Mariner")
return Game1.content.LoadString("Strings\\NPCNames:OldMariner");
}
else if ((int) stringHash != -1583169328)
{
if ((int) stringHash != -1580323331)
{
if ((int) stringHash == -1573815323 && name == "Morris")
return Game1.content.LoadString("Strings\\NPCNames:Morris");
}
else if (name == "Bouncer")
return Game1.content.LoadString("Strings\\NPCNames:Bouncer");
}
else if (name == "Marlon")
return Game1.content.LoadString("Strings\\NPCNames:Marlon");
}
else if (stringHash <= 3659193731U)
{
if ((int) stringHash != -1095409501)
{
if ((int) stringHash != -870902742)
{
if ((int) stringHash == -635773565 && name == "Kel")
return Game1.content.LoadString("Strings\\NPCNames:Kel");
}
else if (name == "Gunther")
return Game1.content.LoadString("Strings\\NPCNames:Gunther");
}
else if (name == "Gil")
return Game1.content.LoadString("Strings\\NPCNames:Gil");
}
else if ((int) stringHash != -544040015)
{
if ((int) stringHash != -453459147)
{
if ((int) stringHash == -360051349 && name == "Governor")
return Game1.content.LoadString("Strings\\NPCNames:Governor");
}
else if (name == "Henchman")
return Game1.content.LoadString("Strings\\NPCNames:Henchman");
}
else if (name == "Welwick")
return Game1.content.LoadString("Strings\\NPCNames:Welwick");
return name;
}
public string getName()
{
if (this.displayName != null && this.displayName.Length > 0)
return this.displayName;
return this.name;
}
public virtual void reloadSprite()
{
string name = this.name;
string str = name == "Old Mariner" ? "Mariner" : (name == "Dwarf King" ? "DwarfKing" : (name == "Mister Qi" ? "MrQi" : (name == "???" ? "Monsters\\Shadow Guy" : this.name)));
if (this.name.Equals(Utility.getOtherFarmerNames()[0]))
str = Game1.player.isMale ? "maleRival" : "femaleRival";
if (!this.IsMonster)
{
this.sprite = new AnimatedSprite(Game1.content.Load<Texture2D>("Characters\\" + str));
if (!this.name.Contains("Dwarf"))
this.sprite.spriteHeight = 32;
}
else
this.sprite = new AnimatedSprite(Game1.content.Load<Texture2D>("Monsters\\" + str));
try
{
this.portrait = Game1.content.Load<Texture2D>("Portraits\\" + str);
}
catch (Exception ex)
{
this.portrait = (Texture2D) null;
}
int num = this.isInvisible ? 1 : 0;
if (!Game1.newDay && (int) Game1.gameMode != 6)
return;
this.faceDirection(this.DefaultFacingDirection);
this.scheduleTimeToTry = 9999999;
this.previousEndPoint = new Point((int) this.defaultPosition.X / Game1.tileSize, (int) this.defaultPosition.Y / Game1.tileSize);
this.Schedule = this.getSchedule(Game1.dayOfMonth);
this.faceDirection(this.defaultFacingDirection);
this.sprite.standAndFaceDirection(this.defaultFacingDirection);
this.loadSeasonalDialogue();
this.updateDialogue();
if (this.isMarried())
this.marriageDuties();
bool flag = Utility.isFestivalDay(Game1.dayOfMonth, Game1.currentSeason);
if (this.name.Equals("Robin") && Game1.player.daysUntilHouseUpgrade > 0 && !flag)
{
this.setTilePosition(68, 14);
this.ignoreMultiplayerUpdates = true;
this.sprite.setCurrentAnimation(new List<FarmerSprite.AnimationFrame>()
{
new FarmerSprite.AnimationFrame(24, 75),
new FarmerSprite.AnimationFrame(25, 75),
new FarmerSprite.AnimationFrame(26, 300, false, false, new AnimatedSprite.endOfAnimationBehavior(this.robinHammerSound), false),
new FarmerSprite.AnimationFrame(27, 1000, false, false, new AnimatedSprite.endOfAnimationBehavior(this.robinVariablePause), false)
});
this.ignoreScheduleToday = true;
this.CurrentDialogue.Clear();
this.currentDialogue.Push(new StardewValley.Dialogue(Game1.player.daysUntilHouseUpgrade == 2 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3926") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3927"), this));
}
else if (this.name.Equals("Robin") && Game1.getFarm().isThereABuildingUnderConstruction() && !flag)
{
this.ignoreMultiplayerUpdates = true;
this.sprite.setCurrentAnimation(new List<FarmerSprite.AnimationFrame>()
{
new FarmerSprite.AnimationFrame(24, 75),
new FarmerSprite.AnimationFrame(25, 75),
new FarmerSprite.AnimationFrame(26, 300, false, false, new AnimatedSprite.endOfAnimationBehavior(this.robinHammerSound), false),
new FarmerSprite.AnimationFrame(27, 1000, false, false, new AnimatedSprite.endOfAnimationBehavior(this.robinVariablePause), false)
});
this.ignoreScheduleToday = true;
Building underConstruction = Game1.getFarm().getBuildingUnderConstruction();
if (underConstruction.daysUntilUpgrade > 0)
{
if (!underConstruction.indoors.characters.Contains(this))
underConstruction.indoors.addCharacter(this);
if (this.currentLocation != null)
this.currentLocation.characters.Remove(this);
this.currentLocation = underConstruction.indoors;
this.setTilePosition(1, 5);
}
else
{
Game1.warpCharacter(this, "Farm", new Vector2((float) (underConstruction.tileX + underConstruction.tilesWide / 2), (float) (underConstruction.tileY + underConstruction.tilesHigh / 2)), false, false);
this.position.X += (float) (Game1.tileSize / 4);
this.position.Y -= (float) (Game1.tileSize / 2);
}
this.CurrentDialogue.Clear();
this.currentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3926"), this));
}
if (this.name.Equals("Shane") || this.name.Equals("Emily"))
this.datable = true;
try
{
this.displayName = Game1.content.Load<Dictionary<string, string>>("Data\\NPCDispositions")[this.name].Split('/')[11];
}
catch (Exception ex)
{
}
}
public void showTextAboveHead(string Text, int spriteTextColor = -1, int style = 2, int duration = 3000, int preTimer = 0)
{
this.textAboveHeadAlpha = 0.0f;
this.textAboveHead = Text;
this.textAboveHeadPreTimer = preTimer;
this.textAboveHeadTimer = duration;
this.textAboveHeadStyle = style;
this.textAboveHeadColor = spriteTextColor;
}
public void loadSeasonalDialogue()
{
try
{
this.dialogue = Game1.content.Load<Dictionary<string, string>>("Characters\\Dialogue\\" + this.name);
}
catch (Exception ex)
{
}
}
public void moveToNewPlaceForEvent(int xTile, int yTile, string oldMap)
{
this.mapBeforeEvent = oldMap;
this.positionBeforeEvent = this.position;
this.position = new Vector2((float) (xTile * Game1.tileSize), (float) (yTile * Game1.tileSize - Game1.tileSize * 3 / 2));
}
public virtual bool hitWithTool(Tool t)
{
return false;
}
public bool canReceiveThisItemAsGift(Item i)
{
return i is Object || i is Ring || (i is Hat || i is Boots) || i is MeleeWeapon;
}
public int getGiftTasteForThisItem(Item item)
{
int num1 = 8;
if (item is Object)
{
Object @object = item as Object;
string str1;
Game1.NPCGiftTastes.TryGetValue(this.name, out str1);
string[] strArray1 = str1.Split('/');
int parentSheetIndex = @object.ParentSheetIndex;
int category = @object.Category;
string str2 = string.Concat((object) parentSheetIndex);
string str3 = string.Concat((object) category);
if (((IEnumerable<string>) Game1.NPCGiftTastes["Universal_Love"].Split(' ')).Contains<string>(str3))
num1 = 0;
else if (((IEnumerable<string>) Game1.NPCGiftTastes["Universal_Hate"].Split(' ')).Contains<string>(str3))
num1 = 6;
else if (((IEnumerable<string>) Game1.NPCGiftTastes["Universal_Like"].Split(' ')).Contains<string>(str3))
num1 = 2;
else if (((IEnumerable<string>) Game1.NPCGiftTastes["Universal_Dislike"].Split(' ')).Contains<string>(str3))
num1 = 4;
bool flag1 = false;
bool flag2 = false;
if (((IEnumerable<string>) Game1.NPCGiftTastes["Universal_Love"].Split(' ')).Contains<string>(str2))
{
num1 = 0;
flag1 = true;
}
else if (((IEnumerable<string>) Game1.NPCGiftTastes["Universal_Hate"].Split(' ')).Contains<string>(str2))
{
num1 = 6;
flag1 = true;
}
else if (((IEnumerable<string>) Game1.NPCGiftTastes["Universal_Like"].Split(' ')).Contains<string>(str2))
{
num1 = 2;
flag1 = true;
}
else if (((IEnumerable<string>) Game1.NPCGiftTastes["Universal_Dislike"].Split(' ')).Contains<string>(str2))
{
num1 = 4;
flag1 = true;
}
else if (((IEnumerable<string>) Game1.NPCGiftTastes["Universal_Neutral"].Split(' ')).Contains<string>(str2))
{
num1 = 8;
flag1 = true;
flag2 = true;
}
if (num1 == 8 && !flag2)
{
if (@object.edibility != -300 && @object.edibility < 0)
num1 = 6;
else if (@object.price < 20)
num1 = 4;
else if (@object.type.Contains("Arch"))
{
num1 = 4;
if (this.name.Equals("Penny"))
num1 = 2;
}
}
if (str1 != null)
{
List<int[]> numArrayList = new List<int[]>();
int num2 = 0;
while (num2 < 10)
{
string[] strArray2 = strArray1[num2 + 1].Split(' ');
int[] numArray = new int[strArray2.Length];
for (int index = 0; index < strArray2.Length; ++index)
{
if (strArray2[index].Length > 0)
numArray[index] = Convert.ToInt32(strArray2[index]);
}
numArrayList.Add(numArray);
num2 += 2;
}
if ((((IEnumerable<int>) numArrayList[0]).Contains<int>(parentSheetIndex) || category != 0 && ((IEnumerable<int>) numArrayList[0]).Contains<int>(category)) && (category == 0 || !((IEnumerable<int>) numArrayList[0]).Contains<int>(category) || !flag1))
return 0;
if ((((IEnumerable<int>) numArrayList[3]).Contains<int>(parentSheetIndex) || category != 0 && ((IEnumerable<int>) numArrayList[3]).Contains<int>(category)) && (category == 0 || !((IEnumerable<int>) numArrayList[3]).Contains<int>(category) || !flag1))
return 6;
if ((((IEnumerable<int>) numArrayList[1]).Contains<int>(parentSheetIndex) || category != 0 && ((IEnumerable<int>) numArrayList[1]).Contains<int>(category)) && (category == 0 || !((IEnumerable<int>) numArrayList[1]).Contains<int>(category) || !flag1))
return 2;
if ((((IEnumerable<int>) numArrayList[2]).Contains<int>(parentSheetIndex) || category != 0 && ((IEnumerable<int>) numArrayList[2]).Contains<int>(category)) && (category == 0 || !((IEnumerable<int>) numArrayList[2]).Contains<int>(category) || !flag1))
return 4;
if ((((IEnumerable<int>) numArrayList[4]).Contains<int>(parentSheetIndex) || category != 0 && ((IEnumerable<int>) numArrayList[4]).Contains<int>(category)) && (category == 0 || !((IEnumerable<int>) numArrayList[4]).Contains<int>(category) || !flag1))
return 8;
}
}
return num1;
}
private void goblinDoorEndBehavior(Character c, GameLocation l)
{
l.characters.Remove(this);
Game1.playSound("doorClose");
}
public virtual void tryToReceiveActiveObject(Farmer who)
{
who.Halt();
who.faceGeneralDirection(this.getStandingPosition(), 0);
if (this.name.Equals("Henchman") && Game1.currentLocation.name.Equals("WitchSwamp"))
{
if (who.ActiveObject != null && who.ActiveObject.parentSheetIndex == 308)
{
if (this.controller != null)
return;
Game1.playSound("coin");
who.reduceActiveItemByOne();
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\Characters:Henchman5"), this));
Game1.drawDialogue(this);
this.sprite.CurrentFrame = 4;
Game1.player.removeQuest(27);
Stack<Point> pathToEndPoint = new Stack<Point>();
pathToEndPoint.Push(new Point(20, 21));
pathToEndPoint.Push(new Point(20, 22));
pathToEndPoint.Push(new Point(20, 23));
pathToEndPoint.Push(new Point(20, 24));
pathToEndPoint.Push(new Point(20, 25));
pathToEndPoint.Push(new Point(20, 26));
pathToEndPoint.Push(new Point(20, 27));
pathToEndPoint.Push(new Point(20, 28));
this.addedSpeed = 2;
this.controller = new PathFindController(pathToEndPoint, (Character) this, Game1.currentLocation);
this.controller.endBehaviorFunction = new PathFindController.endBehavior(this.goblinDoorEndBehavior);
this.showTextAboveHead(Game1.content.LoadString("Strings\\Characters:Henchman6"), -1, 2, 3000, 0);
Game1.player.mailReceived.Add("henchmanGone");
Game1.currentLocation.removeTile(20, 29, "Buildings");
who.freezePause = 2000;
}
else
{
if (who.ActiveObject == null)
return;
if (who.ActiveObject.parentSheetIndex == 684)
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\Characters:Henchman4"), this));
else
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\Characters:Henchman3"), this));
Game1.drawDialogue(this);
}
}
else if (Game1.questOfTheDay != null && Game1.questOfTheDay.accepted && (!Game1.questOfTheDay.completed && Game1.questOfTheDay.GetType().Name.Equals("ItemDeliveryQuest")) && Game1.questOfTheDay.checkIfComplete(this, -1, -1, (Item) who.ActiveObject, (string) null))
{
who.reduceActiveItemByOne();
who.completelyStopAnimatingOrDoingAction();
if (Game1.random.NextDouble() >= 0.3 || this.name.Equals("Wizard"))
return;
this.doEmote(32, true);
}
else if (Game1.questOfTheDay != null && Game1.questOfTheDay.GetType().Name.Equals("FishingQuest") && Game1.questOfTheDay.checkIfComplete(this, who.ActiveObject.ParentSheetIndex, -1, (Item) null, (string) null))
{
who.reduceActiveItemByOne();
who.completelyStopAnimatingOrDoingAction();
if (Game1.random.NextDouble() >= 0.3 || this.name.Equals("Wizard"))
return;
this.doEmote(32, true);
}
else if (who.ActiveObject != null && who.ActiveObject.questItem)
{
if (who.checkForQuestComplete(this, -1, -1, (Item) who.ActiveObject, "", 9, 3))
return;
Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3954"));
}
else
{
if (who.checkForQuestComplete(this, -1, -1, (Item) null, "", 10, -1) || !Game1.NPCGiftTastes.ContainsKey(this.name))
return;
who.completeQuest(25);
if (who.ActiveObject.ParentSheetIndex == 458)
{
if (!this.datable)
{
if (Game1.random.NextDouble() < 0.5)
{
Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3955", (object) this.displayName));
}
else
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.random.NextDouble() < 0.5 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3956") : Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.3957"), this));
Game1.drawDialogue(this);
}
}
else if (this.datable && this.divorcedFromFarmer)
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\Characters:Divorced_bouquet"), this));
Game1.drawDialogue(this);
}
else if (this.datable && who.friendships.ContainsKey(this.name) && who.friendships[this.name][0] < 1000)
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.random.NextDouble() < 0.5 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3958") : Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.3959"), this));
Game1.drawDialogue(this);
}
else if (this.datable && who.friendships.ContainsKey(this.name) && who.friendships[this.name][0] < 2000)
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.random.NextDouble() < 0.5 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3960") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3961"), this));
Game1.drawDialogue(this);
}
else
{
this.datingFarmer = true;
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.random.NextDouble() < 0.5 ? Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.3962") : Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.3963"), this));
who.changeFriendship(25, this);
who.reduceActiveItemByOne();
who.completelyStopAnimatingOrDoingAction();
this.doEmote(20, true);
Game1.drawDialogue(this);
}
}
else if (who.ActiveObject.ParentSheetIndex == 460)
{
if (who.spouse != null)
{
if (who.spouse.Contains("engaged"))
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.random.NextDouble() < 0.5 ? Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.3965") : Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.3966"), this));
Game1.drawDialogue(this);
}
else
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.random.NextDouble() < 0.5 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3967") : Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.3968"), this));
Game1.drawDialogue(this);
}
}
else if (!this.datable || this.divorcedFromFarmer || who.friendships.ContainsKey(this.name) && who.friendships[this.name][0] < 1500)
{
if (Game1.random.NextDouble() < 0.5)
{
Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3969", (object) this.displayName));
}
else
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(this.gender == 1 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3970") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3971"), this));
Game1.drawDialogue(this);
}
}
else if (this.datable && who.friendships.ContainsKey(this.name) && who.friendships[this.name][0] < 2500)
{
if (who.friendships[this.name][4] == 0)
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.random.NextDouble() < 0.5 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3972") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3973"), this));
Game1.drawDialogue(this);
who.changeFriendship(-20, this);
who.friendships[this.name][4] = 1;
}
else
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.random.NextDouble() < 0.5 ? Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.3974") : Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.3975"), this));
Game1.drawDialogue(this);
who.changeFriendship(-50, this);
}
}
else
{
Game1.changeMusicTrack("none");
who.spouse = this.name + "engaged";
Game1.countdownToWedding = 3;
this.datingFarmer = true;
this.CurrentDialogue.Clear();
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.Load<Dictionary<string, string>>("Data\\EngagementDialogue")[this.name + "0"], this));
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3980"), this));
who.changeFriendship(1, this);
who.reduceActiveItemByOne();
who.completelyStopAnimatingOrDoingAction();
Game1.drawDialogue(this);
}
}
else if (who.friendships.ContainsKey(this.name) && who.friendships[this.name][1] < 2 || who.spouse != null && who.spouse.Equals(this.name) || (this is Child || this.isBirthday(Game1.currentSeason, Game1.dayOfMonth)))
{
if (this.divorcedFromFarmer)
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\Characters:Divorced_gift"), this));
Game1.drawDialogue(this);
}
else if (who.friendships[this.name][3] == 1)
{
Game1.drawObjectDialogue(Game1.parseText(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3981", (object) this.displayName)));
}
else
{
this.receiveGift(who.ActiveObject, who, true, 1f, true);
who.reduceActiveItemByOne();
who.completelyStopAnimatingOrDoingAction();
this.faceTowardFarmerForPeriod(4000, 3, false, who);
if (!this.datable || who.spouse == null || (who.spouse.Contains(this.name) || Utility.isMale(who.spouse.Replace("engaged", "")) != Utility.isMale(this.name)) || (Game1.random.NextDouble() >= 0.3 - (double) who.LuckLevel / 100.0 - Game1.dailyLuck || this.isBirthday(Game1.currentSeason, Game1.dayOfMonth)))
return;
NPC characterFromName = Game1.getCharacterFromName(who.spouse.Replace("engaged", ""), false);
who.changeFriendship(-30, characterFromName);
characterFromName.CurrentDialogue.Clear();
characterFromName.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3985", (object) this.displayName), characterFromName));
}
}
else
Game1.drawObjectDialogue(Game1.parseText(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3987", (object) this.displayName, (object) 2)));
}
}
public void haltMe(Farmer who)
{
this.Halt();
}
public virtual bool checkAction(Farmer who, GameLocation l)
{
if (this.isInvisible)
return false;
if (who.isRidingHorse())
who.Halt();
if (this.name.Equals("Henchman") && l.name.Equals("WitchSwamp"))
{
if (!Game1.player.mailReceived.Contains("Henchman1"))
{
Game1.player.mailReceived.Add("Henchman1");
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\Characters:Henchman1"), this));
Game1.drawDialogue(this);
Game1.player.addQuest(27);
Game1.player.friendships.Add("Henchman", new int[6]);
}
else
{
if (who.ActiveObject != null && who.ActiveObject.canBeGivenAsGift())
{
this.tryToReceiveActiveObject(who);
return true;
}
if (this.controller == null)
{
this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\Characters:Henchman2"), this));
Game1.drawDialogue(this);
}
}
return true;
}
if (Game1.NPCGiftTastes.ContainsKey(this.name) && !Game1.player.friendships.ContainsKey(this.name))
{
Game1.player.friendships.Add(this.name, new int[6]);
if (this.name.Equals("Krobus"))
{
this.currentDialogue.Push(new StardewValley.Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3990"), this));
Game1.drawDialogue(this);
return true;
}
}
if (who.checkForQuestComplete(this, -1, -1, (Item) who.ActiveObject, (string) null, -1, 5))
{
this.faceTowardFarmerForPeriod(6000, 3, false, who);
return true;
}
if (this.name.Equals("Dwarf") && this.currentDialogue.Count <= 0 && (who.canUnderstandDwarves && l.name.Equals("Mine")))
Game1.activeClickableMenu = (IClickableMenu) new ShopMenu(Utility.getDwarfShopStock(), 0, "Dwarf");
if (this.name.Equals("Krobus"))
{
if (who.hasQuest(28))