mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-19 14:11:06 +03:00
Compare commits
12 Commits
87ae3b512b
...
c099226cd2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c099226cd2 | ||
|
|
ae64833a5c | ||
|
|
728d13b216 | ||
|
|
f42416bd0b | ||
|
|
b076c2c573 | ||
|
|
0962e5952e | ||
|
|
e51df96e8d | ||
|
|
55e37fd779 | ||
|
|
71b7b159de | ||
|
|
953fb372d8 | ||
|
|
03bd53324a | ||
|
|
1c85269d1c |
@ -16,4 +16,5 @@ target_include_directories(object
|
|||||||
target_link_libraries(object
|
target_link_libraries(object
|
||||||
PRIVATE
|
PRIVATE
|
||||||
db
|
db
|
||||||
|
ui
|
||||||
)
|
)
|
||||||
|
|||||||
@ -31,6 +31,14 @@ void CGObject_C::AddWorldObject() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t CGObject_C::CanBeTargetted() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t CGObject_C::CanHighlight() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CGObject_C::Disable() {
|
void CGObject_C::Disable() {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,8 @@ class CGObject_C : public CGObject, public TSHashObject<CGObject_C, CHashKeyGUID
|
|||||||
void PostReenable();
|
void PostReenable();
|
||||||
virtual void HandleOutOfRange(OUT_OF_RANGE_TYPE type) {};
|
virtual void HandleOutOfRange(OUT_OF_RANGE_TYPE type) {};
|
||||||
// TODO
|
// TODO
|
||||||
|
virtual int32_t CanHighlight();
|
||||||
|
virtual int32_t CanBeTargetted();
|
||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
CGObject_C() = default;
|
CGObject_C() = default;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#include "object/client/CGUnit_C.hpp"
|
#include "object/client/CGUnit_C.hpp"
|
||||||
|
#include "object/client/ObjMgr.hpp"
|
||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
|
#include "ui/Game.hpp"
|
||||||
|
|
||||||
WOWGUID CGUnit_C::s_activeMover;
|
WOWGUID CGUnit_C::s_activeMover;
|
||||||
|
|
||||||
@ -99,6 +101,20 @@ CGUnit_C::~CGUnit_C() {
|
|||||||
// TODO
|
// 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();
|
||||||
|
}
|
||||||
|
|
||||||
void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,10 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
|||||||
|
|
||||||
// Virtual public member functions
|
// Virtual public member functions
|
||||||
virtual ~CGUnit_C();
|
virtual ~CGUnit_C();
|
||||||
|
// TODO
|
||||||
|
virtual int32_t CanHighlight();
|
||||||
|
virtual int32_t CanBeTargetted();
|
||||||
|
// TODO
|
||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
|
CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
|
||||||
|
|||||||
@ -2,5 +2,6 @@
|
|||||||
#define UI_GAME_HPP
|
#define UI_GAME_HPP
|
||||||
|
|
||||||
#include "ui/game/CGGameUI.hpp"
|
#include "ui/game/CGGameUI.hpp"
|
||||||
|
#include "ui/game/CGPetInfo.hpp"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
6
src/ui/game/CGPetInfo.cpp
Normal file
6
src/ui/game/CGPetInfo.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "ui/game/CGPetInfo.hpp"
|
||||||
|
|
||||||
|
WOWGUID CGPetInfo::GetPet(uint32_t index) {
|
||||||
|
// TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
13
src/ui/game/CGPetInfo.hpp
Normal file
13
src/ui/game/CGPetInfo.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef UI_GAME_C_G_PET_INFO_HPP
|
||||||
|
#define UI_GAME_C_G_PET_INFO_HPP
|
||||||
|
|
||||||
|
#include "util/GUID.hpp"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
class CGPetInfo {
|
||||||
|
public:
|
||||||
|
// Static functions
|
||||||
|
static WOWGUID GetPet(uint32_t index);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1,17 +1,31 @@
|
|||||||
#include "ui/game/ScriptEvents.hpp"
|
#include "ui/game/ScriptEvents.hpp"
|
||||||
#include "object/client/ObjMgr.hpp"
|
#include "db/Db.hpp"
|
||||||
|
#include "object/Client.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
#include "ui/ScriptFunctionsSystem.hpp"
|
#include "ui/ScriptFunctionsSystem.hpp"
|
||||||
#include "ui/game/CGGameUI.hpp"
|
#include "ui/game/CGGameUI.hpp"
|
||||||
#include "ui/game/ScriptUtil.hpp"
|
#include "ui/game/ScriptUtil.hpp"
|
||||||
#include "util/GUID.hpp"
|
#include "util/GUID.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
int32_t Script_UnitExists(lua_State* L) {
|
int32_t Script_UnitExists(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto token = lua_tostring(L, 1);
|
||||||
|
WOWGUID guid = 0;
|
||||||
|
Script_GetGUIDFromToken(token, guid, false);
|
||||||
|
|
||||||
|
auto object = ClntObjMgrObjectPtr(guid, TYPE_OBJECT, __FILE__, __LINE__);
|
||||||
|
|
||||||
|
if ((object && object->CanBeTargetted()) || CGGameUI::IsRaidMemberOrPet(guid)) {
|
||||||
|
lua_pushnumber(L, 1.0);
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_UnitIsVisible(lua_State* L) {
|
int32_t Script_UnitIsVisible(lua_State* L) {
|
||||||
@ -695,7 +709,29 @@ int32_t Script_IsXPUserDisabled(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_FillLocalizedClassList(lua_State* L) {
|
int32_t Script_FillLocalizedClassList(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (lua_type(L, 1) != LUA_TTABLE) {
|
||||||
|
luaL_error(L, "Usage: FillLocalizedClassList(classTable[, isFemale])");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto isFemale = StringToBOOL(L, 2, 0);
|
||||||
|
auto sex = isFemale ? UNITSEX_FEMALE : UNITSEX_MALE;
|
||||||
|
|
||||||
|
lua_settop(L, 1);
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < g_chrClassesDB.GetNumRecords(); ++i) {
|
||||||
|
auto classRec = g_chrClassesDB.GetRecordByIndex(i);
|
||||||
|
if (classRec) {
|
||||||
|
auto displayName = CGUnit_C::GetDisplayClassNameFromRecord(classRec, sex, 0);
|
||||||
|
|
||||||
|
lua_pushstring(L, classRec->m_filename);
|
||||||
|
lua_pushstring(L, displayName);
|
||||||
|
|
||||||
|
lua_settable(L, -3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -372,7 +372,18 @@ int32_t CSimpleButton_GetTextWidth(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleButton_GetTextHeight(lua_State* L) {
|
int32_t CSimpleButton_GetTextHeight(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleButton::GetObjectType();
|
||||||
|
auto button = static_cast<CSimpleButton*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
auto text = button->m_text;
|
||||||
|
|
||||||
|
float height = text ? text->GetHeight() : 0.0f;
|
||||||
|
float ddcHeight = CoordinateGetAspectCompensation() * 1024.0f * height;
|
||||||
|
float ndcHeight = DDCToNDCWidth(ddcHeight);
|
||||||
|
|
||||||
|
lua_pushnumber(L, ndcHeight);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleButton_RegisterForClicks(lua_State* L) {
|
int32_t CSimpleButton_RegisterForClicks(lua_State* L) {
|
||||||
|
|||||||
@ -162,7 +162,17 @@ int32_t CSimpleFontString_SetFont(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFontString_GetText(lua_State* L) {
|
int32_t CSimpleFontString_GetText(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleFontString::GetObjectType();
|
||||||
|
auto string = static_cast<CSimpleFontString*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
auto text = string->GetText();
|
||||||
|
if (!text || !*text) {
|
||||||
|
text = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_pushstring(L, text);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFontString_GetFieldSize(lua_State* L) {
|
int32_t CSimpleFontString_GetFieldSize(lua_State* L) {
|
||||||
|
|||||||
@ -522,6 +522,18 @@ void CSimpleFrame::PreLoadXML(XMLNode* node, CStatus* status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSimpleFrame::GetAttribute(const char* name, int32_t& luaRef) {
|
||||||
|
auto attr = this->m_attributes.Ptr(name);
|
||||||
|
|
||||||
|
if (!attr || attr->luaRef == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
luaRef = attr->luaRef;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame::GetBoundsRect(CRect& bounds) {
|
int32_t CSimpleFrame::GetBoundsRect(CRect& bounds) {
|
||||||
if (this->IsResizePending()) {
|
if (this->IsResizePending()) {
|
||||||
this->Resize(1);
|
this->Resize(1);
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#include "ui/CScriptRegion.hpp"
|
#include "ui/CScriptRegion.hpp"
|
||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include "ui/simple/CSimpleRegion.hpp"
|
#include "ui/simple/CSimpleRegion.hpp"
|
||||||
|
#include <storm/Hash.hpp>
|
||||||
#include <storm/List.hpp>
|
#include <storm/List.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@ -17,6 +18,10 @@ class CSimpleTitleRegion;
|
|||||||
class CSimpleTop;
|
class CSimpleTop;
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
|
|
||||||
|
struct FRAMEATTR : TSHashObject<FRAMEATTR, HASHKEY_STRI> {
|
||||||
|
int32_t luaRef;
|
||||||
|
};
|
||||||
|
|
||||||
class CSimpleFrame : public CScriptRegion {
|
class CSimpleFrame : public CScriptRegion {
|
||||||
public:
|
public:
|
||||||
// Static members
|
// Static members
|
||||||
@ -71,6 +76,7 @@ class CSimpleFrame : public CScriptRegion {
|
|||||||
ScriptIx m_onAttributeChange;
|
ScriptIx m_onAttributeChange;
|
||||||
ScriptIx m_onEnable;
|
ScriptIx m_onEnable;
|
||||||
ScriptIx m_onDisable;
|
ScriptIx m_onDisable;
|
||||||
|
TSHashTable<FRAMEATTR, HASHKEY_STRI> m_attributes;
|
||||||
int32_t m_drawenabled[NUM_SIMPLEFRAME_DRAWLAYERS];
|
int32_t m_drawenabled[NUM_SIMPLEFRAME_DRAWLAYERS];
|
||||||
CBackdropGenerator* m_backdrop = nullptr;
|
CBackdropGenerator* m_backdrop = nullptr;
|
||||||
STORM_EXPLICIT_LIST(CSimpleRegion, m_regionLink) m_regions;
|
STORM_EXPLICIT_LIST(CSimpleRegion, m_regionLink) m_regions;
|
||||||
@ -126,6 +132,7 @@ class CSimpleFrame : public CScriptRegion {
|
|||||||
void DisableEvent(CSimpleEventType eventType);
|
void DisableEvent(CSimpleEventType eventType);
|
||||||
void EnableDrawLayer(uint32_t drawlayer);
|
void EnableDrawLayer(uint32_t drawlayer);
|
||||||
void EnableEvent(CSimpleEventType eventType, int32_t priority);
|
void EnableEvent(CSimpleEventType eventType, int32_t priority);
|
||||||
|
bool GetAttribute(const char* name, int32_t& luaRef);
|
||||||
int32_t GetHitRect(CRect& rect);
|
int32_t GetHitRect(CRect& rect);
|
||||||
void Hide();
|
void Hide();
|
||||||
void LoadXML_Attributes(const XMLNode* node, CStatus* status);
|
void LoadXML_Attributes(const XMLNode* node, CStatus* status);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user