Add Emoji event
This is received from the client when they are trying to display an emoji, this comes in to the server, gets processed, and the server sends back the Emote Bubble packet to the clients.
This commit is contained in:
parent
c5fcece18d
commit
2254df21fd
2 changed files with 47 additions and 1 deletions
|
|
@ -151,6 +151,7 @@ namespace TShockAPI
|
|||
{ PacketTypes.CrystalInvasionStart, HandleOldOnesArmy },
|
||||
{ PacketTypes.PlayerHurtV2, HandlePlayerDamageV2 },
|
||||
{ PacketTypes.PlayerDeathV2, HandlePlayerKillMeV2 },
|
||||
{ PacketTypes.Emoji, HandleEmoji },
|
||||
{ PacketTypes.FishOutNPC, HandleFishOutNPC },
|
||||
{ PacketTypes.FoodPlatterTryPlacing, HandleFoodPlatterTryPlacing },
|
||||
{ PacketTypes.SyncRevengeMarker, HandleSyncRevengeMarker }
|
||||
|
|
@ -1866,6 +1867,40 @@ namespace TShockAPI
|
|||
return args.Handled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 FishOutNPC event.
|
||||
/// </summary>
|
||||
|
|
@ -3671,6 +3706,17 @@ 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 HandleFishOutNPC(GetDataHandlerArgs args)
|
||||
{
|
||||
ushort tileX = args.Data.ReadUInt16();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue