Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions BiggerBackpack/BiggerBackpack.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BiggerBackpack", "BiggerBackpack.csproj", "{EF98F916-0992-7BCD-20DE-73C8AABC795E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EF98F916-0992-7BCD-20DE-73C8AABC795E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF98F916-0992-7BCD-20DE-73C8AABC795E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF98F916-0992-7BCD-20DE-73C8AABC795E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF98F916-0992-7BCD-20DE-73C8AABC795E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C69AA91B-64F0-4848-88A0-FB6BBFA147A3}
EndGlobalSection
EndGlobal
35 changes: 18 additions & 17 deletions BiggerBackpack/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
namespace BiggerBackpack
{
public class ModConfig {
/** How much you have to pay to buy this backpack in the shop. (default = 50000).*/
public int BackpackCost = 50000;
/** How much you have to pay to buy this backpack in the shop. (default = 100000).*/
public int BackpackCost = 100000;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There need to be two lines here. One cost for the first upgrade, another for the second.

}

public class ModEntry : HackWithConfig<ModEntry,ModConfig>
Expand Down Expand Up @@ -63,8 +63,9 @@ private void command( string cmd, string[] args )
case "24": newMax = 24; break;
case "36": newMax = 36; break;
case "48": newMax = 48; break;
case "60": newMax = 60; break;
default:
Monitor.Log("The new size must be 12, 24, 36 or 48.", LogLevel.Error);
Monitor.Log("The new size must be 12, 24, 36, 48 or 60.", LogLevel.Error);
return;
}

