36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria;
|
|
using Terraria.ModLoader.IO;
|
|
using static Terraria.GameContent.Bestiary.IL_BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions;
|
|
using Microsoft.Xna.Framework;
|
|
|
|
namespace tMx.NPCs.CustomLoot
|
|
{
|
|
public class FrozenTabletOnKill : GlobalNPC
|
|
{
|
|
public override void OnKill(NPC npc)
|
|
{
|
|
if (Main.rand.NextBool(3)) // ~33%
|
|
{
|
|
if (npc.type == NPCID.IceSlime
|
|
|| npc.type == NPCID.IceBat)
|
|
{
|
|
int dropItemType = ModContent.ItemType<Content.Items.Materials.FrozenTablet>();
|
|
int newItem = Item.NewItem(npc.GetSource_FromThis(), npc.Hitbox, dropItemType);
|
|
|
|
if (Main.netMode == NetmodeID.MultiplayerClient && newItem >= 0)
|
|
{
|
|
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, newItem, 1f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|