From 21abd0f552930215c55e0993bb6a06c90825cdaf Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 22 Feb 2024 01:05:12 -0500 Subject: [PATCH] prefer `base` in rewriters for clarity --- .../ModLoading/Framework/SuppressReasons.cs | 3 ++ .../StardewValley_1_6/BedFurnitureFacade.cs | 4 +-- .../StardewValley_1_6/BreakableContainer.cs | 2 +- .../Rewriters/StardewValley_1_6/BuffFacade.cs | 3 +- .../BuildableGameLocationFacade.cs | 3 +- .../StardewValley_1_6/BuildingFacade.cs | 5 ++-- .../Rewriters/StardewValley_1_6/BushFacade.cs | 9 +++--- .../Rewriters/StardewValley_1_6/CaskFacade.cs | 2 +- .../StardewValley_1_6/CharacterFacade.cs | 15 +++++----- .../StardewValley_1_6/ChestFacade.cs | 4 +-- .../StardewValley_1_6/FarmAnimalFacade.cs | 3 +- .../StardewValley_1_6/FarmerFacade.cs | 29 ++++++++++--------- .../StardewValley_1_6/FarmerTeamFacade.cs | 3 +- .../StardewValley_1_6/FenceFacade.cs | 2 +- .../StardewValley_1_6/FruitTreeFacade.cs | 3 +- .../StardewValley_1_6/FurnitureFacade.cs | 10 +++---- .../StardewValley_1_6/GameLocationFacade.cs | 15 +++++----- .../StardewValley_1_6/JunimoHutFacade.cs | 3 +- .../Rewriters/StardewValley_1_6/NpcFacade.cs | 11 +++---- .../StardewValley_1_6/ObjectFacade.cs | 18 ++++++------ .../StardewValley_1_6/ResourceClumpFacade.cs | 3 +- .../StardewValley_1_6/WorldDateFacade.cs | 5 ++-- 22 files changed, 86 insertions(+), 69 deletions(-) diff --git a/src/SMAPI/Framework/ModLoading/Framework/SuppressReasons.cs b/src/SMAPI/Framework/ModLoading/Framework/SuppressReasons.cs index f2e723769..c960b5196 100644 --- a/src/SMAPI/Framework/ModLoading/Framework/SuppressReasons.cs +++ b/src/SMAPI/Framework/ModLoading/Framework/SuppressReasons.cs @@ -8,5 +8,8 @@ internal static class SuppressReasons /// A message indicating the code is used via assembly rewriting. public const string UsedViaRewriting = "This code is used via assembly rewriting."; + + /// A message indicating the code is used via assembly rewriting. + public const string BaseForClarity = "This code deliberately uses 'base' to ensure we're calling the real method instead of a rewritten one."; } } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BedFurnitureFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BedFurnitureFacade.cs index 2625c9b7f..5156c8e8c 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BedFurnitureFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BedFurnitureFacade.cs @@ -28,12 +28,12 @@ public static BedFurniture Constructor(int which, Vector2 tile) public bool CanModifyBed(GameLocation location, Farmer who) { - return this.CanModifyBed(who); + return base.CanModifyBed(who); } public bool IsBeingSleptIn(GameLocation location) { - return this.IsBeingSleptIn(); + return base.IsBeingSleptIn(); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BreakableContainer.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BreakableContainer.cs index b04c726f9..e9eaea59b 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BreakableContainer.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BreakableContainer.cs @@ -18,7 +18,7 @@ public class BreakableContainerFacade : BreakableContainer, IRewriteFacade *********/ public void releaseContents(GameLocation location, Farmer who) { - this.releaseContents(who); + base.releaseContents(who); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuffFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuffFacade.cs index 8d98fb46a..d479334af 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuffFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuffFacade.cs @@ -11,6 +11,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] [SuppressMessage("ReSharper", "ParameterHidesMember", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] [SuppressMessage("ReSharper", "UnusedParameter.Local", Justification = SuppressReasons.MatchesOriginal)] public class BuffFacade : Buff, IRewriteFacade @@ -46,7 +47,7 @@ public void addBuff() public void removeBuff() { - Game1.player.buffs.Remove(this.id); + Game1.player.buffs.Remove(base.id); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildableGameLocationFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildableGameLocationFacade.cs index bc8cf1150..a66b096c3 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildableGameLocationFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildableGameLocationFacade.cs @@ -12,6 +12,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] [SuppressMessage("ReSharper", "ParameterHidesMember", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class BuildableGameLocationFacade : GameLocation, IRewriteFacade { @@ -45,7 +46,7 @@ public class BuildableGameLocationFacade : GameLocation, IRewriteFacade public Building? getBuildingUnderConstruction() { - foreach (Building b in this.buildings) + foreach (Building b in base.buildings) { if (b.daysOfConstructionLeft > 0 || b.daysUntilUpgrade > 0) return b; diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildingFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildingFacade.cs index 5b8cf14e3..6c21ee719 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildingFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BuildingFacade.cs @@ -12,14 +12,15 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class BuildingFacade : Building, IRewriteFacade { /********* ** Accessors *********/ - public NetRef input => NetRefWrapperCache.GetCachedWrapperFor(this.GetBuildingChest("Input")); // Mill - public NetRef output => NetRefWrapperCache.GetCachedWrapperFor(this.GetBuildingChest("Output")); // Mill + public NetRef input => NetRefWrapperCache.GetCachedWrapperFor(base.GetBuildingChest("Input")); // Mill + public NetRef output => NetRefWrapperCache.GetCachedWrapperFor(base.GetBuildingChest("Output")); // Mill /********* diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BushFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BushFacade.cs index c0cd97b73..7857aaf23 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BushFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/BushFacade.cs @@ -11,6 +11,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class BushFacade : Bush, IRewriteFacade { @@ -21,15 +22,15 @@ public bool inBloom(string season, int dayOfMonth) { // call new method if possible if (season == Game1.currentSeason && dayOfMonth == Game1.dayOfMonth) - return this.inBloom(); + return base.inBloom(); // else mimic old behavior with 1.6 features - if (this.size == Bush.greenTeaBush) + if (base.size == Bush.greenTeaBush) { return - this.getAge() >= Bush.daysToMatureGreenTeaBush + base.getAge() >= Bush.daysToMatureGreenTeaBush && dayOfMonth >= 22 - && (season != "winter" || this.IsSheltered()); + && (season != "winter" || base.IsSheltered()); } switch (season) diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/CaskFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/CaskFacade.cs index a8c4c6d46..c5c765981 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/CaskFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/CaskFacade.cs @@ -19,7 +19,7 @@ public class CaskFacade : Cask, IRewriteFacade *********/ public bool IsValidCaskLocation(GameLocation location) { - return this.IsValidCaskLocation(); + return base.IsValidCaskLocation(); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/CharacterFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/CharacterFacade.cs index dd069c6fe..8b11a9ad2 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/CharacterFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/CharacterFacade.cs @@ -10,6 +10,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class CharacterFacade : Character, IRewriteFacade { @@ -18,37 +19,37 @@ public class CharacterFacade : Character, IRewriteFacade *********/ public int getStandingX() { - return this.StandingPixel.X; + return base.StandingPixel.X; } public int getStandingY() { - return this.StandingPixel.Y; + return base.StandingPixel.Y; } public Point getStandingXY() { - return this.StandingPixel; + return base.StandingPixel; } public Vector2 getTileLocation() { - return this.Tile; + return base.Tile; } public Point getTileLocationPoint() { - return this.TilePoint; + return base.TilePoint; } public int getTileX() { - return this.TilePoint.X; + return base.TilePoint.X; } public int getTileY() { - return this.TilePoint.Y; + return base.TilePoint.Y; } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ChestFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ChestFacade.cs index e4abd8d37..7c18b047f 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ChestFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ChestFacade.cs @@ -51,12 +51,12 @@ public ChestFacade(int coins, List items, Vector2 location, bool giftbox = public void destroyAndDropContents(Vector2 pointToDropAt, GameLocation location) { - this.destroyAndDropContents(pointToDropAt); + base.destroyAndDropContents(pointToDropAt); } public void dumpContents(GameLocation location) { - this.dumpContents(); + base.dumpContents(); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmAnimalFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmAnimalFacade.cs index 51178ea9e..f507249d5 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmAnimalFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmAnimalFacade.cs @@ -10,6 +10,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class FarmAnimalFacade : FarmAnimal, IRewriteFacade { @@ -18,7 +19,7 @@ public class FarmAnimalFacade : FarmAnimal, IRewriteFacade *********/ public bool isCoopDweller() { - FarmAnimalData? data = this.GetAnimalData(); + FarmAnimalData? data = base.GetAnimalData(); return data?.House == "Coop"; } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmerFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmerFacade.cs index 8150fd04d..6452db005 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmerFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmerFacade.cs @@ -15,6 +15,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] public class FarmerFacade : Farmer, IRewriteFacade { /********* @@ -34,12 +35,12 @@ public class FarmerFacade : Farmer, IRewriteFacade *********/ public void addQuest(int questID) { - this.addQuest(questID.ToString()); + base.addQuest(questID.ToString()); } public void changePants(Color color) { - this.changePantsColor(color); + base.changePantsColor(color); } public void changePantStyle(int whichPants, bool is_customization_screen = false) @@ -49,27 +50,27 @@ public void changePantStyle(int whichPants, bool is_customization_screen = false public void changeShirt(int whichShirt, bool is_customization_screen = false) { - this.changeShirt(whichShirt.ToString()); + base.changeShirt(whichShirt.ToString()); } public void changeShoeColor(int which) { - this.changeShoeColor(which.ToString()); + base.changeShoeColor(which.ToString()); } public void completeQuest(int questID) { - this.completeQuest(questID.ToString()); + base.completeQuest(questID.ToString()); } public bool couldInventoryAcceptThisObject(int index, int stack, int quality = 0) { - return this.couldInventoryAcceptThisItem(index.ToString(), stack, quality); + return base.couldInventoryAcceptThisItem(index.ToString(), stack, quality); } public int GetEffectsOfRingMultiplier(int ring_index) { - return this.GetEffectsOfRingMultiplier(ring_index.ToString()); + return base.GetEffectsOfRingMultiplier(ring_index.ToString()); } public int getItemCount(int item_index, int min_price = 0) @@ -81,7 +82,7 @@ public int getItemCount(int item_index, int min_price = 0) public bool hasBuff(int whichBuff) { - return this.hasBuff(whichBuff.ToString()); + return base.hasBuff(whichBuff.ToString()); } public bool hasItemInInventory(int itemIndex, int quantity, int minPrice = 0) @@ -91,24 +92,24 @@ public bool hasItemInInventory(int itemIndex, int quantity, int minPrice = 0) switch (itemIndex) { case 858: - return this.QiGems >= quantity; + return base.QiGems >= quantity; case 73: return Game1.netWorldState.Value.GoldenWalnuts >= quantity; default: - return this.getItemCount(ItemRegistry.type_object + itemIndex) >= quantity; + return base.getItemCount(ItemRegistry.type_object + itemIndex) >= quantity; } } public bool hasQuest(int id) { - return this.hasQuest(id.ToString()); + return base.hasQuest(id.ToString()); } public bool isWearingRing(int ringIndex) { - return this.isWearingRing(ringIndex.ToString()); + return base.isWearingRing(ringIndex.ToString()); } public bool removeItemsFromInventory(int index, int stack) @@ -118,7 +119,7 @@ public bool removeItemsFromInventory(int index, int stack) switch (index) { case 858: - this.QiGems -= stack; + base.QiGems -= stack; return true; case 73: @@ -152,7 +153,7 @@ public bool removeItemsFromInventory(int index, int stack) public void removeQuest(int questID) { - this.removeQuest(questID.ToString()); + base.removeQuest(questID.ToString()); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmerTeamFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmerTeamFacade.cs index 4486117ba..19091c60c 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmerTeamFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FarmerTeamFacade.cs @@ -11,13 +11,14 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class FarmerTeamFacade : FarmerTeam, IRewriteFacade { /********* ** Accessors *********/ - public NetObjectList junimoChest => InventoryToNetObjectList.GetCachedWrapperFor(this.GetOrCreateGlobalInventory(FarmerTeam.GlobalInventoryId_JunimoChest)); + public NetObjectList junimoChest => InventoryToNetObjectList.GetCachedWrapperFor(base.GetOrCreateGlobalInventory(FarmerTeam.GlobalInventoryId_JunimoChest)); /********* diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FenceFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FenceFacade.cs index e5c8c9f42..802280120 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FenceFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FenceFacade.cs @@ -17,7 +17,7 @@ public class FenceFacade : Fence, IRewriteFacade *********/ public void toggleGate(GameLocation location, bool open, bool is_toggling_counterpart = false, Farmer? who = null) { - this.toggleGate(open, is_toggling_counterpart, who); + base.toggleGate(open, is_toggling_counterpart, who); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FruitTreeFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FruitTreeFacade.cs index 933dc5538..0aebc33cd 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FruitTreeFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FruitTreeFacade.cs @@ -13,6 +13,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class FruitTreeFacade : FruitTree, IRewriteFacade { @@ -23,7 +24,7 @@ public NetString fruitSeason { get { - List? seasons = this.GetData()?.Seasons; + List? seasons = base.GetData()?.Seasons; string value = seasons?.Count > 0 ? string.Join(",", seasons) : string.Empty; diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FurnitureFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FurnitureFacade.cs index f8ba103ce..7b6e5f245 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FurnitureFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/FurnitureFacade.cs @@ -29,12 +29,12 @@ public static Furniture Constructor(int which, Vector2 tile) public void AddLightGlow(GameLocation location) { - this.AddLightGlow(); + base.AddLightGlow(); } public void addLights(GameLocation environment) { - this.addLights(); + base.addLights(); } public static Furniture GetFurnitureInstance(int index, Vector2? position = null) @@ -44,17 +44,17 @@ public static Furniture GetFurnitureInstance(int index, Vector2? position = null public void removeLights(GameLocation environment) { - this.removeLights(); + base.removeLights(); } public void RemoveLightGlow(GameLocation location) { - this.RemoveLightGlow(); + base.RemoveLightGlow(); } public void setFireplace(GameLocation location, bool playSound = true, bool broadcast = false) { - this.setFireplace(playSound, broadcast); + base.setFireplace(playSound, broadcast); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/GameLocationFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/GameLocationFacade.cs index a04095e3c..8b9de1c74 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/GameLocationFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/GameLocationFacade.cs @@ -18,6 +18,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] [SuppressMessage("ReSharper", "ParameterHidesMember", Justification = SuppressReasons.MatchesOriginal)] [SuppressMessage("ReSharper", "PossibleLossOfFraction", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class GameLocationFacade : GameLocation, IRewriteFacade { @@ -26,7 +27,7 @@ public class GameLocationFacade : GameLocation, IRewriteFacade *********/ public NetCollection getCharacters() { - return this.characters; + return base.characters; } public virtual int getExtraMillisecondsPerInGameMinuteForThisLocation() @@ -36,17 +37,17 @@ public virtual int getExtraMillisecondsPerInGameMinuteForThisLocation() public int getNumberBuildingsConstructed(string name) { - return base.getNumberBuildingsConstructed(name, false); + return base.getNumberBuildingsConstructed(name, includeUnderConstruction: false); } public string GetSeasonForLocation() { - return this.GetSeasonKey(); + return base.GetSeasonKey(); } public bool isTileLocationOpenIgnoreFrontLayers(Location tile) { - return this.map.RequireLayer("Buildings").Tiles[tile.X, tile.Y] == null && !this.isWaterTile(tile.X, tile.Y); + return base.map.RequireLayer("Buildings").Tiles[tile.X, tile.Y] == null && !base.isWaterTile(tile.X, tile.Y); } public bool isTileLocationTotallyClearAndPlaceable(int x, int y) @@ -57,18 +58,18 @@ public bool isTileLocationTotallyClearAndPlaceable(int x, int y) public bool isTileLocationTotallyClearAndPlaceable(Vector2 v) { Vector2 pixel = new Vector2((v.X * Game1.tileSize) + Game1.tileSize / 2, (v.Y * Game1.tileSize) + Game1.tileSize / 2); - foreach (Furniture f in this.furniture) + foreach (Furniture f in base.furniture) { if (f.furniture_type != Furniture.rug && !f.isPassable() && f.GetBoundingBox().Contains((int)pixel.X, (int)pixel.Y) && !f.AllowPlacementOnThisTile((int)v.X, (int)v.Y)) return false; } - return this.isTileOnMap(v) && !this.isTileOccupied(v) && this.isTilePassable(new Location((int)v.X, (int)v.Y), Game1.viewport) && base.isTilePlaceable(v); + return base.isTileOnMap(v) && !this.isTileOccupied(v) && base.isTilePassable(new Location((int)v.X, (int)v.Y), Game1.viewport) && base.isTilePlaceable(v); } public bool isTileLocationTotallyClearAndPlaceableIgnoreFloors(Vector2 v) { - return this.isTileOnMap(v) && !this.isTileOccupiedIgnoreFloors(v) && this.isTilePassable(new Location((int)v.X, (int)v.Y), Game1.viewport) && base.isTilePlaceable(v); + return base.isTileOnMap(v) && !this.isTileOccupiedIgnoreFloors(v) && base.isTilePassable(new Location((int)v.X, (int)v.Y), Game1.viewport) && base.isTilePlaceable(v); } public bool isTileOccupied(Vector2 tileLocation, string characterToIgnore = "", bool ignoreAllCharacters = false) diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/JunimoHutFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/JunimoHutFacade.cs index d23439189..db6ff7b88 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/JunimoHutFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/JunimoHutFacade.cs @@ -12,13 +12,14 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class JunimoHutFacade : JunimoHut, IRewriteFacade { /********* ** Accessors *********/ - public NetRef output => NetRefWrapperCache.GetCachedWrapperFor(this.GetBuildingChest("Output")); + public NetRef output => NetRefWrapperCache.GetCachedWrapperFor(base.GetBuildingChest("Output")); /********* diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/NpcFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/NpcFacade.cs index 0ddbb7394..28e901025 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/NpcFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/NpcFacade.cs @@ -11,6 +11,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public abstract class NpcFacade : NPC, IRewriteFacade { @@ -21,19 +22,19 @@ public bool isBirthday(string season, int day) { // call new method if possible if (season == Game1.currentSeason && day == Game1.dayOfMonth) - return this.isBirthday(); + return base.isBirthday(); // else replicate old behavior return - this.Birthday_Season != null - && this.Birthday_Season == season - && this.Birthday_Day == day; + base.Birthday_Season != null + && base.Birthday_Season == season + && base.Birthday_Day == day; } public void showTextAboveHead(string Text, int spriteTextColor = -1, int style = NPC.textStyle_none, int duration = 3000, int preTimer = 0) { Color? color = spriteTextColor != -1 ? SpriteText.getColorFromIndex(spriteTextColor) : null; - this.showTextAboveHead(Text, color, style, duration, preTimer); + base.showTextAboveHead(Text, color, style, duration, preTimer); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ObjectFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ObjectFacade.cs index c61c9f994..4b6fa2254 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ObjectFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ObjectFacade.cs @@ -39,7 +39,7 @@ public static SObject Constructor(Vector2 tileLocation, int parentSheetIndex, in public static SObject Constructor(Vector2 tileLocation, int parentSheetIndex, string? Givenname, bool canBeSetDown, bool canBeGrabbed, bool isHoedirt, bool isSpawnedObject) { - SObject obj = new SObject(parentSheetIndex.ToString(), 1); + SObject obj = new(parentSheetIndex.ToString(), 1); if (Givenname != null && obj.name is (null or "Error Item")) obj.name = Givenname; @@ -54,12 +54,12 @@ public static SObject Constructor(Vector2 tileLocation, int parentSheetIndex, st public void ApplySprinkler(GameLocation location, Vector2 tile) { - this.ApplySprinkler(tile); + base.ApplySprinkler(tile); } public void DayUpdate(GameLocation location) { - this.DayUpdate(); + base.DayUpdate(); } public Rectangle getBoundingBox(Vector2 tileLocation) @@ -69,32 +69,32 @@ public Rectangle getBoundingBox(Vector2 tileLocation) public bool isForage(GameLocation location) { - return this.isForage(); + return base.isForage(); } public bool minutesElapsed(int minutes, GameLocation environment) { - return this.minutesElapsed(minutes); + return base.minutesElapsed(minutes); } public bool onExplosion(Farmer who, GameLocation location) { - return this.onExplosion(who); + return base.onExplosion(who); } public void performRemoveAction(Vector2 tileLocation, GameLocation environment) { - this.performRemoveAction(); + base.performRemoveAction(); } public bool performToolAction(Tool t, GameLocation location) { - return this.performToolAction(t); + return base.performToolAction(t); } public void updateWhenCurrentLocation(GameTime time, GameLocation environment) { - this.updateWhenCurrentLocation(time); + base.updateWhenCurrentLocation(time); } diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ResourceClumpFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ResourceClumpFacade.cs index 355147f3a..bd2567eed 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ResourceClumpFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/ResourceClumpFacade.cs @@ -10,13 +10,14 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = SuppressReasons.MatchesOriginal)] + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class ResourceClumpFacade : ResourceClump, IRewriteFacade { /********* ** Public methods *********/ - public NetVector2 tile => this.netTile; + public NetVector2 tile => base.netTile; /********* diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/WorldDateFacade.cs b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/WorldDateFacade.cs index f91490707..43fdcd9a7 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/WorldDateFacade.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/WorldDateFacade.cs @@ -8,6 +8,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6 { /// Maps Stardew Valley 1.5.6's methods to their newer form to avoid breaking older mods. /// This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on for more info. + [SuppressMessage("ReSharper", "RedundantBaseQualifier", Justification = SuppressReasons.BaseForClarity)] [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = SuppressReasons.UsedViaRewriting)] public class WorldDateFacade : WorldDate, IRewriteFacade { @@ -16,8 +17,8 @@ public class WorldDateFacade : WorldDate, IRewriteFacade *********/ public new string Season { - get => this.SeasonKey; - set => this.SeasonKey = value; + get => base.SeasonKey; + set => base.SeasonKey = value; }