Expand Down Expand Up @@ -120,7 +121,7 @@ void SeedShop_draw() {
Instructions.Call_get(typeof(Game1), nameof(Game1.player)),
Instructions.Ldfld(typeof(Farmer), nameof(Farmer.maxItems)),
check[2], // Nothing jumps here so reusing this should be OK.
Instructions.Ldc_I4_S(48),
Instructions.Ldc_I4_S(60),
check[4], // We'll create a new jump in check later.
// drawBiggerBackpack(b);
Instructions.Ldarg_1(),
Expand Down Expand Up @@ -156,7 +157,7 @@ void SpecialItem_getTemporarySpriteForHoldingUp() {
Instructions.Call_get(typeof(Game1), nameof(Game1.player)),
Instructions.Ldfld(typeof(Farmer), nameof(Farmer.maxItems)),
code[3], // Nothing jumps here so reusing this should be OK.
Instructions.Ldc_I4_S(48),
Instructions.Ldc_I4_S(60),
Instructions.Bne_Un(AttachLabel(code[0])),
// return getBackpackSprite(position);
Instructions.Ldarg_1(),
Expand Down Expand Up @@ -195,7 +196,7 @@ void GameLocation_performAction() {
Instructions.Call_get(typeof(Game1), nameof(Game1.player)),
Instructions.Ldfld(typeof(Farmer), nameof(Farmer.maxItems)),
code[2],
Instructions.Ldc_I4_S(48),
Instructions.Ldc_I4_S(60),
code[4],
Instructions.Call(typeof(ModEntry), nameof(clickBackpack)),
Instructions.Br((Label)code[len-1].operand)
Expand Down Expand Up @@ -231,7 +232,7 @@ void GameLocation_answerDialogueAction() {
Instructions.Call_get(typeof(Game1), nameof(Game1.player)),
Instructions.Ldfld(typeof(Farmer), nameof(Farmer.maxItems)),
code[2],
Instructions.Ldc_I4_S(48),
Instructions.Ldc_I4_S(60),
Instructions.Bge(AttachLabel(get_player)),
// && Game1.player.Money >= Mod.getBackpackCost()) {
Instructions.Call_get(typeof(Game1), nameof(Game1.player)),
Expand All @@ -245,7 +246,7 @@ void GameLocation_answerDialogueAction() {
get_player,
Instructions.Ldfld(typeof(Farmer), nameof(Farmer.maxItems)),
code[2],
Instructions.Ldc_I4_S(48),
Instructions.Ldc_I4_S(60),
code[4]
);
}
Expand All @@ -255,28 +256,28 @@ void GameLocation_answerDialogueAction() {
#region Resize GUI
public static void shiftIconsDown(List<ClickableComponent> equipmentIcons){
foreach (var icon in equipmentIcons) {
icon.bounds.Y += Game1.tileSize;
icon.bounds.Y += Game1.tileSize * 2;
}
}

void resize_inventory() {
// Change inventory size from default (36) to 48
// Change inventory size from default (36) to 60
var inv = FindCode(
OpCodes.Ldc_I4_M1, // Size (-1 = default)
OpCodes.Ldc_I4_3, // Rows
OpCodes.Ldc_I4_0,
OpCodes.Ldc_I4_0,
OpCodes.Ldc_I4_1
);
inv[0] = Instructions.Ldc_I4(48);
inv[1] = Instructions.Ldc_I4_4();
inv[0] = Instructions.Ldc_I4(60);
inv[1] = Instructions.Ldc_I4_5();
}

void InventoryPage_ctor() {
BeginCode().Prepend(
// height += Game1.tileSize;
Instructions.Ldarg_S(4),
Instructions.Ldc_I4_S(Game1.tileSize),
Instructions.Ldc_I4(Game1.tileSize * 2),
Instructions.Add(),
Instructions.Starg_S(4)
);
Expand Down Expand Up @@ -321,7 +322,7 @@ void InventoryPage_draw() {
Instructions.Add(),
Instructions.Ldsfld(typeof(IClickableMenu), nameof(IClickableMenu.spaceToClearTopBorder)),
Instructions.Add(),
Instructions.Ldc_I4_S(Game1.tileSize),
Instructions.Ldc_I4(Game1.tileSize * 2),
Instructions.Add(),
Instructions.Stloc_S(yoffset)
);
Expand Down Expand Up @@ -357,7 +358,7 @@ void CraftingPage_ctor() {
BeginCode().Prepend(
// height += Game1.tileSize;
Instructions.Ldarg_S(4),
Instructions.Ldc_I4_S(Game1.tileSize),
Instructions.Ldc_I4(Game1.tileSize * 2),
Instructions.Add(),
Instructions.Starg_S(4)
);
Expand Down Expand Up @@ -458,7 +459,7 @@ void ShippingMenu_ctor() {
OpCodes.Mul,
OpCodes.Add
);
code[0].operand = 600 + Game1.tileSize;
code[0].operand = 600 + Game1.tileSize * 2;
}
}

Expand Down Expand Up @@ -537,4 +538,4 @@ protected override void InitializeApi(IGenericModConfigMenuApi api) {
}
#endregion
}
}
}
Binary file modified BiggerBackpack/backpack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions BiggerBackpack/i18n/default.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
// Translation provided by: <leave your name or nexus/discord username here>
SetBackpackSizeCommand: "Set the size of the player's backpack. This must be a multiple of 12",
Purchase: "Purchase ({{cost}}g)",
BackpackUpgrade: "Backpack Upgrade -- 48 slots",
PremiumPack: "Premium Pack",
BackpackCostName: "Backpack cost", BackpackCostTooltip: "How much you have to pay to buy this backpack in the shop.",
"SetBackpackSizeCommand": "Set the size of the player's backpack. This must be a multiple of 12",
"Purchase": "Purchase ({{cost}}g)",
"BackpackUpgrade": "Backpack Upgrade -- 60 slots",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably should be changed to Backpack Upgrade -- {{slots}} slots and the code referencing this string updated accordingly.

"PremiumPack": "Premium Pack",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There needs to be a second line here for the name of the second upgrade.

"BackpackCostName": "Backpack cost",
"BackpackCostTooltip": "How much you have to pay to buy this backpack in the shop."
}