mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-17 05:02:29 +00:00
feat(net): implement character creation (request and response)
This commit is contained in:
parent
3fb86ab12e
commit
f67c8cfc04
13 changed files with 167 additions and 16 deletions
|
|
@ -65,6 +65,28 @@ void ClientConnection::DeleteCharacter(uint64_t guid) {
|
|||
}
|
||||
}
|
||||
|
||||
void ClientConnection::CharacterCreate(const CHARACTER_CREATE_INFO* info) {
|
||||
this->Initiate(COP_CREATE_CHARACTER, 46, nullptr);
|
||||
if (this->m_connected) {
|
||||
CDataStore msg;
|
||||
msg.Put(static_cast<uint32_t>(CMSG_CREATE_CHARACTER));
|
||||
msg.PutString(info->name);
|
||||
msg.Put(info->raceID);
|
||||
msg.Put(info->classID);
|
||||
msg.Put(info->sexID);
|
||||
msg.Put(info->skinID);
|
||||
msg.Put(info->faceID);
|
||||
msg.Put(info->hairStyleID);
|
||||
msg.Put(info->hairColorID);
|
||||
msg.Put(info->facialHairStyleID);
|
||||
msg.Put(info->outfitID);
|
||||
msg.Finalize();
|
||||
this->Send(&msg);
|
||||
} else {
|
||||
this->Cancel(4);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientConnection::Cancel(int32_t errorCode) {
|
||||
this->Complete(0, errorCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class ClientConnection : public RealmConnection {
|
|||
void EnumerateCharacters(ENUMERATE_CHARACTERS_CALLBACK fcn, void* param);
|
||||
void CharacterLogin(uint64_t id);
|
||||
void DeleteCharacter(uint64_t guid);
|
||||
void CharacterCreate(const CHARACTER_CREATE_INFO* info);
|
||||
void Cancel(int32_t errorCode);
|
||||
void Cleanup();
|
||||
void Connect();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ int32_t RealmConnection::MessageHandler(void* param, NETMESSAGE msgId, uint32_t
|
|||
}
|
||||
|
||||
case SMSG_CREATE_CHAR: {
|
||||
// TODO
|
||||
result = connection->HandleCharacterCreate(msgId, time, msg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -279,6 +279,13 @@ int32_t RealmConnection::HandleCharacterDelete(uint32_t msgId, uint32_t time, CD
|
|||
return 1;
|
||||
}
|
||||
|
||||
int32_t RealmConnection::HandleCharacterCreate(uint32_t msgId, uint32_t time, CDataStore* msg) {
|
||||
uint8_t result;
|
||||
msg->Get(result);
|
||||
static_cast<ClientConnection*>(this)->Complete(1, result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void RealmConnection::SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4) {
|
||||
// TODO
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class RealmConnection : public NetClient {
|
|||
int32_t HandleAuthResponse(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||
int32_t HandleCharEnum(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||
int32_t HandleCharacterDelete(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||
int32_t HandleCharacterCreate(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||
void SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4);
|
||||
void RequestCharacterEnum();
|
||||
void RequestCharacterLogin(uint64_t id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue