Merge branch 'general-devel' into fishoutnpc-event
This commit is contained in:
commit
9a49f6ad15
9 changed files with 116 additions and 32 deletions
|
|
@ -152,7 +152,8 @@ namespace TShockAPI
|
|||
{ PacketTypes.PlayerHurtV2, HandlePlayerDamageV2 },
|
||||
{ PacketTypes.PlayerDeathV2, HandlePlayerKillMeV2 },
|
||||
{ PacketTypes.FishOutNPC, HandleFishOutNPC },
|
||||
{ PacketTypes.FoodPlatterTryPlacing, HandleFoodPlatterTryPlacing }
|
||||
{ PacketTypes.FoodPlatterTryPlacing, HandleFoodPlatterTryPlacing },
|
||||
{ PacketTypes.SyncRevengeMarker, HandleSyncRevengeMarker }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -2356,6 +2357,14 @@ namespace TShockAPI
|
|||
{
|
||||
var player = args.Player;
|
||||
var size = args.Data.ReadInt16();
|
||||
|
||||
var changeType = TileChangeType.None;
|
||||
bool hasChangeType = ((size & 0x7FFF) & 0x8000) != 0;
|
||||
if (hasChangeType)
|
||||
{
|
||||
changeType = (TileChangeType)args.Data.ReadInt8();
|
||||
}
|
||||
|
||||
var tileX = args.Data.ReadInt16();
|
||||
var tileY = args.Data.ReadInt16();
|
||||
var data = args.Data;
|
||||
|
|
@ -3415,24 +3424,38 @@ namespace TShockAPI
|
|||
private static bool HandleSyncExtraValue(GetDataHandlerArgs args)
|
||||
{
|
||||
var npcIndex = args.Data.ReadInt16();
|
||||
var extraValue = args.Data.ReadSingle();
|
||||
var extraValue = args.Data.ReadInt32();
|
||||
var position = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle());
|
||||
|
||||
if (position.X < 0 || position.X >= Main.maxTilesX || position.Y < 0 || position.Y >= Main.maxTilesY)
|
||||
if (position.X < 0 || position.X >= (Main.maxTilesX * 16.0f) || position.Y < 0 || position.Y >= (Main.maxTilesY * 16.0f))
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected extents check {0}", args.Player.Name);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Main.expertMode)
|
||||
if (!Main.expertMode && !Main.masterMode)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected expert mode check {0}", args.Player.Name);
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected expert/master mode check {0}", args.Player.Name);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!args.Player.IsInRange((int)position.X, (int)position.Y))
|
||||
if (npcIndex < 0 || npcIndex >= Main.npc.Length)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected range check {0}", args.Player.Name);
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected npc id out of bounds check - NPC ID: {0}", npcIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
var npc = Main.npc[npcIndex];
|
||||
if (npc == null)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected npc is null - NPC ID: {0}", npcIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
var distanceFromCoinPacketToNpc = Utils.Distance(position, npc.position);
|
||||
if (distanceFromCoinPacketToNpc >= (5*16f)) //5 tile range
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected range check {0},{1} vs {2},{3} which is {4}", npc.position.X, npc.position.Y, position.X, position.Y, distanceFromCoinPacketToNpc);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3673,6 +3696,21 @@ namespace TShockAPI
|
|||
return false;
|
||||
}
|
||||
|
||||
private static bool HandleSyncRevengeMarker(GetDataHandlerArgs args)
|
||||
{
|
||||
int uniqueID = args.Data.ReadInt32();
|
||||
Vector2 location = args.Data.ReadVector2();
|
||||
int netId = args.Data.ReadInt32();
|
||||
float npcHpPercent = args.Data.ReadSingle();
|
||||
int npcTypeAgainstDiscouragement = args.Data.ReadInt32(); //tfw the argument is Type Against Discouragement
|
||||
int npcAiStyleAgainstDiscouragement = args.Data.ReadInt32(); //see ^
|
||||
int coinsValue = args.Data.ReadInt32();
|
||||
float baseValue = args.Data.ReadSingle();
|
||||
bool spawnedFromStatus = args.Data.ReadBoolean();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public enum EditAction
|
||||
{
|
||||
KillTile = 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue