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:
hg committed 2020-12-30 18:47:10 -05:00
1 parent fba078bbe9
commit 6e5ca19d18
6 files changed
+27 -7

No files matched your search

+18
View File
@@ -2714,3 +2714,21 @@ bool Zone::IsZone(uint32 zone_id, uint16 instance_id) const
{
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
}