📄 itemdb.h
字号:
#ifndef ITEMDB_H
#define ITEMDB_H
#include "dbcfile.h"
#include "wx/string.h"
#include <string>
#include <vector>
#include <map>
#include <set>
class ItemDatabase;
class ItemDisplayDB: public DBCFile
{
public:
ItemDisplayDB(): DBCFile("DBFilesClient\\ItemDisplayInfo.dbc") {}
~ItemDisplayDB() {}
/// Fields
static const size_t ItemDisplayID = 0; // uint
static const size_t Model = 1; // string
static const size_t Model2 = 2; // string
static const size_t Skin = 3; // string
static const size_t Skin2 = 4; // string
static const size_t Icon = 5; // string
static const size_t GeosetA = 6; // uint
static const size_t GeosetB = 7; // uint
static const size_t GeosetC = 8; // uint
static const size_t GeosetD = 9; // uint
static const size_t GeosetE = 10; // uint
static const size_t Flags = 11; // uint
static const size_t GeosetVisID1 = 12; // uint
static const size_t GeosetVisID2 = 13; // uint
static const size_t TexArmUpper = 14; // string
static const size_t TexArmLower = 15; // string
static const size_t TexHands = 16; // string
static const size_t TexChestUpper = 17; // string
static const size_t TexChestLower = 18; // string
static const size_t TexLegUpper = 19; // string
static const size_t TexLegLower = 20; // string
static const size_t TexFeet = 21; // string
static const size_t Visuals = 22; // uint
Record getById(unsigned int id);
bool hasId(unsigned int id);
private:
};
class ItemVisualDB: public DBCFile
{
public:
ItemVisualDB(): DBCFile("DBFilesClient\\ItemVisuals.dbc") {}
~ItemVisualDB() {}
/// Fields
static const size_t VisualID = 0; // uint
static const size_t Effect1 = 1; // uint
static const size_t Effect2 = 2; // uint
static const size_t Effect3 = 3; // uint
static const size_t Effect4 = 4; // uint
static const size_t Effect5 = 5; // uint
Record getById(unsigned int id);
};
class ItemVisualEffectDB: public DBCFile
{
public:
ItemVisualEffectDB(): DBCFile("DBFilesClient\\ItemVisualEffects.dbc") {}
~ItemVisualEffectDB() {}
/// Fields
static const size_t EffectID = 0; // uint
static const size_t Model = 1; // string
Record getById(unsigned int id);
};
class ItemSetDB: public DBCFile
{
std::set<int> avail;
public:
ItemSetDB(): DBCFile("DBFilesClient\\ItemSet.dbc") {}
~ItemSetDB() {}
static const size_t NumItems = 8;
/// Fields
static const size_t SetID = 0; // uint
static const size_t Name = 1; // string
static const size_t ItemIDBase = 10; // 8 * uint
static const size_t ItemDisplayIDBase = 66; // 8 * uint
static const size_t ItemTypeBase = 74; // 8 * uint
Record getById(unsigned int id);
void cleanup(ItemDatabase &itemdb);
bool available(unsigned int id);
};
class StartOutfitDB: public DBCFile
{
public:
StartOutfitDB(): DBCFile("DBFilesClient\\CharStartOutfit.dbc") {}
~StartOutfitDB() {}
static const size_t NumItems = 12;
/// Fields
static const size_t StartOutfitID = 0; // uint
static const size_t Race = 4; // byte offset
static const size_t Class = 5; // byte offset
static const size_t Gender = 6; // byte offset
static const size_t ItemIDBase = 2; // 12 * uint
static const size_t ItemDisplayIDBase = 14; // 12 * uint
static const size_t ItemTypeBase = 26; // 12 * uint
Record getById(unsigned int id);
};
enum ItemTypes {
IT_ALL = 0,
IT_HEAD = 1,
IT_NECK,
IT_SHOULDER,
IT_SHIRT,
IT_CHEST,
IT_BELT,
IT_PANTS,
IT_BOOTS,
IT_BRACERS,
IT_GLOVES,
IT_RINGS,
IT_ACCESSORY,
IT_DAGGER,
IT_SHIELD,
IT_BOW,
IT_CAPE,
IT_2HANDED,
IT_QUIVER,
IT_TABARD,
IT_ROBE,
IT_1HANDED,
IT_CLAW,
IT_OFFHAND,
IT_UNUSED, // unused?
IT_THROWN,
IT_GUN,
NUM_ITEM_TYPES
};
extern char* ItemTypeNames[NUM_ITEM_TYPES];
struct ItemRecord {
wxString name;
int id, itemclass, subclass, type, model, sheath;
ItemRecord(const char* line);
ItemRecord(const char* name, int type): id(0), name(name), type(type), itemclass(-1), subclass(-1), model(0), sheath(0)
{}
ItemRecord(const ItemRecord &r): id(r.id), name(r.name), itemclass(r.itemclass), subclass(r.subclass), type(r.type), model(r.model), sheath(r.sheath)
{}
const bool operator< (const ItemRecord &r) const
{
if (type == r.type)
return name < r.name;
else
return type < r.type;
}
};
class ItemDatabase {
public:
ItemDatabase(const char* filename);
ItemDatabase() { }
std::vector<ItemRecord> items;
std::map<int, int> itemLookup;
void cleanup(ItemDisplayDB &itemdb);
void open(const char* filename);
const ItemRecord& get(int id);
int getItemNum(int id);
};
/*
class ItemClassDB: public DBCFile
{
public:
ItemClassDB(): DBCFile("DBFilesClient\\ItemClass.dbc") {}
~ItemClassDB() {}
/// Fields
static const size_t ClassID = 0; // uint
static const size_t Name = 3; // string
//Record getById(unsigned int id);
};
*/
class ItemSubClassDB: public DBCFile
{
public:
ItemSubClassDB(): DBCFile("DBFilesClient\\ItemSubClass.dbc") {}
~ItemSubClassDB() {}
/// Fields
static const size_t ClassID = 0; // int
static const size_t SubClassID = 1; // int
static const size_t Flags = 4; // uint
// ...
static const size_t Hands = 9; // int
static const size_t Name = 10; // string
Record getById(int id, int subid);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -