NPC data provider.
More...
#include <NpcDatabase.h>
§ DeleteNPCByID()
bool CNpcDatabase::DeleteNPCByID |
( |
int |
nNPCID | ) |
|
delete the NPC from database
- Parameters
-
- Returns
- true if succeed
§ DeleteNPCByName()
bool CNpcDatabase::DeleteNPCByName |
( |
const string & |
sName | ) |
|
delete the NPC from database
- Parameters
-
- Returns
- true if succeed
§ GetNPCCount()
int CNpcDatabase::GetNPCCount |
( |
| ) |
|
the total number of NPC in the database.
There is no statement cached for this call.
- Returns
§ GetNPCIDByName()
int CNpcDatabase::GetNPCIDByName |
( |
const string & |
name | ) |
|
get NPC ID by name
- Parameters
-
- Returns
- id is returned if found in database; otherwise non-positive value(-1) is returned.
§ InsertNPC()
- Parameters
-
npc | insert the new character to the database, the ID of npc will be ignored and filled with actual ID if inserted successfully |
- Returns
- true if succeed
§ IsValid()
bool ParaEngine::CNpcDatabase::IsValid |
( |
| ) |
|
|
inline |
§ SelectNPCByID()
bool CNpcDatabase::SelectNPCByID |
( |
int |
nNPCID, |
|
|
CNpcDbItem & |
pOut |
|
) |
| |
- Parameters
-
nNPCID | character ID in the database |
pOut | : the structure will be filled with data in the database |
- Returns
- true if succeed
§ SelectNPCByName()
bool CNpcDatabase::SelectNPCByName |
( |
const string & |
sName, |
|
|
CNpcDbItem & |
pOut |
|
) |
| |
- Parameters
-
sName | character name |
pOut | : the structure will be filled with data in the database |
- Returns
- true if succeed
§ SelectNPCListByRegion()
bool CNpcDatabase::SelectNPCListByRegion |
( |
NPCDBItemList * |
pOut, |
|
|
const Vector3 & |
vMin, |
|
|
const Vector3 & |
vMax |
|
) |
| |
return all NPC whose position is within a AABB region
- Parameters
-
pOut | : the list will be filled with data in the database that meat the criterion. |
vMin | min point in world coordinate system, y component is ignored |
vMax | max point in world coordinate system, y component is ignored |
- Returns
- true if succeed
§ SetDBEntity()
void CNpcDatabase::SetDBEntity |
( |
const string & |
sConnectionstring | ) |
|
replace the current database with current one.
the old one is closed and the new once will be opened.
- Parameters
-
sConnectionstring | the file path |
§ UpdateNPC()
bool CNpcDatabase::UpdateNPC |
( |
const CNpcDbItem & |
npc, |
|
|
DWORD |
dwFields |
|
) |
| |
Selectively update the data fields of NPC.
- Parameters
-
npc | either the ID or name of the npc must be valid. |
dwFields | : a bitwise of database fields specifying which data is to be updated. If it is ALL_ATTRIBUTES(0xffffffff), all data will be updated. please refer to CNpcDbItem::UPDATE_FIELDS for the meaning of the data fields which can be selectively updated. |
- Returns
- true if succeed
§ ValidateDatabase()
void CNpcDatabase::ValidateDatabase |
( |
| ) |
|
ensure that the database has been set up properly.
If not, ResetDatabase() is called to reset the database to blank
The documentation for this class was generated from the following files:
- Client/trunk/ParaEngineClient/Engine/NpcDatabase.h
- Client/trunk/ParaEngineClient/Engine/NpcDatabase.cpp