Merge pull request #3 from JadeShrineMaiden/master

Chat
This commit is contained in:
CPunch 2020-08-19 13:21:41 -05:00 committed by GitHub
commit 0f5be27c97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View File

@ -32,6 +32,7 @@ enum SHARDPACKETID {
P_FE2CL_PC_MOVEPLATFORM = 822083704,
P_FE2CL_REP_PC_GOTO_SUCC = 822083633,
P_FE2CL_GM_REP_PC_SET_VALUE = 822083781,
P_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC = 822083602,
P_FE2CL_REP_PC_AVATAR_EMOTES_CHAT = 822083730,
P_FE2CL_REP_PC_EXIT_SUCC = 822083589,
P_FE2CL_PC_MOTD_LOGIN = 822083793

View File

@ -533,6 +533,12 @@ struct sP_FE2CL_REP_PC_GOTO_SUCC {
int32_t iZ;
};
struct sP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC {
int32_t iPC_ID;
char16_t szFreeChat[128];
int32_t iEmoteCode;
};
struct sP_FE2CL_REP_PC_AVATAR_EMOTES_CHAT {
int32_t iID_From;
int32_t iEmoteCode;

View File

@ -10,8 +10,21 @@ void ChatManager::init() {
void ChatManager::chatHandler(CNSocket* sock, CNPacketData* data) {
sP_CL2FE_REQ_SEND_FREECHAT_MESSAGE* chat = (sP_CL2FE_REQ_SEND_FREECHAT_MESSAGE*)data->buf;
PlayerView plr = PlayerManager::players[sock];
// stubbed for now
sP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC* resp = (sP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC*)xmalloc(sizeof(sP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC));
resp->iPC_ID = PlayerManager::players[sock].plr.iID;
memcpy(resp->szFreeChat, chat->szFreeChat, sizeof(chat->szFreeChat));
resp->iEmoteCode = chat->iEmoteCode;
sock->sendPacket(new CNPacketData((void*)resp, P_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC, sizeof(sP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC), sock->getFEKey()));
for (CNSocket* otherSock : plr.viewable) {
sP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC* resp = (sP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC*)xmalloc(sizeof(sP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC));
resp->iPC_ID = PlayerManager::players[sock].plr.iID;
memcpy(resp->szFreeChat, chat->szFreeChat, sizeof(chat->szFreeChat));
resp->iEmoteCode = chat->iEmoteCode;
otherSock->sendPacket(new CNPacketData((void*)resp, P_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC, sizeof(sP_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC), otherSock->getFEKey()));
}
}
void ChatManager::emoteHandler(CNSocket* sock, CNPacketData* data) {