Compare commits

...

2 Commits

Author SHA1 Message Date
fallenoak
4bf88801ed
feat(ui): implement Script_GetInventorySlotInfo
Some checks are pending
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) Waiting to run
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) Waiting to run
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) Waiting to run
2026-02-06 06:43:00 -06:00
fallenoak
c133d37705
feat(db): add PaperDollItemFrameRec 2026-02-06 06:23:28 -06:00
5 changed files with 118 additions and 1 deletions

View File

@ -18,6 +18,7 @@ WowClientDB<FactionTemplateRec> g_factionTemplateDB;
WowClientDB<ItemDisplayInfoRec> g_itemDisplayInfoDB;
WowClientDB<ItemVisualsRec> g_itemVisualsDB;
WowClientDB<MapRec> g_mapDB;
WowClientDB<PaperDollItemFrameRec> g_paperDollItemFrameDB;
WowClientDB<SoundEntriesRec> g_soundEntriesDB;
WowClientDB<SoundEntriesAdvancedRec> g_soundEntriesAdvancedDB;
@ -43,6 +44,7 @@ void StaticDBLoadAll(void (*loadFn)(WowClientDB_Base*, const char*, int32_t)) {
loadFn(&g_itemDisplayInfoDB, __FILE__, __LINE__);
loadFn(&g_itemVisualsDB, __FILE__, __LINE__);
loadFn(&g_mapDB, __FILE__, __LINE__);
loadFn(&g_paperDollItemFrameDB, __FILE__, __LINE__);
loadFn(&g_soundEntriesDB, __FILE__, __LINE__);
loadFn(&g_soundEntriesAdvancedDB, __FILE__, __LINE__);
};

View File

@ -19,6 +19,7 @@
#include "db/rec/ItemDisplayInfoRec.hpp"
#include "db/rec/ItemVisualsRec.hpp"
#include "db/rec/MapRec.hpp"
#include "db/rec/PaperDollItemFrameRec.hpp"
#include "db/rec/SoundEntriesRec.hpp"
#include "db/rec/SoundEntriesAdvancedRec.hpp"
@ -39,6 +40,7 @@ extern WowClientDB<FactionTemplateRec> g_factionTemplateDB;
extern WowClientDB<ItemDisplayInfoRec> g_itemDisplayInfoDB;
extern WowClientDB<ItemVisualsRec> g_itemVisualsDB;
extern WowClientDB<MapRec> g_mapDB;
extern WowClientDB<PaperDollItemFrameRec> g_paperDollItemFrameDB;
extern WowClientDB<SoundEntriesRec> g_soundEntriesDB;
extern WowClientDB<SoundEntriesAdvancedRec> g_soundEntriesAdvancedDB;

View File

@ -0,0 +1,51 @@
// DO NOT EDIT: generated by whoa-autocode
#include "db/rec/PaperDollItemFrameRec.hpp"
#include "util/Locale.hpp"
#include "util/SFile.hpp"
const char* PaperDollItemFrameRec::GetFilename() {
return "DBFilesClient\\PaperDollItemFrame.dbc";
}
uint32_t PaperDollItemFrameRec::GetNumColumns() {
return 3;
}
uint32_t PaperDollItemFrameRec::GetRowSize() {
return 12;
}
bool PaperDollItemFrameRec::NeedIDAssigned() {
return true;
}
int32_t PaperDollItemFrameRec::GetID() {
return this->m_generatedID;
}
void PaperDollItemFrameRec::SetID(int32_t id) {
this->m_generatedID = id;
}
bool PaperDollItemFrameRec::Read(SFile* f, const char* stringBuffer) {
uint32_t itemButtonNameOfs;
uint32_t slotIconOfs;
if (
!SFile::Read(f, &itemButtonNameOfs, sizeof(uint32_t), nullptr, nullptr, nullptr)
|| !SFile::Read(f, &slotIconOfs, sizeof(uint32_t), nullptr, nullptr, nullptr)
|| !SFile::Read(f, &this->m_slotNumber, sizeof(this->m_slotNumber), nullptr, nullptr, nullptr)
) {
return false;
}
if (stringBuffer) {
this->m_itemButtonName = &stringBuffer[itemButtonNameOfs];
this->m_slotIcon = &stringBuffer[slotIconOfs];
} else {
this->m_itemButtonName = "";
this->m_slotIcon = "";
}
return true;
}

View File

@ -0,0 +1,25 @@
// DO NOT EDIT: generated by whoa-autocode
#ifndef DB_REC_PAPER_DOLL_ITEM_FRAME_REC_HPP
#define DB_REC_PAPER_DOLL_ITEM_FRAME_REC_HPP
#include <cstdint>
class SFile;
class PaperDollItemFrameRec {
public:
const char* m_itemButtonName;
const char* m_slotIcon;
int32_t m_slotNumber;
int32_t m_generatedID;
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

View File

@ -1,11 +1,48 @@
#include "ui/game/CharacterInfoScript.hpp"
#include "db/Db.hpp"
#include "ui/FrameScript.hpp"
#include "util/Lua.hpp"
#include "util/Unimplemented.hpp"
namespace {
int32_t Script_GetInventorySlotInfo(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
if (!lua_isstring(L, 1)) {
luaL_error(L, "Invalid inventory slot in GetInventorySlotInfo");
return 0;
}
auto slotName = lua_tostring(L, 1);
PaperDollItemFrameRec* slotRec = nullptr;
for (int32_t i = 0; i < g_paperDollItemFrameDB.GetNumRecords(); i++) {
auto paperDollItemFrameRec = g_paperDollItemFrameDB.GetRecordByIndex(i);
if (paperDollItemFrameRec && !SStrCmpI(slotName, paperDollItemFrameRec->m_itemButtonName)) {
slotRec = paperDollItemFrameRec;
break;
}
}
if (!slotRec) {
luaL_error(L, "Invalid inventory slot in GetInventorySlotInfo");
return 0;
}
// id
lua_pushnumber(L, slotRec->m_slotNumber);
// textureName
lua_pushstring(L, slotRec->m_slotIcon);
// checkRelic
if (slotRec->m_slotNumber == EQUIPPED_LAST) {
lua_pushnumber(L, 1.0);
} else {
lua_pushnil(L);
}
return 3;
}
int32_t Script_GetInventoryItemsForSlot(lua_State* L) {