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
42 changes: 35 additions & 7 deletions FargoPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,28 +157,56 @@ public override void PostUpdateBuffs()
{
FargoGlobalItem.TryUnlimBuff(item, Player);
}
}

if (GetInstance<FargoConfig>().PiggyBankAcc)
{
foreach (Item item in Player.bank.item)
foreach (Item item in Player.bank3.item)
{
FargoGlobalItem.TryPiggyBankAcc(item, Player);
FargoGlobalItem.TryUnlimBuff(item, Player);
}

foreach (Item item in Player.bank2.item)
foreach (Item item in Player.bank4.item)
{
FargoGlobalItem.TryPiggyBankAcc(item, Player);
FargoGlobalItem.TryUnlimBuff(item, Player);
}
}
}

public override void PostUpdateEquips()
{
FargoGlobalItem.ToolbeltEffectApplied = false;
FargoGlobalItem.ToolboxEffectApplied = false;
if (Fargowiltas.SwarmActive)
{
Player.buffImmune[BuffID.Horrified] = true;
}

if (GetInstance<FargoConfig>().PiggyBankAcc)
{
// This won't work in UpdateInventory, since the equippedAny buffs are set to false after UpdateInventory
foreach (Item item in Player.inventory)
{
FargoGlobalItem.TryPiggyBankAcc(item, Player, true);
}

foreach (Item item in Player.bank.item)
{
FargoGlobalItem.TryPiggyBankAcc(item, Player, false);
}

foreach (Item item in Player.bank2.item)
{
FargoGlobalItem.TryPiggyBankAcc(item, Player, false);
}

foreach (Item item in Player.bank3.item)
{
FargoGlobalItem.TryPiggyBankAcc(item, Player, false);
}

foreach (Item item in Player.bank4.item)
{
FargoGlobalItem.TryPiggyBankAcc(item, Player, false);
}
}
}

public override void PostUpdateMiscEffects()
Expand Down
48 changes: 42 additions & 6 deletions Items/FargoGlobalItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class FargoGlobalItem : GlobalItem
{
private static readonly int[] Hearts = new int[] { ItemID.Heart, ItemID.CandyApple, ItemID.CandyCane };
private static readonly int[] Stars = new int[] { ItemID.Star, ItemID.SoulCake, ItemID.SugarPlum };
public static bool ToolbeltEffectApplied;
public static bool ToolboxEffectApplied;

private bool firstTick = true;

Expand Down Expand Up @@ -126,7 +128,7 @@ public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
|| item.type == ItemID.BewitchingTable
|| item.type == ItemID.SliceOfCake)
{
line = new TooltipLine(Mod, "TooltipUnlim", "[i:87] [c/AAAAAA:Unlimited buff at thirty stack in inventory, Piggy Bank, or Safe]");
line = new TooltipLine(Mod, "TooltipUnlim", "[i:87] [c/AAAAAA:Unlimited buff at fifteen stack in inventory, Piggy Bank, or Safe]");
tooltips.Add(line);
}
}
Expand Down Expand Up @@ -278,23 +280,57 @@ public static void TryUnlimBuff(Item item, Player player)

static int[] Informational = { ItemID.CopperWatch, ItemID.TinWatch, ItemID.TungstenWatch, ItemID.SilverWatch, ItemID.GoldWatch, ItemID.PlatinumWatch, ItemID.DepthMeter, ItemID.Compass, ItemID.Radar, ItemID.LifeformAnalyzer, ItemID.TallyCounter, ItemID.MetalDetector, ItemID.Stopwatch, ItemID.Ruler, ItemID.FishermansGuide, ItemID.Sextant, ItemID.WeatherRadio, ItemID.GPS, ItemID.REK, ItemID.GoblinTech, ItemID.FishFinder, ItemID.PDA, ItemID.CellPhone };
static int[] Construction = { ItemID.Toolbelt, ItemID.Toolbox, ItemID.ExtendoGrip, ItemID.PaintSprayer, ItemID.BrickLayer, ItemID.PortableCementMixer, ItemID.ActuationAccessory, ItemID.ArchitectGizmoPack };
public static void TryPiggyBankAcc(Item item, Player player)
public static void TryPiggyBankAcc(Item item, Player player, bool inInventory)
{
if (item.IsAir)
return;

if (item.maxStack > 1)
return;

if (Informational.Contains(item.type))
// inInventory prevents us from calling VanillaUpdateInventory twice for an item.
if (Informational.Contains(item.type) && !inInventory)
{
player.VanillaUpdateInventory(item);
}
else if (Construction.Contains(item.type))
{
Item fakeItem = new Item();
fakeItem.SetDefaults(item.type);
player.VanillaUpdateEquip(fakeItem);
if (!inInventory)
{
player.VanillaUpdateInventory(item);
}

if (!player.equippedAnyWallSpeedAcc && (item.type == ItemID.PortableCementMixer || item.type == ItemID.ArchitectGizmoPack))
{
player.equippedAnyWallSpeedAcc = true;
player.wallSpeed += 0.5f;
}

if (!player.equippedAnyTileSpeedAcc && player.inventory[player.selectedItem].createTile != 4 && (item.type == ItemID.BrickLayer || item.type == ItemID.ArchitectGizmoPack))
{
player.equippedAnyTileSpeedAcc = true;
player.tileSpeed += 0.5f;
}

if (!player.equippedAnyTileRangeAcc && player.whoAmI == Main.myPlayer && (item.type == ItemID.ExtendoGrip || item.type == ItemID.ArchitectGizmoPack))
{
player.equippedAnyTileRangeAcc = true;
Player.tileRangeX += 3;
Player.tileRangeY += 2;
}

if (!ToolbeltEffectApplied && item.type == ItemID.Toolbelt && !player.armor.Any(a => a.type == ItemID.Toolbelt))
{
ToolbeltEffectApplied = true;
player.blockRange++;
}

if (!ToolboxEffectApplied && item.type == ItemID.Toolbox && player.whoAmI == Main.myPlayer && !player.armor.Any(a => a.type == ItemID.Toolbox))
{
ToolboxEffectApplied = true;
Player.tileRangeX++;
Player.tileRangeY++;
}
}
}

Expand Down