better WIP

This commit is contained in:
Aaron Kimbre 2022-12-20 18:19:21 -06:00
parent c4ae05ecee
commit 9ac11f281d
8 changed files with 46 additions and 20 deletions

View File

@ -714,6 +714,14 @@ void ChatPacketHandler::HandleTeamStatusRequest(Packet* packet) {
}
}
void ChatPacketHandler::HandleGuildLeave(Packet* packet){
CINSTREAM;
LWOOBJID playerID = LWOOBJID_EMPTY;
inStream.Read(playerID);
inStream.Read(playerID);
Game::logger->Log("ChatPacketHandler", "HandleGuildLeave %llu", playerID);
}
void ChatPacketHandler::SendTeamInvite(PlayerData* receiver, PlayerData* sender) {
CBITSTREAM;
PacketUtils::WriteHeader(bitStream, CHAT_INTERNAL, MSG_CHAT_INTERNAL_ROUTE_TO_PLAYER);

View File

@ -23,6 +23,8 @@ namespace ChatPacketHandler {
void HandleTeamLootOption(Packet* packet);
void HandleTeamStatusRequest(Packet* packet);
void HandleGuildLeave(Packet* packet);
void SendTeamInvite(PlayerData* receiver, PlayerData* sender);
void SendTeamInviteConfirm(PlayerData* receiver, bool bLeaderIsFreeTrial, LWOOBJID i64LeaderID, LWOZONEID i64LeaderZoneID, uint8_t ucLootFlag, uint8_t ucNumOfOtherPlayers, uint8_t ucResponseCode, std::u16string wsLeaderName);
void SendTeamStatus(PlayerData* receiver, LWOOBJID i64LeaderID, LWOZONEID i64LeaderZoneID, uint8_t ucLootFlag, uint8_t ucNumOfOtherPlayers, std::u16string wsLeaderName);

View File

@ -289,20 +289,33 @@ void HandlePacket(Packet* packet) {
break;
// Guild messages
case MSG_CHAT_GUILD_CREATE:
Game::logger->Log("ChatPackets", "GuildCreate");
Game::logger->Log("ChatServer", "GUILD_CREATE");
break;
case MSG_CHAT_GUILD_GET_ALL:
Game::logger->Log("ChatPackets", "GuildGetAll");
case MSG_CHAT_GUILD_INVITE_RESPONSE:
Game::logger->Log("ChatServer", "GUILD_INVITE_RESPONSE");
break;
case MSG_CHAT_GUILD_LEAVE:
ChatPacketHandler::HandleGuildLeave(packet);
break;
case MSG_CHAT_GUILD_KICK:
Game::logger->Log("ChatServer", "GUILD_KICK");
break;
case MSG_CHAT_GUILD_GET_STATUS:
Game::logger->Log("ChatPackets", "GuildGetStatus");
Game::logger->Log("ChatServer", "GUILD_GET_STATUS");
break;
case MSG_CHAT_GUILD_GET_ALL:
Game::logger->Log("ChatServer", "GUILD_GET_ALL");
break;
default:
Game::logger->Log("ChatServer", "Unknown CHAT id: %i", int(packet->data[3]));
Game::logger->Log("ChatServer", "Unknown MSG_CHAT id: %i", int(packet->data[3]));
}
}

View File

@ -4545,22 +4545,13 @@ void GameMessages::SendDisplayGuildCreateBox(const LWOOBJID& objectID, bool bSho
CBITSTREAM;
CMSGHEADER;
bitStream.Write((unsigned short)GAME_MSG_DISPLAY_GUILD_CREATE_BOX);
bitStream.Write(GAME_MSG_DISPLAY_GUILD_CREATE_BOX);
bitStream.Write(objectID);
bitStream.Write((unsigned char)bShow);
SEND_PACKET;
}
void GameMessages::SendGuildCreateResponse(const SystemAddress& sysAddr, eGuildCreationResponse guildResponse, LWOOBJID guildID, std::u16string& guildName) {
CBITSTREAM;
CMSGHEADER;
bitStream.Write(MSG_CLIENT_GUILD_CREATE_RESPONSE);
bitStream.Write(guildResponse);
bitStream.Write(guildID);
PacketUtils::WriteWString(bitStream, guildName, 33);
SEND_PACKET;
}
//-----------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------- Handlers ------------------------------------------------------------------

View File

@ -540,7 +540,6 @@ namespace GameMessages {
//Guild messages:
void SendDisplayGuildCreateBox(const LWOOBJID& objectID, bool bShow, const SystemAddress& sysAddr);
void SendGuildCreateResponse(const SystemAddress& sysAddr, eGuildCreationResponse guildResponse, LWOOBJID guildID, std::u16string& guildName);
//Handlers:

View File

@ -391,7 +391,7 @@ void ClientPackets::HandleGuildCreation(const SystemAddress& sysAddr, Packet* pa
if (res->rowsCount() > 0) {
Game::logger->Log("ClientPackets", "But a guild already exists with that name!");
auto usedName = GeneralUtils::UTF8ToUTF16(guildName);
GameMessages::SendGuildCreateResponse(sysAddr, eGuildCreationResponse::REJECTED_EXISTS, LWOOBJID_EMPTY, usedName);
SendGuildCreateResponse(sysAddr, eGuildCreationResponse::REJECTED_EXISTS, LWOOBJID_EMPTY, usedName);
return;
}
@ -401,7 +401,7 @@ void ClientPackets::HandleGuildCreation(const SystemAddress& sysAddr, Packet* pa
// if (!Game::chatFilter->IsSentenceOkay(guildName, 1).empty()) {
// Game::logger->Log("ClientPackets", "But they used bad words!");
// auto usedName = GeneralUtils::UTF8ToUTF16(guildName);
// GameMessages::SendGuildCreateResponse(sysAddr, eGuildCreationResponse::REJECTED_BAD_NAME, LWOOBJID_EMPTY, usedName);
// SendGuildCreateResponse(sysAddr, eGuildCreationResponse::REJECTED_BAD_NAME, LWOOBJID_EMPTY, usedName);
// return;
// }
@ -444,7 +444,7 @@ void ClientPackets::HandleGuildCreation(const SystemAddress& sysAddr, Packet* pa
if (guildId == LWOOBJID_EMPTY){
Game::logger->Log("ClientPackets", "Unknown error ocurred while creating a guild!");
auto usedName = GeneralUtils::UTF8ToUTF16(guildName);
GameMessages::SendGuildCreateResponse(sysAddr, eGuildCreationResponse::UNKNOWN_ERROR, LWOOBJID_EMPTY, usedName);
SendGuildCreateResponse(sysAddr, eGuildCreationResponse::UNKNOWN_ERROR, LWOOBJID_EMPTY, usedName);
return;
}
@ -457,7 +457,17 @@ void ClientPackets::HandleGuildCreation(const SystemAddress& sysAddr, Packet* pa
delete insertOwner;
//Send the guild create response:
GameMessages::SendGuildCreateResponse(sysAddr, eGuildCreationResponse::CREATED, guildId, name);
SendGuildCreateResponse(sysAddr, eGuildCreationResponse::CREATED, guildId, name);
// GameMessages::SendDisplayGuildCreateBox(, true, sysAddr)
}
void ClientPackets::SendGuildCreateResponse(const SystemAddress& sysAddr, eGuildCreationResponse guildResponse, LWOOBJID guildID, std::u16string& guildName) {
CBITSTREAM;
CMSGHEADER;
bitStream.Write(MSG_CLIENT_GUILD_CREATE_RESPONSE);
bitStream.Write(guildResponse);
bitStream.Write(guildID);
PacketUtils::WriteWString(bitStream, guildName, 33);
SEND_PACKET;
}

View File

@ -8,6 +8,7 @@
#include "RakNetTypes.h"
#include "eGuildCreationResponse.h"
#include "dCommonVars.h"
namespace ClientPackets {
void HandleChatMessage(const SystemAddress& sysAddr, Packet* packet);
@ -16,6 +17,7 @@ namespace ClientPackets {
// Guild stuff
void HandleGuildCreation(const SystemAddress& sysAddr, Packet* packet);
void SendGuildCreateResponse(const SystemAddress& sysAddr, eGuildCreationResponse guildResponse, LWOOBJID guildID, std::u16string& guildName);
};
#endif // CLIENTPACKETS_H

View File

@ -1242,6 +1242,7 @@ void HandlePacket(Packet* packet) {
case MSG_WORLD_CLIENT_TMP_GUILD_CREATE: {
Game::logger->Log("WorldServer", "create a guild");
ClientPackets::HandleGuildCreation(packet->systemAddress, packet);
break;
}
default: