Migrate to Harmony2

This commit is contained in:
ZaneYork 2020-05-29 14:12:08 +08:00
parent 872e463d92
commit 468b88fa85
25 changed files with 7 additions and 943 deletions

View File

@ -1,6 +1,6 @@
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
public class DialogueBoxMethods : DialogueBox
{

View File

@ -5,7 +5,7 @@ using System.Text;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
public class DiscreteColorPickerMethods : DiscreteColorPicker
{

View File

@ -2,7 +2,7 @@ using System.Diagnostics.CodeAnalysis;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
namespace StardewModdingAPI.Framework.RewriteFacades
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
public class FarmerMethods : Farmer
{

View File

@ -3,7 +3,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
namespace StardewModdingAPI.Framework.RewriteFacades
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
public class FarmerRendererMethods : FarmerRenderer
{

View File

@ -1,6 +1,6 @@
using StardewValley;
namespace StardewModdingAPI.Framework.RewriteFacades
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
public class GameLocationMethods : GameLocation
{

View File

@ -3,7 +3,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
namespace StardewModdingAPI.Framework.RewriteFacades
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
public class HUDMessageMethods : HUDMessage
{

View File

@ -4,7 +4,7 @@ using Microsoft.Xna.Framework.Graphics;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
{
public class MapPageMethods : MapPage
{

View File

@ -1,78 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class AnimalQueryMenuMethods : AnimalQueryMenu
{
public AnimalQueryMenuMethods(FarmAnimal animal) : base(animal)
{
}
public ClickableTextureComponent AllowReproductionButtonProp
{
get
{
if (this.allowReproductionButton != null)
{
return new ClickableTextureComponent(this.allowReproductionButton.bounds, Game1.mouseCursors, new Rectangle(0x80, 0x189, 9, 9), this.allowReproductionButton.scale, false);
}
return null;
}
set
{
if (value != null)
{
this.allowReproductionButton = new ClickableComponent(value.bounds, "reproButton");
}
this.allowReproductionButton = null;
}
}
public ClickableTextureComponent SellButtonProp
{
get
{
if (this.sellButton != null)
{
return new ClickableTextureComponent(this.sellButton.bounds, Game1.mouseCursors, new Rectangle(0, 0x180, 0x10, 0x10), this.sellButton.scale, false);
}
return null;
}
set
{
if (value != null)
{
this.sellButton = new ClickableComponent(value.bounds, "sellButton");
}
this.sellButton = null;
}
}
public ClickableTextureComponent MoveHomeButtonProp
{
get
{
if (this.moveHomeButton != null)
{
return new ClickableTextureComponent(this.moveHomeButton.bounds, Game1.mouseCursors, new Rectangle(0x10, 0x180, 0x10, 0x10), this.moveHomeButton.scale, false);
}
return null;
}
set
{
if (value != null)
{
this.moveHomeButton = new ClickableComponent(value.bounds, "moveHomeButton");
}
this.moveHomeButton = null;
}
}
}
}

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StardewValley;
using StardewValley.Menus;
using StardewValley.Objects;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class CraftingPageMobileMethods : CraftingPageMobile
{
public CraftingPageMobileMethods(int x, int y, int width, int height, bool cooking = false, bool standalone_menu = false, List<Chest> material_containers = null)
: base(x, y, width, height, cooking, 300, material_containers)
{
}
}
}

View File

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class DayTimeMoneyBoxMethods : DayTimeMoneyBox
{
public void drawMoneyBox(SpriteBatch b, int overrideX = -1, int overrideY = -1)
{
base.drawMoneyBox(b, overrideX, overrideY);
}
}
}

View File

@ -1,83 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using StardewValley;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class DebrisMethods : Debris
{
public DebrisMethods(Item item, Vector2 debrisOrigin)
: base()
{
base.init(item, debrisOrigin);
}
public DebrisMethods(int objectIndex, Vector2 debrisOrigin, Vector2 playerPosition)
: base()
{
base.init(objectIndex, debrisOrigin, playerPosition);
}
public DebrisMethods(Item item, Vector2 debrisOrigin, Vector2 targetLocation)
: base()
{
base.init(item, debrisOrigin, targetLocation);
}
public DebrisMethods(string spriteSheet, int numberOfChunks, Vector2 debrisOrigin)
: base()
{
base.init(spriteSheet, numberOfChunks, debrisOrigin);
}
public DebrisMethods(string spriteSheet, Rectangle sourceRect, int numberOfChunks, Vector2 debrisOrigin)
: base()
{
base.init(spriteSheet, sourceRect, numberOfChunks, debrisOrigin);
}
public DebrisMethods(int debrisType, int numberOfChunks, Vector2 debrisOrigin, Vector2 playerPosition)
: base()
{
base.init(debrisType, numberOfChunks, debrisOrigin, playerPosition);
}
public DebrisMethods(int number, Vector2 debrisOrigin, Color messageColor, float scale, Character toHover)
: base()
{
base.init(number, debrisOrigin, messageColor, scale, toHover);
}
public DebrisMethods(int debrisType, int numberOfChunks, Vector2 debrisOrigin, Vector2 playerPosition, float velocityMultiplayer)
: base()
{
base.init(debrisType, numberOfChunks, debrisOrigin, playerPosition, velocityMultiplayer);
}
public DebrisMethods(string message, int numberOfChunks, Vector2 debrisOrigin, Color messageColor, float scale, float rotation)
: base()
{
base.init(message, numberOfChunks, debrisOrigin, messageColor, scale, rotation);
}
public DebrisMethods(string spriteSheet, Rectangle sourceRect, int numberOfChunks, Vector2 debrisOrigin, Vector2 playerPosition, int groundLevel)
: base()
{
base.init(spriteSheet, sourceRect, numberOfChunks, debrisOrigin, playerPosition, groundLevel);
}
public DebrisMethods(int type, int numberOfChunks, Vector2 debrisOrigin, Vector2 playerPosition, int groundLevel, int color = -1)
: base()
{
base.init(type, numberOfChunks, debrisOrigin, playerPosition, groundLevel, color);
}
public DebrisMethods(string spriteSheet, Rectangle sourceRect, int numberOfChunks, Vector2 debrisOrigin, Vector2 playerPosition, int groundLevel, int sizeOfSourceRectSquares)
: base()
{
base.init(spriteSheet, sourceRect, numberOfChunks, debrisOrigin, playerPosition, groundLevel, sizeOfSourceRectSquares);
}
}
}

View File

@ -1,120 +0,0 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class Game1Methods : Game1
{
public static RainDrop[] rainDrops => (typeof(RainManager).GetField("_rainDropList", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(RainManager.Instance) as List<RainDrop>).ToArray();
public static new IList<IClickableMenu> onScreenMenus => Game1.onScreenMenus;
public static bool IsRainingProp
{
get
{
return RainManager.Instance.isRaining;
}
set
{
RainManager.Instance.isRaining = value;
}
}
public static bool IsSnowingProp
{
get
{
return WeatherDebrisManager.Instance.isSnowing;
}
set
{
WeatherDebrisManager.Instance.isSnowing = value;
}
}
public static bool IsDebrisWeatherProp
{
get
{
return WeatherDebrisManager.Instance.isDebrisWeather;
}
set
{
WeatherDebrisManager.Instance.isDebrisWeather = value;
}
}
public static void updateDebrisWeatherForMovement(List<WeatherDebris> debris)
{
WeatherDebrisManager.Instance.UpdateDebrisWeatherForMovement();
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new string parseText(string text, SpriteFont whichFont, int width)
{
return parseText(text, whichFont, width, 1);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void warpFarmer(LocationRequest locationRequest, int tileX, int tileY, int facingDirectionAfterWarp)
{
warpFarmer(locationRequest, tileX, tileY, facingDirectionAfterWarp, true, false);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void warpFarmer(string locationName, int tileX, int tileY, bool flip)
{
warpFarmer(locationName, tileX, tileY, flip ? ((player.FacingDirection + 2) % 4) : player.FacingDirection);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void warpFarmer(string locationName, int tileX, int tileY, int facingDirectionAfterWarp)
{
warpFarmer(locationName, tileX, tileY, facingDirectionAfterWarp, false, true, false);
}
public static void panScreen(int x, int y)
{
panScreen(x, y, 0);
}
public static void removeSquareDebrisFromTile(int tileX, int tileY)
{
Game1.currentLocation.debris.debrisNetCollection.Filter(debris => {
if ((debris.debrisType == 2) && (((int)(debris.Chunks[0].position.X / 64f)) == tileX))
{
return (debris.chunkFinalYLevel / 0x40) != tileY;
}
return true;
});
}
public static void randomizeDebrisWeatherPositions(List<WeatherDebris> debris)
{
if (debris != null)
{
using (List<WeatherDebris>.Enumerator enumerator = debris.GetEnumerator())
{
while (enumerator.MoveNext())
{
enumerator.Current.position = Utility.getRandomPositionOnScreen();
}
}
}
}
public static new void createItemDebris(Item item, Vector2 origin, int direction, GameLocation location = null, int groundLevel = -1)
{
Game1.createItemDebris(item, origin, direction, location, groundLevel);
}
public static void changeMusicTrack(string newTrackName)
{
Game1.changeMusicTrack(newTrackName, false, MusicContext.Default);
}
}
}

View File

@ -1,32 +0,0 @@
using System.Reflection;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class GameMenuMethods : GameMenu
{
public string HoverTextProp
{
get
{
return (string)typeof(GameMenu).GetField("hoverText", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(this);
}
set
{
typeof(GameMenu).GetField("hoverText", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public GameMenuMethods(bool playOpeningSound = true) : base()
{
}
public GameMenuMethods(int startingTab, int extra = -1, bool playOpeningSound = true) : base(startingTab, extra)
{
}
public void changeTab(int whichTab, bool playSound = true)
{
base.changeTab(whichTab);
}
}
}

View File

@ -1,27 +0,0 @@
using System.Reflection;
using System.Reflection.Emit;
using Harmony;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class HarmonyInstanceMethods
{
public static DynamicMethod Patch(HarmonyInstance instance, MethodBase original, HarmonyMethod prefix = null, HarmonyMethod postfix = null, HarmonyMethod transpiler = null)
{
if (Constants.MonoModInit)
return instance.Patch(original, prefix, postfix, transpiler);
else
return null;
}
public static void PatchAll(HarmonyInstance instance)
{
if (Constants.MonoModInit)
instance.PatchAll();
}
public static void PatchAllToAssembly(HarmonyInstance instance, Assembly assembly)
{
if (Constants.MonoModInit)
instance.PatchAll(assembly);
}
}
}

View File

@ -1,61 +0,0 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class IClickableMenuMethods : IClickableMenu
{
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void drawHoverText(SpriteBatch b, string text, SpriteFont font, int xOffset = 0, int yOffset = 0, int moneyAmounttoDisplayAtBottom = -1, string boldTitleText = null, int healAmountToDisplay = -1, string[] buffIconsToDsiplay = null, Item hoveredItem = null, int currencySymbol = 0, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1, int overideX = -1, int overrideY = -1, float alpha = 1, CraftingRecipe craftingIngrediants = null, IList<Item> additional_craft_materials = null)
{
drawHoverText(b, text, font, xOffset, yOffset, moneyAmounttoDisplayAtBottom, boldTitleText, healAmountToDisplay, buffIconsToDsiplay, hoveredItem, currencySymbol, extraItemToShowIndex, extraItemToShowAmount, overideX, overrideY, alpha, craftingIngrediants, -1, 80, -1, additional_craft_materials);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void drawTextureBox(SpriteBatch b, Texture2D texture, Microsoft.Xna.Framework.Rectangle sourceRect, int x, int y, int width, int height, Color color)
{
drawTextureBox(b, texture, sourceRect, x, y, width, height, color, 1, true, false);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void drawTextureBox(SpriteBatch b, Texture2D texture, Microsoft.Xna.Framework.Rectangle sourceRect, int x, int y, int width, int height, Color color, float scale)
{
drawTextureBox(b, texture, sourceRect, x, y, width, height, color, scale, true, false);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void drawTextureBox(SpriteBatch b, Texture2D texture, Microsoft.Xna.Framework.Rectangle sourceRect, int x, int y, int width, int height, Color color, float scale, bool drawShadow)
{
drawTextureBox(b, texture, sourceRect, x, y, width, height, color, scale, drawShadow, false);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public new void drawHorizontalPartition(SpriteBatch b, int yPosition, bool small = false, int red = -1, int green = -1, int blue = -1)
{
base.drawMobileHorizontalPartition(b, 0, yPosition, 64, small);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public new void drawVerticalUpperIntersectingPartition(SpriteBatch b, int xPosition, int partitionHeight, int red = -1, int green = -1, int blue = -1)
{
base.drawVerticalUpperIntersectingPartition(b, xPosition, partitionHeight);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public new void drawVerticalIntersectingPartition(SpriteBatch b, int xPosition, int yPosition, int red = -1, int green = -1, int blue = -1)
{
base.drawVerticalIntersectingPartition(b, xPosition, yPosition);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public new void drawVerticalPartition(SpriteBatch b, int xPosition, bool small = false, int red = -1, int green = -1, int blue = -1)
{
base.drawVerticalPartition(b, xPosition, small);
}
}
}

View File

@ -1,68 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class InventoryMenuMethods : InventoryMenu
{
public InventoryMenuMethods(int xPosition, int yPosition, bool playerInventory, IList<Item> actualInventory = null, highlightThisItem highlightMethod = null,
int capacity = -1, int rows = 3, int horizontalGap = 0, int verticalGap = 0, bool drawSlots = true)
: base(xPosition, yPosition, playerInventory, actualInventory, highlightMethod, capacity, rows, horizontalGap, verticalGap, drawSlots)
{
}
public Item rightClick(int x, int y, Item toAddTo, bool playSound = true, bool onlyCheckToolAttachments = false)
{
return base.rightClick(x, y, toAddTo, playSound);
}
public List<ClickableComponent> GetBorder(BorderSide side)
{
List<ClickableComponent> clickableComponentList = new List<ClickableComponent>();
int num = this.capacity / this.rows;
switch (side)
{
case BorderSide.Top:
for (int index = 0; index < this.inventory.Count; ++index)
{
if (index < num)
clickableComponentList.Add(this.inventory[index]);
}
break;
case BorderSide.Left:
for (int index = 0; index < this.inventory.Count; ++index)
{
if (index % num == 0)
clickableComponentList.Add(this.inventory[index]);
}
break;
case BorderSide.Right:
for (int index = 0; index < this.inventory.Count; ++index)
{
if (index % num == num - 1)
clickableComponentList.Add(this.inventory[index]);
}
break;
case BorderSide.Bottom:
for (int index = 0; index < this.inventory.Count; ++index)
{
if (index >= this.actualInventory.Count - num)
clickableComponentList.Add(this.inventory[index]);
}
break;
}
return clickableComponentList;
}
public enum BorderSide
{
Top,
Left,
Right,
Bottom,
}
}
}

View File

@ -1,106 +0,0 @@
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class ItemGrabMenuMethods : ItemGrabMenu
{
public ClickableTextureComponent FillStacksButtonProp
{
get
{
ClickableTextureComponent textureComponent1 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - 64 - 64 - 16, 64, 64), "", Game1.content.LoadString("Strings\\UI:ItemGrab_FillStacks"), Game1.mouseCursors, new Rectangle(103, 469, 16, 16), 4f, false);
textureComponent1.myID = 12952;
textureComponent1.upNeighborID = this.colorPickerToggleButton != null ? 27346 : (this.specialButton != null ? 12485 : -500);
textureComponent1.downNeighborID = 106;
textureComponent1.leftNeighborID = 53921;
textureComponent1.region = 15923;
return textureComponent1;
}
set
{
}
}
public ItemGrabMenuMethods(IList<Item> inventory, bool reverseGrab, bool showReceivingMenu, InventoryMenu.highlightThisItem highlightFunction, ItemGrabMenu.behaviorOnItemSelect behaviorOnItemSelectFunction, string message, ItemGrabMenu.behaviorOnItemSelect behaviorOnItemGrab = null, bool snapToBottom = false, bool canBeExitedWithKey = false, bool playRightClickSound = true, bool allowRightClick = true, bool showOrganizeButton = false, int source = 0, Item sourceItem = null, int whichSpecialButton = -1, object context = null)
: base(inventory, reverseGrab, showReceivingMenu, highlightFunction, behaviorOnItemSelectFunction, message, behaviorOnItemGrab, snapToBottom, canBeExitedWithKey, playRightClickSound, allowRightClick, showOrganizeButton, source, sourceItem, whichSpecialButton, context, -1, 3, null, true, null, false, null)
{ }
public ItemGrabMenuMethods(IList<Item> inventory, object context = null)
: base(inventory) { }
public void FillOutStacks()
{
for (int index1 = 0; index1 < this.ItemsToGrabMenu.actualInventory.Count; ++index1)
{
Item obj1 = this.ItemsToGrabMenu.actualInventory[index1];
if (obj1 != null && obj1.maximumStackSize() > 1)
{
for (int index2 = 0; index2 < this.inventory.actualInventory.Count; ++index2)
{
Item stack1 = this.inventory.actualInventory[index2];
if (stack1 != null && obj1.canStackWith((ISalable)stack1))
{
//this._transferredItemSprites.Add(new ItemGrabMenu.TransferredItemSprite(stack1.getOne(), this.inventory.inventory[index2].bounds.X, this.inventory.inventory[index2].bounds.Y));
int stack2 = stack1.Stack;
if (obj1.getRemainingStackSpace() > 0)
{
stack2 = obj1.addToStack(stack1);
//this.ItemsToGrabMenu.ShakeItem(obj1);
}
int stack3;
for (stack1.Stack = stack2; stack1.Stack > 0; stack1.Stack = stack3)
{
Item obj2 = (Item)null;
if (Utility.canItemBeAddedToThisInventoryList(obj1.getOne(), this.ItemsToGrabMenu.actualInventory, this.ItemsToGrabMenu.capacity))
{
if (obj2 == null)
{
for (int index3 = 0; index3 < this.ItemsToGrabMenu.actualInventory.Count; ++index3)
{
if (this.ItemsToGrabMenu.actualInventory[index3] != null && this.ItemsToGrabMenu.actualInventory[index3].canStackWith((ISalable)obj1) && this.ItemsToGrabMenu.actualInventory[index3].getRemainingStackSpace() > 0)
{
obj2 = this.ItemsToGrabMenu.actualInventory[index3];
break;
}
}
}
if (obj2 == null)
{
for (int index3 = 0; index3 < this.ItemsToGrabMenu.actualInventory.Count; ++index3)
{
if (this.ItemsToGrabMenu.actualInventory[index3] == null)
{
obj2 = this.ItemsToGrabMenu.actualInventory[index3] = obj1.getOne();
obj2.Stack = 0;
break;
}
}
}
if (obj2 == null && this.ItemsToGrabMenu.actualInventory.Count < this.ItemsToGrabMenu.capacity)
{
obj2 = obj1.getOne();
this.ItemsToGrabMenu.actualInventory.Add(obj2);
}
if (obj2 != null)
{
stack3 = obj2.addToStack(stack1);
//this.ItemsToGrabMenu.ShakeItem(obj2);
}
else
break;
}
else
break;
}
if (stack1.Stack == 0)
this.inventory.actualInventory[index2] = (Item)null;
}
}
}
}
}
}
}

View File

@ -1,36 +0,0 @@
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class MenuWithInventoryMethods : MenuWithInventory
{
public ClickableTextureComponent TrashCanProp
{
get
{
return new ClickableTextureComponent(new Rectangle((base.xPositionOnScreen + base.width) + 4, ((((base.yPositionOnScreen + base.height) - 0xc0) - 0x20) - IClickableMenu.borderWidth) - 0x68, 0x40, 0x68), Game1.mouseCursors, new Rectangle(0x234 + (Game1.player.trashCanLevel * 0x12), 0x66, 0x12, 0x1a), 4f, false)
{
myID = 0x173c,
downNeighborID = 0x12f9,
leftNeighborID = 12,
upNeighborID = 0x6a
};
}
set
{
}
}
public MenuWithInventoryMethods(InventoryMenu.highlightThisItem highlighterMethod = null, bool okButton = false, bool trashCan = false, int inventoryXOffset = 0, int inventoryYOffset = 0, int menuOffsetHack = 0) : base(highlighterMethod, okButton, trashCan, inventoryXOffset, inventoryYOffset)
{
}
public virtual void draw(SpriteBatch b, bool drawUpperPortion = true, bool drawDescriptionArea = true, int red = -1, int green = -1, int blue = -1)
{
base.draw(b);
base.draw(b, red, green, blue);
}
}
}

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StardewValley;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class NPCMethods : NPC
{
public void reloadSprite()
{
base.reloadSprite(Game1.emergencyLoading);
}
public void checkSchedule(int timeOfDay)
{
base.checkSchedule(timeOfDay, Game1.emergencyLoading);
}
}
}

View File

@ -1,13 +0,0 @@
using System.Collections.Generic;
using StardewValley;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class SaveGameMethods : SaveGame
{
public static IEnumerator<int> Save()
{
return SaveGame.Save(false, false);
}
}
}

View File

@ -1,93 +0,0 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using StardewValley;
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class ShopMenuMethods : ShopMenu
{
public ISalable HeldItemProp
{
get
{
return (ISalable)typeof(ShopMenu).GetField("heldItem", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(this);
}
set
{
typeof(ShopMenu).GetField("heldItem", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public ISalable HoveredItemProp
{
get
{
return (ISalable)typeof(ShopMenu).GetField("hoveredItem", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(this);
}
set
{
typeof(ShopMenu).GetField("hoveredItem", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public int HoverPriceProp
{
get
{
return (int)typeof(ShopMenu).GetField("hoverPrice", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(this);
}
set
{
typeof(ShopMenu).GetField("hoverPrice", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public string HoverTextProp
{
get
{
return (string)typeof(ShopMenu).GetField("hoverText", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(this);
}
set
{
typeof(ShopMenu).GetField("hoverText", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public List<int> CategoriesToSellHereProp
{
get
{
return (List<int>)typeof(ShopMenu).GetField("categoriesToSellHere", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(this);
}
set
{
typeof(ShopMenu).GetField("categoriesToSellHere", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public Dictionary<ISalable, int[]> ItemPriceAndStockProp
{
get
{
return (Dictionary<ISalable, int[]>)typeof(ShopMenu).GetField("itemPriceAndStock", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(this);
}
set
{
typeof(ShopMenu).GetField("itemPriceAndStock", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public List<ISalable> ForSaleProp
{
get
{
return (List<ISalable>)typeof(ShopMenu).GetField("forSale", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(this);
}
set
{
typeof(ShopMenu).GetField("forSale", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public ShopMenuMethods(Dictionary<ISalable, int[]> itemPriceAndStock, int currency = 0, string who = null, Func<ISalable, Farmer, int, bool> on_purchase = null, Func<ISalable, bool> on_sell = null, string context = null) : base(itemPriceAndStock, currency, who, on_purchase, on_sell, context)
{
}
}
}

View File

@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using StardewValley.BellsAndWhistles;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class SpriteTextMethods : SpriteText
{
public new static int getWidthOfString(string s, int widthConstraint = 999999)
{
return SpriteText.getWidthOfString(s);
}
public new static void drawStringHorizontallyCenteredAt(SpriteBatch b, string s, int x, int y, int characterPosition = 999999, int width = -1, int height = 999999, float alpha = -1f, float layerDepth = 0.088f, bool junimoText = false, int color = -1, int maxWdith = 99999)
{
SpriteText.drawString(b, s, x - SpriteText.getWidthOfString(s) / 2, y, characterPosition, width, height, alpha, layerDepth, junimoText, -1, "", color);
}
public static void drawStringWithScrollBackground(SpriteBatch b, string s, int x, int y, string placeHolderWidthText = "", float alpha = 1f, int color = -1, SpriteText.ScrollTextAlignment scroll_text_alignment = SpriteText.ScrollTextAlignment.Left)
{
SpriteText.drawString(b, s, x, y, 999999, -1, 999999, alpha, 0.088f, false, 0, placeHolderWidthText, color, scroll_text_alignment);
}
public static void drawStringWithScrollBackground(SpriteBatch b, string s, int x, int y, string placeHolderWidthText, float alpha, int color)
{
SpriteText.drawStringWithScrollBackground(b, s, x, y, placeHolderWidthText, alpha, color, 0.088f);
}
}
}

View File

@ -1,27 +0,0 @@
using System.Reflection;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley.Menus;
#pragma warning disable 1591 // missing documentation
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class TextBoxMethods : TextBox
{
public static void SelectedSetter(TextBox textBox, bool value)
{
if(!textBox.Selected && value)
{
typeof(TextBox).GetMethod("ShowAndroidKeyboard", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(textBox, new object[] { });
textBox.Selected = value;
}
else
textBox.Selected = value;
}
public TextBoxMethods(Texture2D textboxTexture, Texture2D caretTexture, SpriteFont font, Color textColor)
: base(textboxTexture, caretTexture, font, textColor, true, false)
{
}
}
}

View File

@ -1,86 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using StardewValley;
using StardewValley.Locations;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class UtilityMethods : Utility
{
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void trashItem(Item item)
{
trashItem(item, -1);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new int getTrashReclamationPrice(Item item, Farmer player)
{
return getTrashReclamationPrice(item, player, -1);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static int getRandomItemFromSeason(string season, int randomSeedAddition, bool forQuest, bool changeDaily = true)
{
Random random = new Random((int)Game1.uniqueIDForThisGame + (changeDaily ? (int)Game1.stats.DaysPlayed : 0) + randomSeedAddition);
List<int> source = new List<int>() { 68, 66, 78, 80, 86, 152, 167, 153, 420 };
List<string> stringList1 = new List<string>(Game1.player.craftingRecipes.Keys);
List<string> stringList2 = new List<string>(Game1.player.cookingRecipes.Keys);
if (forQuest)
{
stringList1 = Utility.GetAllPlayerUnlockedCraftingRecipes();
stringList2 = Utility.GetAllPlayerUnlockedCookingRecipes();
}
if (forQuest && (MineShaft.lowestLevelReached > 40 || Utility.GetAllPlayerDeepestMineLevel() >= 1) || !forQuest && (Game1.player.deepestMineLevel > 40 || Game1.player.timesReachedMineBottom >= 1))
source.AddRange(new int[5] { 62, 70, 72, 84, 422 });
if (forQuest && (MineShaft.lowestLevelReached > 80 || Utility.GetAllPlayerDeepestMineLevel() >= 1) || !forQuest && (Game1.player.deepestMineLevel > 80 || Game1.player.timesReachedMineBottom >= 1))
source.AddRange(new int[3] { 64, 60, 82 });
if (Utility.doesAnyFarmerHaveMail("ccVault"))
source.AddRange(new int[4] { 88, 90, 164, 165 });
if (stringList1.Contains("Furnace"))
source.AddRange(new int[4] { 334, 335, 336, 338 });
if (stringList1.Contains("Quartz Globe"))
source.Add(339);
if (season.Equals("spring"))
source.AddRange(new int[17] { 0x10, 0x12, 20, 0x16, 0x81, 0x83, 0x84, 0x88, 0x89, 0x8e, 0x8f, 0x91, 0x93, 0x94, 0x98, 0xa7, 0x10b });
else if (season.Equals("summer"))
source.AddRange(new int[] { 0x80, 130, 0x84, 0x88, 0x8a, 0x8e, 0x90, 0x91, 0x92, 0x95, 150, 0x9b, 0x18c, 0x18e, 0x192, 0x10b });
else if (season.Equals("fall"))
source.AddRange(new int[] { 0x194, 0x196, 0x198, 410, 0x81, 0x83, 0x84, 0x88, 0x89, 0x8b, 140, 0x8e, 0x8f, 0x94, 150, 0x9a, 0x9b, 0x10d });
else if (season.Equals("winter"))
source.AddRange(new int[] { 0x19c, 0x19e, 0x1a0, 0x1a2, 130, 0x83, 0x84, 0x88, 140, 0x8d, 0x90, 0x92, 0x93, 150, 0x97, 0x9a, 0x10d });
if (forQuest)
{
foreach (string key in stringList2)
{
if (random.NextDouble() >= 0.4)
{
List<int> intList = Utility.possibleCropsAtThisTime(Game1.currentSeason, Game1.dayOfMonth <= 7);
Dictionary<string, string> dictionary = Game1.content.Load<Dictionary<string, string>>("Data//CookingRecipes");
if (dictionary.ContainsKey(key))
{
string[] strArray = dictionary[key].Split('/')[0].Split(' ');
bool flag = true;
for (int index = 0; index < strArray.Length; ++index)
{
MethodInfo isCategoryIngredientAvailable = typeof(Utility).GetMethod("isCategoryIngredientAvailable", BindingFlags.NonPublic | BindingFlags.Static);
if (!source.Contains(Convert.ToInt32(strArray[index]))
&& !(bool)isCategoryIngredientAvailable.Invoke(null, new object[] { Convert.ToInt32(strArray[index]) })
&& (intList == null || !intList.Contains(Convert.ToInt32(strArray[index]))))
{
flag = false;
break;
}
}
if (flag)
source.Add(Convert.ToInt32(dictionary[key].Split('/')[2]));
}
}
}
}
return source[random.Next(source.Count)];
}
}
}

View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using StardewValley;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class WeatherDebrisMethods : WeatherDebris
{
public WeatherDebrisMethods(Vector2 position, int which, float rotationVelocity, float dx, float dy)
: base(position, which, dx, dy)
{
}
}
}