mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 12:18:27 +00:00
[Bug Fix] Fix Untrained Disciplines in Client::SaveDisciplines() (#4472)
* [Bug Fix] Fix Untrained Disciplines in Client::SaveDisciplines() * [Bug Fix] Fix Infinite Loop in Adventure::Finished() (#4473) Fix infinite loop condition when bot encountered * [Bug Fix] Fix Untrained Disciplines in Client::SaveDisciplines() * Change to release --------- Co-authored-by: oddx2k <103136558+oddx2k@users.noreply.github.com>
This commit is contained in:
+15
-1
@@ -11097,7 +11097,9 @@ void Client::SaveDisciplines()
|
||||
{
|
||||
std::vector<CharacterDisciplinesRepository::CharacterDisciplines> v;
|
||||
|
||||
for (int slot_id = 0; slot_id < MAX_PP_DISCIPLINES; slot_id++) {
|
||||
std::vector<std::string> delete_slots;
|
||||
|
||||
for (uint16 slot_id = 0; slot_id < MAX_PP_DISCIPLINES; slot_id++) {
|
||||
if (IsValidSpell(m_pp.disciplines.values[slot_id])) {
|
||||
auto e = CharacterDisciplinesRepository::NewEntity();
|
||||
|
||||
@@ -11106,9 +11108,21 @@ void Client::SaveDisciplines()
|
||||
e.disc_id = m_pp.disciplines.values[slot_id];
|
||||
|
||||
v.emplace_back(e);
|
||||
} else {
|
||||
delete_slots.emplace_back(std::to_string(slot_id));
|
||||
}
|
||||
}
|
||||
|
||||
if (!delete_slots.empty()) {
|
||||
CharacterDisciplinesRepository::DeleteWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"`slot_id` IN ({})",
|
||||
Strings::Join(delete_slots, ", ")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (!v.empty()) {
|
||||
CharacterDisciplinesRepository::ReplaceMany(database, v);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user