Commit Graph

5174 Commits

Author SHA1 Message Date
hg 4c9b3ea1df Refactor expedition member online status requests
This optimizes character status requests by only sending a single
bulk request to world for characters in all expeditions instead of
sending a separate request for each expedition on zone startup
2020-10-07 21:55:23 -04:00
hg 158d934df7 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-10-07 21:55:23 -04:00
hg 8ae063f953 Ignore expired lockouts on expedition invite
This fixes an edge case with client invites sometimes failing because
an expired lockout hasn't been removed from client yet

Clients no longer receive expired lockouts from expeditions when joining
2020-10-07 21:55:22 -04:00
hg 95a076c5ad Remove expedition includes from client header
Make quest compass a vec3 to remove include dependency

Quest compass location doesn't require a zone id since it can only be
set in the zone that it's drawn in. Drop the DynamicZoneLocation member
and forward declare to remove the dependency on header.

Move ExpeditionInvite struct to zone common header

Including expedition.h in client.h just to use the ExpeditionInvite struct
is an unnecessary header dependency that increases incremental build time.
This allows expedition classes to be forward declared in client header.
2020-10-07 21:55:22 -04:00
hg d5f476926d Add #dz lockouts remove by event name 2020-10-07 21:55:22 -04:00
hg ca2c1171a1 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-10-07 21:55:22 -04:00
hg 4699a303c0 Only delete empty expeditions when the dz is empty
Zones are no longer able to delete expeditions. World now tracks empty
expeditions in cache and only deletes them when it detects an
expedition's dynamic zone instance has no more clients inside.

This fixes an exploit where lockouts couldn't be applied to expeditions
after all members were removed because zones were deleting the expedition
immediately. Clients still inside the dz were able to complete events
before being kicked from the instance while not having an expedition.

Expeditions are no longer purged from database in the world purge
instance timer to avoid a possible race with this new system
2020-10-07 21:55:21 -04:00
hg 2a0ae8160e Implement world cache to monitor expeditions
This implements a small cache in world to track expedition states.

This fixes expired expeditions being left in zone caches unless the
expedition's dz instance was running to detect it (or unless an
expedition was deleted via a client using /kickplayers). This was also
leaving clients in a ghost expedition that no longer actually existed
2020-10-07 21:55:21 -04:00
hg 37145683c5 Only draw dynamic zone compasses in non-instances
This fixes compasses being drawn in instances that use the same zone as compass

Also adds RemoveCompass method to quest api
2020-10-07 21:55:21 -04:00
hg c5f473e589 Implement expedition locking
Disables the ability to add new members

Adds Expedition::SetLocked(bool) to quest api

Adds is_locked column to expedition_details db table
2020-10-07 21:55:21 -04:00
hg 11eacf25f0 Make adding replay timers to new members optional
Not all expeditions with a replay timer lockout add it to newly
added members automatically

This adds the Expedition::SetReplayLockoutOnMemberJoin(bool) method
to the quest api so it can be disabled
2020-10-07 21:55:21 -04:00
hg 9692aad123 Fix missing invite failure messages 2020-10-07 21:55:20 -04:00
hg 5552770587 Remove unused ExpeditionMemberStatus Lua constants 2020-10-07 21:55:20 -04:00
hg 2f1c3b8037 Use stl algorithms for expedition member searches 2020-10-07 21:55:20 -04:00
hg f716c06ca3 Use built-in benchmarking for expedition caching 2020-10-07 21:55:20 -04:00
hg 44a6e5a63e Rename #dz cache to #dz expedition
Add expedition's remaining dz time to expedition list

Move #dz destroy to a #dz expedition subcommand

Add success or failure messages to destroy command
2020-10-07 21:55:19 -04:00
hg e5e22c34d7 Add #dzkickplayers command for pre-RoF clients
Performs "/kickplayers exp" for older clients without the command
2020-10-07 21:55:19 -04:00
hg e822fdb9cf 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-10-07 21:55:19 -04:00
hg e79d03261a Send expedition re-invite to clients that zone
Moves expedition message handling in world to Expedition method
for messages that need special handling
2020-10-07 21:55:19 -04:00
hg 20bfdac7e0 Check for empty expedition via database not cache
Checking the cache on member removal here isn't reliable due to race
with cross zone message

If a zone removes a member at the same time as another zone, neither zone
can know if the expedition will be empty via cache unless it processes the
world message from the other zone's member removal first.
2020-10-07 21:55:19 -04:00
hg c93b46af8e Add alternative CreateExpedition api
This allows expedition creation to be passed via Lua tables

This also allows for compass, safereturn, and/or zone in location data
of dynamic zones to be set on expedition creation from lua api

Usage example:
  local instance_info = {
    "anguish", 0, 21600,
    compass = { 300, 1353.15, 1712.19, 109.001 },
    safereturn = { 300, 1349.13, 1715.00, 123.81, 0 },
    zonein = { -9, -2466, -79, 0 }
  }
  local expedition_info = { "Anguish, the Fallen Palace", 6, 54, true }
  local dz = e.other:CreateExpedition(instance_info, expedition_info)
2020-10-07 21:55:19 -04:00
hg a9a3e46aa2 Send client lockout update in lockout methods
Add optional client update argument to client lockout methods

