mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 21:51:06 +03:00
Some checks failed
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Has been cancelled
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Has been cancelled
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Has been cancelled
156 lines
3.4 KiB
C++
156 lines
3.4 KiB
C++
#include "object/client/CGUnit_C.hpp"
|
|
#include "object/client/ObjMgr.hpp"
|
|
#include "db/Db.hpp"
|
|
#include "ui/Game.hpp"
|
|
|
|
WOWGUID CGUnit_C::s_activeMover;
|
|
|
|
const char* CGUnit_C::GetDisplayClassNameFromRecord(const ChrClassesRec* classRec, UNIT_SEX sex, UNIT_SEX* displaySex) {
|
|
if (displaySex) {
|
|
*displaySex = sex;
|
|
}
|
|
|
|
if (!classRec) {
|
|
return nullptr;
|
|
}
|
|
|
|
if (sex == UNITSEX_MALE) {
|
|
if (*classRec->m_nameMale) {
|
|
return classRec->m_nameMale;
|
|
}
|
|
|
|
if (*classRec->m_nameFemale) {
|
|
if (displaySex) {
|
|
*displaySex = UNITSEX_FEMALE;
|
|
}
|
|
|
|
return classRec->m_nameFemale;
|
|
}
|
|
|
|
return classRec->m_name;
|
|
}
|
|
|
|
if (sex == UNITSEX_FEMALE) {
|
|
if (*classRec->m_nameFemale) {
|
|
return classRec->m_nameFemale;
|
|
}
|
|
|
|
if (*classRec->m_nameMale) {
|
|
if (displaySex) {
|
|
*displaySex = UNITSEX_MALE;
|
|
}
|
|
|
|
return classRec->m_nameMale;
|
|
}
|
|
|
|
return classRec->m_name;
|
|
}
|
|
|
|
return classRec->m_name;
|
|
}
|
|
|
|
const char* CGUnit_C::GetDisplayRaceNameFromRecord(const ChrRacesRec* raceRec, UNIT_SEX sex, UNIT_SEX* displaySex) {
|
|
if (displaySex) {
|
|
*displaySex = sex;
|
|
}
|
|
|
|
if (!raceRec) {
|
|
return nullptr;
|
|
}
|
|
|
|
if (sex == UNITSEX_MALE) {
|
|
if (*raceRec->m_nameMale) {
|
|
return raceRec->m_nameMale;
|
|
}
|
|
|
|
if (*raceRec->m_nameFemale) {
|
|
if (displaySex) {
|
|
*displaySex = UNITSEX_FEMALE;
|
|
}
|
|
|
|
return raceRec->m_nameFemale;
|
|
}
|
|
|
|
return raceRec->m_name;
|
|
}
|
|
|
|
if (sex == UNITSEX_FEMALE) {
|
|
if (*raceRec->m_nameFemale) {
|
|
return raceRec->m_nameFemale;
|
|
}
|
|
|
|
if (*raceRec->m_nameMale) {
|
|
if (displaySex) {
|
|
*displaySex = UNITSEX_MALE;
|
|
}
|
|
|
|
return raceRec->m_nameMale;
|
|
}
|
|
|
|
return raceRec->m_name;
|
|
}
|
|
|
|
return raceRec->m_name;
|
|
}
|
|
|
|
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate) : CGObject_C(time, objCreate) {
|
|
// TODO
|
|
}
|
|
|
|
CGUnit_C::~CGUnit_C() {
|
|
// TODO
|
|
}
|
|
|
|
int32_t CGUnit_C::CanHighlight() {
|
|
if (this->m_unit->flags & 0x2000000) {
|
|
if (this->m_unit->createdBy != ClntObjMgrGetActivePlayer() || this->GetGUID() != CGPetInfo::GetPet(0)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
int32_t CGUnit_C::CanBeTargetted() {
|
|
return this->CanHighlight();
|
|
}
|
|
|
|
CreatureModelDataRec* CGUnit_C::GetModelData() const {
|
|
// TODO
|
|
return nullptr;
|
|
}
|
|
|
|
int32_t CGUnit_C::GetModelFileName(const char*& name) const {
|
|
auto modelDataRec = this->GetModelData();
|
|
|
|
// Model data not found
|
|
if (!modelDataRec) {
|
|
name = "Spells\\ErrorCube.mdx";
|
|
|
|
return true;
|
|
}
|
|
|
|
name = modelDataRec->m_modelName;
|
|
|
|
return modelDataRec->m_modelName ? true : false;
|
|
}
|
|
|
|
void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
|
// TODO
|
|
|
|
this->CGObject_C::PostInit(time, init, a4);
|
|
|
|
// TODO
|
|
}
|
|
|
|
void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) {
|
|
// TODO
|
|
}
|
|
|
|
void CGUnit_C::SetStorage(uint32_t* storage, uint32_t* saved) {
|
|
this->CGObject_C::SetStorage(storage, saved);
|
|
|
|
this->m_unit = reinterpret_cast<CGUnitData*>(&storage[CGUnit::GetBaseOffset()]);
|
|
this->m_unitSaved = &saved[CGUnit::GetBaseOffsetSaved()];
|
|
}
|