mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-19 06:01:07 +03:00
Compare commits
3 Commits
46b387c19f
...
4c1cd35899
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c1cd35899 | ||
|
|
4857e817c5 | ||
|
|
a82628adaa |
@ -160,6 +160,10 @@ ClientConnection* ClientServices::Connection() {
|
|||||||
return ClientServices::s_currentConnection;
|
return ClientServices::s_currentConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientServices::CharacterDelete(uint64_t guid) {
|
||||||
|
ClientServices::Connection()->RequestCharacterDelete(guid);
|
||||||
|
}
|
||||||
|
|
||||||
void ClientServices::Disconnect() {
|
void ClientServices::Disconnect() {
|
||||||
ClientServices::Connection()->Disconnect();
|
ClientServices::Connection()->Disconnect();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,7 @@ class ClientServices : public LoginResponse {
|
|||||||
// Static functions
|
// Static functions
|
||||||
static void ConnectToSelectedServer();
|
static void ConnectToSelectedServer();
|
||||||
static ClientConnection* Connection();
|
static ClientConnection* Connection();
|
||||||
|
static void CharacterDelete(uint64_t guid);
|
||||||
static void Disconnect();
|
static void Disconnect();
|
||||||
static const char* GetCurrentLoginPortal();
|
static const char* GetCurrentLoginPortal();
|
||||||
static const char* GetCurrentLoginServer();
|
static const char* GetCurrentLoginServer();
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include "glue/CCharacterSelectionScript.hpp"
|
#include "glue/CCharacterSelectionScript.hpp"
|
||||||
|
#include "CGlueMgr.hpp"
|
||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
#include "glue/CCharacterSelection.hpp"
|
#include "glue/CCharacterSelection.hpp"
|
||||||
#include "object/client/CGUnit_C.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) {
|
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) {
|
int32_t Script_RenameCharacter(lua_State* L) {
|
||||||
|
|||||||
@ -129,6 +129,17 @@ void CGlueMgr::ChangeRealm(const REALM_INFO* realmInfo) {
|
|||||||
ClientServices::Connection()->Connect();
|
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() {
|
void CGlueMgr::EnterWorld() {
|
||||||
if (!ClientServices::GetSelectedRealm()) {
|
if (!ClientServices::GetSelectedRealm()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -66,6 +66,7 @@ class CGlueMgr {
|
|||||||
// Static functions
|
// Static functions
|
||||||
static void CancelRealmListQuery();
|
static void CancelRealmListQuery();
|
||||||
static void ChangeRealm(const REALM_INFO* realmInfo);
|
static void ChangeRealm(const REALM_INFO* realmInfo);
|
||||||
|
static void DeleteCharacter(uint64_t guid);
|
||||||
static void DisplayLoginStatus();
|
static void DisplayLoginStatus();
|
||||||
static void EnterWorld();
|
static void EnterWorld();
|
||||||
static void GetCharacterList();
|
static void GetCharacterList();
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#include "net/connection/ClientConnection.hpp"
|
#include "net/connection/ClientConnection.hpp"
|
||||||
#include "net/Login.hpp"
|
|
||||||
#include "client/ClientServices.hpp"
|
#include "client/ClientServices.hpp"
|
||||||
|
#include "common/datastore/CDataStore.hpp"
|
||||||
|
#include "net/Login.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
|
|
||||||
void ClientConnection::AccountLogin(const char* name, const char* password, int32_t region, WOW_LOCALE locale) {
|
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;
|
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)());
|
void Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)());
|
||||||
int32_t IsConnected();
|
int32_t IsConnected();
|
||||||
int32_t PollStatus(WOWCS_OPS& op, const char** msg, int32_t& result, int32_t& errorCode);
|
int32_t PollStatus(WOWCS_OPS& op, const char** msg, int32_t& result, int32_t& errorCode);
|
||||||
|
void RequestCharacterDelete(uint64_t guid);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2,10 +2,13 @@
|
|||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
#include "ui/CBackdropGenerator.hpp"
|
#include "ui/CBackdropGenerator.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
|
#include "ui/FrameXML.hpp"
|
||||||
#include "ui/simple/CSimpleFrame.hpp"
|
#include "ui/simple/CSimpleFrame.hpp"
|
||||||
|
#include "ui/simple/CSimpleTexture.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
#include "util/StringTo.hpp"
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
#include <storm/Memory.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -19,7 +22,66 @@ int32_t CSimpleFrame_CreateTitleRegion(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_CreateTexture(lua_State* L) {
|
int32_t CSimpleFrame_CreateTexture(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleFrame::GetObjectType();
|
||||||
|
auto frame = static_cast<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
const char* name = nullptr;
|
||||||
|
if (lua_isstring(L, 2)) {
|
||||||
|
name = lua_tostring(L, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t drawlayer = DRAWLAYER_ARTWORK;
|
||||||
|
if (lua_isstring(L, 3)) {
|
||||||
|
auto drawlayerStr = lua_tostring(L, 3);
|
||||||
|
StringToDrawLayer(drawlayerStr, drawlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLNode* inheritNode = nullptr;
|
||||||
|
|
||||||
|
if (lua_type(L, 4) == LUA_TSTRING) {
|
||||||
|
auto inheritName = lua_tostring(L, 4);
|
||||||
|
const char* tainted;
|
||||||
|
bool locked;
|
||||||
|
|
||||||
|
inheritNode = FrameXML_AcquireHashNode(inheritName, tainted, locked);
|
||||||
|
|
||||||
|
if (!inheritNode) {
|
||||||
|
luaL_error(L, "%s:CreateTexture(): Couldn't find inherited node \"%s\"", frame->GetDisplayName(), inheritName);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (locked) {
|
||||||
|
luaL_error(L, "%s:CreateTexture(): Recursively inherited node \"%s\"", frame->GetDisplayName(), inheritName);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO CDataAllocator::GetData
|
||||||
|
auto texture = STORM_NEW(CSimpleTexture)(frame, drawlayer, true);
|
||||||
|
|
||||||
|
if (name && *name) {
|
||||||
|
texture->SetName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inheritNode) {
|
||||||
|
CStatus status;
|
||||||
|
|
||||||
|
texture->LoadXML(inheritNode, &status);
|
||||||
|
texture->PostLoadXML(inheritNode, &status);
|
||||||
|
|
||||||
|
auto inheritName = lua_tostring(L, 4);
|
||||||
|
FrameXML_ReleaseHashNode(inheritName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO anim related logic?
|
||||||
|
|
||||||
|
if (!texture->lua_registered) {
|
||||||
|
texture->RegisterScriptObject(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, texture->lua_objectRef);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_CreateFontString(lua_State* L) {
|
int32_t CSimpleFrame_CreateFontString(lua_State* L) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user