mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
Compare commits
6 Commits
0f35d38858
...
047a9c6d61
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
047a9c6d61 | ||
|
|
b69a992141 | ||
|
|
afb329c42d | ||
|
|
d253417233 | ||
|
|
0f7f0207ee | ||
|
|
a82628adaa |
@ -160,6 +160,10 @@ ClientConnection* ClientServices::Connection() {
|
||||
return ClientServices::s_currentConnection;
|
||||
}
|
||||
|
||||
void ClientServices::CharacterDelete(uint64_t guid) {
|
||||
ClientServices::Connection()->RequestCharacterDelete(guid);
|
||||
}
|
||||
|
||||
void ClientServices::Disconnect() {
|
||||
ClientServices::Connection()->Disconnect();
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ class ClientServices : public LoginResponse {
|
||||
// Static functions
|
||||
static void ConnectToSelectedServer();
|
||||
static ClientConnection* Connection();
|
||||
static void CharacterDelete(uint64_t guid);
|
||||
static void Disconnect();
|
||||
static const char* GetCurrentLoginPortal();
|
||||
static const char* GetCurrentLoginServer();
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "glue/CCharacterSelectionScript.hpp"
|
||||
#include "CGlueMgr.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "glue/CCharacterSelection.hpp"
|
||||
#include "object/client/CGUnit_C.hpp"
|
||||
@ -157,7 +158,17 @@ int32_t Script_SelectCharacter(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_DeleteCharacter(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
luaL_error(L, "Usage: DeleteCharacter(index)");
|
||||
}
|
||||
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
|
||||
if (index >= 0 && index < CCharacterSelection::s_characterList.Count()) {
|
||||
CGlueMgr::DeleteCharacter(CCharacterSelection::s_characterList.m_data[index].m_info.guid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_RenameCharacter(lua_State* L) {
|
||||
|
||||
@ -129,6 +129,17 @@ void CGlueMgr::ChangeRealm(const REALM_INFO* realmInfo) {
|
||||
ClientServices::Connection()->Connect();
|
||||
}
|
||||
|
||||
void CGlueMgr::DeleteCharacter(uint64_t guid) {
|
||||
if (guid) {
|
||||
CGlueMgr::SetIdleState(IDLE_DELETE_CHARACTER);
|
||||
|
||||
auto text = FrameScript_GetText(ClientServices::GetErrorToken(70), -1, GENDER_NOT_APPLICABLE);
|
||||
FrameScript_SignalEvent(OPEN_STATUS_DIALOG, "%s%s", "CANCEL", text);
|
||||
|
||||
ClientServices::CharacterDelete(guid);
|
||||
}
|
||||
}
|
||||
|
||||
void CGlueMgr::EnterWorld() {
|
||||
if (!ClientServices::GetSelectedRealm()) {
|
||||
return;
|
||||
|
||||
@ -66,6 +66,7 @@ class CGlueMgr {
|
||||
// Static functions
|
||||
static void CancelRealmListQuery();
|
||||
static void ChangeRealm(const REALM_INFO* realmInfo);
|
||||
static void DeleteCharacter(uint64_t guid);
|
||||
static void DisplayLoginStatus();
|
||||
static void EnterWorld();
|
||||
static void GetCharacterList();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include "net/connection/ClientConnection.hpp"
|
||||
#include "net/Login.hpp"
|
||||
#include "client/ClientServices.hpp"
|
||||
#include "common/datastore/CDataStore.hpp"
|
||||
#include "net/Login.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
|
||||
void ClientConnection::AccountLogin(const char* name, const char* password, int32_t region, WOW_LOCALE locale) {
|
||||
@ -160,3 +161,19 @@ int32_t ClientConnection::PollStatus(WOWCS_OPS& op, const char** msg, int32_t& r
|
||||
|
||||
return this->m_statusComplete;
|
||||
}
|
||||
|
||||
void ClientConnection::RequestCharacterDelete(uint64_t guid) {
|
||||
this->Initiate(COP_DELETE_CHARACTER, 70, nullptr);
|
||||
|
||||
if (this->IsConnected()) {
|
||||
CDataStore netMsg;
|
||||
netMsg.Put(static_cast<uint32_t>(CMSG_CHAR_DELETE));
|
||||
netMsg.Put(guid);
|
||||
netMsg.Finalize();
|
||||
|
||||
this->Send(&netMsg);
|
||||
}
|
||||
else {
|
||||
this->Cancel(4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ class ClientConnection : public RealmConnection {
|
||||
void Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)());
|
||||
int32_t IsConnected();
|
||||
int32_t PollStatus(WOWCS_OPS& op, const char** msg, int32_t& result, int32_t& errorCode);
|
||||
void RequestCharacterDelete(uint64_t guid);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,6 +25,14 @@ uint32_t CGUnit::TotalFieldsSaved() {
|
||||
return CGUnit::GetBaseOffsetSaved() + 123;
|
||||
}
|
||||
|
||||
int32_t CGUnit::GetDisplayID() const {
|
||||
return this->Unit()->displayID;
|
||||
}
|
||||
|
||||
int32_t CGUnit::GetNativeDisplayID() const {
|
||||
return this->Unit()->nativeDisplayID;
|
||||
}
|
||||
|
||||
CGUnitData* CGUnit::Unit() const {
|
||||
return this->m_unit;
|
||||
}
|
||||
|
||||
@ -82,6 +82,10 @@ class CGUnit {
|
||||
static uint32_t TotalFields();
|
||||
static uint32_t TotalFieldsSaved();
|
||||
|
||||
// Public member functions
|
||||
int32_t GetDisplayID() const;
|
||||
int32_t GetNativeDisplayID() const;
|
||||
|
||||
protected:
|
||||
// Protected member variables
|
||||
CGUnitData* m_unit;
|
||||
|
||||
@ -115,11 +115,34 @@ int32_t CGUnit_C::CanBeTargetted() {
|
||||
return this->CanHighlight();
|
||||
}
|
||||
|
||||
int32_t CGUnit_C::GetLocalDisplayID() const {
|
||||
return this->m_localDisplayID;
|
||||
}
|
||||
|
||||
CreatureModelDataRec* CGUnit_C::GetModelData() const {
|
||||
// TODO
|
||||
// Prefer local display ID if set and unit's display ID hasn't been overridden from unit's
|
||||
// native display ID; otherwise prefer overridden display ID.
|
||||
auto displayID = this->GetLocalDisplayID() && this->GetDisplayID() == this->GetNativeDisplayID()
|
||||
? this->GetLocalDisplayID()
|
||||
: this->GetDisplayID();
|
||||
|
||||
auto creatureDisplayInfoRec = g_creatureDisplayInfoDB.GetRecord(displayID);
|
||||
|
||||
if (!creatureDisplayInfoRec) {
|
||||
// TODO SysMsgPrintf(1, 2, "NOCREATUREDISPLAYIDFOUND|%d", displayID);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto creatureModelDataRec = g_creatureModelDataDB.GetRecord(creatureDisplayInfoRec->m_modelID);
|
||||
|
||||
if (!creatureModelDataRec) {
|
||||
// TODO SysMsgPrintf(1, 16, "INVALIDDISPLAYMODELRECORD|%d|%d", creatureDisplayInfoRec->m_modelID, creatureDisplayInfoRec->m_ID);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return creatureModelDataRec;
|
||||
}
|
||||
|
||||
int32_t CGUnit_C::GetModelFileName(const char*& name) const {
|
||||
auto modelDataRec = this->GetModelData();
|
||||
|
||||
|
||||
@ -31,10 +31,17 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
||||
|
||||
// Public member functions
|
||||
CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
|
||||
int32_t GetLocalDisplayID() const;
|
||||
CreatureModelDataRec* GetModelData() const;
|
||||
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
|
||||
void PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover);
|
||||
void SetStorage(uint32_t* storage, uint32_t* saved);
|
||||
|
||||
private:
|
||||
// Private member variables
|
||||
// TODO
|
||||
int32_t m_localDisplayID = 0;
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user