Skip to content

Commit

Permalink
Massive github sync Commit, fear the mess!
Browse files Browse the repository at this point in the history
  • Loading branch information
Entoarox committed Feb 5, 2020
1 parent 339b023 commit 1f51a3c
Show file tree
Hide file tree
Showing 116 changed files with 4,040 additions and 721 deletions.
11 changes: 5 additions & 6 deletions AdvancedLocationLoader/Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static void Shop(Farmer who, string[] arguments, Vector2 tile)
{
if (!ModEntry.PatchData.Shops.Any(p => p.Name == arguments[0]))
{
Game1.activeClickableMenu = new ShopMenu(new List<Item>());
Game1.activeClickableMenu = new ShopMenu(new Dictionary<ISalable, int[]>());
ModEntry.Logger.Log("Unable to open shop, shop not found: " + arguments[0], LogLevel.Error);
}
else
Expand All @@ -131,11 +131,10 @@ public static void Shop(Farmer who, string[] arguments, Vector2 tile)

if (stock.Count == 0)
ModEntry.Logger.Log("No stock: " + arguments[0] + ", if this is intended this message can be ignored.", LogLevel.Warn);
Game1.activeClickableMenu = new ShopMenu(stock)
{
portraitPerson = portrait,
potraitPersonDialogue = shop.Messages[Actions.Random.Next(shop.Messages.Count)]
};
var menu = new ShopMenu(stock.ToDictionary(_ => _ as ISalable, _ => new int[] { _.Stack }));
menu.portraitPerson = portrait;
menu.potraitPersonDialogue = shop.Messages[Actions.Random.Next(shop.Messages.Count)];
Game1.activeClickableMenu = menu;
}
}
catch (Exception err)
Expand Down
2 changes: 1 addition & 1 deletion AdvancedLocationLoader/AdvancedLocationLoader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0-beta.5" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions AdvancedLocationLoader/ConditionalResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public void Resolver(Farmer who, string answer)
{
if (answer == "n")
return;
if ((this.Conditional.Item == -1 && who.money >= this.Conditional.Amount) || who.hasItemInInventory(this.Conditional.Item, this.Conditional.Amount))
if ((this.Conditional.Item == -1 && who.Money >= this.Conditional.Amount) || who.hasItemInInventory(this.Conditional.Item, this.Conditional.Amount))
{
if (this.Conditional.Item == -1)
who.money -= this.Conditional.Amount;
who.Money -= this.Conditional.Amount;
else
who.removeItemsFromInventory(this.Conditional.Item, this.Conditional.Amount);
who.mailReceived.Add("ALLCondition_" + this.Conditional.Name);
Expand Down
4 changes: 2 additions & 2 deletions AdvancedLocationLoader/Menus/CarpenterMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public override void receiveLeftClick(int x, int y, bool playSound = true)
this.moving = true;
}

if (this.okButton.containsPoint(x, y) && string.IsNullOrEmpty(this.TargetLocation) && Game1.player.money >= this.price && this.blueprints[this.currentBlueprintIndex].doesFarmerHaveEnoughResourcesToBuild())
if (this.okButton.containsPoint(x, y) && string.IsNullOrEmpty(this.TargetLocation) && Game1.player.Money >= this.price && this.blueprints[this.currentBlueprintIndex].doesFarmerHaveEnoughResourcesToBuild())
{
Game1.globalFadeToBlack(this.setUpForBuildingPlacement, 0.02f);
Game1.playSound("smallSelect");
Expand Down Expand Up @@ -486,7 +486,7 @@ public override void draw(SpriteBatch b)
Utility.drawTextWithShadow(b, this.price + "g", Game1.dialogueFont, new Vector2((float)(location.X + Game1.tileSize + Game1.pixelZoom - 1.0), location.Y + Game1.pixelZoom * 2), Game1.textColor * 0.25f, 1f, -1f, -1, -1, this.magicalConstruction ? 0.0f : 0.25f, 3);
}

Utility.drawTextWithShadow(b, this.price + "g", Game1.dialogueFont, new Vector2(location.X + Game1.tileSize + Game1.pixelZoom, location.Y + Game1.pixelZoom), Game1.player.money >= this.price ? this.magicalConstruction ? Color.PaleGoldenrod : Game1.textColor : Color.Red, 1f, -1f, -1, -1, this.magicalConstruction ? 0.0f : 0.25f, 3);
Utility.drawTextWithShadow(b, this.price + "g", Game1.dialogueFont, new Vector2(location.X + Game1.tileSize + Game1.pixelZoom, location.Y + Game1.pixelZoom), Game1.player.Money >= this.price ? this.magicalConstruction ? Color.PaleGoldenrod : Game1.textColor : Color.Red, 1f, -1f, -1, -1, this.magicalConstruction ? 0.0f : 0.25f, 3);
location.X -= Game1.tileSize / 4;
location.Y -= Game1.tileSize / 3;
foreach (Item obj in this.ingredients)
Expand Down
12 changes: 6 additions & 6 deletions AdvancedLocationLoader/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public override void Entry(IModHelper helper)

MoreEvents.ActionTriggered += this.OnActionTriggered;
helper.Events.GameLoop.GameLaunched += this.OnGameLaunched;
helper.Events.Specialised.UnvalidatedUpdateTicked += this.OnUnvalidatedUpdateTick;
helper.Events.Specialized.UnvalidatedUpdateTicked += this.OnUnvalidatedUpdateTick;
helper.Events.Player.Warped += this.OnWarped;

this.Helper.Content.RegisterSerializerType<Greenhouse>();
this.Helper.Content.RegisterSerializerType<Sewer>();
this.Helper.Content.RegisterSerializerType<Desert>();
this.Helper.Content.RegisterSerializerType<DecoratableLocation>();
//this.Helper.Content.RegisterSerializerType<Greenhouse>();
//this.Helper.Content.RegisterSerializerType<Sewer>();
//this.Helper.Content.RegisterSerializerType<Desert>();
//this.Helper.Content.RegisterSerializerType<DecoratableLocation>();
}

internal static void UpdateConditionalEdits()
Expand Down Expand Up @@ -125,7 +125,7 @@ private void OnUnvalidatedUpdateTick(object sender, UnvalidatedUpdateTickedEvent
// wait until game loaded
if (!this.IsSaveLoaded)
return;
this.Helper.Events.Specialised.UnvalidatedUpdateTicked -= this.OnUnvalidatedUpdateTick;
this.Helper.Events.Specialized.UnvalidatedUpdateTicked -= this.OnUnvalidatedUpdateTick;

// apply patcher
this.Patcher.ApplyPatches(out Compound compoundData);
Expand Down
34 changes: 0 additions & 34 deletions AdvancedLocationLoader/Processing/Patcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ public void ApplyPatches(out Compound compoundData)
try
{
NPC.populateRoutesFromLocationToLocationList();
this.VerifyGameIntegrity();
this.Monitor.Log("Patches applied!", LogLevel.Debug);
}
catch (Exception ex)
Expand Down Expand Up @@ -325,38 +324,5 @@ private bool PreprocessTile(TileInfo info, HashSet<string> customLocationNames,

return true;
}

private void VerifyGameIntegrity()
{
string[] seasons = { "spring", "summer", "fall", "winter" };
foreach (GameLocation loc in Game1.locations)
{
if (!loc.IsOutdoors || loc.Name.Equals("Desert"))
continue;

foreach (TileSheet sheet in loc.map.TileSheets)
{
string fileName = Path.GetFileName(sheet.ImageSource);
if (fileName.StartsWith("spring_") || fileName.StartsWith("summer_") || fileName.StartsWith("fall_") || fileName.StartsWith("winter_"))
{
string path = Path.GetDirectoryName(sheet.ImageSource);
if (string.IsNullOrWhiteSpace(path))
path = "Maps";

foreach (string season in seasons)
{
try
{
Game1.content.Load<Texture2D>(Path.Combine(path, $"{season}_{fileName.Split(new[] { '_' }, 2)[1]}"));
}
catch
{
this.Monitor.ExitGameImmediately($"The `{sheet.Id}` (`{sheet.ImageSource}`) tileSheet in the `{loc.Name}` location is seasonal, but ALL can't find the tilesheet for the `{season}` season. This will cause bugs!");
}
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion AdvancedLocationLoader/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name": "Advanced Location Loader",
"Author": "Entoarox",
"Version": "1.5.0",
"Version": "1.5.1",
"Description": "Get your content into stardew without replacing any xnb files.",
"UniqueID": "Entoarox.AdvancedLocationLoader",
"EntryDll": "AdvancedLocationLoader.dll",
Expand Down
2 changes: 1 addition & 1 deletion AdvancedLocationLoader2/AdvancedLocationLoader2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0-beta.5" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions AdvancedLocationLoader2/Structure/Version1/ContentPack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Entoarox.AdvancedLocationLoader2.Structure.Version1
{
class ContentPack
{
#pragma warning disable CS0649
public int Version;
public string[] Includes=new string[0];
public MapFileLink[] Locations = new MapFileLink[0];
Expand All @@ -16,5 +17,6 @@ class ContentPack
public Patch[] Patches = new Patch[0];
public TileEdit[] TileEdits = new TileEdit[0];
public Shop[] Shops = new Shop[0];
#pragma warning restore CS0649
}
}
2 changes: 2 additions & 0 deletions AdvancedLocationLoader2/Structure/Version1/MapFileLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ namespace Entoarox.AdvancedLocationLoader2.Structure.Version1
{
class MapFileLink
{
#pragma warning disable CS0649
public string Conditions;
public string FilePath;
public string MapName;
#pragma warning restore CS0649
}
}
2 changes: 2 additions & 0 deletions AdvancedLocationLoader2/Structure/Version1/Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ namespace Entoarox.AdvancedLocationLoader2.Structure.Version1
{
class Patch : MapFileLink
{
#pragma warning disable CS0649
public int X;
public int Y;
public bool Destructive=true;
public bool Full = true;
#pragma warning restore CS0649
}
}
2 changes: 2 additions & 0 deletions AdvancedLocationLoader2/Structure/Version1/Shop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ namespace Entoarox.AdvancedLocationLoader2.Structure.Version1
{
class Shop
{
#pragma warning disable CS0649
public string ShopId;
public string[] ShopMessages;
public int RestockDelay=0;
public ShopItem[] Items=new ShopItem[0];
#pragma warning restore CS0649
}
}
4 changes: 4 additions & 0 deletions AdvancedLocationLoader2/Structure/Version1/ShopItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ namespace Entoarox.AdvancedLocationLoader2.Structure.Version1
{
class ShopItem
{
#pragma warning disable CS0649
#pragma warning disable CS0169
string ItemName;
int Price;
int Stock=int.MaxValue;
string Conditions;
#pragma warning restore CS0649
#pragma warning restore CS0169
}
}
2 changes: 2 additions & 0 deletions AdvancedLocationLoader2/Structure/Version1/TileEdit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Entoarox.AdvancedLocationLoader2.Structure.Version1
{
class TileEdit
{
#pragma warning disable CS0649
public string MapName;
public int X;
public int Y;
Expand All @@ -16,5 +17,6 @@ class TileEdit
public int? TileIndex;
public Dictionary<string, string> Properties;
public string Conditions;
#pragma warning restore CS0649
}
}
2 changes: 2 additions & 0 deletions AdvancedLocationLoader2/Structure/Version1/Warp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ namespace Entoarox.AdvancedLocationLoader2.Structure.Version1
{
class Warp
{
#pragma warning disable CS0649
public string MapName;
public int FromX;
public int FromY;
public string TargetName;
public string TargetX;
public string TargetY;
#pragma warning restore CS0649
}
}
11 changes: 8 additions & 3 deletions CustomBooks/Book.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,17 @@ public override Item getOne()
return new Book(this.Id);
}

public override int getStack()
public override int Stack
{
return 1;
get => 1;

set
{

}
}

public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color color, bool drawShadow)
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow)
{
float halfTilesize = Game1.tileSize / 2;
spriteBatch.Draw(Game1.shadowTexture, location + new Vector2(halfTilesize, Game1.tileSize * 3 / 4), Game1.shadowTexture.Bounds, Color.White * 0.5f, 0f, new Vector2(Game1.shadowTexture.Bounds.Center.X, Game1.shadowTexture.Bounds.Center.Y), 3f, SpriteEffects.None, layerDepth - 0.0001f);
Expand Down
2 changes: 1 addition & 1 deletion CustomBooks/CustomBooks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0-beta.5" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions CustomBooks/Menu/ConfigPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public override void Click(Rectangle region, int x, int y)
{
if (this.Deleting)
{
#pragma warning disable AvoidNetField // Avoid Netcode types when possible
Game1.player.items.Filter(a => (a as Book)?.Id.Equals(this.Menu.Id) != true);
#pragma warning restore AvoidNetField // Avoid Netcode types when possible
ModEntry.Shelf.Books.Remove(this.Menu.Id);
Game1.playSound("trashcan");
this.Menu.exitThisMenu(false);
Expand Down
1 change: 1 addition & 0 deletions CustomPaths/CustomPath.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Entoarox.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
Expand Down
9 changes: 7 additions & 2 deletions CustomPaths/CustomPathObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public bool ShouldDelete()
return !CustomPathsMod.Map.ContainsKey(this.Id);
}

public override bool canStackWith(ISalable other)
{
return other is CustomPathObject obj && obj.Id == this.Id;
}

public override string getCategoryName()
{
return "Path";
Expand Down Expand Up @@ -112,11 +117,11 @@ public override bool isPassable()
return true;
}

public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color color, bool drawShadow)
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, StackDrawType drawStackNumber, Color color, bool drawShadow)
{
Texture2D texture = CustomPathsMod.Map[this.Id].GetTexture();
spriteBatch.Draw(texture, location + new Vector2((int)(Game1.tileSize / 2 * scaleSize), (int)(Game1.tileSize / 2 * scaleSize)), new Rectangle(0, 0, 16, 16), Color.White * transparency, 0f, new Vector2(8f, 8f) * scaleSize, Game1.pixelZoom * scaleSize, SpriteEffects.None, layerDepth);
if (drawStackNumber && this.maximumStackSize() > 1 && scaleSize > 0.3 && this.Stack != 2147483647 && this.Stack > 1)
if (drawStackNumber != StackDrawType.Hide && this.maximumStackSize() > 1 && scaleSize > 0.3 && this.Stack != 2147483647 && this.Stack > 1)
Utility.drawTinyDigits(this.Stack, spriteBatch, location + new Vector2((Game1.tileSize - Utility.getWidthOfTinyDigitString(this.Stack, 3f * scaleSize)) + 3f * scaleSize, Game1.tileSize - 18f * scaleSize + 2f), 3f * scaleSize, 1f, Color.White);
}

Expand Down
2 changes: 1 addition & 1 deletion CustomPaths/CustomPaths.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0-beta.5" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 10 additions & 8 deletions CustomPaths/CustomPathsMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,23 @@ private void Event_MenuChanged(object sender, EventArgs e)

if (CustomPathsMod.Map.Any(a => a.Value.Salesman.Equals(shopOwner)))
{
IReflectedField<Dictionary<Item, int[]>> refStock = this.Helper.Reflection.GetField<Dictionary<Item, int[]>>(Game1.activeClickableMenu, "itemPriceAndStock");
IReflectedField<List<Item>> refSale = this.Helper.Reflection.GetField<List<Item>>(Game1.activeClickableMenu, "forSale");
//IReflectedField<Dictionary<Item, int[]>> refStock = this.Helper.Reflection.GetField<Dictionary<Item, int[]>>(Game1.activeClickableMenu, "itemPriceAndStock");
//IReflectedField<List<Item>> refSale = this.Helper.Reflection.GetField<List<Item>>(Game1.activeClickableMenu, "forSale");
this.Monitor.Log("Shop owned by `" + shopOwner + "` gets edited, adding paths", LogLevel.Trace);
Dictionary<Item, int[]> stock = refStock.GetValue();
List<Item> sale = refSale.GetValue();
//Dictionary<Item, int[]> stock = refStock.GetValue();
//List<Item> sale = refSale.GetValue();
// Add our custom items to the shop
foreach (KeyValuePair<string, CustomPathInfo> item in CustomPathsMod.Map.Where(a => a.Value.Salesman.Equals(shopOwner) && (string.IsNullOrEmpty(a.Value.Requirements) || this.Helper.Conditions().ValidateConditions(a.Value.Requirements))))
{
CustomPathObject obj = new CustomPathObject(item.Key) { Stack = int.MaxValue };
stock.Add(obj, new[] { item.Value.Price * 2, int.MaxValue });
sale.Add(obj);
//stock.Add(obj, new[] { item.Value.Price * 2, int.MaxValue });
//sale.Add(obj);
menu.itemPriceAndStock.Add(obj, new[] { item.Value.Price * 2, int.MaxValue });
menu.forSale.Add(obj);
}

refStock.SetValue(stock);
refSale.SetValue(sale);
//refStock.SetValue(stock);
//refSale.SetValue(sale);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion CustomPaths/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name": "Custom Paths",
"Author": "Entoarox",
"Version": "1.2.1-beta.0",
"Version": "1.2.4",
"Description": "Enables adding custom paths to the game using Content Packs!",
"UniqueID": "Entoarox.CustomPaths",
"EntryDll": "CustomPaths.dll",
Expand Down
2 changes: 1 addition & 1 deletion DialogueFramework/DialogueFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0-beta.5" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
</ItemGroup>

<Import Project="$(SolutionDir)\common.targets" />
Expand Down
Loading

0 comments on commit 1f51a3c

Please sign in to comment.