mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 11:12:29 +00:00
feat(glue): add realm and character handling (#7)
* fix(build): make project compilable * feat(glue): update Character Selection screen to support switching * fix(ui): fix CSimpleFontString::GetHeight() to use proper method * feat(db): add static database classes from whoa-autocode * feat(ui): use class and area IDs for Character Selection * chore(db): update ItemRandomPropertiesRec * feat(glue): update CCharacterSelection methods * chore(db): uncomment DB records * feat(glue): implement character deletion * feat(gx): update supported text tags in GxuDetermineQuotedCode * fix(ui): fix CSimpleFontString to use the FixedColor flag only if the string does not contain color tags * feat(net): implement GrunLogin::LogOff * feat(net): implement NetClient::Disconnect * feat(login): implement trimming of realm name in LoginResponse::HandleRealmData * feat(net): implement proper disconnection from login and realm servers * feat(net): implement PING/PONG messages * feat(net): add NetClient::Destroy method * feat(net): implement ClientServices::GetRealmList (second request of Realm List) * feat(glue): implement CGlueMgr::PollRealmList * feat(glue): implement CGlueMgr::PollCreateCharacter * chore(glue): add skeleton of CCharacterComponent class * fix(build): fix build using latest features * fix(glue): kill gotos in CGlueMgr::NetDisconnectHandler * fix(build): include SDL3 --------- Co-authored-by: superp00t <superp00t@tutanota.com>
This commit is contained in:
parent
50e37d16bc
commit
957a4c7e2f
633 changed files with 1729 additions and 227 deletions
|
|
@ -234,7 +234,7 @@ float CSimpleFontString::GetHeight() {
|
|||
float v9 = v2 == 0.0f ? this->GetStringHeight() : v2;
|
||||
|
||||
float v3 = 1.0f / (CoordinateGetAspectCompensation() * 1024.0f);
|
||||
float v4 = NDCToDDCWidth(v3);
|
||||
float v4 = NDCToDDCHeight(v3);
|
||||
|
||||
return v9 <= v4 ? v4 : v9;
|
||||
}
|
||||
|
|
@ -876,9 +876,17 @@ void CSimpleFontString::UpdateString() {
|
|||
uint32_t styleFlags = this->m_styleFlags;
|
||||
|
||||
if (!(this->m_styleFlags & 0x400)) {
|
||||
// TODO
|
||||
|
||||
styleFlags |= 0x400;
|
||||
// Set FixedColor flag if the text does not contain color tags
|
||||
bool found = false;
|
||||
for (size_t i = 0; displayText && displayText[i]; ++i) {
|
||||
if (displayText[i] == '|' && (displayText[i + 1] == 'C' || displayText[i + 1] == 'c')) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
styleFlags |= 0x400u;
|
||||
}
|
||||
}
|
||||
|
||||
CImVector color = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
#include "ui/Types.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "clientobject/Unit_C.hpp"
|
||||
#include "glue/CCharacterCreation.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
int32_t Script_SetCharCustomizeFrame(lua_State* L) {
|
||||
|
|
@ -17,7 +20,19 @@ int32_t Script_ResetCharCustomize(lua_State* L) {
|
|||
}
|
||||
|
||||
int32_t Script_GetNameForRace(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto raceID = CCharacterCreation::m_character.m_characterInfo.raceID;
|
||||
auto sexID = CCharacterCreation::m_character.m_characterInfo.sexID;
|
||||
auto record = g_chrRacesDB.GetRecord(raceID);
|
||||
auto raceName = CGUnit_C::GetDisplayRaceNameFromRecord(record, sexID);
|
||||
if (record && raceName) {
|
||||
lua_pushstring(L, raceName);
|
||||
lua_pushstring(L, record->m_clientFileString);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
int32_t Script_GetFactionForRace(lua_State* L) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ int32_t Script_SetCharSelectModelFrame(lua_State* L) {
|
|||
auto frame = CScriptObject::GetScriptObjectByName(name, type);
|
||||
|
||||
if (frame) {
|
||||
CCharacterSelection::s_modelFrame = static_cast<CSimpleModelFFX*>(frame);
|
||||
CCharacterSelection::m_modelFrame = static_cast<CSimpleModelFFX*>(frame);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -54,8 +54,8 @@ int32_t Script_GetCharacterInfo(lua_State* L) {
|
|||
luaL_error(L, "Usage: GetCharacterInfo(index)");
|
||||
}
|
||||
|
||||
int index = static_cast<int>(lua_tonumber(L, 1)) - 1;
|
||||
if (index < 0 || index > CCharacterSelection::GetNumCharacters()) {
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
if (index < 0 || index >= CCharacterSelection::GetNumCharacters()) {
|
||||
lua_pushnil(L); // name
|
||||
lua_pushnil(L); // race
|
||||
lua_pushnil(L); // class
|
||||
|
|
@ -75,16 +75,14 @@ int32_t Script_GetCharacterInfo(lua_State* L) {
|
|||
auto raceName = CGUnit_C::GetDisplayRaceNameFromRecord(g_chrRacesDB.GetRecord(character.raceID), character.sexID);
|
||||
lua_pushstring(L, raceName ? raceName : "");
|
||||
|
||||
// TODO: auto className = CGUnit_C::GetDisplayClassNameFromRecord(g_chrClassesDB.GetRecord(character.classID), character.sexID);
|
||||
auto className = "Warrior";
|
||||
auto className = CGUnit_C::GetDisplayClassNameFromRecord(g_chrClassesDB.GetRecord(character.classID), character.sexID);
|
||||
lua_pushstring(L, className ? className : "");
|
||||
|
||||
lua_pushnumber(L, character.experienceLevel);
|
||||
|
||||
// TODO: auto areaRecord = g_areaTableDB.GetRecord(character.zoneID);
|
||||
void* areaRecord = nullptr;
|
||||
auto areaRecord = g_areaTableDB.GetRecord(character.zoneID);
|
||||
if (areaRecord) {
|
||||
// TODO: lua_pushstring(L, areaRecord->name)
|
||||
lua_pushstring(L, areaRecord->m_areaName);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
|
@ -108,11 +106,31 @@ int32_t Script_GetCharacterInfo(lua_State* L) {
|
|||
}
|
||||
|
||||
int32_t Script_SelectCharacter(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
luaL_error(L, "Usage: SelectCharacter(index)");
|
||||
}
|
||||
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
if (index < 1 || index >= CCharacterSelection::GetNumCharacters()) {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
CCharacterSelection::m_selectionIndex = index;
|
||||
CCharacterSelection::ShowCharacter();
|
||||
FrameScript_SignalEvent(8u, "%d", CCharacterSelection::m_selectionIndex + 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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::GetNumCharacters()) {
|
||||
CGlueMgr::DeleteCharacter(CCharacterSelection::s_characterList[index].m_characterInfo.guid);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_RenameCharacter(lua_State* L) {
|
||||
|
|
@ -131,7 +149,7 @@ int32_t Script_UpdateSelectionCustomizationScene(lua_State* L) {
|
|||
|
||||
int32_t Script_GetCharacterSelectFacing(lua_State* L) {
|
||||
// Radian to Degree
|
||||
lua_pushnumber(L, CCharacterSelection::s_charFacing * 57.29578f);
|
||||
lua_pushnumber(L, CCharacterSelection::m_charFacing * 57.29578f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -520,7 +520,8 @@ int32_t Script_RequestRealmSplitInfo(lua_State* L) {
|
|||
}
|
||||
|
||||
int32_t Script_CancelLogin(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
CGlueMgr::CancelLogin();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_GetCVar(lua_State* L) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
#include <storm/String.hpp>
|
||||
|
||||
int32_t Script_RequestRealmList(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
CGlueMgr::GetRealmList(StringToBOOL(L, 1, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_RealmListUpdateRate(lua_State* L) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue