72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
using System;
|
|
using CalamityMod.CustomRecipes;
|
|
using CalamityMod.Items.Materials;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using CalamityMod.UI;
|
|
|
|
|
|
namespace CalamityMod.Items.DraedonMisc
|
|
{
|
|
public class EncryptedSchematicIce : ModItem
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Encrypted Schematic (Ice)");
|
|
Tooltip.SetDefault("Requires a Codebreaker with a complex voltage regulation system to decrypt");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Item.width = 42;
|
|
Item.height = 42;
|
|
Item.rare = ItemRarityID.Red;
|
|
Item.Calamity().customRarity = CalamityRarity.DraedonRust;
|
|
Item.maxStack = 1;
|
|
Item.useAnimation = Item.useTime = 20;
|
|
Item.useStyle = ItemUseStyleID.HoldUp;
|
|
}
|
|
|
|
public override void UpdateInventory(Player player)
|
|
{
|
|
if (Main.netMode != NetmodeID.MultiplayerClient && !RecipeUnlockHandler.HasFoundIceSchematic)
|
|
{
|
|
RecipeUnlockHandler.HasFoundIceSchematic = true;
|
|
CalamityNetcode.SyncWorld();
|
|
}
|
|
}
|
|
|
|
public override void ModifyTooltips(List<TooltipLine> list)
|
|
{
|
|
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0");
|
|
|
|
if (line != null && RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes)
|
|
line.Text = "Has already been decrypted.\n" +
|
|
"Click to view its contents.";
|
|
}
|
|
|
|
public override void AddRecipes()
|
|
{
|
|
CreateRecipe().
|
|
AddIngredient<MysteriousCircuitry>(10).
|
|
AddIngredient<DubiousPlating>(10).
|
|
AddIngredient(ItemID.Glass, 50).
|
|
AddCondition(SchematicRecipe.ConstructRecipeCondition("Ice", out Predicate<Recipe> condition), condition).
|
|
AddTile(TileID.Anvils).
|
|
Register();
|
|
}
|
|
|
|
public override bool? UseItem(Player player)
|
|
{
|
|
if (Main.myPlayer == player.whoAmI && RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes)
|
|
{
|
|
PopupGUIManager.FlipActivityOfGUIWithType(typeof(DraedonSchematicIceGUI));
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|