📄 chardb.cpp
字号:
#include "chardb.h"
// HairGeosets
CharHairGeosetsDB::Record CharHairGeosetsDB::getByParams(unsigned int race, unsigned int gender, unsigned int section)
{
for(Iterator i=begin(); i!=end(); ++i)
{
if (i->getUInt(Race)==race && i->getUInt(Gender)==gender && i->getUInt(Section)==section)
return (*i);
}
throw NotFound();
}
int CharHairGeosetsDB::getGeosetsFor(unsigned int race, unsigned int gender)
{
int n = 0;
for(Iterator i=begin(); i!=end(); ++i)
{
if (i->getUInt(Race)==race && i->getUInt(Gender)==gender) {
n++;
}
}
return n;
}
// Sections
int CharSectionsDB::getColorsFor(unsigned int race, unsigned int gender, unsigned int type, unsigned int section, unsigned int npc)
{
int n = 0;
for(Iterator i=begin(); i!=end(); ++i)
{
// don't allow NPC skins ;(
if (i->getUInt(Race)==race && i->getUInt(Gender)==gender && i->getUInt(Type)==type && i->getUInt(Section)==section && i->getUInt(IsNPC)==npc) {
n++;
}
}
return n;
}
int CharSectionsDB::getSectionsFor(unsigned int race, unsigned int gender, unsigned int type, unsigned int color, unsigned int npc)
{
int n = 0;
for(Iterator i=begin(); i!=end(); ++i)
{
if (i->getUInt(Race)==race && i->getUInt(Gender)==gender && i->getUInt(Type)==type && i->getUInt(Color)==color && i->getUInt(IsNPC)==npc) {
n++;
}
}
return n;
}
CharSectionsDB::Record CharSectionsDB::getByParams(unsigned int race, unsigned int gender, unsigned int type, unsigned int section, unsigned int color, unsigned int npc)
{
for(Iterator i=begin(); i!=end(); ++i)
{
if (i->getUInt(Race)==race && i->getUInt(Gender)==gender && i->getUInt(Type)==type && i->getUInt(Section)==section && i->getUInt(Color)==color && i->getUInt(IsNPC)==npc)
return (*i);
}
throw NotFound();
}
// Races
CharRacesDB::Record CharRacesDB::getByName(wxString name)
{
for(Iterator i=begin(); i!=end(); ++i)
{
if (name.IsSameAs(i->getString(Name),false) == true)
return (*i);
}
throw NotFound();
}
CharRacesDB::Record CharRacesDB::getById(unsigned int id)
{
for(Iterator i=begin(); i!=end(); ++i)
{
if (i->getUInt(RaceID)==id) return (*i);
}
throw NotFound();
}
// FacialHair
CharFacialHairDB::Record CharFacialHairDB::getByParams(unsigned int race, unsigned int gender, unsigned int style)
{
for(Iterator i=begin(); i!=end(); ++i)
{
if (i->getUInt(Race)==race && i->getUInt(Gender)==gender && i->getUInt(Style)==style)
return (*i);
}
throw NotFound();
}
int CharFacialHairDB::getStylesFor(unsigned int race, unsigned int gender)
{
int n = 0;
for(Iterator i=begin(); i!=end(); ++i)
{
if (i->getUInt(Race)==race && i->getUInt(Gender)==gender) {
n++;
}
}
return n;
}
// Classes
CharClassesDB::Record CharClassesDB::getById(unsigned int id)
{
for(Iterator i=begin(); i!=end(); ++i)
{
if (i->getUInt(ClassID)==id) return (*i);
}
throw NotFound();
}
// Head and Helmet display info
HelmGeosetDB::Record HelmGeosetDB::getById(unsigned int id)
{
for(Iterator i=begin(); i!=end(); ++i)
{
if (i->getUInt(TypeID)==id)
return (*i);
}
throw NotFound();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -