Resolved a possible scaling issue with the way CharMaxLevel works with quest globals and data buckets.

This commit is contained in:
Kinglykrab 2018-12-13 21:44:52 -05:00
parent 838ab5b77e
commit 3a757a7a85
6 changed files with 48 additions and 26 deletions

View File

@ -1,5 +1,20 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 12/15/2018 ==
Kinglykrab: 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.
== 10/09/2018 == == 10/09/2018 ==
Uleat: Added bot owner options Uleat: Added bot owner options
- usage: ^owneroption [option] (or aliased as: ^oo [option]) - usage: ^owneroption [option] (or aliased as: ^oo [option])

View File

@ -306,7 +306,6 @@ union
uint32 DestructibleUnk9; uint32 DestructibleUnk9;
bool targetable_with_hotkey; bool targetable_with_hotkey;
bool show_name; bool show_name;
}; };
struct PlayerState_Struct { struct PlayerState_Struct {

View File

@ -263,6 +263,16 @@ Client::Client(EQStreamInterface* ieqs)
PendingSacrifice = false; PendingSacrifice = false;
controlling_boat_id = 0; controlling_boat_id = 0;
if (!RuleB(Character, PerCharacterQglobalMaxLevel) && !RuleB(Character, PerCharacterBucketMaxLevel)) {
SetClientMaxLevel(0);
} else if (RuleB(Character, PerCharacterQglobalMaxLevel)) {
int client_max_level = GetCharMaxLevelFromQGlobal();
SetClientMaxLevel(client_max_level);
} else if (RuleB(Character, PerCharacterBucketMaxLevel)) {
int client_max_level = GetCharMaxLevelFromBucket();
SetClientMaxLevel(client_max_level);
}
KarmaUpdateTimer = new Timer(RuleI(Chat, KarmaUpdateIntervalMS)); KarmaUpdateTimer = new Timer(RuleI(Chat, KarmaUpdateIntervalMS));
GlobalChatLimiterTimer = new Timer(RuleI(Chat, IntervalDurationMS)); GlobalChatLimiterTimer = new Timer(RuleI(Chat, IntervalDurationMS));
AttemptedMessages = 0; AttemptedMessages = 0;
@ -1966,7 +1976,6 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
// ns->spawn.pvp = GetPVP(false) ? 1 : 0; // ns->spawn.pvp = GetPVP(false) ? 1 : 0;
ns->spawn.show_name = true; ns->spawn.show_name = true;
strcpy(ns->spawn.title, m_pp.title); strcpy(ns->spawn.title, m_pp.title);
strcpy(ns->spawn.suffix, m_pp.suffix); strcpy(ns->spawn.suffix, m_pp.suffix);

View File

@ -697,7 +697,9 @@ public:
void SendGuildJoin(GuildJoin_Struct* gj); void SendGuildJoin(GuildJoin_Struct* gj);
void RefreshGuildInfo(); void RefreshGuildInfo();
int GetClientMaxLevel() const { return client_max_level; }
void SetClientMaxLevel(int max_level) { client_max_level = max_level; }
void CheckManaEndUpdate(); void CheckManaEndUpdate();
void SendManaUpdate(); void SendManaUpdate();
void SendEnduranceUpdate(); void SendEnduranceUpdate();
@ -1644,6 +1646,8 @@ private:
void InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, bool log, bool silent, bool &error, int depth); void InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, bool log, bool silent, bool &error, int depth);
bool InterrogateInventory_error(int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, int depth); bool InterrogateInventory_error(int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, int depth);
int client_max_level;
#ifdef BOTS #ifdef BOTS
struct BotOwnerOptions { struct BotOwnerOptions {
bool death_marquee; bool death_marquee;

View File

@ -1419,6 +1419,15 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
drakkin_tattoo = m_pp.drakkin_tattoo; drakkin_tattoo = m_pp.drakkin_tattoo;
drakkin_details = m_pp.drakkin_details; drakkin_details = m_pp.drakkin_details;
// Max Level for Character:PerCharacterQglobalMaxLevel and Character:PerCharacterBucketMaxLevel
int client_max_level = 0;
if (RuleB(Character, PerCharacterQglobalMaxLevel)) {
client_max_level = GetCharMaxLevelFromQGlobal();
} else if (RuleB(Character, PerCharacterBucketMaxLevel)) {
client_max_level = GetCharMaxLevelFromBucket();
}
SetClientMaxLevel(client_max_level);
// we know our class now, so we might have to fix our consume timer! // we know our class now, so we might have to fix our consume timer!
if (class_ == MONK) if (class_ == MONK)
consume_food_timer.SetTimer(CONSUMPTION_MNK_TIMER); consume_food_timer.SetTimer(CONSUMPTION_MNK_TIMER);

View File

@ -684,26 +684,12 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
} }
} }
if(RuleB(Character, PerCharacterQglobalMaxLevel)){ if (GetClientMaxLevel() > 0) {
uint32 MaxLevel = GetCharMaxLevelFromQGlobal(); int client_max_level = GetClientMaxLevel();
if(MaxLevel){ if (GetLevel() >= client_max_level) {
if(GetLevel() >= MaxLevel){ uint32 expneeded = GetEXPForLevel(client_max_level);
uint32 expneeded = GetEXPForLevel(MaxLevel); if(set_exp > expneeded) {
if(set_exp > expneeded) { set_exp = expneeded;
set_exp = expneeded;
}
}
}
}
if(RuleB(Character, PerCharacterBucketMaxLevel)){
uint32 MaxLevel = GetCharMaxLevelFromBucket();
if(MaxLevel){
if(GetLevel() >= MaxLevel){
uint32 expneeded = GetEXPForLevel(MaxLevel);
if(set_exp > expneeded) {
set_exp = expneeded;
}
} }
} }
} }
@ -1142,7 +1128,7 @@ uint32 Client::GetCharMaxLevelFromQGlobal() {
++gcount; ++gcount;
} }
return false; return 0;
} }
uint32 Client::GetCharMaxLevelFromBucket() { uint32 Client::GetCharMaxLevelFromBucket() {
@ -1151,14 +1137,14 @@ uint32 Client::GetCharMaxLevelFromBucket() {
auto results = database.QueryDatabase(query); auto results = database.QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::General, Logs::Error, "Data bucket for CharMaxLevel for char ID %i failed.", char_id); Log(Logs::General, Logs::Error, "Data bucket for CharMaxLevel for char ID %i failed.", char_id);
return false; return 0;
} }
if (results.RowCount() > 0) { if (results.RowCount() > 0) {
auto row = results.begin(); auto row = results.begin();
return atoi(row[0]); return atoi(row[0]);
} }
return false; return 0;
} }
uint32 Client::GetRequiredAAExperience() { uint32 Client::GetRequiredAAExperience() {