Added new data bucket and quest functionality.

Added multiple new instance related quest functions.
	1. quest::GetInstanceIDByCharID(const char *zone, int16 version, uint32 char_id)
		- Allows you to pull the instance ID of a client by character ID.
	2. quest::AssignToInstanceByCharID(uint16 instance_id, uint32 char_id)
		- Allows you to assign an instance to a client by character ID.
	3. quest::RemoveFromInstanceByCharID(uint16 instance_id, uint32 char_id)
		- Allows you to remove a client from an instance by character ID.

Added spell buckets, similar to spell globals.
	- Uses a new spell_buckets table and the Spells:EnableSpellBuckets rule.

Added max level by data bucket.
	- Uses data bucket char_id-CharMaxLevel and Character:PerCharacterBucketMaxLevel rule.
This commit is contained in:
Kinglykrab
2018-12-13 19:41:19 -05:00
parent f4dee67d7c
commit 8ae9c99f3d
10 changed files with 170 additions and 52 deletions
+28
View File
@@ -695,6 +695,18 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
}
}
}
if(RuleB(Character, PerCharacterBucketMaxLevel)){
uint32 MaxLevel = GetCharMaxLevelFromBucket();
if(MaxLevel){
if(GetLevel() >= MaxLevel){
uint32 expneeded = GetEXPForLevel(MaxLevel);
if(set_exp > expneeded) {
set_exp = expneeded;
}
}
}
}
if ((GetLevel() != check_level) && !(check_level >= maxlevel)) {
char val1[20]={0};
@@ -1133,6 +1145,22 @@ uint32 Client::GetCharMaxLevelFromQGlobal() {
return false;
}
uint32 Client::GetCharMaxLevelFromBucket() {
uint32 char_id = this->CharacterID();
std::string query = StringFormat("SELECT value FROM data_buckets WHERE key = '%i-CharMaxLevel'", char_id);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Data bucket for CharMaxLevel for char ID %i failed.", char_id);
return false;
}
if (results.RowCount() > 0) {
auto row = results.begin();
return atoi(row[0]);
}
return false;
}
uint32 Client::GetRequiredAAExperience() {
#ifdef LUA_EQEMU
uint32 lua_ret = 0;