From 8e945a569801c2a21a35f0d9ca614672fe28f230 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Thu, 31 Jan 2019 13:13:46 +1100 Subject: [PATCH] cleanup tellhandler and allow GMs to send messages to busy players --- src/common/Common.h | 5 +++++ src/common/Network/PacketDef/Chat/ServerChatDef.h | 2 +- src/world/Network/Handlers/PacketHandlers.cpp | 13 +++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/common/Common.h b/src/common/Common.h index ef55588f..389c6093 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -57,6 +57,11 @@ namespace Sapphire::Common French = 8 }; + enum TellFlags : uint8_t + { + GmTellMsg = 0x4, + }; + enum ObjKind : uint8_t { None = 0x00, diff --git a/src/common/Network/PacketDef/Chat/ServerChatDef.h b/src/common/Network/PacketDef/Chat/ServerChatDef.h index 9d7ac65c..755ad3c8 100644 --- a/src/common/Network/PacketDef/Chat/ServerChatDef.h +++ b/src/common/Network/PacketDef/Chat/ServerChatDef.h @@ -17,7 +17,7 @@ struct FFXIVIpcTell : FFXIVIpcBasePacket< Tell > { uint64_t contentId; uint16_t worldId; - uint8_t preName; + uint8_t flags; char receipientName[32]; char msg[1029]; }; diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index 4728f667..b1bd4530 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -636,14 +636,14 @@ void Sapphire::Network::GameConnection::tellHandler( FrameworkPtr pFw, return; } - if( pTargetPlayer->hasStateFlag( PlayerStateFlag::BoundByDuty ) ) + if( pTargetPlayer->hasStateFlag( PlayerStateFlag::BoundByDuty ) && !player.isActingAsGm() ) { // send error for player bound by duty // TODO: implement me return; } - if( pTargetPlayer->getOnlineStatus() == OnlineStatus::Busy ) + if( pTargetPlayer->getOnlineStatus() == OnlineStatus::Busy && !player.isActingAsGm() ) { // send error for player being busy // TODO: implement me ( i've seen this done with packet type 67 i think ) @@ -656,16 +656,13 @@ void Sapphire::Network::GameConnection::tellHandler( FrameworkPtr pFw, // TODO: world id from server tellPacket->data().contentId = player.getContentId(); tellPacket->data().worldId = 67; - // TODO: do these have a meaning? - //tellPacket.data().u1 = 0x92CD7337; - //tellPacket.data().u2a = 0x2E; - //tellPacket.data().u2b = 0x40; + if( player.isActingAsGm() ) { - tellPacket->data().preName = 0x04; + tellPacket->data().flags |= TellFlags::GmTellMsg; } - pTargetPlayer->queueChatPacket( tellPacket ); + pTargetPlayer->queueChatPacket( tellPacket ); } void Sapphire::Network::GameConnection::performNoteHandler( FrameworkPtr pFw,