OnNPCStrike now uses GetDataHandledEventArgs.
This commit is contained in:
parent
45c81e960a
commit
61d1bcf93f
1 changed files with 4 additions and 5 deletions
|
|
@ -1215,10 +1215,8 @@ namespace TShockAPI
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For use with a NPCStrike event
|
/// For use with a NPCStrike event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class NPCStrikeEventArgs : HandledEventArgs
|
public class NPCStrikeEventArgs : GetDataHandledEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>The TSPlayer that triggered the event.</summary>
|
|
||||||
public TSPlayer Player { get; set; }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ???
|
/// ???
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -1245,7 +1243,7 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static HandlerList<NPCStrikeEventArgs> NPCStrike = new HandlerList<NPCStrikeEventArgs>();
|
public static HandlerList<NPCStrikeEventArgs> NPCStrike = new HandlerList<NPCStrikeEventArgs>();
|
||||||
|
|
||||||
private static bool OnNPCStrike(TSPlayer player, short id, byte dir, short dmg, float knockback, byte crit)
|
private static bool OnNPCStrike(TSPlayer player, MemoryStream data, short id, byte dir, short dmg, float knockback, byte crit)
|
||||||
{
|
{
|
||||||
if (NPCStrike == null)
|
if (NPCStrike == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1253,6 +1251,7 @@ namespace TShockAPI
|
||||||
var args = new NPCStrikeEventArgs
|
var args = new NPCStrikeEventArgs
|
||||||
{
|
{
|
||||||
Player = player,
|
Player = player,
|
||||||
|
Data = data,
|
||||||
ID = id,
|
ID = id,
|
||||||
Direction = dir,
|
Direction = dir,
|
||||||
Damage = dmg,
|
Damage = dmg,
|
||||||
|
|
@ -2711,7 +2710,7 @@ namespace TShockAPI
|
||||||
var direction = (byte)(args.Data.ReadInt8() - 1);
|
var direction = (byte)(args.Data.ReadInt8() - 1);
|
||||||
var crit = args.Data.ReadInt8();
|
var crit = args.Data.ReadInt8();
|
||||||
|
|
||||||
if (OnNPCStrike(args.Player, id, direction, dmg, knockback, crit))
|
if (OnNPCStrike(args.Player, args.Data, id, direction, dmg, knockback, crit))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Main.npc[id].townNPC && !args.Player.HasPermission(Permissions.hurttownnpc))
|
if (Main.npc[id].townNPC && !args.Player.HasPermission(Permissions.hurttownnpc))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue