[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
+20 -1
View File
@@ -738,7 +738,7 @@ bool Client::Save(uint8 iCommitNow) {
}
}
database.SaveCharacterData(CharacterID(), AccountID(), &m_pp, &m_epp); /* Save Character Data */
database.SaveCharacterData(this, &m_pp, &m_epp); /* Save Character Data */
return true;
}
@@ -9136,6 +9136,25 @@ void Client::SetDevToolsEnabled(bool in_dev_tools_enabled)
Client::dev_tools_enabled = in_dev_tools_enabled;
}
bool Client::IsEXPEnabled() const {
return m_exp_enabled;
}
void Client::SetEXPEnabled(bool is_exp_enabled)
{
auto c = CharacterDataRepository::FindOne(database, CharacterID());
c.exp_enabled = is_exp_enabled;
auto updated = CharacterDataRepository::UpdateOne(database, c);
if (!updated) {
return;
}
m_exp_enabled = is_exp_enabled;
}
/**
* @param model_id
*/