200 Commits

Author SHA1 Message Date
Quintinon
b5c4357de2
[Bug Fix] Fix miscellaneous memory leaks related to EQApplicationPacket and it's pBuffer (#2262)
* Delete EQApplicationPacket after use

* Correct issue where Creating EQApplicationPackets in zone/mob.cpp may not free pBuffer[]

* Handle freeing pBuffer[] if exists in zone/mob.cpp Create*Packet functions

* Handle freeing pBuffer[] in zone/object.cpp Create*Packet methods

* Delete leaked outapp variables in zone/trading.cpp

* Make CreateHorseSpawnPacket() safer by freeing pBuffer[] before replacing with new[]

* Prevent initial new ServerPacket from being leaked in command_reload

* Free pack after sending in command_setlsinfo

* Delete new NPC in command_viewnpctype after printing stats

* Fix compile error

* Delete EQApplicationPacket after sending in command_kick

* Remove unneeded safe_delete(outapp) after FastQueuePacket and fix minor whitespace issue

* Delete packet after sending in WorldServer::SendReloadTasks

* Cleanup logic and free leaked NPCType in Client::Doppelganger

* Free RespawnOption in Client::HandleRespawnFromHover in 'unexpected rez from hover request' branch

* Free EQApplicationPacket after sending in Bot::ProcessBotInspectionRequest

* Free Bot when returning from failed Bot::Save() in helper_bot_create()

* Initialize variable to nullptr to prevent garbage initial value

