mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 21:51:06 +03:00
Compare commits
2 Commits
8c850c0bd5
...
4bf88801ed
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bf88801ed | ||
|
|
c133d37705 |
@ -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__);
|
||||
};
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
51
src/db/rec/PaperDollItemFrameRec.cpp
Normal file
51
src/db/rec/PaperDollItemFrameRec.cpp
Normal 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;
|
||||
}
|
||||
25
src/db/rec/PaperDollItemFrameRec.hpp
Normal file
25
src/db/rec/PaperDollItemFrameRec.hpp
Normal 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
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user