|
AlliedModders Donor
Join Date: May 2013
Location: Serbia
|
07-29-2014
, 05:03
Re: nVault
|
#53
|
Quote:
Originally Posted by PreDominance
Well this is for a warcraft mod. Each player needs to have a few small things (BankXp, bankLevel, current race, player total level). For each race, however, a player needs to have:
- Race XP
- Race Level
- Skill1/2/3/4/5/6/7/8 (stored as a string delimited by ",").
I plan on having over 60 races, so each player might have upwards of 350KV pairs.
I don't have the time to try to work with SQL or SQLite, as I've 0 experience with either, and I've already gotten so much work put into using vault.
For reference, here's how I'm getting/storing data:
Code:
//Returns the key of the KV pair. By systematically generating keys, it becomes
//easier to enforce consistency.
vault_getUserKey(id, type[], raceId = 0)
{
static szReturn[70];
static szKeyType[30];
static szId[30];
get_user_authid(id, szId, charsmax(szId));
if (raceId)
{
format(szKeyType, charsmax(szKeyType), "%s %i", szKeyType, raceId);
} else {
format(szKeyType, charsmax(szKeyType), "%s", type);
}
format(szReturn, charsmax(szReturn), "%s %s", szId, szKeyType);
return szReturn;
}
...constants.inl
#define KEY_CURRACE "CurRace" //Current race, so server remembers your race upon return
#define KEY_RACE_LEVELS "RaceLevels" //Levels of skills in a race
#define KEY_RACE_TOTAL "RaceTotalLevels" //Total level of all skills in a race
#define KEY_RACE_XP "RaceXp" //Xp in a race
#define KEY_BANKXP "BankXP" //Xp in gank
#define KEY_BANKLEVEL "BankLevel" //Levels in bank
#define KEY_NAME "Name" //Name of user upon first connection
|
Maybe a vault file for each class, instead for each player? Or maybe, you could change key to
where that "4" would be class id, which means, every player can have up to 60(or whatever your class number is) keys in vault.
|
|
|
|