mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
Get dz safe return from cache not db
This was loading the dz from database to get safe return data every time a client's dz removal timer triggered Add the Zone::GetDynamicZone() method so zones that are dz instances can find the data from the cache of any dz systems
This commit is contained in:
parent
fba078bbe9
commit
6e5ca19d18
@ -9883,13 +9883,14 @@ void Client::SendDzCompassUpdate()
|
|||||||
QueuePacket(outapp.get());
|
QueuePacket(outapp.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::GoToDzSafeReturnOrBind(const DynamicZoneLocation& safereturn)
|
void Client::GoToDzSafeReturnOrBind(const DynamicZone& dynamic_zone)
|
||||||
{
|
{
|
||||||
|
auto safereturn = dynamic_zone.GetSafeReturnLocation();
|
||||||
LogDynamicZonesDetail(
|
LogDynamicZonesDetail(
|
||||||
"Sending character [{}] to safereturn zone [{}] or bind", CharacterID(), safereturn.zone_id
|
"Sending character [{}] to safereturn zone [{}] or bind", CharacterID(), safereturn.zone_id
|
||||||
);
|
);
|
||||||
|
|
||||||
if (safereturn.zone_id == 0)
|
if (!dynamic_zone.IsValid() || safereturn.zone_id == 0)
|
||||||
{
|
{
|
||||||
GoToBind();
|
GoToBind();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1145,7 +1145,7 @@ public:
|
|||||||
void DzListTimers();
|
void DzListTimers();
|
||||||
void SetDzRemovalTimer(bool enable_timer);
|
void SetDzRemovalTimer(bool enable_timer);
|
||||||
void SendDzCompassUpdate();
|
void SendDzCompassUpdate();
|
||||||
void GoToDzSafeReturnOrBind(const DynamicZoneLocation& safereturn);
|
void GoToDzSafeReturnOrBind(const DynamicZone& dynamic_zone);
|
||||||
void MovePCDynamicZone(uint32 zone_id);
|
void MovePCDynamicZone(uint32 zone_id);
|
||||||
void MovePCDynamicZone(const std::string& zone_name);
|
void MovePCDynamicZone(const std::string& zone_name);
|
||||||
|
|
||||||
|
|||||||
@ -164,8 +164,7 @@ bool Client::Process() {
|
|||||||
if (dynamiczone_removal_timer.Check() && zone && zone->GetInstanceID() != 0)
|
if (dynamiczone_removal_timer.Check() && zone && zone->GetInstanceID() != 0)
|
||||||
{
|
{
|
||||||
dynamiczone_removal_timer.Disable();
|
dynamiczone_removal_timer.Disable();
|
||||||
DynamicZone dz = DynamicZone::LoadDzFromDatabase(zone->GetInstanceID());
|
GoToDzSafeReturnOrBind(zone->GetDynamicZone());
|
||||||
GoToDzSafeReturnOrBind(dz.GetSafeReturnLocation());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linkdead_timer.Check()) {
|
if (linkdead_timer.Check()) {
|
||||||
|
|||||||
@ -5208,7 +5208,7 @@ void EntityList::GateAllClientsToSafeReturn()
|
|||||||
DynamicZone dz;
|
DynamicZone dz;
|
||||||
if (zone)
|
if (zone)
|
||||||
{
|
{
|
||||||
dz = DynamicZone::LoadDzFromDatabase(zone->GetInstanceID());
|
dz = zone->GetDynamicZone();
|
||||||
|
|
||||||
LogDynamicZones(
|
LogDynamicZones(
|
||||||
"Sending all clients in zone: [{}] instance: [{}] to dz safereturn or bind",
|
"Sending all clients in zone: [{}] instance: [{}] to dz safereturn or bind",
|
||||||
@ -5221,7 +5221,7 @@ void EntityList::GateAllClientsToSafeReturn()
|
|||||||
if (client_list_iter.second)
|
if (client_list_iter.second)
|
||||||
{
|
{
|
||||||
// falls back to gating clients to bind if dz invalid
|
// falls back to gating clients to bind if dz invalid
|
||||||
client_list_iter.second->GoToDzSafeReturnOrBind(dz.GetSafeReturnLocation());
|
client_list_iter.second->GoToDzSafeReturnOrBind(dz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2714,3 +2714,21 @@ bool Zone::IsZone(uint32 zone_id, uint16 instance_id) const
|
|||||||
{
|
{
|
||||||
return (zoneid == zone_id && instanceid == instance_id);
|
return (zoneid == zone_id && instanceid == instance_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DynamicZone Zone::GetDynamicZone()
|
||||||
|
{
|
||||||
|
if (GetInstanceID() == 0)
|
||||||
|
{
|
||||||
|
return {}; // invalid
|
||||||
|
}
|
||||||
|
|
||||||
|
auto expedition = Expedition::FindCachedExpeditionByInstanceID(GetInstanceID());
|
||||||
|
if (expedition)
|
||||||
|
{
|
||||||
|
return expedition->GetDynamicZone();
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo: tasks, missions, and quests with an associated dz for this instance id
|
||||||
|
|
||||||
|
return {}; // invalid
|
||||||
|
}
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
#include "spawn2.h"
|
#include "spawn2.h"
|
||||||
#include "spawngroup.h"
|
#include "spawngroup.h"
|
||||||
#include "aa_ability.h"
|
#include "aa_ability.h"
|
||||||
|
#include "dynamiczone.h"
|
||||||
#include "pathfinder_interface.h"
|
#include "pathfinder_interface.h"
|
||||||
#include "global_loot_manager.h"
|
#include "global_loot_manager.h"
|
||||||
|
|
||||||
@ -177,6 +178,7 @@ public:
|
|||||||
void DumpMerchantList(uint32 npcid);
|
void DumpMerchantList(uint32 npcid);
|
||||||
int SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold = false);
|
int SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold = false);
|
||||||
int32 MobsAggroCount() { return aggroedmobs; }
|
int32 MobsAggroCount() { return aggroedmobs; }
|
||||||
|
DynamicZone GetDynamicZone();
|
||||||
|
|
||||||
IPathfinder *pathing;
|
IPathfinder *pathing;
|
||||||
LinkedList<NPC_Emote_Struct *> NPCEmoteList;
|
LinkedList<NPC_Emote_Struct *> NPCEmoteList;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user