Compare commits

..

131 Commits

Author SHA1 Message Date
KimLS 3ef106dc64 Bot compile fix 2021-09-27 00:57:04 -07:00
KimLS 7453326f87 HP overflow is now gated by a rule for clients (bots and mercs will always get fixed hp), fix for phantom stat aa regression 2021-09-21 21:29:28 -07:00
KimLS b82dfb91ae Fix for bot breaking, I don't normally build bots. 2021-09-16 11:21:37 -07:00
KimLS 5891b2c426 Change out 300 for named constant 2021-09-16 00:58:57 -07:00
KimLS 6e16f6c1b6 Match the client's bugged state with natural durability, remove redundant statbonus maxhp 2021-09-16 00:53:11 -07:00
KimLS fba333fe8a Suggested change, and simplified the AA function 2021-09-11 22:42:35 -07:00
KimLS edb7ea4ee3 Fix for build 2021-09-11 21:21:50 -07:00
KimLS 66cf4b546c Various changes:
- Heroic Sta HP calc will now apply after natural durability.
- The base 5 hp that everyone gets will now apply after natural
durability.
- Fixed a rounding issue in the mana calc that would sometimes give
the player +1 mana
- Fixed the endurance calc to match the client better.
- When a server has a custom stat cap active the new stat caps
will be reflected on the client.
    This is done by reserving an AA slot for a "Phantom" AA that will
    act like Planar Power with the difference between what the client
    sees and what the server has.
