OnPlayerMana now uses GetDataHandledEventArgs.
This commit is contained in:
parent
8bb3b88ab0
commit
0efa2fd648
1 changed files with 5 additions and 3 deletions
|
|
@ -296,7 +296,7 @@ namespace TShockAPI
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For use in a PlayerMana event
|
/// For use in a PlayerMana event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PlayerManaEventArgs : HandledEventArgs
|
public class PlayerManaEventArgs : GetDataHandledEventArgs
|
||||||
{
|
{
|
||||||
public byte PlayerId { get; set; }
|
public byte PlayerId { get; set; }
|
||||||
public short Current { get; set; }
|
public short Current { get; set; }
|
||||||
|
|
@ -307,13 +307,15 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static HandlerList<PlayerManaEventArgs> PlayerMana = new HandlerList<PlayerManaEventArgs>();
|
public static HandlerList<PlayerManaEventArgs> PlayerMana = new HandlerList<PlayerManaEventArgs>();
|
||||||
|
|
||||||
private static bool OnPlayerMana(byte _plr, short _cur, short _max)
|
private static bool OnPlayerMana(TSPlayer player, MemoryStream data, byte _plr, short _cur, short _max)
|
||||||
{
|
{
|
||||||
if (PlayerMana == null)
|
if (PlayerMana == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var args = new PlayerManaEventArgs
|
var args = new PlayerManaEventArgs
|
||||||
{
|
{
|
||||||
|
Player = player,
|
||||||
|
Data = data,
|
||||||
PlayerId = _plr,
|
PlayerId = _plr,
|
||||||
Current = _cur,
|
Current = _cur,
|
||||||
Max = _max,
|
Max = _max,
|
||||||
|
|
@ -1676,7 +1678,7 @@ namespace TShockAPI
|
||||||
var cur = args.Data.ReadInt16();
|
var cur = args.Data.ReadInt16();
|
||||||
var max = args.Data.ReadInt16();
|
var max = args.Data.ReadInt16();
|
||||||
|
|
||||||
if (OnPlayerMana(plr, cur, max) || cur < 0 || max < 0 || args.Player.IgnoreSSCPackets)
|
if (OnPlayerMana(args.Player, args.Data, plr, cur, max) || cur < 0 || max < 0 || args.Player.IgnoreSSCPackets)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (max > TShock.Config.MaxMP && !args.Player.HasPermission(Permissions.ignoremp))
|
if (max > TShock.Config.MaxMP && !args.Player.HasPermission(Permissions.ignoremp))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue