Add permission to ignore max HP/MP, add config option for max HP/MP, possibly fix SSC
Fixing SSC is done by sending packet 39 (item disown) to the client. Until a response, which is packet 22, is received from the client, all SSC-related packets are completely ignored. This ensures that the SSC data which is sent is not dirtied due to packets which are processed during RestoreCharacter or slightly afterwards.
This commit is contained in:
parent
7a8422de5c
commit
fd5c696656
5 changed files with 56 additions and 36 deletions
|
|
@ -69,17 +69,20 @@ namespace TShockAPI
|
|||
/// A timer to keep track of whether or not the player has recently thrown an explosive
|
||||
/// </summary>
|
||||
public int RecentFuse = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Whether to ignore packets that are SSC-relevant.
|
||||
/// </summary>
|
||||
public bool IgnoreSSCPackets { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A system to delay Remembered Position Teleports a few seconds
|
||||
/// </summary>
|
||||
|
||||
public int RPPending = 0;
|
||||
|
||||
public int sX = -1;
|
||||
public int sY = -1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A queue of tiles destroyed by the player for reverting.
|
||||
/// </summary>
|
||||
|
|
@ -90,10 +93,6 @@ namespace TShockAPI
|
|||
/// </summary>
|
||||
public Dictionary<Vector2, Tile> TilesCreated { get; protected set; }
|
||||
|
||||
public int FirstMaxHP { get; set; }
|
||||
|
||||
public int FirstMaxMP { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The player's group.
|
||||
/// </summary>
|
||||
|
|
@ -1300,6 +1299,9 @@ namespace TShockAPI
|
|||
|
||||
public void RestoreCharacter(TSPlayer player)
|
||||
{
|
||||
// Start ignoring SSC-related packets! This is critical so that we don't send or receive dirty data!
|
||||
player.IgnoreSSCPackets = true;
|
||||
|
||||
player.TPlayer.statLife = this.health;
|
||||
player.TPlayer.statLifeMax = this.maxHealth;
|
||||
player.TPlayer.statMana = this.maxMana;
|
||||
|
|
@ -1461,6 +1463,8 @@ namespace TShockAPI
|
|||
NetMessage.SendData(50, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(50, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(76, -1, -1, "", player.Index);
|
||||
|
||||
NetMessage.SendData(39, player.Index, -1, "", 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue