├── .gitignore ├── Force.DeepCloner ├── DeepClonerExtensions.cs └── Helpers │ ├── ClonerToExprGenerator.cs │ ├── DeepCloneState.cs │ ├── DeepClonerCache.cs │ ├── DeepClonerExprGenerator.cs │ ├── DeepClonerGenerator.cs │ ├── DeepClonerMsilGenerator.cs │ ├── DeepClonerMsilHelper.cs │ ├── DeepClonerSafeTypes.cs │ ├── ReflectionHelper.cs │ ├── ShallowClonerGenerator.cs │ ├── ShallowObjectCloner.cs │ └── TypeCreationHelper.cs ├── Ionic ├── Crc │ ├── CRC32.cs │ └── CrcCalculatorStream.cs └── Zlib │ ├── Adler.cs │ ├── BlockState.cs │ ├── CompressionLevel.cs │ ├── CompressionMode.cs │ ├── CompressionStrategy.cs │ ├── DeflateFlavor.cs │ ├── DeflateManager.cs │ ├── FlushType.cs │ ├── GZipStream.cs │ ├── InfTree.cs │ ├── InflateBlocks.cs │ ├── InflateCodes.cs │ ├── InflateManager.cs │ ├── InternalConstants.cs │ ├── InternalInflateConstants.cs │ ├── SharedUtils.cs │ ├── StaticTree.cs │ ├── Tree.cs │ ├── ZlibBaseStream.cs │ ├── ZlibCodec.cs │ ├── ZlibConstants.cs │ ├── ZlibException.cs │ ├── ZlibStream.cs │ └── ZlibStreamFlavor.cs ├── Microsoft.Xna.Framework.Graphics └── ViewportExtensions.cs ├── Microsoft.Xna.Framework.RuntimeProfile ├── Netcode ├── AbstractNetEvent1.cs ├── AbstractNetSerializable.cs ├── BinaryReaderWriterExtensions.cs ├── ILoggingWriter.cs ├── INetObject.cs ├── INetRoot.cs ├── INetSerializable.cs ├── InterpolationCancellable.cs ├── NetArray.cs ├── NetBool.cs ├── NetByte.cs ├── NetClock.cs ├── NetCollection.cs ├── NetColor.cs ├── NetDictionary.cs ├── NetDouble.cs ├── NetEnum.cs ├── NetEvent0.cs ├── NetEvent1.cs ├── NetEvent1Field.cs ├── NetEventArg.cs ├── NetEventBinary.cs ├── NetExtendableRef.cs ├── NetField.cs ├── NetFieldBase.cs ├── NetFieldDictionary.cs ├── NetFields.cs ├── NetFloat.cs ├── NetGuid.cs ├── NetGuidDictionary.cs ├── NetInt.cs ├── NetIntDelta.cs ├── NetIntList.cs ├── NetList.cs ├── NetLong.cs ├── NetLongList.cs ├── NetNullableEnum.cs ├── NetObjectArray.cs ├── NetObjectList.cs ├── NetObjectShrinkList.cs ├── NetPoint.cs ├── NetRectangle.cs ├── NetRef.cs ├── NetRefBase.cs ├── NetRefTypes.cs ├── NetRoot.cs ├── NetRootDictionary.cs ├── NetRotation.cs ├── NetString.cs ├── NetStringList.cs ├── NetTimestamp.cs ├── NetVector2.cs ├── NetVersion.cs ├── Netcode.csproj ├── Properties │ └── AssemblyInfo.cs ├── SerializationCollectionFacade.cs ├── SerializationFacade.cs └── StardewValley.Util │ └── GuidHelper.cs ├── README.md ├── Sickhead.Engine.Util └── MemberInfoExtensions.cs ├── StardewValley.GameData ├── BundleData.cs ├── BundleSetData.cs ├── Crafting │ └── TailorItemRecipe.cs ├── FishPond │ ├── FishPondData.cs │ └── FishPondReward.cs ├── HomeRenovations │ ├── HomeRenovation.cs │ ├── Rect.cs │ ├── RectGroup.cs │ └── RenovationValue.cs ├── Movies │ ├── CharacterResponse.cs │ ├── ConcessionItemData.cs │ ├── ConcessionTaste.cs │ ├── MovieCharacterReaction.cs │ ├── MovieData.cs │ ├── MovieReaction.cs │ ├── MovieScene.cs │ └── SpecialResponses.cs ├── Properties │ └── AssemblyInfo.cs ├── RandomBundleData.cs ├── RandomizedElement.cs ├── RandomizedElementItem.cs ├── SpecialOrderData.cs ├── SpecialOrderObjectiveData.cs ├── SpecialOrderRewardData.cs └── StardewValley.GameData.csproj ├── StardewValley.sln └── StardewValley ├── AbortNetSynchronizerException.cs ├── AmethystEnchantment.cs ├── AnimalHouse.cs ├── AnimatedSprite.cs ├── AquamarineEnchantment.cs ├── ArchaeologistEnchantment.cs ├── ArtfulEnchantment.cs ├── ArtifactSpotWatchActivity.cs ├── AudioCategoryWrapper.cs ├── AudioEngineWrapper.cs ├── AutoHookEnchantment.cs ├── AxeEnchantment.cs ├── Background.cs ├── BaseEnchantment.cs ├── BaseWeaponEnchantment.cs ├── BatTemporarySprite.cs ├── BellsAndWhistles ├── AmbientLocationSounds.cs ├── Bird.cs ├── Birdie.cs ├── Butterfly.cs ├── CalderaMonkey.cs ├── Cloud.cs ├── CrabCritter.cs ├── Critter.cs ├── Crow.cs ├── EmilysParrot.cs ├── Firefly.cs ├── Frog.cs ├── Lexicon.cs ├── MoneyDial.cs ├── OverheadParrot.cs ├── Owl.cs ├── ParrotPlatform.cs ├── ParrotUpgradePerch.cs ├── PerchingBirds.cs ├── PlayerStatusList.cs ├── Rabbit.cs ├── SandDuggy.cs ├── ScreenFade.cs ├── ScreenSwipe.cs ├── Seagull.cs ├── SebsFrogs.cs ├── SparklingText.cs ├── SpriteText.cs ├── Squirrel.cs ├── SuspensionBridge.cs ├── Train.cs ├── TrainCar.cs └── Woodpecker.cs ├── BloomComponent.cs ├── BloomSettings.cs ├── BluePrint.cs ├── BottomlessEnchantment.cs ├── Buff.cs ├── BugKillerEnchantment.cs ├── BuildingPaintColor.cs ├── BuildingPainter.cs ├── BuildingUpgrade.cs ├── Buildings ├── Barn.cs ├── Building.cs ├── Coop.cs ├── FishPond.cs ├── GreenhouseBuilding.cs ├── JumpingFish.cs ├── JunimoHut.cs ├── Mill.cs ├── PondFishSilhouette.cs ├── ShippingBin.cs └── Stable.cs ├── BundleGenerator.cs ├── ButtonCollection.cs ├── CachedMultiplayerMap.cs ├── ChangeType.cs ├── CharEnteredHandler.cs ├── Character.cs ├── CharacterEventArgs.cs ├── Characters ├── BotchedNetBool.cs ├── BotchedNetField.cs ├── BotchedNetInt.cs ├── BotchedNetLong.cs ├── Cat.cs ├── Child.cs ├── Dog.cs ├── Horse.cs ├── Junimo.cs ├── JunimoHarvester.cs ├── Pet.cs └── TrashBear.cs ├── Chunk.cs ├── ClearingActivity.cs ├── CollectObjective.cs ├── ColorChanger.cs ├── CosmeticDebris.cs ├── CraftingRecipe.cs ├── Crop.cs ├── CropWatchActivity.cs ├── CrusaderEnchantment.cs ├── CueWrapper.cs ├── Debris.cs ├── DebugMetricsComponent.cs ├── DebugTools.cs ├── DelayedAction.cs ├── DeliverObjective.cs ├── DesktopClipboard.cs ├── Dialogue.cs ├── DiamondEnchantment.cs ├── DisposableList.cs ├── DonateObjective.cs ├── DummyAudioCategory.cs ├── DummyAudioEngine.cs ├── DummyCue.cs ├── DummySoundBank.cs ├── EfficientToolEnchantment.cs ├── EmeraldEnchantment.cs ├── Event.cs ├── EventScript_GreenTea.cs ├── Events ├── BirthingEvent.cs ├── DiaryEvent.cs ├── FairyEvent.cs ├── FarmEvent.cs ├── MovieTheaterScreeningEvent.cs ├── PlayerCoupleBirthingEvent.cs ├── QuestionEvent.cs ├── SoundInTheNightEvent.cs ├── WitchEvent.cs └── WorldChangeEvent.cs ├── Farm.cs ├── FarmActivity.cs ├── FarmAnimal.cs ├── Farmer.cs ├── FarmerPair.cs ├── FarmerRenderer.cs ├── FarmerSprite.cs ├── FarmerTeam.cs ├── Fence.cs ├── FishObjective.cs ├── FishingRodEnchantment.cs ├── FlowerWatchActivity.cs ├── FrameRateCounter.cs ├── Friendship.cs ├── FriendshipReward.cs ├── FriendshipStatus.cs ├── FurniturePlacer.cs ├── GalaxySoulEnchantment.cs ├── Game1.cs ├── GameLocation.cs ├── GameRunner.cs ├── GemsReward.cs ├── GenerousEnchantment.cs ├── GiftObjective.cs ├── HUDMessage.cs ├── HairStyleMetadata.cs ├── HaymakerEnchantment.cs ├── HoeEnchantment.cs ├── HouseRenovation.cs ├── IAnimalLocation.cs ├── IAudioCategory.cs ├── IAudioEngine.cs ├── ICue.cs ├── ICustomEventScript.cs ├── IKeyboardSubscriber.cs ├── ISalable.cs ├── ISittable.cs ├── ISoundBank.cs ├── InputButton.cs ├── InputState.cs ├── InstanceGame.cs ├── InstanceStatics.cs ├── InstancedStatic.cs ├── InteriorDoor.cs ├── InteriorDoorDictionary.cs ├── IslandGemBird.cs ├── Item.cs ├── JKScoreObjective.cs ├── JadeEnchantment.cs ├── KeyEventArgs.cs ├── KeyEventHandler.cs ├── KeyboardDispatcher.cs ├── KeyboardInput.cs ├── KeyboardLayout.cs ├── LightSource.cs ├── ListPool.cs ├── LivestockSprite.cs ├── LocalMultiplayer.cs ├── LocalizedContentManager.cs ├── LocationRequest.cs ├── LocationWeather.cs ├── Locations ├── AbandonedJojaMart.cs ├── AdventureGuild.cs ├── BathHousePool.cs ├── Beach.cs ├── BeachNightMarket.cs ├── BoatTunnel.cs ├── BugLand.cs ├── BuildableGameLocation.cs ├── Bus.cs ├── BusStop.cs ├── Cabin.cs ├── Caldera.cs ├── Cellar.cs ├── Club.cs ├── CommunityCenter.cs ├── DecoratableLocation.cs ├── DecorationFacade.cs ├── Desert.cs ├── DwarfGate.cs ├── FarmCave.cs ├── FarmHouse.cs ├── FishShop.cs ├── Forest.cs ├── IslandEast.cs ├── IslandFarmCave.cs ├── IslandFarmHouse.cs ├── IslandFieldOffice.cs ├── IslandForestLocation.cs ├── IslandHut.cs ├── IslandLocation.cs ├── IslandNorth.cs ├── IslandSecret.cs ├── IslandShrine.cs ├── IslandSouth.cs ├── IslandSouthEast.cs ├── IslandSouthEastCave.cs ├── IslandWest.cs ├── IslandWestCave1.cs ├── JojaMart.cs ├── LibraryMuseum.cs ├── ManorHouse.cs ├── MermaidHouse.cs ├── Mine.cs ├── MineInfo.cs ├── MineShaft.cs ├── Mountain.cs ├── MovieTheater.cs ├── Railroad.cs ├── SeedShop.cs ├── Sewer.cs ├── ShopLocation.cs ├── Submarine.cs ├── Summit.cs ├── Town.cs ├── VolcanoDungeon.cs ├── Wisp.cs ├── WizardHouse.cs └── Woods.cs ├── LoggingBinaryWriter.cs ├── MagicEnchantment.cs ├── MailActivity.cs ├── MailReward.cs ├── MapSeat.cs ├── MarriageDialogueReference.cs ├── MasterEnchantment.cs ├── Menus ├── AboutMenu.cs ├── AddNewItemMenu.cs ├── AdvancedGameOptions.cs ├── AnimalQueryMenu.cs ├── AnimationPreviewTool.cs ├── Billboard.cs ├── BlueprintsMenu.cs ├── BobberBar.cs ├── BuffsDisplay.cs ├── BuildingPaintMenu.cs ├── Bundle.cs ├── BundleIngredientDescription.cs ├── ButtonTutorialMenu.cs ├── CarpenterMenu.cs ├── CataloguePage.cs ├── CharacterCustomization.cs ├── ChatBox.cs ├── ChatMessage.cs ├── ChatSnippet.cs ├── ChatTextBox.cs ├── ChooseFromListMenu.cs ├── ClickableAnimatedComponent.cs ├── ClickableComponent.cs ├── ClickableTextureComponent.cs ├── CollectionsPage.cs ├── ColorPicker.cs ├── ConfirmationDialog.cs ├── CoopMenu.cs ├── CraftingPage.cs ├── DayTimeMoneyBox.cs ├── DialogueBox.cs ├── DigitEntryMenu.cs ├── DiscreteColorPicker.cs ├── DyeMenu.cs ├── EmojiMenu.cs ├── EmoteMenu.cs ├── EmoteSelector.cs ├── ExitPage.cs ├── FarmInfoPage.cs ├── FarmerBoxButton.cs ├── FarmersBox.cs ├── FarmhandMenu.cs ├── FieldOfficeMenu.cs ├── Fish.cs ├── ForgeMenu.cs ├── GameMenu.cs ├── GeodeMenu.cs ├── IClickableMenu.cs ├── ICreditsBlock.cs ├── ImageCreditsBlock.cs ├── InventoryMenu.cs ├── InventoryPage.cs ├── InviteCodeDialog.cs ├── ItemGrabMenu.cs ├── ItemListMenu.cs ├── JojaCDMenu.cs ├── JunimoNoteMenu.cs ├── LanguageSelectionMenu.cs ├── LetterViewerMenu.cs ├── LevelUpMenu.cs ├── LinkCreditsBlock.cs ├── LoadGameMenu.cs ├── LocalCoopJoinMenu.cs ├── MapPage.cs ├── MenuHUDButtons.cs ├── MenuWithInventory.cs ├── MineElevatorMenu.cs ├── MiniatureTerrainFeature.cs ├── MuseumMenu.cs ├── NamingMenu.cs ├── NumberSelectionMenu.cs ├── OptionsButton.cs ├── OptionsCheckbox.cs ├── OptionsDropDown.cs ├── OptionsElement.cs ├── OptionsInputListener.cs ├── OptionsPage.cs ├── OptionsPlusMinus.cs ├── OptionsPlusMinusButton.cs ├── OptionsSlider.cs ├── OptionsTextEntry.cs ├── PI_ItemList.cs ├── PendingProposalDialog.cs ├── PondQueryMenu.cs ├── ProfileItem.cs ├── ProfileMenu.cs ├── PurchaseAnimalsMenu.cs ├── QuestContainerMenu.cs ├── QuestLog.cs ├── ReadyCheckDialog.cs ├── RenovateMenu.cs ├── SaveGameMenu.cs ├── ScreenSizeAdjustMenu.cs ├── ServerConnectionDialog.cs ├── ShippingMenu.cs ├── ShopMenu.cs ├── SkillsPage.cs ├── SkipForClickableAggregation.cs ├── SliderBar.cs ├── SocialPage.cs ├── SpecialCurrencyDisplay.cs ├── SpecialOrdersBoard.cs ├── StorageContainer.cs ├── StrengthGame.cs ├── TailorRecipeListTool.cs ├── TailoringMenu.cs ├── TextBox.cs ├── TextBoxEvent.cs ├── TextCreditsBlock.cs ├── TextEntryMenu.cs ├── TitleMenu.cs ├── TitleTextInputMenu.cs ├── TooManyFarmsMenu.cs ├── Toolbar.cs ├── TutorialMenu.cs └── WheelSpinGame.cs ├── MilkPailEnchantment.cs ├── Minigames ├── AbigailGame.cs ├── BoatJourney.cs ├── CalicoJack.cs ├── CraneGame.cs ├── Darts.cs ├── FantasyBoardGame.cs ├── FishingGame.cs ├── GrandpaStory.cs ├── HaleyCowPictures.cs ├── IMinigame.cs ├── Intro.cs ├── MaruComet.cs ├── MineCart.cs ├── NetLeaderboards.cs ├── NetLeaderboardsEntry.cs ├── OldMineCart.cs ├── ParallaxBG.cs ├── PlaneFlyBy.cs ├── RobotBlastoff.cs ├── Slots.cs ├── TargetGame.cs ├── TelescopeScene.cs └── Test.cs ├── ModDataDictionary.cs ├── ModHooks.cs ├── MoneyMadeScreen.cs ├── MoneyReward.cs ├── Monsters ├── AngryRoger.cs ├── Bat.cs ├── BigSlime.cs ├── BlueSquid.cs ├── Bug.cs ├── DinoMonster.cs ├── Duggy.cs ├── DustSpirit.cs ├── DwarvishSentry.cs ├── Fly.cs ├── Ghost.cs ├── GreenSlime.cs ├── Grub.cs ├── HotHead.cs ├── LavaCrab.cs ├── LavaLurk.cs ├── Leaper.cs ├── MetalHead.cs ├── Monster.cs ├── Mummy.cs ├── ParryEventArgs.cs ├── RockCrab.cs ├── RockGolem.cs ├── Serpent.cs ├── ShadowBrute.cs ├── ShadowGirl.cs ├── ShadowGuy.cs ├── ShadowShaman.cs ├── Shooter.cs ├── Skeleton.cs ├── Spiker.cs └── SquidKid.cs ├── MovieConcession.cs ├── MovieInvitation.cs ├── MovieViewerLockEvent.cs ├── Multiplayer.cs ├── MultipleMutexRequest.cs ├── NPC.cs ├── NPCController.cs ├── NPCDialogueResponse.cs ├── NameSelect.cs ├── NetFarmerPairDictionary.cs ├── NetIntIntArrayDictionary.cs ├── NetLogRecord.cs ├── NetLogger.cs ├── NetSynchronizer.cs ├── Network ├── BandwidthLogger.cs ├── BarGraph.cs ├── Bimap.cs ├── Client.cs ├── FarmerCollection.cs ├── GameServer.cs ├── IBandwidthMonitor.cs ├── IGameServer.cs ├── IWorldState.cs ├── IncomingMessage.cs ├── LidgrenClient.cs ├── LidgrenServer.cs ├── NetAudio.cs ├── NetAudioCueManager.cs ├── NetBufferReadStream.cs ├── NetBufferWriteStream.cs ├── NetBuildingRef.cs ├── NetBundles.cs ├── NetCharacterRef.cs ├── NetDancePartner.cs ├── NetDirection.cs ├── NetFarmerCollection.cs ├── NetFarmerRef.cs ├── NetFarmerRoot.cs ├── NetIntDictionary.cs ├── NetLocationRef.cs ├── NetLongDictionary.cs ├── NetMutex.cs ├── NetMutexQueue.cs ├── NetNPCRef.cs ├── NetPausableField.cs ├── NetPointDictionary.cs ├── NetPosition.cs ├── NetStringDictionary.cs ├── NetVector2Dictionary.cs ├── NetWitnessedLock.cs ├── NetWorldState.cs ├── OutgoingMessage.cs ├── OverlaidDictionary.cs └── Server.cs ├── NewDaySynchronizer.cs ├── Noise.cs ├── NoiseGenerator.cs ├── NonInstancedStatic.cs ├── NumberSprite.cs ├── NutDropRequest.cs ├── ObjToStr.cs ├── Object.cs ├── Objects ├── BedFurniture.cs ├── Boots.cs ├── BreakableContainer.cs ├── Cask.cs ├── Chest.cs ├── Clothing.cs ├── ColoredObject.cs ├── CombinedRing.cs ├── CrabPot.cs ├── FishTankFurniture.cs ├── Furniture.cs ├── Hat.cs ├── IndoorPot.cs ├── ItemDescription.cs ├── ItemPedestal.cs ├── MiniJukebox.cs ├── ObjectFactory.cs ├── Phone.cs ├── Ring.cs ├── Sign.cs ├── SpecialItem.cs ├── StorageFurniture.cs ├── SwitchFloor.cs ├── TV.cs ├── TankFish.cs ├── Wallpaper.cs ├── WoodChipper.cs └── Workbench.cs ├── OneTimeRandom.cs ├── Options.cs ├── OrderObjective.cs ├── OrderReward.cs ├── PanEnchantment.cs ├── PathFindController.cs ├── PathNode.cs ├── PickaxeEnchantment.cs ├── Polygon.cs ├── PowerfulEnchantment.cs ├── PreservingEnchantment.cs ├── PriorityQueue.cs ├── Program.cs ├── Projectiles ├── BasicProjectile.cs ├── DebuffingProjectile.cs └── Projectile.cs ├── Prop.cs ├── Properties └── AssemblyInfo.cs ├── Proposal.cs ├── ProposalResponse.cs ├── ProposalType.cs ├── PurchaseableKeyItem.cs ├── Quests ├── CraftingQuest.cs ├── DescriptionElement.cs ├── FishingQuest.cs ├── GoSomewhereQuest.cs ├── IQuest.cs ├── ItemDeliveryQuest.cs ├── ItemHarvestQuest.cs ├── LostItemQuest.cs ├── NetDescriptionElementList.cs ├── NetDescriptionElementRef.cs ├── Quest.cs ├── ResourceCollectionQuest.cs ├── SecretLostItemQuest.cs ├── SlayMonsterQuest.cs └── SocializeQuest.cs ├── RainDrop.cs ├── ReachMineFloorObjective.cs ├── ReachingToolEnchantment.cs ├── ReadyCheck.cs ├── ReportHasRoomAnotherFarm.cs ├── ResetEventReward.cs ├── Response.cs ├── RubyEnchantment.cs ├── Rumble.cs ├── SDKs ├── Base36.cs ├── GalaxyHelper.cs ├── GalaxyNetClient.cs ├── GalaxyNetHelper.cs ├── GalaxyNetServer.cs ├── GalaxySocket.cs ├── LobbyUpdateListener.cs ├── NullSDKHelper.cs ├── RailHelper.cs ├── SDKHelper.cs ├── SDKNetHelper.cs ├── SteamHelper.cs └── SteamNetHelper.cs ├── SafeAreaOverlay.cs ├── SaveGame.cs ├── SchedulePathDescription.cs ├── SeaMonsterTemporarySprite.cs ├── SerializableDictionary.cs ├── ServerPrivacy.cs ├── ShavingEnchantment.cs ├── ShearsEnchantment.cs ├── Shed.cs ├── ShipObjective.cs ├── ShippedItem.cs ├── ShrineActivity.cs ├── SlayObjective.cs ├── SlimeHutch.cs ├── SoundBankWrapper.cs ├── SpecialOrder.cs ├── StackDrawType.cs ├── StardewValley.csproj ├── StartMovieEvent.cs ├── StartupPreferences.cs ├── Stats.cs ├── StringBuilderFormatEx.cs ├── SwiftToolEnchantment.cs ├── TemporaryAnimatedSprite.cs ├── TerrainFeatures ├── Bush.cs ├── CosmeticPlant.cs ├── Flooring.cs ├── FruitTree.cs ├── GiantCrop.cs ├── Grass.cs ├── HoeDirt.cs ├── LargeTerrainFeature.cs ├── Leaf.cs ├── Quartz.cs ├── ResourceClump.cs ├── TerrainFeature.cs └── Tree.cs ├── TilePositionComparer.cs ├── Tool.cs ├── Tools ├── Axe.cs ├── Blueprints.cs ├── FishingRod.cs ├── GenericTool.cs ├── Hoe.cs ├── Lantern.cs ├── MagnifyingGlass.cs ├── MeleeWeapon.cs ├── MilkPail.cs ├── Pan.cs ├── Pickaxe.cs ├── Raft.cs ├── Seeds.cs ├── Shears.cs ├── Slingshot.cs ├── Stackable.cs ├── Sword.cs ├── ToolDescription.cs ├── ToolFactory.cs ├── Wand.cs └── WateringCan.cs ├── TopazEnchantment.cs ├── Torch.cs ├── TreeActivity.cs ├── Util ├── BoundingBoxGroup.cs ├── EventTest.cs ├── GuidHelper.cs ├── IInputSimulator.cs ├── LeftRightClickSpamInputSimulator.cs ├── SynchronizedShopStock.cs └── ToolSpamInputSimulator.cs ├── Utility.cs ├── VampiricEnchantment.cs ├── Vector2Reader.cs ├── Vector2Serializer.cs ├── Vector2Writer.cs ├── Warp.cs ├── WateringCanEnchantment.cs ├── WeatherDebris.cs └── WorldDate.cs /Force.DeepCloner/DeepClonerExtensions.cs: -------------------------------------------------------------------------------- 1 | using Force.DeepCloner.Helpers; 2 | using System; 3 | using System.Security; 4 | 5 | namespace Force.DeepCloner 6 | { 7 | public static class DeepClonerExtensions 8 | { 9 | public static T DeepClone(this T obj) 10 | { 11 | return DeepClonerGenerator.CloneObject(obj); 12 | } 13 | 14 | public static TTo DeepCloneTo(this TFrom objFrom, TTo objTo) where TTo : class, TFrom 15 | { 16 | return (TTo)DeepClonerGenerator.CloneObjectTo(objFrom, objTo, isDeep: true); 17 | } 18 | 19 | public static TTo ShallowCloneTo(this TFrom objFrom, TTo objTo) where TTo : class, TFrom 20 | { 21 | return (TTo)DeepClonerGenerator.CloneObjectTo(objFrom, objTo, isDeep: false); 22 | } 23 | 24 | public static T ShallowClone(this T obj) 25 | { 26 | return ShallowClonerGenerator.CloneObject(obj); 27 | } 28 | 29 | static DeepClonerExtensions() 30 | { 31 | if (!PermissionCheck()) 32 | { 33 | throw new SecurityException("DeepCloner should have enough permissions to run. Grant FullTrust or Reflection permission."); 34 | } 35 | } 36 | 37 | private static bool PermissionCheck() 38 | { 39 | try 40 | { 41 | new object().ShallowClone(); 42 | } 43 | catch (VerificationException) 44 | { 45 | return false; 46 | } 47 | catch (MemberAccessException) 48 | { 49 | return false; 50 | } 51 | return true; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Force.DeepCloner/Helpers/DeepClonerMsilHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Force.DeepCloner.Helpers 5 | { 6 | internal static class DeepClonerMsilHelper 7 | { 8 | public static bool IsConstructorDoNothing(Type type, ConstructorInfo constructor) 9 | { 10 | if (constructor == null) 11 | { 12 | return false; 13 | } 14 | try 15 | { 16 | if (type.IsGenericType || type.IsContextful || type.IsCOMObject || type.Assembly.IsDynamic) 17 | { 18 | return false; 19 | } 20 | MethodBody methodBody = constructor.GetMethodBody(); 21 | if (methodBody == null) 22 | { 23 | return false; 24 | } 25 | byte[] ilAsByteArray = methodBody.GetILAsByteArray(); 26 | if (ilAsByteArray.Length == 7 && ilAsByteArray[0] == 2 && ilAsByteArray[1] == 40 && ilAsByteArray[6] == 42 && type.Module.ResolveMethod(BitConverter.ToInt32(ilAsByteArray, 2)) == typeof(object).GetConstructor(Type.EmptyTypes)) 27 | { 28 | return true; 29 | } 30 | if (ilAsByteArray.Length == 1 && ilAsByteArray[0] == 42) 31 | { 32 | return true; 33 | } 34 | return false; 35 | } 36 | catch (Exception) 37 | { 38 | return false; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Force.DeepCloner/Helpers/ShallowClonerGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Force.DeepCloner.Helpers 4 | { 5 | internal static class ShallowClonerGenerator 6 | { 7 | public static T CloneObject(T obj) 8 | { 9 | if (obj is ValueType) 10 | { 11 | if (typeof(T) == obj.GetType()) 12 | { 13 | return obj; 14 | } 15 | return (T)ShallowObjectCloner.CloneObject(obj); 16 | } 17 | if (obj == null) 18 | { 19 | return (T)(object)null; 20 | } 21 | if (DeepClonerSafeTypes.CanReturnSameObject(obj.GetType())) 22 | { 23 | return obj; 24 | } 25 | return (T)ShallowObjectCloner.CloneObject(obj); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Force.DeepCloner/Helpers/TypeCreationHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Reflection.Emit; 4 | 5 | namespace Force.DeepCloner.Helpers 6 | { 7 | internal static class TypeCreationHelper 8 | { 9 | private static ModuleBuilder _moduleBuilder; 10 | 11 | internal static ModuleBuilder GetModuleBuilder() 12 | { 13 | if (_moduleBuilder == null) 14 | { 15 | AssemblyName aName = new AssemblyName("DeepClonerCode"); 16 | _moduleBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.Run).DefineDynamicModule(aName.Name); 17 | } 18 | return _moduleBuilder; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ionic/Zlib/Adler.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | public sealed class Adler 4 | { 5 | private static readonly uint BASE = 65521u; 6 | 7 | private static readonly int NMAX = 5552; 8 | 9 | public static uint Adler32(uint adler, byte[] buf, int index, int len) 10 | { 11 | if (buf == null) 12 | { 13 | return 1u; 14 | } 15 | uint s17 = adler & 0xFFFF; 16 | uint s21 = (adler >> 16) & 0xFFFF; 17 | while (len > 0) 18 | { 19 | int i = (len < NMAX) ? len : NMAX; 20 | len -= i; 21 | while (i >= 16) 22 | { 23 | s17 += buf[index++]; 24 | s21 += s17; 25 | s17 += buf[index++]; 26 | s21 += s17; 27 | s17 += buf[index++]; 28 | s21 += s17; 29 | s17 += buf[index++]; 30 | s21 += s17; 31 | s17 += buf[index++]; 32 | s21 += s17; 33 | s17 += buf[index++]; 34 | s21 += s17; 35 | s17 += buf[index++]; 36 | s21 += s17; 37 | s17 += buf[index++]; 38 | s21 += s17; 39 | s17 += buf[index++]; 40 | s21 += s17; 41 | s17 += buf[index++]; 42 | s21 += s17; 43 | s17 += buf[index++]; 44 | s21 += s17; 45 | s17 += buf[index++]; 46 | s21 += s17; 47 | s17 += buf[index++]; 48 | s21 += s17; 49 | s17 += buf[index++]; 50 | s21 += s17; 51 | s17 += buf[index++]; 52 | s21 += s17; 53 | s17 += buf[index++]; 54 | s21 += s17; 55 | i -= 16; 56 | } 57 | if (i != 0) 58 | { 59 | do 60 | { 61 | s17 += buf[index++]; 62 | s21 += s17; 63 | } 64 | while (--i != 0); 65 | } 66 | s17 %= BASE; 67 | s21 %= BASE; 68 | } 69 | return (s21 << 16) | s17; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Ionic/Zlib/BlockState.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | internal enum BlockState 4 | { 5 | NeedMore, 6 | BlockDone, 7 | FinishStarted, 8 | FinishDone 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Ionic/Zlib/CompressionLevel.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | public enum CompressionLevel 4 | { 5 | None = 0, 6 | Level0 = 0, 7 | BestSpeed = 1, 8 | Level1 = 1, 9 | Level2 = 2, 10 | Level3 = 3, 11 | Level4 = 4, 12 | Level5 = 5, 13 | Default = 6, 14 | Level6 = 6, 15 | Level7 = 7, 16 | Level8 = 8, 17 | BestCompression = 9, 18 | Level9 = 9 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Ionic/Zlib/CompressionMode.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | public enum CompressionMode 4 | { 5 | Compress, 6 | Decompress 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Ionic/Zlib/CompressionStrategy.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | public enum CompressionStrategy 4 | { 5 | Default, 6 | Filtered, 7 | HuffmanOnly 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Ionic/Zlib/DeflateFlavor.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | internal enum DeflateFlavor 4 | { 5 | Store, 6 | Fast, 7 | Slow 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Ionic/Zlib/FlushType.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | public enum FlushType 4 | { 5 | None, 6 | Partial, 7 | Sync, 8 | Full, 9 | Finish 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Ionic/Zlib/InternalConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | internal static class InternalConstants 4 | { 5 | internal static readonly int MAX_BITS = 15; 6 | 7 | internal static readonly int BL_CODES = 19; 8 | 9 | internal static readonly int D_CODES = 30; 10 | 11 | internal static readonly int LITERALS = 256; 12 | 13 | internal static readonly int LENGTH_CODES = 29; 14 | 15 | internal static readonly int L_CODES = LITERALS + 1 + LENGTH_CODES; 16 | 17 | internal static readonly int MAX_BL_BITS = 7; 18 | 19 | internal static readonly int REP_3_6 = 16; 20 | 21 | internal static readonly int REPZ_3_10 = 17; 22 | 23 | internal static readonly int REPZ_11_138 = 18; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ionic/Zlib/InternalInflateConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | internal static class InternalInflateConstants 4 | { 5 | internal static readonly int[] InflateMask = new int[17] 6 | { 7 | 0, 8 | 1, 9 | 3, 10 | 7, 11 | 15, 12 | 31, 13 | 63, 14 | 127, 15 | 255, 16 | 511, 17 | 1023, 18 | 2047, 19 | 4095, 20 | 8191, 21 | 16383, 22 | 32767, 23 | 65535 24 | }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Ionic/Zlib/SharedUtils.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Text; 3 | 4 | namespace Ionic.Zlib 5 | { 6 | internal class SharedUtils 7 | { 8 | public static int URShift(int number, int bits) 9 | { 10 | return (int)((uint)number >> bits); 11 | } 12 | 13 | public static int ReadInput(TextReader sourceTextReader, byte[] target, int start, int count) 14 | { 15 | if (target.Length == 0) 16 | { 17 | return 0; 18 | } 19 | char[] charArray = new char[target.Length]; 20 | int bytesRead = sourceTextReader.Read(charArray, start, count); 21 | if (bytesRead == 0) 22 | { 23 | return -1; 24 | } 25 | for (int index = start; index < start + bytesRead; index++) 26 | { 27 | target[index] = (byte)charArray[index]; 28 | } 29 | return bytesRead; 30 | } 31 | 32 | internal static byte[] ToByteArray(string sourceString) 33 | { 34 | return Encoding.UTF8.GetBytes(sourceString); 35 | } 36 | 37 | internal static char[] ToCharArray(byte[] byteArray) 38 | { 39 | return Encoding.UTF8.GetChars(byteArray); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Ionic/Zlib/ZlibConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | public static class ZlibConstants 4 | { 5 | public const int WindowBitsMax = 15; 6 | 7 | public const int WindowBitsDefault = 15; 8 | 9 | public const int Z_OK = 0; 10 | 11 | public const int Z_STREAM_END = 1; 12 | 13 | public const int Z_NEED_DICT = 2; 14 | 15 | public const int Z_STREAM_ERROR = -2; 16 | 17 | public const int Z_DATA_ERROR = -3; 18 | 19 | public const int Z_BUF_ERROR = -5; 20 | 21 | public const int WorkingBufferSizeDefault = 16384; 22 | 23 | public const int WorkingBufferSizeMin = 1024; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ionic/Zlib/ZlibException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Ionic.Zlib 5 | { 6 | [Guid("ebc25cf6-9120-4283-b972-0e5520d0000E")] 7 | public class ZlibException : Exception 8 | { 9 | public ZlibException() 10 | { 11 | } 12 | 13 | public ZlibException(string s) 14 | : base(s) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Ionic/Zlib/ZlibStreamFlavor.cs: -------------------------------------------------------------------------------- 1 | namespace Ionic.Zlib 2 | { 3 | internal enum ZlibStreamFlavor 4 | { 5 | ZLIB = 1950, 6 | DEFLATE, 7 | GZIP 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Microsoft.Xna.Framework.Graphics/ViewportExtensions.cs: -------------------------------------------------------------------------------- 1 | using xTile.Dimensions; 2 | 3 | namespace Microsoft.Xna.Framework.Graphics 4 | { 5 | public static class ViewportExtensions 6 | { 7 | public static Rectangle GetTitleSafeArea(this Viewport vp) 8 | { 9 | return vp.TitleSafeArea; 10 | } 11 | 12 | public static Rectangle ToXna(this xTile.Dimensions.Rectangle xrect) 13 | { 14 | return new Rectangle(xrect.X, xrect.Y, xrect.Width, xrect.Height); 15 | } 16 | 17 | public static Vector2 Size(this Viewport vp) 18 | { 19 | return new Vector2(vp.Width, vp.Height); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Microsoft.Xna.Framework.RuntimeProfile: -------------------------------------------------------------------------------- 1 | Windows.v4.0.HiDef 2 | -------------------------------------------------------------------------------- /Netcode/ILoggingWriter.cs: -------------------------------------------------------------------------------- 1 | namespace Netcode 2 | { 3 | public interface ILoggingWriter 4 | { 5 | void Push(string name); 6 | 7 | void Pop(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Netcode/INetObject.cs: -------------------------------------------------------------------------------- 1 | namespace Netcode 2 | { 3 | public interface INetObject where T : INetSerializable 4 | { 5 | T NetFields 6 | { 7 | get; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Netcode/INetRoot.cs: -------------------------------------------------------------------------------- 1 | namespace Netcode 2 | { 3 | public interface INetRoot 4 | { 5 | NetClock Clock 6 | { 7 | get; 8 | } 9 | 10 | void TickTree(); 11 | 12 | void Disconnect(long connection); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Netcode/INetSerializable.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public interface INetSerializable 6 | { 7 | uint DirtyTick 8 | { 9 | get; 10 | set; 11 | } 12 | 13 | bool Dirty 14 | { 15 | get; 16 | } 17 | 18 | bool NeedsTick 19 | { 20 | get; 21 | set; 22 | } 23 | 24 | bool ChildNeedsTick 25 | { 26 | get; 27 | set; 28 | } 29 | 30 | INetSerializable Parent 31 | { 32 | get; 33 | set; 34 | } 35 | 36 | INetRoot Root 37 | { 38 | get; 39 | } 40 | 41 | void MarkDirty(); 42 | 43 | void MarkClean(); 44 | 45 | bool Tick(); 46 | 47 | void Read(BinaryReader reader, NetVersion version); 48 | 49 | void Write(BinaryWriter writer); 50 | 51 | void ReadFull(BinaryReader reader, NetVersion version); 52 | 53 | void WriteFull(BinaryWriter writer); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Netcode/InterpolationCancellable.cs: -------------------------------------------------------------------------------- 1 | namespace Netcode 2 | { 3 | public interface InterpolationCancellable 4 | { 5 | void CancelInterpolation(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Netcode/NetBool.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetBool : NetField 6 | { 7 | public NetBool() 8 | { 9 | } 10 | 11 | public NetBool(bool value) 12 | : base(value) 13 | { 14 | } 15 | 16 | public override void Set(bool newValue) 17 | { 18 | if (canShortcutSet()) 19 | { 20 | value = newValue; 21 | } 22 | else if (newValue != value) 23 | { 24 | cleanSet(newValue); 25 | MarkDirty(); 26 | } 27 | } 28 | 29 | protected override void ReadDelta(BinaryReader reader, NetVersion version) 30 | { 31 | bool newValue = reader.ReadBoolean(); 32 | if (version.IsPriorityOver(ChangeVersion)) 33 | { 34 | setInterpolationTarget(newValue); 35 | } 36 | } 37 | 38 | protected override void WriteDelta(BinaryWriter writer) 39 | { 40 | writer.Write(value); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Netcode/NetByte.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetByte : NetField 6 | { 7 | public NetByte() 8 | { 9 | } 10 | 11 | public NetByte(byte value) 12 | : base(value) 13 | { 14 | } 15 | 16 | public override void Set(byte newValue) 17 | { 18 | if (canShortcutSet()) 19 | { 20 | value = newValue; 21 | } 22 | else if (newValue != value) 23 | { 24 | cleanSet(newValue); 25 | MarkDirty(); 26 | } 27 | } 28 | 29 | protected override void ReadDelta(BinaryReader reader, NetVersion version) 30 | { 31 | byte newValue = reader.ReadByte(); 32 | if (version.IsPriorityOver(ChangeVersion)) 33 | { 34 | setInterpolationTarget(newValue); 35 | } 36 | } 37 | 38 | protected override void WriteDelta(BinaryWriter writer) 39 | { 40 | writer.Write(base.Value); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Netcode/NetClock.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Netcode 4 | { 5 | public class NetClock 6 | { 7 | public NetVersion netVersion; 8 | 9 | public int LocalId; 10 | 11 | public int InterpolationTicks; 12 | 13 | public List blanks = new List(); 14 | 15 | public NetClock() 16 | { 17 | netVersion = default(NetVersion); 18 | LocalId = AddNewPeer(); 19 | } 20 | 21 | public int AddNewPeer() 22 | { 23 | int id = blanks.IndexOf(item: true); 24 | if (id != -1) 25 | { 26 | blanks[id] = false; 27 | } 28 | else 29 | { 30 | id = netVersion.Size(); 31 | while (blanks.Count < netVersion.Size()) 32 | { 33 | blanks.Add(item: false); 34 | } 35 | netVersion[id] = 0u; 36 | } 37 | return id; 38 | } 39 | 40 | public void RemovePeer(int id) 41 | { 42 | while (blanks.Count <= id) 43 | { 44 | blanks.Add(item: false); 45 | } 46 | blanks[id] = true; 47 | } 48 | 49 | public uint GetLocalTick() 50 | { 51 | return netVersion[LocalId]; 52 | } 53 | 54 | public NetTimestamp GetLocalTimestamp() 55 | { 56 | return netVersion.GetTimestamp(LocalId); 57 | } 58 | 59 | public void Tick() 60 | { 61 | uint num = ++netVersion[LocalId]; 62 | } 63 | 64 | public void Clear() 65 | { 66 | netVersion.Clear(); 67 | LocalId = 0; 68 | } 69 | 70 | public override string ToString() 71 | { 72 | return base.ToString() + ";LocalId=" + LocalId; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Netcode/NetDouble.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetDouble : NetField 6 | { 7 | public NetDouble() 8 | { 9 | } 10 | 11 | public NetDouble(double value) 12 | : base(value) 13 | { 14 | } 15 | 16 | public override void Set(double newValue) 17 | { 18 | if (canShortcutSet()) 19 | { 20 | value = newValue; 21 | } 22 | else if (newValue != value) 23 | { 24 | cleanSet(newValue); 25 | MarkDirty(); 26 | } 27 | } 28 | 29 | protected override double interpolate(double startValue, double endValue, float factor) 30 | { 31 | return startValue + (endValue - startValue) * (double)factor; 32 | } 33 | 34 | protected override void ReadDelta(BinaryReader reader, NetVersion version) 35 | { 36 | double newValue = reader.ReadDouble(); 37 | if (version.IsPriorityOver(ChangeVersion)) 38 | { 39 | setInterpolationTarget(newValue); 40 | } 41 | } 42 | 43 | protected override void WriteDelta(BinaryWriter writer) 44 | { 45 | writer.Write(value); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Netcode/NetEvent0.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Netcode 5 | { 6 | public class NetEvent0 : AbstractNetSerializable 7 | { 8 | public delegate void Event(); 9 | 10 | public readonly NetInt Counter = new NetInt(); 11 | 12 | private int currentCount; 13 | 14 | public event Event onEvent; 15 | 16 | public NetEvent0(bool interpolate = false) 17 | { 18 | Counter.InterpolationEnabled = interpolate; 19 | } 20 | 21 | public void Fire() 22 | { 23 | int num = ++Counter.Value; 24 | Poll(); 25 | } 26 | 27 | public void Poll() 28 | { 29 | if (Counter.Value != currentCount) 30 | { 31 | currentCount = Counter.Value; 32 | if (this.onEvent != null) 33 | { 34 | this.onEvent(); 35 | } 36 | } 37 | } 38 | 39 | public void Clear() 40 | { 41 | Counter.Set(0); 42 | currentCount = 0; 43 | } 44 | 45 | public override void Read(BinaryReader reader, NetVersion version) 46 | { 47 | Counter.Read(reader, version); 48 | } 49 | 50 | public override void ReadFull(BinaryReader reader, NetVersion version) 51 | { 52 | Counter.ReadFull(reader, version); 53 | currentCount = Counter.Value; 54 | } 55 | 56 | public override void Write(BinaryWriter writer) 57 | { 58 | Counter.Write(writer); 59 | } 60 | 61 | public override void WriteFull(BinaryWriter writer) 62 | { 63 | Counter.WriteFull(writer); 64 | } 65 | 66 | protected override void ForEachChild(Action childAction) 67 | { 68 | childAction(Counter); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Netcode/NetEvent1.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public class NetEvent1 : AbstractNetEvent1 where T : NetEventArg, new() 6 | { 7 | protected override T readEventArg(BinaryReader reader, NetVersion version) 8 | { 9 | T arg = new T(); 10 | arg.Read(reader); 11 | return arg; 12 | } 13 | 14 | protected override void writeEventArg(BinaryWriter writer, T eventArg) 15 | { 16 | eventArg.Write(writer); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Netcode/NetEvent1Field.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public class NetEvent1Field : AbstractNetEvent1 where TField : NetField, new() 6 | { 7 | protected override T readEventArg(BinaryReader reader, NetVersion version) 8 | { 9 | TField val = new TField(); 10 | val.ReadFull(reader, version); 11 | return val.Value; 12 | } 13 | 14 | protected override void writeEventArg(BinaryWriter writer, T eventArg) 15 | { 16 | TField val = new TField(); 17 | val.Value = eventArg; 18 | val.WriteFull(writer); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Netcode/NetEventArg.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public interface NetEventArg 6 | { 7 | void Read(BinaryReader reader); 8 | 9 | void Write(BinaryWriter writer); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Netcode/NetEventBinary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Netcode 5 | { 6 | public class NetEventBinary : AbstractNetEvent1 7 | { 8 | public delegate void ArgWriter(BinaryWriter writer); 9 | 10 | public void Fire(ArgWriter argWriter) 11 | { 12 | byte[] bytes; 13 | using (MemoryStream ms = new MemoryStream()) 14 | { 15 | using (BinaryWriter writer = new BinaryWriter(ms)) 16 | { 17 | argWriter(writer); 18 | ms.Position = 0L; 19 | bytes = new byte[ms.Length]; 20 | ms.Read(bytes, 0, (int)ms.Length); 21 | } 22 | } 23 | Fire(bytes); 24 | } 25 | 26 | public void AddReaderHandler(Action handler) 27 | { 28 | base.onEvent += delegate(byte[] bytes) 29 | { 30 | using (MemoryStream input = new MemoryStream(bytes)) 31 | { 32 | using (BinaryReader obj = new BinaryReader(input)) 33 | { 34 | handler(obj); 35 | } 36 | } 37 | }; 38 | } 39 | 40 | protected override byte[] readEventArg(BinaryReader reader, NetVersion version) 41 | { 42 | int count = reader.ReadInt32(); 43 | return reader.ReadBytes(count); 44 | } 45 | 46 | protected override void writeEventArg(BinaryWriter writer, byte[] arg) 47 | { 48 | writer.Write(arg.Length); 49 | writer.Write(arg); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Netcode/NetField.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace Netcode 7 | { 8 | public abstract class NetField : NetFieldBase, IEnumerable, IEnumerable where TSelf : NetField 9 | { 10 | private bool xmlInitialized; 11 | 12 | public NetField() 13 | { 14 | } 15 | 16 | public NetField(T value) 17 | : base(value) 18 | { 19 | } 20 | 21 | public IEnumerator GetEnumerator() 22 | { 23 | return Enumerable.Repeat(Get(), 1).GetEnumerator(); 24 | } 25 | 26 | IEnumerator IEnumerable.GetEnumerator() 27 | { 28 | return GetEnumerator(); 29 | } 30 | 31 | public void Add(T value) 32 | { 33 | if (xmlInitialized || base.Parent != null) 34 | { 35 | throw new InvalidOperationException(GetType().Name + " already has value " + ToString()); 36 | } 37 | cleanSet(value); 38 | xmlInitialized = true; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Netcode/NetFieldDictionary.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Netcode 4 | { 5 | public abstract class NetFieldDictionary : NetDictionary where TField : NetField, new()where TSerialDict : IDictionary, new()where TSelf : NetDictionary 6 | { 7 | public NetFieldDictionary() 8 | { 9 | } 10 | 11 | public NetFieldDictionary(IEnumerable> pairs) 12 | : base(pairs) 13 | { 14 | } 15 | 16 | protected override void setFieldValue(TField field, TKey key, TValue value) 17 | { 18 | field.Value = value; 19 | } 20 | 21 | protected override TValue getFieldValue(TField field) 22 | { 23 | return field.Value; 24 | } 25 | 26 | protected override TValue getFieldTargetValue(TField field) 27 | { 28 | return field.TargetValue; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Netcode/NetFloat.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public class NetFloat : NetField 6 | { 7 | public NetFloat() 8 | { 9 | } 10 | 11 | public NetFloat(float value) 12 | : base(value) 13 | { 14 | } 15 | 16 | public override void Set(float newValue) 17 | { 18 | if (canShortcutSet()) 19 | { 20 | value = newValue; 21 | } 22 | else if (newValue != value) 23 | { 24 | cleanSet(newValue); 25 | MarkDirty(); 26 | } 27 | } 28 | 29 | protected override float interpolate(float startValue, float endValue, float factor) 30 | { 31 | return startValue + (endValue - startValue) * factor; 32 | } 33 | 34 | protected override void ReadDelta(BinaryReader reader, NetVersion version) 35 | { 36 | float newValue = reader.ReadSingle(); 37 | if (version.IsPriorityOver(ChangeVersion)) 38 | { 39 | setInterpolationTarget(newValue); 40 | } 41 | } 42 | 43 | protected override void WriteDelta(BinaryWriter writer) 44 | { 45 | writer.Write(value); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Netcode/NetGuid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Netcode 5 | { 6 | public sealed class NetGuid : NetField 7 | { 8 | public NetGuid() 9 | { 10 | } 11 | 12 | public NetGuid(Guid value) 13 | : base(value) 14 | { 15 | } 16 | 17 | public override void Set(Guid newValue) 18 | { 19 | if (canShortcutSet()) 20 | { 21 | value = newValue; 22 | } 23 | else if (newValue != value) 24 | { 25 | cleanSet(newValue); 26 | MarkDirty(); 27 | } 28 | } 29 | 30 | protected override void ReadDelta(BinaryReader reader, NetVersion version) 31 | { 32 | Guid newValue = reader.ReadGuid(); 33 | if (version.IsPriorityOver(ChangeVersion)) 34 | { 35 | setInterpolationTarget(newValue); 36 | } 37 | } 38 | 39 | protected override void WriteDelta(BinaryWriter writer) 40 | { 41 | writer.WriteGuid(value); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Netcode/NetGuidDictionary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace Netcode 6 | { 7 | public class NetGuidDictionary : NetFieldDictionary, NetGuidDictionary> where TField : NetField, new() 8 | { 9 | public NetGuidDictionary() 10 | { 11 | } 12 | 13 | public NetGuidDictionary(IEnumerable> pairs) 14 | : base(pairs) 15 | { 16 | } 17 | 18 | protected override Guid ReadKey(BinaryReader reader) 19 | { 20 | return reader.ReadGuid(); 21 | } 22 | 23 | protected override void WriteKey(BinaryWriter writer, Guid key) 24 | { 25 | writer.WriteGuid(key); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Netcode/NetInt.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetInt : NetField 6 | { 7 | public NetInt() 8 | { 9 | } 10 | 11 | public NetInt(int value) 12 | : base(value) 13 | { 14 | } 15 | 16 | public override void Set(int newValue) 17 | { 18 | if (canShortcutSet()) 19 | { 20 | value = newValue; 21 | } 22 | else if (newValue != value) 23 | { 24 | cleanSet(newValue); 25 | MarkDirty(); 26 | } 27 | } 28 | 29 | public new bool Equals(NetInt other) 30 | { 31 | return value == other.value; 32 | } 33 | 34 | public bool Equals(int other) 35 | { 36 | return value == other; 37 | } 38 | 39 | protected override int interpolate(int startValue, int endValue, float factor) 40 | { 41 | return startValue + (int)((float)(endValue - startValue) * factor); 42 | } 43 | 44 | protected override void ReadDelta(BinaryReader reader, NetVersion version) 45 | { 46 | int newValue = reader.ReadInt32(); 47 | if (version.IsPriorityOver(ChangeVersion)) 48 | { 49 | setInterpolationTarget(newValue); 50 | } 51 | } 52 | 53 | protected override void WriteDelta(BinaryWriter writer) 54 | { 55 | writer.Write(value); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Netcode/NetIntList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetIntList : NetList 6 | { 7 | public NetIntList() 8 | { 9 | } 10 | 11 | public NetIntList(IEnumerable values) 12 | : base(values) 13 | { 14 | } 15 | 16 | public NetIntList(int capacity) 17 | : base(capacity) 18 | { 19 | } 20 | 21 | public override bool Contains(int item) 22 | { 23 | using (Enumerator enumerator = GetEnumerator()) 24 | { 25 | while (enumerator.MoveNext()) 26 | { 27 | if (enumerator.Current == item) 28 | { 29 | return true; 30 | } 31 | } 32 | } 33 | return false; 34 | } 35 | 36 | public override int IndexOf(int item) 37 | { 38 | NetInt count = base.count; 39 | for (int i = 0; i < (int)count; i++) 40 | { 41 | if (array.Value[i] == item) 42 | { 43 | return i; 44 | } 45 | } 46 | return -1; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Netcode/NetLong.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetLong : NetField 6 | { 7 | public NetLong() 8 | { 9 | } 10 | 11 | public NetLong(long value) 12 | : base(value) 13 | { 14 | } 15 | 16 | public override void Set(long newValue) 17 | { 18 | if (canShortcutSet()) 19 | { 20 | value = newValue; 21 | } 22 | else if (newValue != value) 23 | { 24 | cleanSet(newValue); 25 | MarkDirty(); 26 | } 27 | } 28 | 29 | protected override long interpolate(long startValue, long endValue, float factor) 30 | { 31 | return startValue + (long)((float)(endValue - startValue) * factor); 32 | } 33 | 34 | protected override void ReadDelta(BinaryReader reader, NetVersion version) 35 | { 36 | long newValue = reader.ReadInt64(); 37 | if (version.IsPriorityOver(ChangeVersion)) 38 | { 39 | setInterpolationTarget(newValue); 40 | } 41 | } 42 | 43 | protected override void WriteDelta(BinaryWriter writer) 44 | { 45 | writer.Write(value); 46 | } 47 | 48 | public static implicit operator long(NetLong field) 49 | { 50 | return field.value; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Netcode/NetLongList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetLongList : NetList 6 | { 7 | public NetLongList() 8 | { 9 | } 10 | 11 | public NetLongList(IEnumerable values) 12 | : base(values) 13 | { 14 | } 15 | 16 | public NetLongList(int capacity) 17 | : base(capacity) 18 | { 19 | } 20 | 21 | public override bool Contains(long item) 22 | { 23 | using (Enumerator enumerator = GetEnumerator()) 24 | { 25 | while (enumerator.MoveNext()) 26 | { 27 | if (enumerator.Current == item) 28 | { 29 | return true; 30 | } 31 | } 32 | } 33 | return false; 34 | } 35 | 36 | public override int IndexOf(long item) 37 | { 38 | NetInt count = base.count; 39 | for (int i = 0; i < (int)count; i++) 40 | { 41 | if (array.Value[i] == item) 42 | { 43 | return i; 44 | } 45 | } 46 | return -1; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Netcode/NetObjectArray.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Netcode 4 | { 5 | public class NetObjectArray : NetArray> where T : class, INetObject 6 | { 7 | public NetObjectArray() 8 | { 9 | } 10 | 11 | public NetObjectArray(IEnumerable values) 12 | : base(values) 13 | { 14 | } 15 | 16 | public NetObjectArray(int size) 17 | : base(size) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Netcode/NetObjectList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetObjectList : NetList> where T : class, INetObject 6 | { 7 | public NetObjectList() 8 | { 9 | } 10 | 11 | public NetObjectList(IEnumerable values) 12 | : base(values) 13 | { 14 | } 15 | 16 | public NetObjectList(int capacity) 17 | : base(capacity) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Netcode/NetRef.cs: -------------------------------------------------------------------------------- 1 | namespace Netcode 2 | { 3 | public class NetRef : NetExtendableRef> where T : class, INetObject 4 | { 5 | public NetRef() 6 | { 7 | } 8 | 9 | public NetRef(T value) 10 | : base(value) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Netcode/NetRotation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Netcode 5 | { 6 | public class NetRotation : NetField 7 | { 8 | public NetRotation() 9 | { 10 | } 11 | 12 | public NetRotation(float value) 13 | : base(value) 14 | { 15 | } 16 | 17 | public override void Set(float newValue) 18 | { 19 | if (canShortcutSet()) 20 | { 21 | value = newValue; 22 | } 23 | else if (newValue != value) 24 | { 25 | cleanSet(newValue); 26 | MarkDirty(); 27 | } 28 | } 29 | 30 | protected override float interpolate(float startValue, float endValue, float factor) 31 | { 32 | float num = Math.Abs(endValue - startValue); 33 | float period = (float)Math.PI * 2f; 34 | if (num > 180f) 35 | { 36 | if (endValue > startValue) 37 | { 38 | startValue += period; 39 | } 40 | else 41 | { 42 | endValue += period; 43 | } 44 | } 45 | return (startValue + (endValue - startValue) * factor) % period; 46 | } 47 | 48 | protected override void ReadDelta(BinaryReader reader, NetVersion version) 49 | { 50 | float newValue = reader.ReadSingle(); 51 | if (version.IsPriorityOver(ChangeVersion)) 52 | { 53 | setInterpolationTarget(newValue); 54 | } 55 | } 56 | 57 | protected override void WriteDelta(BinaryWriter writer) 58 | { 59 | writer.Write(value); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Netcode/NetString.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetString : NetField 6 | { 7 | public delegate string FilterString(string newValue); 8 | 9 | public int Length => base.Value.Length; 10 | 11 | public event FilterString FilterStringEvent; 12 | 13 | public NetString() 14 | : base((string)null) 15 | { 16 | } 17 | 18 | public NetString(string value) 19 | : base(value) 20 | { 21 | } 22 | 23 | public override void Set(string newValue) 24 | { 25 | if (canShortcutSet()) 26 | { 27 | value = newValue; 28 | } 29 | else if (newValue != value) 30 | { 31 | cleanSet(newValue); 32 | MarkDirty(); 33 | } 34 | } 35 | 36 | public bool Contains(string substr) 37 | { 38 | if (base.Value != null) 39 | { 40 | return base.Value.Contains(substr); 41 | } 42 | return false; 43 | } 44 | 45 | protected override void ReadDelta(BinaryReader reader, NetVersion version) 46 | { 47 | string newValue = null; 48 | if (reader.ReadBoolean()) 49 | { 50 | newValue = reader.ReadString(); 51 | if (this.FilterStringEvent != null) 52 | { 53 | newValue = this.FilterStringEvent(newValue); 54 | } 55 | } 56 | if (version.IsPriorityOver(ChangeVersion)) 57 | { 58 | setInterpolationTarget(newValue); 59 | } 60 | } 61 | 62 | protected override void WriteDelta(BinaryWriter writer) 63 | { 64 | writer.Write(value != null); 65 | if (value != null) 66 | { 67 | writer.Write(value); 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Netcode/NetStringList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Netcode 4 | { 5 | public sealed class NetStringList : NetList 6 | { 7 | public NetStringList() 8 | { 9 | } 10 | 11 | public NetStringList(IEnumerable values) 12 | : base(values) 13 | { 14 | } 15 | 16 | public NetStringList(int capacity) 17 | : base(capacity) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Netcode/NetTimestamp.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Netcode 4 | { 5 | public struct NetTimestamp 6 | { 7 | public int PeerId; 8 | 9 | public uint Tick; 10 | 11 | public void Read(BinaryReader reader) 12 | { 13 | PeerId = reader.ReadByte(); 14 | Tick = reader.ReadUInt32(); 15 | } 16 | 17 | public void Write(BinaryWriter writer) 18 | { 19 | writer.Write((byte)PeerId); 20 | writer.Write(Tick); 21 | } 22 | 23 | public override string ToString() 24 | { 25 | return "v" + Tick + "@" + PeerId; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Netcode/Netcode.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | net40 6 | x86 7 | 8 | 9 | 10 | True 11 | Netcode 12 | false 13 | Library 14 | 15 | 16 | 17 | DEBUG;TRACE 18 | false 19 | full 20 | true 21 | 22 | 23 | 24 | TRACE 25 | true 26 | 27 | 28 | 29 | 30 | ..\lib\Microsoft.Xna.Framework.dll 31 | 32 | 33 | -------------------------------------------------------------------------------- /Netcode/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Runtime.Versioning; 6 | 7 | [assembly: CompilationRelaxations(8)] 8 | [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] 9 | [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] 10 | [assembly: AssemblyTitle("Netcode")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("Netcode")] 15 | [assembly: AssemblyCopyright("Copyright © 2016")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: ComVisible(false)] 18 | [assembly: Guid("b083bb02-f43e-4882-a5e8-96cec859e46c")] 19 | [assembly: AssemblyFileVersion("1.0.0.0")] 20 | [assembly: AssemblyVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /Netcode/SerializationCollectionFacade.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | 4 | namespace Netcode 5 | { 6 | public abstract class SerializationCollectionFacade : IEnumerable, IEnumerable 7 | { 8 | public SerializationCollectionFacade() 9 | { 10 | } 11 | 12 | protected abstract List Serialize(); 13 | 14 | protected abstract void DeserializeAdd(SerialT serialElem); 15 | 16 | public IEnumerator GetEnumerator() 17 | { 18 | return Serialize().GetEnumerator(); 19 | } 20 | 21 | IEnumerator IEnumerable.GetEnumerator() 22 | { 23 | return GetEnumerator(); 24 | } 25 | 26 | public void Add(SerialT value) 27 | { 28 | DeserializeAdd(value); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Netcode/SerializationFacade.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Netcode 6 | { 7 | public abstract class SerializationFacade : IEnumerable, IEnumerable 8 | { 9 | public SerializationFacade() 10 | { 11 | } 12 | 13 | protected abstract SerialT Serialize(); 14 | 15 | protected abstract void Deserialize(SerialT serialValue); 16 | 17 | public IEnumerator GetEnumerator() 18 | { 19 | return Enumerable.Repeat(Serialize(), 1).GetEnumerator(); 20 | } 21 | 22 | IEnumerator IEnumerable.GetEnumerator() 23 | { 24 | return GetEnumerator(); 25 | } 26 | 27 | public void Add(SerialT value) 28 | { 29 | Deserialize(value); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Netcode/StardewValley.Util/GuidHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley.Util 4 | { 5 | internal static class GuidHelper 6 | { 7 | public static Guid NewGuid() 8 | { 9 | return Guid.NewGuid(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /StardewValley.GameData/BundleData.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | 3 | namespace StardewValley.GameData 4 | { 5 | public class BundleData 6 | { 7 | public string Name; 8 | 9 | public int Index; 10 | 11 | public string Sprite; 12 | 13 | public string Color; 14 | 15 | public string Items; 16 | 17 | [ContentSerializer(Optional = true)] 18 | public int Pick = -1; 19 | 20 | [ContentSerializer(Optional = true)] 21 | public int RequiredItems = -1; 22 | 23 | public string Reward; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /StardewValley.GameData/BundleSetData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace StardewValley.GameData 4 | { 5 | public class BundleSetData 6 | { 7 | public List Bundles = new List(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley.GameData/Crafting/TailorItemRecipe.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.GameData.Crafting 5 | { 6 | public class TailorItemRecipe 7 | { 8 | [ContentSerializer(Optional = true)] 9 | public List FirstItemTags; 10 | 11 | [ContentSerializer(Optional = true)] 12 | public List SecondItemTags; 13 | 14 | [ContentSerializer(Optional = true)] 15 | public bool SpendRightItem = true; 16 | 17 | [ContentSerializer(Optional = true)] 18 | public int CraftedItemID; 19 | 20 | [ContentSerializer(Optional = true)] 21 | public List CraftedItemIDs; 22 | 23 | [ContentSerializer(Optional = true)] 24 | public string CraftedItemColor = "255 255 255"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /StardewValley.GameData/FishPond/FishPondData.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.GameData.FishPond 5 | { 6 | public class FishPondData 7 | { 8 | public List RequiredTags; 9 | 10 | [ContentSerializer(Optional = true)] 11 | public int SpawnTime = -1; 12 | 13 | public List ProducedItems; 14 | 15 | [ContentSerializer(Optional = true)] 16 | public Dictionary> PopulationGates; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /StardewValley.GameData/FishPond/FishPondReward.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | 3 | namespace StardewValley.GameData.FishPond 4 | { 5 | public class FishPondReward 6 | { 7 | [ContentSerializer(Optional = true)] 8 | public int RequiredPopulation; 9 | 10 | [ContentSerializer(Optional = true)] 11 | public float Chance = 1f; 12 | 13 | public int ItemID; 14 | 15 | [ContentSerializer(Optional = true)] 16 | public int MinQuantity = 1; 17 | 18 | [ContentSerializer(Optional = true)] 19 | public int MaxQuantity = 1; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /StardewValley.GameData/HomeRenovations/HomeRenovation.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.GameData.HomeRenovations 5 | { 6 | public class HomeRenovation 7 | { 8 | public string TextStrings; 9 | 10 | public string AnimationType; 11 | 12 | public bool CheckForObstructions; 13 | 14 | public List Requirements; 15 | 16 | public List RenovateActions; 17 | 18 | [ContentSerializer(Optional = true)] 19 | public List RectGroups; 20 | 21 | [ContentSerializer(Optional = true)] 22 | public string SpecialRect; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /StardewValley.GameData/HomeRenovations/Rect.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.GameData.HomeRenovations 2 | { 3 | public class Rect 4 | { 5 | public int X; 6 | 7 | public int Y; 8 | 9 | public int Width; 10 | 11 | public int Height; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /StardewValley.GameData/HomeRenovations/RectGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace StardewValley.GameData.HomeRenovations 4 | { 5 | public class RectGroup 6 | { 7 | public List Rects; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley.GameData/HomeRenovations/RenovationValue.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.GameData.HomeRenovations 2 | { 3 | public class RenovationValue 4 | { 5 | public string Type; 6 | 7 | public string Key; 8 | 9 | public string Value; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /StardewValley.GameData/Movies/CharacterResponse.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | 3 | namespace StardewValley.GameData.Movies 4 | { 5 | public class CharacterResponse 6 | { 7 | [ContentSerializer(Optional = true)] 8 | public string ResponsePoint; 9 | 10 | [ContentSerializer(Optional = true)] 11 | public string Script = ""; 12 | 13 | [ContentSerializer(Optional = true)] 14 | public string Text = ""; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley.GameData/Movies/ConcessionItemData.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.GameData.Movies 5 | { 6 | public class ConcessionItemData 7 | { 8 | public int ID; 9 | 10 | public string Name; 11 | 12 | public string DisplayName; 13 | 14 | public string Description; 15 | 16 | public int Price; 17 | 18 | [ContentSerializer(Optional = true)] 19 | public List ItemTags; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /StardewValley.GameData/Movies/ConcessionTaste.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.GameData.Movies 5 | { 6 | public class ConcessionTaste 7 | { 8 | public string Name; 9 | 10 | [ContentSerializer(Optional = true)] 11 | public List LovedTags; 12 | 13 | [ContentSerializer(Optional = true)] 14 | public List LikedTags; 15 | 16 | [ContentSerializer(Optional = true)] 17 | public List DislikedTags; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /StardewValley.GameData/Movies/MovieCharacterReaction.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.GameData.Movies 5 | { 6 | public class MovieCharacterReaction 7 | { 8 | public string NPCName; 9 | 10 | [ContentSerializer(Optional = true)] 11 | public List Reactions; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /StardewValley.GameData/Movies/MovieData.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.GameData.Movies 5 | { 6 | public class MovieData 7 | { 8 | [ContentSerializer(Optional = true)] 9 | public string ID; 10 | 11 | public int SheetIndex; 12 | 13 | public string Title; 14 | 15 | public string Description; 16 | 17 | [ContentSerializer(Optional = true)] 18 | public List Tags; 19 | 20 | public List Scenes; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /StardewValley.GameData/Movies/MovieReaction.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace StardewValley.GameData.Movies 6 | { 7 | public class MovieReaction 8 | { 9 | public string Tag; 10 | 11 | [ContentSerializer(Optional = true)] 12 | public string Response = "like"; 13 | 14 | [ContentSerializer(Optional = true)] 15 | public List Whitelist = new List(); 16 | 17 | [ContentSerializer(Optional = true)] 18 | public SpecialResponses SpecialResponses; 19 | 20 | public string ID = ""; 21 | 22 | public bool ShouldApplyToMovie(MovieData movie_data, IEnumerable movie_patrons, params string[] other_valid_tags) 23 | { 24 | if (Whitelist != null) 25 | { 26 | if (movie_patrons == null) 27 | { 28 | return false; 29 | } 30 | foreach (string required_character in Whitelist) 31 | { 32 | if (!movie_patrons.Contains(required_character)) 33 | { 34 | return false; 35 | } 36 | } 37 | } 38 | if (Tag == movie_data.ID) 39 | { 40 | return true; 41 | } 42 | if (movie_data.Tags.Contains(Tag)) 43 | { 44 | return true; 45 | } 46 | if (Tag == "*") 47 | { 48 | return true; 49 | } 50 | if (other_valid_tags.Contains(Tag)) 51 | { 52 | return true; 53 | } 54 | return false; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /StardewValley.GameData/Movies/MovieScene.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | 3 | namespace StardewValley.GameData.Movies 4 | { 5 | public class MovieScene 6 | { 7 | [ContentSerializer(Optional = true)] 8 | public int Image = -1; 9 | 10 | [ContentSerializer(Optional = true)] 11 | public string Music = ""; 12 | 13 | [ContentSerializer(Optional = true)] 14 | public string Sound = ""; 15 | 16 | [ContentSerializer(Optional = true)] 17 | public int MessageDelay = 500; 18 | 19 | [ContentSerializer(Optional = true)] 20 | public string Script = ""; 21 | 22 | [ContentSerializer(Optional = true)] 23 | public string Text = ""; 24 | 25 | [ContentSerializer(Optional = true)] 26 | public bool Shake; 27 | 28 | [ContentSerializer(Optional = true)] 29 | public string ResponsePoint; 30 | 31 | public string ID = ""; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /StardewValley.GameData/Movies/SpecialResponses.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | 3 | namespace StardewValley.GameData.Movies 4 | { 5 | public class SpecialResponses 6 | { 7 | [ContentSerializer(Optional = true)] 8 | public CharacterResponse BeforeMovie; 9 | 10 | [ContentSerializer(Optional = true)] 11 | public CharacterResponse DuringMovie; 12 | 13 | [ContentSerializer(Optional = true)] 14 | public CharacterResponse AfterMovie; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley.GameData/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Runtime.Versioning; 6 | 7 | [assembly: CompilationRelaxations(8)] 8 | [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] 9 | [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] 10 | [assembly: AssemblyTitle("StardewValley.GameData")] 11 | [assembly: AssemblyProduct("StardewValley.GameData")] 12 | [assembly: AssemblyDescription("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyCopyright("Copyright © 2019")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: ComVisible(false)] 17 | [assembly: Guid("8da11a36-d40e-47bc-89fc-8d7425e3aaef")] 18 | [assembly: AssemblyVersion("1.0.0.0")] 19 | -------------------------------------------------------------------------------- /StardewValley.GameData/RandomBundleData.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.GameData 5 | { 6 | public class RandomBundleData 7 | { 8 | public string AreaName = ""; 9 | 10 | public string Keys = ""; 11 | 12 | [ContentSerializer(Optional = true)] 13 | public List BundleSets = new List(); 14 | 15 | [ContentSerializer(Optional = true)] 16 | public List Bundles = new List(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /StardewValley.GameData/RandomizedElement.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace StardewValley.GameData 4 | { 5 | public class RandomizedElement 6 | { 7 | public string Name; 8 | 9 | public List Values; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /StardewValley.GameData/RandomizedElementItem.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | 3 | namespace StardewValley.GameData 4 | { 5 | public class RandomizedElementItem 6 | { 7 | [ContentSerializer(Optional = true)] 8 | public string RequiredTags = ""; 9 | 10 | public string Value = ""; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /StardewValley.GameData/SpecialOrderData.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Content; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.GameData 5 | { 6 | public class SpecialOrderData 7 | { 8 | public string Name; 9 | 10 | public string Requester; 11 | 12 | public string Duration; 13 | 14 | [ContentSerializer(Optional = true)] 15 | public string Repeatable = "False"; 16 | 17 | [ContentSerializer(Optional = true)] 18 | public string RequiredTags = ""; 19 | 20 | [ContentSerializer(Optional = true)] 21 | public string OrderType = ""; 22 | 23 | [ContentSerializer(Optional = true)] 24 | public string SpecialRule = ""; 25 | 26 | public string Text; 27 | 28 | [ContentSerializer(Optional = true)] 29 | public string ItemToRemoveOnEnd; 30 | 31 | [ContentSerializer(Optional = true)] 32 | public string MailToRemoveOnEnd; 33 | 34 | [ContentSerializer(Optional = true)] 35 | public List RandomizedElements; 36 | 37 | public List Objectives; 38 | 39 | public List Rewards; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /StardewValley.GameData/SpecialOrderObjectiveData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace StardewValley.GameData 4 | { 5 | public class SpecialOrderObjectiveData 6 | { 7 | public string Type; 8 | 9 | public string Text; 10 | 11 | public string RequiredCount; 12 | 13 | public Dictionary Data; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /StardewValley.GameData/SpecialOrderRewardData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace StardewValley.GameData 4 | { 5 | public class SpecialOrderRewardData 6 | { 7 | public string Type; 8 | 9 | public Dictionary Data; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /StardewValley.GameData/StardewValley.GameData.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net40 5 | x86 6 | 7 | 8 | 9 | StardewValley.GameData 10 | StardewValley.GameData 11 | true 12 | false 13 | Library 14 | 15 | 16 | 17 | DEBUG;TRACE 18 | false 19 | full 20 | true 21 | 22 | 23 | 24 | TRACE 25 | true 26 | 27 | 28 | 29 | 30 | ../lib/Microsoft.Xna.Framework.dll 31 | 32 | 33 | 34 | 35 | 36 | Microsoft.Xna.Framework.RuntimeProfile 37 | 38 | 39 | -------------------------------------------------------------------------------- /StardewValley/AbortNetSynchronizerException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley 4 | { 5 | public class AbortNetSynchronizerException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /StardewValley/AmethystEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class AmethystEnchantment : BaseWeaponEnchantment 6 | { 7 | protected override void _ApplyTo(Item item) 8 | { 9 | base._ApplyTo(item); 10 | MeleeWeapon weapon = item as MeleeWeapon; 11 | if (weapon != null) 12 | { 13 | weapon.knockback.Value += GetLevel(); 14 | } 15 | } 16 | 17 | protected override void _UnapplyTo(Item item) 18 | { 19 | base._UnapplyTo(item); 20 | MeleeWeapon weapon = item as MeleeWeapon; 21 | if (weapon != null) 22 | { 23 | weapon.knockback.Value -= GetLevel(); 24 | } 25 | } 26 | 27 | public override bool ShouldBeDisplayed() 28 | { 29 | return false; 30 | } 31 | 32 | public override bool IsForge() 33 | { 34 | return true; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StardewValley/AquamarineEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class AquamarineEnchantment : BaseWeaponEnchantment 6 | { 7 | protected override void _ApplyTo(Item item) 8 | { 9 | base._ApplyTo(item); 10 | MeleeWeapon weapon = item as MeleeWeapon; 11 | if (weapon != null) 12 | { 13 | weapon.critChance.Value += 0.046f * (float)GetLevel(); 14 | } 15 | } 16 | 17 | protected override void _UnapplyTo(Item item) 18 | { 19 | base._UnapplyTo(item); 20 | MeleeWeapon weapon = item as MeleeWeapon; 21 | if (weapon != null) 22 | { 23 | weapon.critChance.Value -= 0.046f * (float)GetLevel(); 24 | } 25 | } 26 | 27 | public override bool ShouldBeDisplayed() 28 | { 29 | return false; 30 | } 31 | 32 | public override bool IsForge() 33 | { 34 | return true; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StardewValley/ArchaeologistEnchantment.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class ArchaeologistEnchantment : HoeEnchantment 4 | { 5 | public override string GetName() 6 | { 7 | return "Archaeologist"; 8 | } 9 | 10 | protected override void _ApplyTo(Item item) 11 | { 12 | base._ApplyTo(item); 13 | } 14 | 15 | protected override void _UnapplyTo(Item item) 16 | { 17 | base._UnapplyTo(item); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/ArtfulEnchantment.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class ArtfulEnchantment : BaseWeaponEnchantment 4 | { 5 | public override string GetName() 6 | { 7 | return "Artful"; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /StardewValley/ArtifactSpotWatchActivity.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class ArtifactSpotWatchActivity : FarmActivity 4 | { 5 | protected override bool _AttemptActivity(Farm farm) 6 | { 7 | Object found_object = GetRandomObject(farm, (Object o) => Utility.IsNormalObjectAtParentSheetIndex(o, 595)); 8 | if (found_object != null) 9 | { 10 | activityPosition = GetNearbyTile(farm, found_object.TileLocation); 11 | return true; 12 | } 13 | return false; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/AudioCategoryWrapper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | 3 | namespace StardewValley 4 | { 5 | public class AudioCategoryWrapper : IAudioCategory 6 | { 7 | private AudioCategory audioCategory; 8 | 9 | public AudioCategoryWrapper(AudioCategory category) 10 | { 11 | audioCategory = category; 12 | } 13 | 14 | public void SetVolume(float volume) 15 | { 16 | audioCategory.SetVolume(volume); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /StardewValley/AudioEngineWrapper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | internal class AudioEngineWrapper : IAudioEngine, IDisposable 7 | { 8 | private AudioEngine audioEngine; 9 | 10 | public bool IsDisposed => audioEngine.IsDisposed; 11 | 12 | public AudioEngine Engine => audioEngine; 13 | 14 | public AudioEngineWrapper(AudioEngine engine) 15 | { 16 | audioEngine = engine; 17 | } 18 | 19 | public void Dispose() 20 | { 21 | audioEngine.Dispose(); 22 | } 23 | 24 | public IAudioCategory GetCategory(string name) 25 | { 26 | return new AudioCategoryWrapper(audioEngine.GetCategory(name)); 27 | } 28 | 29 | public void Update() 30 | { 31 | audioEngine.Update(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /StardewValley/AutoHookEnchantment.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class AutoHookEnchantment : FishingRodEnchantment 4 | { 5 | public override string GetName() 6 | { 7 | return "Auto-Hook"; 8 | } 9 | 10 | protected override void _ApplyTo(Item item) 11 | { 12 | base._ApplyTo(item); 13 | } 14 | 15 | protected override void _UnapplyTo(Item item) 16 | { 17 | base._UnapplyTo(item); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/AxeEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class AxeEnchantment : BaseEnchantment 6 | { 7 | public override bool CanApplyTo(Item item) 8 | { 9 | if (item is Axe) 10 | { 11 | return true; 12 | } 13 | return false; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/BaseWeaponEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class BaseWeaponEnchantment : BaseEnchantment 6 | { 7 | public override bool CanApplyTo(Item item) 8 | { 9 | if (item is MeleeWeapon && !(item as MeleeWeapon).isScythe()) 10 | { 11 | return true; 12 | } 13 | return false; 14 | } 15 | 16 | public void OnSwing(MeleeWeapon weapon, Farmer farmer) 17 | { 18 | _OnSwing(weapon, farmer); 19 | } 20 | 21 | protected virtual void _OnSwing(MeleeWeapon weapon, Farmer farmer) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /StardewValley/BellsAndWhistles/Owl.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System.Collections.Generic; 4 | 5 | namespace StardewValley.BellsAndWhistles 6 | { 7 | public class Owl : Critter 8 | { 9 | public Owl() 10 | { 11 | } 12 | 13 | public Owl(Vector2 position) 14 | { 15 | baseFrame = 83; 16 | base.position = position; 17 | sprite = new AnimatedSprite(Critter.critterTexture, baseFrame, 32, 32); 18 | startingPosition = position; 19 | sprite.setCurrentAnimation(new List 20 | { 21 | new FarmerSprite.AnimationFrame(83, 100), 22 | new FarmerSprite.AnimationFrame(84, 100), 23 | new FarmerSprite.AnimationFrame(85, 100), 24 | new FarmerSprite.AnimationFrame(86, 100) 25 | }); 26 | } 27 | 28 | public override bool update(GameTime time, GameLocation environment) 29 | { 30 | Vector2 parallax = new Vector2((float)Game1.viewport.X - Game1.previousViewportPosition.X, (float)Game1.viewport.Y - Game1.previousViewportPosition.Y) * 0.15f; 31 | position.Y += (float)time.ElapsedGameTime.TotalMilliseconds * 0.2f; 32 | position.X += (float)time.ElapsedGameTime.TotalMilliseconds * 0.05f; 33 | position -= parallax; 34 | return base.update(time, environment); 35 | } 36 | 37 | public override void draw(SpriteBatch b) 38 | { 39 | } 40 | 41 | public override void drawAboveFrontLayer(SpriteBatch b) 42 | { 43 | sprite.draw(b, Game1.GlobalToLocal(Game1.viewport, position + new Vector2(-64f, -128f + yJumpOffset + yOffset)), position.Y / 10000f + position.X / 100000f, 0, 0, Color.MediumBlue, flip, 4f); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /StardewValley/BellsAndWhistles/SebsFrogs.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace StardewValley.BellsAndWhistles 4 | { 5 | public class SebsFrogs : TemporaryAnimatedSprite 6 | { 7 | private float yOriginal; 8 | 9 | private bool flipJump; 10 | 11 | public override bool update(GameTime time) 12 | { 13 | base.update(time); 14 | if (!pingPong && motion.Equals(Vector2.Zero) && Game1.random.NextDouble() < 0.003) 15 | { 16 | if (Game1.random.NextDouble() < 0.4) 17 | { 18 | animationLength = 3; 19 | pingPong = true; 20 | } 21 | else 22 | { 23 | flipJump = !flipJump; 24 | yOriginal = position.Y; 25 | motion = new Vector2((!flipJump) ? 1 : (-1), -3f); 26 | acceleration = new Vector2(0f, 0.2f); 27 | sourceRect.X = 0; 28 | interval = Game1.random.Next(110, 150); 29 | animationLength = 5; 30 | flipped = flipJump; 31 | if (base.Parent != null && base.Parent == Game1.currentLocation && Game1.random.NextDouble() < 0.03) 32 | { 33 | Game1.playSound("croak"); 34 | } 35 | } 36 | } 37 | else if (pingPong && Game1.random.NextDouble() < 0.02 && sourceRect.X == 64) 38 | { 39 | animationLength = 1; 40 | pingPong = false; 41 | sourceRect.X = (int)sourceRectStartingPos.X; 42 | } 43 | if (!motion.Equals(Vector2.Zero) && position.Y > yOriginal) 44 | { 45 | motion = Vector2.Zero; 46 | acceleration = Vector2.Zero; 47 | sourceRect.X = 64; 48 | animationLength = 1; 49 | position.Y = yOriginal; 50 | } 51 | return false; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /StardewValley/BloomSettings.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class BloomSettings 4 | { 5 | public const int nightTimeLights = 7; 6 | 7 | public string Name; 8 | 9 | public float BloomThreshold; 10 | 11 | public float BlurAmount; 12 | 13 | public float BloomIntensity; 14 | 15 | public float BaseIntensity; 16 | 17 | public float BloomSaturation; 18 | 19 | public float BaseSaturation; 20 | 21 | public bool brightWhiteOnly; 22 | 23 | public static BloomSettings[] PresetSettings = new BloomSettings[8] 24 | { 25 | new BloomSettings("Default", 0.25f, 4f, 1.25f, 1f, 1f, 1f), 26 | new BloomSettings("Soft", 0f, 3f, 1f, 1f, 1f, 1f), 27 | new BloomSettings("Desaturated", 0.5f, 8f, 2f, 1f, 0f, 1f), 28 | new BloomSettings("Saturated", 0.25f, 4f, 2f, 1f, 2f, 0f), 29 | new BloomSettings("RainyDay", 0f, 2f, 0.7f, 1f, 0.5f, 0.5f), 30 | new BloomSettings("SunnyDay", 0.6f, 4f, 0.7f, 1f, 1f, 1f), 31 | new BloomSettings("B&W", 0f, 0f, 0f, 1f, 0f, 0f), 32 | new BloomSettings("NightTimeLights", 0f, 3f, 7f, 1f, 4f, 1.2f, brightWhiteOnly: true) 33 | }; 34 | 35 | public BloomSettings(string name, float bloomThreshold, float blurAmount, float bloomIntensity, float baseIntensity, float bloomSaturation, float baseSaturation, bool brightWhiteOnly = false) 36 | { 37 | Name = name; 38 | BloomThreshold = bloomThreshold; 39 | BlurAmount = blurAmount; 40 | BloomIntensity = bloomIntensity; 41 | BaseIntensity = baseIntensity; 42 | BloomSaturation = bloomSaturation; 43 | BaseSaturation = baseSaturation; 44 | this.brightWhiteOnly = brightWhiteOnly; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /StardewValley/BottomlessEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class BottomlessEnchantment : WateringCanEnchantment 6 | { 7 | public override string GetName() 8 | { 9 | return "Bottomless"; 10 | } 11 | 12 | protected override void _ApplyTo(Item item) 13 | { 14 | base._ApplyTo(item); 15 | WateringCan tool = item as WateringCan; 16 | if (tool != null) 17 | { 18 | tool.IsBottomless = true; 19 | tool.WaterLeft = tool.waterCanMax; 20 | } 21 | } 22 | 23 | protected override void _UnapplyTo(Item item) 24 | { 25 | base._UnapplyTo(item); 26 | WateringCan tool = item as WateringCan; 27 | if (tool != null) 28 | { 29 | tool.IsBottomless = false; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /StardewValley/BugKillerEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Monsters; 2 | 3 | namespace StardewValley 4 | { 5 | public class BugKillerEnchantment : BaseWeaponEnchantment 6 | { 7 | protected override void _OnDealDamage(Monster monster, GameLocation location, Farmer who, ref int amount) 8 | { 9 | if (monster is Grub || monster is Fly || monster is Bug || monster is Leaper || monster is LavaCrab || monster is RockCrab) 10 | { 11 | amount = (int)((float)amount * 2f); 12 | } 13 | } 14 | 15 | public override string GetName() 16 | { 17 | return "Bug Killer"; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/CachedMultiplayerMap.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using xTile; 3 | 4 | namespace StardewValley 5 | { 6 | public class CachedMultiplayerMap 7 | { 8 | public string mapPath; 9 | 10 | public HashSet appliedMapOverrides; 11 | 12 | public Map map; 13 | 14 | public string loadedMapPath; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/ChangeType.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public enum ChangeType 4 | { 5 | Add, 6 | Remove, 7 | Clear 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley/CharEnteredHandler.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public delegate void CharEnteredHandler(object sender, CharacterEventArgs e); 4 | } 5 | -------------------------------------------------------------------------------- /StardewValley/CharacterEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley 4 | { 5 | public class CharacterEventArgs : EventArgs 6 | { 7 | private readonly char character; 8 | 9 | private readonly int lParam; 10 | 11 | public char Character => character; 12 | 13 | public int Param => lParam; 14 | 15 | public int RepeatCount => lParam & 0xFFFF; 16 | 17 | public bool ExtendedKey => (lParam & 0x1000000) > 0; 18 | 19 | public bool AltPressed => (lParam & 0x20000000) > 0; 20 | 21 | public bool PreviousState => (lParam & 0x40000000) > 0; 22 | 23 | public bool TransitionState => (lParam & int.MinValue) > 0; 24 | 25 | public CharacterEventArgs(char character, int lParam) 26 | { 27 | this.character = character; 28 | this.lParam = lParam; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /StardewValley/Characters/BotchedNetBool.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Xml; 3 | 4 | namespace StardewValley.Characters 5 | { 6 | public class BotchedNetBool : BotchedNetField 7 | { 8 | public BotchedNetBool() 9 | { 10 | netField = new NetBool(); 11 | } 12 | 13 | public BotchedNetBool(bool default_value) 14 | { 15 | netField = new NetBool(default_value); 16 | } 17 | 18 | protected override object _ParseValue(XmlReader reader) 19 | { 20 | return bool.Parse(reader.Value); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /StardewValley/Characters/BotchedNetInt.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Xml; 3 | 4 | namespace StardewValley.Characters 5 | { 6 | public class BotchedNetInt : BotchedNetField 7 | { 8 | public BotchedNetInt() 9 | { 10 | netField = new NetInt(); 11 | } 12 | 13 | public BotchedNetInt(int default_value) 14 | { 15 | netField = new NetInt(default_value); 16 | } 17 | 18 | protected override object _ParseValue(XmlReader reader) 19 | { 20 | return int.Parse(reader.Value); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /StardewValley/Characters/BotchedNetLong.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Xml; 3 | 4 | namespace StardewValley.Characters 5 | { 6 | public class BotchedNetLong : BotchedNetField 7 | { 8 | public BotchedNetLong() 9 | { 10 | netField = new NetLong(); 11 | } 12 | 13 | public BotchedNetLong(long default_value) 14 | { 15 | netField = new NetLong(default_value); 16 | } 17 | 18 | protected override object _ParseValue(XmlReader reader) 19 | { 20 | return long.Parse(reader.Value); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /StardewValley/CropWatchActivity.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using StardewValley.TerrainFeatures; 3 | 4 | namespace StardewValley 5 | { 6 | public class CropWatchActivity : FarmActivity 7 | { 8 | protected Object _cropObject; 9 | 10 | protected override bool _AttemptActivity(Farm farm) 11 | { 12 | _cropObject = null; 13 | HoeDirt found_crop = GetRandomCrop(farm, (Crop crop) => crop.currentPhase.Value <= 0 && new Object(Vector2.Zero, crop.indexOfHarvest.Value, 1).category.Value != -80); 14 | if (found_crop != null) 15 | { 16 | _cropObject = new Object(Vector2.Zero, found_crop.crop.indexOfHarvest.Value, 1); 17 | activityPosition = found_crop.currentTileLocation; 18 | return true; 19 | } 20 | return false; 21 | } 22 | 23 | protected override void _EndActivity() 24 | { 25 | _cropObject = null; 26 | } 27 | 28 | protected override void _BeginActivity() 29 | { 30 | if (_cropObject != null) 31 | { 32 | switch (_character.getGiftTasteForThisItem(_cropObject)) 33 | { 34 | case 8: 35 | break; 36 | case 6: 37 | _character.doEmote(20, nextEventCommand: false); 38 | break; 39 | case 2: 40 | _character.doEmote(32, nextEventCommand: false); 41 | break; 42 | default: 43 | _character.doEmote(12, nextEventCommand: false); 44 | break; 45 | } 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /StardewValley/CrusaderEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Monsters; 2 | 3 | namespace StardewValley 4 | { 5 | public class CrusaderEnchantment : BaseWeaponEnchantment 6 | { 7 | protected override void _OnDealDamage(Monster monster, GameLocation location, Farmer who, ref int amount) 8 | { 9 | if (monster is Ghost || monster is Skeleton || monster is Mummy || monster is ShadowBrute || monster is ShadowShaman || monster is ShadowGirl || monster is ShadowGuy || monster is Shooter) 10 | { 11 | amount = (int)((float)amount * 1.5f); 12 | } 13 | } 14 | 15 | public override string GetName() 16 | { 17 | return "Crusader"; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/CueWrapper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | public class CueWrapper : ICue, IDisposable 7 | { 8 | private Cue cue; 9 | 10 | public bool IsStopped => cue.IsStopped; 11 | 12 | public bool IsStopping => cue.IsStopping; 13 | 14 | public bool IsPlaying => cue.IsPlaying; 15 | 16 | public bool IsPaused => cue.IsPaused; 17 | 18 | public string Name => cue.Name; 19 | 20 | public CueWrapper(Cue cue) 21 | { 22 | this.cue = cue; 23 | } 24 | 25 | public void Play() 26 | { 27 | cue.Play(); 28 | } 29 | 30 | public void Pause() 31 | { 32 | cue.Pause(); 33 | } 34 | 35 | public void Resume() 36 | { 37 | cue.Resume(); 38 | } 39 | 40 | public void Stop(AudioStopOptions options) 41 | { 42 | cue.Stop(options); 43 | } 44 | 45 | public void SetVariable(string var, int val) 46 | { 47 | cue.SetVariable(var, val); 48 | } 49 | 50 | public void SetVariable(string var, float val) 51 | { 52 | cue.SetVariable(var, val); 53 | } 54 | 55 | public float GetVariable(string var) 56 | { 57 | return cue.GetVariable(var); 58 | } 59 | 60 | public void Dispose() 61 | { 62 | cue.Dispose(); 63 | cue = null; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /StardewValley/DiamondEnchantment.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class DiamondEnchantment : BaseWeaponEnchantment 4 | { 5 | public override bool ShouldBeDisplayed() 6 | { 7 | return false; 8 | } 9 | 10 | public override bool IsForge() 11 | { 12 | return true; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /StardewValley/DisposableList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley 5 | { 6 | public struct DisposableList 7 | { 8 | public struct Enumerator : IDisposable 9 | { 10 | private readonly DisposableList _parent; 11 | 12 | private int _index; 13 | 14 | public T Current 15 | { 16 | get 17 | { 18 | if (_parent._list == null || _index == 0) 19 | { 20 | throw new InvalidOperationException(); 21 | } 22 | return _parent._list[_index - 1]; 23 | } 24 | } 25 | 26 | public Enumerator(DisposableList parent) 27 | { 28 | _parent = parent; 29 | _index = 0; 30 | } 31 | 32 | public bool MoveNext() 33 | { 34 | _index++; 35 | if (_parent._list != null) 36 | { 37 | return _parent._list.Count >= _index; 38 | } 39 | return false; 40 | } 41 | 42 | public void Reset() 43 | { 44 | _index = 0; 45 | } 46 | 47 | public void Dispose() 48 | { 49 | lock (_parent._pool) 50 | { 51 | _parent._pool.Return(_parent._list); 52 | } 53 | } 54 | } 55 | 56 | private readonly ListPool _pool; 57 | 58 | private readonly List _list; 59 | 60 | public DisposableList(List list, ListPool pool) 61 | { 62 | _list = list; 63 | _pool = pool; 64 | } 65 | 66 | public Enumerator GetEnumerator() 67 | { 68 | return new Enumerator(this); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /StardewValley/DummyAudioCategory.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class DummyAudioCategory : IAudioCategory 4 | { 5 | public void SetVolume(float volume) 6 | { 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley/DummyAudioEngine.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | internal class DummyAudioEngine : IAudioEngine, IDisposable 7 | { 8 | private IAudioCategory category = new DummyAudioCategory(); 9 | 10 | public bool IsDisposed => true; 11 | 12 | public AudioEngine Engine => null; 13 | 14 | public void Update() 15 | { 16 | } 17 | 18 | public IAudioCategory GetCategory(string name) 19 | { 20 | return category; 21 | } 22 | 23 | public void Dispose() 24 | { 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /StardewValley/DummyCue.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | public class DummyCue : ICue, IDisposable 7 | { 8 | public bool IsStopped => true; 9 | 10 | public bool IsStopping => false; 11 | 12 | public bool IsPlaying => false; 13 | 14 | public bool IsPaused => false; 15 | 16 | public string Name => ""; 17 | 18 | public void Play() 19 | { 20 | } 21 | 22 | public void Pause() 23 | { 24 | } 25 | 26 | public void Resume() 27 | { 28 | } 29 | 30 | public void SetVariable(string var, int val) 31 | { 32 | } 33 | 34 | public void SetVariable(string var, float val) 35 | { 36 | } 37 | 38 | public float GetVariable(string var) 39 | { 40 | return 0f; 41 | } 42 | 43 | public void Stop(AudioStopOptions options) 44 | { 45 | } 46 | 47 | public void Dispose() 48 | { 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /StardewValley/DummySoundBank.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | public class DummySoundBank : ISoundBank, IDisposable 7 | { 8 | private ICue dummyCue = new DummyCue(); 9 | 10 | public bool IsInUse => false; 11 | 12 | public bool IsDisposed => true; 13 | 14 | public void Dispose() 15 | { 16 | } 17 | 18 | public ICue GetCue(string name) 19 | { 20 | return dummyCue; 21 | } 22 | 23 | public void PlayCue(string name) 24 | { 25 | } 26 | 27 | public void PlayCue(string name, AudioListener listener, AudioEmitter emitter) 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /StardewValley/EfficientToolEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class EfficientToolEnchantment : BaseEnchantment 6 | { 7 | public override string GetName() 8 | { 9 | return "Efficient"; 10 | } 11 | 12 | public override bool CanApplyTo(Item item) 13 | { 14 | if (item is Tool && !(item is MilkPail) && !(item is MeleeWeapon) && !(item is Shears) && !(item is Pan) && !(item is Wand)) 15 | { 16 | return !(item is Slingshot); 17 | } 18 | return false; 19 | } 20 | 21 | protected override void _ApplyTo(Item item) 22 | { 23 | base._ApplyTo(item); 24 | Tool tool = item as Tool; 25 | if (tool != null) 26 | { 27 | tool.IsEfficient = true; 28 | } 29 | } 30 | 31 | protected override void _UnapplyTo(Item item) 32 | { 33 | base._UnapplyTo(item); 34 | Tool tool = item as Tool; 35 | if (tool != null) 36 | { 37 | tool.IsEfficient = false; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /StardewValley/EmeraldEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class EmeraldEnchantment : BaseWeaponEnchantment 6 | { 7 | protected override void _ApplyTo(Item item) 8 | { 9 | base._ApplyTo(item); 10 | MeleeWeapon weapon = item as MeleeWeapon; 11 | if (weapon != null) 12 | { 13 | weapon.speed.Value += 5 * GetLevel(); 14 | } 15 | } 16 | 17 | protected override void _UnapplyTo(Item item) 18 | { 19 | base._UnapplyTo(item); 20 | MeleeWeapon weapon = item as MeleeWeapon; 21 | if (weapon != null) 22 | { 23 | weapon.speed.Value -= 5 * GetLevel(); 24 | } 25 | } 26 | 27 | public override bool ShouldBeDisplayed() 28 | { 29 | return false; 30 | } 31 | 32 | public override bool IsForge() 33 | { 34 | return true; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StardewValley/Events/FarmEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using Netcode; 4 | 5 | namespace StardewValley.Events 6 | { 7 | public interface FarmEvent : INetObject 8 | { 9 | bool setUp(); 10 | 11 | bool tickUpdate(GameTime time); 12 | 13 | void draw(SpriteBatch b); 14 | 15 | void drawAboveEverything(SpriteBatch b); 16 | 17 | void makeChangesToLocation(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /StardewValley/FarmerPair.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley 4 | { 5 | public struct FarmerPair 6 | { 7 | public long Farmer1; 8 | 9 | public long Farmer2; 10 | 11 | public static FarmerPair MakePair(long f1, long f2) 12 | { 13 | FarmerPair pair = default(FarmerPair); 14 | pair.Farmer1 = Math.Min(f1, f2); 15 | pair.Farmer2 = Math.Max(f1, f2); 16 | return pair; 17 | } 18 | 19 | public bool Contains(long f) 20 | { 21 | if (Farmer1 != f) 22 | { 23 | return Farmer2 == f; 24 | } 25 | return true; 26 | } 27 | 28 | public long GetOther(long f) 29 | { 30 | if (Farmer1 == f) 31 | { 32 | return Farmer2; 33 | } 34 | return Farmer1; 35 | } 36 | 37 | public bool Equals(FarmerPair other) 38 | { 39 | if (Farmer1 == other.Farmer1) 40 | { 41 | return Farmer2 == other.Farmer2; 42 | } 43 | return false; 44 | } 45 | 46 | public override bool Equals(object obj) 47 | { 48 | if (obj is FarmerPair) 49 | { 50 | return Equals((FarmerPair)obj); 51 | } 52 | return false; 53 | } 54 | 55 | public override int GetHashCode() 56 | { 57 | return Farmer1.GetHashCode() ^ (Farmer2.GetHashCode() << 16); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /StardewValley/FishingRodEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | using System.Xml.Serialization; 3 | 4 | namespace StardewValley 5 | { 6 | [XmlInclude(typeof(FishingRodEnchantment))] 7 | public class FishingRodEnchantment : BaseEnchantment 8 | { 9 | public override bool CanApplyTo(Item item) 10 | { 11 | if (item is FishingRod) 12 | { 13 | return true; 14 | } 15 | return false; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /StardewValley/FlowerWatchActivity.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using StardewValley.TerrainFeatures; 3 | 4 | namespace StardewValley 5 | { 6 | public class FlowerWatchActivity : FarmActivity 7 | { 8 | protected override bool _AttemptActivity(Farm farm) 9 | { 10 | HoeDirt found_crop = GetRandomCrop(farm, (Crop crop) => crop.currentPhase.Value >= crop.phaseDays.Count - 1 && new Object(Vector2.Zero, crop.indexOfHarvest.Value, 1).category.Value == -80); 11 | if (found_crop != null) 12 | { 13 | activityPosition = found_crop.currentTileLocation; 14 | return true; 15 | } 16 | return false; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /StardewValley/FrameRateCounter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using StardewValley; 4 | using System; 5 | 6 | public class FrameRateCounter : DrawableGameComponent 7 | { 8 | private LocalizedContentManager content; 9 | 10 | private SpriteBatch spriteBatch; 11 | 12 | private int frameRate; 13 | 14 | private int frameCounter; 15 | 16 | private TimeSpan elapsedTime = TimeSpan.Zero; 17 | 18 | public FrameRateCounter(Game game) 19 | : base(game) 20 | { 21 | content = new LocalizedContentManager(game.Services, base.Game.Content.RootDirectory); 22 | } 23 | 24 | protected override void LoadContent() 25 | { 26 | spriteBatch = new SpriteBatch(base.GraphicsDevice); 27 | } 28 | 29 | protected override void UnloadContent() 30 | { 31 | content.Unload(); 32 | } 33 | 34 | public override void Update(GameTime gameTime) 35 | { 36 | elapsedTime += gameTime.ElapsedGameTime; 37 | if (elapsedTime > TimeSpan.FromSeconds(1.0)) 38 | { 39 | elapsedTime -= TimeSpan.FromSeconds(1.0); 40 | frameRate = frameCounter; 41 | frameCounter = 0; 42 | } 43 | } 44 | 45 | public override void Draw(GameTime gameTime) 46 | { 47 | frameCounter++; 48 | string fps = $"fps: {frameRate}"; 49 | spriteBatch.Begin(); 50 | spriteBatch.DrawString(Game1.dialogueFont, fps, new Vector2(33f, 33f), Color.Black); 51 | spriteBatch.DrawString(Game1.dialogueFont, fps, new Vector2(32f, 32f), Color.White); 52 | spriteBatch.End(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /StardewValley/FriendshipReward.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | using System.Xml.Serialization; 4 | 5 | namespace StardewValley 6 | { 7 | public class FriendshipReward : OrderReward 8 | { 9 | [XmlElement("targetName")] 10 | public NetString targetName = new NetString(); 11 | 12 | [XmlElement("amount")] 13 | public NetInt amount = new NetInt(); 14 | 15 | public override void InitializeNetFields() 16 | { 17 | base.InitializeNetFields(); 18 | base.NetFields.AddFields(targetName, amount); 19 | } 20 | 21 | public override void Load(SpecialOrder order, Dictionary data) 22 | { 23 | string target_name2 = order.requester; 24 | if (data.ContainsKey("TargetName")) 25 | { 26 | target_name2 = data["TargetName"]; 27 | } 28 | target_name2 = order.Parse(target_name2); 29 | targetName.Value = target_name2; 30 | string amount_string2 = "250"; 31 | if (data.ContainsKey("Amount")) 32 | { 33 | amount_string2 = data["Amount"]; 34 | } 35 | amount_string2 = order.Parse(amount_string2); 36 | amount.Value = int.Parse(amount_string2); 37 | } 38 | 39 | public override void Grant() 40 | { 41 | NPC i = Game1.getCharacterFromName(targetName.Value); 42 | if (i != null) 43 | { 44 | Game1.player.changeFriendship(amount.Value, i); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /StardewValley/FriendshipStatus.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public enum FriendshipStatus 4 | { 5 | Friendly, 6 | Dating, 7 | Engaged, 8 | Married, 9 | Divorced 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /StardewValley/GalaxySoulEnchantment.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class GalaxySoulEnchantment : BaseWeaponEnchantment 4 | { 5 | public override bool IsSecondaryEnchantment() 6 | { 7 | return true; 8 | } 9 | 10 | public override bool IsForge() 11 | { 12 | return false; 13 | } 14 | 15 | public override int GetMaximumLevel() 16 | { 17 | return 3; 18 | } 19 | 20 | public override bool ShouldBeDisplayed() 21 | { 22 | return false; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /StardewValley/GemsReward.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley 5 | { 6 | public class GemsReward : OrderReward 7 | { 8 | public NetInt amount = new NetInt(0); 9 | 10 | public override void InitializeNetFields() 11 | { 12 | base.InitializeNetFields(); 13 | base.NetFields.AddFields(amount); 14 | } 15 | 16 | public override void Load(SpecialOrder order, Dictionary data) 17 | { 18 | amount.Value = int.Parse(order.Parse(data["Amount"])); 19 | } 20 | 21 | public override void Grant() 22 | { 23 | Game1.player.QiGems += amount.Value; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /StardewValley/GenerousEnchantment.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class GenerousEnchantment : HoeEnchantment 4 | { 5 | public override string GetName() 6 | { 7 | return "Generous"; 8 | } 9 | 10 | protected override void _ApplyTo(Item item) 11 | { 12 | base._ApplyTo(item); 13 | } 14 | 15 | protected override void _UnapplyTo(Item item) 16 | { 17 | base._UnapplyTo(item); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/HairStyleMetadata.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | 3 | namespace StardewValley 4 | { 5 | public class HairStyleMetadata 6 | { 7 | public Texture2D texture; 8 | 9 | public int tileX; 10 | 11 | public int tileY; 12 | 13 | public bool usesUniqueLeftSprite; 14 | 15 | public int coveredIndex = -1; 16 | 17 | public bool isBaldStyle; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /StardewValley/HaymakerEnchantment.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace StardewValley 4 | { 5 | public class HaymakerEnchantment : BaseWeaponEnchantment 6 | { 7 | public override string GetName() 8 | { 9 | return "Haymaker"; 10 | } 11 | 12 | protected override void _OnCutWeed(Vector2 tile_location, GameLocation location, Farmer who) 13 | { 14 | base._OnCutWeed(tile_location, location, who); 15 | if (Game1.random.NextDouble() < 0.5) 16 | { 17 | Game1.createItemDebris(new Object(771, 1), new Vector2(tile_location.X * 64f + 32f, tile_location.Y * 64f + 32f), -1); 18 | } 19 | if (Game1.random.NextDouble() < 0.33) 20 | { 21 | if ((Game1.getLocationFromName("Farm") as Farm).tryToAddHay(1) == 0) 22 | { 23 | TemporaryAnimatedSprite tmpSprite = new TemporaryAnimatedSprite("Maps\\springobjects", Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 178, 16, 16), 750f, 1, 0, who.Position - new Vector2(0f, 128f), flicker: false, flipped: false, who.Position.Y / 10000f, 0.005f, Color.White, 4f, -0.005f, 0f, 0f); 24 | tmpSprite.motion.Y = -1f; 25 | tmpSprite.layerDepth = 1f - (float)Game1.random.Next(100) / 10000f; 26 | tmpSprite.delayBeforeAnimationStart = Game1.random.Next(350); 27 | Game1.multiplayer.broadcastSprites(location, tmpSprite); 28 | Game1.addHUDMessage(new HUDMessage("Hay", 1, add: true, Color.LightGoldenrodYellow, new Object(178, 1))); 29 | } 30 | else 31 | { 32 | Game1.createItemDebris(new Object(178, 1).getOne(), new Vector2(tile_location.X * 64f + 32f, tile_location.Y * 64f + 32f), -1); 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StardewValley/HoeEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class HoeEnchantment : BaseEnchantment 6 | { 7 | public override bool CanApplyTo(Item item) 8 | { 9 | if (item is Hoe) 10 | { 11 | return true; 12 | } 13 | return false; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/IAnimalLocation.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Netcode; 3 | using StardewValley.Network; 4 | 5 | namespace StardewValley 6 | { 7 | public interface IAnimalLocation 8 | { 9 | NetLongDictionary> Animals 10 | { 11 | get; 12 | } 13 | 14 | bool CheckPetAnimal(Vector2 position, Farmer who); 15 | 16 | bool CheckPetAnimal(Rectangle rect, Farmer who); 17 | 18 | bool CheckInspectAnimal(Vector2 position, Farmer who); 19 | 20 | bool CheckInspectAnimal(Rectangle rect, Farmer who); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /StardewValley/IAudioCategory.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public interface IAudioCategory 4 | { 5 | void SetVolume(float volume); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /StardewValley/IAudioEngine.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | public interface IAudioEngine : IDisposable 7 | { 8 | bool IsDisposed 9 | { 10 | get; 11 | } 12 | 13 | AudioEngine Engine 14 | { 15 | get; 16 | } 17 | 18 | void Update(); 19 | 20 | IAudioCategory GetCategory(string name); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /StardewValley/ICue.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | public interface ICue : IDisposable 7 | { 8 | bool IsStopped 9 | { 10 | get; 11 | } 12 | 13 | bool IsStopping 14 | { 15 | get; 16 | } 17 | 18 | bool IsPlaying 19 | { 20 | get; 21 | } 22 | 23 | bool IsPaused 24 | { 25 | get; 26 | } 27 | 28 | string Name 29 | { 30 | get; 31 | } 32 | 33 | void Play(); 34 | 35 | void Pause(); 36 | 37 | void Resume(); 38 | 39 | void Stop(AudioStopOptions options); 40 | 41 | void SetVariable(string var, int val); 42 | 43 | void SetVariable(string var, float val); 44 | 45 | float GetVariable(string var); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /StardewValley/ICustomEventScript.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace StardewValley 5 | { 6 | public interface ICustomEventScript 7 | { 8 | bool update(GameTime time, Event e); 9 | 10 | void draw(SpriteBatch b); 11 | 12 | void drawAboveAlwaysFront(SpriteBatch b); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /StardewValley/IKeyboardSubscriber.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Input; 2 | 3 | namespace StardewValley 4 | { 5 | public interface IKeyboardSubscriber 6 | { 7 | bool Selected 8 | { 9 | get; 10 | set; 11 | } 12 | 13 | void RecieveTextInput(char inputChar); 14 | 15 | void RecieveTextInput(string text); 16 | 17 | void RecieveCommandInput(char command); 18 | 19 | void RecieveSpecialInput(Keys key); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /StardewValley/ISalable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace StardewValley 5 | { 6 | public interface ISalable 7 | { 8 | string DisplayName 9 | { 10 | get; 11 | } 12 | 13 | string Name 14 | { 15 | get; 16 | } 17 | 18 | int Stack 19 | { 20 | get; 21 | set; 22 | } 23 | 24 | bool ShouldDrawIcon(); 25 | 26 | void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow); 27 | 28 | string getDescription(); 29 | 30 | int maximumStackSize(); 31 | 32 | int addToStack(Item stack); 33 | 34 | int salePrice(); 35 | 36 | bool actionWhenPurchased(); 37 | 38 | bool canStackWith(ISalable other); 39 | 40 | bool CanBuyItem(Farmer farmer); 41 | 42 | bool IsInfiniteStock(); 43 | 44 | ISalable GetSalableInstance(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /StardewValley/ISittable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley 5 | { 6 | public interface ISittable 7 | { 8 | bool IsSittingHere(Farmer who); 9 | 10 | bool HasSittingFarmers(); 11 | 12 | void RemoveSittingFarmer(Farmer farmer); 13 | 14 | int GetSittingFarmerCount(); 15 | 16 | List GetSeatPositions(bool ignore_offsets = false); 17 | 18 | Vector2? GetSittingPosition(Farmer who, bool ignore_offsets = false); 19 | 20 | Vector2? AddSittingFarmer(Farmer who); 21 | 22 | int GetSittingDirection(); 23 | 24 | Rectangle GetSeatBounds(); 25 | 26 | bool IsSeatHere(GameLocation location); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /StardewValley/ISoundBank.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | public interface ISoundBank : IDisposable 7 | { 8 | bool IsInUse 9 | { 10 | get; 11 | } 12 | 13 | bool IsDisposed 14 | { 15 | get; 16 | } 17 | 18 | ICue GetCue(string name); 19 | 20 | void PlayCue(string name); 21 | 22 | void PlayCue(string name, AudioListener listener, AudioEmitter emitter); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /StardewValley/InstanceStatics.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley 4 | { 5 | [AttributeUsage(AttributeTargets.Class)] 6 | public class InstanceStatics : Attribute 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley/InstancedStatic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley 4 | { 5 | [AttributeUsage(AttributeTargets.Field)] 6 | public class InstancedStatic : Attribute 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley/JKScoreObjective.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley 4 | { 5 | public class JKScoreObjective : OrderObjective 6 | { 7 | protected override void _Register() 8 | { 9 | base._Register(); 10 | SpecialOrder order = _order; 11 | order.onJKScoreAchieved = (Action)Delegate.Combine(order.onJKScoreAchieved, new Action(OnNewValue)); 12 | } 13 | 14 | protected override void _Unregister() 15 | { 16 | base._Unregister(); 17 | SpecialOrder order = _order; 18 | order.onJKScoreAchieved = (Action)Delegate.Remove(order.onJKScoreAchieved, new Action(OnNewValue)); 19 | } 20 | 21 | public virtual void OnNewValue(Farmer who, int new_value) 22 | { 23 | SetCount(Math.Min(Math.Max(new_value, currentCount.Value), GetMaxCount())); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /StardewValley/JadeEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class JadeEnchantment : BaseWeaponEnchantment 6 | { 7 | protected override void _ApplyTo(Item item) 8 | { 9 | base._ApplyTo(item); 10 | MeleeWeapon weapon = item as MeleeWeapon; 11 | if (weapon != null) 12 | { 13 | weapon.critMultiplier.Value += 0.1f * (float)GetLevel(); 14 | } 15 | } 16 | 17 | protected override void _UnapplyTo(Item item) 18 | { 19 | base._UnapplyTo(item); 20 | MeleeWeapon weapon = item as MeleeWeapon; 21 | if (weapon != null) 22 | { 23 | weapon.critMultiplier.Value -= 0.1f * (float)GetLevel(); 24 | } 25 | } 26 | 27 | public override bool ShouldBeDisplayed() 28 | { 29 | return false; 30 | } 31 | 32 | public override bool IsForge() 33 | { 34 | return true; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StardewValley/KeyEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Input; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | public class KeyEventArgs : EventArgs 7 | { 8 | private Keys keyCode; 9 | 10 | public Keys KeyCode => keyCode; 11 | 12 | public KeyEventArgs(Keys keyCode) 13 | { 14 | this.keyCode = keyCode; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /StardewValley/KeyEventHandler.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public delegate void KeyEventHandler(object sender, KeyEventArgs e); 4 | } 5 | -------------------------------------------------------------------------------- /StardewValley/KeyboardLayout.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using System.Text; 3 | 4 | namespace StardewValley 5 | { 6 | public class KeyboardLayout 7 | { 8 | private const uint KLF_ACTIVATE = 1u; 9 | 10 | private const int KL_NAMELENGTH = 9; 11 | 12 | private const string LANG_EN_US = "00000409"; 13 | 14 | private const string LANG_HE_IL = "0001101A"; 15 | 16 | [DllImport("user32.dll")] 17 | private static extern long LoadKeyboardLayout(string pwszKLID, uint Flags); 18 | 19 | [DllImport("user32.dll")] 20 | private static extern long GetKeyboardLayoutName(StringBuilder pwszKLID); 21 | 22 | public static string getName() 23 | { 24 | StringBuilder stringBuilder = new StringBuilder(9); 25 | GetKeyboardLayoutName(stringBuilder); 26 | return stringBuilder.ToString(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /StardewValley/ListPool.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace StardewValley 4 | { 5 | public class ListPool 6 | { 7 | private readonly Stack> _in; 8 | 9 | public ListPool() 10 | { 11 | _in = new Stack>(); 12 | _in.Push(new List()); 13 | } 14 | 15 | public List Get() 16 | { 17 | if (_in.Count == 0) 18 | { 19 | _in.Push(new List()); 20 | } 21 | return _in.Pop(); 22 | } 23 | 24 | public void Return(List list) 25 | { 26 | list.Clear(); 27 | _in.Push(list); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /StardewValley/LocationRequest.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class LocationRequest 4 | { 5 | public delegate void Callback(); 6 | 7 | public string Name; 8 | 9 | public bool IsStructure; 10 | 11 | public GameLocation Location; 12 | 13 | public event Callback OnLoad; 14 | 15 | public event Callback OnWarp; 16 | 17 | public LocationRequest(string name, bool isStructure, GameLocation location) 18 | { 19 | Name = name; 20 | IsStructure = isStructure; 21 | Location = location; 22 | } 23 | 24 | public void Loaded(GameLocation location) 25 | { 26 | if (this.OnLoad != null) 27 | { 28 | this.OnLoad(); 29 | } 30 | } 31 | 32 | public void Warped(GameLocation location) 33 | { 34 | if (this.OnWarp != null) 35 | { 36 | this.OnWarp(); 37 | } 38 | Game1.player.ridingMineElevator = false; 39 | Game1.forceSnapOnNextViewportUpdate = true; 40 | } 41 | 42 | public bool IsRequestFor(GameLocation location) 43 | { 44 | if (!IsStructure && location.Name == Name) 45 | { 46 | return true; 47 | } 48 | if (location.uniqueName.Value == Name) 49 | { 50 | return location.isStructure; 51 | } 52 | return false; 53 | } 54 | 55 | public bool IsRequestFor(string name, bool isStructure) 56 | { 57 | if (!IsStructure) 58 | { 59 | return name == Name; 60 | } 61 | return name == Name && isStructure; 62 | } 63 | 64 | public override string ToString() 65 | { 66 | return "LocationRequest(" + Name + ", " + IsStructure.ToString() + ")"; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /StardewValley/LocationWeather.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | 3 | public class LocationWeather : INetObject 4 | { 5 | public readonly NetInt weatherForTomorrow = new NetInt(); 6 | 7 | public readonly NetBool isRaining = new NetBool(); 8 | 9 | public readonly NetBool isSnowing = new NetBool(); 10 | 11 | public readonly NetBool isLightning = new NetBool(); 12 | 13 | public readonly NetBool bloomDay = new NetBool(); 14 | 15 | public readonly NetBool isDebrisWeather = new NetBool(); 16 | 17 | public NetFields NetFields 18 | { 19 | get; 20 | } = new NetFields(); 21 | 22 | 23 | public LocationWeather() 24 | { 25 | NetFields.AddFields(isRaining, isSnowing, isLightning, bloomDay, isDebrisWeather, weatherForTomorrow); 26 | } 27 | 28 | public void InitializeDayWeather() 29 | { 30 | isRaining.Value = false; 31 | isSnowing.Value = false; 32 | isLightning.Value = false; 33 | bloomDay.Value = false; 34 | isDebrisWeather.Value = false; 35 | } 36 | 37 | public void CopyFrom(LocationWeather other) 38 | { 39 | isRaining.Value = other.isRaining.Value; 40 | isSnowing.Value = other.isSnowing.Value; 41 | isLightning.Value = other.isLightning.Value; 42 | bloomDay.Value = other.bloomDay.Value; 43 | isDebrisWeather.Value = other.isDebrisWeather.Value; 44 | weatherForTomorrow.Value = other.weatherForTomorrow.Value; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /StardewValley/Locations/Club.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using StardewValley.BellsAndWhistles; 4 | 5 | namespace StardewValley.Locations 6 | { 7 | public class Club : GameLocation 8 | { 9 | public static int timesPlayedCalicoJack; 10 | 11 | public static int timesPlayedSlots; 12 | 13 | private string coinBuffer; 14 | 15 | public Club() 16 | { 17 | } 18 | 19 | public Club(string mapPath, string name) 20 | : base(mapPath, name) 21 | { 22 | } 23 | 24 | protected override void resetLocalState() 25 | { 26 | base.resetLocalState(); 27 | lightGlows.Clear(); 28 | coinBuffer = ((LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru) ? " " : ((LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh) ? "\u3000\u3000" : " ")); 29 | } 30 | 31 | public override void checkForMusic(GameTime time) 32 | { 33 | if (Game1.random.NextDouble() < 0.002) 34 | { 35 | localSound("boop"); 36 | } 37 | } 38 | 39 | public override void cleanupBeforePlayerExit() 40 | { 41 | Game1.changeMusicTrack("none"); 42 | base.cleanupBeforePlayerExit(); 43 | } 44 | 45 | public override void drawAboveAlwaysFrontLayer(SpriteBatch b) 46 | { 47 | base.drawAboveAlwaysFrontLayer(b); 48 | SpriteText.drawStringWithScrollBackground(b, coinBuffer + Game1.player.clubCoins, 64, 16); 49 | Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(68f, 20f), new Rectangle(211, 373, 9, 10), Color.White, 0f, Vector2.Zero, 4f, flipped: false, 1f); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /StardewValley/Locations/Mine.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Locations 2 | { 3 | public class Mine : GameLocation 4 | { 5 | public Mine() 6 | { 7 | } 8 | 9 | public Mine(string map, string name) 10 | : base(map, name) 11 | { 12 | } 13 | 14 | public override void DayUpdate(int dayOfMonth) 15 | { 16 | base.DayUpdate(dayOfMonth); 17 | MineShaft.mushroomLevelsGeneratedToday.Clear(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/Locations/MineInfo.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Locations 2 | { 3 | public class MineInfo 4 | { 5 | public int platformContainersLeft; 6 | 7 | public int chestsLeft = 1; 8 | 9 | public int coalCartsLeft = 1; 10 | 11 | public int elevator; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /StardewValley/MagicEnchantment.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using StardewValley.Projectiles; 3 | using StardewValley.Tools; 4 | using System; 5 | 6 | namespace StardewValley 7 | { 8 | public class MagicEnchantment : BaseWeaponEnchantment 9 | { 10 | protected override void _OnSwing(MeleeWeapon weapon, Farmer farmer) 11 | { 12 | base._OnSwing(weapon, farmer); 13 | Vector2 shot_velocity = default(Vector2); 14 | Vector2 shot_origin = farmer.getStandingPosition() - new Vector2(32f, 32f); 15 | float rotation_velocity2 = 0f; 16 | switch (farmer.facingDirection.Value) 17 | { 18 | case 0: 19 | shot_velocity.Y = -1f; 20 | break; 21 | case 1: 22 | shot_velocity.X = 1f; 23 | break; 24 | case 3: 25 | shot_velocity.X = -1f; 26 | break; 27 | case 2: 28 | shot_velocity.Y = 1f; 29 | break; 30 | } 31 | rotation_velocity2 = 32f; 32 | shot_velocity *= 10f; 33 | BasicProjectile projectile = new BasicProjectile((int)Math.Ceiling((float)weapon.minDamage.Value / 4f), 11, 0, 1, rotation_velocity2 * ((float)Math.PI / 180f), shot_velocity.X, shot_velocity.Y, shot_origin, "", "", explode: false, damagesMonsters: true, farmer.currentLocation, farmer); 34 | projectile.ignoreTravelGracePeriod.Value = true; 35 | projectile.ignoreMeleeAttacks.Value = true; 36 | projectile.maxTravelDistance.Value = 256; 37 | projectile.height.Value = 32f; 38 | farmer.currentLocation.projectiles.Add(projectile); 39 | } 40 | 41 | public override string GetName() 42 | { 43 | return "Starburst"; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /StardewValley/MailActivity.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class MailActivity : FarmActivity 4 | { 5 | public override bool AttemptActivity(Farm farm) 6 | { 7 | if (_character.getSpouse() != null) 8 | { 9 | activityPosition = Utility.PointToVector2(_character.getSpouse().getMailboxPosition()); 10 | } 11 | else 12 | { 13 | activityPosition = Utility.PointToVector2(Game1.MasterPlayer.getMailboxPosition()); 14 | } 15 | activityPosition.Y += 1f; 16 | activityDirection = 0; 17 | return true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/MasterEnchantment.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class MasterEnchantment : FishingRodEnchantment 4 | { 5 | public override string GetName() 6 | { 7 | return "Master"; 8 | } 9 | 10 | protected override void _ApplyTo(Item item) 11 | { 12 | base._ApplyTo(item); 13 | } 14 | 15 | protected override void _UnapplyTo(Item item) 16 | { 17 | base._UnapplyTo(item); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/Menus/AddNewItemMenu.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace StardewValley.Menus 5 | { 6 | public class AddNewItemMenu : IClickableMenu 7 | { 8 | private InventoryMenu playerInventory; 9 | 10 | private ClickableComponent garbage; 11 | 12 | public AddNewItemMenu() 13 | : base(Game1.uiViewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.uiViewport.Height / 2 - (300 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 300 + IClickableMenu.borderWidth * 2) 14 | { 15 | playerInventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder, playerInventory: true); 16 | garbage = new ClickableComponent(new Rectangle(xPositionOnScreen + width + IClickableMenu.spaceToClearSideBorder, yPositionOnScreen + height - 64, 64, 64), "Garbage"); 17 | } 18 | 19 | public override void receiveLeftClick(int x, int y, bool playSound = true) 20 | { 21 | } 22 | 23 | public override void receiveRightClick(int x, int y, bool playSound = true) 24 | { 25 | } 26 | 27 | public override void performHoverAction(int x, int y) 28 | { 29 | } 30 | 31 | public override void draw(SpriteBatch b) 32 | { 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /StardewValley/Menus/BundleIngredientDescription.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Menus 2 | { 3 | public struct BundleIngredientDescription 4 | { 5 | public int index; 6 | 7 | public int stack; 8 | 9 | public int quality; 10 | 11 | public bool completed; 12 | 13 | public BundleIngredientDescription(int index, int stack, int quality, bool completed) 14 | { 15 | this.completed = completed; 16 | this.index = index; 17 | this.stack = stack; 18 | this.quality = quality; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /StardewValley/Menus/ChatSnippet.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Menus 2 | { 3 | public class ChatSnippet 4 | { 5 | public string message; 6 | 7 | public int emojiIndex = -1; 8 | 9 | public float myLength; 10 | 11 | public ChatSnippet(string message, LocalizedContentManager.LanguageCode language) 12 | { 13 | this.message = message; 14 | myLength = ChatBox.messageFont(language).MeasureString(message).X; 15 | } 16 | 17 | public ChatSnippet(int emojiIndex) 18 | { 19 | this.emojiIndex = emojiIndex; 20 | myLength = 40f; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /StardewValley/Menus/ClickableAnimatedComponent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System; 4 | 5 | namespace StardewValley.Menus 6 | { 7 | public class ClickableAnimatedComponent : ClickableComponent 8 | { 9 | public TemporaryAnimatedSprite sprite; 10 | 11 | public Rectangle sourceRect; 12 | 13 | public float baseScale; 14 | 15 | public string hoverText = ""; 16 | 17 | private bool drawLabel; 18 | 19 | public ClickableAnimatedComponent(Rectangle bounds, string name, string hoverText, TemporaryAnimatedSprite sprite, bool drawLabel) 20 | : base(bounds, name) 21 | { 22 | this.sprite = sprite; 23 | this.sprite.position = new Vector2(bounds.X, bounds.Y); 24 | baseScale = sprite.scale; 25 | this.hoverText = hoverText; 26 | this.drawLabel = drawLabel; 27 | } 28 | 29 | public ClickableAnimatedComponent(Rectangle bounds, string name, string hoverText, TemporaryAnimatedSprite sprite) 30 | : this(bounds, name, hoverText, sprite, drawLabel: true) 31 | { 32 | } 33 | 34 | public void update(GameTime time) 35 | { 36 | sprite.update(time); 37 | } 38 | 39 | public string tryHover(int x, int y) 40 | { 41 | if (bounds.Contains(x, y)) 42 | { 43 | sprite.scale = Math.Min(sprite.scale + 0.02f, baseScale + 0.1f); 44 | return hoverText; 45 | } 46 | sprite.scale = Math.Max(sprite.scale - 0.02f, baseScale); 47 | return null; 48 | } 49 | 50 | public void draw(SpriteBatch b) 51 | { 52 | sprite.draw(b, localPosition: true); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /StardewValley/Menus/FarmerBoxButton.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace StardewValley.Menus 4 | { 5 | internal class FarmerBoxButton : ClickableComponent 6 | { 7 | public bool Selected; 8 | 9 | public FarmerBoxButton(string name) 10 | : base(Rectangle.Empty, name) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /StardewValley/Menus/ICreditsBlock.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | 3 | namespace StardewValley.Menus 4 | { 5 | public abstract class ICreditsBlock 6 | { 7 | public virtual void draw(int topLeftX, int topLeftY, int widthToOccupy, SpriteBatch b) 8 | { 9 | } 10 | 11 | public virtual int getHeight(int maxWidth) 12 | { 13 | return 0; 14 | } 15 | 16 | public virtual void hovered() 17 | { 18 | } 19 | 20 | public virtual void clicked() 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /StardewValley/Menus/ImageCreditsBlock.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace StardewValley.Menus 5 | { 6 | internal class ImageCreditsBlock : ICreditsBlock 7 | { 8 | private ClickableTextureComponent clickableComponent; 9 | 10 | private int animationFrames; 11 | 12 | public ImageCreditsBlock(Texture2D texture, Rectangle sourceRect, int pixelZoom, int animationFrames) 13 | { 14 | this.animationFrames = animationFrames; 15 | clickableComponent = new ClickableTextureComponent(new Rectangle(0, 0, sourceRect.Width * pixelZoom, sourceRect.Height * pixelZoom), texture, sourceRect, pixelZoom); 16 | } 17 | 18 | public override void draw(int topLeftX, int topLeftY, int widthToOccupy, SpriteBatch b) 19 | { 20 | b.Draw(clickableComponent.texture, new Rectangle(topLeftX + widthToOccupy / 2 - clickableComponent.bounds.Width / 2, topLeftY, clickableComponent.bounds.Width, clickableComponent.bounds.Height), new Rectangle(clickableComponent.sourceRect.X + clickableComponent.sourceRect.Width * (int)(Game1.currentGameTime.TotalGameTime.TotalMilliseconds % 600.0 / (double)(600 / animationFrames)), clickableComponent.sourceRect.Y, clickableComponent.sourceRect.Width, clickableComponent.sourceRect.Height), Color.White); 21 | } 22 | 23 | public override int getHeight(int maxWidth) 24 | { 25 | return clickableComponent.bounds.Height; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /StardewValley/Menus/InviteCodeDialog.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace StardewValley.Menus 4 | { 5 | public class InviteCodeDialog : ConfirmationDialog 6 | { 7 | private string code; 8 | 9 | public InviteCodeDialog(string code, behavior onClose) 10 | : base(Game1.content.LoadString("Strings\\UI:Server_InviteCode", code), onClose, onClose) 11 | { 12 | this.code = code; 13 | if (!DesktopClipboard.IsAvailable) 14 | { 15 | cancelButton.visible = false; 16 | } 17 | else 18 | { 19 | onCancel = copyCode; 20 | cancelButton = new ClickableTextureComponent("OK", new Rectangle(xPositionOnScreen + width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 64, yPositionOnScreen + height - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder + 21, 64, 64), null, null, Game1.mouseCursors, new Rectangle(274, 284, 16, 16), 4f) 21 | { 22 | myID = 102, 23 | leftNeighborID = 101 24 | }; 25 | } 26 | if (Game1.options.SnappyMenus) 27 | { 28 | populateClickableComponentList(); 29 | currentlySnappedComponent = getComponentWithID(101); 30 | snapCursorToCurrentSnappedComponent(); 31 | } 32 | } 33 | 34 | protected void copyCode(Farmer who) 35 | { 36 | if (DesktopClipboard.SetText(code)) 37 | { 38 | Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\UI:Server_InviteCode_Copied"))); 39 | } 40 | else 41 | { 42 | Game1.showRedMessageUsingLoadString("Strings\\UI:Server_InviteCode_CopyFailed"); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /StardewValley/Menus/LinkCreditsBlock.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | using StardewValley.BellsAndWhistles; 3 | using System; 4 | using System.Diagnostics; 5 | 6 | namespace StardewValley.Menus 7 | { 8 | internal class LinkCreditsBlock : ICreditsBlock 9 | { 10 | private string text; 11 | 12 | private string url; 13 | 14 | private bool currentlyHovered; 15 | 16 | public LinkCreditsBlock(string text, string url) 17 | { 18 | this.text = text; 19 | this.url = url; 20 | } 21 | 22 | public override void draw(int topLeftX, int topLeftY, int widthToOccupy, SpriteBatch b) 23 | { 24 | SpriteText.drawString(b, text, topLeftX, topLeftY, 999999, widthToOccupy, 99999, 1f, 0.88f, junimoText: false, -1, "", currentlyHovered ? 6 : 7); 25 | currentlyHovered = false; 26 | } 27 | 28 | public override int getHeight(int maxWidth) 29 | { 30 | if (!(text == "")) 31 | { 32 | return SpriteText.getHeightOfString(text, maxWidth); 33 | } 34 | return 64; 35 | } 36 | 37 | public override void hovered() 38 | { 39 | currentlyHovered = true; 40 | } 41 | 42 | public override void clicked() 43 | { 44 | Game1.playSound("bigSelect"); 45 | try 46 | { 47 | Process.Start(url); 48 | } 49 | catch (Exception) 50 | { 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /StardewValley/Menus/MiniatureTerrainFeature.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using StardewValley.TerrainFeatures; 4 | 5 | namespace StardewValley.Menus 6 | { 7 | public class MiniatureTerrainFeature 8 | { 9 | private TerrainFeature feature; 10 | 11 | private Vector2 positionOnScreen; 12 | 13 | private Vector2 tileLocation; 14 | 15 | private float scale; 16 | 17 | public MiniatureTerrainFeature(TerrainFeature feature, Vector2 positionOnScreen, Vector2 tileLocation, float scale) 18 | { 19 | this.feature = feature; 20 | this.positionOnScreen = positionOnScreen; 21 | this.scale = scale; 22 | this.tileLocation = tileLocation; 23 | } 24 | 25 | public void draw(SpriteBatch b) 26 | { 27 | feature.drawInMenu(b, positionOnScreen, tileLocation, scale, 0.86f); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /StardewValley/Menus/OptionsButton.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System; 4 | 5 | namespace StardewValley.Menus 6 | { 7 | public class OptionsButton : OptionsElement 8 | { 9 | private Action action; 10 | 11 | public OptionsButton(string label, Action action) 12 | : base(label) 13 | { 14 | this.action = action; 15 | int width = (int)Game1.dialogueFont.MeasureString(label).X + 64; 16 | int height = 68; 17 | bounds = new Rectangle(32, 0, width, height); 18 | } 19 | 20 | public override void receiveLeftClick(int x, int y) 21 | { 22 | if (!greyedOut && bounds.Contains(x, y) && action != null) 23 | { 24 | action(); 25 | } 26 | base.receiveLeftClick(x, y); 27 | } 28 | 29 | public override void draw(SpriteBatch b, int slotX, int slotY, IClickableMenu context = null) 30 | { 31 | float draw_layer = 0.8f - (float)(slotY + bounds.Y) * 1E-06f; 32 | IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(432, 439, 9, 9), slotX + bounds.X, slotY + bounds.Y, bounds.Width, bounds.Height, Color.White * (greyedOut ? 0.33f : 1f), 4f, drawShadow: true, draw_layer); 33 | Vector2 string_center = Game1.dialogueFont.MeasureString(label) / 2f; 34 | string_center.X = (int)(string_center.X / 4f) * 4; 35 | string_center.Y = (int)(string_center.Y / 4f) * 4; 36 | Utility.drawTextWithShadow(b, label, Game1.dialogueFont, new Vector2(slotX + bounds.Center.X, slotY + bounds.Center.Y) - string_center, Game1.textColor * (greyedOut ? 0.33f : 1f), 1f, draw_layer + 1E-06f, -1, -1, 0f); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /StardewValley/Menus/OptionsCheckbox.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace StardewValley.Menus 5 | { 6 | public class OptionsCheckbox : OptionsElement 7 | { 8 | public const int pixelsWide = 9; 9 | 10 | public static OptionsCheckbox selected; 11 | 12 | public bool isChecked; 13 | 14 | public static Rectangle sourceRectUnchecked = new Rectangle(227, 425, 9, 9); 15 | 16 | public static Rectangle sourceRectChecked = new Rectangle(236, 425, 9, 9); 17 | 18 | public OptionsCheckbox(string label, int whichOption, int x = -1, int y = -1) 19 | : base(label, x, y, 36, 36, whichOption) 20 | { 21 | Game1.options.setCheckBoxToProperValue(this); 22 | } 23 | 24 | public override void receiveLeftClick(int x, int y) 25 | { 26 | if (!greyedOut) 27 | { 28 | Game1.playSound("drumkit6"); 29 | selected = this; 30 | base.receiveLeftClick(x, y); 31 | isChecked = !isChecked; 32 | Game1.options.changeCheckBoxOption(whichOption, isChecked); 33 | selected = null; 34 | } 35 | } 36 | 37 | public override void draw(SpriteBatch b, int slotX, int slotY, IClickableMenu context = null) 38 | { 39 | b.Draw(Game1.mouseCursors, new Vector2(slotX + bounds.X, slotY + bounds.Y), isChecked ? sourceRectChecked : sourceRectUnchecked, Color.White * (greyedOut ? 0.33f : 1f), 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.4f); 40 | base.draw(b, slotX, slotY, context); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /StardewValley/Menus/OptionsTextEntry.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace StardewValley.Menus 5 | { 6 | public class OptionsTextEntry : OptionsElement 7 | { 8 | public const int pixelsHigh = 11; 9 | 10 | public TextBox textBox; 11 | 12 | public OptionsTextEntry(string label, int whichOption, int x = -1, int y = -1) 13 | : base(label, x, y, (int)Game1.smallFont.MeasureString("Windowed Borderless Mode ").X + 48, 44, whichOption) 14 | { 15 | textBox = new TextBox(Game1.content.Load("LooseSprites\\textBox"), null, Game1.smallFont, Color.Black); 16 | textBox.Width = bounds.Width; 17 | } 18 | 19 | public override void draw(SpriteBatch b, int slotX, int slotY, IClickableMenu context = null) 20 | { 21 | textBox.X = slotX + bounds.Left - 8; 22 | textBox.Y = slotY + bounds.Top; 23 | textBox.Draw(b); 24 | base.draw(b, slotX, slotY, context); 25 | } 26 | 27 | public override void receiveLeftClick(int x, int y) 28 | { 29 | textBox.SelectMe(); 30 | textBox.Update(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /StardewValley/Menus/ProfileItem.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace StardewValley.Menus 5 | { 6 | public class ProfileItem 7 | { 8 | protected ProfileMenu _context; 9 | 10 | public string itemName = ""; 11 | 12 | protected Vector2 _nameDrawPosition; 13 | 14 | public ProfileItem(ProfileMenu context, string name) 15 | { 16 | _context = context; 17 | itemName = name; 18 | } 19 | 20 | public virtual void Unload() 21 | { 22 | } 23 | 24 | public virtual string GetName() 25 | { 26 | return itemName; 27 | } 28 | 29 | public virtual void performHover(int x, int y) 30 | { 31 | } 32 | 33 | public virtual float HandleLayout(float draw_y, Rectangle content_rectangle, int index) 34 | { 35 | if (index > 0) 36 | { 37 | draw_y += Game1.smallFont.MeasureString(GetName()).Y; 38 | } 39 | _nameDrawPosition = new Vector2(content_rectangle.Left, draw_y); 40 | draw_y += Game1.smallFont.MeasureString(GetName()).Y; 41 | return draw_y; 42 | } 43 | 44 | public virtual void DrawItemName(SpriteBatch b) 45 | { 46 | b.DrawString(Game1.smallFont, GetName(), _nameDrawPosition, Game1.textColor); 47 | } 48 | 49 | public virtual void Draw(SpriteBatch b) 50 | { 51 | DrawItemName(b); 52 | DrawItem(b); 53 | } 54 | 55 | public virtual void DrawItem(SpriteBatch b) 56 | { 57 | } 58 | 59 | public virtual bool ShouldDraw() 60 | { 61 | return true; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /StardewValley/Menus/ServerConnectionDialog.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace StardewValley.Menus 4 | { 5 | public class ServerConnectionDialog : ConfirmationDialog 6 | { 7 | public ServerConnectionDialog(behavior onConfirm = null, behavior onCancel = null) 8 | : base(Game1.content.LoadString("Strings\\UI:CoopMenu_Connecting"), onConfirm, onCancel) 9 | { 10 | okButton.visible = false; 11 | if (Game1.options.SnappyMenus) 12 | { 13 | populateClickableComponentList(); 14 | snapToDefaultClickableComponent(); 15 | } 16 | } 17 | 18 | public override void update(GameTime time) 19 | { 20 | base.update(time); 21 | if (Game1.server != null && Game1.server.connected()) 22 | { 23 | confirm(); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /StardewValley/Menus/SkipForClickableAggregation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley.Menus 4 | { 5 | [AttributeUsage(AttributeTargets.Field)] 6 | public class SkipForClickableAggregation : Attribute 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley/Menus/SliderBar.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System; 4 | 5 | namespace StardewValley.Menus 6 | { 7 | public class SliderBar 8 | { 9 | public static int defaultWidth = 128; 10 | 11 | public const int defaultHeight = 20; 12 | 13 | public int value; 14 | 15 | public Rectangle bounds; 16 | 17 | public SliderBar(int x, int y, int initialValue) 18 | { 19 | bounds = new Rectangle(x, y, defaultWidth, 20); 20 | value = initialValue; 21 | } 22 | 23 | public int click(int x, int y) 24 | { 25 | if (bounds.Contains(x, y)) 26 | { 27 | x -= bounds.X; 28 | value = (int)((float)x / (float)bounds.Width * 100f); 29 | } 30 | return value; 31 | } 32 | 33 | public void changeValueBy(int amount) 34 | { 35 | value += amount; 36 | value = Math.Max(0, Math.Min(100, value)); 37 | } 38 | 39 | public void release(int x, int y) 40 | { 41 | } 42 | 43 | public void draw(SpriteBatch b) 44 | { 45 | b.Draw(Game1.staminaRect, new Rectangle(bounds.X, bounds.Center.Y - 2, bounds.Width, 4), Color.DarkGray); 46 | b.Draw(Game1.mouseCursors, new Vector2(bounds.X + (int)((float)value / 100f * (float)bounds.Width) + 4, bounds.Center.Y), new Rectangle(64, 256, 32, 32), Color.White, 0f, new Vector2(16f, 9f), 1f, SpriteEffects.None, 0.86f); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /StardewValley/Menus/TextBoxEvent.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Menus 2 | { 3 | public delegate void TextBoxEvent(TextBox sender); 4 | } 5 | -------------------------------------------------------------------------------- /StardewValley/MilkPailEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class MilkPailEnchantment : BaseEnchantment 6 | { 7 | public override bool CanApplyTo(Item item) 8 | { 9 | if (item is MilkPail) 10 | { 11 | return true; 12 | } 13 | return false; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/Minigames/IMinigame.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using Microsoft.Xna.Framework.Input; 4 | 5 | namespace StardewValley.Minigames 6 | { 7 | public interface IMinigame 8 | { 9 | bool tick(GameTime time); 10 | 11 | bool overrideFreeMouseMovement(); 12 | 13 | bool doMainGameUpdates(); 14 | 15 | void receiveLeftClick(int x, int y, bool playSound = true); 16 | 17 | void leftClickHeld(int x, int y); 18 | 19 | void receiveRightClick(int x, int y, bool playSound = true); 20 | 21 | void releaseLeftClick(int x, int y); 22 | 23 | void releaseRightClick(int x, int y); 24 | 25 | void receiveKeyPress(Keys k); 26 | 27 | void receiveKeyRelease(Keys k); 28 | 29 | void draw(SpriteBatch b); 30 | 31 | void changeScreenSize(); 32 | 33 | void unload(); 34 | 35 | void receiveEventPoke(int data); 36 | 37 | string minigameId(); 38 | 39 | bool forceQuit(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /StardewValley/Minigames/NetLeaderboardsEntry.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | 3 | namespace StardewValley.Minigames 4 | { 5 | public class NetLeaderboardsEntry : INetObject 6 | { 7 | public readonly NetString name = new NetString(""); 8 | 9 | public readonly NetInt score = new NetInt(0); 10 | 11 | public NetFields NetFields 12 | { 13 | get; 14 | } = new NetFields(); 15 | 16 | 17 | public void InitNetFields() 18 | { 19 | NetFields.AddFields(name, score); 20 | } 21 | 22 | public NetLeaderboardsEntry() 23 | { 24 | InitNetFields(); 25 | } 26 | 27 | public NetLeaderboardsEntry(string new_name, int new_score) 28 | { 29 | InitNetFields(); 30 | name.Value = new_name; 31 | score.Value = new_score; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /StardewValley/Minigames/ParallaxBG.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Minigames 2 | { 3 | internal class ParallaxBG 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /StardewValley/ModDataDictionary.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using StardewValley.Network; 3 | 4 | namespace StardewValley 5 | { 6 | public class ModDataDictionary : NetStringDictionary 7 | { 8 | public ModDataDictionary() 9 | { 10 | InterpolationWait = false; 11 | } 12 | 13 | public virtual void SetFromSerialization(ModDataDictionary source) 14 | { 15 | Clear(); 16 | if (source != null) 17 | { 18 | foreach (string key in source.Keys) 19 | { 20 | base[key] = source[key]; 21 | } 22 | } 23 | } 24 | 25 | public ModDataDictionary GetForSerialization() 26 | { 27 | if (Game1.game1 != null && Game1.game1.IsSaving && Count() == 0) 28 | { 29 | return null; 30 | } 31 | return this; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /StardewValley/ModHooks.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Input; 2 | using StardewValley.Events; 3 | using System; 4 | using xTile.Dimensions; 5 | 6 | namespace StardewValley 7 | { 8 | public class ModHooks 9 | { 10 | public virtual void OnGame1_PerformTenMinuteClockUpdate(Action action) 11 | { 12 | action(); 13 | } 14 | 15 | public virtual void OnGame1_NewDayAfterFade(Action action) 16 | { 17 | action(); 18 | } 19 | 20 | public virtual void OnGame1_ShowEndOfNightStuff(Action action) 21 | { 22 | action(); 23 | } 24 | 25 | public virtual void OnGame1_UpdateControlInput(ref KeyboardState keyboardState, ref MouseState mouseState, ref GamePadState gamePadState, Action action) 26 | { 27 | action(); 28 | } 29 | 30 | public virtual void OnGameLocation_ResetForPlayerEntry(GameLocation location, Action action) 31 | { 32 | action(); 33 | } 34 | 35 | public virtual bool OnGameLocation_CheckAction(GameLocation location, Location tileLocation, Rectangle viewport, Farmer who, Func action) 36 | { 37 | return action(); 38 | } 39 | 40 | public virtual FarmEvent OnUtility_PickFarmEvent(Func action) 41 | { 42 | return action(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /StardewValley/MoneyReward.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley 5 | { 6 | public class MoneyReward : OrderReward 7 | { 8 | public NetInt amount = new NetInt(0); 9 | 10 | public NetFloat multiplier = new NetFloat(1f); 11 | 12 | public override void InitializeNetFields() 13 | { 14 | base.InitializeNetFields(); 15 | base.NetFields.AddFields(amount, multiplier); 16 | } 17 | 18 | public virtual int GetRewardMoneyAmount() 19 | { 20 | return (int)((float)amount.Value * multiplier.Value); 21 | } 22 | 23 | public override void Load(SpecialOrder order, Dictionary data) 24 | { 25 | amount.Value = int.Parse(order.Parse(data["Amount"])); 26 | if (data.ContainsKey("Multiplier")) 27 | { 28 | multiplier.Value = float.Parse(order.Parse(data["Multiplier"])); 29 | } 30 | } 31 | 32 | public override void Grant() 33 | { 34 | base.Grant(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StardewValley/Monsters/ParryEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.IO; 3 | 4 | namespace StardewValley.Monsters 5 | { 6 | internal class ParryEventArgs : NetEventArg 7 | { 8 | public int damage; 9 | 10 | private long farmerId; 11 | 12 | public Farmer who 13 | { 14 | get 15 | { 16 | return Game1.getFarmer(farmerId); 17 | } 18 | set 19 | { 20 | farmerId = value.UniqueMultiplayerID; 21 | } 22 | } 23 | 24 | public ParryEventArgs() 25 | { 26 | } 27 | 28 | public ParryEventArgs(int damage, Farmer who) 29 | { 30 | this.damage = damage; 31 | this.who = who; 32 | } 33 | 34 | public void Read(BinaryReader reader) 35 | { 36 | damage = reader.ReadInt32(); 37 | farmerId = reader.ReadInt64(); 38 | } 39 | 40 | public void Write(BinaryWriter writer) 41 | { 42 | writer.Write(damage); 43 | writer.Write(farmerId); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /StardewValley/MovieInvitation.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using StardewValley.Network; 3 | 4 | namespace StardewValley 5 | { 6 | public class MovieInvitation : INetObject 7 | { 8 | private NetFarmerRef _farmer = new NetFarmerRef(); 9 | 10 | protected NetString _invitedNPCName = new NetString(); 11 | 12 | protected NetBool _fulfilled = new NetBool(value: false); 13 | 14 | public NetFields NetFields 15 | { 16 | get; 17 | } = new NetFields(); 18 | 19 | 20 | public Farmer farmer 21 | { 22 | get 23 | { 24 | return _farmer.Value; 25 | } 26 | set 27 | { 28 | _farmer.Value = value; 29 | } 30 | } 31 | 32 | public NPC invitedNPC 33 | { 34 | get 35 | { 36 | return Game1.getCharacterFromName(_invitedNPCName.Value); 37 | } 38 | set 39 | { 40 | if (value == null) 41 | { 42 | _invitedNPCName.Set(null); 43 | } 44 | else 45 | { 46 | _invitedNPCName.Set(value.name); 47 | } 48 | } 49 | } 50 | 51 | public bool fulfilled 52 | { 53 | get 54 | { 55 | return _fulfilled.Value; 56 | } 57 | set 58 | { 59 | _fulfilled.Set(value); 60 | } 61 | } 62 | 63 | public MovieInvitation() 64 | { 65 | NetFields.AddFields(_farmer.NetFields, _invitedNPCName, _fulfilled); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /StardewValley/MovieViewerLockEvent.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace StardewValley 6 | { 7 | public class MovieViewerLockEvent : NetEventArg 8 | { 9 | public List uids; 10 | 11 | public int movieStartTime; 12 | 13 | public MovieViewerLockEvent() 14 | { 15 | uids = new List(); 16 | movieStartTime = 0; 17 | } 18 | 19 | public MovieViewerLockEvent(List present_farmers, int movie_start_time) 20 | { 21 | movieStartTime = movie_start_time; 22 | uids = new List(); 23 | foreach (Farmer farmer in present_farmers) 24 | { 25 | uids.Add(farmer.UniqueMultiplayerID); 26 | } 27 | } 28 | 29 | public void Read(BinaryReader reader) 30 | { 31 | uids.Clear(); 32 | movieStartTime = reader.ReadInt32(); 33 | int capacity = reader.ReadInt32(); 34 | for (int i = 0; i < capacity; i++) 35 | { 36 | uids.Add(reader.ReadInt64()); 37 | } 38 | } 39 | 40 | public void Write(BinaryWriter writer) 41 | { 42 | writer.Write(movieStartTime); 43 | writer.Write(uids.Count); 44 | for (int i = 0; i < uids.Count; i++) 45 | { 46 | writer.Write(uids[i]); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /StardewValley/NPCDialogueResponse.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class NPCDialogueResponse : Response 4 | { 5 | public int friendshipChange; 6 | 7 | public int id; 8 | 9 | public NPCDialogueResponse(int id, int friendshipChange, string keyToNPCresponse, string responseText) 10 | : base(keyToNPCresponse, responseText) 11 | { 12 | this.friendshipChange = friendshipChange; 13 | this.id = id; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/NetFarmerPairDictionary.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace StardewValley 6 | { 7 | public class NetFarmerPairDictionary : NetFieldDictionary, NetFarmerPairDictionary> where TField : NetField, new() 8 | { 9 | public NetFarmerPairDictionary() 10 | { 11 | } 12 | 13 | public NetFarmerPairDictionary(IEnumerable> dict) 14 | : base(dict) 15 | { 16 | } 17 | 18 | protected override FarmerPair ReadKey(BinaryReader reader) 19 | { 20 | long f = reader.ReadInt64(); 21 | long farmer2 = reader.ReadInt64(); 22 | return FarmerPair.MakePair(f, farmer2); 23 | } 24 | 25 | protected override void WriteKey(BinaryWriter writer, FarmerPair key) 26 | { 27 | writer.Write(key.Farmer1); 28 | writer.Write(key.Farmer2); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /StardewValley/NetIntIntArrayDictionary.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.IO; 3 | using System.Linq; 4 | 5 | namespace StardewValley 6 | { 7 | public class NetIntIntArrayDictionary : NetDictionary, SerializableDictionary, NetIntIntArrayDictionary> 8 | { 9 | protected override int ReadKey(BinaryReader reader) 10 | { 11 | return reader.ReadInt32(); 12 | } 13 | 14 | protected override void WriteKey(BinaryWriter writer, int key) 15 | { 16 | writer.Write(key); 17 | } 18 | 19 | protected override void setFieldValue(NetArray field, int key, int[] value) 20 | { 21 | field.Set(value); 22 | } 23 | 24 | protected override int[] getFieldValue(NetArray field) 25 | { 26 | return field.ToArray(); 27 | } 28 | 29 | protected override int[] getFieldTargetValue(NetArray field) 30 | { 31 | return field.ToArray(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /StardewValley/NetLogRecord.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | internal struct NetLogRecord 4 | { 5 | public string Path; 6 | 7 | public int Count; 8 | 9 | public long Bytes; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /StardewValley/Network/IBandwidthMonitor.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Network 2 | { 3 | public interface IBandwidthMonitor 4 | { 5 | BandwidthLogger BandwidthLogger 6 | { 7 | get; 8 | } 9 | 10 | bool LogBandwidth 11 | { 12 | get; 13 | set; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/Network/IncomingMessage.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System; 3 | using System.IO; 4 | 5 | namespace StardewValley.Network 6 | { 7 | public class IncomingMessage : IDisposable 8 | { 9 | private byte messageType; 10 | 11 | private long farmerID; 12 | 13 | private byte[] data; 14 | 15 | private MemoryStream stream; 16 | 17 | private BinaryReader reader; 18 | 19 | public byte MessageType => messageType; 20 | 21 | public long FarmerID => farmerID; 22 | 23 | public Farmer SourceFarmer => Game1.getFarmer(farmerID); 24 | 25 | public byte[] Data => data; 26 | 27 | public BinaryReader Reader => reader; 28 | 29 | public void Read(BinaryReader reader) 30 | { 31 | Dispose(); 32 | messageType = reader.ReadByte(); 33 | farmerID = reader.ReadInt64(); 34 | data = reader.ReadSkippableBytes(); 35 | stream = new MemoryStream(data); 36 | this.reader = new BinaryReader(stream); 37 | } 38 | 39 | public void Dispose() 40 | { 41 | if (reader != null) 42 | { 43 | reader.Dispose(); 44 | } 45 | if (stream != null) 46 | { 47 | stream.Dispose(); 48 | } 49 | stream = null; 50 | reader = null; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /StardewValley/Network/NetAudioCueManager.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using Netcode; 3 | using System.Collections.Generic; 4 | 5 | namespace StardewValley.Network 6 | { 7 | public class NetAudioCueManager 8 | { 9 | private Dictionary playingCues = new Dictionary(); 10 | 11 | private List cuesToStop = new List(); 12 | 13 | public virtual void Update(GameLocation currentLocation) 14 | { 15 | NetDictionary, NetStringDictionary>.KeysCollection activeCues = currentLocation.netAudio.ActiveCues; 16 | foreach (string cue3 in activeCues) 17 | { 18 | if (!playingCues.ContainsKey(cue3)) 19 | { 20 | playingCues[cue3] = Game1.soundBank.GetCue(cue3); 21 | playingCues[cue3].Play(); 22 | } 23 | } 24 | foreach (KeyValuePair playingCue in playingCues) 25 | { 26 | string cue2 = playingCue.Key; 27 | if (!activeCues.Contains(cue2)) 28 | { 29 | cuesToStop.Add(cue2); 30 | } 31 | } 32 | foreach (string cue in cuesToStop) 33 | { 34 | playingCues[cue].Stop(AudioStopOptions.AsAuthored); 35 | playingCues.Remove(cue); 36 | } 37 | cuesToStop.Clear(); 38 | } 39 | 40 | public void StopAll() 41 | { 42 | foreach (ICue value in playingCues.Values) 43 | { 44 | value.Stop(AudioStopOptions.Immediate); 45 | } 46 | playingCues.Clear(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /StardewValley/Network/NetBuildingRef.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using StardewValley.Buildings; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | 6 | namespace StardewValley.Network 7 | { 8 | public class NetBuildingRef : INetObject, IEnumerable, IEnumerable 9 | { 10 | private readonly NetString nameOfIndoors = new NetString(); 11 | 12 | public NetFields NetFields 13 | { 14 | get; 15 | } = new NetFields(); 16 | 17 | 18 | public Building Value 19 | { 20 | get 21 | { 22 | string nameOfIndoors = this.nameOfIndoors.Get(); 23 | if (nameOfIndoors == null) 24 | { 25 | return null; 26 | } 27 | return Game1.getFarm().getBuildingByName(nameOfIndoors); 28 | } 29 | set 30 | { 31 | if (value == null) 32 | { 33 | nameOfIndoors.Value = null; 34 | } 35 | else 36 | { 37 | nameOfIndoors.Value = value.nameOfIndoors; 38 | } 39 | } 40 | } 41 | 42 | public NetBuildingRef() 43 | { 44 | NetFields.AddFields(nameOfIndoors); 45 | } 46 | 47 | public IEnumerator GetEnumerator() 48 | { 49 | yield return Value; 50 | } 51 | 52 | IEnumerator IEnumerable.GetEnumerator() 53 | { 54 | return GetEnumerator(); 55 | } 56 | 57 | public static implicit operator Building(NetBuildingRef buildingRef) 58 | { 59 | return buildingRef.Value; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /StardewValley/Network/NetBundles.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using StardewValley.Menus; 3 | using System.IO; 4 | using System.Linq; 5 | 6 | namespace StardewValley.Network 7 | { 8 | public class NetBundles : NetDictionary, SerializableDictionary, NetBundles> 9 | { 10 | protected override int ReadKey(BinaryReader reader) 11 | { 12 | int result = reader.ReadInt32(); 13 | if (Game1.activeClickableMenu is JunimoNoteMenu) 14 | { 15 | (Game1.activeClickableMenu as JunimoNoteMenu).bundlesChanged = true; 16 | } 17 | return result; 18 | } 19 | 20 | protected override void WriteKey(BinaryWriter writer, int key) 21 | { 22 | writer.Write(key); 23 | } 24 | 25 | protected override void setFieldValue(NetArray field, int key, bool[] value) 26 | { 27 | field.Set(value); 28 | } 29 | 30 | protected override bool[] getFieldValue(NetArray field) 31 | { 32 | return field.ToArray(); 33 | } 34 | 35 | protected override bool[] getFieldTargetValue(NetArray field) 36 | { 37 | return field.ToArray(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /StardewValley/Network/NetCharacterRef.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System; 3 | 4 | namespace StardewValley.Network 5 | { 6 | public class NetCharacterRef : INetObject 7 | { 8 | private readonly NetNPCRef npc = new NetNPCRef(); 9 | 10 | private readonly NetFarmerRef farmer = new NetFarmerRef(); 11 | 12 | public NetFields NetFields 13 | { 14 | get; 15 | } = new NetFields(); 16 | 17 | 18 | public NetCharacterRef() 19 | { 20 | NetFields.AddFields(npc.NetFields, farmer.NetFields); 21 | } 22 | 23 | public Character Get(GameLocation location) 24 | { 25 | NPC npcValue = npc.Get(location); 26 | if (npcValue != null) 27 | { 28 | return npcValue; 29 | } 30 | return farmer.Value; 31 | } 32 | 33 | public void Set(GameLocation location, Character character) 34 | { 35 | if (character is NPC) 36 | { 37 | npc.Set(location, character as NPC); 38 | farmer.Value = null; 39 | return; 40 | } 41 | if (character is Farmer) 42 | { 43 | npc.Clear(); 44 | farmer.Value = (character as Farmer); 45 | return; 46 | } 47 | throw new ArgumentException(); 48 | } 49 | 50 | public void Clear() 51 | { 52 | npc.Clear(); 53 | farmer.Value = null; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /StardewValley/Network/NetFarmerRoot.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | 3 | namespace StardewValley.Network 4 | { 5 | public class NetFarmerRoot : NetRoot 6 | { 7 | public NetFarmerRoot() 8 | { 9 | Serializer = SaveGame.farmerSerializer; 10 | } 11 | 12 | public NetFarmerRoot(Farmer value) 13 | : base(value) 14 | { 15 | Serializer = SaveGame.farmerSerializer; 16 | } 17 | 18 | public override NetRoot Clone() 19 | { 20 | NetRoot result = base.Clone(); 21 | if (Game1.serverHost != null && result.Value != null) 22 | { 23 | result.Value.teamRoot = Game1.serverHost.Value.teamRoot; 24 | } 25 | return result; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /StardewValley/Network/NetIntDictionary.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace StardewValley.Network 6 | { 7 | public class NetIntDictionary : NetFieldDictionary, NetIntDictionary> where TField : NetField, new() 8 | { 9 | public NetIntDictionary() 10 | { 11 | } 12 | 13 | public NetIntDictionary(IEnumerable> dict) 14 | : base(dict) 15 | { 16 | } 17 | 18 | protected override int ReadKey(BinaryReader reader) 19 | { 20 | return reader.ReadInt32(); 21 | } 22 | 23 | protected override void WriteKey(BinaryWriter writer, int key) 24 | { 25 | writer.Write(key); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /StardewValley/Network/NetLongDictionary.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace StardewValley.Network 6 | { 7 | public class NetLongDictionary : NetFieldDictionary, NetLongDictionary> where TField : NetField, new() 8 | { 9 | public NetLongDictionary() 10 | { 11 | } 12 | 13 | public NetLongDictionary(IEnumerable> dict) 14 | : base(dict) 15 | { 16 | } 17 | 18 | protected override long ReadKey(BinaryReader reader) 19 | { 20 | return reader.ReadInt64(); 21 | } 22 | 23 | protected override void WriteKey(BinaryWriter writer, long key) 24 | { 25 | writer.Write(key); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /StardewValley/Network/NetNPCRef.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System; 3 | 4 | namespace StardewValley.Network 5 | { 6 | public class NetNPCRef : INetObject 7 | { 8 | private readonly NetGuid guid = new NetGuid(); 9 | 10 | public NetFields NetFields 11 | { 12 | get; 13 | } = new NetFields(); 14 | 15 | 16 | public NetNPCRef() 17 | { 18 | NetFields.AddFields(guid); 19 | } 20 | 21 | public NPC Get(GameLocation location) 22 | { 23 | if (guid.Value == Guid.Empty || location == null) 24 | { 25 | return null; 26 | } 27 | if (!location.characters.ContainsGuid(guid.Value)) 28 | { 29 | return null; 30 | } 31 | return location.characters[guid.Value]; 32 | } 33 | 34 | public void Set(GameLocation location, NPC npc) 35 | { 36 | if (npc == null) 37 | { 38 | guid.Value = Guid.Empty; 39 | return; 40 | } 41 | Guid newGuid = location.characters.GuidOf(npc); 42 | if (newGuid == Guid.Empty) 43 | { 44 | throw new ArgumentException(); 45 | } 46 | guid.Value = newGuid; 47 | } 48 | 49 | public void Clear() 50 | { 51 | guid.Value = Guid.Empty; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /StardewValley/Network/NetPointDictionary.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Netcode; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | 6 | namespace StardewValley.Network 7 | { 8 | public class NetPointDictionary : NetFieldDictionary, NetPointDictionary> where TField : NetField, new() 9 | { 10 | public NetPointDictionary() 11 | { 12 | } 13 | 14 | public NetPointDictionary(IEnumerable> dict) 15 | : base(dict) 16 | { 17 | } 18 | 19 | protected override Point ReadKey(BinaryReader reader) 20 | { 21 | int x = reader.ReadInt32(); 22 | int y = reader.ReadInt32(); 23 | return new Point(x, y); 24 | } 25 | 26 | protected override void WriteKey(BinaryWriter writer, Point key) 27 | { 28 | writer.Write(key.X); 29 | writer.Write(key.Y); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /StardewValley/Network/NetStringDictionary.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace StardewValley.Network 6 | { 7 | public class NetStringDictionary : NetFieldDictionary, NetStringDictionary> where TField : NetField, new() 8 | { 9 | public NetStringDictionary() 10 | { 11 | } 12 | 13 | public NetStringDictionary(IEnumerable> dict) 14 | : base(dict) 15 | { 16 | } 17 | 18 | protected override string ReadKey(BinaryReader reader) 19 | { 20 | return reader.ReadString(); 21 | } 22 | 23 | protected override void WriteKey(BinaryWriter writer, string key) 24 | { 25 | writer.Write(key); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /StardewValley/Network/NetVector2Dictionary.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Netcode; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | 6 | namespace StardewValley.Network 7 | { 8 | public sealed class NetVector2Dictionary : NetFieldDictionary, NetVector2Dictionary> where TField : NetField, new() 9 | { 10 | public NetVector2Dictionary() 11 | { 12 | } 13 | 14 | public NetVector2Dictionary(IEnumerable> dict) 15 | : base(dict) 16 | { 17 | } 18 | 19 | protected override Vector2 ReadKey(BinaryReader reader) 20 | { 21 | float x = reader.ReadSingle(); 22 | float y = reader.ReadSingle(); 23 | return new Vector2(x, y); 24 | } 25 | 26 | protected override void WriteKey(BinaryWriter writer, Vector2 key) 27 | { 28 | writer.Write(key.X); 29 | writer.Write(key.Y); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /StardewValley/NonInstancedStatic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley 4 | { 5 | [AttributeUsage(AttributeTargets.Field)] 6 | public class NonInstancedStatic : Attribute 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley/NutDropRequest.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Netcode; 3 | using System.IO; 4 | 5 | namespace StardewValley 6 | { 7 | public class NutDropRequest : NetEventArg 8 | { 9 | public string key; 10 | 11 | public string locationName; 12 | 13 | public Point position; 14 | 15 | public int limit = 1; 16 | 17 | public int rewardAmount = 1; 18 | 19 | public NutDropRequest() 20 | { 21 | } 22 | 23 | public NutDropRequest(string key, string location_name, Point position, int limit, int reward_amount) 24 | { 25 | this.key = key; 26 | if (location_name == null) 27 | { 28 | locationName = "null"; 29 | } 30 | else 31 | { 32 | locationName = location_name; 33 | } 34 | this.position = position; 35 | this.limit = limit; 36 | rewardAmount = reward_amount; 37 | } 38 | 39 | public void Read(BinaryReader reader) 40 | { 41 | key = reader.ReadString(); 42 | locationName = reader.ReadString(); 43 | position.X = reader.ReadInt32(); 44 | position.Y = reader.ReadInt32(); 45 | limit = reader.ReadInt32(); 46 | rewardAmount = reader.ReadInt32(); 47 | } 48 | 49 | public void Write(BinaryWriter writer) 50 | { 51 | writer.Write(key); 52 | writer.Write(locationName); 53 | writer.Write(position.X); 54 | writer.Write(position.Y); 55 | writer.Write(limit); 56 | writer.Write(rewardAmount); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /StardewValley/Objects/ItemDescription.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Objects 2 | { 3 | public struct ItemDescription 4 | { 5 | public byte type; 6 | 7 | public int index; 8 | 9 | public int stack; 10 | 11 | public ItemDescription(byte type, int index, int stack) 12 | { 13 | this.type = type; 14 | this.index = index; 15 | this.stack = stack; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /StardewValley/Objects/ObjectFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using StardewValley.Tools; 3 | using System; 4 | 5 | namespace StardewValley.Objects 6 | { 7 | public class ObjectFactory 8 | { 9 | public const byte regularObject = 0; 10 | 11 | public const byte bigCraftable = 1; 12 | 13 | public const byte weapon = 2; 14 | 15 | public const byte specialItem = 3; 16 | 17 | public const byte regularObjectRecipe = 4; 18 | 19 | public const byte bigCraftableRecipe = 5; 20 | 21 | public static ItemDescription getDescriptionFromItem(Item i) 22 | { 23 | if (i is Object && (bool)(i as Object).bigCraftable) 24 | { 25 | return new ItemDescription(1, (i as Object).ParentSheetIndex, i.Stack); 26 | } 27 | if (i is Object) 28 | { 29 | return new ItemDescription(0, (i as Object).ParentSheetIndex, i.Stack); 30 | } 31 | if (i is MeleeWeapon) 32 | { 33 | return new ItemDescription(2, (i as MeleeWeapon).CurrentParentTileIndex, i.Stack); 34 | } 35 | throw new Exception("ItemFactory trying to create item description from unknown item"); 36 | } 37 | 38 | public static Item getItemFromDescription(byte type, int index, int stack) 39 | { 40 | switch (type) 41 | { 42 | case 0: 43 | return new Object(Vector2.Zero, index, stack); 44 | case 4: 45 | return new Object(index, stack, isRecipe: true); 46 | case 1: 47 | return new Object(Vector2.Zero, index); 48 | case 5: 49 | return new Object(Vector2.Zero, index, isRecipe: true); 50 | case 2: 51 | return new MeleeWeapon(index); 52 | default: 53 | throw new Exception("ItemFactory trying to create item from unknown description"); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /StardewValley/OneTimeRandom.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | internal class OneTimeRandom 4 | { 5 | private const double shift3 = 0.125; 6 | 7 | private const double shift9 = 0.001953125; 8 | 9 | private const double shift27 = 7.4505805969238281E-09; 10 | 11 | private const double shift53 = 1.1102230246251565E-16; 12 | 13 | public static ulong GetLong(ulong a, ulong b, ulong c, ulong d) 14 | { 15 | ulong e = ((a ^ ((b >> 14) | (b << 50))) + (((c >> 31) | (c << 33)) ^ ((d >> 18) | (d << 46)))) * 1911413418482053185L; 16 | ulong f = ((((a >> 30) | (a << 34)) ^ c) + (((b >> 32) | (b << 32)) ^ ((d >> 50) | (d << 14)))) * 1139072524405308145L; 17 | ulong g = ((((a >> 49) | (a << 15)) ^ ((d >> 33) | (d << 31))) + (b ^ ((c >> 48) | (c << 16)))) * 8792993707439626365L; 18 | ulong h = ((((a >> 17) | (a << 47)) ^ ((b >> 47) | (b << 17))) + (((c >> 15) | (c << 49)) ^ d)) * 1089642907432013597L; 19 | return (e ^ f ^ ((g >> 21) | (g << 43)) ^ ((h >> 44) | (h << 20))) * 2550117894111961111L + (((e >> 20) | (e << 44)) ^ ((f >> 41) | (f << 23)) ^ ((g >> 42) | (g << 22)) ^ h) * 8786584852613159497L + (((e >> 43) | (e << 21)) ^ ((f >> 22) | (f << 42)) ^ g ^ ((h >> 23) | (h << 41))) * 3971056679291618767L; 20 | } 21 | 22 | public static double GetDouble(ulong a, ulong b, ulong c, ulong d) 23 | { 24 | return (double)(GetLong(a, b, c, d) >> 11) * 1.1102230246251565E-16; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /StardewValley/OrderReward.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | using System.Xml.Serialization; 4 | 5 | namespace StardewValley 6 | { 7 | public class OrderReward : INetObject 8 | { 9 | [XmlIgnore] 10 | public NetFields NetFields 11 | { 12 | get; 13 | } = new NetFields(); 14 | 15 | 16 | public OrderReward() 17 | { 18 | InitializeNetFields(); 19 | } 20 | 21 | public virtual void InitializeNetFields() 22 | { 23 | } 24 | 25 | public virtual void Grant() 26 | { 27 | } 28 | 29 | public virtual void Load(SpecialOrder order, Dictionary data) 30 | { 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /StardewValley/PanEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class PanEnchantment : BaseEnchantment 6 | { 7 | public override bool CanApplyTo(Item item) 8 | { 9 | if (item is Pan) 10 | { 11 | return true; 12 | } 13 | return false; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/PathNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley 4 | { 5 | public class PathNode : IEquatable 6 | { 7 | public readonly int x; 8 | 9 | public readonly int y; 10 | 11 | public readonly int id; 12 | 13 | public byte g; 14 | 15 | public PathNode parent; 16 | 17 | public PathNode(int x, int y, PathNode parent) 18 | { 19 | this.x = x; 20 | this.y = y; 21 | this.parent = parent; 22 | id = ComputeHash(x, y); 23 | } 24 | 25 | public PathNode(int x, int y, byte g, PathNode parent) 26 | { 27 | this.x = x; 28 | this.y = y; 29 | this.g = g; 30 | this.parent = parent; 31 | id = ComputeHash(x, y); 32 | } 33 | 34 | public bool Equals(PathNode obj) 35 | { 36 | if (obj == null) 37 | { 38 | return false; 39 | } 40 | if (x == obj.x) 41 | { 42 | return y == obj.y; 43 | } 44 | return false; 45 | } 46 | 47 | public override bool Equals(object obj) 48 | { 49 | PathNode other = obj as PathNode; 50 | if (other == null) 51 | { 52 | return false; 53 | } 54 | if (x == other.x) 55 | { 56 | return y == other.y; 57 | } 58 | return false; 59 | } 60 | 61 | public override int GetHashCode() 62 | { 63 | return id; 64 | } 65 | 66 | public static int ComputeHash(int x, int y) 67 | { 68 | return 100000 * x + y; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /StardewValley/PickaxeEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class PickaxeEnchantment : BaseEnchantment 6 | { 7 | public override bool CanApplyTo(Item item) 8 | { 9 | if (item is Pickaxe) 10 | { 11 | return true; 12 | } 13 | return false; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/PowerfulEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class PowerfulEnchantment : BaseEnchantment 6 | { 7 | public override string GetName() 8 | { 9 | return "Powerful"; 10 | } 11 | 12 | public override bool CanApplyTo(Item item) 13 | { 14 | if (item is Tool) 15 | { 16 | if (!(item is Pickaxe)) 17 | { 18 | return item is Axe; 19 | } 20 | return true; 21 | } 22 | return false; 23 | } 24 | 25 | protected override void _ApplyTo(Item item) 26 | { 27 | base._ApplyTo(item); 28 | Tool tool = item as Tool; 29 | if (tool != null) 30 | { 31 | if (tool is Pickaxe) 32 | { 33 | (tool as Pickaxe).additionalPower.Value += GetLevel(); 34 | } 35 | if (tool is Axe) 36 | { 37 | (tool as Axe).additionalPower.Value += 2 * GetLevel(); 38 | } 39 | } 40 | } 41 | 42 | protected override void _UnapplyTo(Item item) 43 | { 44 | base._UnapplyTo(item); 45 | Tool tool = item as Tool; 46 | if (tool != null) 47 | { 48 | if (tool is Pickaxe) 49 | { 50 | (tool as Pickaxe).additionalPower.Value -= GetLevel(); 51 | } 52 | if (tool is Axe) 53 | { 54 | (tool as Axe).additionalPower.Value -= 2 * GetLevel(); 55 | } 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /StardewValley/PreservingEnchantment.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class PreservingEnchantment : FishingRodEnchantment 4 | { 5 | public override string GetName() 6 | { 7 | return "Preserving"; 8 | } 9 | 10 | protected override void _ApplyTo(Item item) 11 | { 12 | base._ApplyTo(item); 13 | } 14 | 15 | protected override void _UnapplyTo(Item item) 16 | { 17 | base._UnapplyTo(item); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/Prop.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace StardewValley 5 | { 6 | public class Prop 7 | { 8 | private Texture2D texture; 9 | 10 | private Rectangle sourceRect; 11 | 12 | private Rectangle drawRect; 13 | 14 | private Rectangle boundingRect; 15 | 16 | private bool solid; 17 | 18 | public Prop(Texture2D texture, int index, int tilesWideSolid, int tilesHighSolid, int tilesHighDraw, int tileX, int tileY, bool solid = true) 19 | { 20 | this.texture = texture; 21 | sourceRect = Game1.getSourceRectForStandardTileSheet(texture, index, 16, 16); 22 | sourceRect.Width = tilesWideSolid * 16; 23 | sourceRect.Height = tilesHighDraw * 16; 24 | drawRect = new Rectangle(tileX * 64, tileY * 64 + (tilesHighSolid - tilesHighDraw) * 64, tilesWideSolid * 64, tilesHighDraw * 64); 25 | boundingRect = new Rectangle(tileX * 64, tileY * 64, tilesWideSolid * 64, tilesHighSolid * 64); 26 | this.solid = solid; 27 | } 28 | 29 | public bool isColliding(Rectangle r) 30 | { 31 | if (solid) 32 | { 33 | return r.Intersects(boundingRect); 34 | } 35 | return false; 36 | } 37 | 38 | public void draw(SpriteBatch b) 39 | { 40 | drawRect.X = boundingRect.X - Game1.viewport.X; 41 | drawRect.Y = boundingRect.Y + (boundingRect.Height - drawRect.Height) - Game1.viewport.Y; 42 | b.Draw(texture, drawRect, sourceRect, Color.White, 0f, Vector2.Zero, SpriteEffects.None, solid ? ((float)boundingRect.Y / 10000f) : 0f); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /StardewValley/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Runtime.Versioning; 6 | using System.Security; 7 | using System.Security.Permissions; 8 | 9 | [assembly: CompilationRelaxations(8)] 10 | [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] 11 | [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] 12 | [assembly: AssemblyTitle("Stardew Valley")] 13 | [assembly: AssemblyProduct("Stardew Valley")] 14 | [assembly: AssemblyDescription("")] 15 | [assembly: AssemblyCompany("ConcernedApe")] 16 | [assembly: AssemblyCopyright("Copyright © ConcernedApe 2013")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: ComVisible(false)] 19 | [assembly: Guid("cf94604e-6069-4782-a33b-605954798003")] 20 | [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] 21 | [assembly: AssemblyVersion("1.3.7693.392")] 22 | [module: UnverifiableCode] 23 | -------------------------------------------------------------------------------- /StardewValley/Proposal.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using StardewValley.Network; 3 | 4 | namespace StardewValley 5 | { 6 | public class Proposal : INetObject 7 | { 8 | public readonly NetFarmerRef sender = new NetFarmerRef(); 9 | 10 | public readonly NetFarmerRef receiver = new NetFarmerRef(); 11 | 12 | public readonly NetEnum proposalType = new NetEnum(ProposalType.Gift); 13 | 14 | public readonly NetEnum response = new NetEnum(ProposalResponse.None); 15 | 16 | public readonly NetString responseMessageKey = new NetString(); 17 | 18 | public readonly NetRef gift = new NetRef(); 19 | 20 | public readonly NetBool canceled = new NetBool(); 21 | 22 | public readonly NetBool cancelConfirmed = new NetBool(); 23 | 24 | public NetFields NetFields 25 | { 26 | get; 27 | } = new NetFields(); 28 | 29 | 30 | public Proposal() 31 | { 32 | NetFields.AddFields(sender.NetFields, receiver.NetFields, proposalType, response, responseMessageKey, gift, canceled, cancelConfirmed); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /StardewValley/ProposalResponse.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public enum ProposalResponse 4 | { 5 | None, 6 | Rejected, 7 | Accepted 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley/ProposalType.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public enum ProposalType 4 | { 5 | Gift, 6 | Marriage, 7 | Dance, 8 | Baby 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /StardewValley/Quests/CraftingQuest.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using StardewValley.Objects; 3 | using System.Xml.Serialization; 4 | 5 | namespace StardewValley.Quests 6 | { 7 | public class CraftingQuest : Quest 8 | { 9 | [XmlElement("isBigCraftable")] 10 | public readonly NetBool isBigCraftable = new NetBool(); 11 | 12 | [XmlElement("indexToCraft")] 13 | public readonly NetInt indexToCraft = new NetInt(); 14 | 15 | public CraftingQuest() 16 | { 17 | } 18 | 19 | public CraftingQuest(int indexToCraft, bool bigCraftable) 20 | { 21 | this.indexToCraft.Value = indexToCraft; 22 | isBigCraftable.Value = bigCraftable; 23 | } 24 | 25 | protected override void initNetFields() 26 | { 27 | base.initNetFields(); 28 | base.NetFields.AddFields(isBigCraftable, indexToCraft); 29 | } 30 | 31 | public override bool checkIfComplete(NPC n = null, int number1 = -1, int number2 = -2, Item item = null, string str = null) 32 | { 33 | if (item is Clothing) 34 | { 35 | return false; 36 | } 37 | if (item != null && item is Object && (item as Object).bigCraftable.Value == isBigCraftable.Value && (item as Object).parentSheetIndex.Value == indexToCraft.Value) 38 | { 39 | questComplete(); 40 | return true; 41 | } 42 | return false; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /StardewValley/Quests/GoSomewhereQuest.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Xml.Serialization; 3 | 4 | namespace StardewValley.Quests 5 | { 6 | public class GoSomewhereQuest : Quest 7 | { 8 | [XmlElement("whereToGo")] 9 | public readonly NetString whereToGo = new NetString(); 10 | 11 | public GoSomewhereQuest() 12 | { 13 | } 14 | 15 | public GoSomewhereQuest(string where) 16 | { 17 | whereToGo.Value = where; 18 | } 19 | 20 | protected override void initNetFields() 21 | { 22 | base.initNetFields(); 23 | base.NetFields.AddFields(whereToGo); 24 | } 25 | 26 | public override void adjustGameLocation(GameLocation location) 27 | { 28 | checkIfComplete(null, -1, -2, null, location.name); 29 | } 30 | 31 | public override bool checkIfComplete(NPC n = null, int number1 = -1, int number2 = -2, Item item = null, string str = null) 32 | { 33 | if (str != null && str.Equals(whereToGo.Value)) 34 | { 35 | questComplete(); 36 | return true; 37 | } 38 | return false; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /StardewValley/Quests/IQuest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace StardewValley.Quests 4 | { 5 | public interface IQuest 6 | { 7 | string GetName(); 8 | 9 | string GetDescription(); 10 | 11 | List GetObjectiveDescriptions(); 12 | 13 | bool CanBeCancelled(); 14 | 15 | void MarkAsViewed(); 16 | 17 | bool ShouldDisplayAsNew(); 18 | 19 | bool ShouldDisplayAsComplete(); 20 | 21 | bool IsTimedQuest(); 22 | 23 | int GetDaysLeft(); 24 | 25 | bool IsHidden(); 26 | 27 | bool HasReward(); 28 | 29 | bool HasMoneyReward(); 30 | 31 | int GetMoneyReward(); 32 | 33 | void OnMoneyRewardClaimed(); 34 | 35 | bool OnLeaveQuestPage(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StardewValley/Quests/ItemHarvestQuest.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Xml.Serialization; 3 | 4 | namespace StardewValley.Quests 5 | { 6 | public class ItemHarvestQuest : Quest 7 | { 8 | [XmlElement("itemIndex")] 9 | public readonly NetInt itemIndex = new NetInt(); 10 | 11 | [XmlElement("number")] 12 | public readonly NetInt number = new NetInt(); 13 | 14 | public ItemHarvestQuest() 15 | { 16 | } 17 | 18 | public ItemHarvestQuest(int index, int number = 1) 19 | { 20 | itemIndex.Value = index; 21 | this.number.Value = number; 22 | questType.Value = 9; 23 | } 24 | 25 | protected override void initNetFields() 26 | { 27 | base.initNetFields(); 28 | base.NetFields.AddFields(itemIndex, number); 29 | } 30 | 31 | public override bool checkIfComplete(NPC n = null, int itemIndex = -1, int numberHarvested = 1, Item item = null, string str = null) 32 | { 33 | if (!completed && itemIndex != -1 && itemIndex == this.itemIndex.Value) 34 | { 35 | number.Value -= numberHarvested; 36 | if ((int)number <= 0) 37 | { 38 | questComplete(); 39 | return true; 40 | } 41 | } 42 | return false; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /StardewValley/Quests/NetDescriptionElementList.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley.Quests 5 | { 6 | public class NetDescriptionElementList : NetList 7 | { 8 | public NetDescriptionElementList() 9 | { 10 | } 11 | 12 | public NetDescriptionElementList(IEnumerable values) 13 | : base(values) 14 | { 15 | } 16 | 17 | public NetDescriptionElementList(int capacity) 18 | : base(capacity) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /StardewValley/Quests/NetDescriptionElementRef.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | 3 | namespace StardewValley.Quests 4 | { 5 | public class NetDescriptionElementRef : NetExtendableRef 6 | { 7 | public NetDescriptionElementRef() 8 | { 9 | Serializer = DescriptionElement.serializer; 10 | } 11 | 12 | public NetDescriptionElementRef(DescriptionElement value) 13 | : base(value) 14 | { 15 | Serializer = DescriptionElement.serializer; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /StardewValley/RainDrop.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace StardewValley 4 | { 5 | public struct RainDrop 6 | { 7 | public int frame; 8 | 9 | public int accumulator; 10 | 11 | public Vector2 position; 12 | 13 | public RainDrop(int x, int y, int frame, int accumulator) 14 | { 15 | position = new Vector2(x, y); 16 | this.frame = frame; 17 | this.accumulator = accumulator; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/ReachMineFloorObjective.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace StardewValley 6 | { 7 | public class ReachMineFloorObjective : OrderObjective 8 | { 9 | public NetBool skullCave = new NetBool(value: false); 10 | 11 | public override void InitializeNetFields() 12 | { 13 | base.InitializeNetFields(); 14 | base.NetFields.AddFields(skullCave); 15 | } 16 | 17 | public override void Load(SpecialOrder order, Dictionary data) 18 | { 19 | base.Load(order, data); 20 | if (data.ContainsKey("SkullCave") && data["SkullCave"].ToLowerInvariant() == "true") 21 | { 22 | skullCave.Value = true; 23 | } 24 | } 25 | 26 | protected override void _Register() 27 | { 28 | base._Register(); 29 | SpecialOrder order = _order; 30 | order.onMineFloorReached = (Action)Delegate.Combine(order.onMineFloorReached, new Action(OnNewValue)); 31 | } 32 | 33 | protected override void _Unregister() 34 | { 35 | base._Unregister(); 36 | SpecialOrder order = _order; 37 | order.onMineFloorReached = (Action)Delegate.Remove(order.onMineFloorReached, new Action(OnNewValue)); 38 | } 39 | 40 | public virtual void OnNewValue(Farmer who, int new_value) 41 | { 42 | if (skullCave.Value) 43 | { 44 | new_value -= 120; 45 | } 46 | else if (new_value > 120) 47 | { 48 | return; 49 | } 50 | if (new_value > 0) 51 | { 52 | SetCount(Math.Min(Math.Max(new_value, currentCount.Value), GetMaxCount())); 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /StardewValley/ReachingToolEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class ReachingToolEnchantment : BaseEnchantment 6 | { 7 | public override string GetName() 8 | { 9 | return "Expansive"; 10 | } 11 | 12 | public override bool CanApplyTo(Item item) 13 | { 14 | if (item is Tool && (item is WateringCan || item is Hoe)) 15 | { 16 | return (item as Tool).UpgradeLevel == 4; 17 | } 18 | return false; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /StardewValley/ReportHasRoomAnotherFarm.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public delegate void ReportHasRoomAnotherFarm(bool yes); 4 | } 5 | -------------------------------------------------------------------------------- /StardewValley/ResetEventReward.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace StardewValley 6 | { 7 | public class ResetEventReward : OrderReward 8 | { 9 | public NetIntList resetEvents = new NetIntList(); 10 | 11 | public override void InitializeNetFields() 12 | { 13 | base.InitializeNetFields(); 14 | base.NetFields.AddFields(resetEvents); 15 | } 16 | 17 | public override void Load(SpecialOrder order, Dictionary data) 18 | { 19 | string[] array = order.Parse(data["ResetEvents"]).Split(' '); 20 | foreach (string s in array) 21 | { 22 | resetEvents.Add(Convert.ToInt32(s)); 23 | } 24 | } 25 | 26 | public override void Grant() 27 | { 28 | foreach (int event_index in resetEvents) 29 | { 30 | Game1.player.eventsSeen.Remove(event_index); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /StardewValley/Response.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Input; 2 | 3 | namespace StardewValley 4 | { 5 | public class Response 6 | { 7 | public string responseKey; 8 | 9 | public string responseText; 10 | 11 | public Keys hotkey; 12 | 13 | public Response(string responseKey, string responseText) 14 | { 15 | this.responseKey = responseKey; 16 | this.responseText = responseText; 17 | } 18 | 19 | public Response SetHotKey(Keys key) 20 | { 21 | hotkey = key; 22 | return this; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /StardewValley/RubyEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace StardewValley 6 | { 7 | public class RubyEnchantment : BaseWeaponEnchantment 8 | { 9 | protected override void _ApplyTo(Item item) 10 | { 11 | base._ApplyTo(item); 12 | MeleeWeapon weapon = item as MeleeWeapon; 13 | if (weapon != null) 14 | { 15 | string[] array = Game1.temporaryContent.Load>("Data\\weapons")[weapon.InitialParentTileIndex].Split('/'); 16 | int baseMin = Convert.ToInt32(array[2]); 17 | int baseMax = Convert.ToInt32(array[3]); 18 | weapon.minDamage.Value += Math.Max(1, (int)((float)baseMin * 0.1f)) * GetLevel(); 19 | weapon.maxDamage.Value += Math.Max(1, (int)((float)baseMax * 0.1f)) * GetLevel(); 20 | } 21 | } 22 | 23 | protected override void _UnapplyTo(Item item) 24 | { 25 | base._UnapplyTo(item); 26 | MeleeWeapon weapon = item as MeleeWeapon; 27 | if (weapon != null) 28 | { 29 | string[] array = Game1.temporaryContent.Load>("Data\\weapons")[weapon.InitialParentTileIndex].Split('/'); 30 | int baseMin = Convert.ToInt32(array[2]); 31 | int baseMax = Convert.ToInt32(array[3]); 32 | weapon.minDamage.Value -= Math.Max(1, (int)((float)baseMin * 0.1f)) * GetLevel(); 33 | weapon.maxDamage.Value -= Math.Max(1, (int)((float)baseMax * 0.1f)) * GetLevel(); 34 | } 35 | } 36 | 37 | public override bool ShouldBeDisplayed() 38 | { 39 | return false; 40 | } 41 | 42 | public override bool IsForge() 43 | { 44 | return true; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /StardewValley/SDKs/Base36.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley.SDKs 4 | { 5 | public class Base36 6 | { 7 | private const string Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 8 | 9 | private const ulong Base = 36uL; 10 | 11 | public static string Encode(ulong value) 12 | { 13 | string result = ""; 14 | if (value == 0L) 15 | { 16 | return "0"; 17 | } 18 | while (value != 0L) 19 | { 20 | int digit = (int)(value % 36uL); 21 | value /= 36uL; 22 | result = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[digit].ToString() + result; 23 | } 24 | return result; 25 | } 26 | 27 | public static ulong Decode(string value) 28 | { 29 | value = value.ToUpper(); 30 | ulong result2 = 0uL; 31 | string text = value; 32 | foreach (char ch in text) 33 | { 34 | result2 *= 36; 35 | int digit = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".IndexOf(ch); 36 | if (digit == -1) 37 | { 38 | throw new FormatException(value); 39 | } 40 | result2 = (ulong)((long)result2 + (long)digit); 41 | } 42 | return result2; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /StardewValley/SDKs/LobbyUpdateListener.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.SDKs 2 | { 3 | public interface LobbyUpdateListener 4 | { 5 | void OnLobbyUpdate(object lobby); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /StardewValley/SDKs/NullSDKHelper.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.SDKs 2 | { 3 | public class NullSDKHelper : SDKHelper 4 | { 5 | public bool IsEnterButtonAssignmentFlipped => false; 6 | 7 | public bool IsJapaneseRegionRelease => false; 8 | 9 | public virtual string Name 10 | { 11 | get; 12 | } = "?"; 13 | 14 | 15 | public SDKNetHelper Networking 16 | { 17 | get; 18 | } 19 | 20 | public bool ConnectionFinished 21 | { 22 | get; 23 | } = true; 24 | 25 | 26 | public int ConnectionProgress 27 | { 28 | get; 29 | } 30 | 31 | public bool HasOverlay => false; 32 | 33 | public void EarlyInitialize() 34 | { 35 | } 36 | 37 | public void Initialize() 38 | { 39 | } 40 | 41 | public void GetAchievement(string achieve) 42 | { 43 | } 44 | 45 | public void ResetAchievements() 46 | { 47 | } 48 | 49 | public void Update() 50 | { 51 | } 52 | 53 | public void Shutdown() 54 | { 55 | } 56 | 57 | public void DebugInfo() 58 | { 59 | } 60 | 61 | public string FilterDirtyWords(string words) 62 | { 63 | return words; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /StardewValley/SDKs/RailHelper.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.SDKs 2 | { 3 | public class RailHelper : NullSDKHelper 4 | { 5 | public override string Name 6 | { 7 | get; 8 | } = "WeGame"; 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /StardewValley/SDKs/SDKHelper.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.SDKs 2 | { 3 | public interface SDKHelper 4 | { 5 | bool IsEnterButtonAssignmentFlipped 6 | { 7 | get; 8 | } 9 | 10 | bool IsJapaneseRegionRelease 11 | { 12 | get; 13 | } 14 | 15 | string Name 16 | { 17 | get; 18 | } 19 | 20 | SDKNetHelper Networking 21 | { 22 | get; 23 | } 24 | 25 | bool ConnectionFinished 26 | { 27 | get; 28 | } 29 | 30 | int ConnectionProgress 31 | { 32 | get; 33 | } 34 | 35 | bool HasOverlay 36 | { 37 | get; 38 | } 39 | 40 | void EarlyInitialize(); 41 | 42 | void Initialize(); 43 | 44 | void Update(); 45 | 46 | void Shutdown(); 47 | 48 | void DebugInfo(); 49 | 50 | void GetAchievement(string achieve); 51 | 52 | void ResetAchievements(); 53 | 54 | string FilterDirtyWords(string words); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /StardewValley/SDKs/SDKNetHelper.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Network; 2 | 3 | namespace StardewValley.SDKs 4 | { 5 | public interface SDKNetHelper 6 | { 7 | string GetUserID(); 8 | 9 | Client CreateClient(object lobby); 10 | 11 | Client GetRequestedClient(); 12 | 13 | Server CreateServer(IGameServer gameServer); 14 | 15 | void AddLobbyUpdateListener(LobbyUpdateListener listener); 16 | 17 | void RemoveLobbyUpdateListener(LobbyUpdateListener listener); 18 | 19 | void RequestFriendLobbyData(); 20 | 21 | string GetLobbyData(object lobby, string key); 22 | 23 | string GetLobbyOwnerName(object lobby); 24 | 25 | bool SupportsInviteCodes(); 26 | 27 | object GetLobbyFromInviteCode(string inviteCode); 28 | 29 | void ShowInviteDialog(object lobby); 30 | 31 | void MutePlayer(string userId, bool mute); 32 | 33 | bool IsPlayerMuted(string userId); 34 | 35 | void ShowProfile(string userId); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StardewValley/SchedulePathDescription.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.Collections.Generic; 3 | 4 | namespace StardewValley 5 | { 6 | public class SchedulePathDescription 7 | { 8 | public Stack route; 9 | 10 | public int facingDirection; 11 | 12 | public string endOfRouteBehavior; 13 | 14 | public string endOfRouteMessage; 15 | 16 | public SchedulePathDescription(Stack route, int facingDirection, string endBehavior, string endMessage) 17 | { 18 | endOfRouteMessage = endMessage; 19 | this.route = route; 20 | this.facingDirection = facingDirection; 21 | endOfRouteBehavior = endBehavior; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /StardewValley/SeaMonsterTemporarySprite.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace StardewValley 5 | { 6 | public class SeaMonsterTemporarySprite : TemporaryAnimatedSprite 7 | { 8 | public new Texture2D texture; 9 | 10 | public SeaMonsterTemporarySprite(float animationInterval, int animationLength, int numberOfLoops, Vector2 position) 11 | : base(-666, animationInterval, animationLength, numberOfLoops, position, flicker: false, flipped: false) 12 | { 13 | texture = Game1.content.Load("LooseSprites\\SeaMonster"); 14 | Game1.playSound("pullItemFromWater"); 15 | currentParentTileIndex = 0; 16 | } 17 | 18 | public override void draw(SpriteBatch spriteBatch, bool localPosition = false, int xOffset = 0, int yOffset = 0, float extraAlpha = 1f) 19 | { 20 | spriteBatch.Draw(texture, Game1.GlobalToLocal(Game1.viewport, base.Position), new Rectangle(currentParentTileIndex * 16, 0, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (base.Position.Y + 32f) / 10000f); 21 | } 22 | 23 | public override bool update(GameTime time) 24 | { 25 | timer += time.ElapsedGameTime.Milliseconds; 26 | if (timer > interval) 27 | { 28 | currentParentTileIndex++; 29 | timer = 0f; 30 | if (currentParentTileIndex >= animationLength) 31 | { 32 | currentNumberOfLoops++; 33 | currentParentTileIndex = 2; 34 | } 35 | } 36 | if (currentNumberOfLoops >= totalNumberOfLoops) 37 | { 38 | position.Y += 2f; 39 | if (position.Y >= (float)Game1.currentLocation.Map.DisplayHeight) 40 | { 41 | return true; 42 | } 43 | } 44 | return false; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /StardewValley/ServerPrivacy.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public enum ServerPrivacy 4 | { 5 | InviteOnly, 6 | FriendsOnly, 7 | Public 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StardewValley/ShavingEnchantment.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public class ShavingEnchantment : AxeEnchantment 4 | { 5 | public override string GetName() 6 | { 7 | return "Shaving"; 8 | } 9 | 10 | protected override void _ApplyTo(Item item) 11 | { 12 | base._ApplyTo(item); 13 | } 14 | 15 | protected override void _UnapplyTo(Item item) 16 | { 17 | base._UnapplyTo(item); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StardewValley/ShearsEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class ShearsEnchantment : BaseEnchantment 6 | { 7 | public override bool CanApplyTo(Item item) 8 | { 9 | if (item is Shears) 10 | { 11 | return true; 12 | } 13 | return false; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StardewValley/ShippedItem.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | internal struct ShippedItem 4 | { 5 | public int index; 6 | 7 | public int price; 8 | 9 | public string name; 10 | 11 | public ShippedItem(int index, int price, string name) 12 | { 13 | this.index = index; 14 | this.price = price; 15 | this.name = name; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /StardewValley/ShrineActivity.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace StardewValley 4 | { 5 | public class ShrineActivity : FarmActivity 6 | { 7 | public override bool AttemptActivity(Farm farm) 8 | { 9 | activityPosition = new Vector2(8f, 8f); 10 | activityDirection = 0; 11 | return true; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /StardewValley/SlayObjective.cs: -------------------------------------------------------------------------------- 1 | using Netcode; 2 | using StardewValley.Monsters; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Xml.Serialization; 6 | 7 | namespace StardewValley 8 | { 9 | public class SlayObjective : OrderObjective 10 | { 11 | [XmlElement("targetNames")] 12 | public NetStringList targetNames = new NetStringList(); 13 | 14 | public override void InitializeNetFields() 15 | { 16 | base.InitializeNetFields(); 17 | base.NetFields.AddFields(targetNames); 18 | } 19 | 20 | public override void Load(SpecialOrder order, Dictionary data) 21 | { 22 | base.Load(order, data); 23 | if (data.ContainsKey("TargetName")) 24 | { 25 | string[] array = order.Parse(data["TargetName"]).Split(','); 26 | foreach (string target in array) 27 | { 28 | targetNames.Add(target.Trim()); 29 | } 30 | } 31 | } 32 | 33 | protected override void _Register() 34 | { 35 | base._Register(); 36 | SpecialOrder order = _order; 37 | order.onMonsterSlain = (Action)Delegate.Combine(order.onMonsterSlain, new Action(OnMonsterSlain)); 38 | } 39 | 40 | protected override void _Unregister() 41 | { 42 | base._Unregister(); 43 | SpecialOrder order = _order; 44 | order.onMonsterSlain = (Action)Delegate.Remove(order.onMonsterSlain, new Action(OnMonsterSlain)); 45 | } 46 | 47 | public virtual void OnMonsterSlain(Farmer farmer, Monster monster) 48 | { 49 | foreach (string target in targetNames) 50 | { 51 | if (monster.Name.Contains(target)) 52 | { 53 | IncrementCount(1); 54 | break; 55 | } 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /StardewValley/SoundBankWrapper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | using System; 3 | 4 | namespace StardewValley 5 | { 6 | public class SoundBankWrapper : ISoundBank, IDisposable 7 | { 8 | private SoundBank soundBank; 9 | 10 | public bool IsInUse => soundBank.IsInUse; 11 | 12 | public bool IsDisposed => soundBank.IsDisposed; 13 | 14 | public SoundBankWrapper(SoundBank soundBank) 15 | { 16 | this.soundBank = soundBank; 17 | } 18 | 19 | public ICue GetCue(string name) 20 | { 21 | return new CueWrapper(soundBank.GetCue(name)); 22 | } 23 | 24 | public void PlayCue(string name) 25 | { 26 | soundBank.PlayCue(name); 27 | } 28 | 29 | public void PlayCue(string name, AudioListener listener, AudioEmitter emitter) 30 | { 31 | soundBank.PlayCue(name, listener, emitter); 32 | } 33 | 34 | public void Dispose() 35 | { 36 | soundBank.Dispose(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /StardewValley/StackDrawType.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley 2 | { 3 | public enum StackDrawType 4 | { 5 | Hide, 6 | Draw, 7 | Draw_OneInclusive, 8 | HideButShowQuality 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /StardewValley/SwiftToolEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class SwiftToolEnchantment : BaseEnchantment 6 | { 7 | public override string GetName() 8 | { 9 | return "Swift"; 10 | } 11 | 12 | public override bool CanApplyTo(Item item) 13 | { 14 | if (item is Tool && !(item is MilkPail) && !(item is MeleeWeapon) && !(item is Shears) && !(item is FishingRod) && !(item is Pan) && !(item is WateringCan) && !(item is Wand)) 15 | { 16 | return !(item is Slingshot); 17 | } 18 | return false; 19 | } 20 | 21 | protected override void _ApplyTo(Item item) 22 | { 23 | base._ApplyTo(item); 24 | Tool tool = item as Tool; 25 | if (tool != null) 26 | { 27 | tool.AnimationSpeedModifier = 0.66f; 28 | } 29 | } 30 | 31 | protected override void _UnapplyTo(Item item) 32 | { 33 | base._UnapplyTo(item); 34 | Tool tool = item as Tool; 35 | if (tool != null) 36 | { 37 | tool.AnimationSpeedModifier = 1f; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /StardewValley/TerrainFeatures/LargeTerrainFeature.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using Netcode; 4 | using System.Xml.Serialization; 5 | 6 | namespace StardewValley.TerrainFeatures 7 | { 8 | [XmlInclude(typeof(Bush))] 9 | public abstract class LargeTerrainFeature : TerrainFeature 10 | { 11 | [XmlElement("tilePosition")] 12 | public readonly NetVector2 tilePosition = new NetVector2(); 13 | 14 | protected LargeTerrainFeature(bool needsTick) 15 | : base(needsTick) 16 | { 17 | base.NetFields.AddField(tilePosition); 18 | } 19 | 20 | public Rectangle getBoundingBox() 21 | { 22 | return getBoundingBox(tilePosition); 23 | } 24 | 25 | public void dayUpdate(GameLocation l) 26 | { 27 | dayUpdate(l, tilePosition); 28 | } 29 | 30 | public bool tickUpdate(GameTime time, GameLocation location) 31 | { 32 | return tickUpdate(time, tilePosition, location); 33 | } 34 | 35 | public void draw(SpriteBatch b) 36 | { 37 | draw(b, tilePosition); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /StardewValley/TerrainFeatures/Leaf.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace StardewValley.TerrainFeatures 4 | { 5 | public class Leaf 6 | { 7 | public Vector2 position; 8 | 9 | public float rotation; 10 | 11 | public float rotationRate; 12 | 13 | public float yVelocity; 14 | 15 | public int type; 16 | 17 | public Leaf(Vector2 position, float rotationRate, int type, float yVelocity) 18 | { 19 | this.position = position; 20 | this.rotationRate = rotationRate; 21 | this.type = type; 22 | this.yVelocity = yVelocity; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /StardewValley/TilePositionComparer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.Collections.Generic; 3 | 4 | public class TilePositionComparer : IEqualityComparer 5 | { 6 | public bool Equals(Vector2 a, Vector2 b) 7 | { 8 | return a.Equals(b); 9 | } 10 | 11 | public int GetHashCode(Vector2 a) 12 | { 13 | return (ushort)a.X | ((ushort)a.Y << 16); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /StardewValley/Tools/Blueprints.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using StardewValley.Menus; 3 | 4 | namespace StardewValley.Tools 5 | { 6 | public class Blueprints : Tool 7 | { 8 | public Blueprints() 9 | : base("Farmer's Catalogue", 0, 75, 75, stackable: false) 10 | { 11 | base.UpgradeLevel = 0; 12 | base.CurrentParentTileIndex = base.IndexOfMenuItemView; 13 | base.InstantUse = true; 14 | } 15 | 16 | public override Item getOne() 17 | { 18 | Blueprints blueprints = new Blueprints(); 19 | blueprints._GetOneFrom(this); 20 | return blueprints; 21 | } 22 | 23 | protected override string loadDisplayName() 24 | { 25 | return Game1.content.LoadString("Strings\\StringsFromCSFiles:Blueprints.cs.14039"); 26 | } 27 | 28 | protected override string loadDescription() 29 | { 30 | return Game1.content.LoadString("Strings\\StringsFromCSFiles:Blueprints.cs.14040"); 31 | } 32 | 33 | public override void DoFunction(GameLocation location, int x, int y, int power, Farmer who) 34 | { 35 | if (Game1.activeClickableMenu == null) 36 | { 37 | Game1.activeClickableMenu = new BlueprintsMenu(Game1.viewport.Width / 2 - (Game1.viewport.Width / 2 + 96) / 2, Game1.viewport.Height / 4); 38 | ((BlueprintsMenu)Game1.activeClickableMenu).changePosition(((BlueprintsMenu)Game1.activeClickableMenu).xPositionOnScreen, Game1.viewport.Height / 2 - ((BlueprintsMenu)Game1.activeClickableMenu).height / 2); 39 | } 40 | base.CurrentParentTileIndex = base.IndexOfMenuItemView; 41 | } 42 | 43 | public override void tickUpdate(GameTime time, Farmer who) 44 | { 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /StardewValley/Tools/GenericTool.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Tools 2 | { 3 | public class GenericTool : Tool 4 | { 5 | public new string description; 6 | 7 | public GenericTool() 8 | { 9 | } 10 | 11 | public GenericTool(string name, string description, int upgradeLevel, int parentSheetIndex, int menuViewIndex) 12 | : base(name, upgradeLevel, parentSheetIndex, menuViewIndex, stackable: false) 13 | { 14 | this.description = description; 15 | } 16 | 17 | public override Item getOne() 18 | { 19 | GenericTool genericTool = new GenericTool(base.BaseName, description, base.UpgradeLevel, base.InitialParentTileIndex, base.IndexOfMenuItemView); 20 | genericTool._GetOneFrom(this); 21 | return genericTool; 22 | } 23 | 24 | protected override string loadDescription() 25 | { 26 | return description; 27 | } 28 | 29 | protected override string loadDisplayName() 30 | { 31 | return base.BaseName; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /StardewValley/Tools/Stackable.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Tools 2 | { 3 | public abstract class Stackable : Tool 4 | { 5 | private int numberInStack; 6 | 7 | public int NumberInStack 8 | { 9 | get 10 | { 11 | return numberInStack; 12 | } 13 | set 14 | { 15 | numberInStack = value; 16 | } 17 | } 18 | 19 | public Stackable() 20 | { 21 | } 22 | 23 | public Stackable(string name, int upgradeLevel, int initialParentTileIndex, int indexOfMenuItemView, bool stackable) 24 | : base(name, upgradeLevel, initialParentTileIndex, indexOfMenuItemView, stackable) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /StardewValley/Tools/ToolDescription.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Tools 2 | { 3 | public struct ToolDescription 4 | { 5 | public byte index; 6 | 7 | public byte upgradeLevel; 8 | 9 | public ToolDescription(byte index, byte upgradeLevel) 10 | { 11 | this.index = index; 12 | this.upgradeLevel = upgradeLevel; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /StardewValley/TopazEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class TopazEnchantment : BaseWeaponEnchantment 6 | { 7 | protected override void _ApplyTo(Item item) 8 | { 9 | base._ApplyTo(item); 10 | MeleeWeapon weapon = item as MeleeWeapon; 11 | if (weapon != null) 12 | { 13 | weapon.addedDefense.Value += GetLevel(); 14 | } 15 | } 16 | 17 | protected override void _UnapplyTo(Item item) 18 | { 19 | base._UnapplyTo(item); 20 | MeleeWeapon weapon = item as MeleeWeapon; 21 | if (weapon != null) 22 | { 23 | weapon.addedDefense.Value -= GetLevel(); 24 | } 25 | } 26 | 27 | public override bool ShouldBeDisplayed() 28 | { 29 | return false; 30 | } 31 | 32 | public override bool IsForge() 33 | { 34 | return true; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StardewValley/Util/BoundingBoxGroup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System.Collections.Generic; 4 | 5 | namespace StardewValley.Util 6 | { 7 | public class BoundingBoxGroup 8 | { 9 | private List rectangles = new List(); 10 | 11 | public bool Intersects(Rectangle rect) 12 | { 13 | foreach (Rectangle rectangle in rectangles) 14 | { 15 | if (rectangle.Intersects(rect)) 16 | { 17 | return true; 18 | } 19 | } 20 | return false; 21 | } 22 | 23 | public bool Contains(int x, int y) 24 | { 25 | foreach (Rectangle rectangle in rectangles) 26 | { 27 | if (rectangle.Contains(x, y)) 28 | { 29 | return true; 30 | } 31 | } 32 | return false; 33 | } 34 | 35 | public void Add(Rectangle rect) 36 | { 37 | if (!rectangles.Contains(rect)) 38 | { 39 | rectangles.Add(rect); 40 | } 41 | } 42 | 43 | public void ClearNonIntersecting(Rectangle rect) 44 | { 45 | for (int i = rectangles.Count - 1; i >= 0; i--) 46 | { 47 | if (!rectangles[i].Intersects(rect)) 48 | { 49 | rectangles.RemoveAt(i); 50 | } 51 | } 52 | } 53 | 54 | public void Clear() 55 | { 56 | rectangles.Clear(); 57 | } 58 | 59 | public void Draw(SpriteBatch b) 60 | { 61 | foreach (Rectangle r in rectangles) 62 | { 63 | r.Offset(-Game1.viewport.X, -Game1.viewport.Y); 64 | b.Draw(Game1.fadeToBlackRect, r, Color.Green * 0.5f); 65 | } 66 | } 67 | 68 | public bool IsEmpty() 69 | { 70 | return rectangles.Count == 0; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /StardewValley/Util/GuidHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StardewValley.Util 4 | { 5 | internal static class GuidHelper 6 | { 7 | public static Guid NewGuid() 8 | { 9 | return Guid.NewGuid(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /StardewValley/Util/IInputSimulator.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Util 2 | { 3 | public interface IInputSimulator 4 | { 5 | void SimulateInput(ref bool actionButtonPressed, ref bool switchToolButtonPressed, ref bool useToolButtonPressed, ref bool useToolButtonReleased, ref bool addItemToInventoryButtonPressed, ref bool cancelButtonPressed, ref bool moveUpPressed, ref bool moveRightPressed, ref bool moveLeftPressed, ref bool moveDownPressed, ref bool moveUpReleased, ref bool moveRightReleased, ref bool moveLeftReleased, ref bool moveDownReleased, ref bool moveUpHeld, ref bool moveRightHeld, ref bool moveLeftHeld, ref bool moveDownHeld); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /StardewValley/Util/LeftRightClickSpamInputSimulator.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Util 2 | { 3 | public class LeftRightClickSpamInputSimulator : IInputSimulator 4 | { 5 | private bool leftClickThisFrame; 6 | 7 | public void SimulateInput(ref bool actionButtonPressed, ref bool switchToolButtonPressed, ref bool useToolButtonPressed, ref bool useToolButtonReleased, ref bool addItemToInventoryButtonPressed, ref bool cancelButtonPressed, ref bool moveUpPressed, ref bool moveRightPressed, ref bool moveLeftPressed, ref bool moveDownPressed, ref bool moveUpReleased, ref bool moveRightReleased, ref bool moveLeftReleased, ref bool moveDownReleased, ref bool moveUpHeld, ref bool moveRightHeld, ref bool moveLeftHeld, ref bool moveDownHeld) 8 | { 9 | useToolButtonPressed = leftClickThisFrame; 10 | useToolButtonReleased = !leftClickThisFrame; 11 | actionButtonPressed = !leftClickThisFrame; 12 | leftClickThisFrame = !leftClickThisFrame; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /StardewValley/Util/ToolSpamInputSimulator.cs: -------------------------------------------------------------------------------- 1 | namespace StardewValley.Util 2 | { 3 | public class ToolSpamInputSimulator : IInputSimulator 4 | { 5 | private bool pressedLastFrame; 6 | 7 | public void SimulateInput(ref bool actionButtonPressed, ref bool switchToolButtonPressed, ref bool useToolButtonPressed, ref bool useToolButtonReleased, ref bool addItemToInventoryButtonPressed, ref bool cancelButtonPressed, ref bool moveUpPressed, ref bool moveRightPressed, ref bool moveLeftPressed, ref bool moveDownPressed, ref bool moveUpReleased, ref bool moveRightReleased, ref bool moveLeftReleased, ref bool moveDownReleased, ref bool moveUpHeld, ref bool moveRightHeld, ref bool moveLeftHeld, ref bool moveDownHeld) 8 | { 9 | useToolButtonPressed = pressedLastFrame; 10 | useToolButtonReleased = !pressedLastFrame; 11 | pressedLastFrame = !pressedLastFrame; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /StardewValley/VampiricEnchantment.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using StardewValley.Monsters; 3 | using System; 4 | 5 | namespace StardewValley 6 | { 7 | public class VampiricEnchantment : BaseWeaponEnchantment 8 | { 9 | protected override void _OnDealDamage(Monster monster, GameLocation location, Farmer who, ref int amount) 10 | { 11 | } 12 | 13 | protected override void _OnMonsterSlay(Monster m, GameLocation location, Farmer who) 14 | { 15 | if (Game1.random.NextDouble() < 0.090000003576278687) 16 | { 17 | int amount = Math.Max(1, (int)((float)(m.MaxHealth + Game1.random.Next(-m.MaxHealth / 10, m.MaxHealth / 15 + 1)) * 0.1f)); 18 | who.health = Math.Min(who.maxHealth, Game1.player.health + amount); 19 | location.debris.Add(new Debris(amount, new Vector2(Game1.player.getStandingX(), Game1.player.getStandingY()), Color.Lime, 1f, who)); 20 | Game1.playSound("healSound"); 21 | } 22 | } 23 | 24 | public override string GetName() 25 | { 26 | return "Vampiric"; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /StardewValley/Vector2Reader.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.Xml; 3 | using System.Xml.Serialization; 4 | 5 | namespace StardewValley 6 | { 7 | public class Vector2Reader : XmlSerializationReader 8 | { 9 | public Vector2 ReadVector2() 10 | { 11 | XmlReader reader = base.Reader; 12 | reader.ReadStartElement("Vector2"); 13 | reader.ReadStartElement("X"); 14 | float x = reader.ReadContentAsFloat(); 15 | reader.ReadEndElement(); 16 | reader.ReadStartElement("Y"); 17 | float y = reader.ReadContentAsFloat(); 18 | reader.ReadEndElement(); 19 | reader.ReadEndElement(); 20 | return new Vector2(x, y); 21 | } 22 | 23 | protected override void InitCallbacks() 24 | { 25 | } 26 | 27 | protected override void InitIDs() 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /StardewValley/Vector2Serializer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.Xml; 3 | using System.Xml.Serialization; 4 | 5 | namespace StardewValley 6 | { 7 | public class Vector2Serializer : XmlSerializer 8 | { 9 | private Vector2Reader _reader = new Vector2Reader(); 10 | 11 | private Vector2Writer _writer = new Vector2Writer(); 12 | 13 | protected override XmlSerializationReader CreateReader() 14 | { 15 | return _reader; 16 | } 17 | 18 | protected override XmlSerializationWriter CreateWriter() 19 | { 20 | return _writer; 21 | } 22 | 23 | public override bool CanDeserialize(XmlReader xmlReader) 24 | { 25 | return xmlReader.IsStartElement("Vector2"); 26 | } 27 | 28 | protected override void Serialize(object o, XmlSerializationWriter writer) 29 | { 30 | _writer.WriteVector2((Vector2)o); 31 | } 32 | 33 | protected override object Deserialize(XmlSerializationReader reader) 34 | { 35 | return _reader.ReadVector2(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /StardewValley/Vector2Writer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.Xml; 3 | using System.Xml.Serialization; 4 | 5 | namespace StardewValley 6 | { 7 | public class Vector2Writer : XmlSerializationWriter 8 | { 9 | public void WriteVector2(Vector2 vec) 10 | { 11 | XmlWriter writer = base.Writer; 12 | writer.WriteStartElement("Vector2"); 13 | writer.WriteStartElement("X"); 14 | writer.WriteValue(vec.X); 15 | writer.WriteEndElement(); 16 | writer.WriteStartElement("Y"); 17 | writer.WriteValue(vec.Y); 18 | writer.WriteEndElement(); 19 | writer.WriteEndElement(); 20 | } 21 | 22 | protected override void InitCallbacks() 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /StardewValley/WateringCanEnchantment.cs: -------------------------------------------------------------------------------- 1 | using StardewValley.Tools; 2 | 3 | namespace StardewValley 4 | { 5 | public class WateringCanEnchantment : BaseEnchantment 6 | { 7 | public override bool CanApplyTo(Item item) 8 | { 9 | if (item is WateringCan) 10 | { 11 | return true; 12 | } 13 | return false; 14 | } 15 | } 16 | } 17 | --------------------------------------------------------------------------------