Merge branch 'general-devel' into handlegolfpacket
This commit is contained in:
commit
d919c11add
7 changed files with 115 additions and 3 deletions
|
|
@ -151,10 +151,12 @@ namespace TShockAPI
|
|||
{ PacketTypes.CrystalInvasionStart, HandleOldOnesArmy },
|
||||
{ PacketTypes.PlayerHurtV2, HandlePlayerDamageV2 },
|
||||
{ PacketTypes.PlayerDeathV2, HandlePlayerKillMeV2 },
|
||||
{ PacketTypes.Emoji, HandleEmoji },
|
||||
{ PacketTypes.SyncRevengeMarker, HandleSyncRevengeMarker },
|
||||
{ PacketTypes.LandGolfBallInCup, HandleLandGolfBallInCup },
|
||||
{ PacketTypes.FishOutNPC, HandleFishOutNPC },
|
||||
{ PacketTypes.FoodPlatterTryPlacing, HandleFoodPlatterTryPlacing }
|
||||
{ PacketTypes.FoodPlatterTryPlacing, HandleFoodPlatterTryPlacing },
|
||||
{ PacketTypes.SyncCavernMonsterType, HandleSyncCavernMonsterType }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1868,7 +1870,41 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// For use in a LandGolfBallInCup event.
|
||||
/// For use in an Emoji event.
|
||||
/// </summary>
|
||||
public class EmojiEventArgs : GetDataHandledEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The player index in the packet, who sends the emoji.
|
||||
/// </summary>
|
||||
public byte PlayerIndex { get; set; }
|
||||
/// <summary>
|
||||
/// The ID of the emoji, that is being received.
|
||||
/// </summary>
|
||||
public byte EmojiID { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Called when a player sends an emoji.
|
||||
/// </summary>
|
||||
public static HandlerList<EmojiEventArgs> Emoji = new HandlerList<EmojiEventArgs>();
|
||||
private static bool OnEmoji(TSPlayer player, MemoryStream data, byte playerIndex, byte emojiID)
|
||||
{
|
||||
if (Emoji == null)
|
||||
return false;
|
||||
|
||||
var args = new EmojiEventArgs
|
||||
{
|
||||
Player = player,
|
||||
Data = data,
|
||||
PlayerIndex = playerIndex,
|
||||
EmojiID = emojiID
|
||||
};
|
||||
Emoji.Invoke(null, args);
|
||||
return args.Handled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For use in a LandBallInCup event.
|
||||
/// </summary>
|
||||
public class LandGolfBallInCupEventArgs : GetDataHandledEventArgs
|
||||
{
|
||||
|
|
@ -3606,6 +3642,32 @@ namespace TShockAPI
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool HandleEmoji(GetDataHandlerArgs args)
|
||||
{
|
||||
byte playerIndex = args.Data.ReadInt8();
|
||||
byte emojiID = args.Data.ReadInt8();
|
||||
|
||||
if (OnEmoji(args.Player, args.Data, playerIndex, emojiID))
|
||||
return true;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private static bool HandleSyncRevengeMarker(GetDataHandlerArgs args)
|
||||
{
|
||||
|
|
@ -3662,6 +3724,13 @@ namespace TShockAPI
|
|||
return false;
|
||||
}
|
||||
|
||||
private static bool HandleSyncCavernMonsterType(GetDataHandlerArgs args)
|
||||
{
|
||||
args.Player.Kick("Exploit attempt detected!");
|
||||
TShock.Log.ConsoleDebug($"HandleSyncCavernMonsterType: Player is trying to modify NPC cavernMonsterType; this is a crafted packet! - From {args.Player.Name}");
|
||||
return true;
|
||||
}
|
||||
|
||||
public enum EditAction
|
||||
{
|
||||
KillTile = 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue