Add NPCSpecial hook

This commit is contained in:
Lucas Nicodemus 2012-01-01 02:13:03 -07:00
parent 13b8326a6e
commit c9b33e527a

View file

@ -603,6 +603,27 @@ namespace TShockAPI
return args.Handled;
}
public class NPCSpecialEventArgs : HandledEventArgs
{
public byte ID { get; set; }
public byte Type { get; set; }
}
public static HandlerList<NPCSpecialEventArgs> NPCSpecial;
private static bool OnNPCSpecial(byte id, byte type)
{
if (NPCSpecial == null)
return false;
var args = new NPCSpecialEventArgs
{
ID = id,
Type = type,
};
NPCSpecial.Invoke(null, args);
return args.Handled;
}
#endregion
public static void InitGetDataHandler()
{
@ -2067,6 +2088,9 @@ namespace TShockAPI
var id = args.Data.ReadInt8();
var type = args.Data.ReadInt8();
if (OnNPCSpecial(id, type))
return true;
if (type == 1 && TShock.Config.DisableDungeonGuardian)
{
args.Player.SendMessage("The Dungeon Guardian returned you to your spawn point", Color.Purple);