Add NPCSpecial hook
This commit is contained in:
parent
13b8326a6e
commit
c9b33e527a
1 changed files with 24 additions and 0 deletions
|
|
@ -603,6 +603,27 @@ namespace TShockAPI
|
||||||
return args.Handled;
|
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
|
#endregion
|
||||||
public static void InitGetDataHandler()
|
public static void InitGetDataHandler()
|
||||||
{
|
{
|
||||||
|
|
@ -2067,6 +2088,9 @@ namespace TShockAPI
|
||||||
var id = args.Data.ReadInt8();
|
var id = args.Data.ReadInt8();
|
||||||
var type = args.Data.ReadInt8();
|
var type = args.Data.ReadInt8();
|
||||||
|
|
||||||
|
if (OnNPCSpecial(id, type))
|
||||||
|
return true;
|
||||||
|
|
||||||
if (type == 1 && TShock.Config.DisableDungeonGuardian)
|
if (type == 1 && TShock.Config.DisableDungeonGuardian)
|
||||||
{
|
{
|
||||||
args.Player.SendMessage("The Dungeon Guardian returned you to your spawn point", Color.Purple);
|
args.Player.SendMessage("The Dungeon Guardian returned you to your spawn point", Color.Purple);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue