[Feature] Add Parcel Feature for RoF2 Clients (#4198)

* Add Parcel Feature

Add the parcel system for RoF2 client

* Fixed a duplicate define

* Reformat

reformating and review changes

* Further Formatting

* Memory Mgmt Updates

Refactored to using unique_ptr/make_unique/etc to avoid manual memory mgmt.

Other format changes

* Refactor db structure

Refactor for db structure of parcels to character_parcels
Removal of parcel_merchants
Addition of npc_types.is_parcel_merchant
Cleanup as a result

* Refactor to use item id 99990 for money transfers.  Removed the money string function as a result, though simplified the messaging related to money.  Other updates based on feedback.

* Move prune routine out of scheduler and into a world process.
Removed RuleI from #define

* Update

* Update database.cpp

* Update database_update_manifest.cpp

* Update main.cpp

* Update client_process.cpp

* Update parcels.cpp

* Remove parcel merchant content to optional sql instead of manifest.

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Mitch Freeman
2024-04-20 23:15:56 -03:00
committed by GitHub
parent 64fefaebe4
commit fcffc6b3d4
58 changed files with 2505 additions and 230 deletions
+18
View File
@@ -87,6 +87,7 @@
#include "../common/path_manager.h"
#include "../common/events/player_event_logs.h"
#include "../common/skill_caps.h"
#include "../common/repositories/character_parcels_repository.h"
SkillCaps skill_caps;
ZoneStore zone_store;
@@ -176,6 +177,9 @@ int main(int argc, char **argv)
PurgeInstanceTimer.Start(450000);
Timer EQTimeTimer(600000);
EQTimeTimer.Start(600000);
Timer parcel_prune_timer(86400000);
parcel_prune_timer.Start(86400000);
// global loads
LogInfo("Loading launcher list");
@@ -420,6 +424,20 @@ int main(int argc, char **argv)
client_list.Process();
guild_mgr.Process();
if (parcel_prune_timer.Check()) {
if (RuleB(Parcel, EnableParcelMerchants) && RuleB(Parcel, EnablePruning)) {
LogTrading(
"Parcel Prune process running for parcels over <red>[{}] days",
RuleI(Parcel, ParcelPruneDelay)
);
auto out = std::make_unique<ServerPacket>(ServerOP_ParcelPrune);
zoneserver_list.SendPacketToBootedZones(out.get());
database.PurgeCharacterParcels();
}
}
if (player_event_process_timer.Check()) {
player_event_logs.Process();
}
+4 -6
View File
@@ -1,6 +1,7 @@
#include "world_event_scheduler.h"
#include "../common/servertalk.h"
#include <ctime>
#include "../common/rulesys.h"
void WorldEventScheduler::Process(ZSList *zs_list)
{
@@ -31,13 +32,10 @@ void WorldEventScheduler::Process(ZSList *zs_list)
);
for (auto &e: m_events) {
// discard uninteresting events as its less work to calculate time on events we don't care about
// different processes are interested in different events
if (
e.event_type != ServerEvents::EVENT_TYPE_BROADCAST &&
e.event_type != ServerEvents::EVENT_TYPE_RELOAD_WORLD
) {
if (e.event_type != ServerEvents::EVENT_TYPE_BROADCAST &&
e.event_type != ServerEvents::EVENT_TYPE_RELOAD_WORLD) {
continue;
}
@@ -57,7 +55,7 @@ void WorldEventScheduler::Process(ZSList *zs_list)
if (e.event_type == ServerEvents::EVENT_TYPE_RELOAD_WORLD) {
LogScheduler("Sending reload world event [{}]", e.event_data.c_str());
auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
auto *reload_world = (ReloadWorld_Struct *) pack->pBuffer;
reload_world->global_repop = ReloadWorld::Repop;
zs_list->SendPacket(pack);
+13
View File
@@ -1730,6 +1730,19 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
}
break;
}
case ServerOP_ParcelDelivery: {
auto in = (Parcel_Struct *) pack->pBuffer;
if (strlen(in->send_to) == 0) {
LogError(
"ServerOP_ParcelDelivery pack received with invalid character name of [{}]",
in->send_to);
return;
}
zoneserver_list.SendPacketToBootedZones(pack);
break;
}
default: {
LogInfo("Unknown ServerOPcode from zone {:#04x}, size [{}]", pack->opcode, pack->size);
DumpPacket(pack->pBuffer, pack->size);