Add fix for duplicating items abusing the disable code. Add in frozen debuff to disable
This commit is contained in:
parent
fa097e61e3
commit
0ade98dfab
2 changed files with 21 additions and 0 deletions
|
|
@ -1213,6 +1213,7 @@ namespace TShockAPI
|
||||||
{PacketTypes.LiquidSet, HandleLiquidSet},
|
{PacketTypes.LiquidSet, HandleLiquidSet},
|
||||||
{PacketTypes.PlayerSpawn, HandleSpawn},
|
{PacketTypes.PlayerSpawn, HandleSpawn},
|
||||||
{PacketTypes.ChestGetContents, HandleChestOpen},
|
{PacketTypes.ChestGetContents, HandleChestOpen},
|
||||||
|
{PacketTypes.ChestOpen, HandleChestActive},
|
||||||
{PacketTypes.ChestItem, HandleChestItem},
|
{PacketTypes.ChestItem, HandleChestItem},
|
||||||
{PacketTypes.SignNew, HandleSign},
|
{PacketTypes.SignNew, HandleSign},
|
||||||
{PacketTypes.PlayerSlot, HandlePlayerSlot},
|
{PacketTypes.PlayerSlot, HandlePlayerSlot},
|
||||||
|
|
@ -2772,6 +2773,17 @@ namespace TShockAPI
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool HandleChestActive(GetDataHandlerArgs args)
|
||||||
|
{
|
||||||
|
var id = args.Data.ReadInt16();
|
||||||
|
var x = args.Data.ReadInt32();
|
||||||
|
var y = args.Data.ReadInt32();
|
||||||
|
|
||||||
|
args.Player.ActiveChest = id;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static bool HandleChestItem(GetDataHandlerArgs args)
|
private static bool HandleChestItem(GetDataHandlerArgs args)
|
||||||
{
|
{
|
||||||
var id = args.Data.ReadInt16();
|
var id = args.Data.ReadInt16();
|
||||||
|
|
|
||||||
|
|
@ -797,12 +797,21 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTime LastDisableNotification = DateTime.UtcNow;
|
private DateTime LastDisableNotification = DateTime.UtcNow;
|
||||||
|
public int ActiveChest = -1;
|
||||||
|
|
||||||
public virtual void Disable(string reason = "", bool displayConsole = true)
|
public virtual void Disable(string reason = "", bool displayConsole = true)
|
||||||
{
|
{
|
||||||
LastThreat = DateTime.UtcNow;
|
LastThreat = DateTime.UtcNow;
|
||||||
SetBuff(33, 330, true); //Weak
|
SetBuff(33, 330, true); //Weak
|
||||||
SetBuff(32, 330, true); //Slow
|
SetBuff(32, 330, true); //Slow
|
||||||
SetBuff(23, 330, true); //Cursed
|
SetBuff(23, 330, true); //Cursed
|
||||||
|
SetBuff(47, 330, true); //Frozen
|
||||||
|
|
||||||
|
if (ActiveChest != -1)
|
||||||
|
{
|
||||||
|
SendData(PacketTypes.ChestOpen, "", -1);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(reason))
|
if (!string.IsNullOrEmpty(reason))
|
||||||
{
|
{
|
||||||
if ((DateTime.UtcNow - LastDisableNotification).TotalMilliseconds > 5000)
|
if ((DateTime.UtcNow - LastDisableNotification).TotalMilliseconds > 5000)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue