Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Server not tracks deaths, Now players can be viewed with the /death, /pvpdeath, /alldeath and /allpvpdeath commands. #2768

Draft
wants to merge 9 commits into
base: general-devel
Choose a base branch
from
73 changes: 73 additions & 0 deletions TShockAPI/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,27 @@ public static void InitCommands()
});
#endregion

#region Death Commands
add(new Command(Death, "death")
{
AllowServer = false,
HelpText = GetString("Shows your deaths from PVE.")
});
add(new Command(PVPDeath, "pvpdeath")
{
AllowServer = false,
HelpText = GetString("Shows your deaths from PVP.")
});
add(new Command(AllDeath, "alldeath")
{
HelpText = GetString("Shows the currently connected players' deaths from PVE.")
});
add(new Command(AllPVPDeath, "allpvpdeath")
{
HelpText = GetString("Shows the currently connected players' deaths from PVP.")
});
#endregion

add(new Command(Aliases, "aliases")
{
HelpText = GetString("Shows a command's aliases.")
Expand Down Expand Up @@ -6752,6 +6773,58 @@ private static void ToggleGodMode(CommandArgs args)
}
}

private static void Death(CommandArgs args)
{
string tag = args.TPlayer.numberOfDeathsPVE == 1 ? "LegacyMultiplayer.25" : "LegacyMultiplayer.23";
NetworkText text = NetworkText.FromKey(tag, args.Player.Name, args.Player.TPlayer.numberOfDeathsPVE);
args.Player.SendMessage(text.ToString(), Color.Red);
}

private static void PVPDeath(CommandArgs args)
{
string tag = args.TPlayer.numberOfDeathsPVP == 1 ? "LegacyMultiplayer.26" : "LegacyMultiplayer.24";
NetworkText text = NetworkText.FromKey(tag, args.Player.Name, args.Player.TPlayer.numberOfDeathsPVP);
args.Player.SendMessage(text.ToString(), Color.Red);
}

private static void AllDeath(CommandArgs args)
{
string tag = "";
foreach (TSPlayer ply in TShock.Players)
{
if (ply != null && ply.Active)
{
tag = ply.TPlayer.numberOfDeathsPVE == 1 ? "LegacyMultiplayer.25" : "LegacyMultiplayer.23";
NetworkText text = NetworkText.FromKey(tag, ply.Name, ply.TPlayer.numberOfDeathsPVE);
args.Player.SendMessage(text.ToString(), Color.Red);
}
}

if (string.IsNullOrEmpty(tag))
{
args.Player.SendInfoMessage(GetString("There are currently no players online."));
}
}

private static void AllPVPDeath(CommandArgs args)
{
string tag = "";
foreach (TSPlayer ply in TShock.Players)
{
if (ply != null && ply.Active)
{
tag = ply.TPlayer.numberOfDeathsPVP == 1 ? "LegacyMultiplayer.26" : "LegacyMultiplayer.24";
NetworkText text = NetworkText.FromKey(tag, ply.Name, ply.TPlayer.numberOfDeathsPVP);
args.Player.SendMessage(text.ToString(), Color.Red);
}
}

if (string.IsNullOrEmpty(tag))
{
args.Player.SendInfoMessage(GetString("There are currently no players online."));
}
}

#endregion Game Commands
}
}
26 changes: 17 additions & 9 deletions TShockAPI/DB/CharacterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public CharacterManager(IDbConnection db)
new SqlColumn("usedGummyWorm", MySqlDbType.Int32),
new SqlColumn("usedAmbrosia", MySqlDbType.Int32),
new SqlColumn("unlockedSuperCart", MySqlDbType.Int32),
new SqlColumn("enabledSuperCart", MySqlDbType.Int32)
new SqlColumn("enabledSuperCart", MySqlDbType.Int32),
new SqlColumn("numberOfDeathsPVE", MySqlDbType.Int32),
new SqlColumn("numberOfDeathsPVP", MySqlDbType.Int32)
);
var creator = new SqlTableCreator(db,
db.GetSqlType() == SqlType.Sqlite
Expand Down Expand Up @@ -134,6 +136,8 @@ public PlayerData GetPlayerData(TSPlayer player, int acctid)
playerData.usedAmbrosia = reader.Get<int>("usedAmbrosia");
playerData.unlockedSuperCart = reader.Get<int>("unlockedSuperCart");
playerData.enabledSuperCart = reader.Get<int>("enabledSuperCart");
playerData.numberOfDeathsPVE = reader.Get<int>("numberOfDeathsPVE");
playerData.numberOfDeathsPVP = reader.Get<int>("numberOfDeathsPVP");
return playerData;
}
}
Expand Down Expand Up @@ -200,8 +204,8 @@ public bool InsertPlayerData(TSPlayer player, bool fromCommand = false)
try
{
database.Query(
"INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, extraSlot, spawnX, spawnY, skinVariant, hair, hairDye, hairColor, pantsColor, shirtColor, underShirtColor, shoeColor, hideVisuals, skinColor, eyeColor, questsCompleted, usingBiomeTorches, happyFunTorchTime, unlockedBiomeTorches, currentLoadoutIndex,ateArtisanBread, usedAegisCrystal, usedAegisFruit, usedArcaneCrystal, usedGalaxyPearl, usedGummyWorm, usedAmbrosia, unlockedSuperCart, enabledSuperCart) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33);",
player.Account.ID, playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, String.Join("~", playerData.inventory), playerData.extraSlot, player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.skinVariant, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor),TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBoolArray(player.TPlayer.hideVisibleAccessory), TShock.Utils.EncodeColor(player.TPlayer.skinColor),TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished, player.TPlayer.UsingBiomeTorches ? 1 : 0, player.TPlayer.happyFunTorchTime ? 1 : 0, player.TPlayer.unlockedBiomeTorches ? 1 : 0, player.TPlayer.CurrentLoadoutIndex, player.TPlayer.ateArtisanBread ? 1 : 0, player.TPlayer.usedAegisCrystal ? 1 : 0, player.TPlayer.usedAegisFruit ? 1 : 0, player.TPlayer.usedArcaneCrystal ? 1 : 0, player.TPlayer.usedGalaxyPearl ? 1 : 0, player.TPlayer.usedGummyWorm ? 1 : 0, player.TPlayer.usedAmbrosia ? 1 : 0, player.TPlayer.unlockedSuperCart ? 1 : 0, player.TPlayer.enabledSuperCart ? 1 : 0);
"INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, extraSlot, spawnX, spawnY, skinVariant, hair, hairDye, hairColor, pantsColor, shirtColor, underShirtColor, shoeColor, hideVisuals, skinColor, eyeColor, questsCompleted, usingBiomeTorches, happyFunTorchTime, unlockedBiomeTorches, currentLoadoutIndex,ateArtisanBread, usedAegisCrystal, usedAegisFruit, usedArcaneCrystal, usedGalaxyPearl, usedGummyWorm, usedAmbrosia, unlockedSuperCart, enabledSuperCart, numberOfDeathsPVE, numberOfDeathsPVP) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33, @34, @35);",
player.Account.ID, playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, String.Join("~", playerData.inventory), playerData.extraSlot, player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.skinVariant, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor),TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBoolArray(player.TPlayer.hideVisibleAccessory), TShock.Utils.EncodeColor(player.TPlayer.skinColor),TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished, player.TPlayer.UsingBiomeTorches ? 1 : 0, player.TPlayer.happyFunTorchTime ? 1 : 0, player.TPlayer.unlockedBiomeTorches ? 1 : 0, player.TPlayer.CurrentLoadoutIndex, player.TPlayer.ateArtisanBread ? 1 : 0, player.TPlayer.usedAegisCrystal ? 1 : 0, player.TPlayer.usedAegisFruit ? 1 : 0, player.TPlayer.usedArcaneCrystal ? 1 : 0, player.TPlayer.usedGalaxyPearl ? 1 : 0, player.TPlayer.usedGummyWorm ? 1 : 0, player.TPlayer.usedAmbrosia ? 1 : 0, player.TPlayer.unlockedSuperCart ? 1 : 0, player.TPlayer.enabledSuperCart ? 1 : 0, player.TPlayer.numberOfDeathsPVE, player.TPlayer.numberOfDeathsPVP);
return true;
}
catch (Exception ex)
Expand All @@ -214,8 +218,8 @@ public bool InsertPlayerData(TSPlayer player, bool fromCommand = false)
try
{
database.Query(
"UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7, hair = @8, hairDye = @9, hairColor = @10, pantsColor = @11, shirtColor = @12, underShirtColor = @13, shoeColor = @14, hideVisuals = @15, skinColor = @16, eyeColor = @17, questsCompleted = @18, skinVariant = @19, extraSlot = @20, usingBiomeTorches = @21, happyFunTorchTime = @22, unlockedBiomeTorches = @23, currentLoadoutIndex = @24, ateArtisanBread = @25, usedAegisCrystal = @26, usedAegisFruit = @27, usedArcaneCrystal = @28, usedGalaxyPearl = @29, usedGummyWorm = @30, usedAmbrosia = @31, unlockedSuperCart = @32, enabledSuperCart = @33 WHERE Account = @5;",
playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, String.Join("~", playerData.inventory), player.Account.ID, player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor), TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBoolArray(player.TPlayer.hideVisibleAccessory), TShock.Utils.EncodeColor(player.TPlayer.skinColor), TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished, player.TPlayer.skinVariant, player.TPlayer.extraAccessory ? 1 : 0, player.TPlayer.UsingBiomeTorches ? 1 : 0, player.TPlayer.happyFunTorchTime ? 1 : 0, player.TPlayer.unlockedBiomeTorches ? 1 : 0, player.TPlayer.CurrentLoadoutIndex, player.TPlayer.ateArtisanBread ? 1 : 0, player.TPlayer.usedAegisCrystal ? 1 : 0, player.TPlayer.usedAegisFruit ? 1 : 0, player.TPlayer.usedArcaneCrystal ? 1 : 0, player.TPlayer.usedGalaxyPearl ? 1 : 0, player.TPlayer.usedGummyWorm ? 1 : 0, player.TPlayer.usedAmbrosia ? 1 : 0, player.TPlayer.unlockedSuperCart ? 1 : 0, player.TPlayer.enabledSuperCart ? 1 : 0);
"UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7, hair = @8, hairDye = @9, hairColor = @10, pantsColor = @11, shirtColor = @12, underShirtColor = @13, shoeColor = @14, hideVisuals = @15, skinColor = @16, eyeColor = @17, questsCompleted = @18, skinVariant = @19, extraSlot = @20, usingBiomeTorches = @21, happyFunTorchTime = @22, unlockedBiomeTorches = @23, currentLoadoutIndex = @24, ateArtisanBread = @25, usedAegisCrystal = @26, usedAegisFruit = @27, usedArcaneCrystal = @28, usedGalaxyPearl = @29, usedGummyWorm = @30, usedAmbrosia = @31, unlockedSuperCart = @32, enabledSuperCart = @33, numberOfDeathsPVE = @34, numberOfDeathsPVP = @35 WHERE Account = @5;",
playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, String.Join("~", playerData.inventory), player.Account.ID, player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor), TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBoolArray(player.TPlayer.hideVisibleAccessory), TShock.Utils.EncodeColor(player.TPlayer.skinColor), TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished, player.TPlayer.skinVariant, player.TPlayer.extraAccessory ? 1 : 0, player.TPlayer.UsingBiomeTorches ? 1 : 0, player.TPlayer.happyFunTorchTime ? 1 : 0, player.TPlayer.unlockedBiomeTorches ? 1 : 0, player.TPlayer.CurrentLoadoutIndex, player.TPlayer.ateArtisanBread ? 1 : 0, player.TPlayer.usedAegisCrystal ? 1 : 0, player.TPlayer.usedAegisFruit ? 1 : 0, player.TPlayer.usedArcaneCrystal ? 1 : 0, player.TPlayer.usedGalaxyPearl ? 1 : 0, player.TPlayer.usedGummyWorm ? 1 : 0, player.TPlayer.usedAmbrosia ? 1 : 0, player.TPlayer.unlockedSuperCart ? 1 : 0, player.TPlayer.enabledSuperCart ? 1 : 0, player.TPlayer.numberOfDeathsPVE, player.TPlayer.numberOfDeathsPVP);
return true;
}
catch (Exception ex)
Expand Down Expand Up @@ -270,7 +274,7 @@ public bool InsertSpecificPlayerData(TSPlayer player, PlayerData data)
try
{
database.Query(
"INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, extraSlot, spawnX, spawnY, skinVariant, hair, hairDye, hairColor, pantsColor, shirtColor, underShirtColor, shoeColor, hideVisuals, skinColor, eyeColor, questsCompleted, usingBiomeTorches, happyFunTorchTime, unlockedBiomeTorches, currentLoadoutIndex, ateArtisanBread, usedAegisCrystal, usedAegisFruit, usedArcaneCrystal, usedGalaxyPearl, usedGummyWorm, usedAmbrosia, unlockedSuperCart, enabledSuperCart) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33);",
"INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, extraSlot, spawnX, spawnY, skinVariant, hair, hairDye, hairColor, pantsColor, shirtColor, underShirtColor, shoeColor, hideVisuals, skinColor, eyeColor, questsCompleted, usingBiomeTorches, happyFunTorchTime, unlockedBiomeTorches, currentLoadoutIndex, ateArtisanBread, usedAegisCrystal, usedAegisFruit, usedArcaneCrystal, usedGalaxyPearl, usedGummyWorm, usedAmbrosia, unlockedSuperCart, enabledSuperCart, numberOfDeathsPVE, numberOfDeathsPVP) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33, @34, @35);",
player.Account.ID,
playerData.health,
playerData.maxHealth,
Expand Down Expand Up @@ -304,7 +308,9 @@ public bool InsertSpecificPlayerData(TSPlayer player, PlayerData data)
playerData.usedGummyWorm,
playerData.usedAmbrosia,
playerData.unlockedSuperCart,
playerData.enabledSuperCart);
playerData.enabledSuperCart,
playerData.numberOfDeathsPVE,
playerData.numberOfDeathsPVP);
return true;
}
catch (Exception ex)
Expand All @@ -317,7 +323,7 @@ public bool InsertSpecificPlayerData(TSPlayer player, PlayerData data)
try
{
database.Query(
"UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7, hair = @8, hairDye = @9, hairColor = @10, pantsColor = @11, shirtColor = @12, underShirtColor = @13, shoeColor = @14, hideVisuals = @15, skinColor = @16, eyeColor = @17, questsCompleted = @18, skinVariant = @19, extraSlot = @20, usingBiomeTorches = @21, happyFunTorchTime = @22, unlockedBiomeTorches = @23, currentLoadoutIndex = @24, ateArtisanBread = @25, usedAegisCrystal = @26, usedAegisFruit = @27, usedArcaneCrystal = @28, usedGalaxyPearl = @29, usedGummyWorm = @30, usedAmbrosia = @31, unlockedSuperCart = @32, enabledSuperCart = @33 WHERE Account = @5;",
"UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7, hair = @8, hairDye = @9, hairColor = @10, pantsColor = @11, shirtColor = @12, underShirtColor = @13, shoeColor = @14, hideVisuals = @15, skinColor = @16, eyeColor = @17, questsCompleted = @18, skinVariant = @19, extraSlot = @20, usingBiomeTorches = @21, happyFunTorchTime = @22, unlockedBiomeTorches = @23, currentLoadoutIndex = @24, ateArtisanBread = @25, usedAegisCrystal = @26, usedAegisFruit = @27, usedArcaneCrystal = @28, usedGalaxyPearl = @29, usedGummyWorm = @30, usedAmbrosia = @31, unlockedSuperCart = @32, enabledSuperCart = @33, numberOfDeathsPVE = @34, numberOfDeathsPVP = @35 WHERE Account = @5;",
playerData.health,
playerData.maxHealth,
playerData.mana,
Expand Down Expand Up @@ -351,7 +357,9 @@ public bool InsertSpecificPlayerData(TSPlayer player, PlayerData data)
playerData.usedGummyWorm,
playerData.usedAmbrosia,
playerData.unlockedSuperCart,
playerData.enabledSuperCart);
playerData.enabledSuperCart,
playerData.numberOfDeathsPVE,
playerData.numberOfDeathsPVP);
return true;
}
catch (Exception ex)
Expand Down
27 changes: 24 additions & 3 deletions TShockAPI/GetDataHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,14 @@ public class SpawnEventArgs : GetDataHandledEventArgs
/// </summary>
public int RespawnTimer { get; set; }
/// <summary>
/// Player's deaths from PVE.
/// </summary>
public int NumberOfDeathsPVE { get; set; }
/// <summary>
/// Player's deaths from PVP.
/// </summary>
public int NumberOfDeathsPVP { get; set; }
/// <summary>
/// Context of where the player is spawning from.
/// </summary>
public PlayerSpawnContext SpawnContext { get; set; }
Expand All @@ -864,7 +872,7 @@ public class SpawnEventArgs : GetDataHandledEventArgs
/// PlayerSpawn - When a player spawns
/// </summary>
public static HandlerList<SpawnEventArgs> PlayerSpawn = new HandlerList<SpawnEventArgs>();
private static bool OnPlayerSpawn(TSPlayer player, MemoryStream data, byte pid, int spawnX, int spawnY, int respawnTimer, PlayerSpawnContext spawnContext)
private static bool OnPlayerSpawn(TSPlayer player, MemoryStream data, byte pid, int spawnX, int spawnY, int respawnTimer, int numberOfDeathsPVE, int numberOfDeathsPVP, PlayerSpawnContext spawnContext)
{
if (PlayerSpawn == null)
return false;
Expand All @@ -877,6 +885,8 @@ private static bool OnPlayerSpawn(TSPlayer player, MemoryStream data, byte pid,
SpawnX = spawnX,
SpawnY = spawnY,
RespawnTimer = respawnTimer,
NumberOfDeathsPVE = numberOfDeathsPVE,
NumberOfDeathsPVP = numberOfDeathsPVP,
SpawnContext = spawnContext
};
PlayerSpawn.Invoke(null, args);
Expand Down Expand Up @@ -2687,9 +2697,20 @@ private static bool HandleSpawn(GetDataHandlerArgs args)
short spawnx = args.Data.ReadInt16();
short spawny = args.Data.ReadInt16();
int respawnTimer = args.Data.ReadInt32();
short numberOfDeathsPVE = args.Data.ReadInt16();
short numberOfDeathsPVP = args.Data.ReadInt16();
PlayerSpawnContext context = (PlayerSpawnContext)args.Data.ReadByte();

if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny, respawnTimer, context))
// When the player spawn into world, the numberOfDeathsPVE and numberOfDeathsPVP is not correct on the SSC Server.
// Send the data agrain fixed them.
if (context == PlayerSpawnContext.SpawningIntoWorld && args.Player.IsLoggedIn )
{
if(numberOfDeathsPVE != args.TPlayer.numberOfDeathsPVE || numberOfDeathsPVP != args.TPlayer.numberOfDeathsPVP)
{
args.Player.Spawn(PlayerSpawnContext.SpawningIntoWorld);
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dangerous change here -- when SpawningIntoWorld with non-matching death counts (which is likely), we will no longer call the OnPlayerSpawn handler, which is very much unexpected and will cause issue with plugins.

This entire check should be moved below the OnPlayerSpawn handler call.

}
}
if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context))
return true;

if ((Main.ServerSideCharacter) && (spawnx == -1 && spawny == -1)) //this means they want to spawn to vanilla spawn
Expand Down
4 changes: 4 additions & 0 deletions TShockAPI/Net/SpawnMsg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public override PacketTypes ID
public short TileX { get; set; }
public short TileY { get; set; }
public int RespawnTimer { get; set; }
public short NumberOfDeathsPVE { get; set; }
public short NumberOfDeathsPVP { get; set; }
public PlayerSpawnContext PlayerSpawnContext { get; set; }

public override void Pack(Stream stream)
Expand All @@ -41,6 +43,8 @@ public override void Pack(Stream stream)
stream.WriteInt16(TileX);
stream.WriteInt16(TileY);
stream.WriteInt32(RespawnTimer);
stream.WriteInt16(NumberOfDeathsPVE);
stream.WriteInt16(NumberOfDeathsPVP);
stream.WriteByte((byte) PlayerSpawnContext);
}
}
Expand Down
Loading