[Feature] Add Experience Gain Toggle. (#2676)

* [Feature] Add Experience Gain Toggle.

# Perl
- Add `$client->IsEXPEnabled()`.
- Add `$client->SetEXPEnabled(is_exp_enabled)`.

# Lua
- Add `client:IsEXPEnabled()`.
- Add `client:SetEXPEnabled(is_exp_enabled)`.

# Commands
- Add `#exptoggle [Toggle] - Toggle your or your target's experience gain.`.

# Notes
- Allows operators to turn on/off a player's experience gain individually without changing their rule values.
- The command allows operators to give players access to the command to disable their own experience gain.
This commit is contained in:
Alex King
2022-12-30 17:30:23 -05:00
committed by GitHub
parent 0c9c78fbab
commit a6fa6084fa
16 changed files with 489 additions and 371 deletions
+8 -4
View File
@@ -1217,15 +1217,19 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
}
/* Load Character Data */
query = StringFormat("SELECT `lfp`, `lfg`, `xtargets`, `firstlogon`, `guild_id`, `rank` FROM `character_data` LEFT JOIN `guild_members` ON `id` = `char_id` WHERE `id` = %i", cid);
query = fmt::format(
"SELECT `lfp`, `lfg`, `xtargets`, `firstlogon`, `guild_id`, `rank`, `exp_enabled` FROM `character_data` LEFT JOIN `guild_members` ON `id` = `char_id` WHERE `id` = {}",
cid
);
auto results = database.QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) {
for (auto row : results) {
if (row[4] && atoi(row[4]) > 0) {
guild_id = atoi(row[4]);
if (row[5] != nullptr) { guildrank = atoi(row[5]); }
else { guildrank = GUILD_RANK_NONE; }
guildrank = row[5] ? atoi(row[5]) : GUILD_RANK_NONE;
}
SetEXPEnabled(atobool(row[6]));
if (LFP) { LFP = atoi(row[0]); }
if (LFG) { LFG = atoi(row[1]); }
if (row[3])