mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-18 19:12:44 +03:00
feat(client): add ClientHandlers for SMSG_NEW_WORLD and SMSG_LOGIN_VERIFY_WORLD
This commit is contained in:
parent
d46e056299
commit
534cb920da
@ -2,6 +2,7 @@
|
||||
#include "async/AsyncFile.hpp"
|
||||
#include "client/ClientServices.hpp"
|
||||
#include "client/CmdLine.hpp"
|
||||
#include "client/ClientHandlers.hpp"
|
||||
#include "console/CVar.hpp"
|
||||
#include "console/Client.hpp"
|
||||
#include "console/Device.hpp"
|
||||
@ -667,5 +668,9 @@ void WowClientInit() {
|
||||
void ClientInitializeGame(int32_t continentID, const C3Vector& position) {
|
||||
// TODO
|
||||
CGGameUI::InitializeGame();
|
||||
|
||||
ClientServices::SetMessageHandler(SMSG_NEW_WORLD, &NewWorldHandler, nullptr);
|
||||
ClientServices::SetMessageHandler(SMSG_LOGIN_VERIFY_WORLD, &LoginVerifyWorldHandler, nullptr);
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
60
src/client/ClientHandlers.cpp
Normal file
60
src/client/ClientHandlers.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
#include "client/ClientHandlers.hpp"
|
||||
|
||||
#include <storm/Error.hpp>
|
||||
#include <common/DataStore.hpp>
|
||||
|
||||
#include "console/Line.hpp"
|
||||
|
||||
|
||||
uint32_t s_newZoneID = 0;
|
||||
C3Vector s_newPosition;
|
||||
float s_newFacing = 0.0f;
|
||||
const char* s_newMapname = nullptr;
|
||||
|
||||
|
||||
int32_t NewWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||
STORM_ASSERT(msgId == SMSG_NEW_WORLD);
|
||||
|
||||
msg->Get(s_newZoneID);
|
||||
msg->Get(s_newPosition.x);
|
||||
msg->Get(s_newPosition.y);
|
||||
msg->Get(s_newPosition.z);
|
||||
msg->Get(s_newFacing);
|
||||
|
||||
if (msg->IsRead()) {
|
||||
// TODO
|
||||
return 1;
|
||||
} else {
|
||||
ConsoleWrite("Bad SMSG_NEW_WORLD\n", DEFAULT_COLOR);
|
||||
msg->Reset();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t LoginVerifyWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||
STORM_ASSERT(msgId == SMSG_LOGIN_VERIFY_WORLD);
|
||||
|
||||
uint32_t zoneID;
|
||||
msg->Get(zoneID);
|
||||
|
||||
C3Vector position;
|
||||
msg->Get(position.x);
|
||||
msg->Get(position.y);
|
||||
msg->Get(position.z);
|
||||
|
||||
float facing;
|
||||
msg->Get(facing);
|
||||
// zoneID != ClntObjMgrGetMapID()
|
||||
if (false) {
|
||||
s_newFacing = facing;
|
||||
s_newPosition = position;
|
||||
s_newZoneID = zoneID;
|
||||
//if (zoneID < dword_AD4170 || zoneID > dword_AD416C || (v0 = *(_DWORD*)(dword_AD4180 + 4 * (zoneID - dword_AD4170))) == 0) {
|
||||
// ConsoleWrite("Bad SMSG_NEW_WORLD zoneID\n", 0);
|
||||
// return 0;
|
||||
//}
|
||||
//s_newMapname = *(_DWORD*)(v0 + 4);
|
||||
//LoadNewWorld(0, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
13
src/client/ClientHandlers.hpp
Normal file
13
src/client/ClientHandlers.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef CLIENT_CLIENTHANDLERS_HPP
|
||||
#define CLIENT_CLIENTHANDLERS_HPP
|
||||
|
||||
#include "net/Types.hpp"
|
||||
|
||||
class CDataStore;
|
||||
|
||||
|
||||
int32_t NewWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
int32_t LoginVerifyWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
|
||||
|
||||
#endif // CLIENT_CLIENTHANDLERS_HPP
|
@ -65,6 +65,12 @@ ClientServices* ClientServices::GetInstance() {
|
||||
|
||||
return ClientServices::s_instance;
|
||||
}
|
||||
void ClientServices::SetMessageHandler(NETMESSAGE msgId, MESSAGE_HANDLER handler, void* param) {
|
||||
STORM_ASSERT(ClientServices::s_currentConnection);
|
||||
STORM_ASSERT(handler);
|
||||
s_currentConnection->SetMessageHandler(msgId, handler, param);
|
||||
}
|
||||
|
||||
|
||||
void ClientServices::GetRealmList() {
|
||||
// TODO
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define CLIENT_CLIENT_SERVICES_HPP
|
||||
|
||||
#include "net/login/LoginResponse.hpp"
|
||||
#include "net/connection/NetClient.hpp"
|
||||
#include "tempest/Vector.hpp"
|
||||
|
||||
class ClientConnection;
|
||||
@ -34,6 +35,7 @@ class ClientServices : public LoginResponse {
|
||||
static void ConnectToSelectedServer();
|
||||
static ClientConnection* Connection();
|
||||
static ClientServices* GetInstance();
|
||||
static void SetMessageHandler(NETMESSAGE msgId, MESSAGE_HANDLER handler, void* param);
|
||||
static void GetRealmList();
|
||||
static void GetCharacterList();
|
||||
static void CharacterLogin(uint64_t id, const C3Vector& position);
|
||||
|
Loading…
Reference in New Issue
Block a user