add NPCAddBuff bouncer
This commit is contained in:
parent
87915b70b0
commit
fc38521dbd
2 changed files with 33 additions and 2 deletions
|
|
@ -49,6 +49,7 @@ namespace TShockAPI
|
|||
GetDataHandlers.PlayerAnimation += OnPlayerAnimation;
|
||||
GetDataHandlers.NPCStrike += OnNPCStrike;
|
||||
GetDataHandlers.ItemDrop += OnItemDrop;
|
||||
GetDataHandlers.NPCAddBuff += OnNPCAddBuff;
|
||||
GetDataHandlers.PlayerBuff += OnPlayerBuff;
|
||||
GetDataHandlers.ChestItemChange += OnChestItemChange;
|
||||
GetDataHandlers.NPCHome += OnUpdateNPCHome;
|
||||
|
|
@ -453,6 +454,37 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Handles NPCAddBuff events.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
internal void OnNPCAddBuff(object sender, GetDataHandlers.NPCAddBuffEventArgs args)
|
||||
{
|
||||
short id = args.ID;
|
||||
byte type = args.Type;
|
||||
short time = args.Time;
|
||||
|
||||
if (id >= Main.npc.Length)
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
NPC npc = Main.npc[id];
|
||||
|
||||
if (npc == null)
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Player.IsBeingDisabled())
|
||||
{
|
||||
args.Player.SendData(PacketTypes.NpcAddBuff, "", id);
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Handles Buff events.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
|
|
|
|||
|
|
@ -2677,8 +2677,7 @@ namespace TShockAPI
|
|||
|
||||
if (OnNPCAddBuff(args.Player, args.Data, id, type, time))
|
||||
return true;
|
||||
|
||||
args.Player.SendData(PacketTypes.NpcAddBuff, "", id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue