added PlayerZone handler and bouncer, detect lunar towers cheat
This commit is contained in:
parent
e14af631e8
commit
2ea9a0161b
2 changed files with 105 additions and 0 deletions
|
|
@ -83,6 +83,7 @@ namespace TShockAPI
|
|||
GetDataHandlers.LiquidSet += OnLiquidSet;
|
||||
GetDataHandlers.ProjectileKill += OnProjectileKill;
|
||||
GetDataHandlers.PlayerUpdate += OnPlayerUpdate;
|
||||
GetDataHandlers.PlayerZone += OnPlayerZone;
|
||||
GetDataHandlers.KillMe += OnKillMe;
|
||||
GetDataHandlers.NewProjectile += OnNewProjectile;
|
||||
GetDataHandlers.PlaceObject += OnPlaceObject;
|
||||
|
|
@ -1000,6 +1001,40 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
/// <summary>Handles PlayerZone events for preventing spawning NPC maliciously.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
internal void OnPlayerZone(object sender, GetDataHandlers.PlayerZoneEventArgs args)
|
||||
{
|
||||
bool hasSolarTower = false;
|
||||
bool hasVortexTower = false;
|
||||
bool hasNebulaTower = false;
|
||||
bool hasStardustTower = false;
|
||||
|
||||
// May need to optimize
|
||||
foreach (var npc in Main.npc)
|
||||
{
|
||||
if (npc.netID == NPCID.LunarTowerSolar)
|
||||
hasSolarTower = true;
|
||||
else if (npc.netID == NPCID.LunarTowerVortex)
|
||||
hasVortexTower = true;
|
||||
else if (npc.netID == NPCID.LunarTowerNebula)
|
||||
hasNebulaTower = true;
|
||||
else if (npc.netID == NPCID.LunarTowerStardust)
|
||||
hasStardustTower = true;
|
||||
}
|
||||
|
||||
if((args.Zone2[1] && !hasSolarTower)
|
||||
|| (args.Zone2[2] && !hasVortexTower)
|
||||
|| (args.Zone2[3] && !hasNebulaTower)
|
||||
|| (args.Zone2[4] && !hasStardustTower)
|
||||
)
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Bouncer's KillMe hook stops crash exploits from out of bounds values.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue