14 Commits

Author SHA1 Message Date
hg
074b7096df Use fmt join for simple query strings 2020-12-30 18:47:32 -05:00
hg
b46eca4ec6 Store expeditions with dz id not instance id
This exposes dynamic zone ids for any future changes and will make it
easier to preserve historic dz and expedition data. This also cleans up
some dynamic zone creation for expedition requests

When purging instances the expedition table is no longer updated
since dynamic zone ids are not re-used like instance ids are

Update #dz list commands to show dz id

Add GetDynamicZoneID and get_expedition_by_dz_id quest apis
2020-12-30 18:47:32 -05:00
hg
b965a165b1 Add api to update expedition expire time
Add SetSecondsRemaining method to set expire time on expedition
2020-12-30 18:47:11 -05:00
hg
c45840173e Load dz from cache on client switchlist reply 2020-12-30 18:47:11 -05:00
hg
5a826add92 Cleanup expedition headers and unused variables
Modify some expedition and dz logging

Remove unnecessary includes in expedition sources
2020-12-30 18:47:10 -05:00
hg
06d84b83de Remove member history from expeditions
Expedition uuids are now used to check if characters may re-join
2020-12-30 18:47:09 -05:00
hg
4af5f79328 Remove logging of expedition query failures
This is redundant with sql error logging. Logging the operations is
enough to determine the source of any errors
2020-12-30 18:47:09 -05:00
hg
ea0b37b7fc Store expedition duration and times as chrono
This simplifies comparisons and reduces conversions
2020-12-30 18:47:09 -05:00
hg
17be2bf2f7 Clear stale pending expedition lockouts
Delete pending lockouts of members on expedition creation

Delete pending lockouts when all members removed from expedition

This fixes an edge case where members could incorrectly be assigned
pending lockouts that were never cleared from the database (from a
server crash or other situation) after entering another dz.
2020-12-30 18:47:09 -05:00
hg
2c4f505309 Refactor zone expedition caching
This optimizes caching all expeditions by loading dynamic zone data and
expedition members in bulk instead of for each expedition separately.
This reduces the number of queries from 1+2n to 3 total.

Expedition members are now joined in the initial query since empty
expeditions aren't cached anyway. Optional internal lockouts for all
cached expeditions are loaded in a single bulk query afterwards.

Dynamic Zone data is also loaded as a single bulk query afterwards to
simplify processing and keep dz database logic separated. It might be
worth investigating if joining dz data in the initial expeditions load
query is worth refactoring for.
2020-12-30 18:47:08 -05:00
hg
9164073d14 Let world shutdown dz early for empty expeditions
Since world now tracks empty expeditions it can determine when to
shutdown dynamic zone instances when the rule is enabled rather than
letting zones do it.
2020-12-30 18:47:08 -05:00
hg
528b74109e Only update dz expire time if reducing
Add optional UpdateExpireTime parameter

This is currently only used when an expedition becomes empty to make
dynamic zone instances shutdown earlier. For that it should only update
if new time is less than remaining time
2020-12-30 18:47:07 -05:00
hg
eccc79e4ce Let dz handle client removal timers
Remove all clients inside a dz, not just those assigned to instance
2020-12-30 18:47:07 -05:00
hg
8eef2ae089 Add DynamicZone class for expedition instancing
Add DynamicZone sql table schema

Add DynamicZones logging category

Modify CreateExpedition to take DynamicZone and ExpeditionRequest objects

Implement DynamicZone compass, safereturn, and zone-in coordinates.

Implement live-like DynamicZone instance kick timer for removed members

Implement updating multiple client compasses (supports existing quest compass)

fix: Send client compass update after entering zones to clear existing compass

Implement Client::MovePCDynamicZone to invoke DynamicZoneSwitchListWnd
when entering a zone where client has multiple dynamic zones assigned

Implement OP_DzChooseZoneReply handling

Add Lua api methods for expedition's associated dynamic zone

Add #dz list gm command to list current DynamicZone instances from database
2020-12-30 18:47:07 -05:00