diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index c59ce1a7..b3769e4e 100644
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -1003,6 +1003,46 @@ namespace TShockAPI
NPCHome.Invoke(null, args);
return args.Handled;
}
+
+ ///
+ /// For use in a NPCAddBuff event
+ ///
+ public class NPCAddBuffEventArgs : GetDataHandledEventArgs
+ {
+ ///
+ /// The ID of the npc
+ ///
+ public short ID { get; set; }
+ ///
+ /// Buff Type
+ ///
+ public byte Type { get; set; }
+ ///
+ /// Time the buff lasts
+ ///
+ public short Time { get; set; }
+ }
+ ///
+ /// NPCAddBuff - Called when a npc is buffed
+ ///
+ public static HandlerList NPCAddBuff = new HandlerList();
+
+ private static bool OnNPCAddBuff(TSPlayer player, MemoryStream data, short id, byte type, short time)
+ {
+ if (NPCAddBuff == null)
+ return false;
+
+ var args = new NPCAddBuffEventArgs
+ {
+ Player = player,
+ Data = data,
+ ID = id,
+ Type = type,
+ Time = time
+ };
+ NPCAddBuff.Invoke(null, args);
+ return args.Handled;
+ }
///
/// For use in a PlayerBuff event
@@ -1455,6 +1495,7 @@ namespace TShockAPI
{ PacketTypes.PlayerSlot, HandlePlayerSlot },
{ PacketTypes.TileGetSection, HandleGetSection },
{ PacketTypes.UpdateNPCHome, UpdateNPCHome },
+ { PacketTypes.NpcAddBuff, HandleNPCAddBuff },
{ PacketTypes.PlayerAddBuff, HandlePlayerAddBuff },
{ PacketTypes.ItemDrop, HandleItemDrop },
{ PacketTypes.UpdateItemDrop, HandleItemDrop },
@@ -2627,6 +2668,19 @@ namespace TShockAPI
}
return false;
}
+
+ private static bool HandleNPCAddBuff(GetDataHandlerArgs args)
+ {
+ var id = args.Data.ReadInt16();
+ var type = args.Data.ReadInt8();
+ var time = args.Data.ReadInt16();
+
+ if (OnNPCAddBuff(args.Player, args.Data, id, type, time))
+ return true;
+
+ args.Player.SendData(PacketTypes.NpcAddBuff, "", id);
+ return true;
+ }
private static bool HandlePlayerAddBuff(GetDataHandlerArgs args)
{