mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-01 14:21:37 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ca8ed458c3 | |||
| 429d8cdf6d | |||
| 5ca4430f47 | |||
| f5f666062b | |||
| 01fd2611e6 | |||
| 2c1cb55f14 | |||
| 36fc7b6e7f |
@@ -7109,6 +7109,17 @@ ALTER TABLE `npc_types`
|
|||||||
ALTER TABLE `character_data`
|
ALTER TABLE `character_data`
|
||||||
CHANGE COLUMN `firstlogon` `ingame` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`,
|
CHANGE COLUMN `firstlogon` `ingame` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`,
|
||||||
ADD COLUMN `first_login` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`;
|
ADD COLUMN `first_login` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`;
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9324,
|
||||||
|
.description = "2025_05_17_keyring_index.sql",
|
||||||
|
.check = "SHOW CREATE TABLE keyring",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_charid_itemid",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE keyring ADD INDEX idx_charid_itemid (char_id, item_id);
|
||||||
)",
|
)",
|
||||||
.content_schema_update = false
|
.content_schema_update = false
|
||||||
},
|
},
|
||||||
|
|||||||
+24
-37
@@ -22,6 +22,7 @@
|
|||||||
#include "ptimer.h"
|
#include "ptimer.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
|
#include "repositories/timers_repository.h"
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
@@ -149,27 +150,6 @@ bool PersistentTimer::Load(Database *db) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentTimer::Store(Database *db) {
|
|
||||||
if(Expired(db, false)) //dont need to store expired timers.
|
|
||||||
return true;
|
|
||||||
|
|
||||||
std::string query = StringFormat("REPLACE INTO timers "
|
|
||||||
" (char_id, type, start, duration, enable) "
|
|
||||||
" VALUES (%lu, %u, %lu, %lu, %d)",
|
|
||||||
(unsigned long)_char_id, _type, (unsigned long)start_time,
|
|
||||||
(unsigned long)timer_time, enabled ? 1: 0);
|
|
||||||
|
|
||||||
#ifdef DEBUG_PTIMERS
|
|
||||||
printf("Storing timer: char %lu of type %u: '%s'\n", (unsigned long)_char_id, _type, query.c_str());
|
|
||||||
#endif
|
|
||||||
auto results = db->QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PersistentTimer::Clear(Database *db) {
|
bool PersistentTimer::Clear(Database *db) {
|
||||||
|
|
||||||
std::string query = StringFormat("DELETE FROM timers "
|
std::string query = StringFormat("DELETE FROM timers "
|
||||||
@@ -304,27 +284,34 @@ bool PTimerList::Load(Database *db) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PTimerList::Store(Database *db) {
|
bool PTimerList::Store(Database *db)
|
||||||
#ifdef DEBUG_PTIMERS
|
{
|
||||||
printf("Storing all timers for char %lu\n", (unsigned long)_char_id);
|
auto e = TimersRepository::NewEntity();
|
||||||
#endif
|
std::vector<TimersRepository::Timers> entries;
|
||||||
|
|
||||||
std::map<pTimerType, PersistentTimer *>::iterator s;
|
for (auto &[type, timer] : _list) {
|
||||||
s = _list.begin();
|
if (!timer) {
|
||||||
bool res = true;
|
continue;
|
||||||
while(s != _list.end()) {
|
|
||||||
if(s->second != nullptr) {
|
|
||||||
#ifdef DEBUG_PTIMERS
|
|
||||||
printf("Storing timer %u for char %lu\n", s->first, (unsigned long)_char_id);
|
|
||||||
#endif
|
|
||||||
if(!s->second->Store(db))
|
|
||||||
res = false;
|
|
||||||
}
|
}
|
||||||
++s;
|
|
||||||
|
e.char_id = _char_id;
|
||||||
|
e.type = type;
|
||||||
|
e.start = timer->GetStartTime();
|
||||||
|
e.duration = timer->GetTimerTime();
|
||||||
|
e.enable = timer->Enabled() ? 1 : 0;
|
||||||
|
|
||||||
|
entries.emplace_back(e);
|
||||||
}
|
}
|
||||||
return(res);
|
|
||||||
|
if (!entries.empty()) {
|
||||||
|
Expired(db, false);
|
||||||
|
TimersRepository::ReplaceMany(*db, entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PTimerList::Clear(Database *db) {
|
bool PTimerList::Clear(Database *db) {
|
||||||
_list.clear();
|
_list.clear();
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ public:
|
|||||||
inline bool Enabled() { return enabled; }
|
inline bool Enabled() { return enabled; }
|
||||||
|
|
||||||
bool Load(Database *db);
|
bool Load(Database *db);
|
||||||
bool Store(Database *db);
|
|
||||||
bool Clear(Database *db);
|
bool Clear(Database *db);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ public:
|
|||||||
uint8_t lfg;
|
uint8_t lfg;
|
||||||
std::string mailkey;
|
std::string mailkey;
|
||||||
uint8_t xtargets;
|
uint8_t xtargets;
|
||||||
uint8_t ingame;
|
|
||||||
uint32_t first_login;
|
uint32_t first_login;
|
||||||
|
uint8_t ingame;
|
||||||
uint32_t e_aa_effects;
|
uint32_t e_aa_effects;
|
||||||
uint32_t e_percent_to_aa;
|
uint32_t e_percent_to_aa;
|
||||||
uint32_t e_expended_aa_spent;
|
uint32_t e_expended_aa_spent;
|
||||||
@@ -231,8 +231,8 @@ public:
|
|||||||
"lfg",
|
"lfg",
|
||||||
"mailkey",
|
"mailkey",
|
||||||
"xtargets",
|
"xtargets",
|
||||||
"ingame",
|
|
||||||
"first_login",
|
"first_login",
|
||||||
|
"ingame",
|
||||||
"e_aa_effects",
|
"e_aa_effects",
|
||||||
"e_percent_to_aa",
|
"e_percent_to_aa",
|
||||||
"e_expended_aa_spent",
|
"e_expended_aa_spent",
|
||||||
@@ -343,8 +343,8 @@ public:
|
|||||||
"lfg",
|
"lfg",
|
||||||
"mailkey",
|
"mailkey",
|
||||||
"xtargets",
|
"xtargets",
|
||||||
"ingame",
|
|
||||||
"first_login",
|
"first_login",
|
||||||
|
"ingame",
|
||||||
"e_aa_effects",
|
"e_aa_effects",
|
||||||
"e_percent_to_aa",
|
"e_percent_to_aa",
|
||||||
"e_expended_aa_spent",
|
"e_expended_aa_spent",
|
||||||
@@ -489,8 +489,8 @@ public:
|
|||||||
e.lfg = 0;
|
e.lfg = 0;
|
||||||
e.mailkey = "";
|
e.mailkey = "";
|
||||||
e.xtargets = 5;
|
e.xtargets = 5;
|
||||||
e.ingame = 0;
|
|
||||||
e.first_login = 0;
|
e.first_login = 0;
|
||||||
|
e.ingame = 0;
|
||||||
e.e_aa_effects = 0;
|
e.e_aa_effects = 0;
|
||||||
e.e_percent_to_aa = 0;
|
e.e_percent_to_aa = 0;
|
||||||
e.e_expended_aa_spent = 0;
|
e.e_expended_aa_spent = 0;
|
||||||
@@ -631,8 +631,8 @@ public:
|
|||||||
e.lfg = row[93] ? static_cast<uint8_t>(strtoul(row[93], nullptr, 10)) : 0;
|
e.lfg = row[93] ? static_cast<uint8_t>(strtoul(row[93], nullptr, 10)) : 0;
|
||||||
e.mailkey = row[94] ? row[94] : "";
|
e.mailkey = row[94] ? row[94] : "";
|
||||||
e.xtargets = row[95] ? static_cast<uint8_t>(strtoul(row[95], nullptr, 10)) : 5;
|
e.xtargets = row[95] ? static_cast<uint8_t>(strtoul(row[95], nullptr, 10)) : 5;
|
||||||
e.ingame = row[96] ? static_cast<uint8_t>(strtoul(row[96], nullptr, 10)) : 0;
|
e.first_login = row[96] ? static_cast<uint32_t>(strtoul(row[96], nullptr, 10)) : 0;
|
||||||
e.first_login = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0;
|
e.ingame = row[97] ? static_cast<uint8_t>(strtoul(row[97], nullptr, 10)) : 0;
|
||||||
e.e_aa_effects = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
|
e.e_aa_effects = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
|
||||||
e.e_percent_to_aa = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
|
e.e_percent_to_aa = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
|
||||||
e.e_expended_aa_spent = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
|
e.e_expended_aa_spent = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
|
||||||
@@ -769,8 +769,8 @@ public:
|
|||||||
v.push_back(columns[93] + " = " + std::to_string(e.lfg));
|
v.push_back(columns[93] + " = " + std::to_string(e.lfg));
|
||||||
v.push_back(columns[94] + " = '" + Strings::Escape(e.mailkey) + "'");
|
v.push_back(columns[94] + " = '" + Strings::Escape(e.mailkey) + "'");
|
||||||
v.push_back(columns[95] + " = " + std::to_string(e.xtargets));
|
v.push_back(columns[95] + " = " + std::to_string(e.xtargets));
|
||||||
v.push_back(columns[96] + " = " + std::to_string(e.ingame));
|
v.push_back(columns[96] + " = " + std::to_string(e.first_login));
|
||||||
v.push_back(columns[97] + " = " + std::to_string(e.first_login));
|
v.push_back(columns[97] + " = " + std::to_string(e.ingame));
|
||||||
v.push_back(columns[98] + " = " + std::to_string(e.e_aa_effects));
|
v.push_back(columns[98] + " = " + std::to_string(e.e_aa_effects));
|
||||||
v.push_back(columns[99] + " = " + std::to_string(e.e_percent_to_aa));
|
v.push_back(columns[99] + " = " + std::to_string(e.e_percent_to_aa));
|
||||||
v.push_back(columns[100] + " = " + std::to_string(e.e_expended_aa_spent));
|
v.push_back(columns[100] + " = " + std::to_string(e.e_expended_aa_spent));
|
||||||
@@ -896,8 +896,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.lfg));
|
v.push_back(std::to_string(e.lfg));
|
||||||
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
||||||
v.push_back(std::to_string(e.xtargets));
|
v.push_back(std::to_string(e.xtargets));
|
||||||
v.push_back(std::to_string(e.ingame));
|
|
||||||
v.push_back(std::to_string(e.first_login));
|
v.push_back(std::to_string(e.first_login));
|
||||||
|
v.push_back(std::to_string(e.ingame));
|
||||||
v.push_back(std::to_string(e.e_aa_effects));
|
v.push_back(std::to_string(e.e_aa_effects));
|
||||||
v.push_back(std::to_string(e.e_percent_to_aa));
|
v.push_back(std::to_string(e.e_percent_to_aa));
|
||||||
v.push_back(std::to_string(e.e_expended_aa_spent));
|
v.push_back(std::to_string(e.e_expended_aa_spent));
|
||||||
@@ -1031,8 +1031,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.lfg));
|
v.push_back(std::to_string(e.lfg));
|
||||||
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
||||||
v.push_back(std::to_string(e.xtargets));
|
v.push_back(std::to_string(e.xtargets));
|
||||||
v.push_back(std::to_string(e.ingame));
|
|
||||||
v.push_back(std::to_string(e.first_login));
|
v.push_back(std::to_string(e.first_login));
|
||||||
|
v.push_back(std::to_string(e.ingame));
|
||||||
v.push_back(std::to_string(e.e_aa_effects));
|
v.push_back(std::to_string(e.e_aa_effects));
|
||||||
v.push_back(std::to_string(e.e_percent_to_aa));
|
v.push_back(std::to_string(e.e_percent_to_aa));
|
||||||
v.push_back(std::to_string(e.e_expended_aa_spent));
|
v.push_back(std::to_string(e.e_expended_aa_spent));
|
||||||
@@ -1170,8 +1170,8 @@ public:
|
|||||||
e.lfg = row[93] ? static_cast<uint8_t>(strtoul(row[93], nullptr, 10)) : 0;
|
e.lfg = row[93] ? static_cast<uint8_t>(strtoul(row[93], nullptr, 10)) : 0;
|
||||||
e.mailkey = row[94] ? row[94] : "";
|
e.mailkey = row[94] ? row[94] : "";
|
||||||
e.xtargets = row[95] ? static_cast<uint8_t>(strtoul(row[95], nullptr, 10)) : 5;
|
e.xtargets = row[95] ? static_cast<uint8_t>(strtoul(row[95], nullptr, 10)) : 5;
|
||||||
e.ingame = row[96] ? static_cast<uint8_t>(strtoul(row[96], nullptr, 10)) : 0;
|
e.first_login = row[96] ? static_cast<uint32_t>(strtoul(row[96], nullptr, 10)) : 0;
|
||||||
e.first_login = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0;
|
e.ingame = row[97] ? static_cast<uint8_t>(strtoul(row[97], nullptr, 10)) : 0;
|
||||||
e.e_aa_effects = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
|
e.e_aa_effects = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
|
||||||
e.e_percent_to_aa = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
|
e.e_percent_to_aa = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
|
||||||
e.e_expended_aa_spent = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
|
e.e_expended_aa_spent = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
|
||||||
@@ -1300,8 +1300,8 @@ public:
|
|||||||
e.lfg = row[93] ? static_cast<uint8_t>(strtoul(row[93], nullptr, 10)) : 0;
|
e.lfg = row[93] ? static_cast<uint8_t>(strtoul(row[93], nullptr, 10)) : 0;
|
||||||
e.mailkey = row[94] ? row[94] : "";
|
e.mailkey = row[94] ? row[94] : "";
|
||||||
e.xtargets = row[95] ? static_cast<uint8_t>(strtoul(row[95], nullptr, 10)) : 5;
|
e.xtargets = row[95] ? static_cast<uint8_t>(strtoul(row[95], nullptr, 10)) : 5;
|
||||||
e.ingame = row[96] ? static_cast<uint8_t>(strtoul(row[96], nullptr, 10)) : 0;
|
e.first_login = row[96] ? static_cast<uint32_t>(strtoul(row[96], nullptr, 10)) : 0;
|
||||||
e.first_login = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0;
|
e.ingame = row[97] ? static_cast<uint8_t>(strtoul(row[97], nullptr, 10)) : 0;
|
||||||
e.e_aa_effects = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
|
e.e_aa_effects = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
|
||||||
e.e_percent_to_aa = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
|
e.e_percent_to_aa = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
|
||||||
e.e_expended_aa_spent = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
|
e.e_expended_aa_spent = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
|
||||||
@@ -1480,8 +1480,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.lfg));
|
v.push_back(std::to_string(e.lfg));
|
||||||
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
||||||
v.push_back(std::to_string(e.xtargets));
|
v.push_back(std::to_string(e.xtargets));
|
||||||
v.push_back(std::to_string(e.ingame));
|
|
||||||
v.push_back(std::to_string(e.first_login));
|
v.push_back(std::to_string(e.first_login));
|
||||||
|
v.push_back(std::to_string(e.ingame));
|
||||||
v.push_back(std::to_string(e.e_aa_effects));
|
v.push_back(std::to_string(e.e_aa_effects));
|
||||||
v.push_back(std::to_string(e.e_percent_to_aa));
|
v.push_back(std::to_string(e.e_percent_to_aa));
|
||||||
v.push_back(std::to_string(e.e_expended_aa_spent));
|
v.push_back(std::to_string(e.e_expended_aa_spent));
|
||||||
@@ -1608,8 +1608,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.lfg));
|
v.push_back(std::to_string(e.lfg));
|
||||||
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
||||||
v.push_back(std::to_string(e.xtargets));
|
v.push_back(std::to_string(e.xtargets));
|
||||||
v.push_back(std::to_string(e.ingame));
|
|
||||||
v.push_back(std::to_string(e.first_login));
|
v.push_back(std::to_string(e.first_login));
|
||||||
|
v.push_back(std::to_string(e.ingame));
|
||||||
v.push_back(std::to_string(e.e_aa_effects));
|
v.push_back(std::to_string(e.e_aa_effects));
|
||||||
v.push_back(std::to_string(e.e_percent_to_aa));
|
v.push_back(std::to_string(e.e_percent_to_aa));
|
||||||
v.push_back(std::to_string(e.e_expended_aa_spent));
|
v.push_back(std::to_string(e.e_expended_aa_spent));
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@
|
|||||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CURRENT_BINARY_DATABASE_VERSION 9323
|
#define CURRENT_BINARY_DATABASE_VERSION 9324
|
||||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
|
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
|
||||||
#define CUSTOM_BINARY_DATABASE_VERSION 0
|
#define CUSTOM_BINARY_DATABASE_VERSION 0
|
||||||
|
|
||||||
|
|||||||
@@ -11479,7 +11479,6 @@ void Client::SaveSpells()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CharacterSpellsRepository::DeleteWhere(database, fmt::format("id = {}", CharacterID()));
|
CharacterSpellsRepository::DeleteWhere(database, fmt::format("id = {}", CharacterID()));
|
||||||
|
|
||||||
if (!character_spells.empty()) {
|
if (!character_spells.empty()) {
|
||||||
CharacterSpellsRepository::InsertMany(database, character_spells);
|
CharacterSpellsRepository::InsertMany(database, character_spells);
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-24
@@ -827,6 +827,8 @@ void Client::CompleteConnect()
|
|||||||
parse->EventPlayer(EVENT_CONNECT, this, export_string, 0);
|
parse->EventPlayer(EVENT_CONNECT, this, export_string, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RecordStats();
|
||||||
|
|
||||||
if (is_first_login) {
|
if (is_first_login) {
|
||||||
e.first_login = time(nullptr);
|
e.first_login = time(nullptr);
|
||||||
TraderRepository::DeleteWhere(database, fmt::format("`char_id` = '{}'", CharacterID()));
|
TraderRepository::DeleteWhere(database, fmt::format("`char_id` = '{}'", CharacterID()));
|
||||||
@@ -1002,7 +1004,6 @@ void Client::CompleteConnect()
|
|||||||
safe_delete(p);
|
safe_delete(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordStats();
|
|
||||||
AutoGrantAAPoints();
|
AutoGrantAAPoints();
|
||||||
|
|
||||||
// set initial position for mob tracking
|
// set initial position for mob tracking
|
||||||
@@ -1366,22 +1367,22 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
|||||||
// set to full support in case they're a gm with items in disabled expansion slots...but, have their gm flag off...
|
// set to full support in case they're a gm with items in disabled expansion slots...but, have their gm flag off...
|
||||||
// item loss will occur when they use the 'empty' slots, if this is not done
|
// item loss will occur when they use the 'empty' slots, if this is not done
|
||||||
m_inv.SetGMInventory(true);
|
m_inv.SetGMInventory(true);
|
||||||
loaditems = database.GetInventory(this); /* Load Character Inventory */
|
loaditems = database.GetInventory(this);
|
||||||
database.LoadCharacterBandolier(cid, &m_pp); /* Load Character Bandolier */
|
database.LoadCharacterData(cid, &m_pp, &m_epp);
|
||||||
database.LoadCharacterBindPoint(cid, &m_pp); /* Load Character Bind */
|
database.LoadCharacterBandolier(cid, &m_pp);
|
||||||
database.LoadCharacterMaterialColor(cid, &m_pp); /* Load Character Material */
|
database.LoadCharacterBindPoint(cid, &m_pp);
|
||||||
database.LoadCharacterPotionBelt(cid, &m_pp); /* Load Character Potion Belt */
|
database.LoadCharacterMaterialColor(cid, &m_pp);
|
||||||
database.LoadCharacterCurrency(cid, &m_pp); /* Load Character Currency into PP */
|
database.LoadCharacterPotionBelt(cid, &m_pp);
|
||||||
database.LoadCharacterData(cid, &m_pp, &m_epp); /* Load Character Data from DB into PP as well as E_PP */
|
database.LoadCharacterCurrency(cid, &m_pp);
|
||||||
database.LoadCharacterSkills(cid, &m_pp); /* Load Character Skills */
|
database.LoadCharacterSkills(cid, &m_pp);
|
||||||
database.LoadCharacterInspectMessage(cid, &m_inspect_message); /* Load Character Inspect Message */
|
database.LoadCharacterInspectMessage(cid, &m_inspect_message);
|
||||||
database.LoadCharacterSpellBook(cid, &m_pp); /* Load Character Spell Book */
|
database.LoadCharacterSpellBook(cid, &m_pp);
|
||||||
database.LoadCharacterMemmedSpells(cid, &m_pp); /* Load Character Memorized Spells */
|
database.LoadCharacterMemmedSpells(cid, &m_pp);
|
||||||
database.LoadCharacterLanguages(cid, &m_pp); /* Load Character Languages */
|
database.LoadCharacterLanguages(cid, &m_pp);
|
||||||
database.LoadCharacterLeadershipAbilities(cid, &m_pp); /* Load Character Leadership AA's */
|
database.LoadCharacterLeadershipAbilities(cid, &m_pp);
|
||||||
database.LoadCharacterTribute(this); /* Load CharacterTribute */
|
database.LoadCharacterTribute(this);
|
||||||
database.LoadCharacterEXPModifier(this); /* Load Character EXP Modifier */
|
database.LoadCharacterEXPModifier(this);
|
||||||
database.LoadCharacterTitleSets(this); /* Load Character Title Sets */
|
database.LoadCharacterTitleSets(this);
|
||||||
|
|
||||||
// this pattern is strange
|
// this pattern is strange
|
||||||
// this is remnants of the old way of doing things
|
// this is remnants of the old way of doing things
|
||||||
@@ -1553,10 +1554,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SPDAT_RECORDS > 0) {
|
if (SPDAT_RECORDS > 0) {
|
||||||
for (uint32 z = 0; z < EQ::spells::SPELL_GEM_COUNT; z++) {
|
UnmemSpellAll(false);
|
||||||
if (m_pp.mem_spells[z] >= (uint32)SPDAT_RECORDS)
|
|
||||||
UnmemSpell(z, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
database.LoadBuffs(this);
|
database.LoadBuffs(this);
|
||||||
uint32 max_slots = GetMaxBuffSlots();
|
uint32 max_slots = GetMaxBuffSlots();
|
||||||
@@ -10241,13 +10239,13 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
|
|||||||
printf("Wrong size of LoadSpellSet_Struct! Expected: %zu, Got: %i\n", sizeof(LoadSpellSet_Struct), app->size);
|
printf("Wrong size of LoadSpellSet_Struct! Expected: %zu, Got: %i\n", sizeof(LoadSpellSet_Struct), app->size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int i;
|
|
||||||
LoadSpellSet_Struct *ss = (LoadSpellSet_Struct *) app->pBuffer;
|
LoadSpellSet_Struct *ss = (LoadSpellSet_Struct *) app->pBuffer;
|
||||||
for (i = 0; i < EQ::spells::SPELL_GEM_COUNT; i++) {
|
for (int i = 0; i < EQ::spells::SPELL_GEM_COUNT; i++) {
|
||||||
if (ss->spell[i] != 0xFFFFFFFF)
|
if (ss->spell[i] != 0xFFFFFFFF) {
|
||||||
UnmemSpell(i, true);
|
UnmemSpell(i, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Client::Handle_OP_Logout(const EQApplicationPacket *app)
|
void Client::Handle_OP_Logout(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
|
|||||||
+23
-3
@@ -78,6 +78,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
|||||||
#include "../common/misc_functions.h"
|
#include "../common/misc_functions.h"
|
||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
#include "../common/repositories/character_corpses_repository.h"
|
#include "../common/repositories/character_corpses_repository.h"
|
||||||
|
#include "../common/repositories/character_memmed_spells_repository.h"
|
||||||
#include "../common/repositories/spell_buckets_repository.h"
|
#include "../common/repositories/spell_buckets_repository.h"
|
||||||
|
|
||||||
#include "data_bucket.h"
|
#include "data_bucket.h"
|
||||||
@@ -5953,10 +5954,29 @@ void Client::UnmemSpellBySpellID(int32 spell_id)
|
|||||||
|
|
||||||
void Client::UnmemSpellAll(bool update_client)
|
void Client::UnmemSpellAll(bool update_client)
|
||||||
{
|
{
|
||||||
for (int spell_gem = 0; spell_gem < EQ::spells::SPELL_GEM_COUNT; spell_gem++) {
|
bool has_spells = false;
|
||||||
if (IsValidSpell(m_pp.mem_spells[spell_gem])) {
|
for (int slot = 0; slot < EQ::spells::SPELL_GEM_COUNT; slot++) {
|
||||||
UnmemSpell(spell_gem, update_client);
|
if (IsValidSpell(m_pp.mem_spells[slot])) {
|
||||||
|
if (slot >= EQ::spells::SPELL_GEM_COUNT || slot < 0) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogSpells("Spell [{}] forgotten from slot [{}]", m_pp.mem_spells[slot], slot);
|
||||||
|
|
||||||
|
if (update_client) {
|
||||||
|
MemorizeSpell(slot, m_pp.mem_spells[slot], memSpellForget);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pp.mem_spells[slot] = UINT32_MAX;
|
||||||
|
has_spells = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (has_spells) {
|
||||||
|
CharacterMemmedSpellsRepository::DeleteWhere(
|
||||||
|
database,
|
||||||
|
fmt::format("`id` = {}", character_id)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
-85
@@ -290,6 +290,12 @@ bool TaskManager::SaveClientState(Client *client, ClientTaskState *cts)
|
|||||||
|
|
||||||
LogTasks("character_id [{}]", character_id);
|
LogTasks("character_id [{}]", character_id);
|
||||||
|
|
||||||
|
auto ct = CharacterTasksRepository::NewEntity();
|
||||||
|
std::vector<CharacterTasksRepository::CharacterTasks> ct_entries;
|
||||||
|
|
||||||
|
auto cta = CharacterActivitiesRepository::NewEntity();
|
||||||
|
std::vector<CharacterActivitiesRepository::CharacterActivities> cta_entries;
|
||||||
|
|
||||||
if (cts->m_active_task_count > 0 ||
|
if (cts->m_active_task_count > 0 ||
|
||||||
cts->m_active_task.task_id != TASKSLOTEMPTY ||
|
cts->m_active_task.task_id != TASKSLOTEMPTY ||
|
||||||
cts->m_active_shared_task.task_id != TASKSLOTEMPTY) {
|
cts->m_active_shared_task.task_id != TASKSLOTEMPTY) {
|
||||||
@@ -303,7 +309,6 @@ bool TaskManager::SaveClientState(Client *client, ClientTaskState *cts)
|
|||||||
|
|
||||||
int slot = active_task.slot;
|
int slot = active_task.slot;
|
||||||
if (active_task.updated) {
|
if (active_task.updated) {
|
||||||
|
|
||||||
LogTasks(
|
LogTasks(
|
||||||
"character_id [{}] updating task_index [{}] task_id [{}]",
|
"character_id [{}] updating task_index [{}] task_id [{}]",
|
||||||
character_id,
|
character_id,
|
||||||
@@ -311,31 +316,14 @@ bool TaskManager::SaveClientState(Client *client, ClientTaskState *cts)
|
|||||||
task_id
|
task_id
|
||||||
);
|
);
|
||||||
|
|
||||||
std::string query = StringFormat(
|
ct.charid = character_id;
|
||||||
"REPLACE INTO character_tasks (charid, taskid, slot, type, acceptedtime, was_rewarded) "
|
ct.taskid = task_id;
|
||||||
"VALUES (%i, %i, %i, %i, %i, %d)",
|
ct.slot = slot;
|
||||||
character_id,
|
ct.type = static_cast<int>(task_data->type);
|
||||||
task_id,
|
ct.acceptedtime = active_task.accepted_time;
|
||||||
slot,
|
ct.was_rewarded = active_task.was_rewarded;
|
||||||
static_cast<int>(task_data->type),
|
ct_entries.emplace_back(ct);
|
||||||
active_task.accepted_time,
|
|
||||||
active_task.was_rewarded
|
|
||||||
);
|
|
||||||
|
|
||||||
auto results = database.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
active_task.updated = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string query =
|
|
||||||
"REPLACE INTO character_activities (charid, taskid, activityid, donecount, completed) "
|
|
||||||
"VALUES ";
|
|
||||||
|
|
||||||
int updated_activity_count = 0;
|
|
||||||
|
|
||||||
for (int activity_index = 0; activity_index < task_data->activity_count; ++activity_index) {
|
for (int activity_index = 0; activity_index < task_data->activity_count; ++activity_index) {
|
||||||
if (!active_task.activity[activity_index].updated) {
|
if (!active_task.activity[activity_index].updated) {
|
||||||
@@ -350,44 +338,21 @@ bool TaskManager::SaveClientState(Client *client, ClientTaskState *cts)
|
|||||||
activity_index
|
activity_index
|
||||||
);
|
);
|
||||||
|
|
||||||
if (updated_activity_count == 0) {
|
cta.charid = character_id;
|
||||||
query +=
|
cta.taskid = task_id;
|
||||||
StringFormat(
|
cta.activityid = activity_index;
|
||||||
"(%i, %i, %i, %i, %i)", character_id, task_id, activity_index,
|
cta.donecount = active_task.activity[activity_index].done_count;
|
||||||
active_task.activity[activity_index].done_count,
|
cta.completed = active_task.activity[activity_index].activity_state == ActivityCompleted ? 1 : 0;
|
||||||
active_task.activity[activity_index].activity_state ==
|
cta_entries.emplace_back(cta);
|
||||||
ActivityCompleted
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
query +=
|
|
||||||
StringFormat(
|
|
||||||
", (%i, %i, %i, %i, %i)", character_id, task_id, activity_index,
|
|
||||||
active_task.activity[activity_index].done_count,
|
|
||||||
active_task.activity[activity_index].activity_state ==
|
|
||||||
ActivityCompleted
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updated_activity_count++;
|
if (!ct_entries.empty()) {
|
||||||
}
|
CharacterTasksRepository::ReplaceMany(database, ct_entries);
|
||||||
|
|
||||||
if (updated_activity_count == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto results = database.QueryDatabase(query);
|
|
||||||
|
|
||||||
if (!results.Success()) {
|
|
||||||
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
active_task.updated = false;
|
|
||||||
for (int activity_index = 0; activity_index < task_data->activity_count; ++activity_index) {
|
|
||||||
active_task.activity[activity_index].updated = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (!cta_entries.empty()) {
|
||||||
|
CharacterActivitiesRepository::ReplaceMany(database, cta_entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RuleB(TaskSystem, RecordCompletedTasks) || (cts->m_completed_tasks.size() <=
|
if (!RuleB(TaskSystem, RecordCompletedTasks) || (cts->m_completed_tasks.size() <=
|
||||||
@@ -396,8 +361,8 @@ bool TaskManager::SaveClientState(Client *client, ClientTaskState *cts)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *completed_task_query = "REPLACE INTO completed_tasks (charid, completedtime, taskid, activityid) "
|
auto completed_task = CompletedTasksRepository::NewEntity();
|
||||||
"VALUES (%i, %i, %i, %i)";
|
std::vector<CompletedTasksRepository::CompletedTasks> completed_task_entries;
|
||||||
|
|
||||||
for (
|
for (
|
||||||
unsigned int task_index = cts->m_last_completed_task_loaded;
|
unsigned int task_index = cts->m_last_completed_task_loaded;
|
||||||
@@ -423,19 +388,11 @@ bool TaskManager::SaveClientState(Client *client, ClientTaskState *cts)
|
|||||||
// This indicates this task was completed at the given time. We infer that all
|
// This indicates this task was completed at the given time. We infer that all
|
||||||
// none optional activities were completed.
|
// none optional activities were completed.
|
||||||
//
|
//
|
||||||
std::string query = StringFormat(
|
completed_task.charid = character_id;
|
||||||
completed_task_query,
|
completed_task.completedtime = t.completed_time;
|
||||||
character_id,
|
completed_task.taskid = task_id;
|
||||||
t.completed_time,
|
completed_task.activityid = -1;
|
||||||
task_id,
|
completed_task_entries.emplace_back(completed_task);
|
||||||
-1
|
|
||||||
);
|
|
||||||
|
|
||||||
auto results = database.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the Rule to record non-optional task completion is not enabled, don't save it
|
// If the Rule to record non-optional task completion is not enabled, don't save it
|
||||||
if (!RuleB(TaskSystem, RecordCompletedOptionalActivities)) {
|
if (!RuleB(TaskSystem, RecordCompletedOptionalActivities)) {
|
||||||
@@ -449,18 +406,16 @@ bool TaskManager::SaveClientState(Client *client, ClientTaskState *cts)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
query = StringFormat(
|
completed_task.charid = character_id;
|
||||||
completed_task_query,
|
completed_task.completedtime = t.completed_time;
|
||||||
character_id,
|
completed_task.taskid = task_id;
|
||||||
t.completed_time,
|
completed_task.activityid = activity_id;
|
||||||
task_id, activity_id
|
completed_task_entries.emplace_back(completed_task);
|
||||||
);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
results = database.QueryDatabase(query);
|
if (!completed_task_entries.empty()) {
|
||||||
if (!results.Success()) {
|
CompletedTasksRepository::ReplaceMany(database, completed_task_entries);
|
||||||
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cts->m_last_completed_task_loaded = cts->m_completed_tasks.size();
|
cts->m_last_completed_task_loaded = cts->m_completed_tasks.size();
|
||||||
|
|||||||
+24
-19
@@ -642,8 +642,8 @@ bool ZoneDatabase::LoadCharacterLanguages(uint32 character_id, PlayerProfile_Str
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PP_LANGUAGE; ++i) { // Initialize Languages
|
for (unsigned char & language : pp->languages) { // Initialize Languages
|
||||||
pp->languages[i] = 0;
|
language = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& e : l) {
|
for (const auto& e : l) {
|
||||||
@@ -689,8 +689,8 @@ bool ZoneDatabase::LoadCharacterDisciplines(Client* c)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int slot_id = 0; slot_id < MAX_PP_DISCIPLINES; slot_id++) {
|
for (unsigned int & value : c->GetPP().disciplines.values) {
|
||||||
c->GetPP().disciplines.values[slot_id] = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& e : l) {
|
for (const auto& e : l) {
|
||||||
@@ -982,7 +982,6 @@ void ZoneDatabase::SaveCharacterTribute(Client* c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CharacterTributeRepository::DeleteWhere(database, fmt::format("character_id = {}", c->CharacterID()));
|
CharacterTributeRepository::DeleteWhere(database, fmt::format("character_id = {}", c->CharacterID()));
|
||||||
|
|
||||||
if (tribute_count > 0) {
|
if (tribute_count > 0) {
|
||||||
CharacterTributeRepository::InsertMany(database, tributes);
|
CharacterTributeRepository::InsertMany(database, tributes);
|
||||||
}
|
}
|
||||||
@@ -2879,14 +2878,6 @@ void ZoneDatabase::UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, ui
|
|||||||
|
|
||||||
void ZoneDatabase::SaveBuffs(Client *client)
|
void ZoneDatabase::SaveBuffs(Client *client)
|
||||||
{
|
{
|
||||||
CharacterBuffsRepository::DeleteWhere(
|
|
||||||
database,
|
|
||||||
fmt::format(
|
|
||||||
"`character_id` = {}",
|
|
||||||
client->CharacterID()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto buffs = client->GetBuffs();
|
auto buffs = client->GetBuffs();
|
||||||
const int max_buff_slots = client->GetMaxBuffSlots();
|
const int max_buff_slots = client->GetMaxBuffSlots();
|
||||||
|
|
||||||
@@ -2904,6 +2895,16 @@ void ZoneDatabase::SaveBuffs(Client *client)
|
|||||||
character_buff_count++;
|
character_buff_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (character_buff_count) {
|
||||||
|
CharacterBuffsRepository::DeleteWhere(
|
||||||
|
database,
|
||||||
|
fmt::format(
|
||||||
|
"`character_id` = {}",
|
||||||
|
client->CharacterID()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
v.reserve(character_buff_count);
|
v.reserve(character_buff_count);
|
||||||
|
|
||||||
for (int slot_id = 0; slot_id < max_buff_slots; slot_id++) {
|
for (int slot_id = 0; slot_id < max_buff_slots; slot_id++) {
|
||||||
@@ -3027,14 +3028,14 @@ void ZoneDatabase::LoadBuffs(Client *client)
|
|||||||
|
|
||||||
void ZoneDatabase::SaveAuras(Client *c)
|
void ZoneDatabase::SaveAuras(Client *c)
|
||||||
{
|
{
|
||||||
CharacterAurasRepository::DeleteOne(database, c->CharacterID());
|
const auto& auras = c->GetAuraMgr();
|
||||||
|
if (!auras.count) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<CharacterAurasRepository::CharacterAuras> v;
|
std::vector<CharacterAurasRepository::CharacterAuras> v;
|
||||||
|
CharacterAurasRepository::DeleteOne(database, c->CharacterID());
|
||||||
auto e = CharacterAurasRepository::NewEntity();
|
auto e = CharacterAurasRepository::NewEntity();
|
||||||
|
|
||||||
const auto& auras = c->GetAuraMgr();
|
|
||||||
|
|
||||||
for (int slot_id = 0; slot_id < auras.count; ++slot_id) {
|
for (int slot_id = 0; slot_id < auras.count; ++slot_id) {
|
||||||
Aura* a = auras.auras[slot_id].aura;
|
Aura* a = auras.auras[slot_id].aura;
|
||||||
if (a && a->AuraZones()) {
|
if (a && a->AuraZones()) {
|
||||||
@@ -3177,7 +3178,6 @@ void ZoneDatabase::SavePetInfo(Client *client)
|
|||||||
client->CharacterID()
|
client->CharacterID()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!pet_infos.empty()) {
|
if (!pet_infos.empty()) {
|
||||||
CharacterPetInfoRepository::InsertMany(database, pet_infos);
|
CharacterPetInfoRepository::InsertMany(database, pet_infos);
|
||||||
}
|
}
|
||||||
@@ -4261,6 +4261,11 @@ void ZoneDatabase::SaveCharacterEXPModifier(Client* c)
|
|||||||
|
|
||||||
EXPModifier m = zone->exp_modifiers[c->CharacterID()];
|
EXPModifier m = zone->exp_modifiers[c->CharacterID()];
|
||||||
|
|
||||||
|
// if both modifiers are 0, we don't need to save
|
||||||
|
if (m.aa_modifier == 0 && m.exp_modifier == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CharacterExpModifiersRepository::ReplaceOne(
|
CharacterExpModifiersRepository::ReplaceOne(
|
||||||
*this,
|
*this,
|
||||||
CharacterExpModifiersRepository::CharacterExpModifiers{
|
CharacterExpModifiersRepository::CharacterExpModifiers{
|
||||||
|
|||||||
Reference in New Issue
Block a user