Compare commits

..

1441 Commits

Author SHA1 Message Date
KimLS 3259c98a9e Rename some lua general functions to match the rest of the conventions 2021-01-23 18:12:54 -08:00
KimLS 02518cdae1 Change rules to use cat in the actual underlying variables and by extension lua exports 2021-01-22 23:52:34 -08:00
KimLS a00ab6867c Merge branch 'filtered-msg-fix' into fix-event-lua 2021-01-21 15:59:02 -08:00
KimLS f71a6bcb60 rename lua general functions to match their api names 2021-01-21 14:48:00 -08:00
KimLS 2e409f3898 Make bot rules exist even if bots are disabled to make it easier to sync the lua rules without weird ifdefs 2021-01-21 13:57:55 -08:00
KimLS e29d7f4b27 Fix for space after events 2021-01-21 13:46:32 -08:00
KimLS 4e548a588d Update opcodes for lua 2021-01-21 13:42:19 -08:00
KimLS 5ed47b5e50 Remove unused opcode that has a terrible name 2021-01-21 13:39:33 -08:00
KimLS e1e93a9a48 Missing events 2021-01-21 13:28:06 -08:00
KimLS 9c9d195ff6 Fix for filtered msg using Mob* instead of Lua_Mob in lua interface 2021-01-21 13:23:23 -08:00
Chris Miles 0f5a7e1317 Merge pull request #1173 from EQEmu/akkadius/npc-guard-scan-fix
[Bugfix] Very edge case Guard awareness latency
2021-01-04 11:38:23 -06:00
Alex bebf95cfe3 Merge pull request #1170 from splose/ww
Add #wwcast command.
2021-01-03 19:19:56 -05:00
splose 02aa4302de Merge branch 'master' into ww 2021-01-03 18:58:00 -05:00
Chris Miles b7d002dd8b Merge pull request #1171 from KinglyKrab/client_fling
Add client->Fling() to Perl/Lua.
2021-01-03 17:20:04 -06:00
Chris Miles 480e3a89df Merge pull request #1172 from KinglyKrab/target_ring
Add GetTargetRingX(), GetTargetRingY(), and GetTargetRingZ() to Lua.
2021-01-03 17:19:02 -06:00
Chris Miles 427b4db2b3 Merge pull request #1166 from fryguy503/barter-bag-bug
[Bug] Barter was allowing the purchase of bags. Bags could contain…
2021-01-03 17:18:31 -06:00
Chris Miles 306328529e Merge pull request #1169 from splose/endurance
#endurance
2021-01-03 17:18:01 -06:00
Chris Miles 0396bada96 Merge pull request #1165 from fryguy503/instrument-autoequip
[Bug] Prevent Bards from auto equip loot when using instrument
2021-01-03 17:17:08 -06:00
Chris Miles e9be7146af Merge pull request #1164 from fryguy503/group-fixes
[Bug] Fix for Group Leader Disband Issue
2021-01-03 17:13:31 -06:00
Akkadius 53bbbbba1d Add comments around close mob system [skip ci] 2021-01-03 17:07:10 -06:00
Akkadius f5817677df Only add self to others when moving 2021-01-03 16:42:34 -06:00
Akkadius 7b9d88b70b Fix a situation where guards don't scan fast enough because they stand idle, moving mobs will add themselves to guards 2021-01-03 16:40:56 -06:00
Matthew Silvia 4750768e0f Merge branch 'ww' of https://github.com/splose/Server into ww
# Conflicts:
#	zone/command.cpp
2021-01-03 13:20:01 -05:00
Matthew Silvia 90295d8dec change name 2021-01-03 13:18:33 -05:00
Matthew Silvia 6fe05bbf5e change name 2021-01-03 13:16:01 -05:00
Matthew Silvia a4d8d2261a change name 2021-01-03 13:09:09 -05:00
Evan Alexander King c58ba2e6a5 Add GetTargetRingX(), GetTargetRingY(), and GetTargetRingZ() to Lua. 2021-01-03 03:21:54 -05:00
Evan Alexander King 3fa236c2bb Add client->Fling() to Perl/Lua.
- $client->Fling(value, target_x, target_y, target_z, ignore_los, clipping) in Perl.
- client:Fling(value, target_x, target_y, target_z, ignore_los, clipping) in Lua.
2021-01-03 03:12:01 -05:00
Matthew Silvia e13346560e #ww 2021-01-02 23:24:28 -05:00
Matthew Silvia d6e29810f1 #endurance 2021-01-02 23:17:47 -05:00
Trust 29e693d443 Also added LogGroupDetail 2021-01-02 22:57:57 -05:00
Trust 7fbf522aa3 Added LogGroup to logging aliases. 2021-01-02 22:54:26 -05:00
Chris Miles 0456bef903 Merge pull request #1167 from hgtw/fix/instance-corpses
Move player corpses on instance shutdown
2021-01-02 21:31:28 -06:00
hg 6c8c81f3db Move player corpses on instance shutdown
Moves corpses to graveyard when an expired instance shuts down.
Zones without a graveyard move them to non-instance version instead.

Fixes player corpses being left inside instances that expire
before graveyards process or in instances without a graveyard
2021-01-02 19:42:18 -05:00
Trust 538092d59e Fix for incorrect slot definition. 2020-12-31 11:33:04 -05:00
Trust 789cfb2490 [REBASE] Barter was allowing the purchase of bags. Bags could contain anything and it would be traded. 2020-12-31 00:44:55 -05:00
Trust 83928fa4d0 [REBASE] Prevent Bards from auto equip loot when using instrument 2020-12-31 00:22:54 -05:00
Trust f854137ca0 [BUG] Fix for Group Leader Disband Issue
Added public/private class for oldleadername so we can save the previous leader name when the entity is destroyed then allow us to transfer leadership.

Adjusted DelmemberOOZ and in zone functions to include removal of the old leader when disbanding.
2020-12-31 00:16:27 -05:00
Chris Miles de5b7f472d Merge pull request #1163 from hgtw/feat/dz-expeditions
[Expedition / DZ] HGTW DZ / Expedition System
2020-12-30 21:16:22 -06:00
hg 33e5bd0b67 Assign db version to expedition schema 2020-12-30 18:47:59 -05:00
hg a312cd6e1d Don't sync character lockout uuid
Fixes regression that caused loot event apis to stop working
2020-12-30 18:47:33 -05:00
hg 8b2b2db848 Move offline players to dz safereturn
This is an experimental change which allows members to log in at the
safe return if they were offline when the expedition was deleted.
Prior to this they would log in at bind instead

Partially reverts commit 32c69d235d
Removed expedition members are no longer hard deleted from db
2020-12-30 18:47:33 -05:00
hg 4f9eaf7574 Sync character lockouts when entering dz
This removes the is_pending column from character lockouts table

Synchronizing character lockout timers with the expedition's when zoning
into the dynamic zone simplifies adding missing lockouts to new members.
This also matches live behavior that replaces any character lockout
timers from another expedition with ones from the current expedition
2020-12-30 18:47:32 -05:00
hg fc7d8a82e5 Sort #dz list output by dz id
Sort #dz expedition list by expedition id
2020-12-30 18:47:32 -05:00
hg 81e4bd6040 Reduce expedition member status packet updates
Only send update for expedition member status if it changes

Avoids unnecessary packets when members zone
2020-12-30 18:47:32 -05:00
hg 54a175b3ef Cleanup unused arg in remove lockout method 2020-12-30 18:47:32 -05:00
hg 738fd48163 Use id not name in dz makeleader world msg 2020-12-30 18:47:32 -05:00
hg e5916c5c03 Add rule to enable "In Dynamic Zone" status
Live doesn't appear to ever update with this status
2020-12-30 18:47:32 -05:00
hg 1de590137f Verify new expedition leader in world
Cleanup makeleader methods

World now checks if character is expedition member instead of zone
2020-12-30 18:47:32 -05:00
hg 311042f06d Add ExpeditionMember::IsValid method 2020-12-30 18:47:32 -05:00
hg 6acfc41778 Let world handle expedition leader changes
This should eliminate race conditions caused by zones trying to set
a leader when members in different zones quit at the same time

Zone still detects when leader goes offline to trigger a change
since it's easier than having world process expedition member status
updates and perform expedition lookups
2020-12-30 18:47:32 -05:00
hg 955cbeb826 Revert "Don't set member offline before linkdead"
This reverts commit 8d27602aa0.

This doesn't work because a linkdead leader coming back online will
toggle to offline state anyway
2020-12-30 18:47:32 -05:00
hg 6e9f920931 Add saylinks to #dz list output 2020-12-30 18:47:32 -05:00
hg 4ae9904822 Use strlen for perl hash key size 2020-12-30 18:47:32 -05:00
hg c0b8bfde03 Fix invalid return in perl expedition api
This was returning an invalid (garbage) hash reference for
empty results when filtering on expedition name
2020-12-30 18:47:32 -05:00
hg c09ada67d6 Add expedition lock message constants to perl 2020-12-30 18:47:32 -05:00
hg cc5dd4cd82 Add missing expedition perl api declaration 2020-12-30 18:47:32 -05:00
hg 8708564889 Don't send info packet when new member added
It isn't necessary to send this packet to current members when a new
expedition member is added. The member list packet changes the current
player count on the window
2020-12-30 18:47:32 -05:00
hg f506ce9d58 Reduce packet updates when expedition member added
This fixes unnecessary packets and compass updates being sent for
invited members and better matches live's packet update pattern

This also fixes duplicate updates being sent to the added member

Live only sends a MemberListName update for members added through a
swap (player count doesn't change). For members added through an
invite it sends expedition info and a full member list update

A full member list update is sent for both cases in this patch. This
is because MemberListName currently always adds members with status
"unknown". This is either due to unknown packet fields or a change
in future clients
2020-12-30 18:47:32 -05:00
hg 074b7096df Use fmt join for simple query strings 2020-12-30 18:47:32 -05:00
hg b46eca4ec6 Store expeditions with dz id not instance id
This exposes dynamic zone ids for any future changes and will make it
easier to preserve historic dz and expedition data. This also cleans up
some dynamic zone creation for expedition requests

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

Update #dz list commands to show dz id

Add GetDynamicZoneID and get_expedition_by_dz_id quest apis
2020-12-30 18:47:32 -05:00
hg 54500b0e72 Use column aliases for expedition request query 2020-12-30 18:47:31 -05:00
hg d2ad2ec078 Add comment to FormatName 2020-12-30 18:47:31 -05:00
hg b85feb5461 Rename expedition packet fields 2020-12-30 18:47:31 -05:00
hg 022f82291a Rename world expedition cache to state 2020-12-30 18:47:31 -05:00
hg 579c300cbc Rename expeditions table 2020-12-30 18:47:31 -05:00
hg 0f051b68ae Separate world expedition source files 2020-12-30 18:47:31 -05:00
hg 58b3708a47 Use named args in CreateExpedition lua api
This is a breaking api change

All expedition request parameters are now passed via a single table
containing hash keyed options to define values
2020-12-30 18:47:31 -05:00
hg b68994f25c Change all expedition tables to latin1
The lockout tables are latin1 to support older MySQL and MariaDB
versions that limit indexes
2020-12-30 18:47:31 -05:00
hg ad51de052c Cleanup expedition perl api croak messages 2020-12-30 18:47:31 -05:00
hg 77406d7322 Add AddReplayLockoutDuration api 2020-12-30 18:47:31 -05:00
hg 3ed7215a92 Rename character expedition lockouts table 2020-12-30 18:47:31 -05:00
hg 3a1eb51890 Send lockout times with client rounding offset
Add 60s to lockout times sent to clients. Lockout timers
are rounded down to the nearest minute when displayed

This replaces the lockout leeway rule with better behavior
2020-12-30 18:47:31 -05:00
hg ca113cdd85 Let world dispatch expedition expire warnings
This depends on C++14 remaining enabled for chrono literals
2020-12-30 18:47:31 -05:00
hg da5d4b9830 Send all members expedition expire warnings
All expedition members are notified not just those in dz

This will only work if the dz is running. It might make more sense to
move this to client or world processing so members are notified even if
the zone instance isn't running
2020-12-30 18:47:31 -05:00
hg 79287fc507 Require zone id to get expedition by instance id
This is a breaking api change
eq.get_expedition_by_instance_id(instance_id) is replaced with
eq.get_expedition_by_zone_instance(zone_id, instance_id)

This replaces the FindCachedExpeditionByInstanceID method of
obtaining expeditions via instance id with a new method that
requires the dz zone id as well
2020-12-30 18:47:31 -05:00
hg cd98b8bc6f Only send member updates after caching dz data
This fixes characters not receiving a compass if they're already
in the compass zone when an expedition is created from another zone
2020-12-30 18:47:31 -05:00
hg 18dd9e6637 Add #dz expedition unlock command
Add expedition name and zone to #dz expedition list

Adjust #dz list output
2020-12-30 18:47:31 -05:00
hg 6266aa86a4 Add perl expedition api 2020-12-30 18:47:31 -05:00
hg c26c6af356 Remove rule to verify expedition leader with db
This is a holdover from earlier system design and shouldn't be necessary
2020-12-30 18:47:11 -05:00
hg a3a6e55d22 Add lockout timer multiplier rule
This allows servers to adjust all new lockout durations added
during special events like live does
2020-12-30 18:47:11 -05:00
hg b965a165b1 Add api to update expedition expire time
Add SetSecondsRemaining method to set expire time on expedition
2020-12-30 18:47:11 -05:00
hg 2c2c2ac5ee Add api to get expedition's zone name 2020-12-30 18:47:11 -05:00
hg cbccd72050 Truncate members after conflict checks
This more accurately matches live for the new behavior introduced
in the September 16, 2020 patch. All members of a raid/group are
still checked for conflicts and the truncation is only allowed if
there are none.

It might make sense to add a rule for this since ignoring members
that would exceed the expedition max from the start makes it more
convenient to create expeditions. Members that wouldn't be added
anyway don't really need their conflicts checked.
2020-12-30 18:47:11 -05:00
hg 3db23e402c Add api to add lockout to all clients in zone 2020-12-30 18:47:11 -05:00
hg c45840173e Load dz from cache on client switchlist reply 2020-12-30 18:47:11 -05:00
hg 76b5803f83 Let MovePCDynamicZone filter on zone version
Add client GetDynamicZones method to provide a single method to get all
associated client dynamic zones

Refactor compass update and MovePCDynamicZone to use this method
instead of searching for client dzs separately

Add optional disable message arg to MovePCDynamicZone
2020-12-30 18:47:11 -05:00
hg b377fd183a Add api to add lockout duration
Also supports reducing lockout duration

Add Expedition::AddLockoutDuration

Add Client::AddExpeditionLockoutDuration

Some expeditions require adding to existing lockout durations
during progression. These add the specified seconds to individual
member lockout timers instead of setting a static duration based on
internal expedition lockout like UpdateLockoutDuration.
2020-12-30 18:47:11 -05:00
hg 8e52dd0579 Add expedition lock messages 2020-12-30 18:47:11 -05:00
hg b5db40cba6 Add GetZoneVersion to expedition api 2020-12-30 18:47:11 -05:00
hg ea34aa2030 Add group and raid api to check for lockout
Add Group and Raid method DoesAnyMemberHaveExpeditionLockout

This is required by some expeditions that perform a manual check for
custom dialogue (Ikkinz group expeditions)
2020-12-30 18:47:11 -05:00
hg 40717970ff Cleanup some expedition message formatting 2020-12-30 18:47:10 -05:00
hg 1d24432e47 Truncate expedition members to max on creation
This implements the new behavior from live's September 16, 2020
(test server's September 8, 2020) patch

Expeditions can be created even when the client's group or raid
exceeds the expedition's max player requirement. Members are added
until the max player count is reached and the rest are ignored.

Raid members are added ordered by their raid group number with
ungrouped members having the lowest priority

Rename expedition request method ValidateMembers to CanMembersJoin

Change some expedition messages to System color (live changes)
2020-12-30 18:47:10 -05:00
hg a597753bee Increase default early dz shutdown time
Increases default from 15 minutes to 25 minutes

This compensates for current default graveyard timer code. Otherwise
instances may shutdown before graveyards can process any corpses.

A better fix needs implemented later to deal with corpses inside
expired dynamic zone/instances. Zones without graveyards should move
corpses to the non-instance version and zones with graveyards should
somehow still be processed (maybe offloaded to world?)
2020-12-30 18:47:10 -05:00
hg 4d1abce084 Allow zone name in alt CreateExpedition api 2020-12-30 18:47:10 -05:00
hg f822798c63 Cleanup some vector emplacements in expeditions 2020-12-30 18:47:10 -05:00
hg 0c5bd9b338 Escape expedition and event names in queries
Fixes names that have apostrophes
2020-12-30 18:47:10 -05:00
hg 779fc6265e Load character lockouts without looping 2020-12-30 18:47:10 -05:00
hg d6ab87e2c4 Avoid world message on offline member invite
Expedition member status can be used to choose the message
2020-12-30 18:47:10 -05:00
hg 6e5ca19d18 Get dz safe return from cache not db
This was loading the dz from database to get safe return data every time
a client's dz removal timer triggered

Add the Zone::GetDynamicZone() method so zones that are dz instances can
find the data from the cache of any dz systems
2020-12-30 18:47:10 -05:00
hg fba078bbe9 Format name in expedition invite message
Live uses the original unformatted user input in invite messages, but
this doesn't seem necessary to emulate
2020-12-30 18:47:10 -05:00
hg ce19deb5d1 Add rule to always notify new expedition leader
On live, new expedition leaders are only notified if made leader from
the /dzmakeleader command (or from ui). This rule makes it so the new
leader is always messaged on a leader change for cases where previous
leader goes offline or quits
2020-12-30 18:47:10 -05:00
hg 1f3c5af996 Add #dz makeleader command 2020-12-30 18:47:10 -05:00
hg 9c4df6f026 Don't set member offline before linkdead
This prevents toggling to offline state before setting to and from
linkdead status. Without this change, a new expedition leader will be
chosen as soon as the current leader goes linkdead. On live an
expedition leader retains leadership while linkdead
2020-12-30 18:47:10 -05:00
hg d8b825f478 Fix linkdead expedition member offline update
This was leaving expedition members with linkdead status even after
the client was timed out by the server
2020-12-30 18:47:10 -05:00
hg ba9ce2335e Set new expedition leader on leader disconnect
Only choose an online member as new leader on leader changes

Keep leader online status updated in zone expedition caches

Currently this will also trigger a leader change if the leader goes
linkdead. On live the character retains leadership while linkdead
and a new one is only chosen once kicked offline
2020-12-30 18:47:10 -05:00
hg 15235d77f7 Fix regression deleting expedition from db
Set expedition's instance id NULL instead of deleting it from the
database when instances are deleted. Only expedition functions
should delete expeditions

This fixes a regression caused by removing foreign key constraints

The expedition_details row was being deleted and not the corresponding
expedition_members and expedition_lockouts rows. Any characters inside
the members table could no longer join expeditions
2020-12-30 18:47:10 -05:00
hg cb4a117503 Cleanup some expedition logging and formatting
Remove logging unsanitized input

Make unsigned comparison not compare < 0

Cleanup some FormatName and string usage. Some of these strings could
probably be moved instead

Remove unnecessary expedition lookup in a world message handler
2020-12-30 18:47:10 -05:00
hg d61879fd3c Add character id based expedition apis
Add static expedition methods to add or remove character lockouts

Add CreateLockout static helper to ExpeditionLockoutTimer

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

Fix #dz list member count
2020-12-30 18:47:10 -05:00
hg 3e373210c5 Remove dz check in expedition invite reply
Characters can no longer be re-invited while inside a dz, these checks
aren't necessary
2020-12-30 18:47:10 -05:00
hg 5a826add92 Cleanup expedition headers and unused variables
Modify some expedition and dz logging

Remove unnecessary includes in expedition sources
2020-12-30 18:47:10 -05:00
hg 3843ed6540 Don't log expired lockouts in expedition request
Removes logging of lockouts with timer under leeway rule
2020-12-30 18:47:09 -05:00
hg 184ea679f2 Refactor client cross zone message helpers
Remove extra cross zone message server opcode and struct. Existing
function already exists for normal messages

Group CZClientMessageString struct with other CZ structs
2020-12-30 18:47:09 -05:00
hg e99528fe73 Change lockout packet variable to signed 2020-12-30 18:47:09 -05:00
hg 70161aecc4 Remove fk constraints in expedition tables
Add expedition tables to database schema lists
2020-12-30 18:47:09 -05:00
hg e8d250827d Add api to update lockout duration
Some live expeditions update a lockout's duration during progression

The current AddLockout method replaces lockout timers. This updates the
expiration of an existing lockout by modifying the original duration

Only members are updated and not the internal expedition timer by
default. This is so new members receive the original duration like live
2020-12-30 18:47:09 -05:00
hg f97cc7cdec Add expedition event loot api
Add SetLootEventByNPCTypeID and SetLootEventBySpawnID quest apis

These associate events with npcs or entities inside the dz to prevent
them from being looted by characters that didn't receive the event
lockout from the current expedition.

This fixes an exploit that allowed a player that already had a lockout
from another expedition being added to loot after the event is complete
2020-12-30 18:47:09 -05:00
hg 06d84b83de Remove member history from expeditions
Expedition uuids are now used to check if characters may re-join
2020-12-30 18:47:09 -05:00
hg da2a6205ed Use replay timer uuid to allow re-invite
Instead of allowing all previous members to bypass a replay timer
conflict, only allow if expedition uuid of the lockout matches

This fixes an exploit for expeditions that add delayed replay timers.
Members could be part of an expedition on creation and then quit to form
another expedition. They could then always be re-invited to the original
expedition even with a conflicting replay timer lockout.
2020-12-30 18:47:09 -05:00
hg fa21d835d9 Store lockouts with source expedition uuid
Add Client::GetLockoutExpeditionUUID quest api

Refactor lockout update methods to take ExpeditionLockoutTimer parameter

Fix updating expedition lockout cache for multiple AddLockout calls

Fix updating lockout duration when replacing a lockout in database

Replace lockout timer inherited flags with expedition uuid comparisons

Remove is_inherited column from expedition_lockouts table
2020-12-30 18:47:09 -05:00
hg 6a7980ec75 Assign expeditions a uuid 2020-12-30 18:47:09 -05:00
hg f23ca8055f Remove replay timer argument to CreateExpedition
Breaking change to the current API

has_replay_timer column removed from expedition_details table

This argument is unnecessary and just creates confusion. Expedition
replay timers use a hardcoded name precisely for this purpose and
those lockouts are already being checked on creation requests.
2020-12-30 18:47:09 -05:00
hg 892556e26d Fix replay timer assignment to new members
Ignore expired state of replay timers when assigning to new members

This fixes a regression from a previous change that stopped assigning
expired lockouts to new members. Only expired event timers should be
ignored for new members. Replay Timers should always be added with a
a fresh lockout
2020-12-30 18:47:09 -05:00
hg 75410e8886 Don't allow expedition re-invite inside dz
Live requires characters that quit an expedition to zone out before
being re-added. This is probably to avoid exploiting max player
requirements by constantly swapping players in and out
2020-12-30 18:47:09 -05:00
hg 4af5f79328 Remove logging of expedition query failures
This is redundant with sql error logging. Logging the operations is
enough to determine the source of any errors
2020-12-30 18:47:09 -05:00
hg ea0b37b7fc Store expedition duration and times as chrono
This simplifies comparisons and reduces conversions
2020-12-30 18:47:09 -05:00
hg 006f7bf9e9 Don't remove expedition lockouts from non-members
Clients still inside a dz after being removed from an expedition
should only ever have lockouts added
2020-12-30 18:47:09 -05:00
hg 17be2bf2f7 Clear stale pending expedition lockouts
Delete pending lockouts of members on expedition creation

Delete pending lockouts when all members removed from expedition

This fixes an edge case where members could incorrectly be assigned
pending lockouts that were never cleared from the database (from a
server crash or other situation) after entering another dz.
2020-12-30 18:47:09 -05:00
hg 6165550133 Copy instead of moving expedition request data 2020-12-30 18:47:09 -05:00
hg 59d10a9db3 Process character lockout results in db methods 2020-12-30 18:47:09 -05:00
hg f287e9318e Refactor member validation in expedition requests
Small cleanup of logic and unused variables

Rename LoadValidationData to LoadMembersForCreateRequest

Remove unnecessary early string building for members query

Remove unnecessary lockout expired check for leader messages
2020-12-30 18:47:09 -05:00
hg 402491b36b Refactor expedition member online status requests
This optimizes character status requests by only sending a single
bulk request to world for characters in all expeditions instead of
sending a separate request for each expedition on zone startup
2020-12-30 18:47:09 -05:00
hg 2c4f505309 Refactor zone expedition caching
This optimizes caching all expeditions by loading dynamic zone data and
expedition members in bulk instead of for each expedition separately.
This reduces the number of queries from 1+2n to 3 total.

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

Dynamic Zone data is also loaded as a single bulk query afterwards to
simplify processing and keep dz database logic separated. It might be
worth investigating if joining dz data in the initial expeditions load
query is worth refactoring for.
2020-12-30 18:47:08 -05:00
hg f9eafa52f9 Ignore expired lockouts on expedition invite
This fixes an edge case with client invites sometimes failing because
an expired lockout hasn't been removed from client yet

Clients no longer receive expired lockouts from expeditions when joining
2020-12-30 18:47:08 -05:00
hg 4284624096 Remove expedition includes from client header
Make quest compass a vec3 to remove include dependency

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

Move ExpeditionInvite struct to zone common header

Including expedition.h in client.h just to use the ExpeditionInvite struct
is an unnecessary header dependency that increases incremental build time.
This allows expedition classes to be forward declared in client header.
2020-12-30 18:47:08 -05:00
hg 9b82cf57e4 Add #dz lockouts remove by event name 2020-12-30 18:47:08 -05:00
hg 9164073d14 Let world shutdown dz early for empty expeditions
Since world now tracks empty expeditions it can determine when to
shutdown dynamic zone instances when the rule is enabled rather than
letting zones do it.
2020-12-30 18:47:08 -05:00
hg 148af3edfc Only delete empty expeditions when the dz is empty
Zones are no longer able to delete expeditions. World now tracks empty
expeditions in cache and only deletes them when it detects an
expedition's dynamic zone instance has no more clients inside.

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

Expeditions are no longer purged from database in the world purge
instance timer to avoid a possible race with this new system
2020-12-30 18:47:08 -05:00
hg dcbcc5a156 Implement world cache to monitor expeditions
This implements a small cache in world to track expedition states.

This fixes expired expeditions being left in zone caches unless the
expedition's dz instance was running to detect it (or unless an
expedition was deleted via a client using /kickplayers). This was also
leaving clients in a ghost expedition that no longer actually existed
2020-12-30 18:47:08 -05:00
hg 33f2336244 Only draw dynamic zone compasses in non-instances
This fixes compasses being drawn in instances that use the same zone as compass

Also adds RemoveCompass method to quest api
2020-12-30 18:47:08 -05:00
hg 3f4ea66ea1 Implement expedition locking
Disables the ability to add new members

Adds Expedition::SetLocked(bool) to quest api

Adds is_locked column to expedition_details db table
2020-12-30 18:47:08 -05:00
hg 5ddb62e275 Make adding replay timers to new members optional
Not all expeditions with a replay timer lockout add it to newly
added members automatically

This adds the Expedition::SetReplayLockoutOnMemberJoin(bool) method
to the quest api so it can be disabled
2020-12-30 18:47:08 -05:00
hg a7795eda5d Change expedition tables to latin1_swedish_ci
Fixes insertion in MySQL older than 5.7.7 and MariaDB older than 10.2.2
that limit indexes to 767 bytes. This may be a temporary fix until
future refactoring
2020-12-30 18:47:08 -05:00
hg aee3e1084c Fix missing invite failure messages 2020-12-30 18:47:08 -05:00
hg 39fad0c1a0 Remove unused ExpeditionMemberStatus Lua constants 2020-12-30 18:47:08 -05:00
hg 32cc2d66dd Use stl algorithms for expedition member searches 2020-12-30 18:47:08 -05:00
hg 780cf148fa Use built-in benchmarking for expedition caching 2020-12-30 18:47:08 -05:00
hg 8c1f556f29 Rename #dz cache to #dz expedition
Add expedition's remaining dz time to expedition list

Move #dz destroy to a #dz expedition subcommand

Add success or failure messages to destroy command
2020-12-30 18:47:08 -05:00
hg c9504452e1 Add #dzkickplayers command for pre-RoF clients
Performs "/kickplayers exp" for older clients without the command
2020-12-30 18:47:07 -05:00
hg 528b74109e Only update dz expire time if reducing
Add optional UpdateExpireTime parameter

This is currently only used when an expedition becomes empty to make
dynamic zone instances shutdown earlier. For that it should only update
if new time is less than remaining time
2020-12-30 18:47:07 -05:00
hg 89c6d1e258 Send expedition re-invite to clients that zone
Moves expedition message handling in world to Expedition method
for messages that need special handling
2020-12-30 18:47:07 -05:00
hg 50f9a49911 Check for empty expedition via database not cache
Checking the cache on member removal here isn't reliable due to race
with cross zone message

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

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

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

This is better than requiring callers to manually send the update
2020-12-30 18:47:07 -05:00
hg d92c0e330d Validate expedition invite response server side
Stores expedition invite data on client
2020-12-30 18:47:07 -05:00
hg 43963783db Add instance time remaining to #dz list output 2020-12-30 18:47:07 -05:00
hg 11181190ee Add expired lockouts leeway rule
Adds a rule for leeway with expired lockouts during creation requests

The client removes lockout timers with under 60s remaining from the
window. This allows a small leeway to compensate so players don't
request an expedition that has visually hidden lockouts.
2020-12-30 18:47:07 -05:00
hg af766dd323 Move LoadAllClientLockouts back to a client method 2020-12-30 18:47:07 -05:00
hg 158dad052c Clear client expedition info if removed inside dz
Clears client expedition info immediately if removed inside dynamic zone

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

Adds client RemoveAllExpeditionLockouts methods and exposes to lua api
2020-12-30 18:47:07 -05:00
hg b116730885 Fix wrong group leader name in expedition requests
Get group leader name from Client if possible and ask database otherwise

Group::GetLeaderName() is unreliable and broken for groups formed across
zones. The correct leader name is needed here to avoid any possible
exploits with an invalid leader bypassing lockout checks.
2020-12-30 18:47:07 -05:00
hg 78eb3be127 Add option to disable expedition conflict messages
Add optional argument to CreateExpedition to disable conflict messages

Some live expeditions like anguish use a timeout to prevent excessive
leader conflict messages while still performing a creation request
2020-12-30 18:47:07 -05:00
hg 1819b7c23b Cache new expedition before sending client updates
Compass updates get data from the expedition cache so it needs to be
cached first.

Currently this doesn't affect anything because compass isn't sent to
CreateExpedition and has to be set post-creation. In the future this
will make the order of client messages more live accurate though
2020-12-30 18:47:07 -05:00
hg eccc79e4ce Let dz handle client removal timers
Remove all clients inside a dz, not just those assigned to instance
2020-12-30 18:47:07 -05:00
hg 9102bb1478 Assign lockouts to all clients inside dz
This is live like and prevents possible exploiting by dropping
expedition before a lockout. Clients will continue receiving lockouts
until they leave the zone or are kicked via timer
2020-12-30 18:47:07 -05:00
hg 8eef2ae089 Add DynamicZone class for expedition instancing
Add DynamicZone sql table schema

Add DynamicZones logging category

Modify CreateExpedition to take DynamicZone and ExpeditionRequest objects

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

Implement live-like DynamicZone instance kick timer for removed members

Implement updating multiple client compasses (supports existing quest compass)

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

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

Implement OP_DzChooseZoneReply handling

Add Lua api methods for expedition's associated dynamic zone

Add #dz list gm command to list current DynamicZone instances from database
2020-12-30 18:47:07 -05:00
hg f74605d339 Implement Lua quest api for expeditions 2020-12-30 18:47:06 -05:00
hg 7798504641 Add expeditions sql schema file 2020-12-30 18:47:06 -05:00
hg da067be2fa Implement initial expedition system
Add Expeditions logging category

Add handlers for all Dynamic Zone/Expedition related opcodes

Add FormatName string_util function to format character names

Add Zone::IsZone helper method

Add cross zone MessageString support with variable parameters

Add static Client method helpers for cross zone messaging

Add #dz gm command to debug expedition cache for current zone
2020-12-30 18:47:06 -05:00
hg a77f8b582e Update opcodes and packet structs for expeditions
Add and rename some opcodes

Add packet translations for expeditions

Fix OP_DzExpeditionEndsWarning opcode for RoF2

Add RoF2 OP_KickPlayers
2020-12-30 18:47:06 -05:00
Alex 51a74c23ef quest::getspellname() and quest::getclassname() fixes/additions. (#1158)
- Update GetSpellName() to uint16.
- Add more classes to GetClassIDName().
2020-12-30 14:47:27 -06:00
Alex c593ed6a05 Add SetRadiantCrystals() and SetEbonCrystals() to Perl/Lua. (#1159)
- Add $client->SetRadiantCrystals(value) to Perl.
- Add $client->SetEbonCrystals(value) to Perl.
- Add client:SetRadiantCrystals(value) to Lua.
- Add client:SetEbonCrystals(value) to Lua.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2020-12-30 14:46:09 -06:00
Chris Miles c1d7a82307 [DevTools] Improve DevTools Toggling Options (#1161)
* Improve devtools toggling

* Cleanup a few more references
2020-12-30 14:43:33 -06:00
Alex a920d449ff Add removeitem(item_id, quantity) to Perl/Lua. (#1156)
- Perl: quest::removeitem(item_id, quantity);
- Lua: eq.remove_item(item_id, quantity);
2020-12-29 18:21:47 -06:00
Paul Coene 21a1a7bed7 Client tracks pet sit/stand - force new pets to stand rather than use client (#1155)
Co-authored-by: Noudess <noudess@gmail.com>
2020-12-22 18:05:02 -06:00
Paul Coene 8a0f242fc6 Added RACE_BOAT_533 to IsBoat() (#1154)
Co-authored-by: Noudess <noudess@gmail.com>
2020-12-22 14:45:17 -06:00
Michael Cook (mackal) 4ec9ccae98 Merge pull request #1153 from thalix1337/master
Fix for Feature/underworld, typo in SQL
2020-12-22 12:56:09 -05:00
thalix1337 cc344ac98a Fix for Feature/underworld, typo in SQL 2020-12-22 18:06:26 +01:00
Michael Cook (mackal) 69a8507908 Feature/underworld (#1146)
* Update NewZone_Structs

* Update packet translators for NewZone_Struct

* Add OP_UnderWorld OPcodes

These aren't implemented yet, but I thought it would be good to document
them. This sends up just entity ID and location when you fall
underworld. This could possibly be used to check for someone screwing
with zone data locally to warp or something I guess.

* Add database fields
2020-12-21 17:08:04 -06:00
Thalic f87662f676 Minor ortographic corrections of ruletypes.h (#1147)
* Update ruletypes.h

* Update ruletypes.h
2020-12-21 17:07:45 -06:00
Paul Coene 1eb5e4a0c1 Remove the extra erroneous message (DoT landing message) at mob death if mob dies of DoT. (#1138)
* Removed the erroneous message of a DoT "landing" when a mob dies from that DoT

* Set spell=-1 on Death struct for NPCs.  It was causing extra DoT msg.

* Remove whitespace

Co-authored-by: Noudess <noudess@gmail.com>
2020-12-21 17:07:15 -06:00
neckkola a1cc68d214 Added new Perl/LUA GetSpellIDByBookSlot (#1151)
Added a new questAPI GetSpellIDByBookSlot to allow for sorting spellbooks by various attributes (level, type, etc).  Allows to determine which spell is in what book slot.
2020-12-21 17:06:48 -06:00
Alex c6d4d8f291 Merge pull request #1148 from noudess/waterroam
Destination check needed to be actual ground z at loc.  -15 wasnt enough
2020-12-13 16:38:55 -08:00
Noudess fff53fc465 Destination check needed to be actual ground z at loc. -15 wasnt enough 2020-12-13 10:17:04 -05:00
Chris Miles 5a4c651d6b Drone Build Pipeline (#1144)
* Create drone config

* Tweak config

* Update .drone.yml

* Garbage commit to run another build

* Bring cores down

* Fix formatting from https://github.com/EQEmu/Server/pull/1142

* Add tests line

* Change directory to build before running the unit tests

* Remove tests dir

* Avoid double build on PR's

* Testing build settings
2020-12-07 22:36:59 -06:00
Alex ff4c9e1e70 Merge pull request #1142 from noudess/waterroam
Allow water based roamboxes again.
2020-12-07 14:07:59 -08:00
Noudess 8bc60acd77 Fix so roamboxes allow water boxes again. 2020-12-07 11:10:59 -05:00
E Spause f26b3195c9 Add safeguard for issue with mobs pathing to 0,0,0 on teleport nodes with values 0,0,0 (#1140)
* IP limit and account session limit refactor - uses responses built into loginserver

* Fix an issue where teleport nodes with 0.0f as a value were added to routes when pathing.
2020-12-05 15:15:53 -06:00
Michael Cook (mackal) 31019b8832 Merge pull request #1137 from EQEmu/bug_fix/rest_timer
Save the rest_timer sooner to prevent issues
2020-11-22 14:35:24 -05:00
Michael Cook (mackal) df4ccaf970 Merge pull request #1136 from EQEmu/bug_fix/quest_reward_charges
Update the SummonItem call to default charges for QuestRewards
2020-11-22 14:08:33 -05:00
Michael Cook (mackal) eb0d12f220 Save the rest_timer sooner to prevent issues
We need to save the remaining time sooner to prevent circumstances
described here:

http://www.projecteq.net/forums/index.php?threads/raid-out-of-combat-regen-timers-resetting-on-non-raid-mobs.16114/
2020-11-17 15:47:12 -05:00
Michael Cook (mackal) 60254105f1 Update the SummonItem call to default charges for QuestRewards
This should summon the item at max charges, if it has charges
2020-11-05 19:40:04 -05:00
Akkadius 1fc4073a05 Garbage commit to push a build 2020-11-03 19:46:47 -05:00
Chris Miles be12cad7bd Fix for quest::GetZoneLongName(zone_short_name) garbled output (#1134) 2020-10-31 18:47:43 -05:00
Akkadius 25c596656c Merge branch 'master' of https://github.com/EQEmu/Server 2020-10-25 23:49:08 -05:00
Akkadius ee7ef97506 Revert "Spell Fizzle for < LDON expansions via lua_mod (#1118)"
This reverts commit e9d312fa86.
2020-10-25 23:48:57 -05:00
Chris Miles 80ce499f67 Scanning Optimizations (#1133)
* Scanning optimizations this more properly applies idle / moving scanning algorithms and applies update_others when a client is moving

* Fix bots

* Perform a self and other scan when npc's pop
2020-10-25 23:01:30 -05:00
Chris Miles 62efae2e00 SendIllusion Update Internal Values (#1130)
* Fix scenarios where quest calls to SendIllusion also update internal values so that new clients that zone in see the correct appearance

* Typo [skip ci]
2020-10-25 21:48:29 -05:00
Ali Al-Khalifa e9d312fa86 Spell Fizzle for < LDON expansions via lua_mod (#1118)
* [expansions] Create a Lua mod hook into Client::CheckFizzle()

* Added expansions_combat.lua mod stub

* Spell  Fizzle as per TAKP formula
2020-10-24 19:49:43 -05:00
Chris Miles c1c010bc8d Merge pull request #1128 from EQEmu/editmassrespawn_upd
Fix for command '#editmassrespawn'
2020-10-10 20:19:14 -05:00
Uleat f03669b8f4 Fix for command '#editmassrespawn' 2020-10-10 21:13:13 -04:00
Paul Coene b996f40016 Merge pull request #22 from EQEmu/master
Merge base back into my fork
2020-10-09 11:30:38 -04:00
Chris Miles a4a4a2266b Merge pull request #1122 from EQEmu/bug/item_loss_message
Only UF and earlier have the CORPSE_ITEM_LOST string
2020-10-06 02:30:26 -05:00
Chris Miles 82512899b2 Merge pull request #1126 from snail23/master
Compile fix on linux
2020-10-06 02:30:01 -05:00
JJ 4ac62a2ddc Merge pull request #1123 from noudess/amphibious
Allow amphibious mobs underwater to follow los and not fall to water bottom when pathing
2020-10-05 20:17:37 -04:00
Snail 1d4bea21c1 compile fix on linux (glm is using c++14 code), update CXX_STANDARD 2020-10-04 18:50:19 -04:00
Noudess d507222d21 Allow amphibious creatures to swim to next node of pathing. 2020-09-21 10:36:00 -04:00
Paul Coene 27e19900ae Merge pull request #21 from EQEmu/master
Merge from base.
2020-09-21 10:27:18 -04:00
Michael Cook (mackal) 32f4722c0f Only UF and earlier have the CORPSE_ITEM_LOST string
Let's not confuse players with missing messages I guess
2020-09-20 13:55:45 -04:00
Chris Miles 5e93746e8c Merge pull request #1119 from noudess/master
Fix bugged pet sit button and taunt.
2020-09-19 18:48:13 -05:00
Michael Cook (mackal) 1106e404c7 Merge pull request #1121 from EQEmu/bug_fix/pet_affinity_solo_fix
Fix issue where a group buff was casted on a solo player
2020-09-10 14:25:37 -04:00
KimLS 0e2c918479 Added alias to lua skills that don't start with a number so i can use them with typescript which don't allow identifiers starting with 0-9 2020-09-09 21:29:29 -07:00
Noudess 05dfe748d3 Use aabonuses.PetCommands instead of checking AA level 2020-09-08 19:10:48 -04:00
Noudess cd2b2c3c19 Fix indentation. 2020-09-08 16:48:09 -04:00
Michael Cook (mackal) 6f2b39792a Fix issue where a group buff was casted on a solo player
The pet affinity in this case was checking the caster's AAs not the
target's like it should
2020-09-08 15:57:17 -04:00
Noudess ff6de1938b Change older clients to default to taunting=true only for taunt eligble pets. 2020-09-03 15:38:35 -04:00
Noudess d5451c5d77 Remove left over logging. 2020-09-02 14:56:12 -04:00
Noudess 96fb156c47 Change Older clients to not use persistant taunt button & default to taunt on. 2020-09-02 14:50:51 -04:00
Noudess 56afa0404b Updates to fix taunt button on PET UI to match live behavior. 2020-09-02 12:50:11 -04:00
Noudess 29f7bc7a9c Fix bugged pet window sit button and pet sit based regen. 2020-08-31 13:39:42 -04:00
Paul Coene ad74af7797 Merge pull request #20 from EQEmu/master
Merge from base
2020-08-28 18:59:13 -04:00
Chris Miles 3fe0f59deb Merge pull request #1117 from EQEmu/xackery/vscode-update
changed build dir to /bin, updated peq db dump
2020-08-24 08:03:53 -05:00
Xackery Xtal ebf1cc2bc6 changed build dir to /bin, updated peq db dump 2020-08-23 18:17:23 -07:00
Akkadius 32407dbb56 Add rule Character:FinalExpMultiplier - Added on top of everything else, easy for setting EXP events 2020-08-21 01:04:18 -05:00
Chris Miles 482816058f Merge pull request #1113 from EQEmu/fix/ZonePoint_memleak
Fix memory leak for virtual zone line branch
2020-08-21 00:25:27 -05:00
Chris Miles 8ed2ea5cfe Merge pull request #1114 from noudess/patch-1
Removed duplicate code for pruning merhantlist_temp
2020-08-21 00:24:59 -05:00
Chris Miles 5d4a78fb3f Merge pull request #1112 from noudess/untargettable
Add check so that the 'u' key does not open a trade window with an untargettable mob.
2020-08-21 00:24:28 -05:00
Chris Miles ebea77e8ea Merge pull request #1115 from EQEmu/bugfix/command_task
Fix missing arg to client message in #task
2020-08-21 00:24:03 -05:00
Akkadius 51356610b2 Fix overflow issue with character corpse creation using the wrong struct in allocation 2020-08-21 00:23:13 -05:00
Michael Cook (mackal) 84a75f2a77 Fix missing arg to client message in #task 2020-08-19 17:13:28 -04:00
Paul Coene 9be5ac4ca6 Update main.cpp 2020-08-19 14:58:04 -04:00
Paul Coene b8586bf9cb Update main.cpp 2020-08-19 14:57:21 -04:00
Paul Coene 7cc23fcbeb Removed duplicate code for pruning merhantlist_temp
The code already exists, guarded by a rule.
2020-08-19 14:48:28 -04:00
Michael Cook (mackal) 539de20a11 Fix memory leak for virtual zone line branch 2020-08-18 23:32:45 -04:00
Chris Miles b57bcced40 Merge pull request #1111 from EQEmu/bug_fix/aepcv1_mobai_distance
Fix NPC AI casting of ST_AEClientV1
2020-08-18 13:21:53 -05:00
Noudess 9ab61d4ed4 Fix so an untargettable mob is not opened for trade when client pressed the 'u'
key.  Discovered this on untargettable mobs at doors.
2020-08-18 11:15:33 -04:00
Paul Coene 09e0b09649 Merge pull request #19 from EQEmu/master
merge from base
2020-08-18 10:55:21 -04:00
Michael Cook (mackal) b9f01e0d1c Merge pull request #1107 from fryguy503/percentheal_aggro
[Aggro] PercentalHeal should be included in aggro generation
2020-08-17 21:17:40 -04:00
Michael Cook (mackal) f7e997fba1 Fix NPC AI casting of ST_AEClientV1
As noted, I think we do this check incorrectly, but this should work
fine and matches other similar spells, let's get it good enough first.
2020-08-17 18:04:52 -04:00
Akkadius 78776df107 Update world content service API's to consider all expansions enabled 2020-08-16 20:04:49 -05:00
Trust bd4810351d [Aggro] PercentalHeal should be included in aggro generation
Per January 15th 2003 Patch Notes:
"NPCs will now notice Druid and Shaman Percentage Heal spells in a manner similar to traditional healing spells."

Added SE_PercetalHeal to the same CheckHealAggroAmount as SE_CurrentHP to be similar to traditional healing spells.
2020-08-16 18:32:26 -04:00
Chris Miles 0506c01103 Merge pull request #1102 from fryguy503/AERamp
[Combat] AE Ramp now allows Max Melee Range
2020-08-16 02:03:54 -05:00
Chris Miles 24a8ca39d3 Merge pull request #1100 from noudess/empty_processing
Allow quests to turn on mob processing in empty zones
2020-08-16 02:03:22 -05:00
Chris Miles ecf47a0bbb Merge pull request #1097 from SecretsOTheP/null_ptr_fixes
Null ptr fixes
2020-08-16 02:02:46 -05:00
Chris Miles 6a4a4de31c Merge pull request #1106 from EQEmu/feature/virtual-zonepoints
Add support for virtual zonepoints
2020-08-16 01:42:33 -05:00
Akkadius efdead0b0a Add expansion info 2020-08-16 01:12:30 -05:00
Akkadius e319746ca9 Typos 2020-08-16 00:16:50 -05:00
Akkadius f78828216d Add support for virtual zonepoints 2020-08-16 00:06:20 -05:00
Akkadius 9d0f7781b4 Fix compiler warnings 2020-08-15 19:03:25 -05:00
Akkadius f6e544a2e6 Merge branch 'master' of https://github.com/EQEmu/Server 2020-08-15 18:49:24 -05:00
Akkadius 3ffb5299a8 Update repositories 2020-08-15 18:28:34 -05:00
Chris Miles aeb1ce0fbe Merge pull request #1105 from EQEmu/feature/lootdrop-changes
Lootdrop Filtering Adjustments
2020-08-15 17:55:18 -05:00
Akkadius 4b764e2cc5 Set loot default log [skip ci] 2020-08-15 17:48:10 -05:00
Akkadius 45f08b4645 Cleanup some logic 2020-08-15 17:43:20 -05:00
Akkadius 0e31302a7d Add an easy way to pull item saylinks 2020-08-15 17:25:09 -05:00
Akkadius 94d87584aa Lootdrop level filtering adjustments 2020-08-15 16:37:38 -05:00
Trust 3245fa6123 [Combat] AE Ramp now allows Max Melee Range
RuleR AERampageSafeZone - Reduce AE Ramp range by this amount to allow for a small safe zone on AE Ramp.
2020-08-09 14:04:03 -04:00
Akkadius bda13383ef Revert "Merge pull request #1101 from KinglyKrab/custom"
This reverts commit 43108acae1, reversing
changes made to daa1db65b9.
2020-08-03 22:21:51 -05:00
Alex 43108acae1 Merge pull request #1101 from KinglyKrab/custom
Custom changes.
2020-08-03 23:17:37 -04:00
Alex ff7c3aff92 Custom changes. 2020-08-03 23:14:39 -04:00
Chris Miles daa1db65b9 Merge pull request #1094 from EQEmu/integration/multi-tenancy-expansions-repository
Integration/multi tenancy expansions repository
2020-07-30 22:27:58 -05:00
Chris Miles fd48912bd2 Merge pull request #1098 from EQEmu/lua_update_zone_header
Add Lua eq.update_zone_header export to lua_general.cpp.
2020-07-30 22:07:47 -05:00
Akkadius cfa3e88bb2 Add command #gearup as a fairly decent start to a expansion specific way of gearing up a GM test character 2020-07-30 21:10:15 -05:00
Noudess 8e7591cd4b Added support for quests to enable and then redisable processing of movement. 2020-07-27 10:43:24 -04:00
Paul Coene 44a1256eb9 Merge pull request #18 from EQEmu/master
Merge mainline into my fork
2020-07-27 09:53:56 -04:00
Akkadius a307636962 Fix object update spam issue (terrible code) 2020-07-20 22:53:58 -05:00
Akkadius a617fc5034 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-07-19 20:40:00 -05:00
Alex 63ad92090a Add Lua eq.update_zone_header export to lua_general.cpp. 2020-07-19 18:01:06 -04:00
E Spause 147916ce2e Set group info to null in various places
When the group is disbanded, set the leader to null.

When setting a new raid leader, make sure we have a new raid leader. If we don't, avoid a crash and disband the raid. It's better than zones falling apart, and will resolve itself on the next VerifyRaid call.

If a member zones, set the leader pointer to nullptr. This fixes an issue where the leader pointer is freed later (MemberZoned normally cleans up the Client object), but referenced by other entities, allowing the leader to be used in the same server process tick, post-cleanup - as the leader won't exist.
2020-07-19 02:34:59 -04:00
Akkadius 98340751b0 Sanity check on adding self to other lists 2020-07-19 01:34:25 -05:00
E Spause 42781036a8 Fix issue where npc_types could become null in the cache but remain referenced, causing a crash due to invalid memory accessed 2020-07-19 02:31:22 -04:00
E Spause eacd2c2cde Fix null pointers in group/raid pointer removal 2020-07-19 02:30:50 -04:00
Akkadius 2e0c892b07 Add cli character:copy-character and #copycharacter 2020-07-18 21:07:22 -05:00
Akkadius 880b19cc7f Hit the zone cache first so we're not hitting the database every time someone attempts to zone 2020-07-18 13:16:27 -05:00
Chris Miles fc6689ec09 Merge pull request #1096 from noudess/master
Added Rule to enable AA Ding()
2020-07-18 11:50:37 -05:00
Noudess db4f113129 Added rule to allow the Ding sound when AA is earned. 2020-07-13 08:12:02 -04:00
Akkadius 30e0bbb912 More conversion changes to reduce warnings [skip ci] 2020-07-12 17:33:17 -05:00
Akkadius 6a7a78af29 Static cast floats in atof usages where the datatype is actually float to avoid windows compiler warnings 2020-07-12 17:25:50 -05:00
Akkadius 758a30a080 Fix merge 2020-07-12 16:57:36 -05:00
Akkadius 3016f9409b Fix merge 2020-07-12 16:57:04 -05:00
Chris Miles 7ba55759c5 Merge pull request #1095 from EQEmu/world_wide_lua_overrides
Add Lua overrides to worldwide methods to make additional parameters optional.
2020-07-12 16:53:47 -05:00
Akkadius 8647bd73ce Merge remote-tracking branch 'origin' into integration/multi-tenancy-expansions-repository 2020-07-12 16:51:36 -05:00
Alex e033d89a32 Add Lua overrides to worldwide methods to make additional parameters optional. 2020-07-08 18:16:20 -04:00
Paul Coene a8928d4a39 Merge pull request #17 from EQEmu/master
Merge master into our fork
2020-07-08 15:48:20 -04:00
Chris Miles b801f8dfe5 Merge pull request #1092 from EQEmu/cross_zone_overhaul
Completely overhaul cross zone and world wide methods in quest API.
2020-07-07 14:15:29 -05:00
Chris Miles b0b63cc64c Merge pull request #1093 from EQEmu/hot_reload_adjustments
Add hot reload saylinks as well as a rule to determine if you bypass the saylinks.
2020-07-07 14:13:15 -05:00
Alex c8389bc674 Completely overhaul cross zone and world wide methods in quest API. 2020-07-07 08:02:56 -04:00
Alex f1929c4f45 Add hot reload saylinks as well as a rule to determine if you bypass the saylinks. 2020-07-07 07:20:08 -04:00
Akkadius f6b5bbef00 Add world api get_database_schema 2020-07-07 02:21:44 -05:00
Akkadius bdf55403cf Add manifest criteria 2020-07-07 02:10:00 -05:00
Akkadius 084e9b7a35 Fix command exit codes 2020-07-07 02:09:39 -05:00
Akkadius a54d92d078 Cleanup content flag loading logic 2020-07-07 02:06:16 -05:00
Akkadius 331eb51126 Add connection label to MySQL connects 2020-07-07 02:06:00 -05:00
Akkadius b7e2261e16 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-07-07 01:32:17 -05:00
Akkadius 4e6c3b524f Add fix for scenario where a client traveled far distance quickly and mob scanning is too slow; this takes care of all scenarios 2020-07-07 01:19:02 -05:00
Chris Miles 520ac3ae46 Merge pull request #1091 from EQEmu/feature/windows-shared-memory-hotfix-fix
Windows #hotfix Fix
2020-07-04 02:27:17 -05:00
Akkadius 15a70c7aa9 Fix for windows hotfix [skip ci] 2020-07-04 02:24:53 -05:00
Akkadius 9e960b90bd Adjust path quote [skip ci] 2020-07-04 02:01:35 -05:00
Akkadius 8e96232690 Add explicit file extension to file check [skip ci] 2020-07-04 01:58:02 -05:00
Akkadius 6aad062e9a Add logging [skip ci] 2020-07-04 01:50:29 -05:00
Chris Miles 818fd53dd0 Merge pull request #1090 from xevianindustries/titanium_start_zone_fix
Issue 743 - WorldDatabase::GetStartZone now checks isTitanium when creating the SQL
2020-07-02 21:34:52 -05:00
Akkadius 36e064a7b3 Fix issue where #hotfix doesn't work properly in new Windows installations 2020-07-02 21:31:50 -05:00
Erick Christgau 12a0e3e226 Issue 743 - WorldDatabase::GetStartZone now checks isTitanium when creating the SQL 2020-07-02 10:16:04 -05:00
Chris Miles a78c3b9800 Merge pull request #1086 from EQEmu/cross_zone_move
Optimize cross-zone utilities and add cross-zone player move utilities to Perl/Lua.
2020-06-30 14:48:16 -05:00
Chris Miles 62439fe8ee Merge pull request #1088 from EQEmu/move_zone_instance
Add MoveZoneInstance methods to Perl/Lua.
2020-06-30 14:47:16 -05:00
Chris Miles 4b1ea13c32 Merge pull request #1089 from EQEmu/dye_armor
Add DyeArmorBySlot(slot, red, green, blue, use_tint) to Perl/Lua.
2020-06-30 14:46:43 -05:00
Chris Miles 7a5a0915e5 Merge pull request #1085 from EQEmu/display_ac
Add GetDisplayAC() to Perl/Lua.
2020-06-30 14:46:08 -05:00
Paul Coene 0202a2ad23 Merge pull request #16 from EQEmu/master
Merge master into main
2020-06-30 07:56:00 -04:00
Alex eed1fd8a43 Add DyeArmorBySlot(slot, red, green, blue, use_tint) to Perl/Lua. 2020-06-29 20:55:30 -04:00
Alex 1b2c2a1dd0 Add MoveZoneInstance methods to Perl/Lua. 2020-06-29 19:49:37 -04:00
Alex f514dd5b55 Optimize cross-zone utilities and add cross-zone player move utilities to Perl/Lua. 2020-06-29 17:54:30 -04:00
Alex eb039d176c Add GetDisplayAC() to Perl/Lua. 2020-06-29 15:49:24 -04:00
Akkadius 954b0c5106 Post merge fixes 2020-06-29 00:55:53 -05:00
Akkadius e03ca7f65e Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-06-29 00:40:27 -05:00
Akkadius f32126faac Fix issue where when a client first enters a zone, a mob may not be aware of their distance to a client immediately so when the client does their scan we also add ourselves to their lists 2020-06-28 23:10:30 -05:00
Akkadius e11868eb65 Merge branch 'master' of https://github.com/EQEmu/Server 2020-06-28 22:56:35 -05:00
Akkadius 05113aab7d Lower animation throttle frequency 2020-06-28 22:56:33 -05:00
Chris Miles ba62d0bdd3 Merge pull request #1074 from thalix1337/master
Improvement of rule descriptions
2020-06-28 22:03:31 -05:00
Chris Miles 53eb28c5c6 Merge pull request #1079 from KinglyKrab/disc_timer
Add GetDisciplineTimer() and ResetDisciplineTimer() to Perl/Lua.
2020-06-28 22:00:45 -05:00
Chris Miles f6d415410d Merge pull request #1080 from KinglyKrab/assign_tasks
Add cross-zone task assign methods to Perl/Lua.
2020-06-28 21:54:52 -05:00
Chris Miles f143cddc97 Merge pull request #1082 from KinglyKrab/move_zone
Add MoveZone methods to Perl/Lua.
2020-06-28 20:05:16 -05:00
Chris Miles 2a19ad0197 Merge pull request #1083 from EQEmu/recalculate_skills
Fix $npc->RecalculateSkills() in Perl.
2020-06-28 20:04:41 -05:00
Akkadius 30067f9b6d Fix UCS connection bug 2020-06-28 19:14:36 -05:00
Alex 1292e1c9c0 Fix $npc->RecalculateSkills() in Perl. 2020-06-28 10:08:21 -04:00
Alex 9a2294774e Add client-based MoveZone methods. 2020-06-27 21:35:52 -04:00
Alex 2c7d227f4a Merge pull request #1 from EQEmu/master
Update.
2020-06-27 20:41:58 -04:00
Alex 25c3d3803f Add cross-zone task assign methods to Perl/Lua. 2020-06-27 20:03:06 -04:00
Alex 736c345a45 Add GetDisciplineTimer() and ResetDisciplineTimer() to Perl/Lua. 2020-06-27 16:37:24 -04:00
thalix1337 c3e7cd65e8 Corrected duplicate descriptions
Corrected descriptions for the rules UseOldConSystem and UseLiveBlockedMessage
2020-06-27 03:18:40 +02:00
freyonsecurity 9bbef1d79a Missing descriptions added
All missing descriptions added. Made corrections to existing descriptions.
2020-06-26 22:05:35 +02:00
Chris Miles 6bdc1ffffb Merge pull request #1067 from noudess/CallForHelp
Prevent mob from moving from point of aggro until after calls for help are issued.
2020-06-23 14:20:40 -05:00
Chris Miles a9c2e35bc7 Merge pull request #1075 from KinglyKrab/findzone
Add zone ID to #findzone.
2020-06-23 14:18:47 -05:00
Chris Miles 10f54313a5 Merge pull request #1076 from KinglyKrab/zone
Add new zone methods to Perl/Lua.
2020-06-23 14:18:33 -05:00
Chris Miles 2fd149469d Merge pull request #1073 from noudess/gridshow
Repair #grid show command
2020-06-23 14:15:48 -05:00
Chris Miles 08e5176c0c Merge pull request #1077 from KinglyKrab/findrace
Add #findrace command.
2020-06-23 14:10:36 -05:00
Alex 0daadde415 Add #findrace command. 2020-06-21 16:10:55 -04:00
Alex 1ae077ea8f Add new zone methods to Perl/Lua. 2020-06-21 01:15:29 -04:00
Alex 0d28f0c083 Add zone ID to #findzone 2020-06-21 00:26:13 -04:00
Thalix 01698ae989 Incorrectly deleted rules inserted again 2020-06-21 04:03:03 +02:00
Thalix ab73fd7938 Improvement of rule descriptions
Incomplete descriptions added as far as the function was clear to me. Tried to standardize the words used in the descriptions. Corrected a few orthographic problems. Added some words to existing descriptions to make them more understandable. Some rules which were not used anymore are deleted.
2020-06-21 03:19:38 +02:00
Noudess 06f3d40c28 Replaced expensive IsPet() with GetOwnerID(). 2020-06-19 07:59:08 -04:00
Noudess efc3832f52 Fix some formatting and change visual label for stacked node names. 2020-06-19 07:43:06 -04:00
Chris Miles 64b56bd746 Merge pull request #1071 from noudess/master
SQL to add faction mods for guktan and drakkin races, and Agnostic mods
2020-05-30 08:09:20 -05:00
Chris Miles 577fbdac01 Merge pull request #1072 from alimalkhalifa/cmake_mariadb
Updated CMakeLists to default to MariaDB instead of MySQL
2020-05-30 08:08:34 -05:00
Noudess fa2caf8f83 Comment movement code and make target required in all cases again 2020-05-28 13:30:34 -04:00
Noudess 4ad38d4c49 Fix for pets, mercs, bot that don't set combat state. 2020-05-28 13:17:31 -04:00
Noudess 4a23086183 Fixes to #grid show. Added new string utilities. 2020-05-28 08:41:10 -04:00
Paul Coene 9195e5e961 Merge pull request #15 from EQEmu/master
Merge master into my branch
2020-05-28 08:19:35 -04:00
Ali 42352359ad [ci skip] Updated CMakeLists to default to MariaDB instead of MySQL 2020-05-28 15:18:25 +03:00
KimLS 88b405edee Merge branch 'master' of https://github.com/EQEmu/Server 2020-05-26 22:30:24 -07:00
KimLS 8a0d4e37bd Remove optimization off of quest::ChooseRandom on msvc to solve a crash on x64 in release mode 2020-05-26 22:30:19 -07:00
Chris Miles c10a9cb620 Update README.md 2020-05-26 00:32:45 -05:00
Akkadius 01d326ef83 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-25 23:06:14 -05:00
Akkadius 2ec9a2addd Zone point logging 2020-05-25 23:05:05 -05:00
KimLS 6a416a78a8 Merge branch 'master' of https://github.com/EQEmu/Server 2020-05-25 20:56:54 -07:00
KimLS 5e9bf3b044 Make ChooseRandom more idiomatic, the fact that the code can return a SV of anytype makes it a bit dangerous, good canidate for rewriting as a plugin 2020-05-25 20:56:49 -07:00
Chris Miles a3874b5252 Merge pull request #1070 from alimalkhalifa/installer/support_powershell2
Updated installer to support powershell older than 3.0
2020-05-25 18:38:14 -05:00
Paul Coene 0e04e42bea Added two missing agnostic mods 2020-05-25 16:48:03 -04:00
Paul Coene 40e690f8e3 SQL to add the needed guktan and drakkin faction fixes missed by faction_conversion. 2020-05-25 16:25:55 -04:00
Ali 6896ef650e [ci skip] Updated installer to support powershell older than 3.0 2020-05-25 16:19:33 +03:00
Akkadius cfe3b2b071 Reconile a post merge issue [skip ci] 2020-05-25 01:35:39 -05:00
Akkadius a9790e2779 Update lua_general.cpp 2020-05-24 21:57:09 -05:00
Akkadius a4b027db58 Export quest::is_content_flag_enabled and quest::set_content_flag 2020-05-24 20:45:44 -05:00
Akkadius 50c266982f Remove string quotes from integers in mysql queries for faction and rules [skip ci] 2020-05-24 19:21:26 -05:00
Akkadius 905baa71b2 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-24 04:24:01 -05:00
Akkadius db072e767a Bulk instance deletion instead of tons of individual statements [skip ci] 2020-05-24 04:23:52 -05:00
Akkadius 02fa823736 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-24 04:07:38 -05:00
Akkadius 0d2d6a2c6b More resilient fix to killing instances for now [skip ci] 2020-05-24 04:07:29 -05:00
Akkadius 12d10bbc50 Slight adjustment to filter criteria [skip ci] 2020-05-24 03:08:52 -05:00
Akkadius d98e69ae5d Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-24 02:56:13 -05:00
Chris Miles 26831d5ad4 Fix a copy paste error 2020-05-24 02:56:04 -05:00
Akkadius e82f0254b0 Add content_flags_disabled field for additional filtering 2020-05-24 02:24:38 -05:00
Akkadius 630ab5e69d Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-24 01:37:10 -05:00
Akkadius e474df2b12 Tweak content flag filtering [skip ci] 2020-05-24 01:36:17 -05:00
Chris Miles e8a05ec680 Fixes instance deletion issue https://github.com/EQEmu/Server/issues/1069 2020-05-24 01:32:50 -05:00
KimLS 712df6c35a Fix compile issue for latest vc compiler 2020-05-23 23:19:54 -07:00
Akkadius 56c4eb280f Fix post merge issues 2020-05-23 22:41:59 -05:00
Akkadius 03a4254397 Post merge fix [skip ci] 2020-05-23 22:34:32 -05:00
Akkadius 3f62da4573 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-23 22:33:34 -05:00
Akkadius 86ef1b12e2 Strawberry Perl OOB has issue with getstore so lets use something else [skip ci] 2020-05-23 16:50:09 -05:00
Akkadius b585d9b062 Use wget again for windows [skip ci] 2020-05-23 16:29:04 -05:00
Chris Miles 4603fa2ef8 Merge pull request #1068 from alimalkhalifa/reintroduce_wget_to_windows_installer
Revert back to using wget.exe for windows installs
2020-05-23 16:23:57 -05:00
Ali 2c2c09531f [ci skip] Revert back to using wget.exe for windows installs 2020-05-21 15:16:50 +03:00
Noudess 4e8764b6b9 Repair aggro so CallsForHelp are completed before mob charges. 2020-05-20 16:08:42 -04:00
Paul Coene 3ebbcd84d4 Merge pull request #14 from EQEmu/master
Merge Mainline into my base
2020-05-20 15:52:59 -04:00
Alex d7c5a45cc2 Merge pull request #1064 from EQEmu/getskill
Remove duplicate GetSkill() definition.
2020-05-19 19:35:08 -04:00
Alex 5964bcc3c4 Merge branch 'master' into getskill 2020-05-19 18:50:32 -04:00
Chris Miles 0c531e976b Merge pull request #1065 from EQEmu/signalclient
Remove duplicate SignalClient() definition.
2020-05-19 02:38:44 -05:00
Chris Miles a64c0dfd92 Merge pull request #1063 from EQEmu/maketemppet
Remove duplicate MakeTempPet() definition.
2020-05-19 02:37:46 -05:00
Chris Miles 19107e5ace Merge pull request #1037 from alimalkhalifa/win64
Win64 eqemu_server.pl
2020-05-19 01:24:30 -05:00
Chris Miles 852a8e1617 Update eqemu_server.pl [skip ci] 2020-05-19 01:17:02 -05:00
Chris Miles 4180ef58ef Update eqemu_server.pl [skip ci] 2020-05-19 00:58:19 -05:00
Alex 6a817fdce5 Merge pull request #1051 from hgtw/fix/missing-doors
Fix edge case with door packets that can cause missing doors on clients
2020-05-17 20:36:04 -07:00
KimLS c330904695 Fix for broken tests 2020-05-17 19:10:12 -07:00
KimLS 2fbd5aaccc Rename namespace EQEmu to namespace EQ (so we don't have two similar but different namespaces anymore) 2020-05-17 18:36:06 -07:00
Alex 5bdc9c6c60 Remove duplicate SignalClient() definition. 2020-05-16 14:42:38 -04:00
Alex ceff8b8674 Remove duplicate GetSkill() definition. 2020-05-16 14:40:36 -04:00
Alex 968efe8831 Remove duplicate MakeTempPet definition. 2020-05-16 14:30:35 -04:00
Michael Cook (mackal) 06104b624a Merge pull request #1062 from EQEmu/istaunting
Add IsTaunting() to Perl/Lua.
2020-05-15 17:44:59 -04:00
Alex ee55755c85 Add IsTaunting() to Perl/Lua. 2020-05-14 23:55:55 -04:00
Michael Cook (mackal) d042b0831a Merge pull request #1061 from noudess/NewFishing
New fishing
2020-05-12 13:31:52 -04:00
Alex 5f0d3e9026 Add several cross zone methods to Perl/Lua. 2020-05-11 20:10:52 -04:00
Noudess ea48acbf0b Added check for GetItem() failure on Pole 2020-05-11 15:39:28 -04:00
Noudess b37c75630b Fix subtype logic 2020-05-11 14:56:38 -04:00
Noudess fb1228946a Add code to patchers to put support for Expendable flag on breakable fishing 2020-05-11 14:50:17 -04:00
Noudess 94606504af Add check for fishing pole expendable using new subtype field. 2020-05-11 10:07:29 -04:00
Paul Coene c799267c86 Merge pull request #13 from EQEmu/master
Merge from master
2020-05-11 08:37:28 -04:00
Chris Miles 5dbd2c38ed Update script [skip ci] 2020-05-11 04:51:59 -05:00
Chris Miles f785dc232b More tweaks [skip ci] 2020-05-11 03:37:09 -05:00
Chris Miles d534d345d5 More tweaks [skip ci] 2020-05-11 03:35:16 -05:00
Chris Miles 51b98ec724 Lots of tweaks for overhauls [skip ci] 2020-05-11 03:21:46 -05:00
Chris Miles 2c13f2e928 Update server script [skip ci] 2020-05-11 01:13:59 -05:00
Chris Miles 496a958def Update eqemu_server.pl 2020-05-11 00:28:24 -05:00
Chris Miles 39cd5bb9a8 Fix issue where powershell progress output was dramatically slowing down requests [skip ci] 2020-05-10 23:07:48 -05:00
Chris Miles 5e0ab3e37c Merge pull request #1054 from EQEmu/feature/item_subtype
Add Item SubType to data structures and DB
2020-05-10 20:04:43 -05:00
Chris Miles e64526920c Merge pull request #1053 from KinglyKrab/crosszonesignalplayerbygroupid
Add CrossZoneSignalPlayerByGroupID() to Perl/Lua.
2020-05-10 20:01:51 -05:00
Alex dc9bd031ff Merge branch 'master' into crosszonesignalplayerbygroupid 2020-05-10 21:00:43 -04:00
Chris Miles 7113c9236e Merge pull request #1057 from KinglyKrab/crosszonesignalclientbyname
Fix typo in crosszonesignalclientbyname Perl_croak.
2020-05-10 20:00:42 -05:00
Chris Miles 13d4bbcae2 Merge pull request #1060 from KinglyKrab/crosszonemessageplayerbyguildid
Add CrossZoneMessagePlayerByGuildID() to Perl/Lua.
2020-05-10 19:59:49 -05:00
Alex 857b24727c Add CrossZoneMessagePlayerByGuildID() to Perl/Lua. 2020-05-10 16:52:33 -04:00
Alex 4d93406176 Fix typo in crosszonesignalclientbyname Perl_croak. 2020-05-10 09:16:58 -04:00
Michael Cook (mackal) 0e6a0b5a70 Add Item SubType to data structures and DB 2020-05-09 22:37:35 -04:00
Alex 12c4b20169 Add CrossZoneSignalPlayerByGroupID() to Perl/Lua. 2020-05-09 21:15:34 -04:00
Chris Miles 90e6bb8a8a Merge pull request #1052 from KinglyKrab/master
Fix #findzone to allow you to search using part of a zone's short name.
2020-05-09 17:15:50 -05:00
Alex 518bcb58d3 Fix #findzone to allow you to search using part of a zone's short name. 2020-05-09 18:14:22 -04:00
hg b08dc02a0a Fix edge case with door packets that can cause missing doors on clients
Send OP_RemoveAllDoors packets with default CLIENT_CONNECTINGALL flag
to match flag used for OP_SpawnDoor
2020-05-09 16:26:55 -04:00
Chris Miles 0aa8d90e9e Merge pull request #1049 from noudess/NotifyNewTitles
Notify new titles
2020-05-09 14:54:24 -05:00
Chris Miles e453f3e6ed Merge pull request #1048 from KinglyKrab/master
Add GetNPCBySpawnID() to Perl/Lua.
2020-05-09 14:53:47 -05:00
Chris Miles e719992267 Merge pull request #1042 from noudess/master
Fix for static zone issue with mobs congregating after last player zones
2020-05-09 14:52:54 -05:00
Chris Miles e2a7d4f33f Merge pull request #1046 from noudess/flying
Flying
2020-05-09 14:45:15 -05:00
Chris Miles 8b999a63a4 Merge pull request #1047 from isenior/ScaleFix
Don't scale 0 values
2020-05-09 14:42:30 -05:00
Jose123456 914ea27406 Compile on Freebsd (#1044)
* Compile on Freebsd

Small changes needed for compilation on Freebsd. Note that you'll have
to pass -DEQEMU_BUILD_ZLIB=OFF on the cmake command line. The bundled
zlib-ng does not build on Freebsd even though mainline zlib-ng does.

* Fix build errors: typo
2020-05-09 14:40:33 -05:00
Michael Cook (mackal) 7f3e4e3438 Merge pull request #1050 from EQEmu/feature/subtype_to_structs
Identify SubType in Item structs in some clients
2020-05-09 15:22:06 -04:00
Noudess 5471774b4c Repair prototype 2020-05-08 18:24:25 -04:00
Michael Cook (mackal) 572ad1b6ab Identify SubType in Item structs in some clients
This maybe in older clients as well, but I couldn't verify it and those
clients never did anything with this field so it doesn't matter.

MQ2 calls this SubClass, but we call the field it's a "sub" of Type so I
figured we'd call it SubType.

We still need to rename the DB field and handle it server side etc
2020-05-08 12:56:10 -04:00
Noudess 0a42ded33f Expose client method NotifyNewTitlesAvailable for perl and lua 2020-05-08 09:58:53 -04:00
Paul Coene ca50013334 Merge pull request #12 from EQEmu/master
Merge base
2020-05-08 09:54:23 -04:00
Alex 0b03f27660 Add GetNPCBySpawnID() to Perl/Lua. 2020-05-07 23:11:36 -04:00
= 263ed3913b Don't scale 0 values 2020-05-06 02:44:17 +00:00
Noudess 2bcaf2a476 Extended Movement Manager to have a FlyTo 2020-04-30 11:35:09 -04:00
Paul Coene 855e592d22 Merge pull request #10 from EQEmu/master
Merge from master
2020-04-30 11:33:13 -04:00
Akkadius d8b9c3e3de Fix bad object Z data automatically using Z calcs, works fairly reliably 2020-04-25 04:24:22 -05:00
Akkadius 206761d5e8 Force str_tolower on zone name lookups 2020-04-24 20:09:59 -05:00
Akkadius bf0322f8f6 Not sure why we are trying to detete id 0 objects [skip ci] 2020-04-24 18:15:07 -05:00
Akkadius 5dc351e5d5 Remove cross boundary dependency in command_who [skip ci] 2020-04-24 02:22:33 -05:00
Akkadius 22180d4bac Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-04-24 02:11:44 -05:00
Akkadius 954247956e Adjust syntax 2020-04-24 02:11:06 -05:00
Akkadius 43ff59d7db Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-04-24 01:27:17 -05:00
Akkadius 387e1668a5 Remove hard delete from DeleteInstance so that the purge timer can pick it up later 2020-04-24 01:25:09 -05:00
Noudess 5989edb6ec Fix for static zone issue with mobs congregating after last player zones 2020-04-21 09:09:30 -04:00
Akkadius 2159b5db2d Add damageshieldtypes to content tables 2020-04-21 02:10:52 -05:00
Paul Coene 54d494da36 Fix errant merchant full messages and add logging for later use (#1035)
* Fix errant merchant full issues, add logging for later use

* Rename merchant list dump more clearly

* spaces around '='

* Added line spacing,

Co-authored-by: Noudess <noudess@gmail.com>
2020-04-20 23:40:18 -05:00
Alex d6af1b566f Merge pull request #1041 from peterigz/master
Add missing break for OP_AppCombined switch statement
2020-04-19 19:23:40 -07:00
Akkadius b6b008e74a Add tenancy support to the dump service 2020-04-19 19:52:19 -05:00
Michael Cook (mackal) 89f5b0b71e Merge pull request #1040 from alimalkhalifa/redundant-check-during-enter-world
Removed redundant check during enter world
2020-04-19 15:22:18 -04:00
Akkadius 6409e02aed Update base repositories to use int as a base to avoid atoi overflow 2020-04-19 04:49:28 -05:00
Akkadius 373fb3f0e7 Decouple zone calls, cleanup logic 2020-04-19 04:36:39 -05:00
Akkadius ebda1cf601 Add zone store 2020-04-19 03:05:15 -05:00
Akkadius 6a51bcf8fd Fix null reference issue [skip ci] 2020-04-19 01:02:35 -05:00
Akkadius caa0ffda00 Add Truncate repository method and purge player sold items on world bootup 2020-04-18 23:53:52 -05:00
Akkadius 85daee85b8 Move spawn events from content table to server 2020-04-18 23:26:53 -05:00
Akkadius e4748a01e0 Fix tradeskill combine logic [skip ci] 2020-04-18 21:50:00 -05:00
Akkadius 472c0cd196 More tweaks [skip ci] 2020-04-18 20:03:34 -05:00
Akkadius df43a23d98 Another adjustment [skip ci] 2020-04-18 19:52:56 -05:00
Akkadius 74c878a481 Fix [skip ci] 2020-04-18 19:49:20 -05:00
Akkadius 093509baa9 Few adjustments [skip ci[ 2020-04-18 19:46:19 -05:00
Akkadius b8c44ee41b Fix container interaction [skip ci] 2020-04-18 18:19:59 -05:00
Akkadius bcd62b76c4 Fix all expansion enabled filtering [skip ci] 2020-04-18 18:12:25 -05:00
Akkadius a0f8bbb3b9 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-04-18 02:31:43 -05:00
Akkadius 4db646db94 Revert "Merge pull request #1007 from EQEmu/feature/improved-name-generator"
This reverts commit 3c71e2c91d, reversing
changes made to 80d1601754.
2020-04-18 01:44:43 -05:00
Michael Cook (mackal) 5ce1fef9ec Merge pull request #1039 from alimalkhalifa/gitignore-win-64
Added a VS ignore for x64 compiles
2020-04-17 19:58:20 -04:00
Michael Cook (mackal) 874ca053f7 Merge pull request #1038 from alimalkhalifa/fix_charm_break_during_cast_lifetap_nuke
Fix edge case with NPC pet owners charming PCs
2020-04-17 14:19:13 -04:00
peterigz 21ed02ca52 Add missing break for OP_AppCombined switch statement 2020-04-17 18:27:45 +01:00
Ali 6c3ae4580f [skip ci] Win64 eqemu_server.pl
Changed binaries to x64 and got rid of wget.exe for windows, switched to
native WebClient
2020-04-17 18:53:35 +03:00
Ali 5d4e53bb25 Removed redundant check during enter world 2020-04-17 18:48:43 +03:00
Ali b8e7e5bb0d [skip ci] Added a VS ignore for x64 compiles 2020-04-17 18:46:07 +03:00
Ali 15f3697df1 Fix edge case with NPC pet owners charming PCs
* Addresses #1036
* Cleaned up if statement formatting
* Using Mob::GetOwnerOrSelf() now, which accounts for the edge case

NB: The Mob::SpellOnTarget() and Mob::CommonDamage() methods really
should be looked at and spell logic combined somehow.  Both have if
statements that dodge around the other's conditions to decide which
method sends the CombatDamage_Struct packet
2020-04-17 10:56:43 +03:00
Chris Miles 16cfad1966 UCS / Raid / Zone Fixes (#1033)
* Cache EntityList::GetRaidByClient

* Adjustments [skip ci]

* Update entity [skip ci]

* More cleanup [skip ci]

* More tweaks [skip ci]

* Cleanup [skip ci]

* Fix bugs with UCS reconnection on crash / exit, not adding soft deleted characters, put main loop on UV lib

* Reduce log spam that should be debugging; send keepalives to clients so that they properly prune from the connection list

* Shutdown the eventloop to properly shutdown the zone versus calling a hard exit
2020-04-14 23:28:43 -05:00
JJ bffeee8d1a Merge pull request #1034 from TurmoilToad/patch-1
Update README.md
2020-04-13 09:37:07 -05:00
TurmoilToad d29c0fc332 Update README.md
Updated wiki link.
2020-04-13 10:01:22 -04:00
Chris Miles a031c20e7e Update peq-dump.sh [skip ci] 2020-04-11 16:44:19 -05:00
Akkadius 3daf03c796 Remove errant cout [skip ci] 2020-04-11 05:57:31 -05:00
Akkadius 5b4c4bfd66 Implement content flags 2020-04-11 05:48:41 -05:00
Akkadius 47b8aa3f18 Export quest calls 2020-04-11 04:38:42 -05:00
Akkadius 287fc5d313 Create 2020_04_11_expansions_content_filters.sql 2020-04-11 03:13:03 -05:00
Akkadius 77cacf5cd1 Add std::string WorldContentService::GetCurrentExpansionName() [skip ci] 2020-04-11 03:11:09 -05:00
Akkadius e0363a8fe1 Repository tweaks [skip ci] 2020-04-11 02:47:54 -05:00
Akkadius 5c7eb0707f Bulk load goallists 2020-04-11 02:19:58 -05:00
Akkadius 423bb7f0b3 Adjust content bootstrapping in zone [skip ci] 2020-04-11 01:58:35 -05:00
Chris Miles 67d3cab80b Merge pull request #1030 from EQEmu/feature/send-to-guild-hall-instance-fixes
Implement SendToGuildHall and Improve Instance ID Cycling
2020-04-11 01:33:12 -05:00
Akkadius b41f2dac66 Clamp value for max reserved instance id [skip ci] 2020-04-10 03:26:09 -05:00
Akkadius b5b473f25d Update peq dump [skip ci] 2020-04-10 03:21:33 -05:00
Akkadius 0dc3e5ba35 Add jank permanent reference pass back in [skip ci] 2020-04-10 03:20:41 -05:00
Akkadius 499fe153ab Tweak peq dump [skip ci] 2020-04-10 02:56:45 -05:00
Akkadius d1349e5ac9 Oops, math 2020-04-10 02:30:46 -05:00
Akkadius bd8e94ff17 Use version 1 for GH 2020-04-10 02:20:56 -05:00
Akkadius d89b2f11b5 Get time remaining directly from database for now, this needs to be cached better at the zone state level, I'll refactor this when repositories are merged in 2020-04-10 02:03:30 -05:00
Akkadius 88ff56b2f2 Add client->SendToGuildHall - have instances properly cycle out IDs 2020-04-10 01:43:00 -05:00
Akkadius 1728923bbb Revert "Merge pull request #1007 from EQEmu/feature/improved-name-generator"
This reverts commit 3c71e2c91d, reversing
changes made to 80d1601754.
2020-04-08 16:00:27 -05:00
Alex cbd1f42a08 Merge conflict fixes... 2020-04-06 18:57:13 -04:00
Alex f8735cf9ba Update lua_general.cpp 2020-04-06 18:06:18 -04:00
Chris Miles eb00667eab Merge pull request #1027 from noudess/patch-15
Propose change in location of Stun check as possible resolution to crash
2020-04-06 15:40:39 -05:00
Chris Miles cbc0ada454 Merge pull request #1017 from noudess/master
Fix Issue #849.
2020-04-06 15:39:43 -05:00
Alex 54b33f959e Merge pull request #1026 from KinglyKrab/getclassname
Add getclassname(class_id, level) to Perl/Lua.
2020-04-06 16:25:39 -04:00
Alex c6e4b5647f Merge branch 'master' into getclassname 2020-04-06 16:25:29 -04:00
Alex 928070e994 Merge pull request #1023 from KinglyKrab/getcurrencyitemid
Add getcurrencyitemid(currency_id) to Perl/Lua.
2020-04-06 16:22:50 -04:00
Alex 40ef4c799b Update embparser_api.cpp 2020-04-06 16:22:08 -04:00
Alex 8ba7ddd054 Merge branch 'master' into getcurrencyitemid 2020-04-06 16:21:29 -04:00
Paul Coene 973fd376e5 Propose change in location of Stun check as possible resolution to crash 2020-04-06 08:23:57 -04:00
Paul Coene b5575133cd Put in braces in my new function as well as the source function.
The entire file has implied braces...  I'd change them all but fear making a mistake.
2020-04-06 08:10:15 -04:00
Akkadius 2b1b786f02 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-04-06 02:55:46 -05:00
Chris Miles b23bc83f0f Merge pull request #1018 from EQEmu/feature/generated-repositories
Code Generated Repositories
2020-04-06 02:24:43 -05:00
Chris Miles 6f846dc4ff Merge pull request #1025 from KinglyKrab/getracename
Add getracename(race_id) to Perl/Lua.
2020-04-06 01:57:54 -05:00
Chris Miles 0461fc1789 Merge pull request #1024 from KinglyKrab/getskillname
Add getskillname(skill_id) to Perl/Lua.
2020-04-06 01:57:12 -05:00
Chris Miles aa6264266e Merge pull request #1022 from KinglyKrab/getcurrencyid
Add getcurrencyid(item_id) to Perl/Lua.
2020-04-06 01:56:25 -05:00
Chris Miles c3cbe90575 Merge pull request #1021 from KinglyKrab/getnpcnamebyid
Add getnpcnamebyid(npc_id) to Perl/Lua.
2020-04-06 01:56:01 -05:00
Akkadius 700d062606 Fix windows compile 2020-04-06 01:51:58 -05:00
Alex c2c6282cc7 Add getclassname(class_id, level) to Perl/Lua. 2020-04-06 02:26:58 -04:00
Alex fab071d9da Add getracename(race_id) to Perl/Lua. 2020-04-06 02:02:20 -04:00
Alex 358bd60716 Add getskillname(skill_id) to Perl/Lua. 2020-04-06 01:36:46 -04:00
Akkadius 867ff3dcfa Add constructor to world content service 2020-04-06 00:22:52 -05:00
Alex 03ca345b37 Add getcurrencyitemid(currency_id) to Perl/Lua. 2020-04-06 01:07:59 -04:00
Alex 6ddcc2bb8a Add getcurrencyid(item_id) to Perl/Lua. 2020-04-06 00:49:57 -04:00
Akkadius a19bb7b544 Merge branch 'feature/peq-expansions' of https://github.com/EQEmu/Server into feature/generated-repositories 2020-04-05 23:21:21 -05:00
Akkadius 723a3aa18e Update cmake lists [skip ci] 2020-04-05 23:18:32 -05:00
Akkadius be57c57029 More adjustments [skip ci[ 2020-04-05 23:11:25 -05:00
Alex 02cac686b6 Add getnpcnamebyid(npc_id) to Perl/Lua. 2020-04-06 00:10:58 -04:00
Akkadius 725ad9ddf5 Fix comment formatting [skip ci] 2020-04-05 22:23:29 -05:00
Akkadius c978ca65a4 Split repositories out between a base immutable repository (that does not change) and an extended repository of which developers can add more custom methods to 2020-04-05 22:19:36 -05:00
Alex 4c348baabd Merge pull request #1020 from KinglyKrab/getcharnamebyid
Added getcharnamebyid(char_id) to Perl/Lua.
2020-04-05 21:26:31 -04:00
Alex 035bac1044 Update embparser_api.cpp 2020-04-05 21:22:23 -04:00
Alex 5a8d467d25 Merge branch 'master' into getcharnamebyid 2020-04-05 21:21:15 -04:00
Alex ae959be5ac Added getcharnamebyid(char_id) to Perl/Lua. 2020-04-05 21:18:05 -04:00
Chris Miles 4157a03f32 Merge pull request #1019 from KinglyKrab/getcharidbyname
Add getcharidbyname(name) to Perl/Lua.
2020-04-05 20:14:00 -05:00
Akkadius 0cce61e85d Filter GetZoneCFG [skip ci] 2020-04-05 20:11:05 -05:00
Akkadius c8722ea789 Filter start_zones [skip ci] 2020-04-05 19:58:04 -05:00
Akkadius 2f4a217f7a Filter zone_points [skip ci] 2020-04-05 19:49:04 -05:00
Akkadius 9aac84a405 filter traps [skip ci] 2020-04-05 19:45:45 -05:00
Akkadius 91c874a310 Filter starting_items [skip ci] 2020-04-05 19:43:09 -05:00
Alex 41d0b1a947 Add getcharidbyname(name) to Perl/Lua. 2020-04-05 20:41:49 -04:00
Akkadius 9fbcd99be2 Filter ground spawns [skip ci] 2020-04-05 19:40:40 -05:00
Akkadius 68a2af1bce Filter forage [skip ci] 2020-04-05 19:37:00 -05:00
Akkadius dadd674b63 Filter fishing [skip ci] 2020-04-05 19:30:02 -05:00
Akkadius f7d4e51da9 Filter global_loot [skip ci] 2020-04-05 19:20:50 -05:00
Akkadius 152d985821 Filter loot tables and drops [skip ci] 2020-04-05 19:01:45 -05:00
Akkadius 6e3922b7cc Filter merchants [skip ci] 2020-04-05 18:50:30 -05:00
Akkadius 9a90bdf91a Filter tradeskills [skip ci] 2020-04-05 18:40:19 -05:00
Akkadius 17e9198a58 Another typo fix [skip ci] 2020-04-04 21:38:05 -05:00
Akkadius e17bd303b8 Fix typos to stop triggering Secrets [skip ci] 2020-04-04 18:00:48 -05:00
Akkadius be8a6b6af4 Add spawn expansion filtering 2020-04-04 06:08:56 -05:00
Akkadius 80baf1b9ed Filter objects by expansion 2020-04-04 05:59:20 -05:00
Akkadius 8a711f3c64 Expansion filtering for doors 2020-04-04 05:51:21 -05:00
Akkadius c1e58673b2 Add expansion gating for zoning 2020-04-04 05:36:18 -05:00
Akkadius fe7e850a04 Return blank string values for string entries that return back null 2020-04-04 04:48:46 -05:00
Akkadius 15c9b64120 Add GetWhere and DeleteWhere repository methods 2020-04-04 04:44:39 -05:00
Akkadius cc8aa354f1 Add string_id define [skip ci] 2020-04-04 04:15:43 -05:00
Akkadius 33bf20a037 Merge branch 'feature/multi-tenancy' of https://github.com/EQEmu/Server into feature/peq-expansions 2020-04-04 03:56:44 -05:00
Akkadius bcef171cf9 Fix for tradeskill query [skip ci] 2020-04-04 03:55:53 -05:00
Akkadius 9faae00d15 Update cmake lists [skip ci] 2020-04-04 02:59:48 -05:00
Akkadius 0552582274 Use double quotes in strings [skip ci] 2020-04-04 02:56:14 -05:00
Akkadius 376c123fa1 More table exclusions [skip ci] 2020-04-04 02:39:15 -05:00
Akkadius 80fb204f39 More repository comb-throughs [skip ci] 2020-04-04 02:34:34 -05:00
Akkadius 826f0418f7 More float fixes [skip ci] 2020-04-04 02:27:27 -05:00
Akkadius a824ddec44 Fix float types, remove some errant table repositories [skip ci] 2020-04-04 02:26:30 -05:00
Akkadius 9e27ffacff Add tables to ignore list that do not follow typical table conventions 2020-04-04 02:13:47 -05:00
Akkadius 3aaa5020b1 Fix repository struct defaults for varchar | text 2020-04-04 02:04:48 -05:00
Akkadius d691db6621 Add repositories to cmakelists [skip ci] 2020-04-03 03:31:38 -05:00
Chris Miles 3c71e2c91d Merge pull request #1007 from EQEmu/feature/improved-name-generator
Improved Random Name Generator
2020-04-03 03:23:08 -05:00
Chris Miles 80d1601754 Merge pull request #1009 from noudess/patch-13
Hack to fix RoF2 perma IVU/IVA bug after zoning.
2020-04-03 03:22:50 -05:00
Chris Miles cfcbfea3ab Merge pull request #1010 from EQEmu/feared_proximity
Added proximity check for feared clients
2020-04-03 03:22:29 -05:00
Akkadius 82b017887d Upload generated repositories 2020-04-03 02:49:40 -05:00
Akkadius 494811c04b Update repository-generator.pl 2020-04-03 02:41:44 -05:00
Akkadius cbd2336442 Update repository generator to check for schema [skip ci] 2020-04-03 02:38:37 -05:00
Akkadius 3c9fe45af5 Update repository generator 2020-04-03 01:58:06 -05:00
Akkadius f984bd2faf Update instance list repository with auto generated code 2020-04-03 01:34:54 -05:00
Akkadius fe718a6a1d Create repository.template 2020-04-03 01:34:43 -05:00
Akkadius 9e910ad90a Create repository-generator.pl 2020-04-03 01:34:37 -05:00
Akkadius c0c1b5e678 Move doc parser scripts to new generator folder 2020-04-03 01:34:31 -05:00
Akkadius 94ab6499c8 Create account_repository.h 2020-04-03 01:17:09 -05:00
Akkadius 1650a466a1 Add instance list repository; split repository cmake config 2020-04-02 19:38:26 -05:00
Akkadius 459303c0fe Hide test: command from the help output (Developer testing) [skip ci] 2020-04-02 15:58:37 -05:00
Michael Cook (mackal) 7aa8db76f4 Merge pull request #1016 from noudess/patch-14
Update ruletypes.h
2020-04-02 14:44:52 -04:00
Paul Coene 561433902e Removed heal per @mackal 2020-04-02 13:08:05 -04:00
Paul Coene abeb93f1e6 Update entity.h 2020-04-02 12:04:16 -04:00
Paul Coene ef0b29dc8e Update entity.cpp 2020-04-02 12:03:45 -04:00
Paul Coene 42f959329d Update client.h 2020-04-02 11:56:06 -04:00
Paul Coene a898a1d07b Update aggro.cpp 2020-04-02 11:55:05 -04:00
Paul Coene 803c3aabe4 Update client.cpp 2020-04-02 11:54:19 -04:00
Paul Coene 15dde4778a Update aggro.cpp 2020-04-02 11:52:27 -04:00
Paul Coene f2b68e6783 Merge pull request #5 from EQEmu/master
Update from master
2020-04-02 11:50:50 -04:00
Paul Coene 8193b04627 Update ruletypes.h 2020-04-01 08:41:40 -04:00
Akkadius 72b1e58edb Groundwork for world content service and content filtering 2020-04-01 06:07:44 -05:00
Akkadius 58534dea16 Some cleanup [skip ci] 2020-04-01 00:57:34 -05:00
Chris Miles 47e56f9381 Merge pull request #1015 from EQEmu/checkinstancebycharid
Add CheckInstanceByCharID(instance_id, char_id) to Perl/Lua.
2020-03-31 22:21:08 -05:00
Chris Miles 58b9b719f4 Merge pull request #1014 from EQEmu/gettaskname
Add gettaskname(task_id) to Perl/Lua.
2020-03-31 22:20:58 -05:00
Alex a4bf484c74 Add CheckInstanceByCharID(instance_id, char_id) to Perl/Lua. 2020-03-31 23:19:32 -04:00
Alex 4712b56078 Add gettaskname(task_id) to Perl/Lua. 2020-03-31 23:17:25 -04:00
Chris Miles 9362890d26 Merge pull request #1013 from EQEmu/unusedtaskcode
Remove unused variables in resettaskactivity.
2020-03-31 22:11:37 -05:00
KimLS 6d3848b2c7 Removed make_unique from namegen, was conflicting with real make_unique on windows and we're set to cxx11 still 2020-03-31 19:55:27 -07:00
Alex 8974059577 Remove unused variables in resettaskactivity. 2020-03-31 20:01:47 -04:00
Chris Miles 963735e7dd Merge pull request #1012 from EQEmu/getspellname
Add getspellname(spell_id) to Perl/Lua.
2020-03-31 18:53:20 -05:00
Chris Miles c94a2496ca Merge pull request #1011 from EQEmu/getitemname
Add getitemname(item_id) to Perl/Lua.
2020-03-31 18:51:40 -05:00
Alex ceb8b31bc0 Add getspellname(spell_id) to Perl/Lua. 2020-03-31 19:48:44 -04:00
Alex 51b31b5e53 Add getitemname(item_id) to Perl/Lua. 2020-03-31 19:31:04 -04:00
Paul Coene 6fb6d8891d Hack to fix RoF2 perma IVU/IVA bug after zoning.
This fixes the problem, but I believe someone with better knowledge of the client than I can find a more "correct" solution.

Posted as a PR per @joligario  to solve it for now.  Was also asked to put SE_Invisibility in there so that this "hack" is a catch all.
2020-03-31 09:22:16 -04:00
Akkadius 7d8347a556 Update world item instance references [skip ci] 2020-03-31 03:28:35 -05:00
Akkadius 3b9016f503 More faction calls [skip ci] 2020-03-31 02:56:48 -05:00
Akkadius 63eca22aac Get factions fully moved over [skip ci] 2020-03-31 02:49:42 -05:00
Akkadius d4ea9bbee0 Use a better name generator 2020-03-31 02:00:09 -05:00
Akkadius dae20afcba Fix character creation tenancy operations 2020-03-31 01:49:42 -05:00
Akkadius 019735c654 Keeps spawns from doing individual loads and prefer bulk loading [skip ci] 2020-03-30 23:25:32 -05:00
Akkadius 0c3dd7dc93 Update zone.cpp [skip ci] 2020-03-30 21:33:11 -05:00
Akkadius 79dbddd56e Decouple temporary merchant list call [skip ci] 2020-03-30 21:32:59 -05:00
Uleat 3a7908b1de Fix for bots database updates not running when invoked from world.exe [skip ci] 2020-03-30 16:45:50 -04:00
Uleat 99c1c826a8 Fix for bots guild-related view query issue 2020-03-30 08:02:45 -04:00
Akkadius 43716332aa Bulk load grids at repop and zone init instead of 2 costly individual selects per NPC, create repositories to decouple database logic from business logic 2020-03-30 05:49:43 -05:00
Akkadius 128cc458fd Separate tradeskill queries to not be cross-boundary, clean up logic 2020-03-30 04:29:52 -05:00
Akkadius e9b361445f Add give item saylinks to #fi #itemsearch 2020-03-30 04:28:54 -05:00
Akkadius 6127baf12a Update schema [skip ci] 2020-03-29 20:16:17 -05:00
Chris Miles 1b888784eb Merge pull request #1001 from alimalkhalifa/fix_double_spell_msg
Fix double damaging spell messages to non-attacked and non-attacker
2020-03-29 19:23:49 -05:00
Chris Miles 52a25c3b78 Merge pull request #1005 from EQEmu/editmassrespawn
Added command 'editmassrespawn' for mass editing of respawn times
2020-03-29 19:22:36 -05:00
Uleat 4b08ce1237 Merge branch 'master' of https://github.com/EQEmu/Server into editmassrespawn 2020-03-29 18:02:39 -04:00
Uleat b94fdda429 Updated command 'editmassrespawn' queries to use resolved names over aliases 2020-03-29 18:02:27 -04:00
Ali Al-Khalifa a48153baa1 Fix errant formatting
Mistakenly had a variable in camelCase
2020-03-30 00:26:56 +03:00
Chris Miles e26b159efe Merge pull request #1002 from alimalkhalifa/gitignore-enhancements
Enhanced .gitignore
2020-03-29 16:08:20 -05:00
Uleat a2b381bc9e Added command 'editmassrespawn' for mass editing of respawn times 2020-03-29 16:34:07 -04:00
Ali 60e194e32b Fix double damaging spell messages to non-attacked and non-attacker
With handling for client attacker and pets thanks to @noudess
2020-03-25 15:41:09 +03:00
Ali 1cdf507b9f [ci skip] Enhanced .gitignore
* Removes the generated files from both CMake and VS
2020-03-24 12:48:04 +03:00
Akkadius 8effd671c5 Second pass through tables [skip ci] 2020-03-22 03:27:44 -05:00
Chris Miles 3e98e60877 Merge pull request #996 from KinglyKrab/master
Add countitem(item_id) to Perl/Lua.
2020-03-21 21:33:07 -05:00
Chris Miles af5022b3db Merge pull request #999 from EQEmu/PortFindLoopless
Rewrite how zone finds ports
2020-03-21 21:30:11 -05:00
KimLS 52d2469da2 Rewrite how zone finds ports 2020-03-21 17:05:28 -07:00
Akkadius e431c56f7c Remove tables that no longer exist 2020-03-21 18:41:36 -05:00
Alex 0ab7291625 Add countitem(item_id) to Perl/Lua. 2020-03-19 22:33:07 -04:00
KimLS e384cf6149 Replace hard coded 12 with EFFECT_COUNT in the two spots I see it used. 2020-03-18 20:42:27 -07:00
Uleat 463c0d9e0e Added proximity check for feared clients 2020-03-18 16:12:25 -04:00
Chris Miles 0f92287c02 Merge pull request #993 from EQEmu/7z_tweak
Tweaked compression arguments for 7-Zip cli command invocation
2020-03-12 22:22:55 -05:00
Uleat 6a61fd5df9 Tweaked compression arguments for 7-Zip cli command invocation 2020-03-12 23:12:44 -04:00
Akkadius 06a51f555e Fix some stragglers 2020-03-12 03:15:14 -05:00
Akkadius 3dc227e8cc Update schema [skip ci] 2020-03-12 02:53:19 -05:00
Akkadius 4375e51431 Push up schema notes [skip ci] 2020-03-12 02:42:04 -05:00
Akkadius d360c60289 Migrate ldon traps and #hotfix [skip ci] 2020-03-12 02:40:04 -05:00
Akkadius 951a77716c Migrate NPC spells, emotes, merchantlist [skip ci] 2020-03-12 02:34:02 -05:00
Akkadius ca49f3902f Migrate getZoneX calls and npc types calls [skip ci] 2020-03-12 02:27:09 -05:00
Akkadius b22d8f6148 Migrate objects and pets [skip ci] 2020-03-12 01:47:40 -05:00
Akkadius a37260fec5 Port import and eport client files to use content database connection [skip ci] 2020-03-12 01:32:25 -05:00
Akkadius ea98a71f22 client_files/export main formatting [skip ci] 2020-03-12 01:24:35 -05:00
Akkadius 7ee28d6361 Migrate shared memory to use content database source; add logic in DB::core to prevent double freeing [skip ci] 2020-03-12 01:23:06 -05:00
Akkadius 49d835165c Shared memory formatting main.cpp [skip ci] 2020-03-12 00:01:30 -05:00
Akkadius 286c08b8d5 Migrate spawn tables [skip ci] 2020-03-12 00:00:39 -05:00
Akkadius 9048265283 Migrate horses [skip ci] 2020-03-11 23:29:54 -05:00
Akkadius 4b55438b3a Migrate ground_spawns [skip ci] 2020-03-11 23:29:24 -05:00
Alex dac7541d89 Update README.md
Change the badges to the updated builds we have for appveyor.
2020-03-11 20:43:53 -07:00
Chris Miles e7266943e2 Merge pull request #990 from alimalkhalifa/master
Modified eqemu_server.pl to pull latest PEQ
2020-03-11 21:20:27 -05:00
Ali 7f25f8a235 Modified eqemu_server.pl to pull latest PEQ
* Also added an escape to skip pulling Maps (tighter feedback loop if
developing)
2020-03-11 17:28:56 +03:00
Akkadius 26b24c02f1 Simplify connection logic 2020-03-11 04:23:44 -05:00
Akkadius 6af1ae32ae Migrate grids [skip ci] 2020-03-11 04:10:21 -05:00
Akkadius 262432f504 Migrate start_zones [skip ci] 2020-03-11 03:58:30 -05:00
Akkadius 3a09197d77 Migrate zone [skip ci] 2020-03-11 03:55:44 -05:00
Akkadius 8d21225eb3 Migrate veteran_reward_templates [skip ci] 2020-03-11 03:43:16 -05:00
Akkadius 4b2fe732d2 Migrate tributes [skip ci] 2020-03-11 03:41:58 -05:00
Akkadius f5cba5ecab Migrate tradeskills and traps [skip ci] 2020-03-11 03:41:09 -05:00
Akkadius df66c75df2 Migrate global_loot [skip ci] 2020-03-11 03:31:20 -05:00
Akkadius b3e4d90e4f Migrate tasks [skip ci] 2020-03-11 03:31:06 -05:00
Akkadius 0d270fdac7 Migrate forage [skip ci] 2020-03-11 03:30:52 -05:00
Akkadius ed06129f9d Migrate fishing [skip ci] 2020-03-11 03:24:21 -05:00
Akkadius ec5be4985e Migrate factions [skip ci] 2020-03-11 03:22:36 -05:00
Akkadius c98d2743c5 Migrate doors [skip ci] 2020-03-11 03:20:38 -05:00
Akkadius 7c2a3f602c Migrate char_create_combinations [skip ci] 2020-03-11 03:12:53 -05:00
Akkadius 13e8199298 Migrate books [skip ci] 2020-03-11 03:10:40 -05:00
Akkadius 1737ef605c Migrate blocked_spells [skip ci] 2020-03-11 03:09:59 -05:00
Akkadius 8e441f006e Migrate auras [skip ci] 2020-03-11 03:06:40 -05:00
Akkadius 91ca5dcade Migrate alternate_currency [skip ci] 2020-03-11 03:02:41 -05:00
Akkadius 7cf52d467e Migrate adventure database calls [skip ci] 2020-03-11 03:00:08 -05:00
Akkadius dde9b98e4f Beginning of multi-tenancy work 2020-03-11 02:43:21 -05:00
Akkadius 240d5c2a66 Add LOS check with NPC::AICheckCloseBeneficialSpells [skip ci] 2020-03-11 01:39:08 -05:00
Akkadius 785804a936 Move tables around in schema [skip ci] 2020-03-10 19:54:26 -05:00
Akkadius e451dad94e Dump tweaks [skip ci] 2020-03-10 19:42:52 -05:00
Akkadius 08414bda55 Fix 7zip availability check [skip ci] 2020-03-10 19:18:18 -05:00
Chris Miles c39978d3d8 Merge pull request #989 from EQEmu/feature/database-dump-service
Database Dump Service
2020-03-10 18:02:30 -05:00
Akkadius f3d8271066 Slightly adjust manifest criteria [skip ci] 2020-03-10 13:41:53 -05:00
Akkadius 431a325414 Update manifest [skip ci] 2020-03-10 00:22:39 -05:00
Akkadius c42d6dcd1b Add 7zip compression; tweak dump settings 2020-03-10 00:14:28 -05:00
Akkadius fa12b146a3 Add "all" .sql files [skip ci] 2020-03-09 23:05:01 -05:00
Akkadius e7fab67d8a Finalize peq-dump.sh script [skip ci] 2020-03-09 22:57:27 -05:00
Akkadius 6438a37fb5 Split up state table dump 2020-03-09 16:31:43 -05:00
Akkadius 899e2d3397 Add innodb conversion script; will hook up in manifest later 2020-03-09 16:31:30 -05:00
Akkadius 53be04c39c Don't lock tables by default; move tables around in schema; add peq-dump.sh script 2020-03-09 15:51:11 -05:00
Akkadius bfecd6ad14 Add query-serv table dump option, add option to dump directly to console, add initializers for dump settings 2020-03-09 14:08:17 -05:00
Akkadius dd1470892d Update database_dump_service.cpp 2020-03-09 03:20:43 -05:00
Akkadius d4a1ea82dc Create database_dump_service.cpp 2020-03-09 03:01:59 -05:00
Chris Miles 8d252dfd9a Implement database dump service 2020-03-09 03:00:07 -05:00
Alex 1577f2823b Merge pull request #988 from KinglyKrab/master
Add GetRaidIDByCharID to Perl/Lua.
2020-03-08 22:42:17 -04:00
Alex cede38f562 Add GetRaidIDByCharID to Perl/Lua. 2020-03-08 21:11:56 -04:00
Alex 201757567c Merge pull request #987 from KinglyKrab/master
Add GetGroupIDByCharID and GetGuildIDByCharID to Perl/Lua.
2020-03-08 20:50:07 -04:00
Alex 2a9248697e Add GetGroupIDByCharID and GetGuildIDByCharID to Perl/Lua. 2020-03-08 20:49:01 -04:00
Michael Cook (mackal) 3708efd8df Merge pull request #984 from EQEmu/bug_fix/split_in_raid
Fix /split while in a raid
2020-03-08 01:03:16 -05:00
Michael Cook (mackal) 1d907564e9 Merge pull request #986 from regneq/master
Faction conning indifferent regardless of faction level in no-combat zones.
2020-03-07 22:01:26 -05:00
regneq 1b15ee141d Faction always conned indifferent in no combat zone such as PoK, Nexus, etc regardless of faction level as evident with Planar Traveler's Manual (faction modifier) and restocking high quality ore (faction reward) in Bazaar and PoK. 2020-03-07 18:38:38 -08:00
Chris Miles d838ac9582 Merge pull request #985 from KinglyKrab/master
Deleted characters will no longer show in the guild window.
2020-03-07 20:32:34 -06:00
regneq dce5dea609 Merge pull request #4 from EQEmu/master
Update
2020-03-07 18:21:25 -08:00
Alex 581d5b1289 Deleted characters will no longer show in the guild window. 2020-03-07 18:58:12 -05:00
JJ 4915e86aba Slight tweak (field name) to #983 "Override LEVEL and INT aggro blocking".
If you already ran the previous SQL, use this instead:
ALTER TABLE `npc_types` CHANGE `always_aggros_foes` `always_aggro` TINYINT(1) NOT NULL DEFAULT '0';
2020-03-05 22:31:54 -05:00
JJ 09e9c0b504 Merge branch 'master' of https://github.com/EQEmu/Server 2020-03-05 21:40:33 -05:00
Michael Cook (mackal) a3eb74b855 Fix /split while in a raid
This still doesn't add support for /autosplit in a raid, how should that
work?

This changes the Raid::SplitMoney to take a group ID and fails when
provided with RAID_GROUPLESS. This does change behavior, but I'm not
sure if it was ever used so ...
2020-03-05 14:37:43 -05:00
Alex fb396e9f60 Merge pull request #983 from noudess/master
Update version for always_aggros_foes db change.
2020-03-05 13:06:10 -05:00
Noudess d85469dff9 Update version for always_aggros_foes db change. 2020-03-05 13:04:21 -05:00
Alex 3f7ce5df72 Merge pull request #982 from noudess/master
Add flag which can enable a mob to always aggro a foe regardless of int or level
2020-03-05 12:31:59 -05:00
Noudess d5b3dc7c0a Merge remote-tracking branch 'refs/remotes/origin/master' 2020-03-05 10:48:40 -05:00
Noudess ac3b4ade10 Implement new always_aggro_foes field and functionality for mobs. 2020-03-05 10:44:01 -05:00
Paul Coene 482584f95a Merge pull request #4 from EQEmu/master
Update to master
2020-03-05 10:37:41 -05:00
Alex 57e7b4a2b8 Merge pull request #981 from xackery/dev-container
Improved vscode devcontainer setup
2020-03-05 09:40:14 -05:00
Uleat 7f6414d685 Some bot-related changes (Master Wu's Technique, Tiger Claw timer) 2020-03-02 12:09:55 -05:00
Xackery Xtal 81e91d7956 Improved vscode devcontainer setup 2020-02-29 21:34:38 -08:00
JJ 3875485567 Merge branch 'master' of https://github.com/EQEmu/Server 2020-02-28 21:41:52 -05:00
JJ eb104e40de Update link [skip ci] 2020-02-28 21:39:46 -05:00
Michael bec33e22da Update Readme [skip ci]
Updated Windows Installer Link
2020-02-28 21:38:39 -05:00
Chris Miles ac104ed4e0 Merge pull request #977 from prestanneth/master
CheckIncreaseSkill() for Throwing within combat abilities
2020-02-27 17:29:54 -06:00
Alex 0ffb5c46a5 Missing bracket 2020-02-24 15:00:12 -08:00
Alex 92638504db Merge pull request #980 from noudess/patch-11
restore some code unintentionally removed
2020-02-24 13:53:33 -08:00
Paul Coene 08002eacea restore some code unintentionally removed
Checked with @KimLS.
2020-02-24 16:51:05 -05:00
KentaiVZ 79248cffec Merge branch 'master' of https://github.com/prestanneth/Server 2020-02-23 12:23:02 +11:00
Chris Miles 8787f51b58 Merge pull request #979 from hgtw/fix/zlib-deflate-size
Send packet uncompressed if zlib deflates to a larger size than input
2020-02-22 16:24:27 -06:00
Chris Miles 69f4d90737 Merge pull request #976 from xackery/master
Added NPC::RecalculateSkills
2020-02-22 16:20:59 -06:00
Chris Miles 1371e1e7ed Merge pull request #978 from xackery/vscode
Added vscode environment files
2020-02-22 16:19:22 -06:00
Chris Miles 81ff7f5d57 Merge pull request #964 from EQEmu/feature/hot-reload
Feature - Hot Reload
2020-02-22 16:18:47 -06:00
Akkadius 8376ed5d3f PR adjustments 2020-02-22 16:17:18 -06:00
Xackery Xtal fe4a0cfdba Added vscode environment files 2020-02-20 16:50:34 -08:00
kentai 0043f56984 ... 2020-02-20 14:37:26 +11:00
kentai 6ddc5ea8e8 CheckIncreaseSkill() from Client::ThrowingAttack() to DoThrowingAttackDmg() so it gets called during combat abilities(zerker volley), as well as regular throws(monk ranged). 2020-02-20 14:23:06 +11:00
Uleat be38a62d70 Merge pull request #971 from EQEmu/eqemu_server_db_updates
Eqemu server db updates [skip ci]
2020-02-19 13:10:36 -05:00
Uleat fdc38315d3 Updated eqemu_server.pl console messages for Applying/Has update messages [skip ci] 2020-02-19 07:52:10 -05:00
Uleat e7c000813f Merge branch 'master' of https://github.com/EQEmu/Server into eqemu_server_db_updates 2020-02-19 02:08:11 -05:00
Michael Cook (mackal) 6fb0042e3f Add packet struct and ops for AdvancedLoreText
Just stuff if people want to start working on it
2020-02-18 15:50:01 -05:00
Xackery Xtal 0a4429c0c0 Added NPC::RecalculateSkills 2020-02-18 09:21:18 -08:00
Michael Cook (mackal) a63dc7d5e0 Merge pull request #974 from noudess/master
Added a rule to disallow click training of tomes and fall back to handins.
2020-02-16 14:37:56 -05:00
Michael Cook (mackal) 67449de27e Merge pull request #973 from TheGrandPackard/Character-PetsUseReagents-Fix-Necro-Spells
Add Necromancer pet spell effect id to pet spell reagent check
2020-02-16 14:37:26 -05:00
Paul Coene 10e5f0e949 Update ruletypes.h 2020-02-16 12:28:18 -05:00
Joshua Packard 141ecca2bc Add necromancer pet spell check to other reagent logic 2020-02-16 09:23:26 -08:00
Paul Coene bd4fa4fb6b Implement RuleB(Skills, RequireTomeHandin) 2020-02-16 11:42:55 -05:00
Paul Coene 5901df4485 Added Skills, RequireTomeHandin rule
Default behavior will remain the same as current code.

If set to true, tomes will need to be turned in to Guild Masters to learn, like in older times.
2020-02-16 11:41:08 -05:00
Paul Coene 8cda4257b4 Merge pull request #3 from EQEmu/master
Update to Master
2020-02-16 11:38:20 -05:00
Joshua Packard 709a25ba9e Add necro pet spell effect id to pet spell reagent check 2020-02-15 16:55:18 -08:00
hg ed09d4ae54 Send packet uncompressed if zlib deflates to a larger size than input
It's not guaranteed that deflate output will be smaller than the input.

In some cases zlib-ng (Z_BEST_SPEED) compression is causing packets to
increase in size and exceed m_max_packet_size. This results in the
packets never being fully received by the client.

Currently this is most reproducible in the spell_book section of the
OP_PlayerProfile message. After using #scribespells this portion of the
player profile has a lot of incrementing spellids which may be affecting
the compression algorithm. The client never processes the player profile
(MSG_SEND_PC) message and times out on zone entry.

This isn't necessarily a bug with zlib-ng since it inflates back to the
original input and normal zlib could do this too, but the current netcode
doesn't handle this.
2020-02-14 10:06:47 -05:00
Alex 952fd43301 Merge pull request #970 from xackery/master
Added EnableFoodRequirement Rule
2020-02-08 22:07:41 -05:00
Xackery Xtal 5f8d193d6a Added EnableFoodRequirement 2020-02-08 18:01:46 -08:00
Michael Cook (mackal) a4a70cf225 Merge pull request #969 from EQEmu/bug_fix/loh_skill_death_reset
LoH skill needs to be reset on death
2020-02-06 19:50:30 -05:00
Michael Cook (mackal) 29fccd9239 LoH skill needs to be reset on death 2020-02-06 16:44:46 -05:00
Michael Cook (mackal) cdc82f0ba7 Merge pull request #968 from EQEmu/feature/aa_timer_reset_on_death
Implement AA timers reset on death
2020-02-06 16:30:10 -05:00
Uleat 78756f27b6 Merge branch 'master' of https://github.com/EQEmu/Server into eqemu_server_db_updates 2020-02-06 16:23:25 -05:00
Michael Cook (mackal) 2f5909d4cb Implement AA timers reset on death
This is a field in the packet, live only uses this for Lay on Hands

Currently I didn't add this to the packet since it has 0 effect on the
client.

We could move this field to aa_ranks which would give more flexibility
for custom servers, but no one said they wanted it there.
2020-02-06 14:20:18 -05:00
Michael Cook (mackal) 13c2df7eb1 Merge pull request #967 from EQEmu/feature/global_loot_hot_zone
Add hot_zone filtering for global loot
2020-02-06 12:56:20 -05:00
Michael Cook (mackal) 16ac6f624b Remove extra whitespace 2020-02-06 01:59:18 -05:00
Michael Cook (mackal) 501204a4d2 Add hot_zone filtering for global loot
We do this in GlobalLootEntry::PassesRules since we want to check if the
hot zone status changes during run time

Value can be null, if null it's not checked. If the value is 0 the zone
must not be a hot zone (I guess one might want that) and if it's not 0,
the zone must be a hot zone
2020-02-06 01:52:35 -05:00
Michael Cook (mackal) 8bcef6c2e7 Fix BodyType bug in GlobalLoot 2020-02-06 01:08:53 -05:00
Michael Cook (mackal) 2db47adf7b Merge pull request #966 from noudess/master
Idle NPC mana regen
2020-02-05 21:17:23 -05:00
Uleat 916c88939c Added missing 'return' 2020-02-05 21:05:51 -05:00
Paul Coene 1528e7cb09 Update npc.cpp 2020-02-05 16:28:07 -05:00
Paul Coene 8dacadb4f9 Update ruletypes.h 2020-02-05 16:26:46 -05:00
Paul Coene e19db3b7f4 Update npc.cpp 2020-02-05 16:25:24 -05:00
Paul Coene e1adffc4be Update npc.cpp 2020-02-05 15:32:07 -05:00
Chris Miles 7eb71c5902 Merge pull request #953 from noudess/patch-5
_GetRunSpeed did not correctly report aa mods for Clients.
2020-02-05 14:10:47 -06:00
Chris Miles da397606b6 Merge pull request #965 from noudess/master
Added RuleI(Combat, LevelToStopACTwinkControl)
2020-02-05 14:10:25 -06:00
Paul Coene 6b27e88315 Update attack.cpp 2020-02-05 14:42:37 -05:00
Paul Coene 4accb4ea2a Update ruletypes.h 2020-02-05 14:41:36 -05:00
Paul Coene c419df52ff Merge pull request #2 from EQEmu/master
Get up to date
2020-02-05 14:40:12 -05:00
Alex 46ff09f438 Merge pull request #962 from noudess/patch-8
Implement DefaultGuild Rule
2020-02-05 13:05:07 -05:00
Paul Coene b4f42c150f Update database.cpp
Change variable_name and use LastInsertedID() to remove unneeded call.
2020-02-05 12:31:29 -05:00
Akkadius 49134644bc Update dbcore logging to use aliases 2020-02-05 01:56:39 -06:00
Akkadius 861b879a94 Add GetCharacterTables() with table - key pair. Use in character hard deletes https://gist.github.com/Akkadius/f10e3757a0b52b971076643eccf9c5d0 2020-02-05 01:34:29 -06:00
Akkadius 929e4c1317 Adjust verbiage [skip ci] 2020-02-04 23:52:18 -06:00
Chris Miles 138cb80b19 Merge pull request #958 from hgtw/feat/autoconsent
Implement consent for group/raid/guild and add Auto Consent support
2020-02-04 18:22:05 -06:00
Uleat 86b6f543b9 Reworked the update cycle of eqemu_server.pl to process each update cumulatively [skip ci] 2020-02-04 19:07:55 -05:00
hg d7138e84c0 Make consent variable names more descriptive and replace char pointer parameters with std::string
Use fmt::format for SQL statement when updating corpse guild id
2020-02-04 18:54:43 -05:00
Michael Cook (mackal) 2d24cdf5e4 Merge pull request #963 from noudess/patch-10
Update command.cpp
2020-02-04 13:24:49 -05:00
Akkadius 4416e774c2 Merge branch 'master' of https://github.com/EQEmu/Server into feature/hot-reload 2020-02-04 00:25:23 -06:00
Akkadius 342012c4f4 Fix compile issue 2020-02-04 00:24:43 -06:00
Akkadius 34005cd2ed Merge branch 'master' of https://github.com/EQEmu/Server into feature/hot-reload 2020-02-04 00:12:51 -06:00
KimLS 6bc6b659d5 Merge branch 'master' of github.com:EQEmu/Server 2020-02-03 17:17:26 -08:00
Paul Coene ad1f18306b Update command.cpp
Fix #size command to be useful for anyone using the model field in npc_types.

All will remain the same for everyone else.
2020-02-03 13:47:16 -05:00
Paul Coene 6a984a53b5 Merge pull request #1 from noudess/patch-9
Implement DefaultGuild rule
2020-02-03 13:02:55 -05:00
Paul Coene f9b3b7aecf Implement DefaultGuild rule 2020-02-03 12:54:26 -05:00
Paul Coene 5fefdfcc17 Added new DefaultGuild rule to Character 2020-02-03 12:50:05 -05:00
Uleat 00f118cfb4 Removed bot rule and command update code from setup because of auto-injection/removal feature added to server code [skip ci] 2020-02-03 08:36:14 -05:00
Uleat a7633f4ddf Massaged database update code [skip ci] 2020-02-03 08:18:55 -05:00
regneq f742d6427b Merge pull request #3 from EQEmu/master
Update
2020-02-02 20:48:05 -08:00
KimLS d65a97e556 Rule for setting max navmesh nodes, default set higher than current to improve accuracy 2020-02-02 20:19:37 -08:00
hg b8229c8459 Update CURRENT_BINARY_DATABASE_VERSION for consent sql update 2020-02-02 22:57:59 -05:00
Michael Cook (mackal) 424b669cbb Target not required for newer clients in QuestReward 2020-02-02 16:39:46 -05:00
hg e09b0ae1e9 Let client handle consent confirmation messages to corpse owner 2020-02-02 14:37:12 -05:00
KimLS c2300d514c Packet warnings 2020-02-01 20:49:04 -08:00
Michael Cook (mackal) f195820854 Merge pull request #959 from hgtw/fix/raid-invite-crash
Fix zone crash when a group member raid invites own group leader
2020-02-01 22:59:33 -05:00
Michael Cook (mackal) 59903313e4 Expand Lua's Client QuestReward function
You can now use it to summon up to 8 items ex:
`e.other:QuestReward(e.self, {items = {28745, 28092}, exp = 250})`

This expands the version that takes a table. The new item is a table (in
the main table) called items, which needs to be auto keyed like the
example above. If you also provide the old itemid key, it will be
ignored if the items is there.
2020-02-01 22:48:39 -05:00
Michael Cook (mackal) b351d3718a Merge pull request #961 from noudess/patch-7
Fix FixZ regarding the use of model in npc_types
2020-02-01 21:55:53 -05:00
Paul Coene ab3d65b2ea Fix FixZ regarding the use of model in npc_types
This fix only impacts those that use the model field in npc_types to override race on the client.

GetModel() returns model if set, otherwise race.

As a refresher, the model field is there so the server can still see a mob as its base race for things like bane, while the client can use a new model.

FixZ needs to know about this.
2020-02-01 20:29:48 -05:00
Michael Cook (mackal) b02e87cce7 Fix Client::QuestReward for struct adjustment 2020-02-01 19:54:26 -05:00
Michael Cook (mackal) 50a39057e4 Update QuestReward_Struct 2020-02-01 19:27:15 -05:00
Akkadius c8e6d031cf Add more rule-driven behavior 2020-01-31 21:51:05 -06:00
Akkadius 158d8a011f Beginning of hot reload work 2020-01-31 20:25:06 -06:00
hg 14c070f845 Use strn0cpy instead of strcpy when copying consent name buffers
Add nullptr checks to consent functions that accept char pointers
2020-01-30 20:19:54 -05:00
Michael Cook (mackal) 6dee837f67 Merge pull request #960 from noudess/patch-6
Further refine monk weight checks for floating point
2020-01-30 15:41:25 -05:00
Paul Coene 83ad9c86db Update attack.cpp 2020-01-30 15:19:02 -05:00
Paul Coene bcb08f99f0 Update attack.cpp 2020-01-30 15:05:41 -05:00
Paul Coene f968d0df4c Reduce changes to those suggested by @mackal 2020-01-30 15:04:06 -05:00
Paul Coene 712366293d Further refine monk weight checks for floating point 2020-01-30 11:10:57 -05:00
hg 9689787e56 Remove assignments in conditions 2020-01-29 18:34:33 -05:00
Uleat 92d32feb0d Fix for player hp updates not matching between client and server 2020-01-28 21:24:14 -05:00
hg 371265d143 Make guild consent persistent for summoned corpses
Live drops group/raid consent but not guild when moving corpse to another zone
Store guild consent id in db for character corpses and keep it updated
2020-01-28 19:41:27 -05:00
hg 43da07fb55 Fix zone crash when a group member raid invites own group leader 2020-01-28 19:37:36 -05:00
regneq f880663528 Merge pull request #2 from EQEmu/master
Update
2020-01-28 15:36:23 -08:00
hg 63b8df72b2 Implement consent for group/raid/guild and add Auto Consent support
Refactors consent to be more live accurate

Message sent to owner and receiver for each zone a corpse is in
Corpses now store consent list instead of clients holding corpse list
Consent throttling added
Message strings and colors updated
Removed reporting invalid consent targets
2020-01-27 00:17:15 -05:00
Akkadius c82d08cf11 Make sure character soft deletes do not reserve name once deleted, add optional retro script to run for servers who had soft deletes running prior to this commit 2020-01-26 16:31:15 -06:00
Akkadius c6ba29f2e5 Revert commit until further testing [skip ci] 2020-01-25 18:41:15 -06:00
Akkadius 6514ccc41c Bot updates are killing running regular updates afterwards [skip ci] 2020-01-25 18:30:52 -06:00
Akkadius 2f49266d08 Fix bots db updates when bins are in bin folder [skip ci] 2020-01-25 18:26:59 -06:00
Michael Cook (mackal) ff897dc90a Update CURRENT_BINARY_DATABASE_VERSION 2020-01-24 20:36:33 -05:00
Michael Cook (mackal) f73f72b2b2 Merge pull request #956 from regneq/master
New pathgrid types.  fixed an issue where npc would face north when pause and heading were set at -1.
2020-01-24 20:31:10 -05:00
regneq c2b3e85272 Added new pathgrid type 7 (GridCenterPoint). This grid causes a NPC to alternate between the first waypoint in their grid (Number 1 in the editor) and a random waypoint. (1 - 7 - 1 - 4 - 1 - 11 - 1 - 5 - 1, etc)
Changed the wandertype IDs to an enum so we know what we're looking at.
Added new pathgrid type 8 (GridRandomCenterPoint).  (SQL required) This new type causes a NPC to alternate between a random waypoint in grid_entries and a random waypoint marked with the new centerpoint column set to true. If no waypoints are marked as a centerpoint, this wandertype will not work. There is no numbering requirement or limit for centerpoints. You can have as many as you need.
New spawngroup field: wp_spawns (SQL required). Added a new spawngroup field, which is a boolean that if true changes the behavior of spawngroups this way: If the spawnpoint in the spawngroup has a grid, the NPC will spawn at a random waypoint location taken from its grid instead of the spawnpoint location.
New randompath behavior: The randompath grid type will now use the closest waypoint as its current waypoint on spawning.  This allows multiple spawn locations to use the same grid without having the undesirable behavior of walking to the first waypoint through walls and ignoring waypoint nodes. NPC::GetClosestWaypoint() was renamed to NPC::GetClosestWaypoints() as it was filling a list of multiple waypoints. a new method NPC::GetClosestWaypoint() returns a single waypoint in the form of an integer.
2020-01-24 15:11:08 -08:00
Michael Cook (mackal) c590cf7c35 Let's try updating travis to bionic 2020-01-23 23:36:13 -05:00
regneq 453bee511a Merge pull request #1 from EQEmu/master
update
2020-01-22 16:22:35 -08:00
Alex 1baeb01e65 Merge pull request #955 from KinglyKrab/master
New Corpse Methods.
2020-01-20 21:15:41 -05:00
Kinglykrab 8b37ef5e67 Formatting 2020-01-20 21:14:28 -05:00
Kinglykrab caceae1028 Implement Corpse counting methods for global/zone-specific counting.
Global:
- Perl: quest::getplayercorpsecount(uint32 char_id);
- Lua: eq.get_player_corpse_count(uint32 char_id);

Zone-specific:
- Perl: quest::getplayercorpsecountbyzoneid(uint32 char_id, uint32 zone_id);
- Lua: eq.get_player_corpse_count_by_zone_id(uint32 char_id, uint32 zone_id);
2020-01-20 20:23:11 -05:00
Kinglykrab 8e6dd638ff Implement SE_SummonCorpseZone (SPA 388).
- This SPA summons all of a targeted group or raid group member's corpses from anywhere in the world.
- Example Spell 16247 (Summon Remains)
2020-01-20 20:20:06 -05:00
Paul Coene 51fb7d8b77 _GetRunSpeed did not correctly report aa mods for Clients.
I actually believe this was some old cut-n-paste error.  aa_mod was being set to a total of all (3) caps - like the previous line.
2020-01-20 15:38:07 -05:00
Michael Cook (mackal) f6ed4bb888 Merge pull request #952 from noudess/patch-4
Fix formula for mana
2020-01-20 14:49:23 -05:00
Paul Coene 9cc73f2b4a Fix formula for mana
There were errors in the old formula for wis/int values over 201.
2020-01-20 14:24:29 -05:00
Akkadius 6f73278cf8 Fix annoying aura crash that has been around for a year and a half, add aura logging, utilize close lists 2020-01-19 21:57:28 -06:00
Michael Cook (mackal) 6c91786cfb Merge pull request #950 from noudess/patch-3
Update attack.cpp
2020-01-19 16:11:20 -05:00
Paul Coene 8eb60302a2 Update attack.cpp
Fix to Monk Mitigation.  Divided weight by 10 to convert to stones.
2020-01-19 16:03:09 -05:00
Michael Cook (mackal) 43df845233 Fix issue with overflow in Mob::SendHPUpdate 2020-01-18 21:42:51 -05:00
Michael Cook (mackal) feefd7a23b Update default NPC:NPCGatePercent value to something more live like 2020-01-17 17:30:38 -05:00
Michael Cook (mackal) 5a1eac010b Merge pull request #945 from noudess/patch-2
Update waypoints.cpp
2020-01-17 14:52:31 -05:00
Paul Coene d47bf6a73b Update waypoints.cpp
Fixed log message to be correct.
2020-01-17 14:35:32 -05:00
Uleat daa9c04e89 Merge branch 'master' of https://github.com/EQEmu/Server 2020-01-16 20:49:12 -05:00
Uleat a9ef2474d4 Updated eqemu_server.pl to use the appveyor archive when setting up bots [skip ci] 2020-01-16 20:49:03 -05:00
Michael Cook (mackal) e1408ede6b Remove AdventureManager::Load since it doesn't do anything 2020-01-16 19:22:17 -05:00
Michael Cook (mackal) 4241fba7e2 Forgot 2 exceptions 2020-01-16 19:10:04 -05:00
Michael Cook (mackal) 139b6c34e5 Change things -Wcatch-value complains about to references 2020-01-16 19:03:36 -05:00
Michael Cook (mackal) baf4cc62eb Fix format truncation in RoF2 OP_Trader 2020-01-16 18:04:20 -05:00
Michael Cook (mackal) 14402c9c41 Fix unreachable switch statements in console_server_connection.cpp 2020-01-16 17:44:46 -05:00
Michael Cook (mackal) e4c4e5edb2 References shouldn't be null 2020-01-16 17:17:31 -05:00
Michael Cook (mackal) e6a14beb2e Remove another unnecessary this == null check 2020-01-16 17:06:11 -05:00
Michael Cook (mackal) 945ca1278c Remove some unnecessary this == null checks 2020-01-16 17:02:35 -05:00
Michael Cook (mackal) a307747c29 Nuke unused command_itemtest 2020-01-16 16:51:24 -05:00
Michael Cook (mackal) 099da513ff Remove some unused misc.cpp functions (encode/decode)
These were unused and throwing warnings, so throw them away!
2020-01-16 16:18:08 -05:00
Michael Cook (mackal) 607379110b Add some focus effects bots were missing 2020-01-16 16:00:38 -05:00
Michael Cook (mackal) 7ce88b30ad Remove Bot::BotfocusType
This was just a maintenance burden keeping it in sync with focusType
(and it wasn't!)
2020-01-16 15:47:25 -05:00
Michael Cook (mackal) 28b0526857 Change NPCType::deity to uint32 to match client data type
Fixes overflow warning in bot.cpp
Shouldn't need DeityAgnostic_LB anymore either
2020-01-16 15:16:21 -05:00
Michael Cook (mackal) d5067c4c3a Treat bots like PCs for pcnpc_only_flag 2020-01-15 19:30:47 -05:00
Uleat 79db824a3c Fix for bots update reporting errors on server start-up after newer update applied [skip ci] 2020-01-15 02:56:00 -05:00
Akkadius 331032f4f4 Push a scan when mobs first construct [skip ci] 2020-01-14 16:14:19 -06:00
Uleat 61790ef195 Wasn't quite dead... (Removed substring call from silent saylink parsing) 2020-01-13 19:01:42 -05:00
Uleat 9bdb70b2f0 Fatality! (Fix for event_say parse events not observing the correct parser for their situation) 2020-01-13 01:47:39 -05:00
Uleat c438819ed6 Fix for command redirect of '#bot' using EVENT_COMMAND invocation 2020-01-12 22:40:05 -05:00
Uleat 7a791dda3c Merge branch 'master' of https://github.com/EQEmu/Server 2020-01-12 21:11:51 -05:00
Uleat 6366a3fa38 Fix for silent saylinks and EVENT_COMMAND calls 2020-01-12 21:11:43 -05:00
Akkadius 306a08b9ac Unify / streamline scanning logic calls, do a manual scan on enter and cleanup logging 2020-01-12 19:37:53 -06:00
Uleat 467f8d7867 Merge branch 'master' of https://github.com/EQEmu/Server 2020-01-12 01:33:17 -05:00
Uleat 6c2100a650 Fix for perl EVENT_COMMAND not exporting single arguments 2020-01-12 01:32:51 -05:00
Akkadius 9dacd0bd7a Remove aa_timers from character tables [skip ci] 2020-01-11 18:19:27 -06:00
Akkadius 3c6cdd0905 Update character_table_list.txt for now until replaced [skip ci] 2020-01-11 18:02:01 -06:00
Akkadius d1fb74ff5f Fix bot table 2020-01-10 02:59:52 -06:00
Akkadius f81b9d8244 Update worlddb.cpp 2020-01-10 02:54:34 -06:00
Akkadius b9e87abb3c Implement Character Soft Deletes 2020-01-10 02:54:29 -06:00
Uleat 451b0180c9 Merge pull request #943 from EQEmu/script_commands
Reworked EVENT_COMMAND handling and addressed script commands not present during help use
2020-01-07 21:43:32 -05:00
Akkadius 77ae4f0c3f Update missing aliases for when log compilation flag is turned off [skip ci] 2020-01-07 16:09:14 -06:00
Uleat 852d951b65 Reworked EVENT_COMMAND handling and addressed script commands not present during help use 2020-01-06 15:41:05 -05:00
Uleat 4e8aec136e Merge pull request #942 from noudess/patch-1
Added addition usage message for #grid for #grid show. (noudess)
2020-01-04 20:17:07 -05:00
Paul Coene eed4a648b4 Added addition usage message for #grid for #grid show. 2020-01-04 16:17:25 -05:00
Uleat 720d314bb8 Merge branch 'master' of https://github.com/EQEmu/Server 2020-01-04 01:56:45 -05:00
Uleat e5ec277b5e Temporary bot impl until further work can be done 2020-01-04 01:56:38 -05:00
Chris Miles 47aa23e21e Merge pull request #941 from KinglyKrab/master
Fix #reloadworld message.
2020-01-03 23:30:21 -06:00
Kinglykrab 8ad11d0f85 Fix #reloadworld message. 2020-01-03 22:31:13 -05:00
KimLS 6243a31644 Added ability to use default looping behavior of libuv, in use in zone now 2020-01-03 19:12:55 -08:00
Akkadius 958a6d939e Have MySQL log timing display correctly 2020-01-03 18:10:30 -06:00
Akkadius e27c4f4f7c Lets fix some overflows [skip ci] 2020-01-03 17:48:41 -06:00
Akkadius 662048cedc Make the logs even better! [skip ci] 2020-01-03 17:25:53 -06:00
Akkadius 9dda9098a0 Add logging for flee 2020-01-03 17:23:51 -06:00
Michael Cook (mackal) 3a10131a00 Add missing currently_fleeing flag to sanity check 2020-01-03 15:50:10 -05:00
Michael Cook (mackal) a94072e3ea Fix CheckFlee logic
This /should/ be correct. But it doesn't explain other issues we've seen
on some servers
2020-01-03 15:49:20 -05:00
Akkadius 40595de46b Fix fmt bindings 2020-01-02 22:27:53 -06:00
Akkadius d6d361f5eb Adjust logging in legacy_combat.lua [skip ci] 2020-01-02 20:10:14 -06:00
Akkadius c48e8d8823 Tweak logging code 2020-01-02 20:04:37 -06:00
Akkadius 61d1c2d75c Update legacy_combat.lua to be more accurate, better logging 2020-01-02 01:08:36 -06:00
Akkadius 69d887b421 Use something a little more compatibility friendly 2020-01-01 20:47:58 -06:00
Uleat e7ad57a37e Resistance is futile! 2020-01-01 21:12:09 -05:00
Uleat d50e5855c4 There, there windows..it'll be ok... 2020-01-01 20:57:42 -05:00
Akkadius 689493610f Make windows happy? 2020-01-01 19:16:33 -06:00
Akkadius 406b193206 Cleanup Perl logging and streamline formatting, tie errors to main Quests logging category live output, add string utils 2020-01-01 19:04:11 -06:00
Akkadius 6e4d9a915d Fix database update condition loop [skip ci] 2020-01-01 14:56:15 -06:00
Chris Miles 3e0ded6c39 Merge pull request #940 from EQEmu/feature/ae-scanning-optimizations
Mob Scanning and Loop Optimizations
2019-12-31 03:13:04 -06:00
Akkadius 9a08b1be93 Flip [skip ci] 2019-12-30 20:18:44 -06:00
Akkadius d71afda954 Optimize cleanup QueueCloseClients [skip ci] 2019-12-30 20:15:33 -06:00
Akkadius a9e4d1212e Update download URL for weekly dump [skip ci] 2019-12-30 05:48:42 -06:00
Michael Cook (mackal) a7479a628c Use CastTime == 0 on clickies to prevent reagent consumption
This /may/ not be correct, but we think it is
2019-12-29 23:00:42 -05:00
Akkadius 67562e3e42 Unify scanning rules [skip ci] 2019-12-29 20:46:40 -06:00
Michael Cook (mackal) 53a289a6bc Refactor Mob::CastedSpellFinished
We now only call GetInv().GetItem() once
2019-12-29 21:40:36 -05:00
Akkadius a5d41b02b7 More tweaks [skip ci] 2019-12-29 17:34:50 -06:00
Akkadius 0232a8a188 More tweaks [skip ci] 2019-12-29 17:20:39 -06:00
Akkadius 78d63165cb Tweaks [skip ci] 2019-12-29 17:10:53 -06:00
Akkadius ccce630cb2 Adjustments [skip ci] 2019-12-29 13:30:05 -06:00
Akkadius 59b2d18a95 Adjust pointer 2019-12-29 03:37:01 -06:00
Akkadius 54f73d7420 Port MassGroupBuff 2019-12-29 03:33:07 -06:00
Akkadius 0f9c34cf3c Port more AE functions to use flexible GetCloseMobList call 2019-12-29 03:28:48 -06:00
Akkadius e531e68b6d Port AEBardPulse to use GetCloseMobList logic 2019-12-29 03:22:14 -06:00
Akkadius 233f26996b Add GetCloseMobList into other calls 2019-12-29 03:15:42 -06:00
Akkadius ec5faea9b1 Use GetSmartMobList in AESpell 2019-12-29 02:42:52 -06:00
Akkadius 6b465c576d More scanning work to unify data structures 2019-12-29 02:01:48 -06:00
Akkadius 9481e9eb2d More scanning changes around AE cast 2019-12-28 23:58:18 -06:00
Akkadius b11528fbcc Merge branch 'master' of https://github.com/EQEmu/Server into feature/ae-scanning-optimizations 2019-12-29 04:47:04 +00:00
Akkadius 2f564d9651 Merge branch 'master' of https://github.com/EQEmu/Server 2019-12-28 22:45:39 -06:00
Akkadius 4b6a1242f5 Fix water map loading case sensitivity issues when using lowercase water maps like the rest of the map code 2019-12-28 22:45:35 -06:00
Uleat 5fee9b2b3e Fix for Client::SendStatsWindow(...) based zone crashes 2019-12-28 23:17:38 -05:00
Akkadius f9e822072f AE Scanning adjustments, testing 2019-12-28 17:08:34 -06:00
Uleat 0643df3dbe Tweaked client-referenced _GetWalkspeed() and _GetRunSpeed() functions to avoid external calls when HorseID is null 2019-12-25 19:02:35 -05:00
Akkadius 8cb51eb253 Scanning optimization work from over a year ago from EZ - cleaned up a bit 2019-12-25 03:16:14 -06:00
Akkadius 07fd803d41 Fix db updates for binaries in ./bin/ path 2019-12-25 02:21:10 -06:00
Chris Miles 255c755169 Merge pull request #939 from EQEmu/feature/world-cli-handler
World CLI Handler - Database Schema
2019-12-25 00:24:04 -06:00
Akkadius 77feaa9ac1 Adjust description [skip ci] 2019-12-25 00:19:59 -06:00
Akkadius fe18033b5d Only add a loginserver if it has a non-empty value 2019-12-24 23:57:54 -06:00
Akkadius 995fb6914e Adjust order of operations 2019-12-24 23:57:36 -06:00
Uleat 6c35611cd0 Exported Entity::IsBot() (as Mob) to the perl api 2019-12-24 16:24:25 -05:00
Uleat 8a038e17e5 Merge branch 'master' of https://github.com/EQEmu/Server 2019-12-24 14:58:06 -05:00
Uleat 7678a905c8 Modified bot command 'pull' to ignore engaged targets 2019-12-24 14:57:58 -05:00
Akkadius 80d8736276 Merge branch 'master' of https://github.com/EQEmu/Server into feature/world-cli-handler 2019-12-24 03:00:48 -06:00
Akkadius 20538e91a1 Adjust usages for banned_ips table to reflect Uleat's changes 2019-12-24 02:59:58 -06:00
Uleat 72f4f10dbb Rename table Banned_IPs to banned_ips [skip ci] 2019-12-24 02:36:00 -05:00
Akkadius c173936e32 Add banned IP's 😠 2019-12-24 00:27:04 -06:00
Akkadius 71a1142f6b Move data buckets to player tables 2019-12-23 23:31:54 -06:00
Akkadius f542913041 Update database_schema.h 2019-12-23 17:54:36 -06:00
Akkadius 4695aa30ad Add more DatabaseSchema entries 2019-12-23 04:11:45 -06:00
Akkadius b222a619d7 Initial schema fetch with world command "database:schema" 2019-12-23 03:04:02 -06:00
Akkadius d23dccec82 Add "world:version" command 2019-12-23 02:16:43 -06:00
Akkadius 25bd285be5 World entrypoint rename 2019-12-23 02:08:51 -06:00
Akkadius af80b51bd3 Adjust newline in handler 2019-12-23 02:00:32 -06:00
Akkadius 4fa14e44aa Update loginserver commands to use the new and more proper argument format 2019-12-23 01:57:34 -06:00
Akkadius 4b69f56a65 Update command handler to use actual real arguments 2019-12-23 01:31:39 -06:00
Akkadius 2ab0ce19a7 Add console helpers to EQEmu::LogSys cleanup world main 2019-12-23 00:39:39 -06:00
Akkadius 8ef6feac9f Change JsonPP default indent to two spaces 2019-12-23 00:39:09 -06:00
Akkadius bc4e09cea4 Code cleanup 2019-12-23 00:38:58 -06:00
Akkadius 81acd797b4 Add initial world server CLI handler interface 2019-12-23 00:38:50 -06:00
Uleat c87b4f2ad4 Added rule_bool 'Character:UseNoJunkFishing' 2019-12-22 21:36:13 -05:00
Uleat e050534378 Added BARD to available class Bot stop_melee_level criteria 2019-12-17 21:02:36 -05:00
Uleat 2c8b51fcda Delete 'staged_updates' after updating quests [skip ci] 2019-12-15 23:40:20 -05:00
Uleat 0cb425b6dd Tweaked bot title and suffix code a little 2019-12-13 20:59:10 -05:00
Uleat bd6e06aadb Few tweaks to bot ai 2019-12-13 16:50:42 -05:00
Uleat ed67b461ea Added 'skip mez' ability to certain entity functions 2019-12-12 20:38:28 -05:00
Uleat 4e6018e3e8 Fix for pets breaking mez after initial aggro 2019-12-10 22:06:51 -05:00
Uleat 1196abfda8 Fix for bot classes having skills they shouldn't. Please report any abnormalities.
Tweaked bot command 'itemuse' to exclude invalid dual-wield reporting
2019-12-10 20:19:43 -05:00
Uleat efd710855e Added bot command 'itemuse' 2019-12-10 02:02:42 -05:00
Uleat ab35c3ed90 Tweaked a few bot things... 2019-12-09 22:01:50 -05:00
Uleat e306e9ad0c Added bot command option 'follow chain' to allow linear assignment of follow ids to eligible bots 2019-12-08 23:54:51 -05:00
Uleat 08b8deaa4b Merge pull request #937 from noudess/master
Fix for client position while on boat
2019-12-08 16:51:41 -05:00
Uleat 326e1be09f Added Mob::m_RelativePosition in preparation for more boat work 2019-12-05 18:53:07 -05:00
Uleat 7e724568a6 Update to boat-related opcode handlers 2019-12-05 18:24:29 -05:00
Uleat 9910b07a4e Changed Bots:AAExpansion to Bots:BotExpansionSettings and converted it bitmask use; Fix for bots not honoring aa expansion setting 2019-12-03 23:39:46 -05:00
Uleat 35fe27eb5d Added bot commands 'applypoison' and 'applypotion' .. new bot owner option 'buffcounter' 2019-12-03 22:01:13 -05:00
Uleat 86593798a9 Added safety check for zone dereference in ServerOP_ReloadRules handler 2019-12-01 17:59:38 -05:00
Uleat b8623bf6df Added command 'nudge' 2019-11-25 19:56:29 -05:00
Michael Cook (mackal) c90326f585 Merge pull request #933 from fryguy503/no_trade_combat
Mobs will not trade anymore if they are currently in combat.
2019-11-18 21:59:24 -05:00
Uleat a0de61a781 Merge pull request #936 from EQEmu/event_combine_validate
Added EVENT_COMBINE_VALIDATE to facilitate special case tradeskill co…
2019-11-18 21:21:06 -05:00
Uleat a325a9978b Added EVENT_COMBINE_VALIDATE to facilitate special case tradeskill combines 2019-11-18 19:39:03 -05:00
Noudess 40747ae5a3 Repair client updates when client is on (does not have to have control) a boat 2019-11-18 14:58:45 -05:00
Uleat 598204d75c Merge pull request #935 from EQEmu/position_packet_update
Brought Actor Position Update packets up to RoF2 standard in preparat…
2019-11-17 00:23:55 -05:00
Uleat 5fbda48c54 Brought Actor Position Update packets up to RoF2 standard in preparation for boat control modifications. Tested on all 6 supported clients - please report any anomalies 2019-11-16 17:10:40 -05:00
Uleat b56bc29388 Fix for #npceditmass saylink apply missing 'exact match' token 2019-11-14 19:56:12 -05:00
Trust b567e57971 Fixed incorrect logic 2019-11-14 02:15:35 +00:00
Uleat 9ced3270a0 Added 'exact match' option to command npceditmass search criteria 2019-11-13 20:04:50 -05:00
Trust 0fcaf82038 Per comment, removing message and simplified. 2019-11-13 23:46:36 +00:00
Trust 05b3c89729 Mobs will not trade anymore if they are currently in combat. 2019-11-13 22:51:33 +00:00
Uleat e46fcdd48a Added ClientMaxLevel accessors to the perl api 2019-11-12 23:46:17 -05:00
Uleat ea414a279e Fix for unix compile failure 2019-11-12 22:13:53 -05:00
Uleat 1553e44efb Added ClientMaxLevel accessors to the lua api 2019-11-12 21:51:48 -05:00
Akkadius 4437eef957 Added option to disable logging to speed up development feedback loop if desired by the developer (Shaves off over a minute if doing project refactorings) [skip ci] 2019-11-09 21:13:33 -06:00
Uleat 6b201fcbef One-time update to log_category_descriptions to fix naming discrepancies. Additions added after the auto-inject code (including future additions) are not affected 2019-11-09 19:28:21 -05:00
Uleat 8f3689e023 Revert "Added auto-correcting code to logsys category descriptions (thanks kentaiVZ!)"
This reverts commit 7de655ba76.
2019-11-09 19:08:57 -05:00
Akkadius c646942ed1 Make sure we check if the NPC is flagged as auto scaled before applying hp regen scaling instead of assuming from 0 on the stat alone [skip ci] 2019-11-09 16:19:45 -06:00
Uleat 7de655ba76 Added auto-correcting code to logsys category descriptions (thanks kentaiVZ!) 2019-11-08 22:36:40 -05:00
Uleat 6f83a39765 Merge pull request #931 from prestanneth/master
Doh %%
2019-11-08 21:59:27 -05:00
kentai 0bbf9d518e Doh %% 2019-11-08 19:49:05 +11:00
Uleat 06ca5b009d Merge pull request #926 from prestanneth/master
#Faction command
2019-11-07 20:26:03 -05:00
Uleat e788779be0 Merge pull request #928 from noudess/patch-1
This allows for merchants to drop corpses
2019-11-07 19:47:43 -05:00
Uleat 5f3d3a3539 Fix for mis-named logsys category [skip ci] 2019-11-07 19:22:45 -05:00
Uleat f402e96b96 Merge pull request #923 from noudess/spawn2
Eye of Zomm needed support in OP_ClientUpdate.
2019-11-07 19:08:41 -05:00
Noudess f012d13f0c Some quick additions of sanity checks for pointers and variables 2019-11-07 09:31:50 -05:00
Uleat 147be47088 Added a few more inventory slot look-ups to perl and lua apis 2019-11-06 14:50:20 -05:00
Uleat 397619e2f9 Added safety check to [tar] dereference 2019-11-05 18:58:46 -05:00
Uleat cd7584f512 Fix for Merc::CheckAETaunt() server crash 2019-11-05 18:31:21 -05:00
Akkadius ed7ce38fe0 Add some pointer safety checks to underlying data service call [skip ci] 2019-11-03 14:34:07 -06:00
Michael Cook (mackal) dff23793c6 Merge pull request #930 from noudess/patch-2
Fix damage done by poison proc changes
2019-11-02 15:54:09 -04:00
Paul Coene 10c383fd86 Update attack.cpp 2019-11-02 15:24:17 -04:00
Paul Coene 2a8ab28551 Fix damage done by poison proc changes
spell procs were not firing due to bad conditional.
2019-11-02 15:19:15 -04:00
Akkadius 769df9ce7b Allow hotfix to be ran in bin paths [skip ci] 2019-11-02 00:18:54 -05:00
Akkadius b1704377da Fix for pointer crash [skip ci] 2019-11-01 22:36:04 -05:00
Akkadius c90bed9f69 Fix regression from build work changes https://github.com/EQEmu/Server/issues/929 2019-11-01 16:14:56 -05:00
Kinglykrab 40c835c576 Merge branch 'master' of https://github.com/EQEmu/Server 2019-10-31 23:39:07 -04:00
Kinglykrab 15609ab1e8 Added optional 'ignore_mods' parameter to AddLevelBasedExp() in Perl and Lua. 2019-10-31 23:38:09 -04:00
kentai 316507adaf reworked valid target
reworked reset portion to catch feigning as impacts faction map
2019-10-31 11:55:07 +11:00
Uleat 384b1b89c7 Merge branch 'master' of https://github.com/EQEmu/Server 2019-10-30 19:19:17 -04:00
Uleat 01b3b41bae Fix for mailkey-based server crashes (does not fix the problem of non-existent mailkeys...) 2019-10-30 07:22:11 -04:00
Akkadius e2630d2b20 Return blank string on null socket [skip ci] 2019-10-29 23:16:37 -05:00
Akkadius dadeb01045 One more arg [skip ci] 2019-10-29 20:55:27 -05:00
Akkadius 31914eb0b6 Properly set box size [skip ci] 2019-10-29 20:32:20 -05:00
Noudess a7bcc12eb6 Removed constant no longer used 2019-10-28 19:50:28 -04:00
Noudess 566e6ea307 Added support for all SE_EyeOfZomm and some other small changes 2019-10-28 19:48:31 -04:00
Paul Coene 96e5adc8de Merge pull request #6 from noudess/patch-2
Allow for new merchant corpse rule
2019-10-28 10:24:15 -04:00
Paul Coene 6609728188 Allow for new merchant corpse rule 2019-10-28 10:21:33 -04:00
Paul Coene 74ca949a5b Added rule to allow merchants to have a corpse. 2019-10-28 10:16:20 -04:00
Noudess 194c61a467 Modify eye of zomm support to be more efficient. 2019-10-26 10:42:00 -04:00
kentai 3e50332c23 tidied 2019-10-24 15:25:51 +11:00
kentai 454a5c4527 #faction -- Displays Target NPC's Primary faction
#faction Find [criteria | all] -- Displays factions name & id
#faction Review [criteria | all] -- Review Targeted Players faction hits
#faction Reset [id] -- Reset Targeted Players specified faction to base
2019-10-24 14:55:55 +11:00
Uleat 135eaae402 Merge pull request #925 from prestanneth/master
Added some backticks on mysql keywords
2019-10-23 22:22:51 -04:00
Noudess 8f5bd52e24 Make sure eye os zomm updates are the actual eye 2019-10-23 13:58:52 -04:00
kentai 62be0c475e Added backticks on sql keyword 2019-10-24 02:44:57 +11:00
kentai 1c6971da4a Merge branch 'master' of https://github.com/prestanneth/Server 2019-10-24 02:11:13 +11:00
Noudess ff59255e63 Eye of Zomm needed support in OP_ClientUpdate. 2019-10-22 10:45:54 -04:00
Uleat 653801a54b Fix for tradeskill combine-based zone crashes 2019-10-18 20:47:21 -04:00
KentaiVZ 6a393afdf3 Merge pull request #2 from EQEmu/master
SYNC
2019-10-18 16:30:58 +11:00
Michael Cook (mackal) b0efe88a03 Merge pull request #922 from noudess/spawn2
Fix some bugs with the use of the model field in npc_types
2019-10-15 21:02:36 -04:00
Noudess 7eb2e834b1 Fix some bugs with the use of the model field in npc_types 2019-10-15 13:22:49 -04:00
KimLS 754ed71f9a Update dependency locations 2019-10-15 00:07:02 -07:00
Alex 4f538fbdad Merge pull request #921 from EQEmu/master_build_revert
Build merge into master again
2019-10-13 21:47:06 -07:00
Uleat 99ee4e04d9 Added bot command 'precombat' to manually set pre-combat mode rather than the 'assumption' process used before; Added rule Bot:AllowOwnerOptionAltCombat to allow admins control over its use 2019-10-13 22:24:06 -04:00
Alex 7989451c36 Merge pull request #920 from EQEmu/build
Build
2019-10-13 18:50:33 -07:00
Alex 4c9c070d67 Merge pull request #919 from EQEmu/revert-917-revert-916-build
Revert "Revert "Build System Updated""
2019-10-13 18:49:42 -07:00
Alex 058a722569 Revert "Revert "Build System Updated"" 2019-10-13 18:49:16 -07:00
Alex 1d460bd636 Merge pull request #918 from EQEmu/revert-821-feature/remove_boost
Revert "Remove boost"
2019-10-13 01:30:26 -07:00
Alex 47ee5b5afb Revert "Remove boost" 2019-10-13 00:53:31 -07:00
Alex 7edfdbd9db Merge pull request #917 from EQEmu/revert-916-build
Revert "Build System Updated"
2019-10-12 21:08:09 -07:00
Alex b9f57f1f28 Revert "Build System Updated" 2019-10-12 21:07:06 -07:00
Alex 579471afcc Merge pull request #916 from EQEmu/build
Build System Updated
2019-10-12 19:04:26 -07:00
KimLS 04e7238a6e Fix for wrong perl lib in auto dependencies 2019-10-11 15:53:23 -07:00
KimLS 0e9fae3181 Merge remote-tracking branch 'origin/master' into build 2019-10-10 17:29:17 -07:00
Michael Cook (mackal) 37d4371acd Merge pull request #915 from noudess/spawn2
Old School poison changes to be close to live.  Added extending proci…
2019-10-10 17:32:48 -04:00
Noudess bcf0af0a8d Old School poison changes to be close to live. Added extending procing rule. 2019-10-10 14:32:27 -04:00
Chris Miles f17779efeb Merge pull request #913 from EQEmu/quest_logging
Added logging functions to perl/lua apis
2019-10-08 20:56:03 -05:00
Uleat 3aed0e257a Added logging functions to perl/lua apis 2019-10-08 20:35:03 -04:00
Uleat a26227f258 Fix for #npceditmass command failure on string-based updates 2019-10-07 22:15:24 -04:00
Michael Cook (mackal) db085b7126 Merge pull request #911 from noudess/spawn2
Old school apply poison was allowing multiple poisons at once.
2019-10-07 17:18:35 -04:00
Paul Coene bca567d2f5 Merge branch 'master' into spawn2 2019-10-07 13:25:12 -04:00
Noudess c62d9040cb Old school apply poison was allowing multiple poisons at once. 2019-10-07 13:16:52 -04:00
Uleat abb1086e52 Added rules Bots:AllowOwnerAutoDefend and Bots:LeashDistance 2019-10-05 23:11:16 -04:00
Uleat 1f04938535 Merge pull request #910 from EQEmu/bot_ai_rework
Updated Bot AI to make use of neglected commands/features
2019-10-05 19:15:13 -04:00
Uleat 12204dd927 Updated Bot AI to make use of neglected commands/features 2019-10-05 18:17:23 -04:00
Chris Miles b118864920 Merge pull request #907 from alimalkhalifa/master
Added automated initialization of login.json [ci skip]
2019-10-05 00:54:49 -05:00
Ali af749cf07a Updated do_install_config_login_json to pull from EQEmu repo [ci skip] 2019-10-01 23:14:01 +03:00
Ali bf45e8b491 Fix missing ;s [ci skip] 2019-10-01 21:31:22 +03:00
KimLS abd14f556a Merge remote-tracking branch 'origin/master' into build 2019-09-30 14:02:39 -07:00
Akkadius 29b90fbeaf Fix escaping issue in #npcspawn create 2019-09-30 14:14:59 -05:00
Akkadius 6cecc85d17 Change login config defaults to avoid confusion [skip ci] 2019-09-30 01:26:09 -05:00
Akkadius f3c85dc585 Auto convert insecure world server admin passwords during the world authentication process, add cli support for updating world admin account 2019-09-30 01:22:40 -05:00
Ali 2e4868d3eb Added automated initialization of login.json [ci skip] 2019-09-30 08:39:41 +03:00
Chris Miles 0005df31f7 Merge pull request #906 from alimalkhalifa/master
Modified eqemu_server.pl to use new login server schema
2019-09-28 02:22:28 -05:00
Ali 1f3287759a Modified eqemu_server.pl to use new login server schema 2019-09-28 10:20:05 +03:00
Alex 3c345b9a9c Merge pull request #821 from adam4813/feature/remove_boost
Merged finally, to build which will hit master soon (tm)
2019-09-27 17:47:27 -07:00
Alex 895c8626b6 Merge branch 'build' into feature/remove_boost 2019-09-27 16:32:13 -07:00
KimLS 2965ab28e2 Remove oldcode 2019-09-27 16:28:14 -07:00
KimLS 259bce9509 Refactor zone net class (nothing to do with networking -.-) 2019-09-27 14:42:35 -07:00
KimLS 316d645f33 Merge remote-tracking branch 'origin/master' into build 2019-09-27 12:04:47 -07:00
KimLS 135b4aac34 Fix for compile error 2019-09-26 17:19:38 -07:00
Kinglykrab 0b3c489028 Exported MerchantCloseShop() and MerchantOpenShop() to Perl. 2019-09-25 20:07:32 -04:00
Akkadius cda6a1465b Fix small loginserver bug where when a worldserver pings world for the first time it may not show up 2019-09-24 21:51:42 -05:00
Chris Miles 9a4a49fc9e Merge pull request #903 from EQEmu/feature/linux-crash-dumps
Automated Linux GDB crash dumps before process dies that follow the same pipeline as Windows
2019-09-24 01:02:16 -05:00
Akkadius 118c6b5636 Add refinements to linux crash handler 2019-09-23 01:56:03 -05:00
Akkadius 161edef2a8 WIP POC 2019-09-23 00:47:57 -05:00
Kinglykrab 54053f7e24 Fix maximum status value.
- Maximum Status of 250 was causing status levels 251 to 254 to be excluded from the queue.
2019-09-19 22:04:54 -04:00
KimLS 8ae76bc217 Merge fix 2019-09-17 20:56:22 -07:00
Akkadius fdf2fe71e1 Few more logging changes to test out Github bot functionality [skip ci] 2019-09-17 19:11:45 -05:00
Akkadius 5a600cd7c0 Fix simple log formatting [skip ci] 2019-09-17 19:08:29 -05:00
Michael Cook (mackal) 91a7ebbdfb Fix crash in SharedDatabase::UpdateOrphanedCommandSettings 2019-09-17 12:52:00 -04:00
Akkadius 3dbb5fab50 Change some logging scope to LogInfo from LogDebug 2019-09-17 02:33:08 -05:00
JJ 9bc96432be Merge branch 'master' of https://github.com/EQEmu/Server 2019-09-17 01:50:19 -04:00
JJ 48cb96214a Legacy LS tables no longer needed. [skip ci] 2019-09-17 01:49:52 -04:00
Akkadius 084e588843 Add /v1/ API route prefix 2019-09-17 00:49:51 -05:00
Akkadius 11fdbb6a49 Add EscapeString to the one function left that is missing it 2019-09-17 00:37:55 -05:00
Akkadius 96ef76847b Fix log calls that either didn't carry over or were using newer aliases that weren't converted to FMT prior to migration 2019-09-17 00:18:07 -05:00
Akkadius 9a7ecb4e8d Fix faction loading logging 2019-09-16 23:50:48 -05:00
Akkadius 578fafb485 Fix rule logging 2019-09-16 23:48:32 -05:00
Akkadius 4e2b2aca6a Add response codes to loginserver api reponses 2019-09-16 23:40:06 -05:00
Michael Cook (mackal) ae0eebe043 Nuke unused TinyXML 2019-09-16 23:55:40 -04:00
Akkadius 4e129ca7b5 Update database manifest 2019-09-16 22:41:03 -05:00
Chris Miles 1521e3810f Merge pull request #889 from EQEmu/lsid
Loginserver overhaul
2019-09-16 22:25:28 -05:00
Akkadius 2a18d7cd80 Merge branch 'master' of https://github.com/EQEmu/Server into lsid 2019-09-16 22:11:59 -05:00
Uleat d0b505f32d Undefined Behavior fix... 2019-09-16 20:39:05 -04:00
Uleat 9c95d1bfa2 Fix for bad RestoreRuleNotes() query (thanks mackal!) 2019-09-16 20:24:58 -04:00
Uleat 70ad517c14 Fix for linux double free error in RestoreRuleNotes() 2019-09-16 02:18:19 -04:00
Alex 265458a6da Merge pull request #901 from dencelle/patch-1
fix for telnet's lack of language skill
2019-09-13 20:58:31 -04:00
Dencelle 8ab2b15768 fix for telnet's lack of language skill
this function is only used when a raw telnet ooc, auction, or tell is used. it needs to have the language skill set though otherwise it just comes out as garbled
2019-09-13 19:29:37 -05:00
Uleat cf80e594bc Merge branch 'master' of https://github.com/EQEmu/Server into lsid
# Conflicts:
#	common/ruletypes.h
#	world/net.cpp
#	zone/bot_command.cpp
#	zone/command.cpp
#	zone/zonedb.cpp
2019-09-12 01:54:37 -04:00
KentaiVZ 3128453eb6 Merge pull request #1 from EQEmu/master
update local
2019-09-12 08:45:04 +10:00
Chris Miles 655cb798c3 Merge pull request #899 from EQEmu/croak
Remove multi-line Perl croaks
2019-09-10 18:51:20 -07:00
Kinglykrab 499c0fdca5 Fixes multi-link Perl croaks, allowing the quest API reader to function properly. 2019-09-10 21:48:15 -04:00
Uleat 28d5c8f301 Fix-up after 'io_work' branch merger 2019-09-10 00:20:13 -04:00
Uleat 7911225960 Merge pull request #894 from EQEmu/io_work
Io work
2019-09-09 23:57:43 -04:00
Uleat 1990ae970a Updated 'io_work' per pr page request 2019-09-09 23:28:55 -04:00
Uleat b41ae05dc4 Merge branch 'master' of https://github.com/EQEmu/Server into io_work 2019-09-09 22:42:39 -04:00
Uleat 8bb76ae2fe Merge pull request #898 from EQEmu/faction_queries
Faction queries
2019-09-09 22:07:59 -04:00
Uleat e846fc4eea Merge branch 'master' of https://github.com/EQEmu/Server into faction_queries 2019-09-09 21:12:06 -04:00
Uleat e9f5c03141 Merge pull request #892 from prestanneth/master
Bot Naming - View/Delete Databuckets
2019-09-09 20:28:48 -04:00
Uleat 8a26eaabf3 Oops! Gotta have the sql too... [skip ci] 2019-09-09 19:53:34 -04:00
Uleat a73df6aa09 Rework of Bot Owner Options 2019-09-09 19:52:41 -04:00
Uleat 420667a35b Reworked LoadFactionData() to use minimal database queries 2019-09-08 17:02:49 -04:00
Akkadius b63821bbae Change account parse delimiter [skip ci] 2019-09-08 15:44:19 -05:00
Akkadius 51995ca7f2 Formatting [skip ci] 2019-09-08 03:38:08 -05:00
Akkadius edf93f20e5 Update loginserver_webserver.cpp 2019-09-08 03:24:02 -05:00
Akkadius 1e6a67e1ad Change vars to be more consistent [skip ci] 2019-09-08 03:23:47 -05:00
Akkadius 4f20236440 Adjust external endpoint [skip ci] 2019-09-08 03:21:03 -05:00
Akkadius 40696a132b Add another API endpoint [skip ci] 2019-09-08 03:03:52 -05:00
Akkadius 34a4db6302 Fix world server admin auth bug [skip ci] 2019-09-08 02:06:57 -05:00
Akkadius b2526ff6d6 Make sure loginserver is writing to file log [skip ci] 2019-09-08 02:01:10 -05:00
Akkadius 6fcb97e153 Cleanup UCS logging [skip ci] 2019-09-08 01:09:50 -05:00
Akkadius 3177b6ac46 Add CLEStatusString to logging 2019-09-08 00:07:07 -05:00
Akkadius 3230d81d2c Unify ClientLogin logging [skip ci] 2019-09-07 23:59:12 -05:00
Akkadius 89dbdff925 Change logging category [skip ci] 2019-09-07 23:40:22 -05:00
Uleat 5206983513 Removed rule-based check for rule note updates 2019-09-07 23:18:12 -04:00
Akkadius 1bfbe51d89 Add keepalives for world > login and login > world 2019-09-07 21:55:21 -05:00
Uleat 0041d3e0da Manual revert of code from commit to fix clients not dropping group..this still needs to be addressed 2019-09-07 22:15:12 -04:00
Uleat fec567c2f3 Updated Command Update code to report after each process handling rather than at the end 2019-09-07 21:21:46 -04:00
Akkadius 4b61d00dfe Implement Zone -> World keepalive so that Zone reconnects to world in the case of a world crash / reset 2019-09-07 20:20:10 -05:00
Akkadius 4cba9439b9 Move a spammy log call to LogDebug [skip ci] 2019-09-07 19:36:28 -05:00
Akkadius dad1efbeaa Add api endpoint for updating an external account link reference [skip ci] 2019-09-07 19:24:27 -05:00
Akkadius ae781ee962 Replace template function used by many macros 2019-09-07 18:25:40 -05:00
Chris Miles 67d8d6d67d Merge pull request #895 from mibastian/patch-1
git submodule init/update must be executed from the top level working…
2019-09-07 18:11:45 -05:00
Chris Miles b69fee5619 Merge pull request #897 from mibastian/patch-3
RHEL/CentOS 6/7 cmake prerequisites
2019-09-07 18:11:10 -05:00
MIchael Bastian f698571f35 The RHEL/CentOS 6/7 cmake prerequisites
RHEL/CentOS 6/7 are still on cmake version 2. Install cmake3 out of epel and set as primary alternative.
Note: Might break with RHEL/CentOS 8
2019-09-08 00:10:31 +02:00
MIchael Bastian 891944a1ba git submodule init/update must be executed from the top level working tree
Build is failing as the submodules are not installed.
2019-09-07 23:23:08 +02:00
Akkadius cc377f2659 Fix compile [skip ci] 2019-09-07 02:30:33 -05:00
Akkadius 6222132625 More logging cleanup [skip ci] 2019-09-07 02:18:15 -05:00
Akkadius 9e3f9f9749 More logging changes [skip ci] 2019-09-07 01:59:50 -05:00
Akkadius b8216a5d40 Merge branch 'master' of https://github.com/EQEmu/Server into lsid 2019-09-07 01:03:13 -05:00
Akkadius 7154873091 Change opcode too [skip ci] 2019-09-07 00:52:13 -05:00
Akkadius 052583d170 Adjust more logging [skip ci] 2019-09-07 00:30:54 -05:00
Akkadius 463aeea5a3 Fix struct mismatch from merge of identical blocks of code [skip ci] 2019-09-07 00:17:23 -05:00
Akkadius a624b85ea1 More login logging [skip ci] 2019-09-07 00:12:53 -05:00
Akkadius 4b77f573c0 More logging [skip ci] 2019-09-07 00:07:57 -05:00
Akkadius 1f928cd161 More logging [skip ci] 2019-09-07 00:05:00 -05:00
Akkadius b97696a8c0 Adjust logging [skip ci] 2019-09-06 21:40:13 -05:00
Uleat a428eb61a1 Merge branch 'master' of https://github.com/EQEmu/Server into io_work 2019-09-06 20:52:23 -04:00
Uleat 1515785ada Added count reports to command injection/orphan code 2019-09-06 20:43:21 -04:00
Uleat 8673aec9fd Oops! StringFormat wasn't suppose to make into final 2019-09-06 20:04:08 -04:00
Akkadius 534bed1483 Add Rule Zone:KillProcessOnDynamicShutdown and functionality for killing a dynamic after it has been allocated a zone and has shutdown - this is done for memory reasons because we do not clean up after ourselves at all and zone processes bloat heavily in memory. This is a workaround until we manage this better 2019-09-06 12:26:30 -05:00
Akkadius 45278f80ca Cleanup world logging [skip ci] 2019-09-06 12:03:50 -05:00
JJ 1e1b21f2bf Fix log during UCS shutdown [skip ci] 2019-09-06 12:05:51 -04:00
Uleat fcaa685e77 Hack fix for differences in Windows-Linux template generation techniques 2019-09-05 23:00:46 -04:00
Uleat 96103b09e0 Fix for non-fmtlib related linux build failure 2019-09-05 21:01:47 -04:00
Akkadius de38440c4f Update eqemu_server.pl to use the bin folder if the binaries are being ran from them [skip ci] 2019-09-05 19:53:19 -05:00
kentai 512880e316 Combined databucket view delete commands to #databuckets 2019-09-06 10:04:37 +10:00
KimLS bd64d8e6b3 Revert to earlier perl portable, the new ones don't work 2019-09-05 00:49:01 -07:00
Akkadius e4bfc547cb Another logging adjustment [skip ci] 2019-09-05 02:42:53 -05:00
Akkadius afa6358838 Debugging adjustments [skip ci] 2019-09-05 02:01:52 -05:00
Akkadius c53c769a7c Update logging [skip ci] 2019-09-05 01:54:25 -05:00
Akkadius 4ef481dbc0 Adjust logging slightly [skip ci] 2019-09-05 01:52:49 -05:00
Akkadius c887b7eae3 Changelog formatting [skip ci] 2019-09-05 00:31:27 -05:00
Uleat eefe0dfbb7 Merge branch 'master' of https://github.com/EQEmu/Server into io_work
# Conflicts:
#	common/ruletypes.h
2019-09-05 01:18:27 -04:00
kentai 8e1b6a23eb Bot Naming - View/Delete Databuckets
^bottitle
^botsuffix
^botsurname
#viewbuckets
#deletebucket
2019-09-05 14:12:56 +10:00
Uleat c1b48b9931 Updated the rule system to automatically restore rule notes (rule-based) 2019-09-04 22:37:17 -04:00
Akkadius fceca6e72f Merge branch 'master' of https://github.com/EQEmu/Server into lsid 2019-09-03 23:37:57 -05:00
Chris Miles eb4592c3ae Merge pull request #890 from noudess/spawn2
Allow single spawn2 locations to filter based on condition (in spawn-entry).
2019-09-03 04:26:53 -05:00
Uleat f9536f9621 Updated the rule system to automatically add new rules and remove orphaned entries from the rule values tables 2019-09-03 04:04:05 -04:00
Akkadius c89cd9d3c4 Changelog format 2019-09-03 00:40:14 -05:00
Noudess 2e98de3923 Changes to allow individual spawn2 locations to vary in npc selection (cond) 2019-09-02 10:34:09 -04:00
Paul Coene 26e14c02b6 Merge pull request #4 from EQEmu/master
Merge master changes into my fork.
2019-09-02 08:50:51 -04:00
Akkadius b45fd24f9d Update bot.cpp 2019-09-02 04:31:10 -05:00
Akkadius acae5d81ab Logs::QSServer to LogInfo 2019-09-02 04:23:50 -05:00
Akkadius 89bfbe6bd2 Logs::Combat to LogCombat 2019-09-02 04:21:03 -05:00
Akkadius 3e4587cd57 Logs::Spawns to LogSpawns 2019-09-02 04:10:43 -05:00
Akkadius 076d393f79 Logs::FixZ to LogFixZ 2019-09-02 03:54:00 -05:00
Akkadius 44e3f28cb0 Logs::AI to LogAI 2019-09-02 03:44:03 -05:00
Akkadius b4339691f9 Logs::Pathing to LogPathing 2019-09-02 03:37:55 -05:00
Akkadius b738f8852d Logs::AA to LogAA 2019-09-02 03:37:18 -05:00
Akkadius 405ed5447d Logs::Skills to LogSkills 2019-09-02 03:36:04 -05:00
Akkadius 70ba7c9c85 Logs::NPCScaling to LogNPCScaling 2019-09-02 03:35:19 -05:00
Akkadius c3a94766ea Logs::Food to LogFood 2019-09-02 03:31:46 -05:00
Akkadius 698d6d4ed2 Logs::ZoneServer to LogInfo 2019-09-02 03:30:03 -05:00
Akkadius af4c630ede Logs::Spells to LogSpells 2019-09-02 03:26:44 -05:00
Akkadius b83c0f8bf9 Logs::Tribute to LogTribute 2019-09-02 03:20:41 -05:00
Akkadius 1acb76bc74 More Logs::None to LogDebug 2019-09-02 03:18:12 -05:00
Akkadius ed4fc74bd4 Logs::Tradeskills to LogTradeskills and more Logs::Error to LogError 2019-09-02 03:10:03 -05:00
Akkadius b402e8f33d Logs::Trading to LogTrading 2019-09-02 02:57:55 -05:00
Akkadius c8e673c6d4 Move inventory log calls to LogInventory 2019-09-02 02:50:39 -05:00
Akkadius 674dfc5fac Move some log calls to use more appropriate LogDebug 2019-09-02 02:39:30 -05:00
Akkadius 2970afff67 More log migrations to fmt / log aliases 2019-09-02 02:33:02 -05:00
Akkadius 2b1950d2e2 Logs::Guilds to LogGuilds 2019-09-02 02:24:34 -05:00
Akkadius 31cebb5793 Logs::Normal to LogInfo 2019-09-02 02:18:54 -05:00
Akkadius ccbbadc5ee Streamline UCS 2019-09-02 01:39:52 -05:00
Akkadius bfd0752c4d Logs::None added to LogDebug 2019-09-01 23:54:24 -05:00
Akkadius 00c40f5d9e Remove errant debug calls 2019-09-01 23:41:26 -05:00
Akkadius 859252a270 Move status log calls to use LogInfo 2019-09-01 23:22:40 -05:00
Akkadius 2eb14a5c8a Move Netcode logging to LogNetcode 2019-09-01 23:10:49 -05:00
Akkadius be291d58b0 Move worldserver logging ot use LogInfo 2019-09-01 22:53:23 -05:00
Akkadius 678c25e02c Simplify error logging 2019-09-01 22:05:44 -05:00
Akkadius 98cbb7d781 Simplify log calls 2019-09-01 21:04:58 -05:00
Akkadius d3803045bc Add log aliases to make logging much easier to use (All FMT driven) 2019-09-01 20:47:26 -05:00
Akkadius db5e511af3 Merge branch 'master' of https://github.com/EQEmu/Server into lsid 2019-09-01 19:23:56 -05:00
Chris Miles 585c07210d Merge pull request #862 from fryguy503/tradeskill_lockout
Container lock inconsistent state fix
2019-09-01 16:54:22 -05:00
Akkadius b8624d0488 Post PR blocked spells formatting 2019-09-01 16:51:39 -05:00
Chris Miles 206b769731 Merge pull request #866 from eqft/pr/block_all_spells_region
Support for blocked_spells entries for all spells in a region
2019-09-01 16:31:16 -05:00
Akkadius 5381dcead1 Formatting: NPC::ModifyStatsOnCharm 2019-09-01 16:07:48 -05:00
Chris Miles 5c14bc92bd Merge pull request #814 from EQEmu/charm_specialatk
Added Spells:CharmDisablesSpecialAbilities
2019-09-01 15:43:15 -05:00
Chris Miles 898aea80c7 Merge pull request #774 from hgtw/spa112
Make SPA 112 affect fizzle rate not effective caster level
2019-09-01 15:42:00 -05:00
Chris Miles 69a3432898 Merge pull request #877 from noudess/light-wield
Light wield for Npcs/mobs
2019-09-01 15:39:50 -05:00
Chris Miles 1acf78101f Merge pull request #876 from noudess/poison
Poison
2019-09-01 15:38:00 -05:00
Chris Miles 0d6d78ebda Update client_packet.cpp 2019-09-01 15:37:21 -05:00
Uleat a534ab83ec Converted new implode and join_pair functions to template functions 2019-08-31 20:55:46 -04:00
Uleat 3092a8ba3b Fix-up in command system procedural code 2019-08-30 09:41:50 -04:00
Uleat d341a1b38f Updated the command systems to automatically add new commands and remove orphaned entries from the command settings tables 2019-08-30 06:38:48 -04:00
KimLS 276804604c Merge remote-tracking branch 'origin/master' into build 2019-08-29 21:57:54 -07:00
KimLS 836f842f23 Small changes to msvc perl finding 2019-08-28 20:14:31 -07:00
KimLS 4fbce7d5d6 Reworked some of the dependency flow 2019-08-28 14:56:18 -07:00
KimLS 34cb51c449 Some fixes for strawberry perl on msvc, added automatic portable perl linking on windows (experimental) 2019-08-28 01:35:27 -07:00
Uleat f837d423ef Added bot owner option 'spawn message' 2019-08-27 20:06:07 -04:00
KimLS 5ce71b7923 Fix for missing LS option (wowowow) and will build zlib-ng by default now (it doesnt add much to compile time and has a pretty big payoff) 2019-08-27 01:12:47 -07:00
KimLS 9520499103 CMake will fetch visual studio dependencies automatically now 2019-08-26 23:30:30 -07:00
Uleat 7749f83134 Temp fix for Bot::Camp() zone crashes (memory leak still needs to be addressed) 2019-08-27 01:09:11 -04:00
KimLS 5a852d4780 Basic small build guide 2019-08-26 00:44:00 -07:00
KimLS 712e403528 Missing luabind 2019-08-25 22:02:17 -07:00
KimLS 581a0ec212 Added own lua find package that will also try to find luajit since it's compat with the 5.1 api 2019-08-25 20:47:14 -07:00
KimLS bb02af2548 Add check for policy back in 2019-08-25 16:02:45 -07:00
KimLS 852cc9119e Small change to zlibng 2019-08-25 15:49:00 -07:00
KimLS 72a922f2ba Changes to building 2019-08-25 14:45:54 -07:00
Uleat c0575892cb Changed bot create help options to pop-up display 2019-08-24 22:51:29 -04:00
Uleat 377c569635 Fix for clients not dropping group after camping bots 2019-08-24 21:54:46 -04:00
Uleat 5e60fcdc0c Fix for bot pets not updating their health (probably not the best fix..but, it works...) 2019-08-24 21:32:57 -04:00
Uleat 4d1d9df05d Added cap to Titanium BaneDmgAmt translator 2019-08-24 20:38:57 -04:00
Uleat c6c4480061 Merge pull request #888 from KinglyKrab/banedamage
Convert item bane damage to int32.
2019-08-23 22:56:08 -04:00
Kinglykrab c2794b244d Convert item bane damage to int32.
- int8 was not the proper type for this.
2019-08-20 20:52:47 -04:00
Michael Cook (mackal) 83cae7aaf3 Merge pull request #886 from KinglyKrab/master
Export Getter/Setter alternate currency methods to Perl and Lua.
2019-08-20 19:01:45 -04:00
Kinglykrab 08d197fe15 Export Getter/Setter alternate currency methods to Perl and Lua.
- GetAlternateCurrencyValue(currency_id) - Returns the amount of the alternate currency you have.

- SetAlternateCurrencyValue(currency_id, amount) - Allows you to directly set the amount of an alternate currency.
2019-08-20 18:12:27 -04:00
Paul Coene 5a0fcdfefd Merge branch 'master' into light-wield 2019-08-16 10:30:54 -04:00
Paul Coene 49094bcfbc Fix attack to not attack with a non-weapon (expand cancel to include cancel of light)
I found a single item in the db, Flickering Watchtower Torch, that is a light item type but has 1 damage/100 delay.  This code would make that weapon not operate, if we care.
2019-08-16 10:28:06 -04:00
Akkadius 6fb1d95518 Implemented command #spawneditmass <search> <option> <value> with options [respawn_time] currently implemented 2019-08-16 04:33:51 -05:00
Akkadius bf25937ee0 Command #npceditmass now lists column options when one isn't properly specified 2019-08-16 03:39:15 -05:00
Akkadius 05e7c473df Simplified the use of roamboxes and improved the AI for roambox pathing 2019-08-16 03:25:34 -05:00
Akkadius c149e6ca5f Add a heading option to #goto 2019-08-15 22:56:03 -05:00
Uleat 537e3931ef Don't need the zlib1.ilk file... [skip ci] 2019-08-15 22:20:58 -04:00
Chris Miles 9476f9e417 Update SECURITY.md 2019-08-15 20:21:09 -05:00
Chris Miles 1f4753b719 Create SECURITY.md 2019-08-15 20:20:33 -05:00
Uleat 65c05f227b Added zlib1.dll debug symbols to eqemu_server.pl download [skip ci] 2019-08-15 21:10:51 -04:00
Michael Cook (mackal) ef6b2976a3 Make SE_SummonPC only clear aggro for beneficial spells 2019-08-14 23:06:34 -04:00
Michael Cook (mackal) 7b4908957d Clean up EntityList::QuestJournalledSayClose 2019-08-13 15:19:20 -04:00
Michael Cook (mackal) 963da70506 Change how we handle null quest initiator in QuestManager::say
Timers etc triggered say's don't have an initiator but should still
work.

The target ID is set in QuestJournalledSay for us so not needed here
2019-08-13 15:11:37 -04:00
Akkadius 1ef577bc25 Modifications to findzone 2019-08-11 03:20:38 -05:00
Chris Miles a2364023c4 Merge pull request #882 from EQEmu/feature/mass-npc-edit-command
Added bulk edit command #npceditmass <column-to-search> <column-searc…
2019-08-11 02:40:52 -05:00
Akkadius 1c6a76246f Added bulk edit command #npceditmass <column-to-search> <column-search-value> <change-column> <change-value> 2019-08-11 02:40:23 -05:00
Chris Miles 8c17c42a10 Merge pull request #881 from EQEmu/feature/unify-chat-constants
Feature/unify chat constants
2019-08-11 01:58:41 -05:00
Akkadius e9cb8781bf More build fixes for bot 2019-08-11 01:32:51 -05:00
Akkadius 04a18786f9 Bot compile fixes 2019-08-11 01:21:55 -05:00
Akkadius 20bd37dde7 More function name refactoring 2019-08-11 01:09:11 -05:00
Akkadius 665efe09f3 Fill function calls using magic numbers 2019-08-11 00:27:04 -05:00
Akkadius a28ea6419f Beginning of #npceditmass 2019-08-11 00:14:34 -05:00
Akkadius 9f25c9070c Refactor message functions 2019-08-11 00:14:02 -05:00
Akkadius 57354579aa Unify chat constants usage 2019-08-11 00:00:55 -05:00
Akkadius 25a5310f49 Add login account_id in validation response 2019-08-10 07:04:52 -05:00
Akkadius 66ee0dc9bd Update DefaultLoginServerName 2019-08-10 06:59:45 -05:00
Akkadius f39684b7f7 API adjustments 2019-08-10 05:36:22 -05:00
Akkadius f06ff14f9e Squash exception in ParseRequestBody 2019-08-10 05:14:39 -05:00
Akkadius 661ad09291 Remove legacy loginserver config 2019-08-10 05:14:25 -05:00
Akkadius 9708bd38c4 Remove legacy loginserver config 2019-08-10 05:14:12 -05:00
Akkadius 8a2fce83e0 Adjust API handlers 2019-08-10 04:56:50 -05:00
Akkadius 2081b0e214 Merge changes 2019-08-10 03:26:51 -05:00
Akkadius eaf31fb14b Merge branches 'lsid' and 'master' of https://github.com/EQEmu/Server into lsid 2019-08-10 03:26:40 -05:00
Akkadius d2e7cf96bd Update .gitignore 2019-08-10 02:49:55 -05:00
Chris Miles 24d2a5723b Merge pull request #879 from EQEmu/kick_events
Sessions adjustments
2019-08-10 02:48:36 -05:00
Akkadius 17c8af3814 Drop db logging, up stale connections 2019-08-10 02:47:08 -05:00
Akkadius 69bad593cd Merge branch 'master' of https://github.com/EQEmu/Server into kick_events 2019-08-10 02:38:48 -05:00
Akkadius 0884c57928 Update minimum status for devtools 2019-08-10 02:27:07 -05:00
Akkadius 461931f5bd Fix remainder of ghosting 2019-08-10 01:59:58 -05:00
Uleat 0d76e224fd Updated eqemu_server.pl login server config example to json standard [skip ci] 2019-08-09 21:28:07 -04:00
Akkadius ea15e9bc5f Fix bug with command length 2019-08-09 00:43:25 -05:00
KimLS 5fce042a31 Up stale connection ms again 2019-08-08 18:49:21 -07:00
KimLS 6a64d845c2 Async eqemu login credential lookup 2019-08-08 18:45:10 -07:00
Uleat 19c92173d2 Added signal check for player EVENT_CAST_BEGIN 2019-08-08 20:38:24 -04:00
KimLS 880de837d9 Crash and compile issues on windows 2019-08-08 15:55:14 -07:00
Michael Cook (mackal) 8df7bcc2c8 Fix double free in queryserv 2019-08-08 14:26:08 -04:00
Akkadius d9eeb00dea Adjust ghosting algorithm to work much better for super large zones as well 2019-08-07 18:54:53 -05:00
Chris Miles a6af014d5e Merge pull request #878 from EQEmu/fix/eliminate-mob-ghosting
Fix/eliminate mob ghosting
2019-08-06 02:09:03 -07:00
Akkadius 758a1af6ae Merge branch 'fix/eliminate-mob-ghosting' of https://github.com/EQEmu/Server into fix/eliminate-mob-ghosting 2019-08-06 04:07:43 -05:00
Akkadius f1ee042de6 Add bulk force update by distance as well which we had similarily before the movement overhaul 2019-08-06 04:07:37 -05:00
Chris Miles 2014b6c251 Delete CTestTestfile.cmake 2019-08-06 03:28:17 -05:00
Akkadius 8fa76b9154 Optimizations to movement updates to eliminate ghosting possibilities in larger zones 2019-08-06 03:27:33 -05:00
Akkadius 9f6976e852 More readability changes 2019-08-06 03:24:59 -05:00
Akkadius b117be29fb Movement code readability 2019-08-06 01:59:54 -05:00
Paul Coene d3641be6c0 Update loottables.cpp 2019-08-05 09:30:57 -04:00
Paul Coene 06fbd7103e Update client_packet.cpp 2019-08-05 09:24:22 -04:00
Paul Coene acef4c0264 Merge pull request #3 from EQEmu/master
Pull down all of the latest
2019-08-05 08:18:20 -04:00
KimLS b62944c5fb Fix for windows compile issue 2019-08-05 01:12:31 -07:00
Uleat 8065cdb89d Give Erudites their head coverings back (forced until we can sort out the packet building process...) 2019-08-04 22:54:22 -04:00
Uleat 20530ed3cf Merge branch 'master' of https://github.com/EQEmu/Server 2019-08-04 22:37:58 -04:00
Uleat 4aa8cecc55 Fix for SoF client not being able to login 2019-08-04 22:36:24 -04:00
Akkadius 4ec210c411 Update web api errors 2019-08-04 05:09:05 -05:00
Akkadius 4de85ff836 Add CLI and Web endpoints to change local login account password 2019-08-04 05:04:55 -05:00
Akkadius ba6009730b Add CLI and Web endpoints to change local login account password 2019-08-04 05:04:34 -05:00
Akkadius b0d33f094d Add local credential validation logic 2019-08-04 04:16:14 -05:00
Akkadius 5ff0f4851e Add path to http request logging, add email to local account creation through web endpoint 2019-08-04 03:11:30 -05:00
Akkadius 63e1599e9b Remove colon from bearer API key 2019-08-04 03:06:09 -05:00
Akkadius 4498819fad Abstracted CLI command handling interface, streamlined more logging 2019-08-04 02:58:26 -05:00
Chris Miles f5cfec529e Fix format ordering 2019-08-03 04:10:40 -05:00
Chris Miles 9d9374ec19 Fix #gmzone <zonename> <version> to actually create bucket flags via version 2019-08-03 01:32:56 -05:00
KimLS e56edd9231 Some changes to ordering of login authorization for world<->zone 2019-07-30 19:12:44 -07:00
Chris Miles 979c819075 Update README.md 2019-07-29 17:28:58 -05:00
KimLS b754ddbc67 Change drop client code to not be two step process 2019-07-27 20:13:04 -07:00
KimLS 3f2f7b3929 SQL 2019-07-26 19:23:47 -07:00
KimLS 9297fc38f6 Log kick events 2019-07-26 19:22:29 -07:00
Uleat ff4e549ec0 Fix for cmake 'zlib not found' defaulting to internal libs not working issue [skip ci] 2019-07-26 18:20:01 -04:00
KimLS a8ec176432 Merge branch 'master' of github.com:EQEmu/Server 2019-07-25 22:27:11 -07:00
KimLS 212f8a3062 Minor fixes to CLE stale system 2019-07-25 22:26:56 -07:00
Uleat cca5fe3286 Fix for multiple-argument with explicit token use in 'vcxproj_dependencies' [skip ci] 2019-07-25 19:55:42 -04:00
Uleat 9ac15d7a4b Fix for false elevation of priority in 'vcxproj_dependencies' [skip ci] 2019-07-24 22:48:51 -04:00
KimLS 23a187f6c1 Merge branch 'master' of github.com:EQEmu/Server 2019-07-24 19:20:24 -07:00
KimLS f3255c17da Changes to cle enums, characters will now auto kick on login instead of making you wait at world unless you specifically turn that feature on in the rules. 2019-07-24 19:20:09 -07:00
Uleat 90eb9e9da2 Some more mods and tweaks to 'vcxproj_dependencies' [skip ci] 2019-07-24 21:59:57 -04:00
KimLS ffb5b2393f Merge branch 'master' of github.com:EQEmu/Server 2019-07-23 21:59:32 -07:00
KimLS cd32a5a47a Make the reconnect code only trigger when there's actually a client IN ZONE and try to clean up otherwise 2019-07-23 21:59:22 -07:00
Uleat debc2644b1 Tweaked CMakeLists.txt so CMake will play nicer with 'vcpkg' dependencies [skip ci] 2019-07-23 21:11:30 -04:00
Chris Miles 9c9615e8bb Fix the manifest [skip ci] 2019-07-23 19:06:11 -05:00
Uleat 53ec007459 Fixes and tweaks for 'vcxproj' script [skip ci] (zlib still needs some work) 2019-07-23 19:34:35 -04:00
Uleat f5da6e18fc Changed 'vcxproj_dependencies.py' script criteria to allow zero-length pretext headers in multiple-argument hints [skip ci] 2019-07-22 23:27:38 -04:00
Uleat 72ae1b0e0b Added 'vcxproj_dependencies.py' 2019-07-22 23:05:33 -04:00
Akkadius 581cbccad5 CLE checks in non legacy user to world 2019-07-21 18:11:09 -05:00
Akkadius 4aca39ad9b Send correct response 2019-07-21 17:47:34 -05:00
Akkadius 5a7186305d Merge remote-tracking branch 'origin' into lsid 2019-07-21 22:18:19 +00:00
KimLS 780f8f8515 Mark old cle entries as stale when you login 2019-07-20 22:12:48 -07:00
Michael Cook (mackal) 186834594f Merge pull request #871 from EQEmu/fix_OP_SpecialMesg
Fix issues with OP_SpecialMesg handling
2019-07-20 01:46:53 -04:00
Michael Cook (mackal) f4310c5a06 Merge branch 'master' into fix_OP_SpecialMesg 2019-07-20 01:27:37 -04:00
Chris Miles 4d77ba28fe Merge pull request #872 from regneq/master
added language paramter to Lua_Mob::Say() and Lua_Mob::Shout() (credi…
2019-07-19 22:08:46 -07:00
Michael Cook (mackal) 222fd060a3 Change lua constants to be less ugly 2019-07-19 13:04:27 -04:00
regneq 31d0adbacc added language paramter to Lua_Mob::Say() and Lua_Mob::Shout() (credit to Torven) 2019-07-18 18:20:22 -07:00
Michael Cook (mackal) 9fe17f4d46 Fix issues with OP_SpecialMesg handling
This should prevent any optimizations being done on the "1 char string"

This also fully documents the packet and expands the uses of
quest::say/QuestSay
2019-07-18 00:56:46 -04:00
Michael Cook (mackal) 16d6014a87 Merge pull request #859 from eqft/feature/rule_for_gm_level_cmd_with_target
Convert constant check in level_command() to a Rule
2019-07-16 13:43:02 -04:00
Michael Cook (mackal) 7801b295d6 Merge pull request #869 from regneq/master
added variable to chatchannels as well as various changed to chatchannel and using language / language skills d…
2019-07-16 13:39:33 -04:00
Akkadius e92d130538 Adust ProcessUsertoWorldReq reponse codes 2019-07-15 02:21:19 -05:00
Akkadius 7c2ee06355 Merge branch 'master' of https://github.com/EQEmu/Server into lsid 2019-07-14 22:53:32 -05:00
Akkadius f6259af22b Add login schema conversion script 2019-07-14 22:26:12 -05:00
Akkadius 25c119b843 Add new default login.json 2019-07-14 22:23:51 -05:00
Akkadius 6d9bcfe39f Remove old login.ini 2019-07-14 22:16:50 -05:00
Akkadius ce09aad28a Move rest of logging to FMT and move config options into more finite categories 2019-07-14 22:16:26 -05:00
regneq 460468224e various changed to chatchannel and using language / language skills derived from takp code. 2019-07-14 20:03:30 -07:00
KimLS 6bdc9b6ba5 Add support for single account login to both world and login server, should also work with eqemu login server, can be turned off in rules if you don't mind the side effects double logins cause. Also lowered the linkdead time to 30s + 90s default (2min) 2019-07-13 16:16:15 -07:00
Uleat 7181b46608 Merge branch 'master' of https://github.com/EQEmu/Server 2019-07-13 00:44:09 -04:00
Uleat eb8cd1a5b4 Fix for build zlib option when not using vcpkg 2019-07-13 00:43:56 -04:00
Chris Miles a8e65cdce1 Merge pull request #826 from livermana/master
fix for mob movement getting 'stuck' when paths don't have updated lo…
2019-07-11 18:41:50 -05:00
Akkadius 949e7adff8 init vars [skip ci] 2019-07-11 01:23:55 -05:00
Michael Cook (mackal) 1ba78d0988 Switch to char_traits::length in SerializeBuffer
This benches a bit faster
2019-07-10 14:33:33 -04:00
Akkadius 35eb5b24dd Implement flymode 2019-07-10 03:39:07 -05:00
Akkadius 7b808ee6e0 Add more debug logging for ServerListPacket [skip ci] 2019-07-10 00:45:40 -05:00
Michael Cook (mackal) dfa90aaac5 Fix OP_SpecialMesg encoding
This broke with newer GCCs. It also worked even though the code was just
wrong before???
2019-07-10 01:44:59 -04:00
Michael Cook (mackal) 525813be02 Adjust VARSTRUCT_ENCODE_STRING macros for smarter compilers
This is no more dangerous than what we were doing before (not checking
return value of sprintf) Maybe we should sometime
2019-07-10 01:20:51 -04:00
Akkadius 2a927c5c80 Logging / initializers [skip ci] 2019-07-10 00:11:17 -05:00
Akkadius 6e550ecc75 CLE changes [skip ci] 2019-07-09 23:58:47 -05:00
Akkadius 839baba553 Logging [skip ci] 2019-07-09 19:27:23 -05:00
Akkadius 5c2ac5ab24 Validate password hash in WS auth [skip ci] 2019-07-09 17:52:04 -05:00
Akkadius 553d9aca6f Need more coffee apparently [skip ci] 2019-07-09 17:42:29 -05:00
Akkadius 910dfaf082 Typo fail [skip ci] 2019-07-09 17:41:08 -05:00
Akkadius 9730917d73 Format [skip ci] 2019-07-09 17:40:04 -05:00
Akkadius 32e8a0fa45 Authenticate world admin prior to checking against a world short name [skip ci] 2019-07-09 17:39:06 -05:00
Akkadius 193dbe5938 Few tweaks [skip ci] 2019-07-09 17:22:11 -05:00
Akkadius 86943ce6be Add Database::DbLoginServerAdmin GetLoginServerAdmin [skip ci] 2019-07-09 16:57:14 -05:00
Akkadius 739f54bbfb Add CreateLoginserverWorldAdminAccount command [skip ci] 2019-07-09 05:23:21 -05:00
Akkadius b165760f18 Update database [skip ci] 2019-07-09 04:02:13 -05:00
Akkadius 1a577014d9 Few more updates [skip ci] 2019-07-09 03:46:59 -05:00
Akkadius 54ea7d7c4b Update remote ip [skip ci] 2019-07-09 02:41:09 -05:00
Akkadius 0111e9a5d0 Update client [skip ci] 2019-07-09 02:32:20 -05:00
Akkadius 0c2d26579a Update database.cpp 2019-07-09 02:14:41 -05:00
Akkadius 8eaeda5ec5 Tweaks 2019-07-09 02:10:10 -05:00
KimLS 8c75cf1ff5 Fix for compile issues on windows (bad perl bad) 2019-07-08 19:26:21 -07:00
Uleat 87b1d32ce8 Updated PerlembParser::ExportItemVariables to new inventory standard 2019-07-08 21:58:47 -04:00
Akkadius d8f34651de Streamline worldserver authorization handlers, cleanup and refactoring 2019-07-08 20:25:37 -05:00
Akkadius c2917a9004 Take in API requests via json payload instead of params 2019-07-07 19:57:05 -05:00
Akkadius 5473457c0c Migrate database schema 2019-07-07 05:26:10 -05:00
Akkadius 392b328a95 Centralize local account creation and create API endpoint for creation 2019-07-07 04:32:59 -05:00
Akkadius 4bc6493718 Add cli command create-loginserver-account --username=* --password=* 2019-07-07 03:39:44 -05:00
Akkadius 78d8b909be Add standalone web api server, cli handler, authorization, commands 2019-07-07 03:13:04 -05:00
Akkadius 7d71163fa0 Update dbcore.cpp 2019-07-06 03:33:41 -05:00
Akkadius 0668f41de2 Fix some edge case with account name not being passed to world 2019-07-06 03:19:50 -05:00
Akkadius a9969e500b ls tweaks 2019-07-05 21:22:35 -05:00
Akkadius 3eb102a006 Fix issue with adding the real values of new logging categories 2019-07-05 19:43:10 -05:00
Akkadius 9d3ece8133 More logging 2019-07-05 18:34:08 -05:00
Akkadius b2ed5fe479 Add RFC 5424 logging 2019-07-05 18:16:09 -05:00
Akkadius 86f9a205e5 Remove eqemu_logsys_fmt.h header, more log tweaks 2019-07-05 17:20:20 -05:00
Akkadius f0937c3963 More logging adjustments 2019-07-05 04:21:22 -05:00
Akkadius ffd652a643 Load log settings from the database 2019-07-05 03:50:01 -05:00
Akkadius feea52f79e Make loginserver intelligently determine if the client is requesting from a RFC 1918 network instead of using a config string match 2019-07-05 03:38:12 -05:00
Akkadius 2c922876a9 More loginserver refactorings and cleanup 2019-07-05 02:49:55 -05:00
Akkadius b41e58fd10 More loginserver refactorings and cleanup 2019-07-05 02:33:31 -05:00
Akkadius 8b582730a8 Small refactorings 2019-07-05 00:44:42 -05:00
Akkadius d5eb015533 Remove old DB connector 2019-07-04 23:29:54 -05:00
Akkadius 8ad4ef503b database_mysql -> database 2019-07-03 23:27:45 -05:00
Akkadius a914e97c29 Convert Database::GetLoginTokenDataFromToken 2019-07-03 23:26:03 -05:00
Akkadius 126d8edc57 Convert Database::CreateWorldRegistration 2019-07-03 23:13:13 -05:00
Akkadius d17cfff8fe Migrate query Database::GetFreeID 2019-07-03 22:54:22 -05:00
Akkadius 1a5ce7a9de Cleanup query Database::GetWorldRegistration 2019-07-03 22:47:28 -05:00
Akkadius bd2836db61 DatabaseMySQL -> Database 2019-07-03 21:58:39 -05:00
Akkadius ff5783965a Use one database class 2019-07-03 21:56:24 -05:00
Akkadius 7fcf6b51d8 Update database.h 2019-07-03 21:35:39 -05:00
Akkadius eea3965d02 Add DatabaseMySQL::DoesLoginServerAccountExist 2019-07-03 21:35:36 -05:00
Akkadius d40b95f2e8 ProcessLSStatus logging 2019-07-03 19:22:06 -05:00
Akkadius dc9e4e8260 Received New Login Server Info log 2019-07-03 19:10:34 -05:00
Akkadius 8c25486112 Few tweaks 2019-07-03 18:54:08 -05:00
Akkadius 9613d128ae More logging updates 2019-07-03 18:49:53 -05:00
Akkadius 11bc21f99f Update more logging 2019-07-03 16:26:32 -05:00
Akkadius cdfd473476 Add more logging 2019-07-03 16:01:44 -05:00
Akkadius bb7cae46c5 Update console.cpp 2019-07-03 14:53:24 -05:00
Akkadius c7e196e26d Update client.cpp 2019-07-03 04:27:51 -05:00
Akkadius daec42c4d9 Migrate quite a few database calls to dbcore and fmt 2019-07-03 04:03:54 -05:00
Akkadius b04d71ff45 Update json_config.cpp 2019-07-03 03:09:03 -05:00
Akkadius fbebec03ae Update database_mysql.cpp 2019-07-03 02:57:03 -05:00
Akkadius 217c9751a8 Tons of cleanup / formatting 2019-07-03 02:50:16 -05:00
Akkadius 9e0f440106 Remove postgres 2019-07-03 02:16:30 -05:00
Akkadius 6638b9ade5 Cleanup 2019-07-03 02:16:16 -05:00
Akkadius ea02042ace Merge fixes 2019-07-03 01:40:36 -05:00
Akkadius 4e7bcd86ff Merge branch 'master' of https://github.com/EQEmu/Server into lsid 2019-07-03 01:18:23 -05:00
Justin Wienckowski 682054970c Zone::IsSpellBlocked should correctly handle spellid 0 (all spells) blocked in a region (type 2). 2019-06-29 00:08:37 -07:00
Akkadius 8bb909090b Merge branch 'master' into lsid 2019-06-26 00:56:13 -05:00
Justin Wienckowski 5fdf976137 Add an optional SQL to add the new rule to the rule_values table. Default value is unchanged. 2019-06-21 20:02:42 -07:00
Trust 1aab23098a Container lock inconsistent state fix 2019-06-18 23:59:37 +00:00
Justin Wienckowski 6a31af81ee Add GM:MinStatusToLevelTarget rule, which determines the GM status needed to use the #level command on your target. 2019-06-16 00:43:18 -07:00
kentai 6da0f84e18 Merge branch 'master' of https://github.com/EQEmu/Server 2019-03-16 17:27:08 +11:00
kentai b2dd3df1e2 Revert "Added bot commands"
This reverts commit 3ec500244e.
2019-03-16 17:16:49 +11:00
kentai 3ec500244e Added bot commands
^bottitle, ^botsuffix
2019-03-12 19:21:30 +11:00
KentaiVZ 4425e3ab49 Merge pull request #5 from EQEmu/master
merge local
2019-03-12 18:16:33 +11:00
kentai 413c006785 Merge branch 'master' of https://github.com/EQEmu/Server 2019-03-08 18:04:54 +11:00
kentai ae3052fbd1 Merge branch 'master' of https://github.com/EQEmu/Server 2019-02-27 10:21:25 +11:00
adam 7a28a6e9a7 fix for mob movement getting 'stuck' when paths don't have updated locations. 2019-02-22 19:17:09 -05:00
Adam Martin f6c8d9532e Applied changes proposed in https://github.com/decimad/luabind-deboostified/pull/38/
These changes claim to fix GCC 7 compilation.
2019-02-02 00:32:41 -06:00
Adam Martin 5f23a72a16 Removed unused boost header, fixed compiling with new luabind
Fixed TryFinishingBlow attempting to return by parameter reference.
The new luabind fails with a by_reference to by_value check. Using
a pointer accomplishes the same goal, but bypasses this issue.
2019-02-02 00:08:46 -06:00
Adam Martin 26eb4fb6e0 Swapped luabind for non-boost fork
https://github.com/decimad/luabind-deboostified
2019-02-02 00:06:32 -06:00
KentaiVZ 8be23a1214 Merge pull request #4 from EQEmu/master
update local
2019-01-28 14:45:02 +11:00
Xackery Xtal 44f85f140c Added Spells:CharmDisablesSpecialAbilities 2019-01-21 20:29:12 -08:00
hg a73bf221ed Make SPA 112 affect fizzle rate not effective caster level
Per dev quote, SPA 112 "Modifies casting skills of the affected
entity by BaseEffect for the purposes of determining whether or not a
fizzle occurs when casting spells."

Fixes issues caused by having a spell with this effect on caster such
as wrong target debuff durations and buff refreshes not taking hold.
2018-09-13 19:25:05 -04:00
KimLS f16faae964 Fix for bug in config reading tables 2018-01-20 21:26:52 -08:00
Akkadius e0391dfcb8 Merge branch 'master' into lsid 2018-01-17 22:04:46 -06:00
KimLS cc0034fd3c SQL files 2017-12-24 23:31:13 -08:00
KimLS 3fdfc82ca0 Merge branch 'master' into lsid 2017-12-24 23:21:35 -08:00
KimLS 0ec53eff52 Reimplement some functions 2017-12-24 23:21:17 -08:00
KimLS 7a778c549f convert login.ini to login.json, stole jumber's idea about auto-updating old passwords (wip still) 2017-12-16 23:08:21 -08:00
KimLS 3ee5730890 Auto link ls accounts plus auto-create 2017-12-14 18:41:10 -08:00
KimLS 569a907e43 Changes to make it actually sorta work 2017-12-11 18:38:04 -08:00
KimLS 5bbeec626c Heavy wip on login changes to get it to actually work like we want 2017-12-10 23:35:25 -08:00
KimLS 6b70faf141 Multiple login account support initial, needs a ton of work but can login and create account 2017-11-14 21:42:14 -08:00
887 changed files with 303606 additions and 46037 deletions
+21
View File
@@ -0,0 +1,21 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.101.1/containers/ubuntu-18.04-git
{
"name": "Ubuntu 18.04 EQEMU",
// Moved from dockerfile to image so it builds faster
"image": "eqemu/devcontainer:0.0.2",
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
// Add the IDs of extensions you want installed when the container is created.
"extensions": ["ms-vscode.cpptools", "ms-azuretools.vscode-docker"],
"mounts": ["source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"],
"remoteEnv": {
"HOST_PROJECT_PATH": "${localWorkspaceFolder}"
}
}
+16
View File
@@ -0,0 +1,16 @@
---
kind: pipeline
type: docker
name: EQEmulator Server Linux CI
# Limits how many of these builds can run on the drone runner at a time, this isn't about cores
concurrency:
limit: 1
steps:
- name: server-build
# Source build script https://github.com/Akkadius/akk-stack/blob/master/containers/eqemu-server/Dockerfile#L20
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))
+24
View File
@@ -17,6 +17,8 @@
*.out *.out
*.app *.app
.bash_history
# CMake # CMake
CMakeCache.txt CMakeCache.txt
CMakeFiles CMakeFiles
@@ -27,6 +29,28 @@ install_manifest.txt
log/ log/
logs/ logs/
vcpkg/ vcpkg/
perl/
.idea/* .idea/*
*cbp *cbp
submodules/*
cmake-build-debug/
.nfs.*
# Visual Studio and CMAKE Generated Files
/.vs/
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
*.cmake
*.ilk
*.pdb
*.sln
*.dir/
libs/
bin/
/Win32
/x64
/client_files/**/CMakeFiles/
+11 -19
View File
@@ -1,26 +1,18 @@
language: cpp language: cpp
compiler: gcc compiler: gcc
dist: trusty dist: bionic
before_install: addons:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test apt:
- sudo apt-get update -qq packages:
- mkdir $HOME/usr - libmysqlclient-dev
- export PATH="$HOME/usr/bin:$PATH" - libperl-dev
- wget https://cmake.org/files/v3.11/cmake-3.11.2-Linux-x86_64.sh - libboost-dev
- chmod +x cmake-3.11.2-Linux-x86_64.sh - liblua5.1-0-dev
- ./cmake-3.11.2-Linux-x86_64.sh --prefix=$HOME/usr --exclude-subdir --skip-license - zlib1g-dev
- uuid-dev
- libssl-dev
install:
- sudo apt-get install -qq g++-7
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
- sudo apt-get install libmysqlclient-dev
- sudo apt-get install libperl-dev
- sudo apt-get install libboost-dev
- sudo apt-get install liblua5.1-0-dev
- sudo apt-get install zlib1g-dev
- sudo apt-get install uuid-dev
- sudo apt-get install libssl-dev
script: script:
- cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LOGIN=ON - cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LOGIN=ON
- make -j2 - make -j2
+16
View File
@@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/mysql"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}
+164
View File
@@ -0,0 +1,164 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "cd bin && make",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "make clean",
"type": "shell",
"command": "cd bin && make clean",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "cmake",
"type": "shell",
"command": "mkdir -p bin && cd bin && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher":{
"owner": "cpp",
"fileLocation": "relative",
"pattern":[
{
"regexp": "([\\w+|\\\\]*\\.\\w+)\\((\\d+)\\)\\: (warning|error) (.*)$",
"file": 1,
"location": 2,
"severity": 3,
"message": 4
}
]
}
},
{
"label": "download maps",
"type": "shell",
"command": "mkdir -p bin && cd bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "download quests",
"type": "shell",
"command": "mkdir -p bin && cd bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "download eqemu_config",
"type": "shell",
"command": "mkdir -p bin && cd bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "rebuild database (mariadb must be started)",
"type": "shell",
"command": "mkdir -p bin && cd bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "zone 7000",
"type": "shell",
"command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "zone 7001",
"type": "shell",
"command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "loginserver",
"type": "shell",
"command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "shared_memory, world",
"type": "shell",
"command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "queryserv",
"type": "shell",
"command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "mariadb",
"type": "shell",
"command": "docker stop mariadb | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "ucs",
"type": "shell",
"command": "docker stop ucs | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src -p 7778:7778 --name ucs --network=eqemu eqemu/server:0.0.3 gdb -ex run ./ucs",
"group": {
"kind": "test",
"isDefault": true
}
}
]
}
+64
View File
@@ -0,0 +1,64 @@
# Guide To Building From Source Without Installer
This guide is far from exhaustive, you should expect to have some experience with building C++ code before considering compiling the code from scratch. You should instead consider using the installer scripts if you don't want to hack on the code directly.
### CMake
EQEmu uses CMake as the build system on all platforms. You will need CMake 3.2 or higher to build from source.
### Dependencies
The following libraries are required to build from source:
- [boost](https://www.boost.org/ "boost")
- [zlib](https://www.zlib.net/ "zlib") (If not included the source will build [zlib-ng](https://github.com/zlib-ng/zlib-ng "zlib-ng") instead)
- [libmysql](https://dev.mysql.com/downloads/connector/c/ "libmysql") or [libmariadb](https://github.com/MariaDB/mariadb-connector-c "libmariadb")
The following libraries are not strictly required but in many cased recommended.
- [OpenSSL](https://www.openssl.org/ "OpenSSL") or [mbedTLS](https://tls.mbed.org/ "mbedTLS") (Required for the loginserver and headless client)
- [libsodium](https://github.com/jedisct1/libsodium "libsodium") (Required for strong password hashing on the loginserver)
- [Lua 5.1](https://www.lua.org/ "Lua 5.1") or [LuaJit](http://luajit.org/ "LuaJit") (Required for Lua Quest Scripting)
- [Perl](https://www.perl.org/ "Perl") (Required for Perl Quest Scripting)
##### Windows
For windows it is suggested you make use of [vcpkg](https://github.com/microsoft/vcpkg "vcpkg") if you wish to build your own dependencies.
If you wish to use Perl then you should use whichever version of Perl you have installed on the target system.
You can also download a vcpkg export from our releases section for Visual Studio [x86](https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x86.zip "x86") or [x64](https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x64.zip "x64") that includes a toolchain file you can pass to CMake.
##### Linux
For Linux you simply can install the dependencies from your package manager, below is an example of doing it on Ubuntu using apt-get.
sudo apt-get install libmysqlclient-dev libperl-dev libboost-dev liblua5.1-0-dev zlib1g-dev uuid-dev libssl-dev
### Running CMake
##### Windows
The following is a modified command our automated build server uses to run CMake via the release vcpkg export and its toolchain file.
Assuming it is starting in c:/projects/eqemu and the x64 dependencies were extracted to c:/projects/eqemu/vcpkg.
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_ZLIB=ON -DEQEMU_ENABLE_BOTS=ON -DCMAKE_TOOLCHAIN_FILE="c:/projects/eqemu/vcpkg/vcpkg-export-20180828-145455/scripts/buildsystems/vcpkg.cmake" ..
##### Linux
Similarly to Windows running CMake on Linux is simple it just omits the toolchain file and uses a different generator.
mkdir build
cd build
cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LOGIN=ON ..
### Building
##### Windows
Inside the build directory a file EQEmu.sln should be produced by a successful run of the CMake command. You can either open this with Visual Studio or build it directly with MSBuild via the command line.
msbuild EQEmu.sln /p:Configuration=Release
##### Linux
From the build directory you can simply call make to build.
For example.
make -j4
+277 -298
View File
@@ -1,122 +1,28 @@
#EQEmu CMake CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
#Variables used:
#EQEMU_DISABLE_CRT_SECURE_WARNINGS
#EQEMU_FAST_FLOATINGPOINT
#EQEMU_ENABLE_CRASH_LOGGING
#EQEMU_DISABLE_SAFESEH
#EQEMU_BUILD_MSVC_MP
#EQEMU_DEBUG_LEVEL
#EQEMU_LOG_LEVEL_STATUS
#EQEMU_LOG_LEVEL_NORMAL
#EQEMU_LOG_LEVEL_ERROR
#EQEMU_LOG_LEVEL_DEBUG
#EQEMU_LOG_LEVEL_QUEST
#EQEMU_LOG_LEVEL_COMMANDS
#EQEMU_LOG_LEVEL_CRASH
#EQEMU_DEPOP_INVALIDATES_CACHE
#EQEMU_ENABLE_BOTS
#EQEMU_DISABLE_LOGSYS
#EQEMU_COMMANDS_LOGGING
#EQEMU_BUILD_SERVER
#EQEMU_BUILD_LOGIN
#EQEMU_BUILD_TESTS
#EQEMU_BUILD_PERL
#EQEMU_BUILD_LUA
#EQEMU_SANITIZE_LUA_LIBS
#EQEMU_BUILD_CLIENT_FILES
#EQEMU_USE_MAP_MMFS
#EQEMU_MAP_DIR
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
IF(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
ENDIF()
#FindMySQL is located here so lets make it so CMake can find it
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH}) SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
#Our project name is EQEmu IF(POLICY CMP0074)
CMAKE_POLICY(SET CMP0074 NEW)
ENDIF()
PROJECT(EQEmu) PROJECT(EQEmu)
#Default build type is set to RelWithDebInfo for generators that honor that like makefiles
IF(NOT CMAKE_BUILD_TYPE) IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE) ENDIF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dependencies" "${CMAKE_PREFIX_PATH}") SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
#Add our various windows definitions SET(CMAKE_CXX_EXTENSIONS OFF)
IF(MSVC OR MINGW)
ADD_DEFINITIONS(-D_WINDOWS)
IF(CMAKE_CL_64)
ADD_DEFINITIONS(-DWIN64)
ELSE(CMAKE_CL_64)
ADD_DEFINITIONS(-DWIN32)
ENDIF(CMAKE_CL_64)
ENDIF(MSVC OR MINGW)
IF(MSVC) IF(MSVC)
IF(CMAKE_CL_64)
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64")
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x64")
SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x64")
SET(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openssl_x64")
SET(SODIUM_INCLUDE_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/include")
IF(MSVC_VERSION GREATER 1800)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v140/dynamic")
ELSEIF(MSVC_VERSION EQUAL 1800)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v120/dynamic")
ELSE()
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v110/dynamic")
ENDIF()
ELSE(CMAKE_CL_64)
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86")
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86")
SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x86")
SET(SODIUM_INCLUDE_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/include")
SET(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openssl_x86")
IF(MSVC_VERSION GREATER 1800)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v140/dynamic")
ELSEIF(MSVC_VERSION EQUAL 1800)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v120/dynamic")
ELSE()
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v110/dynamic")
ENDIF()
ENDIF(CMAKE_CL_64)
#disable CRT warnings on windows cause they're annoying as shit and we use C functions everywhere
OPTION(EQEMU_DISABLE_CRT_SECURE_WARNINGS "Disable Secure CRT Warnings" ON)
IF(EQEMU_DISABLE_CRT_SECURE_WARNINGS)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ENDIF(EQEMU_DISABLE_CRT_SECURE_WARNINGS)
#fast FP if you'd like it
OPTION(EQEMU_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON)
IF(EQEMU_FAST_FLOATINGPOINT)
ADD_DEFINITIONS(/fp:fast)
ENDIF(EQEMU_FAST_FLOATINGPOINT)
#crash logging currently only works on windows x86/x64
OPTION(EQEMU_ENABLE_CRASH_LOGGING "Enable crash logging" ON)
IF(EQEMU_ENABLE_CRASH_LOGGING)
ADD_DEFINITIONS(-DCRASH_LOGGING)
ENDIF(EQEMU_ENABLE_CRASH_LOGGING)
OPTION(EQEMU_BUILD_MSVC_MP "Enable build with multiple processes." ON)
IF(EQEMU_BUILD_MSVC_MP)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ENDIF(EQEMU_BUILD_MSVC_MP)
#We want to compile /MT not /MD so we change that
FOREACH(flag_var CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
IF(${flag_var} MATCHES "/MD")
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
ENDIF(${flag_var} MATCHES "/MD")
ENDFOREACH(flag_var)
ADD_DEFINITIONS(-DNOMINMAX) ADD_DEFINITIONS(-DNOMINMAX)
ADD_DEFINITIONS(-DCRASH_LOGGING)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ELSE(MSVC) ELSE(MSVC)
#Normally set by perl but we don't use the perl flags anymore so we set it.
ADD_DEFINITIONS(-DHAS_UNION_SEMUN) ADD_DEFINITIONS(-DHAS_UNION_SEMUN)
ENDIF(MSVC) ENDIF(MSVC)
@@ -133,227 +39,235 @@ IF(UNIX)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
ENDIF(UNIX) ENDIF(UNIX)
#debug level, 5 is default. Most people wont ever change this but it's there if you want to ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
SET(EQEMU_DEBUG_LEVEL 5 CACHE STRING "EQEmu debug level: ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT)
0 - Quiet mode Errors to file Status and Normal ignored ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL)
1 - Status and Normal to console, Errors to logfile
2 - Status, Normal, and Error to console and logfile
3 - Light debug release errors and status
4 - Moderate debug release errors and status
5 - Maximum debug release errors and status
10 - More errors than you ever wanted to see"
)
SET(EQEMU_LOG_LEVEL_STATUS 2 CACHE STRING "EQEmu logging level for [Status]: #MSVC can fetch dependencies automatically.
0 - Disabled IF(MSVC)
1 - Ouput to File Enabled INCLUDE("${CMAKE_SOURCE_DIR}/cmake/DependencyHelperMSVC.cmake")
2 - Output to stdout Enabled ENDIF()
3 - Output to File and stdout Enabled
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_NORMAL 3 CACHE STRING "EQEmu logging level for [Normal]: #Find everything we need
0 - Disabled FIND_PACKAGE(Boost REQUIRED)
1 - Ouput to File Enabled FIND_PACKAGE(MySQL)
2 - Output to stdout Enabled FIND_PACKAGE(MariaDB)
3 - Output to File and stdout Enabled FIND_PACKAGE(ZLIB)
8 - Output to stderr Enabled FIND_PACKAGE(OpenSSL)
9 - Output to File and stderr Enabled FIND_PACKAGE(Lua51)
11 - Output to File, stdout and stderr Enabled" FIND_PACKAGE(PerlLibs)
) FIND_PACKAGE(Sodium)
FIND_PACKAGE(mbedTLS)
SET(EQEMU_LOG_LEVEL_ERROR 2 CACHE STRING "EQEmu logging level for [Error]: MESSAGE(STATUS "**************************************************")
0 - Disabled MESSAGE(STATUS "* Library Detection *")
1 - Ouput to File Enabled MESSAGE(STATUS "**************************************************")
2 - Output to stdout Enabled
3 - Output to File and stdout Enabled
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_DEBUG 3 CACHE STRING "EQEmu logging level for [Debug]: IF(MYSQL_FOUND)
0 - Disabled MESSAGE(STATUS "* MySQL: FOUND *")
1 - Ouput to File Enabled ELSE()
2 - Output to stdout Enabled MESSAGE(STATUS "* MySQL: MISSING *")
3 - Output to File and stdout Enabled ENDIF()
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_QUEST 2 CACHE STRING "EQEmu logging level for [Quest]: IF(MARIADB_FOUND)
0 - Disabled MESSAGE(STATUS "* MariaDB: FOUND *")
1 - Ouput to File Enabled ELSE()
2 - Output to stdout Enabled MESSAGE(STATUS "* MariaDB: MISSING *")
3 - Output to File and stdout Enabled ENDIF()
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_COMMANDS 1 CACHE STRING "EQEmu logging level for [Commands]: IF(ZLIB_FOUND)
0 - Disabled MESSAGE(STATUS "* ZLIB: FOUND *")
1 - Ouput to File Enabled ELSE()
2 - Output to stdout Enabled MESSAGE(STATUS "* ZLIB: MISSING *")
3 - Output to File and stdout Enabled ENDIF()
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_CRASH 3 CACHE STRING "EQEmu logging level for [Crash]: IF(Lua51_FOUND)
0 - Disabled MESSAGE(STATUS "* Lua: FOUND *")
1 - Ouput to File Enabled ELSE()
2 - Output to stdout Enabled MESSAGE(STATUS "* Lua: MISSING *")
3 - Output to File and stdout Enabled ENDIF()
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
MARK_AS_ADVANCED(EQEMU_LOG_LEVEL_STATUS EQEMU_LOG_LEVEL_NORMAL EQEMU_LOG_LEVEL_ERROR EQEMU_LOG_LEVEL_DEBUG EQEMU_LOG_LEVEL_QUEST EQEMU_LOG_LEVEL_COMMANDS EQEMU_LOG_LEVEL_CRASH) IF(PerlLibs_FOUND)
MESSAGE(STATUS "* Perl: FOUND *")
ELSE()
MESSAGE(STATUS "* Perl: MISSING *")
ENDIF()
#NPC Types Cache Behavior IF(SODIUM_FOUND)
MESSAGE(STATUS "* libsodium: FOUND *")
ELSE()
MESSAGE(STATUS "* libsodium: MISSING *")
ENDIF()
IF(OpenSSL_FOUND)
MESSAGE(STATUS "* OpenSSL: FOUND *")
ELSE()
MESSAGE(STATUS "* OpenSSL: MISSING *")
ENDIF()
IF(MBEDTLS_FOUND)
MESSAGE(STATUS "* mbedTLS: FOUND *")
ELSE()
MESSAGE(STATUS "* mbedTLS: MISSING *")
ENDIF()
MESSAGE(STATUS "**************************************************")
#options
OPTION(EQEMU_DEPOP_INVALIDATES_CACHE "#repop invalidates the npc_types cache (will cause a larger database hit on #repop but is more convienent)." ON) OPTION(EQEMU_DEPOP_INVALIDATES_CACHE "#repop invalidates the npc_types cache (will cause a larger database hit on #repop but is more convienent)." ON)
#Bots are a compile time option so on/off
OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF) OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF)
#Disable entire _mlog system (excludes trade/command logs)
OPTION(EQEMU_DISABLE_LOGSYS "Disable Logging INI System" ON)
#Enable GM Command log system
OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON) OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
IF(EQEMU_COMMANDS_LOGGING) IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING) ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
ENDIF(EQEMU_COMMANDS_LOGGING) ENDIF(EQEMU_COMMANDS_LOGGING)
IF(EQEMU_DISABLE_LOGSYS)
ADD_DEFINITIONS(-DDISABLE_LOGSYS)
ENDIF(EQEMU_DISABLE_LOGSYS)
IF(EQEMU_ENABLE_BOTS) IF(EQEMU_ENABLE_BOTS)
ADD_DEFINITIONS(-DBOTS) ADD_DEFINITIONS(-DBOTS)
ENDIF(EQEMU_ENABLE_BOTS) ENDIF(EQEMU_ENABLE_BOTS)
#What to build #database
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON) IF(MySQL_FOUND AND MariaDB_FOUND)
OPTION(EQEMU_BUILD_LOGIN "Build the login server." OFF) SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF) MySQL
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF) MariaDB"
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON) )
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
#C++11 stuff IF(DATABASE_LIBRARY_SELECTION STREQUAL "MySQL")
IF(NOT MSVC) SET(DATABASE_LIBRARY_TYPE " MySQL")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") SET(DATABASE_LIBRARY_LIBS ${MySQL_LIBRARIES})
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") SET(DATABASE_LIBRARY_INCLUDE ${MySQL_INCLUDE_DIR})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reserved-user-defined-literal") ELSEIF(DATABASE_LIBRARY_SELECTION STREQUAL "MariaDB")
ENDIF() SET(DATABASE_LIBRARY_TYPE "MariaDB")
ENDIF(NOT MSVC) SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES})
SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR})
#Various definitions ELSE()
IF(EQEMU_BUILD_PERL) MESSAGE(FATAL_ERROR "Unknown database library set, should be one of: MySQL, MariaDB")
ADD_DEFINITIONS(-DEMBPERL)
ADD_DEFINITIONS(-DEMBPERL_PLUGIN)
ENDIF(EQEMU_BUILD_PERL)
IF(EQEMU_BUILD_LUA)
ADD_DEFINITIONS(-DLUA_EQEMU)
ENDIF(EQEMU_BUILD_LUA)
#Disabled until reevaluation performed
#OPTION(EQEMU_USE_MAP_MMFS "Create and use Zone Map MMF files." OFF)
#IF(EQEMU_USE_MAP_MMFS)
# ADD_DEFINITIONS(-DUSE_MAP_MMFS)
#ENDIF(EQEMU_USE_MAP_MMFS)
SET(EQEMU_MAP_DIR "./Maps" CACHE STRING "The dir that maps, water maps, and paths are located in.")
ADD_DEFINITIONS(-DEQDEBUG=${EQEMU_DEBUG_LEVEL})
ADD_DEFINITIONS(-DINVERSEXY)
ADD_DEFINITIONS(-DFIELD_ITEMS)
ADD_DEFINITIONS(-DMAP_DIR="${EQEMU_MAP_DIR}")
ADD_DEFINITIONS(-DLOG_LEVEL_STATUS=${EQEMU_LOG_LEVEL_STATUS})
ADD_DEFINITIONS(-DLOG_LEVEL_NORMAL=${EQEMU_LOG_LEVEL_NORMAL})
ADD_DEFINITIONS(-DLOG_LEVEL_ERROR=${EQEMU_LOG_LEVEL_ERROR})
ADD_DEFINITIONS(-DLOG_LEVEL_DEBUG=${EQEMU_LOG_LEVEL_DEBUG})
ADD_DEFINITIONS(-DLOG_LEVEL_QUEST=${EQEMU_LOG_LEVEL_QUEST})
ADD_DEFINITIONS(-DLOG_LEVEL_COMMANDS=${EQEMU_LOG_LEVEL_COMMANDS})
ADD_DEFINITIONS(-DLOG_LEVEL_CRASH=${EQEMU_LOG_LEVEL_CRASH})
ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT)
ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL)
#Find everything we need
FIND_PACKAGE(ZLIB REQUIRED)
FIND_PACKAGE(MySQL REQUIRED)
IF(EQEMU_BUILD_PERL)
FIND_PACKAGE(PerlLibs REQUIRED)
INCLUDE_DIRECTORIES(SYSTEM "${PERL_INCLUDE_PATH}")
ENDIF(EQEMU_BUILD_PERL)
SET(SERVER_LIBS common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} uv_a fmt RecastNavigation::Detour)
FIND_PACKAGE(Sodium REQUIRED)
IF(SODIUM_FOUND)
OPTION(EQEMU_ENABLE_SECURITY "Use Encryption For TCP Connections" ON)
IF(EQEMU_ENABLE_SECURITY)
INCLUDE_DIRECTORIES(SYSTEM "${SODIUM_INCLUDE_DIRS}")
ADD_DEFINITIONS(-DENABLE_SECURITY)
SET(SERVER_LIBS ${SERVER_LIBS} ${SODIUM_LIBRARIES})
ENDIF() ENDIF()
ELSEIF(MariaDB_FOUND)
SET(DATABASE_LIBRARY_TYPE "MariaDB")
SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES})
SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR})
ELSEIF(MySQL_FOUND)
SET(DATABASE_LIBRARY_TYPE " MySQL")
SET(DATABASE_LIBRARY_LIBS ${MySQL_LIBRARIES})
SET(DATABASE_LIBRARY_INCLUDE ${MySQL_INCLUDE_DIR})
ELSE()
MESSAGE(FATAL_ERROR "One of MySQL or MariaDB is a required dependency.")
ENDIF() ENDIF()
IF(ZLIB_FOUND) #security
OPTION(EQEMU_BUILD_ZLIB "Build internal version of zlib." OFF) #prefer openssl to mbedtls (arbitrary)
IF(OpenSSL_FOUND AND MBEDTLS_FOUND)
SET(TLS_LIBRARY_SELECTION OpenSSL CACHE STRING "TLS library to use:
OpenSSL
mbedTLS"
)
IF(EQEMU_BUILD_ZLIB) IF(TLS_LIBRARY_SELECTION STREQUAL "OpenSSL")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng") SET(TLS_LIBRARY_TYPE " OpenSSL")
SET(SERVER_LIBS ${SERVER_LIBS} "zlibstatic") SET(TLS_LIBRARY_ENABLED ON)
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
ELSEIF(TLS_LIBRARY_SELECTION STREQUAL "mbedTLS")
SET(TLS_LIBRARY_TYPE " mbedTLS")
SET(TLS_LIBRARY_ENABLED ON)
SET(TLS_LIBRARY_LIBS ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
SET(TLS_LIBRARY_INCLUDE ${MBEDTLS_INCLUDE_DIR})
ADD_DEFINITIONS(-DEQEMU_USE_MBEDTLS)
ELSE() ELSE()
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}") MESSAGE(FATAL_ERROR "Unknown TLS library set, should be one of: OpenSSL, mbedTLS")
SET(SERVER_LIBS ${SERVER_LIBS} ${ZLIB_LIBRARY}) ENDIF()
ELSEIF(OpenSSL_FOUND)
SET(TLS_LIBRARY_TYPE " OpenSSL")
SET(TLS_LIBRARY_ENABLED ON)
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
ELSEIF(MBEDTLS_FOUND)
SET(TLS_LIBRARY_TYPE " mbedTLS")
SET(TLS_LIBRARY_ENABLED ON)
SET(TLS_LIBRARY_LIBS ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
SET(TLS_LIBRARY_INCLUDE ${MBEDTLS_INCLUDE_DIR})
ADD_DEFINITIONS(-DEQEMU_USE_MBEDTLS)
ELSE()
SET(TLS_LIBRARY_TYPE "Disabled")
SET(TLS_LIBRARY_ENABLED OFF)
ENDIF()
IF(SODIUM_FOUND)
SET(SODIUM_LIBRARY_TYPE "Libsodium")
SET(SODIUM_LIBRARY_ENABLED ON)
SET(SODIUM_LIBRARY_LIBS ${SODIUM_LIBRARIES})
SET(SODIUM_LIBRARY_INCLUDE ${SODIUM_INCLUDE_DIRS})
ADD_DEFINITIONS(-DENABLE_SECURITY)
ELSE()
SET(SODIUM_LIBRARY_TYPE " Disabled")
SET(SODIUM_LIBRARY_ENABLED OFF)
ENDIF()
IF(Lua51_FOUND)
SET(LUA_LIBRARY_TYPE " Lua 5.1")
SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind)
SET(LUA_LIBRARY_INCLUDE ${LUA_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
ELSE()
SET(LUA_LIBRARY_TYPE "Disabled")
SET(LUA_LIBRARY_ENABLED OFF)
ENDIF()
IF(PerlLibs_FOUND)
SET(PERL_LIBRARY_TYPE " Perl")
SET(PERL_LIBRARY_ENABLED ON)
SET(PERL_LIBRARY_LIBS ${PERL_LIBRARY})
SET(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH})
ELSE()
SET(PERL_LIBRARY_TYPE "Disabled")
SET(PERL_LIBRARY_ENABLED OFF)
ENDIF()
#use zlib if exists
IF(ZLIB_FOUND)
OPTION(EQEMU_BUILD_ZLIB "Build internal version of zlib." ON)
IF(EQEMU_BUILD_ZLIB)
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
ELSE()
SET(ZLIB_LIBRARY_TYPE " zlib")
SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY})
SET(ZLIB_LIBRARY_INCLUDE ${ZLIB_INCLUDE_DIRS})
ENDIF() ENDIF()
ELSE() ELSE()
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng") SET(ZLIB_LIBRARY_TYPE "zlib-ng")
SET(SERVER_LIBS ${SERVER_LIBS} "zlibstatic") SET(ZLIB_LIBRARY_LIBS "zlibstatic")
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
ENDIF() ENDIF()
IF(WIN32) MESSAGE(STATUS "")
SET(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv") MESSAGE(STATUS "**************************************************")
ENDIF() MESSAGE(STATUS "* Library Usage *")
MESSAGE(STATUS "**************************************************")
MESSAGE(STATUS "* Database: ${DATABASE_LIBRARY_TYPE} *")
MESSAGE(STATUS "* TLS: ${TLS_LIBRARY_TYPE} *")
MESSAGE(STATUS "* Sodium: ${SODIUM_LIBRARY_TYPE} *")
MESSAGE(STATUS "* Lua: ${LUA_LIBRARY_TYPE} *")
MESSAGE(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *")
MESSAGE(STATUS "* zlib: ${ZLIB_LIBRARY_TYPE} *")
MESSAGE(STATUS "**************************************************")
IF(UNIX) #setup server libs and headers
SET(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread") SET(SERVER_LIBS common ${DATABASE_LIBRARY_LIBS} ${ZLIB_LIBRARY_LIBS} ${Boost_LIBRARIES} uv_a fmt RecastNavigation::Detour)
IF(NOT DARWIN)
SET(SERVER_LIBS ${SERVER_LIBS} "rt")
ENDIF()
SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
ENDIF()
IF(EQEMU_BUILD_LUA) INCLUDE_DIRECTORIES(SYSTEM "${DATABASE_LIBRARY_INCLUDE}")
FIND_PACKAGE(EQLua51 REQUIRED) INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_LIBRARY_INCLUDE}")
SET(Boost_USE_STATIC_LIBS OFF) INCLUDE_DIRECTORIES(SYSTEM "${Boost_INCLUDE_DIRS}")
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
SET(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/boost")
FIND_PACKAGE(Boost REQUIRED)
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
IF(EQEMU_SANITIZE_LUA_LIBS)
ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS)
ENDIF(EQEMU_SANITIZE_LUA_LIBS)
ENDIF(EQEMU_BUILD_LUA)
INCLUDE_DIRECTORIES(SYSTEM "${MySQL_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/glm") INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/glm")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/cereal/include") INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/cereal/include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/fmt/include") INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/fmt/include")
@@ -365,23 +279,87 @@ INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigat
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Recast/Include") INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Recast/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp") INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp")
OPTION(EQEMU_BUILD_LOGGING "Build Logging (To speed up compilation)" ON)
IF(EQEMU_BUILD_LOGGING)
ADD_DEFINITIONS(-DBUILD_LOGGING)
ENDIF()
IF(TLS_LIBRARY_ENABLED)
SET(SERVER_LIBS ${SERVER_LIBS} ${TLS_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${TLS_LIBRARY_INCLUDE}")
ENDIF()
IF(SODIUM_LIBRARY_ENABLED)
SET(SERVER_LIBS ${SERVER_LIBS} ${SODIUM_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${SODIUM_LIBRARY_INCLUDE}")
ENDIF()
IF(LUA_LIBRARY_ENABLED)
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
IF(EQEMU_BUILD_LUA)
ADD_DEFINITIONS(-DLUA_EQEMU)
SET(SERVER_LIBS ${SERVER_LIBS} ${LUA_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${LUA_LIBRARY_INCLUDE}")
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
IF(EQEMU_SANITIZE_LUA_LIBS)
ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS)
ENDIF()
ENDIF()
ENDIF()
IF(PERL_LIBRARY_ENABLED)
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
IF(EQEMU_BUILD_PERL)
SET(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}")
ADD_DEFINITIONS(-DEMBPERL)
ADD_DEFINITIONS(-DEMBPERL_PLUGIN)
ENDIF()
ENDIF()
IF(WIN32)
SET(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv")
ENDIF()
IF(UNIX)
SET(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread")
IF(NOT DARWIN)
SET(SERVER_LIBS ${SERVER_LIBS} "rt")
ENDIF()
# Freebsd provides uuids in the C library
IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
ENDIF()
ENDIF()
IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED)
MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.")
ENDIF()
IF(EQEMU_BUILD_HC AND NOT TLS_LIBRARY_ENABLED)
MESSAGE(FATAL_ERROR "Headless client requires a TLS Library to build.")
ENDIF()
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
ADD_SUBDIRECTORY(common) ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY(libs) ADD_SUBDIRECTORY(libs)
ADD_SUBDIRECTORY(submodules/fmt) ADD_SUBDIRECTORY(submodules/fmt)
ADD_SUBDIRECTORY(submodules/libuv) ADD_SUBDIRECTORY(submodules/libuv)
SET(RECASTNAVIGATION_DEMO OFF CACHE BOOL "Build demo")
SET(RECASTNAVIGATION_TESTS OFF CACHE BOOL "Build tests")
SET(RECASTNAVIGATION_EXAMPLES OFF CACHE BOOL "Build examples")
ADD_SUBDIRECTORY(submodules/recastnavigation)
IF(EQEMU_BUILD_ZLIB) IF(EQEMU_BUILD_ZLIB)
SET(ZLIB_COMPAT ON CACHE BOOL "Compile with zlib compatible API") SET(ZLIB_COMPAT ON CACHE BOOL "Compile with zlib compatible API")
SET(ZLIB_ENABLE_TESTS OFF CACHE BOOL "Build test binaries") SET(ZLIB_ENABLE_TESTS OFF CACHE BOOL "Build test binaries")
ADD_SUBDIRECTORY(libs/zlibng) ADD_SUBDIRECTORY(libs/zlibng)
ENDIF() ENDIF()
SET(RECASTNAVIGATION_DEMO OFF CACHE BOOL "Build demo")
SET(RECASTNAVIGATION_TESTS OFF CACHE BOOL "Build tests")
SET(RECASTNAVIGATION_EXAMPLES OFF CACHE BOOL "Build examples")
ADD_SUBDIRECTORY(submodules/recastnavigation)
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
IF(EQEMU_BUILD_SERVER) IF(EQEMU_BUILD_SERVER)
ADD_SUBDIRECTORY(shared_memory) ADD_SUBDIRECTORY(shared_memory)
ADD_SUBDIRECTORY(world) ADD_SUBDIRECTORY(world)
@@ -390,6 +368,7 @@ IF(EQEMU_BUILD_SERVER)
ADD_SUBDIRECTORY(queryserv) ADD_SUBDIRECTORY(queryserv)
ADD_SUBDIRECTORY(eqlaunch) ADD_SUBDIRECTORY(eqlaunch)
ENDIF(EQEMU_BUILD_SERVER) ENDIF(EQEMU_BUILD_SERVER)
IF(EQEMU_BUILD_LOGIN) IF(EQEMU_BUILD_LOGIN)
ADD_SUBDIRECTORY(loginserver) ADD_SUBDIRECTORY(loginserver)
ENDIF(EQEMU_BUILD_LOGIN) ENDIF(EQEMU_BUILD_LOGIN)
+15 -4
View File
@@ -1,7 +1,7 @@
# EQEmulator Core Server # EQEmulator Core Server
|Travis CI (Linux)|Appveyor w/ Bots (Windows) |Appveyor w/o Bots (Windows) | |Travis CI (Linux)|Appveyor (Windows x86) |Appveyor (Windows x64) |
|:---:|:---:|:---:| |:---:|:---:|:---:|
|[![Linux CI](https://travis-ci.org/EQEmu/Server.svg?branch=master)](https://travis-ci.org/EQEmu/Server) |[![Build status](https://ci.appveyor.com/api/projects/status/scr25kmntx36c1ub/branch/master?svg=true)](https://ci.appveyor.com/project/KimLS/server-87crp/branch/master) |[![Build status](https://ci.appveyor.com/api/projects/status/mdwbr4o9l6mxqofj/branch/master?svg=true)](https://ci.appveyor.com/project/KimLS/server-w0pq2/branch/master) | |[![Linux CI](https://travis-ci.org/EQEmu/Server.svg?branch=master)](https://travis-ci.org/EQEmu/Server) |[![Build status](https://ci.appveyor.com/api/projects/status/v3utuu0dttm2cqd0?svg=true)](https://ci.appveyor.com/project/KimLS/server) |[![Build status](https://ci.appveyor.com/api/projects/status/scr25kmntx36c1ub?svg=true)](https://ci.appveyor.com/project/KimLS/server-87crp) |
*** ***
@@ -17,9 +17,13 @@
|:---:|:---:|:---:| |:---:|:---:|:---:|
|**Install Count**|![Windows Install Count](http://analytics.akkadius.com/?install_count&windows_count)|![Linux Install Count](http://analytics.akkadius.com/?install_count&linux_count)| |**Install Count**|![Windows Install Count](http://analytics.akkadius.com/?install_count&windows_count)|![Linux Install Count](http://analytics.akkadius.com/?install_count&linux_count)|
### > Windows ### > Windows
* [Install](https://github.com/EQEmu/Server/wiki/Windows-Server)
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-windows)
### > Debian/Ubuntu/CentOS/Fedora ### > Debian/Ubuntu/CentOS/Fedora
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-linux)
* You can use curl or wget to kick off the installer (whichever your OS has) * You can use curl or wget to kick off the installer (whichever your OS has)
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh > curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
@@ -52,7 +56,7 @@ forum, although pull requests will be much quicker and easier on all parties.
## Resources ## Resources
- [EQEmulator Forums](http://www.eqemulator.org/forums) - [EQEmulator Forums](http://www.eqemulator.org/forums)
- [EQEmulator Wiki](https://github.com/EQEmu/Server/wiki) - [EQEmulator Wiki](https://eqemu.gitbook.io/)
## Related Repositories ## Related Repositories
* [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests) * [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests)
@@ -70,3 +74,10 @@ forum, although pull requests will be much quicker and easier on all parties.
* GPL Perl - GPL / ActiveState (under the assumption that this is a free project) * GPL Perl - GPL / ActiveState (under the assumption that this is a free project)
* CPPUnit - GLP StringUtilities - Apache * CPPUnit - GLP StringUtilities - Apache
* LUA - MIT * LUA - MIT
## Contributors
<a href="https://github.com/EQEmu/server/graphs/contributors">
<img src="https://contributors-img.firebaseapp.com/image?repo=EQEmu/server" />
</a>
+3
View File
@@ -0,0 +1,3 @@
# Security Policy - Reporting Vulnerabilities
When reporting active hacks, exploits and other vulnerabilities, please describe how to reproduce said report and if you can provide context into a possible solution
+515 -478
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
add_subdirectory(import) add_subdirectory(import)
add_subdirectory(export) add_subdirectory(export)
+1 -1
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
SET(export_sources SET(export_sources
main.cpp main.cpp
+104 -62
View File
@@ -26,37 +26,63 @@
#include "../../common/crash.h" #include "../../common/crash.h"
#include "../../common/rulesys.h" #include "../../common/rulesys.h"
#include "../../common/string_util.h" #include "../../common/string_util.h"
#include "../../common/content/world_content_service.h"
EQEmuLogSys LogSys; EQEmuLogSys LogSys;
WorldContentService content_service;
void ExportSpells(SharedDatabase *db); void ExportSpells(SharedDatabase *db);
void ExportSkillCaps(SharedDatabase *db); void ExportSkillCaps(SharedDatabase *db);
void ExportBaseData(SharedDatabase *db); void ExportBaseData(SharedDatabase *db);
void ExportDBStrings(SharedDatabase *db); void ExportDBStrings(SharedDatabase *db);
int main(int argc, char **argv) { int main(int argc, char **argv)
{
RegisterExecutablePlatform(ExePlatformClientExport); RegisterExecutablePlatform(ExePlatformClientExport);
LogSys.LoadLogSettingsDefaults(); LogSys.LoadLogSettingsDefaults();
set_exception_handler(); set_exception_handler();
Log(Logs::General, Logs::Status, "Client Files Export Utility"); LogInfo("Client Files Export Utility");
if(!EQEmuConfig::LoadConfig()) { if (!EQEmuConfig::LoadConfig()) {
Log(Logs::General, Logs::Error, "Unable to load configuration file."); LogError("Unable to load configuration file");
return 1; return 1;
} }
auto Config = EQEmuConfig::get(); auto Config = EQEmuConfig::get();
SharedDatabase database; SharedDatabase database;
Log(Logs::General, Logs::Status, "Connecting to database..."); SharedDatabase content_db;
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { LogInfo("Connecting to database");
Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a " if (!database.Connect(
"database connection"); Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort
)) {
LogError("Unable to connect to the database, cannot continue without a database connection");
return 1; return 1;
} }
/* Register Log System and Settings */ /**
* Multi-tenancy: Content database
*/
if (!Config->ContentDbHost.empty()) {
if (!content_db.Connect(
Config->ContentDbHost.c_str() ,
Config->ContentDbUsername.c_str(),
Config->ContentDbPassword.c_str(),
Config->ContentDbName.c_str(),
Config->ContentDbPort
)) {
LogError("Cannot continue without a content database connection");
return 1;
}
} else {
content_db.SetMysql(database.getMySQL());
}
database.LoadLogSettings(LogSys.log_settings); database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs(); LogSys.StartFileLogs();
@@ -67,15 +93,15 @@ int main(int argc, char **argv) {
} }
if (arg_1 == "spells") { if (arg_1 == "spells") {
ExportSpells(&database); ExportSpells(&content_db);
return 0; return 0;
} }
if (arg_1 == "skills") { if (arg_1 == "skills") {
ExportSkillCaps(&database); ExportSkillCaps(&content_db);
return 0; return 0;
} }
if (arg_1 == "basedata") { if (arg_1 == "basedata") {
ExportBaseData(&database); ExportBaseData(&content_db);
return 0; return 0;
} }
if (arg_1 == "dbstring") { if (arg_1 == "dbstring") {
@@ -83,9 +109,9 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
ExportSpells(&database); ExportSpells(&content_db);
ExportSkillCaps(&database); ExportSkillCaps(&content_db);
ExportBaseData(&database); ExportBaseData(&content_db);
ExportDBStrings(&database); ExportDBStrings(&database);
LogSys.CloseFileLogs(); LogSys.CloseFileLogs();
@@ -93,93 +119,105 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
void ExportSpells(SharedDatabase *db) { void ExportSpells(SharedDatabase *db)
Log(Logs::General, Logs::Status, "Exporting Spells..."); {
LogInfo("Exporting Spells");
FILE *f = fopen("export/spells_us.txt", "w"); FILE *f = fopen("export/spells_us.txt", "w");
if(!f) { if (!f) {
Log(Logs::General, Logs::Error, "Unable to open export/spells_us.txt to write, skipping."); LogError("Unable to open export/spells_us.txt to write, skipping.");
return; return;
} }
const std::string query = "SELECT * FROM spells_new ORDER BY id"; const std::string query = "SELECT * FROM spells_new ORDER BY id";
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if(results.Success()) { if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
std::string line; std::string line;
unsigned int fields = results.ColumnCount(); unsigned int fields = results.ColumnCount();
for(unsigned int i = 0; i < fields; ++i) { for (unsigned int i = 0; i < fields; ++i) {
if(i != 0) { if (i != 0) {
line.push_back('^'); line.push_back('^');
} }
if(row[i] != nullptr) { if (row[i] != nullptr) {
line += row[i]; line += row[i];
} }
} }
fprintf(f, "%s\n", line.c_str()); fprintf(f, "%s\n", line.c_str());
} }
} else { }
else {
} }
fclose(f); fclose(f);
} }
bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) { bool SkillUsable(SharedDatabase *db, int skill_id, int class_id)
{
bool res = false; bool res = false;
std::string query = StringFormat("SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d", std::string query = StringFormat(
class_id, skill_id); "SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
class_id, skill_id
);
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if(!results.Success()) { if (!results.Success()) {
return false; return false;
} }
if (results.RowCount() == 0) if (results.RowCount() == 0) {
return false; return false;
}
auto row = results.begin(); auto row = results.begin();
if(row[0] && atoi(row[0]) > 0) if (row[0] && atoi(row[0]) > 0) {
return true; return true;
}
return false; return false;
} }
int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level)
{
std::string query = StringFormat("SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d", std::string query = StringFormat(
class_id, skill_id, level); "SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
class_id, skill_id, level
);
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
return 0; return 0;
} }
if (results.RowCount() == 0) if (results.RowCount() == 0) {
return 0; return 0;
}
auto row = results.begin(); auto row = results.begin();
return atoi(row[0]); return atoi(row[0]);
} }
void ExportSkillCaps(SharedDatabase *db) { void ExportSkillCaps(SharedDatabase *db)
Log(Logs::General, Logs::Status, "Exporting Skill Caps..."); {
LogInfo("Exporting Skill Caps");
FILE *f = fopen("export/SkillCaps.txt", "w"); FILE *f = fopen("export/SkillCaps.txt", "w");
if(!f) { if (!f) {
Log(Logs::General, Logs::Error, "Unable to open export/SkillCaps.txt to write, skipping."); LogError("Unable to open export/SkillCaps.txt to write, skipping.");
return; return;
} }
for(int cl = 1; cl <= 16; ++cl) { for (int cl = 1; cl <= 16; ++cl) {
for(int skill = 0; skill <= 77; ++skill) { for (int skill = 0; skill <= 77; ++skill) {
if(SkillUsable(db, skill, cl)) { if (SkillUsable(db, skill, cl)) {
int previous_cap = 0; int previous_cap = 0;
for(int level = 1; level <= 100; ++level) { for (int level = 1; level <= 100; ++level) {
int cap = GetSkill(db, skill, cl, level); int cap = GetSkill(db, skill, cl, level);
if(cap < previous_cap) { if (cap < previous_cap) {
cap = previous_cap; cap = previous_cap;
} }
@@ -193,26 +231,28 @@ void ExportSkillCaps(SharedDatabase *db) {
fclose(f); fclose(f);
} }
void ExportBaseData(SharedDatabase *db) { void ExportBaseData(SharedDatabase *db)
Log(Logs::General, Logs::Status, "Exporting Base Data..."); {
LogInfo("Exporting Base Data");
FILE *f = fopen("export/BaseData.txt", "w"); FILE *f = fopen("export/BaseData.txt", "w");
if(!f) { if (!f) {
Log(Logs::General, Logs::Error, "Unable to open export/BaseData.txt to write, skipping."); LogError("Unable to open export/BaseData.txt to write, skipping.");
return; return;
} }
const std::string query = "SELECT * FROM base_data ORDER BY level, class"; const std::string query = "SELECT * FROM base_data ORDER BY level, class";
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if(results.Success()) { if (results.Success()) {
for (auto row = results.begin();row != results.end();++row) { for (auto row = results.begin(); row != results.end(); ++row) {
std::string line; std::string line;
unsigned int fields = results.ColumnCount(); unsigned int fields = results.ColumnCount();
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) { for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if(rowIndex != 0) if (rowIndex != 0) {
line.push_back('^'); line.push_back('^');
}
if(row[rowIndex] != nullptr) { if (row[rowIndex] != nullptr) {
line += row[rowIndex]; line += row[rowIndex];
} }
} }
@@ -224,27 +264,29 @@ void ExportBaseData(SharedDatabase *db) {
fclose(f); fclose(f);
} }
void ExportDBStrings(SharedDatabase *db) { void ExportDBStrings(SharedDatabase *db)
Log(Logs::General, Logs::Status, "Exporting DB Strings..."); {
LogInfo("Exporting DB Strings");
FILE *f = fopen("export/dbstr_us.txt", "w"); FILE *f = fopen("export/dbstr_us.txt", "w");
if(!f) { if (!f) {
Log(Logs::General, Logs::Error, "Unable to open export/dbstr_us.txt to write, skipping."); LogError("Unable to open export/dbstr_us.txt to write, skipping.");
return; return;
} }
fprintf(f, "Major^Minor^String(New)\n"); fprintf(f, "Major^Minor^String(New)\n");
const std::string query = "SELECT * FROM db_str ORDER BY id, type"; const std::string query = "SELECT * FROM db_str ORDER BY id, type";
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if(results.Success()) { if (results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
std::string line; std::string line;
unsigned int fields = results.ColumnCount(); unsigned int fields = results.ColumnCount();
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) { for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if(rowIndex != 0) if (rowIndex != 0) {
line.push_back('^'); line.push_back('^');
}
if(row[rowIndex] != nullptr) { if (row[rowIndex] != nullptr) {
line += row[rowIndex]; line += row[rowIndex];
} }
} }
+1 -1
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
SET(import_sources SET(import_sources
main.cpp main.cpp
+46 -20
View File
@@ -24,8 +24,10 @@
#include "../../common/crash.h" #include "../../common/crash.h"
#include "../../common/rulesys.h" #include "../../common/rulesys.h"
#include "../../common/string_util.h" #include "../../common/string_util.h"
#include "../../common/content/world_content_service.h"
EQEmuLogSys LogSys; EQEmuLogSys LogSys;
WorldContentService content_service;
void ImportSpells(SharedDatabase *db); void ImportSpells(SharedDatabase *db);
void ImportSkillCaps(SharedDatabase *db); void ImportSkillCaps(SharedDatabase *db);
@@ -37,29 +39,53 @@ int main(int argc, char **argv) {
LogSys.LoadLogSettingsDefaults(); LogSys.LoadLogSettingsDefaults();
set_exception_handler(); set_exception_handler();
Log(Logs::General, Logs::Status, "Client Files Import Utility"); LogInfo("Client Files Import Utility");
if(!EQEmuConfig::LoadConfig()) { if(!EQEmuConfig::LoadConfig()) {
Log(Logs::General, Logs::Error, "Unable to load configuration file."); LogError("Unable to load configuration file.");
return 1; return 1;
} }
auto Config = EQEmuConfig::get(); auto Config = EQEmuConfig::get();
SharedDatabase database; SharedDatabase database;
Log(Logs::General, Logs::Status, "Connecting to database..."); SharedDatabase content_db;
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { LogInfo("Connecting to database");
Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a " if (!database.Connect(
"database connection"); Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort
)) {
LogError("Unable to connect to the database, cannot continue without a database connection");
return 1; return 1;
} }
/**
* Multi-tenancy: Content database
*/
if (!Config->ContentDbHost.empty()) {
if (!content_db.Connect(
Config->ContentDbHost.c_str() ,
Config->ContentDbUsername.c_str(),
Config->ContentDbPassword.c_str(),
Config->ContentDbName.c_str(),
Config->ContentDbPort
)) {
LogError("Cannot continue without a content database connection");
return 1;
}
} else {
content_db.SetMysql(database.getMySQL());
}
database.LoadLogSettings(LogSys.log_settings); database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs(); LogSys.StartFileLogs();
ImportSpells(&database); ImportSpells(&content_db);
ImportSkillCaps(&database); ImportSkillCaps(&content_db);
ImportBaseData(&database); ImportBaseData(&content_db);
ImportDBStrings(&database); ImportDBStrings(&database);
LogSys.CloseFileLogs(); LogSys.CloseFileLogs();
@@ -97,10 +123,10 @@ bool IsStringField(int i) {
} }
void ImportSpells(SharedDatabase *db) { void ImportSpells(SharedDatabase *db) {
Log(Logs::General, Logs::Status, "Importing Spells..."); LogInfo("Importing Spells");
FILE *f = fopen("import/spells_us.txt", "r"); FILE *f = fopen("import/spells_us.txt", "r");
if(!f) { if(!f) {
Log(Logs::General, Logs::Error, "Unable to open import/spells_us.txt to read, skipping."); LogError("Unable to open import/spells_us.txt to read, skipping.");
return; return;
} }
@@ -173,23 +199,23 @@ void ImportSpells(SharedDatabase *db) {
spells_imported++; spells_imported++;
if(spells_imported % 1000 == 0) { if(spells_imported % 1000 == 0) {
Log(Logs::General, Logs::Status, "%d spells imported.", spells_imported); LogInfo("[{}] spells imported", spells_imported);
} }
} }
if(spells_imported % 1000 != 0) { if(spells_imported % 1000 != 0) {
Log(Logs::General, Logs::Status, "%d spells imported.", spells_imported); LogInfo("[{}] spells imported", spells_imported);
} }
fclose(f); fclose(f);
} }
void ImportSkillCaps(SharedDatabase *db) { void ImportSkillCaps(SharedDatabase *db) {
Log(Logs::General, Logs::Status, "Importing Skill Caps..."); LogInfo("Importing Skill Caps");
FILE *f = fopen("import/SkillCaps.txt", "r"); FILE *f = fopen("import/SkillCaps.txt", "r");
if(!f) { if(!f) {
Log(Logs::General, Logs::Error, "Unable to open import/SkillCaps.txt to read, skipping."); LogError("Unable to open import/SkillCaps.txt to read, skipping.");
return; return;
} }
@@ -220,11 +246,11 @@ void ImportSkillCaps(SharedDatabase *db) {
} }
void ImportBaseData(SharedDatabase *db) { void ImportBaseData(SharedDatabase *db) {
Log(Logs::General, Logs::Status, "Importing Base Data..."); LogInfo("Importing Base Data");
FILE *f = fopen("import/BaseData.txt", "r"); FILE *f = fopen("import/BaseData.txt", "r");
if(!f) { if(!f) {
Log(Logs::General, Logs::Error, "Unable to open import/BaseData.txt to read, skipping."); LogError("Unable to open import/BaseData.txt to read, skipping.");
return; return;
} }
@@ -265,11 +291,11 @@ void ImportBaseData(SharedDatabase *db) {
} }
void ImportDBStrings(SharedDatabase *db) { void ImportDBStrings(SharedDatabase *db) {
Log(Logs::General, Logs::Status, "Importing DB Strings..."); LogInfo("Importing DB Strings");
FILE *f = fopen("import/dbstr_us.txt", "r"); FILE *f = fopen("import/dbstr_us.txt", "r");
if(!f) { if(!f) {
Log(Logs::General, Logs::Error, "Unable to open import/dbstr_us.txt to read, skipping."); LogError("Unable to open import/dbstr_us.txt to read, skipping.");
return; return;
} }
+94
View File
@@ -0,0 +1,94 @@
OPTION(EQEMU_FETCH_MSVC_DEPENDENCIES_VCPKG "Automatically fetch vcpkg dependencies for MSCV" ON)
OPTION(EQEMU_FETCH_MSVC_DEPENDENCIES_PERL "Automatically fetch perl dependencies for MSCV" ON)
MARK_AS_ADVANCED(EQEMU_FETCH_MSVC_DEPENDENCIES_VCPKG)
MARK_AS_ADVANCED(EQEMU_FETCH_MSVC_DEPENDENCIES_PERL)
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X86 "https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x86.zip")
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X64 "https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x64.zip")
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X86 "http://strawberryperl.com/download/5.24.4.1/strawberry-perl-5.24.4.1-32bit-portable.zip")
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X64 "http://strawberryperl.com/download/5.24.4.1/strawberry-perl-5.24.4.1-64bit-portable.zip")
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_ZIP "vcpkg-export-x86.zip")
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_ZIP "vcpkg-export-x64.zip")
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_DIR "vcpkg-export-x86")
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_DIR "vcpkg-export-x64")
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X86_ZIP "strawberry-perl-5.24.4.1-32bit-portable.zip")
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X64_ZIP "strawberry-perl-5.24.4.1-64bit-portable.zip")
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X86_DIR "x86")
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X64_DIR "x64")
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(EQEMU_VCPKG_URL ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X64})
SET(EQEMU_PERL_URL ${EQEMU_MSVC_DEPENDENCIES_PERL_X64})
SET(EQEMU_VCPKG_ZIP ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_ZIP})
SET(EQEMU_VCPKG_DIR ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_DIR})
SET(EQEMU_PERL_ZIP ${EQEMU_MSVC_DEPENDENCIES_PERL_X64_ZIP})
SET(EQEMU_PERL_DIR ${EQEMU_MSVC_DEPENDENCIES_PERL_X64_DIR})
ELSE()
SET(EQEMU_VCPKG_URL ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X86})
SET(EQEMU_PERL_URL ${EQEMU_MSVC_DEPENDENCIES_PERL_X86})
SET(EQEMU_VCPKG_ZIP ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_ZIP})
SET(EQEMU_VCPKG_DIR ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_DIR})
SET(EQEMU_PERL_ZIP ${EQEMU_MSVC_DEPENDENCIES_PERL_X86_ZIP})
SET(EQEMU_PERL_DIR ${EQEMU_MSVC_DEPENDENCIES_PERL_X86_DIR})
ENDIF()
IF(EQEMU_FETCH_MSVC_DEPENDENCIES_VCPKG)
MESSAGE(STATUS "Resolving vcpkg dependencies...")
IF(NOT EXISTS ${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_ZIP})
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/vcpkg)
MESSAGE(STATUS "Downloading existing vcpkg dependencies from releases...")
FILE(DOWNLOAD ${EQEMU_VCPKG_URL} ${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_ZIP}
SHOW_PROGRESS
STATUS DOWNLOAD_STATUS)
LIST(GET DOWNLOAD_STATUS 0 STATUS_CODE)
IF(NOT STATUS_CODE EQUAL 0)
MESSAGE(FATAL_ERROR "Was unable to download dependencies from ${EQEMU_VCPKG_URL}")
ENDIF()
MESSAGE(STATUS "Extracting files...")
EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_ZIP}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/vcpkg
)
ENDIF()
INCLUDE(${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake)
ENDIF()
IF(EQEMU_FETCH_MSVC_DEPENDENCIES_PERL)
#Try to find perl first, (so you can use your active install first)
FIND_PACKAGE(PerlLibs)
IF(NOT PerlLibs_FOUND)
MESSAGE(STATUS "Resolving perl dependencies...")
IF(NOT EXISTS ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_ZIP})
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/perl)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR})
MESSAGE(STATUS "Downloading portable perl...")
FILE(DOWNLOAD ${EQEMU_PERL_URL} ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_ZIP}
SHOW_PROGRESS
STATUS DOWNLOAD_STATUS)
LIST(GET DOWNLOAD_STATUS 0 STATUS_CODE)
IF(NOT STATUS_CODE EQUAL 0)
MESSAGE(FATAL_ERROR "Was unable to download dependencies from ${EQEMU_PERL_URL}")
ENDIF()
MESSAGE(STATUS "Extracting files...")
EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_ZIP}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}
)
ENDIF()
SET(PERL_EXECUTABLE ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}/perl/bin/perl.exe CACHE FILEPATH "Path to perl program" FORCE)
SET(PERL_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}/perl/lib/CORE CACHE PATH "Path to perl include files" FORCE)
SET(PERL_LIBRARY ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}/perl/lib/CORE/libperl524.a CACHE FILEPATH "Path to perl library" FORCE)
ENDIF()
ENDIF()
-124
View File
@@ -1,124 +0,0 @@
#CMake - Cross Platform Makefile Generator
#Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions
#are met:
#
#* Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
#* Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
#* Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
#HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This module defines
# LUA51_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
IF(LUA_ROOT)
FIND_PATH(LUA_INCLUDE_DIR
NAMES lua.h
HINTS
ENV LUA_DIR
PATHS
${LUA_ROOT}
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include src
)
FIND_LIBRARY(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua
HINTS
ENV LUA_DIR
PATHS
${LUA_ROOT}
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib bin
)
ELSE(LUA_ROOT)
FIND_PATH(LUA_INCLUDE_DIR
NAMES lua.h
HINTS
ENV LUA_DIR
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
)
FIND_LIBRARY(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua
HINTS
ENV LUA_DIR
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib bin
)
ENDIF(LUA_ROOT)
IF(LUA_LIBRARY)
# include the math library for Unix
IF(UNIX AND NOT APPLE)
FIND_LIBRARY(LUA_MATH_LIBRARY m)
SET(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
ELSE()
SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
ENDIF()
ENDIF()
IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
UNSET(lua_version_str)
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
+91
View File
@@ -0,0 +1,91 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Modified from the FindLua51 that comes with CMake
#[=======================================================================[.rst:
FindLua51
---------
Locate Lua51 library This module defines
::
LUA51_FOUND, if false, do not try to link to Lua
LUA_LIBRARIES
LUA_INCLUDE_DIR, where to find lua.h
LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
Note that the expected include convention is
::
#include "lua.h"
and not
::
#include <lua/lua.h>
This is because, the lua location is not standardized and may exist in
locations other than lua/
#]=======================================================================]
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include/luajit include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua luajit
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUA_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
# handle the QUIETLY and REQUIRED arguments and set LUA51_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
+87
View File
@@ -0,0 +1,87 @@
# - Find mariadbclient
#
# -*- cmake -*-
#
# Find the native MariaDB includes and library
#
# MariaDB_INCLUDE_DIR - where to find mysql.h, etc.
# MariaDB_LIBRARIES - List of libraries when using MariaDB.
# MariaDB_FOUND - True if MariaDB found.
# The following can be used as a hint as to where to search:
# MARIADB_ROOT
IF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARIES)
# Already in cache, be silent
SET(MariaDB_FIND_QUIETLY TRUE)
ENDIF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARIES)
# Include dir
IF(MARIADB_ROOT)
FIND_PATH(MariaDB_INCLUDE_DIR
NAMES mariadb_version.h
PATHS ${MARIADB_ROOT}/include
PATH_SUFFIXES mysql mariadb
NO_DEFAULT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
)
FIND_PATH(MariaDB_INCLUDE_DIR
NAMES mariadb_version.h
PATH_SUFFIXES mysql mariadb
)
ELSE(MARIADB_ROOT)
FIND_PATH(MariaDB_INCLUDE_DIR
NAMES mariadb_version.h
PATH_SUFFIXES mysql mariadb
)
ENDIF(MARIADB_ROOT)
# Library
SET(MariaDB_NAMES libmariadb)
IF(MARIADB_ROOT)
FIND_LIBRARY(MariaDB_LIBRARY
NAMES ${MariaDB_NAMES}
PATHS ${MARIADB_ROOT}/lib
PATH_SUFFIXES mysql mariadb
NO_DEFAULT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
)
FIND_LIBRARY(MariaDB_LIBRARY
NAMES ${MariaDB_NAMES}
PATH_SUFFIXES mysql mariadb
)
ELSE(MARIADB_ROOT)
FIND_LIBRARY(MariaDB_LIBRARY
NAMES ${MariaDB_NAMES} mariadbclient_r mariadbclient
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
PATH_SUFFIXES mysql mariadb
)
ENDIF(MARIADB_ROOT)
IF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY)
SET(MariaDB_FOUND TRUE)
SET(MariaDB_LIBRARIES ${MariaDB_LIBRARY})
ELSE (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY)
SET(MariaDB_FOUND FALSE)
SET(MariaDB_LIBRARIES)
ENDIF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set MariaDB_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MariaDB DEFAULT_MSG MariaDB_LIBRARY MariaDB_INCLUDE_DIR)
IF(MariaDB_FOUND)
SET( MariaDB_LIBRARY_RELEASE ${MariaDB_LIBRARY} )
SET( MariaDB_LIBRARY_DEBUG ${MariaDB_LIBRARY} )
SET( MariaDB_LIBRARIES ${MariaDB_LIBRARY_RELEASE} ${MariaDB_LIBRARY_DEBUG} )
ELSE(MariaDB_FOUND)
SET( MariaDB_LIBRARIES )
ENDIF(MariaDB_FOUND)
MARK_AS_ADVANCED(
MariaDB_LIBRARY_DEBUG
MariaDB_LIBRARY_RELEASE
MariaDB_INCLUDE_DIR
)
+93
View File
@@ -0,0 +1,93 @@
# - Try to find mbedTLS
# Once done this will define
#
# Read-Only variables
# MBEDTLS_FOUND - system has mbedTLS
# MBEDTLS_INCLUDE_DIR - the mbedTLS include directory
# MBEDTLS_LIBRARY_DIR - the mbedTLS library directory
# MBEDTLS_LIBRARIES - Link these to use mbedTLS
# MBEDTLS_LIBRARY - path to mbedTLS library
# MBEDX509_LIBRARY - path to mbedTLS X.509 library
# MBEDCRYPTO_LIBRARY - path to mbedTLS Crypto library
#
# Hint
# MBEDTLS_ROOT_DIR can be pointed to a local mbedTLS installation.
SET(_MBEDTLS_ROOT_HINTS
${MBEDTLS_ROOT_DIR}
ENV MBEDTLS_ROOT_DIR
)
SET(_MBEDTLS_ROOT_HINTS_AND_PATHS
HINTS ${_MBEDTLS_ROOT_HINTS}
PATHS ${_MBEDTLS_ROOT_PATHS}
)
FIND_PATH(MBEDTLS_INCLUDE_DIR
NAMES mbedtls/version.h
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES include
)
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES)
# Already in cache, be silent
SET(MBEDTLS_FIND_QUIETLY TRUE)
ENDIF()
FIND_LIBRARY(MBEDTLS_LIBRARY
NAMES mbedtls libmbedtls
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES library
)
FIND_LIBRARY(MBEDX509_LIBRARY
NAMES mbedx509 libmbedx509
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES library
)
FIND_LIBRARY(MBEDCRYPTO_LIBRARY
NAMES mbedcrypto libmbedcrypto
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES library
)
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY)
SET(MBEDTLS_FOUND TRUE)
ENDIF()
IF(MBEDTLS_FOUND)
# split mbedTLS into -L and -l linker options, so we can set them for pkg-config
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_DIR ${MBEDTLS_LIBRARY} PATH)
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY} NAME_WE)
GET_FILENAME_COMPONENT(MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY} NAME_WE)
GET_FILENAME_COMPONENT(MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY} NAME_WE)
STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
IF(NOT MBEDTLS_FIND_QUIETLY)
MESSAGE(STATUS "Found mbedTLS:")
FILE(READ ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLSCONTENT)
STRING(REGEX MATCH "MBEDTLS_VERSION_STRING +\"[0-9|.]+\"" MBEDTLSMATCH ${MBEDTLSCONTENT})
IF (MBEDTLSMATCH)
STRING(REGEX REPLACE "MBEDTLS_VERSION_STRING +\"([0-9|.]+)\"" "\\1" MBEDTLS_VERSION ${MBEDTLSMATCH})
MESSAGE(STATUS " version ${MBEDTLS_VERSION}")
ENDIF(MBEDTLSMATCH)
MESSAGE(STATUS " TLS: ${MBEDTLS_LIBRARY}")
MESSAGE(STATUS " X509: ${MBEDX509_LIBRARY}")
MESSAGE(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}")
ENDIF(NOT MBEDTLS_FIND_QUIETLY)
ELSE(MBEDTLS_FOUND)
IF(MBEDTLS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find mbedTLS")
ENDIF(MBEDTLS_FIND_REQUIRED)
ENDIF(MBEDTLS_FOUND)
MARK_AS_ADVANCED(
MBEDTLS_INCLUDE_DIR
MBEDTLS_LIBRARY_DIR
MBEDTLS_LIBRARIES
MBEDTLS_LIBRARY
MBEDX509_LIBRARY
MBEDCRYPTO_LIBRARY
)
+344 -24
View File
@@ -1,13 +1,16 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
SET(common_sources SET(common_sources
base_packet.cpp base_packet.cpp
classes.cpp classes.cpp
cli/eqemu_command_handler.cpp
compression.cpp compression.cpp
condition.cpp condition.cpp
content/world_content_service.cpp
crash.cpp crash.cpp
crc16.cpp crc16.cpp
crc32.cpp crc32.cpp
database/database_dump_service.cpp
database.cpp database.cpp
database_conversions.cpp database_conversions.cpp
database_instances.cpp database_instances.cpp
@@ -30,11 +33,13 @@ SET(common_sources
event_sub.cpp event_sub.cpp
extprofile.cpp extprofile.cpp
faction.cpp faction.cpp
file_util.cpp
guild_base.cpp guild_base.cpp
guilds.cpp guilds.cpp
inventory_profile.cpp inventory_profile.cpp
inventory_slot.cpp inventory_slot.cpp
ipc_mutex.cpp ipc_mutex.cpp
ip_util.cpp
item_data.cpp item_data.cpp
item_instance.cpp item_instance.cpp
json_config.cpp json_config.cpp
@@ -71,7 +76,6 @@ SET(common_sources
textures.cpp textures.cpp
timer.cpp timer.cpp
unix.cpp unix.cpp
xml_parser.cpp
platform.cpp platform.cpp
json/jsoncpp.cpp json/jsoncpp.cpp
net/console_server.cpp net/console_server.cpp
@@ -102,12 +106,332 @@ SET(common_sources
patches/uf.cpp patches/uf.cpp
patches/uf_limits.cpp patches/uf_limits.cpp
StackWalker/StackWalker.cpp StackWalker/StackWalker.cpp
tinyxml/tinystr.cpp
tinyxml/tinyxml.cpp
tinyxml/tinyxmlerror.cpp
tinyxml/tinyxmlparser.cpp
util/directory.cpp util/directory.cpp
util/uuid.cpp util/uuid.cpp)
SET(repositories
# Criteria
repositories/criteria/content_filter_criteria.h
# Base Repositories
repositories/base/base_aa_ability_repository.h
repositories/base/base_aa_ranks_repository.h
repositories/base/base_aa_rank_effects_repository.h
repositories/base/base_aa_rank_prereqs_repository.h
repositories/base/base_account_repository.h
repositories/base/base_account_flags_repository.h
repositories/base/base_account_ip_repository.h
repositories/base/base_account_rewards_repository.h
repositories/base/base_adventure_details_repository.h
repositories/base/base_adventure_members_repository.h
repositories/base/base_adventure_stats_repository.h
repositories/base/base_adventure_template_repository.h
repositories/base/base_adventure_template_entry_repository.h
repositories/base/base_adventure_template_entry_flavor_repository.h
repositories/base/base_alternate_currency_repository.h
repositories/base/base_auras_repository.h
repositories/base/base_base_data_repository.h
repositories/base/base_blocked_spells_repository.h
repositories/base/base_bugs_repository.h
repositories/base/base_bug_reports_repository.h
repositories/base/base_buyer_repository.h
repositories/base/base_character_activities_repository.h
repositories/base/base_character_alternate_abilities_repository.h
repositories/base/base_character_alt_currency_repository.h
repositories/base/base_character_auras_repository.h
repositories/base/base_character_bandolier_repository.h
repositories/base/base_character_bind_repository.h
repositories/base/base_character_buffs_repository.h
repositories/base/base_character_corpses_repository.h
repositories/base/base_character_corpse_items_repository.h
repositories/base/base_character_currency_repository.h
repositories/base/base_character_data_repository.h
repositories/base/base_character_disciplines_repository.h
repositories/base/base_character_inspect_messages_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
repositories/base/base_character_material_repository.h
repositories/base/base_character_memmed_spells_repository.h
repositories/base/base_character_pet_buffs_repository.h
repositories/base/base_character_pet_info_repository.h
repositories/base/base_character_pet_inventory_repository.h
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_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_content_flags_repository.h
repositories/base/base_data_buckets_repository.h
repositories/base/base_db_str_repository.h
repositories/base/base_discovered_items_repository.h
repositories/base/base_doors_repository.h
repositories/base/base_eventlog_repository.h
repositories/base/base_faction_base_data_repository.h
repositories/base/base_faction_list_repository.h
repositories/base/base_faction_list_mod_repository.h
repositories/base/base_faction_values_repository.h
repositories/base/base_fishing_repository.h
repositories/base/base_forage_repository.h
repositories/base/base_friends_repository.h
repositories/base/base_global_loot_repository.h
repositories/base/base_gm_ips_repository.h
repositories/base/base_goallists_repository.h
repositories/base/base_graveyard_repository.h
repositories/base/base_grid_repository.h
repositories/base/base_grid_entries_repository.h
repositories/base/base_ground_spawns_repository.h
repositories/base/base_group_id_repository.h
repositories/base/base_group_leaders_repository.h
repositories/base/base_guilds_repository.h
repositories/base/base_guild_members_repository.h
repositories/base/base_guild_ranks_repository.h
repositories/base/base_guild_relations_repository.h
repositories/base/base_hackers_repository.h
repositories/base/base_instance_list_repository.h
repositories/base/base_instance_list_player_repository.h
repositories/base/base_inventory_repository.h
repositories/base/base_inventory_snapshots_repository.h
repositories/base/base_ip_exemptions_repository.h
repositories/base/base_items_repository.h
repositories/base/base_item_tick_repository.h
repositories/base/base_ldon_trap_entries_repository.h
repositories/base/base_ldon_trap_templates_repository.h
repositories/base/base_level_exp_mods_repository.h
repositories/base/base_lfguild_repository.h
repositories/base/base_login_accounts_repository.h
repositories/base/base_login_api_tokens_repository.h
repositories/base/base_login_server_admins_repository.h
repositories/base/base_login_server_list_types_repository.h
repositories/base/base_login_world_servers_repository.h
repositories/base/base_logsys_categories_repository.h
repositories/base/base_lootdrop_repository.h
repositories/base/base_lootdrop_entries_repository.h
repositories/base/base_loottable_repository.h
repositories/base/base_loottable_entries_repository.h
repositories/base/base_mail_repository.h
repositories/base/base_merchantlist_repository.h
repositories/base/base_merchantlist_temp_repository.h
repositories/base/base_name_filter_repository.h
repositories/base/base_npc_emotes_repository.h
repositories/base/base_npc_faction_repository.h
repositories/base/base_npc_faction_entries_repository.h
repositories/base/base_npc_scale_global_base_repository.h
repositories/base/base_npc_spells_repository.h
repositories/base/base_npc_spells_effects_repository.h
repositories/base/base_npc_spells_effects_entries_repository.h
repositories/base/base_npc_spells_entries_repository.h
repositories/base/base_npc_types_repository.h
repositories/base/base_npc_types_tint_repository.h
repositories/base/base_object_repository.h
repositories/base/base_object_contents_repository.h
repositories/base/base_perl_event_export_settings_repository.h
repositories/base/base_petitions_repository.h
repositories/base/base_pets_repository.h
repositories/base/base_pets_equipmentset_repository.h
repositories/base/base_pets_equipmentset_entries_repository.h
repositories/base/base_player_titlesets_repository.h
repositories/base/base_proximities_repository.h
repositories/base/base_quest_globals_repository.h
repositories/base/base_raid_details_repository.h
repositories/base/base_raid_members_repository.h
repositories/base/base_reports_repository.h
repositories/base/base_respawn_times_repository.h
repositories/base/base_rule_sets_repository.h
repositories/base/base_rule_values_repository.h
repositories/base/base_saylink_repository.h
repositories/base/base_skill_caps_repository.h
repositories/base/base_spawn2_repository.h
repositories/base/base_spawnentry_repository.h
repositories/base/base_spawngroup_repository.h
repositories/base/base_spawn_conditions_repository.h
repositories/base/base_spawn_condition_values_repository.h
repositories/base/base_spawn_events_repository.h
repositories/base/base_spells_new_repository.h
repositories/base/base_spell_buckets_repository.h
repositories/base/base_spell_globals_repository.h
repositories/base/base_starting_items_repository.h
repositories/base/base_start_zones_repository.h
repositories/base/base_tasks_repository.h
repositories/base/base_tasksets_repository.h
repositories/base/base_task_activities_repository.h
repositories/base/base_timers_repository.h
repositories/base/base_titles_repository.h
repositories/base/base_trader_repository.h
repositories/base/base_tradeskill_recipe_repository.h
repositories/base/base_tradeskill_recipe_entries_repository.h
repositories/base/base_traps_repository.h
repositories/base/base_tributes_repository.h
repositories/base/base_tribute_levels_repository.h
repositories/base/base_variables_repository.h
repositories/base/base_veteran_reward_templates_repository.h
repositories/base/base_zone_repository.h
repositories/base/base_zone_points_repository.h
# Extended Repositories
repositories/aa_ability_repository.h
repositories/aa_ranks_repository.h
repositories/aa_rank_effects_repository.h
repositories/aa_rank_prereqs_repository.h
repositories/account_repository.h
repositories/account_flags_repository.h
repositories/account_ip_repository.h
repositories/account_rewards_repository.h
repositories/adventure_details_repository.h
repositories/adventure_members_repository.h
repositories/adventure_stats_repository.h
repositories/adventure_template_repository.h
repositories/adventure_template_entry_repository.h
repositories/adventure_template_entry_flavor_repository.h
repositories/alternate_currency_repository.h
repositories/auras_repository.h
repositories/base_data_repository.h
repositories/blocked_spells_repository.h
repositories/bugs_repository.h
repositories/bug_reports_repository.h
repositories/buyer_repository.h
repositories/character_activities_repository.h
repositories/character_alternate_abilities_repository.h
repositories/character_alt_currency_repository.h
repositories/character_auras_repository.h
repositories/character_bandolier_repository.h
repositories/character_bind_repository.h
repositories/character_buffs_repository.h
repositories/character_corpses_repository.h
repositories/character_corpse_items_repository.h
repositories/character_currency_repository.h
repositories/character_data_repository.h
repositories/character_disciplines_repository.h
repositories/character_inspect_messages_repository.h
repositories/character_item_recast_repository.h
repositories/character_languages_repository.h
repositories/character_leadership_abilities_repository.h
repositories/character_material_repository.h
repositories/character_memmed_spells_repository.h
repositories/character_pet_buffs_repository.h
repositories/character_pet_info_repository.h
repositories/character_pet_inventory_repository.h
repositories/character_potionbelt_repository.h
repositories/character_skills_repository.h
repositories/character_spells_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/content_flags_repository.h
repositories/data_buckets_repository.h
repositories/db_str_repository.h
repositories/discovered_items_repository.h
repositories/doors_repository.h
repositories/eventlog_repository.h
repositories/faction_base_data_repository.h
repositories/faction_list_repository.h
repositories/faction_list_mod_repository.h
repositories/faction_values_repository.h
repositories/fishing_repository.h
repositories/forage_repository.h
repositories/friends_repository.h
repositories/global_loot_repository.h
repositories/gm_ips_repository.h
repositories/goallists_repository.h
repositories/graveyard_repository.h
repositories/grid_repository.h
repositories/grid_entries_repository.h
repositories/ground_spawns_repository.h
repositories/group_id_repository.h
repositories/group_leaders_repository.h
repositories/guilds_repository.h
repositories/guild_members_repository.h
repositories/guild_ranks_repository.h
repositories/guild_relations_repository.h
repositories/hackers_repository.h
repositories/instance_list_repository.h
repositories/instance_list_player_repository.h
repositories/inventory_repository.h
repositories/inventory_snapshots_repository.h
repositories/ip_exemptions_repository.h
repositories/items_repository.h
repositories/item_tick_repository.h
repositories/ldon_trap_entries_repository.h
repositories/ldon_trap_templates_repository.h
repositories/level_exp_mods_repository.h
repositories/lfguild_repository.h
repositories/login_accounts_repository.h
repositories/login_api_tokens_repository.h
repositories/login_server_admins_repository.h
repositories/login_server_list_types_repository.h
repositories/login_world_servers_repository.h
repositories/logsys_categories_repository.h
repositories/lootdrop_repository.h
repositories/lootdrop_entries_repository.h
repositories/loottable_repository.h
repositories/loottable_entries_repository.h
repositories/mail_repository.h
repositories/merchantlist_repository.h
repositories/merchantlist_temp_repository.h
repositories/name_filter_repository.h
repositories/npc_emotes_repository.h
repositories/npc_faction_repository.h
repositories/npc_faction_entries_repository.h
repositories/npc_scale_global_base_repository.h
repositories/npc_spells_repository.h
repositories/npc_spells_effects_repository.h
repositories/npc_spells_effects_entries_repository.h
repositories/npc_spells_entries_repository.h
repositories/npc_types_repository.h
repositories/npc_types_tint_repository.h
repositories/object_repository.h
repositories/object_contents_repository.h
repositories/perl_event_export_settings_repository.h
repositories/petitions_repository.h
repositories/pets_repository.h
repositories/pets_equipmentset_repository.h
repositories/pets_equipmentset_entries_repository.h
repositories/player_titlesets_repository.h
repositories/proximities_repository.h
repositories/quest_globals_repository.h
repositories/raid_details_repository.h
repositories/raid_members_repository.h
repositories/reports_repository.h
repositories/respawn_times_repository.h
repositories/rule_sets_repository.h
repositories/rule_values_repository.h
repositories/saylink_repository.h
repositories/skill_caps_repository.h
repositories/spawn2_repository.h
repositories/spawnentry_repository.h
repositories/spawngroup_repository.h
repositories/spawn_conditions_repository.h
repositories/spawn_condition_values_repository.h
repositories/spawn_events_repository.h
repositories/spells_new_repository.h
repositories/spell_buckets_repository.h
repositories/spell_globals_repository.h
repositories/starting_items_repository.h
repositories/start_zones_repository.h
repositories/tasks_repository.h
repositories/tasksets_repository.h
repositories/task_activities_repository.h
repositories/timers_repository.h
repositories/titles_repository.h
repositories/trader_repository.h
repositories/tradeskill_recipe_repository.h
repositories/tradeskill_recipe_entries_repository.h
repositories/traps_repository.h
repositories/tributes_repository.h
repositories/tribute_levels_repository.h
repositories/variables_repository.h
repositories/veteran_reward_templates_repository.h
repositories/zone_repository.h
repositories/zone_points_repository.h
# Non-Comformative
repositories/character_recipe_list_repository.h
) )
SET(common_headers SET(common_headers
@@ -118,11 +442,17 @@ SET(common_headers
classes.h classes.h
compression.h compression.h
condition.h condition.h
content/world_content_service.h
crash.h crash.h
crc16.h crc16.h
crc32.h crc32.h
cli/argh.h
cli/eqemu_command_handler.h
cli/terminal_color.hpp
database/database_dump_service.h
data_verification.h data_verification.h
database.h database.h
database_schema.h
dbcore.h dbcore.h
deity.h deity.h
emu_constants.h emu_constants.h
@@ -138,7 +468,7 @@ SET(common_headers
eqemu_config.h eqemu_config.h
eqemu_config_elements.h eqemu_config_elements.h
eqemu_logsys.h eqemu_logsys.h
eqemu_logsys_fmt.h eqemu_logsys_log_aliases.h
eq_limits.h eq_limits.h
eq_packet.h eq_packet.h
eq_stream_ident.h eq_stream_ident.h
@@ -150,15 +480,18 @@ SET(common_headers
event_sub.h event_sub.h
extprofile.h extprofile.h
faction.h faction.h
file_util.h
features.h features.h
fixed_memory_hash_set.h fixed_memory_hash_set.h
fixed_memory_variable_hash_set.h fixed_memory_variable_hash_set.h
global_define.h global_define.h
guild_base.h guild_base.h
guilds.h guilds.h
http/httplib.h
inventory_profile.h inventory_profile.h
inventory_slot.h inventory_slot.h
ipc_mutex.h ipc_mutex.h
ip_util.h
item_data.h item_data.h
item_fieldlist.h item_fieldlist.h
item_instance.h item_instance.h
@@ -209,7 +542,6 @@ SET(common_headers
unix.h unix.h
useperl.h useperl.h
version.h version.h
xml_parser.h
zone_numbers.h zone_numbers.h
event/event_loop.h event/event_loop.h
event/task.h event/task.h
@@ -263,12 +595,9 @@ SET(common_headers
patches/uf_ops.h patches/uf_ops.h
patches/uf_structs.h patches/uf_structs.h
StackWalker/StackWalker.h StackWalker/StackWalker.h
tinyxml/tinystr.h
tinyxml/tinyxml.h
util/memory_stream.h util/memory_stream.h
util/directory.h util/directory.h
util/uuid.h util/uuid.h)
)
SOURCE_GROUP(Event FILES SOURCE_GROUP(Event FILES
event/event_loop.h event/event_loop.h
@@ -368,15 +697,6 @@ SOURCE_GROUP(StackWalker FILES
StackWalker/StackWalker.cpp StackWalker/StackWalker.cpp
) )
SOURCE_GROUP(TinyXML FILES
tinyxml/tinystr.h
tinyxml/tinyxml.h
tinyxml/tinystr.cpp
tinyxml/tinyxml.cpp
tinyxml/tinyxmlerror.cpp
tinyxml/tinyxmlparser.cpp
)
SOURCE_GROUP(Util FILES SOURCE_GROUP(Util FILES
util/memory_stream.h util/memory_stream.h
util/directory.cpp util/directory.cpp
@@ -385,9 +705,9 @@ SOURCE_GROUP(Util FILES
util/uuid.h util/uuid.h
) )
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker TinyXML) INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
ADD_LIBRARY(common ${common_sources} ${common_headers}) ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories})
IF(UNIX) IF(UNIX)
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
+2 -2
View File
@@ -24,7 +24,7 @@
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
// EQEmu::Any is a modified version of Boost::Any and as such retains the Boost licensing. // EQ::Any is a modified version of Boost::Any and as such retains the Boost licensing.
#ifndef EQEMU_COMMON_ANY_H #ifndef EQEMU_COMMON_ANY_H
#define EQEMU_COMMON_ANY_H #define EQEMU_COMMON_ANY_H
@@ -32,7 +32,7 @@
#include <algorithm> #include <algorithm>
#include <typeinfo> #include <typeinfo>
namespace EQEmu namespace EQ
{ {
class Any class Any
{ {
+1
View File
@@ -75,6 +75,7 @@ public:
uint32 ReadUInt32() { uint32 value = *(uint32 *)(pBuffer + _rpos); _rpos += sizeof(uint32); return value; } uint32 ReadUInt32() { uint32 value = *(uint32 *)(pBuffer + _rpos); _rpos += sizeof(uint32); return value; }
uint32 ReadUInt32(uint32 Offset) const { uint32 value = *(uint32 *)(pBuffer + Offset); return value; } uint32 ReadUInt32(uint32 Offset) const { uint32 value = *(uint32 *)(pBuffer + Offset); return value; }
void ReadString(char *str) { uint32 len = static_cast<uint32>(strlen((char *)(pBuffer + _rpos))) + 1; memcpy(str, pBuffer + _rpos, len); _rpos += len; } void ReadString(char *str) { uint32 len = static_cast<uint32>(strlen((char *)(pBuffer + _rpos))) + 1; memcpy(str, pBuffer + _rpos, len); _rpos += len; }
void ReadString(std::string &str) { str = reinterpret_cast<char *>(pBuffer + _rpos); _rpos += str.length() + 1; }
void ReadString(char *str, uint32 Offset, uint32 MaxLength) const; void ReadString(char *str, uint32 Offset, uint32 MaxLength) const;
uint32 GetWritePosition() { return _wpos; } uint32 GetWritePosition() { return _wpos; }
+28
View File
@@ -378,6 +378,8 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
return "Berserker Guildmaster"; return "Berserker Guildmaster";
case MERCHANT: case MERCHANT:
return "Merchant"; return "Merchant";
case DISCORD_MERCHANT:
return "Discord Merchant";
case ADVENTURERECRUITER: case ADVENTURERECRUITER:
return "Adventure Recruiter"; return "Adventure Recruiter";
case ADVENTUREMERCHANT: case ADVENTUREMERCHANT:
@@ -388,6 +390,18 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
return "Tribute Master"; return "Tribute Master";
case GUILD_TRIBUTE_MASTER: case GUILD_TRIBUTE_MASTER:
return "Guild Tribute Master"; return "Guild Tribute Master";
case GUILD_BANKER:
return "Guild Banker";
case NORRATHS_KEEPERS_MERCHANT:
return "Radiant Crystal Merchant";
case DARK_REIGN_MERCHANT:
return "Ebon Crystal Merchant";
case FELLOWSHIP_MASTER:
return "Fellowship Master";
case ALT_CURRENCY_MERCHANT:
return "Alternate Currency Merchant";
case MERCERNARY_MASTER:
return "Mercenary Liaison";
default: default:
return "Unknown"; return "Unknown";
} }
@@ -573,6 +587,20 @@ bool IsNonSpellFighterClass(uint8 class_id)
} }
} }
bool IsHybridClass(uint8 class_id)
{
switch (class_id) {
case PALADIN:
case RANGER:
case SHADOWKNIGHT:
case BARD:
case BEASTLORD:
return true;
default:
return false;
}
}
bool IsCasterClass(uint8 class_id) bool IsCasterClass(uint8 class_id)
{ {
switch (class_id) { switch (class_id) {
+2
View File
@@ -61,6 +61,7 @@
#define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far.. #define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far..
#define TRIBUTE_MASTER 63 #define TRIBUTE_MASTER 63
#define GUILD_TRIBUTE_MASTER 64 // not sure #define GUILD_TRIBUTE_MASTER 64 // not sure
#define GUILD_BANKER 66
#define NORRATHS_KEEPERS_MERCHANT 67 #define NORRATHS_KEEPERS_MERCHANT 67
#define DARK_REIGN_MERCHANT 68 #define DARK_REIGN_MERCHANT 68
#define FELLOWSHIP_MASTER 69 #define FELLOWSHIP_MASTER 69
@@ -135,6 +136,7 @@ uint8 GetClassIDFromPlayerClassBit(uint32 player_class_bit);
bool IsFighterClass(uint8 class_id); bool IsFighterClass(uint8 class_id);
bool IsSpellFighterClass(uint8 class_id); bool IsSpellFighterClass(uint8 class_id);
bool IsNonSpellFighterClass(uint8 class_id); bool IsNonSpellFighterClass(uint8 class_id);
bool IsHybridClass(uint8 class_id);
bool IsCasterClass(uint8 class_id); bool IsCasterClass(uint8 class_id);
bool IsINTCasterClass(uint8 class_id); bool IsINTCasterClass(uint8 class_id);
bool IsWISCasterClass(uint8 class_id); bool IsWISCasterClass(uint8 class_id);
+434
View File
@@ -0,0 +1,434 @@
#pragma once
#include <algorithm>
#include <sstream>
#include <limits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cassert>
namespace argh
{
// Terminology:
// A command line is composed of 2 types of args:
// 1. Positional args, i.e. free standing values
// 2. Options: args beginning with '-'. We identify two kinds:
// 2.1: Flags: boolean options => (exist ? true : false)
// 2.2: Parameters: a name followed by a non-option value
#if !defined(__GNUC__) || (__GNUC__ >= 5)
using string_stream = std::istringstream;
#else
// Until GCC 5, istringstream did not have a move constructor.
// stringstream_proxy is used instead, as a workaround.
class stringstream_proxy
{
public:
stringstream_proxy() = default;
// Construct with a value.
stringstream_proxy(std::string const& value) :
stream_(value)
{}
// Copy constructor.
stringstream_proxy(const stringstream_proxy& other) :
stream_(other.stream_.str())
{
stream_.setstate(other.stream_.rdstate());
}
void setstate(std::ios_base::iostate state) { stream_.setstate(state); }
// Stream out the value of the parameter.
// If the conversion was not possible, the stream will enter the fail state,
// and operator bool will return false.
template<typename T>
stringstream_proxy& operator >> (T& thing)
{
stream_ >> thing;
return *this;
}
// Get the string value.
std::string str() const { return stream_.str(); }
std::stringbuf* rdbuf() const { return stream_.rdbuf(); }
// Check the state of the stream.
// False when the most recent stream operation failed
operator bool() const { return !!stream_; }
~stringstream_proxy() = default;
private:
std::istringstream stream_;
};
using string_stream = stringstream_proxy;
#endif
class parser
{
public:
enum Mode { PREFER_FLAG_FOR_UNREG_OPTION = 1 << 0,
PREFER_PARAM_FOR_UNREG_OPTION = 1 << 1,
NO_SPLIT_ON_EQUALSIGN = 1 << 2,
SINGLE_DASH_IS_MULTIFLAG = 1 << 3,
};
parser() = default;
parser(std::initializer_list<char const* const> pre_reg_names)
{ add_params(pre_reg_names); }
parser(const char* const argv[], int mode = PREFER_FLAG_FOR_UNREG_OPTION)
{ parse(argv, mode); }
parser(int argc, const char* const argv[], int mode = PREFER_FLAG_FOR_UNREG_OPTION)
{ parse(argc, argv, mode); }
void add_param(std::string const& name);
void add_params(std::initializer_list<char const* const> init_list);
void parse(const char* const argv[], int mode = PREFER_FLAG_FOR_UNREG_OPTION);
void parse(int argc, const char* const argv[], int mode = PREFER_FLAG_FOR_UNREG_OPTION);
std::multiset<std::string> const& flags() const { return flags_; }
std::map<std::string, std::string> const& params() const { return params_; }
std::vector<std::string> const& pos_args() const { return pos_args_; }
// begin() and end() for using range-for over positional args.
std::vector<std::string>::const_iterator begin() const { return pos_args_.cbegin(); }
std::vector<std::string>::const_iterator end() const { return pos_args_.cend(); }
size_t size() const { return pos_args_.size(); }
//////////////////////////////////////////////////////////////////////////
// Accessors
// flag (boolean) accessors: return true if the flag appeared, otherwise false.
bool operator[](std::string const& name) const;
// multiple flag (boolean) accessors: return true if at least one of the flag appeared, otherwise false.
bool operator[](std::initializer_list<char const* const> init_list) const;
// returns positional arg string by order. Like argv[] but without the options
std::string const& operator[](size_t ind) const;
// returns a std::istream that can be used to convert a positional arg to a typed value.
string_stream operator()(size_t ind) const;
// same as above, but with a default value in case the arg is missing (index out of range).
template<typename T>
string_stream operator()(size_t ind, T&& def_val) const;
// parameter accessors, give a name get an std::istream that can be used to convert to a typed value.
// call .str() on result to get as string
string_stream operator()(std::string const& name) const;
// accessor for a parameter with multiple names, give a list of names, get an std::istream that can be used to convert to a typed value.
// call .str() on result to get as string
// returns the first value in the list to be found.
string_stream operator()(std::initializer_list<char const* const> init_list) const;
// same as above, but with a default value in case the param was missing.
// Non-string def_val types must have an operator<<() (output stream operator)
// If T only has an input stream operator, pass the string version of the type as in "3" instead of 3.
template<typename T>
string_stream operator()(std::string const& name, T&& def_val) const;
// same as above but for a list of names. returns the first value to be found.
template<typename T>
string_stream operator()(std::initializer_list<char const* const> init_list, T&& def_val) const;
private:
string_stream bad_stream() const;
std::string trim_leading_dashes(std::string const& name) const;
bool is_number(std::string const& arg) const;
bool is_option(std::string const& arg) const;
bool got_flag(std::string const& name) const;
bool is_param(std::string const& name) const;
private:
std::vector<std::string> args_;
std::map<std::string, std::string> params_;
std::vector<std::string> pos_args_;
std::multiset<std::string> flags_;
std::set<std::string> registeredParams_;
std::string empty_;
};
//////////////////////////////////////////////////////////////////////////
inline void parser::parse(const char * const argv[], int mode)
{
int argc = 0;
for (auto argvp = argv; *argvp; ++argc, ++argvp);
parse(argc, argv, mode);
}
//////////////////////////////////////////////////////////////////////////
inline void parser::parse(int argc, const char* const argv[], int mode /*= PREFER_FLAG_FOR_UNREG_OPTION*/)
{
// convert to strings
args_.resize(argc);
std::transform(argv, argv + argc, args_.begin(), [](const char* const arg) { return arg; });
// parse line
for (auto i = 0u; i < args_.size(); ++i)
{
if (!is_option(args_[i]))
{
pos_args_.emplace_back(args_[i]);
continue;
}
auto name = trim_leading_dashes(args_[i]);
if (!(mode & NO_SPLIT_ON_EQUALSIGN))
{
auto equalPos = name.find('=');
if (equalPos != std::string::npos)
{
params_.insert({ name.substr(0, equalPos), name.substr(equalPos + 1) });
continue;
}
}
// if the option is unregistered and should be a multi-flag
if (1 == (args_[i].size() - name.size()) && // single dash
argh::parser::SINGLE_DASH_IS_MULTIFLAG & mode && // multi-flag mode
!is_param(name)) // unregistered
{
std::string keep_param;
if (!name.empty() && is_param(std::string(1ul, name.back()))) // last char is param
{
keep_param += name.back();
name.resize(name.size() - 1);
}
for (auto const& c : name)
{
flags_.emplace(std::string{ c });
}
if (!keep_param.empty())
{
name = keep_param;
}
else
{
continue; // do not consider other options for this arg
}
}
// any potential option will get as its value the next arg, unless that arg is an option too
// in that case it will be determined a flag.
if (i == args_.size() - 1 || is_option(args_[i + 1]))
{
flags_.emplace(name);
continue;
}
// if 'name' is a pre-registered option, then the next arg cannot be a free parameter to it is skipped
// otherwise we have 2 modes:
// PREFER_FLAG_FOR_UNREG_OPTION: a non-registered 'name' is determined a flag.
// The following value (the next arg) will be a free parameter.
//
// PREFER_PARAM_FOR_UNREG_OPTION: a non-registered 'name' is determined a parameter, the next arg
// will be the value of that option.
assert(!(mode & argh::parser::PREFER_FLAG_FOR_UNREG_OPTION)
|| !(mode & argh::parser::PREFER_PARAM_FOR_UNREG_OPTION));
bool preferParam = mode & argh::parser::PREFER_PARAM_FOR_UNREG_OPTION;
if (is_param(name) || preferParam)
{
params_.insert({ name, args_[i + 1] });
++i; // skip next value, it is not a free parameter
continue;
}
else
{
flags_.emplace(name);
}
};
}
//////////////////////////////////////////////////////////////////////////
inline string_stream parser::bad_stream() const
{
string_stream bad;
bad.setstate(std::ios_base::failbit);
return bad;
}
//////////////////////////////////////////////////////////////////////////
inline bool parser::is_number(std::string const& arg) const
{
// inefficient but simple way to determine if a string is a number (which can start with a '-')
std::istringstream istr(arg);
double number;
istr >> number;
return !(istr.fail() || istr.bad());
}
//////////////////////////////////////////////////////////////////////////
inline bool parser::is_option(std::string const& arg) const
{
assert(0 != arg.size());
if (is_number(arg))
return false;
return '-' == arg[0];
}
//////////////////////////////////////////////////////////////////////////
inline std::string parser::trim_leading_dashes(std::string const& name) const
{
auto pos = name.find_first_not_of('-');
return std::string::npos != pos ? name.substr(pos) : name;
}
//////////////////////////////////////////////////////////////////////////
inline bool argh::parser::got_flag(std::string const& name) const
{
return flags_.end() != flags_.find(trim_leading_dashes(name));
}
//////////////////////////////////////////////////////////////////////////
inline bool argh::parser::is_param(std::string const& name) const
{
return registeredParams_.count(name);
}
//////////////////////////////////////////////////////////////////////////
inline bool parser::operator[](std::string const& name) const
{
return got_flag(name);
}
//////////////////////////////////////////////////////////////////////////
inline bool parser::operator[](std::initializer_list<char const* const> init_list) const
{
return std::any_of(init_list.begin(), init_list.end(), [&](char const* const name) { return got_flag(name); });
}
//////////////////////////////////////////////////////////////////////////
inline std::string const& parser::operator[](size_t ind) const
{
if (ind < pos_args_.size())
return pos_args_[ind];
return empty_;
}
//////////////////////////////////////////////////////////////////////////
inline string_stream parser::operator()(std::string const& name) const
{
auto optIt = params_.find(trim_leading_dashes(name));
if (params_.end() != optIt)
return string_stream(optIt->second);
return bad_stream();
}
//////////////////////////////////////////////////////////////////////////
inline string_stream parser::operator()(std::initializer_list<char const* const> init_list) const
{
for (auto& name : init_list)
{
auto optIt = params_.find(trim_leading_dashes(name));
if (params_.end() != optIt)
return string_stream(optIt->second);
}
return bad_stream();
}
//////////////////////////////////////////////////////////////////////////
template<typename T>
string_stream parser::operator()(std::string const& name, T&& def_val) const
{
auto optIt = params_.find(trim_leading_dashes(name));
if (params_.end() != optIt)
return string_stream(optIt->second);
std::ostringstream ostr;
ostr.precision(std::numeric_limits<long double>::max_digits10);
ostr << def_val;
return string_stream(ostr.str()); // use default
}
//////////////////////////////////////////////////////////////////////////
// same as above but for a list of names. returns the first value to be found.
template<typename T>
string_stream parser::operator()(std::initializer_list<char const* const> init_list, T&& def_val) const
{
for (auto& name : init_list)
{
auto optIt = params_.find(trim_leading_dashes(name));
if (params_.end() != optIt)
return string_stream(optIt->second);
}
std::ostringstream ostr;
ostr.precision(std::numeric_limits<long double>::max_digits10);
ostr << def_val;
return string_stream(ostr.str()); // use default
}
//////////////////////////////////////////////////////////////////////////
inline string_stream parser::operator()(size_t ind) const
{
if (pos_args_.size() <= ind)
return bad_stream();
return string_stream(pos_args_[ind]);
}
//////////////////////////////////////////////////////////////////////////
template<typename T>
string_stream parser::operator()(size_t ind, T&& def_val) const
{
if (pos_args_.size() <= ind)
{
std::ostringstream ostr;
ostr.precision(std::numeric_limits<long double>::max_digits10);
ostr << def_val;
return string_stream(ostr.str());
}
return string_stream(pos_args_[ind]);
}
//////////////////////////////////////////////////////////////////////////
inline void parser::add_param(std::string const& name)
{
registeredParams_.insert(trim_leading_dashes(name));
}
//////////////////////////////////////////////////////////////////////////
inline void parser::add_params(std::initializer_list<char const* const> init_list)
{
for (auto& name : init_list)
registeredParams_.insert(trim_leading_dashes(name));
}
}
+199
View File
@@ -0,0 +1,199 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#include <fmt/format.h>
#include "eqemu_command_handler.h"
#include "terminal_color.hpp"
#include "../platform.h"
namespace EQEmuCommand {
std::map<std::string, void (*)(
int argc,
char **argv,
argh::parser &cmd,
std::string &description
)> function_map;
/**
* @param cmd
*/
void DisplayDebug(argh::parser &cmd)
{
if (cmd[{"-d", "--debug"}]) {
std::cout << "Positional args:\n";
for (auto &pos_arg : cmd.pos_args())
std::cout << '\t' << pos_arg << std::endl;
std::cout << "\nFlags:\n";
for (auto &flag : cmd.flags())
std::cout << '\t' << flag << std::endl;
std::cout << "\nParameters:\n";
for (auto &param : cmd.params())
std::cout << '\t' << param.first << " : " << param.second << std::endl;
}
}
/**
* @param arguments
* @param options
* @param cmd
* @param argc
* @param argv
*/
void ValidateCmdInput(
std::vector<std::string> &arguments,
std::vector<std::string> &options,
argh::parser &cmd,
int argc,
char **argv
)
{
bool arguments_filled = true;
int index = 2;
for (auto &arg : arguments) {
if (cmd(arg).str().empty() && cmd(index).str().empty()) {
arguments_filled = false;
}
index++;
}
if (!arguments_filled || argc == 2 || cmd[{"-h", "--help"}]) {
std::string arguments_string;
for (auto &arg : arguments) {
arguments_string += " " + arg;
}
std::string options_string;
for (auto &opt : options) {
options_string += " " + opt + "\n";
}
std::stringstream command_string;
command_string <<
termcolor::colorize <<
termcolor::yellow <<
"\nCommand" <<
termcolor::reset << "\n\n" <<
termcolor::green << argv[1] << arguments_string << termcolor::reset << "\n" <<
termcolor::yellow << (!options_string.empty() ? "\nOptions\n\n" : "") <<
termcolor::reset << termcolor::cyan << options_string << termcolor::reset;
std::cout << command_string.str() << std::endl;
exit(0);
}
}
/**
* @param in_function_map
* @param cmd
* @param argc
* @param argv
*/
void HandleMenu(
std::map<std::string, void (*)(
int argc,
char **argv,
argh::parser &cmd,
std::string &description
)> &in_function_map,
argh::parser &cmd,
int argc,
char **argv
)
{
std::string description;
bool ran_command = false;
for (auto &it: in_function_map) {
if (it.first == argv[1]) {
(it.second)(argc, argv, cmd, description);
ran_command = true;
}
}
if (cmd[{"-h", "--help"}]) {
std::cout << std::endl;
std::cout <<
"> " <<
termcolor::yellow <<
"EQEmulator [" + GetPlatformName() + "] CLI Menu" <<
termcolor::reset
<< std::endl
<< std::endl;
/**
* Get max command length for padding length
*/
int max_command_length = 0;
for (auto &it: in_function_map) {
std::stringstream command;
command << termcolor::colorize << termcolor::yellow << it.first << termcolor::reset;
if (command.str().length() > max_command_length) {
max_command_length = command.str().length() + 1;
}
}
/**
* Display command menu
*/
std::string command_section;
for (auto &it: in_function_map) {
description = "";
(it.second)(argc, argv, cmd, description);
/**
* Print section header
*/
std::string command_prefix = it.first.substr(0, it.first.find(":"));
if (command_prefix.find("test") != std::string::npos) {
continue;
}
if (command_section != command_prefix) {
command_section = command_prefix;
std::cout << termcolor::reset << command_prefix << std::endl;
}
/**
* Print commands
*/
std::stringstream command;
command << termcolor::colorize << termcolor::yellow << it.first << termcolor::reset;
printf(" %-*s %s\n", max_command_length, command.str().c_str(), description.c_str());
}
std::cout << std::endl;
std::exit(0);
}
if (ran_command) {
std::exit(0);
}
}
}
+75
View File
@@ -0,0 +1,75 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#ifndef EQEMU_EQEMU_COMMAND_HANDLER_H
#define EQEMU_EQEMU_COMMAND_HANDLER_H
#include "argh.h"
namespace EQEmuCommand {
extern std::map<std::string, void (*)(
int argc,
char **argv,
argh::parser &cmd,
std::string &description
)> function_map;
/**
* @param arguments
* @param options
* @param cmd
* @param argc
* @param argv
*/
void ValidateCmdInput(
std::vector<std::string> &arguments,
std::vector<std::string> &options,
argh::parser &cmd,
int argc,
char **argv
);
/**
* @param cmd
*/
void DisplayDebug(argh::parser &cmd);
/**
* @param in_function_map
* @param cmd
* @param argc
* @param argv
*/
void HandleMenu(
std::map<std::string, void (*)(
int argc,
char **argv,
argh::parser &cmd,
std::string &description
)> &in_function_map,
argh::parser &cmd,
int argc,
char **argv
);
};
#endif //EQEMU_EQEMU_COMMAND_HANDLER_H
+557
View File
@@ -0,0 +1,557 @@
//!
//! termcolor
//! ~~~~~~~~~
//!
//! termcolor is a header-only c++ library for printing colored messages
//! to the terminal. Written just for fun with a help of the Force.
//!
//! :copyright: (c) 2013 by Ihor Kalnytskyi
//! :license: BSD, see LICENSE for details
//!
#ifndef TERMCOLOR_HPP_
#define TERMCOLOR_HPP_
// the following snippet of code detects the current OS and
// defines the appropriate macro that is used to wrap some
// platform specific things
#if defined(_WIN32) || defined(_WIN64)
# define TERMCOLOR_OS_WINDOWS
#elif defined(__APPLE__)
# define TERMCOLOR_OS_MACOS
#elif defined(__unix__) || defined(__unix)
# define TERMCOLOR_OS_LINUX
#else
# error unsupported platform
#endif
// This headers provides the `isatty()`/`fileno()` functions,
// which are used for testing whether a standart stream refers
// to the terminal. As for Windows, we also need WinApi funcs
// for changing colors attributes of the terminal.
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
# include <unistd.h>
#elif defined(TERMCOLOR_OS_WINDOWS)
# include <io.h>
# include <windows.h>
#endif
#include <iostream>
#include <cstdio>
namespace termcolor
{
// Forward declaration of the `_internal` namespace.
// All comments are below.
namespace _internal
{
// An index to be used to access a private storage of I/O streams. See
// colorize / nocolorize I/O manipulators for details.
static int colorize_index = std::ios_base::xalloc();
inline FILE* get_standard_stream(const std::ostream& stream);
inline bool is_colorized(std::ostream& stream);
inline bool is_atty(const std::ostream& stream);
#if defined(TERMCOLOR_OS_WINDOWS)
inline void win_change_attributes(std::ostream& stream, int foreground, int background=-1);
#endif
}
inline
std::ostream& colorize(std::ostream& stream)
{
stream.iword(_internal::colorize_index) = 1L;
return stream;
}
inline
std::ostream& nocolorize(std::ostream& stream)
{
stream.iword(_internal::colorize_index) = 0L;
return stream;
}
inline
std::ostream& reset(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;00m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream, -1, -1);
#endif
}
return stream;
}
inline
std::ostream& bold(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;1m";
#elif defined(TERMCOLOR_OS_WINDOWS)
#endif
}
return stream;
}
inline
std::ostream& dark(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;2m";
#elif defined(TERMCOLOR_OS_WINDOWS)
#endif
}
return stream;
}
inline
std::ostream& underline(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;4m";
#elif defined(TERMCOLOR_OS_WINDOWS)
#endif
}
return stream;
}
inline
std::ostream& blink(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;5m";
#elif defined(TERMCOLOR_OS_WINDOWS)
#endif
}
return stream;
}
inline
std::ostream& reverse(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;7m";
#elif defined(TERMCOLOR_OS_WINDOWS)
#endif
}
return stream;
}
inline
std::ostream& concealed(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;8m";
#elif defined(TERMCOLOR_OS_WINDOWS)
#endif
}
return stream;
}
inline
std::ostream& grey(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;30m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream,
0 // grey (black)
);
#endif
}
return stream;
}
inline
std::ostream& red(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;31m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream,
FOREGROUND_RED
);
#endif
}
return stream;
}
inline
std::ostream& green(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;32m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream,
FOREGROUND_GREEN
);
#endif
}
return stream;
}
inline
std::ostream& yellow(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;33m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream,
FOREGROUND_GREEN | FOREGROUND_RED
);
#endif
}
return stream;
}
inline
std::ostream& blue(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;34m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream,
FOREGROUND_BLUE
);
#endif
}
return stream;
}
inline
std::ostream& magenta(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;35m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream,
FOREGROUND_BLUE | FOREGROUND_RED
);
#endif
}
return stream;
}
inline
std::ostream& cyan(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;36m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream,
FOREGROUND_BLUE | FOREGROUND_GREEN
);
#endif
}
return stream;
}
inline
std::ostream& white(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;37m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream,
FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED
);
#endif
}
return stream;
}
inline
std::ostream& on_grey(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;40m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream, -1,
0 // grey (black)
);
#endif
}
return stream;
}
inline
std::ostream& on_red(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;41m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream, -1,
BACKGROUND_RED
);
#endif
}
return stream;
}
inline
std::ostream& on_green(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;42m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream, -1,
BACKGROUND_GREEN
);
#endif
}
return stream;
}
inline
std::ostream& on_yellow(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;43m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream, -1,
BACKGROUND_GREEN | BACKGROUND_RED
);
#endif
}
return stream;
}
inline
std::ostream& on_blue(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;44m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream, -1,
BACKGROUND_BLUE
);
#endif
}
return stream;
}
inline
std::ostream& on_magenta(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;45m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream, -1,
BACKGROUND_BLUE | BACKGROUND_RED
);
#endif
}
return stream;
}
inline
std::ostream& on_cyan(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;46m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream, -1,
BACKGROUND_GREEN | BACKGROUND_BLUE
);
#endif
}
return stream;
}
inline
std::ostream& on_white(std::ostream& stream)
{
if (_internal::is_colorized(stream))
{
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
stream << "\e[1;47m";
#elif defined(TERMCOLOR_OS_WINDOWS)
_internal::win_change_attributes(stream, -1,
BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_RED
);
#endif
}
return stream;
}
//! Since C++ hasn't a way to hide something in the header from
//! the outer access, I have to introduce this namespace which
//! is used for internal purpose and should't be access from
//! the user code.
namespace _internal
{
//! Since C++ hasn't a true way to extract stream handler
//! from the a given `std::ostream` object, I have to write
//! this kind of hack.
inline
FILE* get_standard_stream(const std::ostream& stream)
{
if (&stream == &std::cout)
return stdout;
else if ((&stream == &std::cerr) || (&stream == &std::clog))
return stderr;
return 0;
}
// Say whether a given stream should be colorized or not. It's always
// true for ATTY streams and may be true for streams marked with
// colorize flag.
inline
bool is_colorized(std::ostream& stream)
{
return is_atty(stream) || static_cast<bool>(stream.iword(colorize_index));
}
//! Test whether a given `std::ostream` object refers to
//! a terminal.
inline
bool is_atty(const std::ostream& stream)
{
FILE* std_stream = get_standard_stream(stream);
// Unfortunately, fileno() ends with segmentation fault
// if invalid file descriptor is passed. So we need to
// handle this case gracefully and assume it's not a tty
// if standard stream is not detected, and 0 is returned.
if (!std_stream)
return false;
#if defined(TERMCOLOR_OS_MACOS) || defined(TERMCOLOR_OS_LINUX)
return ::isatty(fileno(std_stream));
#elif defined(TERMCOLOR_OS_WINDOWS)
return ::_isatty(_fileno(std_stream));
#endif
}
#if defined(TERMCOLOR_OS_WINDOWS)
//! Change Windows Terminal colors attribute. If some
//! parameter is `-1` then attribute won't changed.
inline void win_change_attributes(std::ostream& stream, int foreground, int background)
{
// yeah, i know.. it's ugly, it's windows.
static WORD defaultAttributes = 0;
// Windows doesn't have ANSI escape sequences and so we use special
// API to change Terminal output color. That means we can't
// manipulate colors by means of "std::stringstream" and hence
// should do nothing in this case.
if (!_internal::is_atty(stream))
return;
// get terminal handle
HANDLE hTerminal = INVALID_HANDLE_VALUE;
if (&stream == &std::cout)
hTerminal = GetStdHandle(STD_OUTPUT_HANDLE);
else if (&stream == &std::cerr)
hTerminal = GetStdHandle(STD_ERROR_HANDLE);
// save default terminal attributes if it unsaved
if (!defaultAttributes)
{
CONSOLE_SCREEN_BUFFER_INFO info;
if (!GetConsoleScreenBufferInfo(hTerminal, &info))
return;
defaultAttributes = info.wAttributes;
}
// restore all default settings
if (foreground == -1 && background == -1)
{
SetConsoleTextAttribute(hTerminal, defaultAttributes);
return;
}
// get current settings
CONSOLE_SCREEN_BUFFER_INFO info;
if (!GetConsoleScreenBufferInfo(hTerminal, &info))
return;
if (foreground != -1)
{
info.wAttributes &= ~(info.wAttributes & 0x0F);
info.wAttributes |= static_cast<WORD>(foreground);
}
if (background != -1)
{
info.wAttributes &= ~(info.wAttributes & 0xF0);
info.wAttributes |= static_cast<WORD>(background);
}
SetConsoleTextAttribute(hTerminal, info.wAttributes);
}
#endif // TERMCOLOR_OS_WINDOWS
} // namespace _internal
} // namespace termcolor
#undef TERMCOLOR_OS_WINDOWS
#undef TERMCOLOR_OS_MACOS
#undef TERMCOLOR_OS_LINUX
#endif // TERMCOLOR_HPP_
+1 -1
View File
@@ -3,7 +3,7 @@
#include <string.h> #include <string.h>
#include <zlib.h> #include <zlib.h>
namespace EQEmu namespace EQ
{ {
uint32 EstimateDeflateBuffer(uint32 len) { uint32 EstimateDeflateBuffer(uint32 len) {
z_stream zstream; z_stream zstream;
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
namespace EQEmu namespace EQ
{ {
uint32 EstimateDeflateBuffer(uint32 len); uint32 EstimateDeflateBuffer(uint32 len);
uint32 DeflateData(const char *buffer, uint32 len, char *out_buffer, uint32 out_len_max); uint32 DeflateData(const char *buffer, uint32 len, char *out_buffer, uint32 out_len_max);
+101
View File
@@ -0,0 +1,101 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#include "world_content_service.h"
#include "../database.h"
#include "../rulesys.h"
#include "../eqemu_logsys.h"
WorldContentService::WorldContentService()
{
SetCurrentExpansion(Expansion::EXPANSION_ALL);
}
int WorldContentService::GetCurrentExpansion() const
{
return current_expansion;
}
void WorldContentService::SetExpansionContext()
{
int expansion = RuleI(Expansion, CurrentExpansion);
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
content_service.SetCurrentExpansion(expansion);
}
LogInfo(
"Current expansion is [{}] ({})",
GetCurrentExpansion(),
GetCurrentExpansionName()
);
}
std::string WorldContentService::GetCurrentExpansionName()
{
if (content_service.GetCurrentExpansion() == Expansion::EXPANSION_ALL) {
return "All Expansions";
}
if (current_expansion >= Expansion::Classic && current_expansion <= Expansion::MaxId) {
return Expansion::ExpansionName[content_service.GetCurrentExpansion()];
}
return "Unknown Expansion";
}
/**
* @param current_expansion
*/
void WorldContentService::SetCurrentExpansion(int current_expansion)
{
WorldContentService::current_expansion = current_expansion;
}
/**
* @return
*/
const std::vector<std::string> &WorldContentService::GetContentFlags() const
{
return content_flags;
}
/**
* @param content_flags
*/
void WorldContentService::SetContentFlags(std::vector<std::string> content_flags)
{
WorldContentService::content_flags = content_flags;
}
/**
* @param content_flag
* @return
*/
bool WorldContentService::IsContentFlagEnabled(const std::string& content_flag)
{
for (auto &flag : GetContentFlags()) {
if (flag == content_flag) {
return true;
}
}
return false;
}
+173
View File
@@ -0,0 +1,173 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#ifndef EQEMU_WORLD_CONTENT_SERVICE_H
#define EQEMU_WORLD_CONTENT_SERVICE_H
#include <string>
#include <vector>
namespace Expansion {
static const int EXPANSION_ALL = -1;
static const int EXPANSION_FILTER_MAX = 99;
enum ExpansionNumber {
Classic = 0,
TheRuinsOfKunark,
TheScarsOfVelious,
TheShadowsOfLuclin,
ThePlanesOfPower,
TheLegacyOfYkesha,
LostDungeonsOfNorrath,
GatesOfDiscord,
OmensOfWar,
DragonsOfNorrath,
DepthsOfDarkhollow,
ProphecyOfRo,
TheSerpentsSpine,
TheBuriedSea,
SecretsOfFaydwer,
SeedsOfDestruction,
Underfoot,
HouseOfThule,
VeilOfAlaris,
RainOfFear,
CallOfTheForsaken,
TheDarkendSea,
TheBrokenMirror,
EmpiresOfKunark,
RingOfScale,
TheBurningLands,
TormentOfVelious,
MaxId
};
/**
* If you add to this, make sure you update LogCategory
*/
static const char *ExpansionName[ExpansionNumber::MaxId] = {
"Classic",
"The Ruins of Kunark",
"The Scars of Velious",
"The Shadows of Luclin",
"The Planes of Power",
"The Legacy of Ykesha",
"Lost Dungeons of Norrath",
"Gates of Discord",
"Omens of War",
"Dragons of Norrath",
"Depths of Darkhollow",
"Prophecy of Ro",
"The Serpent's Spine",
"The Buried Sea",
"Secrets of Faydwer",
"Seeds of Destruction",
"Underfoot",
"House of Thule",
"Veil of Alaris",
"Rain of Fear",
"Call of the Forsaken",
"The Darkened Sea",
"The Broken Mirror",
"Empires of Kunark",
"Ring of Scale",
"The Burning Lands",
"Torment of Velious",
};
}
class WorldContentService {
public:
WorldContentService();
std::string GetCurrentExpansionName();
int GetCurrentExpansion() const;
void SetCurrentExpansion(int current_expansion);
bool IsClassicEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Classic || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheRuinsOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheRuinsOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheScarsOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheScarsOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheShadowsOfLuclinEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheShadowsOfLuclin || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsThePlanesOfPowerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ThePlanesOfPower || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheLegacyOfYkeshaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheLegacyOfYkesha || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsLostDungeonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::LostDungeonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsGatesOfDiscordEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::GatesOfDiscord || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsOmensOfWarEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::OmensOfWar || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsDragonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DragonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsDepthsOfDarkhollowEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DepthsOfDarkhollow || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsProphecyOfRoEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ProphecyOfRo || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheSerpentsSpineEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheSerpentsSpine || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheBuriedSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBuriedSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsSecretsOfFaydwerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SecretsOfFaydwer || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsSeedsOfDestructionEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SeedsOfDestruction || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsUnderfootEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Underfoot || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsHouseOfThuleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::HouseOfThule || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsVeilOfAlarisEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::VeilOfAlaris || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsRainOfFearEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RainOfFear || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsCallOfTheForsakenEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::CallOfTheForsaken || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheDarkendSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheDarkendSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheBrokenMirrorEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBrokenMirror || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsEmpiresOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::EmpiresOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsRingOfScaleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RingOfScale || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheBurningLandsEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBurningLands || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTormentOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TormentOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsCurrentExpansionClassic() { return current_expansion == Expansion::ExpansionNumber::Classic; }
bool IsCurrentExpansionTheRuinsOfKunark() { return current_expansion == Expansion::ExpansionNumber::TheRuinsOfKunark; }
bool IsCurrentExpansionTheScarsOfVelious() { return current_expansion == Expansion::ExpansionNumber::TheScarsOfVelious; }
bool IsCurrentExpansionTheShadowsOfLuclin() { return current_expansion == Expansion::ExpansionNumber::TheShadowsOfLuclin; }
bool IsCurrentExpansionThePlanesOfPower() { return current_expansion == Expansion::ExpansionNumber::ThePlanesOfPower; }
bool IsCurrentExpansionTheLegacyOfYkesha() { return current_expansion == Expansion::ExpansionNumber::TheLegacyOfYkesha; }
bool IsCurrentExpansionLostDungeonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::LostDungeonsOfNorrath; }
bool IsCurrentExpansionGatesOfDiscord() { return current_expansion == Expansion::ExpansionNumber::GatesOfDiscord; }
bool IsCurrentExpansionOmensOfWar() { return current_expansion == Expansion::ExpansionNumber::OmensOfWar; }
bool IsCurrentExpansionDragonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::DragonsOfNorrath; }
bool IsCurrentExpansionDepthsOfDarkhollow() { return current_expansion == Expansion::ExpansionNumber::DepthsOfDarkhollow; }
bool IsCurrentExpansionProphecyOfRo() { return current_expansion == Expansion::ExpansionNumber::ProphecyOfRo; }
bool IsCurrentExpansionTheSerpentsSpine() { return current_expansion == Expansion::ExpansionNumber::TheSerpentsSpine; }
bool IsCurrentExpansionTheBuriedSea() { return current_expansion == Expansion::ExpansionNumber::TheBuriedSea; }
bool IsCurrentExpansionSecretsOfFaydwer() { return current_expansion == Expansion::ExpansionNumber::SecretsOfFaydwer; }
bool IsCurrentExpansionSeedsOfDestruction() { return current_expansion == Expansion::ExpansionNumber::SeedsOfDestruction; }
bool IsCurrentExpansionUnderfoot() { return current_expansion == Expansion::ExpansionNumber::Underfoot; }
bool IsCurrentExpansionHouseOfThule() { return current_expansion == Expansion::ExpansionNumber::HouseOfThule; }
bool IsCurrentExpansionVeilOfAlaris() { return current_expansion == Expansion::ExpansionNumber::VeilOfAlaris; }
bool IsCurrentExpansionRainOfFear() { return current_expansion == Expansion::ExpansionNumber::RainOfFear; }
bool IsCurrentExpansionCallOfTheForsaken() { return current_expansion == Expansion::ExpansionNumber::CallOfTheForsaken; }
bool IsCurrentExpansionTheDarkendSea() { return current_expansion == Expansion::ExpansionNumber::TheDarkendSea; }
bool IsCurrentExpansionTheBrokenMirror() { return current_expansion == Expansion::ExpansionNumber::TheBrokenMirror; }
bool IsCurrentExpansionEmpiresOfKunark() { return current_expansion == Expansion::ExpansionNumber::EmpiresOfKunark; }
bool IsCurrentExpansionRingOfScale() { return current_expansion == Expansion::ExpansionNumber::RingOfScale; }
bool IsCurrentExpansionTheBurningLands() { return current_expansion == Expansion::ExpansionNumber::TheBurningLands; }
bool IsCurrentExpansionTormentOfVelious() { return current_expansion == Expansion::ExpansionNumber::TormentOfVelious; }
private:
int current_expansion{};
std::vector<std::string> content_flags;
public:
const std::vector<std::string> &GetContentFlags() const;
bool IsContentFlagEnabled(const std::string& content_flag);
void SetContentFlags(std::vector<std::string> content_flags);
void SetExpansionContext();
};
extern WorldContentService content_service;
#endif //EQEMU_WORLD_CONTENT_SERVICE_H
+59 -1
View File
@@ -111,7 +111,65 @@ void set_exception_handler() {
SetUnhandledExceptionFilter(windows_exception_handler); SetUnhandledExceptionFilter(windows_exception_handler);
} }
#else #else
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/fcntl.h>
#ifdef __FreeBSD__
#include <signal.h>
#include <sys/stat.h>
#endif
void print_trace()
{
auto uid = geteuid();
std::string temp_output_file = "/tmp/dump-output";
char pid_buf[30];
sprintf(pid_buf, "%d", getpid());
char name_buf[512];
name_buf[readlink("/proc/self/exe", name_buf, 511)] = 0;
int child_pid = fork();
if (!child_pid) {
int fd = open(temp_output_file.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
dup2(fd, 1); // redirect output to stderr
fprintf(stdout, "stack trace for %s pid=%s\n", name_buf, pid_buf);
if (uid == 0) {
execlp("gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "bt", name_buf, pid_buf, NULL);
}
else {
execlp("sudo", "gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "bt", name_buf, pid_buf, NULL);
}
close(fd);
abort(); /* If gdb failed to start */
}
else {
waitpid(child_pid, NULL, 0);
}
std::ifstream input(temp_output_file);
for (std::string line; getline(input, line);) {
LogCrash("{}", line);
}
std::remove(temp_output_file.c_str());
exit(1);
}
// crash is off or an unhandled platform // crash is off or an unhandled platform
void set_exception_handler() { void set_exception_handler()
{
signal(SIGABRT, reinterpret_cast<void (*)(int)>(print_trace));
signal(SIGFPE, reinterpret_cast<void (*)(int)>(print_trace));
signal(SIGFPE, reinterpret_cast<void (*)(int)>(print_trace));
signal(SIGSEGV, reinterpret_cast<void (*)(int)>(print_trace));
} }
#endif #endif
+36 -32
View File
@@ -1,53 +1,57 @@
/* EQEMu: Everquest Server Emulator /**
* EQEmulator: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) * Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License. * the Free Software Foundation; version 2 of the License.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which * but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product; * are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ *
*/
#pragma once #pragma once
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
namespace EQEmu namespace EQ {
{ template<typename T>
template <typename T> T Clamp(const T &value, const T &lower, const T &upper)
T Clamp(const T& value, const T& lower, const T& upper) { {
return std::max(lower, std::min(value, upper)); return std::max(lower, std::min(value, upper));
} }
template <typename T> template<typename T>
T ClampLower(const T& value, const T& lower) { T ClampLower(const T &value, const T &lower)
{
return std::max(lower, value); return std::max(lower, value);
} }
template <typename T> template<typename T>
T ClampUpper(const T& value, const T& upper) { T ClampUpper(const T &value, const T &upper)
{
return std::min(value, upper); return std::min(value, upper);
} }
template <typename T> template<typename T>
bool ValueWithin(const T& value, const T& lower, const T& upper) { bool ValueWithin(const T &value, const T &lower, const T &upper)
{
return value >= lower && value <= upper; return value >= lower && value <= upper;
} }
template <typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
bool ValueWithin(const T1& value, const T2& lower, const T3& upper) { bool ValueWithin(const T1 &value, const T2 &lower, const T3 &upper)
return value >= (T1)lower && value <= (T1)upper; {
return value >= (T1) lower && value <= (T1) upper;
} }
} /*EQEmu*/ } /*EQEmu*/
+429 -235
View File
@@ -45,6 +45,7 @@
#include "eq_packet_structs.h" #include "eq_packet_structs.h"
#include "extprofile.h" #include "extprofile.h"
#include "string_util.h" #include "string_util.h"
#include "database_schema.h"
extern Client client; extern Client client;
@@ -60,15 +61,15 @@ Database::Database(const char* host, const char* user, const char* passwd, const
Connect(host, user, passwd, database, port); Connect(host, user, passwd, database, port);
} }
bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port) { bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label) {
uint32 errnum= 0; uint32 errnum= 0;
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
Log(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf); LogError("[MySQL] Connection [{}] Failed to connect to database: Error [{}]", connection_label, errbuf);
return false; return false;
} }
else { else {
Log(Logs::General, Logs::Status, "Using database '%s' at %s:%d", database, host,port); LogInfo("[MySQL] Connection [{}] database [{}] at [{}]:[{}]", connection_label, database, host,port);
return true; return true;
} }
} }
@@ -86,7 +87,7 @@ Database::~Database()
Return the account id or zero if no account matches. Return the account id or zero if no account matches.
Zero will also be returned if there is a database error. Zero will also be returned if there is a database error.
*/ */
uint32 Database::CheckLogin(const char* name, const char* password, int16* oStatus) { uint32 Database::CheckLogin(const char* name, const char* password, const char *loginserver, int16* oStatus) {
if(strlen(name) >= 50 || strlen(password) >= 50) if(strlen(name) >= 50 || strlen(password) >= 50)
return(0); return(0);
@@ -97,9 +98,10 @@ uint32 Database::CheckLogin(const char* name, const char* password, int16* oStat
DoEscapeString(tmpUN, name, strlen(name)); DoEscapeString(tmpUN, name, strlen(name));
DoEscapeString(tmpPW, password, strlen(password)); DoEscapeString(tmpPW, password, strlen(password));
std::string query = StringFormat("SELECT id, status FROM account WHERE name='%s' AND password is not null " std::string query = StringFormat("SELECT id, status FROM account WHERE `name`='%s' AND ls_id='%s' AND password is not null "
"and length(password) > 0 and (password='%s' or password=MD5('%s'))", "and length(password) > 0 and (password='%s' or password=MD5('%s'))",
tmpUN, tmpPW, tmpPW); tmpUN, EscapeString(loginserver).c_str(), tmpPW, tmpPW);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) if (!results.Success())
@@ -123,7 +125,7 @@ uint32 Database::CheckLogin(const char* name, const char* password, int16* oStat
//Get Banned IP Address List - Only return false if the incoming connection's IP address is not present in the banned_ips table. //Get Banned IP Address List - Only return false if the incoming connection's IP address is not present in the banned_ips table.
bool Database::CheckBannedIPs(const char* loginIP) bool Database::CheckBannedIPs(const char* loginIP)
{ {
std::string query = StringFormat("SELECT ip_address FROM Banned_IPs WHERE ip_address='%s'", loginIP); std::string query = StringFormat("SELECT ip_address FROM banned_ips WHERE ip_address='%s'", loginIP);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
@@ -139,7 +141,7 @@ bool Database::CheckBannedIPs(const char* loginIP)
} }
bool Database::AddBannedIP(char* bannedIP, const char* notes) { bool Database::AddBannedIP(char* bannedIP, const char* notes) {
std::string query = StringFormat("INSERT into Banned_IPs SET ip_address='%s', notes='%s'", bannedIP, notes); std::string query = StringFormat("INSERT into banned_ips SET ip_address='%s', notes='%s'", bannedIP, notes);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
return false; return false;
@@ -197,32 +199,61 @@ int16 Database::CheckStatus(uint32 account_id)
return status; return status;
} }
uint32 Database::CreateAccount(const char* name, const char* password, int16 status, uint32 lsaccount_id) { /**
* @param name
* @param password
* @param status
* @param loginserver
* @param lsaccount_id
* @return
*/
uint32 Database::CreateAccount(
const char *name,
const char *password,
int16 status,
const char *loginserver,
uint32 lsaccount_id
)
{
std::string query; std::string query;
if (password) if (password) {
query = StringFormat("INSERT INTO account SET name='%s', password='%s', status=%i, lsaccount_id=%i, time_creation=UNIX_TIMESTAMP();",name,password,status, lsaccount_id); query = StringFormat(
else "INSERT INTO account SET name='%s', password='%s', status=%i, ls_id='%s', lsaccount_id=%i, time_creation=UNIX_TIMESTAMP();",
query = StringFormat("INSERT INTO account SET name='%s', status=%i, lsaccount_id=%i, time_creation=UNIX_TIMESTAMP();",name, status, lsaccount_id); name,
password,
status,
loginserver,
lsaccount_id
);
}
else {
query = StringFormat(
"INSERT INTO account SET name='%s', status=%i, ls_id='%s', lsaccount_id=%i, time_creation=UNIX_TIMESTAMP();",
name,
status,
loginserver,
lsaccount_id
);
}
Log(Logs::General, Logs::World_Server, "Account Attempting to be created: '%s' status: %i", name, status); LogInfo("Account Attempting to be created: [{0}:{1}] status: {2}", loginserver, name, status);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
return 0; return 0;
} }
if (results.LastInsertedID() == 0) if (results.LastInsertedID() == 0) {
{
return 0; return 0;
} }
return results.LastInsertedID(); return results.LastInsertedID();
} }
bool Database::DeleteAccount(const char* name) { bool Database::DeleteAccount(const char* name, const char *loginserver) {
std::string query = StringFormat("DELETE FROM account WHERE name='%s';",name); std::string query = StringFormat("DELETE FROM account WHERE `name`='%s' AND ls_id='%s'", name, loginserver);
Log(Logs::General, Logs::World_Server, "Account Attempting to be deleted:'%s'", name); LogInfo("Account Attempting to be deleted:'[{}]:[{}]'", loginserver, name);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
@@ -263,13 +294,44 @@ bool Database::SetAccountStatus(const char* name, int16 status) {
return true; return true;
} }
/**
* @param account_name
* @param status
* @return
*/
bool Database::SetAccountStatus(const std::string& account_name, int16 status)
{
LogInfo("Account [{}] is attempting to be set to status [{}]", account_name, status);
std::string query = fmt::format(
SQL(
UPDATE account SET status = {} WHERE name = '{}'
),
status,
account_name
);
auto results = QueryDatabase(query);
if (!results.Success()) {
return false;
}
if (results.RowsAffected() == 0) {
LogWarning("Account [{}] does not exist!", account_name);
return false;
}
return true;
}
/* This initially creates the character during character create */ /* This initially creates the character during character create */
bool Database::ReserveName(uint32 account_id, char* name) { bool Database::ReserveName(uint32 account_id, char* name) {
std::string query = StringFormat("SELECT `account_id`, `name` FROM `character_data` WHERE `name` = '%s'", name); std::string query = StringFormat("SELECT `account_id`, `name` FROM `character_data` WHERE `name` = '%s'", name);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
if (row[0] && atoi(row[0]) > 0){ if (row[0] && atoi(row[0]) > 0){
Log(Logs::General, Logs::World_Server, "Account: %i tried to request name: %s, but it is already taken...", account_id, name); LogInfo("Account: [{}] tried to request name: [{}], but it is already taken", account_id, name);
return false; return false;
} }
} }
@@ -277,71 +339,82 @@ bool Database::ReserveName(uint32 account_id, char* name) {
query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name); query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name);
results = QueryDatabase(query); results = QueryDatabase(query);
if (!results.Success() || results.ErrorMessage() != ""){ return false; } if (!results.Success() || results.ErrorMessage() != ""){ return false; }
// Put character into the default guild if rule is being used.
int guild_id = RuleI(Character, DefaultGuild);
if (guild_id != 0) {
int character_id=results.LastInsertedID();
if (character_id > -1) {
query = StringFormat("INSERT INTO `guild_members` SET `char_id` = %i, `guild_id` = '%i'", character_id, guild_id);
results = QueryDatabase(query);
if (!results.Success() || results.ErrorMessage() != ""){
LogInfo("Could not put character [{}] into default Guild", name);
}
}
}
return true; return true;
} }
/* /**
Delete the character with the name "name" * @param character_name
returns false on failure, true otherwise * @return
*/ */
bool Database::DeleteCharacter(char *name) { bool Database::DeleteCharacter(char *character_name) {
uint32 charid = 0; uint32 character_id = 0;
if(!name || !strlen(name)) { if(!character_name || !strlen(character_name)) {
Log(Logs::General, Logs::World_Server, "DeleteCharacter: request to delete without a name (empty char slot)"); LogInfo("DeleteCharacter: request to delete without a name (empty char slot)");
return false; return false;
} }
Log(Logs::General, Logs::World_Server, "Database::DeleteCharacter name : '%s'", name);
/* Get id from character_data before deleting record so we can clean up the rest of the tables */ std::string query = StringFormat("SELECT `id` from `character_data` WHERE `name` = '%s'", character_name);
std::string query = StringFormat("SELECT `id` from `character_data` WHERE `name` = '%s'", name);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); } for (auto row = results.begin(); row != results.end(); ++row) {
if (charid <= 0){ character_id = atoi(row[0]);
Log(Logs::General, Logs::Error, "Database::DeleteCharacter :: Character (%s) not found, stopping delete...", name); }
if (character_id <= 0) {
LogError("DeleteCharacter | Invalid Character ID [{}]", character_name);
return false; return false;
} }
query = StringFormat("DELETE FROM `quest_globals` WHERE `charid` = '%d'", charid); QueryDatabase(query); std::string delete_type = "hard-deleted";
query = StringFormat("DELETE FROM `character_activities` WHERE `charid` = '%d'", charid); QueryDatabase(query); if (RuleB(Character, SoftDeletes)) {
query = StringFormat("DELETE FROM `character_enabledtasks` WHERE `charid` = '%d'", charid); QueryDatabase(query); delete_type = "soft-deleted";
query = StringFormat("DELETE FROM `character_tasks` WHERE `charid` = '%d'", charid); QueryDatabase(query); std::string query = fmt::format(
query = StringFormat("DELETE FROM `completed_tasks` WHERE `charid` = '%d'", charid); QueryDatabase(query); SQL(
query = StringFormat("DELETE FROM `friends` WHERE `charid` = '%d'", charid); QueryDatabase(query); UPDATE
query = StringFormat("DELETE FROM `mail` WHERE `charid` = '%d'", charid); QueryDatabase(query); character_data
query = StringFormat("DELETE FROM `timers` WHERE `char_id` = '%d'", charid); QueryDatabase(query); SET
query = StringFormat("DELETE FROM `inventory` WHERE `charid` = '%d'", charid); QueryDatabase(query); name = SUBSTRING(CONCAT(name, '-deleted-', UNIX_TIMESTAMP()), 1, 64),
query = StringFormat("DELETE FROM `char_recipe_list` WHERE `char_id` = '%d'", charid); QueryDatabase(query); deleted_at = NOW()
query = StringFormat("DELETE FROM `adventure_stats` WHERE `player_id` ='%d'", charid); QueryDatabase(query); WHERE
query = StringFormat("DELETE FROM `zone_flags` WHERE `charID` = '%d'", charid); QueryDatabase(query); id = '{}'
query = StringFormat("DELETE FROM `titles` WHERE `char_id` = '%d'", charid); QueryDatabase(query); ),
query = StringFormat("DELETE FROM `player_titlesets` WHERE `char_id` = '%d'", charid); QueryDatabase(query); character_id
query = StringFormat("DELETE FROM `keyring` WHERE `char_id` = '%d'", charid); QueryDatabase(query); );
query = StringFormat("DELETE FROM `faction_values` WHERE `char_id` = '%d'", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `instance_list_player` WHERE `charid` = '%d'", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_data` WHERE `id` = '%d'", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_skills` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_languages` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_bind` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_alternate_abilities` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_currency` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_data` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_spells` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_memmed_spells` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_disciplines` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_material` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_bandolier` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_potionbelt` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_inspect_messages` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_alt_currency` WHERE `char_id` = '%d'", charid); QueryDatabase(query);
#ifdef BOTS
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", charid); // note: only use of GetMobTypeById()
#else
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d'", charid);
#endif
QueryDatabase(query); QueryDatabase(query);
return true;
}
LogInfo("DeleteCharacter | Character [{}] ({}) is being [{}]", character_name, character_id, delete_type);
for (const auto& iter : DatabaseSchema::GetCharacterTables()) {
std::string table_name = iter.first;
std::string character_id_column_name = iter.second;
QueryDatabase(fmt::format("DELETE FROM {} WHERE {} = {}", table_name, character_id_column_name, character_id));
}
#ifdef BOTS
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", character_id); // note: only use of GetMobTypeById()
QueryDatabase(query);
#endif
return true; return true;
} }
@@ -622,6 +695,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
pp->RestTimer // " RestTimer) " pp->RestTimer // " RestTimer) "
); );
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
/* Save Bind Points */ /* Save Bind Points */
query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, slot)" query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, slot)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i), " " VALUES (%u, %u, %u, %f, %f, %f, %f, %i), "
@@ -676,61 +750,6 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
return true; return true;
} }
/* This only for new Character creation storing */
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv) {
uint32 charid = 0;
char zone[50];
float x, y, z;
charid = GetCharacterID(pp->name);
if(!charid) {
Log(Logs::General, Logs::Error, "StoreCharacter: no character id");
return false;
}
const char *zname = GetZoneName(pp->zone_id);
if(zname == nullptr) {
/* Zone not in the DB, something to prevent crash... */
strn0cpy(zone, "qeynos", 49);
pp->zone_id = 1;
}
else{ strn0cpy(zone, zname, 49); }
x = pp->x;
y = pp->y;
z = pp->z;
/* Saves Player Profile Data */
SaveCharacterCreate(charid, account_id, pp);
/* Insert starting inventory... */
std::string invquery;
for (int16 i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invbag::BANK_BAGS_END;) {
const EQEmu::ItemInstance* newinv = inv->GetItem(i);
if (newinv) {
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
auto results = QueryDatabase(invquery);
}
if (i == EQEmu::invslot::slotCursor) {
i = EQEmu::invbag::GENERAL_BAGS_BEGIN;
continue;
}
else if (i == EQEmu::invbag::CURSOR_BAG_END) {
i = EQEmu::invslot::BANK_BEGIN;
continue;
}
else if (i == EQEmu::invslot::BANK_END) {
i = EQEmu::invbag::BANK_BAGS_BEGIN;
continue;
}
i++;
}
return true;
}
uint32 Database::GetCharacterID(const char *name) { uint32 Database::GetCharacterID(const char *name) {
std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name); std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
@@ -785,11 +804,12 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) {
return atoi(row[0]); return atoi(row[0]);
} }
uint32 Database::GetAccountIDByName(const char* accname, int16* status, uint32* lsid) { uint32 Database::GetAccountIDByName(const char* accname, const char *loginserver, int16* status, uint32* lsid) {
if (!isAlphaNumeric(accname)) if (!isAlphaNumeric(accname))
return 0; return 0;
std::string query = StringFormat("SELECT `id`, `status`, `lsaccount_id` FROM `account` WHERE `name` = '%s' LIMIT 1", accname); std::string query = StringFormat("SELECT `id`, `status`, `lsaccount_id` FROM `account` WHERE `name` = '%s' AND `ls_id`='%s' LIMIT 1",
EscapeString(accname).c_str(), EscapeString(loginserver).c_str());
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
@@ -850,6 +870,38 @@ void Database::GetCharName(uint32 char_id, char* name) {
} }
} }
const char* Database::GetCharNameByID(uint32 char_id) {
std::string query = fmt::format("SELECT `name` FROM `character_data` WHERE id = {}", char_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
return "";
}
if (results.RowCount() == 0) {
return "";
}
auto row = results.begin();
return row[0];
}
const char* Database::GetNPCNameByID(uint32 npc_id) {
std::string query = fmt::format("SELECT `name` FROM `npc_types` WHERE id = {}", npc_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
return "";
}
if (results.RowCount() == 0) {
return "";
}
auto row = results.begin();
return row[0];
}
bool Database::LoadVariables() { bool Database::LoadVariables() {
auto results = QueryDatabase(StringFormat("SELECT varname, value, unix_timestamp() FROM variables where unix_timestamp(ts) >= %d", varcache.last_update)); auto results = QueryDatabase(StringFormat("SELECT varname, value, unix_timestamp() FROM variables where unix_timestamp(ts) >= %d", varcache.last_update));
@@ -918,22 +970,10 @@ bool Database::SetVariable(const std::string varname, const std::string &varvalu
return true; return true;
} }
uint32 Database::GetMiniLoginAccount(char* ip)
{
std::string query = StringFormat("SELECT `id` FROM `account` WHERE `minilogin_ip` = '%s'", ip);
auto results = QueryDatabase(query);
if (!results.Success())
return 0;
auto row = results.begin();
return atoi(row[0]);
}
// Get zone starting points from DB // Get zone starting points from DB
bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe_x, float* safe_y, float* safe_z, int16* minstatus, uint8* minlevel, uint32* minexpansion, uint32* maxexpansion, char *flag_needed) { bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe_x, float* safe_y, float* safe_z, int16* minstatus, uint8* minlevel, char *flag_needed) {
std::string query = StringFormat("SELECT safe_x, safe_y, safe_z, min_status, min_level, flag_needed, min_expansion, max_expansion FROM zone " std::string query = StringFormat("SELECT safe_x, safe_y, safe_z, min_status, min_level, flag_needed FROM zone "
" WHERE short_name='%s' AND (version=%i OR version=0) ORDER BY version DESC", short_name, version); " WHERE short_name='%s' AND (version=%i OR version=0) ORDER BY version DESC", short_name, version);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
@@ -957,10 +997,6 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe
*minlevel = atoi(row[4]); *minlevel = atoi(row[4]);
if (flag_needed != nullptr) if (flag_needed != nullptr)
strcpy(flag_needed, row[5]); strcpy(flag_needed, row[5]);
if (minexpansion != nullptr)
*minexpansion = atoi(row[6]);
if (maxexpansion != nullptr)
*maxexpansion = atoi(row[7]);
return true; return true;
} }
@@ -1046,50 +1082,6 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
return true; return true;
} }
bool Database::LoadZoneNames() {
std::string query("SELECT zoneidnumber, short_name FROM zone");
auto results = QueryDatabase(query);
if (!results.Success())
{
return false;
}
for (auto row= results.begin();row != results.end();++row)
{
uint32 zoneid = atoi(row[0]);
std::string zonename = row[1];
zonename_array.insert(std::pair<uint32,std::string>(zoneid,zonename));
}
return true;
}
uint32 Database::GetZoneID(const char* zonename) {
if (zonename == nullptr)
return 0;
for (auto iter = zonename_array.begin(); iter != zonename_array.end(); ++iter)
if (strcasecmp(iter->second.c_str(), zonename) == 0)
return iter->first;
return 0;
}
const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
auto iter = zonename_array.find(zoneID);
if (iter != zonename_array.end())
return iter->second.c_str();
if (ErrorUnknown)
return "UNKNOWN";
return 0;
}
uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){ uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){
std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version); std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version);
@@ -1195,25 +1187,46 @@ bool Database::AddToNameFilter(const char* name) {
return true; return true;
} }
uint32 Database::GetAccountIDFromLSID(uint32 iLSID, char* oAccountName, int16* oStatus) { /**
* @param in_loginserver_id
* @param in_loginserver_account_id
* @param in_account_name
* @param in_status
* @return
*/
uint32 Database::GetAccountIDFromLSID(
const std::string &in_loginserver_id,
uint32 in_loginserver_account_id,
char *in_account_name,
int16 *in_status
)
{
uint32 account_id = 0; uint32 account_id = 0;
std::string query = StringFormat("SELECT id, name, status FROM account WHERE lsaccount_id=%i", iLSID); auto query = fmt::format(
"SELECT id, `name`, status FROM account WHERE lsaccount_id = {0} AND ls_id = '{1}'",
in_loginserver_account_id,
in_loginserver_id
);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
return 0; return 0;
} }
if (results.RowCount() != 1) if (results.RowCount() != 1) {
return 0; return 0;
}
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
account_id = atoi(row[0]); account_id = std::stoi(row[0]);
if (oAccountName) if (in_account_name) {
strcpy(oAccountName, row[1]); strcpy(in_account_name, row[1]);
if (oStatus) }
*oStatus = atoi(row[2]); if (in_status) {
*in_status = std::stoi(row[2]);
}
} }
return account_id; return account_id;
@@ -1221,7 +1234,7 @@ uint32 Database::GetAccountIDFromLSID(uint32 iLSID, char* oAccountName, int16* o
void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) { void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) {
std::string query = StringFormat("SELECT name, status FROM account WHERE id=%i", id); std::string query = StringFormat("SELECT `name`, status FROM account WHERE id=%i", id);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()){ if (!results.Success()){
@@ -1285,29 +1298,31 @@ uint8 Database::GetServerType() {
return atoi(row[0]); return atoi(row[0]);
} }
bool Database::MoveCharacterToZone(const char* charname, const char* zonename, uint32 zoneid) { bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
if(zonename == nullptr || strlen(zonename) == 0) {
return false; std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i",
zone_id,
character_id
);
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'", zoneid, charname);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
return false; return false;
} }
if (results.RowsAffected() == 0) return results.RowsAffected() != 0;
return false;
return true;
} }
bool Database::MoveCharacterToZone(const char* charname, const char* zonename) { bool Database::MoveCharacterToZone(const char *charname, uint32 zone_id)
return MoveCharacterToZone(charname, zonename, GetZoneID(zonename)); {
} std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'",
zone_id,
charname
);
bool Database::MoveCharacterToZone(uint32 iCharID, const char* iZonename) {
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i", GetZoneID(iZonename), iCharID);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
@@ -1446,9 +1461,9 @@ uint32 Database::GetCharacterInfo(
return charid; return charid;
} }
bool Database::UpdateLiveChar(char* charname,uint32 lsaccount_id) { bool Database::UpdateLiveChar(char* charname, uint32 account_id) {
std::string query = StringFormat("UPDATE account SET charname='%s' WHERE id=%i;",charname, lsaccount_id); std::string query = StringFormat("UPDATE account SET charname='%s' WHERE id=%i;", charname, account_id);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()){ if (!results.Success()){
@@ -1515,7 +1530,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) if (!results.Success())
Log(Logs::General, Logs::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); LogError("Error deleting character from group id: {}", results.ErrorMessage().c_str());
return; return;
} }
@@ -1558,7 +1573,7 @@ uint32 Database::GetGroupID(const char* name){
if (results.RowCount() == 0) if (results.RowCount() == 0)
{ {
// Commenting this out until logging levels can prevent this from going to console // Commenting this out until logging levels can prevent this from going to console
//Log(Logs::General, Logs::None,, "Character not in a group: %s", name); //LogDebug(, "Character not in a group: [{}]", name);
return 0; return 0;
} }
@@ -1605,7 +1620,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) {
result = QueryDatabase(query); result = QueryDatabase(query);
if(!result.Success()) { if(!result.Success()) {
Log(Logs::General, Logs::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); LogDebug("Error in Database::SetGroupLeaderName: [{}]", result.ErrorMessage().c_str());
} }
} }
@@ -1811,7 +1826,7 @@ const char* Database::GetRaidLeaderName(uint32 raid_id)
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::General, Logs::Debug, "Unable to get Raid Leader Name for Raid ID: %u", raid_id); LogDebug("Unable to get Raid Leader Name for Raid ID: [{}]", raid_id);
return "UNKNOWN"; return "UNKNOWN";
} }
@@ -2078,9 +2093,49 @@ uint32 Database::GetGuildIDByCharID(uint32 character_id)
return atoi(row[0]); return atoi(row[0]);
} }
void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings) { uint32 Database::GetGroupIDByCharID(uint32 character_id)
// log_settings previously initialized to '0' by EQEmuLogSys::LoadLogSettingsDefaults() {
std::string query = fmt::format(
SQL(
SELECT groupid
FROM group_id
WHERE charid = '{}'
),
character_id
);
auto results = QueryDatabase(query);
if (!results.Success())
return 0;
if (results.RowCount() == 0)
return 0;
auto row = results.begin();
return atoi(row[0]);
}
uint32 Database::GetRaidIDByCharID(uint32 character_id) {
std::string query = fmt::format(
SQL(
SELECT raidid
FROM raid_members
WHERE charid = '{}'
),
character_id
);
auto results = QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) {
return atoi(row[0]);
}
return 0;
}
/**
* @param log_settings
*/
void Database::LoadLogSettings(EQEmuLogSys::LogSettings *log_settings)
{
std::string query = std::string query =
"SELECT " "SELECT "
"log_category_id, " "log_category_id, "
@@ -2093,10 +2148,9 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings) {
"ORDER BY log_category_id"; "ORDER BY log_category_id";
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
int log_category_id = 0; int log_category_id = 0;
int categories_in_database[1000] = {}; int *categories_in_database = new int[1000];
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
log_category_id = atoi(row[0]); log_category_id = atoi(row[0]);
@@ -2136,15 +2190,14 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings) {
* Auto inject categories that don't exist in the database... * Auto inject categories that don't exist in the database...
*/ */
for (int log_index = Logs::AA; log_index != Logs::MaxCategoryID; log_index++) { for (int log_index = Logs::AA; log_index != Logs::MaxCategoryID; log_index++) {
if (!categories_in_database[log_index]) { if (categories_in_database[log_index] != 1) {
Log(Logs::General, LogInfo(
Logs::Status, "New Log Category [{0}] doesn't exist... Automatically adding to [logsys_categories] table...",
"New Log Category '%s' doesn't exist... Automatically adding to `logsys_categories` table...",
Logs::LogCategoryName[log_index] Logs::LogCategoryName[log_index]
); );
std::string inject_query = StringFormat( auto inject_query = fmt::format(
"INSERT INTO logsys_categories " "INSERT INTO logsys_categories "
"(log_category_id, " "(log_category_id, "
"log_category_description, " "log_category_description, "
@@ -2152,17 +2205,19 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings) {
"log_to_file, " "log_to_file, "
"log_to_gmsay) " "log_to_gmsay) "
"VALUES " "VALUES "
"(%i, '%s', %i, %i, %i)", "({0}, '{1}', {2}, {3}, {4})",
log_index, log_index,
EscapeString(Logs::LogCategoryName[log_index]).c_str(), EscapeString(Logs::LogCategoryName[log_index]),
log_settings[log_category_id].log_to_console, std::to_string(log_settings[log_index].log_to_console),
log_settings[log_category_id].log_to_file, std::to_string(log_settings[log_index].log_to_file),
log_settings[log_category_id].log_to_gmsay std::to_string(log_settings[log_index].log_to_gmsay)
); );
QueryDatabase(inject_query); QueryDatabase(inject_query);
} }
} }
delete[] categories_in_database;
} }
int Database::CountInvSnapshots() { int Database::CountInvSnapshots() {
@@ -2199,7 +2254,7 @@ struct TimeOfDay_Struct Database::LoadTime(time_t &realtime)
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success() || results.RowCount() == 0){ if (!results.Success() || results.RowCount() == 0){
Log(Logs::Detail, Logs::World_Server, "Loading EQ time of day failed. Using defaults."); LogInfo("Loading EQ time of day failed. Using defaults");
eqTime.minute = 0; eqTime.minute = 0;
eqTime.hour = 9; eqTime.hour = 9;
eqTime.day = 1; eqTime.day = 1;
@@ -2253,3 +2308,142 @@ int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
return 0; return 0;
} }
/**
* @param source_character_name
* @param destination_character_name
* @param destination_account_name
* @return
*/
bool Database::CopyCharacter(
std::string source_character_name,
std::string destination_character_name,
std::string destination_account_name
)
{
auto results = QueryDatabase(
fmt::format(
"SELECT id FROM character_data WHERE name = '{}' and deleted_at is NULL LIMIT 1",
source_character_name
)
);
if (results.RowCount() == 0) {
LogError("No character found with name [{}]", source_character_name);
}
auto row = results.begin();
std::string source_character_id = row[0];
results = QueryDatabase(
fmt::format(
"SELECT id FROM account WHERE name = '{}' LIMIT 1",
destination_account_name
)
);
if (results.RowCount() == 0) {
LogError("No account found with name [{}]", destination_account_name);
}
row = results.begin();
std::string source_account_id = row[0];
/**
* Fresh ID
*/
results = QueryDatabase("SELECT (MAX(id) + 1) as new_id from character_data");
row = results.begin();
std::string new_character_id = row[0];
TransactionBegin();
for (const auto &iter : DatabaseSchema::GetCharacterTables()) {
std::string table_name = iter.first;
std::string character_id_column_name = iter.second;
/**
* Columns
*/
results = QueryDatabase(fmt::format("SHOW COLUMNS FROM {}", table_name));
std::vector<std::string> columns = {};
int column_count = 0;
for (row = results.begin(); row != results.end(); ++row) {
columns.emplace_back(row[0]);
column_count++;
}
results = QueryDatabase(
fmt::format(
"SELECT {} FROM {} WHERE {} = {}",
implode(",", wrap(columns, "`")),
table_name,
character_id_column_name,
source_character_id
)
);
std::vector<std::vector<std::string>> new_rows;
for (row = results.begin(); row != results.end(); ++row) {
std::vector<std::string> new_values = {};
for (int column_index = 0; column_index < column_count; column_index++) {
std::string column = columns[column_index];
std::string value = row[column_index] ? row[column_index] : "null";
if (column == character_id_column_name) {
value = new_character_id;
}
if (column == "name" && table_name == "character_data") {
value = destination_character_name;
}
if (column == "account_id" && table_name == "character_data") {
value = source_account_id;
}
new_values.emplace_back(value);
}
new_rows.emplace_back(new_values);
}
std::string insert_values;
std::vector<std::string> insert_rows;
for (auto &r: new_rows) {
std::string insert_row = "(" + implode(",", wrap(r, "'")) + ")";
insert_rows.emplace_back(insert_row);
}
if (!insert_rows.empty()) {
QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
table_name,
character_id_column_name,
new_character_id
)
);
auto insert = QueryDatabase(
fmt::format(
"INSERT INTO {} ({}) VALUES {}",
table_name,
implode(",", wrap(columns, "`")),
implode(",", insert_rows)
)
);
if (!insert.ErrorMessage().empty()) {
TransactionRollback();
return false;
break;
}
}
}
TransactionCommit();
return true;
}
+46 -30
View File
@@ -40,7 +40,7 @@
class MySQLRequestResult; class MySQLRequestResult;
class Client; class Client;
namespace EQEmu namespace EQ
{ {
class InventoryProfile; class InventoryProfile;
} }
@@ -94,31 +94,50 @@ class PTimerList;
# define _ISNAN_(a) std::isnan(a) # define _ISNAN_(a) std::isnan(a)
#endif #endif
#define SQL(...) #__VA_ARGS__
class Database : public DBcore { class Database : public DBcore {
public: public:
Database(); Database();
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port); Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port); bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label = "default");
~Database(); ~Database();
/* Character Creation */ /* Character Creation */
bool AddToNameFilter(const char* name); bool AddToNameFilter(const char *name);
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face); bool CreateCharacter(
bool DeleteCharacter(char* name); uint32 account_id,
bool MoveCharacterToZone(const char* charname, const char* zonename); char *name,
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid); uint16 gender,
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename); uint16 race,
bool ReserveName(uint32 account_id, char* name); uint16 class_,
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp); uint8 str,
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked); uint8 sta,
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone); uint8 cha,
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv); uint8 dex,
bool UpdateName(const char* oldname, const char* newname); uint8 int_,
uint8 agi,
uint8 wis,
uint8 face
);
bool DeleteCharacter(char *character_name);
bool MoveCharacterToZone(const char *charname, uint32 zone_id);
bool MoveCharacterToZone(uint32 character_id, uint32 zone_id);
bool ReserveName(uint32 account_id, char *name);
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp);
bool SetHackerFlag(const char *accountname, const char *charactername, const char *hacked);
bool SetMQDetectionFlag(const char *accountname, const char *charactername, const char *hacked, const char *zone);
bool UpdateName(const char *oldname, const char *newname);
bool CopyCharacter(
std::string source_character_name,
std::string destination_character_name,
std::string destination_account_name
);
/* General Information Queries */ /* General Information Queries */
bool AddBannedIP(char* bannedIP, const char* notes); //Add IP address to the Banned_IPs table. bool AddBannedIP(char* bannedIP, const char* notes); //Add IP address to the banned_ips table.
bool AddGMIP(char* ip_address, char* name); bool AddGMIP(char* ip_address, char* name);
bool CheckBannedIPs(const char* loginIP); //Check incoming connection against banned IP table. bool CheckBannedIPs(const char* loginIP); //Check incoming connection against banned IP table.
bool CheckGMIPs(const char* loginIP, uint32 account_id); bool CheckGMIPs(const char* loginIP, uint32 account_id);
@@ -127,13 +146,17 @@ public:
uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0); uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0);
uint32 GetAccountIDByChar(uint32 char_id); uint32 GetAccountIDByChar(uint32 char_id);
uint32 GetAccountIDByName(const char* accname, int16* status = 0, uint32* lsid = 0); uint32 GetAccountIDByName(const char* accname, const char *loginserver, int16* status = 0, uint32* lsid = 0);
uint32 GetCharacterID(const char *name); uint32 GetCharacterID(const char *name);
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0, float* oX = 0, float* oY = 0, float* oZ = 0); uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0, float* oX = 0, float* oY = 0, float* oZ = 0);
uint32 GetGuildIDByCharID(uint32 char_id); uint32 GetGuildIDByCharID(uint32 char_id);
uint32 GetGroupIDByCharID(uint32 char_id);
uint32 GetRaidIDByCharID(uint32 char_id);
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0); void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
void GetCharName(uint32 char_id, char* name); void GetCharName(uint32 char_id, char* name);
const char *GetCharNameByID(uint32 char_id);
const char *GetNPCNameByID(uint32 npc_id);
void LoginIP(uint32 AccountID, const char* LoginIP); void LoginIP(uint32 AccountID, const char* LoginIP);
/* Instancing */ /* Instancing */
@@ -150,7 +173,6 @@ public:
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id); bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id); bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version); uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
uint16 GetInstanceVersion(uint16 instance_id); uint16 GetInstanceVersion(uint16 instance_id);
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma); uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
@@ -174,18 +196,18 @@ public:
/* Account Related */ /* Account Related */
bool DeleteAccount(const char* name); bool DeleteAccount(const char *name, const char* loginserver);
bool GetLiveChar(uint32 account_id, char* cname); bool GetLiveChar(uint32 account_id, char* cname);
bool SetAccountStatus(const char* name, int16 status); bool SetAccountStatus(const char* name, int16 status);
bool SetAccountStatus(const std::string& account_name, int16 status);
bool SetLocalPassword(uint32 accid, const char* password); bool SetLocalPassword(uint32 accid, const char* password);
bool UpdateLiveChar(char* charname, uint32 lsaccount_id); bool UpdateLiveChar(char* charname, uint32 account_id);
int16 CheckStatus(uint32 account_id); int16 CheckStatus(uint32 account_id);
uint32 CheckLogin(const char* name, const char* password, int16* oStatus = 0); uint32 CheckLogin(const char* name, const char* password, const char *loginserver, int16* oStatus = 0);
uint32 CreateAccount(const char* name, const char* password, int16 status, uint32 lsaccount_id = 0); uint32 CreateAccount(const char* name, const char* password, int16 status, const char* loginserver, uint32 lsaccount_id);
uint32 GetAccountIDFromLSID(uint32 iLSID, char* oAccountName = 0, int16* oStatus = 0); uint32 GetAccountIDFromLSID(const std::string& in_loginserver_id, uint32 in_loginserver_account_id, char* in_account_name = 0, int16* in_status = 0);
uint32 GetMiniLoginAccount(char* ip);
uint8 GetAgreementFlag(uint32 acctid); uint8 GetAgreementFlag(uint32 acctid);
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus); void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
@@ -237,17 +259,12 @@ public:
/* General Queries */ /* General Queries */
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, uint32* minexpansion = 0, uint32* maxexpansion = 0, char *flag_needed = nullptr); bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, uint32* minexpansion = 0, uint32* maxexpansion = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, minexpansion, maxexpansion, flag_needed); }
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0); bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0); bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
bool LoadPTimers(uint32 charid, PTimerList &into); bool LoadPTimers(uint32 charid, PTimerList &into);
bool LoadZoneNames();
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version); uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
uint32 GetZoneID(const char* zonename);
uint8 GetPEQZone(uint32 zoneID, uint32 version); uint8 GetPEQZone(uint32 zoneID, uint32 version);
uint8 GetRaceSkill(uint8 skillid, uint8 in_race); uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
@@ -271,7 +288,6 @@ public:
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings); void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
private: private:
std::map<uint32,std::string> zonename_array;
Mutex Mvarcache; Mutex Mvarcache;
VarCache_Struct varcache; VarCache_Struct varcache;
+580
View File
@@ -0,0 +1,580 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#include <string>
#include <cstdio>
#include <iterator>
#include "database_dump_service.h"
#include "../eqemu_logsys.h"
#include "../string_util.h"
#include "../eqemu_config.h"
#include "../database_schema.h"
#include "../file_util.h"
#include <ctime>
#if _WIN32
#include <windows.h>
#else
#include <sys/time.h>
#endif
#define DATABASE_DUMP_PATH "backups/"
/**
* @param cmd
* @param return_result
* @return
*/
std::string DatabaseDumpService::execute(const std::string &cmd, bool return_result = true)
{
const char *file_name = "db-exec-result.txt";
if (return_result) {
#ifdef _WINDOWS
std::system((cmd + " > " + file_name + " 2>&1").c_str());
#else
std::system((cmd + " > " + file_name).c_str());
#endif
}
else {
std::system((cmd).c_str());
}
std::string result;
if (return_result) {
std::ifstream file(file_name);
result = {std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()};
std::remove(file_name);
}
return result;
}
/**
* @return bool
*/
bool DatabaseDumpService::IsMySQLInstalled()
{
std::string version_output = GetMySQLVersion();
return version_output.find("mysql") != std::string::npos && version_output.find("Ver") != std::string::npos;
}
/**
* Linux
* @return bool
*/
bool DatabaseDumpService::IsTarAvailable()
{
std::string version_output = execute("tar --version");
return version_output.find("GNU tar") != std::string::npos;
}
/**
* Windows
* @return bool
*/
bool DatabaseDumpService::Is7ZipAvailable()
{
std::string version_output = execute("7z --help");
return version_output.find("7-Zip") != std::string::npos;
}
/**
* @return
*/
bool DatabaseDumpService::HasCompressionBinary()
{
return IsTarAvailable() || Is7ZipAvailable();
}
/**
* @return
*/
std::string DatabaseDumpService::GetMySQLVersion()
{
std::string version_output = execute("mysql --version");
return trim(version_output);
}
/**
* @return
*/
std::string DatabaseDumpService::GetBaseMySQLDumpCommand()
{
auto config = EQEmuConfig::get();
if (IsDumpContentTables() && !config->ContentDbHost.empty()) {
return fmt::format(
"mysqldump -u {} -p{} -h {} --port={} {}",
config->ContentDbUsername,
config->ContentDbPassword,
config->ContentDbHost,
config->ContentDbPort,
config->ContentDbName
);
};
return fmt::format(
"mysqldump -u {} -p{} -h {} --port={} {}",
config->DatabaseUsername,
config->DatabasePassword,
config->DatabaseHost,
config->DatabasePort,
config->DatabaseDB
);
}
/**
* @return
*/
std::string DatabaseDumpService::GetPlayerTablesList()
{
std::string tables_list;
std::vector<std::string> tables = DatabaseSchema::GetPlayerTables();
for (const auto &table : tables) {
tables_list += table + " ";
}
return trim(tables_list);
}
/**
* @return
*/
std::string DatabaseDumpService::GetLoginTableList()
{
std::string tables_list;
std::vector<std::string> tables = DatabaseSchema::GetLoginTables();
for (const auto &table : tables) {
tables_list += table + " ";
}
return trim(tables_list);
}
/**
* @return
*/
std::string DatabaseDumpService::GetQueryServTables()
{
std::string tables_list;
std::vector<std::string> tables = DatabaseSchema::GetQueryServerTables();
for (const auto &table : tables) {
tables_list += table + " ";
}
return trim(tables_list);
}
/**
* @return
*/
std::string DatabaseDumpService::GetSystemTablesList()
{
std::string tables_list;
std::vector<std::string> tables = DatabaseSchema::GetServerTables();
for (const auto &table : tables) {
tables_list += table + " ";
}
tables = DatabaseSchema::GetVersionTables();
for (const auto &table : tables) {
tables_list += table + " ";
}
return trim(tables_list);
}
/**
* @return
*/
std::string DatabaseDumpService::GetStateTablesList()
{
std::string tables_list;
std::vector<std::string> tables = DatabaseSchema::GetStateTables();
for (const auto &table : tables) {
tables_list += table + " ";
}
return trim(tables_list);
}
/**
* @return
*/
std::string DatabaseDumpService::GetContentTablesList()
{
std::string tables_list;
std::vector<std::string> tables = DatabaseSchema::GetContentTables();
for (const auto &table : tables) {
tables_list += table + " ";
}
return trim(tables_list);
}
/**
* @return
*/
std::string GetDumpDate()
{
time_t now = time(nullptr);
struct tm time_struct{};
char buf[80];
time_struct = *localtime(&now);
strftime(buf, sizeof(buf), "%Y-%m-%d", &time_struct);
std::string time = buf;
return time;
}
/**
* @return
*/
std::string DatabaseDumpService::GetSetDumpPath()
{
return !GetDumpPath().empty() ? GetDumpPath() : DATABASE_DUMP_PATH;
}
/**
* @return
*/
std::string DatabaseDumpService::GetDumpFileNameWithPath()
{
return GetSetDumpPath() + GetDumpFileName();
}
void DatabaseDumpService::Dump()
{
if (!IsMySQLInstalled()) {
LogError("MySQL is not installed; Please check your PATH for a valid MySQL installation");
return;
}
if (IsDumpDropTableSyntaxOnly()) {
SetDumpOutputToConsole(true);
}
if (IsDumpOutputToConsole()) {
LogSys.SilenceConsoleLogging();
}
LogInfo("MySQL installed [{}]", GetMySQLVersion());
SetDumpFileName(EQEmuConfig::get()->DatabaseDB + '-' + GetDumpDate());
auto config = EQEmuConfig::get();
LogInfo(
"Database [{}] Host [{}] Username [{}]",
config->DatabaseDB,
config->DatabaseHost,
config->DatabaseUsername
);
std::string options = "--allow-keywords --extended-insert";
if (IsDumpWithNoData()) {
options += " --no-data";
}
if (!IsDumpTableLock()) {
options += " --skip-lock-tables";
}
std::string tables_to_dump;
std::string dump_descriptor;
if (!IsDumpAllTables()) {
if (IsDumpPlayerTables()) {
tables_to_dump += GetPlayerTablesList() + " ";
dump_descriptor += "-player";
}
if (IsDumpSystemTables()) {
tables_to_dump += GetSystemTablesList() + " ";
dump_descriptor += "-system";
}
if (IsDumpStateTables()) {
tables_to_dump += GetStateTablesList() + " ";
dump_descriptor += "-state";
}
if (IsDumpContentTables()) {
tables_to_dump += GetContentTablesList() + " ";
dump_descriptor += "-content";
}
if (IsDumpLoginServerTables()) {
tables_to_dump += GetLoginTableList() + " ";
dump_descriptor += "-login";
}
if (IsDumpQueryServerTables()) {
tables_to_dump += GetQueryServTables();
dump_descriptor += "-queryserv";
}
}
if (!dump_descriptor.empty()) {
SetDumpFileName(GetDumpFileName() + dump_descriptor);
}
/**
* If we are dumping to stdout then we don't generate a file
*/
std::string pipe_file;
if (!IsDumpOutputToConsole()) {
pipe_file = fmt::format(" > {}.sql", GetDumpFileNameWithPath());
}
std::string execute_command = fmt::format(
"{} {} {} {}",
GetBaseMySQLDumpCommand(),
options,
tables_to_dump,
pipe_file
);
if (!FileUtil::exists(GetSetDumpPath()) && !IsDumpOutputToConsole()) {
FileUtil::mkdir(GetSetDumpPath());
}
if (IsDumpDropTableSyntaxOnly()) {
std::vector<std::string> tables = SplitString(tables_to_dump, ' ');
for (auto &table : tables) {
std::cout << "DROP TABLE IF EXISTS `" << table << "`;" << std::endl;
}
if (tables_to_dump.empty()) {
std::cerr << "No tables were specified" << std::endl;
}
}
else {
std::string execution_result = execute(execute_command, IsDumpOutputToConsole());
if (!execution_result.empty()) {
std::cout << execution_result;
}
}
if (!tables_to_dump.empty()) {
LogInfo("Dumping Tables [{}]", tables_to_dump);
}
LogInfo("Database dump created at [{}.sql]", GetDumpFileNameWithPath());
if (IsDumpWithCompression() && !IsDumpOutputToConsole()) {
if (HasCompressionBinary()) {
LogInfo("Compression requested... Compressing dump [{}.sql]", GetDumpFileNameWithPath());
if (IsTarAvailable()) {
execute(
fmt::format(
"tar -zcvf {}.tar.gz -C {} {}.sql",
GetDumpFileNameWithPath(),
GetSetDumpPath(),
GetDumpFileName()
)
);
LogInfo("Compressed dump created at [{}.tar.gz]", GetDumpFileNameWithPath());
}
else if (Is7ZipAvailable()) {
execute(
fmt::format(
"7z a -t7z {}.zip {}.sql",
GetDumpFileNameWithPath(),
GetDumpFileNameWithPath()
)
);
LogInfo("Compressed dump created at [{}.zip]", GetDumpFileNameWithPath());
}
else {
LogInfo("Compression requested, but no available compression binary was found");
}
}
else {
LogWarning("Compression requested but binary not found... Skipping...");
}
}
// LogDebug("[{}] dump-to-console", IsDumpOutputToConsole());
// LogDebug("[{}] dump-path", GetSetDumpPath());
// LogDebug("[{}] compression", (IsDumpWithCompression() ? "true" : "false"));
// LogDebug("[{}] query-serv", (IsDumpQueryServerTables() ? "true" : "false"));
// LogDebug("[{}] has-compression-binary", (HasCompressionBinary() ? "true" : "false"));
// LogDebug("[{}] content", (IsDumpContentTables() ? "true" : "false"));
// LogDebug("[{}] no-data", (IsDumpWithNoData() ? "true" : "false"));
// LogDebug("[{}] login", (IsDumpLoginServerTables() ? "true" : "false"));
// LogDebug("[{}] player", (IsDumpPlayerTables() ? "true" : "false"));
// LogDebug("[{}] system", (IsDumpSystemTables() ? "true" : "false"));
}
bool DatabaseDumpService::IsDumpSystemTables() const
{
return dump_system_tables;
}
void DatabaseDumpService::SetDumpSystemTables(bool dump_system_tables)
{
DatabaseDumpService::dump_system_tables = dump_system_tables;
}
bool DatabaseDumpService::IsDumpContentTables() const
{
return dump_content_tables;
}
void DatabaseDumpService::SetDumpContentTables(bool dump_content_tables)
{
DatabaseDumpService::dump_content_tables = dump_content_tables;
}
bool DatabaseDumpService::IsDumpPlayerTables() const
{
return dump_player_tables;
}
void DatabaseDumpService::SetDumpPlayerTables(bool dump_player_tables)
{
DatabaseDumpService::dump_player_tables = dump_player_tables;
}
bool DatabaseDumpService::IsDumpLoginServerTables() const
{
return dump_login_server_tables;
}
void DatabaseDumpService::SetDumpLoginServerTables(bool dump_login_server_tables)
{
DatabaseDumpService::dump_login_server_tables = dump_login_server_tables;
}
bool DatabaseDumpService::IsDumpWithNoData() const
{
return dump_with_no_data;
}
void DatabaseDumpService::SetDumpWithNoData(bool dump_with_no_data)
{
DatabaseDumpService::dump_with_no_data = dump_with_no_data;
}
bool DatabaseDumpService::IsDumpAllTables() const
{
return dump_all_tables;
}
void DatabaseDumpService::SetDumpAllTables(bool dump_all_tables)
{
DatabaseDumpService::dump_all_tables = dump_all_tables;
}
bool DatabaseDumpService::IsDumpTableLock() const
{
return dump_table_lock;
}
void DatabaseDumpService::SetDumpTableLock(bool dump_table_lock)
{
DatabaseDumpService::dump_table_lock = dump_table_lock;
}
bool DatabaseDumpService::IsDumpWithCompression() const
{
return dump_with_compression;
}
void DatabaseDumpService::SetDumpWithCompression(bool dump_with_compression)
{
DatabaseDumpService::dump_with_compression = dump_with_compression;
}
const std::string &DatabaseDumpService::GetDumpPath() const
{
return dump_path;
}
void DatabaseDumpService::SetDumpPath(const std::string &dump_path)
{
DatabaseDumpService::dump_path = dump_path;
}
void DatabaseDumpService::SetDumpFileName(const std::string &dump_file_name)
{
DatabaseDumpService::dump_file_name = dump_file_name;
}
const std::string &DatabaseDumpService::GetDumpFileName() const
{
return dump_file_name;
}
bool DatabaseDumpService::IsDumpQueryServerTables() const
{
return dump_query_server_tables;
}
void DatabaseDumpService::SetDumpQueryServerTables(bool dump_query_server_tables)
{
DatabaseDumpService::dump_query_server_tables = dump_query_server_tables;
}
bool DatabaseDumpService::IsDumpOutputToConsole() const
{
return dump_output_to_console;
}
void DatabaseDumpService::SetDumpOutputToConsole(bool dump_output_to_console)
{
DatabaseDumpService::dump_output_to_console = dump_output_to_console;
}
bool DatabaseDumpService::IsDumpDropTableSyntaxOnly() const
{
return dump_drop_table_syntax_only;
}
void DatabaseDumpService::SetDumpDropTableSyntaxOnly(bool dump_drop_table_syntax_only)
{
DatabaseDumpService::dump_drop_table_syntax_only = dump_drop_table_syntax_only;
}
bool DatabaseDumpService::IsDumpStateTables() const
{
return dump_state_tables;
}
void DatabaseDumpService::SetDumpStateTables(bool dump_state_tables)
{
DatabaseDumpService::dump_state_tables = dump_state_tables;
}
+91
View File
@@ -0,0 +1,91 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#ifndef EQEMU_DATABASE_DUMP_SERVICE_H
#define EQEMU_DATABASE_DUMP_SERVICE_H
class DatabaseDumpService {
public:
void Dump();
bool IsDumpAllTables() const;
void SetDumpAllTables(bool dump_all_tables);
bool IsDumpWithNoData() const;
void SetDumpWithNoData(bool dump_with_no_data);
bool IsDumpSystemTables() const;
void SetDumpSystemTables(bool dump_system_tables);
bool IsDumpContentTables() const;
void SetDumpContentTables(bool dump_content_tables);
bool IsDumpPlayerTables() const;
void SetDumpPlayerTables(bool dump_player_tables);
bool IsDumpLoginServerTables() const;
void SetDumpLoginServerTables(bool dump_login_server_tables);
bool IsDumpTableLock() const;
void SetDumpTableLock(bool dump_table_lock);
bool IsDumpWithCompression() const;
void SetDumpWithCompression(bool dump_with_compression);
const std::string &GetDumpPath() const;
void SetDumpPath(const std::string &dump_path);
const std::string &GetDumpFileName() const;
void SetDumpFileName(const std::string &dump_file_name);
bool IsDumpQueryServerTables() const;
void SetDumpQueryServerTables(bool dump_query_server_tables);
bool IsDumpOutputToConsole() const;
void SetDumpOutputToConsole(bool dump_output_to_console);
bool IsDumpDropTableSyntaxOnly() const;
void SetDumpDropTableSyntaxOnly(bool dump_drop_table_syntax_only);
bool IsDumpStateTables() const;
void SetDumpStateTables(bool dump_state_tables);
private:
bool dump_all_tables = false;
bool dump_state_tables = false;
bool dump_system_tables = false;
bool dump_content_tables = false;
bool dump_player_tables = false;
bool dump_query_server_tables = false;
bool dump_login_server_tables = false;
bool dump_with_no_data = false;
bool dump_table_lock = false;
bool dump_with_compression = false;
bool dump_output_to_console = false;
bool dump_drop_table_syntax_only = false;
std::string dump_path;
std::string dump_file_name;
std::string execute(const std::string &cmd, bool return_result);
bool IsMySQLInstalled();
std::string GetMySQLVersion();
std::string GetBaseMySQLDumpCommand();
std::string GetPlayerTablesList();
std::string GetSystemTablesList();
std::string GetStateTablesList();
std::string GetContentTablesList();
std::string GetLoginTableList();
bool IsTarAvailable();
bool Is7ZipAvailable();
bool HasCompressionBinary();
std::string GetDumpFileNameWithPath();
std::string GetSetDumpPath();
std::string GetQueryServTables();
};
#endif //EQEMU_DATABASE_DUMP_SERVICE_H
+5 -5
View File
@@ -189,7 +189,7 @@ namespace Convert {
/*002*/ uint32 HP; /*002*/ uint32 HP;
/*006*/ uint32 Mana; /*006*/ uint32 Mana;
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT]; /*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ uint32 Items[EQEmu::textures::materialCount]; /*510*/ uint32 Items[EQ::textures::materialCount];
/*546*/ char Name[64]; /*546*/ char Name[64];
/*610*/ /*610*/
}; };
@@ -230,9 +230,9 @@ namespace Convert {
/*0304*/ uint8 ability_time_minutes; /*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder /*0305*/ uint8 ability_time_hours; //place holder
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag? /*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
/*0312*/ uint32 item_material[EQEmu::textures::materialCount]; // Item texture/material of worn/held items /*0312*/ uint32 item_material[EQ::textures::materialCount]; // Item texture/material of worn/held items
/*0348*/ uint8 unknown0348[44]; /*0348*/ uint8 unknown0348[44];
/*0392*/ Convert::Color_Struct item_tint[EQEmu::textures::materialCount]; /*0392*/ Convert::Color_Struct item_tint[EQ::textures::materialCount];
/*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY]; /*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY];
/*2348*/ float unknown2384; //seen ~128, ~47 /*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right /*2352*/ char servername[32]; // length probably not right
@@ -476,7 +476,7 @@ bool Database::CheckDatabaseConversions() {
CheckDatabaseConvertCorpseDeblob(); CheckDatabaseConvertCorpseDeblob();
/* Run EQEmu Server script (Checks for database updates) */ /* Run EQEmu Server script (Checks for database updates) */
system("perl eqemu_server.pl ran_from_world"); if(system("perl eqemu_server.pl ran_from_world"));
return true; return true;
} }
@@ -1396,7 +1396,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
if (rquery != ""){ results = QueryDatabase(rquery); } if (rquery != ""){ results = QueryDatabase(rquery); }
/* Run Material Color Convert */ /* Run Material Color Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery = "";
for (i = EQEmu::textures::textureBegin; i < EQEmu::textures::materialCount; i++){ for (i = EQ::textures::textureBegin; i < EQ::textures::materialCount; i++){
if (pp->item_tint[i].color > 0){ if (pp->item_tint[i].color > 0){
if (first_entry != 1){ if (first_entry != 1){
rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color); rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
+109 -82
View File
@@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define strcasecmp _stricmp #define strcasecmp _stricmp
#else #else
#include "unix.h" #include "unix.h"
#include "../zone/zonedb.h"
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/time.h> #include <sys/time.h>
#endif #endif
@@ -101,14 +102,20 @@ bool Database::CheckInstanceExpired(uint16 instance_id)
int32 duration = 0; int32 duration = 0;
uint32 never_expires = 0; uint32 never_expires = 0;
std::string query = StringFormat("SELECT start_time, duration, never_expires FROM instance_list WHERE id=%u", instance_id); std::string query = StringFormat(
"SELECT start_time, duration, never_expires FROM instance_list WHERE id=%u",
instance_id
);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) if (!results.Success()) {
return true; return true;
}
if (results.RowCount() == 0) if (results.RowCount() == 0) {
return true; return true;
}
auto row = results.begin(); auto row = results.begin();
@@ -116,23 +123,28 @@ bool Database::CheckInstanceExpired(uint16 instance_id)
duration = atoi(row[1]); duration = atoi(row[1]);
never_expires = atoi(row[2]); never_expires = atoi(row[2]);
if (never_expires == 1) if (never_expires == 1) {
return false; return false;
}
timeval tv; timeval tv{};
gettimeofday(&tv, nullptr); gettimeofday(&tv, nullptr);
if ((start_time + duration) <= tv.tv_sec) return (start_time + duration) <= tv.tv_sec;
return true;
return false;
} }
bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration) bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration)
{ {
std::string query = StringFormat("INSERT INTO instance_list (id, zone, version, start_time, duration)" std::string query = StringFormat(
" values(%lu, %lu, %lu, UNIX_TIMESTAMP(), %lu)", "INSERT INTO instance_list (id, zone, version, start_time, duration)"
(unsigned long)instance_id, (unsigned long)zone_id, (unsigned long)version, (unsigned long)duration); " values (%u, %u, %u, UNIX_TIMESTAMP(), %u)",
instance_id,
zone_id,
version,
duration
);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
return results.Success(); return results.Success();
@@ -140,66 +152,84 @@ bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version
bool Database::GetUnusedInstanceID(uint16 &instance_id) bool Database::GetUnusedInstanceID(uint16 &instance_id)
{ {
uint32 count = RuleI(Zone, ReservedInstances); uint32 max_reserved_instance_id = RuleI(Instances, ReservedInstances);
uint32 max = 65535; uint32 max = 32000;
std::string query = StringFormat(
"SELECT IFNULL(MAX(id),%u)+1 FROM instance_list WHERE id > %u",
max_reserved_instance_id,
max_reserved_instance_id
);
if (RuleB(Instances, RecycleInstanceIds)) {
query = (
SQL(
SELECT i.id + 1 AS next_available
FROM instance_list i
LEFT JOIN instance_list i2 ON i2.id = i.id + 1
WHERE i2.id IS NULL
ORDER BY i.id
LIMIT 0, 1;
)
);
}
std::string query = StringFormat("SELECT IFNULL(MAX(id),%u)+1 FROM instance_list WHERE id > %u", count, count);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) if (!results.Success()) {
{
instance_id = 0; instance_id = 0;
return false; return false;
} }
if (results.RowCount() == 0) if (results.RowCount() == 0) {
{ instance_id = max_reserved_instance_id;
instance_id = 0; return true;
return false;
} }
auto row = results.begin(); auto row = results.begin();
if (atoi(row[0]) <= max) if (atoi(row[0]) <= max) {
{
instance_id = atoi(row[0]); instance_id = atoi(row[0]);
return true; return true;
} }
query = StringFormat("SELECT id FROM instance_list where id > %u ORDER BY id", count); if (instance_id < max_reserved_instance_id) {
instance_id = max_reserved_instance_id;
return true;
}
query = StringFormat("SELECT id FROM instance_list where id > %u ORDER BY id", max_reserved_instance_id);
results = QueryDatabase(query); results = QueryDatabase(query);
if (!results.Success()) if (!results.Success()) {
{
instance_id = 0; instance_id = 0;
return false; return false;
} }
if (results.RowCount() == 0) if (results.RowCount() == 0) {
{
instance_id = 0; instance_id = 0;
return false; return false;
} }
count++; max_reserved_instance_id++;
for (auto row = results.begin(); row != results.end(); ++row) for (auto row = results.begin(); row != results.end(); ++row) {
{ if (max_reserved_instance_id < atoi(row[0])) {
if (count < atoi(row[0])) instance_id = max_reserved_instance_id;
{
instance_id = count;
return true; return true;
} }
if (count > max) if (max_reserved_instance_id > max) {
{
instance_id = 0; instance_id = 0;
return false; return false;
} }
count++; max_reserved_instance_id++;
} }
instance_id = count; instance_id = max_reserved_instance_id;
return true; return true;
} }
@@ -276,36 +306,6 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
return true; return true;
} }
uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 version) {
std::string query = StringFormat(
"SELECT "
"instance_list.id "
"FROM "
"instance_list, "
"instance_list_player "
"WHERE "
"instance_list.zone = %u "
"AND instance_list.version = %u "
"AND instance_list.id = instance_list_player.id "
"AND instance_list_player.charid = %u "
"LIMIT 1 ",
GetZoneID(zone),
version,
character_id
);
auto results = QueryDatabase(query);
if (!results.Success())
return 0;
if (results.RowCount() == 0)
return 0;
auto row = results.begin();
return atoi(row[0]);
}
uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version) uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version)
{ {
if (!zone) if (!zone)
@@ -472,22 +472,17 @@ void Database::AssignRaidToInstance(uint32 raid_id, uint32 instance_id)
} }
void Database::BuryCorpsesInInstance(uint16 instance_id) { void Database::BuryCorpsesInInstance(uint16 instance_id) {
std::string query = StringFormat( QueryDatabase(
"UPDATE `character_corpses` " fmt::format(
"SET `is_buried` = 1, " "UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id = {}",
"`instance_id` = 0 "
"WHERE "
"`instance_id` = %u ",
instance_id instance_id
)
); );
auto results = QueryDatabase(query);
} }
void Database::DeleteInstance(uint16 instance_id) void Database::DeleteInstance(uint16 instance_id)
{ {
std::string query;
std::string query = StringFormat("DELETE FROM instance_list WHERE id=%u", instance_id);
QueryDatabase(query);
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id); query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
QueryDatabase(query); QueryDatabase(query);
@@ -498,6 +493,9 @@ void Database::DeleteInstance(uint16 instance_id)
query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id); query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id);
QueryDatabase(query); QueryDatabase(query);
query = fmt::format("DELETE FROM dynamic_zones WHERE instance_id={}", instance_id);
QueryDatabase(query);
BuryCorpsesInInstance(instance_id); BuryCorpsesInInstance(instance_id);
} }
@@ -548,17 +546,46 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list<uint32> &ch
void Database::PurgeExpiredInstances() void Database::PurgeExpiredInstances()
{ {
std::string query("SELECT id FROM instance_list where (start_time+duration) <= UNIX_TIMESTAMP() and never_expires = 0");
/**
* Delay purging by a day so that we can continue using adjacent free instance id's
* from the table without risking the chance we immediately re-allocate a zone that freshly expired but
* has not been fully de-allocated
*/
std::string query =
SQL(
SELECT
id
FROM
instance_list
where
(start_time + duration) <= (UNIX_TIMESTAMP() - 86400)
and never_expires = 0
);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) if (!results.Success()) {
return; return;
}
if (results.RowCount() == 0) if (results.RowCount() == 0) {
return; return;
}
for (auto row = results.begin(); row != results.end(); ++row) std::vector<std::string> instance_ids;
DeleteInstance(atoi(row[0])); for (auto row = results.begin(); row != results.end(); ++row) {
instance_ids.emplace_back(row[0]);
}
std::string imploded_instance_ids = implode(",", instance_ids);
QueryDatabase(fmt::format("DELETE FROM instance_list WHERE id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM instance_list_player WHERE id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM respawn_times WHERE instance_id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM spawn_condition_values WHERE instance_id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM dynamic_zones WHERE instance_id IN ({})", imploded_instance_ids));
} }
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration) void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
+366
View File
@@ -0,0 +1,366 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#ifndef EQEMU_DATABASE_SCHEMA_H
#define EQEMU_DATABASE_SCHEMA_H
#include <vector>
#include <map>
namespace DatabaseSchema {
/**
* Character-specific tables
*
* Does not included related meta-data tables such as 'guilds', 'accounts'
* @return
*/
static std::map<std::string, std::string> GetCharacterTables()
{
return {
{"adventure_stats", "player_id"},
{"buyer", "charid"},
{"char_recipe_list", "char_id"},
{"character_activities", "charid"},
{"character_alt_currency", "char_id"},
{"character_alternate_abilities", "id"},
{"character_auras", "id"},
{"character_bandolier", "id"},
{"character_bind", "id"},
{"character_buffs", "character_id"},
{"character_corpses", "id"},
{"character_currency", "id"},
{"character_data", "id"},
{"character_disciplines", "id"},
{"character_enabledtasks", "charid"},
{"character_expedition_lockouts", "character_id"},
{"character_inspect_messages", "id"},
{"character_item_recast", "id"},
{"character_languages", "id"},
{"character_leadership_abilities", "id"},
{"character_material", "id"},
{"character_memmed_spells", "id"},
{"character_pet_buffs", "char_id"},
{"character_pet_info", "char_id"},
{"character_pet_inventory", "char_id"},
{"character_potionbelt", "id"},
{"character_skills", "id"},
{"character_spells", "id"},
{"character_tasks", "charid"},
{"character_tribute", "id"},
{"completed_tasks", "charid"},
{"data_buckets", "id"},
{"faction_values", "char_id"},
{"friends", "charid"},
{"guild_members", "char_id"},
{"guilds", "id"},
{"instance_list_player", "id"},
{"inventory", "charid"},
{"inventory_snapshots", "charid"},
{"keyring", "char_id"},
{"mail", "charid"},
{"player_titlesets", "char_id"},
{"quest_globals", "charid"},
{"timers", "char_id"},
{"titles", "char_id"},
{"trader", "char_id"},
{"zone_flags", "charID"}
};
}
/**
* @description Gets all player and meta-data tables
* @note These tables have no content in the PEQ daily dump
*
* @return
*/
static std::vector<std::string> GetPlayerTables()
{
return {
"account",
"account_ip",
"account_flags",
"account_rewards",
"adventure_details",
"adventure_stats",
"buyer",
"char_recipe_list",
"character_activities",
"character_alt_currency",
"character_alternate_abilities",
"character_auras",
"character_bandolier",
"character_bind",
"character_buffs",
"character_corpse_items",
"character_corpses",
"character_currency",
"character_data",
"character_disciplines",
"character_enabledtasks",
"character_expedition_lockouts",
"character_inspect_messages",
"character_item_recast",
"character_languages",
"character_leadership_abilities",
"character_material",
"character_memmed_spells",
"character_pet_buffs",
"character_pet_info",
"character_pet_inventory",
"character_potionbelt",
"character_skills",
"character_spells",
"character_tasks",
"character_tribute",
"completed_tasks",
"data_buckets",
"discovered_items",
"faction_values",
"friends",
"guild_bank",
"guild_members",
"guild_ranks",
"guild_relations",
"guilds",
"instance_list_player",
"inventory",
"inventory_snapshots",
"keyring",
"mail",
"petitions",
"player_titlesets",
"quest_globals",
"sharedbank",
"spell_buckets",
"spell_globals",
"timers",
"titles",
"trader",
"trader_audit",
"zone_flags"
};
}
/**
* Gets content tables
*
* @return
*/
static std::vector<std::string> GetContentTables()
{
return {
"aa_ability",
"aa_rank_effects",
"aa_rank_prereqs",
"aa_ranks",
"adventure_template",
"adventure_template_entry",
"adventure_template_entry_flavor",
"alternate_currency",
"auras",
"base_data",
"blocked_spells",
"books",
"char_create_combinations",
"char_create_point_allocations",
"damageshieldtypes",
"doors",
"faction_base_data",
"faction_list",
"faction_list_mod",
"fishing",
"forage",
"global_loot",
"goallists",
"graveyard",
"grid",
"grid_entries",
"ground_spawns",
"horses",
"items",
"ldon_trap_entries",
"ldon_trap_templates",
"lootdrop",
"lootdrop_entries",
"loottable",
"loottable_entries",
"merchantlist",
"npc_emotes",
"npc_faction",
"npc_faction_entries",
"npc_scale_global_base",
"npc_spells",
"npc_spells_effects",
"npc_spells_effects_entries",
"npc_spells_entries",
"npc_types",
"npc_types_tint",
"object",
"pets",
"pets_equipmentset",
"pets_equipmentset_entries",
"proximities",
"skill_caps",
"spawn2",
"spawn_conditions",
"spawnentry",
"spawngroup",
"spells_new",
"start_zones",
"starting_items",
"task_activities",
"tasks",
"tasksets",
"tradeskill_recipe",
"tradeskill_recipe_entries",
"traps",
"tribute_levels",
"tributes",
"veteran_reward_templates",
"zone",
"zone_points",
};
}
/**
* Gets server tables
*
* @return
*/
static std::vector<std::string> GetServerTables()
{
return {
"chatchannels",
"command_settings",
"content_flags",
"db_str",
"eqtime",
"launcher",
"launcher_zones",
"spawn_condition_values",
"spawn_events",
"level_exp_mods",
"logsys_categories",
"name_filter",
"perl_event_export_settings",
"profanity_list",
"rule_sets",
"rule_values",
"variables",
};
}
/**
* Gets QueryServer tables
*
* @return
*/
static std::vector<std::string> GetQueryServerTables()
{
return {
"qs_merchant_transaction_record",
"qs_merchant_transaction_record_entries",
"qs_player_aa_rate_hourly",
"qs_player_delete_record",
"qs_player_delete_record_entries",
"qs_player_events",
"qs_player_handin_record",
"qs_player_handin_record_entries",
"qs_player_move_record",
"qs_player_move_record_entries",
"qs_player_npc_kill_record",
"qs_player_npc_kill_record_entries",
"qs_player_speech",
"qs_player_trade_record",
"qs_player_trade_record_entries",
};
}
/**
* Gets state tables
* Tables that keep track of server state
*
* @return
*/
static std::vector<std::string> GetStateTables()
{
return {
"adventure_members",
"banned_ips",
"bug_reports",
"bugs",
"dynamic_zones",
"eventlog",
"expedition_lockouts",
"expedition_members",
"expeditions",
"gm_ips",
"group_id",
"group_leaders",
"hackers",
"ip_exemptions",
"instance_list",
"item_tick",
"lfguild",
"merchantlist_temp",
"object_contents",
"raid_details",
"raid_leaders",
"raid_members",
"reports",
"respawn_times",
"saylink",
};
}
/**
* Gets login tables
*
* @return
*/
static std::vector<std::string> GetLoginTables()
{
return {
"login_accounts",
"login_api_tokens",
"login_server_admins",
"login_server_list_types",
"login_world_servers",
};
}
/**
* Gets login tables
*
* @return
*/
static std::vector<std::string> GetVersionTables()
{
return {
"db_version",
"inventory_versions",
};
}
}
#endif //EQEMU_DATABASE_SCHEMA_H
+145 -61
View File
@@ -2,8 +2,9 @@
#include <winsock2.h> #include <winsock2.h>
#endif #endif
#include "../common/misc_functions.h" #include "misc_functions.h"
#include "../common/eqemu_logsys.h" #include "eqemu_logsys.h"
#include "timer.h"
#include "dbcore.h" #include "dbcore.h"
@@ -14,33 +15,51 @@
#include <string.h> #include <string.h>
#ifdef _WINDOWS #ifdef _WINDOWS
#define snprintf _snprintf #define snprintf _snprintf
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#define strcasecmp _stricmp #define strcasecmp _stricmp
#include <process.h> #include <process.h>
#else #else
#include "unix.h"
#include <pthread.h> #include "unix.h"
#include <pthread.h>
#endif #endif
#ifdef _EQDEBUG #ifdef _EQDEBUG
#define DEBUG_MYSQL_QUERIES 0 #define DEBUG_MYSQL_QUERIES 0
#else #else
#define DEBUG_MYSQL_QUERIES 0 #define DEBUG_MYSQL_QUERIES 0
#endif #endif
DBcore::DBcore() { DBcore::DBcore()
{
mysql_init(&mysql); mysql_init(&mysql);
pHost = 0; pHost = nullptr;
pUser = 0; pUser = nullptr;
pPassword = 0; pPassword = nullptr;
pDatabase = 0; pDatabase = nullptr;
pCompress = false; pCompress = false;
pSSL = false; pSSL = false;
pStatus = Closed; pStatus = Closed;
} }
DBcore::~DBcore() { DBcore::~DBcore()
{
/**
* This prevents us from doing a double free in multi-tenancy setups where we
* are re-using the default database connection pointer when we dont have an
* external configuration setup ex: (content_database)
*/
std::string mysql_connection_host;
if (mysql.host) {
mysql_connection_host = mysql.host;
}
if (GetOriginHost() != mysql_connection_host) {
return;
}
mysql_close(&mysql); mysql_close(&mysql);
safe_delete_array(pHost); safe_delete_array(pHost);
safe_delete_array(pUser); safe_delete_array(pUser);
@@ -49,7 +68,8 @@ DBcore::~DBcore() {
} }
// Sends the MySQL server a keepalive // Sends the MySQL server a keepalive
void DBcore::ping() { void DBcore::ping()
{
if (!MDatabase.trylock()) { if (!MDatabase.trylock()) {
// well, if's it's locked, someone's using it. If someone's using it, it doesnt need a keepalive // well, if's it's locked, someone's using it. If someone's using it, it doesnt need a keepalive
return; return;
@@ -63,34 +83,44 @@ MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureO
return QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce); return QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
} }
MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce) bool DBcore::DoesTableExist(std::string table_name)
{ {
auto results = QueryDatabase(fmt::format("SHOW TABLES LIKE '{}'", table_name));
return results.RowCount() > 0;
}
MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce)
{
BenchTimer timer;
timer.reset();
LockMutex lock(&MDatabase); LockMutex lock(&MDatabase);
// Reconnect if we are not connected before hand. // Reconnect if we are not connected before hand.
if (pStatus != Connected) if (pStatus != Connected) {
Open(); Open();
}
// request query. != 0 indicates some kind of error. // request query. != 0 indicates some kind of error.
if (mysql_real_query(&mysql, query, querylen) != 0) if (mysql_real_query(&mysql, query, querylen) != 0) {
{
unsigned int errorNumber = mysql_errno(&mysql); unsigned int errorNumber = mysql_errno(&mysql);
if (errorNumber == CR_SERVER_GONE_ERROR) if (errorNumber == CR_SERVER_GONE_ERROR) {
pStatus = Error; pStatus = Error;
}
// error appears to be a disconnect error, may need to try again. // error appears to be a disconnect error, may need to try again.
if (errorNumber == CR_SERVER_LOST || errorNumber == CR_SERVER_GONE_ERROR) if (errorNumber == CR_SERVER_LOST || errorNumber == CR_SERVER_GONE_ERROR) {
{
if (retryOnFailureOnce) if (retryOnFailureOnce) {
{ LogInfo("Database Error: Lost connection, attempting to recover");
std::cout << "Database Error: Lost connection, attempting to recover...." << std::endl;
MySQLRequestResult requestResult = QueryDatabase(query, querylen, false); MySQLRequestResult requestResult = QueryDatabase(query, querylen, false);
if (requestResult.Success()) if (requestResult.Success()) {
{ LogInfo("Reconnection to database successful");
std::cout << "Reconnection to database successful." << std::endl;
return requestResult; return requestResult;
} }
@@ -102,63 +132,96 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer); return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32) mysql_errno(&mysql), errorBuffer);
} }
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE]; auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
/* Implement Logging at the Root */ /**
if (mysql_errno(&mysql) > 0 && strlen(query) > 0){ * Error logging
if (LogSys.log_settings[Logs::MySQLError].is_category_enabled == 1) */
Log(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query); if (mysql_errno(&mysql) > 0 && strlen(query) > 0) {
LogMySQLError("[{}] [{}]\n[{}]", mysql_errno(&mysql), mysql_error(&mysql), query);
} }
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer); return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql), errorBuffer);
} }
// successful query. get results. // successful query. get results.
MYSQL_RES* res = mysql_store_result(&mysql); MYSQL_RES *res = mysql_store_result(&mysql);
uint32 rowCount = 0; uint32 rowCount = 0;
if (res != nullptr) if (res != nullptr) {
rowCount = (uint32)mysql_num_rows(res); rowCount = (uint32) mysql_num_rows(res);
}
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql)); MySQLRequestResult requestResult(
res,
(uint32) mysql_affected_rows(&mysql),
rowCount,
(uint32) mysql_field_count(&mysql),
(uint32) mysql_insert_id(&mysql)
);
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
{
if ((strncasecmp(query, "select", 6) == 0)) { if ((strncasecmp(query, "select", 6) == 0)) {
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s returned)", query, requestResult.RowCount(), requestResult.RowCount() == 1 ? "" : "s"); LogMySQLQuery(
"{0} ({1} row{2} returned) ({3}s)",
query,
requestResult.RowCount(),
requestResult.RowCount() == 1 ? "" : "s",
std::to_string(timer.elapsed())
);
} }
else { else {
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s affected)", query, requestResult.RowsAffected(), requestResult.RowsAffected() == 1 ? "" : "s"); LogMySQLQuery(
"{0} ({1} row{2} affected) ({3}s)",
query,
requestResult.RowsAffected(),
requestResult.RowsAffected() == 1 ? "" : "s",
std::to_string(timer.elapsed())
);
} }
} }
return requestResult; return requestResult;
} }
void DBcore::TransactionBegin() { void DBcore::TransactionBegin()
{
QueryDatabase("START TRANSACTION"); QueryDatabase("START TRANSACTION");
} }
void DBcore::TransactionCommit() { void DBcore::TransactionCommit()
{
QueryDatabase("COMMIT"); QueryDatabase("COMMIT");
} }
void DBcore::TransactionRollback() { void DBcore::TransactionRollback()
{
QueryDatabase("ROLLBACK"); QueryDatabase("ROLLBACK");
} }
uint32 DBcore::DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen) { uint32 DBcore::DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen)
{
// No good reason to lock the DB, we only need it in the first place to check char encoding. // No good reason to lock the DB, we only need it in the first place to check char encoding.
// LockMutex lock(&MDatabase); // LockMutex lock(&MDatabase);
return mysql_real_escape_string(&mysql, tobuf, frombuf, fromlen); return mysql_real_escape_string(&mysql, tobuf, frombuf, fromlen);
} }
bool DBcore::Open(const char* iHost, const char* iUser, const char* iPassword, const char* iDatabase,uint32 iPort, uint32* errnum, char* errbuf, bool iCompress, bool iSSL) { bool DBcore::Open(
const char *iHost,
const char *iUser,
const char *iPassword,
const char *iDatabase,
uint32 iPort,
uint32 *errnum,
char *errbuf,
bool iCompress,
bool iSSL
)
{
LockMutex lock(&MDatabase); LockMutex lock(&MDatabase);
safe_delete(pHost); safe_delete(pHost);
safe_delete(pUser); safe_delete(pUser);
@@ -174,44 +237,65 @@ bool DBcore::Open(const char* iHost, const char* iUser, const char* iPassword, c
return Open(errnum, errbuf); return Open(errnum, errbuf);
} }
bool DBcore::Open(uint32* errnum, char* errbuf) { bool DBcore::Open(uint32 *errnum, char *errbuf)
if (errbuf) {
if (errbuf) {
errbuf[0] = 0; errbuf[0] = 0;
}
LockMutex lock(&MDatabase); LockMutex lock(&MDatabase);
if (GetStatus() == Connected) if (GetStatus() == Connected) {
return true; return true;
}
if (GetStatus() == Error) { if (GetStatus() == Error) {
mysql_close(&mysql); mysql_close(&mysql);
mysql_init(&mysql); // Initialize structure again mysql_init(&mysql); // Initialize structure again
} }
if (!pHost) if (!pHost) {
return false; return false;
}
/* /*
Added CLIENT_FOUND_ROWS flag to the connect Added CLIENT_FOUND_ROWS flag to the connect
otherwise DB update calls would say 0 rows affected when the value already equalled otherwise DB update calls would say 0 rows affected when the value already equalled
what the function was tring to set it to, therefore the function would think it failed what the function was tring to set it to, therefore the function would think it failed
*/ */
uint32 flags = CLIENT_FOUND_ROWS; uint32 flags = CLIENT_FOUND_ROWS;
if (pCompress) if (pCompress) {
flags |= CLIENT_COMPRESS; flags |= CLIENT_COMPRESS;
if (pSSL) }
if (pSSL) {
flags |= CLIENT_SSL; flags |= CLIENT_SSL;
}
if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) { if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
pStatus = Connected; pStatus = Connected;
std::string connected_origin_host = pHost;
SetOriginHost(connected_origin_host);
return true; return true;
} }
else { else {
if (errnum) if (errnum) {
*errnum = mysql_errno(&mysql); *errnum = mysql_errno(&mysql);
if (errbuf) }
if (errbuf) {
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
}
pStatus = Error; pStatus = Error;
return false; return false;
} }
} }
void DBcore::SetMysql(MYSQL *mysql)
{
DBcore::mysql = *mysql;
}
const std::string &DBcore::GetOriginHost() const
{
return origin_host;
}
void DBcore::SetOriginHost(const std::string &origin_host)
{
DBcore::origin_host = origin_host;
}
+33 -12
View File
@@ -2,8 +2,8 @@
#define DBCORE_H #define DBCORE_H
#ifdef _WINDOWS #ifdef _WINDOWS
#include <winsock2.h> #include <winsock2.h>
#include <windows.h> #include <windows.h>
#endif #endif
#include "../common/mutex.h" #include "../common/mutex.h"
@@ -15,33 +15,54 @@
class DBcore { class DBcore {
public: public:
enum eStatus { Closed, Connected, Error }; enum eStatus {
Closed, Connected, Error
};
DBcore(); DBcore();
~DBcore(); ~DBcore();
eStatus GetStatus() { return pStatus; } eStatus GetStatus() { return pStatus; }
MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true); MySQLRequestResult QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce = true);
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true); MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
void TransactionBegin(); void TransactionBegin();
void TransactionCommit(); void TransactionCommit();
void TransactionRollback(); void TransactionRollback();
uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen); uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
void ping(); void ping();
MYSQL* getMySQL(){ return &mysql; } MYSQL *getMySQL() { return &mysql; }
void SetMysql(MYSQL *mysql);
const std::string &GetOriginHost() const;
void SetOriginHost(const std::string &origin_host);
bool DoesTableExist(std::string table_name);
protected: protected:
bool Open(const char* iHost, const char* iUser, const char* iPassword, const char* iDatabase, uint32 iPort, uint32* errnum = 0, char* errbuf = 0, bool iCompress = false, bool iSSL = false); bool Open(
const char *iHost,
const char *iUser,
const char *iPassword,
const char *iDatabase,
uint32 iPort,
uint32 *errnum = 0,
char *errbuf = 0,
bool iCompress = false,
bool iSSL = false
);
private: private:
bool Open(uint32* errnum = 0, char* errbuf = 0); bool Open(uint32 *errnum = nullptr, char *errbuf = nullptr);
MYSQL mysql; MYSQL mysql;
Mutex MDatabase; Mutex MDatabase;
eStatus pStatus; eStatus pStatus;
char* pHost; std::string origin_host;
char* pUser;
char* pPassword; char *pHost;
char* pDatabase; char *pUser;
char *pPassword;
char *pDatabase;
bool pCompress; bool pCompress;
uint32 pPort; uint32 pPort;
bool pSSL; bool pSSL;
+3 -3
View File
@@ -20,7 +20,7 @@
#include "deity.h" #include "deity.h"
EQEmu::deity::DeityTypeBit EQEmu::deity::ConvertDeityTypeToDeityTypeBit(DeityType deity_type) EQ::deity::DeityTypeBit EQ::deity::ConvertDeityTypeToDeityTypeBit(DeityType deity_type)
{ {
switch (deity_type) { switch (deity_type) {
case DeityBertoxxulous: case DeityBertoxxulous:
@@ -63,7 +63,7 @@ EQEmu::deity::DeityTypeBit EQEmu::deity::ConvertDeityTypeToDeityTypeBit(DeityTyp
}; };
} }
EQEmu::deity::DeityType EQEmu::deity::ConvertDeityTypeBitToDeityType(DeityTypeBit deity_type_bit) EQ::deity::DeityType EQ::deity::ConvertDeityTypeBitToDeityType(DeityTypeBit deity_type_bit)
{ {
switch (deity_type_bit) { switch (deity_type_bit) {
case bit_DeityAgnostic: case bit_DeityAgnostic:
@@ -105,7 +105,7 @@ EQEmu::deity::DeityType EQEmu::deity::ConvertDeityTypeBitToDeityType(DeityTypeBi
}; };
} }
const char* EQEmu::deity::DeityName(DeityType deity_type) const char* EQ::deity::DeityName(DeityType deity_type)
{ {
switch (deity_type) { switch (deity_type) {
case DeityBertoxxulous: case DeityBertoxxulous:
+1 -1
View File
@@ -23,7 +23,7 @@
#include "types.h" #include "types.h"
namespace EQEmu namespace EQ
{ {
namespace deity { namespace deity {
enum DeityType { enum DeityType {
+7 -7
View File
@@ -20,7 +20,7 @@
#include "emu_constants.h" #include "emu_constants.h"
int16 EQEmu::invtype::GetInvTypeSize(int16 inv_type) { int16 EQ::invtype::GetInvTypeSize(int16 inv_type) {
static const int16 local_array[] = { static const int16 local_array[] = {
POSSESSIONS_SIZE, POSSESSIONS_SIZE,
BANK_SIZE, BANK_SIZE,
@@ -55,7 +55,7 @@ int16 EQEmu::invtype::GetInvTypeSize(int16 inv_type) {
return local_array[inv_type]; return local_array[inv_type];
} }
const char* EQEmu::bug::CategoryIDToCategoryName(CategoryID category_id) { const char* EQ::bug::CategoryIDToCategoryName(CategoryID category_id) {
switch (category_id) { switch (category_id) {
case catVideo: case catVideo:
return "Video"; return "Video";
@@ -87,7 +87,7 @@ const char* EQEmu::bug::CategoryIDToCategoryName(CategoryID category_id) {
} }
} }
EQEmu::bug::CategoryID EQEmu::bug::CategoryNameToCategoryID(const char* category_name) { EQ::bug::CategoryID EQ::bug::CategoryNameToCategoryID(const char* category_name) {
if (!category_name) if (!category_name)
return catOther; return catOther;
@@ -119,7 +119,7 @@ EQEmu::bug::CategoryID EQEmu::bug::CategoryNameToCategoryID(const char* category
return catOther; return catOther;
} }
const char *EQEmu::constants::GetStanceName(StanceType stance_type) { const char *EQ::constants::GetStanceName(StanceType stance_type) {
switch (stance_type) { switch (stance_type) {
case stanceUnknown: case stanceUnknown:
return "Unknown"; return "Unknown";
@@ -146,9 +146,9 @@ const char *EQEmu::constants::GetStanceName(StanceType stance_type) {
} }
} }
int EQEmu::constants::ConvertStanceTypeToIndex(StanceType stance_type) { int EQ::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
if (stance_type >= EQEmu::constants::stancePassive && stance_type <= EQEmu::constants::stanceBurnAE) if (stance_type >= EQ::constants::stancePassive && stance_type <= EQ::constants::stanceBurnAE)
return (stance_type - EQEmu::constants::stancePassive); return (stance_type - EQ::constants::stancePassive);
return 0; return 0;
} }
+16 -3
View File
@@ -27,7 +27,7 @@
// local definitions are the result of using hybrid-client or server-only values and methods // local definitions are the result of using hybrid-client or server-only values and methods
namespace EQEmu namespace EQ
{ {
using RoF2::IINVALID; using RoF2::IINVALID;
using RoF2::INULL; using RoF2::INULL;
@@ -77,6 +77,10 @@ namespace EQEmu
} // namespace invtype } // namespace invtype
namespace DevTools {
const int32 GM_ACCOUNT_STATUS_LEVEL = 150;
}
namespace popupresponse { namespace popupresponse {
const int32 SERVER_INTERNAL_USE_BASE = 2000000000; const int32 SERVER_INTERNAL_USE_BASE = 2000000000;
const int32 MOB_INFO_DISMISS = 2000000001; const int32 MOB_INFO_DISMISS = 2000000001;
@@ -189,7 +193,7 @@ namespace EQEmu
} // namespace invaug } // namespace invaug
namespace constants { namespace constants {
const EQEmu::versions::ClientVersion CHARACTER_CREATION_CLIENT = EQEmu::versions::ClientVersion::Titanium; const EQ::versions::ClientVersion CHARACTER_CREATION_CLIENT = EQ::versions::ClientVersion::Titanium;
using RoF2::constants::EXPANSION; using RoF2::constants::EXPANSION;
using RoF2::constants::EXPANSION_BIT; using RoF2::constants::EXPANSION_BIT;
@@ -313,12 +317,21 @@ namespace EQEmu
QuestControlGrid = -1 QuestControlGrid = -1
}; };
namespace consent {
enum eConsentType : uint8 {
Normal = 0,
Group,
Raid,
Guild
};
}; // namespace consent
} /*EQEmu*/ } /*EQEmu*/
#endif /*COMMON_EMU_CONSTANTS_H*/ #endif /*COMMON_EMU_CONSTANTS_H*/
/* hack list to prevent circular references /* hack list to prevent circular references
eq_limits.h:EQEmu::inventory::LookupEntry::InventoryTypeSize[n]; eq_limits.h:EQ::inventory::LookupEntry::InventoryTypeSize[n];
*/ */
+8 -7
View File
@@ -1,8 +1,6 @@
// system use // system use
N(OP_ExploreUnknown), N(OP_ExploreUnknown),
// start (please add new opcodes in descending order and re-order any name changes where applicable) // start (please add new opcodes in descending order and re-order any name changes where applicable)
N(OP_0x0193),
N(OP_0x0347),
N(OP_AAAction), N(OP_AAAction),
N(OP_AAExpUpdate), N(OP_AAExpUpdate),
N(OP_AcceptNewTask), N(OP_AcceptNewTask),
@@ -136,20 +134,22 @@ N(OP_Dye),
N(OP_DynamicWall), N(OP_DynamicWall),
N(OP_DzAddPlayer), N(OP_DzAddPlayer),
N(OP_DzChooseZone), N(OP_DzChooseZone),
N(OP_DzChooseZoneReply),
N(OP_DzCompass), N(OP_DzCompass),
N(OP_DzExpeditionEndsWarning), N(OP_DzExpeditionEndsWarning),
N(OP_DzExpeditionInfo), N(OP_DzExpeditionInfo),
N(OP_DzExpeditionList), N(OP_DzExpeditionInvite),
N(OP_DzJoinExpeditionConfirm), N(OP_DzExpeditionInviteResponse),
N(OP_DzJoinExpeditionReply), N(OP_DzExpeditionLockoutTimers),
N(OP_DzLeaderStatus),
N(OP_DzListTimers), N(OP_DzListTimers),
N(OP_DzMakeLeader), N(OP_DzMakeLeader),
N(OP_DzMemberList), N(OP_DzMemberList),
N(OP_DzMemberStatus), N(OP_DzMemberListName),
N(OP_DzMemberListStatus),
N(OP_DzPlayerList), N(OP_DzPlayerList),
N(OP_DzQuit), N(OP_DzQuit),
N(OP_DzRemovePlayer), N(OP_DzRemovePlayer),
N(OP_DzSetLeaderName),
N(OP_DzSwapPlayer), N(OP_DzSwapPlayer),
N(OP_Emote), N(OP_Emote),
N(OP_EndLootRequest), N(OP_EndLootRequest),
@@ -271,6 +271,7 @@ N(OP_ItemVerifyRequest),
N(OP_ItemViewUnknown), N(OP_ItemViewUnknown),
N(OP_Jump), N(OP_Jump),
N(OP_KeyRing), N(OP_KeyRing),
N(OP_KickPlayers),
N(OP_KnowledgeBase), N(OP_KnowledgeBase),
N(OP_LDoNButton), N(OP_LDoNButton),
N(OP_LDoNDisarmTraps), N(OP_LDoNDisarmTraps),
+31 -56
View File
@@ -21,7 +21,7 @@
#include "emu_constants.h" #include "emu_constants.h"
bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version) bool EQ::versions::IsValidClientVersion(ClientVersion client_version)
{ {
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion) if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
return false; return false;
@@ -29,7 +29,7 @@ bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
return true; return true;
} }
EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version) EQ::versions::ClientVersion EQ::versions::ValidateClientVersion(ClientVersion client_version)
{ {
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion) if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
return ClientVersion::Unknown; return ClientVersion::Unknown;
@@ -37,7 +37,7 @@ EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVers
return client_version; return client_version;
} }
const char* EQEmu::versions::ClientVersionName(ClientVersion client_version) const char* EQ::versions::ClientVersionName(ClientVersion client_version)
{ {
switch (client_version) { switch (client_version) {
case ClientVersion::Unknown: case ClientVersion::Unknown:
@@ -61,7 +61,7 @@ const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
}; };
} }
uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version) uint32 EQ::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version)
{ {
switch (client_version) { switch (client_version) {
case ClientVersion::Titanium: case ClientVersion::Titanium:
@@ -81,7 +81,7 @@ uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion cli
} }
} }
EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit) EQ::versions::ClientVersion EQ::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit)
{ {
switch (client_version_bit) { switch (client_version_bit) {
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) : case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) :
@@ -101,7 +101,7 @@ EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientV
} }
} }
bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version) bool EQ::versions::IsValidMobVersion(MobVersion mob_version)
{ {
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion) if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
return false; return false;
@@ -109,7 +109,7 @@ bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version)
return true; return true;
} }
bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version) bool EQ::versions::IsValidPCMobVersion(MobVersion mob_version)
{ {
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion) if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
return false; return false;
@@ -117,7 +117,7 @@ bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version)
return true; return true;
} }
bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version) bool EQ::versions::IsValidNonPCMobVersion(MobVersion mob_version)
{ {
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion) if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
return false; return false;
@@ -125,7 +125,7 @@ bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version)
return true; return true;
} }
bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version) bool EQ::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
{ {
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion) if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
return false; return false;
@@ -133,7 +133,7 @@ bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
return true; return true;
} }
EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_version) EQ::versions::MobVersion EQ::versions::ValidateMobVersion(MobVersion mob_version)
{ {
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion) if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
return MobVersion::Unknown; return MobVersion::Unknown;
@@ -141,7 +141,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_v
return mob_version; return mob_version;
} }
EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob_version) EQ::versions::MobVersion EQ::versions::ValidatePCMobVersion(MobVersion mob_version)
{ {
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion) if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
return MobVersion::Unknown; return MobVersion::Unknown;
@@ -149,7 +149,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob
return mob_version; return mob_version;
} }
EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion mob_version) EQ::versions::MobVersion EQ::versions::ValidateNonPCMobVersion(MobVersion mob_version)
{ {
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion) if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
return MobVersion::Unknown; return MobVersion::Unknown;
@@ -157,7 +157,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion
return mob_version; return mob_version;
} }
EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVersion mob_version) EQ::versions::MobVersion EQ::versions::ValidateOfflinePCMobVersion(MobVersion mob_version)
{ {
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion) if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
return MobVersion::Unknown; return MobVersion::Unknown;
@@ -165,7 +165,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVers
return mob_version; return mob_version;
} }
const char* EQEmu::versions::MobVersionName(MobVersion mob_version) const char* EQ::versions::MobVersionName(MobVersion mob_version)
{ {
switch (mob_version) { switch (mob_version) {
case MobVersion::Unknown: case MobVersion::Unknown:
@@ -217,7 +217,7 @@ const char* EQEmu::versions::MobVersionName(MobVersion mob_version)
}; };
} }
EQEmu::versions::ClientVersion EQEmu::versions::ConvertMobVersionToClientVersion(MobVersion mob_version) EQ::versions::ClientVersion EQ::versions::ConvertMobVersionToClientVersion(MobVersion mob_version)
{ {
switch (mob_version) { switch (mob_version) {
case MobVersion::Unknown: case MobVersion::Unknown:
@@ -240,7 +240,7 @@ EQEmu::versions::ClientVersion EQEmu::versions::ConvertMobVersionToClientVersion
} }
} }
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToMobVersion(ClientVersion client_version) EQ::versions::MobVersion EQ::versions::ConvertClientVersionToMobVersion(ClientVersion client_version)
{ {
switch (client_version) { switch (client_version) {
case ClientVersion::Unknown: case ClientVersion::Unknown:
@@ -263,7 +263,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToMobVersion(Cl
} }
} }
EQEmu::versions::MobVersion EQEmu::versions::ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version) EQ::versions::MobVersion EQ::versions::ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version)
{ {
switch (mob_version) { switch (mob_version) {
case MobVersion::Titanium: case MobVersion::Titanium:
@@ -283,7 +283,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ConvertPCMobVersionToOfflinePCMobVe
} }
} }
EQEmu::versions::MobVersion EQEmu::versions::ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version) EQ::versions::MobVersion EQ::versions::ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version)
{ {
switch (mob_version) { switch (mob_version) {
case MobVersion::OfflineTitanium: case MobVersion::OfflineTitanium:
@@ -303,7 +303,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ConvertOfflinePCMobVersionToPCMobVe
} }
} }
EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version) EQ::versions::ClientVersion EQ::versions::ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version)
{ {
switch (mob_version) { switch (mob_version) {
case MobVersion::OfflineTitanium: case MobVersion::OfflineTitanium:
@@ -323,7 +323,7 @@ EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCMobVersionToClie
} }
} }
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version) EQ::versions::MobVersion EQ::versions::ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version)
{ {
switch (client_version) { switch (client_version) {
case ClientVersion::Titanium: case ClientVersion::Titanium:
@@ -343,7 +343,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToOfflinePCMobV
} }
} }
const char* EQEmu::expansions::ExpansionName(Expansion expansion) const char* EQ::expansions::ExpansionName(Expansion expansion)
{ {
switch (expansion) { switch (expansion) {
case Expansion::EverQuest: case Expansion::EverQuest:
@@ -393,12 +393,12 @@ const char* EQEmu::expansions::ExpansionName(Expansion expansion)
} }
} }
const char* EQEmu::expansions::ExpansionName(uint32 expansion_bit) const char* EQ::expansions::ExpansionName(uint32 expansion_bit)
{ {
return ExpansionName(ConvertExpansionBitToExpansion(expansion_bit)); return ExpansionName(ConvertExpansionBitToExpansion(expansion_bit));
} }
uint32 EQEmu::expansions::ConvertExpansionToExpansionBit(Expansion expansion) uint32 EQ::expansions::ConvertExpansionToExpansionBit(Expansion expansion)
{ {
switch (expansion) { switch (expansion) {
case Expansion::RoK: case Expansion::RoK:
@@ -446,7 +446,7 @@ uint32 EQEmu::expansions::ConvertExpansionToExpansionBit(Expansion expansion)
} }
} }
EQEmu::expansions::Expansion EQEmu::expansions::ConvertExpansionBitToExpansion(uint32 expansion_bit) EQ::expansions::Expansion EQ::expansions::ConvertExpansionBitToExpansion(uint32 expansion_bit)
{ {
switch (expansion_bit) { switch (expansion_bit) {
case bitRoK: case bitRoK:
@@ -494,7 +494,7 @@ EQEmu::expansions::Expansion EQEmu::expansions::ConvertExpansionBitToExpansion(u
} }
} }
uint32 EQEmu::expansions::ConvertExpansionToExpansionsMask(Expansion expansion) uint32 EQ::expansions::ConvertExpansionToExpansionsMask(Expansion expansion)
{ {
switch (expansion) { switch (expansion) {
case Expansion::RoK: case Expansion::RoK:
@@ -542,42 +542,17 @@ uint32 EQEmu::expansions::ConvertExpansionToExpansionsMask(Expansion expansion)
} }
} }
EQEmu::expansions::Expansion EQEmu::expansions::ConvertClientVersionToExpansion(versions::ClientVersion client_version) EQ::expansions::Expansion EQ::expansions::ConvertClientVersionToExpansion(versions::ClientVersion client_version)
{ {
return EQEmu::constants::StaticLookup(client_version)->Expansion; return EQ::constants::StaticLookup(client_version)->Expansion;
} }
uint32 EQEmu::expansions::ConvertClientVersionToExpansionBit(versions::ClientVersion client_version) uint32 EQ::expansions::ConvertClientVersionToExpansionBit(versions::ClientVersion client_version)
{ {
return EQEmu::constants::StaticLookup(client_version)->ExpansionBit; return EQ::constants::StaticLookup(client_version)->ExpansionBit;
} }
uint32 EQEmu::expansions::ConvertClientVersionToExpansionsMask(versions::ClientVersion client_version) uint32 EQ::expansions::ConvertClientVersionToExpansionsMask(versions::ClientVersion client_version)
{ {
return EQEmu::constants::StaticLookup(client_version)->ExpansionsMask; return EQ::constants::StaticLookup(client_version)->ExpansionsMask;
}
uint32 EQEmu::expansions::ConvertExpansionMaskToLatestExpansion(uint32 expansion_mask)
{
if ((expansion_mask & bitRoK) == bitRoK) return static_cast<uint32>(Expansion::RoK);
if ((expansion_mask & bitSoV) == bitSoV) return static_cast<uint32>(Expansion::SoV);
if ((expansion_mask & bitSoL) == bitSoL) return static_cast<uint32>(Expansion::SoL);
if ((expansion_mask & bitPoP) == bitPoP) return static_cast<uint32>(Expansion::PoP);
if ((expansion_mask & bitLoY) == bitLoY) return static_cast<uint32>(Expansion::LoY);
if ((expansion_mask & bitLDoN) == bitLDoN) return static_cast<uint32>(Expansion::LDoN);
if ((expansion_mask & bitGoD) == bitGoD) return static_cast<uint32>(Expansion::GoD);
if ((expansion_mask & bitOoW) == bitOoW) return static_cast<uint32>(Expansion::OoW);
if ((expansion_mask & bitDoN) == bitDoN) return static_cast<uint32>(Expansion::DoN);
if ((expansion_mask & bitDoD) == bitDoD) return static_cast<uint32>(Expansion::DoD);
if ((expansion_mask & bitPoR) == bitPoR) return static_cast<uint32>(Expansion::PoR);
if ((expansion_mask & bitTSS) == bitTSS) return static_cast<uint32>(Expansion::TSS);
if ((expansion_mask & bitTBS) == bitTBS) return static_cast<uint32>(Expansion::TBS);
if ((expansion_mask & bitSoF) == bitSoF) return static_cast<uint32>(Expansion::SoF);
if ((expansion_mask & bitSoD) == bitSoD) return static_cast<uint32>(Expansion::SoD);
if ((expansion_mask & bitUF) == bitUF) return static_cast<uint32>(Expansion::UF);
if ((expansion_mask & bitHoT) == bitHoT) return static_cast<uint32>(Expansion::HoT);
if ((expansion_mask & bitVoA) == bitVoA) return static_cast<uint32>(Expansion::VoA);
if ((expansion_mask & bitRoF) == bitRoF) return static_cast<uint32>(Expansion::RoF);
if ((expansion_mask & bitCotF) == bitCotF) return static_cast<uint32>(Expansion::CotF);
return static_cast<uint32>(Expansion::EverQuest);
} }
+2 -2
View File
@@ -25,7 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
namespace EQEmu namespace EQ
{ {
namespace versions { namespace versions {
enum class ClientVersion : uint32 { enum class ClientVersion : uint32 {
@@ -214,7 +214,7 @@ namespace EQEmu
Expansion ConvertClientVersionToExpansion(versions::ClientVersion client_version); Expansion ConvertClientVersionToExpansion(versions::ClientVersion client_version);
uint32 ConvertClientVersionToExpansionBit(versions::ClientVersion client_version); uint32 ConvertClientVersionToExpansionBit(versions::ClientVersion client_version);
uint32 ConvertClientVersionToExpansionsMask(versions::ClientVersion client_version); uint32 ConvertClientVersionToExpansionsMask(versions::ClientVersion client_version);
uint32 ConvertExpansionMaskToLatestExpansion(uint32 expansion_mask);
} /*expansions*/ } /*expansions*/
} /*EQEmu*/ } /*EQEmu*/
+133 -192
View File
@@ -87,199 +87,114 @@ typedef enum {
_eaMaxAppearance _eaMaxAppearance
} EmuAppearance; } EmuAppearance;
// msg_type's for custom usercolors namespace Chat {
#define MT_Say 256 const uint16 White = 0;
#define MT_Tell 257 const uint16 DimGray = 1;
#define MT_Group 258 const uint16 Default = 1;
#define MT_Guild 259 const uint16 Green = 2;
#define MT_OOC 260 const uint16 BrightBlue = 3;
#define MT_Auction 261 const uint16 LightBlue = 4;
#define MT_Shout 262 const uint16 Magenta = 5;
#define MT_Emote 263 const uint16 Gray = 6;
#define MT_Spells 264 const uint16 LightGray = 7;
#define MT_YouHitOther 265 const uint16 NPCQuestSay = 10;
#define MT_OtherHitsYou 266 const uint16 DarkGray = 12;
#define MT_YouMissOther 267 const uint16 Red = 13;
#define MT_OtherMissesYou 268 const uint16 Lime = 14;
#define MT_Broadcasts 269 const uint16 Yellow = 15;
#define MT_Skills 270 const uint16 Blue = 16;
#define MT_Disciplines 271 const uint16 LightNavy = 17;
#define MT_Unused1 272 const uint16 Cyan = 18;
#define MT_DefaultText 273 const uint16 Black = 20;
#define MT_Unused2 274
#define MT_MerchantOffer 275
#define MT_MerchantBuySell 276
#define MT_YourDeath 277
#define MT_OtherDeath 278
#define MT_OtherHits 279
#define MT_OtherMisses 280
#define MT_Who 281
#define MT_YellForHelp 282
#define MT_NonMelee 283
#define MT_WornOff 284
#define MT_MoneySplit 285
#define MT_LootMessages 286
#define MT_DiceRoll 287
#define MT_OtherSpells 288
#define MT_SpellFailure 289
#define MT_Chat 290
#define MT_Channel1 291
#define MT_Channel2 292
#define MT_Channel3 293
#define MT_Channel4 294
#define MT_Channel5 295
#define MT_Channel6 296
#define MT_Channel7 297
#define MT_Channel8 298
#define MT_Channel9 299
#define MT_Channel10 300
#define MT_CritMelee 301
#define MT_SpellCrits 302
#define MT_TooFarAway 303
#define MT_NPCRampage 304
#define MT_NPCFlurry 305
#define MT_NPCEnrage 306
#define MT_SayEcho 307
#define MT_TellEcho 308
#define MT_GroupEcho 309
#define MT_GuildEcho 310
#define MT_OOCEcho 311
#define MT_AuctionEcho 312
#define MT_ShoutECho 313
#define MT_EmoteEcho 314
#define MT_Chat1Echo 315
#define MT_Chat2Echo 316
#define MT_Chat3Echo 317
#define MT_Chat4Echo 318
#define MT_Chat5Echo 319
#define MT_Chat6Echo 320
#define MT_Chat7Echo 321
#define MT_Chat8Echo 322
#define MT_Chat9Echo 323
#define MT_Chat10Echo 324
#define MT_DoTDamage 325
#define MT_ItemLink 326
#define MT_RaidSay 327
#define MT_MyPet 328
#define MT_DS 329
#define MT_Leadership 330
#define MT_PetFlurry 331
#define MT_PetCrit 332
#define MT_FocusEffect 333
#define MT_Experience 334
#define MT_System 335
#define MT_PetSpell 336
#define MT_PetResponse 337
#define MT_ItemSpeech 338
#define MT_StrikeThrough 339
#define MT_Stun 340
// TODO: Really should combine above and below into one /**
* User colors
//from showeq
enum ChatColor
{
/*
CC_Default = 0,
CC_DarkGrey = 1,
CC_DarkGreen = 2,
CC_DarkBlue = 3,
CC_Purple = 5,
CC_LightGrey = 6,
*/ */
const uint16 Say = 256;
CC_WhiteSmoke = 0, // FF|F0F0F0 const uint16 Tell = 257;
CC_Green = 2, // FF|008000 const uint16 Group = 258;
CC_BrightBlue = 3, // FF|0040FF const uint16 Guild = 259;
CC_Magenta = 5, // FF|F000F0 const uint16 OOC = 260;
CC_Gray = 6, // FF|808080 const uint16 Auction = 261;
CC_LightGray = 7, // FF|E0E0E0 const uint16 Shout = 262;
//CC_WhiteSmoke2 = 10, // FF|F0F0F0 const uint16 Emote = 263;
CC_DarkGray = 12, // FF|A0A0A0 const uint16 Spells = 264;
CC_Red = 13, // FF|F00000 const uint16 YouHitOther = 265;
CC_Lime = 14, // FF|00F000 const uint16 OtherHitYou = 266;
CC_Yellow = 15, // FF|F0F000 const uint16 YouMissOther = 267;
CC_Blue = 16, // FF|0000F0 const uint16 OtherMissYou = 268;
CC_LightNavy = 17, // FF|0000AF const uint16 Broadcasts = 269;
CC_Cyan = 18, // FF|00F0F0 const uint16 Skills = 270;
CC_Black = 20, // FF|000000 const uint16 Disciplines = 271;
const uint16 Unused1 = 272;
// any index <= 255 that is not defined above const uint16 DefaultText = 273;
CC_DimGray = 1, // FF|606060 const uint16 Unused2 = 274;
CC_Default = 1, const uint16 MerchantOffer = 275;
const uint16 MerchantExchange = 276;
CC_User_Say = 256, const uint16 YourDeath = 277;
CC_User_Tell = 257, const uint16 OtherDeath = 278;
CC_User_Group = 258, const uint16 OtherHitOther = 279;
CC_User_Guild = 259, const uint16 OtherMissOther = 280;
CC_User_OOC = 260, const uint16 Who = 281;
CC_User_Auction = 261, const uint16 YellForHelp = 282;
CC_User_Shout = 262, const uint16 NonMelee = 283;
CC_User_Emote = 263, const uint16 SpellWornOff = 284;
CC_User_Spells = 264, const uint16 MoneySplit = 285;
CC_User_YouHitOther = 265, const uint16 Loot = 286;
CC_User_OtherHitYou = 266, const uint16 DiceRoll = 287;
CC_User_YouMissOther = 267, const uint16 OtherSpells = 288;
CC_User_OtherMissYou = 268, const uint16 SpellFailure = 289;
CC_User_Duels = 269, const uint16 ChatChannel = 290;
CC_User_Skills = 270, const uint16 Chat1 = 291;
CC_User_Disciplines = 271, const uint16 Chat2 = 292;
CC_User_Default = 273, const uint16 Chat3 = 293;
CC_User_MerchantOffer = 275, const uint16 Chat4 = 294;
CC_User_MerchantExchange = 276, const uint16 Chat5 = 295;
CC_User_YourDeath = 277, const uint16 Chat6 = 296;
CC_User_OtherDeath = 278, const uint16 Chat7 = 297;
CC_User_OtherHitOther = 279, const uint16 Chat8 = 298;
CC_User_OtherMissOther = 280, const uint16 Chat9 = 299;
CC_User_Who = 281, const uint16 Chat10 = 300;
CC_User_Yell = 282, const uint16 MeleeCrit = 301;
CC_User_NonMelee = 283, const uint16 SpellCrit = 302;
CC_User_SpellWornOff = 284, const uint16 TooFarAway = 303;
CC_User_MoneySplit = 285, const uint16 NPCRampage = 304;
CC_User_Loot = 286, const uint16 NPCFlurry = 305;
CC_User_Random = 287, const uint16 NPCEnrage = 306;
CC_User_OtherSpells = 288, const uint16 EchoSay = 307;
CC_User_SpellFailure = 289, const uint16 EchoTell = 308;
CC_User_ChatChannel = 290, const uint16 EchoGroup = 309;
CC_User_Chat1 = 291, const uint16 EchoGuild = 310;
CC_User_Chat2 = 292, const uint16 EchoOOC = 311;
CC_User_Chat3 = 293, const uint16 EchoAuction = 312;
CC_User_Chat4 = 294, const uint16 EchoShout = 313;
CC_User_Chat5 = 295, const uint16 EchoEmote = 314;
CC_User_Chat6 = 296, const uint16 EchoChat1 = 315;
CC_User_Chat7 = 297, const uint16 EchoChat2 = 316;
CC_User_Chat8 = 298, const uint16 EchoChat3 = 317;
CC_User_Chat9 = 299, const uint16 EchoChat4 = 318;
CC_User_Chat10 = 300, const uint16 EchoChat5 = 319;
CC_User_MeleeCrit = 301, const uint16 EchoChat6 = 320;
CC_User_SpellCrit = 302, const uint16 EchoChat7 = 321;
CC_User_TooFarAway = 303, const uint16 EchoChat8 = 322;
CC_User_NPCRampage = 304, const uint16 EchoChat9 = 323;
CC_User_NPCFurry = 305, const uint16 EchoChat10 = 324;
CC_User_NPCEnrage = 306, const uint16 DotDamage = 325;
CC_User_EchoSay = 307, const uint16 ItemLink = 326;
CC_User_EchoTell = 308, const uint16 RaidSay = 327;
CC_User_EchoGroup = 309, const uint16 MyPet = 328;
CC_User_EchoGuild = 310, const uint16 DamageShield = 329;
CC_User_EchoOOC = 311, const uint16 LeaderShip = 330;
CC_User_EchoAuction = 312, const uint16 PetFlurry = 331;
CC_User_EchoShout = 313, const uint16 PetCritical = 332;
CC_User_EchoEmote = 314, const uint16 FocusEffect = 333;
CC_User_EchoChat1 = 315, const uint16 Experience = 334;
CC_User_EchoChat2 = 316, const uint16 System = 335;
CC_User_EchoChat3 = 317, const uint16 PetSpell = 336;
CC_User_EchoChat4 = 318, const uint16 PetResponse = 337;
CC_User_EchoChat5 = 319, const uint16 ItemSpeech = 338;
CC_User_EchoChat6 = 320, const uint16 StrikeThrough = 339;
CC_User_EchoChat7 = 321, const uint16 Stun = 340;
CC_User_EchoChat8 = 322,
CC_User_EchoChat9 = 323,
CC_User_EchoChat10 = 324,
CC_User_UnusedAtThisTime = 325,
CC_User_ItemTags = 326,
CC_User_RaidSay = 327,
CC_User_MyPet = 328,
CC_User_DamageShield = 329,
}; };
//ZoneChange_Struct->success values //ZoneChange_Struct->success values
@@ -403,7 +318,7 @@ static const uint8 DamageTypeUnknown = 0xFF;
** **
** (indexed by 'Skill' of SkillUseTypes) ** (indexed by 'Skill' of SkillUseTypes)
*/ */
static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated static const uint8 SkillDamageTypes[EQ::skills::HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated
{ {
/*1HBlunt*/ 0, /*1HBlunt*/ 0,
/*1HSlashing*/ 1, /*1HSlashing*/ 1,
@@ -523,4 +438,30 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
static const uint32 MAX_SPELL_DB_ID_VAL = 65535; static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
enum ChatChannelNames : uint16
{
ChatChannel_Guild = 0,
ChatChannel_Group = 2,
ChatChannel_Shout = 3,
ChatChannel_Auction = 4,
ChatChannel_OOC = 5,
ChatChannel_Broadcast = 6,
ChatChannel_Tell = 7,
ChatChannel_Say = 8,
ChatChannel_Petition = 10,
ChatChannel_GMSAY = 11,
ChatChannel_TellEcho = 14,
ChatChannel_Raid = 15,
ChatChannel_UNKNOWN_Guild = 17,
ChatChannel_UNKNOWN_GMSAY = 18,
ChatChannel_UCSRelay = 20,
ChatChannel_Emotes = 22
};
namespace ZoneBlockedSpellTypes {
const uint8 ZoneWide = 1;
const uint8 Region = 2;
};
#endif /*COMMON_EQ_CONSTANTS_H*/ #endif /*COMMON_EQ_CONSTANTS_H*/
+168 -168
View File
@@ -25,7 +25,7 @@
static bool global_dictionary_init = false; static bool global_dictionary_init = false;
void EQEmu::InitializeDynamicLookups() { void EQ::InitializeDynamicLookups() {
if (global_dictionary_init == true) if (global_dictionary_init == true)
return; return;
@@ -37,12 +37,12 @@ void EQEmu::InitializeDynamicLookups() {
global_dictionary_init = true; global_dictionary_init = true;
} }
static std::unique_ptr<EQEmu::constants::LookupEntry> constants_dynamic_nongm_lookup_entries[EQEmu::versions::ClientVersionCount]; static std::unique_ptr<EQ::constants::LookupEntry> constants_dynamic_nongm_lookup_entries[EQ::versions::ClientVersionCount];
static std::unique_ptr<EQEmu::constants::LookupEntry> constants_dynamic_gm_lookup_entries[EQEmu::versions::ClientVersionCount]; static std::unique_ptr<EQ::constants::LookupEntry> constants_dynamic_gm_lookup_entries[EQ::versions::ClientVersionCount];
static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu::versions::ClientVersionCount] = static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::versions::ClientVersionCount] =
{ {
/*[ClientVersion::Unknown] =*/ /*[ClientVersion::Unknown] =*/
EQEmu::constants::LookupEntry( EQ::constants::LookupEntry(
ClientUnknown::constants::EXPANSION, ClientUnknown::constants::EXPANSION,
ClientUnknown::constants::EXPANSION_BIT, ClientUnknown::constants::EXPANSION_BIT,
ClientUnknown::constants::EXPANSIONS_MASK, ClientUnknown::constants::EXPANSIONS_MASK,
@@ -50,7 +50,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
ClientUnknown::INULL ClientUnknown::INULL
), ),
/*[ClientVersion::Client62] =*/ /*[ClientVersion::Client62] =*/
EQEmu::constants::LookupEntry( EQ::constants::LookupEntry(
Client62::constants::EXPANSION, Client62::constants::EXPANSION,
Client62::constants::EXPANSION_BIT, Client62::constants::EXPANSION_BIT,
Client62::constants::EXPANSIONS_MASK, Client62::constants::EXPANSIONS_MASK,
@@ -58,7 +58,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
Client62::INULL Client62::INULL
), ),
/*[ClientVersion::Titanium] =*/ /*[ClientVersion::Titanium] =*/
EQEmu::constants::LookupEntry( EQ::constants::LookupEntry(
Titanium::constants::EXPANSION, Titanium::constants::EXPANSION,
Titanium::constants::EXPANSION_BIT, Titanium::constants::EXPANSION_BIT,
Titanium::constants::EXPANSIONS_MASK, Titanium::constants::EXPANSIONS_MASK,
@@ -66,7 +66,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
Titanium::constants::SAY_LINK_BODY_SIZE Titanium::constants::SAY_LINK_BODY_SIZE
), ),
/*[ClientVersion::SoF] =*/ /*[ClientVersion::SoF] =*/
EQEmu::constants::LookupEntry( EQ::constants::LookupEntry(
SoF::constants::EXPANSION, SoF::constants::EXPANSION,
SoF::constants::EXPANSION_BIT, SoF::constants::EXPANSION_BIT,
SoF::constants::EXPANSIONS_MASK, SoF::constants::EXPANSIONS_MASK,
@@ -74,7 +74,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
SoF::constants::SAY_LINK_BODY_SIZE SoF::constants::SAY_LINK_BODY_SIZE
), ),
/*[ClientVersion::SoD] =*/ /*[ClientVersion::SoD] =*/
EQEmu::constants::LookupEntry( EQ::constants::LookupEntry(
SoD::constants::EXPANSION, SoD::constants::EXPANSION,
SoD::constants::EXPANSION_BIT, SoD::constants::EXPANSION_BIT,
SoD::constants::EXPANSIONS_MASK, SoD::constants::EXPANSIONS_MASK,
@@ -82,7 +82,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
SoD::constants::SAY_LINK_BODY_SIZE SoD::constants::SAY_LINK_BODY_SIZE
), ),
/*[ClientVersion::UF] =*/ /*[ClientVersion::UF] =*/
EQEmu::constants::LookupEntry( EQ::constants::LookupEntry(
UF::constants::EXPANSION, UF::constants::EXPANSION,
UF::constants::EXPANSION_BIT, UF::constants::EXPANSION_BIT,
UF::constants::EXPANSIONS_MASK, UF::constants::EXPANSIONS_MASK,
@@ -90,7 +90,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
UF::constants::SAY_LINK_BODY_SIZE UF::constants::SAY_LINK_BODY_SIZE
), ),
/*[ClientVersion::RoF] =*/ /*[ClientVersion::RoF] =*/
EQEmu::constants::LookupEntry( EQ::constants::LookupEntry(
RoF::constants::EXPANSION, RoF::constants::EXPANSION,
RoF::constants::EXPANSION_BIT, RoF::constants::EXPANSION_BIT,
RoF::constants::EXPANSIONS_MASK, RoF::constants::EXPANSIONS_MASK,
@@ -98,7 +98,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
RoF::constants::SAY_LINK_BODY_SIZE RoF::constants::SAY_LINK_BODY_SIZE
), ),
/*[ClientVersion::RoF2] =*/ /*[ClientVersion::RoF2] =*/
EQEmu::constants::LookupEntry( EQ::constants::LookupEntry(
RoF2::constants::EXPANSION, RoF2::constants::EXPANSION,
RoF2::constants::EXPANSION_BIT, RoF2::constants::EXPANSION_BIT,
RoF2::constants::EXPANSIONS_MASK, RoF2::constants::EXPANSIONS_MASK,
@@ -108,7 +108,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
}; };
static bool constants_dictionary_init = false; static bool constants_dictionary_init = false;
void EQEmu::constants::InitializeDynamicLookups() { void EQ::constants::InitializeDynamicLookups() {
if (constants_dictionary_init == true) if (constants_dictionary_init == true)
return; return;
constants_dictionary_init = true; constants_dictionary_init = true;
@@ -119,7 +119,7 @@ void EQEmu::constants::InitializeDynamicLookups() {
// use static references for now // use static references for now
} }
const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicLookup(versions::ClientVersion client_version, bool gm_flag) const EQ::constants::LookupEntry* EQ::constants::DynamicLookup(versions::ClientVersion client_version, bool gm_flag)
{ {
if (gm_flag) if (gm_flag)
return DynamicGMLookup(client_version); return DynamicGMLookup(client_version);
@@ -127,7 +127,7 @@ const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicLookup(versions::C
return DynamicNonGMLookup(client_version); return DynamicNonGMLookup(client_version);
} }
const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicNonGMLookup(versions::ClientVersion client_version) const EQ::constants::LookupEntry* EQ::constants::DynamicNonGMLookup(versions::ClientVersion client_version)
{ {
client_version = versions::ValidateClientVersion(client_version); client_version = versions::ValidateClientVersion(client_version);
if (constants_dynamic_nongm_lookup_entries[static_cast<int>(client_version)]) if (constants_dynamic_nongm_lookup_entries[static_cast<int>(client_version)])
@@ -136,7 +136,7 @@ const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicNonGMLookup(versio
return &constants_static_lookup_entries[static_cast<int>(client_version)]; return &constants_static_lookup_entries[static_cast<int>(client_version)];
} }
const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicGMLookup(versions::ClientVersion client_version) const EQ::constants::LookupEntry* EQ::constants::DynamicGMLookup(versions::ClientVersion client_version)
{ {
client_version = versions::ValidateClientVersion(client_version); client_version = versions::ValidateClientVersion(client_version);
if (constants_dynamic_gm_lookup_entries[static_cast<int>(client_version)]) if (constants_dynamic_gm_lookup_entries[static_cast<int>(client_version)])
@@ -145,18 +145,18 @@ const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicGMLookup(versions:
return &constants_static_lookup_entries[static_cast<int>(client_version)]; return &constants_static_lookup_entries[static_cast<int>(client_version)];
} }
const EQEmu::constants::LookupEntry* EQEmu::constants::StaticLookup(versions::ClientVersion client_version) const EQ::constants::LookupEntry* EQ::constants::StaticLookup(versions::ClientVersion client_version)
{ {
return &constants_static_lookup_entries[static_cast<int>(versions::ValidateClientVersion(client_version))]; return &constants_static_lookup_entries[static_cast<int>(versions::ValidateClientVersion(client_version))];
} }
static std::unique_ptr<EQEmu::inventory::LookupEntry> inventory_dynamic_nongm_lookup_entries[EQEmu::versions::MobVersionCount]; static std::unique_ptr<EQ::inventory::LookupEntry> inventory_dynamic_nongm_lookup_entries[EQ::versions::MobVersionCount];
static std::unique_ptr<EQEmu::inventory::LookupEntry> inventory_dynamic_gm_lookup_entries[EQEmu::versions::MobVersionCount]; static std::unique_ptr<EQ::inventory::LookupEntry> inventory_dynamic_gm_lookup_entries[EQ::versions::MobVersionCount];
static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu::versions::MobVersionCount] = static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::versions::MobVersionCount] =
{ {
/*[MobVersion::Unknown] =*/ /*[MobVersion::Unknown] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
@@ -182,8 +182,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::Client62] =*/ /*[MobVersion::Client62] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
Client62::INULL, Client62::INULL, Client62::INULL, Client62::INULL, Client62::INULL, Client62::INULL,
Client62::INULL, Client62::INULL, Client62::INULL, Client62::INULL, Client62::INULL, Client62::INULL,
Client62::INULL, Client62::INULL, Client62::INULL, Client62::INULL, Client62::INULL, Client62::INULL,
@@ -209,9 +209,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::Titanium] =*/ /*[MobVersion::Titanium] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, Titanium::invtype::BANK_SIZE, Titanium::invtype::SHARED_BANK_SIZE, EQ::invtype::POSSESSIONS_SIZE, Titanium::invtype::BANK_SIZE, Titanium::invtype::SHARED_BANK_SIZE,
Titanium::invtype::TRADE_SIZE, Titanium::invtype::WORLD_SIZE, Titanium::invtype::LIMBO_SIZE, Titanium::invtype::TRADE_SIZE, Titanium::invtype::WORLD_SIZE, Titanium::invtype::LIMBO_SIZE,
Titanium::invtype::TRIBUTE_SIZE, Titanium::INULL, Titanium::invtype::GUILD_TRIBUTE_SIZE, Titanium::invtype::TRIBUTE_SIZE, Titanium::INULL, Titanium::invtype::GUILD_TRIBUTE_SIZE,
Titanium::invtype::MERCHANT_SIZE, Titanium::INULL, Titanium::invtype::CORPSE_SIZE, Titanium::invtype::MERCHANT_SIZE, Titanium::INULL, Titanium::invtype::CORPSE_SIZE,
@@ -236,9 +236,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
Titanium::inventory::AllowOverLevelEquipment Titanium::inventory::AllowOverLevelEquipment
), ),
/*[MobVersion::SoF] =*/ /*[MobVersion::SoF] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, SoF::invtype::BANK_SIZE, SoF::invtype::SHARED_BANK_SIZE, EQ::invtype::POSSESSIONS_SIZE, SoF::invtype::BANK_SIZE, SoF::invtype::SHARED_BANK_SIZE,
SoF::invtype::TRADE_SIZE, SoF::invtype::WORLD_SIZE, SoF::invtype::LIMBO_SIZE, SoF::invtype::TRADE_SIZE, SoF::invtype::WORLD_SIZE, SoF::invtype::LIMBO_SIZE,
SoF::invtype::TRIBUTE_SIZE, SoF::INULL, SoF::invtype::GUILD_TRIBUTE_SIZE, SoF::invtype::TRIBUTE_SIZE, SoF::INULL, SoF::invtype::GUILD_TRIBUTE_SIZE,
SoF::invtype::MERCHANT_SIZE, SoF::INULL, SoF::invtype::CORPSE_SIZE, SoF::invtype::MERCHANT_SIZE, SoF::INULL, SoF::invtype::CORPSE_SIZE,
@@ -263,9 +263,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
SoF::inventory::AllowOverLevelEquipment SoF::inventory::AllowOverLevelEquipment
), ),
/*[MobVersion::SoD] =*/ /*[MobVersion::SoD] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, SoD::invtype::BANK_SIZE, SoD::invtype::SHARED_BANK_SIZE, EQ::invtype::POSSESSIONS_SIZE, SoD::invtype::BANK_SIZE, SoD::invtype::SHARED_BANK_SIZE,
SoD::invtype::TRADE_SIZE, SoD::invtype::WORLD_SIZE, SoD::invtype::LIMBO_SIZE, SoD::invtype::TRADE_SIZE, SoD::invtype::WORLD_SIZE, SoD::invtype::LIMBO_SIZE,
SoD::invtype::TRIBUTE_SIZE, SoD::INULL, SoD::invtype::GUILD_TRIBUTE_SIZE, SoD::invtype::TRIBUTE_SIZE, SoD::INULL, SoD::invtype::GUILD_TRIBUTE_SIZE,
SoD::invtype::MERCHANT_SIZE, SoD::INULL, SoD::invtype::CORPSE_SIZE, SoD::invtype::MERCHANT_SIZE, SoD::INULL, SoD::invtype::CORPSE_SIZE,
@@ -290,9 +290,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
SoD::inventory::AllowOverLevelEquipment SoD::inventory::AllowOverLevelEquipment
), ),
/*[MobVersion::UF] =*/ /*[MobVersion::UF] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, UF::invtype::BANK_SIZE, UF::invtype::SHARED_BANK_SIZE, EQ::invtype::POSSESSIONS_SIZE, UF::invtype::BANK_SIZE, UF::invtype::SHARED_BANK_SIZE,
UF::invtype::TRADE_SIZE, UF::invtype::WORLD_SIZE, UF::invtype::LIMBO_SIZE, UF::invtype::TRADE_SIZE, UF::invtype::WORLD_SIZE, UF::invtype::LIMBO_SIZE,
UF::invtype::TRIBUTE_SIZE, UF::INULL, UF::invtype::GUILD_TRIBUTE_SIZE, UF::invtype::TRIBUTE_SIZE, UF::INULL, UF::invtype::GUILD_TRIBUTE_SIZE,
UF::invtype::MERCHANT_SIZE, UF::INULL, UF::invtype::CORPSE_SIZE, UF::invtype::MERCHANT_SIZE, UF::INULL, UF::invtype::CORPSE_SIZE,
@@ -317,9 +317,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
UF::inventory::AllowOverLevelEquipment UF::inventory::AllowOverLevelEquipment
), ),
/*[MobVersion::RoF] =*/ /*[MobVersion::RoF] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, RoF::invtype::BANK_SIZE, RoF::invtype::SHARED_BANK_SIZE, EQ::invtype::POSSESSIONS_SIZE, RoF::invtype::BANK_SIZE, RoF::invtype::SHARED_BANK_SIZE,
RoF::invtype::TRADE_SIZE, RoF::invtype::WORLD_SIZE, RoF::invtype::LIMBO_SIZE, RoF::invtype::TRADE_SIZE, RoF::invtype::WORLD_SIZE, RoF::invtype::LIMBO_SIZE,
RoF::invtype::TRIBUTE_SIZE, RoF::invtype::TROPHY_TRIBUTE_SIZE, RoF::invtype::GUILD_TRIBUTE_SIZE, RoF::invtype::TRIBUTE_SIZE, RoF::invtype::TROPHY_TRIBUTE_SIZE, RoF::invtype::GUILD_TRIBUTE_SIZE,
RoF::invtype::MERCHANT_SIZE, RoF::invtype::DELETED_SIZE, RoF::invtype::CORPSE_SIZE, RoF::invtype::MERCHANT_SIZE, RoF::invtype::DELETED_SIZE, RoF::invtype::CORPSE_SIZE,
@@ -344,9 +344,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
RoF::inventory::AllowOverLevelEquipment RoF::inventory::AllowOverLevelEquipment
), ),
/*[MobVersion::RoF2] =*/ /*[MobVersion::RoF2] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, RoF2::invtype::BANK_SIZE, RoF2::invtype::SHARED_BANK_SIZE, EQ::invtype::POSSESSIONS_SIZE, RoF2::invtype::BANK_SIZE, RoF2::invtype::SHARED_BANK_SIZE,
RoF2::invtype::TRADE_SIZE, RoF2::invtype::WORLD_SIZE, RoF2::invtype::LIMBO_SIZE, RoF2::invtype::TRADE_SIZE, RoF2::invtype::WORLD_SIZE, RoF2::invtype::LIMBO_SIZE,
RoF2::invtype::TRIBUTE_SIZE, RoF2::invtype::TROPHY_TRIBUTE_SIZE, RoF2::invtype::GUILD_TRIBUTE_SIZE, RoF2::invtype::TRIBUTE_SIZE, RoF2::invtype::TROPHY_TRIBUTE_SIZE, RoF2::invtype::GUILD_TRIBUTE_SIZE,
RoF2::invtype::MERCHANT_SIZE, RoF2::invtype::DELETED_SIZE, RoF2::invtype::CORPSE_SIZE, RoF2::invtype::MERCHANT_SIZE, RoF2::invtype::DELETED_SIZE, RoF2::invtype::CORPSE_SIZE,
@@ -371,9 +371,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
RoF2::inventory::AllowOverLevelEquipment RoF2::inventory::AllowOverLevelEquipment
), ),
/*[MobVersion::NPC] =*/ /*[MobVersion::NPC] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EQ::invtype::POSSESSIONS_SIZE, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
EntityLimits::NPC::invtype::TRADE_SIZE, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::invtype::TRADE_SIZE, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, /*InvTypeCorpseSize,*/ EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, /*InvTypeCorpseSize,*/
@@ -389,8 +389,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false, false,
false, false,
@@ -398,9 +398,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::NPCMerchant] =*/ /*[MobVersion::NPCMerchant] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::invtype::TRADE_SIZE, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::invtype::TRADE_SIZE, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, /*InvTypeCorpseSize,*/ EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, /*InvTypeCorpseSize,*/
@@ -416,8 +416,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false, false,
false, false,
@@ -425,9 +425,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::Merc] =*/ /*[MobVersion::Merc] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
EntityLimits::Merc::invtype::TRADE_SIZE, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::invtype::TRADE_SIZE, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, /*InvTypeCorpseSize,*/ EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, /*InvTypeCorpseSize,*/
@@ -443,8 +443,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false, false,
false, false,
@@ -452,9 +452,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::Bot] =*/ /*[MobVersion::Bot] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
EntityLimits::Bot::invtype::TRADE_SIZE, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::invtype::TRADE_SIZE, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, /*InvTypeCorpseSize,*/ EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, /*InvTypeCorpseSize,*/
@@ -470,8 +470,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::Bot::invslot::CURSOR_BITMASK, EntityLimits::Bot::invslot::CURSOR_BITMASK,
EntityLimits::Bot::invslot::POSSESSIONS_BITMASK, EntityLimits::Bot::invslot::POSSESSIONS_BITMASK,
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
EQEmu::invaug::SOCKET_COUNT, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/ EQ::invaug::SOCKET_COUNT, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false, false,
false, false,
@@ -479,9 +479,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::ClientPet] =*/ /*[MobVersion::ClientPet] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::invtype::TRADE_SIZE, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::invtype::TRADE_SIZE, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, /*InvTypeCorpseSize,*/ EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, /*InvTypeCorpseSize,*/
@@ -497,8 +497,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false, false,
false, false,
@@ -506,9 +506,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::NPCPet] =*/ /*[MobVersion::NPCPet] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::invtype::TRADE_SIZE, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::invtype::TRADE_SIZE, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, /*InvTypeCorpseSize,*/ EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, /*InvTypeCorpseSize,*/
@@ -524,8 +524,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false, false,
false, false,
@@ -533,9 +533,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::MercPet] =*/ /*[MobVersion::MercPet] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
EntityLimits::MercPet::invtype::TRADE_SIZE, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::invtype::TRADE_SIZE, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, /*InvTypeCorpseSize,*/ EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, /*InvTypeCorpseSize,*/
@@ -551,8 +551,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false, false,
false, false,
@@ -560,9 +560,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::BotPet] =*/ /*[MobVersion::BotPet] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
EntityLimits::BotPet::invtype::TRADE_SIZE, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::invtype::TRADE_SIZE, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, /*InvTypeCorpseSize,*/ EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, /*InvTypeCorpseSize,*/
@@ -578,8 +578,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ 0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/ 0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false, false,
false, false,
@@ -587,8 +587,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::OfflineTitanium] =*/ /*[MobVersion::OfflineTitanium] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
Titanium::INULL, Titanium::INULL, Titanium::INULL, Titanium::INULL, Titanium::INULL, Titanium::INULL,
Titanium::invtype::TRADE_SIZE, Titanium::INULL, Titanium::INULL, Titanium::invtype::TRADE_SIZE, Titanium::INULL, Titanium::INULL,
Titanium::INULL, Titanium::INULL, Titanium::INULL, Titanium::INULL, Titanium::INULL, Titanium::INULL,
@@ -614,8 +614,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::OfflineSoF] =*/ /*[MobVersion::OfflineSoF] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
SoF::INULL, SoF::INULL, SoF::INULL, SoF::INULL, SoF::INULL, SoF::INULL,
SoF::invtype::TRADE_SIZE, SoF::INULL, SoF::INULL, SoF::invtype::TRADE_SIZE, SoF::INULL, SoF::INULL,
SoF::INULL, SoF::INULL, SoF::INULL, SoF::INULL, SoF::INULL, SoF::INULL,
@@ -641,8 +641,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::OfflineSoD] =*/ /*[MobVersion::OfflineSoD] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
SoD::INULL, SoD::INULL, SoD::INULL, SoD::INULL, SoD::INULL, SoD::INULL,
SoD::invtype::TRADE_SIZE, SoD::INULL, SoD::INULL, SoD::invtype::TRADE_SIZE, SoD::INULL, SoD::INULL,
SoD::INULL, SoD::INULL, SoD::INULL, SoD::INULL, SoD::INULL, SoD::INULL,
@@ -668,8 +668,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::OfflineUF] =*/ /*[MobVersion::OfflineUF] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
UF::INULL, UF::INULL, UF::INULL, UF::INULL, UF::INULL, UF::INULL,
UF::invtype::TRADE_SIZE, UF::INULL, UF::INULL, UF::invtype::TRADE_SIZE, UF::INULL, UF::INULL,
UF::INULL, UF::INULL, UF::INULL, UF::INULL, UF::INULL, UF::INULL,
@@ -695,8 +695,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::OfflineRoF] =*/ /*[MobVersion::OfflineRoF] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
RoF::INULL, RoF::INULL, RoF::INULL, RoF::INULL, RoF::INULL, RoF::INULL,
RoF::invtype::TRADE_SIZE, RoF::INULL, RoF::INULL, RoF::invtype::TRADE_SIZE, RoF::INULL, RoF::INULL,
RoF::INULL, RoF::INULL, RoF::INULL, RoF::INULL, RoF::INULL, RoF::INULL,
@@ -722,8 +722,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false false
), ),
/*[MobVersion::OfflineRoF2] =*/ /*[MobVersion::OfflineRoF2] =*/
EQEmu::inventory::LookupEntry( EQ::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct( EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
RoF2::INULL, RoF2::INULL, RoF2::INULL, RoF2::INULL, RoF2::INULL, RoF2::INULL,
RoF2::invtype::TRADE_SIZE, RoF2::INULL, RoF2::INULL, RoF2::invtype::TRADE_SIZE, RoF2::INULL, RoF2::INULL,
RoF2::INULL, RoF2::INULL, RoF2::INULL, RoF2::INULL, RoF2::INULL, RoF2::INULL,
@@ -751,7 +751,7 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
}; };
static bool inventory_dictionary_init = false; static bool inventory_dictionary_init = false;
void EQEmu::inventory::InitializeDynamicLookups() { void EQ::inventory::InitializeDynamicLookups() {
if (inventory_dictionary_init == true) if (inventory_dictionary_init == true)
return; return;
inventory_dictionary_init = true; inventory_dictionary_init = true;
@@ -774,9 +774,9 @@ void EQEmu::inventory::InitializeDynamicLookups() {
const uint32 dynamic_check_mask = const uint32 dynamic_check_mask =
( (
EQEmu::expansions::bitPoR | EQ::expansions::bitPoR |
EQEmu::expansions::bitTBS | EQ::expansions::bitTBS |
EQEmu::expansions::bitHoT EQ::expansions::bitHoT
); );
// if all of the above expansion bits are present, then static references will suffice // if all of the above expansion bits are present, then static references will suffice
@@ -784,7 +784,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
return; return;
// Dynamic Lookups (promotive methodology) (all mob versions allowed) // Dynamic Lookups (promotive methodology) (all mob versions allowed)
for (uint32 iter = static_cast<uint32>(EQEmu::versions::MobVersion::Unknown); iter <= static_cast<uint32>(EQEmu::versions::LastPCMobVersion); ++iter) { for (uint32 iter = static_cast<uint32>(EQ::versions::MobVersion::Unknown); iter <= static_cast<uint32>(EQ::versions::LastPCMobVersion); ++iter) {
// no need to dynamic this condition since it is the lowest compatibility standard // no need to dynamic this condition since it is the lowest compatibility standard
if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask) if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask)
continue; continue;
@@ -803,21 +803,21 @@ void EQEmu::inventory::InitializeDynamicLookups() {
inventory_dynamic_nongm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later inventory_dynamic_nongm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later
inventory_dynamic_nongm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later inventory_dynamic_nongm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later
if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitPoR) { if (RuleI(World, ExpansionSettings) & EQ::expansions::bitPoR) {
// update bank size // update bank size
if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitPoR) if (constants_static_lookup_entries[iter].ExpansionsMask & EQ::expansions::bitPoR)
inventory_dynamic_nongm_lookup_entries[iter]->InventoryTypeSize.Bank = SoF::invtype::BANK_SIZE; inventory_dynamic_nongm_lookup_entries[iter]->InventoryTypeSize.Bank = SoF::invtype::BANK_SIZE;
} }
if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitTBS) { if (RuleI(World, ExpansionSettings) & EQ::expansions::bitTBS) {
// update power source // update power source
if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitTBS) if (constants_static_lookup_entries[iter].ExpansionsMask & EQ::expansions::bitTBS)
inventory_dynamic_nongm_lookup_entries[iter]->EquipmentBitmask = SoF::invslot::EQUIPMENT_BITMASK; inventory_dynamic_nongm_lookup_entries[iter]->EquipmentBitmask = SoF::invslot::EQUIPMENT_BITMASK;
} }
if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitHoT) { if (RuleI(World, ExpansionSettings) & EQ::expansions::bitHoT) {
// update general size // update general size
if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitHoT) if (constants_static_lookup_entries[iter].ExpansionsMask & EQ::expansions::bitHoT)
inventory_dynamic_nongm_lookup_entries[iter]->GeneralBitmask = RoF::invslot::GENERAL_BITMASK; inventory_dynamic_nongm_lookup_entries[iter]->GeneralBitmask = RoF::invslot::GENERAL_BITMASK;
} }
@@ -841,7 +841,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
} }
// Dynamic GM Lookups (demotive methodology) (client-linked mob versions only) // Dynamic GM Lookups (demotive methodology) (client-linked mob versions only)
for (uint32 iter = static_cast<uint32>(EQEmu::versions::MobVersion::Unknown); iter <= static_cast<uint32>(EQEmu::versions::LastPCMobVersion); ++iter) { for (uint32 iter = static_cast<uint32>(EQ::versions::MobVersion::Unknown); iter <= static_cast<uint32>(EQ::versions::LastPCMobVersion); ++iter) {
// no need to dynamic this condition since it is the lowest compatibility standard // no need to dynamic this condition since it is the lowest compatibility standard
if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask) if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask)
continue; continue;
@@ -869,13 +869,13 @@ void EQEmu::inventory::InitializeDynamicLookups() {
inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later
inventory_dynamic_gm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later inventory_dynamic_gm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later
if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitPoR) { if (~RuleI(World, ExpansionSettings) & EQ::expansions::bitPoR) {
// update bank size // update bank size
if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitPoR) if (constants_static_lookup_entries[iter].ExpansionsMask & EQ::expansions::bitPoR)
inventory_dynamic_gm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE; inventory_dynamic_gm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE;
} }
if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitTBS) { if (~RuleI(World, ExpansionSettings) & EQ::expansions::bitTBS) {
// update power source // update power source
switch (iter) { switch (iter) {
case versions::bitUF: case versions::bitUF:
@@ -890,7 +890,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
} }
} }
if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitHoT) { if (~RuleI(World, ExpansionSettings) & EQ::expansions::bitHoT) {
// update general size // update general size
switch (iter) { switch (iter) {
case versions::bitUF: case versions::bitUF:
@@ -927,7 +927,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
// only client versions that require a change from their static definitions have been given a dynamic (gm) lookup entry // only client versions that require a change from their static definitions have been given a dynamic (gm) lookup entry
} }
const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicLookup(versions::MobVersion mob_version, bool gm_flag) const EQ::inventory::LookupEntry* EQ::inventory::DynamicLookup(versions::MobVersion mob_version, bool gm_flag)
{ {
if (gm_flag) if (gm_flag)
return DynamicGMLookup(mob_version); return DynamicGMLookup(mob_version);
@@ -935,7 +935,7 @@ const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicLookup(versions::M
return DynamicNonGMLookup(mob_version); return DynamicNonGMLookup(mob_version);
} }
const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicNonGMLookup(versions::MobVersion mob_version) const EQ::inventory::LookupEntry* EQ::inventory::DynamicNonGMLookup(versions::MobVersion mob_version)
{ {
mob_version = versions::ValidateMobVersion(mob_version); mob_version = versions::ValidateMobVersion(mob_version);
if (inventory_dynamic_nongm_lookup_entries[static_cast<int>(mob_version)]) if (inventory_dynamic_nongm_lookup_entries[static_cast<int>(mob_version)])
@@ -944,7 +944,7 @@ const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicNonGMLookup(versio
return &inventory_static_lookup_entries[static_cast<int>(mob_version)]; return &inventory_static_lookup_entries[static_cast<int>(mob_version)];
} }
const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicGMLookup(versions::MobVersion mob_version) const EQ::inventory::LookupEntry* EQ::inventory::DynamicGMLookup(versions::MobVersion mob_version)
{ {
mob_version = versions::ValidateMobVersion(mob_version); mob_version = versions::ValidateMobVersion(mob_version);
if (inventory_dynamic_gm_lookup_entries[static_cast<int>(mob_version)]) if (inventory_dynamic_gm_lookup_entries[static_cast<int>(mob_version)])
@@ -953,107 +953,107 @@ const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicGMLookup(versions:
return &inventory_static_lookup_entries[static_cast<int>(mob_version)]; return &inventory_static_lookup_entries[static_cast<int>(mob_version)];
} }
const EQEmu::inventory::LookupEntry* EQEmu::inventory::StaticLookup(versions::MobVersion mob_version) const EQ::inventory::LookupEntry* EQ::inventory::StaticLookup(versions::MobVersion mob_version)
{ {
return &inventory_static_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))]; return &inventory_static_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
} }
static std::unique_ptr<EQEmu::behavior::LookupEntry> behavior_dynamic_nongm_lookup_entries[EQEmu::versions::MobVersionCount]; static std::unique_ptr<EQ::behavior::LookupEntry> behavior_dynamic_nongm_lookup_entries[EQ::versions::MobVersionCount];
static std::unique_ptr<EQEmu::behavior::LookupEntry> behavior_dynamic_gm_lookup_entries[EQEmu::versions::MobVersionCount]; static std::unique_ptr<EQ::behavior::LookupEntry> behavior_dynamic_gm_lookup_entries[EQ::versions::MobVersionCount];
static const EQEmu::behavior::LookupEntry behavior_static_lookup_entries[EQEmu::versions::MobVersionCount] = static const EQ::behavior::LookupEntry behavior_static_lookup_entries[EQ::versions::MobVersionCount] =
{ {
/*[MobVersion::Unknown] =*/ /*[MobVersion::Unknown] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
true true
), ),
/*[MobVersion::Client62] =*/ /*[MobVersion::Client62] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
true true
), ),
/*[MobVersion::Titanium] =*/ /*[MobVersion::Titanium] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
Titanium::behavior::CoinHasWeight Titanium::behavior::CoinHasWeight
), ),
/*[MobVersion::SoF] =*/ /*[MobVersion::SoF] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
SoF::behavior::CoinHasWeight SoF::behavior::CoinHasWeight
), ),
/*[MobVersion::SoD] =*/ /*[MobVersion::SoD] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
SoD::behavior::CoinHasWeight SoD::behavior::CoinHasWeight
), ),
/*[MobVersion::UF] =*/ /*[MobVersion::UF] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
UF::behavior::CoinHasWeight UF::behavior::CoinHasWeight
), ),
/*[MobVersion::RoF] =*/ /*[MobVersion::RoF] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
RoF::behavior::CoinHasWeight RoF::behavior::CoinHasWeight
), ),
/*[MobVersion::RoF2] =*/ /*[MobVersion::RoF2] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
RoF2::behavior::CoinHasWeight RoF2::behavior::CoinHasWeight
), ),
/*[MobVersion::NPC] =*/ /*[MobVersion::NPC] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight EQ::behavior::CoinHasWeight
), ),
/*[MobVersion::NPCMerchant] =*/ /*[MobVersion::NPCMerchant] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight EQ::behavior::CoinHasWeight
), ),
/*[MobVersion::Merc] =*/ /*[MobVersion::Merc] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight EQ::behavior::CoinHasWeight
), ),
/*[MobVersion::Bot] =*/ /*[MobVersion::Bot] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight EQ::behavior::CoinHasWeight
), ),
/*[MobVersion::ClientPet] =*/ /*[MobVersion::ClientPet] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight EQ::behavior::CoinHasWeight
), ),
/*[MobVersion::NPCPet] =*/ /*[MobVersion::NPCPet] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight EQ::behavior::CoinHasWeight
), ),
/*[MobVersion::MercPet] =*/ /*[MobVersion::MercPet] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight EQ::behavior::CoinHasWeight
), ),
/*[MobVersion::BotPet] =*/ /*[MobVersion::BotPet] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight EQ::behavior::CoinHasWeight
), ),
/*[MobVersion::OfflineTitanium] =*/ /*[MobVersion::OfflineTitanium] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
Titanium::behavior::CoinHasWeight Titanium::behavior::CoinHasWeight
), ),
/*[MobVersion::OfflineSoF] =*/ /*[MobVersion::OfflineSoF] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
SoF::behavior::CoinHasWeight SoF::behavior::CoinHasWeight
), ),
/*[MobVersion::OfflineSoD] =*/ /*[MobVersion::OfflineSoD] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
SoD::behavior::CoinHasWeight SoD::behavior::CoinHasWeight
), ),
/*[MobVersion::OfflineUF] =*/ /*[MobVersion::OfflineUF] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
UF::behavior::CoinHasWeight UF::behavior::CoinHasWeight
), ),
/*[MobVersion::OfflineRoF] =*/ /*[MobVersion::OfflineRoF] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
RoF::behavior::CoinHasWeight RoF::behavior::CoinHasWeight
), ),
/*[MobVersion::OfflineRoF2] =*/ /*[MobVersion::OfflineRoF2] =*/
EQEmu::behavior::LookupEntry( EQ::behavior::LookupEntry(
RoF2::behavior::CoinHasWeight RoF2::behavior::CoinHasWeight
) )
}; };
static bool behavior_dictionary_init = false; static bool behavior_dictionary_init = false;
void EQEmu::behavior::InitializeDynamicLookups() { void EQ::behavior::InitializeDynamicLookups() {
if (behavior_dictionary_init == true) if (behavior_dictionary_init == true)
return; return;
behavior_dictionary_init = true; behavior_dictionary_init = true;
@@ -1064,7 +1064,7 @@ void EQEmu::behavior::InitializeDynamicLookups() {
// use static references for now // use static references for now
} }
const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicLookup(versions::MobVersion mob_version, bool gm_flag) const EQ::behavior::LookupEntry* EQ::behavior::DynamicLookup(versions::MobVersion mob_version, bool gm_flag)
{ {
if (gm_flag) if (gm_flag)
return DynamicGMLookup(mob_version); return DynamicGMLookup(mob_version);
@@ -1072,7 +1072,7 @@ const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicLookup(versions::Mob
return DynamicNonGMLookup(mob_version); return DynamicNonGMLookup(mob_version);
} }
const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicNonGMLookup(versions::MobVersion mob_version) const EQ::behavior::LookupEntry* EQ::behavior::DynamicNonGMLookup(versions::MobVersion mob_version)
{ {
mob_version = versions::ValidateMobVersion(mob_version); mob_version = versions::ValidateMobVersion(mob_version);
if (behavior_dynamic_nongm_lookup_entries[static_cast<int>(mob_version)]) if (behavior_dynamic_nongm_lookup_entries[static_cast<int>(mob_version)])
@@ -1081,7 +1081,7 @@ const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicNonGMLookup(versions
return &behavior_static_lookup_entries[static_cast<int>(mob_version)]; return &behavior_static_lookup_entries[static_cast<int>(mob_version)];
} }
const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicGMLookup(versions::MobVersion mob_version) const EQ::behavior::LookupEntry* EQ::behavior::DynamicGMLookup(versions::MobVersion mob_version)
{ {
mob_version = versions::ValidateMobVersion(mob_version); mob_version = versions::ValidateMobVersion(mob_version);
if (behavior_dynamic_gm_lookup_entries[static_cast<int>(mob_version)]) if (behavior_dynamic_gm_lookup_entries[static_cast<int>(mob_version)])
@@ -1090,17 +1090,17 @@ const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicGMLookup(versions::M
return &behavior_static_lookup_entries[static_cast<int>(mob_version)]; return &behavior_static_lookup_entries[static_cast<int>(mob_version)];
} }
const EQEmu::behavior::LookupEntry* EQEmu::behavior::StaticLookup(versions::MobVersion mob_version) const EQ::behavior::LookupEntry* EQ::behavior::StaticLookup(versions::MobVersion mob_version)
{ {
return &behavior_static_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))]; return &behavior_static_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
} }
static std::unique_ptr<EQEmu::spells::LookupEntry> spells_dynamic_nongm_lookup_entries[EQEmu::versions::ClientVersionCount]; static std::unique_ptr<EQ::spells::LookupEntry> spells_dynamic_nongm_lookup_entries[EQ::versions::ClientVersionCount];
static std::unique_ptr<EQEmu::spells::LookupEntry> spells_dynamic_gm_lookup_entries[EQEmu::versions::ClientVersionCount]; static std::unique_ptr<EQ::spells::LookupEntry> spells_dynamic_gm_lookup_entries[EQ::versions::ClientVersionCount];
static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::versions::ClientVersionCount] = static const EQ::spells::LookupEntry spells_static_lookup_entries[EQ::versions::ClientVersionCount] =
{ {
/*[ClientVersion::Unknown] =*/ /*[ClientVersion::Unknown] =*/
EQEmu::spells::LookupEntry( EQ::spells::LookupEntry(
ClientUnknown::INULL, ClientUnknown::INULL,
ClientUnknown::INULL, ClientUnknown::INULL,
ClientUnknown::INULL, ClientUnknown::INULL,
@@ -1113,7 +1113,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
ClientUnknown::INULL ClientUnknown::INULL
), ),
/*[ClientVersion::Client62] =*/ /*[ClientVersion::Client62] =*/
EQEmu::spells::LookupEntry( EQ::spells::LookupEntry(
Client62::INULL, Client62::INULL,
Client62::INULL, Client62::INULL,
Client62::INULL, Client62::INULL,
@@ -1126,7 +1126,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
Client62::INULL Client62::INULL
), ),
/*[ClientVersion::Titanium] =*/ /*[ClientVersion::Titanium] =*/
EQEmu::spells::LookupEntry( EQ::spells::LookupEntry(
Titanium::spells::SPELL_ID_MAX, Titanium::spells::SPELL_ID_MAX,
Titanium::spells::SPELLBOOK_SIZE, Titanium::spells::SPELLBOOK_SIZE,
Titanium::spells::SPELL_GEM_COUNT, Titanium::spells::SPELL_GEM_COUNT,
@@ -1139,7 +1139,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
Titanium::spells::MERC_BUFFS Titanium::spells::MERC_BUFFS
), ),
/*[ClientVersion::SoF] =*/ /*[ClientVersion::SoF] =*/
EQEmu::spells::LookupEntry( EQ::spells::LookupEntry(
SoF::spells::SPELL_ID_MAX, SoF::spells::SPELL_ID_MAX,
SoF::spells::SPELLBOOK_SIZE, SoF::spells::SPELLBOOK_SIZE,
SoF::spells::SPELL_GEM_COUNT, SoF::spells::SPELL_GEM_COUNT,
@@ -1152,7 +1152,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
SoF::spells::MERC_BUFFS SoF::spells::MERC_BUFFS
), ),
/*[ClientVersion::SoD] =*/ /*[ClientVersion::SoD] =*/
EQEmu::spells::LookupEntry( EQ::spells::LookupEntry(
SoD::spells::SPELL_ID_MAX, SoD::spells::SPELL_ID_MAX,
SoD::spells::SPELLBOOK_SIZE, SoD::spells::SPELLBOOK_SIZE,
SoD::spells::SPELL_GEM_COUNT, SoD::spells::SPELL_GEM_COUNT,
@@ -1165,7 +1165,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
SoD::spells::MERC_BUFFS SoD::spells::MERC_BUFFS
), ),
/*[ClientVersion::UF] =*/ /*[ClientVersion::UF] =*/
EQEmu::spells::LookupEntry( EQ::spells::LookupEntry(
UF::spells::SPELL_ID_MAX, UF::spells::SPELL_ID_MAX,
UF::spells::SPELLBOOK_SIZE, UF::spells::SPELLBOOK_SIZE,
UF::spells::SPELL_GEM_COUNT, UF::spells::SPELL_GEM_COUNT,
@@ -1178,7 +1178,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
UF::spells::MERC_BUFFS UF::spells::MERC_BUFFS
), ),
/*[ClientVersion::RoF] =*/ /*[ClientVersion::RoF] =*/
EQEmu::spells::LookupEntry( EQ::spells::LookupEntry(
RoF::spells::SPELL_ID_MAX, RoF::spells::SPELL_ID_MAX,
RoF::spells::SPELLBOOK_SIZE, RoF::spells::SPELLBOOK_SIZE,
UF::spells::SPELL_GEM_COUNT, // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case UF::spells::SPELL_GEM_COUNT, // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case
@@ -1191,7 +1191,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
RoF::spells::MERC_BUFFS RoF::spells::MERC_BUFFS
), ),
/*[ClientVersion::RoF2] =*/ /*[ClientVersion::RoF2] =*/
EQEmu::spells::LookupEntry( EQ::spells::LookupEntry(
RoF2::spells::SPELL_ID_MAX, RoF2::spells::SPELL_ID_MAX,
RoF2::spells::SPELLBOOK_SIZE, RoF2::spells::SPELLBOOK_SIZE,
UF::spells::SPELL_GEM_COUNT, // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case UF::spells::SPELL_GEM_COUNT, // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case
@@ -1206,7 +1206,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
}; };
static bool spells_dictionary_init = false; static bool spells_dictionary_init = false;
void EQEmu::spells::InitializeDynamicLookups() { void EQ::spells::InitializeDynamicLookups() {
if (spells_dictionary_init == true) if (spells_dictionary_init == true)
return; return;
spells_dictionary_init = true; spells_dictionary_init = true;
@@ -1217,7 +1217,7 @@ void EQEmu::spells::InitializeDynamicLookups() {
// use static references for now // use static references for now
} }
const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicLookup(versions::ClientVersion client_version, bool gm_flag) const EQ::spells::LookupEntry* EQ::spells::DynamicLookup(versions::ClientVersion client_version, bool gm_flag)
{ {
if (gm_flag) if (gm_flag)
return DynamicGMLookup(client_version); return DynamicGMLookup(client_version);
@@ -1225,7 +1225,7 @@ const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicLookup(versions::ClientV
return DynamicNonGMLookup(client_version); return DynamicNonGMLookup(client_version);
} }
const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicNonGMLookup(versions::ClientVersion client_version) const EQ::spells::LookupEntry* EQ::spells::DynamicNonGMLookup(versions::ClientVersion client_version)
{ {
client_version = versions::ValidateClientVersion(client_version); client_version = versions::ValidateClientVersion(client_version);
if (spells_dynamic_nongm_lookup_entries[static_cast<int>(client_version)]) if (spells_dynamic_nongm_lookup_entries[static_cast<int>(client_version)])
@@ -1234,7 +1234,7 @@ const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicNonGMLookup(versions::Cl
return &spells_static_lookup_entries[static_cast<int>(client_version)]; return &spells_static_lookup_entries[static_cast<int>(client_version)];
} }
const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicGMLookup(versions::ClientVersion client_version) const EQ::spells::LookupEntry* EQ::spells::DynamicGMLookup(versions::ClientVersion client_version)
{ {
client_version = versions::ValidateClientVersion(client_version); client_version = versions::ValidateClientVersion(client_version);
if (spells_dynamic_gm_lookup_entries[static_cast<int>(client_version)]) if (spells_dynamic_gm_lookup_entries[static_cast<int>(client_version)])
@@ -1243,7 +1243,7 @@ const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicGMLookup(versions::Clien
return &spells_static_lookup_entries[static_cast<int>(client_version)]; return &spells_static_lookup_entries[static_cast<int>(client_version)];
} }
const EQEmu::spells::LookupEntry* EQEmu::spells::StaticLookup(versions::ClientVersion client_version) const EQ::spells::LookupEntry* EQ::spells::StaticLookup(versions::ClientVersion client_version)
{ {
return &spells_static_lookup_entries[static_cast<int>(versions::ValidateClientVersion(client_version))]; return &spells_static_lookup_entries[static_cast<int>(versions::ValidateClientVersion(client_version))];
} }
+10 -10
View File
@@ -31,13 +31,13 @@
#include "../common/patches/rof2_limits.h" #include "../common/patches/rof2_limits.h"
namespace EQEmu namespace EQ
{ {
void InitializeDynamicLookups(); void InitializeDynamicLookups();
namespace constants { namespace constants {
struct LookupEntry { struct LookupEntry {
EQEmu::expansions::Expansion Expansion; EQ::expansions::Expansion Expansion;
uint32 ExpansionBit; uint32 ExpansionBit;
uint32 ExpansionsMask; uint32 ExpansionsMask;
int16 CharacterCreationLimit; int16 CharacterCreationLimit;
@@ -45,7 +45,7 @@ namespace EQEmu
LookupEntry(const LookupEntry *lookup_entry) { } LookupEntry(const LookupEntry *lookup_entry) { }
LookupEntry( LookupEntry(
EQEmu::expansions::Expansion Expansion, EQ::expansions::Expansion Expansion,
uint32 ExpansionBit, uint32 ExpansionBit,
uint32 ExpansionsMask, uint32 ExpansionsMask,
int16 CharacterCreationLimit, int16 CharacterCreationLimit,
@@ -111,7 +111,7 @@ namespace EQEmu
union { union {
InventoryTypeSize_Struct InventoryTypeSize; InventoryTypeSize_Struct InventoryTypeSize;
int16 InventoryTypeSizeArray[25]; // should reflect EQEmu::invtype::TYPE_COUNT referenced in emu_constants.h int16 InventoryTypeSizeArray[25]; // should reflect EQ::invtype::TYPE_COUNT referenced in emu_constants.h
}; };
uint64 EquipmentBitmask; uint64 EquipmentBitmask;
@@ -244,9 +244,9 @@ namespace ClientUnknown
const int16 INULL = 0; const int16 INULL = 0;
namespace constants { namespace constants {
const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::EverQuest; const EQ::expansions::Expansion EXPANSION = EQ::expansions::Expansion::EverQuest;
const uint32 EXPANSION_BIT = EQEmu::expansions::bitEverQuest; const uint32 EXPANSION_BIT = EQ::expansions::bitEverQuest;
const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskEverQuest; const uint32 EXPANSIONS_MASK = EQ::expansions::maskEverQuest;
} // namespace constants } // namespace constants
@@ -258,9 +258,9 @@ namespace Client62
const int16 INULL = 0; const int16 INULL = 0;
namespace constants { namespace constants {
const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::EverQuest; const EQ::expansions::Expansion EXPANSION = EQ::expansions::Expansion::EverQuest;
const uint32 EXPANSION_BIT = EQEmu::expansions::bitEverQuest; const uint32 EXPANSION_BIT = EQ::expansions::bitEverQuest;
const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskEverQuest; const uint32 EXPANSIONS_MASK = EQ::expansions::maskEverQuest;
} // namespace constants } // namespace constants
+222 -97
View File
@@ -35,6 +35,8 @@ static const uint32 MAX_MERC = 100;
static const uint32 MAX_MERC_GRADES = 10; static const uint32 MAX_MERC_GRADES = 10;
static const uint32 MAX_MERC_STANCES = 10; static const uint32 MAX_MERC_STANCES = 10;
static const uint32 BLOCKED_BUFF_COUNT = 20; static const uint32 BLOCKED_BUFF_COUNT = 20;
static const uint32 QUESTREWARD_COUNT = 8;
static const uint32 ADVANCED_LORE_LENGTH = 8192;
/* /*
@@ -127,7 +129,7 @@ struct LDoNTrapTemplate
// All clients translate the character select information to some degree // All clients translate the character select information to some degree
struct CharSelectEquip : EQEmu::textures::Texture_Struct, EQEmu::textures::Tint_Struct {}; struct CharSelectEquip : EQ::textures::Texture_Struct, EQ::textures::Tint_Struct {};
// RoF2-based hybrid struct // RoF2-based hybrid struct
struct CharacterSelectEntry_Struct struct CharacterSelectEntry_Struct
@@ -142,7 +144,7 @@ struct CharacterSelectEntry_Struct
uint16 Instance; uint16 Instance;
uint8 Gender; uint8 Gender;
uint8 Face; uint8 Face;
CharSelectEquip Equip[EQEmu::textures::materialCount]; CharSelectEquip Equip[EQ::textures::materialCount];
uint8 Unknown15; // Seen FF uint8 Unknown15; // Seen FF
uint8 Unknown19; // Seen FF uint8 Unknown19; // Seen FF
uint32 DrakkinTattoo; uint32 DrakkinTattoo;
@@ -251,7 +253,7 @@ struct Spawn_Struct {
/*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner /*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner
/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader /*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader
/*0194*/ uint8 unknown0194[3]; /*0194*/ uint8 unknown0194[3];
/*0197*/ EQEmu::TextureProfile equipment; /*0197*/ EQ::TextureProfile equipment;
/*0233*/ float runspeed; // Speed when running /*0233*/ float runspeed; // Speed when running
/*0036*/ uint8 afk; // 0=no, 1=afk /*0036*/ uint8 afk; // 0=no, 1=afk
/*0238*/ uint32 guildID; // Current guild /*0238*/ uint32 guildID; // Current guild
@@ -282,7 +284,7 @@ union
/*0340*/ uint32 spawnId; // Spawn Id /*0340*/ uint32 spawnId; // Spawn Id
/*0344*/ float bounding_radius; // used in melee, overrides calc /*0344*/ float bounding_radius; // used in melee, overrides calc
/*0347*/ uint8 IsMercenary; /*0347*/ uint8 IsMercenary;
/*0348*/ EQEmu::TintProfile equipment_tint; /*0348*/ EQ::TintProfile equipment_tint;
/*0384*/ uint8 lfg; // 0=off, 1=lfg on /*0384*/ uint8 lfg; // 0=off, 1=lfg on
/*0385*/ /*0385*/
@@ -373,13 +375,16 @@ struct NewZone_Struct {
/*0686*/ uint16 zone_instance; /*0686*/ uint16 zone_instance;
/*0688*/ uint32 unknown688; /*0688*/ uint32 unknown688;
/*0692*/ uint8 unknown692[8]; /*0692*/ uint8 unknown692[8];
// Titanium doesn't have a translator, but we can still safely add stuff under here without issues since client memcpy's only what it knows
// Just wastes some bandwidth sending to tit clients /shrug
/*0700*/ float fog_density; /*0700*/ float fog_density;
/*0704*/ uint32 SuspendBuffs; /*0704*/ uint32 SuspendBuffs;
/*0708*/ uint32 FastRegenHP; /*0708*/ uint32 FastRegenHP;
/*0712*/ uint32 FastRegenMana; /*0712*/ uint32 FastRegenMana;
/*0716*/ uint32 FastRegenEndurance; /*0716*/ uint32 FastRegenEndurance;
/*0720*/ uint32 NPCAggroMaxDist; /*0720*/ uint32 NPCAggroMaxDist;
/*0724*/ /*0724*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, if this value is 0, it prevents you from running off edges that would end up underworld
/*0728*/
}; };
/* /*
@@ -734,7 +739,7 @@ struct BandolierItem_Struct
struct Bandolier_Struct struct Bandolier_Struct
{ {
char Name[32]; char Name[32];
BandolierItem_Struct Items[EQEmu::profile::BANDOLIER_ITEM_COUNT]; BandolierItem_Struct Items[EQ::profile::BANDOLIER_ITEM_COUNT];
}; };
//len = 72 //len = 72
@@ -748,7 +753,7 @@ struct PotionBeltItem_Struct
//len = 288 //len = 288
struct PotionBelt_Struct struct PotionBelt_Struct
{ {
PotionBeltItem_Struct Items[EQEmu::profile::POTION_BELT_SIZE]; PotionBeltItem_Struct Items[EQ::profile::POTION_BELT_SIZE];
}; };
struct MovePotionToBelt_Struct struct MovePotionToBelt_Struct
@@ -839,7 +844,7 @@ struct SuspendedMinion_Struct
/*002*/ uint32 HP; /*002*/ uint32 HP;
/*006*/ uint32 Mana; /*006*/ uint32 Mana;
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT]; /*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ EQEmu::TextureMaterialProfile Items; /*510*/ EQ::TextureMaterialProfile Items;
/*546*/ char Name[64]; /*546*/ char Name[64];
/*610*/ /*610*/
}; };
@@ -931,7 +936,7 @@ struct PlayerProfile_Struct
/*0245*/ uint8 guildbanker; /*0245*/ uint8 guildbanker;
/*0246*/ uint8 unknown0246[6]; // /*0246*/ uint8 unknown0246[6]; //
/*0252*/ uint32 intoxication; /*0252*/ uint32 intoxication;
/*0256*/ uint32 spellSlotRefresh[EQEmu::spells::SPELL_GEM_COUNT]; //in ms /*0256*/ uint32 spellSlotRefresh[EQ::spells::SPELL_GEM_COUNT]; //in ms
/*0292*/ uint32 abilitySlotRefresh; /*0292*/ uint32 abilitySlotRefresh;
/*0296*/ uint8 haircolor; // Player hair color /*0296*/ uint8 haircolor; // Player hair color
/*0297*/ uint8 beardcolor; // Player beard color /*0297*/ uint8 beardcolor; // Player beard color
@@ -944,9 +949,9 @@ struct PlayerProfile_Struct
/*0304*/ uint8 ability_time_minutes; /*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder /*0305*/ uint8 ability_time_hours; //place holder
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag? /*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
/*0312*/ EQEmu::TextureMaterialProfile item_material; // Item texture/material of worn/held items /*0312*/ EQ::TextureMaterialProfile item_material; // Item texture/material of worn/held items
/*0348*/ uint8 unknown0348[44]; /*0348*/ uint8 unknown0348[44];
/*0392*/ EQEmu::TintProfile item_tint; /*0392*/ EQ::TintProfile item_tint;
/*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY]; /*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY];
/*2348*/ float unknown2384; //seen ~128, ~47 /*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right /*2352*/ char servername[32]; // length probably not right
@@ -970,9 +975,9 @@ struct PlayerProfile_Struct
/*2505*/ uint8 unknown2541[47]; // ? /*2505*/ uint8 unknown2541[47]; // ?
/*2552*/ uint8 languages[MAX_PP_LANGUAGE]; /*2552*/ uint8 languages[MAX_PP_LANGUAGE];
/*2580*/ uint8 unknown2616[4]; /*2580*/ uint8 unknown2616[4];
/*2584*/ uint32 spell_book[EQEmu::spells::SPELLBOOK_SIZE]; /*2584*/ uint32 spell_book[EQ::spells::SPELLBOOK_SIZE];
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff /*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
/*4632*/ uint32 mem_spells[EQEmu::spells::SPELL_GEM_COUNT]; /*4632*/ uint32 mem_spells[EQ::spells::SPELL_GEM_COUNT];
/*4668*/ uint8 unknown4704[32]; // /*4668*/ uint8 unknown4704[32]; //
/*4700*/ float y; // Player y position /*4700*/ float y; // Player y position
/*4704*/ float x; // Player x position /*4704*/ float x; // Player x position
@@ -1048,7 +1053,7 @@ struct PlayerProfile_Struct
/*7212*/ uint32 tribute_points; /*7212*/ uint32 tribute_points;
/*7216*/ uint32 unknown7252; /*7216*/ uint32 unknown7252;
/*7220*/ uint32 tribute_active; //1=active /*7220*/ uint32 tribute_active; //1=active
/*7224*/ Tribute_Struct tributes[EQEmu::invtype::TRIBUTE_SIZE]; /*7224*/ Tribute_Struct tributes[EQ::invtype::TRIBUTE_SIZE];
/*7264*/ Disciplines_Struct disciplines; /*7264*/ Disciplines_Struct disciplines;
/*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use) /*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use)
/*7744*/ char unknown7780[160]; /*7744*/ char unknown7780[160];
@@ -1075,7 +1080,7 @@ struct PlayerProfile_Struct
/*12800*/ uint32 expAA; /*12800*/ uint32 expAA;
/*12804*/ uint32 aapoints; //avaliable, unspent /*12804*/ uint32 aapoints; //avaliable, unspent
/*12808*/ uint8 unknown12844[36]; /*12808*/ uint8 unknown12844[36];
/*12844*/ Bandolier_Struct bandoliers[EQEmu::profile::BANDOLIERS_SIZE]; /*12844*/ Bandolier_Struct bandoliers[EQ::profile::BANDOLIERS_SIZE];
/*14124*/ uint8 unknown14160[4506]; /*14124*/ uint8 unknown14160[4506];
/*18630*/ SuspendedMinion_Struct SuspendedMinion; // No longer in use /*18630*/ SuspendedMinion_Struct SuspendedMinion; // No longer in use
/*19240*/ uint32 timeentitledonaccount; /*19240*/ uint32 timeentitledonaccount;
@@ -1093,16 +1098,16 @@ struct PlayerProfile_Struct
/*19568*/ /*19568*/
// All player profile packets are translated and this overhead is ignored in out-bound packets // All player profile packets are translated and this overhead is ignored in out-bound packets
PlayerProfile_Struct() : m_player_profile_version(EQEmu::versions::MobVersion::Unknown) { } PlayerProfile_Struct() : m_player_profile_version(EQ::versions::MobVersion::Unknown) { }
EQEmu::versions::MobVersion PlayerProfileVersion() { return m_player_profile_version; } EQ::versions::MobVersion PlayerProfileVersion() { return m_player_profile_version; }
void SetPlayerProfileVersion(EQEmu::versions::MobVersion mob_version) { m_player_profile_version = EQEmu::versions::ValidateMobVersion(mob_version); } void SetPlayerProfileVersion(EQ::versions::MobVersion mob_version) { m_player_profile_version = EQ::versions::ValidateMobVersion(mob_version); }
void SetPlayerProfileVersion(EQEmu::versions::ClientVersion client_version) { SetPlayerProfileVersion(EQEmu::versions::ConvertClientVersionToMobVersion(client_version)); } void SetPlayerProfileVersion(EQ::versions::ClientVersion client_version) { SetPlayerProfileVersion(EQ::versions::ConvertClientVersionToMobVersion(client_version)); }
private: private:
// No need for gm flag since pp already has one // No need for gm flag since pp already has one
// No need for lookup pointer since this struct is not tied to any one system // No need for lookup pointer since this struct is not tied to any one system
EQEmu::versions::MobVersion m_player_profile_version; EQ::versions::MobVersion m_player_profile_version;
}; };
@@ -1188,6 +1193,20 @@ struct SpecialMesg_Struct
/*24*/ char message[1]; // What is being said? /*24*/ char message[1]; // What is being said?
}; };
struct SpecialMesgHeader_Struct
{
/*00*/ char SpeakMode; // 2 shouts, 4 %1 %2, 3 %2, 5 tells group, 0 copy, default says
/*01*/ char JournalMode; // 1 and 2 go to journal
/*02*/ char language;
/*03*/ uint32 msg_type; // Color of text (see MT_*** below)
/*07*/ uint32 target_spawn_id; // Who is it being said to?
/*11*/ // speaker's name
/*xx*/ // unknown, location, client doesn't care
/*xx*/ // unknown
/*xx*/ // unknown
/*xx*/ // message
};
/* /*
** When somebody changes what they're wearing or give a pet a weapon (model changes) ** When somebody changes what they're wearing or give a pet a weapon (model changes)
** Length: 19 Bytes ** Length: 19 Bytes
@@ -1199,7 +1218,7 @@ struct WearChange_Struct {
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material /*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ uint32 hero_forge_model; // New to VoA /*014*/ uint32 hero_forge_model; // New to VoA
/*018*/ uint32 unknown18; // New to RoF /*018*/ uint32 unknown18; // New to RoF
/*022*/ EQEmu::textures::Tint_Struct color; /*022*/ EQ::textures::Tint_Struct color;
/*026*/ uint8 wear_slot_id; /*026*/ uint8 wear_slot_id;
/*027*/ /*027*/
}; };
@@ -1345,20 +1364,23 @@ struct BecomeCorpse_Struct {
struct PlayerPositionUpdateServer_Struct struct PlayerPositionUpdateServer_Struct
{ {
/*0000*/ uint16 spawn_id; /*0000*/ uint16 spawn_id;
/*0002*/ int32 delta_heading:10, // change in heading /*0002*/ uint16 vehicle_id;
x_pos:19, // x coord /*0004*/ signed padding0004 : 12;
padding0002:3; // ***Placeholder signed y_pos : 19; // y coord
/*0006*/ int32 y_pos:19, // y coord unsigned padding : 1;
animation:10, // animation /*0008*/ signed delta_z : 13; // change in z
padding0006:3; // ***Placeholder signed delta_x : 13; // change in x
/*0010*/ int32 z_pos:19, // z coord signed padding0008 : 6;
delta_y:13; // change in y /*0012*/ signed x_pos : 19; // x coord
/*0014*/ int32 delta_x:13, // change in x unsigned heading : 12; // heading
heading:12, // heading signed padding0016 : 1;
padding0014:7; // ***Placeholder /*0016*/ signed delta_heading : 10; // change in heading
/*0018*/ int32 delta_z:13, // change in z signed z_pos : 19; // z coord
padding0018:19; // ***Placeholder signed padding0020 : 3;
/*0022*/ /*0020*/ signed animation : 10; // animation
signed delta_y : 13; // change in y
signed padding0024 : 9;
/*0024*/
}; };
/* /*
@@ -1369,21 +1391,23 @@ struct PlayerPositionUpdateServer_Struct
*/ */
struct PlayerPositionUpdateClient_Struct struct PlayerPositionUpdateClient_Struct
{ {
/*0000*/ uint16 spawn_id; /*0000*/ uint16 sequence; // increments one each packet - Verified
/*0002*/ uint16 sequence; //increments one each packet /*0002*/ uint16 spawn_id; // Player's spawn id
/*0004*/ float y_pos; // y coord /*0004*/ uint16 vehicle_id; // Player's vehicle spawn id
/*0008*/ float delta_z; // Change in z /*0006*/ uint8 unknown0004[4]; // ***Placeholder
/*0012*/ float delta_x; // Change in x /*0010*/ float delta_x; // Change in x
/*0016*/ float delta_y; // Change in y /*0014*/ unsigned heading : 12; // Directional heading
/*0020*/ int32 animation:10, // animation unsigned padding0040 : 20; // ***Placeholder
delta_heading:10, // change in heading /*0018*/ float x_pos; // x coord (2nd loc value)
padding0020:12; // ***Placeholder (mostly 1) /*0022*/ float delta_z; // Change in z
/*0024*/ float x_pos; // x coord /*0026*/ float z_pos; // z coord (3rd loc value)
/*0028*/ float z_pos; // z coord /*0030*/ float y_pos; // y coord (1st loc value)
/*0032*/ uint16 heading:12, // Directional heading /*0034*/ unsigned animation : 10; // ***Placeholder
padding0004:4; // ***Placeholder unsigned padding0024 : 22; // animation
/*0034*/ uint8 unknown0006[2]; // ***Placeholder /*0038*/ float delta_y; // Change in y
/*0036*/ /*0042*/ signed delta_heading : 10; // change in heading
unsigned padding0041 : 22; // ***Placeholder
/*0046*/
}; };
struct SpawnPositionUpdate_Struct struct SpawnPositionUpdate_Struct
@@ -2102,7 +2126,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct { /*struct Item_Shop_Struct {
uint16 merchantid; uint16 merchantid;
uint8 itemtype; uint8 itemtype;
EQEmu::ItemData item; EQ::ItemData item;
uint8 iss_unknown001[6]; uint8 iss_unknown001[6];
};*/ };*/
@@ -2128,7 +2152,7 @@ struct Illusion_Struct { //size: 256 - SoF
/*092*/ uint32 drakkin_heritage; // /*092*/ uint32 drakkin_heritage; //
/*096*/ uint32 drakkin_tattoo; // /*096*/ uint32 drakkin_tattoo; //
/*100*/ uint32 drakkin_details; // /*100*/ uint32 drakkin_details; //
/*104*/ EQEmu::TintProfile armor_tint; // /*104*/ EQ::TintProfile armor_tint; //
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct /*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct /*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
/*142*/ uint8 unknown138[114]; // /*142*/ uint8 unknown138[114]; //
@@ -2161,14 +2185,7 @@ struct QuestReward_Struct
/*024*/ uint32 silver; // Gives silver to the client /*024*/ uint32 silver; // Gives silver to the client
/*028*/ uint32 gold; // Gives gold to the client /*028*/ uint32 gold; // Gives gold to the client
/*032*/ uint32 platinum; // Gives platinum to the client /*032*/ uint32 platinum; // Gives platinum to the client
/*036*/ uint32 item_id; /*036*/ int32 item_id[QUESTREWARD_COUNT]; // -1 for nothing
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044;
/*048*/ uint32 unknown048;
/*052*/ uint32 unknown052;
/*056*/ uint32 unknown056;
/*060*/ uint32 unknown060;
/*064*/ uint32 unknown064;
/*068*/ /*068*/
}; };
@@ -2953,6 +2970,12 @@ struct ItemViewRequest_Struct {
/*046*/ char unknown046[2]; /*046*/ char unknown046[2];
}; };
struct ItemAdvancedLoreText_Struct {
int32 item_id;
char item_name[64];
char advanced_lore[ADVANCED_LORE_LENGTH];
};
struct LDONItemViewRequest_Struct { struct LDONItemViewRequest_Struct {
uint32 item_id; uint32 item_id;
uint8 unknown004[4]; uint8 unknown004[4];
@@ -3469,8 +3492,8 @@ struct SelectTributeReply_Struct {
struct TributeInfo_Struct { struct TributeInfo_Struct {
uint32 active; //0 == inactive, 1 == active uint32 active; //0 == inactive, 1 == active
uint32 tributes[EQEmu::invtype::TRIBUTE_SIZE]; //-1 == NONE uint32 tributes[EQ::invtype::TRIBUTE_SIZE]; //-1 == NONE
uint32 tiers[EQEmu::invtype::TRIBUTE_SIZE]; //all 00's uint32 tiers[EQ::invtype::TRIBUTE_SIZE]; //all 00's
uint32 tribute_master_id; uint32 tribute_master_id;
}; };
@@ -4381,7 +4404,7 @@ struct AnnoyingZoneUnknown_Struct {
}; };
struct LoadSpellSet_Struct { struct LoadSpellSet_Struct {
uint32 spell[EQEmu::spells::SPELL_GEM_COUNT]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0 uint32 spell[EQ::spells::SPELL_GEM_COUNT]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0
uint32 unknown; //there seems to be an extra field in this packet... uint32 unknown; //there seems to be an extra field in this packet...
}; };
@@ -4812,17 +4835,98 @@ struct BuffIcon_Struct
BuffIconEntry_Struct entries[0]; BuffIconEntry_Struct entries[0];
}; };
struct ExpeditionInfo_Struct struct ExpeditionInvite_Struct
{ {
/*000*/ uint32 max_players; /*000*/ uint32 client_id; // unique character id
/*004*/ char expedition_name[128]; /*004*/ uint32 unknown004; // added after titanium
/*132*/ char leader_name[64]; /*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
}; };
struct ExpeditionJoinPrompt_Struct struct ExpeditionInviteResponse_Struct
{ {
/*000*/ char player_name[64]; /*000*/ uint32 unknown000;
/*064*/ char expedition_name[64]; /*004*/ uint32 unknown004; // added after titanium
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004; // added after titanium
/*008*/ uint32 assigned; // padded bool, 0: not in expedition (clear data), 1: in expedition
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
{
/*000*/ char name[64]; // variable length, null terminated, max 0x40 (64)
/*064*/ uint8 expedition_status; // 0: unknown, 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[128]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[256]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
}; };
struct ExpeditionExpireWarning struct ExpeditionExpireWarning
@@ -4830,48 +4934,67 @@ struct ExpeditionExpireWarning
/*008*/ uint32 minutes_remaining; /*008*/ uint32 minutes_remaining;
}; };
struct ExpeditionCompassEntry_Struct struct DynamicZoneCompassEntry_Struct
{ {
/*000*/ uint32 enabled; //guess /*000*/ uint16 dz_zone_id; // target dz id pair
/*004*/ float y; /*002*/ uint16 dz_instance_id;
/*008*/ float x; /*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*012*/ float z; /*008*/ uint32 unknown008;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
}; };
struct ExpeditionCompass_Struct struct DynamicZoneCompass_Struct
{ {
/*000*/ uint32 client_id;
/*000*/ uint32 count; /*000*/ uint32 count;
/*004*/ ExpeditionCompassEntry_Struct entries[0]; /*004*/ DynamicZoneCompassEntry_Struct entries[0];
}; };
struct ExpeditionMemberEntry_Struct struct DynamicZoneChooseZoneEntry_Struct
{ {
char name[64]; /*000*/ uint16 dz_zone_id; // dz_id pair
char status; /*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // seen 28 00 00 00 (40), sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[128]; // variable length, null terminated
/*144*/ char leader_name[64]; // variable length, null terminated
}; };
struct ExpeditionMemberList_Struct struct DynamicZoneChooseZone_Struct
{ {
/*000*/ uint32 count; /*000*/ uint32 client_id;
/*004*/ ExpeditionMemberEntry_Struct entries[0]; /*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
}; };
struct ExpeditionLockoutEntry_Struct struct DynamicZoneChooseZoneReply_Struct
{ {
/*000*/ uint32 time_left; /*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ char expedition[128]; /*004*/ uint32 unknown004; // seen 69 00 00 00
/*132*/ char expedition_event[128]; /*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
}; };
struct ExpeditionLockoutList_Struct struct KickPlayers_Struct
{ {
/*000*/ uint32 count; /*000*/ char char_name[64];
/*004*/ ExpeditionLockoutEntry_Struct entries[0]; /*064*/ uint32 unknown064; // always 0
}; /*068*/ uint8 kick_expedition; // true if /kickplayers exp
/*069*/ uint8 kick_task; // true if /kickplayers task
struct ExpeditionLeaderSet_Struct /*070*/ uint8 padding[2];
{
/*000*/ char leader_name[64];
}; };
struct CorpseDrag_Struct struct CorpseDrag_Struct
@@ -5331,8 +5454,10 @@ struct ServerLootItem_Struct {
uint32 aug_5; // uint32 aug_5; uint32 aug_5; // uint32 aug_5;
uint32 aug_6; // uint32 aug_5; uint32 aug_6; // uint32 aug_5;
uint8 attuned; uint8 attuned;
uint8 min_level; uint16 trivial_min_level;
uint8 max_level; uint16 trivial_max_level;
uint16 npc_min_level;
uint16 npc_max_level;
}; };
//Found in client near a ref to the string: //Found in client near a ref to the string:
+104 -104
View File
@@ -84,14 +84,14 @@ void EQStream::init(bool resetSession) {
OpMgr = nullptr; OpMgr = nullptr;
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log(Logs::Detail, Logs::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); LogNetcode(_L "init Invalid Sequenced queue: BS [{}] + SQ [{}] != NOS [{}]" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
} }
} }
EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p)
{ {
EQRawApplicationPacket *ap=nullptr; EQRawApplicationPacket *ap=nullptr;
Log(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, p->size); LogNetcode(_L "Creating new application packet, length [{}]" __L, p->size);
// _raw(NET__APP_CREATE_HEX, 0xFFFF, p); // _raw(NET__APP_CREATE_HEX, 0xFFFF, p);
ap = p->MakeAppPacket(); ap = p->MakeAppPacket();
return ap; return ap;
@@ -100,7 +100,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p)
EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len) EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len)
{ {
EQRawApplicationPacket *ap=nullptr; EQRawApplicationPacket *ap=nullptr;
Log(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, len); LogNetcode(_L "Creating new application packet, length [{}]" __L, len);
ap = new EQRawApplicationPacket(buf, len); ap = new EQRawApplicationPacket(buf, len);
return ap; return ap;
} }
@@ -130,7 +130,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
} }
if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) { if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) {
Log(Logs::Detail, Logs::Netcode, _L "Session not initialized, packet ignored" __L); LogNetcode(_L "Session not initialized, packet ignored" __L);
// _raw(NET__DEBUG, 0xFFFF, p); // _raw(NET__DEBUG, 0xFFFF, p);
return; return;
} }
@@ -141,7 +141,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
while(processed < p->size) { while(processed < p->size) {
subpacket_length=*(p->pBuffer+processed); subpacket_length=*(p->pBuffer+processed);
EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length); EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length);
Log(Logs::Detail, Logs::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); LogNetcode(_L "Extracting combined packet of length [{}]" __L, subpacket_length);
// _raw(NET__NET_CREATE_HEX, 0xFFFF, subp); // _raw(NET__NET_CREATE_HEX, 0xFFFF, subp);
subp->copyInfo(p); subp->copyInfo(p);
ProcessPacket(subp); ProcessPacket(subp);
@@ -156,12 +156,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
while(processed<p->size) { while(processed<p->size) {
EQRawApplicationPacket *ap=nullptr; EQRawApplicationPacket *ap=nullptr;
if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) { if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) {
Log(Logs::Detail, Logs::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); LogNetcode(_L "Extracting combined app packet of length [{}], short len" __L, subpacket_length);
ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length);
processed+=subpacket_length+1; processed+=subpacket_length+1;
} else { } else {
subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1)); subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1));
Log(Logs::Detail, Logs::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); LogNetcode(_L "Extracting combined app packet of length [{}], short len" __L, subpacket_length);
ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length);
processed+=subpacket_length+3; processed+=subpacket_length+3;
} }
@@ -176,29 +176,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_Packet: { case OP_Packet: {
if(!p->pBuffer || (p->Size() < 4)) if(!p->pBuffer || (p->Size() < 4))
{ {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_Packet that was of malformed size" __L); LogNetcode(_L "Received OP_Packet that was of malformed size" __L);
break; break;
} }
uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
SeqOrder check=CompareSequence(NextInSeq,seq); SeqOrder check=CompareSequence(NextInSeq,seq);
if (check == SeqFuture) { if (check == SeqFuture) {
Log(Logs::Detail, Logs::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); LogNetcode(_L "Future OP_Packet: Expecting Seq=[{}], but got Seq=[{}]" __L, NextInSeq, seq);
// _raw(NET__DEBUG, seq, p); // _raw(NET__DEBUG, seq, p);
PacketQueue[seq]=p->Copy(); PacketQueue[seq]=p->Copy();
Log(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); LogNetcode(_L "OP_Packet Queue size=[{}]" __L, PacketQueue.size());
//SendOutOfOrderAck(seq); //SendOutOfOrderAck(seq);
} else if (check == SeqPast) { } else if (check == SeqPast) {
Log(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); LogNetcode(_L "Duplicate OP_Packet: Expecting Seq=[{}], but got Seq=[{}]" __L, NextInSeq, seq);
// _raw(NET__DEBUG, seq, p); // _raw(NET__DEBUG, seq, p);
SendOutOfOrderAck(seq); //we already got this packet but it was out of order SendOutOfOrderAck(seq); //we already got this packet but it was out of order
} else { } else {
// In case we did queue one before as well. // In case we did queue one before as well.
EQProtocolPacket *qp=RemoveQueue(seq); EQProtocolPacket *qp=RemoveQueue(seq);
if (qp) { if (qp) {
Log(Logs::General, Logs::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); LogNetcode("[NET_TRACE] OP_Packet: Removing older queued packet with sequence [{}]", seq);
delete qp; delete qp;
} }
@@ -207,7 +207,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
// Check for an embedded OP_AppCombinded (protocol level 0x19) // Check for an embedded OP_AppCombinded (protocol level 0x19)
if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) {
EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2); EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2);
Log(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); LogNetcode(_L "seq [{}], Extracting combined packet of length [{}]" __L, seq, subp->size);
// _raw(NET__NET_CREATE_HEX, seq, subp); // _raw(NET__NET_CREATE_HEX, seq, subp);
subp->copyInfo(p); subp->copyInfo(p);
ProcessPacket(subp); ProcessPacket(subp);
@@ -226,29 +226,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_Fragment: { case OP_Fragment: {
if(!p->pBuffer || (p->Size() < 4)) if(!p->pBuffer || (p->Size() < 4))
{ {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_Fragment that was of malformed size" __L); LogNetcode(_L "Received OP_Fragment that was of malformed size" __L);
break; break;
} }
uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
SeqOrder check=CompareSequence(NextInSeq,seq); SeqOrder check=CompareSequence(NextInSeq,seq);
if (check == SeqFuture) { if (check == SeqFuture) {
Log(Logs::Detail, Logs::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); LogNetcode(_L "Future OP_Fragment: Expecting Seq=[{}], but got Seq=[{}]" __L, NextInSeq, seq);
// _raw(NET__DEBUG, seq, p); // _raw(NET__DEBUG, seq, p);
PacketQueue[seq]=p->Copy(); PacketQueue[seq]=p->Copy();
Log(Logs::Detail, Logs::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); LogNetcode(_L "OP_Fragment Queue size=[{}]" __L, PacketQueue.size());
//SendOutOfOrderAck(seq); //SendOutOfOrderAck(seq);
} else if (check == SeqPast) { } else if (check == SeqPast) {
Log(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); LogNetcode(_L "Duplicate OP_Fragment: Expecting Seq=[{}], but got Seq=[{}]" __L, NextInSeq, seq);
// _raw(NET__DEBUG, seq, p); // _raw(NET__DEBUG, seq, p);
SendOutOfOrderAck(seq); SendOutOfOrderAck(seq);
} else { } else {
// In case we did queue one before as well. // In case we did queue one before as well.
EQProtocolPacket *qp=RemoveQueue(seq); EQProtocolPacket *qp=RemoveQueue(seq);
if (qp) { if (qp) {
Log(Logs::General, Logs::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); LogNetcode("[NET_TRACE] OP_Fragment: Removing older queued packet with sequence [{}]", seq);
delete qp; delete qp;
} }
SetNextAckToSend(seq); SetNextAckToSend(seq);
@@ -256,18 +256,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
if (oversize_buffer) { if (oversize_buffer) {
memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2); memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2);
oversize_offset+=p->size-2; oversize_offset+=p->size-2;
Log(Logs::Detail, Logs::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); LogNetcode(_L "Fragment of oversized of length [{}], seq [{}]: now at [{}]/[{}]" __L, p->size-2, seq, oversize_offset, oversize_length);
if (oversize_offset==oversize_length) { if (oversize_offset==oversize_length) {
if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) {
EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset); EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset);
Log(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); LogNetcode(_L "seq [{}], Extracting combined oversize packet of length [{}]" __L, seq, subp->size);
//// _raw(NET__NET_CREATE_HEX, subp); //// _raw(NET__NET_CREATE_HEX, subp);
subp->copyInfo(p); subp->copyInfo(p);
ProcessPacket(subp); ProcessPacket(subp);
delete subp; delete subp;
} else { } else {
EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset); EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset);
Log(Logs::Detail, Logs::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); LogNetcode(_L "seq [{}], completed combined oversize packet of length [{}]" __L, seq, ap->size);
if (ap) { if (ap) {
ap->copyInfo(p); ap->copyInfo(p);
InboundQueuePush(ap); InboundQueuePush(ap);
@@ -282,20 +282,20 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
oversize_buffer=new unsigned char[oversize_length]; oversize_buffer=new unsigned char[oversize_length];
memcpy(oversize_buffer,p->pBuffer+6,p->size-6); memcpy(oversize_buffer,p->pBuffer+6,p->size-6);
oversize_offset=p->size-6; oversize_offset=p->size-6;
Log(Logs::Detail, Logs::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); LogNetcode(_L "First fragment of oversized of seq [{}]: now at [{}]/[{}]" __L, seq, oversize_offset, oversize_length);
} }
} }
} }
break; break;
case OP_KeepAlive: { case OP_KeepAlive: {
NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size)); NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size));
Log(Logs::Detail, Logs::Netcode, _L "Received and queued reply to keep alive" __L); LogNetcode(_L "Received and queued reply to keep alive" __L);
} }
break; break;
case OP_Ack: { case OP_Ack: {
if(!p->pBuffer || (p->Size() < 4)) if(!p->pBuffer || (p->Size() < 4))
{ {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_Ack that was of malformed size" __L); LogNetcode(_L "Received OP_Ack that was of malformed size" __L);
break; break;
} }
uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
@@ -309,11 +309,11 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_SessionRequest: { case OP_SessionRequest: {
if(p->Size() < sizeof(SessionRequest)) if(p->Size() < sizeof(SessionRequest))
{ {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); LogNetcode(_L "Received OP_SessionRequest that was of malformed size" __L);
break; break;
} }
if (GetState()==ESTABLISHED) { if (GetState()==ESTABLISHED) {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); LogNetcode(_L "Received OP_SessionRequest in ESTABLISHED state ([{}]) streamactive ([{}]) attempt ([{}])" __L, GetState(),streamactive,sessionAttempts);
// client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case // client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case
// streamactive means we identified the opcode for the stream, we cannot re-establish this connection // streamactive means we identified the opcode for the stream, we cannot re-establish this connection
@@ -331,7 +331,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
SessionRequest *Request=(SessionRequest *)p->pBuffer; SessionRequest *Request=(SessionRequest *)p->pBuffer;
Session=ntohl(Request->Session); Session=ntohl(Request->Session);
SetMaxLen(ntohl(Request->MaxLength)); SetMaxLen(ntohl(Request->MaxLength));
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); LogNetcode(_L "Received OP_SessionRequest: session [{}], maxlen [{}]" __L, (unsigned long)Session, MaxLen);
SetState(ESTABLISHED); SetState(ESTABLISHED);
Key=0x11223344; Key=0x11223344;
SendSessionResponse(); SendSessionResponse();
@@ -340,7 +340,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_SessionResponse: { case OP_SessionResponse: {
if(p->Size() < sizeof(SessionResponse)) if(p->Size() < sizeof(SessionResponse))
{ {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); LogNetcode(_L "Received OP_SessionResponse that was of malformed size" __L);
break; break;
} }
@@ -356,7 +356,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
compressed=(Response->Format&FLAG_COMPRESSED); compressed=(Response->Format&FLAG_COMPRESSED);
encoded=(Response->Format&FLAG_ENCODED); encoded=(Response->Format&FLAG_ENCODED);
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); LogNetcode(_L "Received OP_SessionResponse: session [{}], maxlen [{}], key [{}], compressed? [{}], encoded? [{}]" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no");
// Kinda kludgy, but trie for now // Kinda kludgy, but trie for now
if (StreamType==UnknownStream) { if (StreamType==UnknownStream) {
@@ -379,17 +379,17 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
EQStreamState state = GetState(); EQStreamState state = GetState();
if(state == ESTABLISHED) { if(state == ESTABLISHED) {
//client initiated disconnect? //client initiated disconnect?
Log(Logs::Detail, Logs::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); LogNetcode(_L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect" __L);
_SendDisconnect(); _SendDisconnect();
SetState(CLOSED); SetState(CLOSED);
} else if(state == CLOSING) { } else if(state == CLOSING) {
//we were waiting for this anyways, ignore pending messages, send the reply and be closed. //we were waiting for this anyways, ignore pending messages, send the reply and be closed.
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); LogNetcode(_L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though" __L);
_SendDisconnect(); _SendDisconnect();
SetState(CLOSED); SetState(CLOSED);
} else { } else {
//we are expecting this (or have already gotten it, but dont care either way) //we are expecting this (or have already gotten it, but dont care either way)
Log(Logs::Detail, Logs::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); LogNetcode(_L "Received expected OP_SessionDisconnect. Moving to closed state" __L);
SetState(CLOSED); SetState(CLOSED);
} }
} }
@@ -397,14 +397,14 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_OutOfOrderAck: { case OP_OutOfOrderAck: {
if(!p->pBuffer || (p->Size() < 4)) if(!p->pBuffer || (p->Size() < 4))
{ {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); LogNetcode(_L "Received OP_OutOfOrderAck that was of malformed size" __L);
break; break;
} }
uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
MOutboundQueue.lock(); MOutboundQueue.lock();
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log(Logs::Detail, Logs::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); LogNetcode(_L "Pre-OOA Invalid Sequenced queue: BS [{}] + SQ [{}] != NOS [{}]" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
} }
//if the packet they got out of order is between our last acked packet and the last sent packet, then its valid. //if the packet they got out of order is between our last acked packet and the last sent packet, then its valid.
@@ -414,7 +414,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
uint16 sqsize = SequencedQueue.size(); uint16 sqsize = SequencedQueue.size();
uint16 index = seq - SequencedBase; uint16 index = seq - SequencedBase;
Log(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); LogNetcode(_L "OP_OutOfOrderAck marking packet acked in queue (queue index = [{}], queue size = [{}])" __L, index, sqsize);
if (index < sqsize) { if (index < sqsize) {
SequencedQueue[index]->acked = true; SequencedQueue[index]->acked = true;
// flag packets for a resend // flag packets for a resend
@@ -423,7 +423,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end() && count < index; ++sitr, ++count) { for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end() && count < index; ++sitr, ++count) {
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && (((*sitr)->sent_time + timeout) < Timer::GetCurrentTime())) { if (!(*sitr)->acked && (*sitr)->sent_time > 0 && (((*sitr)->sent_time + timeout) < Timer::GetCurrentTime())) {
(*sitr)->sent_time = 0; (*sitr)->sent_time = 0;
Log(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck Flagging packet %d for retransmission" __L, SequencedBase + count); LogNetcode(_L "OP_OutOfOrderAck Flagging packet [{}] for retransmission" __L, SequencedBase + count);
} }
} }
} }
@@ -432,11 +432,11 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
retransmittimer = Timer::GetCurrentTime(); retransmittimer = Timer::GetCurrentTime();
} }
} else { } else {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); LogNetcode(_L "Received OP_OutOfOrderAck for out-of-window [{}]. Window ([{}]->[{}])" __L, seq, SequencedBase, NextOutSeq);
} }
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log(Logs::Detail, Logs::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); LogNetcode(_L "Post-OOA Invalid Sequenced queue: BS [{}] + SQ [{}] != NOS [{}]" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
} }
MOutboundQueue.unlock(); MOutboundQueue.unlock();
@@ -445,7 +445,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_SessionStatRequest: { case OP_SessionStatRequest: {
if(p->Size() < sizeof(ClientSessionStats)) if(p->Size() < sizeof(ClientSessionStats))
{ {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); LogNetcode(_L "Received OP_SessionStatRequest that was of malformed size" __L);
break; break;
} }
ClientSessionStats *ClientStats=(ClientSessionStats *)p->pBuffer; ClientSessionStats *ClientStats=(ClientSessionStats *)p->pBuffer;
@@ -468,7 +468,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
retransmittimeout += 300; retransmittimeout += 300;
if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX) if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX)
retransmittimeout = RETRANSMIT_TIMEOUT_MAX; retransmittimeout = RETRANSMIT_TIMEOUT_MAX;
Log(Logs::Detail, Logs::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); LogNetcode(_L "Retransmit timeout recalculated to [{}]ms" __L, retransmittimeout);
} }
} }
@@ -485,11 +485,11 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
} }
break; break;
case OP_SessionStatResponse: { case OP_SessionStatResponse: {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); LogNetcode(_L "Received OP_SessionStatResponse. Ignoring" __L);
} }
break; break;
case OP_OutOfSession: { case OP_OutOfSession: {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); LogNetcode(_L "Received OP_OutOfSession. Ignoring" __L);
} }
break; break;
default: default:
@@ -520,7 +520,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req)
return; return;
if(OpMgr == nullptr || *OpMgr == nullptr) { if(OpMgr == nullptr || *OpMgr == nullptr) {
Log(Logs::Detail, Logs::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); LogNetcode(_L "Packet enqueued into a stream with no opcode manager, dropping" __L);
delete pack; delete pack;
return; return;
} }
@@ -559,18 +559,18 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
// Convert the EQApplicationPacket to 1 or more EQProtocolPackets // Convert the EQApplicationPacket to 1 or more EQProtocolPackets
if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2) if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2)
Log(Logs::Detail, Logs::Netcode, _L "Making oversized packet, len %d" __L, p->Size()); LogNetcode(_L "Making oversized packet, len [{}]" __L, p->Size());
auto tmpbuff = new unsigned char[p->size + 3]; auto tmpbuff = new unsigned char[p->size + 3];
length=p->serialize(opcode, tmpbuff); length=p->serialize(opcode, tmpbuff);
if (length != p->Size()) if (length != p->Size())
Log(Logs::Detail, Logs::Netcode, _L "Packet adjustment, len %d to %d" __L, p->Size(), length); LogNetcode(_L "Packet adjustment, len [{}] to [{}]" __L, p->Size(), length);
auto out = new EQProtocolPacket(OP_Fragment, nullptr, MaxLen - 4); auto out = new EQProtocolPacket(OP_Fragment, nullptr, MaxLen - 4);
*(uint32 *)(out->pBuffer+2)=htonl(length); *(uint32 *)(out->pBuffer+2)=htonl(length);
used=MaxLen-10; used=MaxLen-10;
memcpy(out->pBuffer+6,tmpbuff,used); memcpy(out->pBuffer+6,tmpbuff,used);
Log(Logs::Detail, Logs::Netcode, _L "First fragment: used %d/%d. Payload size %d in the packet" __L, used, length, p->size); LogNetcode(_L "First fragment: used [{}]/[{}]. Payload size [{}] in the packet" __L, used, length, p->size);
SequencedPush(out); SequencedPush(out);
@@ -581,7 +581,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
out->size=chunksize+2; out->size=chunksize+2;
SequencedPush(out); SequencedPush(out);
used+=chunksize; used+=chunksize;
Log(Logs::Detail, Logs::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, length); LogNetcode(_L "Subsequent fragment: len [{}], used [{}]/[{}]" __L, chunksize, used, length);
} }
delete p; delete p;
delete[] tmpbuff; delete[] tmpbuff;
@@ -623,7 +623,7 @@ void EQStream::SequencedPush(EQProtocolPacket *p)
void EQStream::NonSequencedPush(EQProtocolPacket *p) void EQStream::NonSequencedPush(EQProtocolPacket *p)
{ {
MOutboundQueue.lock(); MOutboundQueue.lock();
Log(Logs::Detail, Logs::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); LogNetcode(_L "Pushing non-sequenced packet of length [{}]" __L, p->size);
NonSequencedQueue.push(p); NonSequencedQueue.push(p);
MOutboundQueue.unlock(); MOutboundQueue.unlock();
} }
@@ -631,14 +631,14 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p)
void EQStream::SendAck(uint16 seq) void EQStream::SendAck(uint16 seq)
{ {
uint16 Seq=htons(seq); uint16 Seq=htons(seq);
Log(Logs::Detail, Logs::Netcode, _L "Sending ack with sequence %d" __L, seq); LogNetcode(_L "Sending ack with sequence [{}]" __L, seq);
SetLastAckSent(seq); SetLastAckSent(seq);
NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16))); NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16)));
} }
void EQStream::SendOutOfOrderAck(uint16 seq) void EQStream::SendOutOfOrderAck(uint16 seq)
{ {
Log(Logs::Detail, Logs::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); LogNetcode(_L "Sending out of order ack with sequence [{}]" __L, seq);
uint16 Seq=htons(seq); uint16 Seq=htons(seq);
NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16))); NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16)));
} }
@@ -688,24 +688,24 @@ void EQStream::Write(int eq_fd)
// If we don't have a packet to try to combine into, use this one as the base // If we don't have a packet to try to combine into, use this one as the base
// And remove it form the queue // And remove it form the queue
p = NonSequencedQueue.front(); p = NonSequencedQueue.front();
Log(Logs::Detail, Logs::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); LogNetcode(_L "Starting combined packet with non-seq packet of len [{}]" __L, p->size);
NonSequencedQueue.pop(); NonSequencedQueue.pop();
} else if (!p->combine(NonSequencedQueue.front())) { } else if (!p->combine(NonSequencedQueue.front())) {
// Trying to combine this packet with the base didn't work (too big maybe) // Trying to combine this packet with the base didn't work (too big maybe)
// So just send the base packet (we'll try this packet again later) // So just send the base packet (we'll try this packet again later)
Log(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); LogNetcode(_L "Combined packet full at len [{}], next non-seq packet is len [{}]" __L, p->size, (NonSequencedQueue.front())->size);
ReadyToSend.push(p); ReadyToSend.push(p);
BytesWritten+=p->size; BytesWritten+=p->size;
p=nullptr; p=nullptr;
if (BytesWritten > threshold) { if (BytesWritten > threshold) {
// Sent enough this round, lets stop to be fair // Sent enough this round, lets stop to be fair
Log(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); LogNetcode(_L "Exceeded write threshold in nonseq ([{}] > [{}])" __L, BytesWritten, threshold);
break; break;
} }
} else { } else {
// Combine worked, so just remove this packet and it's spot in the queue // Combine worked, so just remove this packet and it's spot in the queue
Log(Logs::Detail, Logs::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); LogNetcode(_L "Combined non-seq packet of len [{}], yeilding [{}] combined" __L, (NonSequencedQueue.front())->size, p->size);
delete NonSequencedQueue.front(); delete NonSequencedQueue.front();
NonSequencedQueue.pop(); NonSequencedQueue.pop();
} }
@@ -718,7 +718,7 @@ void EQStream::Write(int eq_fd)
uint16 seq_send = SequencedBase + count; //just for logging... uint16 seq_send = SequencedBase + count; //just for logging...
if(SequencedQueue.empty()) { if(SequencedQueue.empty()) {
Log(Logs::Detail, Logs::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); LogNetcode(_L "Tried to write a packet with an empty queue ([{}] is past next out [{}])" __L, seq_send, NextOutSeq);
SeqEmpty=true; SeqEmpty=true;
continue; continue;
} }
@@ -728,35 +728,35 @@ void EQStream::Write(int eq_fd)
++sitr; ++sitr;
++count; ++count;
if (p) { if (p) {
Log(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size); LogNetcode(_L "Final combined packet not full, len [{}]" __L, p->size);
ReadyToSend.push(p); ReadyToSend.push(p);
BytesWritten += p->size; BytesWritten += p->size;
p = nullptr; p = nullptr;
} }
Log(Logs::Detail, Logs::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); LogNetcode(_L "Not retransmitting seq packet [{}] because already marked as acked" __L, seq_send);
} else if (!p) { } else if (!p) {
// If we don't have a packet to try to combine into, use this one as the base // If we don't have a packet to try to combine into, use this one as the base
// Copy it first as it will still live until it is acked // Copy it first as it will still live until it is acked
p=(*sitr)->Copy(); p=(*sitr)->Copy();
Log(Logs::Detail, Logs::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); LogNetcode(_L "Starting combined packet with seq packet [{}] of len [{}]" __L, seq_send, p->size);
(*sitr)->sent_time = Timer::GetCurrentTime(); (*sitr)->sent_time = Timer::GetCurrentTime();
++sitr; ++sitr;
++count; ++count;
} else if (!p->combine(*sitr)) { } else if (!p->combine(*sitr)) {
// Trying to combine this packet with the base didn't work (too big maybe) // Trying to combine this packet with the base didn't work (too big maybe)
// So just send the base packet (we'll try this packet again later) // So just send the base packet (we'll try this packet again later)
Log(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send + 1, (*sitr)->size); LogNetcode(_L "Combined packet full at len [{}], next seq packet [{}] is len [{}]" __L, p->size, seq_send + 1, (*sitr)->size);
ReadyToSend.push(p); ReadyToSend.push(p);
BytesWritten+=p->size; BytesWritten+=p->size;
p=nullptr; p=nullptr;
if ((*sitr)->opcode != OP_Fragment && BytesWritten > threshold) { if ((*sitr)->opcode != OP_Fragment && BytesWritten > threshold) {
// Sent enough this round, lets stop to be fair // Sent enough this round, lets stop to be fair
Log(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); LogNetcode(_L "Exceeded write threshold in seq ([{}] > [{}])" __L, BytesWritten, threshold);
break; break;
} }
} else { } else {
// Combine worked // Combine worked
Log(Logs::Detail, Logs::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); LogNetcode(_L "Combined seq packet [{}] of len [{}], yeilding [{}] combined" __L, seq_send, (*sitr)->size, p->size);
(*sitr)->sent_time = Timer::GetCurrentTime(); (*sitr)->sent_time = Timer::GetCurrentTime();
++sitr; ++sitr;
++count; ++count;
@@ -766,7 +766,7 @@ void EQStream::Write(int eq_fd)
++sitr; ++sitr;
++count; ++count;
if (p) { if (p) {
Log(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size); LogNetcode(_L "Final combined packet not full, len [{}]" __L, p->size);
ReadyToSend.push(p); ReadyToSend.push(p);
BytesWritten += p->size; BytesWritten += p->size;
p = nullptr; p = nullptr;
@@ -776,25 +776,25 @@ void EQStream::Write(int eq_fd)
// Copy it first as it will still live until it is acked // Copy it first as it will still live until it is acked
p=(*sitr)->Copy(); p=(*sitr)->Copy();
(*sitr)->sent_time = Timer::GetCurrentTime(); (*sitr)->sent_time = Timer::GetCurrentTime();
Log(Logs::Detail, Logs::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); LogNetcode(_L "Starting combined packet with seq packet [{}] of len [{}]" __L, seq_send, p->size);
++sitr; ++sitr;
++count; ++count;
} else if (!p->combine(*sitr)) { } else if (!p->combine(*sitr)) {
// Trying to combine this packet with the base didn't work (too big maybe) // Trying to combine this packet with the base didn't work (too big maybe)
// So just send the base packet (we'll try this packet again later) // So just send the base packet (we'll try this packet again later)
Log(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); LogNetcode(_L "Combined packet full at len [{}], next seq packet [{}] is len [{}]" __L, p->size, seq_send, (*sitr)->size);
ReadyToSend.push(p); ReadyToSend.push(p);
BytesWritten+=p->size; BytesWritten+=p->size;
p=nullptr; p=nullptr;
if (BytesWritten > threshold) { if (BytesWritten > threshold) {
// Sent enough this round, lets stop to be fair // Sent enough this round, lets stop to be fair
Log(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); LogNetcode(_L "Exceeded write threshold in seq ([{}] > [{}])" __L, BytesWritten, threshold);
break; break;
} }
} else { } else {
// Combine worked // Combine worked
Log(Logs::Detail, Logs::Netcode, _L "Combined seq packet %d of len %d, yielding %d combined." __L, seq_send, (*sitr)->size, p->size); LogNetcode(_L "Combined seq packet [{}] of len [{}], yielding [{}] combined" __L, seq_send, (*sitr)->size, p->size);
(*sitr)->sent_time = Timer::GetCurrentTime(); (*sitr)->sent_time = Timer::GetCurrentTime();
++sitr; ++sitr;
++count; ++count;
@@ -802,7 +802,7 @@ void EQStream::Write(int eq_fd)
} }
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log(Logs::Detail, Logs::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); LogNetcode(_L "Post send Invalid Sequenced queue: BS [{}] + SQ [{}] != NOS [{}]" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
} }
} else { } else {
// No more sequenced packets // No more sequenced packets
@@ -814,7 +814,7 @@ void EQStream::Write(int eq_fd)
// We have a packet still, must have run out of both seq and non-seq, so send it // We have a packet still, must have run out of both seq and non-seq, so send it
if (p) { if (p) {
Log(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size); LogNetcode(_L "Final combined packet not full, len [{}]" __L, p->size);
ReadyToSend.push(p); ReadyToSend.push(p);
BytesWritten+=p->size; BytesWritten+=p->size;
} }
@@ -831,7 +831,7 @@ void EQStream::Write(int eq_fd)
if(SeqEmpty && NonSeqEmpty) { if(SeqEmpty && NonSeqEmpty) {
//no more data to send //no more data to send
if(CheckState(CLOSING)) { if(CheckState(CLOSING)) {
Log(Logs::Detail, Logs::Netcode, _L "All outgoing data flushed, closing stream." __L ); LogNetcode(_L "All outgoing data flushed, closing stream" __L );
//we are waiting for the queues to empty, now we can do our disconnect. //we are waiting for the queues to empty, now we can do our disconnect.
//this packet will not actually go out until the next call to Write(). //this packet will not actually go out until the next call to Write().
_SendDisconnect(); _SendDisconnect();
@@ -910,7 +910,7 @@ void EQStream::SendSessionRequest()
Request->Session=htonl(time(nullptr)); Request->Session=htonl(time(nullptr));
Request->MaxLength=htonl(512); Request->MaxLength=htonl(512);
Log(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); LogNetcode(_L "Sending OP_SessionRequest: session [{}], maxlen=[{}]" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength));
NonSequencedPush(out); NonSequencedPush(out);
} }
@@ -924,7 +924,7 @@ void EQStream::_SendDisconnect()
*(uint32 *)out->pBuffer=htonl(Session); *(uint32 *)out->pBuffer=htonl(Session);
NonSequencedPush(out); NonSequencedPush(out);
Log(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); LogNetcode(_L "Sending OP_SessionDisconnect: session [{}]" __L, (unsigned long)Session);
} }
void EQStream::InboundQueuePush(EQRawApplicationPacket *p) void EQStream::InboundQueuePush(EQRawApplicationPacket *p)
@@ -976,7 +976,7 @@ EQRawApplicationPacket *p=nullptr;
if(OpMgr != nullptr && *OpMgr != nullptr) { if(OpMgr != nullptr && *OpMgr != nullptr) {
EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode);
if(emu_op == OP_Unknown) { if(emu_op == OP_Unknown) {
Log(Logs::General, Logs::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); LogNetcode("Unable to convert EQ opcode {:#04x} to an Application opcode", p->opcode);
} }
p->SetOpcode(emu_op); p->SetOpcode(emu_op);
@@ -1004,7 +1004,7 @@ void EQStream::InboundQueueClear()
{ {
EQApplicationPacket *p=nullptr; EQApplicationPacket *p=nullptr;
Log(Logs::Detail, Logs::Netcode, _L "Clearing inbound queue" __L); LogNetcode(_L "Clearing inbound queue" __L);
MInboundQueue.lock(); MInboundQueue.lock();
if (!InboundQueue.empty()) { if (!InboundQueue.empty()) {
@@ -1047,7 +1047,7 @@ void EQStream::OutboundQueueClear()
{ {
EQProtocolPacket *p=nullptr; EQProtocolPacket *p=nullptr;
Log(Logs::Detail, Logs::Netcode, _L "Clearing outbound queue" __L); LogNetcode(_L "Clearing outbound queue" __L);
MOutboundQueue.lock(); MOutboundQueue.lock();
while(!NonSequencedQueue.empty()) { while(!NonSequencedQueue.empty()) {
@@ -1069,7 +1069,7 @@ void EQStream::PacketQueueClear()
{ {
EQProtocolPacket *p=nullptr; EQProtocolPacket *p=nullptr;
Log(Logs::Detail, Logs::Netcode, _L "Clearing future packet queue" __L); LogNetcode(_L "Clearing future packet queue" __L);
if(!PacketQueue.empty()) { if(!PacketQueue.empty()) {
std::map<unsigned short,EQProtocolPacket *>::iterator itr; std::map<unsigned short,EQProtocolPacket *>::iterator itr;
@@ -1101,7 +1101,7 @@ void EQStream::Process(const unsigned char *buffer, const uint32 length)
delete p; delete p;
ProcessQueue(); ProcessQueue();
} else { } else {
Log(Logs::Detail, Logs::Netcode, _L "Incoming packet failed checksum" __L); LogNetcode(_L "Incoming packet failed checksum" __L);
} }
} }
@@ -1132,23 +1132,23 @@ std::deque<EQProtocolPacket *>::iterator itr, tmp;
SeqOrder ord = CompareSequence(SequencedBase, seq); SeqOrder ord = CompareSequence(SequencedBase, seq);
if(ord == SeqInOrder) { if(ord == SeqInOrder) {
//they are not acking anything new... //they are not acking anything new...
Log(Logs::Detail, Logs::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); LogNetcode(_L "Received an ack with no window advancement (seq [{}])" __L, seq);
} else if(ord == SeqPast) { } else if(ord == SeqPast) {
//they are nacking blocks going back before our buffer, wtf? //they are nacking blocks going back before our buffer, wtf?
Log(Logs::Detail, Logs::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); LogNetcode(_L "Received an ack with backward window advancement (they gave [{}], our window starts at [{}]). This is bad" __L, seq, SequencedBase);
} else { } else {
Log(Logs::Detail, Logs::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); LogNetcode(_L "Received an ack up through sequence [{}]. Our base is [{}]" __L, seq, SequencedBase);
//this is a good ack, we get to ack some blocks. //this is a good ack, we get to ack some blocks.
seq++; //we stop at the block right after their ack, counting on the wrap of both numbers. seq++; //we stop at the block right after their ack, counting on the wrap of both numbers.
while(SequencedBase != seq) { while(SequencedBase != seq) {
if(SequencedQueue.empty()) { if(SequencedQueue.empty()) {
Log(Logs::Detail, Logs::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, SequencedQueue.size()); LogNetcode(_L "OUT OF PACKETS acked packet with sequence [{}]. Next send is [{}] before this" __L, (unsigned long)SequencedBase, SequencedQueue.size());
SequencedBase = NextOutSeq; SequencedBase = NextOutSeq;
break; break;
} }
Log(Logs::Detail, Logs::Netcode, _L "Removing acked packet with sequence %lu." __L, (unsigned long)SequencedBase); LogNetcode(_L "Removing acked packet with sequence [{}]" __L, (unsigned long)SequencedBase);
//clean out the acked packet //clean out the acked packet
delete SequencedQueue.front(); delete SequencedQueue.front();
SequencedQueue.pop_front(); SequencedQueue.pop_front();
@@ -1156,7 +1156,7 @@ std::deque<EQProtocolPacket *>::iterator itr, tmp;
SequencedBase++; SequencedBase++;
} }
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log(Logs::Detail, Logs::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); LogNetcode(_L "Post-Ack on [{}] Invalid Sequenced queue: BS [{}] + SQ [{}] != NOS [{}]" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq);
} }
} }
@@ -1166,7 +1166,7 @@ std::deque<EQProtocolPacket *>::iterator itr, tmp;
void EQStream::SetNextAckToSend(uint32 seq) void EQStream::SetNextAckToSend(uint32 seq)
{ {
MAcks.lock(); MAcks.lock();
Log(Logs::Detail, Logs::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); LogNetcode(_L "Set Next Ack To Send to [{}]" __L, (unsigned long)seq);
NextAckToSend=seq; NextAckToSend=seq;
MAcks.unlock(); MAcks.unlock();
} }
@@ -1174,7 +1174,7 @@ void EQStream::SetNextAckToSend(uint32 seq)
void EQStream::SetLastAckSent(uint32 seq) void EQStream::SetLastAckSent(uint32 seq)
{ {
MAcks.lock(); MAcks.lock();
Log(Logs::Detail, Logs::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); LogNetcode(_L "Set Last Ack Sent to [{}]" __L, (unsigned long)seq);
LastAckSent=seq; LastAckSent=seq;
MAcks.unlock(); MAcks.unlock();
} }
@@ -1187,10 +1187,10 @@ void EQStream::ProcessQueue()
EQProtocolPacket *qp=nullptr; EQProtocolPacket *qp=nullptr;
while((qp=RemoveQueue(NextInSeq))!=nullptr) { while((qp=RemoveQueue(NextInSeq))!=nullptr) {
Log(Logs::Detail, Logs::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); LogNetcode(_L "Processing Queued Packet: Seq=[{}]" __L, NextInSeq);
ProcessPacket(qp); ProcessPacket(qp);
delete qp; delete qp;
Log(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); LogNetcode(_L "OP_Packet Queue size=[{}]" __L, PacketQueue.size());
} }
} }
@@ -1201,21 +1201,21 @@ EQProtocolPacket *qp=nullptr;
if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) { if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) {
qp=itr->second; qp=itr->second;
PacketQueue.erase(itr); PacketQueue.erase(itr);
Log(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); LogNetcode(_L "OP_Packet Queue size=[{}]" __L, PacketQueue.size());
} }
return qp; return qp;
} }
void EQStream::SetStreamType(EQStreamType type) void EQStream::SetStreamType(EQStreamType type)
{ {
Log(Logs::Detail, Logs::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); LogNetcode(_L "Changing stream type from [{}] to [{}]" __L, StreamTypeString(StreamType), StreamTypeString(type));
StreamType=type; StreamType=type;
switch (StreamType) { switch (StreamType) {
case LoginStream: case LoginStream:
app_opcode_size=1; app_opcode_size=1;
compressed=false; compressed=false;
encoded=false; encoded=false;
Log(Logs::Detail, Logs::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); LogNetcode(_L "Login stream has app opcode size [{}], is not compressed or encoded" __L, app_opcode_size);
break; break;
case ChatOrMailStream: case ChatOrMailStream:
case ChatStream: case ChatStream:
@@ -1223,7 +1223,7 @@ void EQStream::SetStreamType(EQStreamType type)
app_opcode_size=1; app_opcode_size=1;
compressed=false; compressed=false;
encoded=true; encoded=true;
Log(Logs::Detail, Logs::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); LogNetcode(_L "Chat/Mail stream has app opcode size [{}], is not compressed, and is encoded" __L, app_opcode_size);
break; break;
case ZoneStream: case ZoneStream:
case WorldStream: case WorldStream:
@@ -1231,7 +1231,7 @@ void EQStream::SetStreamType(EQStreamType type)
app_opcode_size=2; app_opcode_size=2;
compressed=true; compressed=true;
encoded=false; encoded=false;
Log(Logs::Detail, Logs::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); LogNetcode(_L "World/Zone stream has app opcode size [{}], is compressed, and is not encoded" __L, app_opcode_size);
break; break;
} }
} }
@@ -1281,7 +1281,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq)
void EQStream::SetState(EQStreamState state) { void EQStream::SetState(EQStreamState state) {
MState.lock(); MState.lock();
Log(Logs::Detail, Logs::Netcode, _L "Changing state from %d to %d" __L, State, state); LogNetcode(_L "Changing state from [{}] to [{}]" __L, State, state);
State=state; State=state;
MState.unlock(); MState.unlock();
} }
@@ -1293,29 +1293,29 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) {
EQStreamState orig_state = GetState(); EQStreamState orig_state = GetState();
if (orig_state == CLOSING && !outgoing_data) { if (orig_state == CLOSING && !outgoing_data) {
Log(Logs::Detail, Logs::Netcode, _L "Out of data in closing state, disconnecting." __L); LogNetcode(_L "Out of data in closing state, disconnecting" __L);
_SendDisconnect(); _SendDisconnect();
SetState(DISCONNECTING); SetState(DISCONNECTING);
} else if (LastPacket && (now-LastPacket) > timeout) { } else if (LastPacket && (now-LastPacket) > timeout) {
switch(orig_state) { switch(orig_state) {
case CLOSING: case CLOSING:
//if we time out in the closing state, they are not acking us, just give up //if we time out in the closing state, they are not acking us, just give up
Log(Logs::Detail, Logs::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); LogNetcode(_L "Timeout expired in closing state. Moving to closed state" __L);
_SendDisconnect(); _SendDisconnect();
SetState(CLOSED); SetState(CLOSED);
break; break;
case DISCONNECTING: case DISCONNECTING:
//we timed out waiting for them to send us the disconnect reply, just give up. //we timed out waiting for them to send us the disconnect reply, just give up.
Log(Logs::Detail, Logs::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); LogNetcode(_L "Timeout expired in disconnecting state. Moving to closed state" __L);
SetState(CLOSED); SetState(CLOSED);
break; break;
case CLOSED: case CLOSED:
Log(Logs::Detail, Logs::Netcode, _L "Timeout expired in closed state??" __L); LogNetcode(_L "Timeout expired in closed state??" __L);
break; break;
case ESTABLISHED: case ESTABLISHED:
//we timed out during normal operation. Try to be nice about it. //we timed out during normal operation. Try to be nice about it.
//we will almost certainly time out again waiting for the disconnect reply, but oh well. //we will almost certainly time out again waiting for the disconnect reply, but oh well.
Log(Logs::Detail, Logs::Netcode, _L "Timeout expired in established state. Closing connection." __L); LogNetcode(_L "Timeout expired in established state. Closing connection" __L);
_SendDisconnect(); _SendDisconnect();
SetState(DISCONNECTING); SetState(DISCONNECTING);
break; break;
@@ -1342,7 +1342,7 @@ void EQStream::Decay()
for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end(); ++sitr, count++) { for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end(); ++sitr, count++) {
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && ((*sitr)->sent_time + retransmittimeout) < Timer::GetCurrentTime()) { if (!(*sitr)->acked && (*sitr)->sent_time > 0 && ((*sitr)->sent_time + retransmittimeout) < Timer::GetCurrentTime()) {
(*sitr)->sent_time = 0; (*sitr)->sent_time = 0;
Log(Logs::Detail, Logs::Netcode, _L "Timeout exceeded for seq %d. Flagging packet for retransmission" __L, SequencedBase + count); LogNetcode(_L "Timeout exceeded for seq [{}]. Flagging packet for retransmission" __L, SequencedBase + count);
} }
} }
MOutboundQueue.unlock(); MOutboundQueue.unlock();
@@ -1384,12 +1384,12 @@ void EQStream::AdjustRates(uint32 average_delta)
void EQStream::Close() { void EQStream::Close() {
if(HasOutgoingData()) { if(HasOutgoingData()) {
//there is pending data, wait for it to go out. //there is pending data, wait for it to go out.
Log(Logs::Detail, Logs::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); LogNetcode(_L "Stream requested to Close(), but there is pending data, waiting for it" __L);
SetState(CLOSING); SetState(CLOSING);
} else { } else {
//otherwise, we are done, we can drop immediately. //otherwise, we are done, we can drop immediately.
_SendDisconnect(); _SendDisconnect();
Log(Logs::Detail, Logs::Netcode, _L "Stream closing immediate due to Close()" __L); LogNetcode(_L "Stream closing immediate due to Close()" __L);
SetState(DISCONNECTING); SetState(DISCONNECTING);
} }
} }
@@ -1417,19 +1417,19 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) {
} else if(p->opcode == sig->first_eq_opcode) { } else if(p->opcode == sig->first_eq_opcode) {
//opcode matches, check length.. //opcode matches, check length..
if(p->size == sig->first_length) { if(p->size == sig->first_length) {
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); LogNetcode("[StreamIdentify] [{}]:[{}]: First opcode matched {:#04x} and length matched [{}]", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
res = MatchSuccessful; res = MatchSuccessful;
} else if(sig->first_length == 0) { } else if(sig->first_length == 0) {
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); LogNetcode("[StreamIdentify] [{}]:[{}]: First opcode matched {:#04x} and length ([{}]) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
res = MatchSuccessful; res = MatchSuccessful;
} else { } else {
//opcode matched but length did not. //opcode matched but length did not.
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); LogNetcode("[StreamIdentify] [{}]:[{}]: First opcode matched {:#04x}, but length [{}] did not match expected [{}]", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length);
res = MatchFailed; res = MatchFailed;
} }
} else { } else {
//first opcode did not match.. //first opcode did not match..
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); LogNetcode("[StreamIdentify] [{}]:[{}]: First opcode {:#04x} did not match expected {:#04x}", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode);
res = MatchFailed; res = MatchFailed;
} }
} }
+11 -11
View File
@@ -46,7 +46,7 @@ void EQStreamIdentifier::Process() {
//first see if this stream has expired //first see if this stream has expired
if(r.expire.Check(false)) { if(r.expire.Check(false)) {
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", r.stream->GetRemoteAddr().c_str(), ntohs(r.stream->GetRemotePort())); LogNetcode("[StreamIdentify] Unable to identify stream from [{}:{}] before timeout", r.stream->GetRemoteAddr().c_str(), ntohs(r.stream->GetRemotePort()));
r.stream->Close(); r.stream->Close();
cur = m_streams.erase(cur); cur = m_streams.erase(cur);
@@ -62,23 +62,23 @@ void EQStreamIdentifier::Process() {
} }
if(r.stream->GetState() != ESTABLISHED) { if(r.stream->GetState() != ESTABLISHED) {
//the stream closed before it was identified. //the stream closed before it was identified.
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort())); LogNetcode("[StreamIdentify] Unable to identify stream from [{}:{}] before it closed", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
switch(r.stream->GetState()) switch(r.stream->GetState())
{ {
case ESTABLISHED: case ESTABLISHED:
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Established"); LogNetcode("[StreamIdentify] Stream state was Established");
break; break;
case CLOSING: case CLOSING:
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closing"); LogNetcode("[StreamIdentify] Stream state was Closing");
break; break;
case DISCONNECTING: case DISCONNECTING:
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Disconnecting"); LogNetcode("[StreamIdentify] Stream state was Disconnecting");
break; break;
case CLOSED: case CLOSED:
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closed"); LogNetcode("[StreamIdentify] Stream state was Closed");
break; break;
default: default:
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); LogNetcode("[StreamIdentify] Stream state was Unestablished or unknown");
break; break;
} }
r.stream->ReleaseFromUse(); r.stream->ReleaseFromUse();
@@ -102,13 +102,13 @@ void EQStreamIdentifier::Process() {
switch(res) { switch(res) {
case EQStreamInterface::MatchNotReady: case EQStreamInterface::MatchNotReady:
//the stream has not received enough packets to compare with this signature //the stream has not received enough packets to compare with this signature
// Log.LogDebugType(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str()); // Log.LogDebugType(Logs::General, Logs::Netcode, "[StreamIdentify] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
all_ready = false; all_ready = false;
break; break;
case EQStreamInterface::MatchSuccessful: { case EQStreamInterface::MatchSuccessful: {
//yay, a match. //yay, a match.
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str()); LogNetcode("[StreamIdentify] Identified stream [{}:{}] with signature [{}]", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
// before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further // before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further
r.stream->SetActive(true); r.stream->SetActive(true);
@@ -122,7 +122,7 @@ void EQStreamIdentifier::Process() {
} }
case EQStreamInterface::MatchFailed: case EQStreamInterface::MatchFailed:
//do nothing... //do nothing...
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str()); LogNetcode("[StreamIdentify] [{}:{}] Tried patch [{}] and it did not match", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
break; break;
} }
} }
@@ -130,7 +130,7 @@ void EQStreamIdentifier::Process() {
//if we checked all patches and did not find a match. //if we checked all patches and did not find a match.
if(all_ready && !found_one) { if(all_ready && !found_one) {
//the stream cannot be identified. //the stream cannot be identified.
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort())); LogNetcode("[StreamIdentify] Unable to identify stream from [{}:{}], no match found", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
r.stream->ReleaseFromUse(); r.stream->ReleaseFromUse();
} }
+1 -1
View File
@@ -100,7 +100,7 @@ public:
virtual MatchState CheckSignature(const Signature *sig) { return MatchFailed; } virtual MatchState CheckSignature(const Signature *sig) { return MatchFailed; }
virtual EQStreamState GetState() = 0; virtual EQStreamState GetState() = 0;
virtual void SetOpcodeManager(OpcodeManager **opm) = 0; virtual void SetOpcodeManager(OpcodeManager **opm) = 0;
virtual const EQEmu::versions::ClientVersion ClientVersion() const { return EQEmu::versions::ClientVersion::Unknown; } virtual const EQ::versions::ClientVersion ClientVersion() const { return EQ::versions::ClientVersion::Unknown; }
virtual Stats GetStats() const = 0; virtual Stats GetStats() const = 0;
virtual void ResetStats() = 0; virtual void ResetStats() = 0;
virtual EQStreamManagerInterface* GetManager() const = 0; virtual EQStreamManagerInterface* GetManager() const = 0;
+3 -3
View File
@@ -22,7 +22,7 @@ std::string EQStreamProxy::Describe() const {
return(m_structs->Describe()); return(m_structs->Describe());
} }
const EQEmu::versions::ClientVersion EQStreamProxy::ClientVersion() const const EQ::versions::ClientVersion EQStreamProxy::ClientVersion() const
{ {
return m_structs->ClientVersion(); return m_structs->ClientVersion();
} }
@@ -42,8 +42,8 @@ void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
return; return;
if (p->GetOpcode() != OP_SpecialMesg) { if (p->GetOpcode() != OP_SpecialMesg) {
Log(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size()); Log(Logs::General, Logs::PacketServerClient, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
Log(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str()); Log(Logs::General, Logs::PacketServerClientWithDump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
} }
EQApplicationPacket *newp = p->Copy(); EQApplicationPacket *newp = p->Copy();
+1 -1
View File
@@ -28,7 +28,7 @@ public:
virtual void RemoveData(); virtual void RemoveData();
virtual bool CheckState(EQStreamState state); virtual bool CheckState(EQStreamState state);
virtual std::string Describe() const; virtual std::string Describe() const;
virtual const EQEmu::versions::ClientVersion ClientVersion() const; virtual const EQ::versions::ClientVersion ClientVersion() const;
virtual EQStreamState GetState(); virtual EQStreamState GetState();
virtual void SetOpcodeManager(OpcodeManager **opm); virtual void SetOpcodeManager(OpcodeManager **opm);
virtual Stats GetStats() const; virtual Stats GetStats() const;
+9
View File
@@ -104,6 +104,15 @@ void EQEmuConfig::parse_config()
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str()); DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
DatabaseDB = _root["server"]["database"].get("db", "eq").asString(); DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
/**
* Content Database
*/
ContentDbUsername = _root["server"]["content_database"].get("username", "").asString();
ContentDbPassword = _root["server"]["content_database"].get("password", "").asString();
ContentDbHost = _root["server"]["content_database"].get("host", "").asString();
ContentDbPort = atoi(_root["server"]["content_database"].get("port", 0).asString().c_str());
ContentDbName = _root["server"]["content_database"].get("db", "").asString();
/** /**
* QS * QS
*/ */
+8 -1
View File
@@ -74,6 +74,13 @@ class EQEmuConfig
std::string DatabaseDB; std::string DatabaseDB;
uint16 DatabasePort; uint16 DatabasePort;
// From <content_database/>
std::string ContentDbHost;
std::string ContentDbUsername;
std::string ContentDbPassword;
std::string ContentDbName;
uint16 ContentDbPort;
// From <qsdatabase> // QueryServ // From <qsdatabase> // QueryServ
std::string QSDatabaseHost; std::string QSDatabaseHost;
std::string QSDatabaseUsername; std::string QSDatabaseUsername;
@@ -165,7 +172,7 @@ class EQEmuConfig
fconfig >> _config->_root; fconfig >> _config->_root;
_config->parse_config(); _config->parse_config();
} }
catch (std::exception) { catch (std::exception &) {
return false; return false;
} }
return true; return true;
+1 -1
View File
@@ -18,7 +18,7 @@
#include "eqemu_exception.h" #include "eqemu_exception.h"
namespace EQEmu namespace EQ
{ {
Exception::Exception(const char* name, const std::string& description, const char* file, long line) Exception::Exception(const char* name, const std::string& description, const char* file, long line)
: line_(line), : line_(line),
+2 -2
View File
@@ -22,7 +22,7 @@
#include <sstream> #include <sstream>
#include <exception> #include <exception>
namespace EQEmu namespace EQ
{ {
//! EQEmu Exception Class //! EQEmu Exception Class
/*! /*!
@@ -104,7 +104,7 @@ namespace EQEmu
} // EQEmu } // EQEmu
#ifndef EQ_EXCEPT #ifndef EQ_EXCEPT
#define EQ_EXCEPT(n, d) throw EQEmu::Exception(n, d, __FILE__, __LINE__) #define EQ_EXCEPT(n, d) throw EQ::Exception(n, d, __FILE__, __LINE__)
#endif #endif
#endif #endif
+151 -56
View File
@@ -19,6 +19,7 @@
*/ */
#include "eqemu_logsys.h" #include "eqemu_logsys.h"
#include "rulesys.h"
#include "platform.h" #include "platform.h"
#include "string_util.h" #include "string_util.h"
#include "database.h" #include "database.h"
@@ -81,14 +82,6 @@ namespace Console {
}; };
} }
enum GameChatColor {
yellow = 15,
red = 13,
light_green = 14,
light_cyan = 258,
light_purple = 5
};
/** /**
* EQEmuLogSys Constructor * EQEmuLogSys Constructor
*/ */
@@ -96,16 +89,12 @@ EQEmuLogSys::EQEmuLogSys()
{ {
on_log_gmsay_hook = [](uint16 log_type, const std::string &) {}; on_log_gmsay_hook = [](uint16 log_type, const std::string &) {};
on_log_console_hook = [](uint16 debug_level, uint16 log_type, const std::string &) {}; on_log_console_hook = [](uint16 debug_level, uint16 log_type, const std::string &) {};
bool file_logs_enabled = false;
int log_platform = 0;
} }
/** /**
* EQEmuLogSys Deconstructor * EQEmuLogSys Deconstructor
*/ */
EQEmuLogSys::~EQEmuLogSys() EQEmuLogSys::~EQEmuLogSys() = default;
{
}
void EQEmuLogSys::LoadLogSettingsDefaults() void EQEmuLogSys::LoadLogSettingsDefaults()
{ {
@@ -126,15 +115,29 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
/** /**
* Set Defaults * Set Defaults
*/ */
log_settings[Logs::World_Server].log_to_console = Logs::General; log_settings[Logs::WorldServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Zone_Server].log_to_console = Logs::General; log_settings[Logs::ZoneServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::QS_Server].log_to_console = Logs::General; log_settings[Logs::QSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::UCS_Server].log_to_console = Logs::General; log_settings[Logs::UCSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Crash].log_to_console = Logs::General; log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::MySQLError].log_to_console = Logs::General; log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Login_Server].log_to_console = Logs::General; log_settings[Logs::Loginserver].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Headless_Client].log_to_console = Logs::General; log_settings[Logs::HeadlessClient].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::NPCScaling].log_to_gmsay = Logs::General; log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
/**
* RFC 5424
*/
log_settings[Logs::Emergency].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Alert].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Critical].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Error].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Warning].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Notice].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Info].log_to_console = static_cast<uint8>(Logs::General);
/** /**
* Set Category enabled status on defaults * Set Category enabled status on defaults
@@ -175,20 +178,41 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
} }
} }
/**
* @param log_category
* @return
*/
bool EQEmuLogSys::IsRfc5424LogCategory(uint16 log_category)
{
return (
log_category == Logs::Emergency ||
log_category == Logs::Alert ||
log_category == Logs::Critical ||
log_category == Logs::Error ||
log_category == Logs::Warning ||
log_category == Logs::Notice ||
log_category == Logs::Info ||
log_category == Logs::Debug
);
}
/** /**
* @param log_category * @param log_category
* @param in_message * @param in_message
* @return * @return
*/ */
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message) std::string EQEmuLogSys::FormatOutMessageString(
uint16 log_category,
const std::string &in_message
)
{ {
std::string ret; std::string return_string;
ret.push_back('[');
ret.append(Logs::LogCategoryName[log_category]); if (IsRfc5424LogCategory(log_category)) {
ret.push_back(']'); return_string = "[" + GetPlatformName() + "] ";
ret.push_back(' '); }
ret.append(in_message);
return ret; return return_string + "[" + Logs::LogCategoryName[log_category] + "] " + in_message;
} }
/** /**
@@ -196,7 +220,11 @@ std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::
* @param log_category * @param log_category
* @param message * @param message
*/ */
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message) void EQEmuLogSys::ProcessGMSay(
uint16 debug_level,
uint16 log_category,
const std::string &message
)
{ {
/** /**
* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash * Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash
@@ -218,7 +246,11 @@ void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const st
* @param log_category * @param log_category
* @param message * @param message
*/ */
void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message) void EQEmuLogSys::ProcessLogWrite(
uint16 debug_level,
uint16 log_category,
const std::string &message
)
{ {
if (log_category == Logs::Crash) { if (log_category == Logs::Crash) {
char time_stamp[80]; char time_stamp[80];
@@ -280,6 +312,8 @@ std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category)
case Logs::Normal: case Logs::Normal:
return LC_YELLOW; return LC_YELLOW;
case Logs::MySQLError: case Logs::MySQLError:
case Logs::Warning:
case Logs::Critical:
case Logs::Error: case Logs::Error:
return LC_RED; return LC_RED;
case Logs::MySQLQuery: case Logs::MySQLQuery:
@@ -306,22 +340,22 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
switch (log_category) { switch (log_category) {
case Logs::Status: case Logs::Status:
case Logs::Normal: case Logs::Normal:
return GameChatColor::yellow; return Chat::Yellow;
case Logs::MySQLError: case Logs::MySQLError:
case Logs::Error: case Logs::Error:
return GameChatColor::red; return Chat::Red;
case Logs::MySQLQuery: case Logs::MySQLQuery:
case Logs::Debug: case Logs::Debug:
return GameChatColor::light_green; return Chat::Lime;
case Logs::Quests: case Logs::Quests:
return GameChatColor::light_cyan; return Chat::Group;
case Logs::Commands: case Logs::Commands:
case Logs::Mercenaries: case Logs::Mercenaries:
return GameChatColor::light_purple; return Chat::Magenta;
case Logs::Crash: case Logs::Crash:
return GameChatColor::red; return Chat::Red;
default: default:
return GameChatColor::yellow; return Chat::Yellow;
} }
} }
@@ -351,6 +385,42 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category,
on_log_console_hook(debug_level, log_category, message); on_log_console_hook(debug_level, log_category, message);
} }
/**
* @param str
* @return
*/
constexpr const char *str_end(const char *str)
{
return *str ? str_end(str + 1) : str;
}
/**
* @param str
* @return
*/
constexpr bool str_slant(const char *str)
{
return *str == '/' ? true : (*str ? str_slant(str + 1) : false);
}
/**
* @param str
* @return
*/
constexpr const char *r_slant(const char *str)
{
return *str == '/' ? (str + 1) : r_slant(str - 1);
}
/**
* @param str
* @return
*/
constexpr const char *base_file_name(const char *str)
{
return str_slant(str) ? r_slant(str_end(str)) : str;
}
/** /**
* Core logging function * Core logging function
* *
@@ -359,7 +429,15 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category,
* @param message * @param message
* @param ... * @param ...
*/ */
void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...) void EQEmuLogSys::Out(
Logs::DebugLevel debug_level,
uint16 log_category,
const char *file,
const char *func,
int line,
const char *message,
...
)
{ {
bool log_to_console = true; bool log_to_console = true;
if (log_settings[log_category].log_to_console < debug_level) { if (log_settings[log_category].log_to_console < debug_level) {
@@ -381,12 +459,18 @@ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::st
return; return;
} }
std::string prefix;
if (RuleB(Logging, PrintFileFunctionAndLine)) {
prefix = fmt::format("[{0}::{1}:{2}] ", base_file_name(file), func, line);
}
va_list args; va_list args;
va_start(args, message); va_start(args, message);
std::string output_message = vStringFormat(message.c_str(), args); std::string output_message = vStringFormat(message, args);
va_end(args); va_end(args);
std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message); std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, prefix + output_message);
if (log_to_console) { if (log_to_console) {
EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message); EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message);
@@ -422,7 +506,7 @@ void EQEmuLogSys::MakeDirectory(const std::string &directory_name)
return; return;
_mkdir(directory_name.c_str()); _mkdir(directory_name.c_str());
#else #else
struct stat st; struct stat st{};
if (stat(directory_name.c_str(), &st) == 0) { // exists if (stat(directory_name.c_str(), &st) == 0) { // exists
return; return;
} }
@@ -463,12 +547,7 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
return; return;
} }
EQEmuLogSys::Out( LogInfo("Starting File Log [logs/{}_{}.log]", platform_file_name.c_str(), getpid());
Logs::General,
Logs::Status,
"Starting File Log 'logs/%s_%i.log'",
platform_file_name.c_str(),
getpid());
/** /**
* Make directory if not exists * Make directory if not exists
@@ -488,17 +567,11 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
/** /**
* All other processes * All other processes
*/ */
if (platform_file_name.empty()) { if (platform_file_name.empty()) {
return; return;
} }
EQEmuLogSys::Out( LogInfo("Starting File Log [logs/{}_{}.log]", platform_file_name.c_str(), getpid());
Logs::General,
Logs::Status,
"Starting File Log 'logs/%s_%i.log'",
platform_file_name.c_str(),
getpid());
/** /**
* Open file pointer * Open file pointer
@@ -509,3 +582,25 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
); );
} }
} }
/**
* Silence console logging
*/
void EQEmuLogSys::SilenceConsoleLogging()
{
for (int log_index = Logs::AA; log_index != Logs::MaxCategoryID; log_index++) {
log_settings[log_index].log_to_console = 0;
log_settings[log_index].is_category_enabled = 0;
}
}
/**
* Enables console logging
*/
void EQEmuLogSys::EnableConsoleLogging()
{
for (int log_index = Logs::AA; log_index != Logs::MaxCategoryID; log_index++) {
log_settings[log_index].log_to_console = Logs::General;
log_settings[log_index].is_category_enabled = 1;
}
}
+150 -29
View File
@@ -25,6 +25,14 @@
#include <fstream> #include <fstream>
#include <stdio.h> #include <stdio.h>
#include <functional> #include <functional>
#ifdef _WIN32
#ifdef utf16_to_utf8
#undef utf16_to_utf8
#endif
#endif
#include <fmt/format.h>
#include "types.h" #include "types.h"
namespace Logs { namespace Logs {
@@ -45,7 +53,7 @@ namespace Logs {
AI, AI,
Aggro, Aggro,
Attack, Attack,
Client_Server_Packet, PacketClientServer,
Combat, Combat,
Commands, Commands,
Crash, Crash,
@@ -59,40 +67,60 @@ namespace Logs {
Normal, Normal,
Object, Object,
Pathing, Pathing,
QS_Server, QSServer,
Quests, Quests,
Rules, Rules,
Skills, Skills,
Spawns, Spawns,
Spells, Spells,
Status, Status,
TCP_Connection, TCPConnection,
Tasks, Tasks,
Tradeskills, Tradeskills,
Trading, Trading,
Tribute, Tribute,
UCS_Server, UCSServer,
WebInterface_Server, WebInterfaceServer,
World_Server, WorldServer,
Zone_Server, ZoneServer,
MySQLError, MySQLError,
MySQLQuery, MySQLQuery,
Mercenaries, Mercenaries,
QuestDebug, QuestDebug,
Server_Client_Packet, PacketServerClient,
Client_Server_Packet_Unhandled, PacketClientServerUnhandled,
Server_Client_Packet_With_Dump, PacketServerClientWithDump,
Client_Server_Packet_With_Dump, PacketClientServerWithDump,
Login_Server, Loginserver,
Client_Login, ClientLogin,
Headless_Client, HeadlessClient,
HP_Update, HPUpdate,
FixZ, FixZ,
Food, Food,
Traps, Traps,
NPCRoamBox, NPCRoamBox,
NPCScaling, NPCScaling,
MobAppearance, MobAppearance,
Info,
Warning,
Critical,
Emergency,
Alert,
Notice,
AIScanClose,
AIYellForHelp,
AICastBeneficialClose,
AoeCast,
EntityManagement,
Flee,
Aura,
HotReload,
Merchants,
ZonePoints,
Loot,
Expeditions,
DynamicZones,
Group,
MaxCategoryID /* Don't Remove this */ MaxCategoryID /* Don't Remove this */
}; };
@@ -152,19 +180,31 @@ namespace Logs {
"Traps", "Traps",
"NPC Roam Box", "NPC Roam Box",
"NPC Scaling", "NPC Scaling",
"Mob Appearance" "Mob Appearance",
"Info",
"Warning",
"Critical",
"Emergency",
"Alert",
"Notice",
"AI Scan Close",
"AI Yell For Help",
"AI Cast Beneficial Close",
"AOE Cast",
"Entity Management",
"Flee",
"Aura",
"HotReload",
"Merchants",
"ZonePoints",
"Loot",
"Expeditions",
"DynamicZones",
"Group",
}; };
} }
#define Log(debug_level, log_category, message, ...) do {\ #include "eqemu_logsys_log_aliases.h"
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
LogSys.Out(debug_level, log_category, message, ##__VA_ARGS__);\
} while (0)
#define LogF(debug_level, log_category, message, ...) do {\
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
OutF(LogSys, debug_level, log_category, message, ##__VA_ARGS__);\
} while (0)
class EQEmuLogSys { class EQEmuLogSys {
public: public:
@@ -177,6 +217,10 @@ public:
*/ */
void CloseFileLogs(); void CloseFileLogs();
void LoadLogSettingsDefaults(); void LoadLogSettingsDefaults();
/**
* @param directory_name
*/
void MakeDirectory(const std::string &directory_name); void MakeDirectory(const std::string &directory_name);
/** /**
@@ -188,12 +232,25 @@ public:
* - This would pipe the same category and debug level to all output formats, but the internal memory reference of log_settings would * - This would pipe the same category and debug level to all output formats, but the internal memory reference of log_settings would
* be checked against to see if that piped output is set to actually process it for the category and debug level * be checked against to see if that piped output is set to actually process it for the category and debug level
*/ */
void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...); void Out(
Logs::DebugLevel debug_level,
uint16 log_category,
const char *file,
const char *func,
int line,
const char *message,
...
);
/** /**
* Used in file logs to prepend a timestamp entry for logs * 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
*/
void StartFileLogs(const std::string &log_name = ""); void StartFileLogs(const std::string &log_name = "");
/** /**
@@ -218,14 +275,14 @@ public:
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults * These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
* Database loaded via Database::LoadLogSettings(log_settings) * Database loaded via Database::LoadLogSettings(log_settings)
*/ */
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]; LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
bool file_logs_enabled; bool file_logs_enabled = false;
/** /**
* Sets Executable platform (Zone/World/UCS) etc. * Sets Executable platform (Zone/World/UCS) etc.
*/ */
int log_platform; int log_platform = 0;
/** /**
* File name used in writing logs * File name used in writing logs
@@ -240,9 +297,26 @@ public:
*/ */
uint16 GetGMSayColorFromCategory(uint16 log_category); uint16 GetGMSayColorFromCategory(uint16 log_category);
/**
* @param f
*/
void SetGMSayHandler(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; } void SetGMSayHandler(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
/**
* @param f
*/
void SetConsoleHandler(std::function<void(uint16 debug_level, uint16 log_type, const std::string&)> f) { on_log_console_hook = f; } void SetConsoleHandler(std::function<void(uint16 debug_level, uint16 log_type, const std::string&)> f) { on_log_console_hook = f; }
/**
* Silence console logging
*/
void SilenceConsoleLogging();
/**
* Turn on all console logging
*/
void EnableConsoleLogging();
private: private:
/** /**
@@ -258,6 +332,7 @@ private:
/** /**
* Linux console color messages mapped by category * Linux console color messages mapped by category
*
* @param log_category * @param log_category
* @return * @return
*/ */
@@ -268,11 +343,57 @@ private:
*/ */
uint16 GetWindowsConsoleColorFromCategory(uint16 log_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); 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); 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); void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message);
/**
* @param log_category
* @return
*/
bool IsRfc5424LogCategory(uint16 log_category);
}; };
extern EQEmuLogSys LogSys; extern EQEmuLogSys LogSys;
/**
template<typename... Args>
void OutF(
EQEmuLogSys &ls,
Logs::DebugLevel debug_level,
uint16 log_category,
const char *file,
const char *func,
int line,
const char *fmt,
const Args &... args
)
{
std::string log_str = fmt::format(fmt, args...);
ls.Out(debug_level, log_category, file, func, line, log_str.c_str());
}
**/
#define OutF(ls, debug_level, log_category, file, func, line, formatStr, ...) \
do { \
ls.Out(debug_level, log_category, file, func, line, fmt::format(formatStr, ##__VA_ARGS__).c_str()); \
} while(0)
#endif #endif
File diff suppressed because it is too large Load Diff
+8
View File
@@ -21,6 +21,14 @@ namespace EQ
uv_run(&m_loop, UV_RUN_NOWAIT); uv_run(&m_loop, UV_RUN_NOWAIT);
} }
void Run() {
uv_run(&m_loop, UV_RUN_DEFAULT);
}
void Shutdown() {
uv_stop(&m_loop);
}
uv_loop_t* Handle() { return &m_loop; } uv_loop_t* Handle() { return &m_loop; }
private: private:
+3 -3
View File
@@ -8,7 +8,7 @@ namespace EQ {
class Task class Task
{ {
public: public:
typedef std::function<void(const EQEmu::Any&)> ResolveFn; typedef std::function<void(const EQ::Any&)> ResolveFn;
typedef std::function<void(const std::exception&)> RejectFn; typedef std::function<void(const std::exception&)> RejectFn;
typedef std::function<void()> FinallyFn; typedef std::function<void()> FinallyFn;
typedef std::function<void(ResolveFn, RejectFn)> TaskFn; typedef std::function<void(ResolveFn, RejectFn)> TaskFn;
@@ -19,7 +19,7 @@ namespace EQ {
RejectFn on_catch; RejectFn on_catch;
FinallyFn on_finally; FinallyFn on_finally;
bool has_result; bool has_result;
EQEmu::Any result; EQ::Any result;
bool has_error; bool has_error;
std::exception error; std::exception error;
}; };
@@ -63,7 +63,7 @@ namespace EQ {
uv_queue_work(EventLoop::Get().Handle(), m_work, [](uv_work_t* req) { uv_queue_work(EventLoop::Get().Handle(), m_work, [](uv_work_t* req) {
TaskBaton *baton = (TaskBaton*)req->data; TaskBaton *baton = (TaskBaton*)req->data;
baton->fn([baton](const EQEmu::Any& result) { baton->fn([baton](const EQ::Any& result) {
baton->has_error = false; baton->has_error = false;
baton->has_result = true; baton->has_result = true;
baton->result = result; baton->result = result;
+114
View File
@@ -0,0 +1,114 @@
#pragma once
#include <vector>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <queue>
#include <future>
namespace EQ
{
namespace Event
{
class TaskScheduler
{
public:
static const int DefaultThreadCount = 4;
TaskScheduler() : _running(false)
{
Start(DefaultThreadCount);
}
TaskScheduler(size_t threads) : _running(false)
{
Start(threads);
}
~TaskScheduler() {
Stop();
}
void Start(size_t threads) {
if (true == _running) {
return;
}
_running = true;
for (size_t i = 0; i < threads; ++i) {
_threads.push_back(std::thread(std::bind(&TaskScheduler::ProcessWork, this)));
}
}
void Stop() {
if (false == _running) {
return;
}
{
std::unique_lock<std::mutex> lock(_lock);
_running = false;
}
_cv.notify_all();
for (auto &t : _threads) {
t.join();
}
}
template<typename Fn, typename... Args>
auto Enqueue(Fn&& fn, Args&&... args) -> std::future<typename std::result_of<Fn(Args...)>::type> {
using return_type = typename std::result_of<Fn(Args...)>::type;
auto task = std::make_shared<std::packaged_task<return_type()>>(
std::bind(std::forward<Fn>(fn), std::forward<Args>(args)...)
);
std::future<return_type> res = task->get_future();
{
std::unique_lock<std::mutex> lock(_lock);
if (false == _running) {
throw std::runtime_error("Enqueue on stopped scheduler.");
}
_tasks.emplace([task]() { (*task)(); });
}
_cv.notify_one();
return res;
}
private:
void ProcessWork() {
for (;;) {
std::function<void()> work;
{
std::unique_lock<std::mutex> lock(_lock);
_cv.wait(lock, [this] { return !_running || !_tasks.empty(); });
if (false == _running) {
return;
}
work = std::move(_tasks.front());
_tasks.pop();
}
work();
}
}
bool _running = true;
std::vector<std::thread> _threads;
std::mutex _lock;
std::condition_variable _cv;
std::queue<std::function<void()>> _tasks;
};
}
}
+1 -1
View File
@@ -40,7 +40,7 @@ struct ExtendedProfile_Struct {
uint16 old_pet_hp; /* Not Used */ uint16 old_pet_hp; /* Not Used */
uint16 old_pet_mana; /* Not Used */ uint16 old_pet_mana; /* Not Used */
SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */ SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
EQEmu::TextureMaterialProfile pet_items; /* Not Used */ EQ::TextureMaterialProfile pet_items; /* Not Used */
char merc_name[64]; /* Used */ char merc_name[64]; /* Used */
uint32 aa_effects; /* Used */ uint32 aa_effects; /* Used */
+67
View File
@@ -0,0 +1,67 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#include <fstream>
#include "file_util.h"
#ifdef _WINDOWS
#include <direct.h>
#include <conio.h>
#include <iostream>
#include <dos.h>
#include <windows.h>
#include <process.h>
#else
#include <unistd.h>
#include <sys/stat.h>
#endif
/**
* @param name
* @return
*/
bool FileUtil::exists(const std::string &name)
{
std::ifstream f(name.c_str());
return f.good();
}
/**
* @param directory_name
*/
void FileUtil::mkdir(const std::string& directory_name)
{
#ifdef _WINDOWS
struct _stat st;
if (_stat(directory_name.c_str(), &st) == 0) // exists
return;
_mkdir(directory_name.c_str());
#else
struct stat st{};
if (stat(directory_name.c_str(), &st) == 0) { // exists
return;
}
::mkdir(directory_name.c_str(), 0755);
#endif
}
+32
View File
@@ -0,0 +1,32 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#ifndef EQEMU_FILE_UTIL_H
#define EQEMU_FILE_UTIL_H
class FileUtil {
public:
static bool exists(const std::string &name);
static void mkdir(const std::string& directory_name);
};
#endif //EQEMU_FILE_UTIL_H
+1 -1
View File
@@ -23,7 +23,7 @@
#include "eqemu_exception.h" #include "eqemu_exception.h"
#include "types.h" #include "types.h"
namespace EQEmu { namespace EQ {
/*! Simple HashSet designed to be used in fixed memory that may be difficult to use an /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an
allocator for (shared memory), we assume all keys are unsigned int allocator for (shared memory), we assume all keys are unsigned int
+1 -1
View File
@@ -23,7 +23,7 @@
#include "eqemu_exception.h" #include "eqemu_exception.h"
#include "types.h" #include "types.h"
namespace EQEmu { namespace EQ {
/*! Simple HashSet designed to be used in fixed memory that may be difficult to use an /*! Simple HashSet designed to be used in fixed memory that may be difficult to use an
allocator for (shared memory), we assume all keys are unsigned int, values are a pointer and size allocator for (shared memory), we assume all keys are unsigned int, values are a pointer and size
+47 -47
View File
@@ -46,7 +46,7 @@ bool BaseGuildManager::LoadGuilds() {
ClearGuilds(); ClearGuilds();
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested to load guilds when we have no database object."); LogGuilds("Requested to load guilds when we have no database object");
return(false); return(false);
} }
@@ -77,13 +77,13 @@ bool BaseGuildManager::LoadGuilds() {
uint8 rankn = atoi(row[1]); uint8 rankn = atoi(row[1]);
if(rankn > GUILD_MAX_RANK) { if(rankn > GUILD_MAX_RANK) {
Log(Logs::Detail, Logs::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); LogGuilds("Found invalid (too high) rank [{}] for guild [{}], skipping", rankn, guild_id);
continue; continue;
} }
res = m_guilds.find(guild_id); res = m_guilds.find(guild_id);
if(res == m_guilds.end()) { if(res == m_guilds.end()) {
Log(Logs::Detail, Logs::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); LogGuilds("Found rank [{}] for non-existent guild [{}], skipping", rankn, guild_id);
continue; continue;
} }
@@ -105,7 +105,7 @@ bool BaseGuildManager::LoadGuilds() {
bool BaseGuildManager::RefreshGuild(uint32 guild_id) { bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); LogGuilds("Requested to refresh guild [{}] when we have no database object", guild_id);
return(false); return(false);
} }
@@ -123,7 +123,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
if (results.RowCount() == 0) if (results.RowCount() == 0)
{ {
Log(Logs::Detail, Logs::Guilds, "Unable to find guild %d in the database.", guild_id); LogGuilds("Unable to find guild [{}] in the database", guild_id);
return false; return false;
} }
@@ -145,7 +145,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
uint8 rankn = atoi(row[1]); uint8 rankn = atoi(row[1]);
if(rankn > GUILD_MAX_RANK) { if(rankn > GUILD_MAX_RANK) {
Log(Logs::Detail, Logs::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); LogGuilds("Found invalid (too high) rank [{}] for guild [{}], skipping", rankn, guild_id);
continue; continue;
} }
@@ -162,7 +162,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1') ? true: false; rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1') ? true: false;
} }
Log(Logs::Detail, Logs::Guilds, "Successfully refreshed guild %d from the database.", guild_id); LogGuilds("Successfully refreshed guild [{}] from the database", guild_id);
return true; return true;
} }
@@ -214,14 +214,14 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con
bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) {
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested to store guild %d when we have no database object.", guild_id); LogGuilds("Requested to store guild [{}] when we have no database object", guild_id);
return(false); return(false);
} }
std::map<uint32, GuildInfo *>::const_iterator res; std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id); res = m_guilds.find(guild_id);
if(res == m_guilds.end()) { if(res == m_guilds.end()) {
Log(Logs::Detail, Logs::Guilds, "Requested to store non-existent guild %d", guild_id); LogGuilds("Requested to store non-existent guild [{}]", guild_id);
return(false); return(false);
} }
GuildInfo *info = res->second; GuildInfo *info = res->second;
@@ -289,14 +289,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) {
safe_delete_array(title_esc); safe_delete_array(title_esc);
} }
Log(Logs::Detail, Logs::Guilds, "Stored guild %d in the database", guild_id); LogGuilds("Stored guild [{}] in the database", guild_id);
return true; return true;
} }
uint32 BaseGuildManager::_GetFreeGuildID() { uint32 BaseGuildManager::_GetFreeGuildID() {
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested find a free guild ID when we have no database object."); LogGuilds("Requested find a free guild ID when we have no database object");
return(GUILD_NONE); return(GUILD_NONE);
} }
@@ -330,12 +330,12 @@ uint32 BaseGuildManager::_GetFreeGuildID() {
if (results.RowCount() == 0) if (results.RowCount() == 0)
{ {
Log(Logs::Detail, Logs::Guilds, "Located free guild ID %d in the database", index); LogGuilds("Located free guild ID [{}] in the database", index);
return index; return index;
} }
} }
Log(Logs::Detail, Logs::Guilds, "Unable to find a free guild ID when requested."); LogGuilds("Unable to find a free guild ID when requested");
return GUILD_NONE; return GUILD_NONE;
} }
@@ -505,11 +505,11 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) {
//now store the resulting guild setup into the DB. //now store the resulting guild setup into the DB.
if(!_StoreGuildDB(new_id)) { if(!_StoreGuildDB(new_id)) {
Log(Logs::Detail, Logs::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); LogGuilds("Error storing new guild. It may have been partially created which may need manual removal");
return(GUILD_NONE); return(GUILD_NONE);
} }
Log(Logs::Detail, Logs::Guilds, "Created guild %d in the database.", new_id); LogGuilds("Created guild [{}] in the database", new_id);
return(new_id); return(new_id);
} }
@@ -525,7 +525,7 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) {
} }
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); LogGuilds("Requested to delete guild [{}] when we have no database object", guild_id);
return(false); return(false);
} }
@@ -545,14 +545,14 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) {
query = StringFormat("DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id); query = StringFormat("DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id);
QueryWithLogging(query, "deleting guild bank"); QueryWithLogging(query, "deleting guild bank");
Log(Logs::Detail, Logs::Guilds, "Deleted guild %d from the database.", guild_id); LogGuilds("Deleted guild [{}] from the database", guild_id);
return(true); return(true);
} }
bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) {
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); LogGuilds("Requested to rename guild [{}] when we have no database object", guild_id);
return false; return false;
} }
@@ -573,13 +573,13 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) {
if (!results.Success()) if (!results.Success())
{ {
Log(Logs::Detail, Logs::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); LogGuilds("Error renaming guild [{}] [{}]: [{}]", guild_id, query.c_str(), results.Success());
safe_delete_array(esc); safe_delete_array(esc);
return false; return false;
} }
safe_delete_array(esc); safe_delete_array(esc);
Log(Logs::Detail, Logs::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); LogGuilds("Renamed guild [{}] ([{}]) to [{}] in database", info->name.c_str(), guild_id, name);
info->name = name; //update our local record. info->name = name; //update our local record.
@@ -588,7 +588,7 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) {
bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) {
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); LogGuilds("Requested to set the leader for guild [{}] when we have no database object", guild_id);
return false; return false;
} }
@@ -614,7 +614,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) {
if(!DBSetGuildRank(leader, GUILD_LEADER)) if(!DBSetGuildRank(leader, GUILD_LEADER))
return false; return false;
Log(Logs::Detail, Logs::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); LogGuilds("Set guild leader for guild [{}] to [{}] in the database", guild_id, leader);
info->leader_char_id = leader; //update our local record. info->leader_char_id = leader; //update our local record.
@@ -623,7 +623,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) {
bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) { bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) {
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); LogGuilds("Requested to set the MOTD for guild [{}] when we have no database object", guild_id);
return(false); return(false);
} }
@@ -654,7 +654,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c
safe_delete_array(esc); safe_delete_array(esc);
safe_delete_array(esc_set); safe_delete_array(esc_set);
Log(Logs::Detail, Logs::Guilds, "Set MOTD for guild %d in the database", guild_id); LogGuilds("Set MOTD for guild [{}] in the database", guild_id);
info->motd = motd; //update our local record. info->motd = motd; //update our local record.
info->motd_setter = setter; //update our local record. info->motd_setter = setter; //update our local record.
@@ -688,7 +688,7 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL)
} }
safe_delete_array(esc); safe_delete_array(esc);
Log(Logs::Detail, Logs::Guilds, "Set URL for guild %d in the database", GuildID); LogGuilds("Set URL for guild [{}] in the database", GuildID);
info->url = URL; //update our local record. info->url = URL; //update our local record.
@@ -722,7 +722,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel)
} }
safe_delete_array(esc); safe_delete_array(esc);
Log(Logs::Detail, Logs::Guilds, "Set Channel for guild %d in the database", GuildID); LogGuilds("Set Channel for guild [{}] in the database", GuildID);
info->channel = Channel; //update our local record. info->channel = Channel; //update our local record.
@@ -731,7 +731,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel)
bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); LogGuilds("Requested to set char to guild [{}] when we have no database object", guild_id);
return(false); return(false);
} }
@@ -753,7 +753,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
return false; return false;
} }
} }
Log(Logs::Detail, Logs::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); LogGuilds("Set char [{}] to guild [{}] and rank [{}] in the database", charid, guild_id, rank);
return true; return true;
} }
@@ -845,7 +845,7 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) {
return false; return false;
} }
Log(Logs::Detail, Logs::Guilds, "Set public not for char %d", charid); LogGuilds("Set public not for char [{}]", charid);
return true; return true;
} }
@@ -912,7 +912,7 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vector<CharGuildInfo
return(false); return(false);
//load up the rank info for each guild. //load up the rank info for each guild.
std::string query = StringFormat(GuildMemberBaseQuery " WHERE g.guild_id=%d", guild_id); std::string query = StringFormat(GuildMemberBaseQuery " WHERE g.guild_id=%d AND c.deleted_at IS NULL", guild_id);
auto results = m_db->QueryDatabase(query); auto results = m_db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
return false; return false;
@@ -924,14 +924,14 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vector<CharGuildInfo
members.push_back(ci); members.push_back(ci);
} }
Log(Logs::Detail, Logs::Guilds, "Retreived entire guild member list for guild %d from the database", guild_id); LogGuilds("Retreived entire guild member list for guild [{}] from the database", guild_id);
return true; return true;
} }
bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested char info on %s when we have no database object.", char_name); LogGuilds("Requested char info on [{}] when we have no database object", char_name);
return(false); return(false);
} }
@@ -941,7 +941,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
m_db->DoEscapeString(esc, char_name, nl); m_db->DoEscapeString(esc, char_name, nl);
//load up the rank info for each guild. //load up the rank info for each guild.
std::string query = StringFormat(GuildMemberBaseQuery " WHERE c.name='%s'", esc); std::string query = StringFormat(GuildMemberBaseQuery " WHERE c.name='%s' AND c.deleted_at IS NULL", esc);
safe_delete_array(esc); safe_delete_array(esc);
auto results = m_db->QueryDatabase(query); auto results = m_db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
@@ -953,7 +953,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
auto row = results.begin(); auto row = results.begin();
ProcessGuildMember(row, into); ProcessGuildMember(row, into);
Log(Logs::Detail, Logs::Guilds, "Retreived guild member info for char %s from the database", char_name); LogGuilds("Retreived guild member info for char [{}] from the database", char_name);
return true; return true;
@@ -962,16 +962,16 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) {
if(m_db == nullptr) { if(m_db == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Requested char info on %d when we have no database object.", char_id); LogGuilds("Requested char info on [{}] when we have no database object", char_id);
return false; return false;
} }
//load up the rank info for each guild. //load up the rank info for each guild.
std::string query; std::string query;
#ifdef BOTS #ifdef BOTS
query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.mob_type = 'C'", char_id); query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.mob_type = 'C' AND c.deleted_at IS NULL", char_id);
#else #else
query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d", char_id); query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.deleted_at IS NULL", char_id);
#endif #endif
auto results = m_db->QueryDatabase(query); auto results = m_db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
@@ -983,7 +983,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) {
auto row = results.begin(); auto row = results.begin();
ProcessGuildMember(row, into); ProcessGuildMember(row, into);
Log(Logs::Detail, Logs::Guilds, "Retreived guild member info for char %d", char_id); LogGuilds("Retreived guild member info for char [{}]", char_id);
return true; return true;
@@ -1098,16 +1098,16 @@ bool BaseGuildManager::GuildExists(uint32 guild_id) const {
bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const { bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const {
if(guild_id == GUILD_NONE) { if(guild_id == GUILD_NONE) {
Log(Logs::Detail, Logs::Guilds, "Check leader for char %d: not a guild.", char_id); LogGuilds("Check leader for char [{}]: not a guild", char_id);
return(false); return(false);
} }
std::map<uint32, GuildInfo *>::const_iterator res; std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id); res = m_guilds.find(guild_id);
if(res == m_guilds.end()) { if(res == m_guilds.end()) {
Log(Logs::Detail, Logs::Guilds, "Check leader for char %d: invalid guild.", char_id); LogGuilds("Check leader for char [{}]: invalid guild", char_id);
return(false); //invalid guild return(false); //invalid guild
} }
Log(Logs::Detail, Logs::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); LogGuilds("Check leader for guild [{}], char [{}]: leader id=[{}]", guild_id, char_id, res->second->leader_char_id);
return(char_id == res->second->leader_char_id); return(char_id == res->second->leader_char_id);
} }
@@ -1137,20 +1137,20 @@ uint8 BaseGuildManager::GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 cha
bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const {
if(status >= 250) { if(status >= 250) {
Log(Logs::Detail, Logs::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); LogGuilds("Check permission on guild [{}] with user status [{}] > 250, granted", guild_id, status);
return(true); //250+ as allowed anything return(true); //250+ as allowed anything
} }
std::map<uint32, GuildInfo *>::const_iterator res; std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id); res = m_guilds.find(guild_id);
if(res == m_guilds.end()) { if(res == m_guilds.end()) {
Log(Logs::Detail, Logs::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); LogGuilds("Check permission on guild [{}] with user status [{}], no such guild, denied", guild_id, status);
return(false); //invalid guild return(false); //invalid guild
} }
bool granted = (res->second->minstatus <= status); bool granted = (res->second->minstatus <= status);
Log(Logs::Detail, Logs::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", LogGuilds("Check permission on guild [{}] ([{}]) with user status [{}]. Min status [{}]: [{}]",
res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied"); res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied");
return(granted); return(granted);
@@ -1158,21 +1158,21 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const {
bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const { bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const {
if(rank > GUILD_MAX_RANK) { if(rank > GUILD_MAX_RANK) {
Log(Logs::Detail, Logs::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", LogGuilds("Check permission on guild [{}] and rank [{}] for action [{}] ([{}]): Invalid rank, denied",
guild_id, rank, GuildActionNames[act], act); guild_id, rank, GuildActionNames[act], act);
return(false); //invalid rank return(false); //invalid rank
} }
std::map<uint32, GuildInfo *>::const_iterator res; std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id); res = m_guilds.find(guild_id);
if(res == m_guilds.end()) { if(res == m_guilds.end()) {
Log(Logs::Detail, Logs::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", LogGuilds("Check permission on guild [{}] and rank [{}] for action [{}] ([{}]): Invalid guild, denied",
guild_id, rank, GuildActionNames[act], act); guild_id, rank, GuildActionNames[act], act);
return(false); //invalid guild return(false); //invalid guild
} }
bool granted = res->second->ranks[rank].permissions[act]; bool granted = res->second->ranks[rank].permissions[act];
Log(Logs::Detail, Logs::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", LogGuilds("Check permission on guild [{}] ([{}]) and rank [{}] ([{}]) for action [{}] ([{}]): [{}]",
res->second->name.c_str(), guild_id, res->second->name.c_str(), guild_id,
res->second->ranks[rank].name.c_str(), rank, res->second->ranks[rank].name.c_str(), rank,
GuildActionNames[act], act, GuildActionNames[act], act,
File diff suppressed because it is too large Load Diff
+98 -98
View File
@@ -33,7 +33,7 @@
#include <iostream> #include <iostream>
std::list<EQEmu::ItemInstance*> dirty_inst; std::list<EQ::ItemInstance*> dirty_inst;
// //
@@ -48,50 +48,50 @@ ItemInstQueue::~ItemInstQueue()
} }
// Put item onto back of queue // Put item onto back of queue
void ItemInstQueue::push(EQEmu::ItemInstance* inst) void ItemInstQueue::push(EQ::ItemInstance* inst)
{ {
m_list.push_back(inst); m_list.push_back(inst);
} }
// Put item onto front of queue // Put item onto front of queue
void ItemInstQueue::push_front(EQEmu::ItemInstance* inst) void ItemInstQueue::push_front(EQ::ItemInstance* inst)
{ {
m_list.push_front(inst); m_list.push_front(inst);
} }
// Remove item from front of queue // Remove item from front of queue
EQEmu::ItemInstance* ItemInstQueue::pop() EQ::ItemInstance* ItemInstQueue::pop()
{ {
if (m_list.empty()) if (m_list.empty())
return nullptr; return nullptr;
EQEmu::ItemInstance* inst = m_list.front(); EQ::ItemInstance* inst = m_list.front();
m_list.pop_front(); m_list.pop_front();
return inst; return inst;
} }
// Remove item from back of queue // Remove item from back of queue
EQEmu::ItemInstance* ItemInstQueue::pop_back() EQ::ItemInstance* ItemInstQueue::pop_back()
{ {
if (m_list.empty()) if (m_list.empty())
return nullptr; return nullptr;
EQEmu::ItemInstance* inst = m_list.back(); EQ::ItemInstance* inst = m_list.back();
m_list.pop_back(); m_list.pop_back();
return inst; return inst;
} }
// Look at item at front of queue // Look at item at front of queue
EQEmu::ItemInstance* ItemInstQueue::peek_front() const EQ::ItemInstance* ItemInstQueue::peek_front() const
{ {
return (m_list.empty()) ? nullptr : m_list.front(); return (m_list.empty()) ? nullptr : m_list.front();
} }
// //
// class EQEmu::InventoryProfile // class EQ::InventoryProfile
// //
EQEmu::InventoryProfile::~InventoryProfile() EQ::InventoryProfile::~InventoryProfile()
{ {
for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) {
safe_delete(iter->second); safe_delete(iter->second);
@@ -119,18 +119,18 @@ EQEmu::InventoryProfile::~InventoryProfile()
m_trade.clear(); m_trade.clear();
} }
void EQEmu::InventoryProfile::SetInventoryVersion(versions::MobVersion inventory_version) { void EQ::InventoryProfile::SetInventoryVersion(versions::MobVersion inventory_version) {
m_mob_version = versions::ValidateMobVersion(inventory_version); m_mob_version = versions::ValidateMobVersion(inventory_version);
SetGMInventory(m_gm_inventory); SetGMInventory(m_gm_inventory);
} }
void EQEmu::InventoryProfile::SetGMInventory(bool gmi_flag) { void EQ::InventoryProfile::SetGMInventory(bool gmi_flag) {
m_gm_inventory = gmi_flag; m_gm_inventory = gmi_flag;
m_lookup = inventory::DynamicLookup(m_mob_version, gmi_flag); m_lookup = inventory::DynamicLookup(m_mob_version, gmi_flag);
} }
void EQEmu::InventoryProfile::CleanDirty() { void EQ::InventoryProfile::CleanDirty() {
auto iter = dirty_inst.begin(); auto iter = dirty_inst.begin();
while (iter != dirty_inst.end()) { while (iter != dirty_inst.end()) {
delete (*iter); delete (*iter);
@@ -139,14 +139,14 @@ void EQEmu::InventoryProfile::CleanDirty() {
dirty_inst.clear(); dirty_inst.clear();
} }
void EQEmu::InventoryProfile::MarkDirty(ItemInstance *inst) { void EQ::InventoryProfile::MarkDirty(ItemInstance *inst) {
if (inst) { if (inst) {
dirty_inst.push_back(inst); dirty_inst.push_back(inst);
} }
} }
// Retrieve item at specified slot; returns false if item not found // Retrieve item at specified slot; returns false if item not found
EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const EQ::ItemInstance* EQ::InventoryProfile::GetItem(int16 slot_id) const
{ {
ItemInstance* result = nullptr; ItemInstance* result = nullptr;
@@ -219,31 +219,31 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const
} }
// Retrieve item at specified position within bag // Retrieve item at specified position within bag
EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id, uint8 bagidx) const EQ::ItemInstance* EQ::InventoryProfile::GetItem(int16 slot_id, uint8 bagidx) const
{ {
return GetItem(InventoryProfile::CalcSlotId(slot_id, bagidx)); return GetItem(InventoryProfile::CalcSlotId(slot_id, bagidx));
} }
// Put an item snto specified slot // Put an item snto specified slot
int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst) int16 EQ::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
{ {
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) { if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0) if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
return EQEmu::invslot::SLOT_INVALID; return EQ::invslot::SLOT_INVALID;
} }
else if (slot_id <= EQEmu::invbag::GENERAL_BAGS_END && slot_id >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (slot_id <= EQ::invbag::GENERAL_BAGS_END && slot_id >= EQ::invbag::GENERAL_BAGS_BEGIN) {
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_id - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT); auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((slot_id - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0)
return EQEmu::invslot::SLOT_INVALID; return EQ::invslot::SLOT_INVALID;
} }
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) { else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
if ((slot_id - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) if ((slot_id - EQ::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank)
return EQEmu::invslot::SLOT_INVALID; return EQ::invslot::SLOT_INVALID;
} }
else if (slot_id <= EQEmu::invbag::BANK_BAGS_END && slot_id >= EQEmu::invbag::BANK_BAGS_BEGIN) { else if (slot_id <= EQ::invbag::BANK_BAGS_END && slot_id >= EQ::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (slot_id - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT; auto temp_slot = (slot_id - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize.Bank) if (temp_slot >= m_lookup->InventoryTypeSize.Bank)
return EQEmu::invslot::SLOT_INVALID; return EQ::invslot::SLOT_INVALID;
} }
// Clean up item already in slot (if exists) // Clean up item already in slot (if exists)
@@ -259,17 +259,17 @@ int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
return _PutItem(slot_id, inst.Clone()); return _PutItem(slot_id, inst.Clone());
} }
int16 EQEmu::InventoryProfile::PushCursor(const ItemInstance &inst) { int16 EQ::InventoryProfile::PushCursor(const ItemInstance &inst) {
m_cursor.push(inst.Clone()); m_cursor.push(inst.Clone());
return invslot::slotCursor; return invslot::slotCursor;
} }
EQEmu::ItemInstance* EQEmu::InventoryProfile::GetCursorItem() { EQ::ItemInstance* EQ::InventoryProfile::GetCursorItem() {
return m_cursor.peek_front(); return m_cursor.peek_front();
} }
// Swap items in inventory // Swap items in inventory
bool EQEmu::InventoryProfile::SwapItem( bool EQ::InventoryProfile::SwapItem(
int16 source_slot, int16 source_slot,
int16 destination_slot, int16 destination_slot,
SwapItemFailState &fail_state, SwapItemFailState &fail_state,
@@ -280,54 +280,54 @@ bool EQEmu::InventoryProfile::SwapItem(
) { ) {
fail_state = swapInvalid; fail_state = swapInvalid;
if (source_slot <= EQEmu::invslot::POSSESSIONS_END && source_slot >= EQEmu::invslot::POSSESSIONS_BEGIN) { if (source_slot <= EQ::invslot::POSSESSIONS_END && source_slot >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64) 1 << source_slot) & m_lookup->PossessionsBitmask) == 0) { if ((((uint64) 1 << source_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (source_slot <= EQEmu::invbag::GENERAL_BAGS_END && source_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (source_slot <= EQ::invbag::GENERAL_BAGS_END && source_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((source_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT); auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((source_slot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) { if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (source_slot <= EQEmu::invslot::BANK_END && source_slot >= EQEmu::invslot::BANK_BEGIN) { else if (source_slot <= EQ::invslot::BANK_END && source_slot >= EQ::invslot::BANK_BEGIN) {
if ((source_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) { if ((source_slot - EQ::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (source_slot <= EQEmu::invbag::BANK_BAGS_END && source_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) { else if (source_slot <= EQ::invbag::BANK_BAGS_END && source_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (source_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT; auto temp_slot = (source_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize.Bank) { if (temp_slot >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
if (destination_slot <= EQEmu::invslot::POSSESSIONS_END && destination_slot >= EQEmu::invslot::POSSESSIONS_BEGIN) { if (destination_slot <= EQ::invslot::POSSESSIONS_END && destination_slot >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << destination_slot) & m_lookup->PossessionsBitmask) == 0) { if ((((uint64)1 << destination_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (destination_slot <= EQEmu::invbag::GENERAL_BAGS_END && destination_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (destination_slot <= EQ::invbag::GENERAL_BAGS_END && destination_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((destination_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT); auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((destination_slot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) { if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (destination_slot <= EQEmu::invslot::BANK_END && destination_slot >= EQEmu::invslot::BANK_BEGIN) { else if (destination_slot <= EQ::invslot::BANK_END && destination_slot >= EQ::invslot::BANK_BEGIN) {
if ((destination_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) { if ((destination_slot - EQ::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (destination_slot <= EQEmu::invbag::BANK_BAGS_END && destination_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) { else if (destination_slot <= EQ::invbag::BANK_BAGS_END && destination_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (destination_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT; auto temp_slot = (destination_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize.Bank) { if (temp_slot >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
@@ -399,7 +399,7 @@ bool EQEmu::InventoryProfile::SwapItem(
} }
// Remove item from inventory (with memory delete) // Remove item from inventory (with memory delete)
bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) { bool EQ::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
// Pop item out of inventory map (or queue) // Pop item out of inventory map (or queue)
ItemInstance *item_to_delete = PopItem(slot_id); ItemInstance *item_to_delete = PopItem(slot_id);
@@ -434,7 +434,7 @@ bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
} }
// Checks All items in a bag for No Drop // Checks All items in a bag for No Drop
bool EQEmu::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse) bool EQ::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse)
{ {
ItemInstance* inst = GetItem(slot_id); ItemInstance* inst = GetItem(slot_id);
if (!inst) if (!inst)
@@ -445,7 +445,7 @@ bool EQEmu::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse)
// Remove item from bucket without memory delete // Remove item from bucket without memory delete
// Returns item pointer if full delete was successful // Returns item pointer if full delete was successful
EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id) EQ::ItemInstance* EQ::InventoryProfile::PopItem(int16 slot_id)
{ {
ItemInstance* p = nullptr; ItemInstance* p = nullptr;
@@ -488,7 +488,7 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id)
return p; return p;
} }
bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity) { bool EQ::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity) {
if (ItemToTry->Stackable) { if (ItemToTry->Stackable) {
@@ -592,7 +592,7 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
//This function has a flaw in that it only returns the last stack that it looked at //This function has a flaw in that it only returns the last stack that it looked at
//when quantity is greater than 1 and not all of quantity can be found in 1 stack. //when quantity is greater than 1 and not all of quantity can be found in 1 stack.
int16 EQEmu::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 where) int16 EQ::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 where)
{ {
int16 slot_id = INVALID_INDEX; int16 slot_id = INVALID_INDEX;
@@ -642,7 +642,7 @@ int16 EQEmu::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 whe
} }
//this function has the same quantity flaw mentioned above in HasItem() //this function has the same quantity flaw mentioned above in HasItem()
int16 EQEmu::InventoryProfile::HasItemByUse(uint8 use, uint8 quantity, uint8 where) int16 EQ::InventoryProfile::HasItemByUse(uint8 use, uint8 quantity, uint8 where)
{ {
int16 slot_id = INVALID_INDEX; int16 slot_id = INVALID_INDEX;
@@ -688,7 +688,7 @@ int16 EQEmu::InventoryProfile::HasItemByUse(uint8 use, uint8 quantity, uint8 whe
return slot_id; return slot_id;
} }
int16 EQEmu::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where) int16 EQ::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where)
{ {
int16 slot_id = INVALID_INDEX; int16 slot_id = INVALID_INDEX;
@@ -736,7 +736,7 @@ int16 EQEmu::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where)
// Locate an available inventory slot // Locate an available inventory slot
// Returns slot_id when there's one available, else SLOT_INVALID // Returns slot_id when there's one available, else SLOT_INVALID
int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow) int16 EQ::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow)
{ {
// Check basic inventory // Check basic inventory
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) { for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
@@ -786,7 +786,7 @@ int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8
} }
// This is a mix of HasSpaceForItem and FindFreeSlot..due to existing coding behavior, it was better to add a new helper function... // This is a mix of HasSpaceForItem and FindFreeSlot..due to existing coding behavior, it was better to add a new helper function...
int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start, uint8 bag_start) { int16 EQ::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start, uint8 bag_start) {
// Do not arbitrarily use this function..it is designed for use with Client::ResetTrade() and Client::FinishTrade(). // Do not arbitrarily use this function..it is designed for use with Client::ResetTrade() and Client::FinishTrade().
// If you have a need, use it..but, understand it is not a suitable replacement for InventoryProfile::FindFreeSlot(). // If you have a need, use it..but, understand it is not a suitable replacement for InventoryProfile::FindFreeSlot().
// //
@@ -924,7 +924,7 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
} }
// Opposite of below: Get parent bag slot_id from a slot inside of bag // Opposite of below: Get parent bag slot_id from a slot inside of bag
int16 EQEmu::InventoryProfile::CalcSlotId(int16 slot_id) { int16 EQ::InventoryProfile::CalcSlotId(int16 slot_id) {
int16 parent_slot_id = INVALID_INDEX; int16 parent_slot_id = INVALID_INDEX;
// this is not a bag range... using this risks over-writing existing items // this is not a bag range... using this risks over-writing existing items
@@ -952,7 +952,7 @@ int16 EQEmu::InventoryProfile::CalcSlotId(int16 slot_id) {
} }
// Calculate slot_id for an item within a bag // Calculate slot_id for an item within a bag
int16 EQEmu::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx) { int16 EQ::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx) {
if (!InventoryProfile::SupportsContainers(bagslot_id)) if (!InventoryProfile::SupportsContainers(bagslot_id))
return INVALID_INDEX; return INVALID_INDEX;
@@ -977,7 +977,7 @@ int16 EQEmu::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx) {
return slot_id; return slot_id;
} }
uint8 EQEmu::InventoryProfile::CalcBagIdx(int16 slot_id) { uint8 EQ::InventoryProfile::CalcBagIdx(int16 slot_id) {
uint8 index = 0; uint8 index = 0;
// this is not a bag range... using this risks over-writing existing items // this is not a bag range... using this risks over-writing existing items
@@ -1006,7 +1006,7 @@ uint8 EQEmu::InventoryProfile::CalcBagIdx(int16 slot_id) {
return index; return index;
} }
int16 EQEmu::InventoryProfile::CalcSlotFromMaterial(uint8 material) int16 EQ::InventoryProfile::CalcSlotFromMaterial(uint8 material)
{ {
switch (material) switch (material)
{ {
@@ -1033,7 +1033,7 @@ int16 EQEmu::InventoryProfile::CalcSlotFromMaterial(uint8 material)
} }
} }
uint8 EQEmu::InventoryProfile::CalcMaterialFromSlot(int16 equipslot) uint8 EQ::InventoryProfile::CalcMaterialFromSlot(int16 equipslot)
{ {
switch (equipslot) switch (equipslot)
{ {
@@ -1061,7 +1061,7 @@ uint8 EQEmu::InventoryProfile::CalcMaterialFromSlot(int16 equipslot)
} }
} }
bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, const ItemData *Container) { bool EQ::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, const ItemData *Container) {
if (!ItemToTry || !Container) if (!ItemToTry || !Container)
return false; return false;
@@ -1078,7 +1078,7 @@ bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, c
return true; return true;
} }
bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id) bool EQ::InventoryProfile::SupportsClickCasting(int16 slot_id)
{ {
// there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range // there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) { if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
@@ -1095,7 +1095,7 @@ bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
return false; return false;
} }
bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id) bool EQ::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id)
{ {
// does this have the same criteria as 'SupportsClickCasting' above? (bag clicking per client) // does this have the same criteria as 'SupportsClickCasting' above? (bag clicking per client)
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) { if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
@@ -1112,7 +1112,7 @@ bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id)
} }
// Test whether a given slot can support a container item // Test whether a given slot can support a container item
bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id) bool EQ::InventoryProfile::SupportsContainers(int16 slot_id)
{ {
if ((slot_id == invslot::slotCursor) || if ((slot_id == invslot::slotCursor) ||
(slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) || (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) ||
@@ -1126,7 +1126,7 @@ bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id)
return false; return false;
} }
int EQEmu::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) { int EQ::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) {
if (!inst) if (!inst)
return INVALID_INDEX; return INVALID_INDEX;
@@ -1162,7 +1162,7 @@ int EQEmu::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) {
return INVALID_INDEX; return INVALID_INDEX;
} }
uint8 EQEmu::InventoryProfile::FindBrightestLightType() uint8 EQ::InventoryProfile::FindBrightestLightType()
{ {
uint8 brightest_light_type = 0; uint8 brightest_light_type = 0;
@@ -1213,7 +1213,7 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType()
return brightest_light_type; return brightest_light_type;
} }
void EQEmu::InventoryProfile::dumpEntireInventory() { void EQ::InventoryProfile::dumpEntireInventory() {
dumpWornItems(); dumpWornItems();
dumpInventory(); dumpInventory();
@@ -1223,29 +1223,29 @@ void EQEmu::InventoryProfile::dumpEntireInventory() {
std::cout << std::endl; std::cout << std::endl;
} }
void EQEmu::InventoryProfile::dumpWornItems() { void EQ::InventoryProfile::dumpWornItems() {
std::cout << "Worn items:" << std::endl; std::cout << "Worn items:" << std::endl;
dumpItemCollection(m_worn); dumpItemCollection(m_worn);
} }
void EQEmu::InventoryProfile::dumpInventory() { void EQ::InventoryProfile::dumpInventory() {
std::cout << "Inventory items:" << std::endl; std::cout << "Inventory items:" << std::endl;
dumpItemCollection(m_inv); dumpItemCollection(m_inv);
} }
void EQEmu::InventoryProfile::dumpBankItems() { void EQ::InventoryProfile::dumpBankItems() {
std::cout << "Bank items:" << std::endl; std::cout << "Bank items:" << std::endl;
dumpItemCollection(m_bank); dumpItemCollection(m_bank);
} }
void EQEmu::InventoryProfile::dumpSharedBankItems() { void EQ::InventoryProfile::dumpSharedBankItems() {
std::cout << "Shared Bank items:" << std::endl; std::cout << "Shared Bank items:" << std::endl;
dumpItemCollection(m_shbank); dumpItemCollection(m_shbank);
} }
int EQEmu::InventoryProfile::GetSlotByItemInstCollection(const std::map<int16, ItemInstance*> &collection, ItemInstance *inst) { int EQ::InventoryProfile::GetSlotByItemInstCollection(const std::map<int16, ItemInstance*> &collection, ItemInstance *inst) {
for (auto iter = collection.begin(); iter != collection.end(); ++iter) { for (auto iter = collection.begin(); iter != collection.end(); ++iter) {
ItemInstance *t_inst = iter->second; ItemInstance *t_inst = iter->second;
if (t_inst == inst) { if (t_inst == inst) {
@@ -1261,10 +1261,10 @@ int EQEmu::InventoryProfile::GetSlotByItemInstCollection(const std::map<int16, I
} }
} }
return EQEmu::invslot::SLOT_INVALID; return EQ::invslot::SLOT_INVALID;
} }
void EQEmu::InventoryProfile::dumpItemCollection(const std::map<int16, ItemInstance*> &collection) void EQ::InventoryProfile::dumpItemCollection(const std::map<int16, ItemInstance*> &collection)
{ {
for (auto it = collection.cbegin(); it != collection.cend(); ++it) { for (auto it = collection.cbegin(); it != collection.cend(); ++it) {
auto inst = it->second; auto inst = it->second;
@@ -1278,7 +1278,7 @@ void EQEmu::InventoryProfile::dumpItemCollection(const std::map<int16, ItemInsta
} }
} }
void EQEmu::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map<int16, ItemInstance*>::const_iterator *it) void EQ::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map<int16, ItemInstance*>::const_iterator *it)
{ {
if (!inst || !inst->IsClassBag()) if (!inst || !inst->IsClassBag())
return; return;
@@ -1297,14 +1297,14 @@ void EQEmu::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map<int16
} }
// Internal Method: Retrieves item within an inventory bucket // Internal Method: Retrieves item within an inventory bucket
EQEmu::ItemInstance* EQEmu::InventoryProfile::_GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const EQ::ItemInstance* EQ::InventoryProfile::_GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const
{ {
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) { if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0) if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
return nullptr; return nullptr;
} }
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) { else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
if (slot_id - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank) if (slot_id - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
return nullptr; return nullptr;
} }
@@ -1319,7 +1319,7 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::_GetItem(const std::map<int16, Ite
// Internal Method: "put" item into bucket, without regard for what is currently in bucket // Internal Method: "put" item into bucket, without regard for what is currently in bucket
// Assumes item has already been allocated // Assumes item has already been allocated
int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst) int16 EQ::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
{ {
// What happens here when we _PutItem(MainCursor)? Bad things..really bad things... // What happens here when we _PutItem(MainCursor)? Bad things..really bad things...
// //
@@ -1356,7 +1356,7 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
result = slot_id; result = slot_id;
} }
else if (slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) { else if (slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) {
if (slot_id - EQEmu::invslot::BANK_BEGIN < m_lookup->InventoryTypeSize.Bank) { if (slot_id - EQ::invslot::BANK_BEGIN < m_lookup->InventoryTypeSize.Bank) {
m_bank[slot_id] = inst; m_bank[slot_id] = inst;
result = slot_id; result = slot_id;
} }
@@ -1381,7 +1381,7 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
} }
if (result == INVALID_INDEX) { if (result == INVALID_INDEX) {
Log(Logs::General, Logs::Error, "InventoryProfile::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); LogError("InventoryProfile::_PutItem: Invalid slot_id specified ({}) with parent slot id ({})", slot_id, parentSlot);
InventoryProfile::MarkDirty(inst); // Slot not found, clean up InventoryProfile::MarkDirty(inst); // Slot not found, clean up
} }
@@ -1389,17 +1389,17 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
} }
// Internal Method: Checks an inventory bucket for a particular item // Internal Method: Checks an inventory bucket for a particular item
int16 EQEmu::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket, uint32 item_id, uint8 quantity) int16 EQ::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket, uint32 item_id, uint8 quantity)
{ {
uint32 quantity_found = 0; uint32 quantity_found = 0;
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) { if (iter->first <= EQ::invslot::POSSESSIONS_END && iter->first >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0) if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
continue; continue;
} }
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) { else if (iter->first <= EQ::invslot::BANK_END && iter->first >= EQ::invslot::BANK_BEGIN) {
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank) if (iter->first - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
continue; continue;
} }
@@ -1440,7 +1440,7 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket,
} }
// Internal Method: Checks an inventory queue type bucket for a particular item // Internal Method: Checks an inventory queue type bucket for a particular item
int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) int16 EQ::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity)
{ {
// The downfall of this (these) queue procedure is that callers presume that when an item is // The downfall of this (these) queue procedure is that callers presume that when an item is
// found, it is presented as being available on the cursor. In cases of a parity check, this // found, it is presented as being available on the cursor. In cases of a parity check, this
@@ -1491,17 +1491,17 @@ int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, u
} }
// Internal Method: Checks an inventory bucket for a particular item // Internal Method: Checks an inventory bucket for a particular item
int16 EQEmu::InventoryProfile::_HasItemByUse(std::map<int16, ItemInstance*>& bucket, uint8 use, uint8 quantity) int16 EQ::InventoryProfile::_HasItemByUse(std::map<int16, ItemInstance*>& bucket, uint8 use, uint8 quantity)
{ {
uint32 quantity_found = 0; uint32 quantity_found = 0;
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) { if (iter->first <= EQ::invslot::POSSESSIONS_END && iter->first >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0) if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
continue; continue;
} }
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) { else if (iter->first <= EQ::invslot::BANK_END && iter->first >= EQ::invslot::BANK_BEGIN) {
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank) if (iter->first - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
continue; continue;
} }
@@ -1532,7 +1532,7 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(std::map<int16, ItemInstance*>& buc
} }
// Internal Method: Checks an inventory queue type bucket for a particular item // Internal Method: Checks an inventory queue type bucket for a particular item
int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) int16 EQ::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity)
{ {
uint32 quantity_found = 0; uint32 quantity_found = 0;
@@ -1566,15 +1566,15 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, u
return INVALID_INDEX; return INVALID_INDEX;
} }
int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*>& bucket, uint32 loregroup) int16 EQ::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*>& bucket, uint32 loregroup)
{ {
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) { if (iter->first <= EQ::invslot::POSSESSIONS_END && iter->first >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0) if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
continue; continue;
} }
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) { else if (iter->first <= EQ::invslot::BANK_END && iter->first >= EQ::invslot::BANK_BEGIN) {
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank) if (iter->first - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
continue; continue;
} }
@@ -1611,11 +1611,11 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*
} }
} }
return EQEmu::invslot::SLOT_INVALID; return EQ::invslot::SLOT_INVALID;
} }
// Internal Method: Checks an inventory queue type bucket for a particular item // Internal Method: Checks an inventory queue type bucket for a particular item
int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) int16 EQ::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup)
{ {
for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) { for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) {
auto inst = *iter; auto inst = *iter;
@@ -1654,5 +1654,5 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32
break; break;
} }
return EQEmu::invslot::SLOT_INVALID; return EQ::invslot::SLOT_INVALID;
} }
+10 -10
View File
@@ -52,30 +52,30 @@ public:
// Public Methods // Public Methods
///////////////////////// /////////////////////////
inline std::list<EQEmu::ItemInstance*>::const_iterator cbegin() { return m_list.cbegin(); } inline std::list<EQ::ItemInstance*>::const_iterator cbegin() { return m_list.cbegin(); }
inline std::list<EQEmu::ItemInstance*>::const_iterator cend() { return m_list.cend(); } inline std::list<EQ::ItemInstance*>::const_iterator cend() { return m_list.cend(); }
inline int size() { return static_cast<int>(m_list.size()); } // TODO: change to size_t inline int size() { return static_cast<int>(m_list.size()); } // TODO: change to size_t
inline bool empty() { return m_list.empty(); } inline bool empty() { return m_list.empty(); }
void push(EQEmu::ItemInstance* inst); void push(EQ::ItemInstance* inst);
void push_front(EQEmu::ItemInstance* inst); void push_front(EQ::ItemInstance* inst);
EQEmu::ItemInstance* pop(); EQ::ItemInstance* pop();
EQEmu::ItemInstance* pop_back(); EQ::ItemInstance* pop_back();
EQEmu::ItemInstance* peek_front() const; EQ::ItemInstance* peek_front() const;
protected: protected:
///////////////////////// /////////////////////////
// Protected Members // Protected Members
///////////////////////// /////////////////////////
std::list<EQEmu::ItemInstance*> m_list; std::list<EQ::ItemInstance*> m_list;
}; };
// ######################################## // ########################################
// Class: EQEmu::InventoryProfile // Class: EQ::InventoryProfile
// Character inventory // Character inventory
namespace EQEmu namespace EQ
{ {
class InventoryProfile class InventoryProfile
{ {
+31 -31
View File
@@ -22,7 +22,7 @@
#include "string_util.h" #include "string_util.h"
int8 EQEmu::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index) int8 EQ::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index)
{ {
switch (slot_index) { switch (slot_index) {
case invslot::slotHead: case invslot::slotHead:
@@ -48,7 +48,7 @@ int8 EQEmu::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index)
} }
} }
int8 EQEmu::inventory::ConvertEquipmentSlotToTextureIndex(const InventorySlot& inventory_slot) int8 EQ::inventory::ConvertEquipmentSlotToTextureIndex(const InventorySlot& inventory_slot)
{ {
if ((!inventory_slot.Typeless() && !inventory_slot.IsTypeIndex(invtype::typePossessions)) || !inventory_slot.IsContainerIndex(invbag::SLOT_INVALID) || !inventory_slot.IsSocketIndex(invaug::SOCKET_INVALID)) if ((!inventory_slot.Typeless() && !inventory_slot.IsTypeIndex(invtype::typePossessions)) || !inventory_slot.IsContainerIndex(invbag::SLOT_INVALID) || !inventory_slot.IsSocketIndex(invaug::SOCKET_INVALID))
return textures::textureInvalid; return textures::textureInvalid;
@@ -56,7 +56,7 @@ int8 EQEmu::inventory::ConvertEquipmentSlotToTextureIndex(const InventorySlot& i
return ConvertEquipmentIndexToTextureIndex(inventory_slot.SlotIndex()); return ConvertEquipmentIndexToTextureIndex(inventory_slot.SlotIndex());
} }
int16 EQEmu::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index) int16 EQ::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index)
{ {
switch (texture_index) { switch (texture_index) {
case textures::armorHead: case textures::armorHead:
@@ -82,7 +82,7 @@ int16 EQEmu::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index)
} }
} }
bool EQEmu::InventorySlot::IsValidSlot() const bool EQ::InventorySlot::IsValidSlot() const
{ {
if (_typeless) if (_typeless)
return false; return false;
@@ -100,7 +100,7 @@ bool EQEmu::InventorySlot::IsValidSlot() const
return true; return true;
} }
bool EQEmu::InventorySlot::IsDeleteSlot() const bool EQ::InventorySlot::IsDeleteSlot() const
{ {
if (_typeless) if (_typeless)
return (_slot_index == invslot::SLOT_INVALID && _container_index == invbag::SLOT_INVALID && _socket_index == invaug::SOCKET_INVALID); return (_slot_index == invslot::SLOT_INVALID && _container_index == invbag::SLOT_INVALID && _socket_index == invaug::SOCKET_INVALID);
@@ -108,7 +108,7 @@ bool EQEmu::InventorySlot::IsDeleteSlot() const
return (_type_index == invtype::TYPE_INVALID && _slot_index == invslot::SLOT_INVALID && _container_index == invbag::SLOT_INVALID && _socket_index == invaug::SOCKET_INVALID); return (_type_index == invtype::TYPE_INVALID && _slot_index == invslot::SLOT_INVALID && _container_index == invbag::SLOT_INVALID && _socket_index == invaug::SOCKET_INVALID);
} }
bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index) bool EQ::InventorySlot::IsEquipmentIndex(int16 slot_index)
{ {
if (slot_index < invslot::EQUIPMENT_BEGIN || slot_index > invslot::EQUIPMENT_END) if (slot_index < invslot::EQUIPMENT_BEGIN || slot_index > invslot::EQUIPMENT_END)
return false; return false;
@@ -116,7 +116,7 @@ bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index)
return true; return true;
} }
bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index) bool EQ::InventorySlot::IsGeneralIndex(int16 slot_index)
{ {
if (slot_index < invslot::GENERAL_BEGIN || slot_index > invslot::GENERAL_END) if (slot_index < invslot::GENERAL_BEGIN || slot_index > invslot::GENERAL_END)
return false; return false;
@@ -124,7 +124,7 @@ bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index)
return true; return true;
} }
bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index) bool EQ::InventorySlot::IsCursorIndex(int16 slot_index)
{ {
if (slot_index == invslot::slotCursor) if (slot_index == invslot::slotCursor)
return true; return true;
@@ -132,7 +132,7 @@ bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index)
return false; return false;
} }
bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index) bool EQ::InventorySlot::IsWeaponIndex(int16 slot_index)
{ {
if (slot_index == invslot::slotPrimary || slot_index == invslot::slotSecondary || slot_index == invslot::slotRange) if (slot_index == invslot::slotPrimary || slot_index == invslot::slotSecondary || slot_index == invslot::slotRange)
return true; return true;
@@ -140,7 +140,7 @@ bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index)
return false; return false;
} }
bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index) bool EQ::InventorySlot::IsTextureIndex(int16 slot_index)
{ {
switch (slot_index) { switch (slot_index) {
case invslot::slotHead: case invslot::slotHead:
@@ -158,7 +158,7 @@ bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index)
} }
} }
bool EQEmu::InventorySlot::IsTintableIndex(int16 slot_index) bool EQ::InventorySlot::IsTintableIndex(int16 slot_index)
{ {
switch (slot_index) { switch (slot_index) {
case invslot::slotHead: case invslot::slotHead:
@@ -174,7 +174,7 @@ bool EQEmu::InventorySlot::IsTintableIndex(int16 slot_index)
} }
} }
bool EQEmu::InventorySlot::IsEquipmentSlot() const bool EQ::InventorySlot::IsEquipmentSlot() const
{ {
if (!_typeless && (_type_index != invtype::typePossessions)) if (!_typeless && (_type_index != invtype::typePossessions))
return false; return false;
@@ -185,7 +185,7 @@ bool EQEmu::InventorySlot::IsEquipmentSlot() const
return IsEquipmentIndex(_slot_index); return IsEquipmentIndex(_slot_index);
} }
bool EQEmu::InventorySlot::IsGeneralSlot() const bool EQ::InventorySlot::IsGeneralSlot() const
{ {
if (!_typeless && (_type_index != invtype::typePossessions)) if (!_typeless && (_type_index != invtype::typePossessions))
return false; return false;
@@ -196,7 +196,7 @@ bool EQEmu::InventorySlot::IsGeneralSlot() const
return IsGeneralIndex(_socket_index); return IsGeneralIndex(_socket_index);
} }
bool EQEmu::InventorySlot::IsCursorSlot() const bool EQ::InventorySlot::IsCursorSlot() const
{ {
if (!_typeless && (_type_index != invtype::typePossessions)) if (!_typeless && (_type_index != invtype::typePossessions))
return false; return false;
@@ -207,7 +207,7 @@ bool EQEmu::InventorySlot::IsCursorSlot() const
return IsCursorIndex(_slot_index); return IsCursorIndex(_slot_index);
} }
bool EQEmu::InventorySlot::IsWeaponSlot() const bool EQ::InventorySlot::IsWeaponSlot() const
{ {
if (!_typeless && (_type_index != invtype::typePossessions)) if (!_typeless && (_type_index != invtype::typePossessions))
return false; return false;
@@ -218,7 +218,7 @@ bool EQEmu::InventorySlot::IsWeaponSlot() const
return IsWeaponIndex(_slot_index); return IsWeaponIndex(_slot_index);
} }
bool EQEmu::InventorySlot::IsTextureSlot() const bool EQ::InventorySlot::IsTextureSlot() const
{ {
if (!_typeless && (_type_index != invtype::typePossessions)) if (!_typeless && (_type_index != invtype::typePossessions))
return false; return false;
@@ -229,7 +229,7 @@ bool EQEmu::InventorySlot::IsTextureSlot() const
return IsTextureIndex(_slot_index); return IsTextureIndex(_slot_index);
} }
bool EQEmu::InventorySlot::IsTintableSlot() const bool EQ::InventorySlot::IsTintableSlot() const
{ {
if (!_typeless && (_type_index != invtype::typePossessions)) if (!_typeless && (_type_index != invtype::typePossessions))
return false; return false;
@@ -240,7 +240,7 @@ bool EQEmu::InventorySlot::IsTintableSlot() const
return IsTintableIndex(_slot_index); return IsTintableIndex(_slot_index);
} }
bool EQEmu::InventorySlot::IsSlot() const bool EQ::InventorySlot::IsSlot() const
{ {
if (!_typeless && (_type_index == invtype::TYPE_INVALID)) if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false; return false;
@@ -254,7 +254,7 @@ bool EQEmu::InventorySlot::IsSlot() const
return true; return true;
} }
bool EQEmu::InventorySlot::IsSlotSocket() const bool EQ::InventorySlot::IsSlotSocket() const
{ {
if (!_typeless && (_type_index == invtype::TYPE_INVALID)) if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false; return false;
@@ -268,7 +268,7 @@ bool EQEmu::InventorySlot::IsSlotSocket() const
return true; return true;
} }
bool EQEmu::InventorySlot::IsContainer() const bool EQ::InventorySlot::IsContainer() const
{ {
if (!_typeless && (_type_index == invtype::TYPE_INVALID)) if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false; return false;
@@ -282,7 +282,7 @@ bool EQEmu::InventorySlot::IsContainer() const
return true; return true;
} }
bool EQEmu::InventorySlot::IsContainerSocket() const bool EQ::InventorySlot::IsContainerSocket() const
{ {
if (!_typeless && (_type_index == invtype::TYPE_INVALID)) if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false; return false;
@@ -296,12 +296,12 @@ bool EQEmu::InventorySlot::IsContainerSocket() const
return true; return true;
} }
EQEmu::InventorySlot EQEmu::InventorySlot::ToTopOwner() const EQ::InventorySlot EQ::InventorySlot::ToTopOwner() const
{ {
return InventorySlot(_type_index, _slot_index); return InventorySlot(_type_index, _slot_index);
} }
EQEmu::InventorySlot EQEmu::InventorySlot::ToOwner() const EQ::InventorySlot EQ::InventorySlot::ToOwner() const
{ {
if (IsSlot() || IsSlotSocket() || IsContainer()) if (IsSlot() || IsSlotSocket() || IsContainer())
return InventorySlot(_type_index, _slot_index); return InventorySlot(_type_index, _slot_index);
@@ -312,17 +312,17 @@ EQEmu::InventorySlot EQEmu::InventorySlot::ToOwner() const
return InventorySlot(); return InventorySlot();
} }
const std::string EQEmu::InventorySlot::ToString() const const std::string EQ::InventorySlot::ToString() const
{ {
return StringFormat("(%i%s, %i, %i, %i)", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index); return StringFormat("(%i%s, %i, %i, %i)", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index);
} }
const std::string EQEmu::InventorySlot::ToName() const const std::string EQ::InventorySlot::ToName() const
{ {
return StringFormat("InventorySlot - _type_index: %i%s, _slot_index: %i, _container_index: %i, _socket_index: %i", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index); return StringFormat("InventorySlot - _type_index: %i%s, _slot_index: %i, _container_index: %i, _socket_index: %i", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index);
} }
void EQEmu::InventorySlot::SetInvalidSlot() void EQ::InventorySlot::SetInvalidSlot()
{ {
_type_index = invtype::TYPE_INVALID; _type_index = invtype::TYPE_INVALID;
_slot_index = invslot::SLOT_INVALID; _slot_index = invslot::SLOT_INVALID;
@@ -330,7 +330,7 @@ void EQEmu::InventorySlot::SetInvalidSlot()
_socket_index = invaug::SOCKET_INVALID; _socket_index = invaug::SOCKET_INVALID;
} }
//bool EQEmu::InventorySlot::IsBonusIndex(int16 slot_index) //bool EQ::InventorySlot::IsBonusIndex(int16 slot_index)
//{ //{
// if ((slot_index >= inventory::EquipmentBegin) && (slot_index <= inventory::EquipmentEnd) && (slot_index != inventory::slotAmmo)) // if ((slot_index >= inventory::EquipmentBegin) && (slot_index <= inventory::EquipmentEnd) && (slot_index != inventory::slotAmmo))
// return true; // return true;
@@ -338,7 +338,7 @@ void EQEmu::InventorySlot::SetInvalidSlot()
// return false; // return false;
//} //}
//bool EQEmu::InventorySlot::IsBonusSlot() const //bool EQ::InventorySlot::IsBonusSlot() const
//{ //{
// if ((_type_index != inventory::typePossessions) || (_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) // if ((_type_index != inventory::typePossessions) || (_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid))
// return false; // return false;
@@ -346,7 +346,7 @@ void EQEmu::InventorySlot::SetInvalidSlot()
// return IsBonusIndex(_slot_index); // return IsBonusIndex(_slot_index);
//} //}
bool inventory_slot_typeless_lessthan(const EQEmu::InventorySlot& lhs, const EQEmu::InventorySlot& rhs) bool inventory_slot_typeless_lessthan(const EQ::InventorySlot& lhs, const EQ::InventorySlot& rhs)
{ {
if (lhs.SlotIndex() < rhs.SlotIndex()) if (lhs.SlotIndex() < rhs.SlotIndex())
return true; return true;
@@ -360,7 +360,7 @@ bool inventory_slot_typeless_lessthan(const EQEmu::InventorySlot& lhs, const EQE
return false; return false;
} }
bool EQEmu::InventorySlot::operator<(const InventorySlot& rhs) const bool EQ::InventorySlot::operator<(const InventorySlot& rhs) const
{ {
if (Typeless() || rhs.Typeless()) if (Typeless() || rhs.Typeless())
return inventory_slot_typeless_lessthan(*this, rhs); return inventory_slot_typeless_lessthan(*this, rhs);
@@ -380,7 +380,7 @@ bool EQEmu::InventorySlot::operator<(const InventorySlot& rhs) const
return false; return false;
} }
bool EQEmu::operator==(const InventorySlot& lhs, const InventorySlot& rhs) bool EQ::operator==(const InventorySlot& lhs, const InventorySlot& rhs)
{ {
if (lhs.Typeless() || rhs.Typeless()) if (lhs.Typeless() || rhs.Typeless())
return ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() == rhs.SocketIndex())); return ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() == rhs.SocketIndex()));
+1 -1
View File
@@ -23,7 +23,7 @@
#include "emu_constants.h" #include "emu_constants.h"
namespace EQEmu namespace EQ
{ {
class InventorySlot; class InventorySlot;
+72
View File
@@ -0,0 +1,72 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#include "ip_util.h"
/**
* @param ip
* @return
*/
uint32_t IpUtil::IPToUInt(const std::string &ip)
{
int a, b, c, d;
uint32_t addr = 0;
if (sscanf(ip.c_str(), "%d.%d.%d.%d", &a, &b, &c, &d) != 4) {
return 0;
}
addr = a << 24;
addr |= b << 16;
addr |= c << 8;
addr |= d;
return addr;
}
/**
* @param ip
* @param network
* @param mask
* @return
*/
bool IpUtil::IsIpInRange(const std::string &ip, const std::string &network, const std::string &mask)
{
uint32_t ip_addr = IpUtil::IPToUInt(ip);
uint32_t network_addr = IpUtil::IPToUInt(network);
uint32_t mask_addr = IpUtil::IPToUInt(mask);
uint32_t net_lower = (network_addr & mask_addr);
uint32_t net_upper = (net_lower | (~mask_addr));
return ip_addr >= net_lower && ip_addr <= net_upper;
}
/**
* @param ip
* @return
*/
bool IpUtil::IsIpInPrivateRfc1918(const std::string &ip)
{
return (
IpUtil::IsIpInRange(ip, "10.0.0.0", "255.0.0.0") ||
IpUtil::IsIpInRange(ip, "172.16.0.0", "255.240.0.0") ||
IpUtil::IsIpInRange(ip, "192.168.0.0", "255.255.0.0")
);
}
+15 -9
View File
@@ -16,15 +16,21 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
#pragma once #ifndef EQEMU_IP_UTIL_H
#define EQEMU_IP_UTIL_H
#include <fmt/format.h> #include "types.h"
#include "iostream"
template <typename... Args> class IpUtil {
void OutF(EQEmuLogSys &ls, Logs::DebugLevel debug_level, uint16 log_category, const char *fmt, const Args&... args) public:
{
std::string log_str = fmt::format(fmt, args...); static uint32_t IPToUInt(const std::string &ip);
ls.Out(debug_level, log_category, log_str); static bool IsIpInRange(const std::string &ip, const std::string &network, const std::string &mask);
} static bool IsIpInPrivateRfc1918(const std::string &ip);
};
#endif //EQEMU_IP_UTIL_H
+1 -1
View File
@@ -31,7 +31,7 @@
#include "eqemu_exception.h" #include "eqemu_exception.h"
#include "eqemu_config.h" #include "eqemu_config.h"
namespace EQEmu { namespace EQ {
struct IPCMutex::Implementation { struct IPCMutex::Implementation {
#ifdef _WINDOWS #ifdef _WINDOWS
HANDLE mut_; HANDLE mut_;
+1 -1
View File
@@ -21,7 +21,7 @@
#include <string> #include <string>
namespace EQEmu { namespace EQ {
//! Interprocess Named Binary Semaphore (Mutex) //! Interprocess Named Binary Semaphore (Mutex)
/*! /*!
+10 -10
View File
@@ -23,7 +23,7 @@
//#include "deity.h" //#include "deity.h"
uint32 EQEmu::item::ConvertAugTypeToAugTypeBit(uint8 aug_type) uint32 EQ::item::ConvertAugTypeToAugTypeBit(uint8 aug_type)
{ {
switch (aug_type) { switch (aug_type) {
case AugTypeGeneralSingleStat: case AugTypeGeneralSingleStat:
@@ -95,7 +95,7 @@ uint32 EQEmu::item::ConvertAugTypeToAugTypeBit(uint8 aug_type)
} }
} }
uint8 EQEmu::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit) uint8 EQ::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit)
{ {
switch (aug_type_bit) { switch (aug_type_bit) {
case bit_AugTypeGeneralSingleStat: case bit_AugTypeGeneralSingleStat:
@@ -167,7 +167,7 @@ uint8 EQEmu::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit)
} }
} }
bool EQEmu::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const bool EQ::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const
{ {
if (!(Races & GetPlayerRaceBit(race_id))) if (!(Races & GetPlayerRaceBit(race_id)))
return false; return false;
@@ -178,37 +178,37 @@ bool EQEmu::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const
return true; return true;
} }
bool EQEmu::ItemData::IsClassCommon() const bool EQ::ItemData::IsClassCommon() const
{ {
return (ItemClass == item::ItemClassCommon); return (ItemClass == item::ItemClassCommon);
} }
bool EQEmu::ItemData::IsClassBag() const bool EQ::ItemData::IsClassBag() const
{ {
return (ItemClass == item::ItemClassBag); return (ItemClass == item::ItemClassBag);
} }
bool EQEmu::ItemData::IsClassBook() const bool EQ::ItemData::IsClassBook() const
{ {
return (ItemClass == item::ItemClassBook); return (ItemClass == item::ItemClassBook);
} }
bool EQEmu::ItemData::IsType1HWeapon() const bool EQ::ItemData::IsType1HWeapon() const
{ {
return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing) || (ItemType == item::ItemTypeMartial)); return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing) || (ItemType == item::ItemTypeMartial));
} }
bool EQEmu::ItemData::IsType2HWeapon() const bool EQ::ItemData::IsType2HWeapon() const
{ {
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing)); return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
} }
bool EQEmu::ItemData::IsTypeShield() const bool EQ::ItemData::IsTypeShield() const
{ {
return (ItemType == item::ItemTypeShield); return (ItemType == item::ItemTypeShield);
} }
bool EQEmu::ItemData::CheckLoreConflict(const ItemData* l_item, const ItemData* r_item) bool EQ::ItemData::CheckLoreConflict(const ItemData* l_item, const ItemData* r_item)
{ {
if (!l_item || !r_item) if (!l_item || !r_item)
return false; return false;
+3 -2
View File
@@ -47,7 +47,7 @@
#include "emu_constants.h" #include "emu_constants.h"
namespace EQEmu namespace EQ
{ {
namespace item { namespace item {
enum ItemClass { enum ItemClass {
@@ -413,7 +413,7 @@ namespace EQEmu
int32 SkillModMax; // Max skill point modification int32 SkillModMax; // Max skill point modification
uint32 SkillModType; // Type of skill for SkillModValue to apply to uint32 SkillModType; // Type of skill for SkillModValue to apply to
uint32 BaneDmgRace; // Bane Damage Race uint32 BaneDmgRace; // Bane Damage Race
int8 BaneDmgAmt; // Bane Damage Body Amount int32 BaneDmgAmt; // Bane Damage Body Amount
uint32 BaneDmgBody; // Bane Damage Body uint32 BaneDmgBody; // Bane Damage Body
bool Magic; // True=Magic Item, False=not bool Magic; // True=Magic Item, False=not
int32 CastTime_; int32 CastTime_;
@@ -434,6 +434,7 @@ namespace EQEmu
//uint32 Unk054; //uint32 Unk054;
int16 MaxCharges; // Maximum charges items can hold: -1 if not a chargeable item int16 MaxCharges; // Maximum charges items can hold: -1 if not a chargeable item
uint8 ItemType; // Item Type/Skill (itemClass* from above) uint8 ItemType; // Item Type/Skill (itemClass* from above)
int32 SubType; // Some items have sub types that can be used for other things (unbreakable fishing poles, SE_FFItemClass)
uint8 Material; // Item material type uint8 Material; // Item material type
uint32 HerosForgeModel;// Hero's Forge Armor Model Type (2-13?) uint32 HerosForgeModel;// Hero's Forge Armor Model Type (2-13?)
float SellRate; // Sell rate float SellRate; // Sell rate
+1
View File
@@ -203,3 +203,4 @@ F(procname)
F(wornname) F(wornname)
F(focusname) F(focusname)
F(scrollname) F(scrollname)
F(subtype)
+109 -109
View File
@@ -54,9 +54,9 @@ static inline int32 GetNextItemInstSerialNumber() {
} }
// //
// class EQEmu::ItemInstance // class EQ::ItemInstance
// //
EQEmu::ItemInstance::ItemInstance(const ItemData* item, int16 charges) { EQ::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
m_use_type = ItemInstNormal; m_use_type = ItemInstNormal;
if(item) { if(item) {
m_item = new ItemData(*item); m_item = new ItemData(*item);
@@ -87,7 +87,7 @@ EQEmu::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
m_new_id_file = 0; m_new_id_file = 0;
} }
EQEmu::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges) { EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges) {
m_use_type = ItemInstNormal; m_use_type = ItemInstNormal;
m_item = db->GetItem(item_id); m_item = db->GetItem(item_id);
if(m_item) { if(m_item) {
@@ -121,7 +121,7 @@ EQEmu::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 char
m_new_id_file = 0; m_new_id_file = 0;
} }
EQEmu::ItemInstance::ItemInstance(ItemInstTypes use_type) { EQ::ItemInstance::ItemInstance(ItemInstTypes use_type) {
m_use_type = use_type; m_use_type = use_type;
m_item = nullptr; m_item = nullptr;
m_charges = 0; m_charges = 0;
@@ -143,8 +143,8 @@ EQEmu::ItemInstance::ItemInstance(ItemInstTypes use_type) {
m_new_id_file = 0; m_new_id_file = 0;
} }
// Make a copy of an EQEmu::ItemInstance object // Make a copy of an EQ::ItemInstance object
EQEmu::ItemInstance::ItemInstance(const ItemInstance& copy) EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
{ {
m_use_type=copy.m_use_type; m_use_type=copy.m_use_type;
if(copy.m_item) if(copy.m_item)
@@ -202,7 +202,7 @@ EQEmu::ItemInstance::ItemInstance(const ItemInstance& copy)
} }
// Clean up container contents // Clean up container contents
EQEmu::ItemInstance::~ItemInstance() EQ::ItemInstance::~ItemInstance()
{ {
Clear(); Clear();
safe_delete(m_item); safe_delete(m_item);
@@ -211,7 +211,7 @@ EQEmu::ItemInstance::~ItemInstance()
} }
// Query item type // Query item type
bool EQEmu::ItemInstance::IsType(item::ItemClass item_class) const bool EQ::ItemInstance::IsType(item::ItemClass item_class) const
{ {
// IsType(<ItemClassTypes>) does not protect against 'm_item = nullptr' // IsType(<ItemClassTypes>) does not protect against 'm_item = nullptr'
@@ -225,23 +225,23 @@ bool EQEmu::ItemInstance::IsType(item::ItemClass item_class) const
return (m_item->ItemClass == item_class); return (m_item->ItemClass == item_class);
} }
bool EQEmu::ItemInstance::IsClassCommon() const bool EQ::ItemInstance::IsClassCommon() const
{ {
return (m_item && m_item->IsClassCommon()); return (m_item && m_item->IsClassCommon());
} }
bool EQEmu::ItemInstance::IsClassBag() const bool EQ::ItemInstance::IsClassBag() const
{ {
return (m_item && m_item->IsClassBag()); return (m_item && m_item->IsClassBag());
} }
bool EQEmu::ItemInstance::IsClassBook() const bool EQ::ItemInstance::IsClassBook() const
{ {
return (m_item && m_item->IsClassBook()); return (m_item && m_item->IsClassBook());
} }
// Is item stackable? // Is item stackable?
bool EQEmu::ItemInstance::IsStackable() const bool EQ::ItemInstance::IsStackable() const
{ {
if (!m_item) if (!m_item)
return false; return false;
@@ -249,7 +249,7 @@ bool EQEmu::ItemInstance::IsStackable() const
return m_item->Stackable; return m_item->Stackable;
} }
bool EQEmu::ItemInstance::IsCharged() const bool EQ::ItemInstance::IsCharged() const
{ {
if (!m_item) if (!m_item)
return false; return false;
@@ -261,7 +261,7 @@ bool EQEmu::ItemInstance::IsCharged() const
} }
// Can item be equipped? // Can item be equipped?
bool EQEmu::ItemInstance::IsEquipable(uint16 race, uint16 class_) const bool EQ::ItemInstance::IsEquipable(uint16 race, uint16 class_) const
{ {
if (!m_item || (m_item->Slots == 0)) if (!m_item || (m_item->Slots == 0))
return false; return false;
@@ -270,18 +270,18 @@ bool EQEmu::ItemInstance::IsEquipable(uint16 race, uint16 class_) const
} }
// Can equip at this slot? // Can equip at this slot?
bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const bool EQ::ItemInstance::IsEquipable(int16 slot_id) const
{ {
if (!m_item) if (!m_item)
return false; return false;
if (slot_id < EQEmu::invslot::EQUIPMENT_BEGIN || slot_id > EQEmu::invslot::EQUIPMENT_END) if (slot_id < EQ::invslot::EQUIPMENT_BEGIN || slot_id > EQ::invslot::EQUIPMENT_END)
return false; return false;
return ((m_item->Slots & (1 << slot_id)) != 0); return ((m_item->Slots & (1 << slot_id)) != 0);
} }
bool EQEmu::ItemInstance::IsAugmentable() const bool EQ::ItemInstance::IsAugmentable() const
{ {
if (!m_item) if (!m_item)
return false; return false;
@@ -294,7 +294,7 @@ bool EQEmu::ItemInstance::IsAugmentable() const
return false; return false;
} }
bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const { bool EQ::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return false; return false;
@@ -306,10 +306,10 @@ bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const {
} }
} }
return (index <= EQEmu::invslot::EQUIPMENT_END); return (index <= EQ::invslot::EQUIPMENT_END);
} }
int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const int8 EQ::ItemInstance::AvailableAugmentSlot(int32 augtype) const
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return INVALID_INDEX; return INVALID_INDEX;
@@ -324,7 +324,7 @@ int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const
return (index <= invaug::SOCKET_END) ? index : INVALID_INDEX; return (index <= invaug::SOCKET_END) ? index : INVALID_INDEX;
} }
bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return false; return false;
@@ -336,7 +336,7 @@ bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) cons
} }
// Retrieve item inside container // Retrieve item inside container
EQEmu::ItemInstance* EQEmu::ItemInstance::GetItem(uint8 index) const EQ::ItemInstance* EQ::ItemInstance::GetItem(uint8 index) const
{ {
auto it = m_contents.find(index); auto it = m_contents.find(index);
if (it != m_contents.end()) { if (it != m_contents.end()) {
@@ -346,7 +346,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetItem(uint8 index) const
return nullptr; return nullptr;
} }
uint32 EQEmu::ItemInstance::GetItemID(uint8 slot) const uint32 EQ::ItemInstance::GetItemID(uint8 slot) const
{ {
ItemInstance *item = GetItem(slot); ItemInstance *item = GetItem(slot);
if (item) if (item)
@@ -355,7 +355,7 @@ uint32 EQEmu::ItemInstance::GetItemID(uint8 slot) const
return 0; return 0;
} }
void EQEmu::ItemInstance::PutItem(uint8 index, const ItemInstance& inst) void EQ::ItemInstance::PutItem(uint8 index, const ItemInstance& inst)
{ {
// Clean up item already in slot (if exists) // Clean up item already in slot (if exists)
DeleteItem(index); DeleteItem(index);
@@ -365,7 +365,7 @@ void EQEmu::ItemInstance::PutItem(uint8 index, const ItemInstance& inst)
} }
// Remove item inside container // Remove item inside container
void EQEmu::ItemInstance::DeleteItem(uint8 index) void EQ::ItemInstance::DeleteItem(uint8 index)
{ {
ItemInstance* inst = PopItem(index); ItemInstance* inst = PopItem(index);
safe_delete(inst); safe_delete(inst);
@@ -373,7 +373,7 @@ void EQEmu::ItemInstance::DeleteItem(uint8 index)
// Remove item from container without memory delete // Remove item from container without memory delete
// Hands over memory ownership to client of this function call // Hands over memory ownership to client of this function call
EQEmu::ItemInstance* EQEmu::ItemInstance::PopItem(uint8 index) EQ::ItemInstance* EQ::ItemInstance::PopItem(uint8 index)
{ {
auto iter = m_contents.find(index); auto iter = m_contents.find(index);
if (iter != m_contents.end()) { if (iter != m_contents.end()) {
@@ -386,7 +386,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::PopItem(uint8 index)
} }
// Remove all items from container // Remove all items from container
void EQEmu::ItemInstance::Clear() void EQ::ItemInstance::Clear()
{ {
// Destroy container contents // Destroy container contents
for (auto iter = m_contents.begin(); iter != m_contents.end(); ++iter) { for (auto iter = m_contents.begin(); iter != m_contents.end(); ++iter) {
@@ -396,7 +396,7 @@ void EQEmu::ItemInstance::Clear()
} }
// Remove all items from container // Remove all items from container
void EQEmu::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) void EQ::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
{ {
// TODO: This needs work... // TODO: This needs work...
@@ -458,7 +458,7 @@ void EQEmu::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is
} }
} }
uint8 EQEmu::ItemInstance::FirstOpenSlot() const uint8 EQ::ItemInstance::FirstOpenSlot() const
{ {
if (!m_item) if (!m_item)
return INVALID_INDEX; return INVALID_INDEX;
@@ -472,7 +472,7 @@ uint8 EQEmu::ItemInstance::FirstOpenSlot() const
return (i < slots) ? i : INVALID_INDEX; return (i < slots) ? i : INVALID_INDEX;
} }
uint8 EQEmu::ItemInstance::GetTotalItemCount() const uint8 EQ::ItemInstance::GetTotalItemCount() const
{ {
if (!m_item) if (!m_item)
return 0; return 0;
@@ -486,7 +486,7 @@ uint8 EQEmu::ItemInstance::GetTotalItemCount() const
return item_count; return item_count;
} }
bool EQEmu::ItemInstance::IsNoneEmptyContainer() bool EQ::ItemInstance::IsNoneEmptyContainer()
{ {
if (!m_item || !m_item->IsClassBag()) if (!m_item || !m_item->IsClassBag())
return false; return false;
@@ -500,7 +500,7 @@ bool EQEmu::ItemInstance::IsNoneEmptyContainer()
} }
// Retrieve augment inside item // Retrieve augment inside item
EQEmu::ItemInstance* EQEmu::ItemInstance::GetAugment(uint8 slot) const EQ::ItemInstance* EQ::ItemInstance::GetAugment(uint8 slot) const
{ {
if (m_item && m_item->IsClassCommon()) if (m_item && m_item->IsClassCommon())
return GetItem(slot); return GetItem(slot);
@@ -508,7 +508,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetAugment(uint8 slot) const
return nullptr; return nullptr;
} }
EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentationAugtype) const EQ::ItemInstance* EQ::ItemInstance::GetOrnamentationAug(int32 ornamentationAugtype) const
{ {
if (!m_item || !m_item->IsClassCommon()) { return nullptr; } if (!m_item || !m_item->IsClassCommon()) { return nullptr; }
if (ornamentationAugtype == 0) { return nullptr; } if (ornamentationAugtype == 0) { return nullptr; }
@@ -533,7 +533,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentatio
return nullptr; return nullptr;
} }
uint32 EQEmu::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const { uint32 EQ::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const {
// Not a Hero Forge item. // Not a Hero Forge item.
if (m_ornament_hero_model == 0 || material_slot < 0) if (m_ornament_hero_model == 0 || material_slot < 0)
return 0; return 0;
@@ -546,7 +546,7 @@ uint32 EQEmu::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const {
return (m_ornament_hero_model * 100) + material_slot; return (m_ornament_hero_model * 100) + material_slot;
} }
bool EQEmu::ItemInstance::UpdateOrnamentationInfo() { bool EQ::ItemInstance::UpdateOrnamentationInfo() {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return false; return false;
@@ -582,7 +582,7 @@ bool EQEmu::ItemInstance::UpdateOrnamentationInfo() {
return ornamentSet; return ornamentSet;
} }
bool EQEmu::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll) { bool EQ::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll) {
if (!ItemToTry || !Container) return false; if (!ItemToTry || !Container) return false;
if (ItemToTry->ItemType == item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0) if (ItemToTry->ItemType == item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0)
@@ -629,7 +629,7 @@ bool EQEmu::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData
return false; return false;
} }
uint32 EQEmu::ItemInstance::GetAugmentItemID(uint8 slot) const uint32 EQ::ItemInstance::GetAugmentItemID(uint8 slot) const
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return 0; return 0;
@@ -638,7 +638,7 @@ uint32 EQEmu::ItemInstance::GetAugmentItemID(uint8 slot) const
} }
// Add an augment to the item // Add an augment to the item
void EQEmu::ItemInstance::PutAugment(uint8 slot, const ItemInstance& augment) void EQ::ItemInstance::PutAugment(uint8 slot, const ItemInstance& augment)
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return; return;
@@ -646,7 +646,7 @@ void EQEmu::ItemInstance::PutAugment(uint8 slot, const ItemInstance& augment)
PutItem(slot, augment); PutItem(slot, augment);
} }
void EQEmu::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id) void EQ::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id)
{ {
if (item_id == 0) { return; } if (item_id == 0) { return; }
if (db == nullptr) { return; /* TODO: add log message for nullptr */ } if (db == nullptr) { return; /* TODO: add log message for nullptr */ }
@@ -659,7 +659,7 @@ void EQEmu::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item
} }
// Remove augment from item and destroy it // Remove augment from item and destroy it
void EQEmu::ItemInstance::DeleteAugment(uint8 index) void EQ::ItemInstance::DeleteAugment(uint8 index)
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return; return;
@@ -668,7 +668,7 @@ void EQEmu::ItemInstance::DeleteAugment(uint8 index)
} }
// Remove augment from item and return it // Remove augment from item and return it
EQEmu::ItemInstance* EQEmu::ItemInstance::RemoveAugment(uint8 index) EQ::ItemInstance* EQ::ItemInstance::RemoveAugment(uint8 index)
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return nullptr; return nullptr;
@@ -676,7 +676,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::RemoveAugment(uint8 index)
return PopItem(index); return PopItem(index);
} }
bool EQEmu::ItemInstance::IsAugmented() bool EQ::ItemInstance::IsAugmented()
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return false; return false;
@@ -690,7 +690,7 @@ bool EQEmu::ItemInstance::IsAugmented()
} }
// Has attack/delay? // Has attack/delay?
bool EQEmu::ItemInstance::IsWeapon() const bool EQ::ItemInstance::IsWeapon() const
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return false; return false;
@@ -701,7 +701,7 @@ bool EQEmu::ItemInstance::IsWeapon() const
return ((m_item->Damage != 0) && (m_item->Delay != 0)); return ((m_item->Damage != 0) && (m_item->Delay != 0));
} }
bool EQEmu::ItemInstance::IsAmmo() const bool EQ::ItemInstance::IsAmmo() const
{ {
if (!m_item) if (!m_item)
return false; return false;
@@ -717,7 +717,7 @@ bool EQEmu::ItemInstance::IsAmmo() const
} }
const EQEmu::ItemData* EQEmu::ItemInstance::GetItem() const const EQ::ItemData* EQ::ItemInstance::GetItem() const
{ {
if (!m_item) if (!m_item)
return nullptr; return nullptr;
@@ -728,13 +728,13 @@ const EQEmu::ItemData* EQEmu::ItemInstance::GetItem() const
return m_item; return m_item;
} }
const EQEmu::ItemData* EQEmu::ItemInstance::GetUnscaledItem() const const EQ::ItemData* EQ::ItemInstance::GetUnscaledItem() const
{ {
// No operator calls and defaults to nullptr // No operator calls and defaults to nullptr
return m_item; return m_item;
} }
std::string EQEmu::ItemInstance::GetCustomDataString() const { std::string EQ::ItemInstance::GetCustomDataString() const {
std::string ret_val; std::string ret_val;
auto iter = m_custom_data.begin(); auto iter = m_custom_data.begin();
while (iter != m_custom_data.end()) { while (iter != m_custom_data.end()) {
@@ -753,7 +753,7 @@ std::string EQEmu::ItemInstance::GetCustomDataString() const {
return ret_val; return ret_val;
} }
std::string EQEmu::ItemInstance::GetCustomData(std::string identifier) { std::string EQ::ItemInstance::GetCustomData(std::string identifier) {
std::map<std::string, std::string>::const_iterator iter = m_custom_data.find(identifier); std::map<std::string, std::string>::const_iterator iter = m_custom_data.find(identifier);
if (iter != m_custom_data.end()) { if (iter != m_custom_data.end()) {
return iter->second; return iter->second;
@@ -762,49 +762,49 @@ std::string EQEmu::ItemInstance::GetCustomData(std::string identifier) {
return ""; return "";
} }
void EQEmu::ItemInstance::SetCustomData(std::string identifier, std::string value) { void EQ::ItemInstance::SetCustomData(std::string identifier, std::string value) {
DeleteCustomData(identifier); DeleteCustomData(identifier);
m_custom_data[identifier] = value; m_custom_data[identifier] = value;
} }
void EQEmu::ItemInstance::SetCustomData(std::string identifier, int value) { void EQ::ItemInstance::SetCustomData(std::string identifier, int value) {
DeleteCustomData(identifier); DeleteCustomData(identifier);
std::stringstream ss; std::stringstream ss;
ss << value; ss << value;
m_custom_data[identifier] = ss.str(); m_custom_data[identifier] = ss.str();
} }
void EQEmu::ItemInstance::SetCustomData(std::string identifier, float value) { void EQ::ItemInstance::SetCustomData(std::string identifier, float value) {
DeleteCustomData(identifier); DeleteCustomData(identifier);
std::stringstream ss; std::stringstream ss;
ss << value; ss << value;
m_custom_data[identifier] = ss.str(); m_custom_data[identifier] = ss.str();
} }
void EQEmu::ItemInstance::SetCustomData(std::string identifier, bool value) { void EQ::ItemInstance::SetCustomData(std::string identifier, bool value) {
DeleteCustomData(identifier); DeleteCustomData(identifier);
std::stringstream ss; std::stringstream ss;
ss << value; ss << value;
m_custom_data[identifier] = ss.str(); m_custom_data[identifier] = ss.str();
} }
void EQEmu::ItemInstance::DeleteCustomData(std::string identifier) { void EQ::ItemInstance::DeleteCustomData(std::string identifier) {
auto iter = m_custom_data.find(identifier); auto iter = m_custom_data.find(identifier);
if (iter != m_custom_data.end()) { if (iter != m_custom_data.end()) {
m_custom_data.erase(iter); m_custom_data.erase(iter);
} }
} }
// Clone a type of EQEmu::ItemInstance object // Clone a type of EQ::ItemInstance object
// c++ doesn't allow a polymorphic copy constructor, // c++ doesn't allow a polymorphic copy constructor,
// so we have to resort to a polymorphic Clone() // so we have to resort to a polymorphic Clone()
EQEmu::ItemInstance* EQEmu::ItemInstance::Clone() const EQ::ItemInstance* EQ::ItemInstance::Clone() const
{ {
// Pseudo-polymorphic copy constructor // Pseudo-polymorphic copy constructor
return new ItemInstance(*this); return new ItemInstance(*this);
} }
bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const { bool EQ::ItemInstance::IsSlotAllowed(int16 slot_id) const {
if (!m_item) { return false; } if (!m_item) { return false; }
else if (InventoryProfile::SupportsContainers(slot_id)) { return true; } else if (InventoryProfile::SupportsContainers(slot_id)) { return true; }
else if (m_item->Slots & (1 << slot_id)) { return true; } else if (m_item->Slots & (1 << slot_id)) { return true; }
@@ -812,7 +812,7 @@ bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const {
else { return false; } else { return false; }
} }
bool EQEmu::ItemInstance::IsDroppable(bool recurse) const bool EQ::ItemInstance::IsDroppable(bool recurse) const
{ {
if (!m_item) if (!m_item)
return false; return false;
@@ -838,7 +838,7 @@ bool EQEmu::ItemInstance::IsDroppable(bool recurse) const
return true; return true;
} }
void EQEmu::ItemInstance::Initialize(SharedDatabase *db) { void EQ::ItemInstance::Initialize(SharedDatabase *db) {
// if there's no actual item, don't do anything // if there's no actual item, don't do anything
if (!m_item) if (!m_item)
return; return;
@@ -855,7 +855,7 @@ void EQEmu::ItemInstance::Initialize(SharedDatabase *db) {
} }
} }
void EQEmu::ItemInstance::ScaleItem() { void EQ::ItemInstance::ScaleItem() {
if (!m_item) if (!m_item)
return; return;
@@ -939,18 +939,18 @@ void EQEmu::ItemInstance::ScaleItem() {
m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself. m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself.
} }
bool EQEmu::ItemInstance::EvolveOnAllKills() const { bool EQ::ItemInstance::EvolveOnAllKills() const {
return (m_evolveInfo && m_evolveInfo->AllKills); return (m_evolveInfo && m_evolveInfo->AllKills);
} }
int8 EQEmu::ItemInstance::GetMaxEvolveLvl() const { int8 EQ::ItemInstance::GetMaxEvolveLvl() const {
if (m_evolveInfo) if (m_evolveInfo)
return m_evolveInfo->MaxLvl; return m_evolveInfo->MaxLvl;
else else
return 0; return 0;
} }
uint32 EQEmu::ItemInstance::GetKillsNeeded(uint8 currentlevel) { uint32 EQ::ItemInstance::GetKillsNeeded(uint8 currentlevel) {
uint32 kills = -1; // default to -1 (max uint32 value) because this value is usually divided by, so we don't want to ever return zero. uint32 kills = -1; // default to -1 (max uint32 value) because this value is usually divided by, so we don't want to ever return zero.
if (m_evolveInfo) if (m_evolveInfo)
if (currentlevel != m_evolveInfo->MaxLvl) if (currentlevel != m_evolveInfo->MaxLvl)
@@ -962,24 +962,24 @@ uint32 EQEmu::ItemInstance::GetKillsNeeded(uint8 currentlevel) {
return kills; return kills;
} }
void EQEmu::ItemInstance::SetTimer(std::string name, uint32 time) { void EQ::ItemInstance::SetTimer(std::string name, uint32 time) {
Timer t(time); Timer t(time);
t.Start(time, false); t.Start(time, false);
m_timers[name] = t; m_timers[name] = t;
} }
void EQEmu::ItemInstance::StopTimer(std::string name) { void EQ::ItemInstance::StopTimer(std::string name) {
auto iter = m_timers.find(name); auto iter = m_timers.find(name);
if(iter != m_timers.end()) { if(iter != m_timers.end()) {
m_timers.erase(iter); m_timers.erase(iter);
} }
} }
void EQEmu::ItemInstance::ClearTimers() { void EQ::ItemInstance::ClearTimers() {
m_timers.clear(); m_timers.clear();
} }
int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const int EQ::ItemInstance::GetItemArmorClass(bool augments) const
{ {
int ac = 0; int ac = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -993,7 +993,7 @@ int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const
return ac; return ac;
} }
int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments) const int EQ::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments) const
{ {
const auto item = GetItem(); const auto item = GetItem();
if (item) { if (item) {
@@ -1035,7 +1035,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold
return magic + fire + cold + poison + disease + chromatic + prismatic + physical + corruption; return magic + fire + cold + poison + disease + chromatic + prismatic + physical + corruption;
} }
int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const int EQ::ItemInstance::GetItemElementalFlag(bool augments) const
{ {
int flag = 0; int flag = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1056,7 +1056,7 @@ int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const
return flag; return flag;
} }
int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const int EQ::ItemInstance::GetItemElementalDamage(bool augments) const
{ {
int damage = 0; int damage = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1077,7 +1077,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const
return damage; return damage;
} }
int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const int EQ::ItemInstance::GetItemRecommendedLevel(bool augments) const
{ {
int level = 0; int level = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1099,7 +1099,7 @@ int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const
return level; return level;
} }
int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const int EQ::ItemInstance::GetItemRequiredLevel(bool augments) const
{ {
int level = 0; int level = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1121,7 +1121,7 @@ int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const
return level; return level;
} }
int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const int EQ::ItemInstance::GetItemWeaponDamage(bool augments) const
{ {
int damage = 0; int damage = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1137,7 +1137,7 @@ int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const
return damage; return damage;
} }
int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const int EQ::ItemInstance::GetItemBackstabDamage(bool augments) const
{ {
int damage = 0; int damage = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1153,7 +1153,7 @@ int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const
return damage; return damage;
} }
int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const int EQ::ItemInstance::GetItemBaneDamageBody(bool augments) const
{ {
int body = 0; int body = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1174,7 +1174,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const
return body; return body;
} }
int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const int EQ::ItemInstance::GetItemBaneDamageRace(bool augments) const
{ {
int race = 0; int race = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1195,7 +1195,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const
return race; return race;
} }
int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) const int EQ::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) const
{ {
int damage = 0; int damage = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1212,7 +1212,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments)
return damage; return damage;
} }
int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) const int EQ::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) const
{ {
int damage = 0; int damage = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1229,7 +1229,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) co
return damage; return damage;
} }
int EQEmu::ItemInstance::GetItemMagical(bool augments) const int EQ::ItemInstance::GetItemMagical(bool augments) const
{ {
const auto item = GetItem(); const auto item = GetItem();
if (item) { if (item) {
@@ -1245,7 +1245,7 @@ int EQEmu::ItemInstance::GetItemMagical(bool augments) const
return 0; return 0;
} }
int EQEmu::ItemInstance::GetItemHP(bool augments) const int EQ::ItemInstance::GetItemHP(bool augments) const
{ {
int hp = 0; int hp = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1259,7 +1259,7 @@ int EQEmu::ItemInstance::GetItemHP(bool augments) const
return hp; return hp;
} }
int EQEmu::ItemInstance::GetItemMana(bool augments) const int EQ::ItemInstance::GetItemMana(bool augments) const
{ {
int mana = 0; int mana = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1273,7 +1273,7 @@ int EQEmu::ItemInstance::GetItemMana(bool augments) const
return mana; return mana;
} }
int EQEmu::ItemInstance::GetItemEndur(bool augments) const int EQ::ItemInstance::GetItemEndur(bool augments) const
{ {
int endur = 0; int endur = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1287,7 +1287,7 @@ int EQEmu::ItemInstance::GetItemEndur(bool augments) const
return endur; return endur;
} }
int EQEmu::ItemInstance::GetItemAttack(bool augments) const int EQ::ItemInstance::GetItemAttack(bool augments) const
{ {
int atk = 0; int atk = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1301,7 +1301,7 @@ int EQEmu::ItemInstance::GetItemAttack(bool augments) const
return atk; return atk;
} }
int EQEmu::ItemInstance::GetItemStr(bool augments) const int EQ::ItemInstance::GetItemStr(bool augments) const
{ {
int str = 0; int str = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1315,7 +1315,7 @@ int EQEmu::ItemInstance::GetItemStr(bool augments) const
return str; return str;
} }
int EQEmu::ItemInstance::GetItemSta(bool augments) const int EQ::ItemInstance::GetItemSta(bool augments) const
{ {
int sta = 0; int sta = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1329,7 +1329,7 @@ int EQEmu::ItemInstance::GetItemSta(bool augments) const
return sta; return sta;
} }
int EQEmu::ItemInstance::GetItemDex(bool augments) const int EQ::ItemInstance::GetItemDex(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1343,7 +1343,7 @@ int EQEmu::ItemInstance::GetItemDex(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemAgi(bool augments) const int EQ::ItemInstance::GetItemAgi(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1357,7 +1357,7 @@ int EQEmu::ItemInstance::GetItemAgi(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemInt(bool augments) const int EQ::ItemInstance::GetItemInt(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1371,7 +1371,7 @@ int EQEmu::ItemInstance::GetItemInt(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemWis(bool augments) const int EQ::ItemInstance::GetItemWis(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1385,7 +1385,7 @@ int EQEmu::ItemInstance::GetItemWis(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemCha(bool augments) const int EQ::ItemInstance::GetItemCha(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1399,7 +1399,7 @@ int EQEmu::ItemInstance::GetItemCha(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemMR(bool augments) const int EQ::ItemInstance::GetItemMR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1413,7 +1413,7 @@ int EQEmu::ItemInstance::GetItemMR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemFR(bool augments) const int EQ::ItemInstance::GetItemFR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1427,7 +1427,7 @@ int EQEmu::ItemInstance::GetItemFR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemCR(bool augments) const int EQ::ItemInstance::GetItemCR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1441,7 +1441,7 @@ int EQEmu::ItemInstance::GetItemCR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemPR(bool augments) const int EQ::ItemInstance::GetItemPR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1455,7 +1455,7 @@ int EQEmu::ItemInstance::GetItemPR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemDR(bool augments) const int EQ::ItemInstance::GetItemDR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1469,7 +1469,7 @@ int EQEmu::ItemInstance::GetItemDR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemCorrup(bool augments) const int EQ::ItemInstance::GetItemCorrup(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1483,7 +1483,7 @@ int EQEmu::ItemInstance::GetItemCorrup(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const int EQ::ItemInstance::GetItemHeroicStr(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1497,7 +1497,7 @@ int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const int EQ::ItemInstance::GetItemHeroicSta(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1511,7 +1511,7 @@ int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const int EQ::ItemInstance::GetItemHeroicDex(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1525,7 +1525,7 @@ int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const int EQ::ItemInstance::GetItemHeroicAgi(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1539,7 +1539,7 @@ int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const int EQ::ItemInstance::GetItemHeroicInt(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1553,7 +1553,7 @@ int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const int EQ::ItemInstance::GetItemHeroicWis(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1567,7 +1567,7 @@ int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const int EQ::ItemInstance::GetItemHeroicCha(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1581,7 +1581,7 @@ int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const int EQ::ItemInstance::GetItemHeroicMR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1595,7 +1595,7 @@ int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const int EQ::ItemInstance::GetItemHeroicFR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1609,7 +1609,7 @@ int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const int EQ::ItemInstance::GetItemHeroicCR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1623,7 +1623,7 @@ int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const int EQ::ItemInstance::GetItemHeroicPR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1637,7 +1637,7 @@ int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const int EQ::ItemInstance::GetItemHeroicDR(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1651,7 +1651,7 @@ int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const int EQ::ItemInstance::GetItemHeroicCorrup(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
@@ -1665,7 +1665,7 @@ int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const
return total; return total;
} }
int EQEmu::ItemInstance::GetItemHaste(bool augments) const int EQ::ItemInstance::GetItemHaste(bool augments) const
{ {
int total = 0; int total = 0;
const auto item = GetItem(); const auto item = GetItem();
+6 -6
View File
@@ -38,7 +38,7 @@ class EvolveInfo; // Stores information about an evolving item family
#include <map> #include <map>
// Specifies usage type for item inside EQEmu::ItemInstance // Specifies usage type for item inside EQ::ItemInstance
enum ItemInstTypes enum ItemInstTypes
{ {
ItemInstNormal = 0, ItemInstNormal = 0,
@@ -54,11 +54,11 @@ typedef enum {
class SharedDatabase; class SharedDatabase;
// ######################################## // ########################################
// Class: EQEmu::ItemInstance // Class: EQ::ItemInstance
// Base class for an instance of an item // Base class for an instance of an item
// An item instance encapsulates item data + data specific // An item instance encapsulates item data + data specific
// to an item instance (includes dye, augments, charges, etc) // to an item instance (includes dye, augments, charges, etc)
namespace EQEmu namespace EQ
{ {
class InventoryProfile; class InventoryProfile;
@@ -222,7 +222,7 @@ namespace EQEmu
inline int32 GetSerialNumber() const { return m_SerialNumber; } inline int32 GetSerialNumber() const { return m_SerialNumber; }
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; } inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
std::map<std::string, Timer>& GetTimers() { return m_timers; } std::map<std::string, ::Timer>& GetTimers() { return m_timers; }
void SetTimer(std::string name, uint32 time); void SetTimer(std::string name, uint32 time);
void StopTimer(std::string name); void StopTimer(std::string name);
void ClearTimers(); void ClearTimers();
@@ -316,13 +316,13 @@ namespace EQEmu
// Items inside of this item (augs or contents); // Items inside of this item (augs or contents);
std::map<uint8, ItemInstance*> m_contents; // Zero-based index: min=0, max=9 std::map<uint8, ItemInstance*> m_contents; // Zero-based index: min=0, max=9
std::map<std::string, std::string> m_custom_data; std::map<std::string, std::string> m_custom_data;
std::map<std::string, Timer> m_timers; std::map<std::string, ::Timer> m_timers;
}; };
} }
class EvolveInfo { class EvolveInfo {
public: public:
friend class EQEmu::ItemInstance; friend class EQ::ItemInstance;
//temporary //temporary
uint16 LvlKills[9]; uint16 LvlKills[9];
uint32 FirstItem; uint32 FirstItem;
+1 -1
View File
@@ -5277,7 +5277,7 @@ void StreamWriterBuilder::setDefaults(Json::Value* settings)
{ {
//! [StreamWriterBuilderDefaults] //! [StreamWriterBuilderDefaults]
(*settings)["commentStyle"] = "All"; (*settings)["commentStyle"] = "All";
(*settings)["indentation"] = "\t"; (*settings)["indentation"] = " ";
(*settings)["enableYAMLCompatibility"] = false; (*settings)["enableYAMLCompatibility"] = false;
(*settings)["dropNullPlaceholders"] = false; (*settings)["dropNullPlaceholders"] = false;
(*settings)["useSpecialFloats"] = false; (*settings)["useSpecialFloats"] = false;
+89 -17
View File
@@ -1,26 +1,29 @@
#include "json_config.h" #include "json_config.h"
#include <fstream> #include <fstream>
#include <iostream>
EQ::JsonConfigFile::JsonConfigFile() EQ::JsonConfigFile::JsonConfigFile() = default;
{
}
EQ::JsonConfigFile::JsonConfigFile(const Json::Value &value) EQ::JsonConfigFile::JsonConfigFile(const Json::Value &value)
{ {
m_root = value; m_root = value;
} }
EQ::JsonConfigFile::~JsonConfigFile() EQ::JsonConfigFile::~JsonConfigFile() = default;
{
}
EQ::JsonConfigFile EQ::JsonConfigFile::Load(const std::string &filename) /**
* @param file_name
* @return
*/
EQ::JsonConfigFile EQ::JsonConfigFile::Load(
const std::string &file_name
)
{ {
JsonConfigFile ret; JsonConfigFile ret;
ret.m_root = Json::Value(); ret.m_root = Json::Value();
std::ifstream ifs; std::ifstream ifs;
ifs.open(filename, std::ifstream::in); ifs.open(file_name, std::ifstream::in);
if (!ifs.good()) { if (!ifs.good()) {
return ret; return ret;
@@ -29,59 +32,128 @@ EQ::JsonConfigFile EQ::JsonConfigFile::Load(const std::string &filename)
try { try {
ifs >> ret.m_root; ifs >> ret.m_root;
} }
catch (std::exception) { catch (std::exception &) {
return ret; return ret;
} }
return ret; return ret;
} }
std::string EQ::JsonConfigFile::GetVariableString(const std::string &title, const std::string &parameter, const std::string &default_value) { /**
* @param file_name
* @return
*/
void EQ::JsonConfigFile::Save(
const std::string &file_name
)
{
std::ofstream opened_config_file;
opened_config_file.open(file_name);
/**
* Grab and build config contents
*/
Json::StreamWriterBuilder write_builder;
write_builder["indentation"] = " ";
std::string document = Json::writeString(write_builder, m_root);
/**
* Write current contents and close
*/
opened_config_file << document;
opened_config_file.close();
}
/**
* @param title
* @param parameter
* @param default_value
* @return
*/
std::string EQ::JsonConfigFile::GetVariableString(
const std::string &title,
const std::string &parameter,
const std::string &default_value
)
{
try { try {
if (m_root.isMember(title) && m_root[title].isMember(parameter)) { if (m_root.isMember(title) && m_root[title].isMember(parameter)) {
return m_root[title][parameter].asString(); return m_root[title][parameter].asString();
} }
} }
catch (std::exception) { catch (std::exception &) {
return default_value; return default_value;
} }
return default_value; return default_value;
} }
int EQ::JsonConfigFile::GetVariableInt(const std::string &title, const std::string &parameter, const int default_value) { /**
* @param title
* @param parameter
* @param default_value
* @return
*/
int EQ::JsonConfigFile::GetVariableInt(
const std::string &title,
const std::string &parameter,
const int default_value
)
{
try { try {
if (m_root.isMember(title) && m_root[title].isMember(parameter)) { if (m_root.isMember(title) && m_root[title].isMember(parameter)) {
return m_root[title][parameter].asInt(); return m_root[title][parameter].asInt();
} }
} }
catch (std::exception) { catch (std::exception &) {
return default_value; return default_value;
} }
return default_value; return default_value;
} }
bool EQ::JsonConfigFile::GetVariableBool(const std::string &title, const std::string &parameter, const bool default_value) { /**
* @param title
* @param parameter
* @param default_value
* @return
*/
bool EQ::JsonConfigFile::GetVariableBool(
const std::string &title,
const std::string &parameter,
const bool default_value
)
{
try { try {
if (m_root.isMember(title) && m_root[title].isMember(parameter)) { if (m_root.isMember(title) && m_root[title].isMember(parameter)) {
return m_root[title][parameter].asBool(); return m_root[title][parameter].asBool();
} }
} }
catch (std::exception) { catch (std::exception &) {
return default_value; return default_value;
} }
return default_value; return default_value;
} }
double EQ::JsonConfigFile::GetVariableDouble(const std::string &title, const std::string &parameter, const double default_value) { /**
* @param title
* @param parameter
* @param default_value
* @return
*/
double EQ::JsonConfigFile::GetVariableDouble(
const std::string &title,
const std::string &parameter,
const double default_value
)
{
try { try {
if (m_root.isMember(title) && m_root[title].isMember(parameter)) { if (m_root.isMember(title) && m_root[title].isMember(parameter)) {
return m_root[title][parameter].asDouble(); return m_root[title][parameter].asDouble();
} }
} }
catch (std::exception) { catch (std::exception &) {
return default_value; return default_value;
} }
+3 -2
View File
@@ -7,10 +7,12 @@ namespace EQ
class JsonConfigFile class JsonConfigFile
{ {
public: public:
JsonConfigFile();
JsonConfigFile(const Json::Value &value); JsonConfigFile(const Json::Value &value);
~JsonConfigFile(); ~JsonConfigFile();
static JsonConfigFile Load(const std::string &filename); static JsonConfigFile Load(const std::string &file_name);
void Save(const std::string &file_name);
std::string GetVariableString(const std::string &title, const std::string &parameter, const std::string &default_value); std::string GetVariableString(const std::string &title, const std::string &parameter, const std::string &default_value);
int GetVariableInt(const std::string &title, const std::string &parameter, const int default_value); int GetVariableInt(const std::string &title, const std::string &parameter, const int default_value);
@@ -19,7 +21,6 @@ namespace EQ
Json::Value& RawHandle() { return m_root; } Json::Value& RawHandle() { return m_root; }
private: private:
JsonConfigFile();
Json::Value m_root; Json::Value m_root;
}; };
+5 -5
View File
@@ -22,7 +22,7 @@
#include <string.h> #include <string.h>
uint8 EQEmu::lightsource::TypeToLevel(uint8 light_type) uint8 EQ::lightsource::TypeToLevel(uint8 light_type)
{ {
switch (light_type) { switch (light_type) {
case LightTypeGlobeOfStars: case LightTypeGlobeOfStars:
@@ -55,7 +55,7 @@ uint8 EQEmu::lightsource::TypeToLevel(uint8 light_type)
} }
} }
bool EQEmu::lightsource::IsLevelGreater(uint8 left_type, uint8 right_type) bool EQ::lightsource::IsLevelGreater(uint8 left_type, uint8 right_type)
{ {
static const uint8 light_levels[LightTypeCount] = { static const uint8 light_levels[LightTypeCount] = {
LightLevelUnlit, /* LightTypeNone */ LightLevelUnlit, /* LightTypeNone */
@@ -82,17 +82,17 @@ bool EQEmu::lightsource::IsLevelGreater(uint8 left_type, uint8 right_type)
return (light_levels[left_type] > light_levels[right_type]); return (light_levels[left_type] > light_levels[right_type]);
} }
EQEmu::LightSource_Struct::LightSource_Struct() EQ::LightSource_Struct::LightSource_Struct()
{ {
Clear(); Clear();
} }
void EQEmu::LightSource_Struct::Clear() void EQ::LightSource_Struct::Clear()
{ {
memset(&Slot, 0, (sizeof(uint8) * lightsource::LightCount)); memset(&Slot, 0, (sizeof(uint8) * lightsource::LightCount));
} }
void EQEmu::LightSourceProfile::Clear() void EQ::LightSourceProfile::Clear()
{ {
Type.Clear(); Type.Clear();
Level.Clear(); Level.Clear();
+1 -1
View File
@@ -23,7 +23,7 @@
#include "types.h" #include "types.h"
namespace EQEmu namespace EQ
{ {
namespace lightsource { namespace lightsource {
enum LightSlot { enum LightSlot {
-6
View File
@@ -278,12 +278,6 @@ void LinkedListIterator<TYPE>::Replace(const TYPE& new_data)
template<class TYPE> template<class TYPE>
void LinkedListIterator<TYPE>::Reset() void LinkedListIterator<TYPE>::Reset()
{ {
if (!(&list))
{
current_element=0;
return;
}
if (dir == FORWARD) if (dir == FORWARD)
{ {
current_element = list.first; current_element = list.first;
+4 -2
View File
@@ -43,8 +43,10 @@ struct LootDropEntries_Struct {
int8 item_charges; int8 item_charges;
uint8 equip_item; uint8 equip_item;
float chance; float chance;
uint8 minlevel; uint16 trivial_min_level;
uint8 maxlevel; uint16 trivial_max_level;
uint16 npc_min_level;
uint16 npc_max_level;
uint8 multiplier; uint8 multiplier;
}; };
+24 -24
View File
@@ -20,7 +20,7 @@
#include "memory_buffer.h" #include "memory_buffer.h"
EQEmu::MemoryBuffer::MemoryBuffer() EQ::MemoryBuffer::MemoryBuffer()
{ {
buffer_ = nullptr; buffer_ = nullptr;
size_ = 0; size_ = 0;
@@ -29,7 +29,7 @@ EQEmu::MemoryBuffer::MemoryBuffer()
write_pos_ = 0; write_pos_ = 0;
} }
EQEmu::MemoryBuffer::MemoryBuffer(size_t sz) EQ::MemoryBuffer::MemoryBuffer(size_t sz)
{ {
buffer_ = nullptr; buffer_ = nullptr;
size_ = 0; size_ = 0;
@@ -39,7 +39,7 @@ EQEmu::MemoryBuffer::MemoryBuffer(size_t sz)
Resize(sz); Resize(sz);
} }
EQEmu::MemoryBuffer::MemoryBuffer(const MemoryBuffer &other) EQ::MemoryBuffer::MemoryBuffer(const MemoryBuffer &other)
{ {
if(other.capacity_) { if(other.capacity_) {
buffer_ = new uchar[other.capacity_]; buffer_ = new uchar[other.capacity_];
@@ -54,7 +54,7 @@ EQEmu::MemoryBuffer::MemoryBuffer(const MemoryBuffer &other)
read_pos_ = other.read_pos_; read_pos_ = other.read_pos_;
} }
EQEmu::MemoryBuffer::MemoryBuffer(MemoryBuffer &&other) EQ::MemoryBuffer::MemoryBuffer(MemoryBuffer &&other)
{ {
uchar *tbuf = other.buffer_; uchar *tbuf = other.buffer_;
size_t tsz = other.size_; size_t tsz = other.size_;
@@ -75,7 +75,7 @@ EQEmu::MemoryBuffer::MemoryBuffer(MemoryBuffer &&other)
read_pos_ = tread_pos; read_pos_ = tread_pos;
} }
EQEmu::MemoryBuffer& EQEmu::MemoryBuffer::operator=(const MemoryBuffer &other) EQ::MemoryBuffer& EQ::MemoryBuffer::operator=(const MemoryBuffer &other)
{ {
if(this == &other) { if(this == &other) {
return *this; return *this;
@@ -100,7 +100,7 @@ EQEmu::MemoryBuffer& EQEmu::MemoryBuffer::operator=(const MemoryBuffer &other)
return *this; return *this;
} }
EQEmu::MemoryBuffer& EQEmu::MemoryBuffer::operator=(MemoryBuffer &&other) EQ::MemoryBuffer& EQ::MemoryBuffer::operator=(MemoryBuffer &&other)
{ {
uchar *tbuf = other.buffer_; uchar *tbuf = other.buffer_;
size_t tsz = other.size_; size_t tsz = other.size_;
@@ -122,7 +122,7 @@ EQEmu::MemoryBuffer& EQEmu::MemoryBuffer::operator=(MemoryBuffer &&other)
return *this; return *this;
} }
EQEmu::MemoryBuffer& EQEmu::MemoryBuffer::operator+=(const MemoryBuffer &rhs) EQ::MemoryBuffer& EQ::MemoryBuffer::operator+=(const MemoryBuffer &rhs)
{ {
if(!rhs.buffer_) { if(!rhs.buffer_) {
return *this; return *this;
@@ -142,52 +142,52 @@ EQEmu::MemoryBuffer& EQEmu::MemoryBuffer::operator+=(const MemoryBuffer &rhs)
return *this; return *this;
} }
EQEmu::MemoryBuffer::~MemoryBuffer() EQ::MemoryBuffer::~MemoryBuffer()
{ {
Clear(); Clear();
} }
uchar& EQEmu::MemoryBuffer::operator[](size_t pos) uchar& EQ::MemoryBuffer::operator[](size_t pos)
{ {
return buffer_[pos]; return buffer_[pos];
} }
const uchar& EQEmu::MemoryBuffer::operator[](size_t pos) const const uchar& EQ::MemoryBuffer::operator[](size_t pos) const
{ {
return buffer_[pos]; return buffer_[pos];
} }
bool EQEmu::MemoryBuffer::Empty() bool EQ::MemoryBuffer::Empty()
{ {
return size_ == 0; return size_ == 0;
} }
bool EQEmu::MemoryBuffer::Empty() const bool EQ::MemoryBuffer::Empty() const
{ {
return size_ == 0; return size_ == 0;
} }
size_t EQEmu::MemoryBuffer::Size() size_t EQ::MemoryBuffer::Size()
{ {
return size_; return size_;
} }
size_t EQEmu::MemoryBuffer::Size() const size_t EQ::MemoryBuffer::Size() const
{ {
return size_; return size_;
} }
size_t EQEmu::MemoryBuffer::Capacity() size_t EQ::MemoryBuffer::Capacity()
{ {
return capacity_; return capacity_;
} }
size_t EQEmu::MemoryBuffer::Capacity() const size_t EQ::MemoryBuffer::Capacity() const
{ {
return capacity_; return capacity_;
} }
void EQEmu::MemoryBuffer::Resize(size_t sz) void EQ::MemoryBuffer::Resize(size_t sz)
{ {
if(!buffer_) { if(!buffer_) {
size_t new_size = sz + 64; size_t new_size = sz + 64;
@@ -213,7 +213,7 @@ void EQEmu::MemoryBuffer::Resize(size_t sz)
} }
} }
void EQEmu::MemoryBuffer::Clear() void EQ::MemoryBuffer::Clear()
{ {
if(buffer_) { if(buffer_) {
delete[] buffer_; delete[] buffer_;
@@ -226,14 +226,14 @@ void EQEmu::MemoryBuffer::Clear()
read_pos_ = 0; read_pos_ = 0;
} }
void EQEmu::MemoryBuffer::Zero() void EQ::MemoryBuffer::Zero()
{ {
if(buffer_) { if(buffer_) {
memset(buffer_, 0, capacity_); memset(buffer_, 0, capacity_);
} }
} }
void EQEmu::MemoryBuffer::Write(const char *val, size_t len) void EQ::MemoryBuffer::Write(const char *val, size_t len)
{ {
size_t size_needed = write_pos_ + len; size_t size_needed = write_pos_ + len;
Resize(size_needed); Resize(size_needed);
@@ -242,20 +242,20 @@ void EQEmu::MemoryBuffer::Write(const char *val, size_t len)
write_pos_ += len; write_pos_ += len;
} }
void EQEmu::MemoryBuffer::Read(uchar *buf, size_t len) void EQ::MemoryBuffer::Read(uchar *buf, size_t len)
{ {
memcpy(buf, &buffer_[read_pos_], len); memcpy(buf, &buffer_[read_pos_], len);
read_pos_ += len; read_pos_ += len;
} }
void EQEmu::MemoryBuffer::Read(char *str) void EQ::MemoryBuffer::Read(char *str)
{ {
size_t len = strlen((const char*)&buffer_[read_pos_]); size_t len = strlen((const char*)&buffer_[read_pos_]);
memcpy(str, &buffer_[read_pos_], len); memcpy(str, &buffer_[read_pos_], len);
read_pos_ += len; read_pos_ += len;
} }
void EQEmu::OutBuffer::overwrite(OutBuffer::pos_type position, const char *_Str, std::streamsize _Count) void EQ::OutBuffer::overwrite(OutBuffer::pos_type position, const char *_Str, std::streamsize _Count)
{ {
auto last_pos = tellp(); auto last_pos = tellp();
seekp(position); seekp(position);
@@ -263,7 +263,7 @@ void EQEmu::OutBuffer::overwrite(OutBuffer::pos_type position, const char *_Str,
seekp(last_pos); seekp(last_pos);
} }
uchar* EQEmu::OutBuffer::detach() uchar* EQ::OutBuffer::detach()
{ {
size_t buffer_size = tellp(); size_t buffer_size = tellp();
if (buffer_size == 0) if (buffer_size == 0)
+1 -1
View File
@@ -28,7 +28,7 @@
#include <sstream> #include <sstream>
namespace EQEmu namespace EQ
{ {
class MemoryBuffer { class MemoryBuffer {
public: public:

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