@@ -856,6 +856,14 @@ public class SpawnEventArgs : GetDataHandledEventArgs
856856 /// </summary>
857857 public int RespawnTimer { get ; set ; }
858858 /// <summary>
859+ /// Number Of Deaths PVE
860+ /// </summary>
861+ public int NumberOfDeathsPVE { get ; set ; }
862+ /// <summary>
863+ /// Number Of Deaths PVP
864+ /// </summary>
865+ public int NumberOfDeathsPVP { get ; set ; }
866+ /// <summary>
859867 /// Context of where the player is spawning from.
860868 /// </summary>
861869 public PlayerSpawnContext SpawnContext { get ; set ; }
@@ -864,7 +872,7 @@ public class SpawnEventArgs : GetDataHandledEventArgs
864872 /// PlayerSpawn - When a player spawns
865873 /// </summary>
866874 public static HandlerList < SpawnEventArgs > PlayerSpawn = new HandlerList < SpawnEventArgs > ( ) ;
867- private static bool OnPlayerSpawn ( TSPlayer player , MemoryStream data , byte pid , int spawnX , int spawnY , int respawnTimer , PlayerSpawnContext spawnContext )
875+ private static bool OnPlayerSpawn ( TSPlayer player , MemoryStream data , byte pid , int spawnX , int spawnY , int respawnTimer , int numberOfDeathsPVE , int numberOfDeathsPVP , PlayerSpawnContext spawnContext )
868876 {
869877 if ( PlayerSpawn == null )
870878 return false ;
@@ -877,6 +885,8 @@ private static bool OnPlayerSpawn(TSPlayer player, MemoryStream data, byte pid,
877885 SpawnX = spawnX ,
878886 SpawnY = spawnY ,
879887 RespawnTimer = respawnTimer ,
888+ NumberOfDeathsPVE = numberOfDeathsPVE ,
889+ NumberOfDeathsPVP = numberOfDeathsPVP ,
880890 SpawnContext = spawnContext
881891 } ;
882892 PlayerSpawn . Invoke ( null , args ) ;
@@ -1033,12 +1043,16 @@ public class PlayerZoneEventArgs : GetDataHandledEventArgs
10331043 /// 0 = Old One's Army, 1 = Granite, 2 = Marble, 3 = Hive, 4 = Gem Cave, 5 = Lihzhard Temple, 6 = Graveyard
10341044 /// </summary>
10351045 public BitsByte Zone4 { get ; set ; }
1046+ /// <summary>
1047+ /// 0 = The Aether
1048+ /// </summary>
1049+ public BitsByte Zone5 { get ; set ; }
10361050 }
10371051 /// <summary>
10381052 /// PlayerZone - When the player sends it's zone/biome information to the server
10391053 /// </summary>
10401054 public static HandlerList < PlayerZoneEventArgs > PlayerZone = new HandlerList < PlayerZoneEventArgs > ( ) ;
1041- private static bool OnPlayerZone ( TSPlayer player , MemoryStream data , byte plr , BitsByte zone1 , BitsByte zone2 , BitsByte zone3 , BitsByte zone4 )
1055+ private static bool OnPlayerZone ( TSPlayer player , MemoryStream data , byte plr , BitsByte zone1 , BitsByte zone2 , BitsByte zone3 , BitsByte zone4 , BitsByte zone5 )
10421056 {
10431057 if ( PlayerZone == null )
10441058 return false ;
@@ -1051,7 +1065,8 @@ private static bool OnPlayerZone(TSPlayer player, MemoryStream data, byte plr, B
10511065 Zone1 = zone1 ,
10521066 Zone2 = zone2 ,
10531067 Zone3 = zone3 ,
1054- Zone4 = zone4
1068+ Zone4 = zone4 ,
1069+ Zone5 = zone5
10551070 } ;
10561071 PlayerZone . Invoke ( null , args ) ;
10571072 return args . Handled ;
@@ -1519,12 +1534,16 @@ public class PaintTileEventArgs : GetDataHandledEventArgs
15191534 /// Type
15201535 /// </summary>
15211536 public byte type { get ; set ; }
1537+ /// <summary>
1538+ /// Paint Coat Tile
1539+ /// </summary>
1540+ public byte coatTile { get ; set ; }
15221541 }
15231542 /// <summary>
15241543 /// NPCStrike - Called when an NPC is attacked
15251544 /// </summary>
15261545 public static HandlerList < PaintTileEventArgs > PaintTile = new HandlerList < PaintTileEventArgs > ( ) ;
1527- private static bool OnPaintTile ( TSPlayer player , MemoryStream data , Int32 x , Int32 y , byte t )
1546+ private static bool OnPaintTile ( TSPlayer player , MemoryStream data , Int32 x , Int32 y , byte t , byte ct )
15281547 {
15291548 if ( PaintTile == null )
15301549 return false ;
@@ -1535,7 +1554,8 @@ private static bool OnPaintTile(TSPlayer player, MemoryStream data, Int32 x, Int
15351554 Data = data ,
15361555 X = x ,
15371556 Y = y ,
1538- type = t
1557+ type = t ,
1558+ coatTile = ct
15391559 } ;
15401560 PaintTile . Invoke ( null , args ) ;
15411561 return args . Handled ;
@@ -1558,12 +1578,16 @@ public class PaintWallEventArgs : GetDataHandledEventArgs
15581578 /// Type
15591579 /// </summary>
15601580 public byte type { get ; set ; }
1581+ /// <summary>
1582+ /// Paint Coat Wall
1583+ /// </summary>
1584+ public byte coatWall { get ; set ; }
15611585 }
15621586 /// <summary>
15631587 /// Called When a wall is painted
15641588 /// </summary>
15651589 public static HandlerList < PaintWallEventArgs > PaintWall = new HandlerList < PaintWallEventArgs > ( ) ;
1566- private static bool OnPaintWall ( TSPlayer player , MemoryStream data , Int32 x , Int32 y , byte t )
1590+ private static bool OnPaintWall ( TSPlayer player , MemoryStream data , Int32 x , Int32 y , byte t , byte cw )
15671591 {
15681592 if ( PaintWall == null )
15691593 return false ;
@@ -1574,7 +1598,8 @@ private static bool OnPaintWall(TSPlayer player, MemoryStream data, Int32 x, Int
15741598 Data = data ,
15751599 X = x ,
15761600 Y = y ,
1577- type = t
1601+ type = t ,
1602+ coatWall = cw
15781603 } ;
15791604 PaintWall . Invoke ( null , args ) ;
15801605 return args . Handled ;
@@ -1734,12 +1759,15 @@ public class PlaceObjectEventArgs : GetDataHandledEventArgs
17341759 /// <summary>Alternate variation of the object placed.</summary>
17351760 public byte Alternate { get ; set ; }
17361761
1762+ /// <summary>Related to Rubblemaker.</summary>
1763+ public sbyte Random { get ; set ; }
1764+
17371765 /// <summary>The direction the object was placed.</summary>
17381766 public bool Direction { get ; set ; }
17391767 }
17401768 /// <summary>Fired when an object is placed in the world.</summary>
17411769 public static HandlerList < PlaceObjectEventArgs > PlaceObject = new HandlerList < PlaceObjectEventArgs > ( ) ;
1742- private static bool OnPlaceObject ( TSPlayer player , MemoryStream data , short x , short y , short type , short style , byte alternate , bool direction )
1770+ private static bool OnPlaceObject ( TSPlayer player , MemoryStream data , short x , short y , short type , short style , byte alternate , sbyte random , bool direction )
17431771 {
17441772 if ( PlaceObject == null )
17451773 return false ;
@@ -1753,6 +1781,7 @@ private static bool OnPlaceObject(TSPlayer player, MemoryStream data, short x, s
17531781 Type = type ,
17541782 Style = style ,
17551783 Alternate = alternate ,
1784+ Random = random ,
17561785 Direction = direction
17571786 } ;
17581787
@@ -1980,14 +2009,18 @@ public class PlayerDamageEventArgs : GetDataHandledEventArgs
19802009 /// Is the damage critical?
19812010 /// </summary>
19822011 public bool Critical { get ; set ; }
2012+ /// <summary>
2013+ /// Cooldown Counter
2014+ /// </summary>
2015+ public sbyte CooldownCounter { get ; set ; }
19832016 /// <summary>The reason the player took damage and/or died.</summary>
19842017 public PlayerDeathReason PlayerDeathReason { get ; set ; }
19852018 }
19862019 /// <summary>
19872020 /// PlayerDamage - Called when a player is damaged
19882021 /// </summary>
19892022 public static HandlerList < PlayerDamageEventArgs > PlayerDamage = new HandlerList < PlayerDamageEventArgs > ( ) ;
1990- private static bool OnPlayerDamage ( TSPlayer player , MemoryStream data , byte id , byte dir , short dmg , bool pvp , bool crit , PlayerDeathReason playerDeathReason )
2023+ private static bool OnPlayerDamage ( TSPlayer player , MemoryStream data , byte id , byte dir , short dmg , bool pvp , bool crit , sbyte cooldownCounter , PlayerDeathReason playerDeathReason )
19912024 {
19922025 if ( PlayerDamage == null )
19932026 return false ;
@@ -2001,6 +2034,7 @@ private static bool OnPlayerDamage(TSPlayer player, MemoryStream data, byte id,
20012034 Damage = dmg ,
20022035 PVP = pvp ,
20032036 Critical = crit ,
2037+ CooldownCounter = cooldownCounter ,
20042038 PlayerDeathReason = playerDeathReason ,
20052039 } ;
20062040 PlayerDamage . Invoke ( null , args ) ;
@@ -2687,9 +2721,11 @@ private static bool HandleSpawn(GetDataHandlerArgs args)
26872721 short spawnx = args . Data . ReadInt16 ( ) ;
26882722 short spawny = args . Data . ReadInt16 ( ) ;
26892723 int respawnTimer = args . Data . ReadInt32 ( ) ;
2724+ short numberOfDeathsPVE = args . Data . ReadInt16 ( ) ;
2725+ short numberOfDeathsPVP = args . Data . ReadInt16 ( ) ;
26902726 PlayerSpawnContext context = ( PlayerSpawnContext ) args . Data . ReadByte ( ) ;
26912727
2692- if ( OnPlayerSpawn ( args . Player , args . Data , player , spawnx , spawny , respawnTimer , context ) )
2728+ if ( OnPlayerSpawn ( args . Player , args . Data , player , spawnx , spawny , respawnTimer , numberOfDeathsPVE , numberOfDeathsPVP , context ) )
26932729 return true ;
26942730
26952731 if ( ( Main . ServerSideCharacter ) & & ( spawnx == - 1 && spawny == - 1 ) ) //this means they want to spawn to vanilla spawn
@@ -2912,17 +2948,19 @@ private static bool HandleProjectileNew(GetDataHandlerArgs args)
29122948 Vector2 vel = args . Data . ReadVector2 ( ) ;
29132949 byte owner = args . Data . ReadInt8 ( ) ;
29142950 short type = args . Data . ReadInt16 ( ) ;
2915- NewProjectileData bits = new NewProjectileData ( ( BitsByte ) args . Data . ReadByte ( ) ) ;
2951+ BitsByte bitsByte = ( BitsByte ) args . Data . ReadByte ( ) ;
2952+ BitsByte bitsByte2 = ( BitsByte ) ( bitsByte [ 2 ] ? args . Data . ReadByte ( ) : 0 ) ;
29162953 float [ ] ai = new float [ Projectile . maxAI ] ;
2917- for ( int i = 0 ; i < Projectile . maxAI ; ++ i )
2918- ai [ i ] = ! bits . AI [ i ] ? 0.0f : args . Data . ReadSingle ( ) ;
2919- ushort bannerId = bits . HasBannerIdToRespondTo ? args . Data . ReadUInt16 ( ) : ( ushort ) 0 ;
2920- short dmg = bits . HasDamage ? args . Data . ReadInt16 ( ) : ( short ) 0 ;
2921- float knockback = bits . HasKnockback ? args . Data . ReadSingle ( ) : 0.0f ;
2922- short origDmg = bits . HasOriginalDamage ? args . Data . ReadInt16 ( ) : ( short ) 0 ;
2923- short projUUID = bits . HasUUUID ? args . Data . ReadInt16 ( ) : ( short ) - 1 ;
2924- if ( projUUID >= 1000 )
2925- projUUID = - 1 ;
2954+ for ( int i = 0 ; i < Projectile . maxAI ; ++ i ) ai [ i ] = 0f ;
2955+ ai [ 0 ] = bitsByte [ 0 ] ? args . Data . ReadSingle ( ) : 0f ;
2956+ ai [ 1 ] = bitsByte [ 1 ] ? args . Data . ReadSingle ( ) : 0f ;
2957+ ushort bannerId = ( ushort ) ( bitsByte [ 3 ] ? args . Data . ReadUInt16 ( ) : 0 ) ;
2958+ short dmg = ( short ) ( bitsByte [ 4 ] ? args . Data . ReadInt16 ( ) : 0 ) ;
2959+ float knockback = bitsByte [ 5 ] ? args . Data . ReadSingle ( ) : 0f ;
2960+ short origDmg = ( short ) ( bitsByte [ 6 ] ? args . Data . ReadInt16 ( ) : 0 ) ;
2961+ short projUUID = ( short ) ( bitsByte [ 7 ] ? args . Data . ReadInt16 ( ) : - 1 ) ;
2962+ if ( projUUID >= 1000 ) projUUID = - 1 ;
2963+ ai [ 2 ] = ( bitsByte2 [ 0 ] ? args . Data . ReadSingle ( ) : 0f ) ;
29262964
29272965 var index = TShock . Utils . SearchProjectile ( ident , owner ) ;
29282966
@@ -3150,8 +3188,9 @@ private static bool HandlePlayerZone(GetDataHandlerArgs args)
31503188 BitsByte zone2 = args . Data . ReadInt8 ( ) ;
31513189 BitsByte zone3 = args . Data . ReadInt8 ( ) ;
31523190 BitsByte zone4 = args . Data . ReadInt8 ( ) ;
3191+ BitsByte zone5 = args . Data . ReadInt8 ( ) ;
31533192
3154- if ( OnPlayerZone ( args . Player , args . Data , plr , zone1 , zone2 , zone3 , zone4 ) )
3193+ if ( OnPlayerZone ( args . Player , args . Data , plr , zone1 , zone2 , zone3 , zone4 , zone5 ) )
31553194 return true ;
31563195
31573196 return false ;
@@ -3616,13 +3655,14 @@ private static bool HandlePaintTile(GetDataHandlerArgs args)
36163655 var x = args . Data . ReadInt16 ( ) ;
36173656 var y = args . Data . ReadInt16 ( ) ;
36183657 var t = args . Data . ReadInt8 ( ) ;
3658+ var ct = args . Data . ReadInt8 ( ) ; //PaintCoatTile
36193659
36203660 if ( x < 0 || y < 0 || x >= Main . maxTilesX || y >= Main . maxTilesY || t > Main . numTileColors )
36213661 {
36223662 TShock . Log . ConsoleDebug ( GetString ( "GetDataHandlers / HandlePaintTile rejected range check {0}" , args . Player . Name ) ) ;
36233663 return true ;
36243664 }
3625- if ( OnPaintTile ( args . Player , args . Data , x , y , t ) )
3665+ if ( OnPaintTile ( args . Player , args . Data , x , y , t , ct ) )
36263666 {
36273667 return true ;
36283668 }
@@ -3663,13 +3703,14 @@ private static bool HandlePaintWall(GetDataHandlerArgs args)
36633703 var x = args . Data . ReadInt16 ( ) ;
36643704 var y = args . Data . ReadInt16 ( ) ;
36653705 var t = args . Data . ReadInt8 ( ) ;
3706+ var cw = args . Data . ReadInt8 ( ) ; //PaintCoatWall
36663707
36673708 if ( x < 0 || y < 0 || x >= Main . maxTilesX || y >= Main . maxTilesY || t > Main . numTileColors )
36683709 {
36693710 TShock . Log . ConsoleDebug ( GetString ( "GetDataHandlers / HandlePaintWall rejected range check {0}" , args . Player . Name ) ) ;
36703711 return true ;
36713712 }
3672- if ( OnPaintWall ( args . Player , args . Data , x , y , t ) )
3713+ if ( OnPaintWall ( args . Player , args . Data , x , y , t , cw ) )
36733714 {
36743715 return true ;
36753716 }
@@ -3928,9 +3969,10 @@ private static bool HandlePlaceObject(GetDataHandlerArgs args)
39283969 short type = args . Data . ReadInt16 ( ) ;
39293970 short style = args . Data . ReadInt16 ( ) ;
39303971 byte alternate = args . Data . ReadInt8 ( ) ;
3972+ sbyte random = ( sbyte ) args . Data . ReadInt8 ( ) ;
39313973 bool direction = args . Data . ReadBoolean ( ) ;
39323974
3933- if ( OnPlaceObject ( args . Player , args . Data , x , y , type , style , alternate , direction ) )
3975+ if ( OnPlaceObject ( args . Player , args . Data , x , y , type , style , alternate , random , direction ) )
39343976 return true ;
39353977
39363978 return false ;
@@ -4068,7 +4110,7 @@ private static bool HandlePlayerPortalTeleport(GetDataHandlerArgs args)
40684110
40694111 private static bool HandleNpcTeleportPortal ( GetDataHandlerArgs args )
40704112 {
4071- var npcIndex = args . Data . ReadByte ( ) ;
4113+ var npcIndex = args . Data . ReadUInt16 ( ) ;
40724114 var portalColorIndex = args . Data . ReadInt16 ( ) ;
40734115 var newPosition = new Vector2 ( args . Data . ReadSingle ( ) , args . Data . ReadSingle ( ) ) ;
40744116 var velocity = new Vector2 ( args . Data . ReadSingle ( ) , args . Data . ReadSingle ( ) ) ;
@@ -4162,8 +4204,9 @@ private static bool HandlePlayerDamageV2(GetDataHandlerArgs args)
41624204 var bits = ( BitsByte ) ( args . Data . ReadByte ( ) ) ;
41634205 var crit = bits [ 0 ] ;
41644206 var pvp = bits [ 1 ] ;
4207+ var cooldownCounter = ( sbyte ) args . Data . ReadInt8 ( ) ;
41654208
4166- if ( OnPlayerDamage ( args . Player , args . Data , id , direction , dmg , pvp , crit , playerDeathReason ) )
4209+ if ( OnPlayerDamage ( args . Player , args . Data , id , direction , dmg , pvp , crit , cooldownCounter , playerDeathReason ) )
41674210 return true ;
41684211
41694212 return false ;
0 commit comments