mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-23 19:17:54 +00:00
[Fix] Add trader/buyer cleanup actions (#4843)
* Add trader/buyer cleanup actions Add trader/buyer db cleanup for - on zone idle - on client first login - when world drops a zone connection - in Client::ProcessMovePC Cleanup several compiler warnings * Formatting Updates
This commit is contained in:
@@ -37,6 +37,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "dynamic_zone_manager.h"
|
||||
#include "ucs.h"
|
||||
#include "clientlist.h"
|
||||
#include "../common/repositories/trader_repository.h"
|
||||
#include "../common/repositories/buyer_repository.h"
|
||||
|
||||
extern uint32 numzones;
|
||||
extern EQ::Random emu_random;
|
||||
@@ -84,6 +86,8 @@ void ZSList::Remove(const std::string &uuid)
|
||||
while (iter != zone_server_list.end()) {
|
||||
if ((*iter)->GetUUID().compare(uuid) == 0) {
|
||||
auto port = (*iter)->GetCPort();
|
||||
(*iter)->CheckToClearTraderAndBuyerTables();
|
||||
|
||||
zone_server_list.erase(iter);
|
||||
|
||||
if (port != 0) {
|
||||
|
||||
@@ -50,6 +50,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/repositories/guild_tributes_repository.h"
|
||||
#include "../common/skill_caps.h"
|
||||
#include "../common/server_reload_types.h"
|
||||
#include "../common/repositories/trader_repository.h"
|
||||
#include "../common/repositories/buyer_repository.h"
|
||||
|
||||
extern ClientList client_list;
|
||||
extern GroupLFPList LFPGroupList;
|
||||
@@ -1860,3 +1862,19 @@ void ZoneServer::IncomingClient(Client* client) {
|
||||
SendPacket(pack);
|
||||
delete pack;
|
||||
}
|
||||
|
||||
void ZoneServer::CheckToClearTraderAndBuyerTables()
|
||||
{
|
||||
if (GetZoneID() == Zones::BAZAAR) {
|
||||
TraderRepository::DeleteWhere(
|
||||
database,
|
||||
fmt::format("`char_zone_id` = {} AND `char_zone_instance_id` = {}", GetZoneID(), GetInstanceID()
|
||||
)
|
||||
);
|
||||
BuyerRepository::DeleteBuyers(database, GetZoneID(), GetInstanceID());
|
||||
|
||||
LogTradingDetail(
|
||||
"Removed trader and buyer entries for Zone ID [{}] and Instance ID [{}]", GetZoneID(), GetInstanceID()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
inline const char* GetZoneName() const { return zone_name; }
|
||||
inline const char* GetZoneLongName() const { return long_name; }
|
||||
inline std::string GetCurrentVersion() const { return CURRENT_VERSION; }
|
||||
void CheckToClearTraderAndBuyerTables();
|
||||
inline std::string GetCompileDate() const { return COMPILE_DATE; }
|
||||
const char* GetCompileTime() const{ return compiled; }
|
||||
void SetCompile(char* in_compile){ strcpy(compiled,in_compile); }
|
||||
|
||||
Reference in New Issue
Block a user