mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-08 18:36:00 +03:00
Compare commits
No commits in common. "03cb7e699ebd3ff55713c45ea31f78e5d67dcb59" and "77cb9ed9664a64d4fe4953caa5327d2cf489b8ef" have entirely different histories.
03cb7e699e
...
77cb9ed966
@ -423,10 +423,6 @@ bool ClientServices::LoadCDKey() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ClientServices::GetExpansionLevel() {
|
|
||||||
return ClientServices::Connection()->GetExpansionLevel();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClientServices::InitLoginServerCVars(int32_t overwrite, const char* locale) {
|
void ClientServices::InitLoginServerCVars(int32_t overwrite, const char* locale) {
|
||||||
if ((ClientServices::s_realmListBNVar == nullptr || ClientServices::s_realmListVar == nullptr) || overwrite != 0 ) {
|
if ((ClientServices::s_realmListBNVar == nullptr || ClientServices::s_realmListVar == nullptr) || overwrite != 0 ) {
|
||||||
ClientServices::s_decorateAccountName = CVar::Register(
|
ClientServices::s_decorateAccountName = CVar::Register(
|
||||||
|
|||||||
@ -56,7 +56,6 @@ class ClientServices : public LoginResponse {
|
|||||||
static const char* GetDefaultRealmlistString();
|
static const char* GetDefaultRealmlistString();
|
||||||
static const char* GetDefaultPatchListString();
|
static const char* GetDefaultPatchListString();
|
||||||
static bool LoadCDKey();
|
static bool LoadCDKey();
|
||||||
static int32_t GetExpansionLevel();
|
|
||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual int32_t GetLoginServerType();
|
virtual int32_t GetLoginServerType();
|
||||||
|
|||||||
@ -110,9 +110,6 @@ void CCharacterComponent::FreeComponent(CCharacterComponent* component) {
|
|||||||
// TODO: ObjectFree()
|
// TODO: ObjectFree()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::ValidateComponentData(ComponentData* data, COMPONENT_CONTEXT context) {
|
|
||||||
}
|
|
||||||
|
|
||||||
CCharacterComponent::CCharacterComponent() {
|
CCharacterComponent::CCharacterComponent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +135,3 @@ bool CCharacterComponent::Init(ComponentData* data, const char* a3) {
|
|||||||
this->m_data = *data;
|
this->m_data = *data;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrep(int32_t a2) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|||||||
@ -42,7 +42,6 @@ class CCharacterComponent {
|
|||||||
static void Initialize(EGxTexFormat format, uint32_t mipLevels, int32_t useThreads, int32_t useCompression);
|
static void Initialize(EGxTexFormat format, uint32_t mipLevels, int32_t useThreads, int32_t useCompression);
|
||||||
static CCharacterComponent* AllocComponent();
|
static CCharacterComponent* AllocComponent();
|
||||||
static void FreeComponent(CCharacterComponent* component);
|
static void FreeComponent(CCharacterComponent* component);
|
||||||
static void ValidateComponentData(ComponentData* data, COMPONENT_CONTEXT context = DEFAULT_CONTEXT);
|
|
||||||
|
|
||||||
CCharacterComponent();
|
CCharacterComponent();
|
||||||
~CCharacterComponent();
|
~CCharacterComponent();
|
||||||
@ -54,7 +53,6 @@ class CCharacterComponent {
|
|||||||
void SetRandomFacialFeature(COMPONENT_CONTEXT context = DEFAULT_CONTEXT);
|
void SetRandomFacialFeature(COMPONENT_CONTEXT context = DEFAULT_CONTEXT);
|
||||||
|
|
||||||
bool Init(ComponentData* data, const char* a3);
|
bool Init(ComponentData* data, const char* a3);
|
||||||
void RenderPrep(int32_t a2);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint32_t m_handle;
|
uint32_t m_handle;
|
||||||
|
|||||||
@ -93,9 +93,7 @@ void CCharacterCreation::ResetCharCustomizeInfo() {
|
|||||||
CCharacterCreation::CalcClasses(data.m_info.raceID);
|
CCharacterCreation::CalcClasses(data.m_info.raceID);
|
||||||
CCharacterCreation::InitCharacterComponent(&data, 1);
|
CCharacterCreation::InitCharacterComponent(&data, 1);
|
||||||
|
|
||||||
CCharacterCreation::SetSelectedClass(CCharacterCreation::GetRandomClassID());
|
// TODO
|
||||||
|
|
||||||
data.m_info.classID = CCharacterCreation::m_selectedClassID;
|
|
||||||
|
|
||||||
CCharacterCreation::m_raceIndex = -1;
|
CCharacterCreation::m_raceIndex = -1;
|
||||||
for (uint32_t i = 0; i < CCharacterCreation::m_races.Count(); ++i) {
|
for (uint32_t i = 0; i < CCharacterCreation::m_races.Count(); ++i) {
|
||||||
@ -105,7 +103,7 @@ void CCharacterCreation::ResetCharCustomizeInfo() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: CNameGen::LoadNames
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::GetRandomRaceAndSex(ComponentData* data) {
|
void CCharacterCreation::GetRandomRaceAndSex(ComponentData* data) {
|
||||||
@ -185,73 +183,3 @@ void CCharacterCreation::RandomizeCharFeatures() {
|
|||||||
CCharacterCreation::m_prevHairStyleIndex = info.hairStyleID;
|
CCharacterCreation::m_prevHairStyleIndex = info.hairStyleID;
|
||||||
CCharacterCreation::m_prevFacialFeatureIndex = info.facialFeatureID;
|
CCharacterCreation::m_prevFacialFeatureIndex = info.facialFeatureID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::SetSelectedRace(int32_t raceID) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCharacterCreation::SetSelectedSex(int32_t sexID) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCharacterCreation::SetSelectedClass(int32_t classID) {
|
|
||||||
if (!CCharacterCreation::IsClassValid(classID)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CCharacterCreation::m_selectedClassID = classID;
|
|
||||||
ComponentData data;
|
|
||||||
data.m_info = CCharacterCreation::m_character->m_data.m_info;
|
|
||||||
data.m_info.classID = classID;
|
|
||||||
CCharacterComponent::ValidateComponentData(&data);
|
|
||||||
CCharacterCreation::InitCharacterComponent(&data, 0);
|
|
||||||
// TODO: sub_4E0FD0
|
|
||||||
// TODO: sub_4E6AE0((int)CCharacterCreation::m_character, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCharacterCreation::CycleCharCustomization(CHAR_CUSTOMIZATION_TYPE customization, int32_t delta) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCharacterCreation::RandomizeCharCustomization() {
|
|
||||||
CCharacterCreation::RandomizeCharFeatures();
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCharacterCreation::SetCharFacing(float facing) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCharacterCreation::CreateCharacter(const char* name) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCharacterCreation::SetToExistingCharacter(uint32_t index) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CCharacterCreation::IsRaceClassValid(int32_t raceID, int32_t classID) {
|
|
||||||
for (int32_t i = 0; i < g_charBaseInfoDB.GetNumRecords(); ++i) {
|
|
||||||
auto record = g_charBaseInfoDB.GetRecordByIndex(i);
|
|
||||||
if (record && record->m_raceID == raceID && record->m_classID == classID) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CCharacterCreation::IsClassValid(int32_t classID) {
|
|
||||||
for (uint32_t i = 0; i < CCharacterCreation::m_classes.Count(); i) {
|
|
||||||
auto record = CCharacterCreation::m_classes[i];
|
|
||||||
if (record && record->m_ID == classID) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CCharacterCreation::GetRandomClassID() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -13,15 +13,6 @@ class ChrClassesRec;
|
|||||||
|
|
||||||
|
|
||||||
class CCharacterCreation {
|
class CCharacterCreation {
|
||||||
public:
|
|
||||||
enum CHAR_CUSTOMIZATION_TYPE {
|
|
||||||
CHAR_CUSTOMIZATION_SKIN = 0,
|
|
||||||
CHAR_CUSTOMIZATION_FACE = 1,
|
|
||||||
CHAR_CUSTOMIZATION_HAIR_STYLE = 2,
|
|
||||||
CHAR_CUSTOMIZATION_HAIR_COLOR = 3,
|
|
||||||
CHAR_CUSTOMIZATION_FACIAL_FEATURE = 4
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Static variables
|
// Static variables
|
||||||
static int32_t m_selectedClassID;
|
static int32_t m_selectedClassID;
|
||||||
@ -47,17 +38,6 @@ class CCharacterCreation {
|
|||||||
static void CalcClasses(uint32_t raceID);
|
static void CalcClasses(uint32_t raceID);
|
||||||
static void InitCharacterComponent(ComponentData* data, int32_t randomize);
|
static void InitCharacterComponent(ComponentData* data, int32_t randomize);
|
||||||
static void RandomizeCharFeatures();
|
static void RandomizeCharFeatures();
|
||||||
static void SetSelectedRace(int32_t raceID);
|
|
||||||
static void SetSelectedSex(int32_t sexID);
|
|
||||||
static void SetSelectedClass(int32_t classID);
|
|
||||||
static void CycleCharCustomization(CHAR_CUSTOMIZATION_TYPE customization, int32_t delta);
|
|
||||||
static void RandomizeCharCustomization();
|
|
||||||
static void SetCharFacing(float facing);
|
|
||||||
static void CreateCharacter(const char* name);
|
|
||||||
static void SetToExistingCharacter(uint32_t index);
|
|
||||||
static int32_t IsRaceClassValid(int32_t raceID, int32_t classID);
|
|
||||||
static int32_t IsClassValid(int32_t classID);
|
|
||||||
static int32_t GetRandomClassID();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GLUE_C_CHARACTER_CREATION_HPP
|
#endif // GLUE_C_CHARACTER_CREATION_HPP
|
||||||
|
|||||||
@ -297,7 +297,3 @@ void RealmConnection::RequestCharacterLogin(uint64_t id) {
|
|||||||
msg.Finalize();
|
msg.Finalize();
|
||||||
this->Send(&msg);
|
this->Send(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t RealmConnection::GetExpansionLevel() const {
|
|
||||||
return this->m_accountExpansion;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -45,7 +45,6 @@ class RealmConnection : public NetClient {
|
|||||||
void SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4);
|
void SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4);
|
||||||
void RequestCharacterEnum();
|
void RequestCharacterEnum();
|
||||||
void RequestCharacterLogin(uint64_t id);
|
void RequestCharacterLogin(uint64_t id);
|
||||||
int32_t GetExpansionLevel() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
const char* g_glueScriptEvents[41];
|
const char* g_glueScriptEvents[41];
|
||||||
const char* g_scriptEvents[722];
|
const char* g_scriptEvents[722];
|
||||||
int32_t g_glueFrameScriptGenders[3] = { 2, 3, 1 };
|
|
||||||
|
|
||||||
void* FrameScript::s_mempool;
|
void* FrameScript::s_mempool;
|
||||||
lua_State* FrameScript::s_context;
|
lua_State* FrameScript::s_context;
|
||||||
|
|||||||
@ -42,7 +42,6 @@ class FrameScript_EventObject : public TSHashObject<FrameScript_EventObject, HAS
|
|||||||
|
|
||||||
extern const char* g_glueScriptEvents[41];
|
extern const char* g_glueScriptEvents[41];
|
||||||
extern const char* g_scriptEvents[722];
|
extern const char* g_scriptEvents[722];
|
||||||
extern int32_t g_glueFrameScriptGenders[3];
|
|
||||||
|
|
||||||
namespace FrameScript {
|
namespace FrameScript {
|
||||||
extern void* s_mempool;
|
extern void* s_mempool;
|
||||||
|
|||||||
@ -1,16 +1,12 @@
|
|||||||
#include "ui/ScriptFunctions.hpp"
|
#include "ui/ScriptFunctions.hpp"
|
||||||
#include "ui/CSimpleModelFFX.hpp"
|
#include "ui/CSimpleModelFFX.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
|
||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include "util/SFile.hpp"
|
|
||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
#include "clientobject/Unit_C.hpp"
|
#include "clientobject/Unit_C.hpp"
|
||||||
#include "glue/CCharacterCreation.hpp"
|
#include "glue/CCharacterCreation.hpp"
|
||||||
#include "glue/CCharacterComponent.hpp"
|
#include "glue/CCharacterComponent.hpp"
|
||||||
#include "glue/CCharacterSelection.hpp"
|
|
||||||
#include "client/ClientServices.hpp"
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
int32_t Script_SetCharCustomizeFrame(lua_State* L) {
|
int32_t Script_SetCharCustomizeFrame(lua_State* L) {
|
||||||
@ -97,37 +93,31 @@ int32_t Script_GetFactionForRace(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetAvailableRaces(lua_State* L) {
|
int32_t Script_GetAvailableRaces(lua_State* L) {
|
||||||
auto sexID = CCharacterCreation::m_character->m_data.m_info.sexID;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < CCharacterCreation::m_races.Count(); ++i) {
|
for (uint32_t i = 0; i < CCharacterCreation::m_races.Count(); ++i) {
|
||||||
auto raceRecord = g_chrRacesDB.GetRecord(CCharacterCreation::m_races[i]);
|
auto raceRecord = g_chrRacesDB.GetRecord(CCharacterCreation::m_races[i]);
|
||||||
auto raceName = CGUnit_C::GetDisplayRaceNameFromRecord(raceRecord, sexID);
|
auto raceName = CGUnit_C::GetDisplayRaceNameFromRecord(
|
||||||
|
raceRecord,
|
||||||
|
CCharacterCreation::m_character->m_data.m_info.sexID);
|
||||||
|
|
||||||
lua_pushstring(L, raceName);
|
lua_pushstring(L, raceName);
|
||||||
if (raceRecord) {
|
lua_pushstring(L, raceRecord ? raceRecord->m_clientFileString : nullptr);
|
||||||
lua_pushstring(L, raceRecord->m_clientFileString);
|
// TODO: Expansion Check
|
||||||
bool available = ClientServices::GetExpansionLevel() >= raceRecord->m_requiredExpansion;
|
lua_pushnumber(L, 1.0);
|
||||||
lua_pushnumber(L, available ? 1.0 : 0.0);
|
|
||||||
} else {
|
|
||||||
lua_pushstring(L, nullptr);
|
|
||||||
lua_pushnumber(L, 0.0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return CCharacterCreation::m_races.Count() * 3;
|
return CCharacterCreation::m_races.Count() * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetAvailableClasses(lua_State* L) {
|
int32_t Script_GetAvailableClasses(lua_State* L) {
|
||||||
auto sexID = CCharacterCreation::m_character->m_data.m_info.sexID;
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < g_chrClassesDB.GetNumRecords(); ++i) {
|
for (int32_t i = 0; i < g_chrClassesDB.GetNumRecords(); ++i) {
|
||||||
auto record = g_chrClassesDB.GetRecordByIndex(i);
|
auto record = g_chrClassesDB.GetRecordByIndex(i);
|
||||||
auto className = CGUnit_C::GetDisplayClassNameFromRecord(record, sexID);
|
auto className = CGUnit_C::GetDisplayClassNameFromRecord(
|
||||||
|
record,
|
||||||
|
CCharacterCreation::m_character->m_data.m_info.sexID);
|
||||||
if (className) {
|
if (className) {
|
||||||
lua_pushstring(L, className);
|
lua_pushstring(L, className);
|
||||||
lua_pushstring(L, record->m_filename);
|
lua_pushstring(L, record->m_filename);
|
||||||
bool available = ClientServices::GetExpansionLevel() >= record->m_requiredExpansion;
|
// TODO: Expansion Check
|
||||||
lua_pushnumber(L, available ? 1.0 : 0.0);
|
lua_pushnumber(L, 1.0);
|
||||||
} else {
|
} else {
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
@ -138,17 +128,16 @@ int32_t Script_GetAvailableClasses(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetClassesForRace(lua_State* L) {
|
int32_t Script_GetClassesForRace(lua_State* L) {
|
||||||
auto sexID = CCharacterCreation::m_character->m_data.m_info.sexID;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < CCharacterCreation::m_classes.Count(); ++i) {
|
for (uint32_t i = 0; i < CCharacterCreation::m_classes.Count(); ++i) {
|
||||||
auto record = CCharacterCreation::m_classes[i];
|
auto record = CCharacterCreation::m_classes[i];
|
||||||
auto className = CGUnit_C::GetDisplayClassNameFromRecord(record, sexID);
|
auto className = CGUnit_C::GetDisplayClassNameFromRecord(
|
||||||
|
record,
|
||||||
|
CCharacterCreation::m_character->m_data.m_info.sexID);
|
||||||
if (className) {
|
if (className) {
|
||||||
lua_pushstring(L, className);
|
lua_pushstring(L, className);
|
||||||
lua_pushstring(L, record->m_filename);
|
lua_pushstring(L, record->m_filename);
|
||||||
bool available = ClientServices::GetExpansionLevel() >= record->m_requiredExpansion;
|
// TODO: Expansion Check
|
||||||
lua_pushnumber(L, available ? 1.0 : 0.0);
|
lua_pushnumber(L, 1.0);
|
||||||
} else {
|
} else {
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
@ -193,8 +182,8 @@ int32_t Script_GetSelectedRace(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetSelectedSex(lua_State* L) {
|
int32_t Script_GetSelectedSex(lua_State* L) {
|
||||||
auto sexID = CCharacterCreation::m_character->m_data.m_info.sexID;
|
// TODO: g_glueFrameScriptGenders[CCharacterCreation::m_character->m_data.m_info.sexID]
|
||||||
lua_pushnumber(L, g_glueFrameScriptGenders[sexID]);
|
lua_pushnumber(L, 2.0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,111 +218,51 @@ int32_t Script_GetSelectedClass(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_SetSelectedRace(lua_State* L) {
|
int32_t Script_SetSelectedRace(lua_State* L) {
|
||||||
if (!lua_isnumber(L, 1)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return luaL_error(L, "Usage: SetSelectedRace(index)");
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t raceID = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
|
||||||
CCharacterCreation::SetSelectedRace(raceID);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_SetSelectedSex(lua_State* L) {
|
int32_t Script_SetSelectedSex(lua_State* L) {
|
||||||
if (!lua_isnumber(L, 1)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return luaL_error(L, "Usage: SetSelectedSex(index)");
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t sexID = static_cast<int32_t>(lua_tonumber(L, 1));
|
|
||||||
for (int32_t i = 0; i < 3; ++i) {
|
|
||||||
if (g_glueFrameScriptGenders[i] == sexID) {
|
|
||||||
CCharacterCreation::SetSelectedSex(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_SetSelectedClass(lua_State* L) {
|
int32_t Script_SetSelectedClass(lua_State* L) {
|
||||||
if (!lua_isnumber(L, 1)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return luaL_error(L, "Usage: SetSelectedSex(index)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
int32_t Script_UpdateCustomizationBackground(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
// NOTICE: Original client has access violation issue in this method
|
|
||||||
auto record = g_chrClassesDB.GetRecordByIndex(index);
|
|
||||||
CCharacterCreation::SetSelectedClass(record ? record->m_ID : 0);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_UpdateCustomizationBackground(lua_State*) {
|
int32_t Script_UpdateCustomizationScene(lua_State* L) {
|
||||||
CCharacterCreation::SetSelectedRace(CCharacterCreation::m_raceIndex);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t Script_UpdateCustomizationScene(lua_State*) {
|
|
||||||
CCharacterCreation::m_character->RenderPrep(0);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_CycleCharCustomization(lua_State* L) {
|
int32_t Script_CycleCharCustomization(lua_State* L) {
|
||||||
if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return luaL_error(L, "Usage: CycleCharCustomization(index, delta)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using CHAR_CUSTOMIZATION_TYPE = CCharacterCreation::CHAR_CUSTOMIZATION_TYPE;
|
int32_t Script_RandomizeCharCustomization(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
auto customization = static_cast<CHAR_CUSTOMIZATION_TYPE>(lua_tonumber(L, 1) - 1.0);
|
|
||||||
int32_t delta = static_cast<int32_t>(lua_tonumber(L, 2));
|
|
||||||
|
|
||||||
CCharacterCreation::CycleCharCustomization(customization, delta);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t Script_RandomizeCharCustomization(lua_State*) {
|
|
||||||
CCharacterCreation::RandomizeCharCustomization();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetCharacterCreateFacing(lua_State* L) {
|
int32_t Script_GetCharacterCreateFacing(lua_State* L) {
|
||||||
lua_pushnumber(L, CCharacterCreation::m_charFacing * 57.29578);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_SetCharacterCreateFacing(lua_State* L) {
|
int32_t Script_SetCharacterCreateFacing(lua_State* L) {
|
||||||
if (!lua_isnumber(L, 1)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return luaL_error(L, "Usage: SetCharacterCreateFacing(degrees)");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Degree to Radian
|
|
||||||
float facing = lua_tonumber(L, 1) * 0.017453292;
|
|
||||||
CCharacterCreation::SetCharFacing(facing);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetRandomName(lua_State* L) {
|
int32_t Script_GetRandomName(lua_State* L) {
|
||||||
// TODO: Proper implementation
|
WHOA_UNIMPLEMENTED(0);
|
||||||
// WORKAROUND:
|
|
||||||
lua_pushstring(L, "RandomName");
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_CreateCharacter(lua_State* L) {
|
int32_t Script_CreateCharacter(lua_State* L) {
|
||||||
if (lua_isstring(L, 1)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
lua_tolstring(L, 1, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
CCharacterCreation::CreateCharacter(lua_tolstring(L, 1, nullptr));
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_CustomizeExistingCharacter(lua_State* L) {
|
int32_t Script_CustomizeExistingCharacter(lua_State* L) {
|
||||||
if (!lua_isnumber(L, 1)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return luaL_error(L, "Usage: CustomizeExistingCharacter(index)");
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t index = static_cast<uint32_t>(lua_tonumber(L, 1)) - 1;
|
|
||||||
CCharacterCreation::SetToExistingCharacter(index);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_PaidChange_GetPreviousRaceIndex(lua_State* L) {
|
int32_t Script_PaidChange_GetPreviousRaceIndex(lua_State* L) {
|
||||||
@ -353,84 +282,16 @@ int32_t Script_PaidChange_GetName(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_IsRaceClassValid(lua_State* L) {
|
int32_t Script_IsRaceClassValid(lua_State* L) {
|
||||||
if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return luaL_error(L, "Usage: IsRaceClassValid(raceIndex, classIndex)");
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t raceIndex = static_cast<uint32_t>(lua_tonumber(L, 1)) - 1;
|
|
||||||
int32_t classIndex = static_cast<int32_t>(lua_tonumber(L, 2)) - 1;
|
|
||||||
|
|
||||||
auto classRecord = g_chrClassesDB.GetRecordByIndex(classIndex);
|
|
||||||
if (!classRecord) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t raceID = 0;
|
|
||||||
if (raceIndex < CCharacterCreation::m_races.Count()) {
|
|
||||||
raceID = CCharacterCreation::m_races[raceIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CCharacterCreation::IsRaceClassValid(raceID, classRecord->m_ID)) {
|
|
||||||
lua_pushnumber(L, 1.0);
|
|
||||||
} else {
|
|
||||||
lua_pushnil(L);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_IsRaceClassRestricted(lua_State* L) {
|
int32_t Script_IsRaceClassRestricted(lua_State* L) {
|
||||||
if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
return luaL_error(L, "Usage: Script_IsRaceClassRestricted(raceID, classID)");
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t raceID = static_cast<int32_t>(lua_tonumber(L, 1));
|
|
||||||
int32_t classID = static_cast<int32_t>(lua_tonumber(L, 2));
|
|
||||||
|
|
||||||
classID = (1 << classID);
|
|
||||||
|
|
||||||
bool restricted = false;
|
|
||||||
switch (raceID) {
|
|
||||||
case 1:
|
|
||||||
restricted = (CCharacterSelection::m_restrictHuman & classID) != 0;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
restricted = (CCharacterSelection::m_restrictOrc & classID) != 0;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
restricted = (CCharacterSelection::m_restrictDwarf & classID) != 0;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
restricted = (CCharacterSelection::m_restrictNightElf & classID) != 0;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
restricted = (CCharacterSelection::m_restrictUndead & classID) != 0;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
restricted = (CCharacterSelection::m_restrictTauren & classID) != 0;
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
restricted = (CCharacterSelection::m_restrictGnome & classID) != 0;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
restricted = (CCharacterSelection::m_restrictTroll & classID) != 0;
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
restricted = (CCharacterSelection::m_restrictBloodElf & classID) != 0;
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
restricted = (CCharacterSelection::m_restrictDraenei & classID) != 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
luaL_error(L, "Script_IsRaceClassRestricted: unsupported race ID(%d)", raceID);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_pushnumber(L, restricted ? 1.0 : 0.0);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetCreateBackgroundModel(lua_State* L) {
|
int32_t Script_GetCreateBackgroundModel(lua_State* L) {
|
||||||
if (SFile::IsTrial()) {
|
// TODO
|
||||||
|
if (false /* SFile::IsTrial() */) {
|
||||||
lua_pushstring(L, "CharacterSelect");
|
lua_pushstring(L, "CharacterSelect");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -307,8 +307,3 @@ int32_t SFile::RebuildHash() {
|
|||||||
// TODO
|
// TODO
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SFile::IsTrial() {
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -41,7 +41,6 @@ class SFile {
|
|||||||
static int32_t GetDataPath(char* path, size_t capacity);
|
static int32_t GetDataPath(char* path, size_t capacity);
|
||||||
static int32_t SetDataPathAlternate(const char* path);
|
static int32_t SetDataPathAlternate(const char* path);
|
||||||
static int32_t RebuildHash();
|
static int32_t RebuildHash();
|
||||||
static int32_t IsTrial();
|
|
||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
SFILE_TYPE m_type;
|
SFILE_TYPE m_type;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user