diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index d928a64c18..4fa6822831 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -4986,6 +4986,53 @@ namespace CalamityMod.CalPlayer RecipeUnlockHandler.HasFoundIceSchematic = true; shouldSync = true; } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundLuxorsGift) + { + RecipeUnlockHandler.HasFoundLuxorsGift = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundFungalSymbiote) + { + RecipeUnlockHandler.HasFoundFungalSymbiote = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundTrinketOfChi) + { + RecipeUnlockHandler.HasFoundTrinketOfChi = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundFrozenCube) + { + RecipeUnlockHandler.HasFoundFrozenCube = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundGladiatorsLocket) + { + RecipeUnlockHandler.HasFoundGladiatorsLocket = true; + shouldSync = true; + } + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundUnstableGraniteCore) + { + RecipeUnlockHandler.HasFoundUnstableGraniteCore = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundCrimsonEffigy) + { + RecipeUnlockHandler.HasFoundCrimsonEffigy = true; + shouldSync = true; + } + + if (Main.mouseItem.type == ModContent.ItemType() && !RecipeUnlockHandler.HasFoundCorruptionEffigy) + { + RecipeUnlockHandler.HasFoundCorruptionEffigy = true; + shouldSync = true; + } } if (shouldSync) diff --git a/CustomRecipes/RecipeUnlockHandler.cs b/CustomRecipes/RecipeUnlockHandler.cs index 2d2d263f2c..6945b303d4 100644 --- a/CustomRecipes/RecipeUnlockHandler.cs +++ b/CustomRecipes/RecipeUnlockHandler.cs @@ -18,6 +18,16 @@ namespace CalamityMod.CustomRecipes public static bool HasFoundHellSchematic = false; public static bool HasFoundIceSchematic = false; + public static bool HasFoundLuxorsGift = false; + public static bool HasFoundFungalSymbiote = false; + public static bool HasFoundTrinketOfChi = false; + public static bool HasFoundFrozenCube = false; + public static bool HasFoundGladiatorsLocket = false; + public static bool HasFoundUnstableGraniteCore = false; + public static bool HasFoundCrimsonEffigy = false; + public static bool HasFoundCorruptionEffigy = false; + + public static void Save(List boolTagContainer) { boolTagContainer.AddWithCondition("HasUnlockedT1ArsenalRecipes", HasUnlockedT1ArsenalRecipes); @@ -31,6 +41,15 @@ namespace CalamityMod.CustomRecipes boolTagContainer.AddWithCondition("HasFoundJungleSchematic", HasFoundJungleSchematic); boolTagContainer.AddWithCondition("HasFoundHellSchematic", HasFoundHellSchematic); boolTagContainer.AddWithCondition("HasFoundIceSchematic", HasFoundIceSchematic); + + boolTagContainer.AddWithCondition("HasFoundLuxorsGift", HasFoundLuxorsGift); + boolTagContainer.AddWithCondition("HasFoundFungalSymbiote", HasFoundFungalSymbiote); + boolTagContainer.AddWithCondition("HasFoundTrinketOfChi", HasFoundTrinketOfChi); + boolTagContainer.AddWithCondition("HasFoundFrozenCube", HasFoundFrozenCube); + boolTagContainer.AddWithCondition("HasFoundGladiatorsLocket", HasFoundGladiatorsLocket); + boolTagContainer.AddWithCondition("HasFoundUnstableGraniteCore", HasFoundUnstableGraniteCore); + boolTagContainer.AddWithCondition("HasFoundCrimsonEffigy", HasFoundCrimsonEffigy); + boolTagContainer.AddWithCondition("HasFoundCorruptionEffigy", HasFoundCorruptionEffigy); } public static void Load(IList boolTagContainer) @@ -46,6 +65,16 @@ namespace CalamityMod.CustomRecipes HasFoundJungleSchematic = boolTagContainer.Contains("HasFoundJungleSchematic"); HasFoundHellSchematic = boolTagContainer.Contains("HasFoundHellSchematic"); HasFoundIceSchematic = boolTagContainer.Contains("HasFoundIceSchematic"); + + HasFoundLuxorsGift = boolTagContainer.Contains("HasFoundLuxorsGift"); + HasFoundFungalSymbiote = boolTagContainer.Contains("HasFoundFungalSymbiote"); + HasFoundTrinketOfChi = boolTagContainer.Contains("HasFoundTrinketOfChi"); + HasFoundFrozenCube = boolTagContainer.Contains("HasFoundFrozenCube"); + HasFoundGladiatorsLocket = boolTagContainer.Contains("HasFoundGladiatorsLocket"); + HasFoundUnstableGraniteCore = boolTagContainer.Contains("HasFoundUnstableGraniteCore"); + HasFoundCrimsonEffigy = boolTagContainer.Contains("HasFoundCrimsonEffigy"); + HasFoundCorruptionEffigy = boolTagContainer.Contains("HasFoundCorruptionEffigy"); + } public static void SendData(BinaryWriter writer) @@ -63,9 +92,19 @@ namespace CalamityMod.CustomRecipes BitsByte flags2 = new BitsByte(); flags2[0] = HasFoundHellSchematic; flags2[1] = HasFoundIceSchematic; + flags2[2] = HasFoundLuxorsGift; + flags2[3] = HasFoundFungalSymbiote; + flags2[4] = HasFoundTrinketOfChi; + flags2[5] = HasFoundGladiatorsLocket; + flags2[6] = HasFoundUnstableGraniteCore; + flags2[7] = HasFoundCrimsonEffigy; + + BitsByte flags3 = new BitsByte(); + flags3[0] = HasFoundCorruptionEffigy; writer.Write(flags); writer.Write(flags2); + writer.Write(flags3); } public static void ReceiveData(BinaryReader reader) @@ -83,6 +122,16 @@ namespace CalamityMod.CustomRecipes BitsByte flags2 = reader.ReadByte(); HasFoundHellSchematic = flags2[0]; HasFoundIceSchematic = flags2[1]; + HasFoundLuxorsGift = flags2[2]; + HasFoundFungalSymbiote = flags2[3]; + HasFoundTrinketOfChi = flags2[4]; + HasFoundGladiatorsLocket = flags2[5]; + HasFoundUnstableGraniteCore = flags2[6]; + HasFoundCrimsonEffigy = flags2[7]; + + BitsByte flags3 = reader.ReadByte(); + HasFoundCorruptionEffigy = flags3[0]; + } } } diff --git a/Items/Accessories/FrozenCube.cs b/Items/Accessories/FrozenCube.cs index 6cd386972d..58765d3548 100644 --- a/Items/Accessories/FrozenCube.cs +++ b/Items/Accessories/FrozenCube.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -35,6 +36,16 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Orange; Item.accessory = true; } + + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundFrozenCube) + { + RecipeUnlockHandler.HasFoundFrozenCube = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -48,6 +59,7 @@ namespace CalamityMod.Items.Accessories Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, projectile, damage, 0f, player.whoAmI); } } + public override void ModifyTooltips(List list) { if (Main.LocalPlayer != null) diff --git a/Items/Accessories/FungalSymbiote.cs b/Items/Accessories/FungalSymbiote.cs index 8f020a1998..2620cdc165 100644 --- a/Items/Accessories/FungalSymbiote.cs +++ b/Items/Accessories/FungalSymbiote.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +18,15 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundFungalSymbiote) + { + RecipeUnlockHandler.HasFoundFungalSymbiote = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 104e8933bc..53f1648981 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,6 +17,14 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundGladiatorsLocket) + { + RecipeUnlockHandler.HasFoundGladiatorsLocket = true; + CalamityNetcode.SyncWorld(); + } + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index d051683737..ad27354113 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -35,6 +36,14 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundLuxorsGift) + { + RecipeUnlockHandler.HasFoundLuxorsGift = true; + CalamityNetcode.SyncWorld(); + } + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/TrinketofChi.cs b/Items/Accessories/TrinketofChi.cs index 5222c8b13a..f3c5c0ff09 100644 --- a/Items/Accessories/TrinketofChi.cs +++ b/Items/Accessories/TrinketofChi.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -25,6 +26,15 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundTrinketOfChi) + { + RecipeUnlockHandler.HasFoundTrinketOfChi = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/UnstableGraniteCore.cs b/Items/Accessories/UnstableGraniteCore.cs index 178ce5ca83..863255e771 100644 --- a/Items/Accessories/UnstableGraniteCore.cs +++ b/Items/Accessories/UnstableGraniteCore.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.CustomRecipes; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -25,6 +26,15 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundUnstableGraniteCore) + { + RecipeUnlockHandler.HasFoundUnstableGraniteCore = true; + CalamityNetcode.SyncWorld(); + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Placeables/Furniture/CorruptionEffigy.cs b/Items/Placeables/Furniture/CorruptionEffigy.cs index a8a1a05932..1bb305a0d3 100644 --- a/Items/Placeables/Furniture/CorruptionEffigy.cs +++ b/Items/Placeables/Furniture/CorruptionEffigy.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.CustomRecipes; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -21,6 +22,15 @@ namespace CalamityMod.Items.Placeables.Furniture Item.rare = ItemRarityID.Orange; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundCorruptionEffigy) + { + RecipeUnlockHandler.HasFoundCorruptionEffigy = true; + CalamityNetcode.SyncWorld(); + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Placeables/Furniture/CrimsonEffigy.cs b/Items/Placeables/Furniture/CrimsonEffigy.cs index 1662948a74..e5e94ae501 100644 --- a/Items/Placeables/Furniture/CrimsonEffigy.cs +++ b/Items/Placeables/Furniture/CrimsonEffigy.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.CustomRecipes; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -21,6 +22,15 @@ namespace CalamityMod.Items.Placeables.Furniture Item.rare = ItemRarityID.Orange; } + public override void UpdateInventory(Player player) + { + if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundCrimsonEffigy) + { + RecipeUnlockHandler.HasFoundCrimsonEffigy = true; + CalamityNetcode.SyncWorld(); + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/NPCs/TownNPCs/ShadySalesman.cs b/NPCs/TownNPCs/ShadySalesman.cs index 99fe2370e2..569296d0d5 100644 --- a/NPCs/TownNPCs/ShadySalesman.cs +++ b/NPCs/TownNPCs/ShadySalesman.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading; +using CalamityMod.CustomRecipes; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Items.Fishing; @@ -284,7 +285,15 @@ namespace CalamityMod.NPCs.TownNPCs .Add(Condition.DownedGoblinArmy) .Add(Condition.DownedGoblinArmy) .Add(Condition.DownedGolem) - + .Add(new Condition("Mods.CalamityMod.Conditions.HasFoundLuxorsGift", () => RecipeUnlockHandler.HasFoundLuxorsGift)) + .Add(new Condition("Mods.CalamityMod.Conditions.HasFoundFungalSymbiote", () => RecipeUnlockHandler.HasFoundFungalSymbiote)) + .Add(new Condition("Mods.CalamityMod.Conditions.HasFoundTrinketOfChi", () => RecipeUnlockHandler.HasFoundTrinketOfChi)) + .Add(new Condition("Mods.CalamityMod.Conditions.HasFoundFrozenCube", () => RecipeUnlockHandler.HasFoundFrozenCube)) + .Add(new Condition("Mods.CalamityMod.Conditions.HasFoundGladiatorsLocket", () => RecipeUnlockHandler.HasFoundGladiatorsLocket)) + .Add(new Condition("Mods.CalamityMod.Conditions.HasFoundUnstableGraniteCore", () => RecipeUnlockHandler.HasFoundUnstableGraniteCore)) + .Add(new Condition("Mods.CalamityMod.Conditions.HasFoundCrimsonEffigy", () => RecipeUnlockHandler.HasFoundCrimsonEffigy)) + .Add(new Condition("Mods.CalamityMod.Conditions.HasFoundCorruptionEffigy", () => RecipeUnlockHandler.HasFoundCorruptionEffigy)) + .Register(); }