- AA slots cap now will be 300 (the later clients max)
instead of 240 (titanium's max)
2021-09-10 19:52:28 -07:00
Chris Miles c078257f70 [Quest API] Port DiaWind Plugin to Native Quest API (#1521)
* Port DiaWind plugin to native Quest API

* Add no logging aliases
2021-09-05 20:29:21 -05: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
splose 943c623be0 [Hitpoints] More HP Fixes - Remove Hacks (#1518)
* Fix HP update throttling

* Remove more hacks

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-09-04 23:17:59 -05:00
Michael Cook (mackal) 41352f77ae [Spells] Implement PVP resist and duration overrides (#1513)
* Make use of PVP resist field

* Implement PVP duration formulas
2021-09-03 20:19:39 -05:00
Logan af6d344e12 [Mods] Added Hastev3Cap (#1506)
* Added Hastev3Cap

* Added Hastev3Cap rule
2021-09-03 20:15:24 -05:00
KayenEQ 59434e0101 [Spells] Updated SE_NegateSpellEffect SPA 382, new functionality (#1514)
* updated SPA 382

Updated SE_NegateSpellEffect SPA 382

Now uses spell values base1 which allows you to limit which bonuses are negated.

* Update spdat.h

* minor update

* Update bonuses.cpp

reset bool correctly

* Update bonuses.cpp

* Update bonuses.cpp
2021-09-03 20:15:07 -05:00
Kinglykrab 119018cf41 [Quest API] Add GetHealScale() and GetSpellScale() to Perl and Lua. (#1515) 2021-09-03 19:47:33 -05:00
Chris Miles e1df72d64d [Hitpoints] Remove HP Update Throttling (#1517)
* Remove HP update throttling and increase HP update resolution and accuracy

* Make some log statements detail

* Add better logging messages

* Remove old self update throttle block check preventing updates to self
2021-09-03 19:47:25 -05:00
Chris Miles 7f823256f4 [Hotfix] Fixing FMT Format Crash (#1516) 2021-09-03 12:59:17 -05:00
KayenEQ 9525827881 [Spells] Allow SE_SecondaryForte 248 to be calculated as a bonus instead of hardcoded AA (#1507)
* start

* Update client.cpp

* Update client.cpp

* Update bonuses.cpp

* Update bonuses.cpp

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-08-31 01:32:16 -05:00
Kinglykrab fec1b1538e [Quest API] Modify GetItemStat() and GetSpellStat() functionality. (#1509)
- Added quest::getitemstat(item_id, stat_identifier) to Perl.
- Added quest::getspellstat(spell_id, stat_identifier, slot) to Perl.
- Added eq.get_item_stat(item_id, stat_identifier) to Lua.
- Added eq.get_spell_stat(spell_id, stat_identifier, slot) to Lua.

Wasn't sure where to put the GetItemStatValue() method so I put it in inventory profile, I can move it wherever is preferred.

These additions will allow people to grab item and spell stat values in plugins without needing a mob object.
2021-08-31 01:31:56 -05:00
Akkadius 87a4f64ff0 [Compile Fix] Squelch warnings 2021-08-31 01:24:21 -05:00
Dencelle 7b069dcf20 [Cheat Detection] Anti-Cheat reimplementation (#1434)
* [Cheat Detection] Anti-Cheat reimplementation

* minor patch fixes

* ceiling to server side runspeed

Warp(LT) was picking up a bunch of expected 6.2 but it was reported back as 6.5, this should help reduce the amount of false positives we get

* use ceil instead of std::ceilf for linux

* boat false positive fix

* stopping the double detection

* fixes and cleanup

* auto merge tricked me...

* dummy divide by 0 checks

this should prevent anyone from setting Zone:MQWarpDetectionDistanceFactor to 0 and causing a crash.

* Formatting

* encapsulation to its own class and clean up

* more detections

* typo

* OP_UnderWorld implmentation

* Update client_packet.h

* Syntax changes, formatting, cleanup

* preventing crashes due to invalid packet size

* typos and clearer logic

* seperated the catagory for cheats

* Updated MQGhost for more detail

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-31 01:08:31 -05:00
Kinglykrab 26299354b6 [Quest API] Adds new methods to NPCs and Corpses (#1510)
- Add $npc->HasItem(item_id) to Perl.
- Add $npc->CountItem(item_id) to Perl.
- Add $npc->GetItemIDBySlot(loot_slot) to Perl.
- Add $npc->GetFirstSlotByItemID(item_id) to Perl.
- Add $corpse->HasItem(item_id) to Perl.
- Add $corpse->CountItem(item_id) to Perl.
- Add $corpse->GetItemIDBySlot(loot_slot) to Perl.
- Add $corpse->GetFirstSlotByItemID(item_id) to Perl.
- Add npc:HasItem(item_id) to Lua.
- Add npc:CountItem(item_id) to Lua.
- Add npc:GetItemIDBySlot(loot_slot) to Lua.
- Add npc:GetFirstSlotByItemID(item_id) to Lua.
- Add corpse:HasItem(item_id) to Lua.
- Add corpse:CountItem(item_id) to Lua.
- Add corpse:GetItemIDBySlot(loot_slot) to Lua.
- Add corpse:GetFirstSlotByItemID(item_id) to Lua.

These methods will allow server operators to view the loot a current has in a slot, the first slot found by item ID, count the item by ID, and see if the NPC has the item.

With that functionality you could build a custom loot system and modify loot more dynamically.
2021-08-31 00:42:08 -05:00
Kinglykrab 642cbfcadc [Bug Fix] Shared Bank Charges Fix (#1511)
- Shared bank charges were being set to int8 on select, meaning any item that stacks over 127 would break if put in shared bank, causing loss of items.
2021-08-31 00:41:43 -05:00
KayenEQ cb3f8daedd [Spells] Major update to cast restriction code and new spell field 'caster_requirement_id' (field220) implemented (#1508)
* Implemented spells_new table 'field220' as 'caster_requirement_id'

Implemented spells_new table 'field220' as 'caster_requirement_id'

* Update spell_effects.cpp

* updates to CastRestriction

enum using live description
updated entire function
missing and new types added
many fixes

* updates

* code fixes

* updates

* updates

* Update spdat.h

* typo fix
2021-08-31 00:41:20 -05:00
KayenEQ 5f3c054044 [Spells] Updated pet suspend code to use spell effect data and bonuses (#1501) 2021-08-31 00:35:18 -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 06890f695a [Repositories] Add datetime support to repositories (#1503) 2021-08-31 00:34:10 -05:00
Chris Miles 228e0007ca Pad zero size packets which is what we did on encrypted connections prior to #1464 (#1504) 2021-08-31 00:33:49 -05:00
Chris Miles f4bd7c53c0 [Logging] Implement World GMSay Logging (#1505)
* Implement world GM say logging

* Add missed callback function

* Update min status
2021-08-31 00:33:31 -05:00
Alex 1c8231eb9e [Netcode] Remove security from servertalk connections (#1464)
* Remove security from servertalk connections

* Remove the two hello steps before handshake that are now obsolete out

* Revert "Remove the two hello steps before handshake that are now obsolete out"

This reverts commit 32d61ea238.

* Keep old values for enums

* Use downgrade security handshake for backwards compat

* Send handshake instead of hello to fast connect

* Add connect callback so it will actually work
2021-08-15 23:39:38 -05:00
KayenEQ bde5d6931c [Spells] Implemented SPA 390 SE_FcTimerLockout (#1496)
* Implemented SPA 390 SE_FcTimerLockout

Implemented

SPA 390 SE_FcTimerLockout

This focus limited effect sets any spell that meets the criteria of the of the focus limits to be a on recast timer.
Base value: recast duration in milliseconds.

Note: This focus can only be applied from spells (not item or AA)
Note: Although reinforced by the server, to appear visually correct both server side and client side spell values need to match (ie. need to matching spells_new values).

Example spell: Suppression of Fire ID 16973.
Sets any fire spell in the clients spell bar to a 2 second recast when the client is affect by the spell.

* Formatting

* Use range based for

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-15 23:17:04 -05:00
KayenEQ d40d21121a [Feature] Implemented /shield ability and related affects (#1494)
* shield ability initial work

* updates

* update

* updates

* Update client_process.cpp

* major updates

optimized
pet support
perl support

* updates

* minor update

* fix merge error

* requested changes

* variable fix

* optimization

* minor update

* Revert "optimization"

This reverts commit 27e11e758b.

* fix

reset variables on shield_target if shielder dies or zones during shielding.

* edge case fix

Catch and fix situations where shield target doesn't have shielder variable cleared. Can occur if shielder . uses ability when target is not in combat then zones.

* combined packet and mob function

Shield now uses a common pathway through ShieldAbility, added parameters to perl function

* Addressing formatting for Kayen

* Fix function typo

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-15 22:59:10 -05:00
KayenEQ 9c62bf3c2f [Spells] Fix SPA 209 SE_DispelBeneficial not causing aggro (#1495)
Fix SPA 209 SE_DispelBeneficial not causing aggro.
2021-08-13 15:01:29 -05:00
KayenEQ c821397367 [Spells] Implemented SPA 471 SE_Double_Melee_Round (#1492)
* Implemented SPA 471 SE_Double_Melee_Round

#define SE_Double_Melee_Round			471
Percent chance to repeat primary weapon round with a percent damage modifier, base: pct chance repeat, limit: pct dmg mod, max: none

* minor fixes

* tab to spaces
2021-08-11 01:38:38 -05:00
Michael Cook (mackal) b539c63326 [cmake] Update min cmake version due to fe7cb76 (#1489) 2021-08-10 18:40:07 -05:00
KayenEQ 2c01fe59ce [Spells] Implemented SPA 489 SE_Worn_Endurance_Regen_Cap (#1493)
Implemented

SE_Worn_Endurance_Regen_Cap		489
modify worn item regen cap
base: amt, limit: none, max: none

Also added support to allow item mana regen cap to check item and spell bonuses.
2021-08-10 18:39:12 -05:00
KayenEQ 416fadd554 [Spells] Implemented SPA 504 and 506 (#1488)
* Implemented SPA 504 and 506

 SE_Damage_Taken_Position_Amt	506 // implemented - modify melee damage by amt if dmg taken from Front or Behind

SE_Melee_Damage_Position_Amt	504 // implemented - modify melee damage by amt if done from Front or Behind

* fix, description updates

* Update spdat.h
2021-08-10 14:46:52 -05:00
KayenEQ 51ad6d65dc [Spells] Implemented SPA 476 SE_Weapons_Stance and Live-like AA Enable/Disable Toggle (#1477)
* Work started on SPA 476

defines

* bonus structure add

bonus structure set up

* updates spa476

updates spa476

* spell bonus now functional

spell bonus working well.

* major update with debug messages

aa, item and spell now working

* Pre clean up, effect implemented

working for AA, spells, items, all checked for stacking issues.

* removed debug messages

removed debug messages

* spdat description added

spdat description added

* minor fix

removed debug shout
removed unneeded code check.

* syntax updates, minor fixes

syntax updates, minor fixes

* syntax fixes

syntax fixes

* improvements to code

moved function to check at swap item.  Easier to manage and more live like behavior. Required minor adjustment
Still working on AA toggle.

* updates to aa buy, functionalish

* Syntax / Formatting

* Add break / default to switch

* updates

* completed v2

* Major revisions

Main function check moved to when items are swapped and out of when ever bonus are recalculated.

AA Toggle and data structure now more accurate to live.

* Update aa.cpp

* debug removed

* implemented SE_Buy_AA_Rank

Closer to live.

* Update aa.cpp

broadening AA toggle to be more general use.

* improved various checks

aa toggle is now broadly implemented to be usable with any passive effect.

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-10 14:46:37 -05:00
KayenEQ c69446c460 [Spells] SPIndex fix for wrong const in variable (#1487)
* SPIndex fix for mislabeled spell

SPIndex fix for mislabeled spell

All other SPIndex variables were checked again without any additional errors found.

* spdat h merge fix
2021-08-02 21:42:41 -05:00
Gangsta 38a84cae93 [Quest API] Sit method (#1449)
* quest api sit method

* alphabetical

* Fix

* fix again

* Ok real fix unprivated

* Add Lua Export

Co-authored-by: ProducerZekServer <go@away.com>
Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-01 20:58:05 -05:00
Gangsta bb3c918eac [Spells] IsInvisSpell() Method + InvisRequireGroup Rule (#1453)
* IsInvis() Method + InvisRequireGroup Rule

* Fixed issues with invis rule crashes

* Fixed issues with invis rule crashes

* Invis Require Group nullptr fix

* Invis Group Require Fix crash

* Fixes Self only Invis Crashes

* Formatting, reverse check order to prevent unnecessary processing

Co-authored-by: ProducerZekServer <go@away.com>
Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-01 20:44:06 -05:00
KayenEQ 0e7cfe96ef [Spells] Update to SPA 130 and SPA 131 focus calculation, focus code improvements (#1486)
[Spells] Update to SPA 130 and SPA 131 focus calculation, focus code improvements
#use instead of PR 1483
2021-08-01 19:23:59 -05:00
KayenEQ e71b11fcba [Spells] New SPA focus effects and focus limits (#1462)
* Implemented SPA Duration Pct

Implemented new spell effects
SE_Duration_HP_Pct 			524
SE_Duration_Mana_Pct			525
SE_Duration_Endurance_Pct		526

Consumes 'base1' % of your maximum health/mana/endurance every 6 seconds. 'max' is maximum amount that can be consumed per tic.

Additional Functionality
Can be used as a heal/gain % by setting the base1 value to a positive.

* Implemented SPA Instant Mana/End pct

Fixes for SPA 524-526
Implemented
SE_Instant_Mana_Pct			522
SE_Instant_Endurance_Pct		523

Extracts 'base1' percent of your maximum mana/endurance, or 'max', whichever is lower.

* Implemented: SPA 521 EndAbsorbPctDmg

Implemented
SE_Endurance_Absorb_Pct_Damage 521

Absorb Damage using Endurance: base1 % (base2 End per 1 HP)
Note: Both base1 and base2 need to be divided by 100 for actually value

* Implemented SE_HealthTransfer 509

Implemented
SE_Health_Transfer			509
'life burn'
Consume base2 % of Hit Points to Damage for base % of Hit Points

Can be used for heal
Act of Valor

* Implemented SPA 515,516,518,496

Implemented
SE_AC_Avoidance_Max_Percent 515
SE_AC_Mitigation_Max_Percent	516
SE_Attack_Accuracy_Max_Percent	518
Above are stackable defense and offensive mods

SE_Critical_Melee_Damage_Mod_Max	496 - This is a non stackable melee critical modifier

* Implemented SPA 503 , 505

SE_Melee_Damage_Position_Mod	503
define SE_Damage_Taken_Position_Mod	505

SPA 503 increase/decreases melee damage by percent base1 based on your position base2 0=back 1=front

SPA 504 increase/decreases melee damage taken by percent base1 based on your position base2 0=back 1=front

* Implemented 467,468

Implemented
SE_DS_Mitigation_Amount		467
SE_DS_Mitigation_Percentage	468

Reduce incoming DS by amt or percentage. base1 is value, if a reduction is desired it should be set to negative for both.

* Fixes

Formula fixes

* Update spdat.h

Added spa descriptions.

* Implemented SPA 469, 470

Implemented
SE_Chance_Best_in_Spell_Grp     469  Chance to cast highest scribed spell within a spell group. All base2 spells share roll chance, only 1 cast.

SE_Trigger_Best_in_Spell_Grp	470

Chance to cast highest scribed spell within a spell group. Each spell has own chance.

Additional Changes:
Rewrote TrySpellTrigger function used for SPA 340 since it incorporates SPA 469. Improved code so that chance of spell being triggered should be more accurate statistically.

* Implemented SPA 474, 494

Implemented
 SE_Pet_Crit_Melee_Damage_Pct_Owner	474 - Gives pets a critical melee damage modifier from the owner

SE_Pet_Add_Atk	494 - Gives pet a ATK bonus from the owner

Fixed SE_PetMeleeMitigation 397 - The bonus was not being calculated

* Implemented SPA 465,477,478

Implemented

SE_PC_Pet_AE_Rampage			465
Chance for pet to AE rampage with a damage modifier

SE_Hatelist_To_Top_Index		477
Chance to be put on top of RAMPAGE list

SE_Hatelist_To_Tail_Index		478
Chance to be put on bottom of RAMPAGE list

* Implemented

Implemented

SE_Fearstun 	502
Stun with a max level limit. Normal stun restrictions don't apply. Base1 duration, base2 PC duration, max is level limit

SE_TwinCastBlocker 39
Previously unused spell effect that is now used on live. Simply, if this effect is present in a spell then the spell can not be twin cast.

* Implemented SPA 483

Implemented
Fc_Spell_Damage_Pct_IncomingPC	483
- Focus effect that modifies iby percent incoming spell damage on the target.
Base1= min Base2= max. Final percent is random between max and min each time focus is applied from a spell cast.

Note: Written to stack with similar functioning focus SPA 269 SE_FcSpellVulnerability.

* Implemented SPA 484

Implemented

SE_Fc_Spell_Damage_Amt_IncomingPC	484 // focus effect that modifies incoming spell damage by flat amount. Consider it a debuff that adds damage to incoming spells. Positive value to add additional damage.

* Implemented SPA 481, 485,486,512

Implemented

SE_Fc_Cast_Spell_On_Land 481
Focus effect that is checked when a spell is cast on a target, if target has this focus effect and all limiting criteria are met, then the target will cast a spell as specified by the focus. Can be given a roll chance for success. Base1=Chance, Base2=Spellid

Note: This spell has a huge amount of potential applications. See 'Alliance' type spells on live. (ie live spell 50247)

Implemented associated focus limits seen in live spells.

SE_Ff_CasterClass	485
- Caster of spell on target with a focus effect that is checked by incoming spells must be specified class or classes.

SE_Ff_Same_Caster	 486 -Caster of spell on target with a focus effect that is checked by incoming spells 0=Must be different caster 1=Must be same caster

The following is an associated effect seen with SPA 481

SE_Proc_Timer_Modifier 			512
This provides a way to rate limit the amount of spell triggers generated by SPA 481. For example after 1 successful spell trigger no additional spells can be triggered for 1.5 seconds. Ie. Base=1 and Base2 1500.
Written in a flexible format to allow scaling of multiple different buffs with this effect at same time.

* Stacking fixes for new effects

Stacking fixes for new effects.

* merge with upstream master

merge and update up spdat.h

* Update spdat.h

* Fix for bolt spell targeting self if target zone/died while casting.

Fix for bolt spell targeting self if target zone/died while casting. Despite the name being "ST_TargetOptional", this target type is reserved for projectile spells which all require a target, thus should be treated like any other targeted spell.

* Implemented new focus and limits

SE_Fc_Amplify_Mod 507  @Fc, On Caster, damage-heal-dot mod pct, base: pct

SE_Fc_Amplify_Amt 508
@Fc, On Caster, damage-heal-dot mod flat amt, base: amt

SE_Fc_ResistIncoming 510 implemented, @Fc, On Target, resist modifier, base: amt

SE_Fc_CastTimeMod2 500
@Fc, On Caster, cast time mod pct, base: pct

SE_Fc_CastTimeAmt  501
@Fc, On Caster, cast time mod flat amt, base: milliseconds

SE_Ff_DurationMax	 495
@Ff, Max duration of spell that can be focused, base: tics

SE_Ff_ReuseTimeMin  490
@Ff, Minimum recast time of a spell that can be focused, base: recast time

SE_Ff_ReuseTimeMax  491
 @Ff, Max recast time of a spell that can be focused, base: recast time

SE_Ff_Endurance_Min 492
@Ff, Minimum endurance cost of a spell that can be focused, base: endurance cost

SE_Ff_Endurance_Max 	493
 @Ff, Max endurance cost of a spell that can be focused, base: endurance cost

SE_Ff_Value_Min 479
@Ff, Minimum base value of a spell that can be focused, base: spells to be focused base1 value

 SE_Ff_Value_Max 	480
@Ff, Max base value of a spell that can be focused, base: spells to be focused base1 value

SE_Ff_Override_NotFocusable		460 @Fc, Allow spell to be focused event if flagged with 'not_focusable' in spell table, base: 1

Added basic focus and limit descriptions to source.

* Update spell_effects.cpp

hotfix

* fix for SE_Ff_Override_Notfocusable

Fix for SE_Ff_Override_Notfocusable

Logic was not correct. Changed where spell field 'not_focusable' makes check to properly account for this effect.

* Update to SE_Fc_CastTimeMod2

Update to SE_Fc_CastTimeMod2
Found sources that show it can reduce cast time to instant. Rewrote formulas to account for such.

* fix

unintentional change, reverted back.

* fixed missing break statements

fixed missing break statements

* update to IsFocusLimit

missing limit cases added to IsFocusLimit

* Format CalcFocusEffect

* Revert "Format CalcFocusEffect"

This reverts commit e5b81791ee.

* Revert "Revert "Format CalcFocusEffect""

This reverts commit a1ce29a875.

* Post merge fixes

* More post merge adjustments

* Another post merge change

* Add LimitResist constants back

* Swap int16's for 32's

* int32 fix

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-01 17:45:05 -05:00
KayenEQ d270670145 [Spells] Update for SPA 403 and 404 (#1482)
* Update for SPA403 and 404

Update
SPA SE_LimitSpellClass: 403
SPA SE_LimitSpellSubclass: 404

Now use spell table values from column 221 and 222 respectively.

Unknown what the values mean in these fields, but at least live spells work properly.

Added FocusLImitInclude Enum to improved focus effect function readability.

* Formatting

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-01 13:47:17 -05:00
KayenEQ f01cf74fa6 [Spells] Update SPA 339 SE_TriggerOnCast (#1478)
* Recoded SE_TriggerOnCast Focus effect

Recoded SE_TriggerOnCast focus effect to be consistent with how all other focuses are checked. No longer an arbitrary limit as to number of a focus effects of this type you can have.

* new command: resetdisc_timer

usage: #resetdisc_timer [all | timer_id]

* syntax fixes

syntax improvements

* minor fix

changed numhits check

* Update spell_effects.cpp

* added better support for spell procs that don't require target.

* syntax

* Formatting and syntax tweaks

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-01 13:26:44 -05:00
KayenEQ 93b0264a8b Update to focus SE_BlockNextSpell (#1479)
Minor code changes to make the focus be checked consistent with how all other focuses are checked. No change in functionality.
2021-08-01 13:19:42 -05:00
KayenEQ 38beb804a3 [Spells] Added constant labeling to all StatBonuses that use as arrays. (#1485)
* constexpr labels added

* more updates

* more updates

* completed

* Update common.h

* Namespace constants, few minor spelling tweaks

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-08-01 13:13:14 -05:00
KayenEQ 72056ffba3 [Spells] Focus related functions to use int32 instead of int16
Need to increase from int16 to int32 when calculating focus due it causing issues with returning spell ids for some effects which can easily be over the int16 limit. CalcAAFocus and CalcFocusEffect were doing all math in int16 also, no reason not to increase to int32.
2021-08-01 13:06:57 -05:00
Michael Cook (mackal) 2d296eb317 [CI] Enable Bots (Typo) in Drone Config (#1481) 2021-07-30 11:47:22 -05:00
Michael Cook (mackal) c3f8b8073b Fix bots with ExtraAttackChance changes (#1480)
This should probably be updated to match everything in client, but this
will at least fix compile
2021-07-30 12:09:44 -04:00
KayenEQ 187d6e9dc4 [Spells] Bug fix for AOE Harmony/Lull (#1472)
* Bug fix for AOE Harmony/Lull type spells.

Fixed bug with SPA 30 SE_SE_ChangeFrenzyRad and SPA 86 SE_Harmony allowing those spells to affect NPC's above their level restrictions when cast as a 'Targeted AE' spell (ie. Harmony, Wake of Tranquility) when the targeted NPC was bellow level restricted range, but the NPC's next to them were above it.

As coded now, the adjacent NPC's if over level limit will still get the buff applied to them BUT will not get any benefits from the buff.

This bug was originally reported by: Isaaru

* Live like behavior

Implemented the live like behavior, if this case occurs on live, the buff is not applied to the targets over the level limit and "Your target looks unaffected" message is given.

* code optimization

code optimization
2021-07-29 19:20:21 -04:00
KayenEQ 78b15a0214 Implemented SPA 498 and 499 (extra attack chance effects) (#1475)
* Implemented SPA 498 and 499

Implemented
SE_AddExtraAttackPct_1h_Primary	498 , gives your double attacks a percent chance to perform an extra attack with 1-handed primary weapon, base: chance, limit: amt attacks max: none

SE_AddExtraAttackPct_1h_Secondary	499  gives your double attacks a percent chance to perform an extra attack with 1-handed secondary weapon, base: chance, limit: amt attacks max: none

Added limit functionality to similar effect SPA 266

SPA 266 will now be calculated to take highest percent value when applying bonus. (was additive, which does not seem correct based on AA data)

* Update attack.cpp

code update

* Update bonuses.cpp

code update

* Update spdat.h

added commas

* Update spell_effects.cpp

fix to remove unknown spa message

Co-authored-by: Michael Cook (mackal) <mcook@mackal.net>
2021-07-29 19:19:35 -04:00
KayenEQ a50663e0a4 Fix SE_TwinCastBlocker to block twinproc (#1476)
Improvement to SE_TwinCastBlocker implementation. Will now ensure both spell casted and weapon proced twincasts can be effectively blocked.
2021-07-29 18:56:02 -04:00
KayenEQ fee8772bb6 Implemented SPA 482 SE_Skill_Base_Damage_Mod (#1474)
* Implemented SPA 482 SE_Skill_Base_Damage_Mod

Implemented SPA 482 SE_Skill_Base_Damage_Mod

Modifies base melee damage by skill
Base: pct Limit: skill(-1=ALL), max: none

* Update spell_effects.cpp

fix to remove unknown spa message
2021-07-29 18:55:06 -04:00
Gangsta 7e85224202 [Merchants] Fix issue where an item purchased with 1 charges actually is bought with 0 charges
Co-authored-by: ProducerZekServer <go@away.com>
2021-07-27 01:03:17 -05:00
KayenEQ 5d92d484a1 Projectiles Update (#1468)
Fixed spell projectiles whose angle was not being calculated correctly.

Significantly improved all projectile timings. At least up to range of 300 should see more accurate timings for damage/effects occurring upon projectile impact. Will be noticed most significantly for all spell projectiles and for longer range archery.
2021-07-26 22:20:13 -04:00
E Spause 792a3b1443 Add SetGMStatus to LUA, cleanup unused variable, cleanup naming of new function added to Client class, remove unneeded return on void function. (#1471)
* Fix issue #1469 - remove unused variable in perl_client

* Add SetGMStatus to LUA, clean up naming in client.cpp to be consistent with the perl/lua naming, remove unneeded return in void function

* Delete PERL_CLIENT.ipch
2021-07-26 13:03:17 -04:00
splose 8696ba398b Merge pull request #1460 from EQEmu/feature/random_enhancements
[Feature] Add some knobs to our RNG class
2021-07-26 12:28:37 -04:00
splose 696d875624 Merge pull request #1457 from Natedog2012/master_copy2
Add Rank to lua Spell
2021-07-26 12:28:01 -04:00
splose b401404227 [Quest API] Add $client->SetGMStatus() (#1465)
* add $client->SetGMStatus()

* add UpdateAdmin after setting status
2021-07-26 12:21:06 -04:00
KimLS fe7cb764b2 Fix for compile issue when you either don't have openSSL or you're using a version not supported by httplib 2021-07-22 19:03:05 -07:00
KayenEQ 2b74d71ff5 [Feature] New SPAs pass 2 (#1459)
* Implemented SPA Duration Pct

Implemented new spell effects
SE_Duration_HP_Pct 			524
SE_Duration_Mana_Pct			525
SE_Duration_Endurance_Pct		526

Consumes 'base1' % of your maximum health/mana/endurance every 6 seconds. 'max' is maximum amount that can be consumed per tic.

Additional Functionality
Can be used as a heal/gain % by setting the base1 value to a positive.

* Implemented SPA Instant Mana/End pct

Fixes for SPA 524-526
Implemented
SE_Instant_Mana_Pct			522
SE_Instant_Endurance_Pct		523

Extracts 'base1' percent of your maximum mana/endurance, or 'max', whichever is lower.

* Implemented: SPA 521 EndAbsorbPctDmg

Implemented
SE_Endurance_Absorb_Pct_Damage 521

Absorb Damage using Endurance: base1 % (base2 End per 1 HP)
Note: Both base1 and base2 need to be divided by 100 for actually value

* Implemented SE_HealthTransfer 509

Implemented
SE_Health_Transfer			509
'life burn'
Consume base2 % of Hit Points to Damage for base % of Hit Points

Can be used for heal
Act of Valor

* Implemented SPA 515,516,518,496

Implemented
SE_AC_Avoidance_Max_Percent 515
SE_AC_Mitigation_Max_Percent	516
SE_Attack_Accuracy_Max_Percent	518
Above are stackable defense and offensive mods

SE_Critical_Melee_Damage_Mod_Max	496 - This is a non stackable melee critical modifier

* Implemented SPA 503 , 505

SE_Melee_Damage_Position_Mod	503
define SE_Damage_Taken_Position_Mod	505

SPA 503 increase/decreases melee damage by percent base1 based on your position base2 0=back 1=front

SPA 504 increase/decreases melee damage taken by percent base1 based on your position base2 0=back 1=front

* Implemented 467,468

Implemented
SE_DS_Mitigation_Amount		467
SE_DS_Mitigation_Percentage	468

Reduce incoming DS by amt or percentage. base1 is value, if a reduction is desired it should be set to negative for both.

* Fixes

Formula fixes

* Update spdat.h

Added spa descriptions.

* Implemented SPA 469, 470

Implemented
SE_Chance_Best_in_Spell_Grp     469  Chance to cast highest scribed spell within a spell group. All base2 spells share roll chance, only 1 cast.

SE_Trigger_Best_in_Spell_Grp	470

Chance to cast highest scribed spell within a spell group. Each spell has own chance.

Additional Changes:
Rewrote TrySpellTrigger function used for SPA 340 since it incorporates SPA 469. Improved code so that chance of spell being triggered should be more accurate statistically.

* Implemented SPA 474, 494

Implemented
 SE_Pet_Crit_Melee_Damage_Pct_Owner	474 - Gives pets a critical melee damage modifier from the owner

SE_Pet_Add_Atk	494 - Gives pet a ATK bonus from the owner

Fixed SE_PetMeleeMitigation 397 - The bonus was not being calculated

* Implemented SPA 465,477,478

Implemented

SE_PC_Pet_AE_Rampage			465
Chance for pet to AE rampage with a damage modifier

SE_Hatelist_To_Top_Index		477
Chance to be put on top of RAMPAGE list

SE_Hatelist_To_Tail_Index		478
Chance to be put on bottom of RAMPAGE list

* Implemented

Implemented

SE_Fearstun 	502
Stun with a max level limit. Normal stun restrictions don't apply. Base1 duration, base2 PC duration, max is level limit

SE_TwinCastBlocker 39
Previously unused spell effect that is now used on live. Simply, if this effect is present in a spell then the spell can not be twin cast.

* Implemented SPA 483

Implemented
Fc_Spell_Damage_Pct_IncomingPC	483
- Focus effect that modifies iby percent incoming spell damage on the target.
Base1= min Base2= max. Final percent is random between max and min each time focus is applied from a spell cast.

Note: Written to stack with similar functioning focus SPA 269 SE_FcSpellVulnerability.

* Implemented SPA 484

Implemented

SE_Fc_Spell_Damage_Amt_IncomingPC	484 // focus effect that modifies incoming spell damage by flat amount. Consider it a debuff that adds damage to incoming spells. Positive value to add additional damage.

* Implemented SPA 481, 485,486,512

Implemented

SE_Fc_Cast_Spell_On_Land 481
Focus effect that is checked when a spell is cast on a target, if target has this focus effect and all limiting criteria are met, then the target will cast a spell as specified by the focus. Can be given a roll chance for success. Base1=Chance, Base2=Spellid

Note: This spell has a huge amount of potential applications. See 'Alliance' type spells on live. (ie live spell 50247)

Implemented associated focus limits seen in live spells.

SE_Ff_CasterClass	485
- Caster of spell on target with a focus effect that is checked by incoming spells must be specified class or classes.

SE_Ff_Same_Caster	 486 -Caster of spell on target with a focus effect that is checked by incoming spells 0=Must be different caster 1=Must be same caster

The following is an associated effect seen with SPA 481

SE_Proc_Timer_Modifier 			512
This provides a way to rate limit the amount of spell triggers generated by SPA 481. For example after 1 successful spell trigger no additional spells can be triggered for 1.5 seconds. Ie. Base=1 and Base2 1500.
Written in a flexible format to allow scaling of multiple different buffs with this effect at same time.

* Stacking fixes for new effects

Stacking fixes for new effects.

* merge with upstream master

merge and update up spdat.h

* Update spdat.h

* Fix for bolt spell targeting self if target zone/died while casting.

Fix for bolt spell targeting self if target zone/died while casting. Despite the name being "ST_TargetOptional", this target type is reserved for projectile spells which all require a target, thus should be treated like any other targeted spell.
2021-07-20 11:06:20 -04:00
Michael Cook (mackal) ddb14187b0 Add some knobs to our RNG class
Also included is an additive lagged fibonacci generator that should is
very similar to EQ's. Also added BIASED_INT_DIST in case someone wants
to use "bad" int distribution to more closely match EQ as well.

An option to set a custom engine (just in case people would like to play
with other std engines) is available.

There is also support for GCC's SIMD accelerated extension to std random
engines.

All these options are hidden behind advanced options in CMake since
they're rather advanced knobs.
2021-07-16 21:50:46 -04:00
Natedog2012 7decf74505 Add Rank to lua Spell 2021-07-15 19:27:27 -05:00
KayenEQ 8a2a1b152e [Feature] New SPAs pass 1 (#1454)
* Implemented SPA Duration Pct

Implemented new spell effects
SE_Duration_HP_Pct 			524
SE_Duration_Mana_Pct			525
SE_Duration_Endurance_Pct		526

Consumes 'base1' % of your maximum health/mana/endurance every 6 seconds. 'max' is maximum amount that can be consumed per tic.

Additional Functionality
Can be used as a heal/gain % by setting the base1 value to a positive.

* Implemented SPA Instant Mana/End pct

Fixes for SPA 524-526
Implemented
SE_Instant_Mana_Pct			522
SE_Instant_Endurance_Pct		523

Extracts 'base1' percent of your maximum mana/endurance, or 'max', whichever is lower.

* Implemented: SPA 521 EndAbsorbPctDmg

Implemented
SE_Endurance_Absorb_Pct_Damage 521

Absorb Damage using Endurance: base1 % (base2 End per 1 HP)
Note: Both base1 and base2 need to be divided by 100 for actually value

* Implemented SE_HealthTransfer 509

Implemented
SE_Health_Transfer			509
'life burn'
Consume base2 % of Hit Points to Damage for base % of Hit Points

Can be used for heal
Act of Valor

* Implemented SPA 515,516,518,496

Implemented
SE_AC_Avoidance_Max_Percent 515
SE_AC_Mitigation_Max_Percent	516
SE_Attack_Accuracy_Max_Percent	518
Above are stackable defense and offensive mods

SE_Critical_Melee_Damage_Mod_Max	496 - This is a non stackable melee critical modifier

* Implemented SPA 503 , 505

SE_Melee_Damage_Position_Mod	503
define SE_Damage_Taken_Position_Mod	505

SPA 503 increase/decreases melee damage by percent base1 based on your position base2 0=back 1=front

SPA 504 increase/decreases melee damage taken by percent base1 based on your position base2 0=back 1=front

* Implemented 467,468

Implemented
SE_DS_Mitigation_Amount		467
SE_DS_Mitigation_Percentage	468

Reduce incoming DS by amt or percentage. base1 is value, if a reduction is desired it should be set to negative for both.

* Fixes

Formula fixes

* Update spdat.h

Added spa descriptions.

* Fixes for PR

removed debug shouts
fixed description issue
2021-07-14 23:15:04 -04:00
Chris Miles a8e12c82a7 [Repository Usage] Migrate NPC Scale Manager to use repositories (#1441) 2021-07-08 11:44:02 -05:00
Chris Miles b68607a6ef [Repository Generator] Add int64/bigint support, add support for reserved words (#1439) 2021-07-08 11:43:35 -05:00
Dencelle ab89fe13b4 [Code] Addition of zone constants for hard coding (#1443) 2021-07-08 11:43:13 -05:00
Gangsta c72a37a434 [Bugfix] Fixes guards assisting mobs against players (#1448)
Co-authored-by: ProducerZekServer <go@away.com>
2021-07-08 11:39:58 -05:00
Natedog2012 36e009a5bd Allow NPCs to aggro player pets with NPCAggro field set in database and new rule AggroPlayerPets set to true (#1450)
Co-authored-by: Natedog2012 <joewalters2012@gmail.com>
2021-07-08 11:38:57 -05:00
Dencelle f5ab135906 [Commands] Make #maxskills work on target. (#1445)
* [Commands] Make #maxskills work on target.

* Update command.cpp

* don't code when you first wake up... doesn't end well...

* another typo brought to you by lack of coffee
2021-07-07 11:55:23 -04:00
Michael Cook (mackal) 92914d86f1 Add defines (commented) for further known SPAs (#1446)
* Add defines (commented) for further known SPAs

Added as comments since that appears what we were doing. This just gets
us caught up to dev post.

* More SPAs
2021-07-05 13:02:49 -04:00
Chris Miles 82d6e0138d [Repositories] Regenerate repositories with int64 support, reserved word support (#1440) 2021-06-25 15:05:47 -05:00
Michael Cook (mackal) 1c75236508 [Spells Cleanup] Unify and add most hardcoded spell IDs (#1438)
Move the newer stuff added that was recently to the same place all of
our previous spell IDs were defined.

Either of these solutions were good, but I went with defines since it
was less changes

I also added a bunch of stuff the client has hardcoded behavior for, but
not currently implemented by us.

The removed stuff from the command_castspell were reused on live, so I
figured it was best to remove them from the restrictions since they are
no longer test spells
2021-06-25 14:38:02 -05:00
Kurt Gilpin 5a2b5cd295 [Inventory] Remove Trader's Satchel ID from inventory.cpp (#1423)
* Remove Trader's Satchel ID from inventory.cpp

Not sure if this is the right way to do this, but seems to work...

* Update inventory.cpp

Readibility.
2021-06-24 14:14:00 -05:00
Chris Miles 1f154af2ca [Hotfix] SendIllusion revert to October 2021-06-23 00:17:56 -05:00
Michael Cook (mackal) c214c3a95b [Bug Fix] spell cast time cap issue introduced in e5b9d72b81 (#1435)
Me bad coder.
2021-06-22 11:08:04 -05:00
Alex 34d5959cae [Typo] row[27] not row[25]. (#1432) 2021-06-19 15:11:18 -04:00
Alex 27cf5a4068 [Commands] Resolve issue with #giveitem crash with no target. (#1425) 2021-06-19 11:35:20 -04:00
Alex 249cbb7bc7 [Quest API] Add CanRaceEquipItem(item_id) to Perl/Lua. (#1411)
* [Quest API] Add CanRaceEquipItem(item_id) to Perl/Lua.
- Add $mob->CanRaceEquipItem(item_id) to Perl.
- Add mob:CanClassEquipItem(item_id) to Lua.
- Add mob:CanRaceEquipItem(item_id) to Lua.

* Use constants.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-06-17 18:42:44 -04:00
Alex ccfc8b296f [Quest API] Add SendToInstance(instance_type, zone_short_name, instance_version, x, y, z, heading, instance_identifier, duration) to Perl/Lua. (#1417)
* [Quest API] Add SendToInstance(instance_type, zone_short_name, instance_version, x, y, z, heading, instance_identifier, duration) to Perl/Lua.
- Add $client->SendToInstance(instance_type, zone_short_name, instance_version, x, y, z, heading, instance_identifier, duration) to Perl.
- Add client:SendToInstance(instance_type, zone_short_name, instance_version, x, y, z, heading, instance_identifier, duration) to Lua.

* Fix instance naming.

* Add current instance type to bucket name, remove unused variables.

* Typo.
2021-06-17 11:49:20 -05:00
Alex 3f8b67e500 [Quest API] Add RemoveAllNimbusEffects() to Perl/Lua. (#1413)
* [Quest API] Add RemoveAllNimbusEffects() to Perl/Lua.
- Add $client->RemoveAllNimbusEffects() to Perl.
- Add client:RemoveAllNimbusEffects() to Lua.

* Optimize.
2021-06-17 11:40:01 -05:00
splose 82ad8b5fe2 Adds ability to use the ~~old~~ proper 2HB animation and also allows you to do it on a per-zone basis since its rule-based. (#1420) 2021-06-17 11:39:25 -05:00
Alex 40db13d33e [Quest API] Add get_data_remaining(bucket_name) to Perl/Lua. (#1421)
- Add quest::get_data_remaining(bucket_name) to Perl.
- Add eq.get_data_remaining(bucket_name) to Lua.
2021-06-17 11:39:16 -05:00
Alex 68fe95786e [Quest API] Add getgendername(gender_id) to Perl/Lua. (#1405)
- Add quest::getgendername(gender_id) to Perl.
- Add eq.get_gender_name(gender_id) to Lua.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-06-16 10:49:02 -05:00
Alex f8a72296e6 [Quest API] Add getdeityname(deity_id) to Perl/Lua. (#1404)
- Add quest::getdeityname(deity_id) to Perl.
- Add eq.get_deity_name(deity_id) to Lua.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-06-16 10:45:38 -05:00
Alex ed6e53be54 [Quest API] Add getinventoryslotname(slot_id) to Perl/Lua. (#1406)
- Add quest::getinventoryslotname(slot_id) to Perl.
- Add eq.get_inventory_slot_name(slot_id) to Lua.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-06-16 10:42:06 -05:00
splose f1d1731fc7 [Command] Add #npcedit rarespawn (#1418)
* add #npcedit rarespawn

* minor fix
2021-06-16 10:24:07 -05:00
splose d34afb6f30 Fix for unknown spell effect message with spell effect 459 (DamageModifierV2) (#1419) 2021-06-16 10:23:14 -05:00
Alex a98e3b758a [Quest API] Add CountItem(item_id) and RemoveItem(item_id, quantity) to Perl/Lua. (#1416)
- Add $client->CountItem(item_id) to Perl.
- Add $client->RemoveItem(item_id, quantity) to Perl.
- Add client:CountItem(item_id) to Lua.
- Add client:RemoveItem(item_id, quantity) to Lua.
2021-06-16 10:11:38 -05:00
Alex 797eaf308d [Quest API] Add AddNimbusEffect(effect_id) to Perl. (#1412)
- Add $client->AddNimbusEffect(effect_id) to Perl.
2021-06-16 10:06:30 -05:00
Alex 65150b0581 [Typo] dot_stacking_exempt not dot_stacking_exemp (#1409) 2021-06-16 10:05:44 -05:00
Alex 743b61ae13 [Typo] IsDisciplineBuff not IsDisciplineBuf (#1410) 2021-06-16 10:05:30 -05:00
Alex 966067ae74 [Typo] basediff not basedeiff (#1408) 2021-06-16 10:05:13 -05:00
Dencelle 4f5824b4a1 [Feature] Add lua and perl event for test buff (#1403)
* [Feature] Add lua and perl event for test buff

* added EnableTestBuff
2021-06-16 10:04:34 -05:00
Akkadius 5d937b5be9 [Hotfix] Correct PR syntax issue https://github.com/EQEmu/Server/pull/1374 2021-06-16 09:51:16 -05:00
Alex ecdebbc1a7 [Consistency] Deity not diety. (#1407)
* [Consistency] Deity not diety.

* Uppercase. [skip ci]
2021-06-16 09:33:10 -05:00
Chris Miles f2ffca1a06 [Command] #gearup Table Auto-Install (#1402)
* Update syntax for new httplib and run on own thread

* Only log if path is set in request

* Auto install tool table if does not exist locally

* Add lore and has item checks to reduce verbosity and errors

* Formatting

* Remove test code from test command
2021-06-16 09:31:56 -05:00
splose 19b14ea2d4 [Bug Fix] Fixed Invis vs Undead / Invis Vs Animals not breaking charm + Added rule for custom capabilities (#1374)
* Fixed Invis vs Undead / Invis Vs Animals not breaking charm
Added rule for custom capabilities

* Fix logging & remove comments

* change logic

* change logic

* if (RuleB(Pets, LivelikeBreakCharmOnInvis) || IsInvisible(formerpet))
2021-06-16 09:31:38 -05:00
Alex b9d8fb0d91 [Quest API] Add rename(name) to Perl/Lua. (#1414)
- Add quest::rename(name) to Perl.
- Add eq.rename(name) to Lua.
2021-06-16 09:30:32 -05:00
Alex 4c7f2391cd [Commands] Modify #summonitem and #giveitem. (#1400)
- #summonitem will now properly take item augments from an item link when used as a link for summoning.
- #summonitem help message and command message will now list proper argument list.
- #giveitem will now allow item links like #summonitem with the same functionality level.
- #giveitem help message and command message will now list proper argument list.
- #giveitem small fix where there were 2 checks for argument count at 7, meaning final argument count (8) did not work.
2021-06-13 21:48:48 -05:00
Chris Miles 7139530787 [Library] Update httplib (#1401)
* Update httplib

* Update syntax for new httplib and run on own thread

* Only log if path is set in request
2021-06-13 21:42:30 -05:00
Alex 3886636ec7 [Commands] Modify #grid and #wp. (#1399)
- #grid add will no longer let you put in a duplicate grid.
- Grid nodes now spawn with invul/immune to damage.
- Grid nodes now set an entity variable "grid_id" on spawn.
- This allows grid nodes to be specifically despawned by "grid_id" entity variable, meaning you can view multiple grids at once and not despawn them all accidentally.
- #grid hide will despawn your targeted NPC's Grid nodes.
- #grid add, #grid show, #grid delete, and #grid hide send messages to let GM know what's going on.
- #wp add and #wp delete now send messages to let the GM know what's going on.
- #wpadd now send messages to let the GM know what's going on.
2021-06-13 21:41:38 -05:00
Akkadius 22333ee40b Fix Loginserver log setting db load init 2021-06-13 20:04:03 -05:00
Alex 2ca37ae838 [Quest API] Add Popup(title, text, popup_id, negative_id, button_type, duration, button_name_one, button_name_two, sound_controls) to Lua. (#1396)
- Add client:Popup(title, text, popup_id, negative_id, button_type, duration, button_name_one, button_name_two, sound_controls) to Lua.
- There is no overload for only using button_name_one, as the SendFullPopup requires both button names to be set.
2021-06-13 18:44:54 -05:00
Kurt Gilpin 45eea666a1 [Items] Allow any bag type 51 to be used for Trader (#1392)
* Allow any bag type 51 to be used for Trader

Most commonly this would allow the different color satchels to be used in Trader mode.
PEQ database has 1 item (Yellow Trader's Satchel Token - 35037) marked as type 51, but otherwise only the proper bags are already set.
Bonus of removing the hard-coded ID from source.

* Updated

Fixed where I missed it in a couple more spots too.

* Update bonuses.cpp
2021-06-13 18:06:58 -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 0e4361955d [Quest API] Add ResetAllDisciplineTimers() to Perl/Lua. (#1395)
- Add $client->ResetAllDisciplineTimers() to Perl.
- Add client:ResetAllDisciplineTimers() to Lua.
2021-06-13 18:06:36 -05:00
Chris Miles 8d90b5a2e7 [Hotfix] Illusion Revert (#1398)
* Revert some "fixes", clean some code up

* Use RaceGender default height data for when calculating size during SendIllusionPacket which should alleviate some inconsistencies for new clients zoning in and seeing the entity

* Some code cleanup
2021-06-13 18:06:27 -05:00
Chris Miles e1e5873398 [Hotfix] Fix crash pertaining to new PVPEnableGuardFactionAssist code (#1393)
Pushing through due to crash severity on master
2021-06-13 02:09:23 -05:00
Chris Miles 4a067e4e9b [Fix] Fix illusions (#1389) 2021-06-13 02:03:21 -05:00
Kurt Gilpin e285a88e13 Fix crash when casting with no target (#1390) 2021-06-12 13:13:48 -04:00
Alex d162f25536 [Commands] Add #findclass [search criteria] command. (#1384)
* [Commands] Add #findclass [search criteria] command.
- Allows GMs to find a class by name or ID.
- Modify some verbiage in command messages that were improper.

* Update find functions to use strings instead of chars.
2021-06-12 11:36:19 -05:00
Alex a0063997e1 [Quest API] Add SetHideMe() to Perl/Lua. (#1388)
- Add $client->SetHideMe(hide_me_state) to Perl.
- Add client:SetHideMe(hide_me_state) to Lua.
2021-06-12 11:34:55 -05:00
Alex 88526eac21 [Quest API] Add ChangeLastName() and ClearLastName() to Lua. (#1386) 2021-06-12 11:34:19 -05:00
Alex 6e12d2fd49 [Commands] Add #viewzoneloot [item id] command. (#1382)
* [Commands] Add #viewzoneloot [item id] command.
- Allows GMs to search for a specific item across all the loot currently available on the spawned NPCs in the zone.
- Specifying item ID 0 will allow GMs to see all the droppable items, I tested in Sanctus Seru (a huge zone) and it sent approximately 1,200 messages, which didn't lag or desync my client.

* Adjustments.

* Adjustments.
2021-06-12 11:32:36 -05:00
Alex 00dd7c2b71 [Quest API] Add getcleannpcnamebyid(npc_id) to Perl/Lua. (#1383)
* [Quest API] Add optional clean name parameter to getnpcnamebyid in Perl/Lua.
- Allows Server Operators to grab the clean name without having to clean it up in their Perl/Lua.

* Convert from a parameter to a method.

* Add safer method.

* Convert to proper type.
2021-06-11 23:41:06 -05:00
Alex cc46297b32 [Bug Fix] Fix CMakeLists.txt so compile works. (#1387)
* [Bug Fix] Fix CMakeLists.txt so compile works.

* Typo.

* Add ifdefs to bot files so they're not used unless bots are enabled.
2021-06-11 23:52:47 -04:00
RoTPvP 6e61f6d0ba [Spells] Added a pet check to Cazic Touch (#1365)
* Added a pet check to Cazic Touch

* Added a pet check to Cazic Touch

* Added rule option to Cazic pet Check

* Removed Magic Numbers

* Bracket fix

* Revert "Bracket fix"

This reverts commit 3deb3e0cad.

* Bracket fix

* Update spells.cpp

* Fixed constants

* Revert "Fixed constants"

This reverts commit 68502effd3.

* Update eq_constants.h

* Update eq_constants.h

Co-authored-by: ProducerZekServer <go@away.com>
Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-06-11 16:10:30 -05:00
Alex b87c5484b1 [Pets] Unhardcode Beastlord pet values. (#1379)
* [Pets] Unhardcode Beastlord pet values.
- Create a Beastlord pets table to allow server operators to easily customize Beastlord pets without a source modification.

* Add table to schema.
2021-06-11 15:57:14 -05:00
Dencelle f0bf3826bd [Bug Fix] NPC not breaking charm correctly (#1363)
* [Bug Fix] NPC not breaking charm correctly

#947 and #905
fixes the issue with charm breaking and spells being cast after to cause a faction war. this removes dots to stop faction wars also.

dot removal part needs better testing to ensure it works as intended

* Remove this-> since it is implied

* Update spell_effects.cpp

* clear all this->

* pMob to mob

* Added rule Spells:PreventFactionWarOnCharmBreak

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-06-11 15:55:23 -05:00
Alex d9d6a64941 [Bots] Add Bot scripting capabilities to the source. (#1378)
- This will allow server operators to interact with bots within a script in Perl or Lua.
2021-06-11 13:46:30 -05:00
Alex d54cd08560 [Spells] Adds a rule to allow right-click memorize from spell scrolls. (#1377)
* [Spells] Adds a rule to allow right-click memorize from spell scrolls.

* Typo.
2021-06-11 13:41:08 -05:00
regneq ebdb8e5d90 [Time] strict spawn_events now take into account EQ minute. (#1370)
* strict spawn_events now take into account EQ minute.

This should fixed the eqtime spawn condition from falling behind.

* change a log to logspawns and add a comment in ExecEvent function.

* moved the comment to the note paramenter in the rule for last commit.
2021-06-11 13:32:35 -05:00
hg b61cc85b5f [Expeditions] Move member compass updates to dz (#1371) 2021-06-11 13:31:50 -05:00
hg 5b3ab59b7c [Expeditions] Avoid expedition leader change if only member (#1372)
This fixes an edge case where a player could be made leader when added
to an expedition that only had a single member previously.

If a leader in a two-member expedition quit (forcing a leader change)
and the new leader went offline while throttled, a leader change flag
would be set until a non-leader was available. The first added member
would then be made the new leader.

This could also potentially occur on world startup due to the initial
throttle timer state but member statuses aren't processed there yet
2021-06-11 13:31:25 -05:00
Alex c3456ebea0 [Bots] Remove hardcoded race-class combinations from bots. (#1375)
* [Bots] Remove hardcoded race-class combinations from bots.
- Allows server operators to directly influence via a database table the classes a specific bot race can be.
- Previously this was hardcoded and required a source modification to do.
- Allowed races, classes, and genders have been removed due to redundancy at this point.

* Remove const cast and modify saylink definition.
2021-06-11 13:30:56 -05:00
Michael 0461ac7912 [Rule] Allow Skill ups from items (Default: On) (#1376) 2021-06-11 13:29:09 -05:00
Michael Cook (mackal) 02526072f3 [Quest API] Add Lua_Mob::GetShuffledHateList (#1381)
This returns the hate list but in a random order. This is useful to
prevent repeated (potentially infinite ...) calls to GetHateRandom()
2021-06-11 13:28:35 -05:00
splose 854a09fc84 [Bug Fix] Allow GMs to chat when stunned (#1380) 2021-06-11 13:27:52 -05:00
Michael Cook (mackal) f0d0c83710 Magic numbers bad (#1373) 2021-06-03 11:17:56 -04:00
395 changed files with 32618 additions and 11446 deletions
+1 -1
View File
@@ -13,4 +13,4 @@ steps:
image: akkadius/eqemu-server:latest
commands:
- sudo chown eqemu:eqemu /drone/src/ * -R
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_BOTS=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
+48 -1
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.7)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
@@ -131,6 +131,47 @@ OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
#PRNG options
OPTION(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF)
MARK_AS_ADVANCED(EQEMU_ADDITIVE_LFIB_PRNG)
OPTION(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF)
MARK_AS_ADVANCED(EQEMU_BIASED_INT_DIST)
SET(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)")
MARK_AS_ADVANCED(EQEMU_CUSTOM_PRNG_ENGINE)
IF(CMAKE_COMPILER_IS_GNUCXX)
OPTION(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF)
MARK_AS_ADVANCED(EQEMU_SFMT19937)
ENDIF()
IF(EQEMU_ADDITIVE_LFIB_PRNG)
ADD_DEFINITIONS(-DUSE_ADDITIVE_LFIB_PRNG)
IF(EQEMU_SFMT19937)
MESSAGE(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.")
SET(EQEMU_SFMT19937 OFF)
ENDIF()
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.")
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
ENDIF()
ENDIF()
IF(EQEMU_SFMT19937)
ADD_DEFINITIONS(-DUSE_SFMT19937)
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.")
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
ENDIF()
ENDIF()
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
ADD_DEFINITIONS(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE})
ENDIF()
IF(EQEMU_BIASED_INT_DIST)
ADD_DEFINITIONS(-DBIASED_INT_DIST)
ENDIF()
IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
ENDIF(EQEMU_COMMANDS_LOGGING)
@@ -183,6 +224,9 @@ IF(OpenSSL_FOUND AND MBEDTLS_FOUND)
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1")
ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT)
ENDIF()
ELSEIF(TLS_LIBRARY_SELECTION STREQUAL "mbedTLS")
SET(TLS_LIBRARY_TYPE " mbedTLS")
SET(TLS_LIBRARY_ENABLED ON)
@@ -198,6 +242,9 @@ ELSEIF(OpenSSL_FOUND)
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1")
ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT)
ENDIF()
ELSEIF(MBEDTLS_FOUND)
SET(TLS_LIBRARY_TYPE " mbedTLS")
SET(TLS_LIBRARY_ENABLED ON)
+3 -2
View File
@@ -83,8 +83,9 @@ int main(int argc, char **argv)
content_db.SetMysql(database.getMySQL());
}
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();
LogSys.SetDatabase(&database)
->LoadLogDatabaseSettings()
->StartFileLogs();
std::string arg_1;
+3 -2
View File
@@ -80,8 +80,9 @@ int main(int argc, char **argv) {
content_db.SetMysql(database.getMySQL());
}
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();
LogSys.SetDatabase(&database)
->LoadLogDatabaseSettings()
->StartFileLogs();
ImportSpells(&content_db);
ImportSkillCaps(&content_db);
+22 -2
View File
@@ -32,7 +32,6 @@ SET(common_sources
eq_stream_proxy.cpp
eqtime.cpp
event_sub.cpp
expedition_base.cpp
expedition_lockout_timer.cpp
extprofile.cpp
faction.cpp
@@ -72,6 +71,7 @@ SET(common_sources
serialize_buffer.cpp
server_event_scheduler.cpp
serverinfo.cpp
shared_tasks.cpp
shareddb.cpp
skills.cpp
spdat.cpp
@@ -154,6 +154,7 @@ SET(repositories
repositories/base/base_character_disciplines_repository.h
repositories/base/base_character_expedition_lockouts_repository.h
repositories/base/base_character_inspect_messages_repository.h
repositories/base/base_character_instance_safereturns_repository.h
repositories/base/base_character_item_recast_repository.h
repositories/base/base_character_languages_repository.h
repositories/base/base_character_leadership_abilities_repository.h
@@ -165,11 +166,15 @@ SET(repositories
repositories/base/base_character_potionbelt_repository.h
repositories/base/base_character_skills_repository.h
repositories/base/base_character_spells_repository.h
repositories/base/base_character_task_timers_repository.h
repositories/base/base_character_tasks_repository.h
repositories/base/base_char_create_combinations_repository.h
repositories/base/base_char_create_point_allocations_repository.h
repositories/base/base_char_recipe_list_repository.h
repositories/base/base_completed_tasks_repository.h
repositories/base/base_completed_shared_tasks_repository.h
repositories/base/base_completed_shared_task_members_repository.h
repositories/base/base_completed_shared_task_activity_state_repository.h
repositories/base/base_content_flags_repository.h
repositories/base/base_damageshieldtypes_repository.h
repositories/base/base_data_buckets_repository.h
@@ -255,6 +260,10 @@ SET(repositories
repositories/base/base_rule_values_repository.h
repositories/base/base_saylink_repository.h
repositories/base/base_server_scheduled_events_repository.h
repositories/base/base_shared_tasks_repository.h
repositories/base/base_shared_task_activity_state_repository.h
repositories/base/base_shared_task_dynamic_zones_repository.h
repositories/base/base_shared_task_members_repository.h
repositories/base/base_skill_caps_repository.h
repositories/base/base_spawn2_repository.h
repositories/base/base_spawnentry_repository.h
@@ -318,6 +327,7 @@ SET(repositories
repositories/character_disciplines_repository.h
repositories/character_expedition_lockouts_repository.h
repositories/character_inspect_messages_repository.h
repositories/character_instance_safereturns_repository.h
repositories/character_item_recast_repository.h
repositories/character_languages_repository.h
repositories/character_leadership_abilities_repository.h
@@ -329,11 +339,15 @@ SET(repositories
repositories/character_potionbelt_repository.h
repositories/character_skills_repository.h
repositories/character_spells_repository.h
repositories/character_task_timers_repository.h
repositories/character_tasks_repository.h
repositories/char_create_combinations_repository.h
repositories/char_create_point_allocations_repository.h
repositories/char_recipe_list_repository.h
repositories/completed_tasks_repository.h
repositories/completed_shared_tasks_repository.h
repositories/completed_shared_task_members_repository.h
repositories/completed_shared_task_activity_state_repository.h
repositories/content_flags_repository.h
repositories/damageshieldtypes_repository.h
repositories/data_buckets_repository.h
@@ -419,6 +433,10 @@ SET(repositories
repositories/rule_values_repository.h
repositories/saylink_repository.h
repositories/server_scheduled_events_repository.h
repositories/shared_tasks_repository.h
repositories/shared_task_activity_state_repository.h
repositories/shared_task_dynamic_zones_repository.h
repositories/shared_task_members_repository.h
repositories/skill_caps_repository.h
repositories/spawn2_repository.h
repositories/spawnentry_repository.h
@@ -451,6 +469,7 @@ SET(repositories
)
SET(common_headers
additive_lagged_fibonacci_engine.h
any.h
base_packet.h
base_data.h
@@ -496,7 +515,6 @@ SET(common_headers
eqtime.h
errmsg.h
event_sub.h
expedition_base.h
expedition_lockout_timer.h
extprofile.h
faction.h
@@ -552,11 +570,13 @@ SET(common_headers
server_event_scheduler.h
serverinfo.h
servertalk.h
shared_tasks.h
shareddb.h
skills.h
spdat.h
string_util.h
struct_strategy.h
tasks.h
textures.h
timer.h
types.h
+147
View File
@@ -0,0 +1,147 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2021 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#include <cstdint>
#include <limits>
#include <type_traits>
#include <algorithm>
#include <iostream>
/*
* This is an additive lagged fibonacci generator as seen in The Art of Computer Programming, Vol. 2
* This should roughly match the implementation that EQ's client uses and be compatible with our Random class
*
* EQ's rand looks like it was from an example implementation that as posted on pscode.com
*
* You might also want to consider defining BIASED_INT_DIST as well to more closely match EQ
*/
namespace EQ {
template<typename UIntType, size_t w, size_t j, size_t k>
class additive_lagged_fibonacci_engine {
static_assert(std::is_unsigned<UIntType>::value, "result_type must be an unsigned integral type");
static_assert(0u < j && j < k, "0 < j < k");
static_assert(0u < w && w <= std::numeric_limits<UIntType>::digits,
"template argument substituting w out of bounds");
public:
using result_type = UIntType;
static constexpr size_t word_size = w;
static constexpr size_t short_lag = j;
static constexpr size_t long_lag = k;
static constexpr result_type default_seed = 19780503u; // default for subtract_with_carry_engine
additive_lagged_fibonacci_engine() : additive_lagged_fibonacci_engine(default_seed) {}
explicit additive_lagged_fibonacci_engine(result_type sd) { seed(sd); }
void seed(result_type seed = default_seed)
{
state1 = long_lag - long_lag;
state2 = long_lag - short_lag;
state[0] = static_cast<int>(seed) & ((1u << word_size) - 1);
state[1] = 1;
for (int i = 2; i < long_lag; ++i)
state[i] = (state[i - 1] + state[i - 2]) & ((1u << word_size) - 1);
return;
}
// TODO: seed via seed_seq
static constexpr result_type min() { return 0; }
static constexpr result_type max() { return ((1u << word_size) - 1) >> 6; }
void discard(unsigned long long z) {
for (; z != 0ULL; --z)
(*this)();
}
result_type operator()() {
result_type rand = (state[state1] + state[state2]) & ((1u << word_size) - 1);
state[state1] = rand;
if (++state1 == long_lag)
state1 = 0;
if (++state2 == long_lag)
state2 = 0;
return rand >> 6;
}
private:
result_type state1;
result_type state2;
result_type state[long_lag];
public:
template<typename UInt, size_t W, size_t J, size_t K>
friend bool operator==(const additive_lagged_fibonacci_engine<UInt, W, J, K> &x,
const additive_lagged_fibonacci_engine<UInt, W, J, K> &y)
{
return std::equal(x.state, x.state + long_lag, y.state) && x.state1 == y.state1 &&
x.state2 == y.state2;
}
template<typename UInt, size_t W, size_t J, size_t K>
friend bool operator!=(const additive_lagged_fibonacci_engine<UInt, W, J, K> &x,
const additive_lagged_fibonacci_engine<UInt, W, J, K> &y)
{ return !(x == y); }
template<typename UInt, size_t W, size_t J, size_t K, typename CharT, typename Traits>
friend std::basic_ostream<CharT, Traits> &
operator<<(std::basic_istream<CharT, Traits> &os, additive_lagged_fibonacci_engine<UInt, W, J, K> &x)
{
using ios_base = typename std::basic_istream<CharT, Traits>::ios_base;
const typename ios_base::fmtflags flags = os.flags();
const CharT fill = os.fill();
const CharT space = os.widen(' ');
os.flags(ios_base::dec | ios_base::fixed | ios_base::left);
os.fill(space);
for (size_t i = 0; i < long_lag; ++i)
os << x.state[i] << space;
os << x.state1 << space << x.state2;
os.flags(flags);
os.fill(fill);
return os;
}
template<typename UInt, size_t W, size_t J, size_t K, typename CharT, typename Traits>
friend std::basic_istream<CharT, Traits> &
operator>>(std::basic_istream<CharT, Traits> &is, additive_lagged_fibonacci_engine<UInt, W, J, K> &x)
{
using ios_base = typename std::basic_istream<CharT, Traits>::ios_base;
const typename ios_base::fmtflags flags = is.flags();
is.flags(ios_base::dec | ios_base::skipws);
for (size_t i = 0; i < long_lag; ++i)
is >> x.state[i];
is >> x.state1;
is >> x.state2;
is.flags(flags);
return is;
}
};
using EQRand = additive_lagged_fibonacci_engine<uint32_t, 30, 24, 55>;
};
+10 -8
View File
@@ -27,16 +27,17 @@ typedef enum {
BT_Extraplanar = 6,
BT_Magical = 7, //this name might be a bit off,
BT_SummonedUndead = 8,
BT_RaidGiant = 9,
// ...
BT_RaidGiant = 9, //Velious era Raid Giant
BT_RaidColdain = 10, //Velious era Raid Coldain
BT_NoTarget = 11, //no name, can't target this bodytype
BT_Vampire = 12,
BT_Atenha_Ra = 13,
BT_Greater_Akheva = 14,
BT_Khati_Sha = 15,
BT_Seru = 16, //not confirmed....
BT_Seru = 16,
BT_Grieg_Veneficus = 17,
BT_Draz_Nurakk = 18,
BT_Zek = 19,
BT_Zek = 19, //"creatures from the Plane of War."
BT_Luggald = 20,
BT_Animal = 21,
BT_Insect = 22,
@@ -46,17 +47,18 @@ typedef enum {
BT_Dragon = 26,
BT_Summoned2 = 27,
BT_Summoned3 = 28,
//29
BT_Dragon2 = 29, //database data indicates this is a dragon type (kunark and DoN?)
BT_VeliousDragon = 30, //might not be a tight set
// ...
BT_Familiar = 31,
BT_Dragon3 = 32,
BT_Boxes = 33,
BT_Muramite = 34, //tribal dudes
// ...
BT_NoTarget2 = 60,
// ...
BT_SwarmPet = 63, //is this valid, or made up?
// ...
BT_SwarmPet = 63, //Looks like weapon proc related temp pets and few misc pets, should not be used for checking swarm pets in general.
BT_MonsterSummon = 64,
// 65, trap or effect related?
BT_InvisMan = 66, //no name, seen on 'InvisMan', can be /targeted
BT_Special = 67
} bodyType;
+25 -104
View File
@@ -906,6 +906,26 @@ std::string Database::GetNPCNameByID(uint32 npc_id) {
return res;
}
std::string Database::GetCleanNPCNameByID(uint32 npc_id) {
std::string query = fmt::format("SELECT `name` FROM `npc_types` WHERE id = {}", npc_id);
auto results = QueryDatabase(query);
std::string res;
std::string mob_name;
if (!results.Success()) {
return res;
}
if (results.RowCount() == 0) {
return res;
}
auto row = results.begin();
mob_name = row[0];
CleanMobName(mob_name.begin(), mob_name.end(), std::back_inserter(res));
return res;
}
bool Database::LoadVariables() {
auto results = QueryDatabase(StringFormat("SELECT varname, value, unix_timestamp() FROM variables where unix_timestamp(ts) >= %d", varcache.last_update));
@@ -2019,7 +2039,7 @@ void Database::ClearRaidLeader(uint32 gid, uint32 rid)
QueryDatabase(query);
}
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove)
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)
{
std::string field;
@@ -2057,26 +2077,16 @@ void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win,
}
}
if (win) {
if (win)
field += "wins";
} else {
else
field += "losses";
}
std::string modification;
if (remove){
modification = "-1";
} else {
modification = "+1";
}
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s%s WHERE player_id=%u",field.c_str(), field.c_str(), modification.c_str(), char_id);
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s+1 WHERE player_id=%u",field.c_str(), field.c_str(), char_id);
auto results = QueryDatabase(query);
if (results.RowsAffected() != 0) {
if (results.RowsAffected() != 0)
return;
}
query = StringFormat("INSERT INTO `adventure_stats` SET %s=1, player_id=%u", field.c_str(), char_id);
QueryDatabase(query);
@@ -2181,95 +2191,6 @@ uint32 Database::GetRaidIDByCharID(uint32 character_id) {
return 0;
}
/**
* @param log_settings
*/
void Database::LoadLogSettings(EQEmuLogSys::LogSettings *log_settings)
{
std::string query =
"SELECT "
"log_category_id, "
"log_category_description, "
"log_to_console, "
"log_to_file, "
"log_to_gmsay "
"FROM "
"logsys_categories "
"ORDER BY log_category_id";
auto results = QueryDatabase(query);
int log_category_id = 0;
int *categories_in_database = new int[1000];
for (auto row = results.begin(); row != results.end(); ++row) {
log_category_id = atoi(row[0]);
if (log_category_id <= Logs::None || log_category_id >= Logs::MaxCategoryID) {
continue;
}
log_settings[log_category_id].log_to_console = static_cast<uint8>(atoi(row[2]));
log_settings[log_category_id].log_to_file = static_cast<uint8>(atoi(row[3]));
log_settings[log_category_id].log_to_gmsay = static_cast<uint8>(atoi(row[4]));
/**
* Determine if any output method is enabled for the category
* and set it to 1 so it can used to check if category is enabled
*/
const bool log_to_console = log_settings[log_category_id].log_to_console > 0;
const bool log_to_file = log_settings[log_category_id].log_to_file > 0;
const bool log_to_gmsay = log_settings[log_category_id].log_to_gmsay > 0;
const bool is_category_enabled = log_to_console || log_to_file || log_to_gmsay;
if (is_category_enabled) {
log_settings[log_category_id].is_category_enabled = 1;
}
/**
* This determines whether or not the process needs to actually file log anything.
* If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open
*/
if (log_settings[log_category_id].log_to_file > 0) {
LogSys.file_logs_enabled = true;
}
categories_in_database[log_category_id] = 1;
}
/**
* Auto inject categories that don't exist in the database...
*/
for (int log_index = Logs::AA; log_index != Logs::MaxCategoryID; log_index++) {
if (categories_in_database[log_index] != 1) {
LogInfo(
"New Log Category [{0}] doesn't exist... Automatically adding to [logsys_categories] table...",
Logs::LogCategoryName[log_index]
);
auto inject_query = fmt::format(
"INSERT INTO logsys_categories "
"(log_category_id, "
"log_category_description, "
"log_to_console, "
"log_to_file, "
"log_to_gmsay) "
"VALUES "
"({0}, '{1}', {2}, {3}, {4})",
log_index,
EscapeString(Logs::LogCategoryName[log_index]),
std::to_string(log_settings[log_index].log_to_console),
std::to_string(log_settings[log_index].log_to_file),
std::to_string(log_settings[log_index].log_to_gmsay)
);
QueryDatabase(inject_query);
}
}
delete[] categories_in_database;
}
int Database::CountInvSnapshots() {
std::string query = StringFormat("SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a GROUP BY `charid`, `time_index`) b");
auto results = QueryDatabase(query);
+3 -3
View File
@@ -78,6 +78,7 @@ class PTimerList;
#define SQL(...) #__VA_ARGS__
class LogSettings;
class Database : public DBcore {
public:
Database();
@@ -140,6 +141,7 @@ public:
void GetCharName(uint32 char_id, char* name);
std::string GetCharNameByID(uint32 char_id);
std::string GetNPCNameByID(uint32 npc_id);
std::string GetCleanNPCNameByID(uint32 npc_id);
void LoginIP(uint32 AccountID, const char* LoginIP);
/* Instancing */
@@ -174,7 +176,7 @@ public:
/* Adventure related. */
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove = false);
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
/* Account Related */
@@ -267,8 +269,6 @@ public:
int CountInvSnapshots();
void ClearInvSnapshots(bool from_now = false);
/* EQEmuLogSys */
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
private:
+13 -1
View File
@@ -53,6 +53,7 @@ namespace DatabaseSchema {
{"character_expedition_lockouts", "character_id"},
{"character_exp_modifiers", "character_id"},
{"character_inspect_messages", "id"},
{"character_instance_safereturns", "character_id"},
{"character_item_recast", "id"},
{"character_languages", "id"},
{"character_leadership_abilities", "id"},
@@ -64,6 +65,7 @@ namespace DatabaseSchema {
{"character_potionbelt", "id"},
{"character_skills", "id"},
{"character_spells", "id"},
{"character_task_timers", "character_id"},
{"character_tasks", "charid"},
{"character_tribute", "id"},
{"completed_tasks", "charid"},
@@ -119,6 +121,7 @@ namespace DatabaseSchema {
"character_expedition_lockouts",
"character_exp_modifiers",
"character_inspect_messages",
"character_instance_safereturns",
"character_item_recast",
"character_languages",
"character_leadership_abilities",
@@ -130,6 +133,7 @@ namespace DatabaseSchema {
"character_potionbelt",
"character_skills",
"character_spells",
"character_task_timers",
"character_tasks",
"character_tribute",
"completed_tasks",
@@ -217,6 +221,7 @@ namespace DatabaseSchema {
"npc_types_tint",
"object",
"pets",
"pets_beastlord_data",
"pets_equipmentset",
"pets_equipmentset_entries",
"proximities",
@@ -309,6 +314,9 @@ namespace DatabaseSchema {
"banned_ips",
"bug_reports",
"bugs",
"completed_shared_task_activity_state",
"completed_shared_task_members",
"completed_shared_tasks",
"dynamic_zone_members",
"dynamic_zones",
"eventlog",
@@ -318,8 +326,8 @@ namespace DatabaseSchema {
"group_id",
"group_leaders",
"hackers",
"ip_exemptions",
"instance_list",
"ip_exemptions",
"item_tick",
"lfguild",
"merchantlist_temp",
@@ -331,6 +339,10 @@ namespace DatabaseSchema {
"respawn_times",
"saylink",
"server_scheduled_events",
"shared_task_activity_state",
"shared_task_dynamic_zones",
"shared_task_members",
"shared_tasks",
};
}
+216 -47
View File
@@ -5,6 +5,7 @@
#include "repositories/instance_list_player_repository.h"
#include "rulesys.h"
#include "servertalk.h"
#include "util/uuid.h"
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
{
@@ -13,16 +14,12 @@ DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& e
uint32_t DynamicZoneBase::Create()
{
if (m_id != 0)
{
return m_id;
}
if (GetInstanceID() == 0)
{
CreateInstance();
}
m_uuid = EQ::Util::UUID::Generate().ToString();
m_id = SaveToDatabase();
return m_id;
@@ -75,6 +72,11 @@ uint32_t DynamicZoneBase::CreateInstance()
void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry)
{
m_id = dz_entry.id;
m_uuid = std::move(dz_entry.uuid);
m_name = std::move(dz_entry.name);
m_leader.id = dz_entry.leader_id;
m_min_players = dz_entry.min_players;
m_max_players = dz_entry.max_players;
m_instance_id = dz_entry.instance_id;
m_type = static_cast<DynamicZoneType>(dz_entry.type);
m_compass.zone_id = dz_entry.compass_zone_id;
@@ -104,6 +106,12 @@ void DynamicZoneBase::AddMemberFromRepositoryResult(
DynamicZoneMembersRepository::MemberWithName&& entry)
{
auto status = DynamicZoneMemberStatus::Unknown;
if (m_leader.id == entry.character_id)
{
m_leader.name = entry.character_name;
}
AddInternalMember({ entry.character_id, std::move(entry.character_name), status });
}
@@ -114,6 +122,11 @@ uint32_t DynamicZoneBase::SaveToDatabase()
if (m_instance_id != 0)
{
auto insert_dz = DynamicZonesRepository::NewEntity();
insert_dz.uuid = m_uuid;
insert_dz.name = m_name;
insert_dz.leader_id = m_leader.id;
insert_dz.min_players = m_min_players;
insert_dz.max_players = m_max_players;
insert_dz.instance_id = m_instance_id,
insert_dz.type = static_cast<int>(m_type);
insert_dz.compass_zone_id = m_compass.zone_id;
@@ -137,34 +150,80 @@ uint32_t DynamicZoneBase::SaveToDatabase()
return 0;
}
void DynamicZoneBase::AddCharacter(uint32_t character_id)
bool DynamicZoneBase::AddMember(const DynamicZoneMember& add_member)
{
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, character_id);
GetDatabase().AddClientToInstance(m_instance_id, character_id);
SendInstanceAddRemoveCharacter(character_id, false); // stops client kick timer
}
void DynamicZoneBase::RemoveCharacter(uint32_t character_id)
{
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, character_id);
GetDatabase().RemoveClientFromInstance(m_instance_id, character_id);
SendInstanceAddRemoveCharacter(character_id, true); // start client kick timer
}
void DynamicZoneBase::RemoveAllCharacters(bool enable_removal_timers)
{
if (GetInstanceID() == 0)
if (HasMember(add_member.id))
{
return;
return false;
}
if (enable_removal_timers)
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, add_member.id);
GetDatabase().AddClientToInstance(m_instance_id, add_member.id);
ProcessMemberAddRemove(add_member, false);
SendServerPacket(CreateServerMemberAddRemovePacket(add_member, false).get());
return true;
}
bool DynamicZoneBase::RemoveMember(uint32_t character_id)
{
auto remove_member = GetMemberData(character_id);
return RemoveMember(remove_member);
}
bool DynamicZoneBase::RemoveMember(const std::string& character_name)
{
auto remove_member = GetMemberData(character_name);
return RemoveMember(remove_member);
}
bool DynamicZoneBase::RemoveMember(const DynamicZoneMember& remove_member)
{
if (remove_member.id == 0)
{
SendInstanceRemoveAllCharacters();
return false;
}
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, remove_member.id);
GetDatabase().RemoveClientFromInstance(m_instance_id, remove_member.id);
ProcessMemberAddRemove(remove_member, true);
SendServerPacket(CreateServerMemberAddRemovePacket(remove_member, true).get());
return true;
}
bool DynamicZoneBase::SwapMember(
const DynamicZoneMember& add_member, const std::string& remove_char_name)
{
auto remove_member = GetMemberData(remove_char_name);
if (!add_member.IsValid() || !remove_member.IsValid())
{
return false;
}
// make remove and add atomic to avoid racing with separate world messages
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, remove_member.id);
GetDatabase().RemoveClientFromInstance(m_instance_id, remove_member.id);
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, add_member.id);
GetDatabase().AddClientToInstance(m_instance_id, add_member.id);
ProcessMemberAddRemove(remove_member, true);
ProcessMemberAddRemove(add_member, false);
SendServerPacket(CreateServerMemberSwapPacket(remove_member, add_member).get());
return true;
}
void DynamicZoneBase::RemoveAllMembers()
{
DynamicZoneMembersRepository::RemoveAllMembers(GetDatabase(), m_id);
GetDatabase().RemoveClientsFromInstance(GetInstanceID());
ProcessRemoveAllMembers();
SendServerPacket(CreateServerRemoveAllMembersPacket().get());
}
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
@@ -181,7 +240,6 @@ void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
member_entry.dynamic_zone_id = m_id;
member_entry.character_id = member.id;
member_entry.is_current_member = true;
insert_members.emplace_back(member_entry);
InstanceListPlayerRepository::InstanceListPlayer player_entry;
@@ -206,7 +264,7 @@ void DynamicZoneBase::SetCompass(const DynamicZoneLocation& location, bool updat
DynamicZonesRepository::UpdateCompass(GetDatabase(),
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
SendGlobalLocationChange(ServerOP_DzSetCompass, location);
SendServerPacket(CreateServerDzLocationPacket(ServerOP_DzSetCompass, location).get());
}
}
@@ -227,7 +285,7 @@ void DynamicZoneBase::SetSafeReturn(const DynamicZoneLocation& location, bool up
DynamicZonesRepository::UpdateSafeReturn(GetDatabase(), m_id, m_safereturn.zone_id,
m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
SendGlobalLocationChange(ServerOP_DzSetSafeReturn, location);
SendServerPacket(CreateServerDzLocationPacket(ServerOP_DzSetSafeReturn, location).get());
}
}
@@ -249,7 +307,7 @@ void DynamicZoneBase::SetZoneInLocation(const DynamicZoneLocation& location, boo
DynamicZonesRepository::UpdateZoneIn(GetDatabase(), m_id, m_zone_id,
m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading, m_has_zonein);
SendGlobalLocationChange(ServerOP_DzSetZoneIn, location);
SendServerPacket(CreateServerDzLocationPacket(ServerOP_DzSetZoneIn, location).get());
}
}
@@ -258,35 +316,71 @@ void DynamicZoneBase::SetZoneInLocation(float x, float y, float z, float heading
SetZoneInLocation({ 0, x, y, z, heading }, update_db);
}
void DynamicZoneBase::SetLeader(const DynamicZoneMember& new_leader, bool update_db)
{
m_leader = new_leader;
if (update_db)
{
DynamicZonesRepository::UpdateLeaderID(GetDatabase(), m_id, new_leader.id);
}
}
uint32_t DynamicZoneBase::GetSecondsRemaining() const
{
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
return std::max(0, static_cast<int>(remaining));
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerAddRemoveCharacterPacket(
uint32_t character_id, bool removed)
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberAddRemovePacket(
const DynamicZoneMember& member, bool removed)
{
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzAddRemoveCharacter, pack_size);
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
buf->zone_id = GetZoneID();
buf->instance_id = GetInstanceID();
buf->remove = removed;
buf->character_id = character_id;
constexpr uint32_t pack_size = sizeof(ServerDzMember_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzAddRemoveMember, pack_size);
auto buf = reinterpret_cast<ServerDzMember_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->dz_zone_id = GetZoneID();
buf->dz_instance_id = GetInstanceID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
buf->removed = removed;
buf->character_id = member.id;
buf->character_status = static_cast<uint8_t>(member.status);
strn0cpy(buf->character_name, member.name.c_str(), sizeof(buf->character_name));
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerRemoveAllCharactersPacket()
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberSwapPacket(
const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member)
{
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzRemoveAllCharacters, pack_size);
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
buf->zone_id = GetZoneID();
buf->instance_id = GetInstanceID();
buf->remove = true;
buf->character_id = 0;
constexpr uint32_t pack_size = sizeof(ServerDzMemberSwap_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzSwapMembers, pack_size);
auto buf = reinterpret_cast<ServerDzMemberSwap_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->dz_zone_id = GetZoneID();
buf->dz_instance_id = GetInstanceID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
buf->add_character_status = static_cast<uint8_t>(add_member.status);
buf->add_character_id = add_member.id;
buf->remove_character_id = remove_member.id;
strn0cpy(buf->add_character_name, add_member.name.c_str(), sizeof(buf->add_character_name));
strn0cpy(buf->remove_character_name, remove_member.name.c_str(), sizeof(buf->remove_character_name));
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerRemoveAllMembersPacket()
{
constexpr uint32_t pack_size = sizeof(ServerDzID_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzRemoveAllMembers, pack_size);
auto buf = reinterpret_cast<ServerDzID_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->dz_zone_id = GetZoneID();
buf->dz_instance_id = GetInstanceID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
return pack;
}
@@ -309,10 +403,25 @@ std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzLocationPacket(
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberStatusPacket(
uint32_t character_id, DynamicZoneMemberStatus status)
{
constexpr uint32_t pack_size = sizeof(ServerDzMemberStatus_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzUpdateMemberStatus, pack_size);
auto buf = reinterpret_cast<ServerDzMemberStatus_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
buf->status = static_cast<uint8_t>(status);
buf->character_id = character_id;
return pack;
}
uint32_t DynamicZoneBase::GetDatabaseMemberCount()
{
return DynamicZoneMembersRepository::GetCountWhere(GetDatabase(),
fmt::format("dynamic_zone_id = {} AND is_current_member = TRUE", m_id));
fmt::format("dynamic_zone_id = {}", m_id));
}
bool DynamicZoneBase::HasDatabaseMember(uint32_t character_id)
@@ -323,7 +432,7 @@ bool DynamicZoneBase::HasDatabaseMember(uint32_t character_id)
}
auto entries = DynamicZoneMembersRepository::GetWhere(GetDatabase(), fmt::format(
"dynamic_zone_id = {} AND character_id = {} AND is_current_member = TRUE",
"dynamic_zone_id = {} AND character_id = {}",
m_id, character_id
));
@@ -411,6 +520,33 @@ bool DynamicZoneBase::SetInternalMemberStatus(uint32_t character_id, DynamicZone
return false;
}
void DynamicZoneBase::SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status)
{
auto update_member = GetMemberData(character_id);
if (update_member.IsValid())
{
ProcessMemberStatusChange(character_id, status);
SendServerPacket(CreateServerMemberStatusPacket(character_id, status).get());
}
}
void DynamicZoneBase::ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed)
{
if (!removed)
{
AddInternalMember(member);
}
else
{
RemoveInternalMember(member.id);
}
}
bool DynamicZoneBase::ProcessMemberStatusChange(uint32_t character_id, DynamicZoneMemberStatus status)
{
return SetInternalMemberStatus(character_id, status);
}
std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
{
switch (dz_type)
@@ -428,3 +564,36 @@ std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
}
return "Unknown";
}
EQ::Net::DynamicPacket DynamicZoneBase::GetSerializedDzPacket()
{
EQ::Net::DynamicPacket dyn_pack;
dyn_pack.PutSerialize(0, *this);
LogDynamicZonesDetail("Serialized server dz size [{}]", dyn_pack.Length());
return dyn_pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzCreatePacket(
uint16_t origin_zone_id, uint16_t origin_instance_id)
{
EQ::Net::DynamicPacket dyn_pack = GetSerializedDzPacket();
auto pack_size = sizeof(ServerDzCreateSerialized_Struct) + dyn_pack.Length();
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
auto buf = reinterpret_cast<ServerDzCreateSerialized_Struct*>(pack->pBuffer);
buf->origin_zone_id = origin_zone_id;
buf->origin_instance_id = origin_instance_id;
buf->cereal_size = static_cast<uint32_t>(dyn_pack.Length());
memcpy(buf->cereal_data, dyn_pack.Data(), dyn_pack.Length());
return pack;
}
void DynamicZoneBase::LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size)
{
LogDynamicZonesDetail("Deserializing server dz size [{}]", cereal_size);
EQ::Util::MemoryStreamReader ss(cereal_data, cereal_size);
cereal::BinaryInputArchive archive(ss);
archive(*this);
}
+72 -15
View File
@@ -2,6 +2,7 @@
#define COMMON_DYNAMIC_ZONE_BASE_H
#include "eq_constants.h"
#include "net/packet.h"
#include "repositories/dynamic_zones_repository.h"
#include "repositories/dynamic_zone_members_repository.h"
#include <algorithm>
@@ -18,7 +19,7 @@ struct DynamicZoneMember
{
uint32_t id = 0;
std::string name;
DynamicZoneMemberStatus status = DynamicZoneMemberStatus::Online;
DynamicZoneMemberStatus status = DynamicZoneMemberStatus::Unknown;
DynamicZoneMember() = default;
DynamicZoneMember(uint32_t id, std::string name_)
@@ -29,6 +30,12 @@ struct DynamicZoneMember
bool IsOnline() const { return status == DynamicZoneMemberStatus::Online ||
status == DynamicZoneMemberStatus::InDynamicZone; }
bool IsValid() const { return id != 0 && !name.empty(); }
template<class Archive>
void serialize(Archive& archive)
{
archive(id, name, status);
}
};
struct DynamicZoneLocation
@@ -42,6 +49,12 @@ struct DynamicZoneLocation
DynamicZoneLocation() = default;
DynamicZoneLocation(uint32_t zone_id_, float x_, float y_, float z_, float heading_)
: zone_id(zone_id_), x(x_), y(y_), z(z_), heading(heading_) {}
template<class Archive>
void serialize(Archive& archive)
{
archive(zone_id, x, y, z, heading);
}
};
class DynamicZoneBase
@@ -64,6 +77,7 @@ public:
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
uint32_t GetID() const { return m_id; }
uint16_t GetInstanceID() const { return static_cast<uint16_t>(m_instance_id); }
uint32_t GetLeaderID() const { return m_leader.id; }
uint32_t GetMaxPlayers() const { return m_max_players; }
uint32_t GetMemberCount() const { return static_cast<uint32_t>(m_members.size()); }
uint32_t GetMinPlayers() const { return m_min_players; }
@@ -74,6 +88,7 @@ public:
DynamicZoneType GetType() const { return m_type; }
const std::string& GetLeaderName() const { return m_leader.name; }
const std::string& GetName() const { return m_name; }
const std::string& GetUUID() const { return m_uuid; }
const DynamicZoneMember& GetLeader() const { return m_leader; }
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
@@ -81,14 +96,12 @@ public:
const DynamicZoneLocation& GetZoneInLocation() const { return m_zonein; }
std::chrono::system_clock::duration GetDurationRemaining() const { return m_expire_time - std::chrono::system_clock::now(); }
void AddCharacter(uint32_t character_id);
void AddInternalMember(const DynamicZoneMember& member);
bool AddMember(const DynamicZoneMember& add_member);
void AddMemberFromRepositoryResult(DynamicZoneMembersRepository::MemberWithName&& entry);
void ClearInternalMembers() { m_members.clear(); }
uint32_t Create();
uint32_t GetDatabaseMemberCount();
DynamicZoneMember GetMemberData(uint32_t character_id);
DynamicZoneMember GetMemberData(const std::string& character_name);
EQ::Net::DynamicPacket GetSerializedDzPacket();
bool HasDatabaseMember(uint32_t character_id);
bool HasMember(uint32_t character_id);
bool HasMember(const std::string& character_name);
@@ -98,38 +111,52 @@ public:
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
bool IsValid() const { return m_instance_id != 0; }
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
void RemoveAllCharacters(bool enable_removal_timers = true);
void RemoveCharacter(uint32_t character_id);
void RemoveInternalMember(uint32_t character_id);
void LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size);
void RemoveAllMembers();
bool RemoveMember(uint32_t character_id);
bool RemoveMember(const std::string& character_name);
bool RemoveMember(const DynamicZoneMember& remove_member);
void SaveMembers(const std::vector<DynamicZoneMember>& members);
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
void SetLeader(const DynamicZoneMember& leader) { m_leader = leader; }
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
void SetLeader(const DynamicZoneMember& leader, bool update_db = false);
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
void SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
void SetName(const std::string& name) { m_name = name; }
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
void SetType(DynamicZoneType type) { m_type = type; }
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
bool SwapMember(const DynamicZoneMember& add_member, const std::string& remove_char_name);
protected:
virtual uint16_t GetCurrentInstanceID() { return 0; }
virtual uint16_t GetCurrentZoneID() { return 0; }
virtual Database& GetDatabase() = 0;
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
virtual void SendInstanceAddRemoveCharacter(uint32_t character_id, bool remove) = 0;
virtual void SendInstanceRemoveAllCharacters() = 0;
virtual void SendGlobalLocationChange(uint16_t server_opcode, const DynamicZoneLocation& location) = 0;
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
virtual bool ProcessMemberStatusChange(uint32_t member_id, DynamicZoneMemberStatus status);
virtual void ProcessRemoveAllMembers(bool silent = false) { m_members.clear(); }
virtual bool SendServerPacket(ServerPacket* packet) = 0;
void AddInternalMember(const DynamicZoneMember& member);
uint32_t Create();
uint32_t CreateInstance();
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
void RemoveInternalMember(uint32_t character_id);
uint32_t SaveToDatabase();
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
std::unique_ptr<ServerPacket> CreateServerAddRemoveCharacterPacket(uint32_t character_id, bool removed);
std::unique_ptr<ServerPacket> CreateServerRemoveAllCharactersPacket();
std::unique_ptr<ServerPacket> CreateServerDzCreatePacket(uint16_t origin_zone_id, uint16_t origin_instance_id);
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
std::unique_ptr<ServerPacket> CreateServerRemoveAllMembersPacket();
uint32_t m_id = 0;
uint32_t m_zone_id = 0;
@@ -139,7 +166,9 @@ protected:
uint32_t m_max_players = 0;
bool m_never_expires = false;
bool m_has_zonein = false;
bool m_has_member_statuses = false;
std::string m_name;
std::string m_uuid;
DynamicZoneMember m_leader;
DynamicZoneType m_type{ DynamicZoneType::None };
DynamicZoneLocation m_compass;
@@ -149,6 +178,34 @@ protected:
std::chrono::time_point<std::chrono::system_clock> m_start_time;
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
std::vector<DynamicZoneMember> m_members;
public:
template<class Archive>
void serialize(Archive& archive)
{
archive(
m_id,
m_zone_id,
m_instance_id,
m_zone_version,
m_min_players,
m_max_players,
m_never_expires,
m_has_zonein,
m_has_member_statuses,
m_name,
m_uuid,
m_leader,
m_type,
m_compass,
m_safereturn,
m_zonein,
m_duration,
m_start_time,
m_expire_time,
m_members
);
}
};
#endif
+16 -2
View File
@@ -355,7 +355,6 @@ N(OP_OpenContainer),
N(OP_OpenDiscordMerchant),
N(OP_OpenGuildTributeMaster),
N(OP_OpenInventory),
N(OP_OpenNewTasksWindow),
N(OP_OpenTributeMaster),
N(OP_PDeletePetition),
N(OP_PetBuffWindow),
@@ -464,6 +463,19 @@ N(OP_SetServerFilter),
N(OP_SetStartCity),
N(OP_SetTitle),
N(OP_SetTitleReply),
N(OP_SharedTaskMemberList),
N(OP_SharedTaskAddPlayer),
N(OP_SharedTaskRemovePlayer),
N(OP_SharedTaskMakeLeader),
N(OP_SharedTaskMemberInvite),
N(OP_SharedTaskInvite),
N(OP_SharedTaskInviteResponse),
N(OP_SharedTaskAcceptNew),
N(OP_SharedTaskMemberChange),
N(OP_SharedTaskPlayerList),
N(OP_SharedTaskSelectWindow),
N(OP_SharedTaskQuit),
N(OP_TaskTimers),
N(OP_Shielding),
N(OP_ShopDelItem),
N(OP_ShopEnd),
@@ -499,7 +511,8 @@ N(OP_TaskActivityComplete),
N(OP_TaskDescription),
N(OP_TaskHistoryReply),
N(OP_TaskHistoryRequest),
N(OP_TaskMemberList),
N(OP_TaskRequestTimer),
N(OP_TaskSelectWindow),
N(OP_Taunt),
N(OP_TestBuff),
N(OP_TGB),
@@ -567,4 +580,5 @@ N(OP_ZoneServerReady),
N(OP_ZoneSpawns),
N(OP_ZoneUnavail),
N(OP_ResetAA),
N(OP_UnderWorld),
// mail and chat opcodes located in ../mail_oplist.h
+490 -6
View File
@@ -65,6 +65,7 @@
#define AT_FindBits 46 // set FindBits, whatever those are!
#define AT_TextureType 48 // TextureType
#define AT_FacePick 49 // Turns off face pick window? maybe ...
#define AT_AntiCheat 51 // sent by the client randomly telling the server how long since last action has occured
#define AT_GuildShow 52 // this is what MQ2 call sit, not sure
#define AT_Offline 53 // Offline mode
@@ -197,6 +198,492 @@ namespace Chat {
const uint16 Stun = 340;
};
// generation SQL:
// SELECT CONCAT(' constexpr uint16 ', UPPER(short_name), ' = ' , zoneidnumber, '; // ', long_name) from zone group by zoneidnumber ORDER BY zoneidnumber;
namespace Zones {
constexpr uint16 QEYNOS = 1; // South Qeynos
constexpr uint16 QEYNOS2 = 2; // North Qeynos
constexpr uint16 QRG = 3; // The Surefall Glade
constexpr uint16 QEYTOQRG = 4; // The Qeynos Hills
constexpr uint16 HIGHPASS = 5; // Highpass Hold
constexpr uint16 HIGHKEEP = 6; // High Keep
constexpr uint16 FREPORTN = 8; // North Freeport
constexpr uint16 FREPORTW = 9; // West Freeport
constexpr uint16 FREPORTE = 10; // East Freeport
constexpr uint16 RUNNYEYE = 11; // The Liberated Citadel of Runnyeye
constexpr uint16 QEY2HH1 = 12; // The Western Plains of Karana
constexpr uint16 NORTHKARANA = 13; // The Northern Plains of Karana
constexpr uint16 SOUTHKARANA = 14; // The Southern Plains of Karana
constexpr uint16 EASTKARANA = 15; // Eastern Plains of Karana
constexpr uint16 BEHOLDER = 16; // Gorge of King Xorbb
constexpr uint16 BLACKBURROW = 17; // Blackburrow
constexpr uint16 PAW = 18; // The Lair of the Splitpaw
constexpr uint16 RIVERVALE = 19; // Rivervale
constexpr uint16 KITHICOR = 20; // Kithicor Forest
constexpr uint16 COMMONS = 21; // West Commonlands
constexpr uint16 ECOMMONS = 22; // East Commonlands
constexpr uint16 ERUDNINT = 23; // The Erudin Palace
constexpr uint16 ERUDNEXT = 24; // Erudin
constexpr uint16 NEKTULOS = 25; // The Nektulos Forest
constexpr uint16 CSHOME = 26; // Sunset Home
constexpr uint16 LAVASTORM = 27; // The Lavastorm Mountains
constexpr uint16 NEKTROPOS = 28; // Nektropos
constexpr uint16 HALAS = 29; // Halas
constexpr uint16 EVERFROST = 30; // Everfrost Peaks
constexpr uint16 SOLDUNGA = 31; // Solusek's Eye
constexpr uint16 SOLDUNGB = 32; // Nagafen's Lair
constexpr uint16 MISTY = 33; // Misty Thicket
constexpr uint16 NRO = 34; // Northern Desert of Ro
constexpr uint16 SRO = 35; // Southern Desert of Ro
constexpr uint16 BEFALLEN = 36; // Befallen
constexpr uint16 OASIS = 37; // Oasis of Marr
constexpr uint16 TOX = 38; // Toxxulia Forest
constexpr uint16 HOLE = 39; // The Hole
constexpr uint16 NERIAKA = 40; // Neriak - Foreign Quarter
constexpr uint16 NERIAKB = 41; // Neriak - Commons
constexpr uint16 NERIAKC = 42; // Neriak - 3rd Gate
constexpr uint16 NERIAKD = 43; // Neriak Palace
constexpr uint16 NAJENA = 44; // Najena
constexpr uint16 QCAT = 45; // The Qeynos Aqueduct System
constexpr uint16 INNOTHULE = 46; // Innothule Swamp
constexpr uint16 FEERROTT = 47; // The Feerrott
constexpr uint16 CAZICTHULE = 48; // Accursed Temple of CazicThule
constexpr uint16 OGGOK = 49; // Oggok
constexpr uint16 RATHEMTN = 50; // The Rathe Mountains
constexpr uint16 LAKERATHE = 51; // Lake Rathetear
constexpr uint16 GROBB = 52; // Grobb
constexpr uint16 AVIAK = 53; // Aviak Village
constexpr uint16 GFAYDARK = 54; // The Greater Faydark
constexpr uint16 AKANON = 55; // Ak'Anon
constexpr uint16 STEAMFONT = 56; // Steamfont Mountains
constexpr uint16 LFAYDARK = 57; // The Lesser Faydark
constexpr uint16 CRUSHBONE = 58; // Crushbone
constexpr uint16 MISTMOORE = 59; // The Castle of Mistmoore
constexpr uint16 KALADIMA = 60; // South Kaladim
constexpr uint16 FELWITHEA = 61; // Northern Felwithe
constexpr uint16 FELWITHEB = 62; // Southern Felwithe
constexpr uint16 UNREST = 63; // The Estate of Unrest
constexpr uint16 KEDGE = 64; // Kedge Keep
constexpr uint16 GUKTOP = 65; // The City of Guk
constexpr uint16 GUKBOTTOM = 66; // The Ruins of Old Guk
constexpr uint16 KALADIMB = 67; // North Kaladim
constexpr uint16 BUTCHER = 68; // Butcherblock Mountains
constexpr uint16 OOT = 69; // Ocean of Tears
constexpr uint16 CAULDRON = 70; // Dagnor's Cauldron
constexpr uint16 AIRPLANE = 71; // The Plane of Sky
constexpr uint16 FEARPLANE = 72; // The Plane of Fear
constexpr uint16 PERMAFROST = 73; // The Permafrost Caverns
constexpr uint16 KERRARIDGE = 74; // Kerra Isle
constexpr uint16 PAINEEL = 75; // Paineel
constexpr uint16 HATEPLANE = 76; // Plane of Hate
constexpr uint16 ARENA = 77; // The Arena
constexpr uint16 FIELDOFBONE = 78; // The Field of Bone
constexpr uint16 WARSLIKSWOOD = 79; // The Warsliks Woods
constexpr uint16 SOLTEMPLE = 80; // The Temple of Solusek Ro
constexpr uint16 DROGA = 81; // The Temple of Droga
constexpr uint16 CABWEST = 82; // Cabilis West
constexpr uint16 SWAMPOFNOHOPE = 83; // The Swamp of No Hope
constexpr uint16 FIRIONA = 84; // Firiona Vie
constexpr uint16 LAKEOFILLOMEN = 85; // Lake of Ill Omen
constexpr uint16 DREADLANDS = 86; // The Dreadlands
constexpr uint16 BURNINGWOOD = 87; // The Burning Wood
constexpr uint16 KAESORA = 88; // Kaesora
constexpr uint16 SEBILIS = 89; // The Ruins of Sebilis
constexpr uint16 CITYMIST = 90; // The City of Mist
constexpr uint16 SKYFIRE = 91; // The Skyfire Mountains
constexpr uint16 FRONTIERMTNS = 92; // Frontier Mountains
constexpr uint16 OVERTHERE = 93; // The Overthere
constexpr uint16 EMERALDJUNGLE = 94; // The Emerald Jungle
constexpr uint16 TRAKANON = 95; // Trakanon's Teeth
constexpr uint16 TIMOROUS = 96; // Timorous Deep
constexpr uint16 KURN = 97; // Kurn's Tower
constexpr uint16 ERUDSXING = 98; // Erud's Crossing
constexpr uint16 STONEBRUNT = 100; // The Stonebrunt Mountains
constexpr uint16 WARRENS = 101; // The Warrens
constexpr uint16 KARNOR = 102; // Karnor's Castle
constexpr uint16 CHARDOK = 103; // Chardok
constexpr uint16 DALNIR = 104; // The Crypt of Dalnir
constexpr uint16 CHARASIS = 105; // The Howling Stones
constexpr uint16 CABEAST = 106; // Cabilis East
constexpr uint16 NURGA = 107; // The Mines of Nurga
constexpr uint16 VEESHAN = 108; // Veeshan's Peak
constexpr uint16 VEKSAR = 109; // Veksar
constexpr uint16 ICECLAD = 110; // The Iceclad Ocean
constexpr uint16 FROZENSHADOW = 111; // The Tower of Frozen Shadow
constexpr uint16 VELKETOR = 112; // Velketor's Labyrinth
constexpr uint16 KAEL = 113; // Kael Drakkel
constexpr uint16 SKYSHRINE = 114; // Skyshrine
constexpr uint16 THURGADINA = 115; // The City of Thurgadin
constexpr uint16 EASTWASTES = 116; // Eastern Wastes
constexpr uint16 COBALTSCAR = 117; // Cobaltscar
constexpr uint16 GREATDIVIDE = 118; // The Great Divide
constexpr uint16 WAKENING = 119; // The Wakening Land
constexpr uint16 WESTWASTES = 120; // The Western Wastes
constexpr uint16 CRYSTAL = 121; // The Crystal Caverns
constexpr uint16 NECROPOLIS = 123; // Dragon Necropolis
constexpr uint16 TEMPLEVEESHAN = 124; // The Temple of Veeshan
constexpr uint16 SIRENS = 125; // Siren's Grotto
constexpr uint16 MISCHIEFPLANE = 126; // The Plane of Mischief
constexpr uint16 GROWTHPLANE = 127; // The Plane of Growth
constexpr uint16 SLEEPER = 128; // The Sleeper's Tomb
constexpr uint16 THURGADINB = 129; // Icewell Keep
constexpr uint16 ERUDSXING2 = 130; // Marauders Mire
constexpr uint16 SHADOWHAVEN = 150; // Shadow Haven
constexpr uint16 BAZAAR = 151; // The Bazaar
constexpr uint16 NEXUS = 152; // Nexus
constexpr uint16 ECHO_ = 153; // The Echo Caverns
constexpr uint16 ACRYLIA = 154; // The Acrylia Caverns
constexpr uint16 SHARVAHL = 155; // The City of Shar Vahl
constexpr uint16 PALUDAL = 156; // The Paludal Caverns
constexpr uint16 FUNGUSGROVE = 157; // The Fungus Grove
constexpr uint16 VEXTHAL = 158; // Vex Thal
constexpr uint16 SSERU = 159; // Sanctus Seru
constexpr uint16 KATTA = 160; // Katta Castellum
constexpr uint16 NETHERBIAN = 161; // Netherbian Lair
constexpr uint16 SSRATEMPLE = 162; // Ssraeshza Temple
constexpr uint16 GRIEGSEND = 163; // Grieg's End
constexpr uint16 THEDEEP = 164; // The Deep
constexpr uint16 SHADEWEAVER = 165; // Shadeweaver's Thicket
constexpr uint16 HOLLOWSHADE = 166; // Hollowshade Moor
constexpr uint16 GRIMLING = 167; // Grimling Forest
constexpr uint16 MSERU = 168; // Marus Seru
constexpr uint16 LETALIS = 169; // Mons Letalis
constexpr uint16 TWILIGHT = 170; // The Twilight Sea
constexpr uint16 THEGREY = 171; // The Grey
constexpr uint16 TENEBROUS = 172; // The Tenebrous Mountains
constexpr uint16 MAIDEN = 173; // The Maiden's Eye
constexpr uint16 DAWNSHROUD = 174; // The Dawnshroud Peaks
constexpr uint16 SCARLET = 175; // The Scarlet Desert
constexpr uint16 UMBRAL = 176; // The Umbral Plains
constexpr uint16 AKHEVA = 179; // The Akheva Ruins
constexpr uint16 ARENA2 = 180; // The Arena Two
constexpr uint16 JAGGEDPINE = 181; // The Jaggedpine Forest
constexpr uint16 NEDARIA = 182; // Nedaria's Landing
constexpr uint16 TUTORIAL = 183; // EverQuest Tutorial
constexpr uint16 LOAD = 184; // Loading Zone
constexpr uint16 LOAD2 = 185; // New Loading Zone
constexpr uint16 HATEPLANEB = 186; // The Plane of Hate
constexpr uint16 SHADOWREST = 187; // Shadowrest
constexpr uint16 TUTORIALA = 188; // The Mines of Gloomingdeep
constexpr uint16 TUTORIALB = 189; // The Mines of Gloomingdeep
constexpr uint16 CLZ = 190; // Loading
constexpr uint16 CODECAY = 200; // The Crypt of Decay
constexpr uint16 POJUSTICE = 201; // The Plane of Justice
constexpr uint16 POKNOWLEDGE = 202; // The Plane of Knowledge
constexpr uint16 POTRANQUILITY = 203; // The Plane of Tranquility
constexpr uint16 PONIGHTMARE = 204; // The Plane of Nightmares
constexpr uint16 PODISEASE = 205; // The Plane of Disease
constexpr uint16 POINNOVATION = 206; // The Plane of Innovation
constexpr uint16 POTORMENT = 207; // Torment, the Plane of Pain
constexpr uint16 POVALOR = 208; // The Plane of Valor
constexpr uint16 BOTHUNDER = 209; // Bastion of Thunder
constexpr uint16 POSTORMS = 210; // The Plane of Storms
constexpr uint16 HOHONORA = 211; // The Halls of Honor
constexpr uint16 SOLROTOWER = 212; // The Tower of Solusek Ro
constexpr uint16 POWAR = 213; // Plane of War
constexpr uint16 POTACTICS = 214; // Drunder, the Fortress of Zek
constexpr uint16 POAIR = 215; // The Plane of Air
constexpr uint16 POWATER = 216; // The Plane of Water
constexpr uint16 POFIRE = 217; // The Plane of Fire
constexpr uint16 POEARTHA = 218; // The Plane of Earth
constexpr uint16 POTIMEA = 219; // The Plane of Time
constexpr uint16 HOHONORB = 220; // The Temple of Marr
constexpr uint16 NIGHTMAREB = 221; // The Lair of Terris Thule
constexpr uint16 POEARTHB = 222; // The Plane of Earth
constexpr uint16 POTIMEB = 223; // The Plane of Time
constexpr uint16 GUNTHAK = 224; // The Gulf of Gunthak
constexpr uint16 DULAK = 225; // Dulak's Harbor
constexpr uint16 TORGIRAN = 226; // The Torgiran Mines
constexpr uint16 NADOX = 227; // The Crypt of Nadox
constexpr uint16 HATESFURY = 228; // Hate's Fury
constexpr uint16 GUKA = 229; // Deepest Guk: Cauldron of Lost Souls
constexpr uint16 RUJA = 230; // The Rujarkian Hills: Bloodied Quarries
constexpr uint16 TAKA = 231; // Takish-Hiz: Sunken Library
constexpr uint16 MIRA = 232; // Miragul's Menagerie: Silent Gallery
constexpr uint16 MMCA = 233; // Mistmoore's Catacombs: Forlorn Caverns
constexpr uint16 GUKB = 234; // The Drowning Crypt
constexpr uint16 RUJB = 235; // The Rujarkian Hills: Halls of War
constexpr uint16 TAKB = 236; // Takish-Hiz: Shifting Tower
constexpr uint16 MIRB = 237; // Miragul's Menagerie: Frozen Nightmare
constexpr uint16 MMCB = 238; // Mistmoore's Catacombs: Dreary Grotto
constexpr uint16 GUKC = 239; // Deepest Guk: Ancient Aqueducts
constexpr uint16 RUJC = 240; // The Rujarkian Hills: Wind Bridges
constexpr uint16 TAKC = 241; // Takish-Hiz: Within the Compact
constexpr uint16 MIRC = 242; // The Spider Den
constexpr uint16 MMCC = 243; // Mistmoore's Catacombs: Struggles within the Progeny
constexpr uint16 GUKD = 244; // The Mushroom Grove
constexpr uint16 RUJD = 245; // The Rujarkian Hills: Prison Break
constexpr uint16 TAKD = 246; // Takish-Hiz: Royal Observatory
constexpr uint16 MIRD = 247; // Miragul's Menagerie: Hushed Banquet
constexpr uint16 MMCD = 248; // Mistmoore's Catacombs: Chambers of Eternal Affliction
constexpr uint16 GUKE = 249; // Deepest Guk: The Curse Reborn
constexpr uint16 RUJE = 250; // The Rujarkian Hills: Drudge Hollows
constexpr uint16 TAKE = 251; // Takish-Hiz: River of Recollection
constexpr uint16 MIRE = 252; // The Frosted Halls
constexpr uint16 MMCE = 253; // Mistmoore's Catacombs: Sepulcher of the Damned
constexpr uint16 GUKF = 254; // Deepest Guk: Chapel of the Witnesses
constexpr uint16 RUJF = 255; // The Rujarkian Hills: Fortified Lair of the Taskmasters
constexpr uint16 TAKF = 256; // Takish-Hiz: Sandfall Corridors
constexpr uint16 MIRF = 257; // The Forgotten Wastes
constexpr uint16 MMCF = 258; // Mistmoore's Catacombs: Scion Lair of Fury
constexpr uint16 GUKG = 259; // The Root Garden
constexpr uint16 RUJG = 260; // The Rujarkian Hills: Hidden Vale of Deceit
constexpr uint16 TAKG = 261; // Takish-Hiz: Balancing Chamber
constexpr uint16 MIRG = 262; // Miragul's Menagerie: Heart of the Menagerie
constexpr uint16 MMCG = 263; // Mistmoore's Catacombs: Cesspits of Putrescence
constexpr uint16 GUKH = 264; // Deepest Guk: Accursed Sanctuary
constexpr uint16 RUJH = 265; // The Rujarkian Hills: Blazing Forge
constexpr uint16 TAKH = 266; // Takish-Hiz: Sweeping Tides
constexpr uint16 MIRH = 267; // The Morbid Laboratory
constexpr uint16 MMCH = 268; // Mistmoore's Catacombs: Aisles of Blood
constexpr uint16 RUJI = 269; // The Rujarkian Hills: Arena of Chance
constexpr uint16 TAKI = 270; // Takish-Hiz: Antiquated Palace
constexpr uint16 MIRI = 271; // The Theater of Imprisoned Horror
constexpr uint16 MMCI = 272; // Mistmoore's Catacombs: Halls of Sanguinary Rites
constexpr uint16 RUJJ = 273; // The Rujarkian Hills: Barracks of War
constexpr uint16 TAKJ = 274; // Takish-Hiz: Prismatic Corridors
constexpr uint16 MIRJ = 275; // Miragul's Menagerie: Grand Library
constexpr uint16 MMCJ = 276; // Mistmoore's Catacombs: Infernal Sanctuary
constexpr uint16 CHARDOKB = 277; // Chardok: The Halls of Betrayal
constexpr uint16 SOLDUNGC = 278; // The Caverns of Exile
constexpr uint16 ABYSMAL = 279; // The Abysmal Sea
constexpr uint16 NATIMBI = 280; // Natimbi, the Broken Shores
constexpr uint16 QINIMI = 281; // Qinimi, Court of Nihilia
constexpr uint16 RIWWI = 282; // Riwwi, Coliseum of Games
constexpr uint16 BARINDU = 283; // Barindu, Hanging Gardens
constexpr uint16 FERUBI = 284; // Ferubi, Forgotten Temple of Taelosia
constexpr uint16 SNPOOL = 285; // Sewers of Nihilia, Pool of Sludg
constexpr uint16 SNLAIR = 286; // Sewers of Nihilia, Lair of Trapp
constexpr uint16 SNPLANT = 287; // Sewers of Nihilia, Purifying Pla
constexpr uint16 SNCREMATORY = 288; // Sewers of Nihilia, Emanating Cre
constexpr uint16 TIPT = 289; // Tipt, Treacherous Crags
constexpr uint16 VXED = 290; // Vxed, the Crumbling Caverns
constexpr uint16 YXTTA = 291; // Yxtta, Pulpit of Exiles
constexpr uint16 UQUA = 292; // Uqua, the Ocean God Chantry
constexpr uint16 KODTAZ = 293; // Kod'Taz, Broken Trial Grounds
constexpr uint16 IKKINZ = 294; // Ikkinz, Chambers of Transcendence
constexpr uint16 QVIC = 295; // Qvic, Prayer Grounds of Calling
constexpr uint16 INKTUTA = 296; // Inktu'Ta, the Unmasked Chapel
constexpr uint16 TXEVU = 297; // Txevu, Lair of the Elite
constexpr uint16 TACVI = 298; // Tacvi, The Broken Temple
constexpr uint16 QVICB = 299; // Qvic, the Hidden Vault
constexpr uint16 WALLOFSLAUGHTER = 300; // Wall of Slaughter
constexpr uint16 BLOODFIELDS = 301; // The Bloodfields
constexpr uint16 DRANIKSSCAR = 302; // Dranik's Scar
constexpr uint16 CAUSEWAY = 303; // Nobles' Causeway
constexpr uint16 CHAMBERSA = 304; // Muramite Proving Grounds
constexpr uint16 CHAMBERSB = 305; // Muramite Proving Grounds
constexpr uint16 CHAMBERSC = 306; // Muramite Proving Grounds
constexpr uint16 CHAMBERSD = 307; // Muramite Proving Grounds
constexpr uint16 CHAMBERSE = 308; // Muramite Proving Grounds
constexpr uint16 CHAMBERSF = 309; // Muramite Proving Grounds
constexpr uint16 PROVINGGROUNDS = 316; // Muramite Proving Grounds
constexpr uint16 ANGUISH = 317; // Anguish, the Fallen Palace
constexpr uint16 DRANIKHOLLOWSA = 318; // Dranik's Hollows
constexpr uint16 DRANIKHOLLOWSB = 319; // Dranik's Hollows
constexpr uint16 DRANIKHOLLOWSC = 320; // Dranik's Hollows
constexpr uint16 DRANIKCATACOMBSA = 328; // Catacombs of Dranik
constexpr uint16 DRANIKCATACOMBSB = 329; // Catacombs of Dranik
constexpr uint16 DRANIKCATACOMBSC = 330; // Catacombs of Dranik
constexpr uint16 DRANIKSEWERSA = 331; // Sewers of Dranik
constexpr uint16 DRANIKSEWERSB = 332; // Sewers of Dranik
constexpr uint16 DRANIKSEWERSC = 333; // Sewers of Dranik
constexpr uint16 RIFTSEEKERS = 334; // Riftseekers' Sanctum
constexpr uint16 HARBINGERS = 335; // Harbinger's Spire
constexpr uint16 DRANIK = 336; // The Ruined City of Dranik
constexpr uint16 BROODLANDS = 337; // The Broodlands
constexpr uint16 STILLMOONA = 338; // Stillmoon Temple
constexpr uint16 STILLMOONB = 339; // The Ascent
constexpr uint16 THUNDERCREST = 340; // Thundercrest Isles
constexpr uint16 DELVEA = 341; // Lavaspinner's Lair
constexpr uint16 DELVEB = 342; // Tirranun's Delve
constexpr uint16 THENEST = 343; // The Nest
constexpr uint16 GUILDLOBBY = 344; // Guild Lobby
constexpr uint16 GUILDHALL = 345; // Guild Hall
constexpr uint16 BARTER = 346; // The Barter Hall
constexpr uint16 ILLSALIN = 347; // Ruins of Illsalin
constexpr uint16 ILLSALINA = 348; // Illsalin Marketplace
constexpr uint16 ILLSALINB = 349; // Temple of Korlach
constexpr uint16 ILLSALINC = 350; // The Nargil Pits
constexpr uint16 DREADSPIRE = 351; // Dreadspire Keep
constexpr uint16 DRACHNIDHIVE = 354; // The Hive
constexpr uint16 DRACHNIDHIVEA = 355; // The Hatchery
constexpr uint16 DRACHNIDHIVEB = 356; // The Cocoons
constexpr uint16 DRACHNIDHIVEC = 357; // Queen Sendaii`s Lair
constexpr uint16 WESTKORLACH = 358; // Stoneroot Falls
constexpr uint16 WESTKORLACHA = 359; // Prince's Manor
constexpr uint16 WESTKORLACHB = 360; // Caverns of the Lost
constexpr uint16 WESTKORLACHC = 361; // Lair of the Korlach
constexpr uint16 EASTKORLACH = 362; // The Undershore
constexpr uint16 EASTKORLACHA = 363; // Snarlstone Dens
constexpr uint16 SHADOWSPINE = 364; // Shadow Spine
constexpr uint16 CORATHUS = 365; // Corathus Creep
constexpr uint16 CORATHUSA = 366; // Sporali Caverns
constexpr uint16 CORATHUSB = 367; // The Corathus Mines
constexpr uint16 NEKTULOSA = 368; // Shadowed Grove
constexpr uint16 ARCSTONE = 369; // Arcstone, Isle of Spirits
constexpr uint16 RELIC = 370; // Relic, the Artifact City
constexpr uint16 SKYLANCE = 371; // Skylance
constexpr uint16 DEVASTATION = 372; // The Devastation
constexpr uint16 DEVASTATIONA = 373; // The Seething Wall
constexpr uint16 RAGE = 374; // Sverag, Stronghold of Rage
constexpr uint16 RAGEA = 375; // Razorthorn, Tower of Sullon Zek
constexpr uint16 TAKISHRUINS = 376; // Ruins of Takish-Hiz
constexpr uint16 TAKISHRUINSA = 377; // The Root of Ro
constexpr uint16 ELDDAR = 378; // The Elddar Forest
constexpr uint16 ELDDARA = 379; // Tunare's Shrine
constexpr uint16 THEATER = 380; // Theater of Blood
constexpr uint16 THEATERA = 381; // Deathknell, Tower of Dissonance
constexpr uint16 FREEPORTEAST = 382; // East Freeport
constexpr uint16 FREEPORTWEST = 383; // West Freeport
constexpr uint16 FREEPORTSEWERS = 384; // Freeport Sewers
constexpr uint16 FREEPORTACADEMY = 385; // Academy of Arcane Sciences
constexpr uint16 FREEPORTTEMPLE = 386; // Temple of Marr
constexpr uint16 FREEPORTMILITIA = 387; // Freeport Militia House: My Precious
constexpr uint16 FREEPORTARENA = 388; // Arena
constexpr uint16 FREEPORTCITYHALL = 389; // City Hall
constexpr uint16 FREEPORTTHEATER = 390; // Theater of the Tranquil
constexpr uint16 FREEPORTHALL = 391; // Hall of Truth: Bounty
constexpr uint16 NORTHRO = 392; // North Desert of Ro
constexpr uint16 SOUTHRO = 393; // South Desert of Ro
constexpr uint16 CRESCENT = 394; // Crescent Reach
constexpr uint16 MOORS = 395; // Blightfire Moors
constexpr uint16 STONEHIVE = 396; // Stone Hive
constexpr uint16 MESA = 397; // Goru`kar Mesa
constexpr uint16 ROOST = 398; // Blackfeather Roost
constexpr uint16 STEPPES = 399; // The Steppes
constexpr uint16 ICEFALL = 400; // Icefall Glacier
constexpr uint16 VALDEHOLM = 401; // Valdeholm
constexpr uint16 FROSTCRYPT = 402; // Frostcrypt, Throne of the Shade King
constexpr uint16 SUNDEROCK = 403; // Sunderock Springs
constexpr uint16 VERGALID = 404; // Vergalid Mines
constexpr uint16 DIREWIND = 405; // Direwind Cliffs
constexpr uint16 ASHENGATE = 406; // Ashengate, Reliquary of the Scale
constexpr uint16 HIGHPASSHOLD = 407; // Highpass Hold
constexpr uint16 COMMONLANDS = 408; // The Commonlands
constexpr uint16 OCEANOFTEARS = 409; // The Ocean of Tears
constexpr uint16 KITHFOREST = 410; // Kithicor Forest
constexpr uint16 BEFALLENB = 411; // Befallen
constexpr uint16 HIGHPASSKEEP = 412; // HighKeep
constexpr uint16 INNOTHULEB = 413; // The Innothule Swamp
constexpr uint16 TOXXULIA = 414; // Toxxulia Forest
constexpr uint16 MISTYTHICKET = 415; // The Misty Thicket
constexpr uint16 KATTACASTRUM = 416; // Katta Castrum
constexpr uint16 THALASSIUS = 417; // Thalassius, the Coral Keep
constexpr uint16 ATIIKI = 418; // Jewel of Atiiki
constexpr uint16 ZHISZA = 419; // Zhisza, the Shissar Sanctuary
constexpr uint16 SILYSSAR = 420; // Silyssar, New Chelsith
constexpr uint16 SOLTERIS = 421; // Solteris, the Throne of Ro
constexpr uint16 BARREN = 422; // Barren Coast
constexpr uint16 BURIEDSEA = 423; // The Buried Sea
constexpr uint16 JARDELSHOOK = 424; // Jardel's Hook
constexpr uint16 MONKEYROCK = 425; // Monkey Rock
constexpr uint16 SUNCREST = 426; // Suncrest Isle
constexpr uint16 DEADBONE = 427; // Deadbone Reef
constexpr uint16 BLACKSAIL = 428; // Blacksail Folly
constexpr uint16 MAIDENSGRAVE = 429; // Maiden's Grave
constexpr uint16 REDFEATHER = 430; // Redfeather Isle
constexpr uint16 SHIPMVP = 431; // The Open Sea
constexpr uint16 SHIPMVU = 432; // The Open Sea
constexpr uint16 SHIPPVU = 433; // The Open Sea
constexpr uint16 SHIPUVU = 434; // The Open Sea
constexpr uint16 SHIPMVM = 435; // The Open Sea
constexpr uint16 MECHANOTUS = 436; // Fortress Mechanotus
constexpr uint16 MANSION = 437; // Meldrath's Majestic Mansion
constexpr uint16 STEAMFACTORY = 438; // The Steam Factory
constexpr uint16 SHIPWORKSHOP = 439; // S.H.I.P. Workshop
constexpr uint16 GYROSPIREB = 440; // Gyrospire Beza
constexpr uint16 GYROSPIREZ = 441; // Gyrospire Zeka
constexpr uint16 DRAGONSCALE = 442; // Dragonscale Hills
constexpr uint16 LOPINGPLAINS = 443; // Loping Plains
constexpr uint16 HILLSOFSHADE = 444; // Hills of Shade
constexpr uint16 BLOODMOON = 445; // Bloodmoon Keep
constexpr uint16 CRYSTALLOS = 446; // Crystallos, Lair of the Awakened
constexpr uint16 GUARDIAN = 447; // The Mechamatic Guardian
constexpr uint16 STEAMFONTMTS = 448; // The Steamfont Mountains
constexpr uint16 CRYPTOFSHADE = 449; // Crypt of Shade
constexpr uint16 DRAGONSCALEB = 451; // Deepscar's Den
constexpr uint16 OLDFIELDOFBONE = 452; // Field of Scale
constexpr uint16 OLDKAESORAA = 453; // Kaesora Library
constexpr uint16 OLDKAESORAB = 454; // Kaesora Hatchery
constexpr uint16 OLDKURN = 455; // Kurn's Tower
constexpr uint16 OLDKITHICOR = 456; // Bloody Kithicor
constexpr uint16 OLDCOMMONS = 457; // Old Commonlands
constexpr uint16 OLDHIGHPASS = 458; // Highpass Hold
constexpr uint16 THEVOIDA = 459; // The Void
constexpr uint16 THEVOIDB = 460; // The Void
constexpr uint16 THEVOIDC = 461; // The Void
constexpr uint16 THEVOIDD = 462; // The Void
constexpr uint16 THEVOIDE = 463; // The Void
constexpr uint16 THEVOIDF = 464; // The Void
constexpr uint16 THEVOIDG = 465; // The Void
constexpr uint16 OCEANGREENHILLS = 466; // Oceangreen Hills
constexpr uint16 OCEANGREENVILLAGE = 467; // Oceangreen Village
constexpr uint16 OLDBLACKBURROW = 468; // BlackBurrow
constexpr uint16 BERTOXTEMPLE = 469; // Temple of Bertoxxulous
constexpr uint16 DISCORD = 470; // Korafax, Home of the Riders
constexpr uint16 DISCORDTOWER = 471; // Citadel of the Worldslayer
constexpr uint16 OLDBLOODFIELD = 472; // Old Bloodfields
constexpr uint16 PRECIPICEOFWAR = 473; // The Precipice of War
constexpr uint16 OLDDRANIK = 474; // City of Dranik
constexpr uint16 TOSKIRAKK = 475; // Toskirakk
constexpr uint16 KORASCIAN = 476; // Korascian Warrens
constexpr uint16 RATHECHAMBER = 477; // Rathe Council Chamber
constexpr uint16 BRELLSREST = 480; // Brell's Rest
constexpr uint16 FUNGALFOREST = 481; // Fungal Forest
constexpr uint16 UNDERQUARRY = 482; // The Underquarry
constexpr uint16 COOLINGCHAMBER = 483; // The Cooling Chamber
constexpr uint16 SHININGCITY = 484; // Kernagir, the Shining City
constexpr uint16 ARTHICREX = 485; // Arthicrex
constexpr uint16 FOUNDATION = 486; // The Foundation
constexpr uint16 LICHENCREEP = 487; // Lichen Creep
constexpr uint16 PELLUCID = 488; // Pellucid Grotto
constexpr uint16 STONESNAKE = 489; // Volska's Husk
constexpr uint16 BRELLSTEMPLE = 490; // Brell's Temple
constexpr uint16 CONVORTEUM = 491; // The Convorteum
constexpr uint16 BRELLSARENA = 492; // Brell's Arena
constexpr uint16 WEDDINGCHAPEL = 493; // Wedding Chapel
constexpr uint16 WEDDINGCHAPELDARK = 494; // Wedding Chapel
constexpr uint16 DRAGONCRYPT = 495; // Lair of the Risen
constexpr uint16 FEERROTT2 = 700; // The Feerrott
constexpr uint16 THULEHOUSE1 = 701; // House of Thule
constexpr uint16 THULEHOUSE2 = 702; // House of Thule, Upper Floors
constexpr uint16 HOUSEGARDEN = 703; // The Grounds
constexpr uint16 THULELIBRARY = 704; // The Library
constexpr uint16 WELL = 705; // The Well
constexpr uint16 FALLEN = 706; // Erudin Burning
constexpr uint16 MORELLCASTLE = 707; // Morell's Castle
constexpr uint16 SOMNIUM = 708; // Sanctum Somnium
constexpr uint16 ALKABORMARE = 709; // Al'Kabor's Nightmare
constexpr uint16 MIRAGULMARE = 710; // Miragul's Nightmare
constexpr uint16 THULEDREAM = 711; // Fear Itself
constexpr uint16 NEIGHBORHOOD = 712; // Sunrise Hills
constexpr uint16 ARGATH = 724; // Argath, Bastion of Illdaera
constexpr uint16 ARELIS = 725; // Valley of Lunanyn
constexpr uint16 SARITHCITY = 726; // Sarith, City of Tides
constexpr uint16 RUBAK = 727; // Rubak Oseka, Temple of the Sea
constexpr uint16 BEASTDOMAIN = 728; // Beasts' Domain
constexpr uint16 RESPLENDENT = 729; // The Resplendent Temple
constexpr uint16 PILLARSALRA = 730; // Pillars of Alra
constexpr uint16 WINDSONG = 731; // Windsong Sanctuary
constexpr uint16 CITYOFBRONZE = 732; // Erillion, City of Bronze
constexpr uint16 SEPULCHER = 733; // Sepulcher of Order
constexpr uint16 EASTSEPULCHER = 734; // Sepulcher East
constexpr uint16 WESTSEPULCHER = 735; // Sepulcher West
constexpr uint16 SHARDSLANDING = 752; // Shard's Landing
constexpr uint16 XORBB = 753; // Valley of King Xorbb
constexpr uint16 KAELSHARD = 754; // Kael Drakkel: The King's Madness
constexpr uint16 EASTWASTESSHARD = 755; // East Wastes: Zeixshi-Kar's Awakening
constexpr uint16 CRYSTALSHARD = 756; // The Crystal Caverns: Fragment of Fear
constexpr uint16 BREEDINGGROUNDS = 757; // The Breeding Grounds
constexpr uint16 EVILTREE = 758; // Evantil, the Vile Oak
constexpr uint16 GRELLETH = 759; // Grelleth's Palace, the Chateau of Filth
constexpr uint16 CHAPTERHOUSE = 760; // Chapterhouse of the Fallen
constexpr uint16 ARTTEST = 996; // Art Testing Domain
constexpr uint16 FHALLS = 998; // The Forgotten Halls
constexpr uint16 APPRENTICE = 999; // Designer Apprentice
}
//ZoneChange_Struct->success values
#define ZONE_ERROR_NOMSG 0
#define ZONE_ERROR_NOTREADY -1
@@ -438,12 +925,9 @@ static const uint8 SkillDamageTypes[EQ::skills::HIGHEST_SKILL + 1] = // change t
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
static const uint32 DB_SPELL_CAZIC_TOUCH = 982;
static const uint32 DB_SPELL_TOUCH_OF_VINITRAS = 2859;
static const uint32 DB_FACTION_GEM_CHOPPERS = 255;
static const uint32 DB_FACTION_HERETICS = 265;
static const uint32 DB_FACTION_KING_AKANON = 333;
static const uint32 DB_FACTION_GEM_CHOPPERS = 255;
static const uint32 DB_FACTION_HERETICS = 265;
static const uint32 DB_FACTION_KING_AKANON = 333;
enum ChatChannelNames : uint16
{
+99 -33
View File
@@ -860,7 +860,7 @@ static const uint32 MAX_PP_LANGUAGE = 28;
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
static const uint32 MAX_PP_INNATE_SKILL = 25;
static const uint32 MAX_PP_AA_ARRAY = 240;
static const uint32 MAX_PP_AA_ARRAY = 300;
static const uint32 MAX_GROUP_MEMBERS = 6;
static const uint32 MAX_RECAST_TYPES = 20;
@@ -2131,31 +2131,31 @@ struct AdventureLeaderboard_Struct
};*/
struct Illusion_Struct { //size: 256 - SoF
/*000*/ uint32 spawnid;
/*004*/ char charname[64]; //
/*068*/ uint16 race; //
/*070*/ char unknown006[2];
/*072*/ uint8 gender;
/*073*/ uint8 texture;
/*074*/ uint8 unknown008; //
/*075*/ uint8 unknown009; //
/*076*/ uint8 helmtexture; //
/*077*/ uint8 unknown010; //
/*078*/ uint8 unknown011; //
/*079*/ uint8 unknown012; //
/*080*/ uint32 face; //
/*084*/ uint8 hairstyle; //
/*085*/ uint8 haircolor; //
/*086*/ uint8 beard; //
/*087*/ uint8 beardcolor; //
/*088*/ float size; //
/*092*/ uint32 drakkin_heritage; //
/*096*/ uint32 drakkin_tattoo; //
/*100*/ uint32 drakkin_details; //
/*104*/ EQ::TintProfile armor_tint; //
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
/*142*/ uint8 unknown138[114]; //
/*000*/ uint32 spawnid;
/*004*/ char charname[64]; //
/*068*/ uint16 race; //
/*070*/ char unknown006[2];
/*072*/ uint8 gender;
/*073*/ uint8 texture;
/*074*/ uint8 unknown008; //
/*075*/ uint8 unknown009; //
/*076*/ uint8 helmtexture; //
/*077*/ uint8 unknown010; //
/*078*/ uint8 unknown011; //
/*079*/ uint8 unknown012; //
/*080*/ uint32 face; //
/*084*/ uint8 hairstyle; //
/*085*/ uint8 haircolor; //
/*086*/ uint8 beard; //
/*087*/ uint8 beardcolor; //
/*088*/ float size; //
/*092*/ uint32 drakkin_heritage; //
/*096*/ uint32 drakkin_tattoo; //
/*100*/ uint32 drakkin_details; //
/*104*/ EQ::TintProfile armor_tint; //
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
/*142*/ uint8 unknown138[114]; //
/*256*/
};
@@ -3714,17 +3714,66 @@ struct SetTitleReply_Struct {
uint32 entity_id;
};
struct TaskMemberList_Struct {
/*00*/ uint32 gopher_id;
/*04*/ uint32 unknown04;
/*08*/ uint32 member_count; //1 less than the number of members
/*12*/ char list_pointer[0];
struct SharedTaskMemberList_Struct {
/*00*/ uint32 gopher_id;
/*04*/ uint32 unknown04;
/*08*/ uint32 member_count; //1 less than the number of members
///*12*/ char list_pointer[0];
char member_name[1]; //null terminated string
uint32 monster_mission; // class chosen
uint8 task_leader; //boolean flag
/* list is of the form:
char member_name[1] //null terminated string
uint8 task_leader //boolean flag
*/
};
struct SharedTaskQuit_Struct {
int32 field1;
int32 field2;
int32 field3;
};
struct SharedTaskAddPlayer_Struct {
int32 field1;
int32 field2;
char player_name[64];
};
struct SharedTaskMakeLeader_Struct {
int32 field1;
int32 field2;
char player_name[64];
};
struct SharedTaskRemovePlayer_Struct {
int32 field1;
int32 field2;
char player_name[64];
};
struct SharedTaskInvite_Struct {
int32_t unknown00; // probably the unique character id sent in some packets
int32_t invite_id; // invite id sent back in response
char task_name[64];
char inviter_name[64];
};
struct SharedTaskInviteResponse_Struct {
int32_t unknown00; // 0
int32_t invite_id; // same id sent in the invite, probably for server verification
int8_t accepted; // 0: declined 1: accepted
int8_t padding[3]; // padding garbage probably
};
struct SharedTaskAccept_Struct {
int32_t unknown00;
int32_t unknown04;
uint32_t npc_entity_id; // npc task giver entity id (sent in selection window)
uint32_t task_id;
float reward_multiplier; // added after titanium (sent in selection window)
};
#if 0
// Old struct not used by Task System implementation but left for reference
@@ -3817,7 +3866,7 @@ struct TaskHistory_Struct {
#endif
struct AcceptNewTask_Struct {
uint32 unknown00;
uint32 task_type; // type sent in selection window
uint32 task_id; //set to 0 for 'decline'
uint32 task_master_id; //entity ID
};
@@ -5530,6 +5579,23 @@ struct SayLinkBodyFrame_Struct {
/*056*/
};
struct UpdateMovementEntry {
/* 00 */ float Y;
/* 04 */ float X;
/* 08 */ float Z;
/* 12 */ uint8 type;
/* 13 */ unsigned int timestamp;
/* 17 */
};
struct UnderWorld {
/* 00 */ int spawn_id;
/* 04 */ float y;
/* 08 */ float x;
/* 12 */ float z;
/* 16 */
};
// Restore structure packing to default
#pragma pack()
+83 -4
View File
@@ -22,8 +22,8 @@
#include "rulesys.h"
#include "platform.h"
#include "string_util.h"
#include "database.h"
#include "misc.h"
#include "repositories/logsys_categories_repository.h"
#include <iostream>
#include <fstream>
@@ -31,6 +31,7 @@
#include <iomanip>
#include <time.h>
#include <sys/stat.h>
#include <algorithm>
std::ofstream process_log;
@@ -96,7 +97,7 @@ EQEmuLogSys::EQEmuLogSys()
*/
EQEmuLogSys::~EQEmuLogSys() = default;
void EQEmuLogSys::LoadLogSettingsDefaults()
EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
{
/**
* Get Executable platform currently running this code (Zone/World/etc)
@@ -128,6 +129,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Cheat].log_to_console = static_cast<uint8>(Logs::General);
/**
* RFC 5424
@@ -177,6 +179,8 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformHC) {
platform_file_name = "hc";
}
return this;
}
/**
@@ -231,9 +235,11 @@ void EQEmuLogSys::ProcessGMSay(
}
/**
* Check to see if the process that actually ran this is zone
* Processes that actually support hooks
*/
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone) {
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone ||
EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld
) {
on_log_gmsay_hook(log_category, message);
}
}
@@ -601,3 +607,76 @@ void EQEmuLogSys::EnableConsoleLogging()
log_settings[log_index].is_category_enabled = 1;
}
}
EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
{
auto categories = LogsysCategoriesRepository::GetWhere(
*m_database,
"TRUE ORDER BY log_category_id"
);
// keep track of categories
std::vector<int> db_categories{};
db_categories.reserve(categories.size());
// loop through database categories
for (auto &c: categories) {
if (c.log_category_id <= Logs::None || c.log_category_id >= Logs::MaxCategoryID) {
continue;
}
log_settings[c.log_category_id].log_to_console = static_cast<uint8>(c.log_to_console);
log_settings[c.log_category_id].log_to_file = static_cast<uint8>(c.log_to_file);
log_settings[c.log_category_id].log_to_gmsay = static_cast<uint8>(c.log_to_gmsay);
// Determine if any output method is enabled for the category
// and set it to 1 so it can used to check if category is enabled
const bool log_to_console = log_settings[c.log_category_id].log_to_console > 0;
const bool log_to_file = log_settings[c.log_category_id].log_to_file > 0;
const bool log_to_gmsay = log_settings[c.log_category_id].log_to_gmsay > 0;
const bool is_category_enabled = log_to_console || log_to_file || log_to_gmsay;
if (is_category_enabled) {
log_settings[c.log_category_id].is_category_enabled = 1;
}
// This determines whether or not the process needs to actually file log anything.
// If we go through this whole loop and nothing is set to any debug level, there
// is no point to create a file or keep anything open
if (log_settings[c.log_category_id].log_to_file > 0) {
LogSys.file_logs_enabled = true;
}
db_categories.emplace_back(c.log_category_id);
}
// Auto inject categories that don't exist in the database...
for (int i = Logs::AA; i != Logs::MaxCategoryID; i++) {
if (std::find(db_categories.begin(), db_categories.end(), i) == db_categories.end()) {
LogInfo(
"Automatically adding new log category [{0}]",
Logs::LogCategoryName[i]
);
auto new_category = LogsysCategoriesRepository::NewEntity();
new_category.log_category_id = i;
new_category.log_category_description = EscapeString(Logs::LogCategoryName[i]);
new_category.log_to_console = log_settings[i].log_to_console;
new_category.log_to_gmsay = log_settings[i].log_to_gmsay;
new_category.log_to_file = log_settings[i].log_to_file;
LogsysCategoriesRepository::InsertOne(*m_database, new_category);
}
}
LogInfo("Loaded [{}] log categories", categories.size());
return this;
}
EQEmuLogSys *EQEmuLogSys::SetDatabase(Database *db)
{
m_database = db;
return this;
}
+41 -79
View File
@@ -23,8 +23,9 @@
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <cstdio>
#include <functional>
#include <algorithm>
#ifdef _WIN32
#ifdef utf16_to_utf8
@@ -37,9 +38,9 @@
namespace Logs {
enum DebugLevel {
General = 1, /* 1 - Low-Level general debugging, useful info on single line */
Moderate, /* 2 - Informational based, used in functions, when particular things load */
Detail /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */
General = 1, // 1 - Low-Level general debugging, useful info on single line
Moderate, // 2 - Informational based, used in functions, when particular things load
Detail // 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication
};
/**
@@ -121,13 +122,16 @@ namespace Logs {
Expeditions,
DynamicZones,
Scheduler,
Cheat,
ClientList,
DiaWind,
MaxCategoryID /* Don't Remove this */
};
/**
* If you add to this, make sure you update LogCategory
*/
static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
static const char *LogCategoryName[LogCategory::MaxCategoryID] = {
"",
"AA",
"AI",
@@ -201,11 +205,16 @@ namespace Logs {
"Expeditions",
"DynamicZones",
"Scheduler",
"Cheat",
"ClientList",
"DialogueWindow",
};
}
#include "eqemu_logsys_log_aliases.h"
class Database;
class EQEmuLogSys {
public:
EQEmuLogSys();
@@ -216,7 +225,8 @@ public:
* This should be handled on deconstructor but to be safe we use it anyways.
*/
void CloseFileLogs();
void LoadLogSettingsDefaults();
EQEmuLogSys *LoadLogSettingsDefaults();
EQEmuLogSys *LoadLogDatabaseSettings();
/**
* @param directory_name
@@ -246,7 +256,7 @@ public:
* Used in file logs to prepend a timestamp entry for logs
* @param time_stamp
*/
void SetCurrentTimeStamp(char* time_stamp);
void SetCurrentTimeStamp(char *time_stamp);
/**
* @param log_name
@@ -273,101 +283,53 @@ public:
/**
* Internally used memory reference for all log settings per category
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
* Database loaded via Database::LoadLogSettings(log_settings)
* Database loaded via LogSys.SetDatabase(&database)->LoadLogDatabaseSettings();
*/
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
bool file_logs_enabled = false;
/**
* Sets Executable platform (Zone/World/UCS) etc.
*/
int log_platform = 0;
int log_platform = 0;
std::string platform_file_name;
/**
* File name used in writing logs
*/
std::string platform_file_name;
/**
* GMSay Client Message colors mapped by category
*
* @param log_category
* @return
*/
// gmsay
uint16 GetGMSayColorFromCategory(uint16 log_category);
/**
* @param f
*/
void SetGMSayHandler(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
EQEmuLogSys * SetGMSayHandler(std::function<void(uint16 log_type, const std::string &)> f) {
on_log_gmsay_hook = f;
return this;
}
/**
* @param f
*/
void SetConsoleHandler(std::function<void(uint16 debug_level, uint16 log_type, const std::string&)> f) { on_log_console_hook = f; }
/**
* Silence console logging
*/
// console
void SetConsoleHandler(
std::function<void(
uint16 debug_level,
uint16 log_type,
const std::string &
)> f
) { on_log_console_hook = f; }
void SilenceConsoleLogging();
/**
* Turn on all console logging
*/
void EnableConsoleLogging();
// database
EQEmuLogSys *SetDatabase(Database *db);
private:
/**
* Callback pointer to zone process for hooking logs to zone using GMSay
*/
std::function<void(uint16 log_category, const std::string&)> on_log_gmsay_hook;
std::function<void(uint16 debug_level, uint16 log_category, const std::string&)> on_log_console_hook;
// reference to database
Database *m_database;
std::function<void(uint16 log_category, const std::string &)> on_log_gmsay_hook;
std::function<void(uint16 debug_level, uint16 log_category, const std::string &)> on_log_console_hook;
/**
* Formats log messages like '[Category] This is a log message'
*/
std::string FormatOutMessageString(uint16 log_category, const std::string &in_message);
/**
* Linux console color messages mapped by category
*
* @param log_category
* @return
*/
std::string GetLinuxConsoleColorFromCategory(uint16 log_category);
/**
* Windows console color messages mapped by category
*/
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category);
/**
* @param debug_level
* @param log_category
* @param message
*/
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message);
/**
* @param debug_level
* @param log_category
* @param message
*/
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message);
/**
* @param debug_level
* @param log_category
* @param message
*/
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message);
/**
* @param log_category
* @return
*/
bool IsRfc5424LogCategory(uint16 log_category);
};
+48
View File
@@ -646,6 +646,36 @@
OutF(LogSys, Logs::Detail, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogCheat(message, ...) do {\
if (LogSys.log_settings[Logs::Cheat].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Cheat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogCheatDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Cheat].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Cheat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogClientList(message, ...) do {\
if (LogSys.log_settings[Logs::ClientList].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::ClientList, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogClientListDetail(message, ...) do {\
if (LogSys.log_settings[Logs::ClientList].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::ClientList, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogDiaWind(message, ...) do {\
if (LogSys.log_settings[Logs::DiaWind].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::DiaWind, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogDiaWindDetail(message, ...) do {\
if (LogSys.log_settings[Logs::DiaWind].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::DiaWind, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@@ -1018,6 +1048,24 @@
#define LogDynamicZonesDetail(message, ...) do {\
} while (0)
#define LogCheatList(message, ...) do {\
} while (0)
#define LogCheatDetail(message, ...) do {\
} while (0)
#define LogClientList(message, ...) do {\
} while (0)
#define LogClientListDetail(message, ...) do {\
} while (0)
#define LogDiaWind(message, ...) do {\
} while (0)
#define LogDiaWindDetail(message, ...) do {\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
} while (0)
-23
View File
@@ -1,23 +0,0 @@
#include "expedition_base.h"
#include "repositories/expeditions_repository.h"
ExpeditionBase::ExpeditionBase(uint32_t id, const std::string& uuid,
const std::string& expedition_name, const DynamicZoneMember& leader
) :
m_id(id),
m_uuid(uuid),
m_expedition_name(expedition_name),
m_leader(leader)
{
}
void ExpeditionBase::LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry)
{
m_id = entry.id;
m_uuid = std::move(entry.uuid);
m_expedition_name = std::move(entry.expedition_name);
m_add_replay_on_join = entry.add_replay_on_join;
m_is_locked = entry.is_locked;
m_leader.id = entry.leader_id;
m_leader.name = std::move(entry.leader_name);
}
-40
View File
@@ -1,40 +0,0 @@
#ifndef COMMON_EXPEDITION_BASE_H
#define COMMON_EXPEDITION_BASE_H
#include "dynamic_zone_base.h"
#include "repositories/expeditions_repository.h"
#include <cstdint>
#include <string>
class ExpeditionBase
{
public:
virtual ~ExpeditionBase() = default;
ExpeditionBase(const ExpeditionBase&) = default;
ExpeditionBase(ExpeditionBase&&) = default;
ExpeditionBase& operator=(const ExpeditionBase&) = default;
ExpeditionBase& operator=(ExpeditionBase&&) = default;
uint32_t GetID() const { return m_id; }
uint32_t GetLeaderID() const { return m_leader.id; }
const std::string& GetName() const { return m_expedition_name; }
const std::string& GetLeaderName() const { return m_leader.name; }
const std::string& GetUUID() const { return m_uuid; }
const DynamicZoneMember& GetLeader() const { return m_leader; }
void LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry);
protected:
ExpeditionBase() = default;
ExpeditionBase(uint32_t id, const std::string& uuid, const std::string& expedition_name,
const DynamicZoneMember& leader);
uint32_t m_id = 0;
bool m_is_locked = false;
bool m_add_replay_on_join = true;
std::string m_uuid;
std::string m_expedition_name;
DynamicZoneMember m_leader;
};
#endif
+4 -4
View File
@@ -50,8 +50,8 @@ struct NPCFactionList {
struct FactionMods
{
int32 base;
int16 min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
int16 max; // The highest your personal earned faction can go - before race/class/diety adjustments.
int16 min; // The lowest your personal earned faction can go - before race/class/deity adjustments.
int16 max; // The highest your personal earned faction can go - before race/class/deity adjustments.
int32 class_mod;
int32 race_mod;
int32 deity_mod;
@@ -61,8 +61,8 @@ struct Faction {
int32 id;
std::map<std::string, int16> mods;
int16 base;
int16 min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
int16 max; // The highest your personal earned faction can go - before race/class/diety adjustments.
int16 min; // The lowest your personal earned faction can go - before race/class/deity adjustments.
int16 max; // The highest your personal earned faction can go - before race/class/deity adjustments.
char name[50];
};
+6518 -1549
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -190,6 +190,7 @@ namespace EQ
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value);
std::string GetCustomItemData(int16 slot_id, std::string identifier);
static int GetItemStatValue(uint32 item_id, const char* identifier);
protected:
///////////////////////////////
// Protected Methods
+16 -167
View File
@@ -21,32 +21,16 @@ EQ::Net::ServertalkClient::~ServertalkClient()
void EQ::Net::ServertalkClient::Send(uint16_t opcode, EQ::Net::Packet &p)
{
// pad zero size packets
if (p.Length() == 0) {
p.PutUInt8(0, 0);
}
EQ::Net::DynamicPacket out;
#ifdef ENABLE_SECURITY
if (m_encrypted) {
if (p.Length() == 0) {
p.PutUInt8(0, 0);
}
out.PutUInt32(0, p.Length() + crypto_secretbox_MACBYTES);
out.PutUInt16(4, opcode);
std::unique_ptr<unsigned char[]> cipher(new unsigned char[p.Length() + crypto_secretbox_MACBYTES]);
crypto_box_easy_afternm(&cipher[0], (unsigned char*)p.Data(), p.Length(), m_nonce_ours, m_shared_key);
(*(uint64_t*)&m_nonce_ours[0])++;
out.PutData(6, &cipher[0], p.Length() + crypto_secretbox_MACBYTES);
}
else {
out.PutUInt32(0, p.Length());
out.PutUInt16(4, opcode);
out.PutPacket(6, p);
}
#else
out.PutUInt32(0, p.Length());
out.PutUInt16(4, opcode);
out.PutPacket(6, p);
#endif
InternalSend(ServertalkMessage, out);
}
@@ -87,14 +71,18 @@ void EQ::Net::ServertalkClient::Connect()
m_connection = connection;
m_connection->OnDisconnect([this](EQ::Net::TCPConnection *c) {
LogF(Logs::General, Logs::TCPConnection, "Connection lost to {0}:{1}, attempting to reconnect...", m_addr, m_port);
m_encrypted = false;
m_connection.reset();
});
m_connection->OnRead(std::bind(&EQ::Net::ServertalkClient::ProcessData, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_connection->Start();
SendHello();
SendHandshake();
if (m_on_connect_cb) {
m_on_connect_cb(this);
}
m_connecting = false;
});
}
@@ -188,67 +176,11 @@ void EQ::Net::ServertalkClient::ProcessReadBuffer()
void EQ::Net::ServertalkClient::ProcessHello(EQ::Net::Packet &p)
{
#ifdef ENABLE_SECURITY
memset(m_public_key_ours, 0, crypto_box_PUBLICKEYBYTES);
memset(m_public_key_theirs, 0, crypto_box_PUBLICKEYBYTES);
memset(m_private_key_ours, 0, crypto_box_SECRETKEYBYTES);
memset(m_nonce_ours, 0, crypto_box_NONCEBYTES);
memset(m_nonce_theirs, 0, crypto_box_NONCEBYTES);
memset(m_shared_key, 0, crypto_box_BEFORENMBYTES);
m_encrypted = false;
try {
bool enc = p.GetInt8(0) == 1 ? true : false;
if (enc) {
if (p.Length() == (1 + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES)) {
memcpy(m_public_key_theirs, (char*)p.Data() + 1, crypto_box_PUBLICKEYBYTES);
memcpy(m_nonce_theirs, (char*)p.Data() + 1 + crypto_box_PUBLICKEYBYTES, crypto_box_NONCEBYTES);
m_encrypted = true;
SendHandshake();
if (m_on_connect_cb) {
m_on_connect_cb(this);
}
}
else {
LogError("Could not process hello, size != {0}", 1 + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES);
}
}
else {
SendHandshake();
if (m_on_connect_cb) {
m_on_connect_cb(this);
}
}
}
catch (std::exception &ex) {
LogError("Error parsing hello from server: {0}", ex.what());
m_connection->Disconnect();
SendHandshake();
if (m_on_connect_cb) {
m_on_connect_cb(nullptr);
}
}
#else
try {
bool enc = p.GetInt8(0) == 1 ? true : false;
if (enc) {
SendHandshake(true);
if (m_on_connect_cb) {
m_on_connect_cb(this);
}
}
else {
SendHandshake();
if (m_on_connect_cb) {
m_on_connect_cb(this);
}
m_on_connect_cb(this);
}
}
catch (std::exception &ex) {
@@ -259,7 +191,6 @@ void EQ::Net::ServertalkClient::ProcessHello(EQ::Net::Packet &p)
m_on_connect_cb(nullptr);
}
}
#endif
}
void EQ::Net::ServertalkClient::ProcessMessage(EQ::Net::Packet &p)
@@ -269,45 +200,7 @@ void EQ::Net::ServertalkClient::ProcessMessage(EQ::Net::Packet &p)
auto opcode = p.GetUInt16(4);
if (length > 0) {
auto data = p.GetString(6, length);
#ifdef ENABLE_SECURITY
if (m_encrypted) {
size_t message_len = length - crypto_secretbox_MACBYTES;
std::unique_ptr<unsigned char[]> decrypted_text(new unsigned char[message_len]);
if (crypto_box_open_easy_afternm(&decrypted_text[0], (unsigned char*)&data[0], length, m_nonce_theirs, m_shared_key))
{
LogError("Error decrypting message from server");
(*(uint64_t*)&m_nonce_theirs[0])++;
return;
}
EQ::Net::StaticPacket decrypted_packet(&decrypted_text[0], message_len);
(*(uint64_t*)&m_nonce_theirs[0])++;
auto cb = m_message_callbacks.find(opcode);
if (cb != m_message_callbacks.end()) {
cb->second(opcode, decrypted_packet);
}
if (m_message_callback) {
m_message_callback(opcode, decrypted_packet);
}
}
else {
size_t message_len = length;
EQ::Net::StaticPacket packet(&data[0], message_len);
auto cb = m_message_callbacks.find(opcode);
if (cb != m_message_callbacks.end()) {
cb->second(opcode, packet);
}
if (m_message_callback) {
m_message_callback(opcode, packet);
}
}
#else
size_t message_len = length;
EQ::Net::StaticPacket packet(&data[0], message_len);
@@ -319,7 +212,6 @@ void EQ::Net::ServertalkClient::ProcessMessage(EQ::Net::Packet &p)
if (m_message_callback) {
m_message_callback(opcode, packet);
}
#endif
}
}
catch (std::exception &ex) {
@@ -327,54 +219,11 @@ void EQ::Net::ServertalkClient::ProcessMessage(EQ::Net::Packet &p)
}
}
void EQ::Net::ServertalkClient::SendHandshake(bool downgrade)
void EQ::Net::ServertalkClient::SendHandshake()
{
EQ::Net::DynamicPacket handshake;
#ifdef ENABLE_SECURITY
if (m_encrypted) {
crypto_box_keypair(m_public_key_ours, m_private_key_ours);
randombytes_buf(m_nonce_ours, crypto_box_NONCEBYTES);
crypto_box_beforenm(m_shared_key, m_public_key_theirs, m_private_key_ours);
handshake.PutData(0, m_public_key_ours, crypto_box_PUBLICKEYBYTES);
handshake.PutData(crypto_box_PUBLICKEYBYTES, m_nonce_ours, crypto_box_NONCEBYTES);
memset(m_public_key_ours, 0, crypto_box_PUBLICKEYBYTES);
memset(m_public_key_theirs, 0, crypto_box_PUBLICKEYBYTES);
memset(m_private_key_ours, 0, crypto_box_SECRETKEYBYTES);
size_t cipher_length = m_identifier.length() + 1 + m_credentials.length() + 1 + crypto_secretbox_MACBYTES;
size_t data_length = m_identifier.length() + 1 + m_credentials.length() + 1;
std::unique_ptr<unsigned char[]> signed_buffer(new unsigned char[cipher_length]);
std::unique_ptr<unsigned char[]> data_buffer(new unsigned char[data_length]);
memset(&data_buffer[0], 0, data_length);
memcpy(&data_buffer[0], m_identifier.c_str(), m_identifier.length());
memcpy(&data_buffer[1 + m_identifier.length()], m_credentials.c_str(), m_credentials.length());
crypto_box_easy_afternm(&signed_buffer[0], &data_buffer[0], data_length, m_nonce_ours, m_shared_key);
(*(uint64_t*)&m_nonce_ours[0])++;
handshake.PutData(crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES, &signed_buffer[0], cipher_length);
}
else {
handshake.PutString(0, m_identifier);
handshake.PutString(m_identifier.length() + 1, m_credentials);
handshake.PutUInt8(m_identifier.length() + 1 + m_credentials.length(), 0);
}
#else
handshake.PutString(0, m_identifier);
handshake.PutString(m_identifier.length() + 1, m_credentials);
handshake.PutUInt8(m_identifier.length() + 1 + m_credentials.length(), 0);
#endif
if (downgrade) {
InternalSend(ServertalkClientDowngradeSecurityHandshake, handshake);
}
else {
InternalSend(ServertalkClientHandshake, handshake);
}
InternalSend(ServertalkClientDowngradeSecurityHandshake, handshake);
}
+1 -17
View File
@@ -4,9 +4,6 @@
#include "../event/timer.h"
#include "servertalk_common.h"
#include "packet.h"
#ifdef ENABLE_SECURITY
#include <sodium.h>
#endif
namespace EQ
{
@@ -34,8 +31,7 @@ namespace EQ
void ProcessReadBuffer();
void ProcessHello(EQ::Net::Packet &p);
void ProcessMessage(EQ::Net::Packet &p);
void SendHandshake() { SendHandshake(false); }
void SendHandshake(bool downgrade);
void SendHandshake();
std::unique_ptr<EQ::Timer> m_timer;
@@ -45,23 +41,11 @@ namespace EQ
bool m_connecting;
int m_port;
bool m_ipv6;
bool m_encrypted;
std::shared_ptr<EQ::Net::TCPConnection> m_connection;
std::vector<char> m_buffer;
std::unordered_map<uint16_t, std::function<void(uint16_t, EQ::Net::Packet&)>> m_message_callbacks;
std::function<void(uint16_t, EQ::Net::Packet&)> m_message_callback;
std::function<void(ServertalkClient*)> m_on_connect_cb;
#ifdef ENABLE_SECURITY
unsigned char m_public_key_ours[crypto_box_PUBLICKEYBYTES];
unsigned char m_private_key_ours[crypto_box_SECRETKEYBYTES];
unsigned char m_nonce_ours[crypto_box_NONCEBYTES];
unsigned char m_public_key_theirs[crypto_box_PUBLICKEYBYTES];
unsigned char m_nonce_theirs[crypto_box_NONCEBYTES];
unsigned char m_shared_key[crypto_box_BEFORENMBYTES];
#endif
};
}
}
+1 -1
View File
@@ -15,4 +15,4 @@ namespace EQ
ServertalkMessage,
};
}
}
}
+1 -3
View File
@@ -10,12 +10,10 @@ EQ::Net::ServertalkServer::~ServertalkServer()
void EQ::Net::ServertalkServer::Listen(const ServertalkServerOptions& opts)
{
m_encrypted = opts.encrypted;
m_credentials = opts.credentials;
m_allow_downgrade = opts.allow_downgrade;
m_server = std::make_unique<EQ::Net::TCPServer>();
m_server->Listen(opts.port, opts.ipv6, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
m_unident_connections.push_back(std::make_shared<ServertalkServerConnection>(connection, this, m_encrypted, m_allow_downgrade));
m_unident_connections.push_back(std::make_shared<ServertalkServerConnection>(connection, this));
});
}
-13
View File
@@ -5,10 +5,6 @@
#include <vector>
#include <map>
#ifdef ENABLE_SECURITY
#include <sodium.h>
#endif
namespace EQ
{
namespace Net
@@ -17,18 +13,9 @@ namespace EQ
{
int port;
bool ipv6;
bool encrypted;
bool allow_downgrade;
std::string credentials;
ServertalkServerOptions() {
#ifdef ENABLE_SECURITY
encrypted = true;
allow_downgrade = true;
#else
encrypted = false;
allow_downgrade = true;
#endif
ipv6 = false;
}
};
+10 -155
View File
@@ -3,12 +3,10 @@
#include "../eqemu_logsys.h"
#include "../util/uuid.h"
EQ::Net::ServertalkServerConnection::ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, EQ::Net::ServertalkServer *parent, bool encrypted, bool allow_downgrade)
EQ::Net::ServertalkServerConnection::ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, EQ::Net::ServertalkServer *parent)
{
m_connection = c;
m_parent = parent;
m_encrypted = encrypted;
m_allow_downgrade = allow_downgrade;
m_uuid = EQ::Util::UUID::Generate().ToString();
m_connection->OnRead(std::bind(&ServertalkServerConnection::OnRead, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_connection->OnDisconnect(std::bind(&ServertalkServerConnection::OnDisconnect, this, std::placeholders::_1));
@@ -21,31 +19,16 @@ EQ::Net::ServertalkServerConnection::~ServertalkServerConnection()
void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet & p)
{
// pad zero size packets
if (p.Length() == 0) {
p.PutUInt8(0, 0);
}
EQ::Net::DynamicPacket out;
#ifdef ENABLE_SECURITY
if (m_encrypted) {
if (p.Length() == 0) {
p.PutUInt8(0, 0);
}
out.PutUInt32(0, p.Length() + crypto_secretbox_MACBYTES);
out.PutUInt16(4, opcode);
std::unique_ptr<unsigned char[]> cipher(new unsigned char[p.Length() + crypto_secretbox_MACBYTES]);
crypto_box_easy_afternm(&cipher[0], (unsigned char*)p.Data(), p.Length(), m_nonce_ours, m_shared_key);
(*(uint64_t*)&m_nonce_ours[0])++;
out.PutData(6, &cipher[0], p.Length() + crypto_secretbox_MACBYTES);
}
else {
out.PutUInt32(0, p.Length());
out.PutUInt16(4, opcode);
out.PutPacket(6, p);
}
#else
out.PutUInt32(0, p.Length());
out.PutUInt16(4, opcode);
out.PutPacket(6, p);
#endif
InternalSend(ServertalkMessage, out);
}
@@ -109,6 +92,7 @@ void EQ::Net::ServertalkServerConnection::ProcessReadBuffer()
}
break;
case ServertalkClientHandshake:
case ServertalkClientDowngradeSecurityHandshake:
ProcessHandshake(p);
break;
case ServertalkMessage:
@@ -125,10 +109,8 @@ void EQ::Net::ServertalkServerConnection::ProcessReadBuffer()
}
break;
case ServertalkClientHandshake:
ProcessHandshake(p);
break;
case ServertalkClientDowngradeSecurityHandshake:
ProcessHandshake(p, true);
ProcessHandshake(p);
break;
case ServertalkMessage:
ProcessMessage(p);
@@ -155,29 +137,7 @@ void EQ::Net::ServertalkServerConnection::OnDisconnect(TCPConnection *c)
void EQ::Net::ServertalkServerConnection::SendHello()
{
EQ::Net::DynamicPacket hello;
#ifdef ENABLE_SECURITY
memset(m_public_key_ours, 0, crypto_box_PUBLICKEYBYTES);
memset(m_public_key_theirs, 0, crypto_box_PUBLICKEYBYTES);
memset(m_private_key_ours, 0, crypto_box_SECRETKEYBYTES);
memset(m_nonce_ours, 0, crypto_box_NONCEBYTES);
memset(m_nonce_theirs, 0, crypto_box_NONCEBYTES);
if (m_encrypted) {
hello.PutInt8(0, 1);
crypto_box_keypair(m_public_key_ours, m_private_key_ours);
randombytes_buf(m_nonce_ours, crypto_box_NONCEBYTES);
hello.PutData(1, m_public_key_ours, crypto_box_PUBLICKEYBYTES);
hello.PutData(1 + crypto_box_PUBLICKEYBYTES, m_nonce_ours, crypto_box_NONCEBYTES);
}
else {
hello.PutInt8(0, 0);
}
#else
hello.PutInt8(0, 0);
#endif
InternalSend(ServertalkServerHello, hello);
}
@@ -197,71 +157,8 @@ void EQ::Net::ServertalkServerConnection::InternalSend(ServertalkPacketType type
m_connection->Write((const char*)out.Data(), out.Length());
}
void EQ::Net::ServertalkServerConnection::ProcessHandshake(EQ::Net::Packet &p, bool downgrade_security)
void EQ::Net::ServertalkServerConnection::ProcessHandshake(EQ::Net::Packet &p)
{
#ifdef ENABLE_SECURITY
if (downgrade_security && m_allow_downgrade && m_encrypted) {
LogF(Logs::General, Logs::TCPConnection, "Downgraded encrypted connection to plaintext because otherside didn't support encryption {0}:{1}",
m_connection->RemoteIP(), m_connection->RemotePort());
m_encrypted = false;
}
if (m_encrypted) {
try {
if (p.Length() > (crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES)) {
memcpy(m_public_key_theirs, (char*)p.Data(), crypto_box_PUBLICKEYBYTES);
memcpy(m_nonce_theirs, (char*)p.Data() + crypto_box_PUBLICKEYBYTES, crypto_box_NONCEBYTES);
crypto_box_beforenm(m_shared_key, m_public_key_theirs, m_private_key_ours);
size_t cipher_len = p.Length() - crypto_box_PUBLICKEYBYTES - crypto_box_NONCEBYTES;
size_t message_len = cipher_len - crypto_secretbox_MACBYTES;
std::unique_ptr<unsigned char[]> decrypted_text(new unsigned char[message_len]);
if (crypto_box_open_easy_afternm(&decrypted_text[0], (unsigned char*)p.Data() + crypto_box_PUBLICKEYBYTES + crypto_box_NONCEBYTES, cipher_len, m_nonce_theirs, m_shared_key))
{
LogError("Error decrypting handshake from client, dropping connection.");
m_connection->Disconnect();
return;
}
m_identifier = (const char*)&decrypted_text[0];
std::string credentials = (const char*)&decrypted_text[0] + (m_identifier.length() + 1);
if (!m_parent->CheckCredentials(credentials)) {
LogError("Got incoming connection with invalid credentials during handshake, dropping connection.");
m_connection->Disconnect();
return;
}
m_parent->ConnectionIdentified(this);
(*(uint64_t*)&m_nonce_theirs[0])++;
}
}
catch (std::exception &ex) {
LogError("Error parsing handshake from client: {0}", ex.what());
m_connection->Disconnect();
}
}
else {
try {
m_identifier = p.GetCString(0);
auto credentials = p.GetCString(m_identifier.length() + 1);
if (!m_parent->CheckCredentials(credentials)) {
LogError("Got incoming connection with invalid credentials during handshake, dropping connection.");
m_connection->Disconnect();
return;
}
m_parent->ConnectionIdentified(this);
}
catch (std::exception &ex) {
LogError("Error parsing handshake from client: {0}", ex.what());
m_connection->Disconnect();
}
}
#else
try {
m_identifier = p.GetCString(0);
auto credentials = p.GetCString(m_identifier.length() + 1);
@@ -278,7 +175,6 @@ void EQ::Net::ServertalkServerConnection::ProcessHandshake(EQ::Net::Packet &p, b
LogError("Error parsing handshake from client: {0}", ex.what());
m_connection->Disconnect();
}
#endif
}
void EQ::Net::ServertalkServerConnection::ProcessMessage(EQ::Net::Packet &p)
@@ -288,46 +184,6 @@ void EQ::Net::ServertalkServerConnection::ProcessMessage(EQ::Net::Packet &p)
auto opcode = p.GetUInt16(4);
if (length > 0) {
auto data = p.GetString(6, length);
#ifdef ENABLE_SECURITY
if (m_encrypted) {
size_t message_len = length - crypto_secretbox_MACBYTES;
std::unique_ptr<unsigned char[]> decrypted_text(new unsigned char[message_len]);
if (crypto_box_open_easy_afternm(&decrypted_text[0], (unsigned char*)&data[0], length, m_nonce_theirs, m_shared_key))
{
LogError("Error decrypting message from client");
(*(uint64_t*)&m_nonce_theirs[0])++;
return;
}
EQ::Net::StaticPacket decrypted_packet(&decrypted_text[0], message_len);
(*(uint64_t*)&m_nonce_theirs[0])++;
auto cb = m_message_callbacks.find(opcode);
if (cb != m_message_callbacks.end()) {
cb->second(opcode, decrypted_packet);
}
if (m_message_callback) {
m_message_callback(opcode, decrypted_packet);
}
}
else {
size_t message_len = length;
EQ::Net::StaticPacket packet(&data[0], message_len);
auto cb = m_message_callbacks.find(opcode);
if (cb != m_message_callbacks.end()) {
cb->second(opcode, packet);
}
if (m_message_callback) {
m_message_callback(opcode, packet);
}
}
#else
size_t message_len = length;
EQ::Net::StaticPacket packet(&data[0], message_len);
@@ -339,7 +195,6 @@ void EQ::Net::ServertalkServerConnection::ProcessMessage(EQ::Net::Packet &p)
if (m_message_callback) {
m_message_callback(opcode, packet);
}
#endif
}
}
catch (std::exception &ex) {
+2 -19
View File
@@ -4,9 +4,6 @@
#include "servertalk_common.h"
#include "packet.h"
#include <vector>
#ifdef ENABLE_SECURITY
#include <sodium.h>
#endif
namespace EQ
{
@@ -16,7 +13,7 @@ namespace EQ
class ServertalkServerConnection
{
public:
ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, ServertalkServer *parent, bool encrypted, bool allow_downgrade);
ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, ServertalkServer *parent);
~ServertalkServerConnection();
void Send(uint16_t opcode, EQ::Net::Packet &p);
@@ -33,8 +30,7 @@ namespace EQ
void OnDisconnect(TCPConnection* c);
void SendHello();
void InternalSend(ServertalkPacketType type, EQ::Net::Packet &p);
void ProcessHandshake(EQ::Net::Packet &p) { ProcessHandshake(p, false); }
void ProcessHandshake(EQ::Net::Packet &p, bool security_downgrade);
void ProcessHandshake(EQ::Net::Packet &p);
void ProcessMessage(EQ::Net::Packet &p);
std::shared_ptr<EQ::Net::TCPConnection> m_connection;
@@ -45,19 +41,6 @@ namespace EQ
std::function<void(uint16_t, EQ::Net::Packet&)> m_message_callback;
std::string m_identifier;
std::string m_uuid;
bool m_encrypted;
bool m_allow_downgrade;
#ifdef ENABLE_SECURITY
unsigned char m_public_key_ours[crypto_box_PUBLICKEYBYTES];
unsigned char m_private_key_ours[crypto_box_SECRETKEYBYTES];
unsigned char m_nonce_ours[crypto_box_NONCEBYTES];
unsigned char m_public_key_theirs[crypto_box_PUBLICKEYBYTES];
unsigned char m_nonce_theirs[crypto_box_NONCEBYTES];
unsigned char m_shared_key[crypto_box_BEFORENMBYTES];
#endif
};
}
}
-9
View File
@@ -2098,15 +2098,6 @@ namespace RoF
outapp->WriteUInt32(emu->aa_array[r].charges);
}
// Fill the other 60 AAs with zeroes
for (uint32 r = 0; r < structs::MAX_PP_AA_ARRAY - MAX_PP_AA_ARRAY; r++)
{
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(structs::MAX_PP_SKILL);
for (uint32 r = 0; r < structs::MAX_PP_SKILL; r++)
-9
View File
@@ -2155,15 +2155,6 @@ namespace RoF2
outapp->WriteUInt32(emu->aa_array[r].charges);
}
// Fill the other 60 AAs with zeroes
for (uint32 r = 0; r < structs::MAX_PP_AA_ARRAY - MAX_PP_AA_ARRAY; r++)
{
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(structs::MAX_PP_SKILL);
for (uint32 r = 0; r < structs::MAX_PP_SKILL; r++)
+1 -2
View File
@@ -1504,8 +1504,7 @@ namespace SoD
OUT(item_tint.Slot[r].Color);
}
// OUT(unknown00224[48]);
//NOTE: new client supports 300 AAs, our internal rep/PP
//only supports 240..
//NOTE: new client supports 300 AAs
for (r = 0; r < MAX_PP_AA_ARRAY; r++) {
OUT(aa_array[r].AA);
OUT(aa_array[r].value);
+1 -2
View File
@@ -1172,8 +1172,7 @@ namespace SoF
OUT(item_tint.Slot[r].Color);
}
// OUT(unknown00224[48]);
//NOTE: new client supports 300 AAs, our internal rep/PP
//only supports 240..
//NOTE: new client supports 300 AAs
for (r = 0; r < MAX_PP_AA_ARRAY; r++) {
OUT(aa_array[r].AA);
OUT(aa_array[r].value);
+1 -2
View File
@@ -1734,8 +1734,7 @@ namespace UF
OUT(item_tint.Slot[r].Color);
}
// OUT(unknown00224[48]);
//NOTE: new client supports 300 AAs, our internal rep/PP
//only supports 240..
//NOTE: new client supports 300 AAs
for (r = 0; r < MAX_PP_AA_ARRAY; r++) {
eq->aa_array[r].AA = emu->aa_array[r].AA;
eq->aa_array[r].value = emu->aa_array[r].value;
+2
View File
@@ -45,6 +45,8 @@ enum : int { //values for pTimerType
pTimerLinkedSpellReuseStart = 28,
pTimerLinkedSpellReuseEnd = 48,
pTimerShieldAbility = 86,
pTimerLayHands = 87, //these IDs are used by client too
pTimerHarmTouch = 89, //so dont change them
+39 -7
View File
@@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
Copyright (C) 2001-2021 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,10 +25,24 @@
#include <iterator>
#include <type_traits>
/* This uses mt19937 seeded with the std::random_device
* The idea is to have this be included as a member of another class
* so mocking out for testing is easier
* If you need to reseed random.Reseed()
#ifdef USE_SFMT19937
// only GCC supports, so lets turn it off
#ifndef __GNUC__
#undef USE_SFMT19937
#endif
#ifdef __clang__
#undef USE_SFMT19937
#endif
#endif
#ifdef USE_ADDITIVE_LFIB_PRNG
#include "additive_lagged_fibonacci_engine.h"
#elif defined(USE_SFMT19937)
#include <ext/random>
#endif
/* This uses mt19937 (or other compatible engine) seeded with the std::random_device. The idea is to have this be
* included as a member of another class so mocking out for testing is easier If you need to reseed random.Reseed()
* Eventually this should be derived from an abstract base class
*/
@@ -40,7 +54,12 @@ namespace EQ {
{
if (low > high)
std::swap(low, high);
// EQ uses biased int distribution, so I guess we can support it :P
#ifdef BIASED_INT_DIST
return low + m_gen() % (high - low + 1);
#else
return int_dist(m_gen, int_param_t(low, high)); // [low, high]
#endif
}
// AKA old MakeRandomFloat
@@ -98,11 +117,24 @@ namespace EQ {
}
private:
#ifndef BIASED_INT_DIST
typedef std::uniform_int_distribution<int>::param_type int_param_t;
typedef std::uniform_real_distribution<double>::param_type real_param_t;
std::mt19937 m_gen;
std::uniform_int_distribution<int> int_dist;
#endif
typedef std::uniform_real_distribution<double>::param_type real_param_t;
std::uniform_real_distribution<double> real_dist;
// define USE_CUSTOM_PRNG_ENGINE to any supported random engine like:
// #define USE_CUSTOM_PRNG_ENGINE std::default_random_engine
#ifdef USE_ADDITIVE_LFIB_PRNG
EQRand
#elif defined(USE_SFMT19937)
__gnu_cxx::sfmt19937
#elif defined(USE_CUSTOM_PRNG_ENGINE)
USE_CUSTOM_PRNG_ENGINE
#else
std::mt19937
#endif
m_gen;
};
}
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -74,7 +74,7 @@ public:
entry.accid = 0;
entry.ip = "";
entry.count = 1;
entry.lastused = current_timestamp();
entry.lastused = "";
return entry;
}
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -19,7 +19,7 @@ class BaseBaseDataRepository {
public:
struct BaseData {
int level;
int class;
int class_;
float hp;
float mana;
float end;
@@ -39,7 +39,7 @@ public:
{
return {
"level",
"class",
"`class`",
"hp",
"mana",
"end",
@@ -84,7 +84,7 @@ public:
BaseData entry{};
entry.level = 0;
entry.class = 0;
entry.class_ = 0;
entry.hp = 0;
entry.mana = 0;
entry.end = 0;
@@ -129,7 +129,7 @@ public:
BaseData entry{};
entry.level = atoi(row[0]);
entry.class = atoi(row[1]);
entry.class_ = atoi(row[1]);
entry.hp = static_cast<float>(atof(row[2]));
entry.mana = static_cast<float>(atof(row[3]));
entry.end = static_cast<float>(atof(row[4]));
@@ -172,7 +172,7 @@ public:
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(base_data_entry.level));
update_values.push_back(columns[1] + " = " + std::to_string(base_data_entry.class));
update_values.push_back(columns[1] + " = " + std::to_string(base_data_entry.class_));
update_values.push_back(columns[2] + " = " + std::to_string(base_data_entry.hp));
update_values.push_back(columns[3] + " = " + std::to_string(base_data_entry.mana));
update_values.push_back(columns[4] + " = " + std::to_string(base_data_entry.end));
@@ -203,7 +203,7 @@ public:
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(base_data_entry.level));
insert_values.push_back(std::to_string(base_data_entry.class));
insert_values.push_back(std::to_string(base_data_entry.class_));
insert_values.push_back(std::to_string(base_data_entry.hp));
insert_values.push_back(std::to_string(base_data_entry.mana));
insert_values.push_back(std::to_string(base_data_entry.end));
@@ -242,7 +242,7 @@ public:
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(base_data_entry.level));
insert_values.push_back(std::to_string(base_data_entry.class));
insert_values.push_back(std::to_string(base_data_entry.class_));
insert_values.push_back(std::to_string(base_data_entry.hp));
insert_values.push_back(std::to_string(base_data_entry.mana));
insert_values.push_back(std::to_string(base_data_entry.end));
@@ -285,7 +285,7 @@ public:
BaseData entry{};
entry.level = atoi(row[0]);
entry.class = atoi(row[1]);
entry.class_ = atoi(row[1]);
entry.hp = static_cast<float>(atof(row[2]));
entry.mana = static_cast<float>(atof(row[3]));
entry.end = static_cast<float>(atof(row[4]));
@@ -319,7 +319,7 @@ public:
BaseData entry{};
entry.level = atoi(row[0]);
entry.class = atoi(row[1]);
entry.class_ = atoi(row[1]);
entry.hp = static_cast<float>(atof(row[2]));
entry.mana = static_cast<float>(atof(row[3]));
entry.end = static_cast<float>(atof(row[4]));
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -154,9 +154,9 @@ public:
entry._unknown_value = 0;
entry.bug_report = "";
entry.system_info = "";
entry.report_datetime = current_timestamp();
entry.report_datetime = "";
entry.bug_status = 0;
entry.last_review = current_timestamp();
entry.last_review = "";
entry.last_reviewer = "None";
entry.reviewer_notes = "";
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -20,7 +20,7 @@ public:
struct CharCreateCombinations {
int allocation_id;
int race;
int class;
int class_;
int deity;
int start_zone;
int expansions_req;
@@ -36,7 +36,7 @@ public:
return {
"allocation_id",
"race",
"class",
"`class`",
"deity",
"start_zone",
"expansions_req",
@@ -77,7 +77,7 @@ public:
entry.allocation_id = 0;
entry.race = 0;
entry.class = 0;
entry.class_ = 0;
entry.deity = 0;
entry.start_zone = 0;
entry.expansions_req = 0;
@@ -118,7 +118,7 @@ public:
entry.allocation_id = atoi(row[0]);
entry.race = atoi(row[1]);
entry.class = atoi(row[2]);
entry.class_ = atoi(row[2]);
entry.deity = atoi(row[3]);
entry.start_zone = atoi(row[4]);
entry.expansions_req = atoi(row[5]);
@@ -157,7 +157,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(char_create_combinations_entry.allocation_id));
update_values.push_back(columns[1] + " = " + std::to_string(char_create_combinations_entry.race));
update_values.push_back(columns[2] + " = " + std::to_string(char_create_combinations_entry.class));
update_values.push_back(columns[2] + " = " + std::to_string(char_create_combinations_entry.class_));
update_values.push_back(columns[3] + " = " + std::to_string(char_create_combinations_entry.deity));
update_values.push_back(columns[4] + " = " + std::to_string(char_create_combinations_entry.start_zone));
update_values.push_back(columns[5] + " = " + std::to_string(char_create_combinations_entry.expansions_req));
@@ -184,7 +184,7 @@ public:
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
insert_values.push_back(std::to_string(char_create_combinations_entry.class));
insert_values.push_back(std::to_string(char_create_combinations_entry.class_));
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
@@ -219,7 +219,7 @@ public:
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
insert_values.push_back(std::to_string(char_create_combinations_entry.class));
insert_values.push_back(std::to_string(char_create_combinations_entry.class_));
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
@@ -258,7 +258,7 @@ public:
entry.allocation_id = atoi(row[0]);
entry.race = atoi(row[1]);
entry.class = atoi(row[2]);
entry.class_ = atoi(row[2]);
entry.deity = atoi(row[3]);
entry.start_zone = atoi(row[4]);
entry.expansions_req = atoi(row[5]);
@@ -288,7 +288,7 @@ public:
entry.allocation_id = atoi(row[0]);
entry.race = atoi(row[1]);
entry.class = atoi(row[2]);
entry.class_ = atoi(row[2]);
entry.deity = atoi(row[3]);
entry.start_zone = atoi(row[4]);
entry.expansions_req = atoi(row[5]);
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -38,7 +38,7 @@ public:
int level;
int race;
int gender;
int class;
int class_;
int deity;
int texture;
int helm_texture;
@@ -95,7 +95,7 @@ public:
"level",
"race",
"gender",
"class",
"`class`",
"deity",
"texture",
"helm_texture",
@@ -177,7 +177,7 @@ public:
entry.level = 0;
entry.race = 0;
entry.gender = 0;
entry.class = 0;
entry.class_ = 0;
entry.deity = 0;
entry.texture = 0;
entry.helm_texture = 0;
@@ -259,7 +259,7 @@ public:
entry.level = atoi(row[17]);
entry.race = atoi(row[18]);
entry.gender = atoi(row[19]);
entry.class = atoi(row[20]);
entry.class_ = atoi(row[20]);
entry.deity = atoi(row[21]);
entry.texture = atoi(row[22]);
entry.helm_texture = atoi(row[23]);
@@ -338,7 +338,7 @@ public:
update_values.push_back(columns[17] + " = " + std::to_string(character_corpses_entry.level));
update_values.push_back(columns[18] + " = " + std::to_string(character_corpses_entry.race));
update_values.push_back(columns[19] + " = " + std::to_string(character_corpses_entry.gender));
update_values.push_back(columns[20] + " = " + std::to_string(character_corpses_entry.class));
update_values.push_back(columns[20] + " = " + std::to_string(character_corpses_entry.class_));
update_values.push_back(columns[21] + " = " + std::to_string(character_corpses_entry.deity));
update_values.push_back(columns[22] + " = " + std::to_string(character_corpses_entry.texture));
update_values.push_back(columns[23] + " = " + std::to_string(character_corpses_entry.helm_texture));
@@ -406,7 +406,7 @@ public:
insert_values.push_back(std::to_string(character_corpses_entry.level));
insert_values.push_back(std::to_string(character_corpses_entry.race));
insert_values.push_back(std::to_string(character_corpses_entry.gender));
insert_values.push_back(std::to_string(character_corpses_entry.class));
insert_values.push_back(std::to_string(character_corpses_entry.class_));
insert_values.push_back(std::to_string(character_corpses_entry.deity));
insert_values.push_back(std::to_string(character_corpses_entry.texture));
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
@@ -482,7 +482,7 @@ public:
insert_values.push_back(std::to_string(character_corpses_entry.level));
insert_values.push_back(std::to_string(character_corpses_entry.race));
insert_values.push_back(std::to_string(character_corpses_entry.gender));
insert_values.push_back(std::to_string(character_corpses_entry.class));
insert_values.push_back(std::to_string(character_corpses_entry.class_));
insert_values.push_back(std::to_string(character_corpses_entry.deity));
insert_values.push_back(std::to_string(character_corpses_entry.texture));
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
@@ -562,7 +562,7 @@ public:
entry.level = atoi(row[17]);
entry.race = atoi(row[18]);
entry.gender = atoi(row[19]);
entry.class = atoi(row[20]);
entry.class_ = atoi(row[20]);
entry.deity = atoi(row[21]);
entry.texture = atoi(row[22]);
entry.helm_texture = atoi(row[23]);
@@ -633,7 +633,7 @@ public:
entry.level = atoi(row[17]);
entry.race = atoi(row[18]);
entry.gender = atoi(row[19]);
entry.class = atoi(row[20]);
entry.class_ = atoi(row[20]);
entry.deity = atoi(row[21]);
entry.texture = atoi(row[22]);
entry.helm_texture = atoi(row[23]);
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -32,7 +32,7 @@ public:
float heading;
int gender;
int race;
int class;
int class_;
int level;
int deity;
int birthday;
@@ -72,7 +72,7 @@ public:
int sta;
int cha;
int dex;
int int;
int int_;
int agi;
int wis;
int zone_change_count;
@@ -144,7 +144,7 @@ public:
"heading",
"gender",
"race",
"class",
"`class`",
"level",
"deity",
"birthday",
@@ -184,7 +184,7 @@ public:
"sta",
"cha",
"dex",
"int",
"`int`",
"agi",
"wis",
"zone_change_count",
@@ -281,7 +281,7 @@ public:
entry.heading = 0;
entry.gender = 0;
entry.race = 0;
entry.class = 0;
entry.class_ = 0;
entry.level = 0;
entry.deity = 0;
entry.birthday = 0;
@@ -321,7 +321,7 @@ public:
entry.sta = 0;
entry.cha = 0;
entry.dex = 0;
entry.int = 0;
entry.int_ = 0;
entry.agi = 0;
entry.wis = 0;
entry.zone_change_count = 0;
@@ -368,7 +368,7 @@ public:
entry.aa_points_spent_old = 0;
entry.aa_points_old = 0;
entry.e_last_invsnapshot = 0;
entry.deleted_at = 0;
entry.deleted_at = "";
return entry;
}
@@ -418,7 +418,7 @@ public:
entry.heading = static_cast<float>(atof(row[11]));
entry.gender = atoi(row[12]);
entry.race = atoi(row[13]);
entry.class = atoi(row[14]);
entry.class_ = atoi(row[14]);
entry.level = atoi(row[15]);
entry.deity = atoi(row[16]);
entry.birthday = atoi(row[17]);
@@ -458,7 +458,7 @@ public:
entry.sta = atoi(row[51]);
entry.cha = atoi(row[52]);
entry.dex = atoi(row[53]);
entry.int = atoi(row[54]);
entry.int_ = atoi(row[54]);
entry.agi = atoi(row[55]);
entry.wis = atoi(row[56]);
entry.zone_change_count = atoi(row[57]);
@@ -552,7 +552,7 @@ public:
update_values.push_back(columns[11] + " = " + std::to_string(character_data_entry.heading));
update_values.push_back(columns[12] + " = " + std::to_string(character_data_entry.gender));
update_values.push_back(columns[13] + " = " + std::to_string(character_data_entry.race));
update_values.push_back(columns[14] + " = " + std::to_string(character_data_entry.class));
update_values.push_back(columns[14] + " = " + std::to_string(character_data_entry.class_));
update_values.push_back(columns[15] + " = " + std::to_string(character_data_entry.level));
update_values.push_back(columns[16] + " = " + std::to_string(character_data_entry.deity));
update_values.push_back(columns[17] + " = " + std::to_string(character_data_entry.birthday));
@@ -592,7 +592,7 @@ public:
update_values.push_back(columns[51] + " = " + std::to_string(character_data_entry.sta));
update_values.push_back(columns[52] + " = " + std::to_string(character_data_entry.cha));
update_values.push_back(columns[53] + " = " + std::to_string(character_data_entry.dex));
update_values.push_back(columns[54] + " = " + std::to_string(character_data_entry.int));
update_values.push_back(columns[54] + " = " + std::to_string(character_data_entry.int_));
update_values.push_back(columns[55] + " = " + std::to_string(character_data_entry.agi));
update_values.push_back(columns[56] + " = " + std::to_string(character_data_entry.wis));
update_values.push_back(columns[57] + " = " + std::to_string(character_data_entry.zone_change_count));
@@ -675,7 +675,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.heading));
insert_values.push_back(std::to_string(character_data_entry.gender));
insert_values.push_back(std::to_string(character_data_entry.race));
insert_values.push_back(std::to_string(character_data_entry.class));
insert_values.push_back(std::to_string(character_data_entry.class_));
insert_values.push_back(std::to_string(character_data_entry.level));
insert_values.push_back(std::to_string(character_data_entry.deity));
insert_values.push_back(std::to_string(character_data_entry.birthday));
@@ -715,7 +715,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.sta));
insert_values.push_back(std::to_string(character_data_entry.cha));
insert_values.push_back(std::to_string(character_data_entry.dex));
insert_values.push_back(std::to_string(character_data_entry.int));
insert_values.push_back(std::to_string(character_data_entry.int_));
insert_values.push_back(std::to_string(character_data_entry.agi));
insert_values.push_back(std::to_string(character_data_entry.wis));
insert_values.push_back(std::to_string(character_data_entry.zone_change_count));
@@ -806,7 +806,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.heading));
insert_values.push_back(std::to_string(character_data_entry.gender));
insert_values.push_back(std::to_string(character_data_entry.race));
insert_values.push_back(std::to_string(character_data_entry.class));
insert_values.push_back(std::to_string(character_data_entry.class_));
insert_values.push_back(std::to_string(character_data_entry.level));
insert_values.push_back(std::to_string(character_data_entry.deity));
insert_values.push_back(std::to_string(character_data_entry.birthday));
@@ -846,7 +846,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.sta));
insert_values.push_back(std::to_string(character_data_entry.cha));
insert_values.push_back(std::to_string(character_data_entry.dex));
insert_values.push_back(std::to_string(character_data_entry.int));
insert_values.push_back(std::to_string(character_data_entry.int_));
insert_values.push_back(std::to_string(character_data_entry.agi));
insert_values.push_back(std::to_string(character_data_entry.wis));
insert_values.push_back(std::to_string(character_data_entry.zone_change_count));
@@ -941,7 +941,7 @@ public:
entry.heading = static_cast<float>(atof(row[11]));
entry.gender = atoi(row[12]);
entry.race = atoi(row[13]);
entry.class = atoi(row[14]);
entry.class_ = atoi(row[14]);
entry.level = atoi(row[15]);
entry.deity = atoi(row[16]);
entry.birthday = atoi(row[17]);
@@ -981,7 +981,7 @@ public:
entry.sta = atoi(row[51]);
entry.cha = atoi(row[52]);
entry.dex = atoi(row[53]);
entry.int = atoi(row[54]);
entry.int_ = atoi(row[54]);
entry.agi = atoi(row[55]);
entry.wis = atoi(row[56]);
entry.zone_change_count = atoi(row[57]);
@@ -1067,7 +1067,7 @@ public:
entry.heading = static_cast<float>(atof(row[11]));
entry.gender = atoi(row[12]);
entry.race = atoi(row[13]);
entry.class = atoi(row[14]);
entry.class_ = atoi(row[14]);
entry.level = atoi(row[15]);
entry.deity = atoi(row[16]);
entry.birthday = atoi(row[17]);
@@ -1107,7 +1107,7 @@ public:
entry.sta = atoi(row[51]);
entry.cha = atoi(row[52]);
entry.dex = atoi(row[53]);
entry.int = atoi(row[54]);
entry.int_ = atoi(row[54]);
entry.agi = atoi(row[55]);
entry.wis = atoi(row[56]);
entry.zone_change_count = atoi(row[57]);
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -0,0 +1,355 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_CHARACTER_INSTANCE_SAFERETURNS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_INSTANCE_SAFERETURNS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterInstanceSafereturnsRepository {
public:
struct CharacterInstanceSafereturns {
int id;
int character_id;
int instance_zone_id;
int instance_id;
int safe_zone_id;
float safe_x;
float safe_y;
float safe_z;
float safe_heading;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"character_id",
"instance_zone_id",
"instance_id",
"safe_zone_id",
"safe_x",
"safe_y",
"safe_z",
"safe_heading",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_instance_safereturns");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterInstanceSafereturns NewEntity()
{
CharacterInstanceSafereturns entry{};
entry.id = 0;
entry.character_id = 0;
entry.instance_zone_id = 0;
entry.instance_id = 0;
entry.safe_zone_id = 0;
entry.safe_x = 0;
entry.safe_y = 0;
entry.safe_z = 0;
entry.safe_heading = 0;
return entry;
}
static CharacterInstanceSafereturns GetCharacterInstanceSafereturnsEntry(
const std::vector<CharacterInstanceSafereturns> &character_instance_safereturnss,
int character_instance_safereturns_id
)
{
for (auto &character_instance_safereturns : character_instance_safereturnss) {
if (character_instance_safereturns.id == character_instance_safereturns_id) {
return character_instance_safereturns;
}
}
return NewEntity();
}
static CharacterInstanceSafereturns FindOne(
Database& db,
int character_instance_safereturns_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_instance_safereturns_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterInstanceSafereturns entry{};
entry.id = atoi(row[0]);
entry.character_id = atoi(row[1]);
entry.instance_zone_id = atoi(row[2]);
entry.instance_id = atoi(row[3]);
entry.safe_zone_id = atoi(row[4]);
entry.safe_x = static_cast<float>(atof(row[5]));
entry.safe_y = static_cast<float>(atof(row[6]));
entry.safe_z = static_cast<float>(atof(row[7]));
entry.safe_heading = static_cast<float>(atof(row[8]));
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_instance_safereturns_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_instance_safereturns_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterInstanceSafereturns character_instance_safereturns_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(character_instance_safereturns_entry.character_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_instance_safereturns_entry.instance_zone_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_instance_safereturns_entry.instance_id));
update_values.push_back(columns[4] + " = " + std::to_string(character_instance_safereturns_entry.safe_zone_id));
update_values.push_back(columns[5] + " = " + std::to_string(character_instance_safereturns_entry.safe_x));
update_values.push_back(columns[6] + " = " + std::to_string(character_instance_safereturns_entry.safe_y));
update_values.push_back(columns[7] + " = " + std::to_string(character_instance_safereturns_entry.safe_z));
update_values.push_back(columns[8] + " = " + std::to_string(character_instance_safereturns_entry.safe_heading));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_instance_safereturns_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterInstanceSafereturns InsertOne(
Database& db,
CharacterInstanceSafereturns character_instance_safereturns_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_instance_safereturns_entry.id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.character_id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.instance_zone_id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.instance_id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_zone_id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_x));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_y));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_z));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_heading));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_instance_safereturns_entry.id = results.LastInsertedID();
return character_instance_safereturns_entry;
}
character_instance_safereturns_entry = NewEntity();
return character_instance_safereturns_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterInstanceSafereturns> character_instance_safereturns_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_instance_safereturns_entry: character_instance_safereturns_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_instance_safereturns_entry.id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.character_id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.instance_zone_id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.instance_id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_zone_id));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_x));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_y));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_z));
insert_values.push_back(std::to_string(character_instance_safereturns_entry.safe_heading));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterInstanceSafereturns> All(Database& db)
{
std::vector<CharacterInstanceSafereturns> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterInstanceSafereturns entry{};
entry.id = atoi(row[0]);
entry.character_id = atoi(row[1]);
entry.instance_zone_id = atoi(row[2]);
entry.instance_id = atoi(row[3]);
entry.safe_zone_id = atoi(row[4]);
entry.safe_x = static_cast<float>(atof(row[5]));
entry.safe_y = static_cast<float>(atof(row[6]));
entry.safe_z = static_cast<float>(atof(row[7]));
entry.safe_heading = static_cast<float>(atof(row[8]));
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterInstanceSafereturns> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterInstanceSafereturns> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterInstanceSafereturns entry{};
entry.id = atoi(row[0]);
entry.character_id = atoi(row[1]);
entry.instance_zone_id = atoi(row[2]);
entry.instance_id = atoi(row[3]);
entry.safe_zone_id = atoi(row[4]);
entry.safe_x = static_cast<float>(atof(row[5]));
entry.safe_y = static_cast<float>(atof(row[6]));
entry.safe_z = static_cast<float>(atof(row[7]));
entry.safe_heading = static_cast<float>(atof(row[8]));
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_INSTANCE_SAFERETURNS_REPOSITORY_H
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -0,0 +1,336 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_CHARACTER_TASK_TIMERS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_TASK_TIMERS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterTaskTimersRepository {
public:
struct CharacterTaskTimers {
int id;
int character_id;
int task_id;
int timer_type;
time_t expire_time;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"character_id",
"task_id",
"timer_type",
"expire_time",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"character_id",
"task_id",
"timer_type",
"UNIX_TIMESTAMP(expire_time)",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_task_timers");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterTaskTimers NewEntity()
{
CharacterTaskTimers entry{};
entry.id = 0;
entry.character_id = 0;
entry.task_id = 0;
entry.timer_type = 0;
entry.expire_time = std::time(nullptr);
return entry;
}
static CharacterTaskTimers GetCharacterTaskTimersEntry(
const std::vector<CharacterTaskTimers> &character_task_timerss,
int character_task_timers_id
)
{
for (auto &character_task_timers : character_task_timerss) {
if (character_task_timers.id == character_task_timers_id) {
return character_task_timers;
}
}
return NewEntity();
}
static CharacterTaskTimers FindOne(
Database& db,
int character_task_timers_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_task_timers_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterTaskTimers entry{};
entry.id = atoi(row[0]);
entry.character_id = atoi(row[1]);
entry.task_id = atoi(row[2]);
entry.timer_type = atoi(row[3]);
entry.expire_time = strtoll(row[4], nullptr, 10);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_task_timers_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_task_timers_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterTaskTimers character_task_timers_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(character_task_timers_entry.character_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_task_timers_entry.task_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_task_timers_entry.timer_type));
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_task_timers_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterTaskTimers InsertOne(
Database& db,
CharacterTaskTimers character_task_timers_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_task_timers_entry.id));
insert_values.push_back(std::to_string(character_task_timers_entry.character_id));
insert_values.push_back(std::to_string(character_task_timers_entry.task_id));
insert_values.push_back(std::to_string(character_task_timers_entry.timer_type));
insert_values.push_back("FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_task_timers_entry.id = results.LastInsertedID();
return character_task_timers_entry;
}
character_task_timers_entry = NewEntity();
return character_task_timers_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterTaskTimers> character_task_timers_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_task_timers_entry: character_task_timers_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_task_timers_entry.id));
insert_values.push_back(std::to_string(character_task_timers_entry.character_id));
insert_values.push_back(std::to_string(character_task_timers_entry.task_id));
insert_values.push_back(std::to_string(character_task_timers_entry.timer_type));
insert_values.push_back("FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterTaskTimers> All(Database& db)
{
std::vector<CharacterTaskTimers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterTaskTimers entry{};
entry.id = atoi(row[0]);
entry.character_id = atoi(row[1]);
entry.task_id = atoi(row[2]);
entry.timer_type = atoi(row[3]);
entry.expire_time = strtoll(row[4], nullptr, 10);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterTaskTimers> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterTaskTimers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterTaskTimers entry{};
entry.id = atoi(row[0]);
entry.character_id = atoi(row[1]);
entry.task_id = atoi(row[2]);
entry.timer_type = atoi(row[3]);
entry.expire_time = strtoll(row[4], nullptr, 10);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_TASK_TIMERS_REPOSITORY_H
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -0,0 +1,337 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_COMPLETED_SHARED_TASK_ACTIVITY_STATE_REPOSITORY_H
#define EQEMU_BASE_COMPLETED_SHARED_TASK_ACTIVITY_STATE_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCompletedSharedTaskActivityStateRepository {
public:
struct CompletedSharedTaskActivityState {
int64 shared_task_id;
int activity_id;
int done_count;
time_t updated_time;
time_t completed_time;
};
static std::string PrimaryKey()
{
return std::string("shared_task_id");
}
static std::vector<std::string> Columns()
{
return {
"shared_task_id",
"activity_id",
"done_count",
"updated_time",
"completed_time",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"shared_task_id",
"activity_id",
"done_count",
"UNIX_TIMESTAMP(updated_time)",
"UNIX_TIMESTAMP(completed_time)",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("completed_shared_task_activity_state");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CompletedSharedTaskActivityState NewEntity()
{
CompletedSharedTaskActivityState entry{};
entry.shared_task_id = 0;
entry.activity_id = 0;
entry.done_count = 0;
entry.updated_time = 0;
entry.completed_time = 0;
return entry;
}
static CompletedSharedTaskActivityState GetCompletedSharedTaskActivityStateEntry(
const std::vector<CompletedSharedTaskActivityState> &completed_shared_task_activity_states,
int completed_shared_task_activity_state_id
)
{
for (auto &completed_shared_task_activity_state : completed_shared_task_activity_states) {
if (completed_shared_task_activity_state.shared_task_id == completed_shared_task_activity_state_id) {
return completed_shared_task_activity_state;
}
}
return NewEntity();
}
static CompletedSharedTaskActivityState FindOne(
Database& db,
int completed_shared_task_activity_state_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
completed_shared_task_activity_state_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CompletedSharedTaskActivityState entry{};
entry.shared_task_id = strtoll(row[0], nullptr, 10);
entry.activity_id = atoi(row[1]);
entry.done_count = atoi(row[2]);
entry.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int completed_shared_task_activity_state_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
completed_shared_task_activity_state_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CompletedSharedTaskActivityState completed_shared_task_activity_state_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(completed_shared_task_activity_state_entry.shared_task_id));
update_values.push_back(columns[1] + " = " + std::to_string(completed_shared_task_activity_state_entry.activity_id));
update_values.push_back(columns[2] + " = " + std::to_string(completed_shared_task_activity_state_entry.done_count));
update_values.push_back(columns[3] + " = FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.updated_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.updated_time) : "null") + ")");
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.completed_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.completed_time) : "null") + ")");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
completed_shared_task_activity_state_entry.shared_task_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CompletedSharedTaskActivityState InsertOne(
Database& db,
CompletedSharedTaskActivityState completed_shared_task_activity_state_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.shared_task_id));
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.activity_id));
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.done_count));
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.updated_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.updated_time) : "null") + ")");
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.completed_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.completed_time) : "null") + ")");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
completed_shared_task_activity_state_entry.shared_task_id = results.LastInsertedID();
return completed_shared_task_activity_state_entry;
}
completed_shared_task_activity_state_entry = NewEntity();
return completed_shared_task_activity_state_entry;
}
static int InsertMany(
Database& db,
std::vector<CompletedSharedTaskActivityState> completed_shared_task_activity_state_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &completed_shared_task_activity_state_entry: completed_shared_task_activity_state_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.shared_task_id));
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.activity_id));
insert_values.push_back(std::to_string(completed_shared_task_activity_state_entry.done_count));
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.updated_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.updated_time) : "null") + ")");
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_task_activity_state_entry.completed_time > 0 ? std::to_string(completed_shared_task_activity_state_entry.completed_time) : "null") + ")");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CompletedSharedTaskActivityState> All(Database& db)
{
std::vector<CompletedSharedTaskActivityState> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CompletedSharedTaskActivityState entry{};
entry.shared_task_id = strtoll(row[0], nullptr, 10);
entry.activity_id = atoi(row[1]);
entry.done_count = atoi(row[2]);
entry.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CompletedSharedTaskActivityState> GetWhere(Database& db, std::string where_filter)
{
std::vector<CompletedSharedTaskActivityState> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CompletedSharedTaskActivityState entry{};
entry.shared_task_id = strtoll(row[0], nullptr, 10);
entry.activity_id = atoi(row[1]);
entry.done_count = atoi(row[2]);
entry.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_COMPLETED_SHARED_TASK_ACTIVITY_STATE_REPOSITORY_H
@@ -0,0 +1,317 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_COMPLETED_SHARED_TASK_MEMBERS_REPOSITORY_H
#define EQEMU_BASE_COMPLETED_SHARED_TASK_MEMBERS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCompletedSharedTaskMembersRepository {
public:
struct CompletedSharedTaskMembers {
int64 shared_task_id;
int64 character_id;
int is_leader;
};
static std::string PrimaryKey()
{
return std::string("shared_task_id");
}
static std::vector<std::string> Columns()
{
return {
"shared_task_id",
"character_id",
"is_leader",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"shared_task_id",
"character_id",
"is_leader",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("completed_shared_task_members");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CompletedSharedTaskMembers NewEntity()
{
CompletedSharedTaskMembers entry{};
entry.shared_task_id = 0;
entry.character_id = 0;
entry.is_leader = 0;
return entry;
}
static CompletedSharedTaskMembers GetCompletedSharedTaskMembersEntry(
const std::vector<CompletedSharedTaskMembers> &completed_shared_task_memberss,
int completed_shared_task_members_id
)
{
for (auto &completed_shared_task_members : completed_shared_task_memberss) {
if (completed_shared_task_members.shared_task_id == completed_shared_task_members_id) {
return completed_shared_task_members;
}
}
return NewEntity();
}
static CompletedSharedTaskMembers FindOne(
Database& db,
int completed_shared_task_members_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
completed_shared_task_members_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CompletedSharedTaskMembers entry{};
entry.shared_task_id = strtoll(row[0], nullptr, 10);
entry.character_id = strtoll(row[1], nullptr, 10);
entry.is_leader = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int completed_shared_task_members_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
completed_shared_task_members_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CompletedSharedTaskMembers completed_shared_task_members_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(completed_shared_task_members_entry.shared_task_id));
update_values.push_back(columns[1] + " = " + std::to_string(completed_shared_task_members_entry.character_id));
update_values.push_back(columns[2] + " = " + std::to_string(completed_shared_task_members_entry.is_leader));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
completed_shared_task_members_entry.shared_task_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CompletedSharedTaskMembers InsertOne(
Database& db,
CompletedSharedTaskMembers completed_shared_task_members_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(completed_shared_task_members_entry.shared_task_id));
insert_values.push_back(std::to_string(completed_shared_task_members_entry.character_id));
insert_values.push_back(std::to_string(completed_shared_task_members_entry.is_leader));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
completed_shared_task_members_entry.shared_task_id = results.LastInsertedID();
return completed_shared_task_members_entry;
}
completed_shared_task_members_entry = NewEntity();
return completed_shared_task_members_entry;
}
static int InsertMany(
Database& db,
std::vector<CompletedSharedTaskMembers> completed_shared_task_members_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &completed_shared_task_members_entry: completed_shared_task_members_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(completed_shared_task_members_entry.shared_task_id));
insert_values.push_back(std::to_string(completed_shared_task_members_entry.character_id));
insert_values.push_back(std::to_string(completed_shared_task_members_entry.is_leader));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CompletedSharedTaskMembers> All(Database& db)
{
std::vector<CompletedSharedTaskMembers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CompletedSharedTaskMembers entry{};
entry.shared_task_id = strtoll(row[0], nullptr, 10);
entry.character_id = strtoll(row[1], nullptr, 10);
entry.is_leader = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CompletedSharedTaskMembers> GetWhere(Database& db, std::string where_filter)
{
std::vector<CompletedSharedTaskMembers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CompletedSharedTaskMembers entry{};
entry.shared_task_id = strtoll(row[0], nullptr, 10);
entry.character_id = strtoll(row[1], nullptr, 10);
entry.is_leader = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_COMPLETED_SHARED_TASK_MEMBERS_REPOSITORY_H
@@ -0,0 +1,347 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_COMPLETED_SHARED_TASKS_REPOSITORY_H
#define EQEMU_BASE_COMPLETED_SHARED_TASKS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCompletedSharedTasksRepository {
public:
struct CompletedSharedTasks {
int64 id;
int task_id;
time_t accepted_time;
time_t expire_time;
time_t completion_time;
int is_locked;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"task_id",
"accepted_time",
"expire_time",
"completion_time",
"is_locked",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"task_id",
"UNIX_TIMESTAMP(accepted_time)",
"UNIX_TIMESTAMP(expire_time)",
"UNIX_TIMESTAMP(completion_time)",
"is_locked",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("completed_shared_tasks");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CompletedSharedTasks NewEntity()
{
CompletedSharedTasks entry{};
entry.id = 0;
entry.task_id = 0;
entry.accepted_time = 0;
entry.expire_time = 0;
entry.completion_time = 0;
entry.is_locked = 0;
return entry;
}
static CompletedSharedTasks GetCompletedSharedTasksEntry(
const std::vector<CompletedSharedTasks> &completed_shared_taskss,
int completed_shared_tasks_id
)
{
for (auto &completed_shared_tasks : completed_shared_taskss) {
if (completed_shared_tasks.id == completed_shared_tasks_id) {
return completed_shared_tasks;
}
}
return NewEntity();
}
static CompletedSharedTasks FindOne(
Database& db,
int completed_shared_tasks_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
completed_shared_tasks_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CompletedSharedTasks entry{};
entry.id = strtoll(row[0], nullptr, 10);
entry.task_id = atoi(row[1]);
entry.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10);
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.is_locked = atoi(row[5]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int completed_shared_tasks_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
completed_shared_tasks_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CompletedSharedTasks completed_shared_tasks_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(completed_shared_tasks_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(completed_shared_tasks_entry.task_id));
update_values.push_back(columns[2] + " = FROM_UNIXTIME(" + (completed_shared_tasks_entry.accepted_time > 0 ? std::to_string(completed_shared_tasks_entry.accepted_time) : "null") + ")");
update_values.push_back(columns[3] + " = FROM_UNIXTIME(" + (completed_shared_tasks_entry.expire_time > 0 ? std::to_string(completed_shared_tasks_entry.expire_time) : "null") + ")");
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + (completed_shared_tasks_entry.completion_time > 0 ? std::to_string(completed_shared_tasks_entry.completion_time) : "null") + ")");
update_values.push_back(columns[5] + " = " + std::to_string(completed_shared_tasks_entry.is_locked));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
completed_shared_tasks_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CompletedSharedTasks InsertOne(
Database& db,
CompletedSharedTasks completed_shared_tasks_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(completed_shared_tasks_entry.id));
insert_values.push_back(std::to_string(completed_shared_tasks_entry.task_id));
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.accepted_time > 0 ? std::to_string(completed_shared_tasks_entry.accepted_time) : "null") + ")");
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.expire_time > 0 ? std::to_string(completed_shared_tasks_entry.expire_time) : "null") + ")");
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.completion_time > 0 ? std::to_string(completed_shared_tasks_entry.completion_time) : "null") + ")");
insert_values.push_back(std::to_string(completed_shared_tasks_entry.is_locked));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
completed_shared_tasks_entry.id = results.LastInsertedID();
return completed_shared_tasks_entry;
}
completed_shared_tasks_entry = NewEntity();
return completed_shared_tasks_entry;
}
static int InsertMany(
Database& db,
std::vector<CompletedSharedTasks> completed_shared_tasks_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &completed_shared_tasks_entry: completed_shared_tasks_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(completed_shared_tasks_entry.id));
insert_values.push_back(std::to_string(completed_shared_tasks_entry.task_id));
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.accepted_time > 0 ? std::to_string(completed_shared_tasks_entry.accepted_time) : "null") + ")");
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.expire_time > 0 ? std::to_string(completed_shared_tasks_entry.expire_time) : "null") + ")");
insert_values.push_back("FROM_UNIXTIME(" + (completed_shared_tasks_entry.completion_time > 0 ? std::to_string(completed_shared_tasks_entry.completion_time) : "null") + ")");
insert_values.push_back(std::to_string(completed_shared_tasks_entry.is_locked));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CompletedSharedTasks> All(Database& db)
{
std::vector<CompletedSharedTasks> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CompletedSharedTasks entry{};
entry.id = strtoll(row[0], nullptr, 10);
entry.task_id = atoi(row[1]);
entry.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10);
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.is_locked = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CompletedSharedTasks> GetWhere(Database& db, std::string where_filter)
{
std::vector<CompletedSharedTasks> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CompletedSharedTasks entry{};
entry.id = strtoll(row[0], nullptr, 10);
entry.task_id = atoi(row[1]);
entry.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10);
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.is_locked = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_COMPLETED_SHARED_TASKS_REPOSITORY_H
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -18,7 +18,7 @@
class BaseDataBucketsRepository {
public:
struct DataBuckets {
int id;
int64 id;
std::string key;
std::string value;
int expires;
@@ -110,7 +110,7 @@ public:
if (results.RowCount() == 1) {
DataBuckets entry{};
entry.id = atoi(row[0]);
entry.id = strtoll(row[0], NULL, 10);
entry.key = row[1] ? row[1] : "";
entry.value = row[2] ? row[2] : "";
entry.expires = atoi(row[3]);
@@ -241,7 +241,7 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
DataBuckets entry{};
entry.id = atoi(row[0]);
entry.id = strtoll(row[0], NULL, 10);
entry.key = row[1] ? row[1] : "";
entry.value = row[2] ? row[2] : "";
entry.expires = atoi(row[3]);
@@ -269,7 +269,7 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
DataBuckets entry{};
entry.id = atoi(row[0]);
entry.id = strtoll(row[0], NULL, 10);
entry.key = row[1] ? row[1] : "";
entry.value = row[2] ? row[2] : "";
entry.expires = atoi(row[3]);
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -4,7 +4,7 @@
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
@@ -53,7 +53,6 @@ public:
int max_expansion;
std::string content_flags;
std::string content_flags_disabled;
int is_instance_door;
};
static std::string PrimaryKey()
@@ -99,7 +98,6 @@ public:
"max_expansion",
"content_flags",
"content_flags_disabled",
"is_instance_door",
};
}
@@ -170,7 +168,6 @@ public:
entry.max_expansion = 0;
entry.content_flags = "";
entry.content_flags_disabled = "";
entry.is_instance_door = 0;
return entry;
}
@@ -241,7 +238,6 @@ public:
entry.max_expansion = atoi(row[32]);
entry.content_flags = row[33] ? row[33] : "";
entry.content_flags_disabled = row[34] ? row[34] : "";
entry.is_instance_door = atoi(row[35]);
return entry;
}
@@ -309,7 +305,6 @@ public:
update_values.push_back(columns[32] + " = " + std::to_string(doors_entry.max_expansion));
update_values.push_back(columns[33] + " = '" + EscapeString(doors_entry.content_flags) + "'");
update_values.push_back(columns[34] + " = '" + EscapeString(doors_entry.content_flags_disabled) + "'");
update_values.push_back(columns[35] + " = " + std::to_string(doors_entry.is_instance_door));
auto results = db.QueryDatabase(
fmt::format(
@@ -366,7 +361,6 @@ public:
insert_values.push_back(std::to_string(doors_entry.max_expansion));
insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'");
insert_values.push_back(std::to_string(doors_entry.is_instance_door));
auto results = db.QueryDatabase(
fmt::format(
@@ -431,7 +425,6 @@ public:
insert_values.push_back(std::to_string(doors_entry.max_expansion));
insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'");
insert_values.push_back(std::to_string(doors_entry.is_instance_door));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
@@ -500,7 +493,6 @@ public:
entry.max_expansion = atoi(row[32]);
entry.content_flags = row[33] ? row[33] : "";
entry.content_flags_disabled = row[34] ? row[34] : "";
entry.is_instance_door = atoi(row[35]);
all_entries.push_back(entry);
}
@@ -560,7 +552,6 @@ public:
entry.max_expansion = atoi(row[32]);
entry.content_flags = row[33] ? row[33] : "";
entry.content_flags_disabled = row[34] ? row[34] : "";
entry.is_instance_door = atoi(row[35]);
all_entries.push_back(entry);
}
@@ -21,7 +21,6 @@ public:
int id;
int dynamic_zone_id;
int character_id;
int is_current_member;
};
static std::string PrimaryKey()
@@ -35,7 +34,6 @@ public:
"id",
"dynamic_zone_id",
"character_id",
"is_current_member",
};
}
@@ -71,10 +69,9 @@ public:
{
DynamicZoneMembers entry{};
entry.id = 0;
entry.dynamic_zone_id = 0;
entry.character_id = 0;
entry.is_current_member = 1;
entry.id = 0;
entry.dynamic_zone_id = 0;
entry.character_id = 0;
return entry;
}
@@ -110,10 +107,9 @@ public:
if (results.RowCount() == 1) {
DynamicZoneMembers entry{};
entry.id = atoi(row[0]);
entry.dynamic_zone_id = atoi(row[1]);
entry.character_id = atoi(row[2]);
entry.is_current_member = atoi(row[3]);
entry.id = atoi(row[0]);
entry.dynamic_zone_id = atoi(row[1]);
entry.character_id = atoi(row[2]);
return entry;
}
@@ -149,7 +145,6 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
update_values.push_back(columns[2] + " = " + std::to_string(dynamic_zone_members_entry.character_id));
update_values.push_back(columns[3] + " = " + std::to_string(dynamic_zone_members_entry.is_current_member));
auto results = db.QueryDatabase(
fmt::format(
@@ -174,7 +169,6 @@ public:
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
insert_values.push_back(std::to_string(dynamic_zone_members_entry.is_current_member));
auto results = db.QueryDatabase(
fmt::format(
@@ -207,7 +201,6 @@ public:
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
insert_values.push_back(std::to_string(dynamic_zone_members_entry.is_current_member));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
@@ -241,10 +234,9 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
DynamicZoneMembers entry{};
entry.id = atoi(row[0]);
entry.dynamic_zone_id = atoi(row[1]);
entry.character_id = atoi(row[2]);
entry.is_current_member = atoi(row[3]);
entry.id = atoi(row[0]);
entry.dynamic_zone_id = atoi(row[1]);
entry.character_id = atoi(row[2]);
all_entries.push_back(entry);
}
@@ -269,10 +261,9 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
DynamicZoneMembers entry{};
entry.id = atoi(row[0]);
entry.dynamic_zone_id = atoi(row[1]);
entry.character_id = atoi(row[2]);
entry.is_current_member = atoi(row[3]);
entry.id = atoi(row[0]);
entry.dynamic_zone_id = atoi(row[1]);
entry.character_id = atoi(row[2]);
all_entries.push_back(entry);
}

Some files were not shown because too many files have changed in this diff Show More