Add PlayerBuff hook

This commit is contained in:
Lucas Nicodemus 2012-01-01 01:53:03 -07:00
parent 9998890ace
commit 5c9639c9c1

View file

@ -497,6 +497,29 @@ namespace TShockAPI
return args.Handled;
}
public class PlayerBuffEventArgs : HandledEventArgs
{
public byte ID { get; set; }
public byte Type { get; set; }
public short Time { get; set; }
}
public static HandlerList<PlayerBuffEventArgs> PlayerBuff;
private static bool OnPlayerBuff(byte id, byte type, short time)
{
if (PlayerBuff == null)
return false;
var args = new PlayerBuffEventArgs
{
ID = id,
Type = type,
Time = time,
};
PlayerBuff.Invoke(null, args);
return args.Handled;
}
#endregion
public static void InitGetDataHandler()
{
@ -1769,6 +1792,9 @@ namespace TShockAPI
var type = args.Data.ReadInt8();
var time = args.Data.ReadInt16();
if (OnPlayerBuff(id, type, time))
return true;
if (TShock.CheckIgnores(args.Player))
{
args.Player.SendData(PacketTypes.PlayerBuff, "", id);