* Undo change in other PR
2022-07-02 22:10:51 -05:00
Chris Miles
4639405fdf
[Discord Integration] Native Discord Integration (#2140)
* Start of discord integration work

* more testing

* Discord client work

* More discord work

* Cleanup

* Handle retry timer response and max retries

* Update base retry timer

* Move Discord queue handler to UCS, add queuer to own thread

* Post merge

* Send up Zone::SendDiscordMessage

* Start of discord integration work

* more testing

* Discord client work

* More discord work

* Cleanup

* Move Discord queue handler to UCS, add queuer to own thread

* Post merge

* Push up tables

* Quest API stuff.

* Update 2022_05_07_discord_webhooks.sql

* Post merge fixes

* Push up manifest

* Flip logging signs in logic from copy / paste of inverse logic before

* Make sure we add new line to quest api sourced messages

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
2022-06-09 17:22:23 -05:00
Kinglykrab
f9191d4ef4
[Commands] Cleanup #oocmute Command. (#2191)
- Cleanup messages and logic.
- Add ServerOOCMute_Struct for cleanliness.
2022-05-27 14:38:40 -04:00
Kinglykrab
df99d97431
[Cleanup] Cleanup #kick message. (#2164) 2022-05-10 19:52:14 -04:00
Kinglykrab
d120cf8a40
[Commands] #reload Command Overhaul. (#2162)
* [Commands] #reload Command Overhaul.
- Consolidated #reloadaa, #reloadallrules, #reloadcontentflags, #reloademote, #reloadlevelmods, #reloadmerchants, #reloadperlexportsettings, #reloadqst, #reloadstatic, #reloadtitles, #relaodtraps, #reloadworld, and #reloadzps in to one command.
- #reload has 15 different sub commands you may use, including Log Settings and Tasks reloading.
- All the reload commands are a part of the Developer Tools Menu messages now, as well as part of the documentation.
- Fixes the commands that weren't actually sending their packet to zone server to globally reload stuff.
- Added Variables table reloading to command.

* Consistency.

* Hot reload.

* Final big push.
2022-05-10 06:19:07 -04:00
Chris Miles
07b46ed445
[UCS] Auto Client Reconnection (#2154) 2022-05-07 22:24:11 -05:00
Kinglykrab
7df9b2974b
[Commands] Cleanup #reloadzps Command. (#2129)
* [Commands] Cleanup #reloadzps Command.
- Cleanup messages and logic.
- Make reloading of zone points global instead of zone specific.

* Further cleanup.
- Add zone->GetZoneDescription().
- Add mob->GetTargetDescription(mob).

* Final cleanup.

* Typo.
2022-05-07 03:23:15 -04:00
Kinglykrab
0b3065d7a9
[Commands] Cleanup #reloadtraps Command. (#2126)
* [Commands] Cleanup #reloadtraps Command.
- Cleanup messages and logic.
- Allow the option to reload/repop traps globally for this command.

* Typos.
2022-05-06 22:39:21 -04:00
Kinglykrab
7549fbbeea
[Commands] Cleanup #reloadlevelmods Command. (#2122)
* [Commands] Cleanup #reloadlevelmods Command.
- Cleanup messages and logic.
- Make the reloading of modifiers global instead of zone-specific.

* Remove unnecessary message.

* Update worldserver.cpp

* Update worldserver.cpp

* Update worldserver.cpp
2022-05-06 22:31:17 -04:00
Kinglykrab
86568e9292
[Commands] Cleanup #reloadaa Command. (#2120)
* [Commands] Cleanup #reloadaa Command.
- Cleanup messages.
- Remove unncessary file_exists command from file.
- Make reloading of Alternate Advancement data global instead of zone specific.

* Update worldserver.cpp

* Update worldserver.cpp
2022-05-06 21:57:19 -04:00
Kinglykrab
ee86001132
[Commands] Cleanup #reloadmerchants Command. (#2123)
* [Commands] Cleanup #reloadmerchants Command.
- Cleanup messages and logic.
- Make the reloading of merchants global instead of zone specific.

* Update worldserver.cpp

* Update worldserver.cpp
2022-05-06 20:48:46 -04:00
Kinglykrab
c1aa3e7056
[Commands] Cleanup #reloadallrules Command. (#2121)
* [Commands] Cleanup #reloadallrules Command.
- Cleanup messages.

* Typo.
2022-05-06 20:26:39 -04:00
Kinglykrab
1d59fff2bf
[Commands] Cleanup #reloadperlexportsettings Command. (#2124)
* [Commands] Cleanup #reloadperlexportsettings Command.
- Cleanup messages and logic.
- Make reloading of Perl event export settings global instead of zone specific.

* Update worldserver.cpp
2022-05-06 20:22:58 -04:00
Kinglykrab
6beb220e93
[Commands] Cleanup #reloadtitles Command. (#2125)
* [Commands] Cleanup #reloadtitles Command.
- Cleanup messages;

* Update worldserver.cpp
2022-05-06 20:20:42 -04:00
Kinglykrab
3091a84540
[Commands] Cleanup #reloadworld and #repop Command. (#2127)
* [Commands] Cleanup #reloadworld Command.
- Cleanup messages and logic.

* [Commands] Cleanup #reloadworld and #repop Command.
- Cleanup messages and logic.
- Add #reloadworld 2 option to forcefully repop all mobs globally as well as reset quest timers and reload quests.
- Remove delay argument from #repop as it isn't used for anything.

* Typos.
2022-05-06 20:06:51 -04:00
Kinglykrab
6846deb9c8
[Commands] Cleanup #reloadstatic Command. (#2130)
- Cleanup messages and logic.
- Make reloading of static zone data global instead of zone specific.
2022-05-06 20:03:22 -04:00
Kinglykrab
0aeab11408
[Commands] Cleanup #summon Command. (#2145)
* [Commands] Cleanup #summon Command.
- Cleanup messages and logic.
- Add glm::vec4 overload for GMMove.
- Remove unused parameter from GMMove.
- Remove unnecessary Lua GMMove now that parameter is gone.

* Update summon.cpp

* Cleanup.
2022-05-06 18:45:12 -05:00
cybernine186
0d734a0837
Bug Fix for WorldServer::HandleMessage, CZUpdateType_NPC (#2074) 2022-04-21 08:17:29 -04:00
Paul Coene
ccd0713b33
[Bug Fix] Fix recipient sound (vtell) on non-player races (#2066)
* [Bug Fix] Fix recipient sound (vtell) on non-player races

* Fix to use BaseRace as intended
2022-04-02 11:18:10 -04:00
Kinglykrab
d86544ff60
[Bug Fix] Alleviate some lag with crosszone/worldwide spell casting. (#2016)
- Spell casting was using SpellFinished which casts the spell, and if the spell was a group spell each member of the group would cast it on all the other members, causing a chain reaction.
- This fix utilizes ApplySpellBuff(spell_id, duration) so that it only casts the spell on the target, as with the crosszone and worldwide methods you will be affecting your target based on identifiers regardless.
- This should alleviate some of the crosszone/worldwide casting crashes on larger servers such as Lazarus.
2022-02-20 21:59:46 -05:00
Chris Miles
9815f50efa
[Expansion] Content Filtering Adjustments (#1910)
* Change default expansion values for ALL to -1 from 0

* Adjust content_filter_criteria

* Refactor content filtering logic

* Allow flag strings to also just be empty instead of null

* Formatting

* Editor oops
2022-01-02 20:52:29 -06:00
Kinglykrab
40edefa6f4
[Commands] Cleanup #camerashake Command. (#1787)
- Cleanup message and logic.
- Fix ConvertSecondsToTime logic for milliseconds.
- Add ConvertMillisecondsToTime inline function.
2021-11-21 10:03:20 -05:00
Kinglykrab
293361a1f7
[Cleanup] Make use of AccountStatus constants wherever status is checked or used. (#1764)
* [Cleanup] Make use of AccountStatus constants wherever status is checked or used.
- Cleanup all instances of SendEmoteMessage.
- Cleanup all instances of SendEmoteMessageRaw.
- Cleanup all instances of MessageStatus.
- Convert Quest API method defaults to use constants.

* Cleanup constant names.
2021-11-14 21:01:13 -06:00
Kinglykrab
efab0c4b6b
[Quest API] Add remove LDoN Win/Loss to Perl and Lua. (#1611)
* [Quest API] Add remove LDoN Win/Loss to Perl and Lua.
- Add $client->RemoveLDoNLoss(theme_id) to Perl.
- Add $client->RemoveLDoNWin(theme_id) to Perl.
- Add quest::removeldonloss(theme_id) to Perl.
- Add quest::removeldonwin(theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbyexpeditionid(expedition_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbyclientname(client_name, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbyexpeditionid(expedition_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbyclientname(client_name, theme_id) to Perl.
- Add quest::worldwideaddldonloss(theme_id, min_status, max_status) to Perl.
- Add quest::worldwideaddldonwin(theme_id, min_status, max_status) to Perl.
- Add client:RemoveLDoNLoss(theme_id) to Lua.
- Add client:RemoveLDoNWin(theme_id) to Lua.
- Add eq.remove_ldon_loss(theme_id) to Lua.
- Add eq.remove_ldon_win(theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_expedition_id(expedition_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_client_name(client_name, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_expedition_id(expedition_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_client_name(client_name, theme_id) to Lua.
- Add eq.world_wide_add_ldon_loss(theme_id, min_status, max_status) to Lua.
- Add eq.world_wide_add_ldon_win(theme_id, min_status, max_status) to Lua.
Adds enum for LDoN Themes and Theme Bitmasks so we're not using magic numbers.
Adds item links to item messages and augment messages on rejection/restriction/Lore.

* Update client_packet.cpp

* Update client_packet.cpp

* Update servertalk.h

Alphabetical.
2021-10-20 15:11:14 -04:00
Kinglykrab
91adf9c0eb
[Quest API] Add cross zone and world wide dialogue windows to Perl/Lua. (#1599)
* [Quest API] Add cross zone and world wide dialogue windows to Perl/Lua.
- Add quest::crosszonedialoguewindowbycharid(character_id, message) to Perl.
- Add quest::crosszonedialoguewindowbygroupid(group_id, message) to Perl.
- Add quest::crosszonedialoguewindowbyraidid(raid_id, message) to Perl.
- Add quest::crosszonedialoguewindowbyguildid(guild_id, message) to Perl.
- Add quest::crosszonedialoguewindowbyexpeditionid(expedition_id, message) to Perl.
- Add quest::crosszonedialoguewindowbyclientname(client_name, message) to Perl.
- Add quest::worldwidedialoguewindow(message, min_status, max_status) to Perl.
- Add eq.cross_zone_dialogue_window_by_char_id(character_id, message) to Lua.
- Add eq.cross_zone_dialogue_window_by_group_id(group_id, message) to Lua.
- Add eq.cross_zone_dialogue_window_by_raid_id(raid_id, message) to Lua.
- Add eq.cross_zone_dialogue_window_by_guild_id(guild_id, message) to Lua.
- Add eq.cross_zone_dialogue_window_by_expedition_id(expedition_id, message) to Lua.
- Add eq.cross_zone_dialogue_window_by_client_name(client_name, message) to Lua.
- Add eq.world_wide_dialogue_window(message, min_status, max_status) to Lua.

* Use string instead.
2021-10-11 16:33:18 -04:00
Kinglykrab
c15c54e920
[Quest API] Cross zone and world wide method overhaul. (#1520)
* [Quest API] Cross zone and world wide method overhaul.
- Adds support for Character ID, Character Name, and Expedition ID to all cross zone methods that did not have a method.
- Adds worldwide LDoN Updates.
- Shrinks the number of packets and structs from 83 to 17.

No quest functionality will be affected by this, as the only changes are the underlying method used to send the cross zone and world wide data.

* Formatting, organization, and fixing of improper exports.

* Finalize comb through of variable types, update types, etc.

* Merge fixes.
2021-09-19 16:15:14 -07:00
Chris Miles
e7dd8d49a9
[Shared Tasks] Shared Tasks System Implementation (#1451)
* Shared tasks WIP; lots of logging; shared tasks and tasks work internally the same for now; lots to cleanup yet

* Update task_manager.cpp

* Add tables

* World message handler

* Zone message handler

* More messaging

* More rearranging

* Task creation work (wip)

* Tweaks

* Decoupled things, added a shared task manager, moved logic to the manager, created the shared task object, now creating a sense of state on creation and members, zero validation, happy path

* Cleanup unnecessary  getter

* More work on shared task persistence and state loading

* Add int64 support into repositories

* More state handling, creation loads all tables

* Wrap up shared task state creation and removal

* Move more lookup operations to preloading (memory). Restore shared task state during world bootup

* Implement shared task updates

* Add members other than just leader in task confirmations

* Update shared_task_manager.cpp

* Hook task cancellation for shared task removal (middleware)

* Remove dynamic_zone_id from SharedTasks model in repositories (for now) since we will likely be one to many with DZ objects

* Get members to show up in the window on creation

* Add opcodes, cleanup

* Add opcode handlers

* Split some methods out, self removal of shared task and updating members

* Implement offline shared task sync

* Style changes

* Send memberlist on initial login; implement remove player from shared task window

* Refactorings, cleanup

* Implement make leader in shared tasks window

* Implement add player, sync shared task state after add

* Add opcodes for remaining clients

* Shared task invite dialogue window implementation and response handling (including validation)

* Logging

* Remove comment

* Some cleanup

* Pass NPC context through shared task request logic

* Remove extra SharedTaskMember fields

* Add message constants

* Remove static

* Only use dz for expedition request

This passes expedition creation parameters through DynamicZone instead
of injecting ExpeditionRequest since it can hold creation data now

* Store expedition leader on dz

This shifts to using the leader object that exists in the core dynamic
zone object. It will be moved to the dynamic zone table later with other
columns that should just be on the dz to make loading easier.

Expeditions are probably the only dz type that will use this for window
updates and command auth. Other systems on live do fill the window but
don't keep it updated

* Store expedition name on dz

This uses the name stored on dz (for window packets) instead of
duplicating it. This will be moved completely to dz table later

* Store uuid on dynamic zone

This lets dynamic zones generate the uuid instead of expeditions. Other
dz type systems may want to make use of this. Lockouts should also be
moved to dynamic zones at some point in the future so this will be
necessary for that

* Move expedition db columns to dz

These columns should just belong to the core dynamic zone. This will
simplify loading from the database and in the future a separate
expedition table may no longer be necessary.

* Move window packet methods to dz

It makes more sense for these methods to be in the core

This will also allow support for other systems to use the window, though
live behavior that updates the window for shared task missions when not
in an expedition is likely unintended since it's not updated on changes.

* Store dynamic zone ids on clients

These will now be used for client dynamic zone lookups to remove
dependency on any dz type system caches

* Move member management to dz

This moves server messaging for adding and removing members to internal
dynamic zone methods

Set default dz member status to Unknown

* Move member status caching to dz

This moves world member status caching into internal dz methods

Zone member updates for created expeditions are now async and sent after
world replies with member statuses. Prior to this two memberlist packets
were sent to members in other zones on creation to update statuses.

This also fixes a bug with member statuses being wrong for offline raid
members in the zone that created an expedition. Note that live kicks
offline players out of raids so this is only to support emu behavior.

* Move member status updates to dz

* Set dz member status on all client dzs

This also renames the zone entry dz update method and moves window
update to a dynamic zone method. Eventually expedition components
should just be merged with dz and handled as another dz type

* Save instance safe return on characters

Add character_instance_safereturns table and repository

Previously dz safe return only worked for online characters via the dz
kicktimer or offline characters with a workaround that moved them when
an expedition was deleted. There were various edge cases that would
cause characters to be moved to bind instead (succoring after removal,
camping before kick timer, removed while offline, bulk kickplayers
removal with some offline)

This updates a character's instance safereturn every time they enter a
zone. If a character enters world in an instance that expired or are no
longer part of they'll be moved to their instance safereturn (if the
safereturn data is for the same zone-instance). Bind is still a fallback

This may also be used for non-dz instancing so it's named generically

This removes the expedition MoveMembersToSafeReturn workaround which
deprecates the is_current_member column of dynamic_zone_members and
will be removed in a followup patch.

* Remove is_current_member from dz members

This was only being used in the workaround to move past members to
dz safereturns if they were still inside the dz but not online

* Let dz check leader in world

This moves expedition leader processing in world to the dynamic zone.
This is a step in phasing out the separate expedition class for things
that can run off the dynamic zone core with simple dz type checks

This greatly simplifies checking leader on member and status changes
without needing callbacks. Other dz types that may use the dz leader
object can just handle it directly on the dz the same as expeditions

* Let dz handle member expire warnings

This moves expire warning checks to dz. This will make it easier for
other dz types to issue expire warnings if needed

* Use separate dynamic zone cache

Dynamic zones are no longer member objects of expeditions and have been
placed into their own cache. This was done so other dz types can be
cached without relying on their systems. Client and zone dz Lookups are
now independent of any system

This continues the process of phasing out a separate expedition cache.
Eventually expeditions can just be run directly as dynamic zones
internally with a few dz type checks.

Add dz serialization methods (cereal) for passing server dz creation

Modify #dz list to show cache and database separately. Also adds #dz
cache reload. This command will reload expeditions too since they
currently hold references to the dz in their own zone cache.

Add a dynamic zone processing class to world to process all types and
move expedition processing to it

* Move expedition makeleader processing to dz

* Let dz handle expedition deletions

This removes the need for separate expedition cache in world

This will greatly simplify world dynamic zone caching and processing.
Dynamic zones that are expeditions can just handle this directly. Once
lockouts and other components are completely moved to dynamic zones the
separate expedition cache in zone will also no longer be necessary

* Remove ExpeditionBase class

Since world no longer caches expeditions this will not be necessary

* Fix windows compile

* Implement task dz creation

Prototype dz creation for shared tasks

* Add and remove shared task members from dz

Also keep leader updated (used in choose zone window)

* Fix client crash on failed shared task

* Fix linux compile and warning

* Check client nullptr for dz message

This was accidently removed when expedition makeleader was moved

* Disable dz creation for solo tasks

* Add shared task repository headers to CMakeLists

* Add shared task dynamic zones table

* Add shared task dz database persistence

* Get members from db on shared task dz creation

This fixes a case where removing a member from a shared task dz would
fail if the member's name was empty. This could happen if the shared
task dz was created while a member was offline.

This also changes the dz member removal method to only check id. It
might be possible to change all dz member validations to only check
ids since names are primarily for window updates, but shared task dz
member names need to be non-empty anyway to support possible live-like
dz window usage in the future.

* Add character message methods to world

Add simple and eqstr message methods to ClientList

Add shared task manager methods to message all members or leader

* Add SyncClientSharedTaskState and nested sync strategies to cover M3 work

* Fix whitespace

* Implement task request cooldown timer

This implements the task request cooldown (15 seconds) that live uses
when a task is accepted. This will also need to be set when shared
tasks are offered (likely due to additional group/raid validations)

* Implement shared task selector validation

This implements the validation and filtering that occurs before the task
selection window is sent to a client for shared tasks

To keep things live-like, task selectors that contain a shared task will
be run through shared task validation and drop non-shared tasks. Live
doesn't mix types in task selections and this makes validation simpler.

Also note that live sends shared task selectors via a different opcode
than solo tasks but that has not been implemented yet

* Add separate shared task select opcodes

Live uses separate opcodes for solo and shared task selection windows

* Convert ActivityType to enum class

* Refactor task selector serialization

This adds serializer methods to task and task objective structs for the
task selection windows. This combines the duplicate task selector
methods to reduce code duplication and simplify serialization

* Add shared task selector

This sends shared task selection window using the shared task specific
opcode and adds an opcode handler for shared task accepts which are sent
by client in response to setting selection window to shared task type.

* Refactor task objective serialization

This adds a serialization method to the task objective struct for
serializing objectives in the window list and combines the separate
client-based methods to reduce duplicated code.

* Add task level spread and player count columns

* Implement shared task accept validation

This adds a common method for shared task character request queries

* Add task replay and request timer columns

* Add character task timers table

* Use shared task accept time on clients

This overrides client task accept time with shared task's creation time.
This is needed for accurate window task timers and lockout messages
especially for characters added to shared tasks post creation

* Implement task timer lockouts

This implements replay and request task timers for solo and shared tasks

* Add solo and shared task timer validation

* Remove logging of padding array

This gets interpreted as a c string which may not be null terminated

* Implement /kickplayers task

This also fixes current CancelTask behavior for leader which was
performing kickplayers functionality through the remove task button

* Implement /taskquit command

* Implement shared task invite validation

Remove active invitation before invite accept validation

* Remove local client db persistence during SyncClientSharedTaskRemoveLocalIfNotExists

* Add missing accept time arg to assign task

* Only validate non-zero task invite requirements

* Fix task error log crash

* Separate task cooldown timer messaging

* Use method to check for client shared task

* Avoid unneeded task invite validation query

Only need to query character data for levels for non-zero level spread

* Implement /tasktimers command

May want to add some type of throttled caching mechanism for this in
the future

* Add /tasktimers rate limiter

* Intercept shared task completion; more work to come

* Change SharedTaskActivityState and SharedTasks time objects to datetime

* Add updated_time updates to SharedTaskActivities

* Mark shared tasks as complete when all activities are completed

* Save a database query on shared task completion and use the active record in memory

* Don't record shared task completions to the quest log

* Implement RecordSharedTaskCompletion, add tables, repositories

* Update shared_task_manager.cpp

* Update shared_task_manager.cpp

* Add shared task replay timers

This is still not feature complete. On live any past members that ever
joined the shared task will receive a replay timer when it's completed

* Create FindCharactersInSharedTasks that searches through memory

* Remove namespace shorthand and formatting

* More minor cleanup

* Implement PurgeAllSharedTasks via #task command

* Add #task purgetimers

* Decrease m_keepalive time between processes

* Remove type ordering in /tasktimer query

* Add comment for task packet reward multiplier

This is likely a reward multiplier that changes text color based on
value to represent any scaled bonus or penalty

* Add replay timers to past members

This implements the live behavior that adds replay timers to any
previous member of a shared task. This likely exists to avoid possible
exploits.

Shared task member history is stored in memory and is used to assign
replay timers. This history will be lost on world crashes or restarts
but is simpler than saving past member state in database.

This also makes world send shared task replay timer messages since
past members need to be messaged now

* Move PurgeTaskTimers client method to tasks.cpp

* Remove dz members when purging shared tasks

Server dz states need to be updated before shared tasks are deleted

* Use exact name in shared task invites

This removes the wildcards from shared task invite character queries
which was sometimes selecting the wrong character

Taskadd validation is called even for invalid characters to allow for
proper messages to occur

* Clear declined active shared task invitations

This also notifies leader for declined shared task invites

* Store shared task member names

This adds back the character name field to SharedTaskMember. This should
make serialization easier in the future and reduce database lookups when
names are needed for /task commands

* Implement /taskplayerlist command

* Replace queries with member name lookups

Now that shared task members store names these queries are unnecessary

This also adds not-a-member messages for /taskremove and /taskmakeleader

* Implement shared task member change packet

This avoids sending the full member list to members when a single member
is added or removed and lets the client generate chat messages for it.

* Serialize shared task member list from world

This uses cereal to serialize the full member list from world and
removes the zone query workarounds

* Initialize client task state array

This was causing sql query errors on client state reloads

The client task information array was uninitialized resulting in being
filled with 0xcdcdcdcd values in msvc debug builds. Under release builds
this may have resulted in indeterminate values

A better fix would be to refactor some of this legacy code

* Add shared task command messages

Add messages for non-leader task commands

This adds taskadd, taskremove, taskmakeleader, and taskquit messages

The leader receives double messages for taskremove like live due to the
client generated message as well as the explicit one. It also receives
double server messages if the leader /taskremoves self.

* Replace some task messages with eqstrs

This also updates to use live colors

* Avoid shared task invite leader lookup query

Since member names are stored now this query is also unnecessary

* Avoid reloading client state on shared task accept

This was unnecessarily reloading client task state when added to a
shared task.

This also resulted in all active tasks being resent to shared task
members on creation. The shared task itself is the only task that
needs to be sent which is handled by AcceptNewTask.

* Remove active shared task invite on zone

Live doesn't re-send shared task invites after zoning like it does for
expeditions so there's no need to keep these around. This fixes active
invitations never getting reset on characters that zone or go offline.

* Choose new shared task leader if leader removed

* Add separate shared task kickplayers method

* Enable EVENT_CAST_ON for clients

This will be required for a shared task objective (The Creator) in DoN

* Revert "Avoid reloading client state on shared task accept"

This reverts commit 3af14fee2de8b109ffb6c2b2fc67731e1531a665.

Without this clients added to a task after some objectives have been
completed don't get updated state. Will need to investigate this later

* Disallow looting inside a dz by non-members

Non-members of a dynamic zone should not be allowed to loot npcs inside
it. This should have been disabled for expeditions already but was still
allowed due to an oversight (or live behavior changed). This is less
critical for shared tasks since members can be added and removed at will
without leaving a dz but still an important feature.

* Change load where criteria

* Increase task completion emote column size

* Use eqstr for task item reward message

* Implement radiant and ebon crystal rewards

This adds reward columns for radiant and ebon crystals to the tasks
table and updates task description serialization

* Send task completion emote before rewards

This matches live and makes it a little easier to see item rewards when
tasks have a long completion emote. This also changes it to send via the
same normal message opcode that live uses.

* Do not send a shared task in completed task history

* Allow EVENT_TASK_STAGE_COMPLETE for quest goals

This invokes event_task_stage_complete for task elements flagged with a
quest controlled goal method. It should be expected behavior that a
completed task stage always fires this event even if a quest controls it

* Add SyncSharedTaskZoneClientDoneCountState

* Swap return for continue in this case

* Formatting

* Simplify

* Formatting

* Formatting

* Formatting

* Remove errant check

* Formatting, add setter for shared tasks

* Remove debugging

* Comments in PR

* More PR follow up

* Formatting

* Cleanup

* Update packet comments

* Comments

* More cleanup

* Send command error message if not in shared task

/taskadd is the only command with this feedback on live. Newer live
clients also generate this instead of the server sending the message

* Implement expire_time on SharedTask object and add a purge on world bootup

* Comment

* Add SyncClientSharedTaskStateToLocal where clients fall out of sync and no longer have a task locally

* Clamp shared task activity updates to max done count and discard updates out of bounds

* Fix packet send

* Revert packet send

* Adjust clamping OOO for completed time check. Add completed tables to purge truncation

* Refactor kill update logic so that shared task kill updates only update one client instead of all clients

* Cleanup how we're checking for active tasks

* Forward task sets that contain shared tasks

This forwards task sets that contain a shared task to shared task
selector validation like normal task selectors

* Change eqstr for empty solo task offers

This is the message live appears to use if all task offers are filtered
out by solo task validation

* Fix max active tasks client message

This message starts at the third argument. It was maybe intended to be
an npc say message but live just sends it as a normal eqstr with the
first two arguments nulled.

* Load client task state after zoning complete

This fixes a possible race where a character removed from a shared task
while zoning would be stuck with an incorrect character activities state
after zoning was completed.

This was caused by the character loading task state to early on zone
entry but never receiving the remove player message from world since
they are missing from the world cle until zoning is completed.

Loading client state after zone connection is completed makes sure the
client has the latest state and available to the world cle

* Send message to clients removed while zoning

This message should usually only be sent to characters that were
removed from a shared task while zoning but will occur for any sync
state removals where a message wouldn't have already occured.

* Post rebase fix

* HG comment for checking active task

* Addressing HG comments around zeroing out a shared task id

* Remove errant comment

* Post rebase database manifest updates

* Update eqemu_logsys_log_aliases.h

* More rebase catches

* Bump database version for last commit

Co-authored-by: hg <4683435+hgtw@users.noreply.github.com>
2021-09-05 01:21:23 -05:00
Chris Miles
3b01608a71
[Server] Tweak inter process keepalive timers; this is a very tiny overhead for inter-process chatter to check for connection liveness (#1502) 2021-08-31 00:34:28 -05:00
Chris Miles
bcb0e43d13
[Logging] Simplify Log Settings Initialization (#1394)
* Simplify logging loading

* Fix log injections and reduce verbosity
2021-06-13 18:06:43 -05:00
Alex
e14acd6802
[Quest API] Add several methods to Perl/Lua API for LDoN stuff. (#1356)
- Swapped parameters in mostly unused functions to be theme_id first and points second. (No examples in PEQ quests.)
- Add $client->AddLDoNLoss(theme_id) to Perl.
- Add $client->AddLDoNWin(theme_id) to Perl.
- Add quest::crosszoneaddldonlossbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbyexpeditionid(expedition_id, theme_id) to Perl.
- Add quest::crosszoneaddldonpointsbycharid(character_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbygroupid(group_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbyraidid(raid_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbyguildid(guild_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbyexpeditionid(expedition_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonwinbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbyexpeditionid(expedition_id, theme_id) to Perl.
- Fix quest::addldonloss(theme_id) in Perl.
- Fix quest::addldonwin(theme_id) in Perl.
- Add client:AddLDoNLoss(theme_id) to Lua.
- Add client:AddLDoNWin(theme_id) to Lua.
- Add eq.add_ldon_loss(theme_id) to Lua.
- Add eq.add_ldon_points(theme_id, points) to Lua.
- Add eq.add_ldon_win(theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_expedition_id(expedition_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_points_by_char_id(character_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_group_id(group_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_raid_id(raid_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_guild_id(guild_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_expedition_id(expedition_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_win_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_expedition_id(expedition_id, theme_id) to Lua.
2021-05-24 21:15:41 -05:00
hg
0ce7c11d36
[Expeditions] Track DZ member status in world (#1341)
World now caches and tracks member statuses so it can send them to zones
that request them on startup. Prior to this the cle would be searched in
world for every zone startup caching request, now it's only searched once
when a new expedition is created.

Bulk loading statuses removed since it would only be needed on world
startup now and likely have no clients in the client list anyway.

This also lets world choose non-linkdead members on expedition leader
changes and better detect when a leader change needs to occur
2021-05-10 01:07:19 -05:00
Chris Miles
7aa5308f9c
[Scheduler] Event scheduler implementation (#1257)
* Event scheduler implementation

* Create 2021_02_17_server_scheduled_events.sql

* Tweak

* Remove unused event [skip ci]

* Cleanup [skip ci]

* PR adjustments

* Database manifest
2021-03-29 02:52:57 -05:00
hg
049fe55c7f
[Expeditions] Create common dz abstract class (#1312)
This creates an abstract class in common so zone and world can share
most of the implementation. World now has access to the same dz data and
api as zone.

Rename CharacterChange to AddRemoveCharacter for clarity

Rename GetRemainingDuration to GetDurationRemaining for consistency

Move dynamic zone queries to custom repository methods
2021-03-29 02:17:36 -05:00
hg
d9e23a0303
[Expeditions] Decouple dz updates from expeditions (#1303)
Use internal dz messages to process duration and location changes

Add world DynamicZone class (later this will inherit from a base)

Add FindDynamicZoneByID to get dz from zone and world system caches
2021-03-28 18:14:36 -05:00
Alex
e5f5db69b4
Merge pull request #1280 from EQEmu/bug_fix/strcpy_overlap_GetGroupLeadershipInfo
[ASan] Fix strcpy-param-overlap with GetGroupLeadershipInfo calls
2021-03-05 19:24:42 -08:00
Alex
d635e69ee3
Merge pull request #1283 from EQEmu/cleanup/Wformat-overflow
[Cleanup] Make code -Wformat-overflow safe
2021-03-05 19:23:48 -08:00
Michael Cook (mackal)
224c26620e Clean up MOTD processing 2021-03-05 15:24:40 -05:00
Michael Cook (mackal)
c45395be95 Fix strcpy-param-overlap with GetGroupLeadershipInfo calls
==1810==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7ffef04baf90,0x7ffef04baf98) and [0x7ffef04baf90, 0x7ffef04baf98) overlap
    #0 0x7f163bb9509e  (/lib/x86_64-linux-gnu/libasan.so.5+0x4f09e)
    #1 0x5652caed27b3 in Client::Handle_Connect_OP_ZoneEntry(EQApplicationPacket const*) ../zone/client_packet.cpp:1535

==1918==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7ffddc8057c0,0x7ffddc8057c8) and [0x7ffddc8057c0, 0x7ffddc8057c8) overlap
    #0 0x7fc61ee0e09e  (/lib/x86_64-linux-gnu/libasan.so.5+0x4f09e)
    #1 0x56023c149698 in WorldServer::HandleMessage(unsigned short, EQ::Net::Packet const&) ../zone/worldserver.cpp:1055
2021-02-28 21:42:51 -05:00
Michael Cook (mackal)
b82f376bfb Fix stack-buffer-overflow thanks to StopLFP
==1674==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffb47f3068 at pc 0x7f64ee1f531e bp 0x7fffb47f2f50 sp 0x7fffb47f2700
READ of size 432 at 0x7fffb47f3068 thread T0
    #0 0x7f64ee1f531d  (/lib/x86_64-linux-gnu/libasan.so.5+0x3f31d)
    #1 0x55c78e8d002e in WorldServer::UpdateLFP(unsigned int, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int, char const*, GroupLFPMemberEntry*) ../zone/worldserver.cpp:3166
    #2 0x55c78e8d01d9 in WorldServer::StopLFP(unsigned int) ../zone/worldserver.cpp:3180
2021-02-28 17:50:07 -05:00
Michael Cook (mackal)
7a46a6595c
[Cleanup] use std::make_unique (#1259)
* Convert common/eq_limits.cpp to use make_unique

* Convert common/net/console_server.cpp to use make_unique

* Convert common/net/servertalk_client_connection.cpp to use make_unique

* Convert common/net/servertalk_legacy_client_connection.cpp to use make_unique

* Convert common/net/servertalk_server.cpp to use make_unique

* Convert common/net/websocket_server.cpp to use make_unique

* Convert common/net/websocket_server_connection.cpp to use make_unique

* Convert common/shareddb.cpp to use make_unique

* Convert eqlaunch/worldserver.cpp to use make_unique

* Convert loginserver/server_manager.cpp to use make_unique

* Convert loginserver/world_server.cpp to use make_unique

* Convert queryserv/worldserver.cpp to use make_unique

* Convert ucs/worldserver.cpp to use make_unique

* Convert world/clientlist.cpp to use make_unique

* Convert world/expedition.cpp to use make_unique

* Convert world/launcher_link.cpp to use make_unique

* Convert world/login_server.cpp to use make_unique

* Convert world/main.cpp to use make_unique

* Convert world/ucs.cpp to use make_unique

* Convert world/web_interface.cpp to use make_unique

* Convert world/zonelist.cpp to use make_unique

* Convert world/zoneserver.cpp to use make_unique

* Convert zone/client.cpp to use make_unique

* Convert zone/corpse.cpp to use make_unique

* Convert zone/dynamiczone.cpp to use make_unique

* Convert zone/expedition.cpp to use make_unique

* Convert zone/main.cpp to use make_unique

* Convert zone/mob_ai.cpp to use make_unique

* Convert zone/mob_movement_manager.cpp to use make_unique

* Convert zone/pathfinder_nav_mesh.cpp to use make_unique

* Convert zone/worldserver.cpp to use make_unique
2021-02-23 18:30:46 -06:00
Michael Cook (mackal)
0ef01165ea
Fix some leaks of groups/raids (#1242)
These cases probably are exceedingly rare, but they still need to be
accounted for. (As in, I don't think anyone has run into these cases too
often to cause problems)
2021-02-12 02:07:58 -06:00
Akkadius
6e765e7ddc Revert "[BUG] Fix for Group Leader Disband Issue"
This reverts commit f854137ca029fa6e90cab5133bd8ee6194f8e1cb.
2021-02-12 02:05:20 -06:00
Akkadius
0c533071d4 Yet more cleanup 2021-02-07 15:00:16 -06:00
Akkadius
c194e2ac9c Fix linux compile warnings 2021-02-06 01:22:22 -06:00
Akkadius
b7983d4c20 First pass 2021-02-06 00:45:13 -06:00
Trust
f854137ca0 [BUG] Fix for Group Leader Disband Issue
Added public/private class for oldleadername so we can save the previous leader name when the entity is destroyed then allow us to transfer leadership.

Adjusted DelmemberOOZ and in zone functions to include removal of the old leader when disbanding.
2020-12-31 00:16:27 -05:00
hg
da5d4b9830 Send all members expedition expire warnings
All expedition members are notified not just those in dz

This will only work if the dz is running. It might make more sense to
move this to client or world processing so members are notified even if
the zone instance isn't running
2020-12-30 18:47:31 -05:00
hg
b377fd183a Add api to add lockout duration
Also supports reducing lockout duration

Add Expedition::AddLockoutDuration

Add Client::AddExpeditionLockoutDuration

Some expeditions require adding to existing lockout durations
during progression. These add the specified seconds to individual
member lockout timers instead of setting a static duration based on
internal expedition lockout like UpdateLockoutDuration.
2020-12-30 18:47:11 -05:00
hg
d61879fd3c Add character id based expedition apis
Add static expedition methods to add or remove character lockouts

Add CreateLockout static helper to ExpeditionLockoutTimer

Refactor existing character lockout removal to allow removal of lockouts
for offline characters (was only used by #dz lockouts remove command)

Fix #dz list member count
2020-12-30 18:47:10 -05:00
hg
184ea679f2 Refactor client cross zone message helpers
Remove extra cross zone message server opcode and struct. Existing
function already exists for normal messages

Group CZClientMessageString struct with other CZ structs
2020-12-30 18:47:09 -05:00