This is better than requiring callers to manually send the update
2020-10-07 21:55:18 -04:00
hg 26176f44fe Validate expedition invite response server side
Stores expedition invite data on client
2020-10-07 21:55:18 -04:00
hg a8184ce853 Add instance time remaining to #dz list output 2020-10-07 21:55:18 -04:00
hg b8c429b8f8 Add expired lockouts leeway rule
Adds a rule for leeway with expired lockouts during creation requests

The client removes lockout timers with under 60s remaining from the
window. This allows a small leeway to compensate so players don't
request an expedition that has visually hidden lockouts.
2020-10-07 21:55:18 -04:00
hg d9ee19f0ea Move LoadAllClientLockouts back to a client method 2020-10-07 21:55:17 -04:00
hg 0de11ab56b Clear client expedition info if removed inside dz
Clears client expedition info immediately if removed inside dynamic zone

Live clears expedition info from clients removed inside a dz on the same
timer used for removals, even if the client zones before it triggers.
This is problematic to mimic and not worth the effort
2020-10-07 21:55:17 -04:00
hg 7eb6a9828e Filter out expired instances from #dz list
Add 'all' argument to #dz list to optionally show expired instances
2020-10-07 21:55:17 -04:00
hg 7e25e7b3a3 Add #dz lockouts remove command
This allows clearing a character's lockouts

Adds client RemoveAllExpeditionLockouts methods and exposes to lua api
2020-10-07 21:55:17 -04:00
hg 59cd45ec39 Fix wrong group leader name in expedition requests
Get group leader name from Client if possible and ask database otherwise

Group::GetLeaderName() is unreliable and broken for groups formed across
zones. The correct leader name is needed here to avoid any possible
exploits with an invalid leader bypassing lockout checks.
2020-10-07 21:55:17 -04:00
hg 181973537c Add option to disable expedition conflict messages
Add optional argument to CreateExpedition to disable conflict messages

Some live expeditions like anguish use a timeout to prevent excessive
leader conflict messages while still performing a creation request
2020-10-07 21:55:17 -04:00
hg a47546fc14 Cache new expedition before sending client updates
Compass updates get data from the expedition cache so it needs to be
cached first.

Currently this doesn't affect anything because compass isn't sent to
CreateExpedition and has to be set post-creation. In the future this
will make the order of client messages more live accurate though
2020-10-07 21:55:16 -04:00
hg 098176a7ed Let dz handle client removal timers
Remove all clients inside a dz, not just those assigned to instance
2020-10-07 21:55:16 -04:00
hg 3ca57dc0eb Assign lockouts to all clients inside dz
This is live like and prevents possible exploiting by dropping
expedition before a lockout. Clients will continue receiving lockouts
until they leave the zone or are kicked via timer
2020-10-07 21:55:16 -04:00
hg b8b4c5a280 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-10-07 21:55:16 -04:00
hg 41db607d36 Implement Lua quest api for expeditions 2020-10-07 21:55:15 -04:00
hg 0a4151b7c5 Implement initial expedition system
Add Expeditions logging category

Add handlers for all Dynamic Zone/Expedition related opcodes

Add FormatName string_util function to format character names

Add Zone::IsZone helper method

Add cross zone MessageString support with variable parameters

Add static Client method helpers for cross zone messaging

Add #dz gm command to debug expedition cache for current zone
2020-10-07 21:55:15 -04:00
hg e69f0b230b Update opcodes and packet structs for expeditions
Add and rename some opcodes

Add packet translations for expeditions

Fix OP_DzExpeditionEndsWarning opcode for RoF2

Add RoF2 OP_KickPlayers
2020-10-07 21:55:15 -04:00
Chris Miles a4a4a2266b Merge pull request #1122 from EQEmu/bug/item_loss_message
Only UF and earlier have the CORPSE_ITEM_LOST string
2020-10-06 02:30:26 -05:00
Noudess d507222d21 Allow amphibious creatures to swim to next node of pathing. 2020-09-21 10:36:00 -04:00
Michael Cook (mackal) 32f4722c0f Only UF and earlier have the CORPSE_ITEM_LOST string
Let's not confuse players with missing messages I guess
2020-09-20 13:55:45 -04:00
Chris Miles 5e93746e8c Merge pull request #1119 from noudess/master
Fix bugged pet sit button and taunt.
2020-09-19 18:48:13 -05:00
Michael Cook (mackal) 1106e404c7 Merge pull request #1121 from EQEmu/bug_fix/pet_affinity_solo_fix
Fix issue where a group buff was casted on a solo player
2020-09-10 14:25:37 -04:00
KimLS 0e2c918479 Added alias to lua skills that don't start with a number so i can use them with typescript which don't allow identifiers starting with 0-9 2020-09-09 21:29:29 -07:00
Noudess 05dfe748d3 Use aabonuses.PetCommands instead of checking AA level 2020-09-08 19:10:48 -04:00
Noudess cd2b2c3c19 Fix indentation. 2020-09-08 16:48:09 -04:00
Michael Cook (mackal) 6f2b39792a Fix issue where a group buff was casted on a solo player
The pet affinity in this case was checking the caster's AAs not the
target's like it should
2020-09-08 15:57:17 -04:00
Noudess ff6de1938b Change older clients to default to taunting=true only for taunt eligble pets. 2020-09-03 15:38:35 -04:00
Noudess d5451c5d77 Remove left over logging. 2020-09-02 14:56:12 -04:00
Noudess 96fb156c47 Change Older clients to not use persistant taunt button & default to taunt on. 2020-09-02 14:50:51 -04:00