mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
Compare commits
5 Commits
a69f364c90
...
f3ef0c04de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3ef0c04de | ||
|
|
6860d86369 | ||
|
|
e56bde0dde | ||
|
|
c6a89b5ef8 | ||
|
|
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();
|
||||
|
||||
@ -14,6 +14,7 @@ WowClientDB<ChrRacesRec> g_chrRacesDB;
|
||||
WowClientDB<CreatureDisplayInfoRec> g_creatureDisplayInfoDB;
|
||||
WowClientDB<CreatureDisplayInfoExtraRec> g_creatureDisplayInfoExtraDB;
|
||||
WowClientDB<CreatureModelDataRec> g_creatureModelDataDB;
|
||||
WowClientDB<CreatureSoundDataRec> g_creatureSoundDataDB;
|
||||
WowClientDB<FactionGroupRec> g_factionGroupDB;
|
||||
WowClientDB<FactionTemplateRec> g_factionTemplateDB;
|
||||
WowClientDB<ItemDisplayInfoRec> g_itemDisplayInfoDB;
|
||||
@ -22,6 +23,7 @@ WowClientDB<MapRec> g_mapDB;
|
||||
WowClientDB<PaperDollItemFrameRec> g_paperDollItemFrameDB;
|
||||
WowClientDB<SoundEntriesRec> g_soundEntriesDB;
|
||||
WowClientDB<SoundEntriesAdvancedRec> g_soundEntriesAdvancedDB;
|
||||
WowClientDB<UnitBloodLevelsRec> g_unitBloodLevelsDB;
|
||||
|
||||
void LoadDB(WowClientDB_Base* db, const char* filename, int32_t linenumber) {
|
||||
db->Load(filename, linenumber);
|
||||
@ -41,6 +43,7 @@ void StaticDBLoadAll(void (*loadFn)(WowClientDB_Base*, const char*, int32_t)) {
|
||||
loadFn(&g_creatureDisplayInfoDB, __FILE__, __LINE__);
|
||||
loadFn(&g_creatureDisplayInfoExtraDB, __FILE__, __LINE__);
|
||||
loadFn(&g_creatureModelDataDB, __FILE__, __LINE__);
|
||||
loadFn(&g_creatureSoundDataDB, __FILE__, __LINE__);
|
||||
loadFn(&g_factionGroupDB, __FILE__, __LINE__);
|
||||
loadFn(&g_factionTemplateDB, __FILE__, __LINE__);
|
||||
loadFn(&g_itemDisplayInfoDB, __FILE__, __LINE__);
|
||||
@ -49,6 +52,7 @@ void StaticDBLoadAll(void (*loadFn)(WowClientDB_Base*, const char*, int32_t)) {
|
||||
loadFn(&g_paperDollItemFrameDB, __FILE__, __LINE__);
|
||||
loadFn(&g_soundEntriesDB, __FILE__, __LINE__);
|
||||
loadFn(&g_soundEntriesAdvancedDB, __FILE__, __LINE__);
|
||||
loadFn(&g_unitBloodLevelsDB, __FILE__, __LINE__);
|
||||
};
|
||||
|
||||
void ClientDBInitialize() {
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include "db/rec/CreatureDisplayInfoRec.hpp"
|
||||
#include "db/rec/CreatureDisplayInfoExtraRec.hpp"
|
||||
#include "db/rec/CreatureModelDataRec.hpp"
|
||||
#include "db/rec/CreatureSoundDataRec.hpp"
|
||||
#include "db/rec/FactionGroupRec.hpp"
|
||||
#include "db/rec/FactionTemplateRec.hpp"
|
||||
#include "db/rec/ItemDisplayInfoRec.hpp"
|
||||
@ -23,6 +24,7 @@
|
||||
#include "db/rec/PaperDollItemFrameRec.hpp"
|
||||
#include "db/rec/SoundEntriesRec.hpp"
|
||||
#include "db/rec/SoundEntriesAdvancedRec.hpp"
|
||||
#include "db/rec/UnitBloodLevelsRec.hpp"
|
||||
|
||||
extern WowClientDB<AchievementRec> g_achievementDB;
|
||||
extern WowClientDB<AreaTableRec> g_areaTableDB;
|
||||
@ -37,6 +39,7 @@ extern WowClientDB<ChrRacesRec> g_chrRacesDB;
|
||||
extern WowClientDB<CreatureDisplayInfoRec> g_creatureDisplayInfoDB;
|
||||
extern WowClientDB<CreatureDisplayInfoExtraRec> g_creatureDisplayInfoExtraDB;
|
||||
extern WowClientDB<CreatureModelDataRec> g_creatureModelDataDB;
|
||||
extern WowClientDB<CreatureSoundDataRec> g_creatureSoundDataDB;
|
||||
extern WowClientDB<FactionGroupRec> g_factionGroupDB;
|
||||
extern WowClientDB<FactionTemplateRec> g_factionTemplateDB;
|
||||
extern WowClientDB<ItemDisplayInfoRec> g_itemDisplayInfoDB;
|
||||
@ -45,6 +48,7 @@ extern WowClientDB<MapRec> g_mapDB;
|
||||
extern WowClientDB<PaperDollItemFrameRec> g_paperDollItemFrameDB;
|
||||
extern WowClientDB<SoundEntriesRec> g_soundEntriesDB;
|
||||
extern WowClientDB<SoundEntriesAdvancedRec> g_soundEntriesAdvancedDB;
|
||||
extern WowClientDB<UnitBloodLevelsRec> g_unitBloodLevelsDB;
|
||||
|
||||
void ClientDBInitialize();
|
||||
|
||||
|
||||
75
src/db/rec/CreatureSoundDataRec.cpp
Normal file
75
src/db/rec/CreatureSoundDataRec.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#include "db/rec/CreatureSoundDataRec.hpp"
|
||||
#include "util/Locale.hpp"
|
||||
#include "util/SFile.hpp"
|
||||
|
||||
const char* CreatureSoundDataRec::GetFilename() {
|
||||
return "DBFilesClient\\CreatureSoundData.dbc";
|
||||
}
|
||||
|
||||
uint32_t CreatureSoundDataRec::GetNumColumns() {
|
||||
return 38;
|
||||
}
|
||||
|
||||
uint32_t CreatureSoundDataRec::GetRowSize() {
|
||||
return 152;
|
||||
}
|
||||
|
||||
bool CreatureSoundDataRec::NeedIDAssigned() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t CreatureSoundDataRec::GetID() {
|
||||
return this->m_ID;
|
||||
}
|
||||
|
||||
void CreatureSoundDataRec::SetID(int32_t id) {
|
||||
this->m_ID = id;
|
||||
}
|
||||
|
||||
bool CreatureSoundDataRec::Read(SFile* f, const char* stringBuffer) {
|
||||
if (
|
||||
!SFile::Read(f, &this->m_ID, sizeof(this->m_ID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundExertionID, sizeof(this->m_soundExertionID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundExertionCriticalID, sizeof(this->m_soundExertionCriticalID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundInjuryID, sizeof(this->m_soundInjuryID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundInjuryCriticalID, sizeof(this->m_soundInjuryCriticalID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundInjuryCrushingBlowID, sizeof(this->m_soundInjuryCrushingBlowID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundDeathID, sizeof(this->m_soundDeathID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundStunID, sizeof(this->m_soundStunID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundStandID, sizeof(this->m_soundStandID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFootstepID, sizeof(this->m_soundFootstepID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundAggroID, sizeof(this->m_soundAggroID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundWingFlapID, sizeof(this->m_soundWingFlapID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundWingGlideID, sizeof(this->m_soundWingGlideID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundAlertID, sizeof(this->m_soundAlertID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[0], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[1], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[2], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[3], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundFidget[4], sizeof(m_soundFidget[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_customAttack[0], sizeof(m_customAttack[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_customAttack[1], sizeof(m_customAttack[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_customAttack[2], sizeof(m_customAttack[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_customAttack[3], sizeof(m_customAttack[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_npcsoundID, sizeof(this->m_npcsoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_loopSoundID, sizeof(this->m_loopSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_creatureImpactType, sizeof(this->m_creatureImpactType), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundJumpStartID, sizeof(this->m_soundJumpStartID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundJumpEndID, sizeof(this->m_soundJumpEndID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundPetAttackID, sizeof(this->m_soundPetAttackID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundPetOrderID, sizeof(this->m_soundPetOrderID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_soundPetDismissID, sizeof(this->m_soundPetDismissID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_fidgetDelaySecondsMin, sizeof(this->m_fidgetDelaySecondsMin), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_fidgetDelaySecondsMax, sizeof(this->m_fidgetDelaySecondsMax), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_birthSoundID, sizeof(this->m_birthSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_spellCastDirectedSoundID, sizeof(this->m_spellCastDirectedSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_submergeSoundID, sizeof(this->m_submergeSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_submergedSoundID, sizeof(this->m_submergedSoundID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_creatureSoundDataIdpet, sizeof(this->m_creatureSoundDataIdpet), nullptr, nullptr, nullptr)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
52
src/db/rec/CreatureSoundDataRec.hpp
Normal file
52
src/db/rec/CreatureSoundDataRec.hpp
Normal file
@ -0,0 +1,52 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#ifndef DB_REC_CREATURE_SOUND_DATA_REC_HPP
|
||||
#define DB_REC_CREATURE_SOUND_DATA_REC_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class SFile;
|
||||
|
||||
class CreatureSoundDataRec {
|
||||
public:
|
||||
int32_t m_ID;
|
||||
int32_t m_soundExertionID;
|
||||
int32_t m_soundExertionCriticalID;
|
||||
int32_t m_soundInjuryID;
|
||||
int32_t m_soundInjuryCriticalID;
|
||||
int32_t m_soundInjuryCrushingBlowID;
|
||||
int32_t m_soundDeathID;
|
||||
int32_t m_soundStunID;
|
||||
int32_t m_soundStandID;
|
||||
int32_t m_soundFootstepID;
|
||||
int32_t m_soundAggroID;
|
||||
int32_t m_soundWingFlapID;
|
||||
int32_t m_soundWingGlideID;
|
||||
int32_t m_soundAlertID;
|
||||
int32_t m_soundFidget[5];
|
||||
int32_t m_customAttack[4];
|
||||
int32_t m_npcsoundID;
|
||||
int32_t m_loopSoundID;
|
||||
int32_t m_creatureImpactType;
|
||||
int32_t m_soundJumpStartID;
|
||||
int32_t m_soundJumpEndID;
|
||||
int32_t m_soundPetAttackID;
|
||||
int32_t m_soundPetOrderID;
|
||||
int32_t m_soundPetDismissID;
|
||||
float m_fidgetDelaySecondsMin;
|
||||
float m_fidgetDelaySecondsMax;
|
||||
int32_t m_birthSoundID;
|
||||
int32_t m_spellCastDirectedSoundID;
|
||||
int32_t m_submergeSoundID;
|
||||
int32_t m_submergedSoundID;
|
||||
int32_t m_creatureSoundDataIdpet;
|
||||
|
||||
static const char* GetFilename();
|
||||
static uint32_t GetNumColumns();
|
||||
static uint32_t GetRowSize();
|
||||
static bool NeedIDAssigned();
|
||||
int32_t GetID();
|
||||
void SetID(int32_t id);
|
||||
bool Read(SFile* f, const char* stringBuffer);
|
||||
};
|
||||
|
||||
#endif
|
||||
41
src/db/rec/UnitBloodLevelsRec.cpp
Normal file
41
src/db/rec/UnitBloodLevelsRec.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#include "db/rec/UnitBloodLevelsRec.hpp"
|
||||
#include "util/Locale.hpp"
|
||||
#include "util/SFile.hpp"
|
||||
|
||||
const char* UnitBloodLevelsRec::GetFilename() {
|
||||
return "DBFilesClient\\UnitBloodLevels.dbc";
|
||||
}
|
||||
|
||||
uint32_t UnitBloodLevelsRec::GetNumColumns() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
uint32_t UnitBloodLevelsRec::GetRowSize() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
bool UnitBloodLevelsRec::NeedIDAssigned() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t UnitBloodLevelsRec::GetID() {
|
||||
return this->m_ID;
|
||||
}
|
||||
|
||||
void UnitBloodLevelsRec::SetID(int32_t id) {
|
||||
this->m_ID = id;
|
||||
}
|
||||
|
||||
bool UnitBloodLevelsRec::Read(SFile* f, const char* stringBuffer) {
|
||||
if (
|
||||
!SFile::Read(f, &this->m_ID, sizeof(this->m_ID), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_violencelevel[0], sizeof(m_violencelevel[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_violencelevel[1], sizeof(m_violencelevel[0]), nullptr, nullptr, nullptr)
|
||||
|| !SFile::Read(f, &this->m_violencelevel[2], sizeof(m_violencelevel[0]), nullptr, nullptr, nullptr)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
23
src/db/rec/UnitBloodLevelsRec.hpp
Normal file
23
src/db/rec/UnitBloodLevelsRec.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
// DO NOT EDIT: generated by whoa-autocode
|
||||
#ifndef DB_REC_UNIT_BLOOD_LEVELS_REC_HPP
|
||||
#define DB_REC_UNIT_BLOOD_LEVELS_REC_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class SFile;
|
||||
|
||||
class UnitBloodLevelsRec {
|
||||
public:
|
||||
int32_t m_ID;
|
||||
int32_t m_violencelevel[3];
|
||||
|
||||
static const char* GetFilename();
|
||||
static uint32_t GetNumColumns();
|
||||
static uint32_t GetRowSize();
|
||||
static bool NeedIDAssigned();
|
||||
int32_t GetID();
|
||||
void SetID(int32_t id);
|
||||
bool Read(SFile* f, const char* stringBuffer);
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -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
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include "object/client/ObjMgr.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "ui/Game.hpp"
|
||||
#include <storm/Error.hpp>
|
||||
|
||||
WOWGUID CGUnit_C::s_activeMover;
|
||||
|
||||
@ -95,6 +96,10 @@ const char* CGUnit_C::GetDisplayRaceNameFromRecord(const ChrRacesRec* raceRec, U
|
||||
|
||||
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate) : CGObject_C(time, objCreate) {
|
||||
// TODO
|
||||
|
||||
this->RefreshDataPointers();
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
CGUnit_C::~CGUnit_C() {
|
||||
@ -115,16 +120,22 @@ int32_t CGUnit_C::CanBeTargetted() {
|
||||
return this->CanHighlight();
|
||||
}
|
||||
|
||||
int32_t CGUnit_C::GetDisplayID() const {
|
||||
// Prefer local display ID if set and unit's display ID hasn't been overridden from unit's
|
||||
// native display ID.
|
||||
if (this->GetLocalDisplayID() && this->GetDisplayID() == this->GetNativeDisplayID()) {
|
||||
return this->GetLocalDisplayID();
|
||||
}
|
||||
|
||||
return this->CGUnit::GetDisplayID();
|
||||
}
|
||||
|
||||
int32_t CGUnit_C::GetLocalDisplayID() const {
|
||||
return this->m_localDisplayID;
|
||||
}
|
||||
|
||||
CreatureModelDataRec* CGUnit_C::GetModelData() const {
|
||||
// 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 displayID = this->GetDisplayID();
|
||||
|
||||
auto creatureDisplayInfoRec = g_creatureDisplayInfoDB.GetRecord(displayID);
|
||||
|
||||
@ -170,6 +181,63 @@ void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeM
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGUnit_C::RefreshDataPointers() {
|
||||
auto displayID = this->GetDisplayID();
|
||||
|
||||
// Display info
|
||||
|
||||
this->m_displayInfo = g_creatureDisplayInfoDB.GetRecord(displayID);
|
||||
|
||||
if (!this->m_displayInfo) {
|
||||
// TODO auto name = this->GetUnitName(0, 1);
|
||||
// TODO SysMsgPrintf(2, 2, "NOUNITDISPLAYID|%d|%s", displayID, name);
|
||||
|
||||
this->m_displayInfo = g_creatureDisplayInfoDB.GetRecordByIndex(0);
|
||||
|
||||
if (!this->m_displayInfo) {
|
||||
STORM_APP_FATAL("Error, NO creature display records found");
|
||||
}
|
||||
}
|
||||
|
||||
// Display info extra
|
||||
|
||||
this->m_displayInfoExtra = g_creatureDisplayInfoExtraDB.GetRecord(this->m_displayInfo->m_extendedDisplayInfoID);
|
||||
|
||||
// Model data
|
||||
|
||||
this->m_modelData = g_creatureModelDataDB.GetRecord(this->m_displayInfo->m_modelID);
|
||||
|
||||
// Sound data
|
||||
|
||||
this->m_soundData = g_creatureSoundDataDB.GetRecord(this->m_displayInfo->m_soundID);
|
||||
|
||||
if (!this->m_soundData) {
|
||||
this->m_soundData = g_creatureSoundDataDB.GetRecord(this->m_modelData->m_soundID);
|
||||
}
|
||||
|
||||
// Blood levels
|
||||
|
||||
this->m_bloodRec = g_unitBloodLevelsDB.GetRecord(this->m_displayInfo->m_bloodID);
|
||||
|
||||
if (!this->m_bloodRec) {
|
||||
this->m_bloodRec = g_unitBloodLevelsDB.GetRecord(this->m_modelData->m_bloodID);
|
||||
|
||||
if (!this->m_bloodRec) {
|
||||
this->m_bloodRec = g_unitBloodLevelsDB.GetRecordByIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Creature stats
|
||||
|
||||
if (this->GetType() == HIER_TYPE_UNIT) {
|
||||
// TODO load creature stats
|
||||
}
|
||||
|
||||
// Flags
|
||||
|
||||
// TODO set flags
|
||||
}
|
||||
|
||||
void CGUnit_C::SetStorage(uint32_t* storage, uint32_t* saved) {
|
||||
this->CGObject_C::SetStorage(storage, saved);
|
||||
|
||||
|
||||
@ -9,7 +9,11 @@
|
||||
|
||||
class ChrClassesRec;
|
||||
class ChrRacesRec;
|
||||
class CreatureDisplayInfoRec;
|
||||
class CreatureDisplayInfoExtraRec;
|
||||
class CreatureModelDataRec;
|
||||
class CreatureSoundDataRec;
|
||||
class UnitBloodLevelsRec;
|
||||
|
||||
class CGUnit_C : public CGObject_C, public CGUnit {
|
||||
public:
|
||||
@ -31,15 +35,27 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
||||
|
||||
// Public member functions
|
||||
CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
|
||||
int32_t GetLocalDisplayID() const;
|
||||
int32_t GetDisplayID() 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);
|
||||
|
||||
protected:
|
||||
// Protected member functions
|
||||
int32_t GetLocalDisplayID() const;
|
||||
void RefreshDataPointers();
|
||||
|
||||
private:
|
||||
// Private member variables
|
||||
// TODO
|
||||
CreatureDisplayInfoRec* m_displayInfo;
|
||||
CreatureDisplayInfoExtraRec* m_displayInfoExtra;
|
||||
CreatureModelDataRec* m_modelData;
|
||||
CreatureSoundDataRec* m_soundData;
|
||||
// TODO
|
||||
UnitBloodLevelsRec* m_bloodRec;
|
||||
// TODO
|
||||
int32_t m_localDisplayID = 0;
|
||||
// TODO
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user