From fa68f0cf46d72bf1819f3f01037535f0c0de109b Mon Sep 17 00:00:00 2001 From: FrogSkyWater Date: Sat, 4 Apr 2026 20:23:45 +0200 Subject: [PATCH] [feature] 60 slots backpack --- BiggerBackpack/BiggerBackpack.sln | 24 ++++++++++++++++++++ BiggerBackpack/ModEntry.cs | 35 +++++++++++++++--------------- BiggerBackpack/backpack.png | Bin 15195 -> 351 bytes BiggerBackpack/i18n/default.json | 12 +++++----- 4 files changed, 48 insertions(+), 23 deletions(-) create mode 100644 BiggerBackpack/BiggerBackpack.sln diff --git a/BiggerBackpack/BiggerBackpack.sln b/BiggerBackpack/BiggerBackpack.sln new file mode 100644 index 0000000..c3e1935 --- /dev/null +++ b/BiggerBackpack/BiggerBackpack.sln @@ -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 diff --git a/BiggerBackpack/ModEntry.cs b/BiggerBackpack/ModEntry.cs index e929170..342ddad 100644 --- a/BiggerBackpack/ModEntry.cs +++ b/BiggerBackpack/ModEntry.cs @@ -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; } public class ModEntry : HackWithConfig @@ -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; } @@ -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(), @@ -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(), @@ -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) @@ -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)), @@ -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] ); } @@ -255,12 +256,12 @@ void GameLocation_answerDialogueAction() { #region Resize GUI public static void shiftIconsDown(List 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 @@ -268,15 +269,15 @@ void resize_inventory() { 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) ); @@ -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) ); @@ -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) ); @@ -458,7 +459,7 @@ void ShippingMenu_ctor() { OpCodes.Mul, OpCodes.Add ); - code[0].operand = 600 + Game1.tileSize; + code[0].operand = 600 + Game1.tileSize * 2; } } @@ -537,4 +538,4 @@ protected override void InitializeApi(IGenericModConfigMenuApi api) { } #endregion } -} +} \ No newline at end of file diff --git a/BiggerBackpack/backpack.png b/BiggerBackpack/backpack.png index bbe4846edbae3a7c7a6e3a5f65d4a0d5ed6bb545..e5e9a054b0a0e124b7e4cb80f71dc658bc0b8872 100644 GIT binary patch literal 351 zcmV-l0igbgP)00039Nkl~!{jkEv2t3$Z9q2t_xEFPwOBQ!WK3ds`W&G} zT9Scb&Wt<;m`285KmPxJ_5z|nRnwXQqyZNIX#@edCXfaYFtnTprW;;|!u2+Yu7-+ literal 15195 zcmeI3UyKt)9LE<7#w&k3LEH&$Cy&yBL-2?zCO6-7Vd{ zYww~4!Gxed2q8*8VwL0NPIAwXrj@CM1v6!0z@8&QNh{%@APhRiTGls zNxS=--+X_+na})Yx-YwDXmIml$0H7kq81NCBXM|L1iwq}yBGehIQ92cc-OniAuY{%SgCbvrYbl^0pISS-4V9+y!_v%DY(Eazt3ZU**X%qiWHON?%=t^}#Y zi2ze6Xn9LBblQ$9CyfcK+v&6u)j!pF;ohDY7Lw&+;ygokbLj;bpnpj7rn$ zn}j2&&TPhnW@0K2*f=naiGl+9CV_6Po@o%OQje3LC}higRD}gukb@Ev4xXQJ2>Fa* z8D_?qW!`o7th2YYRAX^kreJ$!m4T8ri_G>^WaUz*tdIojPYf4;Y#D`wVPr#FOJ6jOp=znAIYnvoY>g3%i37T6$+`jtA|W_;m!_$r2grWa9~2lKcmd-M zcm*a2I4=YEV1NtwK#Er@lWdi@g^n1?gk4B5bYeHnj@=~PmsJ^FoC@>yPdV2 zSwC{>CyK2pZ*Wmo?6W7N*yRgUiEU|Z46ClJ%Cz?7oEw5l{3iMAIf@ye&~j}*7lt!sfw5~3OU&dX*oF!*u0*W*hXU`r_?xu!ba98#0(XLJQ6!o zbCb&ca}wbx0V`H6?@nG~+uG3nqxNpkPL%rx+#LL{y!~61HoH;j7+%`!Mx_nqR$a3~ z?rJuqxk+XJgNkJs!|-7bg#13A$0xC9GpZQUN+3HL(cn36+UFGyGnF-{V@BavlhE5N zY;shEl~QPWEGzHvN-KQmgU_36{eiP>``1s&yLr=?(cO%S#3D%$Ab6AD!t+7A1Q!AX zZxUR1K8Tm#LV(~+f(y?F@e*7J5WGon;rSq5f(rqHHwi90AH+*=AwcjZ!G-68cnK~9 z2;L;P@O%(2!G!?9n*-`)0c5Vpn2+==WPAhhBMn6Zh)FYx*`X`z+Skf0kY!jz!mgz5Cnm*Bv~5E&0Lu zpFe%!r7Mw>#~-_M;=^n7iXrK>&9}dEoIm&A&9OgkFQQJJHXdDi>cE$9($qlTVC2M; H+jjl~$jF90 diff --git a/BiggerBackpack/i18n/default.json b/BiggerBackpack/i18n/default.json index 32764dd..77b9b3c 100644 --- a/BiggerBackpack/i18n/default.json +++ b/BiggerBackpack/i18n/default.json @@ -1,8 +1,8 @@ { - // Translation provided by: - 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", + "PremiumPack": "Premium Pack", + "BackpackCostName": "Backpack cost", + "BackpackCostTooltip": "How much you have to pay to buy this backpack in the shop." }