-
Notifications
You must be signed in to change notification settings - Fork 62
/
Game1.cs
13124 lines (12851 loc) · 650 KB
/
Game1.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.Game1
// 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.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using StardewValley.BellsAndWhistles;
using StardewValley.Buildings;
using StardewValley.Characters;
using StardewValley.Events;
using StardewValley.Locations;
using StardewValley.Menus;
using StardewValley.Minigames;
using StardewValley.Monsters;
using StardewValley.Network;
using StardewValley.Objects;
using StardewValley.Projectiles;
using StardewValley.Quests;
using StardewValley.TerrainFeatures;
using StardewValley.Tools;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using xTile;
using xTile.Dimensions;
using xTile.Display;
using xTile.Layers;
using xTile.ObjectModel;
using xTile.Tiles;
namespace StardewValley
{
public class Game1 : Game
{
public static int pixelZoom = 4;
public static int tileSize = 64;
public static float thumbStickSensitivity = 0.1f;
public static float runThreshold = 0.5f;
private static StringBuilder _debugStringBuilder = new StringBuilder();
public static List<GameLocation> locations = new List<GameLocation>();
private static Texture2D _toolSpriteSheet = (Texture2D) null;
public static float screenGlowAlpha = 0.0f;
public static float flashAlpha = 0.0f;
public static bool fadeToBlack = false;
public static bool fadeIn = true;
public static bool dialogueUp = false;
public static bool dialogueTyping = false;
public static bool pickingTool = false;
public static bool isQuestion = false;
public static bool nonWarpFade = false;
public static bool particleRaining = false;
public static bool newDay = false;
public static bool inMine = false;
public static bool isEating = false;
public static bool menuUp = false;
public static bool eventUp = false;
public static bool viewportFreeze = false;
public static bool eventOver = false;
public static bool nameSelectUp = false;
public static bool screenGlow = false;
public static bool screenGlowHold = false;
public static bool progressBar = false;
public static bool isRaining = false;
public static bool isSnowing = false;
public static bool killScreen = false;
public static bool displayHUD = true;
public static bool displayFarmer = true;
public static bool spawnMonstersAtNight = false;
public static bool showingHealth = false;
public static string currentSeason = "spring";
public static string nextMusicTrack = "";
public static string messageAfterPause = "";
public static string fertilizer = "";
public static string samBandName = "The Alfalfas";
public static string elliottBookName = "Blue Tower";
public static string keyHelpString = "";
public static string lastDebugInput = "";
public static string loadingMessage = "";
public static string errorMessage = "";
public static Queue<string> currentObjectDialogue = new Queue<string>();
public static Queue<string> mailbox = new Queue<string>();
public static List<Response> questionChoices = new List<Response>();
public static int dayOfMonth = 0;
public static int year = 1;
public static int timeOfDay = 600;
public static int numberOfSelectedItems = -1;
public static int farmerWallpaper = 22;
public static int wallpaperPrice = 75;
public static int currentFloor = 3;
public static int FarmerFloor = 29;
public static int floorPrice = 75;
public static int tvStation = -1;
public static int percentageToWinStardewHero = 70;
public static int currentSongIndex = 3;
public static Color morningColor = Color.LightBlue;
public static Color eveningColor = new Color((int) byte.MaxValue, (int) byte.MaxValue, 0);
public static Color unselectedOptionColor = new Color(100, 100, 100);
public static Random random = new Random(DateTime.Now.Millisecond);
public static Random recentMultiplayerRandom = new Random();
public static List<Object> shippingBin = new List<Object>();
public static List<HUDMessage> hudMessages = new List<HUDMessage>();
public static float dialogueButtonScale = 1f;
public static PlayerIndex playerOneIndex = PlayerIndex.One;
public static Vector2 shiny = Vector2.Zero;
public static Vector2 lastCursorTile = Vector2.Zero;
public static RainDrop[] rainDrops = new RainDrop[70];
public static double chanceToRainTomorrow = 0.0;
public static double dailyLuck = 0.001;
public static List<WeatherDebris> debrisWeather = new List<WeatherDebris>();
public static List<TemporaryAnimatedSprite> screenOverlayTempSprites = new List<TemporaryAnimatedSprite>();
public static ulong uniqueIDForThisGame = (ulong) (DateTime.UtcNow - new DateTime(2012, 6, 22)).TotalSeconds;
public static Stats stats = new Stats();
public static int[] directionKeyPolling = new int[4];
public static HashSet<LightSource> currentLightSources = new HashSet<LightSource>();
public static Color outdoorLight = new Color((int) byte.MaxValue, (int) byte.MaxValue, 0);
public static Color textColor = new Color(34, 17, 34);
public static Color textShadowColor = new Color(206, 156, 95);
private static IMinigame _currentMinigame = (IMinigame) null;
public static List<IClickableMenu> onScreenMenus = new List<IClickableMenu>();
private static List<float> _fpsList = new List<float>(120);
private static Stopwatch _fpsStopwatch = new Stopwatch();
private static float _fps = 0.0f;
public static List<DelayedAction> delayedActions = new List<DelayedAction>();
public static Stack<IClickableMenu> endOfNightMenus = new Stack<IClickableMenu>();
public static Vector2 viewportTarget = new Vector2((float) int.MinValue, (float) int.MinValue);
public static float viewportSpeed = 2f;
private static bool _cursorDragEnabled = false;
private static bool _cursorDragPrevEnabled = false;
private static bool _cursorSpeedDirty = true;
private static float _cursorSpeed = 16f;
private static float _cursorSpeedScale = 1f;
private static float _cursorUpdateElapsedSec = 0.0f;
public static float screenGlowRate = 0.005f;
public static bool haltAfterCheck = false;
public static bool conventionMode = false;
public static float thumbstickMotionAccell = 1f;
public static int mouseCursor = 0;
private static float _mouseCursorTransparency = 1f;
public static bool wasMouseVisibleThisFrame = true;
private readonly Color bgColor = new Color(5, 3, 4);
private readonly BlendState lightingBlend = new BlendState()
{
ColorBlendFunction = BlendFunction.ReverseSubtract,
ColorDestinationBlend = Blend.One,
ColorSourceBlend = Blend.SourceColor
};
public const int defaultResolutionX = 1280;
public const int defaultResolutionY = 720;
public const int smallestTileSize = 16;
public const int up = 0;
public const int right = 1;
public const int down = 2;
public const int left = 3;
public const int spriteIndexForOveralls = 3854;
public const int colorToleranceForOveralls = 60;
public const int spriteIndexForOverallsBorder = 3846;
public const int colorToloranceForOverallsBorder = 20;
public const int dialogueBoxTileHeight = 5;
public const int realMilliSecondsPerGameTenMinutes = 7000;
public const int rainDensity = 70;
public const int millisecondsPerDialogueLetterType = 30;
public const float pickToolDelay = 500f;
public const int defaultMinFishingBiteTime = 600;
public const int defaultMaxFishingBiteTime = 30000;
public const int defaultMinFishingNibbleTime = 340;
public const int defaultMaxFishingNibbleTime = 800;
public const int minWallpaperPrice = 75;
public const int maxWallpaperPrice = 500;
public const int rainLoopLength = 70;
public const int weather_sunny = 0;
public const int weather_rain = 1;
public const int weather_debris = 2;
public const int weather_lightning = 3;
public const int weather_festival = 4;
public const int weather_snow = 5;
public const int weather_wedding = 6;
public const byte singlePlayer = 0;
public const byte multiplayerClient = 1;
public const byte multiplayerServer = 2;
public const byte logoScreenGameMode = 4;
public const byte titleScreenGameMode = 0;
public const byte loadScreenGameMode = 1;
public const byte newGameMode = 2;
public const byte playingGameMode = 3;
public const byte characterSelectMode = 5;
public const byte loadingMode = 6;
public const byte saveMode = 7;
public const byte saveCompleteMode = 8;
public const byte selectGameScreen = 9;
public const byte creditsMode = 10;
public const byte errorLogMode = 11;
public const string version = "1.2.33";
public const float keyPollingThreshold = 650f;
public const float toolHoldPerPowerupLevel = 600f;
public const float startingMusicVolume = 1f;
public LocalizedContentManager xTileContent;
private static LocalizedContentManager _temporaryContent;
public static GraphicsDeviceManager graphics;
public static LocalizedContentManager content;
public static SpriteBatch spriteBatch;
public static GamePadState oldPadState;
public static KeyboardState oldKBState;
public static MouseState oldMouseState;
private static Farmer _player;
private static Farmer _serverHost;
public static GameLocation currentLocation;
public static GameLocation locationAfterWarp;
public static IDisplayDevice mapDisplayDevice;
public static xTile.Dimensions.Rectangle viewport;
public static Texture2D objectSpriteSheet;
public static Texture2D cropSpriteSheet;
public static Texture2D mailboxTexture;
public static Texture2D emoteSpriteSheet;
public static Texture2D debrisSpriteSheet;
public static Texture2D toolIconBox;
public static Texture2D rainTexture;
public static Texture2D bigCraftableSpriteSheet;
public static Texture2D swordSwipe;
public static Texture2D swordSwipeDark;
public static Texture2D buffsIcons;
public static Texture2D daybg;
public static Texture2D nightbg;
public static Texture2D logoScreenTexture;
public static Texture2D tvStationTexture;
public static Texture2D cloud;
public static Texture2D menuTexture;
public static Texture2D lantern;
public static Texture2D windowLight;
public static Texture2D sconceLight;
public static Texture2D cauldronLight;
public static Texture2D shadowTexture;
public static Texture2D mouseCursors;
public static Texture2D controllerMaps;
public static Texture2D indoorWindowLight;
public static Texture2D animations;
public static Texture2D titleScreenBG;
public static Texture2D logo;
private static RenderTarget2D _lightmap;
public static Texture2D fadeToBlackRect;
public static Texture2D staminaRect;
public static Texture2D currentCoopTexture;
public static Texture2D currentBarnTexture;
public static Texture2D currentHouseTexture;
public static Texture2D greenhouseTexture;
public static Texture2D littleEffect;
public static SpriteFont dialogueFont;
public static SpriteFont smallFont;
public static SpriteFont tinyFont;
public static SpriteFont tinyFontBorder;
public static float fadeToBlackAlpha;
public static float pickToolInterval;
public static float starCropShimmerPause;
public static float noteBlockTimer;
public static float globalFadeSpeed;
public static bool screenGlowUp;
public static bool coopDwellerBorn;
public static bool messagePause;
public static bool isDebrisWeather;
public static bool boardingBus;
public static bool listeningForKeyControlDefinitions;
public static bool weddingToday;
public static bool exitToTitle;
public static bool debugMode;
public static bool isLightning;
public static bool showKeyHelp;
public static bool shippingTax;
public static bool dialogueButtonShrinking;
public static bool jukeboxPlaying;
public static bool drawLighting;
public static bool bloomDay;
public static bool quit;
public static bool isChatting;
public static bool globalFade;
public static bool drawGrid;
public static bool freezeControls;
public static bool saveOnNewDay;
public static bool panMode;
public static bool showingEndOfNightStuff;
public static bool wasRainingYesterday;
public static bool hasLoadedGame;
public static bool isActionAtCurrentCursorTile;
public static bool isInspectionAtCurrentCursorTile;
public static bool paused;
public static bool lastCursorMotionWasMouse;
public static string debugOutput;
public static string selectedItemsType;
public static string nameSelectType;
public static string slotResult;
public static int xLocationAfterWarp;
public static int yLocationAfterWarp;
public static int gameTimeInterval;
public static int currentQuestionChoice;
public static int currentDialogueCharacterIndex;
public static int dialogueTypingInterval;
public static int priceOfSelectedItem;
public static int currentWallpaper;
public static int dialogueWidth;
public static int countdownToWedding;
public static int menuChoice;
public static int currentBillboard;
public static int facingDirectionAfterWarp;
public static int tmpTimeOfDay;
public static int mouseClickPolling;
public static int gamePadXButtonPolling;
public static int gamePadAButtonPolling;
public static int weatherIcon;
public static int hitShakeTimer;
public static int staminaShakeTimer;
public static int pauseThenDoFunctionTimer;
public static int weatherForTomorrow;
public static int cursorTileHintCheckTimer;
public static int timerUntilMouseFade;
public static int minecartHighScore;
public static int whichFarm;
public static List<int> dealerCalicoJackTotal;
public static Color screenGlowColor;
public static NPC currentSpeaker;
public static Dictionary<int, string> objectInformation;
public static Dictionary<int, string> bigCraftablesInformation;
public static MineShaft mine;
public static Dictionary<string, string> NPCGiftTastes;
public static float musicPlayerVolume;
public static float ambientPlayerVolume;
public static float pauseAccumulator;
public static float pauseTime;
public static float upPolling;
public static float downPolling;
public static float rightPolling;
public static float leftPolling;
public static float debrisSoundInterval;
public static float toolHold;
public static float windGust;
public static float creditsTimer;
public static float globalOutdoorLighting;
public static Cue currentSong;
public static AudioCategory musicCategory;
public static AudioCategory soundCategory;
public static AudioCategory ambientCategory;
public static AudioCategory footstepCategory;
public static AudioEngine audioEngine;
public static WaveBank waveBank;
public static SoundBank soundBank;
public static Vector2 previousViewportPosition;
public static Vector2 currentCursorTile;
public static Cue fuseSound;
public static Cue chargeUpSound;
public static Cue wind;
private static byte _gameMode;
private bool _isSaving;
public static byte multiplayerMode;
public static IEnumerator<int> currentLoader;
public static int[] cropsOfTheWeek;
public static Quest questOfTheDay;
public static MoneyMadeScreen moneyMadeScreen;
public static Color ambientLight;
public static IClickableMenu overlayMenu;
private static IClickableMenu _activeClickableMenu;
private const int _fpsHistory = 120;
public static BloomComponent bloom;
public static Dictionary<int, string> achievements;
public static Object dishOfTheDay;
public static BuffsDisplay buffsDisplay;
public static DayTimeMoneyBox dayTimeMoneyBox;
public static Dictionary<long, Farmer> otherFarmers;
public static Server server;
public static Client client;
public static KeyboardDispatcher keyboardDispatcher;
public static Background background;
public static FarmEvent farmEvent;
public static Game1.afterFadeFunction afterFade;
public static Game1.afterFadeFunction afterDialogues;
public static Game1.afterFadeFunction afterViewport;
public static Game1.afterFadeFunction viewportReachedTarget;
public static Game1.afterFadeFunction afterPause;
public static GameTime currentGameTime;
public static Options options;
public static Game1 game1;
public static Point lastMousePositionBeforeFade;
private static string debugPresenceString;
public static bool overrideGameMenuReset;
public static Point viewportCenter;
public static int viewportHold;
private const float CursorBaseSpeed = 16f;
private static int thumbstickPollingTimer;
public static bool toggleFullScreen;
public static string whereIsTodaysFest;
public static bool farmerShouldPassOut;
public const string NO_LETTER_MAIL = "%&NL&%";
private static Task _newDayTask;
private static Action _afterNewDayAction;
public static Vector2 currentViewportTarget;
public static Vector2 viewportPositionLerp;
public static float screenGlowMax;
private string panModeString;
private bool panFacingDirectionWait;
public static int thumbstickMotionMargin;
public static int triggerPolling;
public static int rightClickPolling;
private RenderTarget2D _screen;
public static NPC objectDialoguePortraitPerson;
public void CleanupReturningToTitle()
{
Console.WriteLine("CleanupReturningToTitle()");
SaveGame.CancelToTitle = false;
Game1.overlayMenu = (IClickableMenu) null;
Game1._afterNewDayAction = (Action) null;
Game1._currentMinigame = (IMinigame) null;
Game1.gameMode = (byte) 0;
this._isSaving = false;
Game1._mouseCursorTransparency = 1f;
Game1._newDayTask = (Task) null;
Game1.resetPlayer();
Game1.serverHost = (Farmer) null;
Game1.afterDialogues = (Game1.afterFadeFunction) null;
Game1.afterFade = (Game1.afterFadeFunction) null;
Game1.afterPause = (Game1.afterFadeFunction) null;
Game1.afterViewport = (Game1.afterFadeFunction) null;
Game1.ambientLight = new Color(0, 0, 0, 0);
Game1.background = (Background) null;
Game1.bloom = (BloomComponent) null;
Game1.bloomDay = false;
Game1.boardingBus = false;
Game1.chanceToRainTomorrow = 0.0;
Game1.client = (Client) null;
Game1.cloud = (Texture2D) null;
Game1.conventionMode = false;
Game1.coopDwellerBorn = false;
Game1.countdownToWedding = 0;
Game1.creditsTimer = 0.0f;
Game1.cropsOfTheWeek = (int[]) null;
Game1.currentBarnTexture = (Texture2D) null;
Game1.currentBillboard = 0;
Game1.currentCoopTexture = (Texture2D) null;
Game1.currentCursorTile = Vector2.Zero;
Game1.currentDialogueCharacterIndex = 0;
Game1.currentFloor = 3;
Game1.currentHouseTexture = (Texture2D) null;
Game1.currentLightSources.Clear();
Game1.currentLoader = (IEnumerator<int>) null;
Game1.currentLocation = (GameLocation) null;
Game1.currentObjectDialogue.Clear();
Game1.currentQuestionChoice = 0;
Game1.currentSeason = "spring";
Game1.currentSongIndex = 3;
Game1.currentSpeaker = (NPC) null;
Game1.currentViewportTarget = Vector2.Zero;
Game1.currentWallpaper = 0;
Game1.cursorTileHintCheckTimer = 0;
Game1.dailyLuck = 0.001;
Game1.dayOfMonth = 0;
Game1.dealerCalicoJackTotal = (List<int>) null;
Game1.debrisSoundInterval = 0.0f;
Game1.debrisWeather.Clear();
Game1.debugMode = false;
Game1.debugOutput = (string) null;
Game1.debugPresenceString = "In menus";
Game1.delayedActions.Clear();
Game1.dialogueButtonScale = 1f;
Game1.dialogueButtonShrinking = false;
Game1.dialogueTyping = false;
Game1.dialogueTypingInterval = 0;
Game1.dialogueUp = false;
Game1.dialogueWidth = 1024;
Game1.dishOfTheDay = (Object) null;
Game1.displayFarmer = true;
Game1.displayHUD = true;
Game1.downPolling = 0.0f;
Game1.drawGrid = false;
Game1.drawLighting = false;
Game1.elliottBookName = "Blue Tower";
Game1.endOfNightMenus.Clear();
Game1.errorMessage = "";
Game1.eveningColor = new Color((int) byte.MaxValue, (int) byte.MaxValue, 0, (int) byte.MaxValue);
Game1.eventOver = false;
Game1.eventUp = false;
Game1.exitToTitle = false;
Game1.facingDirectionAfterWarp = 0;
Game1.fadeIn = true;
Game1.fadeToBlack = false;
Game1.fadeToBlackAlpha = 1.02f;
Game1.FarmerFloor = 29;
Game1.farmerShouldPassOut = false;
Game1.farmerWallpaper = 22;
Game1.farmEvent = (FarmEvent) null;
Game1.fertilizer = "";
Game1.flashAlpha = 0.0f;
Game1.floorPrice = 75;
Game1.freezeControls = false;
Game1.gamePadAButtonPolling = 0;
Game1.gameTimeInterval = 0;
Game1.globalFade = false;
Game1.globalFadeSpeed = 0.0f;
Game1.globalOutdoorLighting = 0.0f;
Game1.greenhouseTexture = (Texture2D) null;
Game1.haltAfterCheck = false;
Game1.hasLoadedGame = false;
Game1.hitShakeTimer = 0;
Game1.hudMessages.Clear();
Game1.inMine = false;
Game1.isActionAtCurrentCursorTile = false;
Game1.isChatting = false;
Game1.isDebrisWeather = false;
Game1.isEating = false;
Game1.isInspectionAtCurrentCursorTile = false;
Game1.isLightning = false;
Game1.isQuestion = false;
Game1.isRaining = false;
Game1.isSnowing = false;
Game1.jukeboxPlaying = false;
Game1.keyHelpString = "";
Game1.killScreen = false;
Game1.lastCursorMotionWasMouse = true;
Game1.lastCursorTile = Vector2.Zero;
Game1.lastDebugInput = "";
Game1.lastMousePositionBeforeFade = Point.Zero;
Game1.leftPolling = 0.0f;
Game1.listeningForKeyControlDefinitions = false;
Game1.loadingMessage = "";
Game1.locationAfterWarp = (GameLocation) null;
Game1.locations.Clear();
Game1.logo = (Texture2D) null;
Game1.logoScreenTexture = (Texture2D) null;
Game1.mailbox.Clear();
Game1.mailboxTexture = (Texture2D) null;
Game1.mapDisplayDevice = (IDisplayDevice) new XnaDisplayDevice(this.Content, this.GraphicsDevice);
Game1.menuChoice = 0;
Game1.menuUp = false;
Game1.messageAfterPause = "";
Game1.messagePause = false;
Game1.mine = (MineShaft) null;
Game1.minecartHighScore = 0;
Game1.moneyMadeScreen = (MoneyMadeScreen) null;
Game1.mouseClickPolling = 0;
Game1.mouseCursor = 0;
Game1.multiplayerMode = (byte) 0;
Game1.nameSelectType = (string) null;
Game1.nameSelectUp = false;
Game1.newDay = false;
Game1.nonWarpFade = false;
Game1.noteBlockTimer = 0.0f;
Game1.numberOfSelectedItems = -1;
Game1.objectDialoguePortraitPerson = (NPC) null;
Game1.onScreenMenus.Clear();
Game1.onScreenMenus.Add((IClickableMenu) new Toolbar());
Game1.dayTimeMoneyBox = new DayTimeMoneyBox();
Game1.onScreenMenus.Add((IClickableMenu) Game1.dayTimeMoneyBox);
Game1.buffsDisplay = new BuffsDisplay();
Game1.onScreenMenus.Add((IClickableMenu) Game1.buffsDisplay);
Game1.options = new Options();
for (int index = 0; index < Game1.otherFarmers.Count; ++index)
Game1.otherFarmers[(long) index].unload();
Game1.otherFarmers.Clear();
Game1.outdoorLight = new Color((int) byte.MaxValue, (int) byte.MaxValue, 0, (int) byte.MaxValue);
Game1.overlayMenu = (IClickableMenu) null;
Game1.overrideGameMenuReset = false;
this.panFacingDirectionWait = false;
Game1.panMode = false;
this.panModeString = (string) null;
Game1.particleRaining = false;
Game1.pauseAccumulator = 0.0f;
Game1.paused = false;
Game1.pauseThenDoFunctionTimer = 0;
Game1.pauseTime = 0.0f;
Game1.percentageToWinStardewHero = 70;
Game1.pickingTool = false;
Game1.pickToolInterval = 0.0f;
Game1.pixelZoom = 4;
Game1.previousViewportPosition = Vector2.Zero;
Game1.priceOfSelectedItem = 0;
Game1.progressBar = false;
Game1.questionChoices.Clear();
Game1.questOfTheDay = (Quest) null;
Game1.quit = false;
Game1.rightClickPolling = 0;
Game1.rightPolling = 0.0f;
Game1.runThreshold = 0.5f;
Game1.samBandName = "The Alfalfas";
Game1.saveOnNewDay = true;
Game1.screenGlow = false;
Game1.screenGlowAlpha = 0.0f;
Game1.screenGlowColor = new Color(0, 0, 0, 0);
Game1.screenGlowHold = false;
Game1.screenGlowMax = 0.0f;
Game1.screenGlowRate = 0.005f;
Game1.screenGlowUp = false;
Game1.screenOverlayTempSprites.Clear();
Game1.selectedItemsType = (string) null;
Game1.server = (Server) null;
Game1.shiny = Vector2.Zero;
Game1.shippingBin.Clear();
Game1.shippingTax = false;
Game1.showingEndOfNightStuff = false;
Game1.showKeyHelp = false;
Game1.slotResult = (string) null;
Game1.spawnMonstersAtNight = false;
Game1.staminaShakeTimer = 0;
Game1.starCropShimmerPause = 0.0f;
Game1.stats = new Stats();
Game1.swordSwipe = (Texture2D) null;
Game1.swordSwipeDark = (Texture2D) null;
Game1.textColor = new Color(34, 17, 34, (int) byte.MaxValue);
Game1.textShadowColor = new Color(206, 156, 95, (int) byte.MaxValue);
Game1.thumbstickMotionAccell = 1f;
Game1.thumbstickMotionMargin = 0;
Game1.thumbstickPollingTimer = 0;
Game1.thumbStickSensitivity = 0.1f;
Game1.tileSize = 64;
Game1.timeOfDay = 600;
Game1.timerUntilMouseFade = 0;
Game1.titleScreenBG = (Texture2D) null;
Game1.tmpTimeOfDay = 0;
Game1.toggleFullScreen = false;
Game1.toolHold = 0.0f;
Game1.toolIconBox = (Texture2D) null;
Game1.ResetToolSpriteSheet();
Game1.triggerPolling = 0;
Game1.tvStation = -1;
Game1.tvStationTexture = (Texture2D) null;
Game1.uniqueIDForThisGame = (ulong) (DateTime.UtcNow - new DateTime(2012, 6, 22)).TotalSeconds;
Game1.upPolling = 0.0f;
Game1.viewportFreeze = false;
Game1.viewportHold = 0;
Game1.viewportPositionLerp = Vector2.Zero;
Game1.viewportReachedTarget = (Game1.afterFadeFunction) null;
Game1.viewportSpeed = 2f;
Game1.viewportTarget = new Vector2((float) int.MinValue, (float) int.MinValue);
Game1.wallpaperPrice = 75;
Game1.wasMouseVisibleThisFrame = true;
Game1.wasRainingYesterday = false;
Game1.weatherForTomorrow = 0;
Game1.weatherIcon = 0;
Game1.weddingToday = false;
Game1.whereIsTodaysFest = (string) null;
Game1.whichFarm = 0;
Game1.windGust = 0.0f;
Game1.xLocationAfterWarp = 0;
Game1.game1.xTileContent.Dispose();
Game1.game1.xTileContent = this.CreateContentManager(Game1.content.ServiceProvider, Game1.content.RootDirectory);
Game1.year = 1;
Game1.yLocationAfterWarp = 0;
JojaMart.Morris = (NPC) null;
AmbientLocationSounds.onLocationLeave();
WeatherDebris.globalWind = -0.25f;
Utility.killAllStaticLoopingSoundCues();
TitleMenu.subMenu = (IClickableMenu) null;
OptionsDropDown.selected = (OptionsDropDown) null;
JunimoNoteMenu.tempSprites.Clear();
JunimoNoteMenu.screenSwipe = (ScreenSwipe) null;
JunimoNoteMenu.canClick = true;
GameMenu.forcePreventClose = false;
Club.timesPlayedCalicoJack = 0;
if (GamePad.GetState(PlayerIndex.One).IsConnected)
Game1.options.gamepadControls = true;
Game1.game1.refreshWindowSettings();
if (Game1.activeClickableMenu == null || !(Game1.activeClickableMenu is TitleMenu))
return;
(Game1.activeClickableMenu as TitleMenu).applyPreferences();
Game1.activeClickableMenu.gameWindowSizeChanged(Game1.graphics.GraphicsDevice.Viewport.Bounds, Game1.graphics.GraphicsDevice.Viewport.Bounds);
}
public static void GetNumFarmsSavedAsync(ReportNumFarms callback)
{
new Task((Action) (() =>
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
callback(Game1.GetNumFarmsSaved());
})).Start();
}
public static int GetNumFarmsSaved()
{
int num = 0;
string str = Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley"), "Saves"));
if (Directory.Exists(str))
{
foreach (string directory in Directory.GetDirectories(str))
{
string path = Path.Combine(str, directory, "SaveGameInfo");
try
{
using (File.Open(path, FileMode.Open))
++num;
}
catch (Exception ex)
{
}
}
}
return num;
}
public static int GetMaxNumFarmsSaved()
{
return int.MaxValue;
}
private static string GameModeToString(byte mode)
{
switch (mode)
{
case 0:
return string.Format("titleScreenGameMode ({0})", (object) mode);
case 1:
return string.Format("loadScreenGameMode ({0})", (object) mode);
case 2:
return string.Format("newGameMode ({0})", (object) mode);
case 3:
return string.Format("playingGameMode ({0})", (object) mode);
case 4:
return string.Format("logoScreenGameMode ({0})", (object) mode);
case 5:
return string.Format("characterSelectMode ({0})", (object) mode);
case 6:
return string.Format("loadingMode ({0})", (object) mode);
case 7:
return string.Format("saveMode ({0})", (object) mode);
case 8:
return string.Format("saveCompleteMode ({0})", (object) mode);
case 9:
return string.Format("selectGameScreen ({0})", (object) mode);
case 10:
return string.Format("creditsMode ({0})", (object) mode);
case 11:
return string.Format("errorLogMode ({0})", (object) mode);
default:
return string.Format("unknown ({0})", (object) mode);
}
}
public static LocalizedContentManager temporaryContent
{
get
{
if (Game1._temporaryContent == null)
Game1._temporaryContent = Game1.content.CreateTemporary();
return Game1._temporaryContent;
}
}
public static Farmer player
{
get
{
return Game1._player;
}
set
{
if (Game1._player != null)
{
Game1._player.unload();
Game1._player = (Farmer) null;
}
Game1._player = value;
}
}
public static Farmer serverHost
{
get
{
return Game1._serverHost;
}
set
{
if (Game1._serverHost != null)
{
if (Game1._serverHost != Game1._player)
Game1._serverHost.unload();
Game1._serverHost = (Farmer) null;
}
Game1._serverHost = value;
}
}
public static Texture2D toolSpriteSheet
{
get
{
if (Game1._toolSpriteSheet == null)
Game1.ResetToolSpriteSheet();
return Game1._toolSpriteSheet;
}
}
public static void ResetToolSpriteSheet()
{
if (Game1._toolSpriteSheet != null)
{
Game1._toolSpriteSheet.Dispose();
Game1._toolSpriteSheet = (Texture2D) null;
}
Texture2D texture2D1 = Game1.game1.Content.Load<Texture2D>("TileSheets\\tools");
int width = texture2D1.Width;
int height = texture2D1.Height;
int levelCount = texture2D1.LevelCount;
Texture2D texture2D2 = new Texture2D(Game1.game1.GraphicsDevice, width, height, false, SurfaceFormat.Color);
Color[] data1 = new Color[width * height];
texture2D1.GetData<Color>(data1);
Color[] data2 = data1;
texture2D2.SetData<Color>(data2);
Game1._toolSpriteSheet = texture2D2;
}
public static RenderTarget2D lightmap
{
get
{
return Game1._lightmap;
}
}
private static void allocateLightmap()
{
int num1 = 32;
float num2 = 1f;
if (Game1.options != null)
{
num1 = Game1.options.lightingQuality;
num2 = Game1.options.zoomLevel;
}
int width = (int) ((double) Game1.graphics.GraphicsDevice.Viewport.Width * (1.0 / (double) num2) + (double) Game1.tileSize) / (num1 / 2);
int height = (int) ((double) Game1.graphics.GraphicsDevice.Viewport.Height * (1.0 / (double) num2) + (double) Game1.tileSize) / (num1 / 2);
if (Game1.lightmap != null && Game1.lightmap.Width == width && Game1.lightmap.Height == height)
return;
if (Game1._lightmap != null)
Game1._lightmap.Dispose();
Game1._lightmap = new RenderTarget2D(Game1.graphics.GraphicsDevice, width, height, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
}
public static string CurrentSeasonDisplayName
{
get
{
return Game1.content.LoadString("Strings\\StringsFromCSFiles:" + Game1.currentSeason);
}
}
public static byte gameMode
{
get
{
return Game1._gameMode;
}
set
{
if ((int) Game1._gameMode == (int) value)
return;
Console.WriteLine("gameMode was '{0}', set to '{1}'.", (object) Game1.GameModeToString(Game1._gameMode), (object) Game1.GameModeToString(value));
Game1._gameMode = value;
}
}
public bool IsSaving
{
get
{
return this._isSaving;
}
set
{
this._isSaving = value;
}
}
public static IClickableMenu activeClickableMenu
{
get
{
return Game1._activeClickableMenu;
}
set
{
if (Game1._activeClickableMenu is IDisposable)
(Game1._activeClickableMenu as IDisposable).Dispose();
Game1._activeClickableMenu = value;
}
}
public static IMinigame currentMinigame
{
get
{
return Game1._currentMinigame;
}
set
{
Game1._currentMinigame = value;
if (value == null)
{
if (Game1.currentLocation == null)
return;
Game1.setRichPresence("location", (object) Game1.currentLocation.Name);
}
else
{
if (value.minigameId() == null)
return;
Game1.setRichPresence("minigame", (object) value.minigameId());
}
}
}
public static void ExitToTitle()
{
Game1.changeMusicTrack("none");
Game1.setGameMode((byte) 0);
Game1.exitToTitle = true;
}
public static bool IsMultiplayer
{
get
{
return (uint) Game1.multiplayerMode > 0U;
}
}
public static bool IsClient
{
get
{
return (int) Game1.multiplayerMode == 1;
}
}
public static bool IsServer
{
get
{
return (int) Game1.multiplayerMode == 2;
}
}
public static bool IsMasterGame
{
get
{
if ((int) Game1.multiplayerMode != 0)
return (int) Game1.multiplayerMode == 2;
return true;
}
}
public static ChatBox ChatBox
{
get
{
foreach (IClickableMenu onScreenMenu in Game1.onScreenMenus)
{
if (onScreenMenu is ChatBox)
return (ChatBox) onScreenMenu;
}
return (ChatBox) null;
}
}
public static Event CurrentEvent
{
get
{
if (Game1.currentLocation == null)
return (Event) null;
return Game1.currentLocation.currentEvent;
}
}
public Game1()
{
Program.gamePtr = this;
Game1.game1 = this;
Program.sdk.EarlyInitialize();
Game1.graphics = new GraphicsDeviceManager((Game) this);
Game1.graphics.PreferredBackBufferWidth = 1280;
Game1.graphics.PreferredBackBufferHeight = 720;
Game1.viewport = new xTile.Dimensions.Rectangle(new Size(1280, 720));
this.Window.AllowUserResizing = true;
this.Content.RootDirectory = "Content";
Game1._temporaryContent = this.CreateContentManager(this.Content.ServiceProvider, this.Content.RootDirectory);
this.Window.ClientSizeChanged += new EventHandler<EventArgs>(this.Window_ClientSizeChanged);
this.Exiting += new EventHandler<EventArgs>(this.exitEvent);
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
LocalizedContentManager.OnLanguageChange += (LocalizedContentManager.LanguageChangedHandler) (code => this.TranslateFields());
}
private void TranslateFields()
{