Compare commits

..

2185 Commits

Author SHA1 Message Date
Xackery 0c6ec2117a Added WorldUDP Port 2022-12-30 08:28:06 -08:00
Kinglykrab 2218f46b5b [Commands] Cleanup #dbspawn2 Command. (#2493)
* [Commands] Cleanup #dbspawn2 Command.

Add some descriptive messages so that you get some feedback from the command.

* Update dbspawn2.cpp
2022-10-29 21:22:24 -04:00
Kinglykrab 53dcd14534 [Commands] Cleanup #emotesearch and #emoteview Command. (#2494)
* [Commands] Cleanup #emoteview Command.

Cleanup command messages and logic.

Add constants for Emote Events and Emote Types and replace all the old constants with the new constants.

* Update emoteview.cpp

* Cleanup #emotesearch Command.
2022-10-29 21:22:17 -04:00
Kinglykrab dcbc9a358f [Commands] Cleanup #modifynpcstat Command. (#2499)
* [Commands] Cleanup #modifynpcstat Command.

Cleanup messages and logic,

Add map and loop through it to display all stats, can add to this in the future if we add more stuff modifiable by this command.

* Delete settings.json

* Update modifynpcstat.cpp

* Update modifynpcstat.cpp

* Update questmgr.h
2022-10-29 21:22:07 -04:00
Kinglykrab b512447448 [Bots] Add give/remove saylinks to ^itemuse. (#2503)
Adds shortcut saylinks for giving items to bots or removing items from them.
2022-10-29 21:22:01 -04:00
hg 444a4f6744 [Tasks] Add pre-task update event (#2512)
This adds the player EVENT_TASK_BEFORE_UPDATE event which will allow
quests to prevent a source controlled task update by returning non-zero.
2022-10-29 20:46:08 -04:00
hg 43ec9dc815 [Tasks] Let task completion event block task rewards (#2511)
Returning non-zero from EVENT_TASK_COMPLETE will prevent task rewards
and completion emote. This is necessary for a DoN mission which scripts
a mission failure but still gives the lockout.
2022-10-29 20:46:00 -04:00
hg 9e836a9780 [Feature] Add player /inspect quest event (#2508)
Returning non-zero from EVENT_INSPECT will prevent default message
2022-10-29 19:49:48 -04:00
hg 3bc5d4b125 [Quest API] Add ResetAlternateAdvancementRank() to Perl/Lua. (#2510)
Exports Client::ResetAlternateAdvancementRank
2022-10-29 19:49:23 -04:00
hg 9f033df196 [Cleanup] Send eqstr message in AddAAPoints (#2507)
This api is only used by quests
2022-10-29 19:48:27 -04:00
hg 16ee25224d [Feature] Add special ability to block /open (#2506)
This adds the IMMUNE_OPEN (53) special ability to prevent /open on
LDON_TREASURE classes.
2022-10-29 19:48:14 -04:00
hg 56510e6383 [Quest API] Add Corpse::AddItem overloads for Lua (#2509)
Perl already has these
2022-10-29 19:48:03 -04:00
Aeadoin bf43bda1e2 [Bots] Cleanup Bot Spell Functions, reduce reliance on NPC Functions/Attributes (#2495)
* [Bots] Initial Cleanup of Functions, moved Bot Casting out of mob_ai.cpp

* Moved Bots off NPC AI_Spells Struct, and AI_Spells private attribute.

* Formatting Fixes, fixed LogAI entries, Added LogAIModerate Alias

* Add Constants.

* Added Bot DB Struct, fixed some potential casting issues

* Formatting

* Formatting
2022-10-29 16:38:15 -04:00
hg 5708164511 [Tasks] Add method to filter shared task offers (#2497) 2022-10-29 16:38:04 -04:00
Kinglykrab 7abb02655d [Rules] Add Toggle for Warrior Shielding (#2496)
This adds a toggle to disable the Warrior shielding ability. This will not stop the client-side message from sending when you do not have a target, but it will keep the ability from doing anything.
2022-10-22 14:59:52 -05:00
Akkadius cb08c02537 [Hotfix] Fix path load ordering for CLI commands 2022-10-15 22:26:12 -05:00
Chris Miles dea94ce63d [Zoning] Revert #2424 (#2492) 2022-10-15 20:48:15 -05:00
Chris Miles bd302b8394 [Logs] Have #reload logs also reload UCS logging (#2491) 2022-10-15 17:06:36 -05:00
Coreidan 221140c3c5 [Doors] Fix Neriak PoK Stone (#2486)
* [Doors] Fix Neriak PoK Stone

This augments the recent zone version heading changes where the doors for Neriak need to be corrected. The client version mask was incorrect and the locations were incorrect for the client.  Tested in my sandbox.

* [Doors] Change Misty PoK Stone Destination To Old Zone

Code fix #2482 changed Misty PoK Stone destination to the new misty zone.  This needed to be changed back to the old zone.  Zone destination was modified along with destination coordinates.

Co-authored-by: chrisjezorek <chris@jezoreksolutions.com>
2022-10-15 15:18:12 -05:00
Chris Miles 7092183103 [Crash] Stability Fixes (#2489)
* Input sanitation for #zone

* Update zone.cpp

* Update clientlist.cpp

* Test

* Test

* Remove logging, revert /who all code

* Remove log

* Update clientlist.cpp
2022-10-15 15:17:50 -05:00
Chris Miles bbbebdd346 [Crash] Pointer validation in mob iteration loops (#2490) 2022-10-15 15:10:11 -05:00
Akkadius 05723ad1e8 [Hotfix] Return weather_type_map 2022-10-14 17:57:55 -05:00
Chris Miles 4c7a625d7c [Doors] Fix Misty PoK Stone (#2482) 2022-10-13 21:03:15 -05:00
Aeadoin 1b82e6b283 [Feature] Add Hate Override for Heals (#2485)
* [Feature] Add Hate Override for Heals

* Formatting

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-10-13 21:02:59 -05:00
Kinglykrab 0240a9cc76 [Quest API] Add IsRaining() and IsSnowing() to Perl/Lua. (#2477)
* [Quest API] Add IsRaining() and IsSnowing() to Perl/Lua.

- Add quest::IsRaining() to Perl.
- Add quest::IsSnowing() to Perl.
- Add eq.is_raining() to Lua.
- Add eq.is_snowing() to Lua.

This will allow server operators to tell if a zone is currently raining, snowing, or neither.

* Remove unnecessary quest manager stuff.

* Added constants and cleaned up #weather command

* Revert "Added constants and cleaned up #weather command"

This reverts commit 2ec85304b7.

* Revert "Revert "Added constants and cleaned up #weather command""

This reverts commit 76f4e411b6.

* Delete settings.json

* Update zone.cpp
2022-10-13 20:59:55 -05:00
Aeadoin eb02525d36 [Feature] Add Support for "Show Mine Only" Filters (#2484)
* [Feature] Add Support for "Show Mine Only" Filters

* Added "Show Mine Only" support for HoTs

* remove this-> as it's implied.
2022-10-12 20:39:53 -05:00
Michael d7097e84ff [Feature] AA Cap Limit (#2423)
* [Feature] AA Cap Limit

Will force unused AA points to the cap if they exceed the cap. Will also force AA Percentage to 0%. NOTE: The variable, UnusedAAPointCap, should NOT be lowered once implemented without first checking the DB for how many Unused AAs people have.  The next time they gain any EXP, it WILL drop them to cap.  Also, PCs should be given warning prior to this patch going to Live, to ensure they have a chance to spend any AAs above the cap, else they will lose them.

* Fix formatting on strings

* Fixes

* Change ConvertArray to fmt

* Fix formating and >= 0 aa_cap per review
2022-10-12 20:14:44 -05:00
Aeadoin 3de65d46b4 [Bug Fix] Fixed Spell Logic for Bot Nukes (#2481) 2022-10-12 20:14:14 -05:00
Kinglykrab 303b35a755 [Commands] Cleanup #setlanguage Command. (#2464)
* [Commands] Cleanup #setlanguage Command.

Cleanup #setlanguage command and remove unnecessary variables.

* Tabs not spaces.

* newline
2022-10-12 20:13:25 -05:00
Aeadoin a9e218acfa [Feature] Soft Delete Bots on Character Soft Delete (#2467)
* [Feature] Soft Delete Bots on Character SoftDelete

* Moved Bot Soft Delete logic to be inline with SoftDeletes rule.

* Update from feedback

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-10-12 20:12:29 -05:00
Aeadoin 0f2da56b04 [Feature] Spell Ranks will now work with AllowSpellMemorizeFromItem Rule (#2475)
* Figured out Popup Windows

* SendPopupToClient, and response works

* Added Popup logic

* Didn't use WriteSpellInfoSection function

* Misc fixes, DB String ID 11004  now referenced as a constant

* Remove use of "this"

* Added "else" statement to return if "AllowSpellMemorizeFromItem" rule is not used
2022-10-12 19:53:21 -05:00
Kinglykrab f3f8a50d3c [Bug Fix] Allow Songs to be scribed from scrolls (#2460)
* [Bug Fix] Allow Songs to be scribed from scrolls

Songs weren't capable of being scribed from scrolls because we didn't check for `Song: ` in the name.

Converted old logic to substrings, can probably do it cleaner, but it's better than it was.

Removed extraneous `initiator->IsClient()` calls as `initiator` is **always** a client.

* Fix substr logic.
2022-10-11 21:29:54 -05:00
Chris Miles bc72641eef [Zoning] Fix zone race condition (#2479)
* Testing

* Separate auto shutdown fix

* Revert for PR

* Invalidate lock in places where zoning is cancelled
2022-10-11 20:23:27 -05:00
Chris Miles 18bfee5616 [Zone Shutdown] Fix for resetting shutdown timer (#2480) 2022-10-11 20:23:12 -05:00
Chris Miles 6c8930eacd [Logging] Fix zoning log typo (#2478) 2022-10-11 18:01:24 -04:00
Chris Miles e18d4a81c5 [Zoning] Possible zoning under world fix (#2424) 2022-10-10 22:55:49 -05:00
Alex 77c3841a49 [Process Management] Change all executables to use the default event loop run (#2471)
* Loginserver change to event loop run.

* eqlaunch, loginserver, queryserv, world
2022-10-10 22:55:39 -05:00
Michael Cook (mackal) 832bffa811 Fix Client::QuestReward overload SummonItem call (#2472)
The overload that took the packet struct wasn't calling SummonItem with
-1 charges, resulting it chargeless items if they had any
2022-10-05 16:23:03 -04:00
Aeadoin 267472fc91 [Bug Fix] Touch Of Vinitras was ignoring pet DT rule (#2469) 2022-10-03 19:35:52 -04:00
Chris Miles 44f760d177 [Crash] Fix reload crashes (#2462) 2022-09-30 07:54:05 -05:00
Michael Cook (mackal) 50fc4d68aa eqlaunch wasn't loading paths (#2461) 2022-09-29 14:23:20 -04:00
Akkadius ee167bbc64 [Hotfix] Fix lua mod load path 2022-09-29 12:06:01 -05:00
Chris Miles b20d0b84f6 [Logging] Remove loginserver unhandled error (#2458) 2022-09-28 22:20:20 -05:00
Kinglykrab 267d73ca27 [Tasks] Use zone currencies instead of hard-coded enum. (#2459) 2022-09-28 22:20:07 -05:00
Chris Miles c1626da40d [Crash] Websocket Crash fix race when fetching log categories (#2456)
* [Crash] Websocket crash fix race

* Refine check
2022-09-28 21:29:04 -05:00
Aeadoin 554b41d424 [Feature] Change Lifetap Emotes to be filterable. (#2454) 2022-09-28 21:03:26 -05:00
Chris Miles 714fb032e9 [Crash] Fix spawn race condition shown by #repop (#2455)
* Troubleshooting

* Debugging

* Debugging

* Debugging

* Debugging

* Remove debug line

* Revert back to GetRawNPCTypeName
2022-09-28 21:03:05 -05:00
Chris Miles 74dfc1ae3c [Database] Add fallback migration for logsys columns (#2457) 2022-09-28 21:02:51 -05:00
Akkadius 6b1e3d94f8 [Hotfix] Force collation on conversion script 2022-09-28 14:15:16 -05:00
Chris Miles f357361474 [Logging] Add stack trace in code paths that shouldn't occur (#2453)
* [Logging] Add stack trace in code paths that shouldn't occur

* Update zone_store.cpp

* Windows workaround
2022-09-28 13:32:39 -05:00
Chris Miles f8e7576ae7 [File Paths] Implement Path Manager (#2440)
* Push up branch for testing

* Path manager

* Tweaks

* Changes

* More path work

* Update paths for eqemu_server.pl

* More path work

* Import and export client files

* Path remove

* More path work

* Update eqemu_config.h

* Fix tests

* Tests disable temp

* Update eqemu_config.h

* Update .drone.yml

* Hook tests back up

* Update main.cpp

* Platform tests

* Fix include

* Use std::filesystem on windows

* Fix IPCMutex name on windows

* std::filesystem changes

* Update path_manager.cpp

* Explicit string cast

* Explicit string cast

* Update path_manager.cpp

* Windows fixes

* Mapped files

* Relative fixes

* Use relative paths off of cwd

* Update Debian image to Debian 11 (updates GCC)

Co-authored-by: hg <4683435+hgtw@users.noreply.github.com>
2022-09-28 04:08:59 -05:00
Chris Miles 19791195e5 [Logging] Netcode Logging Unify (#2443)
* [Logging] Unify netcode logging

* More tweaks, generator

* Exclude OP_SpecialMesg at callback level

* Consolidate packet loggers

* Log at EQStream level instead of proxy

* Fix C->S

* Server to server logging

* C-S for Loginserver

* Hook UCS for C->S

* Update eqemu_logsys.h

* World C->S logging

* Translate opcodes through patch system for client to server

* Additional logging requests

* Add detailed opcode translation logging

* vStringFormat resiliency

* Translate loginserver C->S

* Simplify out message string (reduce copies) and ignore legacy formats

* Update eqemu_logsys.cpp

* Log file format

* Handle deprecated categories
2022-09-28 03:42:09 -05:00
Chris Miles 9d766bf5dc [World CLI] Refactor world CLI to be easier to reason about (#2441) 2022-09-28 03:04:09 -05:00
Chris Miles 7ac8fe17e5 [Library] Bump httplib to 0.11.2 (#2442) 2022-09-28 03:03:23 -05:00
Kinglykrab 959a17daea [Quest API] Add GetGMStatus() to Perl/Lua. (#2448)
* [Quest API] Add GetGMStatus() to Perl/Lua.

- Add $client->GetGMStatus() to Perl.
- Add client:GetGMStatus() to Lua.
- Fix client:Admin() using Lua_Safe_Call_Bool().

This is just a more descriptive form of $client->Admin() in Perl and client:Admin() in Lua.

* Update lua_client.cpp

* Update perl_client.cpp
2022-09-28 03:03:07 -05:00
Kinglykrab 90406e0328 [Quest API] Add Merchant Events to Perl/Lua. (#2452)
- Add EVENT_ALT_CURRENCY_MERCHANT_BUY to Perl/Lua.
- Add EVENT_ALT_CURRENCY_MERCHANT_SELL to Perl/Lua.
- Add EVENT_MERCHANT_BUY to Perl/Lua.
- Add EVENT_MERCHANT_SELL to Perl/Lua.

This will allow server operators to track or do specific stuff based on if a person buys X item from Y NPC or whatever.
2022-09-28 03:02:42 -05:00
hg e883703b2f [Tasks] Schema simplification (#2449)
* Combine task_activity item and npc fields

This will make tooling easier.

While denormalizing goallists may not be ideal, it decouples tasks from
rewards which share the table and removes a redundant column in favor
of a using the delimited string which better matches live packet data.

* [Tasks] Deprecate goallists table, migrate reward goal lists, simplify logic

* Update 2022_09_25_task_concat_matchlists.sql

* Update 2022_09_25_task_concat_matchlists.sql

* Tweaks

* Fix reward column name in conversion script

* Task reward stacking

* Update task_client_state.cpp

* Implement stack counts

* Fix reward item instance memory leak

* Validate reward item instance

* Fix item reward message

* Fix findtask

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-09-28 02:31:05 -05:00
JJ d22fca7593 [Database Updates] Typo in manifest 9207 (#2451) 2022-09-27 20:21:09 -05:00
Aeadoin 2b203c0ebe [Bug Fix] Fix Swarm Pet Flurry/Rampages Messages (#2444)
* Fix Swarm Pet Flurry/Rampages Messages

* Fixed formatting
2022-09-25 13:00:43 -04:00
Chris Miles c826d3b4e9 [eqemu_server.pl] Remove non-working fetch_latest_windows_binaries() (#2445) 2022-09-25 13:00:33 -04:00
Chris Miles 78a9de124e [Command] Fix #copycharacter command crash (#2446) 2022-09-25 13:00:25 -04:00
Aeadoin 1ce272a1c3 [Feature] Allow Focus Effects to be Filtered out. (#2447) 2022-09-25 13:00:19 -04:00
Michael Cook (mackal) 678a4e30f5 Define is _WINDOWS not WINDOWS (#2439) 2022-09-21 12:43:38 -04:00
hg dbf8440a32 [Quest API] Let HasQuestSub check encounters (#2435)
This fixes an edge case where trading would not detect the npc had a
quest handler if it was registered inside a Lua encounter.
2022-09-20 13:21:48 -04:00
Aeadoin b2a73dc572 [Feature] Add Type 49545 to Spell Resistrictions (#2436) 2022-09-20 09:06:23 -04:00
Aeadoin 406ea039d7 [Bug Fix] Fix Spellinfo Command to work with SpellIDs above int16 (#2437)
* Fix Spellinfo Command SpellIDs to work above int16

* Updated to use int32_t
2022-09-20 09:06:01 -04:00
hg b4e46c1f7e [Tasks] Let task reward find free bag slots (#2431) 2022-09-18 10:45:34 -04:00
Chris Miles 5502ab8765 [Pathing] Fix pathing z-correctness for certain models (#2430)
* [Pathing] Fix pathing z-correctness for certain models

* Update npc.cpp

* Update npc.cpp

* Update npc.cpp
2022-09-11 13:05:20 -04:00
Aeadoin 7dc9b40ee1 [Feature] Update HateMod used by SPA 114 to Int32. (#2428) 2022-09-08 07:49:13 -04:00
hg 2c9fe4f2b8 [Tasks] Add rule to update multiple task elements (#2427)
On live if a task update would affect multiple elements, only the first
one gets updated. This was added as part of the changes in 7482cfc0.

Setting `UpdateOneElementPerTask` to false will restore the old behavior
that increments all active elements matching the task update criteria.
2022-09-06 12:42:45 -04:00
hg 78223b7ebf [Commands] Make #damage require a target (#2426)
Fixes annoying issue where it affected the client if no target
2022-09-05 12:12:46 -05:00
Michael Cook (mackal) 73f310d098 I guess we'll go plural (#2425) 2022-09-05 10:54:33 -04:00
Akkadius f22d90f6e2 [Hotfix] Add Bazaar portal discs to SQL 2022-09-05 04:30:49 -05:00
Chris Miles 78d4bd464e [Zone Points] Fix zone point heading data (#2415)
* [Zone Points] Fix zone point heading data

* Update 2022_09_03_fix_zone_point_heading_data.sql

* Augment #showzonepoints with saylinks

* Add more heading fixes to zone points

* Account for 999 target_heading

* Add zone safe headings
2022-09-05 04:08:34 -05:00
Chris Miles 186c2fe2ae [Doors] Fix door target zone heading data (#2414)
* [Doors] Fix door target zone heading

* Fix even more doors that were wrong to be accurate to live

* Update version.h
2022-09-05 04:06:39 -05:00
Chris Miles 5250b819fa [Character Starting Points] Fix headings data (#2413)
* [Character Starting Points] Fix headings

* Update version.h

Co-authored-by: Michael Cook (mackal) <277429+mackal@users.noreply.github.com>
2022-09-05 04:02:47 -05:00
Akkadius da4bcbf736 [Hotfix] Faction associations file naming / lock consistency 2022-09-05 00:10:21 -05:00
Michael Cook (mackal) d8134df679 Clang was complaining about these (#2421)
Checking if first char is null should be faster than strlen
2022-09-03 17:36:45 -04:00
hg 89382d5e4a [Tasks] Only allow shared task completion once (#2422)
This prevents re-triggering completion when a shared task contains
optional elements
2022-09-03 16:25:18 -05:00
hg aa3c72c1de [Tasks] Make Task Selector Cooldown Optional (#2420)
Some live npcs ignore the request cooldown timer (tutorialb)

A separate function had to be used for perl because the apis use an
array instead of array reference which won't allow a bool overload

This also replaces the fixed array and count args with a vector
2022-09-03 13:20:03 -04:00
Michael Cook (mackal) 5e9a9e8afe [Bug Fix] Shared Memory Faction Association Typo (#2419) 2022-09-03 12:08:40 -04:00
Michael Cook (mackal) ba53b4144e [Cleanup] Rework Lua QuestReward to not use try/catch blocks (#2417)
Quest system will catch any errors and result it in being reported where
these weren't
2022-09-03 12:07:46 -04:00
Kinglykrab 5134a0e43b [NPC Scaling] Recalculate Skills and Reload Spells on Level Change (#2416)
* [NPC Scaling] Recalculate Skills and Reload Spells on Level Change

- Add $npc->ReloadSpells() to Perl.
- Add npc:ReloadSpells() to Lua.

Previously, you would you have to manually call RecalculateSkills() after you scale the NPC, now the call is built in to the scaling.

Spells did not reload when NPCs were scaled, causing them to continue to use their low/high level spells depending upon which way their level had been scaled, this has been adding to the scaling method. This will make NPCs properly use their level-based spells.

RecalculateSkills() and ReloadSpells() can still be used manually if people scale using something other than the source scaling method. Having this functionality built in to the scaling itself just makes more sense to me. Open to any  ideas or thoughts.

* Reload spell effects, too.
2022-09-03 12:06:33 -04:00
Michael Cook (mackal) 402d742def Unsure how this seding messed up (#2418) 2022-09-03 11:53:43 -04:00
Michael Cook (mackal) 2b4e555eae [Feature] Faction Association (#2408)
* Add faction logging category

Probably should use this for more things

* Add FactionAssociation struct

This is simply just a struct that contains an array of faction ids and
multiplier. This can hold a maximum of 10 entries (Seru hit is 8, so 2
extra) this can be raised if need be.

* Add database changes and other data point changes

This is all the database changes and loading changes

Included is an optional SQL that will be used as a starting point, there
is likely errors or typos, but we will fix those as they are discovered.

* Add Client::RewardFaction function

This just takes the faction ID and the magnitude of the primary faction
hit and calculates the rest.

The minimum change will be either 1 or -1. We stop processing after we
see an ID of 0 and assume there will be no later entries.

The primary faction ID will always receive a hit even if there is no
faction association entries

* Add users of RewardFaction to NPC death, tasks, and QuestRewards

This will only use the new system if the magnitude is set, otherwise we
will just use the old system still

* Add quest system calls and lua QuestReward support

* Add #factionassociation command

This just calls RewardFaction, mostly useful for debugging
2022-09-03 10:57:55 -04:00
hg efe1879115 [Tasks] Change zone task data container (#2410)
This allows removal of the task id limit (MAXTASKS)

There's some suspect places task data isn't verified but left unchanged

If memory use becomes too high once more live data is added tasks can be
stored in shared memory instead
2022-09-03 03:33:49 -05:00
Chris Miles ec857cefae [Zoning] Fix zoning logic issues (#2412)
* [Zoning] Fix various zoning issues, flag logic, #zone etc

* Enforce character restrictions later in the connection process so we don't end up in a loop race condition in world
2022-09-03 00:57:57 -05:00
hg 034667f03b [Bug Fix] Avoid erase in discord queue range loop (#2411)
Erasing from the map inside the range loop invalidated the iterator used
internally by the loop. This caused ucs access violations under msvc
debug builds when a discord logging category was enabled.
2022-09-02 21:49:14 -05:00
hg d12145c449 [Bug Fix] Fix memory leak in ucs (#2409) 2022-09-02 21:48:33 -05:00
hg ce12481021 [Tasks] Tweak task update messages (#2406)
Excludes GiveCash since it uses copper amount for increments
2022-09-01 23:10:05 -05:00
hg 7cf96ca2d8 [Tasks] Remove delivered task items from trades (#2405) 2022-09-01 23:09:13 -05:00
hg e011864ed5 [Zone] Add missing safe_heading assignment (#2407)
Regression from 89fdd842e1
2022-09-01 23:04:35 -05:00
hg 7482cfc066 [Tasks] Replace task goals with explicit fields (#2402)
The task goal system made implementing tasks a little confusing since
the goal could be ambiguous depending on type. This also didn't support
filtering on multiple goals (e.g. looting items from matching npc names
inside an area). Deliver types could specify an npc id in `delivertonpc`
but the database may have multiple npcs with the same name or a task
might want to match partial npc names.

This replaces goalids with explicit fields for npcs, items, proximity
areas, and touch switch ids. These changes make managing task data
easier without needing to update multiple tables and allows filtering
task updates by multiple criteria. To mitigate any performance impact
from merging task proximities, only clients with explore tasks in the
current zone are checked during client movement updates.

Items and npcs still support goallists but it would be possible to
denormalize entries into delimited strings to combine with the match
lists. This would also decouple task goals from reward lists.

The client task update functions were refactored to run through a single
filtering function which significantly reduces duplicated code from the
legacy task system. This will also make it easier to later implement
any unhandled types.

Since the new fields will handle filtering single entries and lists
based on having values set, `goalmethod` now only distinguishes quest
controlled from source controlled.

This is a breaking api change, `taskexploredarea` has been removed
since explore ids no longer exist.
2022-09-01 19:18:21 -05:00
Michael Cook (mackal) 8851b410d2 [Bug Fix] Resolve logic error in Raid::QueueClients (#2404)
We're checking if they're groupless here, so this should be correct now
2022-09-01 18:48:47 -05:00
Chris Miles 89fdd842e1 [Code Cleanup] Zone Data Loading Refactor (#2388)
* [Code Cleanup] Zone data loading refactor

* Update client_packet.cpp

* strcpy adjustments

* Ensure safe points get reloaded properly

* Simplify GetPEQZone and getZoneShutDownDelay

* Bring in zone_store where needed

* Update client.cpp

* Signature

* Signature

* Convert helpers to using pointers

* PR comment

* Update worlddb.cpp

* Fix loading for instances

* Fix zoning with fallback as well

* Another place for instance fallback
2022-09-01 18:48:28 -05:00
Michael Cook (mackal) c613dbb2f7 Fix issues with Client::SetHideMe (#2403)
Arg was shadowing the member variable and we weren't updating the member
variable
2022-09-01 11:48:23 -04:00
Michael Cook (mackal) 6f7fa98996 [Repositories] Add more precise types to repository generator (#2391)
* Make utils/scripts/generators/repository-generator.pl aware of more
datatypes

This adds support for unsigned and more integer types. It also avoids
using parsing functions that require casting (still needed in some
cases)

Having the data types in the Repository structs better map to the types
in the database will allow us to avoid casting when we pull data out of
them. And as a benefit, assume something is wrong if we do :)

Hopefully clean up some warnings due to casting too.

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-08-31 00:04:27 -05:00
Kinglykrab fcf01f6d87 [Commands] Add #findrecipe and #viewrecipe Commands. (#2401)
* [Commands] Add #findrecipe and #viewrecipe Commands.

- Add #findrecipe [Search Critieria] command.
- Add #viewrecipe [Recipe ID] command.
- #findrecipe will show #viewrecipe saylinks if the user has access to that command.
- #viewrecipe will show #summonitem saylinks if the user has access to that command.

* Cleanup

* Lexicon change.

* Remove unnecessary .c_str() and
2022-08-30 23:32:17 -05:00
Michael 3228d6edf6 [Bug] Loot Drop Randomization adjustment (#2368)
* [Bug] Loot Drop Randomization adjustment

Loot Table currently favors the first item in the loot drop. This should help remove that condition.

Code by Ailia.

* snake_case

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-08-30 23:31:07 -05:00
Aeadoin 149fa54cfa [Feature] Implement Heroic Strikethrough to NPCs (#2395)
* [Feature] Implement Heroic Strikethrough to NPCs

* Removed virtual from inline int32 GetHeroicStrikethrough()

* Fix formatting

* Removed unnecessary function
2022-08-30 23:29:41 -05:00
Michael Cook (mackal) edda5ef811 [Utility] Add std::string_view overloads for std::from_chars (#2392)
* Add std::string_view overloads for std::from_chars

std::from_chars floating point support is still pour, so we provide some
fall backs. These fall backs currently lack error handling.

(since GCC 11 and MSVC 2019 16.4 FP support is added, clang with libc++
still doesn't support FP)

GCC's floating point support is still rather pour (performance) and
probably shouldn't be used, but we have support to if people want to
now.

Probably need more test cases ...

* Fix issue with std::chars_format define lacking

My test case for lacking FP support was clang with libc++ which defined
this enum anyways.
2022-08-30 23:13:59 -05:00
Chris Miles 786a7e2169 [Zone] Fix and simplify zone shutdown logic (#2390)
* Fix and simplify zone shutdown logic

* Add ResetShutdownTimer
2022-08-30 23:08:24 -05:00
Michael Cook (mackal) 59584a8d94 Use macro to generate correct format specifier (#2400)
Windows and Linux use different data models on 64 bit systems so "%lld"
isn't the same on them.
2022-08-28 14:38:26 -04:00
hg 94ac04b360 [Bug Fix] Fix loading world shared task state (#2398)
The default for this field is -1 not 0, so on world restarts this was
marking all elements completed
2022-08-28 13:16:35 -04:00
Kinglykrab 3e703769a4 [Quest API] Allow CreateInstance to be used without a Client initiator. (#2399)
* [Quest API] Allow CreateInstance to be used without a Client initiator.

Currently, you have to create the instance with a client initiator, whether that's in an NPC's EVENT_SAY /EVENT_ITEM or in a player script.

This will allow you to create instances without needing a client, but if there is one and there are errors, the messages will be sent to the client.

* Update questmgr.h

* Instance version.
2022-08-28 13:10:19 -04:00
Kinglykrab 57b3255fad [Quest API] Add Recipe Methods (#2393)
- Add $client->GetRecipeMadeCount(recipe_id) to Perl.
- Add $client->HasRecipeLearned(recipe_id) to Perl.
- Add quest::getrecipemadecount(recipe_id) to Perl.
- Add quest::getrecipename(recipe_id) to Perl.
- Add quest::hasrecipelearned(recipe_id) to Perl.
- Add client:GetRecipeMadeCount(recipe_id) to Lua.
- Add client:HasRecipeLearned(recipe_id) to Lua.
- Add eq.get_recipe_made_count(recipe_id) to Lua.
- Add eq.get_recipe_name(recipe_id) to Lua.
- Add eq.has_recipe_learned(recipe_id) to Lua.
2022-08-23 13:23:33 -05:00
Michael Cook (mackal) 10fd26ebbf [Manifest] Its not_empty not notempty (#2394) 2022-08-22 22:26:24 -05:00
Kinglykrab b9d8a13c76 [Bug Fix] Fix Silent Saylinks Sending Message to Others. (#2389)
* [Bug Fix] Fix Silent Saylinks Sending Message to Others.
Silent saylinks wouldn't send to sender, but to everyone else, so they could see what your saylinks were.

Added an optional `is_silent` bool to ChannelMessageReceived to account for this where necessary.

* Nullptr fix.
2022-08-21 23:26:25 -04:00
Chris Miles c0d4dd4176 [Expansions] Zone expansion consistency changes (#2380)
* [Expansions] Zone expansion consistency changes

* Add expansion check exclusions

* Update 2022_08_19_zone_expansion_consistency.sql
2022-08-21 20:36:21 -05:00
Kinglykrab 6637e2c59f [Feature] Add Guild Chat to Console. (#2387)
Adds guild chat to console.
2022-08-21 20:55:26 -04:00
hg e65b61a95f [Tasks] Implement task activity prerequisites (#2374)
Some live tasks make new elements available without requiring all
currently active ones to be completed first.

This adds the `req_activity_id` field to task activities which will mark
an element active if its required activity id is completed. If a valid
value is set then it's used instead of checking the current step.

The `step` field may still be set on rows with a valid `req_activity_id`
to specify its logical step and prevent later steps from becoming active
until completed. It's only ignored when deciding if the current element
is active.

The legacy task logic for unlocking activities was completely refactored
for this. A common method has been added so both zone and world can make
use of it to determine which elements are currently active. The previous
step system should remain unchanged.

The world logic for locking shared tasks when an element became active
did not account for "sequential" mode (all steps 0), unordered steps, or
gaps in step numbers. This also resolves that issue.
2022-08-21 19:55:19 -05:00
Kinglykrab c954685239 [Bug Fix] Fix Duplicate Silent Saylink Messages (#2386)
Clicking silent saylinks was sending the message twice if you had an NPC targeted due to duplicate code within ChannelMessageReceived.
2022-08-21 20:54:40 -04:00
Chris Miles 893d53425a [Repository] Modernize character recipe list (#2385) 2022-08-21 19:06:57 -05:00
Chris Miles 295ec0e1b4 [Tasks] Data validation for zone_version (#2381)
* [Tasks] Data validation for zone_version

* Update task_manager.cpp

* Update task_manager.cpp

* Update task_manager.cpp

* Update task_manager.cpp
2022-08-21 14:45:06 -05:00
Aeadoin 1d8dc4c8a8 [Feature] Change Mana Costs to use Signed Int (#2384) 2022-08-21 15:38:21 -04:00
Kinglykrab b108828502 [Bug Fix] Fix Strings::Money Missing Conditions. (#2383)
Noudess pointed out we were missing CSP, CP, and SP options in these conditions.
2022-08-21 15:00:02 -04:00
Michael Cook (mackal) 3f9df40c3c Update CURRENT_BINARY_DATABASE_VERSION (#2382)
PR #2376 didn't update it
2022-08-20 17:20:37 -04:00
Kinglykrab 3e8d34825a [Quest API] Add Goto Player Teleport Methods. (#2379)
* [Quest API] Add Player Teleport Methods.

These methods will allow server operators to teleport players directly to other players via the quest API using the #goto command's functionality.
- Add $client->TeleportToPlayerByCharID(character_id) to Perl.
- Add $client->TeleportToPlayerByName(player_name) to Perl.
- Add $client->TeleportGroupToPlayerByCharID(character_id) to Perl.
- Add $client->TeleportGroupToPlayerByName(player_name) to Perl.
- Add $client->TeleportRaidToPlayerByCharID(character_id) to Perl.
- Add $client->TeleportRaidToPlayerByName(player_name) to Perl.
- Add client:TeleportToPlayerByCharID(character_id) to Lua.
- Add client:TeleportToPlayerByName(player_name) to Lua.
- Add client:TeleportGroupToPlayerByCharID(character_id) to Lua.
- Add client:TeleportGroupToPlayerByName(player_name) to Lua.
- Add client:TeleportRaidToPlayerByCharID(character_id) to Lua.
- Add client:TeleportRaidToPlayerByName(player_name) to Lua.

* Simplify by using repositories

* Simplify

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-08-20 10:23:41 -04:00
Kinglykrab 59691f39d7 [Commands] Command Status Reload and Helper Method (#2377)
* [Commands] Command Status Reloading

Currently command status changes require a server restart to take effect, this will allow them to be changed and use `#reload commands` without needing a restart.

Added a helper method called GetCommandStatus() for future reference when sending command saylinks to people and making sure if they're high enough status for the command before sending the link.

* Update client.cpp

* Update command.h

* Saylink cleanup.

* Remove unnecessary packet sending.

* Revert "Remove unnecessary packet sending."

This reverts commit e7e77b83af.
2022-08-20 10:23:26 -04:00
Kinglykrab 8e3ad529dc [Feature] Instance Version Specific Experience Modifiers (#2376)
* [Feature] Add Instance Version Support to Experience Modifiers.

Allows Operators to set experience modifiers to be instance version specific so that you can have different versions of the same zone have different modifiers. If there is not one found, it defaults to zone_id 0 for global and instance_veresion -1 for global.

* Update zonedb.cpp

* Typo.
2022-08-20 03:16:58 -05:00
Chris Miles 607871a7ac [Loot] Add #lootsim (Loot Simulator) command (#2375)
* [Loot] Add #lootsim (Loot Simulator) command

* Validation

* Add global loot
2022-08-20 03:16:09 -05:00
Kinglykrab 6232a64cdb [Bug Fix] Fix Bot Group Loading (#2366)
* [Bug Fix] Fix Bot Group Loading

There were some weird cases where this code would falsely say a bot group did not exist and this would disallow summoning this botgroup as well as deleting it.

* Typo.
2022-08-20 03:15:58 -05:00
Michael Cook (mackal) 25c6b055a4 Fix issue with trap auras casting on caster (#2378)
Unsure if something changed or I just failed to test correctly
2022-08-18 12:34:37 -04:00
Kinglykrab 216b6ef426 [Saylinks] Convert all GM Command Saylinks to Silent Saylinks. (#2373)
* [Saylinks] Convert all GM Command Saylinks to Silent Saylinks.
- This cleans up all non-silent GM Command Saylinks that we had before due to the way they worked before. All saylinks like this should be silent now.
- Add source short hand capability for say links with same link as text.

* Defaults to r anyway.

* Spacing.
2022-08-13 20:40:22 -04:00
Chris Miles 597b041d92 [Saylinks] Add Silent helper (#2372)
* [Saylinks] Add Silent helper

* Swap out usage in door manipulation for silent saylink helper
2022-08-13 19:44:53 -04:00
Michael f6889d20e9 [Bug] UINT32 EmoteID (#2369)
emoteid packet structure is UINT32 but a number of references are in UINT16.
2022-08-13 18:41:14 -05:00
Chris Miles 79285b1002 [Repositories] Add GetMaxId, Count (#2371)
* [Repositories] Add GetMaxId, Count

* Update cmake with repositories, regenerate extended repos

* Remove license from files

* Simplify receivers

* Receiver simplify remaining

* Simplify receivers final

* Pass params by const reference

* Modernize grid tables

* Remove guild members since it doesn't conform as a generatable table

* PR comment
2022-08-13 18:40:56 -05:00
Chris Miles b79e1947f1 [Doors] Improvements to door manipulation (#2370) 2022-08-13 18:16:55 -05:00
Kinglykrab aa2b7f8947 [Quest API] Add GetSkillDmgAmt() to Perl. (#2365)
- Add $mob->GetSkillDmgAmt(skill_id) to Perl.
- This already exists in Lua, but not Perl.
2022-08-10 13:39:51 -04:00
Aeadoin 1d5a3a82a8 [Feature] Change GetSkillDmgAmt to int32 (#2364) 2022-08-09 21:24:15 -04:00
Kinglykrab 8ee7759dec [Rules] Add Rule to Enable Tells with #hideme (#2358)
With the recent changes to #hideme as of #2328, tells are disabled to hidden GMs, meaning a GM must show themselves in order to receive tells.
2022-08-04 16:41:36 -04:00
Chris Miles 5ec18709a6 [Hotfix] Remove expansion field from account for those who have it (#2357) 2022-08-01 15:07:36 -05:00
hg 7c27c4350d [Tasks] Add task accept packet validation (#2354)
This makes it so clients can only accept tasks that have been offered
2022-07-31 17:54:42 -05:00
hg 6068085de4 [Quest API] Fix lua task selector count when over max (#2353)
This was leaving the task count at 0 if called with more than the max
number of tasks (40)
2022-07-31 17:52:18 -05:00
Kinglykrab e1f515ba4b [Typo] Remove CanTradeFVNoDropItem() Duplicate (#2352) 2022-07-31 13:57:48 -05:00
hg c7a3e88b81 [Tasks] Make #task reloadall not quit shared tasks (#2351)
This was causing #task reloadall to desync state for shared tasks.
Characters were removed from the shared task but remained in the
character_tasks table. This CancelTask is cosmetic only to reload
the client window.
2022-07-31 13:57:33 -05:00
Kinglykrab b0da836f5a [Quest API] Add GetBotItem() and GetBotItemIDBySlot() to Perl/Lua. (#2350)
- Add $bot->GetBotItem() to Perl.
- Add $bot->GetBotItemIDBySlot() to Perl.
- Add bot:GetBotItem() to Lua.
- Add bot:GetBotItemIDBySlot() to Lua.
2022-07-31 13:45:17 -05:00
Michael Cook (mackal) a24a6f1160 [Code Cleanup] Resolve some warnings in loginserver/world_server.cpp (#2347) 2022-07-31 13:25:09 -05:00
hg be1e558b3b [Shared Tasks] Fix shared task message target (#2349)
Small regression from refactoring
2022-07-31 13:24:36 -05:00
hg c4a99aabd0 [Shared Tasks] Avoid erasing shared tasks while iterating (#2348)
This wasn't safe since the erase would invalidate iterators used
internally by the range loops.

Shared tasks with no members are now also cleaned up

Make GetMembers return reference instead of copy (this is used a lot)

Add rule for shared task terminate time for easier debugging
2022-07-31 13:24:21 -05:00
Akkadius 0dfc6eaa15 [Hotfix] Fix potential race for crash dumps (Linux) 2022-07-31 04:10:09 -05:00
Akkadius 3cccb183a2 [Hotfix] SQL Update 2022-07-31 03:00:24 -05:00
Michael Cook (mackal) c6cfcc3ea9 [Bug Fix] Limit merchant temp item list to zone and instance (#2346)
This prevents issues with a merchant being in more than one zone as well
as guild hall merchants sharing a list of temp items
2022-07-30 22:22:09 -05:00
hg 53b599518a [Dynamic Zones] Implement dz templates (#2345)
This allows shared tasks to create dz instances automatically through
the `dz_template_id` field instead of using quest scripts. Quest apis
were also added to create expeditions from template ids.
2022-07-30 21:25:43 -05:00
hg 5e7e255d72 [Tasks] Use dz switch id for task touch events (#2344)
This changes task touch elements to use the dz_switch_id as the goal id
instead of checking if a player zoned. It will remove the need to script
door clicks or modify task element zone field since task packet data can
just be imported.
2022-07-30 21:14:22 -05:00
hg 676467cbdc [Dynamic Zones] Implement dz switch id (#2343)
This adds the `dz_switch_id` field to doors and dynamic_zones. It will
allow for compasses to be automatically added to dz entrances and will
support moving clients to the dz on use without needing to script it.
These can be imported for switches/doors from live packet dumps.

Also removes compass packet encoders (same struct in all clients)
2022-07-30 21:00:11 -05:00
hg 1351f147f4 [Shared Tasks] Enforce task reqs on player removal (#2342)
This verifies a shared task's minimum players requirement is still met
when a member is removed and schedules it for termination if not
2022-07-30 20:49:57 -05:00
hg d243cbf8a3 [Shared Tasks] Cleanup shared task request and remove (#2341)
Functionally nothing should change in this patch. This refactors a lot
of formatting and code duplication in requests and member removals.

The long SharedTaskMessage namespace and its constants were contributing
to a lot of formatting that was difficult to read. These were shortened
since they're not all shared task specific anyway (though they should
probably just be moved to string_ids.h with other eqstrs now)

Shared task requests were refactored a little to remove an unnecessary
function that filled potential members. The separate functions used for
/taskquit and /taskremove were also combined into a single function to
remove a member while preserving live message differences.
2022-07-30 20:36:04 -05:00
hg 8a962e09f6 [Shared Tasks] Implement task timer groups (#2340)
This adds task replay and request timer groups (an arbitrary id) which
allows for different tasks to share lockouts
2022-07-30 20:18:19 -05:00
hg f64d072af7 [Shared Tasks] Implement Activity Locking (#2339)
* Add shared task element locking

This adds the `lock_activity_id` field to the tasks table which will
automatically lock a shared task when that element becomes active.

A method was added to world analogous to zone's UnlockActivities to
determine when an activity is active with respect to task steps.

Also adds quest apis to manually lock or unlock a client's shared task

* Add comment
2022-07-30 19:57:57 -05:00
Michael ea878ed27f [Feature] GM State Change Persistance (#2328)
* [Feature] GM State Change Persistance

- Flymode and Invulnerable will now persist over zoning.

- Appended GMSpeed, Flymode and Invulnerable to the hideme message GMs see when they first login.

- Added #godmode [on/off] command to turn on or off hideme, flymode, gmspeed and invulnerable all in one shot.

- /becomenpc will now disable tells to the target player. It will also automatically disable GM States that interfere with its functionality.

- GM Command /toggle will not properly turn tells on/off

- GMs will now be notified if they are ignoring tells when they first zone-in, provided their GM flag is up.

- Added TellsOff variable to the output to #showstats

* [Bug] Fix tells when gmhideme is turned off.

* [Cleanup] Cleanup function and rename for consistancy.

Remove un-needed this->

* Tweaks

* Tweaks

* Update db_update_manifest.txt

* Move string building logic to a vector and use strings join

* Update client_packet.cpp

* Update 2022_07_28_gm_state_changes.sql

* PR comment tweaks

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-07-30 19:29:24 -05:00
hg 793d4bc3a4 [Quest API] Use Floating Point for CameraEffect Intensity (#2337)
This was implemented in a very odd way. The intensity is just a float.

This is a breaking api change but low-impact (intensity will be
different).

To convert old values to new values with same intensity:

  0: 0.03125
  1: 0.05625
  2: 0.1
  3: 0.175
  4: 0.3
  5: 0.5
  6: 0.9
  7: 1.6
  8: 2.8
  9: 4.8
 10: 8.0
2022-07-30 19:18:20 -05:00
hg 4592c15dd6 [Tasks] Send Client Message for All Solo Task Updates (#2336)
Live sends the task updated message for every solo quest and task
increment (not just goal completed).

Also changed color to what live uses now. There are some other color
changes with shared task messages but they correspond with colors
changed in client generated messages but probably not worth chasing
down and causing inconsistency.
2022-07-30 19:17:24 -05:00
hg 4cf6db79aa [Saylinks] Inject Saylinks in MessageClose API (#2335) 2022-07-30 19:16:25 -05:00
Kinglykrab 576e7b0f91 [Quest API] Add IsRareSpawn() to Perl/Lua. (#2338)
- Add $npc->IsRareSpawn() to Perl.
- Add npc:IsRareSpawn() to Lua.
2022-07-30 19:40:51 -04:00
Paul Coene 113846c48c [Roambox] Improve Path Finding (#2324) 2022-07-30 14:52:28 -05:00
Michael Cook (mackal) dd71420a0e [Feature] NPCs with bows and arrows do ranged attacks (#2322)
* NPCs with bows and arrows do ranged attacks

Who knew!!

* PR comments

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-07-30 14:28:06 -05:00
Michael 0f9427098d [Rules] Add adjustment for zone forage. (#2330)
* [Rules] Add adjustment for zone forage.

- Added rule to allow the adjustment of zone foraging %

* Cleanup if formating
2022-07-30 13:39:12 -05:00
Aeadoin 25705878d8 [Feature] Change mana_used to int32 (#2321)
* Changed mana_used to use int32,
to match int32 mana_cost
This will allow higher mana costs to function

* Corrected DoHPToManaCovert to Int32

* Removed unused uint16 GetMana function call from Server/zone/questmgr.h

* Change GetSkillDmgAmt from Int16 to Int32 (SkillDamageAmount2 which uses function is Int32)

* Delete mob.cpp

* Revert "Delete mob.cpp"

This reverts commit 3db8bf04d1.

* Revert "Change GetSkillDmgAmt from Int16 to Int32 (SkillDamageAmount2 which uses function is Int32)"

This reverts commit cf5dbc9ce8.

Co-authored-by: dmcintosh-BCT <dan@blackcreektechnologies.com>
2022-07-30 13:36:48 -05:00
hg 6e2d11a283 [Tasks] Support Raw NPC Names in Task Goal List (#2333) 2022-07-30 13:33:53 -05:00
hg 2ccf692167 [Tasks] Use CashReward for Tasks (#2332)
Also removes the sound which does not occur
2022-07-30 13:33:05 -05:00
Trent 5e50c4181f [Rules] Add Keep Level on Death (#2319)
* add keep level on death rule

* add keep level on death rule

* add sql rule

* add rule db update

* remove unnecessary manifest entry

* remove unnecessary sql migration

* fix casing
2022-07-30 13:32:21 -05:00
hg eaeb583048 [Tasks] Add Task Reward Points Field (#2317)
* Add task reward points field

This replaces the separate DoN crystal reward fields with points and
point_type fields. This will make it easier to import data from
packet/client captures and possibly better support any future clients
or tasks that don't reward through the newer reward window.

* Fix manifest column check
2022-07-30 13:31:34 -05:00
Quintinon c68ff9bc5a [Rules] Update logic checks everywhere for FVNoDropFlag. (#2179)
* Update logic checks everywhere for FVNoDropFlag.

FVNoDropFlag == 0 is disabled
FVNoDropFlag == 1 is enabled for everyone
FVNoDropFlag == 2 is enabled for Admin() >= Character:MinStatusForNoDropExemptions

* Adding extra parenthesis to reduce ambiquity of order of operations for FVNoDropFlag checks

* Move FVNoDropFlag checks into a helper function in emu_constants.cpp and make an enum for the possible values.
Added console warning if setting is outside of allowed values.

* Move to client scoped helper method

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-07-30 13:16:47 -05:00
Kinglykrab 3bda8251b9 [Rules] Add Rule to allow Assassinate on non-Humanoid body types. (#2331) 2022-07-29 19:23:20 -04:00
Kinglykrab cadd29e5d1 [Rules] Add Rule to allow Headshots on non-Humanoid body types. (#2329)
* [Rules] Add Rule to allow Headshots on non-Humanoid body types.

* Formatting.
2022-07-29 18:38:30 -04:00
Akkadius 4002d6a083 [Hotfix] Shared Memory Protection Fixes 2022-07-27 17:37:20 -05:00
Michael Cook (mackal) 5331f4d841 [CPP] Update C++ standard to C++17 (#2308)
* Update C++ standard to C++17

* Nuke EQ::Any in favor of std::any

* Remove std::iterator due to deprecation

* Replace result_of with invoke_result due to deprecation
2022-07-27 09:00:09 -05:00
Quintinon f4f5728195 [Memory Leak] This mem leak was missed due to merge issues in the previous PRs. (#2314)
https://github.com/EQEmu/Server/commit/b5c4357de2e14a1c97abbab26c60eee8ff308331#r77584958
2022-07-27 08:54:40 -05:00
hg ed64c82a2f [Quest API] Allow scripts to prevent door click (#2327)
Returning non-zero from EVENT_CLICK_DOOR will prevent the default
handler.

This should have been implemented when expeditions were put in to
allow scripts to prevent zoning out of vxed and tipt without flags.
Some upcoming changes may need this to allow scripts to prevent
automatic dz entry.
2022-07-27 08:53:38 -05:00
hg c847e3da86 [Netcode] Adjust first packet for compress flag (#2326)
When a packet was over max_raw_size and zlib failed to compress the
first packet chunk then the final output would be 513 bytes which
exceeded m_max_packet_size of 512.

This occured because the first packet chunk used sublen without
adjusting for the new_length + 1 compression flag added in Compress().
When the packet failed to compress then it was already at its max.
After the first packet, chunk sizes are calculated using max_raw_size
which already accounted for the compress flag. (From #979)

This should fix #2325
2022-07-27 08:52:25 -05:00
Chris Miles 7d2f88325a [Client] Fix IsMoving for Client (#2318)
* [Client] Fix IsMoving for client

* Consolidate member vars

* Update client_process.cpp
2022-07-27 08:51:51 -05:00
hg 1089f8139b [Saylinks] Refactor saylink injection (#2315)
If a message was longer than 50 characters with "00000" somewhere in the
message (such as messages with hex numbers) then the saylink injection
method was sending a blank message to the chat window.

This refactors the saylink injection method using a crude state machine
to build the output. It should function the same:

  - Inner-most brackets generate saylinks when nested
  - Saylinks are not generated in brackets that already have a saylink
  - Existing saylinks are preserved
  - Existing saylinks that contain text with brackets do not attempt to
    generate saylinks
  - Saylinks are not generated if brackets contains leading or trailing
    spaces (e.g. [ spaces ])
2022-07-27 08:50:00 -05:00
Chris Miles f07e3f4d3b [CI] Hook tests back up (#2316)
* [CI] Hook tests back up

* Pull in config file

* Delete .travis.yml
2022-07-27 08:49:04 -05:00
Chris Miles 9f8f838265 [Content Filter] Fix Runtime Filtering When Set to -1 (All) (#2313) 2022-07-27 08:48:50 -05:00
Paul Coene 5af1620e50 Fix bestz to work on client or target. (#2323) 2022-07-23 13:03:20 -04:00
hg 20c639c872 [Tasks] Reward clients on shared task completion sync (#2306)
If a member is offline (or possibly during a race while zoning?) when
the shared task is completed they will not receive the reward. On live
the character receives their reward (with an updated replay timer) if
they enter back into game while the shared task is still active. They
keep the original replay timer if the shared task is no longer active
and do not receive a reward.

This makes it so clients are issued rewards (and a task completed
event is dispatch) if the client's task state was out of sync with a
completed shared task. To prevent characters being rewarded more than
once in case of bad sync checks, a 'was_rewarded' field has been added
to the character_tasks table and updated when rewards are assigned.

This fixes a couple bugs so the character_activities table is correctly
updated with shared task states to better detect when out of sync:

- The character_activities table is now flagged to update after syncing
  shared task states. This table was not being updated if a client was
  offline or inaccessible for a shared task element update.

- The character_activities table is now updated when a task element is
  completed. This was only being updated for activity increments and on
  completing the entire task. SaveClientState is now called at the end
  of ClientTaskState::IncrementDoneCount to cover all cases.

This also has a cosmetic change to show replay timers before rewards
like live, though this will not work for shared tasks until refactoring
world code
2022-07-16 15:26:48 -05:00
Akkadius 635b7b5e86 [Hotfix] fix manifest 2022-07-16 14:58:11 -05:00
Michael Cook (mackal) 139845f971 [Feature] Implement OP_CashReward (#2307)
* Implement OP_CashReward

Tit opcode needs verifying still, I think it's correct.

Added Perl and lua client CashReward functions

* Forgot AddMoneyToPP call somehow

* Switch QuestManager::givecash to CashReward packet

* Fix extra comma
2022-07-14 21:17:44 -05:00
KimLS ce74ac9913 Merge branch 'master' of https://github.com/EQEmu/Server 2022-07-14 18:56:08 -07:00
KimLS 1db2dffa57 Fix windows build for strings.cpp 2022-07-14 18:56:00 -07:00
Chris Miles 59f8d54491 [Expansions] Expansion Deprecation Revert (#2312)
* [Expansions] Expansion Deprecation Revert

* Add blank SQL for deprecate

* Update version.h

* Adjustments
2022-07-14 20:48:26 -05:00
Michael Cook (mackal) 9488ee1e8c [Bug Fix] Remove StringUtilTest::EscapeStringMemoryTest (#2310)
This was testing the old std::string EscapeString(const char *src,
size_t sz) which was removed since it's not used anywhere else.
2022-07-14 19:47:58 -05:00
Chris Miles ffe4d528e7 [Tasks] Zone Version Matching (#2303) 2022-07-14 02:57:23 -05:00
Chris Miles ddb5794462 [Zone] Deprecate Zone expansion Field (#2297) 2022-07-14 02:49:35 -05:00
Chris Miles c8b3ca53fe [World] World Bootup Consolidation (#2294) 2022-07-14 02:39:01 -05:00
Akkadius fb2df0e570 [Hotfix] Fix merge issue 2022-07-14 02:32:35 -05:00
Paul Coene 6b5e4afd2d [DoT Messages] Add DoT messages for mob->PC casts, fixed others to use correct str. (#2289) 2022-07-14 02:23:13 -05:00
neckkola 3b409def2c [Login] Added OP_ExpansionPacketData for RoF2 and update payload for Titanium (#2186)
* Fix for GENERIC_9_STRINGS

* Update .gitignore

* OP_ExpansionPacketData for Titanium and RoF2

* Update for login_opcodes_sod.conf

* Add OP_LoginExpansionPacketData for Titanium and RoF2

* Few expansion fixes

* Update client.h

* Update client.h

* l

* Updates based on PR feedback.
Moved configuration to login.json
Set Titanium limits to constants

* Update login.json

Added the two configurations to login.json
display_expansions - true/false to display on the server select screen
max_expansions - the bitmask of expansions enabled (http://spire.akkadius.com/calculators#expansions-bitmask-calculator)

* Further cleanup based on feedback.

* Further cleanup and refactor max_expansions to max_expansions_mask to better reflect its purpose

* Missed rename of max_expansions corrected.
2022-07-14 02:22:50 -05:00
hg 1488c3685c [Tasks] Apply full duration mission replay timers (#2299)
Shared task replay timers used to be based on the task start time
(reducing the final lockout timer by elapsed task time).

Live changed this in the 2022 April 20 patch:
"Replay timers will now apply their full duration upon completion of
their associated task/quest."

Solo tasks and quests already did this

This also fixes a small bug where request timers were being
deleted when replacing replay timers for shared tasks
2022-07-14 02:19:27 -05:00
Chris Miles 71966c85ca [Logs] #logs list Improvements (#2302) 2022-07-14 02:19:00 -05:00
Chris Miles 6cbfecd5a1 [Code Cleanup] Remove Unused EQEMU_DEPOP_INVALIDATES_CACHE (#2292) 2022-07-14 02:18:13 -05:00
Chris Miles 73d4e90275 [World] Add more descriptive LS auth erroring (#2293) 2022-07-14 02:17:51 -05:00
Chris Miles f7923457fd [Crash] Linux Crash Dump Improvements (#2296)
* [Crash] Linux Crash Dump Improvements

* Change LogError  for LogCrash
2022-07-14 02:17:18 -05:00
hg f381453dbd [Tasks] Place task item rewards in free slots (#2300)
Live places item rewards into the first free inventory slot and only
places it on the cursor if inventory is full
2022-07-14 02:16:43 -05:00
hg 792ea1608a [Tasks] Fix #task command crash on bad input (#2301) 2022-07-14 02:16:31 -05:00
Chris Miles 230d115195 [Code Cleanup] Remove use of bzero since it is deprecated for memset (#2295) 2022-07-14 02:11:30 -05:00
Chris Miles dda1712bb8 [Logs] Fix GMSay Log Regression (#2298) 2022-07-14 02:11:18 -05:00
Kinglykrab 849f4e18a5 [Validation] Add Size Validation to #hotfix. (#2304)
* [Validation] Add Size Validation to #hotfix.
- Validates size of shared memory pool versus current count of database so people don't accidentally #hotfix and mess something up.

* Typo.

* Message change.
2022-07-14 02:11:04 -05:00
Chris Miles dfd8f84cac [Strings] Refactor Strings Usage (#2305)
* Initial commit checkpoint

* More functions converted

* Commify

* More functions

* Fin

* Sort declarations

* Split functions between files

* Bots

* Update strings.h

* Split

* Revert find replaces

* Repository template

* Money

* Misc function

* Update CMakeLists.txt

* Saylink

* Update strings.cpp

* Swap Strings::Saylink for Saylink::Create since saylink is coupled to zone database

* API casings
2022-07-14 02:10:52 -05:00
hg 44c85a0dd7 [Quest API] Fix missing arg in perl set_proximity (#2291) 2022-07-08 19:05:33 -05:00
Michael Cook (mackal) 8d6fcf2a84 Fix string comparison issues in Client::SendZoneFlagInfo (#2290)
clang complained about these
2022-07-08 00:07:07 -04:00
Akkadius c59ec59e85 [Hotfix] Windows compile fix take 3 (final) 2022-07-06 23:14:52 -05:00
Akkadius a2e531d7e4 [Hotfix] Possible windows compile fix take 2 2022-07-06 22:58:22 -05:00
Akkadius 8ab3ec4fb0 [Hotfix] Possible windows compile fix 2022-07-06 22:40:34 -05:00
Chris Miles 19b751257b [Server Maintenance Script] Improvements to Downloading - Empty File Detection (#2282)
* Change how the utility script gets downloaded

* Adjust timeouts and order
2022-07-06 22:13:42 -05:00
Chris Miles f4904d00d2 [Backups] Use World CLI for Database Backups (#2286)
* Use world backup utility instead of db_dumper.pl

* Delete database_dumper.pl

* Delete db_dumper.pl

* Tweak script
2022-07-06 22:02:28 -05:00
Chris Miles 67f5759e47 [Server] Configuration Issues Checker (LAN Detection) (#2283)
* LAN detect

* Add more checks, consolidate logic

* Tweaks

* Tweaks

* Update world_config.cpp

* Tweak logic

* Add DNS resolution

* Delete task runner after being used

* JSON path notation adjust
2022-07-06 22:01:58 -05:00
Chris Miles eca4eed996 [Logging] Table Injection - Member Variable Cleanup (#2281)
* Logsys member variable cleanup, table injection

* Private member adjustments, OOB checks

* continue
2022-07-06 22:01:47 -05:00
Paul Coene 5c105d7408 [Bug Fix] NPCs were getting weapon proc added twice (#2277) 2022-07-06 21:59:46 -05:00
Kinglykrab a444857b46 [Quest API] Perl Doors Fix. (#2288) 2022-07-05 16:17:55 -05:00
Kinglykrab 4025b84891 [Quest API] Add missing methods/package.adds to Perl API. (#2287) 2022-07-05 16:07:41 -05:00
Kinglykrab 6d56b5b730 [Bug Fix] Fix Spell Bucket and Spell Global Logic Checks. (#2285)
- Default to true and set to false if they fail the proper check.
2022-07-04 23:28:21 -04:00
Michael 0f13a92b73 Merge pull request #2284 from hgtw/fix/missing-overload 2022-07-04 11:29:56 -04:00
hg 44dc9967a3 Add perl SpellFinished overload 2022-07-04 11:19:44 -04:00
hg 7e8a24fcec [Quest API] Use binding library for perl apis (#2216)
* Add perlbind library

* Convert perl apis to perlbind
2022-07-03 21:33:45 -05:00
Michael 2829d21057 [Cleanup] Update to EQEmu #2253 to clean up message strings (#2279)
Added message string 1393 // You have been summoned!
2022-07-03 18:57:33 -04:00
Akkadius 66d6d523cf [Hotfix] Move discord_webhooks to state tables because we don't want webhooks being exported 2022-07-03 12:16:19 -05:00
Akkadius 1a02017737 [Hotfix] Add discord_webhooks to server tables 2022-07-03 12:08:00 -05:00
Quintinon b5c4357de2 [Bug Fix] Fix miscellaneous memory leaks related to EQApplicationPacket and it's pBuffer (#2262)
* Delete EQApplicationPacket after use

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

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

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

* Delete leaked outapp variables in zone/trading.cpp

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

* Prevent initial new ServerPacket from being leaked in command_reload

* Free pack after sending in command_setlsinfo

* Delete new NPC in command_viewnpctype after printing stats

* Fix compile error

* Delete EQApplicationPacket after sending in command_kick

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

* Delete packet after sending in WorldServer::SendReloadTasks

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

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

* Free EQApplicationPacket after sending in Bot::ProcessBotInspectionRequest

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

* Initialize variable to nullptr to prevent garbage initial value

* Undo change in other PR
2022-07-02 22:10:51 -05:00
Paul Coene 5c60913583 [Feature] Add humanoid and non-wielded restrictions to pick pocket (#2276)
* Add humanoid and non-wielded restructions to pick pocket

* Use constants for message string and char color

* Fixed more magic #s

* Fix to include valie bodytypes

* Fix incorrect scope of final else

* My extra message was not needed.  Client handles based on packet reply

* Removed string ID I added - issued by client

* Use existing pick pocket reply function / clean up
2022-07-02 22:02:43 -05:00
Quintinon 30f35a920b [Bug Fix] Handle memory leaks from return value of Client::GetTraderItems() (#2266)
* Move delete of ItemInstance to avoid edge case leaking in ZoneDatabase::LoadWorldContainer()

* Delete ItemInstance after use in Client::Handle_OP_AdventureMerchantPurchase()

* Delete ItemInstance after use in NPC::GetEquipmentMaterial()

* Delete ItemInstance after use in Bot::AddBotItem()

* Delete GetItems_Struct in edge case when !TradeItemsValid in Client::Handle_OP_Trader()

* Move delete GetItems_Struct to handle edge case when Customer is not valid in Client::Trader_EndTrader()
2022-07-02 22:01:42 -05:00
Quintinon 445c94bf4a [Cleanup] Fix unintended copies in zone/zonedb.cpp by changing auto to auto& (#2271) 2022-07-02 21:57:17 -05:00
Michael 221d173c59 [Feature] Bind Wound and Forage while mounted. (#2257)
During some point in the eras you were not able to Bind Wound or Forage when mounted. I am not sure if Live is still like this, so I added a rule with it disabled by default.
2022-07-02 21:53:15 -05:00
Michael 68d28bcd3e [Bug Fix] Add required distance to CoTH before aggro wipe (#2253)
* Add required distance to CoTH before aggro wipe

This should fix eqemu/master#2205

* Remove implied this->

* Adjustments to rules per PR discussion.
2022-07-02 21:51:57 -05:00
Kinglykrab d107226ced [Telnet] Add guildsay to console commands and Guild Channel to QueueMessage. (#2263)
* [Telnet] Add guildsay to console commands and Guild Channel to QueueMessage.
- Will allow you to send guild-specific messages from things like Discord EQ.
- Add Guild support in `EQ::Net::ConsoleServerConnection::SendChannelMessage` so guild ID can be parsed out.

* Fix auction ChannelMessage by adding to condition.

* Update console.cpp

* Update console.cpp
2022-07-02 21:51:03 -05:00
Quintinon 2c0716f654 [Cleanup] Cleanup code smells and compiler warnings in common/shareddb (#2270)
* Apply refactoring for modernize-use-default-equals

* Apply refactoring for const local variable

* Replace c-style cast with static_cast<>

* Explicit cast double to float to remove compiler warning

* Make member functions const when possible

* Correct [lnt-accidental-copy] by changing auto to auto&

* Use static_cast instead of reinterpret_cast when appropriate

* Remove unneeded initial values when assigned in all paths and joined delcaration and assignment when possible

* Remove unused include

* Make member function in header const
2022-07-02 21:49:42 -05:00
Kinglykrab 0c01872608 [Bots] Cleanup ^inventoryremove, ^inventorylist, and ^list Commands and bot groups. (#2273)
* [Bots] Cleanup ^inventoryremove, ^inventorylist, and ^list Commands.

* Bot group cleanup, bot group auto spawning.

* Compile fix.

* Require SQL.
2022-07-02 21:46:00 -05:00
Paul Coene 3936b2b882 [Fix] Boats should never get FixZ'd (#2246)
* Boats should never get FixZ'd

* Use member variable to avoid repetitive checks

* Resolve comments from review

* Fix return type
2022-07-02 13:49:45 -05:00
Kinglykrab 15113f4056 [Quest API] Add TrackNPC to Perl/Lua. (#2272)
* [Quest API] Add TrackNPC to Perl/Lua.
- Add quest::tracknpc(entity_id) to Perl.
- Add eq.track_npc(entity_id) to Lua.
- This will allow server operators to arbitrarily Track NPCs for clients with scripts.
- Modified tracking to auto turn off and tell you that you discovered your target if within 10 units, this is to allow scripted Tracking to turn off without the need for the Tracking skill.

* Remove unnecessary DoTracking() call.

* Update client.cpp
2022-06-29 15:29:02 -04:00
hg 16b31c5a3a [Bug Fix] Fix empty spawned merchants (#2275)
Regression from 763fc823
2022-06-28 09:23:08 -04:00
Kinglykrab 28b07d635a [Spells] Target's Target Combat Range Rule (#2274) 2022-06-24 19:04:52 -04:00
Quintinon 059a4b7568 [Bug Fix] Delete NpcType Struct returned by Bot::CreateDefaultNPCTypeStructForBot() when unused (#2267) 2022-06-18 16:45:38 -04:00
Quintinon b9ceba1b1c [Bug Fix] Free return value of ZoneDatabase::LoadTraderItemWithCharges() (#2264) 2022-06-18 16:44:23 -04:00
Quintinon cb95251c68 [Bug Fix] Correct type signed/unsigned int when reading item from database in shareddb (#2269)
* Correct database reads from unsigned to signed integer for item regen, manaregen, endur, and enduranceregen

* Correct item database read for Click.Effect from unsigned to signed int
2022-06-15 12:16:58 -04:00
Kinglykrab be00aa1b60 [Loot] Remove unnecessary loot error messages. (#2261)
* [Loot] Remove unnecessary loot error messages.
These messages are only sent when you loot a corpse that is mid-decay (i.e. no items and you go to loot it immediately) or if you try to loot a non-corpse entity.
The ent != 0 shows up a lot if you're trying to loot too quickly and really isn't an error, the server just hasn't caught up to decay the corpse before you try to loot.

* Use preexisting struct.

* Remove newline.

* Update client_packet.cpp
2022-06-12 18:44:16 -04:00
Akkadius b2658a6cbc [Hotfix] Correct database call to point to the content_db connection 2022-06-12 17:34:51 -05:00
Michael 026133f32a [Bug Fix] Tradeskill Item 0 Error (#2256)
When trying to fully script a combine so the tradeskill itself does not return an item (Item 0) and handling all items through quests, the source will provide an error regardless that "Item 0 does not exist". This change will move the item summon after the validity check thus preventing the error to the client.
2022-06-10 13:53:30 -04:00
Michael 6d4f22a1c0 [Bug Fix] Tradeskill Autocombine MinSkill (#2260)
* [Bug] Tradeskill Autocombine MinSkill

Require min tradeskill or above for autocombine.

* Syntax fixes
2022-06-10 13:52:31 -04:00
Michael e75f87a535 [Quest API] Expand SaveGuardSpot (#2258)
* Expand SaveGuardSpot

- Adds
-- mob:saveguardspot()
-- mob:saveguardspot(true)

* Perl Support
Thanks to KinglyKrab for the perl implementation.
2022-06-10 13:52:22 -04:00
Kinglykrab 83e066bffc [Bug Fix] Stop skill ups on Charmed NPCs. (#2249)
- Clients were capable of leveling up their melee skills on Charmed Mobs according to: https://github.com/EQEmu/Server/issues/2182
2022-06-09 21:08:50 -04:00
Chris Miles 4639405fdf [Discord Integration] Native Discord Integration (#2140)
* Start of discord integration work

* more testing

* Discord client work

* More discord work

* Cleanup

* Handle retry timer response and max retries

* Update base retry timer

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

* Post merge

* Send up Zone::SendDiscordMessage

* Start of discord integration work

* more testing

* Discord client work

* More discord work

* Cleanup

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

* Post merge

* Push up tables

* Quest API stuff.

* Update 2022_05_07_discord_webhooks.sql

* Post merge fixes

* Push up manifest

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

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

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
2022-06-09 17:22:23 -05:00
hg 8ef3e87370 [Bug Fix] Fix stack leaks in Lua events #2254
EventItem was leaving the package table on the stack in successful
(non-encounter) calls and only popping the return. All events were
also leaking the full stack on lua_pcall errors. Lua mod callbacks
were popping error returns but leaking the table.
2022-06-09 17:20:35 -05:00
Akkadius bec28769aa [Hotfix] Flipped positive / negative values for legacy_combat.lua 2022-06-09 17:19:00 -05:00
Kinglykrab 8586cdc47e [Messages] Convert messages from Spells to FocusEffect where necessary. (#2243)
* [Messages] Convert messages from Spells to FocusEffect where necessary.
https://github.com/EQEmu/Server/issues/837 from 2019 notes a couple places that should use Focus Effect chat type instead of Spells chat type.

* Add rule for item cast messages.
2022-06-08 19:09:33 -04:00
Michael Cook (mackal) 63ba5dc3ab Fix memory leaks found by Quint (#2248) 2022-06-07 23:41:13 -04:00
Michael fcc7725ca3 [Bug Fix] Bazaar Search MYSQL Error (#2252)
Corrected fields that the bazaar search function is using to prevent mysql error due to non-existant field items.spellid.
2022-06-07 21:21:02 -04:00
Michael 5df6a61c96 [Bug Fix] Hacker_Str was causing sql errors - Non Escaped (#2251)
Processing the hacker_str through EscapeString().
2022-06-07 21:19:24 -04:00
Kinglykrab fc5105eed7 [Rules] Add Frontal Stun Immunity Rules. (#2217)
* [Rules] Add Frontal Stun Immunity Rules.
- Add Combat:FrontalStunImmunityClasses rule for determining Frontal Stun Immunity by class bitmasks
- Add Combat:FrontalStunImmunityRaces rule for determining Frontal Stun Immunity by race bitmasks
- Add Combat:NPCsUseFrontalStunImmunityClasses rule for determining if NPCs use Frontal Stun Immunity by class bitmasks
- Add Combat:NPCsUseFrontalStunImmunityRaces rule for determining if NPCs uses Frontal Stun Immunity by race bitmasks
- Cleanup GetDefaultGender() as best as possible with the globalload I have.
- Combat:NPCsUseFrontalStunImmunityRaces defaults to true as NPCs currently use Frontal Stun Immunity.
- Added **all** Ogre races to the check for Frontal Stun Immunity.

* Remove other Ogre races.
2022-06-06 22:29:06 -05:00
Quintinon 243fb781e8 [Bug Fix] Fix two invalid data accesses in zone/client.cpp (#2238)
* Correct potential read out of bounds on array in Client::Doppelganger

* Correct potential read out of bounds in Client::ChannelMessageSend

* Corrected logic to not read out of bounds on the lower end.
2022-06-06 22:26:36 -05:00
Kinglykrab ec4d228dd5 [Bug Fix] Fix issue where #advnpcspawn addspawn does not add spawn sometimes. (#2247)
* [Bug Fix] Fix issue where #advnpcspawn addspawn does not add spawn sometimes.
- Cleanup where std::stoi should be std::stoul.
- Cleanup ShowStats message to show NPC stats at bottom as well.

* Update advnpcspawn.cpp
2022-06-06 22:24:45 -05:00
Michael Cook (mackal) 2910073373 [Memory Leak] Fix leak of CommandRecords in commandlist (#2244)
* Fix leak of CommandRecords in commandlist

Quicker than porting to std::unique_ptr since we do fun stuff with
commandlist ...

* Fix leak so it won't double free

This is fine enough until we rewrite it to be better
2022-06-06 15:21:35 -04:00
Kinglykrab b4d5e807e3 [Commands] Add BestZ and Region Data to #loc (#2245) 2022-06-05 15:38:51 -04:00
Kinglykrab 8f729fe948 [Rules] Add Rule to Disable NPC Last Names. (#2227)
* [Rules] Add Rule to Disable NPC Last Names.
- Add NPC:DisableLastNames to disable NPC Last Names.
- Fix #npcedit lastname to allow you to use an empty string.

* Cleanup of classes in naming.

* Duplicate.

* Update classes.cpp
2022-06-04 14:01:00 -04:00
Kinglykrab 7160aa651e [Cleanup] Cleanup Haste references and Lua API calls for unsigned to signed. (#2240) 2022-06-04 14:00:21 -04:00
Kinglykrab 8414ce02e3 [Cleanup] Add Validation to varchar number item fields. (#2241)
- combateffects and charmfileid were varchar and have no default value, so if you passed '' shared memory would fail, default these to 0 to prevent this.
2022-06-04 14:00:16 -04:00
Kinglykrab 17034a6e47 [Commands] Cleanup #spawneditmass Command. (#2229)
* [Commands] Cleanup #spawneditmass Command.
- Cleanup messages and logic.
- Split command into its own file.

* Save querying database if they're not using the only supported option.

* Condense to one message.
2022-06-04 12:59:46 -05:00
Quintinon be1772d464 [Bug Fix] Correct (probably) unintended bitwise AND instead of logical AND (#2239) 2022-06-01 21:17:39 -04:00
Quintinon a00f086bb8 [Combat] Fix shield calculation (#2234)
* Fix max mitigation calculation

* Fix shield ability not receiving correct arguments from perl script.

* Correct shielder having wrong mitigation set.
2022-06-01 17:17:14 -04:00
Quintinon de830e5535 [Code Cleanup] Resharper Warnings (#2235)
* Remove unused local variable

* Remove another unused variable

* Correct typos and remove unused initialization

* Cleanup some code in OPCharCreate

* Remove unused function in client.cpp and undefined declaration.
Also the function potentially had a null pointer dereference according to Visual Studio.
2022-06-01 17:16:49 -04:00
Kinglykrab d1404a2d95 [Rules] Add Rules to disable various item functionalities and cleanup data types. (#2225)
- Noticed some data types were unsigned when they should be signed based on Live items having these stats as negatives.
- Loregroup was uint32 and should be int32 for Loregroup -1, fixed any references to -1 as 0xFFFFFFFF.
- Attack was uint32 and should be int32.
- DamageShield was uint32 and should be int32.
- DotShielding was uint32 and should be int32.
- Endurance was uint32 and should be int32.
- EnduranceRegen was uint32 and should be int32.
- Haste was uint32 and should be int32.
- ManaRegen was uint32 and should be int32.
- Regen was uint32 and should be int32.
- RULE_BOOL(Items, DisableAttuneable, false, "Enable this to disable Attuneable Items")
- RULE_BOOL(Items, DisableBardFocusEffects, false, "Enable this to disable Bard Focus Effects on Items")
- RULE_BOOL(Items, DisableLore, false, "Enable this to disable Lore Items")
- RULE_BOOL(Items, DisableNoDrop, false, "Enable this to disable No Drop Items")
- RULE_BOOL(Items, DisableNoPet, false, "Enable this to disable No Pet Items")
- RULE_BOOL(Items, DisableNoRent, false, "Enable this to disable No Rent Items")
- RULE_BOOL(Items, DisableNoTransfer, false, "Enable this to disable No Transfer Items")
- RULE_BOOL(Items, DisablePotionBelt, false, "Enable this to disable Potion Belt Items")
- RULE_BOOL(Items, DisableSpellFocusEffects, false, "Enable this to disable Spell Focus Effects on Items")
2022-06-01 17:12:31 -04:00
Kinglykrab 38da37755d [Bug Fix] Fix MovePC in #zone and #zoneinstance Commands. (#2236)
* [Bug Fix] Fix MovePC in #zone and #zoneinstance COmmands.

* #zone 0 Optional Functionality.
2022-06-01 17:05:43 -04:00
Kinglykrab 57ac46d090 [Commands] Cleanup #date Command. (#2228)
* [Commands] Cleanup #date Command.
- Cleanup messages and logic.

* Cleanup.
2022-06-01 15:31:31 -04:00
Chris Miles 59f32b8d34 [Loading] Zone Version Loading Fixes (#2233)
* Zone version loading fixes

* Remove errant code
2022-05-31 22:15:05 -05:00
Chris Miles a45117cd04 [Bug Fix] Adjustment for nullptr crash (#2232) 2022-05-31 22:24:12 -04:00
Chris Miles 291aaea581 [Bug Fix] Fix null pointer crash on zones that have not booted a zone yet with #reload commands or anything that calls GetZoneDescription (#2231) 2022-05-31 21:55:00 -04:00
Chris Miles 162d34e1d9 [Tasks] Fix validation loading (#2230) 2022-05-31 21:47:01 -04:00
titanium-forever 86c9be410d [Database Backup] Enable database dump of bot data (#2221)
* Add option to dump bot data

* Add player_bot_table dump suppor to command handler

* Add tableList getter to the dump_service

* Fix declaration in header file

* Include missed bot tables

* Rename player-bot to bot to be more descriptive

* Fix missed reference to player-bots

Co-authored-by: Kieren Hinch <khinch-github@nylonmoon.com>
2022-05-31 18:25:10 -05:00
Kinglykrab 30e34c67b4 [Quest API] Fix parameters in some Perl worldwide methods. (#2224) 2022-05-31 15:46:14 -04:00
Kinglykrab ce8b8da0d6 [Bug Fix] Fix Legacy Combat Lua Script (#2226) 2022-05-30 22:43:03 -04:00
Kinglykrab 02e8b125a4 [Hot Fix] Fix Linux compile due to missing include. (#2223)
- Not sure how Windows compiles, but Linux fails.
2022-05-30 22:10:49 -04:00
Kinglykrab 11369247b1 [INT64] Further int64 cleanup in Perl SetHP() and GetSpellHPBonuses() in Perl/Lua. (#2222) 2022-05-29 16:36:32 -05:00
Kinglykrab d493a6627b [Commands] Cleanup #nudge Command. (#2220)
* [Commands] Cleanup #nudge Command.
- Cleanup messages and logic.

* Update nudge.cpp

* Update nudge.cpp
2022-05-29 14:33:40 -04:00
Kinglykrab b07945f0be [Commands] Cleanup #emptyinventory Command. (#2219)
- Cleanup messages and logic.
- Breakout #emptyinventory into its own command file.
2022-05-29 14:33:35 -04:00
Kinglykrab 8f3ac74196 [INT64] Fix int64 for OOC Regen and GetHP(), GetMaxHP(), GetItemHPBonuses() in Perl/Lua. (#2218)
* [INT64] Fix int64 for OOC Regen and GetHP(), GetMaxHP(), GetItemHPBonuses() in Perl/Lua.
- These all had int64 values and were overflowing, returning garbage data.

* Update npc.cpp
2022-05-29 14:33:30 -04:00
Kinglykrab bcf7ccefcd [Money Messages] Cleanup quest::givecash(), split, and task reward messages. (#2205)
* [Money Messages] Cleanup quest::givecash(), split, and task reward messages.
- Cleans up all the money messages using ConvertMoneyToString().
- Allows quest::givecash() to have optional parameters other than copper.

* Commification.

* Corpse messages.

* String IDs and cleanup.
2022-05-29 14:33:18 -04:00
Kinglykrab 9e9ef6809b [Cleanup] Cleanup spell and max level bucket logic. (#2181)
* [Cleanup] Cleanup spell and max level bucket logic.
- Spell buckets will now allow new mob->SetBucket() buckets since most people use these now.
- Max level bucket will now allow new mob->SetBucket() bucket since most people use these now.
- Clean up GetScribeableSpells() and GetLearnableDisciplines() logic and magic numbers.
- Make GetClientMaxLevel() uint8 instead of int since it can only be 0-255.

* Fix typo from other commit.

* Lua setter.

* Update client.cpp
2022-05-28 14:35:17 -04:00
Kinglykrab c8f6dbb86d [Commands] Cleanup #npcedit, #lastname, #title, and #titlesuffix Commands. (#2215)
* [Commands] Cleanup #lastname, #npcedit, #title, and #titlesuffix Commands.
- Cleanup messages and logic.

* Update emu_constants.h

* Update command.cpp

* Update command.cpp

* Cleanup of GetXName methods to not define map unnecessarily.

* Update emu_constants.cpp

* Update npcedit.cpp
2022-05-28 14:35:05 -04:00
Kinglykrab 7de50d0e60 [Bug Fix] Fix IP Exemptions. (#2189)
* [Bug Fix] Fix IP Exemptions.
- IP Exemptions were broken due to GetAccountID() returning 0 in logic somehow, resolved this by setting a variable to GetAccountID() at the beginning of the method.
- Fixed weird IP messages where the long form of IP was displayed instead of the string form.
- Fixes edge case where IP rule may be set to -1 and this will make anyone get instantly kicked if IP Exemptions were enabled as their IP Count would always be greater than -1.

* Update client.cpp

* Update client.cpp

* Update clientlist.cpp

* Update clientlist.cpp
2022-05-27 23:57:55 -04:00
Paul Coene aaaee6c6a4 [Bug Fix] IsDamage test for lifetap was not complete. (#2213)
* [Bug Fix] IsDamage test for lifetap was not complete.

* Fix magic # and formatting as per Kingly

* Added #define
2022-05-27 15:30:38 -04:00
Kinglykrab d7f38361f2 [Commands] Cleanup #findaliases and #help Commands. (#2204)
- Cleanup messages and logic.
- Add saylinks to messages for ease of use when searching for commands as most have help messages when using them incorrectly or require no arguments and can be used immediately from the say link.
2022-05-27 15:28:36 -04:00
Kinglykrab 275995a374 [Commands] Cleanup #zone and #zoneinstance Commands. (#2202)
* [Commands] Cleanup #zone and #zoneinstance Commands.
- Cleanup messages and logic.
- Broke these commands out in to their own files.

* Update database.cpp

* Update database.cpp

* Update database.cpp
2022-05-27 15:26:30 -04:00
Kinglykrab 7072b5721b [Rules] Add Spells:BuffsFadeOnDeath. (#2200)
- Allows you to disable buffs fading on death.
2022-05-27 15:00:59 -04:00
Kinglykrab 123bc5f19a [Commands] Cleanup #findclass and #findrace Commands. (#2211)
- Cleanup messages and logic.
- Add bitmasks to player race messages.
2022-05-27 14:46:53 -04:00
Kinglykrab e6db71e31e [Commands] Cleanup #corpsefix Command. (#2197)
* [Commands] Cleanup #corpsefix Command.
- Cleanup messages and logic.

* Update entity.cpp
2022-05-27 14:46:26 -04:00
Kinglykrab 129a738072 [Commands] Cleanup #level Command. (#2203)
- Cleanup messages and logic.
- Breakout #level into its own command file.
2022-05-27 14:45:26 -04:00
Kinglykrab 0de90dc135 [Rules] Add Spells:IllusionsAlwaysPersist. (#2199)
- Allows illusions to always persist beyond death or zoning.
2022-05-27 14:39:35 -04:00
Kinglykrab 5bc4cff7a9 [Regen] Fix possible overflow in CalcHPRegenCap(). (#2185) 2022-05-27 14:39:25 -04:00
Kinglykrab f9191d4ef4 [Commands] Cleanup #oocmute Command. (#2191)
- Cleanup messages and logic.
- Add ServerOOCMute_Struct for cleanliness.
2022-05-27 14:38:40 -04:00
Michael Cook (mackal) 49d751b3d5 Revert "[Aggro] Rooted mobs will add other hated targets to Hate list (#2180)" (#2214)
This reverts commit 14f48fcc93.
2022-05-27 11:40:43 -04:00
Paul Coene 14f48fcc93 [Aggro] Rooted mobs will add other hated targets to Hate list (#2180) 2022-05-27 09:37:55 -04:00
titanium-forever 25addc3bd9 Create user directory during account creation to ensure default files are copied to profile from /etc/skel (#2176)
Co-authored-by: Kieren Hinch <khinch-github@nylonmoon.com>
2022-05-27 00:22:31 -05:00
Kinglykrab 7f12ad325a [Bug Fix] Fix bot compile locking client on server enter. (#2210) 2022-05-26 14:10:19 -04:00
Kinglykrab 6636c64c82 [Commands] Fix typos in #ban and #ipban Commands. (#2209) 2022-05-25 20:05:07 -04:00
Chris e2708af6f2 [Bug Fix] Blocked spells max spell id increased (#2207)
https://github.com/EQEmu/Server/pull/2073 broke blocking spells. There is another location in mob.h that needs to be updated to int32. Tested as fixed on my server.
2022-05-25 17:53:40 -04:00
Kinglykrab 1de0c27629 [Bug Fix] Fix HP Regen Per Second. (#2206)
`hp_regen_rate` was being used for `hp_regen_per_second` incorrectly.
2022-05-25 12:08:28 -05:00
Kinglykrab 9ccdb9eb84 [Bot Commands] Use Account Status Constants. (#2201)
- Convert bot_command_add calls to use constants instead of magic numbers.
2022-05-23 19:56:56 -04:00
Kinglykrab e69f7a6cf1 [Commands] Remove unused/broken #deletegraveyard and #setgraveyard Commands. (#2198)
- These commands don't function in their current state, and they probably haven't ever.
- Removing the commands and putting this in an editor makes more sense, as #setgraveyard uses the current zone XYZ coordinates of a target to set a graveyard for another zone. and they also only allow version 0 graveyards.
- Not sure of a better idea than just deleting, as setting data based on another zone using your current zone's data seems beyond the scope of a command.
2022-05-23 19:56:30 -04:00
Kinglykrab efd04f8324 [Commands] Cleanup #motd Command. (#2190) 2022-05-23 19:56:19 -04:00
Kinglykrab eeacc62a91 [Rules] Cleanup all unused rules. (#2184) 2022-05-23 19:56:03 -04:00
Kinglykrab a7a525ed0b [Commands] #bind Typo. (#2196) 2022-05-22 22:31:14 -04:00
Kinglykrab e43538cf73 [Commands] Cleanup #kill Command. (#2195)
- Cleanup messages and logic.
2022-05-22 22:31:08 -04:00
Kinglykrab 5b90d26a33 [Bug Fix] Fix bot guild removal. (#2194) 2022-05-22 22:31:03 -04:00
Kinglykrab 992e4ac59e [Commands] Consolidate #lock and #unlock Commands into #serverlock. (#2193)
- Convert the two commands into one command.
- Cleanup struct naming.
2022-05-22 22:30:56 -04:00
Chris Miles 6b85c914a5 Schema consistency fixes (#2192) 2022-05-21 23:44:04 -04:00
Kinglykrab 089246db53 [Cleanup] Move Client::Undye() to client.cpp from #path Command. (#2188)
- Client::Undye() was inside the #path command file.
2022-05-21 10:26:45 -04:00
Paul Coene f3e5423677 [Bug Fix] Fix duplicate and missing messages due to innate in spells (#2170)
* [Bug Fix] Fix duplicate and missing messages due to innate skill in spells.

* Seperate spell and melee damage range and skip

* Refine when innate messages are produced.

* Fix magic # (replace with constant)
2022-05-20 11:49:18 -04:00
Kinglykrab 0e96099b3d [Titles] Cleanup titles, title suffix, and last name methods. (#2174)
* [Titles] Cleanup titles, title suffix, and last name methods.
- Use strings instead of const chars*.
- Add optional parameter to SetAATitle in Lua so you can save to the database similar to Perl.
- Cleanup #lastname command.
- Cleanup #title command.
- Cleanup #titlesuffix command.

* Update npc.cpp
2022-05-19 20:15:44 -04:00
Kinglykrab 6398381c44 [Quest API] Add CheckNameFilter to Perl/Lua. (#2175)
- Add quest::checknamefilter(name) to Perl.
- Add eq.check_name_filter(name) to Lua.
- Allows operators to check strings against the name filter for stuff like setting custom pet names, titles, suffixes, etc in scripts.
2022-05-19 20:01:14 -04:00
Kinglykrab 7c1a139991 [Cleanup] Quest API push methods using invalid types. (#2172)
* [Cleanup] Quest API push methods using invalid types.
- Some push methods were pushing integers as unsigned integers or unsigned integer as integers, this fixes all of that.
- Also cleans up some lines that had multiple function calls on them.

* More cleanup of bools and one expansion name was wrong.
2022-05-15 22:14:16 -04:00
Kinglykrab 8554aab2ff [Cleanup] Remove unused methods. (#2171) 2022-05-15 19:12:33 -04:00
hg 77e72ba666 Save eyes in #npcedit featuresave (#2178) 2022-05-15 19:12:22 -04:00
Kinglykrab 8329760632 [Quest API] Add TaskSelector to Perl/Lua. (#2177)
- Add $client->TaskSelector(task_list) to Perl.
- Add client:TaskSelector({task_list}) to Lua.
- Allow $client->AssignTask(task_id) in Perl.
- Allow client:AssignTask(task_id) in Lua.
- Can now assign tasks in scripts without the NPC ID parameter.
2022-05-15 00:49:55 -04:00
hg d8aa8f7e7a [Opcode] Implement SetFace opcode (#2167)
* Implement SetFace opcode

This implements the opcode that's used to update zone clients when a
client updates their face

* Use SetFace in #feature command

Add check for valid number

This adds the #feature eyes command which isn't in the illusion struct
2022-05-11 19:57:20 -04:00
Kinglykrab 29cdd91ca0 [Quest API] Add GetHealAmount() and GetSpellDamage() to Perl/Lua. (#2165)
- Add $client->GetHealAmount() to Perl.
- Add $client->GetSpellDamage() to Perl.
- Add client:GetHealAmount() to Lua
- Add client:GetSpellDamage() to Lua.
2022-05-11 06:35:27 -04:00
Kinglykrab df99d97431 [Cleanup] Cleanup #kick message. (#2164) 2022-05-10 19:52:14 -04:00
Kinglykrab f314e05087 [Hot Fix] Off by on in Merchant Loading. (#2166) 2022-05-10 18:25:32 -04:00
Kinglykrab d120cf8a40 [Commands] #reload Command Overhaul. (#2162)
* [Commands] #reload Command Overhaul.
- Consolidated #reloadaa, #reloadallrules, #reloadcontentflags, #reloademote, #reloadlevelmods, #reloadmerchants, #reloadperlexportsettings, #reloadqst, #reloadstatic, #reloadtitles, #relaodtraps, #reloadworld, and #reloadzps in to one command.
- #reload has 15 different sub commands you may use, including Log Settings and Tasks reloading.
- All the reload commands are a part of the Developer Tools Menu messages now, as well as part of the documentation.
- Fixes the commands that weren't actually sending their packet to zone server to globally reload stuff.
- Added Variables table reloading to command.

* Consistency.

* Hot reload.

* Final big push.
2022-05-10 06:19:07 -04:00
Chris Miles 209b0eb273 [int64] Hate Fixes (#2163)
* Hate fixes

* Update perl_hateentry.cpp

* Update perl_hateentry.cpp
2022-05-09 20:49:43 -05:00
Kinglykrab 763fc82379 [Merchants] Add Merchant Data Bucket capability. (#2160)
* [Merchants] Add Merchant Data Bucket capability.
- Allows server operators to limit merchant items based on data bucket values and comparisons.
- Adds 3 columns, bucket_name, bucket_value, and bucket_comparison to merchantlist table.
- Bucket is checked based on GetBucketKey()-bucket_name.
- Buckets are mass loaded when using the merchant so it's not a database call per item, just a grouping of all their buckets from the start.
- This is a nearly year old pull request redone for master.
- bucket_comparison Values are as follows:
        - bucket_comparison 0: bucket_name == bucket_value
        - bucket_comparison 1: bucket_name != bucket_value
        - bucket_comparison 2: bucket_name >= bucket_value
        - bucket_comparison 3: bucket_name <= bucket_value
        - bucket_comparison 4: bucket_name > bucket_value
        - bucket_comparison 5: bucket_name < bucket_value
        - bucket_comparison 6: bucket_name is any of  pipe(|)-separated bucket_value
        - bucket_comparison 7: bucket_name is not any of  pipe(|)-separated bucket_value
        - bucket_comparison 8: bucket_name is between first and second value of pipe(|)-separated bucket_value
        - bucket_comparison 9: bucket_name is not between first and second value of pipe(|)-separated  bucket_value

* Revert query change.
2022-05-09 21:36:51 -04:00
Kinglykrab 6e0d101457 [Cleanup] Possible issues with variable/parameter name equality. (#2161) 2022-05-09 21:00:37 -04:00
Chris Miles a1a4f91ea6 [Hotfix] Fix regression caused by #2129 2022-05-09 01:18:10 -05:00
Michael Cook (mackal) 6cc845e05e Fix out of bounds issues with SPA 288 (#2157) 2022-05-08 18:18:24 -04:00
Kinglykrab 597e324319 [Bug FIx] Fix #repop Command. (#2159)
If you use no arguments, the command does not repop.
2022-05-08 17:01:50 -04:00
Kinglykrab f370a6048f [Bug Fix] Make Perl TakeMoneyFromPP int64 (#2158) 2022-05-08 13:17:46 -04:00
Kinglykrab 9d784d0d9b [Bug Fix] Fix possible issue where variables have the same name. (#2156)
* [Bug Fix] Fix possible issue where variables have the same name.

* Naming.
2022-05-08 01:43:28 -04:00
Chris Miles fd7b15abb1 [int64] Windows Compile Fixes (#2155)
* int64 windows aftermath

* Perl.

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
2022-05-07 23:45:52 -05:00
Kinglykrab b27428a6d8 [Commands] Cleanup #cvs Command. (#2153)
* [Commands] Cleanup #cvs Command.
- Cleanup messages and logic.
- std::find was using .begin() in both comparisons, so it wasn't working and unique IPS always returned 1.

* Update cvs.cpp
2022-05-07 23:45:44 -04:00
Chris Miles f201d4c999 [int64] Support for HP / Mana / End / Damage / Hate (#2091)
* Initial int64 work

* Hate 64 bit

* Update special_attacks.cpp

* Aggro / Damage / Hate int64

* NPC edit adjustments

* Fix bot compile

* More int64 adjustments

* More int64 references

* npcedit references

* aggrozone

* More int64 changes

* More int64 changes for damage

* Many more damage int64 references

* More spell damage int64 conversions

* HealDamage

* Damage fully working

* Remove debug

* Add migration

* More int64 adjustments

* Much wow, many int64

* More int64

* PR adjustments
2022-05-07 22:32:02 -05:00
Kinglykrab d9c41526e8 [Commands] Cleanup #ban, #ipban, #flag, #kick, #setlsinfo, and #setpass Commands. (#2104)
* [Commands] Cleanup #ban, #ipban, #flag, and #kick Commands.
- Cleanup messages and logic.
- Add ServerFlagUpdate_Struct for flag updates.

* Add #setlsinfo and #setpass to cleanup.

* Update setlsinfo.cpp

* Update database.cpp

* Update database.cpp

* Update command.cpp
2022-05-07 23:28:45 -04:00
Chris Miles 07b46ed445 [UCS] Auto Client Reconnection (#2154) 2022-05-07 22:24:11 -05:00
Chris Miles 9f9eaed983 [Hotfix] Fix DB version merge 2022-05-07 21:19:21 -05:00
Chris Miles 862e1e33bf [Tasks] Implement Task Goal Match List (#2097)
* [Tasks] Implement Task Goal Match List

* Migration

* Add npc_type_id to match types for npc kill

* Flip str_tolower
2022-05-07 15:37:06 -05:00
Kinglykrab dca34cc2ff [Commands] Cleanup #time and #timezone Command. (#2147)
* [Commands] Cleanup #time and #timezone Command.
- Cleanup messages and logic.

* Cleanup.
2022-05-07 05:03:58 -05:00
Kinglykrab ccb316b11b [Bug Fix] NPC::GetNPCStat has no default return. (#2150)
```In member function 'float NPC::GetNPCStat(const char*)':
/drone/src/zone/npc.cpp:2810:1: warning: control reaches end of non-void function [-Wreturn-type]```
2022-05-07 05:01:36 -05:00
Kinglykrab 10ae4ea8f6 [Bug Fix] Lua GetBlockNextSpell() no return. (#2151)
- No return value.
2022-05-07 05:01:22 -05:00
Kinglykrab 7df9b2974b [Commands] Cleanup #reloadzps Command. (#2129)
* [Commands] Cleanup #reloadzps Command.
- Cleanup messages and logic.
- Make reloading of zone points global instead of zone specific.

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

* Final cleanup.

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

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

* Remove unnecessary message.

* Update worldserver.cpp

* Update worldserver.cpp

* Update worldserver.cpp
2022-05-06 22:31:17 -04:00
Kinglykrab e26eba8e03 [Commands] Cleanup #npctype_cache Command. (#2109)
* [Commands] Cleanup #npctype_cache Command.
- Cleanup messages and logic.
- Loop was returning as soon as it found first ID, so you couldn't use the spaced ID list functionality at all.

* Remove command.
2022-05-06 22:13:16 -04:00
Kinglykrab 02828a73b8 [Commands] Cleanup #npcspecialattk Command. (#2108)
* [Commands] Cleanup #npcspecialattk Command.
- Cleanup messages and logic.

* Remove command.
2022-05-06 22:06:12 -04:00
Kinglykrab 0e710fe5e7 [Commands] Cleanup #ucs Command. (#2149)
* [Commands] Cleanup #ucs Command.
- Cleanup messages and logic.

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

* Update worldserver.cpp

* Update worldserver.cpp
2022-05-06 21:57:19 -04:00
Kinglykrab bf1d05d639 [Commands] Cleanup #profanity Command. (#2113)
* [Commands] Cleanup #profanity Command.
- Cleanup messages and logic.

* Update profanity_manager.cpp

* Update profanity_manager.cpp

* Update profanity_manager.cpp

* Update profanity_manager.cpp
2022-05-06 21:36:23 -04:00
Kinglykrab 4eaf44fc33 [Commands] Remove unused #bestz and #pf Commands. (#2112)
- Remove unused commands.
2022-05-06 21:13:26 -04:00
Kinglykrab e62a283a79 [Commands] Cleanup #makepet Command. (#2105)
- Cleanup messages and logic.
2022-05-06 20:58:07 -04:00
Kinglykrab a847e461c1 [Commands] Cleanup #npcemote Command. (#2106)
* [Commands] Cleanup #npcemote Command.
- Cleanup messages and logic.

* Update npcemote.cpp
2022-05-06 20:58:01 -04:00
Kinglykrab 37fefad58e [Commands] Cleanup #npcsay and #npcshout Commands. (#2107)
* [Commands] Cleanup #npcsay and #npcshout Commands.
- Cleanup messages and logic.

* Update npcsay.cpp

* Update npcshout.cpp
2022-05-06 20:57:53 -04:00
Kinglykrab 26b26af8d7 [Commands] Cleanup #npctypespawn Command. (#2110)
- Cleanup messages and logic.
2022-05-06 20:50:02 -04:00
Kinglykrab ee86001132 [Commands] Cleanup #reloadmerchants Command. (#2123)
* [Commands] Cleanup #reloadmerchants Command.
- Cleanup messages and logic.
- Make the reloading of merchants global instead of zone specific.

* Update worldserver.cpp

* Update worldserver.cpp
2022-05-06 20:48:46 -04:00
Kinglykrab 7d89c05a48 [Commmands] Cleanup #questerrors Command. (#2116)
- Cleanup messages and logic.
2022-05-06 20:42:47 -04:00
Kinglykrab 6e15fae6a0 [Commands] Cleanup #randomizefeatures Command. (#2118)
- Cleanup messages and logic.
- Make #randomizefeatures function for Iksar and Vah Shir.
2022-05-06 20:42:34 -04:00
Kinglykrab 2f962c2c8a [Commands] Cleanup #refreshgroup Command. (#2119)
- Cleanup messages and logic.
2022-05-06 20:42:25 -04:00
Kinglykrab 6bbd1e94c3 [Commands] Cleanup #push Command. (#2114)
- Cleanup messages and logic.
2022-05-06 19:38:15 -05:00
Kinglykrab 78d44440eb [Commands] Cleanup #qglobal Command. (#2115)
- Cleanup messages and logic.
2022-05-06 19:37:45 -05:00
Kinglykrab 1e45ffa24d [Bug Fix] Resolve subroutine redefinition due to bot methods. (#2117)
* [Bug Fix] Resolve subroutine definition due to bot methods.

* Update perl_bot.cpp
2022-05-06 19:33:20 -05:00
Kinglykrab 37d5d96871 [Commands] Cleanup #resetaa_timer Command. (#2131)
* [Commands] Cleanup #resetaa_timer Command.
- Cleanup messages and logic.

* Typos.
2022-05-06 20:26:59 -04:00
Kinglykrab 90725f9fd9 [Commands] Cleanup #revoke Command. (#2134)
* [Commands] Cleanup #revoke Command.
- Cleanup messages and logic.

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

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

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

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

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

* Typos.
2022-05-06 20:06:51 -04:00
Kinglykrab 9fbab76d40 [Commands] Cleanup #summonburiedplayercorpse Command. (#2146)
* [Commands] Cleanup #summonburiedplayercorpse Command.
- Cleanup messages and logic.

* Update summonburiedplayercorpse.cpp
2022-05-06 20:06:04 -04:00
Kinglykrab b03d47b9cd [Commands] Cleanup #trapinfo Command. (#2148)
* [Commands] Cleanup #trapinfo Command.
- Cleanup messages.
- Does not modify the command file, as it's only one line that calls the method in zones/trap.cpp.

* Cleanup.

* Update trap.cpp

* Update trap.cpp
2022-05-06 20:05:55 -04:00
Kinglykrab b583d95f09 [Commands] Cleanup #reloadrulesworld Command. (#2128)
- Cleanup messages and logic.
2022-05-06 20:05:40 -04:00
Kinglykrab 6846deb9c8 [Commands] Cleanup #reloadstatic Command. (#2130)
- Cleanup messages and logic.
- Make reloading of static zone data global instead of zone specific.
2022-05-06 20:03:22 -04:00
Kinglykrab adfec15893 [Commands] Cleanup #resetaa Command. (#2132)
* [Commands] Cleanup #resetaa Command.
- Cleanup messages and logic.

* Update resetaa.cpp
2022-05-06 20:02:32 -04:00
Kinglykrab 132c936c90 [Commands] Cleanup #sensetrap Command. (#2137)
* [Commands] Cleanup #sensetrap Command.
- Cleanup messages and logic.

* Update sensetrap.cpp
2022-05-06 20:01:29 -04:00
Kinglykrab a0ed0d57c5 [Commands] Cleanup #serverinfo Command. (#2138)
* [Commands] Cleanup #serverinfo Command.
- Cleanup message and logic.
- Use popup instead of messages.

* Update serverinfo.cpp
2022-05-06 20:01:21 -04:00
Kinglykrab 128e8ce08d [Commands] Cleanup #resetdisc_timer Command. (#2133)
- Cleanup messages and logic.
2022-05-06 19:50:58 -04:00
Kinglykrab 55629ce396 [Commands] Cleanup #roambox Command. (#2135)
- Cleanup messages and logic.
2022-05-06 19:50:26 -04:00
Kinglykrab bf7c1252f8 [Commands] Cleanup #save Command. (#2136)
- Cleanup messages and logic.
2022-05-06 19:50:19 -04:00
Kinglykrab e2bfa44df0 [Commands] Cleanup #serverrules Command. (#2139)
- Cleanup messages and logic.
- Change separator from new line to pipe separator, as new line was non-functional.
2022-05-06 19:50:09 -04:00
Kinglykrab e5acc7c322 [Commands] Cleanup #shownpcgloballoot and #showzonegloballoot Command. (#2141)
- Cleanup messages and logic.
2022-05-06 19:50:03 -04:00
Kinglykrab 5aaaaed6f1 [Commands] Add #feature Command. (#2142)
* [Commands] Add #feature Command.
- Removes #beard, #beardcolor, #details, #face, #hair, #haircolor, #helm, #heritage, #size, and #tattoo commands.
- Cleanup messages and logic.
- Consolidate 13 different feature settings to this one command.
- Unique commands including #gender, #race, and #texture were not removed.

* Add missing feature.cpp.

* Update feature.cpp
2022-05-06 19:49:56 -04:00
Kinglykrab 6d31786456 [Commands] Cleanup #spawnfix Command. (#2143)
- Cleanup messages and logic.
2022-05-06 19:49:51 -04:00
Kinglykrab 0aeab11408 [Commands] Cleanup #summon Command. (#2145)
* [Commands] Cleanup #summon Command.
- Cleanup messages and logic.
- Add glm::vec4 overload for GMMove.
- Remove unused parameter from GMMove.
- Remove unnecessary Lua GMMove now that parameter is gone.

* Update summon.cpp

* Cleanup.
2022-05-06 18:45:12 -05:00
Kinglykrab fc484d0b1c [Commands] Cleanup #gassign Command. (#2101)
* [Commands] Cleanup #gassign Command.
- Cleanup messages and logic.

* Update gassign.cpp

* Update gassign.cpp
2022-05-06 19:13:28 -04:00
Kinglykrab 8dcc810b43 [Commands] Cleanup #spawnstatus Command. (#2144)
* [Commands] Cleanup #spawnstatus Command.
- Cleanup messages and logic.

* Further cleanup and consolidation, add inline GetTimer() as timer is protected.
2022-05-06 18:12:29 -05:00
Kinglykrab 04f3d6286c [Commands] Cleanup #attack Command. (#2103)
- Cleanup messages and logic.
2022-05-03 23:05:16 -04:00
Kinglykrab 35044becc1 [Commands] Cleanup #freeze and #unfreeze Commands. (#2102)
- Cleanup messages and logic.
- Remove the ability to #freeze yourself.
2022-05-03 23:05:09 -04:00
Kinglykrab e08afb1234 [Commands] Cleanup #getvariable Command. (#2100)
- Cleanup messages and logic.
2022-05-03 23:05:02 -04:00
Kinglykrab b2b87ea4e0 [Quest API] Expand Bot quest API functionality. (#2096)
* [Quest API] Expand Bot quest API functionality.
- Add $bot->AddItem(slot_id, item_id, charges, attuned, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six) to Perl.
- Add $bot->CountItem(item_id) to Perl.
- Add $bot->HasItem(item_id) to Perl.
- Add $bot->RemoveItem(item_id) to Perl.
- Add bot:AddItem(slot_id, item_id, charges, attuned, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six) to Lua.
- Add bot:CountItem(item_id) to Lua.
- Add bot:GetOwner() to Lua.
- Add bot:HasItem(item_id) to Lua.
- Add bot:RemoveItem(item_id) to Lua.

* Fix possible crash.
2022-05-03 23:04:54 -04:00
Kinglykrab 837c0a4385 [Quest API] Perl Money Fixes. (#2098)
- Fixes `$client->GetAllMoney()` to use `uint64` and not overflow int value.
- Fixes `$client->GetCarriedMoney()` to use `uint64` and not overflow int value.
2022-05-03 22:55:56 -04:00
Kinglykrab 9b075c28b6 [Quest API] Add commify to Perl/Lua. (#2099)
- Add quest::commify(number) to Perl.
- Add eq.commify(number) to Lua.
2022-05-03 19:44:22 -04:00
Paul Coene c4f05c3864 [Combat] Fix Frenzy vs opponents immune to non-magic (#2095)
* [Combat] Fix Frenzy vs opponents immune to non-magic

* Fix naming.

* Use snake case for variable
2022-05-02 23:08:08 -04:00
hg 0c12ca8370 [Repository] Cast floats to avoid grid repository warnings (#2094)
This is in the custom repository method file so the generator doesn't
need modified for it
2022-05-01 21:53:37 -05:00
Chris Miles a450779c91 [Drone] Speed up drone builds (#2092)
* Speed up drone builds

* Add chown for ccache

* Add the cmake compiler launcher flag for ccache

* Update .drone.yml

* Don't optimize

* Don't optimize take 2
2022-05-01 20:17:43 -05:00
hg dc004c2a9d Remove already defined method (#2093)
CastRestrictedSpell is already defined in common/spdat

MSVC Debug builds caught this as an ODR violation, though Release
builds still allowed it (maybe because the methods were identical)
2022-05-01 20:54:50 -04:00
Kinglykrab d59dcb68ca [Commands] Add additional #peqzone functionality. (#2085)
* [Commands] Add additional #peqzone functionality.
- Add #peqzone flagging capabilities so operators don't have to blanket allow #peqzone access to zones.
- Allows you to set a zone's `peqzone` column to `2` and disallow use of `#peqzone` until they have been given the appropriate flag.
- Add #peqzone_flags command to list your #peqzone flags similar to #flags command.
- Add `character_peqzone_flags` table to database and database_schema.h.
- Required SQL update to add the new table.
- Add client:ClearPEQZoneFlag(zone_id) to Lua.
- Add client:HasPEQZoneFlag(zone_id) to Lua.
- Add client:LoadPEQZoneFlags() to Lua.
- Add client:LoadZoneFlags() to Lua.
- Add client:SendPEQZoneFlagInfo(client) to Lua.
- Add client:SetPEQZoneFlag(zone_id) to Lua.
- Add $client->ClearPEQZoneFlag(zone_id) to Perl.
- Add $client->HasPEQZoneFlag(zone_id) to Perl.
- Add $client->LoadPEQZoneFlags() to Perl.
- Add $client->SendPEQZoneFlagInfo(client) to Perl.
- Add $client->SetPEQZoneFlag(zone_id) to Perl.

* Fixes.
2022-05-01 19:39:52 -04:00
Chris Miles c7dbdfae58 [Combat] Basic Combat Recording (#2090)
* Basic combat recording

* Update combat_record.h
2022-05-01 18:08:12 -05:00
Kinglykrab 759f9bd007 [Bots] Bot::PerformTradeWithClient Cleanup. (#2084)
* [Bots] Bot::PerformTradeWithClient Cleanup.
- Cleanups message and logic.
- Initial cleanup to eventually allow easy use with Perl/Lua quest API.

* Duplicated comment.
2022-05-01 19:05:12 -04:00
Chris Miles 8f0b80097e [Refactor] Simplify NPC Loading (#2087)
* Refactor / simplify NPC loading

* Update spacing [skip ci]

* Update base_npc_types_repository.h
2022-05-01 17:04:38 -05:00
Chris Miles 71ae03d5bc [Compile] Decrease build times using unity build strategy (#2089) 2022-05-01 15:53:21 -05:00
KayenEQ 34dc081306 [Spells] Update to target types Beam and Cone to ignore invalid targets. (#2080) 2022-05-01 16:50:55 -04:00
Chris Miles 35b35f85cf [Logging] Update BUILD_LOGGING=false Blank Aliases (#2083) 2022-05-01 14:54:46 -05:00
Chris Miles 90da136b7a [Regen] Implement Per Second HP Regen for NPCs (#2086)
* Implement NPC per second regen

* Add hp_regen_per_second to ModifyNPCStat

* Take per second regen the rest of the way

* Add #npcedit hp_regen_per_second

* Add db migration
2022-05-01 10:26:16 -04:00
Chris Miles 5b4aeaa457 [Code Cleanup] Remove this-> in code where its implied (#2088) 2022-05-01 10:22:09 -04:00
Kinglykrab b02008ec53 [Bots] Remove unused methods. (#2082)
- Remove Bot::BotTradeSwapItem().
- Remove Bot::ApplySpecialAttackMod().
2022-04-30 18:13:34 -04:00
Kinglykrab c709a6aa8e [Quest API] Add multiple inventory method short hands to client. (#2078)
- Allows you to just directly use Client instead of having to grab reference to inventory.
- Add $client->CountAugmentEquippedByID(item_id) to Perl.
- Add $client->HasAugmentEquippedByID(item_id) to Perl.
- Add $client->CountItemEquippedByID(item_id) to Perl.
- Add $client->HasItemEquippedByID(item_id) to Perl.
- Add client:CountAugmentEquippedByID(item_id) to Lua.
- Add client:HasAugmentEquippedByID(item_id) to Lua
- Add client:CountItemEquippedByID(item_id) to Lua.
- Add client:HasItemEquippedByID(item_id) to Lua.
2022-04-30 11:47:05 -04:00
Kinglykrab 9113508269 [Bots] Fix ^dyearmor command math. (#2081)
* [Bots] Fix ^dyearmor command math.

* Typo.
2022-04-30 10:57:22 -04:00
Kinglykrab 1b7c12297d [Quest API] Add AddPlatinum(), GetCarriedPlatinum() and TakePlatinum() to Perl/Lua. (#2079)
* [Quest API] Add AddPlatinum(), GetCarriedPlatinum() and TakePlatinum() to Perl/Lua.
- Allows for easier NPC interactions.
- GetCarriedPlatinum() adds together all currencies in inventory based on conversion amounts so it works easily with removals/checks.
- Add $client->AddPlatinum(platinum, update_client) to Perl.
- Add $client->GetCarriedPlatinum() to Perl.
- Add $client->TakePlatinum(platinum, update_client) to Perl.
- Add client:AddPlatinum(platinum, update_client) to Lua.
- Add client:GetCarriedPlatinum() to Lua.
- Add client:TakePlatinum(platinum, update_client) to Lua.

* Formatting.
2022-04-30 10:57:05 -04:00
nytmyr b1311780a7 [Quest API] Add EVENT_SKILL_UP & EVENT_LANGUAGE_SKILL_UP to Perl/Lua (#2076)
Added EVENT_SKILL_UP to Perl/Lua

Adds sub EVENT_SKILL_UP output for use.
Exports:
$skill_id - ID of the skill being exported. Will export skill or language as the same so check below.
$skill_value - New skill level
$skill_max - Maximum value of skill
$is_tradeskill - 0 for non-tradeskill, 1 for tradeskill

Example usage:
sub EVENT_SKILL_UP {
if($is_tradeskill == 0) {
		quest::shout("Skill Increase! " . $client->GetCleanName() . " has increased their " . quest::getskillname($skill_id) . " to " . $skill_value . " of " . $skill_max . "!"); #deleteme
	}
	if ($is_tradeskill == 1) {
		quest::shout("Tradeskill Increase! " . $client->GetCleanName() . " has increased their " . quest::getskillname($skill_id) . " to " . $skill_value . " of " . $skill_max . "!"); #deleteme
	}
}

Adds sub EVENT_LANGUAGE_SKILL_UP output for use.
Exports:
$skill_id - ID of the skill being exported. Will export skill or language as the same so check below.
$skill_value - New skill level
$skill_max - Maximum value of skill

Example usage:
sub EVENT_LANGUAGE_SKILL_UP  {
		quest::shout("Language Increase! " . $client->GetCleanName() . " has increased their " . quest::getlanguagename($skill_id) . " to " . $skill_value . " of " . $skill_max . "!"); #deleteme
}

Co-authored-by: toxin06 <53322305+toxin06@users.noreply.github.com>
2022-04-25 11:18:52 -05:00
cybernine186 0d734a0837 Bug Fix for WorldServer::HandleMessage, CZUpdateType_NPC (#2074) 2022-04-21 08:17:29 -04:00
Paul Coene ee54a7eb5f [Bug Fix] Restore missing messages for lifetap and dmg spells. (#2057)
* [Bug Fix] Restore missing messages for lifetap and dmg spells.

* Fix unintended duplicate message for DD on clients.

* Improve performance and accuracy of IsDamageSpell()
2022-04-13 23:11:26 -04:00
Kinglykrab a6814d46de [Commands] Cleanup #task Command. (#2071)
* [Commands] Cleanup #task Command.
- Cleanup messages.
- Add #task uncomplete [Task ID] to uncomplete a completed task without having to go in the database manually.

* Message cleanup.
2022-04-13 23:11:20 -04:00
KayenEQ 9dba6a6680 [Bug Fix] Blocked spells max spell id increased (#2073)
Blocked spell id should be checking int32 not int16
2022-04-13 11:54:11 -04:00
KayenEQ bc875ae554 [API] Methods for getting more information on quest timers. (#2060)
* hastimer

* [API] Check quest timer duration, timer remaining and if timer exists.

* [API] Methods for getting more information on quest timers.

* [API] Methods for getting more information on quest timers.

* [API] Methods for getting more information on quest timers.
2022-04-13 11:20:03 -04:00
KayenEQ bb897b755f [Bug Fix] Instrument Mods should not affect spells that change model size. (#2072)
Instrument Mods should not affect spells that change model size.
2022-04-13 11:02:21 -04:00
Kinglykrab a39a825045 [Quest API] Add GetBotListByCharacterID() to Perl/Lua. (#2069) 2022-04-02 17:51:26 -04:00
Paul Coene ccd0713b33 [Bug Fix] Fix recipient sound (vtell) on non-player races (#2066)
* [Bug Fix] Fix recipient sound (vtell) on non-player races

* Fix to use BaseRace as intended
2022-04-02 11:18:10 -04:00
Kinglykrab 5d94c9844a [Bug Fix] Clear title/suffix bug fix. (#2068)
- Clearing uses title ID 0, so need to make sure title ID is valid when setting and based on that, either check and set, or just clear.
2022-04-02 11:09:48 -04:00
KayenEQ bbe2db7c0f [Bug Fix] Bard Invisible causing display issues. (#2067)
* [Bug Fix] Bard Invisible causing display issues.

Error occurring due to bard modifiers being applied to invisible spell effect value.

* [Bug Fix] Bard Invisible causing display issues.
2022-04-02 00:01:38 +02:00
Kinglykrab 5dc76e595b [Quest API] Add GetBotListByClientName(client_name) to Perl/Lua. (#2064)
* [Quest API] Add GetBotListByClientName(client_name) to Perl/Lua.
- Add $entity_list->GetBotListByClientName(client_name) to Perl.
- Add eq.get_entity_list():GetBotListByClientName(client_name) to Lua.
- Allows you to get a bot list comprised solely of a specific character's bots.

* Update lua_entity_list.cpp
2022-03-23 08:47:47 -04:00
Natedog2012 b6b662f1c7 [Bug Fix] #peqzone no longer bypass Handle_OP_ZoneChange (#2063)
* [Bug Fix] #peqzone no longer bypass Handle_OP_ZoneChange

* Force other quest functions to trigger EVENT_ZONE properly

* call MovePC

* Use MoveZone to keep things uniform
2022-03-19 19:25:14 -04:00
Paul Coene 5275201713 [Bug Fix] Fix for being able to skill up on corspe. (#2058)
* [Bug Fix] Fix for being able to skill up on corspe.

* Fix whitespace
2022-03-19 13:21:54 -05:00
Paul Coene 1e86e0c02f [Bug Fix] manifest for db version 9176 had incorrect field name(#2062)
Field name in version 9176 doesn't match field created.
2022-03-19 13:13:56 -05:00
Natedog2012 25c0416f1e [Bug Fix] Force NPCs to respect special ability 24 and 50 when set on player pets (#2059)
* Force NPCs to respect special ability 24 and 50 when set on player pets

* Fix error in logic

* Remove this
2022-03-15 19:28:36 -05:00
Paul Coene 326dba6aeb [Logging] Fix log messages to final damage values (#2056) 2022-03-14 12:05:39 -04:00
Kinglykrab b75741ff4e [Bug Fix] Fix possible crash with zone name methods. (#2055)
- ZoneLongName and ZoneName were returning nullptr in places that were then attempting to use that nullptr value, causing zone crashes.
2022-03-13 15:59:57 -04:00
Kinglykrab 8e62383997 [Quest API] Add AddItem() to Perl/Lua. (#2054)
- Add $client->AddItem(item_data) to Perl.
- Add client:AddItem(item_table) to Lua.
- This will allow server operators to add items without needless parameters.

Perl Example:
```pl
my %item_data = (
	"item_id" => 1200,
	"charges" => 1,
	"augment_one" => 49656,
	"augment_two" => 49656,
	"augment_three" => 49656,
	"augment_four" => 49656,
	"augment_five" => 49656,
	"augment_six" => 49656,
	"attuned" => 1,
	"slot_id" => quest::getinventoryslotid("general1")
);
$client->AddItem(\%item_data);
```
Lua Example:
```lua
local item_data = {
	item_id = 1200,
	charges = 1,
	augment_one = 49656,
	augment_two = 49656,
	augment_three = 49656,
	augment_four = 49656,
	augment_five = 49656,
	augment_six = 49656,
	attuned = true,
	slot_id = Slot.General1
};
e.self:AddItem(item_data);
```
2022-03-13 15:59:48 -04:00
KayenEQ 4296e2e39e [API] GetNPCStat default better naming (#2053) 2022-03-12 20:01:25 -05:00
Kinglykrab e5f924d1d5 [Quest API] Allow EVENT_ZONE to be parsed as non-zero to prevent zoning. (#2052)
- This will allow server operators to prevent zoning to or from a specific zone based on whatever criteria they want.
2022-03-12 16:11:27 -05:00
Kinglykrab fb2aee1827 [Quest API] Add EVENT_CAST_ON exports to EVENT_CAST and EVENT_CAST_BEGIN. (#2051)
- Export $caster_id and $caster_level to EVENT_CAST and EVENT_CAST_BEGIN in Perl.
- Export e.caster_id and e.caster_level to EVENT_CAST and EVENT_CAST_BEGIN in Lua.
2022-03-12 14:33:00 -05:00
Kinglykrab 791d8b329d [Quest API] Export killed XYZH to EVENT_DEATH_ZONE in Perl. (#2050)
- Export $killed_x, $killed_y, $killed_z, and $killed_h to EVENT_DEATH_ZONE in Perl.
- Cleanup export strings and unnecessary .c_str() calls on event exports.
2022-03-12 13:44:01 -05:00
catapultam-habeo abcf8cbce1 [Bots] Update Bot Heal & Damage methods to more closely match Clients + Bugfixes (#2045)
* - Fixed Bots Spell Damage being negative under some circumstances (heal target)
- Allow Bots to send non-melee damage reports in the same manner as Clients
- Refactor\Update Bots Spell Damage & Heal calculations to match current state of Clients.
- Allow Bots to actually utilize Spell Damage and Heal Amount stats

* Don't send packets to bots

* remove random tab

* align text lol
2022-03-11 18:28:00 -05:00
Chris Miles 3ed6663c4c [Repositories] Update repositories (#2040) 2022-03-11 18:27:36 -05:00
Chris Miles f22608a43a [Bug FIx] Saylink Collation Database Edge Case (#2039) 2022-03-11 18:27:15 -05:00
KayenEQ 0e5d578d71 [Bug Fix] #tune command various fixes (#2046)
* tune fixes

* [Bug Fix] #tune command various fixes

accuracy tune fix
2022-03-11 10:13:51 -05:00
KayenEQ 8107ed52e1 [API] GetNPCStat can now return default stat values. (#2048)
* [API] GetNPCStat return default stat values.

* [API] GetNPCStat can now return default stat values.
2022-03-11 09:10:52 -05:00
Kinglykrab d904db0e52 [Quest API] Add caster_id and caster_level export to EVENT_CAST_ON in Perl/Lua. (#2049)
- Add $caster_id and $caster_level to EVENT_CAST_ON in Perl.
- Add e.caster_id and e.caster_level to EVENT_CAST_ON in Perl.
2022-03-10 21:46:27 -05:00
Kinglykrab e6c8a38ffa [Bug Fix] Spell Buckets/Globals did not allow string-based values. (#2043) 2022-03-09 14:18:24 -05:00
KayenEQ dbe0591b09 [API] Perl functions to set invulnerable to and modify environmental damage. (#2044)
* invulnerable

* modifier

* fix

* fix

* fix

* [API] Perl functions to set invulnerable to and modify environmental damage.

* [API] Perl and Lua functions to set invulnerable to and modify environmental damage.

credit to kinglykrab for lua
2022-03-08 19:50:46 -05:00
KayenEQ 5b6f1d38be [Bug Fix] Invisible will display as dropped now on air pets when they attack. (#2042)
invisible display issue on pets
2022-03-07 16:41:43 -05:00
JJ ce85c70a07 [Database] Update 2022_01_10_checksum_verification.sql (#2041) 2022-03-07 14:30:24 -06:00
KayenEQ f814b5bec5 [Bug Fix] PR 2032 would lock client on casting fail as written (#2038) 2022-03-06 22:03:19 -06:00
Chris Miles 4e40d7eacc [Command] Fix #killallnpcs from crashing (#2037) 2022-03-06 22:03:10 -06:00
Randy Girard 31ad0da811 [Content Filtering] Updates contents flags to be checked at runtime. (#1940)
* Updates contents flags to be checked at runtime.

* Fix formatting

* Add expansion flags

* Tweaks to logic

* Logic tweaks

* Update world_content_service.cpp

* Inverse DoesPassContentFiltering logic

* Update world_content_service.cpp

* Update world_content_service.cpp

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-03-06 22:02:57 -06:00
Chris Miles 25a19a13dc [Database] Add Primary ID Keys to Tables (#2036) 2022-03-06 22:02:33 -06:00
Paul Coene 2a5ddde78a [Feature] Client Checksum Verification (Resubmit old 1678) (#1922)
* [Feature] Client Checksum Verification (Resubmit old 1678)

* Updated db version

* Add new updatechecksum to CmakeLists.txt

* Removed magic number and used constant

* Fix new command to have access to worldserver

* spacing, more venbose desc and remove unneeded check

* Cleanup, refactoring

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-03-06 20:26:29 -06:00
catapultam-habeo eca2ed0321 [Feature] EQ2-style implied targeting for spells. (#2032)
* Implemented EQ2-style implied targeting for spells.

* Fixed nullptr w\ target that has no target
2022-03-06 20:25:40 -06:00
Paul Coene afc32afb02 [AI] Spell Type (1024) InCombatBuff were spam casting (#2030) 2022-03-06 20:18:30 -06:00
catapultam-habeo 751db6fffb [Feature] Allow pets to zone with permanent (buffdurationformula 50) buffs to maintain them through zone transitions (#2035) 2022-03-06 20:17:25 -06:00
Paul Coene c4eb1f8439 [Bug Fix] Bandolier didn't recognize source weapon on cursor (#2026)
* [Bug Fix] Bandolier didn't recognize source weapon on cursor

* Add TODO comment
2022-03-06 20:15:22 -06:00
Paul Coene d6c03b54a1 [Bug Fix] Fixed several instances of incorrect comparision - & executes after == (#2025) 2022-03-06 18:42:23 -06:00
neckkola 261a9e6938 [Bots] Fix bot spawn when bot id = char_id (#1984)
* Fix for GENERIC_9_STRINGS

* Update .gitignore

* Fixed query for use case when char_id of owner equals a bot_id

* Update BotDatabase::LoadGroupedBotsByGroupID to not use a view though correct edge case where botid=charid
2022-03-06 18:41:53 -06:00
catapultam-habeo ac214f71d4 [Bots] Apply Spells:IgnoreSpellDmgLvlRestriction to bots (#2024)
* Correct bot spell damage and healing pathways to account for rule Spell:IgnoreSpellDmgLvlRestriction

* Corrected to be more consistent in regard to the 'spells[spell_id].no_heal_damage_item_mod' modifier. This modifier doesn't seem to actually exist on any content, and bots didn't use it to begin with.

This restriction is present on players - do we want it on bots also?
2022-03-06 18:40:21 -06:00
KayenEQ fd878e7b16 [Bug Fix] Missing break (#2031) 2022-03-04 18:35:59 -05:00
Michael Cook (mackal) 58cde58b45 Fix order of operations issues in worldshutdown command (#2029) 2022-03-04 12:24:13 -05:00
Kinglykrab cc2ef11158 [Bug Fix] Objects::GetTiltX() and Objects::GetTiltY() Perl Croak Typos. (#2028)
- Typo was causing GetIncline() to show three times on Spire and causing GetTiltX() and GetTiltY() not to show at all on Spire.
2022-03-03 22:06:25 -05:00
Kinglykrab 2dfb7614cc [Bug Fix] Doors::GetSize() Perl Croak Typo. (#2027)
- Typo was causing GetIncline() to show twice on Spire and causing GetSize() not to show at all on Spire.
2022-03-03 21:54:02 -05:00
KayenEQ 6dffeacc6e [Spells] Fixes for numhits type 7 counter incrementing incorrectly. (#2022)
* [Spells] Fix for numhits type 7 counter incrementing incorrectly.

* [Spells] Fixes for numhits type 7 counter incrementing incorrectly.

bot fix

* [Spells] Fixes for numhits type 7 counter incrementing incorrectly.

mercs

* [Spells] Fixes for numhits type 7 counter incrementing incorrectly.

remove old variable and related code.

* [Spells] Fixes for numhits type 7 counter incrementing incorrectly.

comments
2022-03-01 21:20:27 -05:00
Michael 2ec6dcbe24 Merge pull request #2023 from EQEmu/bug_fix/lua_argument_dispatch 2022-02-28 20:22:12 -05:00
Kinglykrab 39bc12b582 [Bug Fix] Removed Lua Event Argument Dispatch.
Fix accidentally removal of argument dispatch for EVENT_CONSIDER_CORPSE in https://github.com/EQEmu/Server/pull/2015
2022-02-28 19:59:34 -05:00
Kinglykrab 6d78f926c8 [Commands] Cleanup #worldwide command. (#2021)
- Cleanup messages and logic.
- Command usages would not display when using commands improperly, this will fix that.
2022-02-28 19:46:56 -05:00
catapultam-habeo 00af2903c3 Rule to apply Spell Dmg and Heal Amount stats as a percentage instead of flat value. (#2017)
* Apply Spell Dmg and Heal Amt stats as a percentage increase (1 SD\HA = 1% increase to spell effectiveness) instead of a flat addition.

* Corrected logic to allow for coexistence of FlatItemExtraSpellAmt rule and this.

* Adjusted rule name to be less ambiguous.
2022-02-28 15:24:16 -05:00
Kinglykrab 58fafd0f9c [Bug Fix] quest::MovePCInstance() Arguments Fix. (#2020)
- Logic made the method return an "error" when not using last parameter.
2022-02-27 16:39:45 -05:00
Kinglykrab 9f0989ee2d [Bug Fix] Spell Buckets/Globals SQL Escape. (#2019) 2022-02-26 10:17:05 -05:00
KayenEQ 14648b96c4 [Spells] SPA 79 SE_CurrentHPOnce now will check for focus, critical and partial resist checks, except for buffs. (#2018)
* [Spells] SPA 79 SE_CurrentHPOnce check for focus and related effects.

SPA 79 SE_CurrentHPOnce should have the damage checks as SPA 0 for heal/damage

* Update spell_effects.cpp

* [Spells] SPA 79 SE_CurrentHPOnce now will check for focus, critical and partial resist checks.
2022-02-24 13:47:54 -05:00
Kinglykrab bfd1cf9379 [Quest API] Add EVENT_EQUIP_ITEM_CLIENT and EVENT_UNEQUIP_ITEM_CLIENT to Perl/Lua. (#2015)
- These events allow more customization beyond forcing operators to use a script file for each and every item they want to have some sort of functionality for these events.
- Perl event exports $item_id, $item_quantity, and $slot_id.
- Lua event exports item_id, item_quantity, slot_id, and item.
2022-02-22 20:04:08 -05:00
Chris Miles 3c35e9bbc8 [GM Command] Fix Crash Issue and Validation with #zclip (#2014)
* Fix crash issue and validation with zclip

* Formatting.

Co-authored-by: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com>
2022-02-21 17:02:48 -05:00
Kinglykrab d86544ff60 [Bug Fix] Alleviate some lag with crosszone/worldwide spell casting. (#2016)
- Spell casting was using SpellFinished which casts the spell, and if the spell was a group spell each member of the group would cast it on all the other members, causing a chain reaction.
- This fix utilizes ApplySpellBuff(spell_id, duration) so that it only casts the spell on the target, as with the crosszone and worldwide methods you will be affecting your target based on identifiers regardless.
- This should alleviate some of the crosszone/worldwide casting crashes on larger servers such as Lazarus.
2022-02-20 21:59:46 -05:00
KayenEQ 70eed67e08 [Bug Fix] checking casting_spell_slot before its defined is bad (#2013) 2022-02-20 15:56:17 -05:00
KayenEQ 1c0524681e [API] perl added GetNPCStat(identifier) (#2012)
* [API] perl added GetNPCStat

Returns values of the modifiers from ModifyNPCStat

* https://github.com/EQEmu/Server/pull/2012
2022-02-20 14:00:28 -05:00
KayenEQ aa9320de3c [Spells] Bard songs from item clickies should not require components (#2011) 2022-02-18 09:37:09 -05:00
KayenEQ ad28f3c3f3 [Bug Fix] Fix for castspell command (#2010)
Fix for using castspell command with parameter 0
2022-02-17 20:44:11 -05:00
Kinglykrab 71dfa9acc0 [Commands] Bug fix for #logs command. (#2008)
* [Commands] Bug fix for #logs command.

* Update logs.cpp
2022-02-17 12:01:06 -05:00
KayenEQ 56d0478ab1 [API] Fix for SetBuffDuration function to check bard slots. (#2009) 2022-02-17 12:00:42 -05:00
Kinglykrab 0d02fadb60 [Quest API] Add GetRandomMob() and GetRandomNPC() to Perl/Lua. (#2006)
- Add $entity_list->GetRandomMob(x, y, z, distance, exclude_mob) to Perl.
- Add $entity_list->GetRandomNPC(x, y, z, distance, exclude_npc) to Perl.
- Add eq.get_entity_list():GetRandomMob(x, y, z, distance, exclude_mob) to Lua.
- Add eq.get_entity_list():GetRandomNPC(x, y, z, distance, exclude_npc) to Lua.
2022-02-17 08:57:02 -05:00
cybernine186 4de5a7b86d [Bug] Fixed trade items record log (#2003)
LogPlayerHandin was not recording the item details of the trade. It should be inserting the trade details into `qs_player_handin_record_entries` but it was not running the query because of missing QueryDatabase function.
2022-02-16 21:52:14 -06:00
KayenEQ ba3c19ad0b [Spells] AE Duration effect (Rains) will now work with Target Ring and PBAE spells. (#2000)
* done

* Update beacon.cpp

* [Spells] AE Duration effect (Rains) will now work with Target Ring and PBAE spells.

Mackals suggestions implemented.
2022-02-16 10:12:13 -05:00
Kinglykrab 8ec80644ee [Commands] Cleanup #unscribespell Command. (#1998)
* [Commands] Cleanup #unscribespell Command.
- Cleanup messages and logic.
- Add Client::UnscribeSpellBySpellID(spell_id, update_client).
- Add $client->UnscribeSpellBySpellID(spell_id, update_client) to Perl.
- Add client:UnscribeSpellBySpellID(spell_id, update_client) to Lua.

* Update unscribespell.cpp
2022-02-16 06:04:01 -05:00
Kinglykrab ed7e2b2652 [Commands] Cleanup #untraindisc Command. (#1996)
- Cleanup messages and logic.
2022-02-16 06:03:51 -05:00
KayenEQ a83ad7080a fix for meloday cast bar issue (#2005) 2022-02-15 14:01:01 -05:00
KayenEQ 677d595c9d invis updates (#2004) 2022-02-15 11:39:19 -05:00
KayenEQ 615f4a5304 [API] Apply spells with custom buff durations and adjust existing spell buff durations. (#1997)
* working

* Update spell_effects.cpp

* updates

* disable_buff_overwrite

* revert

* update

* working

* update

* updates

* Update spells.cpp

* getbuffstat done

* Update perl_mob.cpp

* [API] Apply spells with custom buff durations and adjust existing spell buff durations.

* [API] Apply spells with custom buff durations and adjust existing spell buff durations.

* [API] Apply spells with custom buff durations and adjust existing spell buff durations.

* [API] Apply spells with custom buff durations and adjust existing spell buff durations.

* https://github.com/EQEmu/Server/pull/1997

Lua added, thanks kinglykrab
2022-02-15 08:58:10 -05:00
KayenEQ 5fd62d82db Update bonuses.cpp (#2002) 2022-02-15 08:57:53 -05:00
KayenEQ b938e6223c [Spells] Invisibility updates and rework (#1991)
* updates pre merge

* update

* Update spell_effects.cpp

* Update mob.h

* test

* test

* updates

* updates

* save

* update

* working solid

* animal and undead start

* progress

* updates

* rename

* set invis appearance on bonus

* remove fade buff state check

* update IsViisble check

* optimizing

* don't break bots

* debug remover

* Update ruletypes.h

* perl adds

* Update client_packet.cpp

* update

* done

* remove debugs

* Update client_packet.cpp

* update

* [Spells] Invisibility updates and rework

lua support

* [Spells] Invisibility updates and rework

lua
2022-02-15 00:18:02 -05:00
KayenEQ 51c8771bd2 bug fix (#2001) 2022-02-15 00:17:23 -05:00
Kinglykrab cc9196bd65 [Commands] Cleanup #showskills Command. (#1994)
* [Commands] Cleanup #showskills Command.
- Utilize popup over messages.
- Usage: #showskills [Start Skill ID] [All] - shows skills starting from skill ID and if "all" is specified it will show skills the player does not have normally (no max/cannot have skill).

* Update showskills.cpp

* Update command.cpp
2022-02-14 19:49:14 -05:00
Kinglykrab 6303f129af [Commands] Cleanup #setskillall Command. (#1992)
- Cleanup messages and logic.
2022-02-14 19:02:27 -05:00
KayenEQ 3f0987ba55 [Combat] /shield command "too far away message" (#1999)
* live did something that makes sense

* [Combat] /shield command "too far away message

better chat

* [Combat] /shield command "too far away message

never mind that one was red.
2022-02-14 10:44:26 -05:00
KayenEQ 1d4438ae1f [Bug Fix] Edge case AA reset timer issue fixes (#1995)
* SendCastRestriction not displaying right on linux build

changed const char to string

* fail safe to prevent recast timer checks from triggered spells

* fixed

* Update spell_effects.cpp

* https://github.com/EQEmu/Server/pull/1995

better message code
2022-02-13 21:50:53 -05:00
KayenEQ 03adf20fe9 bot crash fix (#1993) 2022-02-13 12:09:32 -05:00
KimLS dd6cde68bb Small change to order of a couple of files in zone cmakefile, added the gm commands to their own source group so they are cleanly separated in any IDEs cmake supports 2022-02-12 23:31:51 -08:00
KimLS 95c8b60ec6 Extra extern c warning squash, XS macro expands to XS_EXTERNAL which under c++ expands to extern c 2022-02-12 22:04:30 -08:00
KimLS fa418172d6 What is this random semicoloned if, removed to silence warning 2022-02-12 22:04:30 -08:00
KimLS 7b106fc622 Handle default case of GetDynamicZoneTypeName to silence warning 2022-02-12 22:04:30 -08:00
KimLS 62a453f0d7 Remove obsolete register spec on int to silence warning 2022-02-12 22:04:30 -08:00
KayenEQ fa9314811e [Bug Fix] Fix for Bot command casting (#1990)
* missing return true in ApplyBardPulse

* Update bot.cpp

* [Bug Fix] Fix for Bot command casting

compile error

* [Bug Fix] Fix for Bot command casting

* Update bot.cpp
2022-02-12 15:12:35 -05:00
Kinglykrab d2d7b8108d [Commands] Cleanup #ai Command. (#1980)
- Cleanup messages and logic.
- Remove #ai start/#ai stop as they can crash zones and are mostly useless.
- Add EQ::constants::GetConsiderLevelMap() and EQ::constants::GetConsiderLevelName().
- Add quest::getconsiderlevelname(consider_level) to Perl.
- Add eq.get_consider_level_name(consider_level) to Lua.
2022-02-11 16:26:08 -05:00
KayenEQ 99793cab8b [Spells] Fix for AA recast timers not resetting properly (#1989)
* revert completed

Too many issues popping up that are difficult to track down. This was probably not best way to solve the problem.

* fixed for real

* Update aa.cpp

* Update aa.cpp

* Update aa.cpp

* should work

* remove spaces

* [Spells] Fix for AA recast timers not resetting properly
2022-02-11 16:25:59 -05:00
KayenEQ e2484997dd revert completed (#1988)
Too many issues popping up that are difficult to track down. This was probably not best way to solve the problem.
2022-02-11 10:58:43 -05:00
KimLS 66935fe21b Fix for passing std::string to vsprintf 2022-02-11 01:15:02 -08:00
KayenEQ db988e4261 group message (#1987) 2022-02-10 23:55:59 -05:00
Kinglykrab fdd260d5fa [Commands] Cleanup #npcloot Command. (#1974)
- Cleanup messages and logic.
- Utilize item links where helpful.
- Implement #npcloot remove all to remove all loot from an NPC using GetLootList().
- #npcloot money now supports 0 to 65,535 for the money types, clamped using EQ::Clamp.
2022-02-10 20:05:36 -05:00
Kinglykrab 9110bc863e [Commands] Cleanup #logs Command. (#1969)
- Cleanup messages and logic.
- Utilize popup for list and applying settings.
2022-02-10 16:52:15 -05:00
Kinglykrab 4a41583805 [Commands] Cleanup #flagedit Command. (#1968)
- Cleanup and fix messages and logic.
- Utilized popup for listing zones that have required flags.
2022-02-10 16:17:52 -05:00
Kinglykrab 5396c0c88b [Commands] Cleanup #name Command. (#1977)
- Cleanup messages and logic.
2022-02-10 16:14:40 -05:00
Kinglykrab 968ae26c99 [Commands] Cleanup #hatelist Command. (#1976)
- Cleanup messages and logic.
2022-02-10 16:14:17 -05:00
Kinglykrab 7bf466cf3f [Commands] Cleanup #netstats Command. (#1970)
- Utilize popup over chat messages.
2022-02-10 16:10:31 -05:00
Kinglykrab 49d7eb1402 [Commands] Cleanup #version Command. (#1967)
- Utilize popup over chat message.
2022-02-10 16:10:23 -05:00
Kinglykrab d83ced6f76 [Commands] Cleanup #undye and #undyeme Commands. (#1966)
- Fix #undye command as its method was not being used in command.cpp.
- Cleanup messages and logic for both #undye and #undyeme.
2022-02-10 16:10:16 -05:00
Kinglykrab 1ea8888607 [Commands] Cleanup #timers Command. (#1965)
- Cleanup message and logic.
- Utilize popup instead of chat messages.
- Utilize ConvertSecondsToTime() helper method.
2022-02-10 16:10:06 -05:00
Kinglykrab f9eb4603a3 [Quest API] Add GetEnvironmentalDamageName() to Perl/Lua. (#1964)
- Add EQ::constants::GetEnvironmentalDamageMap() and EQ::constants::GetEnvironmentalDamageName().
- Add quest::getenvironmentaldamagename(damage_type) to Perl.
- Add eq.get_environmental_damage_name(damage_type) to Lua.
- Cleanup GM messages for avoiding environmental damage.
2022-02-10 16:09:56 -05:00
KayenEQ d656be6be4 [Bug Fix] Fix for PR1954 target restriction with npcpc_only_flag from groupbuffs (#1986)
* Update spells.cpp

* Update spells.cpp

* [Bug Fix] Fix for PR1954 target restriction with npcpc_only_flag from groupbuffs

disc failure log

* [Bug Fix] Fix for PR1954 target restriction with npcpc_only_flag from groupbuffs

improved HasItemRecastTimer check
2022-02-10 14:58:28 -05:00
KayenEQ fbbbd3b09d [Bug Fix] PR 1982 (#1985)
* Update spells.cpp

* [Bug Fix] PR 1982
2022-02-09 23:24:18 -05:00
KayenEQ a6d1652f44 fixed (#1983) 2022-02-09 18:02:45 -05:00
KayenEQ f0bf285836 [Spells] Support for SPA 194 SE_FadingMemories to use max level checks on aggroed mobs (#1979)
* escape fix for different target types

* implemented max level for fade

* test

* update

* update

* support modern limits

* Update ruletypes.h

* update

* [Spells] Support for SPA 194 SE_FadingMemories to use max level checks on aggroed mobs

not sure why this code got removed, maybe merge error.
2022-02-09 15:12:39 -05:00
KayenEQ 1f560529da [Bug Fix] Bard update fixes 1 (#1982)
* fix for bard item charge consumables

* [Bug Fix] Bards not consuming item click charges on instant cast items.

* [Bug Fix] Bard update fixes 1

bards not respecting deity/race/class restrictions on instant cast items
2022-02-09 15:07:38 -05:00
Kinglykrab f65a6d2761 [Quest API] Add AddAISpellEffect(spell_effect_id, base_value, limit_value, max_value) and RemoveAISpellEffect(spell_effect_id) to Lua. (#1981)
- Add npc:AddAISpellEffect(spell_effect_id, base_value, limit_value, max_value) to Lua.
- Add npc:RemoveAISpellEffect(spell_effect_id) to Lua.
2022-02-08 20:46:59 -05:00
KayenEQ 79f250da2d [API] Perl functions added to apply spell effects directly to NPCs without requiring buffs. (#1975)
* script functions working

* Update perl_npc.cpp

* [API] Perl functions added to apply spell effects directly to NPCs without requiring buffs.
2022-02-08 18:32:13 -05:00
KayenEQ 752e6c89f3 [Spells] Allow damage spells to heal if quest based spell mitigation is over 100 pct. (#1978)
* heal from nuke

* Update mob.cpp
2022-02-08 09:03:31 -05:00
KayenEQ e962ad3a35 procs silence (#1973) 2022-02-08 07:36:20 -05:00
KayenEQ 872d494bb6 [Bug Fix] Summon Companion causing pets to warps away. (#1972)
* Update spell_effects.cpp

* Update spell_effects.cpp
2022-02-08 07:36:04 -05:00
KayenEQ 8a48473dbc [Spells] Fix for AA and Discipline recast timers being set on spell casting failure. (#1971)
* recast timer updates

* reworked

* removed unneeded param

* fix expendible AA

* fixed

* Update spells.cpp

* [Spells] Fix for AA and Discipline recast timers being set on spell casting failure.

don't check recasts from triggered spells.
2022-02-08 07:35:47 -05:00
KayenEQ a208801d1f [Spells] Major update to Bard song pulsing, Bard item clicks while singing, and spell casting restriction logic. (#1954)
* test

* complete

* Update effects.cpp

* Update spells.cpp

* Update effects.cpp

* [Spells] Support for bards using Disciplines while casting or /melody.

Support for spell field 'cast not standing' not allow casting from divine aura

* [Spells] Support for bards using Disciplines while casting or /melody.

DA bypass logic for spells with field 'cast_not_standing'

* updates

* stun and mez bypass

* Update spdat.cpp

* Update spdat.cpp

* Update spells.cpp

* clean

* requirement messages

* update

* pct

* save work

* Reform code 1_22_22

* updated

* update id to pointer

* Update spells.cpp

* rework 2

* update 1_23_22

* Update spells.cpp

* updates

* msg string works

* fix disc timers not be set

* more optimization

* update 1_23_22 PM

moved stop casting out
charm and harmony moved in

* update 1_25_22

rework of functions

* updates 1_26_22

* remove old checks

* gm override added for some

* update bard AA casting checks

* updates

* addbuff exception for bard

* debugs

* charm working

* update

* moved skill check here

* cast from item while singing

* lets not attack mounts

* instant cast items click

* aug clicks working

* aug tests

Bug? Cast time not display on aug clicks for bards

* aug recast from items semi ok

* added item timer function

* unified setting item recast timer

* clean up time

* update

* bard AA cast updates

* debugs removed

* debugs removed

* clean up

* clean up

* better placement of bindsight and numhits fix

* move and rename function

* Update spells.cpp

* add logs

* delete old DoCastingChecks

* Removed old bard pulse functions

* remove AEBardPulse and GroupPulse

* removed Raid::GroupBardPulse

* Pulse Restriction: Divine Aura

* Pulse Restrictions : Fear behavior

* Update spells.cpp

* Update spells.cpp

* [Spells] Major update to Bard song pulsing, Bard item clicks while singing, and spell casting restriction logic.

bots...

* [Spells] Major update to Bard song pulsing, Bard item clicks while singing, and spell casting restriction logic.

added recommended isvalidspell check

* [Spells] Major update to Bard song pulsing, Bard item clicks while singing, and spell casting restriction logic.

merged

* [Spells] Major update to Bard song pulsing, Bard item clicks while singing, and spell casting restriction logic.

removed defines since we have them as constants
2022-02-07 07:48:52 -05:00
Kinglykrab a5d8a64792 [Quest API] Add inventory->CountItemEquippedByID(item_id) and inventory->HasItemEquippedByID(item_id) to Perl/Lua. (#1963)
- Add $inventory->CountItemEquippedByID(item_id) to Perl.
- Add $inventory->HasItemEquippedByID(item_id) to Perl.
- Add inventory:CountItemEquippedByID(item_id) to Lua.
- Add inventory:HasItemEquippedByID(item_id) to Lua
2022-02-06 13:21:48 -05:00
Chris Miles ee1f0ea91f [Maintenance Script] Pull from different maps mirror for now 2022-02-05 00:34:28 -06:00
KayenEQ 7c20a86f23 escape fix for different target types (#1962) 2022-02-04 21:14:53 -05:00
KayenEQ dbe6adbed0 [Spells] SPA 311 SE_LimitCombatSkills should prevent focusing of procs even if proc is a 'casted' spell. (#1961)
* proc limiter update

* Update spdat.h

* [Spells] SPA 311 SE_LimitCombatSkills should prevent focusing of procs even if proc is a 'casted' spell.
2022-02-04 21:14:40 -05:00
KayenEQ d300e78b39 [Spells] Illusions will now persist onto the corpse when mob is killed. (#1960)
* illusion applies to corpse

* Update spell_effects.cpp

* [Spells] Illusions will now persist onto the corpse when mob is killed.

addressed comments
2022-02-04 21:14:29 -05:00
Kinglykrab 0400504adc [Bug Fix] NPC::CountItem and Corpse::CountItem 0 Charge Item Fix. (#1959)
- Fixes an issue where 0 charged or out of charge items do not count towards the return value.
2022-02-04 06:07:46 -05:00
KayenEQ 5ce2889210 [Bug Fix] Illusions will now properly display armor to other clients when they zone in. (#1958)
* Fix for illusion wear change

On zone in, mobs with illusions were not displaying correct armor.

* [Bug Fix] Illusions will now properly display armor to other clients when they zone in

better looping
2022-02-03 22:04:15 -05:00
KayenEQ cc0371c16e [Spells] Swarm pet aggro logic fix (#1956)
* temp commit

* swarm pet logic fix

* [Spells] Swarm pet aggro logic fix
2022-02-03 22:00:52 -05:00
Kinglykrab 4e297f3d96 [Commands] #ginfo Cleanup. (#1955)
* [Commands] #ginfo Cleanup.
- Use popup over chat messages.

* Remove leader since GetLeaderName() is wrong.
2022-02-03 18:52:31 -05:00
Kinglykrab e9f48d5fba [Commands] Cleanup #npceditmass command. (#1957)
* [Commands] Cleanup #npceditmass command.
- Cleanup messages and logic.
- Fix crash with SQL format.

* Message change.
2022-02-03 15:25:37 -06:00
KayenEQ 00c41dda8c [Spells] Support for 'HateAdded' spell field to apply negative values to reduce hate. (#1953)
* HateAdded field can be negative

* [Spells] Support for 'HateAdded' spell field to apply negative values to reduce hate.
2022-02-02 21:43:17 -05:00
Kinglykrab 7b235a6ede [Bug Fix] Fix issue where you can set your title to titles you don't have. (#1917)
* [Bug Fix] Fix issue where you can set your title to titles you don't have.

* Fixes.

* Fix missing logic check for HasTitle

Co-authored-by: Natedog2012 <jwalters_06@yahoo.com>
2022-01-29 20:09:02 -06:00
mmcgarvey 58d5983ef1 [Skills] Configurable Exponential Decay Formula for Skill Up (#1887)
* [Skills] Exponential Decay Skill Up Formula

Added an exponential decay skill up formula option.
The current, linear, formula results in negative chances to skill up, which
have been mitigated via a multiplier and minimum of 1%

* [Skills]Configurable Exponential Decay Formala for Skill Up

What this fixes:
The existing formula for determining whether or not to skill up could result
in negative chances, and made an assumption around the number 252.
This would ultimately result in an override that would set the chance to 1.

My fix:
I created 2 new rules:
Character:SkillUpMaximumChancePercentage
Character:SkillUpMinimumChancePercentage

I changed the forumla to:
chance = ((max - min + skill_modification) * (.99^skill)) + min

This results in an exponential decay that starts at skill-modified maximum
and approaches minimum.

I decided that max-min+skill_modification should never be less than min
I also decided to continue to apply the Character:SkillUpModifier rule
post-calculation.  I do not really think this is necessary anymore, given
this new formula, but we can discuss removing it.
I chose 25 and 2 as default maximum and minimum based on feel.

Related method signature fix:

Client::mod_increase_skill_chance was changed to return a double and
accept a double as an input for chance.  This matches the actual data types
provided while calling the method and eliminates some type coersion and
resultant truncation.  Right now, this method doesn't do anything, but in the
future we could implement skill-specific training dummies that accelerate
skill ups.  I deduce that this is the purpose of this method call.

* [Skills]Configurable Exponential Decay Formula for Skill Up

What this fixes:
The existing formula for determining whether or not to skill up could result
in negative chances, and made an assumption around the number 252.
This would ultimately result in an override that would set the chance to 1.

My fix:
I created 2 new rules:
Character:SkillUpMaximumChancePercentage
Character:SkillUpMinimumChancePercentage

I changed the forumla to:
chance = ((max - min + skill_modification) * (.99^skill)) + min

This results in an exponential decay that starts at skill-modified maximum
and approaches minimum.

I decided that max-min+skill_modification should never be less than min
I also decided to continue to apply the Character:SkillUpModifier rule
post-calculation.  I do not really think this is necessary anymore, given
this new formula, but we can discuss removing it.
I chose 25 and 2 as default maximum and minimum based on feel.

Related method signature fix:

Client::mod_increase_skill_chance was changed to return a double and
accept a double as an input for chance.  This matches the actual data types
provided while calling the method and eliminates some type coersion and
resultant truncation.  Right now, this method doesn't do anything, but in the
future we could implement skill-specific training dummies that accelerate
skill ups.  I deduce that this is the purpose of this method call.

* fixup! [Skills]Configurable Exponential Decay Formula for Skill Up

* fixup! [Skills]Configurable Exponential Decay Formula for Skill Up
2022-01-29 20:01:58 -06:00
Paul Coene 7749c626f0 [Bug Fix] Fix issue with mobs summoning PCs into ceilings (#1921) 2022-01-29 19:55:40 -06:00
KayenEQ a6cd0bc33a [Bug Fix] Do not allow /open to be used on traps or auras, causes crash (#1951)
* Update client_packet.cpp

* [Bug Fix] Do not allow /open to be used on traps or auras, causes crash

* [Bug Fix] Do not allow /open to be used on traps or auras, causes crash
2022-01-29 19:54:26 -06:00
Chris Miles cba95851a2 [Combat] Legacy Combat Middleware Affected by PR #1858 (#1939) 2022-01-29 19:47:35 -06:00
KayenEQ 7f5706abcf bard throw while casting (#1937) 2022-01-28 22:07:23 -05:00
KayenEQ 44b8c9203a [Spells] Updates to spell field 'cast not stands' to ignore casting restrictions (#1938)
* test

* complete

* Update effects.cpp

* Update spells.cpp

* Update effects.cpp

* [Spells] Support for bards using Disciplines while casting or /melody.

Support for spell field 'cast not standing' not allow casting from divine aura

* [Spells] Support for bards using Disciplines while casting or /melody.

DA bypass logic for spells with field 'cast_not_standing'

* updates

* stun and mez bypass

* Update spdat.cpp

* Update spdat.cpp

* Update spells.cpp
2022-01-28 22:05:45 -05:00
KayenEQ afdbc0ce80 bug fix for push while rooted (#1949) 2022-01-28 22:05:29 -05:00
Paul Coene e850d80656 [Bug Fix (faction)] Do not award faction if NPC is charmed. (#1945)
* Do not award faction if npc is charmed.

* No faction on kill of charmed mob or questreward of same
2022-01-26 18:17:25 -05:00
Paul Coene b9722c6d28 [Bug Fix] Any use of TempName left old clean_name. (#1946)
* [Bug Fix] Any use of TempName left old clean_name.

* Dunsel change
2022-01-26 17:02:37 -05:00
Kinglykrab 5a7ee28740 [Bug Fix] Fix quest::updatespawntimer() Perl croak. (#1947) 2022-01-26 14:57:18 -06:00
mmcgarvey e4f2aec11e [XTarget] Revert All XTarget Corpse Changes (#1944) 2022-01-23 20:18:38 -06:00
KayenEQ e99c8dafc5 spellbar lock bug fix (#1943) 2022-01-23 20:27:45 -05:00
KayenEQ 936043a53c bind sight pets (#1942) 2022-01-23 20:27:32 -05:00
KayenEQ 3c09448e90 [Spells] NPC spell push should work on rooted mobs. (#1941)
* Update spells.cpp

* [Spells] NPC spell push should work on rooted mobs.

don't push perma or psuedorooted mobs
2022-01-20 12:13:14 -05:00
KayenEQ e09a8f8f8f [Spells] Support for bards using Disciplines while casting or /melody. (#1936)
* test

* complete

* Update effects.cpp

* Update spells.cpp

* Update effects.cpp

* [Spells] Support for bards using Disciplines while casting or /melody.

Support for spell field 'cast not standing' not allow casting from divine aura

* [Spells] Support for bards using Disciplines while casting or /melody.

DA bypass logic for spells with field 'cast_not_standing'
2022-01-19 22:44:17 -05:00
Randy Girard 804f0681a9 [Content Flags] Load the content flags before loading shared data. (#1935) 2022-01-19 12:58:15 -06:00
KayenEQ 71c53cb18b [Spells] Updates and fixes to Target Locked Pets (#1932)
* start of rework

* reworked v2 no timer

* fix

* more mechanics

* Update pets.cpp

* move to pet.cpp

* [Spells] Updates and fixes to Target Locked Pets

* [Spells] Updates and fixes to Target Locked Pets
2022-01-18 21:48:36 -05:00
Natedog2012 176bfc8524 [Bug Fix] Loading pets from database will make unique name to not overlap existing pets with same name in zone (#1933) 2022-01-18 16:43:58 -06:00
KayenEQ 28b1abe1a7 [Bug Fix] Fixes Enchanter AA Doppleganger crash issue (#1931)
* Fix crash bug

* [Bug Fix] Fixes Enchanter AA Doppleganger crash issue
2022-01-17 09:10:37 -05:00
Kinglykrab 3a94132749 [Quest API] Add multiple augment related methods to Perl/Lua. (#1930)
* [Quest API] Add multiple augment related methods to Perl/Lua.
- Add $inventory->CountAugmentEquippedByID(item_id) to Perl.
- Add $inventory->HasAugmentEquippedByID(item_id) to Perl.
- Add $item->ContainsAugmentByID(item_id) to Perl.
- Add $item->CountAugmentByID(item_id) to Perl.
- Add inventory:CountAugmentEquippedByID(item_id) to Perl.
- Add inventory:HasAugmentEquippedByID(item_id) to Perl.
- Add item:ContainsAugmentByID(item_id) to Perl.
- Add item:CountAugmentByID(item_id) to Perl.

* Update inventory_profile.cpp
2022-01-16 18:04:51 -05:00
KayenEQ 5ebbbf647b [Spells] SPA 299 Wake the Dead updates and crash fixes. SPA 306 Army of Dead implemented. (#1929)
* start

* wtd fix v1

* Update aa.cpp

* rework done, army of dead supported

* debugs

* Update aa.cpp

* Update spdat.h
2022-01-16 14:55:51 -05:00
KayenEQ 5f482a9b30 [Combat] Implemented rule for live like Riposte mechanics (#1927)
* Live like Riposte

* [Combat] Implemented rule for live like Riposte mechanics

bot fix
2022-01-15 19:37:47 -05:00
KayenEQ 91aa950304 fix for hasten AA (#1928) 2022-01-15 18:28:21 -05:00
JJ 613066976d [Bug Fix] Update to #1893 (#1926)
* Update to #1893

* Missed bonuses.cpp
2022-01-12 22:04:58 -05:00
mmcgarvey 1a556f4451 [XTarget] Performance Improvement After Corpse Change (#1918)
Removed a conditional that was rendered obsolete by moving the addition of a
mob to the auto haters list to fire after an IsValidXTarget check.  This
made an entity_list call unnecessary.  [zone/client.cpp]

Removed said unnecessary entity_list call.  [zone/client.cpp]

Removed a superfluous call to ProcessXTargetAutoHaters [zone/attack.cpp]
2022-01-12 16:04:18 -06:00
KayenEQ d10145fc6f [Bug Fix] Fix Tradeskill Salvage (#1925) 2022-01-11 18:24:47 -05:00
Kinglykrab f3002d9656 [Commands] Cleanup #who Command. (#1924)
* [Commands] Cleanup #who Command.
- Cleanup messages and logic.
- Add GetAccountStatusMap() and GetAccountStatusName() helpers for account status stuff.
- Use Chat::Who instead of Chat::Magenta so you can more easily see saylinks.
- Add a summon saylink to the list of saylinks so you can summon the player.

* New line.
2022-01-11 06:09:29 -05:00
KayenEQ 59c373bcff Update client_packet.cpp (#1923)
bug fix
2022-01-10 21:22:56 -05:00
Kinglykrab ae8273e0b1 [Commands] #guild create argument count bug fix. (#1920)
- Names with spaces were breaking command.
2022-01-10 17:33:28 -05:00
KayenEQ 10083387b6 [Spells] SPA 193 SE_SkillAttack will no longer trigger procs (#1919)
* fixed

* [Spells] SPA 193 SE_SkillAttack will no longer trigger procs
2022-01-09 08:32:09 -05:00
Chris Miles 7e065ad966 [Docs] Update Readme to reflect new docs 2022-01-08 13:57:31 -06:00
Kinglykrab ffa968f64f [Bug Fix] Disallow multiple augments in same item. (#1916)
- Disallows multiple augments via #augmentitem or otherwise.
- Added ItemInstance::ContainsAugmentByID(item_id) helper method for finding an augment in an item instance.
2022-01-04 17:18:17 -05:00
Natedog2012 6bf5608cf3 [Bug Fix] Add range check to OP_PickPocket (#1912)
* [Bug Fix] Add range check to OP_PickPocket

* Pickpocket distance is 15 constant according to Mackal

* Re-add wiggle room for distance check due to pathing
2022-01-03 22:26:37 -05:00
mmcgarvey 3853c4f150 [Bug Fix] XTarget Changes Causing Crashes (#1915)
* [Bugfix] XTarget Changes Causing Crashes

Added nullptr check when processing XTargetAutoHaters for pet owner.

* [Bugfix] XTarget Changes Causing Crashes

Added another needed sanity check after the nullptr check.

* [Bugfix] XTarget Changes Causing Crashes

Added another check against nullptr.

* [Bugfix] XTarget Changes Causing Crashes

Cleaned up nullptr checks per PR comments.
2022-01-03 22:22:21 -05:00
Chris Miles d6d4c458e7 [Database] Mark titles as a server table so it at least shows up in dumps (#1914) 2022-01-03 14:55:10 -06:00
Natedog2012 26b160c59b [Bug Fix] OP_Taunt checks if we have the skill (#1913) 2022-01-03 14:54:36 -06:00
Akkadius d107ff3069 [Hotfix] Add additional check to IsContentFlagEnabled given refactor from #1909 2022-01-03 01:06:17 -06:00
mmcgarvey 220d8497dd [XTarget] Disallow Corpses in XTarget Auto Slots (#1881)
* [XTarget] Disallow Corpses in XTarget Auto Slots

Why:
There exists an odd state where corpses will fill up your XTarget window.
This is reproducable using a combination of a pet to kill a mob
and timely feign death to wipe the owner's aggro.

What:
Added an IsCorpse check to IsXTarget.
Added a block to mark corpse XTargets as dirty to ProcessXTargetAutoHaters

* fixup! [XTarget] Disallow Corpses in XTarget Auto Slots

* fixup! [XTarget] Disallow Corpses in XTarget Auto Slots

* [XTarget] Disallow Corpses Code Cleanup

Added some safety, performance, and code readability changes per PR request.
2022-01-02 21:07:57 -06:00
Kinglykrab 645251992d [Bug Fix] Remove possible Duel exploit. (#1911)
* [Duels] Cleanup duel response/request logic.

* Fixes and function name cleanup.

* Patch file name changes.
2022-01-02 21:06:31 -06:00
Chris Miles 9815f50efa [Expansion] Content Filtering Adjustments (#1910)
* Change default expansion values for ALL to -1 from 0

* Adjust content_filter_criteria

* Refactor content filtering logic

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

* Formatting

* Editor oops
2022-01-02 20:52:29 -06:00
Kinglykrab c0f57bed1f [Bug Fix] Cleanup Perl croaks for Spire parser. (#1908)
- Client::SendToInstance()
- Mob::DeleteBucket()
- Mob::GetBucket()
- Mob::GetBucketExpires()
- Mob::GetBucketRemaining()
- Mob::SetBucket()
2021-12-30 19:47:52 -06:00
j883376 d280d54446 [Spells] Allow GMs to remove buffs from any target (#1907) 2021-12-30 19:40:14 -06:00
Kinglykrab c99c5c1f1c [Bug Fix] Fix #guild rename, #killallnpcs, and #worldwide message errors. (#1904)
- #guild rename was checking argument count and not allowing you to rename guilds to names that had spaces.
- #killallnpcs was crashing zones when used sometimes due to getting a nullptr somewhere in the loop.
- #worldwide message was using just the first word of the message sent using the command, not all of them.
2021-12-29 12:06:51 -05:00
Natedog2012 e45f02af95 [Skills] RoF+ allows other classes to have feign death if set in skill_caps (#1902) 2021-12-29 11:17:31 -05:00
KayenEQ 323b35989c [Spells] Implemented SPA 281 SE_PetFeignMinion (#1900)
* start

* update

* debugs in

* test

* clean up

* debugs removed

* Update mob_ai.cpp

* Update spdat.h

* [Spells] Implemented SPA 281 SE_PetFeignMinion

debug remoevd

* [Spells] Implemented SPA 281 SE_PetFeignMinion

npc forget timer

* [Spells] Implemented SPA 281 SE_PetFeignMinion
2021-12-27 11:33:57 -05:00
Kinglykrab 7f23c93ce5 [Commands] Cleanup #setadventurepoints Command. (#1901)
- Cleanup message and logic.
2021-12-24 13:46:17 -05:00
Chris Miles 6a7782ab8d [Doors] Ignore Doors that Have Non-Zero Trigger or Door Param (#1899) 2021-12-23 14:47:24 -06:00
mmcgarvey 5457f30659 [Spells] Instant Heals honor IgnoreSpellDmgLvlRestriction (#1888)
Why:
Heal Over Time spells honor the Spells:IgnoreSpellDmgLvlRestriction rule,
shouldn't instant heals honor this rule too?

The fix:
Added a check for Spells:IgnoreSpellDmgLvlRestriction in the GetActSpellHealing
method.
2021-12-23 14:43:02 -06:00
KayenEQ 652ea89dea [Rule] Added rule to disable SPA 173 from making player immune to enrage. (#1897)
* immune enrage rule

* [Rule] Added rule to disable SPA 173 from making player immune to enrage.

spelling oops
2021-12-23 14:21:46 -06:00
mmcgarvey c79fbb99aa [Shared Tasks] Cross Zone Remove Fix (#1740)
* [Shared Tasks] Cross Zone Remove Fix

Why:
	The cross_zone_remove_task quest methods were not removing from
	shared_task_members database table and were not clearing shared task
	cache.  This resulted in a situation where a character could not
	request other shared tasks.

What:
	Shamelessly copied shared task logic from ClientTaskState::CancelTask
	into ClientTaskState::RemoveTaskByTaskID

* What:

Instead of copying code from CancelTask into RemoveTaskByTaskID, it is better
for code maintenance to simply call CancelTask from RemoveTaskByTaskID.
This is cleaner.

Note:  I chose to be explicit with the remove_from_db parameter, despite true
being the default.  I tend to do this to protect from the default value
changing in the future.

* [Shared Tasks] RemoveTaskByTaskID Cleanup

Removed unused variables.
Distinguished log messages for Shared Tasks from regular Tasks.
2021-12-23 14:20:15 -06:00
Paul Coene 4f0e9945c6 [Combat] Allow npcs/pets to kick vs opponents requiring magic weapons if wearing magic booties. (#1868)
* [Pets/NPC Kick] Allow pets/npcs kick vs mobs that req magic if using magic boots

* Backout accidental change to bash
2021-12-23 14:01:56 -06:00
mmcgarvey 4fbb98a5f7 [Skills] Make Tracking Skill Configurable (#1784)
Added 1 rule per class that defines tracking distance multiplier for that class
Kept the defaults of 12 for ranger, 10 for druid, and 7 for bard

Created 1 method for determining class tracking distance multiplier
Created 1 method for determining if a class can track, based on multiplier

Updated tracking logic to use these methods to determine whether a tracking
packet should and can be sent or not.
2021-12-23 13:57:53 -06:00
Paul Coene 8c78a19c95 [Bug Fix] Pick Lock was allowing skillups on doors above player skill (#1815)
* [Bux Fix] Pick Lock was allowing skillups on doors above player skill

* Fixed indentation

* Fix indentation #2 - I am not so bright :(

* Further refine messages for pick lock to match live

* sql to make pot pick locks book pickable by skill 1 and skillup
2021-12-23 13:56:06 -06:00
Kinglykrab 6a77764f8b [Commands] Cleanup #guild Command. (#1880)
- Cleanup messages and logic.
- Adds GetGuildNameByID, GetGuildRankName, GetGuildIDByCharacterID, and IsCharacterInGuild helper methods for guild stuff.
- Convert #guild info message to a popup display to tidy it up and make it more legible.
2021-12-23 13:04:26 -05:00
Natedog2012 d0ec0872b9 Client will give 1 second window to start casting at the end of DA effect but we interrupt it and need to allow spellbar active after (#1894) 2021-12-22 22:35:48 -06:00
Kinglykrab 724d47432b [Bug Fix] Fix Perl Croak for GetEnt() (#1898) 2021-12-22 15:27:25 -05:00
KayenEQ f26d56d6d5 validspell check (#1895) 2021-12-21 09:17:35 -05:00
KayenEQ 886b321e66 [Spells] Rework of SPA 288 SE_SkillAttackProc (#1893)
* start

* updated 288
2021-12-20 09:47:32 -05:00
Natedog2012 85971590c8 Re-enable spellbar and reset Discipline timer when stopping casts in EVENT_CAST_BEGIN (#1891) 2021-12-19 15:17:04 -06:00
KayenEQ 898b1ea4d1 Update attack.cpp (#1892) 2021-12-16 07:23:11 -05:00
KayenEQ d460fb3db8 [Spells] Update to SPA 440 SE_FinishingBlowMaxLevel limit value sets HP ratio for FB (#1890)
* fb max level update

* Update to SPA 440 SE_FinishingBlowMaxLevel limit value sets HP ratio for FB
2021-12-15 22:00:34 -05:00
Paul Coene fbc5d045de [Doors] Add new rule enabling classic "key on cursor" for pre keyring keys (#1869) 2021-12-15 13:26:31 -05:00
KayenEQ 3414d3a1ae fearstun update (#1889) 2021-12-15 13:17:15 -05:00
mmcgarvey feed584a41 [Database] Escape reserved mysql keyword rank w/ backticks (#1862)
Fixes #1567
2021-12-14 13:57:35 -05:00
KayenEQ 119b2d023f [Spells] Throwing procs fixed and other proc updates (#1871)
* first updating sbindex defines

* updates

* updates

* proctypes added for organization

* debug

* updates

* range procs cleaned up

* skill proc clean up

* fix

* remove debugs

* [Spells] Throwing procs fixed and other proc updates

* [Spells] Throwing procs fixed and other proc updates

bot fix

* [Spells] Throwing procs fixed and other proc updates

proctype updates
2021-12-14 12:34:51 -05:00
KayenEQ 73acc3310c [Spells] Updates and fixes to targeted focus effects (#1870) 2021-12-14 12:31:38 -05:00
KayenEQ 6da7116c66 [Bug Fix] Hero Forge armor graphics not displaying properly to other clients in zone. (#1883)
* fix part1

* updates

* Update inventory.cpp

* fixed

* Update inventory.cpp

* update

* [Bug Fix] Hero Forge armor graphics not displaying properly to other clients in zone.
2021-12-14 11:26:59 -05:00
KayenEQ 26b21673ad [Spells] Implemented SPA 245 SE_TrapCircumvention (#1885)
* implemented

* [Spells] Implemented SPA 245 SE_TrapCircumvention
2021-12-13 20:33:22 -05:00
KayenEQ ef1f6adf18 effective casting level update (#1886) 2021-12-13 20:32:25 -05:00
KayenEQ 1c2e1ea228 rampage updates (#1882) 2021-12-13 18:49:53 -05:00
KayenEQ 7cf66a2daa [Spells] Update SPA 238 SE_IllusionPersistence allow illusions to persist through deaths at higher AA ranks. (#1884)
* start

* working
2021-12-13 18:49:33 -05:00
KayenEQ 91c958ae63 Update spell_effects.cpp (#1877)
updated
2021-12-12 13:22:43 -05:00
KayenEQ 8de410ebb7 [Features] Appearance Effects will now be sent to clients upon zone in. GM commands. (#1874)
* start

* working

* Update perl_mob.cpp

* updates

* Update perl_mob.cpp

* illusion behavior

* rework start

* fix later

* Update mob.cpp

* rework

* updates

* Update mob.cpp

* update

* gm command updates

* updates

* Update CMakeLists.txt

* [Features] Appearance Effects will now be sent to clients upon zone in. GM commands.

remove debugs

* [Features] Appearance Effects will now be sent to clients upon zone in. GM commands.

perl fix

* [Features] Appearance Effects will now be sent to clients upon zone in. GM commands.

space fix

* [Features] Appearance Effects will now be sent to clients upon zone in. GM commands.

minor fix

* Update CMakeLists.txt

* [Features] Appearance Effects will now be sent to clients upon zone in. GM commands.

cleaned up some inconsistency

* [Features] Appearance Effects will now be sent to clients upon zone in. GM commands.
2021-12-10 13:46:23 -05:00
KayenEQ 550485ba33 [Spells] Fixed issue with permanent Illusions not being consistent when zoning. (#1876)
* start of work

* updates

* [Spells] Fixed issue with permanent Illusions not being consistent when zoning.
2021-12-10 12:21:19 -05:00
KayenEQ eb2b4fd9e0 [Spells] Update to SPA 58 SE_Levitate to support limit value (#1875)
* [Spells] Update to SPA 58 SE_Levitate to support limit value

* [Spells] Update to SPA 58 SE_Levitate to support limit value

apply same on zone in
2021-12-10 12:20:25 -05:00
Natedog2012 42f439c4b7 [Quest API] Add ResetCastbarCooldownBySlot / ResetCastbarCooldownBySpellID / ResetAllCastbarCooldowns (#1873)
* New function to reset spellbar in perl/lua ResetCastbarCooldownsBySlot -1 for all slots and anything else to do it by slot number

* Add ResetCastbarCooldownsBySlot / ResetCastbarCooldownsBySpellID / ResetAllCastbarCooldowns
2021-12-08 21:39:35 -06:00
Kinglykrab 294e51fca7 [Commands] Add #setaltcurrency Command. (#1850)
* [Commands] Add #setaltcurrency Command.
- Add #setaltcurrency [Currency ID] [Amount] command to allow you to set a specific alternate currency to a value.
- Add Zone::GetCurrencyID() and Zone::GetCurrencyItemID() helper methods.
- Cleanup loops through zone->AlternateCurrencies.
- Utilize helper methods where necessary.
- Convert old methods parameters and return values from int to uint32 where necessary.

* Typo.
2021-12-08 18:58:06 -05:00
Kinglykrab 94166e0f95 [Commands] Add #unmemspell and #unmemspells Commands. (#1867)
- Add #unmemspell [Spell ID] command to unmemorize a spell by ID from you or your target.
- Add #unmemspells command to unmemorize all spells from you or your target.
- Cleanup #memspell command and change arguments from #memspell [Slot] [Spell ID] to #memspell [Spell ID] [Spell Gem] for easier use.
- Add #memspell [Spell ID] functionality to memorize to first open spell gem if there are any using FindEmptyMemSlot helper method.
- Rename client->FindMemmedSpellByID(spell_id) to FindMemmedSpellBySpellID(spell_id).
- Add client->FindEmptyMemSlot() helper method.
- Add $client->FindEmptyMemSlot() to Perl.
- Add client:FindEmptyMemSlot() to Lua.
- Add $client->FindMemmedSpellBySpellID(spell_id) to Perl.
- Add client:FindMemmedSpellBySpellID(spell_id) to Lua.
2021-12-08 18:18:14 -05:00
Kinglykrab 1a1c3abc24 [Commands] Cleanup #setstartzone Command. (#1853)
- Add a message when setting start zone.
- Cleanup logic.
2021-12-08 18:18:06 -05:00
Natedog2012 0f4f5d7046 RemoveAllAppearanceEffects sends all relevant data so NPC appearance doesn't get altered. (#1864) 2021-12-07 15:15:28 -05:00
Kinglykrab 8ec4afe721 [Commands] Cleanup #wpinfo Command. (#1866)
- Cleanup message and logic.
- Only display grid/waypoints if NPC has a grid.
2021-12-04 21:53:29 -05:00
Kinglykrab aa4536e1ef [Quest API] Add GetLDoNThemeName() to Perl/Lua. (#1861)
* [Quest API] Add GetLDoNThemeName() to Perl/Lua.
- Add quest::getldonthemename(theme_id) to Perl.
- Add eq.get_ldon_theme_name(theme_id) to Lua.

* Update embparser_api.cpp
2021-12-03 19:53:00 -05:00
Kinglykrab 01a671918a [Quest API] Add GetBodyTypeName() to Perl/Lua. (#1863)
* [Quest API] Add GetBodyTypeName() to Perl/Lua.
- Add GetBodyTypeName() and GetBodyTypeMap() helper methods.
- Add quest::getbodytypename(bodytype_id) to Perl.
- Add eq.get_body_type_name(bodytype_id) to Lua.

* ShowStats() cleanup.
2021-12-03 19:52:42 -05:00
KayenEQ e09f28c62c [Spells] Update to SPA 296 and 483 item and AA support (#1857)
[Spells] Update to SPA 296 and 483 item and AA support
2021-12-03 15:39:21 -05:00
KayenEQ 82000949e3 [Spells] Update to SPA 297 and 484 to support focus from AA and items. (#1858)
[Spells] Update to SPA 297 and 484 to support focus from  AA and items.
2021-12-03 15:39:06 -05:00
Kinglykrab 4a154686e1 [Quest API] Add GetFactionName() to Perl/Lua. (#1859)
* [Quest API] Add GetFactionName() to Perl/Lua.
- Add quest::getfactionname(faction_id) to Perl.
- Add eq.get_faction_name(faction_id) to Lua.

* Update embparser_api.cpp

* Update embparser_api.cpp

* Update embparser_api.cpp
2021-12-02 10:09:15 -05:00
Kinglykrab 29dfe9d404 [Quest API] Add GetLanguageName() to Perl/Lua. (#1860)
- Add quest::getlanguagename(language_id) to Perl.
- Add eq.get_language_name(language_id) to Lua.
2021-12-01 20:31:20 -05:00
Kinglykrab 9a0c98397e [Bug Fix] Charm Break Invisibility Fix. (#1855)
- Invisibility vs. Undead and Invisibility vs. Animals were not breaking charm.
- Add Invisibility enumerator.
- Add special identifier for Invisibility vs. Undead and Invisibility vs. Animals.
2021-12-01 12:01:19 -05:00
KayenEQ bc0795bb48 [Spells] SPA 310 SE_ReduceReuseTimer will now work on spell recast time (#1856)
* [Spells] SPA 310 SE_ReduceReuseTimer	will now work on spell recast time

[Spells] SPA 310 SE_ReduceReuseTimer	will now work on spell recast time

* [Spells] SPA 310 SE_ReduceReuseTimer will now work on spell recast time

[Spells] SPA 310 SE_ReduceReuseTimer will now work on spell recast time
2021-12-01 00:22:10 -06:00
JJ d972183a79 [Cleanup] holdzones not used. (#1852)
Fixes #1116.
2021-11-28 22:35:52 -05:00
Natedog2012 f70b4a79b2 SetPetID after we assign the new NPC an ID (#1851) 2021-11-28 15:42:42 -06:00
Kinglykrab 7cac2e2bc3 [Commands] Add #viewcurrencies Command. (#1844)
* [Commands] Add #viewcurrencies Command.
- Add #viewcurrencies command to view your or your target's currencies (Money, Crystals, Alternate Currency, LDoN, and PVP).
- Add GetLDoNThemeName() helper method.

* Update viewcurrencies.cpp

* Cleanup name of map method.

* Cleanup.
2021-11-28 00:09:07 -05:00
Kinglykrab 2be1321aa9 [Commands] Add #removeitem Command. (#1847)
- Add #removeitem [Item ID] [Amount] command to remove items by amount versus nuking them all, removes all if amount is greater than what you or your target have.
2021-11-27 21:41:54 -05:00
Kinglykrab ba5bb09af7 [Commands] Cleanup #flymode Command. (#1845)
- Cleanup message and logic.
- Add GetFlyModeName() and GetFlyModeMap() helper methods.
- Cleanup #npcedit flymode to use helper methods.
2021-11-27 21:39:54 -05:00
Kinglykrab 5ab9b941e2 [Commands] Cleanup #titlesuffix Command. (#1834)
- Cleanup message and logic.
2021-11-27 21:29:56 -05:00
Kinglykrab d28f902ecc [Commands] Add #countitem Command. (#1842)
* [Commands] Add #countitem Command.
- Add #countitem [Item ID] command to count an item by ID on yourself or your player/NPC target.

* Cleanup.
2021-11-27 20:52:09 -05:00
Kinglykrab fd862d16bb [Commands] Cleanup #mysql Command. (#1837)
* [Commands] Cleanup #mysql Command.
- Cleanup messages and logic.

* Update mysql.cpp
2021-11-27 20:32:21 -05:00
Kinglykrab a6e5534b64 [Commands] Cleanup #texture Command. (#1835)
* [Commands] Cleanup #texture Command.
- Cleanup message and logic.

* Update command.cpp
2021-11-27 20:21:58 -05:00
Kinglykrab 225497337c [Commands] Add #setendurance Command. (#1841)
- Add #setendurance [Endurance] command to set an NPC or player's endurance to a specified amount, or to max if the amount is greater than their max.
- Cleanup #endurance command message and logic.
2021-11-27 19:08:07 -05:00
Kinglykrab a5348e207b [Commands] Add #sethp Command. (#1840)
- Add #sethp [Health] command to set an NPC or player's health to a specified amount, or to max if the amount is greater than their max.
- Cleanup #heal command message and logic.
2021-11-27 19:08:00 -05:00
Kinglykrab c4c5256438 [Commands] Add #setmana Command. (#1839)
* [Commands] Add #setmana Command.
- Add #setmana [Mana] command to set an NPC or player's mana to a specified amount, or to max if the amount is greater than their max.
- Cleanup #mana command message and logic.

* Update mana.cpp
2021-11-27 19:07:47 -05:00
Kinglykrab b3b9899a23 [Commands] Cleanup #movechar Command. (#1838)
- Cleanup messages and logic.
- Add support for Zone ID versus Zone Short Name.
- Add support for Character ID versus Character Name.
2021-11-27 19:06:40 -05:00
Kinglykrab 7d1d385418 [Commands] Cleanup #gmzone Command. (#1836)
- Cleanup messages and logic.
- Add support for Zone ID.
2021-11-27 18:19:03 -05:00
Kinglykrab 96cdf1b076 [Commands] Cleanup #title Command. (#1833)
- Cleanup message and logic.
2021-11-27 18:18:27 -05:00
KayenEQ 8688e9c9fa [Spells] Eye of Zomm will now despawn and stack properly (#1849)
* [Spells] Eye of Zomm stop chain spawning

No more chain spawning.

* [Spells] Eye of Zomm stop chain spawning

* [Spells] Eye of Zomm update
2021-11-27 12:11:23 -05:00
KayenEQ 6a28828e08 [API] mob->AppearanceEffects improved functionality. (#1821)
* appearanceffectscript

* update

* debugged

* [API] SendAppearanceEffect update

* [API] SendAppearanceEffect update

* [API] SendAppearanceEffect Upates

perl method RemoveAppearanceEffect to remove the apperanceeffect

* [API} AppearanceEffects update

* [API] SendAppearanceEffects update
2021-11-27 12:10:08 -05:00
Natedog2012 8566662d56 [Bug Fix] SendSpellBarEnable sends correct slotid to fix spellbar on RoF2 (#1848)
* SendSpellBarEnable sends correct slotid to fix spellbar on RoF2

* Send correct data when using StopCasting() to re-enable spellbar
2021-11-27 09:45:57 -05:00
Kinglykrab 298ae3e3ba [Bug Fix] Fix possible crash with #killallnpcs. (#1846) 2021-11-27 09:45:13 -05:00
Michael Cook (mackal) 4507b063f5 Switch server to use new style ManaChange_Struct (#1843)
This will allow us to fix some bugs the current handling has.

Note: the decoder isn't needed since the client always sends it up as a
0 length packet.
2021-11-26 21:33:49 -05:00
Natedog2012 774e0c7faa Do not set teleport doors to Open (#1786) 2021-11-26 15:26:07 -06:00
Kinglykrab 8b54bb34e4 [Commands] Cleanup #gmspeed Command. (#1831)
* [Commands] Cleanup #gmspeed Command.
- Cleanup message and logic.

* Update gmspeed.cpp

* Update gmspeed.cpp
2021-11-26 13:56:45 -05:00
Kinglykrab e87b8e2682 [Commands] Cleanup #gender Command. (#1832)
- Cleanup message and logic.
- Cleanup other spots using similar logic so they're all uniform.
2021-11-26 10:01:35 -05:00
Kinglykrab 2dc3ca52db [Commands] Cleanup #gm Command. (#1830)
- Cleanup message and logic.
- Cleanup SetGM() message.
2021-11-26 10:01:13 -05:00
Kinglykrab 514029a6bb [Commands] Cleanup #bind Command. (#1829)
- Add message and cleanup logic.
2021-11-26 10:01:04 -05:00
Kinglykrab b29f398239 [Commands] Cleanup #getplayerburiedcorpsecount Command. (#1818)
* [Commands] Cleanup #getplayerburiedcorpsecount Command.
- Cleanup message and logic.

* Update command.cpp
2021-11-25 21:01:23 -05:00
Kinglykrab e474b2a280 [Commands] Add #petitems Command. (#1823)
- Add #petitems command to show a person's pet items if they have access to the command.
- Adds a default false parameter to QueryLoot for NPCs that keeps messages and logic from being ran on pets for no reason.
- Cleaned up message a bit for loot and stuff.
- Remove check for loottable ID when using #npcstats for NPCs that get items from a script or otherwise.
2021-11-25 14:50:05 -05:00
Kinglykrab d38b8a4867 [Bug Fix] Fix possible crash in #givemoney. (#1828) 2021-11-25 13:55:06 -05:00
KayenEQ 1a5f48521d [Bug Fix] Bind Sight will now function properly (#1825)
* start

* bind sight fixed

* Update spdat.h

* Update spells.cpp

* Search or jump to… Pull requests Issues Marketplace Explore   @KayenEQ  EQEmu / Server Public 60 338 290 Code Issues 106 Pull requests 11 Actions Projects 1 Wiki Security Insights [Bug Fix] Bind Sight will now function properly #1825  Open KayenEQ wants to merge 4 commits into EQEmu:master from KayenEQ:bindsightfix2  Open [Bug Fix] Bind Sight will now function properly
2021-11-25 10:16:28 -05:00
KayenEQ ba427c64ba [Bug Fix] Numhits now display instantly on cast. (#1826) 2021-11-25 08:33:39 -05:00
KayenEQ 9d59b3def4 [Spells] Bard AA clicks should not receive song modifiers. (#1824) 2021-11-25 08:32:46 -05:00
KayenEQ a6f5bf72be Update spell_effects.cpp (#1822) 2021-11-24 19:43:43 -05:00
KayenEQ 6ff7f7aa53 [API] mob->SpellEffect small perl fix (#1820)
* Update perl_mob.cpp

* Update perl_mob.cpp
2021-11-24 12:48:23 -05:00
Kinglykrab 1a2897c423 [Commands] Cleanup #disablerecipe Command. (#1816)
- Cleanup message and logic.
2021-11-23 21:45:59 -05:00
Kinglykrab 8b5b19ae2c [Commands] Cleanup #enablerecipe Command. (#1817)
- Cleanup message and logic.
2021-11-23 21:45:52 -05:00
Kinglykrab 6fa41a3b73 [Commands] Remove duplicate commands. (#1819) 2021-11-23 19:53:39 -05:00
Kinglykrab 6496690123 [Commands] Cleanup #zsafecoords Command. (#1806)
* [Commands] Cleanup #zsafecoords Command.
- Cleanup message and logic.
- Add parameter to allow data to be saved to database.

* Typo.

* Update zsafecoords.cpp

* Update zsafecoords.cpp
2021-11-23 18:25:12 -05:00
Kinglykrab a11482ff23 [Cleanup] Utilize ConvertSecondsToTime() method. (#1805)
* [Cleanup] Utilize ConvertSecondsToTime() method.

* Lowercase.
2021-11-23 18:25:02 -05:00
Kinglykrab 4672e48fbd [Commands] Cleanup #zcolor Command. (#1813)
* [Commands] Cleanup #zcolor Command.
- Cleanup message and logic.
- Add parameter to allow data to be saved to database.

* Update zcolor.cpp
2021-11-23 16:45:31 -05:00
KayenEQ 8f3cce6585 send graphic to target correctly (#1785) 2021-11-23 12:55:58 -05:00
Kinglykrab 8d3a179ecc [Commands] Remove #zuwcoords Command. (#1810)
- Remove duplicate command of #zunderworld
2021-11-23 06:03:09 -05:00
Kinglykrab 2cbcefd9a0 [Commands] Cleanup #zheader Command. (#1814)
* [Commands] Cleanup #zheader Command.
- Cleanup message and logic.
- Add parameter to allow versions to be loaded.
- Cleanup parameter name in CFG methods from instance_id to instance_version.

* Update zonedb.cpp
2021-11-23 05:49:11 -05:00
Kinglykrab ef06a0d0b6 [Commands] Cleanup #zclip Command. (#1812)
* [Commands] Cleanup #zclip Command.
- Cleanup message and logic.
- Add parameter to allow data to be saved to database.

* Cleanup.
2021-11-23 05:48:47 -05:00
Kinglykrab 1935ea60d0 [Commands] Remove #zonespawn Command. (#1811)
* [Commands] Remove #zonespawn Command.
- Remove unimplemented command.

* Remove from CMakeLists.txt.

* Fix.
2021-11-23 05:48:39 -05:00
Kinglykrab 8c7e1be344 [Commands] Cleanup #givemoney Command. (#1804)
- Cleanup money message to use new helper method.
2021-11-22 21:18:04 -05:00
Kinglykrab 9240497cbc [Commands] Cleanup #zsky Command. (#1808)
- Cleanup message and logic.
- Add parameter to allow data to be saved to database.
2021-11-22 21:17:13 -05:00
Kinglykrab 0da4610249 [Commands] Cleanup #zsave Command. (#1807)
* [Commands] Cleanup #zsave Command.
- Cleanup message and logic.

* White.
2021-11-22 21:17:03 -05:00
Kinglykrab 26c7287997 [Commands] Cleanup #zunderworld Command. (#1809)
* [Commands] Cleanup #zunderworld Command.
- Cleanup message and logic.
- Add parameter to allow data to be saved to database.

* Update zunderworld.cpp
2021-11-22 21:16:42 -05:00
Kinglykrab cece66adc6 [Commands] Cleanup #instance Command. (#1803)
* [Commands] Cleanup #instance Command.
- Cleanups message and logic.
- Cleanup ListAllInstances() method.
- Fix day calculation in ConvertSecondsToTime().

* Cleanup.

* Add return.
2021-11-21 19:02:01 -05:00
Kinglykrab d29993fafa [Commands] Cleanup #nukebuffs Command. (#1795)
* [Commands] Cleanup #nukebuffs Command.
- Cleanup messages and logic.
- #nukebuffs now allows you to nuke all, beneficial, or detrimental buffs, also added a help menu.
- Add BuffFadeBeneficial().
- Cleanup logic in some buff fade methods.
- Fix several spots where we were using CalcBonuses() when it was unnecessary, i.e when you fade no buffs you do not need to recalculate bonuses.

* Update spells.cpp
2021-11-21 15:20:16 -05:00
Kinglykrab 39c27c987d [Commands] Cleanup #peqzone Command. (#1794)
- Cleanup messages and logic.
- Add RULE_INT(Zone, PEQZoneHPRatio, 75, "Required HP Ratio to use #peqzone")
- Modify #peqzone Timer rule to allow it to be disabled.
2021-11-21 14:19:08 -05:00
Kinglykrab 5470ec6293 [Commands] Cleanup #corpse Command. (#1790)
- Cleanup message and logic.
- Add ConvertMoneyToString(platinum, gold, silver, copper) helper method.
- Cleanup NPC::QueryLoot() and Corpse::QueryLoot().
2021-11-21 14:02:03 -05:00
Kinglykrab 1acdc6034b [Commands] Cleanup #permagender Command. (#1779)
- Cleanup message and logic.
2021-11-21 14:01:15 -05:00
KayenEQ e9fc80815a [Spells] Support for SPA 161 and 450 to give percent spell or dot mitigation from Items or AA's. (#1793)
* spell dot shield item AA support

* Update spdat.h

* Update attack.cpp
2021-11-21 10:16:55 -05:00
splose a84536cd05 [Bug Fix] Autofire attacking yourself (#1776)
* Fix being able to attack yourself with autofire if Combat:MinRangedAttackDist == 0

* requested changes

* 2
2021-11-21 10:16:20 -05:00
splose 0a34809bb3 [Bug Fix] - Monk AA Spirit of Master Wu (#1775)
* Monk AA Spirit of Master Wu sends message even if it grants 0 extra attacks.

* fomatting + put if statement in wrong place.. oops.

* Need to push something to set up my Tortoise Github Auth

* test

* test

* test

* test

* test

* requested changes

* Update special_attacks.cpp

Co-authored-by: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com>
2021-11-21 10:15:36 -05:00
Kinglykrab 03847fb1ac [Commands] Cleanup #lastname Command. (#1802)
- Cleanup message and logic.
2021-11-21 10:12:47 -05:00
Kinglykrab 8a27fce3a8 [Commands] Cleanup #memspell Command. (#1801)
- Cleanup message and logic.
- Add support for memorizing spell to target if you have GM enabled.
2021-11-21 10:12:37 -05:00
Kinglykrab 6a42639386 [Commands] Cleanup #pvp Command. (#1800)
- Cleanup messages and logic.
2021-11-21 10:12:23 -05:00
Kinglykrab b9214bfdee [Commands] Cleanup #aggro Command. (#1799)
- Cleanup messages and logic.
- Cleanup constant names and references.
- Cleanup aggro description methods.
2021-11-21 10:12:12 -05:00
Kinglykrab 04fda24c8e [Commands] Cleanup #aggrozone Command. (#1798)
- Cleanup message and logic.
- Add the ability to aggro the zone on your target if you have one.
2021-11-21 10:12:02 -05:00
Kinglykrab 446c5d90ec [Commands] Cleanup #killallnpcs Command. (#1797)
- Cleanup message and logic.
2021-11-21 10:11:47 -05:00
Kinglykrab 80f15ed04a [Commands] Cleanup #myskills Command. (#1796)
- Cleanup popup window display and logic.
2021-11-21 10:11:29 -05:00
Kinglykrab 51fb46556d [Commands] Cleanup #setfaction Command. (#1792)
- Cleanup message and logic.
- Doesn't allow you to use invalid faction IDs anymore.
2021-11-21 10:11:03 -05:00
Kinglykrab d73194c1f6 [Commands] Cleanup #setanim Command. (#1791)
- Cleanup message and logic.
- SetAppearance was not sending to self, so if you modified your own appearance, you wouldn't be able to see it.
2021-11-21 10:10:52 -05:00
Kinglykrab ec1cf68ce2 [Commands] Cleanup #damage Command. (#1789)
- Cleanup logic.
2021-11-21 10:08:20 -05:00
Kinglykrab 39b39970f6 [Commands] Cleanup #ginfo Command. (#1788)
- Cleanup message and logic.
2021-11-21 10:03:31 -05:00
Kinglykrab 40edefa6f4 [Commands] Cleanup #camerashake Command. (#1787)
- Cleanup message and logic.
- Fix ConvertSecondsToTime logic for milliseconds.
- Add ConvertMillisecondsToTime inline function.
2021-11-21 10:03:20 -05:00
Kinglykrab 7154d5b841 [Commands] Cleanup #flags Command. (#1783)
- Cleanup message and logic.
2021-11-21 10:03:08 -05:00
Kinglykrab dfe43ce189 [Commands] Cleanup #nukeitem Command. (#1782)
* [Commands] Cleanup #nukeitem Command.
- Cleanup message and logic.

* Typo.
2021-11-21 09:59:07 -05:00
Kinglykrab 69d5fee471 [Commands] Cleanup #givemoney Command. (#1781)
* [Commands] Cleanup #givemoney Command.
- Cleanup message and logic.

* Update givemoney.cpp
2021-11-21 09:58:23 -05:00
Kinglykrab f1d9221b4c [Commands] Cleanup #invul Command. (#1780)
- Cleanup message and logic.
2021-11-21 09:58:13 -05:00
Kinglykrab fb2f901539 [Commands] Cleanup #permarace Command. (#1778)
- Cleanup message and logic.
2021-11-21 09:56:27 -05:00
Kinglykrab 7c12c5d5ef [Commands] Cleanup #permaclass Command. (#1777)
- Cleanup message and logic.
2021-11-21 09:56:10 -05:00
splose 7559732408 [Bug Fix] Frenzy is supposed to use 1H Animation. (#1774) 2021-11-21 01:19:04 -05:00
KayenEQ fac0d795f2 [Bug Fix] Melee Life tap overflowing and causing damage (#1773)
* Update mob.cpp

* Update mob.cpp
2021-11-18 09:10:02 -05:00
Kinglykrab 3efd9c7f60 [Cleanup] Convert DeleteItemInInventory quantity to int16. (#1767)
* [Cleanup] Convert DeleteItemInInventory quantity to int16.

* Type conversion.
2021-11-16 08:52:22 -05:00
Kinglykrab bf8a0328b3 [Cleanup] Add Entity ID to ShowStats() NPC display. (#1770) 2021-11-15 18:19:42 -05:00
Michael Cook (mackal) 0ebb1cc54c Fix linking tests due to ddcb18418 (#1769) 2021-11-15 13:27:01 -05:00
Akkadius a111668888 [Hotfix] Default PR #1758 to false 2021-11-15 04:07:55 -06:00
Chris Miles 0550fcfd3f [GM Commands] Split GM Commands Into Separate Files (#1766)
* Split GM commands into their own files

* Code cleanup
2021-11-14 22:48:47 -06:00
Kinglykrab 293361a1f7 [Cleanup] Make use of AccountStatus constants wherever status is checked or used. (#1764)
* [Cleanup] Make use of AccountStatus constants wherever status is checked or used.
- Cleanup all instances of SendEmoteMessage.
- Cleanup all instances of SendEmoteMessageRaw.
- Cleanup all instances of MessageStatus.
- Convert Quest API method defaults to use constants.

* Cleanup constant names.
2021-11-14 21:01:13 -06:00
Kinglykrab 5d75b7b365 [Commands] Cleanup #advnpcspawn and #npcspawn Commands. (#1754)
* [Commands] Cleanup #advnpcspawn and #npcspawn Commands.
- Cleanup messages and logic.
- Add enum for spawn types to remove magic numbers.
- Cleanup messages that were improper/unused.

* Cleanup.

* Cleanup.

* Cleanup.

* Typo.

* Update command.cpp
2021-11-14 19:58:55 -06:00
Natedog2012 6400e2f8bc [Rules] Add option rule to load AA based on CurrentExpansion rule (#1758)
* Add option rule to load AA based on CurrentExpansion rule

* Default UseCurrentExpansionAAOnly to true

* Only clear the PlayerAA when reloadingAA
2021-11-14 19:54:45 -06:00
JJ 76b0183a0f [Loginserver] Increase IP/hostname size a bit more (#1765) 2021-11-14 19:53:53 -06:00
JJ b3471c51df [Config] Delete extra versions (#1763)
* [Config] Delete extra versions [CI SKIP]

* Same
2021-11-14 19:53:14 -06:00
Kinglykrab b2c86f5571 [Commands] Cleanup #raidloot Command. (#1757)
- Cleanup message and logic.
- Add RaidLootTypes enum and map for names.
2021-11-14 19:50:51 -06:00
Kinglykrab 264c6cb019 [Commands] Cleanup #setcrystals Command. (#1745)
* [Commands] Cleanup #setcrystals Command.
- Add message.
- Increase cap from 100,000 to 2,000,000,000.

* Cleanup.

* Remove condition, ID is always defined.

* Cleanup.
2021-11-14 19:47:36 -06:00
Akkadius 9bcb617f90 [Hotfix] Line ending changes 2021-11-14 15:59:03 -06:00
Kinglykrab f5d37a9959 [Commands] Cleanup #setpvppoints Command. (#1755)
* [Commands] Cleanup #setpvppoints Command.
- Cleanup message and logic.

* Cleanup.
2021-11-14 14:47:25 -05:00
Kinglykrab c44b82500d [Commands] Cleanup #setaaxp Command. (#1751)
* [Commands] Cleanup #setaaxp Command.
- Add message.
- Cleanup logic.

* Update command.cpp

* Cleanup.
2021-11-14 14:47:17 -05:00
Kinglykrab 4f550fcbf3 [Commands] Cleanup #loc Command. (#1752)
- Cleanup message and logic.
2021-11-14 14:09:10 -05:00
Kinglykrab 1103d50733 [Commands] Cleanup #setaapts Command. (#1750)
* [Commands] Cleanup #setaapts Command.
- Cleanup message and logic.
- Increase cap from 5,000 to 2,000,000,000.

* Update command.cpp

* Update command.cpp

* Cleanup.

* Cleanup.
2021-11-14 14:06:57 -05:00
Kinglykrab ddcb184183 [Commands] Cleanup #stun Command. (#1749)
* [Commands] Cleanup #stun Command.
- Cleanup message.
- Add ConvertSecondsToTime() to string_util.h and convert Quest API Methods to use helper.

* Add days to ConvertSecondsToTime() and cleanup logic.

* Cleanup.

* Typo.

* Cleanup.

* Cleanup.
2021-11-14 14:05:44 -05:00
Kinglykrab 90bcc5f03c [Commands] Cleanup #zonelock Command. (#1711)
* [Commands] Cleanup #zonelock Command.
- Add support for Zone IDs.
- Cleanup messages and display.
- Fix dangling pointer in ZoneLongName() helper method so name is displayed properly.

* Add account status enum.

* Typo.

* Typo.

* Convert list to constants.

* Cleanup.

* Update command.cpp

* Fix compile.
2021-11-14 11:32:08 -05:00
JJ 27f8ae3999 [Hotfix] Optional SQL for existing servers (#1756) 2021-11-13 22:15:49 -05:00
JJ 80a891e541 Make room for host names.
Since m_remote_ip_address does not resolve IP address, world server may still use host name.
2021-11-13 20:14:39 -05:00
KayenEQ 776449aa3d [Spells] Update to IsCombatProc checks (#1741)
* Update spells.cpp

* Update spells.cpp

* Update spells.cpp

* Update spells.cpp
2021-11-13 14:47:42 -05:00
JJ cef352f0ac [Bug Fix] Removed unused pointer. Fixes #157. (#1748) 2021-11-13 10:39:35 -05:00
Kinglykrab e8607a0c78 [Commands] Cleanup #checklos Command. (#1744)
- Cleanup message and logic.
2021-11-13 05:25:58 -05:00
Kinglykrab 9c55cf9a8e [Bug Fix] Loginserver Error String Constants. (#1747)
- Constant was named after Windows macro.
2021-11-13 02:00:45 -05:00
Chris Miles a9d1034298 [Loginserver] Worldserver Name Sanitization (#1739)
* Sanitize bad words in server names

* Add config options and enforcement for dev/test servers and servers starting with a special character

* Refine bad word logic

* Add installer to dev/test servers

* Change server prefixes

* Special char prefix

* Formatting

* Remove multi words

* Add server types enum

* Add error constants

* Remove sanitize from world level

* Use strn0cpy
2021-11-12 23:02:05 -06:00
Kinglykrab 8b83a13560 [Rules] Add Archery/Throwing Ammo Consumption Rules. (#1743)
- Add RULE_BOOL(Combat, ArcheryConsumesAmmo, true, "Set to false to disable Archery Ammo Consumption")
- Add RULE_BOOL(Combat, ThrowingConsumesAmmo, true, "Set to false to disable Throwing Ammo Consumption")
2021-11-12 23:04:09 -05:00
hg 3c87480553 [Quest API] Add back removed lua class properties (#1742)
Fixes regression from 7b6decae
2021-11-12 21:16:39 -05:00
Kinglykrab 1a69218045 [Commands] Cleanup #faction Command. (#1716)
* [Commands] Cleanup #faction Command.
- Remove find subcommand as we have #findfaction now.
- Cleanup message.

* Remove #setfaction message.
2021-11-12 18:28:14 -05:00
Kinglykrab e870ee5e0e [Commands] Remove #logtest Command. (#1731)
- Remove unused/deprecated command.
2021-11-12 14:46:05 -06:00
Kinglykrab 908c6c18af [Commands] Cleanup #findnpctype Command. (#1714)
* [Commands] Cleanup #findnpctype Command.
- Cleanup message and logic.

* Logic cleanup, found_count is always greater than 0.

* Fix order.

* Add return.
2021-11-12 09:19:43 -05:00
Kinglykrab f591378ed3 [Commands] Cleanup #viewnpctype Command. (#1713)
* [Commands] Cleanup #viewnpctype Command.
- Create a temporary NPC to use ShowStats() instead.
- Cleanup message.

* Cleanup spawn/emote/textures logic in ShowStats() when unused.

* Formatting.
2021-11-12 08:58:43 -05:00
Kinglykrab 0997a8a31e [Commands] Remove #bug Command. (#1737)
- Remove unused command.
2021-11-12 08:23:22 -05:00
Kinglykrab 0bf6627fb0 [Commands] Remove #crashtest Command. (#1734)
- Remove unused/deprecated command.
2021-11-12 08:19:58 -05:00
Kinglykrab fb8539e679 [Commands] Cleanup #endurance Command. (#1719)
- Add message.
2021-11-12 08:11:45 -05:00
Kinglykrab f8c2e85f3e [Commands] Cleanup #mana Command. (#1718)
* [Commands] Cleanup #mana Command.
- Add message.

* Add self message.
2021-11-12 08:10:43 -05:00
Kinglykrab 110d2a0e10 [Commands] Cleanup #heal Command. (#1717)
* [Commands] Cleanup #heal Command.
- Add message.

* Remove target requirement.

* Add self message.

* Typo.
2021-11-12 08:06:53 -05:00
Kinglykrab 8d9415191a [Commands] Cleanup #reloadquest Command. (#1712)
- Cleanup message and logic.
2021-11-12 07:42:22 -05:00
Kinglykrab 7178a7e55d [Commands] Remove #clearinvsnapshots Command. (#1736)
* [Commands] Remove #clearinvsnapshots Command.
- Remove unused command.

* Web editor conflict fail

Co-authored-by: JJ <3617814+joligario@users.noreply.github.com>
2021-11-12 07:41:46 -05:00
Kinglykrab 9e8d03d92d [Commands] Remove #connectworldserver Command. (#1735)
- Remove unused command.
2021-11-12 05:58:18 -05:00
Kinglykrab f4a70eff43 [Commands] Remove #d1 Command. (#1733)
- Remove unused command.
2021-11-12 05:58:01 -05:00
Kinglykrab f9ec45c7ff [Commands] Remove #ipc Command. (#1732)
- Remove unused command.
2021-11-12 05:57:43 -05:00
Kinglykrab cf8bf9e4fc [Commands] Remove #manastat Command. (#1730)
- Remove unused command.
2021-11-12 05:57:25 -05:00
Kinglykrab 575237d764 [Commands] Remove #mysqltest Command. (#1729)
- Removed unused/deprecated command.
2021-11-12 05:57:09 -05:00
Kinglykrab e12e8df3ef [Commands] Remove #numauths Command. (#1728)
- Remove unused command.
2021-11-12 05:56:50 -05:00
Kinglykrab 8d7b7d6cc4 [Commands] Remove #optest Command. (#1727)
- Remove unused command.
2021-11-12 05:56:32 -05:00
Kinglykrab 6f79ea117c [Commands] Remove #refundaa Command. (#1726)
- Remove unused command.
2021-11-12 05:56:11 -05:00
Kinglykrab 7b022502da [Commands] Remove #qtest Command. (#1725)
- Remove unused command.
2021-11-12 05:55:54 -05:00
Kinglykrab 4a376b7859 [Commands] Remove #testspawn and #testspawnkill Commands. (#1724)
- Remove unused commands.
2021-11-12 05:55:35 -05:00
Kinglykrab 87cdf7feb1 [Commands] Remove #synctod Command. (#1723)
- Remove unused command.
2021-11-12 05:55:06 -05:00
Kinglykrab caf32290b8 [Commands] Remove #sendop Command. (#1722)
- Remove unused command.
2021-11-12 05:54:44 -05:00
JJ 7d495c56b3 [Logs] Show local_address in correct location (#1721) 2021-11-12 05:54:21 -05:00
Kinglykrab dc1c7bb284 [Commands] Remove #serversidename Command. (#1720)
- Remove unused command.
2021-11-12 05:53:44 -05:00
Chris Miles a6c85babfc [Loginserver] Add config option to display player count (#1738)
* [Loginserver] Add config option to display player count

* Update name
2021-11-11 22:38:41 -06:00
hg cbea7045fa [Loginserver] Identify unknown login client packet fields (#1680)
* Add player login reply struct

* Use player login reply struct for failed logins

* Use base message struct for login requests

* Refactor server list reply serialization

Use BaseMessage and BaseReplyMessage structs for server list
and add flags for server type and status

* Use reply message struct for login handshake

Remove client version checks, the packets are the same for titanium and rof2

* Use base headers for join server requests

* Log correct server list ip

* Add compressed flag to base message header

Document encrypt type flag more
2021-11-11 20:13:30 -06:00
KayenEQ 099759c477 [Commands] #tune command rewrite (#1677)
* tune updates

* Update tune.cpp

* tune update

* updates

* updates

* less zero

* update

* up

* u

* Update tune.cpp

* Update tune.cpp

* avoidance working

* accuracy

* save1

* Update tune.cpp

* override

* Removed Old Tune Code

* cleanup1

* up

* finished v1

* Update command.cpp

* Update command.cpp

* spellfix

* Update command.cpp

* remove test command

* added SYNC comments

Hopefully if anyone changes these functions they will change the corresponding tune

* Tune_ to Tune

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-11-11 19:41:59 -06:00
cybernine186 65197ac027 [Rules] Gate /tgb, /autofire and /melody (#1679)
* Rules to negate /tgb, /autofire, and /melody

Created new rules to negate server and client side effects of commands: /tgb, /autofire, and /melody. These commands are enabled by default and can be disabled to enforce a classic EQ experience if using progression style play for example.

Rules
--------------
RULE_BOOL(Character, EnableBardMelody, true, "Enable Bard /melody by default, to disable change to false for a classic experience.")
RULE_BOOL(Character, EnableRangerAutoFire, true, "Enable Ranger /autofire by default, to disable change to false for a classic experience.")
RULE_BOOL(Character, EnableTGB, true, "Enable /tgb (Target Group Buff) by default, to disable change to false for a classic experience.")

* Removed sql query for rules per Mackal recommendation.
2021-11-11 19:41:03 -06:00
Alex e4bd6f5bd2 [Networking] Servertalk Legacy World Connections for Login (#1662)
* servertalk server connections will now attempt to parse legacy connections as well as modern ones

* Some fixes for legacy connections

* Change legacy default from local to eqemu
2021-11-11 19:37:35 -06:00
mmcgarvey acf5836253 [Rules] Add optional rule for lifetap heals (#1689)
What:
	Add toggle for compounding bonuses for lifetap heals.

Why:
	When spell damage and heal amount bonuses are scaled to ludicrous
	levels, this double dip results in very high heals from
	relatively weak lifetaps.

Created new rule:  Spells:CompoundLifetapHeals

If true (default):
	Apply spell damage bonuses to lifetap damage
	Pass that amount through heal bonuses
	Heal for this resulting amount
If false:
	Apply spell damage bonuses to lifetap damage
	Heal for this resulting amount
2021-11-11 19:37:14 -06:00
KayenEQ 17c8e8414c [Spells] Fixed proc rate for Ranged procs (#1715) 2021-11-11 19:27:50 -06:00
KayenEQ 239033a269 [Bug Fix] Prevent critical DOTs from affecting beneficial damage over time (#1710)
* no critical from lich

* better
2021-11-11 18:32:16 -05:00
Kinglykrab fa07064466 [Commands] Cleanup #cvs Command. (#1709)
* [Commands] Cleanup #cvs Command.
- Cleanup message and display.
- Add Total Clients to message.
- Add Unique IPs to message.

* Formatting.

* Formatting.
2021-11-11 16:48:50 -05:00
Kinglykrab 994ef712b2 [Commands] Cleanup #cast Command. (#1706)
* [Commands] Cleanup #cast Command.
- Cleanup message.

* Add optional cast non-instant parameter.
- Fix cast time.

* Fix message.
2021-11-11 16:48:35 -05:00
KayenEQ 33c30d3cbb [Bug Fix] Fix for dual wield animation when same delay weapons. (#1671)
* DW animation fix

* spelling

* better animation

looks better for low skill where dw doesn't fire as often.

* Update attack.cpp
2021-11-10 21:27:51 -05:00
KayenEQ d9c8e80bca [Spells] Allow item click effects to have cast time and recast time modified by focus effects. (#1695)
* prelim

* Spell Focus implemented

* AA implemented

* Update spdat.h

* Update spdat.h

* working

* Update spells.cpp

* prelim excludes

* enum limit expansion

* overhaul

* v2 testing

* updates

* working

* Fin

* Update spell_effects.cpp

* Update spell_effects.cpp

* update

* Update spells.cpp

* fix

* fix

* Update spell_effects.cpp

* remove debugs

* Update spells.cpp
2021-11-10 21:23:49 -05:00
Kinglykrab 990729fe21 [Commands] Cleanup #distance Command. (#1707)
- Cleanup message.
2021-11-10 21:21:06 -05:00
Kinglykrab aac0dd2993 [Commands] Cleanup #setlanguage Command. (#1705)
* [Commands] Cleanup #setlanguage Command.
- Cleanup message and lofic.
- Add GetLanguageName() helper and GetLanguageMap() for future use.

* Optimize GetLanguageName().
2021-11-10 21:20:51 -05:00
Kinglykrab b17c24d2df [Commands] Cleanup #setskill Command. (#1704)
* [Commands] Cleanup #setskill Command.
- Cleanup message and logic.

* Optimize GetSkillName().
2021-11-10 21:20:40 -05:00
Kinglykrab 32d606c667 [Bug Fix] Fix Mob::ShowStats() Proximity Display. (#1708) 2021-11-10 19:48:02 -05:00
Kinglykrab 6661672e2d [Commands] Cleanup #showskills Command. (#1698)
* [Commands] Cleanup #showskills Command.
- Cleanup display and use GetSkillName() helper method.

* Add optional "all" parameter to show all skills.

* Formatting.

* Formatting.

* Target, not c.
2021-11-09 23:24:46 -05:00
Kinglykrab b5391b9110 [Commands] Cleanup #showstats Command. (#1700)
- Convert Mob::ShowStats() to use the #npcstats code and make #npcstats use Mob::ShowStats().
2021-11-09 21:25:42 -05:00
Kinglykrab e306059f43 [Commands] Cleanup #showspellslist Command. (#1703)
- Cleanup messages and display.
2021-11-09 21:24:34 -05:00
Kinglykrab a64e326c68 [Commands] Cleanup #viewzoneloot Command. (#1702)
- Cleanup message logic.
2021-11-09 21:24:25 -05:00
Kinglykrab 605b3d3a27 [Commands] Cleanup #fov Command. (#1701)
- Cleanup message.
2021-11-09 21:24:17 -05:00
Kinglykrab 248e6d44db [Commands] Cleanup #npccast Command. (#1699)
- Cleanup messages and display.
2021-11-09 21:23:48 -05:00
Kinglykrab 328a94e2d4 [Commands] Add #findfaction Command. (#1697)
- Add #findfaction [search criteria] command.
- Cleanup other #find command messages/logic.
- Add GetMaxFaction() helper method.
- Add races.h defines for races 725-732.
2021-11-09 21:23:38 -05:00
Michael Cook (mackal) 211196a722 Fix Channel TellEcho issues (#1676)
These were missed switching them to TellEcho from a previous change
2021-11-09 10:54:54 -05:00
Kinglykrab 0b283e60db [Commands] Remove #listnpcs Command. (#1696)
- Unused command.
2021-11-07 18:32:33 -05:00
Kinglykrab 90871cb3d9 [Commands] Cleanup #worldshutdown Command. (#1694)
- Cleanup system messages and magic numbers.
2021-11-07 17:21:42 -05:00
Kinglykrab bf92845a4a [Rules] Add Resurrection Sickness rules for Characters/Bots. (#1692)
* [Rules] Add Resurrection Sickness rule for Characters/Bots.
- Add RULE_BOOL(Character, UseResurrectionSickness, true, "Use Resurrection Sickness based on Resurrection spell cast, set to false to disable Resurrection Sickness.")
- Add RULE_BOOL(Bots, UseOldRaceRezEffects, false, "Older clients had ID 757 for races with high starting STR, but it doesn't seem used anymore")
- Add RULE_BOOL(Bots, UseResurrectionSickness, true, "Use Resurrection Sickness based on Resurrection spell cast, set to false to disable Resurrection Sickness.")

* Add rules for spell IDs.

* Fix bot health on spawn when resurrection sickness is disabled.
- Formatting.

* Remove 'this' keyword.
2021-11-07 17:21:34 -05:00
Kinglykrab f8cbc2faed [Commands] Further implement #worldwide functionality. (#1693)
- Add #worldwide remove [Spell ID] - Removes a spell from player buffs worldwide.
- Add #worldwide message [Message] - Sends a worldwide message in Chat::Yellow.
- Add #worldwide move [Zone ID] or #worldwide move [Zone Short Name] - Moves every player in the game to the specified zone.
- Add #worldwide moveinstance [Instance ID] - Moves every player in the game to the specified instance.
- All but `#worldwide message` send a message to sender client.
2021-11-07 17:21:22 -05:00
Kinglykrab 30fdb18945 [Bug Fix] Fix Elemental Illusion spells not using proper texture. (#1691) 2021-11-07 17:21:04 -05:00
Kinglykrab 062fb73f03 [Commands] Remove #test, #spon, and #spoff Commands. (#1686)
- These commands are unused or outdated.
2021-11-07 17:20:55 -05:00
Kinglykrab 194c71727d [Commands] Cleanup #npcstats Command. (#1690)
- Cleanup menu and add stats that were not there before.
- Only display some data if necessary (i.e only show loot/money if they have loot/money)
- Add skill name helper method.
- Add faction name helper method.
- Add Charmed stats and other getter methods.
- Cleanup QueryLoot() method.
2021-11-07 17:20:43 -05:00
Kinglykrab e1de3d2ae0 [Commands] Cleanup #zstats Command. (#1687)
- Add new data from NewZone_Struct to command and clean up display.
2021-11-07 17:15:03 -05:00
KayenEQ 7f497f9d32 [Spells] Implemented SPA 415 SE_FFItemClass (#1688)
* prelim

* Spell Focus implemented

* AA implemented

* Update spdat.h

* Update spdat.h

* prelim excludes

* enum limit expansion

* overhaul

* v2 testing

* updates

* working

* Fin

* Update spell_effects.cpp

* Update spell_effects.cpp

* var fix

* Update spell_effects.cpp

make it not apply to casted spells... oops

* Update spell_effects.cpp

* Update spell_effects.cpp
2021-11-07 16:35:30 -05:00
KayenEQ 1cdb1816a2 [Bug Fix] SOF+ clients item click recast timer not met check (#1682)
* Update client_packet.cpp

* Update spells.cpp

* augs working too
2021-11-06 23:14:36 -04:00
Kinglykrab bc82b897c5 [Commands] Add #emptyinventory Command. (#1684)
* [Commands] Add #emptyinventory Command.
- Allows you empty you or your target's inventory completely. (Equipment, General, Bank, and Shared Bank)
- Fixed an issue not allowing quest::removeitem(item_id, quanity) to remove 0 charge items.
- Fixed an issue not allowing eq.remove_item(item_id, quanity) to remove 0 charge items.

* Update command.cpp

* Update client.cpp
2021-11-06 22:34:04 -04:00
hg beb4de0b45 [Cleanup] Remove unused door variable. (#1685) 2021-11-06 21:57:05 -04:00
KayenEQ 785926a584 [Quest API] Added NPC special ability to modify Riposte/Dodge/Parry/Block chance (#1683)
* Update attack.cpp

* u

* Update attack.cpp

* spellchecked
2021-11-06 21:06:14 -04:00
Natedog2012 5c7972345a [Bug Fix] Fix startzone rule to default players to correct zone when not found … (#1669)
* Fix startzone rule to default players to correct zone when not found in database

* Formatting

Co-authored-by: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com>
2021-11-06 18:22:52 -04:00
Natedog2012 886f00ed50 Fix resetAA to actually remove all AAs except granted AAs (#1681) 2021-11-06 17:36:19 -04:00
Kinglykrab b983fac860 [Quest API] Alphabetize Perl method exports. (#1672)
- Keeps things tidier.
Perl script was used to get this in order easily.
```pl
my @perl_file_types = (
	"bot",
	"client",
	"doors",
	"entity",
	"expedition",
	"groups",
	"hateentry",
	"inventory",
	"mob",
	"npc",
	"object",
	"perlpacket",
	"player_corpse",
	"questitem",
	"raids",
	"spell"
);

foreach my $file_type (sort {$a cmp $b} @perl_file_types) {
	my $perl_file = "perl_$file_type.cpp";
	open my $client_file, '<', $perl_file or die "Cannot open file_name $perl_file";
	{
		local $/;
		$content = <$client_file>;
	}
	close $client_file;

	open my $perl_data_file, ">", "perl_$file_type\_data.cpp";

	my @variables = ();

	foreach my $line (split("\n", $content)) {
		if ($line=~/newXSproto\(/i) {
			$line =~ s/\s+/ /g;
			my @line_data = split(/ /, $line);
			push(@variables, join(" ", @line_data));
		}
	}

	foreach my $variable (sort {$a cmp $b} @variables) {
		$variable =~ s/^ //ig;
		print $perl_data_file "\t$variable\n";
	}

	close $perl_data_file;
}```
2021-11-06 17:36:06 -04:00
Kinglykrab 7b6decaef3 [Quest API] Alphabetize Lua method exports. (#1673)
- Keeps things tidier.
- Removes unnecessary/outdated comments at the top of files.
2021-11-06 17:36:00 -04:00
Kinglykrab 8d8301fbd7 [Commands] Add #findskill [search criteria] Command. (#1674)
* [Commands] Add #findskill [search criteria] Command.
- Allows you to search for skills by ID or partial name.

* Add error message.

* Update command.cpp

* Update command.cpp

* Update command.cpp
2021-11-06 17:35:43 -04:00
Kinglykrab b4aa401210 [Commands] Add #findtask [search criteria] Command. (#1675)
* [Commands] Add #findtask [search criteria] Command.
- Allows you to search for Tasks by ID or partial name.

* Update command.cpp
2021-11-06 17:35:37 -04:00
KayenEQ f1bfd6bc2a [Spells] Implemented SPA 512 SE_Proc_Timer_Modifier, Fixed AA procs not working (#1646)
* update for SPA 511

* remove debugs, AA implemented

* update

* twinprocfix

* AA procs added

* format update

* update

* proctimer limits

* update

* rename function

renamed function
only check for buffs value > 0, don't need to check for AA's which are negative ID's

* pre merge

* variable updates

* Update spell_effects.cpp

* var rename

update var name to better represent its function.

* updated proc struct

added reuse timer

* reuse timer to spell procs

* updates

* debug remove

* Update mob.cpp

* fix

* merge
2021-11-05 14:14:11 -04:00
KayenEQ 8c95323728 [Spells] Update to Charm target restriction code (#1666)
* charm target restrictions

* fixed

* Update spells.cpp

* Update spells.cpp

* Update spells.cpp

only send spell bar when we have to, avoid potential exploit.

* logs
2021-11-05 10:39:17 -04:00
KayenEQ 5874deeffc Update spell_effects.cpp (#1670) 2021-11-03 21:07:45 -04:00
KayenEQ 18cc648c8d Update spell_effects.cpp (#1668) 2021-11-03 19:01:08 -04:00
Kinglykrab 9d515b20f2 [Quest API] Simplify bulk Scribe and Train logic. (#1660)
* [Quest API] Simplify bulk Scribe and Train logic.
- Add $client->GetFreeDisciplineSlot(starting_slot) to Perl.
- Add $client->ScribeSpells(min_level, max_level) to Perl.
- Add $client->LearnDisciplines(min_level, max_level) to Perl.
- Add client:GetNextAvailableDisciplineSlot(starting_slot) to Lua.
- Add client:ScribeSpells(min_level, max_level) to Lua.
- Add client:LearnDisciplines(min_level, max_level) to Lua.
Convert quest::scribespells() and quest::traindisc() to use new ScribeSpells and LearnDisciplines methods for consistency.

* Update command.cpp
2021-11-03 18:31:13 -04:00
Kinglykrab 17aaab1f9d [Quest API] Add Spell methods to Perl. (#1631)
* [Quest API] Add Spell methods to Perl.
- Add quest::getspell(spell_id) to Perl.
- Add eq.get_spell(spell_id) to Lua.
These methods return a spell object.

Exports $spell object references to spell events.

* Formatting.

* Remove comment.

* Update spdat.cpp

* Amplication typo.

* Fix conflicts.

* Remove repository changes.

* Fix typing.

* Update spell_effects.cpp
2021-11-03 17:47:15 -04:00
Chris Miles 6e26e8953c [Loginserver] Health Checks (#1665)
* Health checks stash

* Healthcheck work
2021-11-03 14:39:51 -05:00
Natedog2012 e4138b871b [Rules] Add optional rules for HealAmt and SpellAmt to scale DoTs/HoTs. (#1661)
* Add optional rules for itembonuses HealAmt and SpellAmt to scale for DoTs/HoTs

* Fix typo

* Only 1 rulecheck

* Apply +healingitems and +dmgitems after focus effects so they scale properly

* Fix dots / hots to not always use PVPScaling for extra_dmg / extra_healing

Adjust +healamt and +spelldmg to scale over the full duration of the spell, Thanks Kayen
2021-11-02 15:12:07 -05:00
splose 4ac525afc2 [Rules] Missing Character:TradeskillUpTailoring (#1667) 2021-11-02 12:57:16 -05:00
Chris Miles 05782433b8 [Loginserver] Add some resiliency to LS requests (#1663) 2021-11-02 00:19:13 -05:00
KayenEQ 9af7122b1d [BugFix] Remove potential nullptrs in Virus Code (#1658) 2021-10-31 00:06:32 -05:00
Chris Miles 9e7a763482 [Charm] Push up fragments of Kayen's PR back up (#1659) 2021-10-31 00:04:48 -05:00
Akkadius 1231d44b55 Revert "[BugFix] Charm Targeting and other issues. (#1655)"
This reverts commit df3161455a.
2021-10-30 22:18:40 -05:00
hg 873f1f7f34 [Hotfix] Add include to fix windows build (#1657) 2021-10-30 21:11:04 -05:00
Chris Miles d87db648c3 [Loginserver] Code Cleanup and Tweaks (#1653)
* if for whatever reason the world server is not sending an address, use the local address it sends

* Log when world is sending loginserver info

* Force legacy mode when login host is login.eqemulator.net to avoid misconfigurations at least until things change

* Add human IP translation to log messages

* Sanitize world server name

* Code cleanup and renaming member variables

* More cleanup

* Remove this->

* Validation constants

* Key worldserver lookups by both longname and shortname both

* Update allowed character list

* Fix short_name API response field; add world_id to response

* Shorten receiver verbosity

* Remove unnecessary member variables from database and rename database to m_database

* Adjust MAX_SERVER_VERSION_LENGTH

* Fix indents
2021-10-30 19:09:42 -05:00
Chris Miles 119c3d14b7 [Hotfix] Gate some new shared task logic behind task rule (#1656) 2021-10-30 19:06:38 -05:00
Chris Miles 3cda32c213 [Saylinks] In-Memory Saylink Lookups (#1644)
* Implement saylink memory lookups (performance)

* Ignore commands
2021-10-30 17:32:59 -05:00
KayenEQ df3161455a [BugFix] Charm Targeting and other issues. (#1655)
* fix for target change bug on client

* Update spell_effects.cpp
2021-10-30 16:48:55 -05:00
KayenEQ 4389f84ea5 [BugFix] Fix for bard song instrument mod formula from recent update (#1654)
* Update spell_effects.cpp

* Update spell_effects.cpp

* Update spell_effects.cpp
2021-10-30 08:50:15 -04:00
Chris Miles f9855fd097 [Rez] Fix Z during Resurrection (#1648) 2021-10-30 00:54:44 -05:00
Chris Miles f912814e13 [Commands] Fix Z on #spawnfix (#1647)
* Fix Z on spawnfix

* Slight adjustment
2021-10-30 00:54:33 -05:00
Paul Coene 5738958a2a Fix issue with droplimit code (#1650) 2021-10-28 14:43:40 -04:00
Michael Cook (mackal) d36d11653a Fix issue with new summmon method putting players OOB (#1649)
The FindClosestZ was finding the Z above them ... lets try just not
doing that for now :)
2021-10-27 23:42:31 -04:00
Chris Miles 7230714cbc [Spells/Disciplines] Bulk Train / Scribe (#1640)
* Bulk scribe spells

* Add bulk disc training

* Remove bulk from non bulk method

* PR adjustments
2021-10-27 21:45:27 -04:00
Chris Miles 6e5bf4b941 [Saylinks] Multiple saylinks in brackets (#1643)
* Saylink edge case where multiple saylinks show up within a bracket

* Update partial
2021-10-27 00:01:37 -05:00
KayenEQ fb66afd565 [Spells] Implemented SPA 511 SE_Ff_FocusTimerMin (#1645)
* update for SPA 511

* remove debugs, AA implemented

* update

* format update

* rename function

renamed function
only check for buffs value > 0, don't need to check for AA's which are negative ID's

* var rename

update var name to better represent its function.
2021-10-26 21:36:10 -04:00
Chris Miles ef5124d756 [Shared Tasks] World Reload Task Data on #task reloadall (#1641) 2021-10-24 21:53:29 -05:00
KayenEQ 987de17e93 [Spells] Rework for SPA 413 SE_FcBaseEffects and Bard updates (#1629)
* baseline start

* update1

* updates

* base effect implemented for bard

* instrument mod updates

amplification amps itself

* updates

* updates

* debug

* base effect updates

* baseeffects for spell focus updated

* update skill attack baseeffects

* focus will remain for quest functions

* song cap mod added back in

* remove debugs1

* fix cr

* base effects functionalish

* remove debug

* Update client_mods.cpp

* spdat instrumentmod

* Update spell_effects.cpp

* Update spdat.h

* remove new instrument mod check

split PR
2021-10-24 18:38:28 -05:00
KayenEQ 060be606e7 [Spells] Rework of Virus Effect code (#1593)
* start of rework

* functional

* virus updates

* Update npc.cpp

* updates

* updates

* update v2

* pre remove old code

* removed old code1

* remove debugs

* description

* Update spell_effects.cpp

* changed function name

* remove unused var

* merge error fix

* fix formating issue

* Update spdat.cpp

* Update spell_effects.cpp

* Convert virus entity range code to use vectors and GetCloseMobList

* Formatting [skip ci]

Co-authored-by: Akkadius <akkadius1@gmail.com>
2021-10-24 18:27:51 -05:00
Kinglykrab 1c5f9f2e0f [Bug Fix] Fix possible #proximity crash. (#1639) 2021-10-24 17:50:43 -04:00
Paul Coene 62253cc016 [Bug Fix] Edge cases where min_drop 1 not honored with valid choices (#1617)
* [Bug Fix] Edge cases where min_drop 1 not honored with valid choices

* Forgot header file change.

* Remove verbose option from MeetsLootDropLevelRequirements per @akka

* Fix spacing

* Restore verbose mode after further consideration

* Remove logging on counting of valid items

Co-authored-by: Noudess <noudess@gmail.com>
2021-10-24 16:17:42 -05:00
KayenEQ 0b18671e91 [Spells] Update to how Bard Instrument mods are applied to spell effects (#1628)
* new instrument mod spell effect checks

PR split

* format

* Update spdat.cpp

correction, all direct damage spells get modifiers. Made a mistake with the parse, was using wrong mod.

* restriction changes

cure effects can be modified.
decided to keep a list of known effects that are not modified to return false. and will keep the default to be true for anything as to not inhibit custom bard song development

* SE_ProcChance is modified

* Update spdat.cpp

* update

* Update spell_effects.cpp
2021-10-24 16:07:25 -05:00
Kinglykrab c98f3cfb4c [Quest API] Further char array cleanup. (#1634)
- Cleans up the rest of the char arrays used when exporting to events.
- Converts all events to use a similar variable name for export `export_string`.
- Needless calls to .c_str() removed.
2021-10-24 16:06:22 -05:00
Kinglykrab 624d11de4e [Bug Fix] Fix missing format in client message. (#1637) 2021-10-24 17:03:24 -04:00
Logan 5eb95a95d0 [Rules] Added rule to extend max race id (#1630)
* Added rule to extend max race id

* Cleaned fmt of MaxRaceID

* Added format command

* Updated MaxRaceID default to be 732
2021-10-24 15:53:49 -05:00
JJ da01156673 Update 2021_03_03_instance_safereturns.sql (#1636) 2021-10-24 11:53:23 -04:00
KayenEQ 6a244f16e1 Update spells.cpp (#1635) 2021-10-24 11:08:21 -04:00
KayenEQ 36d10462f7 [Combat] Updates to IMMUNE_MELEE_NONMAGICAL mechanics (#1616)
* pre remove debug

* Update attack.cpp

* Update attack.cpp

* Update attack.cpp

* Update attack.cpp

* apply to temp pets

* format fix

* changed to just use one rule

Merged into NPC's and Pet's into one rule.
2021-10-22 22:39:37 -04:00
Natedog2012 c30dbf6628 [Bug Fix] Do not check tics remaining on non-buff spells (#1633) 2021-10-22 17:16:56 -04:00
splose 657cbbcabe define caster to fix a crash from #1618 (#1632) 2021-10-22 13:48:15 -04:00
Kinglykrab 81e7cf5a32 [Quest API] Convert Spell Events to similar formats and exports. (#1618)
* [Quest API] Convert Spell Events to similar formats and exports.
Export spell ID, caster ID, caster level, tics remaining, and buff slot to Perl/Lua spell events.
- Export e.buff_slot, e.caster_id, e.caster_level, e.spell_id, and e.tics_remaining to `event_spell_buff_tic`, `event_spell_effect`, and `event_spell_fade` in Lua.
- Export $buff_slot, $caster_id, $caster_level, $spell_id, $tics_remaining to `EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT`, `EVENT_SPELL_EFFECT_BUFF_TIC_NPC`, `EVENT_SPELL_EFFECT_CLIENT`, `EVENT_SPELL_EFFECT_NPC`, and `EVENT_SPELL_FADE` in Perl.

* Formatting.

* Remove debug variable.
2021-10-20 16:02:12 -04:00
Kinglykrab edf298685e [Quest API] Convert all char arrays to strings. (#1612)
* [Quest API] Convert all char arrays to strings.
Also change multiple loops for zone controller to one loop.

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

* Update client_packet.cpp

* Update client_packet.cpp

* Update servertalk.h

Alphabetical.
2021-10-20 15:11:14 -04:00
Kinglykrab c838564023 [Bug Fix] Fix OpenSSL Support for Windows (#1625) 2021-10-19 22:28:10 -05:00
Chris Miles d197ee631e [Saylinks] Fix auto saylink injection edge cases (#1620)
* Fix auto saylink injection edge cases

* Add even more resiliency to edge cases

* Move to split based injection

* Add some constants
2021-10-19 22:25:13 -05:00
Kinglykrab 3dcddcba04 [Quest API] Add GetHateRandomBot(), GetHateRandomClient(), and GetHateRandomNPC() to Perl/Lua. (#1613)
- Add $mob->GetHateRandomBot() to Perl.
- Add $mob->GetHateRandomClient() to Perl.
- Add $mob->GetHateRandomNPC() to Perl.
- Add mob:GetHateRandomBot() to Lua.
- Add mob:GetHateRandomClient() to Lua.
- Add mob:GetHateRandomNPC() to Lua.
2021-10-17 23:41:10 -04:00
Natedog2012 7823ff5336 [Quest API] Add EVENT_LOOT_ZONE to zone_controller (#1608)
* Add EVENT_LOOT_ZONE to zone_controller

* Fix porting event_loot_zone to lua API

* Remove extra spacing and remove forced message to allow for scripted responses.

* Allow all script parsing to fire before sending a failed lootitem, add corpse_id

* Only search for zone_controller once
2021-10-16 23:19:19 -05:00
Chris Miles 11c335a015 [DiaWind] Tag Adjustments for title, button_one, button_two (#1610)
* Add a consistent way to handle a few different tags

* Simplify logic further
2021-10-16 21:35:03 -05:00
Kinglykrab 07d96ad921 [Bug Fix] Fix Character Recast Type -1 saving to database. (#1598) 2021-10-16 15:10:42 -04:00
Kinglykrab 5d522b149b [Bug Fix] Allow invisible to be cast on Raid Group members. (#1607)
When `Spells:InvisRequiresGroup` was true, you could only cast on Group members, intended functionality is to cast on Group members and/or people in your Raid Group.
2021-10-16 08:56:38 -04:00
splose 234bd89ed5 Merge pull request #1609 from KayenEQ/npcMagicAttack2
hotfix for PR #1606 (IMMUNE MELEE NONMAGICAL)
2021-10-16 00:38:06 -04:00
KayenEQ af5cfb9bed [Spells] Fix to prevent Charmed Pets from continuing fight target if owner is dead. (#1600)
* Fix for charm break if pet owner dead

* fix, can't check hatelist it is already wiped.

* Update spell_effects.cpp
2021-10-16 00:22:07 -04:00
KayenEQ 426f9c337b hotfix 2021-10-16 00:10:54 -04:00
KayenEQ 5235dcee95 Fix Immune Melee Nonmagical logic (#1606) 2021-10-15 20:46:57 -04:00
Paul Coene 203ba2d340 [Bug Fix] Urgent - Previous fix for TimeSync on static zones broke dynamic zones. (#1605)
* [BugFix] Urgent - Previous fix for TimeSync on static zones broke dynamic zones

* Use local variable instead of inline accessor for consistancy.

Co-authored-by: Noudess <noudess@gmail.com>
2021-10-15 13:17:51 -04:00
KayenEQ 9c67421ccc quick fix for persistent effects fading (#1604) 2021-10-15 09:04:14 -04:00
KayenEQ 6669fc8214 [Bug Fix] Healing pets not correctly dropping out of combat status (#1603)
* Fix for pets not correctly triggering in combat timers

* Update spells.cpp
2021-10-14 23:30:34 -04:00
Paul Coene cef873f793 [BugFix] Remove detection of client pets from Sense[Summoned|Undead|Animal] spells (#1601)
* Remove detection of client pets from Sense[Summoned|Undead|Animal]

* Use IsPetOwnerClient() function instead of individual checks

* Add option to exclude client pets from GetClosestMobByBodyType

* Add parameter

Co-authored-by: Noudess <noudess@gmail.com>
2021-10-14 10:52:29 -04:00
KayenEQ 6a962f2591 [Spells] Update SPA158 Reflect (#1590)
* update

* updates

* updates

* update

* update

* Update ruletypes.h

* Apply extra spell dmg

Mob with the reflect effect apply its Extra Spell Damage from item stat to the reflected spell.
Updated portion of formula for extra damage based on live parsing.

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

* Use string instead.
2021-10-11 16:33:18 -04:00
hg 9887580f9a Make columns in doors table not nullable (#1597)
This makes the float and integer fields in the doors table not nullable.
The only column this should affect is the buffer column which wasn't
being loaded in the old doors loading query. The other columns weren't
validated but they should still be made not nullable to avoid issues.

This will fix a crash in potimeb which is the only zone that had NULL
values in the buffer column with the current peq database. This column
can be removed in a future followup since it isn't being used anyway.
2021-10-09 13:45:38 -04:00
KayenEQ b7c62b5242 Merge pull request #1592 from KayenEQ/updateSPA157SpellDS
[Spells] Update to SPA 157 Spell Damage Shield
2021-10-09 12:05:15 -04:00
KayenEQ 89a40272c6 Merge pull request #1588 from KayenEQ/spa154and209updates
[Spells] Update to SPA 154 and SPA 209 Dispel Bene/Detrimental
2021-10-09 00:57:42 -04:00
Chris Miles db369c98c8 [HP Updates] Fix for Titanium clients not being updated properly by removing client version check (#1596) 2021-10-08 21:04:19 -07:00
KayenEQ 10ba5d6046 Merge pull request #1595 from KayenEQ/instanthealbug1
[Spells] Hotfix for healing code error from recent commit.
2021-10-08 18:54:54 -04:00
KayenEQ dd1a869531 hotfix 2021-10-08 18:43:47 -04:00
KayenEQ a9e23cf83a Merge pull request #1594 from KayenEQ/fixExtraSpellAmt
[Spells] Minor fix to Item Extra Spell Damage Amt formula
2021-10-08 18:00:46 -04:00
KayenEQ 783c12590e minor fix
was not correct, was comparing negative to a positive
2021-10-08 13:14:39 -04:00
Kinglykrab 6689b57a52 [Commands] Convert item ID search to use saylinks similar to name search. (#1589) 2021-10-08 05:41:37 -04:00
Paul Coene 7029c699a0 Merge pull request #1591 from noudess/aggro
[Bug Fix] always_aggro flag needed to be checked on assist
2021-10-07 16:25:51 -04:00
KayenEQ 3b9574af14 fix 2021-10-05 16:59:07 -04:00
Noudess 740f84dc22 always_aggro flag needed to be checked on assist 2021-10-05 15:51:22 -04:00
KayenEQ 55d45f9a98 updates 2021-10-05 15:50:26 -04:00
Cole-SoD 61d1eeab6f Minor corrections (#1582) 2021-10-04 17:26:02 -04:00
Kinglykrab 133c1e866c [Bug Fix] Send appearance wasn't setting size properly when changing races. (#1586) 2021-10-04 17:25:51 -04:00
Kinglykrab b730461894 [Bug Fix] Trim output in hidden dialogue response. (#1587) 2021-10-04 17:25:21 -04:00
KayenEQ 8b08e22dbc removed unused function 2021-10-04 14:33:20 -04:00
KayenEQ fc7c99fb0a Update spdat.h 2021-10-04 11:14:56 -04:00
KayenEQ f1d267bb2d Update spell_effects.cpp 2021-10-04 08:31:52 -04:00
Kinglykrab 07664eedc0 [Bug Fix] Trim trailing whitespace off output in Popup. (#1584) 2021-10-03 14:51:12 -04:00
hg 64b8d7c874 Remove unnecessary includes (#1585)
The include order here was causing a compile error when building with
perl 5.12 due to a bad interaction with the older fmt submodule version
being used
2021-10-03 13:25:49 -04:00
Kinglykrab ccab07bd66 [Dialogue] Add hidden response support. (#1583)
Allows operators to hide responses.
Syntax is `hiddenresponse`.
2021-10-03 13:06:39 -04:00
Kinglykrab 3a76d9a28e [Bug Fix] Dialogue Window Name replace. (#1581)
{name} was being replaced with the string "$name" because Perl would parse it properly, but when used here it doesn't return the client's name.
2021-10-03 13:06:31 -04:00
Kinglykrab 5720a5020d [Quest API] Add attuned/augment support to client->SummonBaggedItems() in Perl/Lua. (#1580)
Perl Example:
```pl
my @bag_items = (
      { item_id => 33649, charges => 1, attuned => 1, augment_one => 32940 }
    );
```

Lua Example:
```lua
local bag_items = {
	{ item_id = 33649, charges = 1, attuned = 1, augment_one = 32940 }
}
2021-10-02 19:35:35 -04:00
Kinglykrab b3e9e2099a [Quest API] Add GetIPExemption(), GetIPString(), and SetIPExemption(exemption_amount) to Perl/Lua.
- Add $client->GetIPExemption() to Perl.
- Add $client->GetIPString() to Perl.
- Add $client->SetIPExemption(exemption_amount) to Perl.
- Add client:GetIPExemption() to Lua.
- Add client:GetIPString() to Lua.
- Add client:SetIPExemption(exemption_amount) to Lua.

Will make plugin::IP unnecessary and allow people to get readable IP string easier, as well as set/get IP exemptions from Perl and Lua.
2021-10-02 13:39:32 -04:00
Kinglykrab 93acf50bb4 [Quest API] Add client->ReadBookByName(book_name, book_type) to Perl/Lua.
- Add $client->ReadBookByName(booK_name, book_type) to Perl.
- Add client:ReadBookByName(booK_name, book_type) to Lua.
- Allows server operators to put books in to their database and read from their database instead of storing the values in a script, also allows them to read pre-existing books using a script.
2021-10-02 13:09:30 -04:00
Kinglykrab ff46a854f9 [Quest API] Add LavaDamage and MinLavaDamage to UpdateZoneHeader in Perl/Lua. (#1578)
Allows operators to modify lava damage dynamically.
2021-10-02 12:01:54 -04:00
Kinglykrab 8c5f26ca5e [Quest API] Add IsNPCSpawned(npc_ids) and CountSpawnedNPCs(npc_ids) to Perl/Lua. (#1570)
- Add quest::isnpcspawned(npc_ids) to Perl.
- Add quest::countspawnednpcs(npc_ids) to Perl.
- Add eq.is_npc_spawned(npc_ids) to Lua.
- Add eq.count_spawned_npcs(npc_ids) to Lua.
2021-10-02 12:01:39 -04:00
hg 5560b198ca [Quest API] Add client->SummonBaggedItems(bag_item_id, bag_items_ref) to Perl/Lua.
Alternative apis using arrays of hash items for EQEmu/Server#1575

Perl usage:
```pl
    # create as an array, pass as reference
    my @bag_items = (
      { item_id => 1001, charges => 1 },
      { item_id => 1002, charges => 1 },
      { item_id => 10037, charges => 10 },
    );
    $client->SummonBaggedItems(17403, \@bag_items);

    # create directly as an array reference
    my $bag_items = [
      { item_id => 1001, charges => 1 },
      { item_id => 1002, charges => 1 },
      { item_id => 10037, charges => 10 },
    ];
    $client->SummonBaggedItems(17403, $bag_items); ```

Lua Usage:
```lua
    local bag_items = {
      { item_id = 1001, charges = 1 },
      { item_id = 1002, charges = 1 },
      { item_id = 10037, charges = 10 }
    }
    e.other:SummonBaggedItems(17403, bag_items);
2021-10-02 12:00:00 -04:00
Chris Miles 9a413cf553 [Shared Tasks] Task Kill Update Fix (#1573)
* Revert "Revert "Shared task kill update fix""

This reverts commit 859751f74d.

* Swap return for continue in this context

* Slight tweak

* Slight tweak

* Remove no longer needed task methods

* Update scope for IncrementDoneCount

* Create helper method Client::GetPartyMembers() and add client->HasTaskState()

* Move HandleUpdateTasksOnKill responsibility to TaskManager

* Remove unnecessary pointer
2021-10-01 20:57:00 -07:00
Kinglykrab bb5c491794 [Dialogue] Add support for Dialogue Window titles. (#1563)
* [Dialogue] Add support for Dialogue Window titles.
- Custom title allows defaults to be overridden where necessary, like a leaderboard or something.
- Default target to client in case people want to send Dialogue Windows from current client.

* Fix possible issue with markdown.
- Example: Using the word "title" or using any identifier and forgetting the colon.
2021-10-01 22:20:15 -05:00
Kinglykrab 2f5d360e53 [Quest API] Add UntrainDiscBySpellID(spell_id, update_client) to Perl/Lua. (#1565)
- Add $client->UntrainDiscBySpellID(spell_id, update_client) to Perl.
- Add client:UntrainDiscBySpellID(spell_id, update_client) to Lua.
2021-10-01 22:14:56 -05:00
hg 92e03dccb9 [Quest API] Add perl hash apis for dz creation (#1571)
Add hash overload to perl CreateExpedition api

  This adds an api to perl similar to the Lua api that accepts a reference
  to a hash table with expedition creation info

  Usage example:
    my $expedition_info = {
      expedition => { name => "Perl expedition", min_players => 2, max_players => 6 },
      instance   => { zone => "crushbone", version => 0, duration => 3600 },
      compass    => { zone => "gfaydark", x => 238, y => 987, z => -24.90 },
      safereturn => { zone => "gfaydark", x => 245.84, y => 987.93, z => -27.6, h => 484.0 },
      zonein     => { x => 479.44, y => -500.18, z => 5.75, h => 421.8 }
    };

    $client->CreateExpedition($expedition_info);

  Syntax for passing directly from a hash:
    my %expedition_info = (...);
    $client->CreateExpedition(\%expedition_info);

Add CreateTaskDynamicZone api to perl

  Usage example:
    sub EVENT_TASKACCEPTED {
      if ($task_id == 4795) {
        my %dz_hash = (
          "instance",   { zone=>"thundercrest", version => 11 },
          "compass",    { zone=>"broodlands", x=>1241.88, y=>511.147, z=>23.4192 },
          "safereturn", { zone=>"broodlands", x=>1242.0, y=>526.0, z=>27.0, h=>0.0 }
        );
        $client->CreateTaskDynamicZone($task_id, \%dz_hash)
      }
    }
2021-10-01 22:12:45 -05:00
hg 5ffe6284ca [Shared Tasks] Start solo task replay timers from completion time (#1568)
Shared tasks start replay timers based on accept time but solo tasks
should start from completion time. Solo tasks on live that have a
non-unlimited duration may require further investigation
2021-10-01 22:11:57 -05:00
hg fb98349bbd [Quest API] Add mob SetPet and RemovePet quest apis (#1569)
Will be required for tutoriala script and other similar events
2021-10-01 22:11:16 -05:00
hg 00a22ca12e [Repositories] Use repositories to load doors (#1572)
Remove Door struct that was being used to map db columns
2021-10-01 22:09:40 -05:00
Chris Miles 3883adcefc [Dialogue Window / Saylinks] Missing Changes (#1574)
* Implement auto saylink injection

* Cover Lua say since it takes a different code path

* [Dialogue] Dialogue Window Middleware (#1526)

* Dialogue window quest dialogue work

* Add rest of DialogueWindow hooks

* Remove spacing
2021-10-01 22:09:21 -05:00
Kinglykrab 0762ffa3dc [Quest API] Typo in Perl $entity_lsit->IsMobSpawnedByNpcTypeID(). (#1576)
This causes the wrong name to show up on Spire.
2021-10-01 21:19:26 -04:00
KayenEQ b70dc64d96 Update spell_effects.cpp 2021-10-01 20:36:54 -04:00
Akkadius 859751f74d Revert "Shared task kill update fix"
This reverts commit 91c451b6c5.
2021-10-01 18:42:36 -05:00
Akkadius 91c451b6c5 Shared task kill update fix 2021-10-01 18:42:02 -05:00
KayenEQ 30c7ed7e45 Merge pull request #1557 from KayenEQ/spa395fix2
[Spells] Healing focuses effects update and Fix for SPA 395
2021-10-01 15:52:25 -04:00
KayenEQ 509b6f2056 Merge pull request #1558 from KayenEQ/spa382update2
[Spells] More updates for SPA 382 SE_NegateSpellEffect
2021-10-01 15:51:32 -04:00
KayenEQ 558bebe710 updates 2021-10-01 15:50:26 -04:00
KayenEQ 08a85c5dae Merge remote-tracking branch 'upstream/master' into spa395fix2 2021-10-01 14:28:45 -04:00
KayenEQ d22f9ee294 Merge remote-tracking branch 'upstream/master' into spa382update2 2021-10-01 14:26:43 -04:00
Cole-SoD 0aeaf7c3b7 [Zone] Add LavaDamage and MinLavaDamage support to ZoneHeader (#1540)
* Add LavaDamage and MinLavaDamage support to ZoneHeader

* Add lava_damage and min_lava_damage to base_zone_repository.h

* Update version.h and utils/sql/git/required/ file

* Correct SQL Query, adjust utils/sql/db_update_manifest.txt to check one column

* Correct manifest
https://github.com/EQEmu/Server/pull/1540#discussion_r714330945
2021-09-30 11:44:22 -05:00
KayenEQ c04bcef273 Update spells.cpp (#1554) 2021-09-30 11:43:36 -05:00
KayenEQ 7fcea371c2 [Spells] Updated Memory Blur SPA 63 - Implemented Live Mechanics (#1559)
* memory blur updated

* Update spdat.h
2021-09-30 11:43:05 -05:00
Natedog2012 dd765238f7 Merge pull request #1553 from Natedog2012/tradeskill_fix
[Tradeskill] Fix logic in taught tradeskill recipes
2021-09-29 19:05:41 -05:00
Paul Coene 2c98a11696 Merge pull request #1561 from noudess/timesync
[Bug Fix] Zones no longer syncing time to world
2021-09-29 16:57:30 -04:00
Noudess d4f14efaa0 Fix TimeSync to work with new Servertalk connection order 2021-09-27 10:04:02 -04:00
KayenEQ 27787c247b Update spell_effects.cpp 2021-09-23 18:01:08 -04:00
KayenEQ ea9c07aa98 393 NegateEffect updates 2021-09-23 16:43:07 -04:00
KayenEQ 5cd9bfeb70 reminder
bot code needs to updated, then old function can be removed
2021-09-23 14:23:17 -04:00
KayenEQ b699196299 Update effects.cpp 2021-09-23 14:14:46 -04:00
KayenEQ e89c2aec4a Update bot.cpp 2021-09-23 13:48:15 -04:00
KayenEQ 456fb56e82 revert for bots 2021-09-23 13:42:36 -04:00
KayenEQ 03ac828134 Update bot.cpp 2021-09-23 12:28:34 -04:00
KayenEQ 34b2264d5d bots... 2021-09-23 12:21:53 -04:00
KayenEQ 933ede40f9 Update bot.cpp 2021-09-23 12:13:29 -04:00
KayenEQ 881dc33c9b update 2021-09-23 12:00:16 -04:00
KayenEQ 3faa0d2603 update 2021-09-23 11:41:36 -04:00
KayenEQ 1ce5087e2a Update effects.cpp 2021-09-23 09:35:09 -04:00
Natedog2012 bf8d94eb35 Fix SendTradeskillSearchResults row count was incorrect format. Remove extra database hits from last commit. 2021-09-22 21:43:49 -05:00
Natedog2012 9aac12f517 Hide tradeskill recipes that require being learned before crafting them, as well as fix how learned recipes are checked. 2021-09-22 18:21:57 -05:00
Kinglykrab 7b969173f4 [Door Manipulation] Resolve some typos and add a GM check. (#1550)
* [Door Manipulation] Resolve some typos and add a status check.

* Remove Status check and use GetGM() inside devtools check instead.
2021-09-22 16:43:01 -05:00
Kinglykrab ca77d22035 [Bug Fix] GetSpellStat() Identifiers were comparing improperly. (#1552)
- GetSpellStat() converts identifiers to lowercase and they were being checked against mixed case strings, causing certain identifiers to always fail.
2021-09-21 21:08:16 -04:00
Paul Coene ad3bf35397 Merge pull request #1548 from noudess/master
[Bug Fix] Fix bug where IVU could not be cast on char with Invis
2021-09-21 12:21:18 -04:00
Noudess 9b06221be0 [Bug Fix] Fix bug where IVU could not be cast on char with Invis 2021-09-20 11:30:33 -04:00
Kinglykrab c0de178173 [Commands] Overhauled #npcedit. (#1538)
* [Commands] Overhauled #npcedit.
- Added missing columns like untargetable, show_name, exp_mod, etc.
- Put stats in order of column appearance in table within help message and within code.
- Converted StringFormat to fmt::format.
- Added a GetGenderName() helper method.
- Prettified response messages of nearly every #npcedit option.

All tested and ready to go.

Would like input about possibly changing some of the command arguments to match the table column names more closely, example being "spell" should be "npc_spells_id".

* Cleanup.

* Fix indentation.
2021-09-19 16:32:21 -07:00
Kinglykrab 6a5face0aa [Dialogue] Add support for Dialogue Window buttons. (#1546)
* [Dialogue] Add support for Dialogue Window buttons.
- Also changes "mysterious" identifier to "{mysterious}".
- Both button names are required for anything to show up, otherwise it defaults to Yes/No similar to Client::SendFullPopup.

* Move SetEntityVariable so responses can override default button response.

* Add negativeid support so you can override button two popup ID.

* Fix log.

* Update dialogue_window.cpp

Convert button names to strings and negativeid to secondrespondid.
2021-09-19 16:24:04 -07:00
Kinglykrab c15c54e920 [Quest API] Cross zone and world wide method overhaul. (#1520)
* [Quest API] Cross zone and world wide method overhaul.
- Adds support for Character ID, Character Name, and Expedition ID to all cross zone methods that did not have a method.
- Adds worldwide LDoN Updates.
- Shrinks the number of packets and structs from 83 to 17.

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

* Formatting, organization, and fixing of improper exports.

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

* Merge fixes.
2021-09-19 16:15:14 -07:00
Chris Miles 24c079dca4 [Hotfix] Fix freeze formatting for Quest API parsing (Spire) (#1547) 2021-09-19 15:25:52 -05:00
Kinglykrab 8eef7bb283 [Quest API] Add EVENT_COMBINE to Perl and Lua. (#1536)
- Exports $container_slot in Perl.
- Exports e.container_slot in Lua.

Allows you to perform events when clicking combine in a tradeskill container.
2021-09-19 15:22:51 -05:00
Michael Cook (mackal) 80493719f2 [Summoning] Make Summon a bit more live like (#1539)
Pretty sure the distance should probably be melee range / 2 but ahh
yeah. Can't do that. Hopefully 5 units isn't too far.
2021-09-19 15:19:29 -05:00
KayenEQ df9d6bc506 [Spells] Corrected implementation of SE_Purify 291 (#1541)
* Correct implementation of spa291

* debug removal
2021-09-19 15:17:10 -05:00
KayenEQ 71870cbd1c [Spells] Update to SPA 442 and 443 (SE_TriggerOnReqTarget, SE_TriggerOnReqCaster) (#1543)
* Update to SPA 442 and 443

Use SpellRestriction Id's and updated PassCastRestriction code

* Update mob.cpp
2021-09-19 15:16:56 -05:00
Kinglykrab f715ccd368 [Bug Fix] Fixes EVENT_DISCONNECT for /quit and /exit. (#1542)
/quit and /exit will now properly parse to EVENT_DISCONNECT so operators can do things on disconnect to these players, previously it only functioned for /camp.
2021-09-19 15:16:38 -05:00
KayenEQ 46edd56acc [Spells] Update SPA 101 SE_CompleteHeal (#1544)
Fixed buff stacking issue
2021-09-19 15:16:21 -05:00
KayenEQ 442850aebb [Spells] Update to SPA305 (#1545)
minor fix to allow for effects with negative values.
2021-09-19 15:16:02 -05:00
KayenEQ d4e752987e fixes 2021-09-17 23:21:03 -04:00
KayenEQ 9c6a85ff16 heal code updates 2021-09-17 22:27:45 -04:00
Kinglykrab fa8d8eccc2 [Quest API] Add corpse->RemoveItemByID(item_id, quantity) to Perl and Lua. (#1535)
* [Quest API] Add corpse->RemoveItemByID(item_id, quantity) to Perl and Lua.
- Add $corpse->RemoveItemByID(item_id, quantity) to Perl.
- Add corpse:RemoveItemByID(item_id, quantity) to Lua.

* Formatting.
2021-09-13 15:42:04 -04:00
Kinglykrab 6e76f89ca2 [Quest API] Add EVENT_CONSIDER to Perl and Lua. (#1531)
* [Quest API] Add EVENT_CONSIDER to Perl and Lua.
- Exports $entity_id in Perl.
- Exports e.entity_id in Lua.

Allows you to perform events on consider for server operators.

* Missing comma.

* Formatting.

* Add return capability to EVENT_CONSIDER and EVENT_CONSIDER_CORPSE so operators can break out of consider functions.
2021-09-13 15:30:17 -04:00
Akkadius 9589bf6bf8 [Hotfix] Crash fix that apparently didn't make it in another PR 2021-09-13 14:15:08 -05:00
Kinglykrab ce5fa9502f [Commands] Adds #dye command. (#1537)
* [Commands] Adds #dye command.

* Fix use tint.
2021-09-12 22:40:43 -05:00
Kinglykrab 7b1b05a35c [Bug Fix] Resolves issues with improper genders and textures on spells. (#1533)
* [Bug Fix] Resolves issues with improper genders and textures on spells.
Spells will now properly understand their expected gender and texture.
Logic is based on what I saw in a stock PEQ database, can be adjusted if need be.
Any feedback is helpful.

* Made use of GetRaceGenderDefaultHeight() and added all races to their proper conditions.

* Formatting.
2021-09-12 22:40:07 -05:00
Kinglykrab 38a86edc70 [Quest API] Add EVENT_CONSIDER_CORPSE to Perl and Lua. (#1530)
- Exports $corpse_entity_id in Perl.
- Exports e.corpse_entity_id in Lua.

Allows you to perform events on corpse consider for server operators.
2021-09-12 22:39:09 -05:00
Kinglykrab 56b9b6f2c4 [Quest API] Add corpse->GetLootList() and npc->GetLootList() to Perl and Lua. (#1529)
* [Quest API] Add corpse->GetLootList() and npc->GetLootList() to Perl and Lua.
- Add $corpse->GetLootList() to Perl.
- Add $npc->GetLootList() to Perl.
- Add corpse:GetLootList() to Lua.
- Add npc:GetLootList() to Lua.

Returns an array of item IDs for use with corpse and NPC methods such as HasItem(item_id), CountItem(item_id), and GetFirstSlotByItemID(item_id).

* Categories.

* Modify Lua to use classes.
2021-09-12 22:38:38 -05:00
Chris 97dcba70cf [Bots] Fix for Bot Pets Taunting (#1519)
Currently bot pets will taunt and there's no way to turn it off. This makes it so pets follow their owner's taunt settings.
2021-09-12 22:37:39 -05:00
Chris Miles 6b93130c13 [Saylinks] Implement Auto Saylink Injection (#1525)
* Implement auto saylink injection

* Cover Lua say since it takes a different code path
2021-09-12 22:08:30 -05:00
Chris Miles 94c1a50cc8 [GM Command] Door Manipulation Command Port (#1524)
* Initial commit

* Push latest

* Update door_manipulation.cpp

* More door work

* More doors work

* Upload notes

* Finalize changes

* Remove comment

* Add missing chat line

* Swapped URI parser with something not using deprecated C++ functions
2021-09-12 22:08:04 -05:00
Kinglykrab 31ab1d4287 Merge pull request #1522 from EQEmu/feature/temp_merchant_list_bug_fix
[Bug Fix] Resolves issue where loading temporary merchant list "fails" because there aren't any to load.
2021-09-11 10:35:39 -04:00
Paul Coene b6ba493450 Merge pull request #1528 from noudess/merchant
Fix bug where stacks of non-stackable items are removed when you buy 1.
2021-09-11 10:19:37 -04:00
Paul Coene c613db2338 Merge pull request #1527 from noudess/toofar
Hack to fix melee chasing fleeing mobs "too far" issues.
2021-09-10 18:21:38 -04:00
Noudess 05ac8499df Fix bug where stacks of non-stackable items are removed when you buy 1. 2021-09-10 10:18:59 -04:00
Chris Miles 69244a094d Update changelog.txt 2021-09-09 09:52:26 -05:00
Noudess 1155673642 Hack to fix melee chasing fleeing mobs "too far" issues. 2021-09-09 08:42:14 -04:00
Kinglykrab 930079959c [Bug Fix] Resolves issue where loading temporary merchant list "fails" because there aren't any to load. 2021-09-06 20:37:34 -04:00
Chris Miles c078257f70 [Quest API] Port DiaWind Plugin to Native Quest API (#1521)
* Port DiaWind plugin to native Quest API

* Add no logging aliases
2021-09-05 20:29:21 -05:00
Chris Miles e7dd8d49a9 [Shared Tasks] Shared Tasks System Implementation (#1451)
* Shared tasks WIP; lots of logging; shared tasks and tasks work internally the same for now; lots to cleanup yet

* Update task_manager.cpp

* Add tables

* World message handler

* Zone message handler

* More messaging

* More rearranging

* Task creation work (wip)

* Tweaks

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

* Cleanup unnecessary  getter

* More work on shared task persistence and state loading

* Add int64 support into repositories

* More state handling, creation loads all tables

* Wrap up shared task state creation and removal

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

* Implement shared task updates

* Add members other than just leader in task confirmations

* Update shared_task_manager.cpp

* Hook task cancellation for shared task removal (middleware)

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

* Get members to show up in the window on creation

* Add opcodes, cleanup

* Add opcode handlers

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

* Implement offline shared task sync

* Style changes

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

* Refactorings, cleanup

* Implement make leader in shared tasks window

* Implement add player, sync shared task state after add

* Add opcodes for remaining clients

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

* Logging

* Remove comment

* Some cleanup

* Pass NPC context through shared task request logic

* Remove extra SharedTaskMember fields

* Add message constants

* Remove static

* Only use dz for expedition request

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

* Store expedition leader on dz

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

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

* Store expedition name on dz

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

* Store uuid on dynamic zone

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

* Move expedition db columns to dz

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

* Move window packet methods to dz

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

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

* Store dynamic zone ids on clients

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

* Move member management to dz

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

Set default dz member status to Unknown

* Move member status caching to dz

This moves world member status caching into internal dz methods

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

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

* Move member status updates to dz

* Set dz member status on all client dzs

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

* Save instance safe return on characters

Add character_instance_safereturns table and repository

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

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

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

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

* Remove is_current_member from dz members

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

* Let dz check leader in world

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

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

* Let dz handle member expire warnings

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

* Use separate dynamic zone cache

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

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

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

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

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

* Move expedition makeleader processing to dz

* Let dz handle expedition deletions

This removes the need for separate expedition cache in world

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

* Remove ExpeditionBase class

Since world no longer caches expeditions this will not be necessary

* Fix windows compile

* Implement task dz creation

Prototype dz creation for shared tasks

* Add and remove shared task members from dz

Also keep leader updated (used in choose zone window)

* Fix client crash on failed shared task

* Fix linux compile and warning

* Check client nullptr for dz message

This was accidently removed when expedition makeleader was moved

* Disable dz creation for solo tasks

* Add shared task repository headers to CMakeLists

* Add shared task dynamic zones table

* Add shared task dz database persistence

* Get members from db on shared task dz creation

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

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

* Add character message methods to world

Add simple and eqstr message methods to ClientList

Add shared task manager methods to message all members or leader

* Add SyncClientSharedTaskState and nested sync strategies to cover M3 work

* Fix whitespace

* Implement task request cooldown timer

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

* Implement shared task selector validation

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

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

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

* Add separate shared task select opcodes

Live uses separate opcodes for solo and shared task selection windows

* Convert ActivityType to enum class

* Refactor task selector serialization

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

* Add shared task selector

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

* Refactor task objective serialization

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

* Add task level spread and player count columns

* Implement shared task accept validation

This adds a common method for shared task character request queries

* Add task replay and request timer columns

* Add character task timers table

* Use shared task accept time on clients

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

* Implement task timer lockouts

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

* Add solo and shared task timer validation

* Remove logging of padding array

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

* Implement /kickplayers task

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

* Implement /taskquit command

* Implement shared task invite validation

Remove active invitation before invite accept validation

* Remove local client db persistence during SyncClientSharedTaskRemoveLocalIfNotExists

* Add missing accept time arg to assign task

* Only validate non-zero task invite requirements

* Fix task error log crash

* Separate task cooldown timer messaging

* Use method to check for client shared task

* Avoid unneeded task invite validation query

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

* Implement /tasktimers command

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

* Add /tasktimers rate limiter

* Intercept shared task completion; more work to come

* Change SharedTaskActivityState and SharedTasks time objects to datetime

* Add updated_time updates to SharedTaskActivities

* Mark shared tasks as complete when all activities are completed

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

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

* Implement RecordSharedTaskCompletion, add tables, repositories

* Update shared_task_manager.cpp

* Update shared_task_manager.cpp

* Add shared task replay timers

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

* Create FindCharactersInSharedTasks that searches through memory

* Remove namespace shorthand and formatting

* More minor cleanup

* Implement PurgeAllSharedTasks via #task command

* Add #task purgetimers

* Decrease m_keepalive time between processes

* Remove type ordering in /tasktimer query

* Add comment for task packet reward multiplier

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

* Add replay timers to past members

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

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

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

* Move PurgeTaskTimers client method to tasks.cpp

* Remove dz members when purging shared tasks

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

* Use exact name in shared task invites

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

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

* Clear declined active shared task invitations

This also notifies leader for declined shared task invites

* Store shared task member names

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

* Implement /taskplayerlist command

* Replace queries with member name lookups

Now that shared task members store names these queries are unnecessary

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

* Implement shared task member change packet

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

* Serialize shared task member list from world

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

* Initialize client task state array

This was causing sql query errors on client state reloads

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

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

* Add shared task command messages

Add messages for non-leader task commands

This adds taskadd, taskremove, taskmakeleader, and taskquit messages

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

* Replace some task messages with eqstrs

This also updates to use live colors

* Avoid shared task invite leader lookup query

Since member names are stored now this query is also unnecessary

* Avoid reloading client state on shared task accept

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

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

* Remove active shared task invite on zone

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

* Choose new shared task leader if leader removed

* Add separate shared task kickplayers method

* Enable EVENT_CAST_ON for clients

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

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

This reverts commit 3af14fee2de8b109ffb6c2b2fc67731e1531a665.

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

* Disallow looting inside a dz by non-members

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

* Change load where criteria

* Increase task completion emote column size

* Use eqstr for task item reward message

* Implement radiant and ebon crystal rewards

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

* Send task completion emote before rewards

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

* Do not send a shared task in completed task history

* Allow EVENT_TASK_STAGE_COMPLETE for quest goals

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

* Add SyncSharedTaskZoneClientDoneCountState

* Swap return for continue in this case

* Formatting

* Simplify

* Formatting

* Formatting

* Formatting

* Remove errant check

* Formatting, add setter for shared tasks

* Remove debugging

* Comments in PR

* More PR follow up

* Formatting

* Cleanup

* Update packet comments

* Comments

* More cleanup

* Send command error message if not in shared task

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

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

* Comment

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

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

* Fix packet send

* Revert packet send

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

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

* Cleanup how we're checking for active tasks

* Forward task sets that contain shared tasks

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

* Change eqstr for empty solo task offers

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

* Fix max active tasks client message

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

* Load client task state after zoning complete

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

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

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

* Send message to clients removed while zoning

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

* Post rebase fix

* HG comment for checking active task

* Addressing HG comments around zeroing out a shared task id

* Remove errant comment

* Post rebase database manifest updates

* Update eqemu_logsys_log_aliases.h

* More rebase catches

* Bump database version for last commit

Co-authored-by: hg <4683435+hgtw@users.noreply.github.com>
2021-09-05 01:21:23 -05:00
splose 943c623be0 [Hitpoints] More HP Fixes - Remove Hacks (#1518)
* Fix HP update throttling

* Remove more hacks

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

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

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

Updated SE_NegateSpellEffect SPA 382

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

* Update spdat.h

* minor update

* Update bonuses.cpp

reset bool correctly

* Update bonuses.cpp

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

* Make some log statements detail

* Add better logging messages

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

* Update client.cpp

* Update client.cpp

* Update bonuses.cpp

* Update bonuses.cpp

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

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

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

* minor patch fixes

* ceiling to server side runspeed

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

* use ceil instead of std::ceilf for linux

* boat false positive fix

* stopping the double detection

* fixes and cleanup

* auto merge tricked me...

* dummy divide by 0 checks

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

* Formatting

* encapsulation to its own class and clean up

* more detections

* typo

* OP_UnderWorld implmentation

* Update client_packet.h

* Syntax changes, formatting, cleanup

* preventing crashes due to invalid packet size

* typos and clearer logic

* seperated the catagory for cheats

* Updated MQGhost for more detail

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

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

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

Implemented spells_new table 'field220' as 'caster_requirement_id'

* Update spell_effects.cpp

* updates to CastRestriction

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

* updates

* code fixes

* updates

* updates

* Update spdat.h

* typo fix
2021-08-31 00:41:20 -05:00
KayenEQ 5f3c054044 [Spells] Updated pet suspend code to use spell effect data and bonuses (#1501) 2021-08-31 00:35:18 -05:00
Chris Miles 3b01608a71 [Server] Tweak inter process keepalive timers; this is a very tiny overhead for inter-process chatter to check for connection liveness (#1502) 2021-08-31 00:34:28 -05:00
Chris Miles 06890f695a [Repositories] Add datetime support to repositories (#1503) 2021-08-31 00:34:10 -05:00
Chris Miles 228e0007ca Pad zero size packets which is what we did on encrypted connections prior to #1464 (#1504) 2021-08-31 00:33:49 -05:00
Chris Miles f4bd7c53c0 [Logging] Implement World GMSay Logging (#1505)
* Implement world GM say logging

* Add missed callback function

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

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

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

This reverts commit 32d61ea238.

* Keep old values for enums

* Use downgrade security handshake for backwards compat

* Send handshake instead of hello to fast connect

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

Implemented

SPA 390 SE_FcTimerLockout

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

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

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

* Formatting

* Use range based for

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

* updates

* update

* updates

* Update client_process.cpp

* major updates

optimized
pet support
perl support

* updates

* minor update

* fix merge error

* requested changes

* variable fix

* optimization

* minor update

* Revert "optimization"

This reverts commit 27e11e758b.

* fix

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

* edge case fix

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

* combined packet and mob function

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

* Addressing formatting for Kayen

* Fix function typo

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

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

* minor fixes

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

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

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

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

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

* fix, description updates

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

defines

* bonus structure add

bonus structure set up

* updates spa476

updates spa476

* spell bonus now functional

spell bonus working well.

* major update with debug messages

aa, item and spell now working

* Pre clean up, effect implemented

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

* removed debug messages

removed debug messages

* spdat description added

spdat description added

* minor fix

removed debug shout
removed unneeded code check.

* syntax updates, minor fixes

syntax updates, minor fixes

* syntax fixes

syntax fixes

* improvements to code

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

* updates to aa buy, functionalish

* Syntax / Formatting

* Add break / default to switch

* updates

* completed v2

* Major revisions

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

AA Toggle and data structure now more accurate to live.

* Update aa.cpp

* debug removed

* implemented SE_Buy_AA_Rank

Closer to live.

* Update aa.cpp

broadening AA toggle to be more general use.

* improved various checks

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

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

SPIndex fix for mislabeled spell

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

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

* alphabetical

* Fix

* fix again

* Ok real fix unprivated

* Add Lua Export

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

* Fixed issues with invis rule crashes

* Fixed issues with invis rule crashes

* Invis Require Group nullptr fix

* Invis Group Require Fix crash

* Fixes Self only Invis Crashes

* Formatting, reverse check order to prevent unnecessary processing

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

Implemented new spell effects
SE_Duration_HP_Pct 			524
SE_Duration_Mana_Pct			525
SE_Duration_Endurance_Pct		526

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

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

* Implemented SPA Instant Mana/End pct

Fixes for SPA 524-526
Implemented
SE_Instant_Mana_Pct			522
SE_Instant_Endurance_Pct		523

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

* Implemented: SPA 521 EndAbsorbPctDmg

Implemented
SE_Endurance_Absorb_Pct_Damage 521

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

* Implemented SE_HealthTransfer 509

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

Can be used for heal
Act of Valor

* Implemented SPA 515,516,518,496

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

SE_Critical_Melee_Damage_Mod_Max	496 - This is a non stackable melee critical modifier

* Implemented SPA 503 , 505

SE_Melee_Damage_Position_Mod	503
define SE_Damage_Taken_Position_Mod	505

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

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

* Implemented 467,468

Implemented
SE_DS_Mitigation_Amount		467
SE_DS_Mitigation_Percentage	468

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

* Fixes

Formula fixes

* Update spdat.h

Added spa descriptions.

* Implemented SPA 469, 470

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

SE_Trigger_Best_in_Spell_Grp	470

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

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

* Implemented SPA 474, 494

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

SE_Pet_Add_Atk	494 - Gives pet a ATK bonus from the owner

Fixed SE_PetMeleeMitigation 397 - The bonus was not being calculated

* Implemented SPA 465,477,478

Implemented

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

SE_Hatelist_To_Top_Index		477
Chance to be put on top of RAMPAGE list

SE_Hatelist_To_Tail_Index		478
Chance to be put on bottom of RAMPAGE list

* Implemented

Implemented

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

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

* Implemented SPA 483

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

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

* Implemented SPA 484

Implemented

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

* Implemented SPA 481, 485,486,512

Implemented

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

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

Implemented associated focus limits seen in live spells.

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

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

The following is an associated effect seen with SPA 481

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

* Stacking fixes for new effects

Stacking fixes for new effects.

* merge with upstream master

merge and update up spdat.h

* Update spdat.h

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

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

* Implemented new focus and limits

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

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

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

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

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

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

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

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

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

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

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

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

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

Added basic focus and limit descriptions to source.

* Update spell_effects.cpp

hotfix

* fix for SE_Ff_Override_Notfocusable

Fix for SE_Ff_Override_Notfocusable

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

* Update to SE_Fc_CastTimeMod2

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

* fix

unintentional change, reverted back.

* fixed missing break statements

fixed missing break statements

* update to IsFocusLimit

missing limit cases added to IsFocusLimit

* Format CalcFocusEffect

* Revert "Format CalcFocusEffect"

This reverts commit e5b81791ee.

* Revert "Revert "Format CalcFocusEffect""

This reverts commit a1ce29a875.

* Post merge fixes

* More post merge adjustments

* Another post merge change

* Add LimitResist constants back

* Swap int16's for 32's

* int32 fix

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

Update
SPA SE_LimitSpellClass: 403
SPA SE_LimitSpellSubclass: 404

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

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

Added FocusLImitInclude Enum to improved focus effect function readability.

* Formatting

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

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

* new command: resetdisc_timer

usage: #resetdisc_timer [all | timer_id]

* syntax fixes

syntax improvements

* minor fix

changed numhits check

* Update spell_effects.cpp

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

* syntax

* Formatting and syntax tweaks

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

* more updates

* more updates

* completed

* Update common.h

* Namespace constants, few minor spelling tweaks

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

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

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

This bug was originally reported by: Isaaru

* Live like behavior

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

* code optimization

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

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

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

Added limit functionality to similar effect SPA 266

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

* Update attack.cpp

code update

* Update bonuses.cpp

code update

* Update spdat.h

added commas

* Update spell_effects.cpp

fix to remove unknown spa message

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

Implemented SPA 482 SE_Skill_Base_Damage_Mod

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

* Update spell_effects.cpp

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

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

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

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

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

Implemented new spell effects
SE_Duration_HP_Pct 			524
SE_Duration_Mana_Pct			525
SE_Duration_Endurance_Pct		526

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

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

* Implemented SPA Instant Mana/End pct

Fixes for SPA 524-526
Implemented
SE_Instant_Mana_Pct			522
SE_Instant_Endurance_Pct		523

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

* Implemented: SPA 521 EndAbsorbPctDmg

Implemented
SE_Endurance_Absorb_Pct_Damage 521

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

* Implemented SE_HealthTransfer 509

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

Can be used for heal
Act of Valor

* Implemented SPA 515,516,518,496

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

SE_Critical_Melee_Damage_Mod_Max	496 - This is a non stackable melee critical modifier

* Implemented SPA 503 , 505

SE_Melee_Damage_Position_Mod	503
define SE_Damage_Taken_Position_Mod	505

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

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

* Implemented 467,468

Implemented
SE_DS_Mitigation_Amount		467
SE_DS_Mitigation_Percentage	468

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

* Fixes

Formula fixes

* Update spdat.h

Added spa descriptions.

* Implemented SPA 469, 470

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

SE_Trigger_Best_in_Spell_Grp	470

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

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

* Implemented SPA 474, 494

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

SE_Pet_Add_Atk	494 - Gives pet a ATK bonus from the owner

Fixed SE_PetMeleeMitigation 397 - The bonus was not being calculated

* Implemented SPA 465,477,478

Implemented

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

SE_Hatelist_To_Top_Index		477
Chance to be put on top of RAMPAGE list

SE_Hatelist_To_Tail_Index		478
Chance to be put on bottom of RAMPAGE list

* Implemented

Implemented

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

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

* Implemented SPA 483

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

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

* Implemented SPA 484

Implemented

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

* Implemented SPA 481, 485,486,512

Implemented

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

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

Implemented associated focus limits seen in live spells.

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

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

The following is an associated effect seen with SPA 481

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

* Stacking fixes for new effects

Stacking fixes for new effects.

* merge with upstream master

merge and update up spdat.h

* Update spdat.h

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

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

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

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

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

Implemented new spell effects
SE_Duration_HP_Pct 			524
SE_Duration_Mana_Pct			525
SE_Duration_Endurance_Pct		526

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

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

* Implemented SPA Instant Mana/End pct

Fixes for SPA 524-526
Implemented
SE_Instant_Mana_Pct			522
SE_Instant_Endurance_Pct		523

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

* Implemented: SPA 521 EndAbsorbPctDmg

Implemented
SE_Endurance_Absorb_Pct_Damage 521

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

* Implemented SE_HealthTransfer 509

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

Can be used for heal
Act of Valor

* Implemented SPA 515,516,518,496

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

SE_Critical_Melee_Damage_Mod_Max	496 - This is a non stackable melee critical modifier

* Implemented SPA 503 , 505

SE_Melee_Damage_Position_Mod	503
define SE_Damage_Taken_Position_Mod	505

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

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

* Implemented 467,468

Implemented
SE_DS_Mitigation_Amount		467
SE_DS_Mitigation_Percentage	468

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

* Fixes

Formula fixes

* Update spdat.h

Added spa descriptions.

* Fixes for PR

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

* Update command.cpp

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

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

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

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

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

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

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

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

* Update inventory.cpp

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

* Use constants.

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

* Fix instance naming.

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

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

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

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

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

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

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

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

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

* Only log if path is set in request

* Auto install tool table if does not exist locally

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

* Formatting

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

* Fix logging & remove comments

* change logic

* change logic

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

* Update syntax for new httplib and run on own thread

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

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

* Updated

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

* Update bonuses.cpp
2021-06-13 18:06:58 -05:00
Chris Miles bcb0e43d13 [Logging] Simplify Log Settings Initialization (#1394)
* Simplify logging loading

* Fix log injections and reduce verbosity
2021-06-13 18:06:43 -05:00
Alex 0e4361955d [Quest API] Add ResetAllDisciplineTimers() to Perl/Lua. (#1395)
- Add $client->ResetAllDisciplineTimers() to Perl.
- Add client:ResetAllDisciplineTimers() to Lua.
2021-06-13 18:06:36 -05:00
Chris Miles 8d90b5a2e7 [Hotfix] Illusion Revert (#1398)
* Revert some "fixes", clean some code up

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

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

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

* Adjustments.

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

* Convert from a parameter to a method.

* Add safer method.

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

* Typo.

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

* Added a pet check to Cazic Touch

* Added rule option to Cazic pet Check

* Removed Magic Numbers

* Bracket fix

* Revert "Bracket fix"

This reverts commit 3deb3e0cad.

* Bracket fix

* Update spells.cpp

* Fixed constants

* Revert "Fixed constants"

This reverts commit 68502effd3.

* Update eq_constants.h

* Update eq_constants.h

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

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

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

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

* Remove this-> since it is implied

* Update spell_effects.cpp

* clear all this->

* pMob to mob

* Added rule Spells:PreventFactionWarOnCharmBreak

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

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

This should fixed the eqtime spawn condition from falling behind.

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

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

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

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

* Remove const cast and modify saylink definition.
2021-06-11 13:30:56 -05:00
Michael 0461ac7912 [Rule] Allow Skill ups from items (Default: On) (#1376) 2021-06-11 13:29:09 -05:00
Michael Cook (mackal) 02526072f3 [Quest API] Add Lua_Mob::GetShuffledHateList (#1381)
This returns the hate list but in a random order. This is useful to
prevent repeated (potentially infinite ...) calls to GetHateRandom()
2021-06-11 13:28:35 -05:00
splose 854a09fc84 [Bug Fix] Allow GMs to chat when stunned (#1380) 2021-06-11 13:27:52 -05:00
Michael Cook (mackal) f0d0c83710 Magic numbers bad (#1373) 2021-06-03 11:17:56 -04:00
RoTPvP 71e9dd5a3c [PVP] Pvp guard assist code. (Guards will assist in PvP based on faction) (#1367)
* Added Guard Assist Code

* Added PvP Rule and Detrimental Spell Check

* Added IsGuard() Method

* Change from uint to bool

* Added a faction check to IsGuard()

* Simplified Guard Checks, reduced costs

* Added IsNPC check to guard check

* simplified pet check

* Removed Magic numbers

* Formatting Fix

* Code fixes

* Fixed constants

Co-authored-by: ProducerZekServer <go@away.com>
2021-05-30 20:22:52 -05:00
Dencelle 542ec38660 [Bug Fix] Fix for charges not being sold correctly (#1357)
* fix for charges not being sold correctly

https://github.com/EQEmu/Server/issues/1350 this fixes this issue

* Update client_packet.cpp

* Update zone.cpp

this completes the fix for all charge items being sold to merchants

* code opmizations

could probably be fixed up better but this is a little cleaner

* Update snake_casing

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-05-24 21:16:46 -05:00
Alex e14acd6802 [Quest API] Add several methods to Perl/Lua API for LDoN stuff. (#1356)
- Swapped parameters in mostly unused functions to be theme_id first and points second. (No examples in PEQ quests.)
- Add $client->AddLDoNLoss(theme_id) to Perl.
- Add $client->AddLDoNWin(theme_id) to Perl.
- Add quest::crosszoneaddldonlossbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbyexpeditionid(expedition_id, theme_id) to Perl.
- Add quest::crosszoneaddldonpointsbycharid(character_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbygroupid(group_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbyraidid(raid_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbyguildid(guild_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbyexpeditionid(expedition_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonwinbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbyexpeditionid(expedition_id, theme_id) to Perl.
- Fix quest::addldonloss(theme_id) in Perl.
- Fix quest::addldonwin(theme_id) in Perl.
- Add client:AddLDoNLoss(theme_id) to Lua.
- Add client:AddLDoNWin(theme_id) to Lua.
- Add eq.add_ldon_loss(theme_id) to Lua.
- Add eq.add_ldon_points(theme_id, points) to Lua.
- Add eq.add_ldon_win(theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_expedition_id(expedition_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_points_by_char_id(character_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_group_id(group_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_raid_id(raid_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_guild_id(guild_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_expedition_id(expedition_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_win_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_expedition_id(expedition_id, theme_id) to Lua.
2021-05-24 21:15:41 -05:00
hg 15328196e2 [Expeditions] Store members on dynamic zone (#1358)
This moves members from expeditions so other systems can use them

Replace expedition_members table with dynamic_zone_members

Move 'EnableInDynamicZoneStatus' rule to DynamicZone namespace

Modify #dz list to show dz members (not instance players) and type name

Move various queries to repository methods
2021-05-24 21:14:32 -05:00
splose e8b94a11f1 [Rules] Add rule to allow you to cast invis on already invis'd players (#1361) 2021-05-24 20:29:27 -05:00
TurmoilToad 7458b5f32f [Docs] Create CODE_OF_CONDUCT.md (#1360) 2021-05-24 20:23:50 -05:00
hg efa245d636 [Quest API] Add write overloads to lua packet quest api (#1366)
Makes prototyping easier without having to manually track an offset

Also add GetWritePosition and SetWritePosition
2021-05-24 20:22:31 -05:00
Michael Cook (mackal) e5b9d72b81 [Fix] Fix Spell Cast Time reduction issues (#1369)
Remove the overloads that don't make sense (bots probably doesn't make
sense either, but too lazy)

Fix the formulas

Removed the Spells:MaxCastTimeReduction rule since this is HARDCODED in
the client so it doesn't really make sense to have it as a customization
point. If you want to hack the client, change the hardcode as well I
guess.
2021-05-24 20:21:39 -05:00
Alex 93329b4b06 [Shared Bank] Add additional popup to shared bank warning message, as client-side filters can cause the message to be unseen. (#1368) 2021-05-24 20:15:37 -05:00
Michael Cook (mackal) b65cf4c081 This skill bonus was suppose to only apply to monks with epics (#1364)
This also scales up to 280 skill, so under that, you don't get as high
of a bonus
2021-05-19 19:40:51 -04:00
Dencelle a59ffc6e6b [Bug Fix] EntityList::AESpell fix for Pacify / Mez (#1354)
* [Bug Fix] EntityList::AESpell fix for Pacify / Mez

this fixes AE pacify / Mez spells only landing on 4 when it shouldn't have a cap

* Update effects.cpp

added constants

* Update effects.cpp

opmization thanks to @mackal

* Update effects.cpp

this fixes the unlimited issue

* added Spells:AOEMaxTargets to rules

incase a server doesn't want there to be a absolute unlimited AOE targeting for spells

* Update ruletypes.h
2021-05-15 17:33:45 -04:00
hg c1c2d7b302 [Dynamic Zones] Store min and max players on dz (#1355)
This starts some changes that move storage of things from expeditions to
dynamic zone class so other systems can possibly use them. This will also
make it easier to move window packet creation methods to DynamicZone.

For now these will remain on the expeditions table in the database. This
can be re-evaluated once other components are moved and seeing how other
systems may want to handle their player requirements.
2021-05-12 19:59:48 -05:00
Paul Coene 4cc24dea75 [GM Command] #list npcs Goto option now goes to higher Z if selected NPC is a boat. (#1349)
* #list npcs Goto option now goes to higher Z if npc selected is a boat.

Makes using #list npcs and using the goto button more useful when NPC is a boat, as normal Z will put you in the water.

* Use ?: instead of bool multiply

* Update command.cpp
2021-05-12 19:17:55 -05:00
hg 1f896d05ed [Repository Generator] Fix repository generator on windows (#1353)
Remove hardcoded port
2021-05-12 19:16:29 -05:00
Michael Cook (mackal) 1f978ffd72 [Bug Fix] EntityList::AESpell was off by one (#1351)
We need to do the spell effect first, then check the limits
2021-05-12 19:13:05 -05:00
JJ 6ce273baf5 [SQL] Tweak SQL from #1339 [skip ci] (#1348) 2021-05-10 11:13:58 -05:00
Alex e18b332414 [CLE] Reset iterator in IsAccountInGame() (#1345) 2021-05-10 01:34:40 -05:00
Paul Coene 2edda6e743 [Feature] Allow any spawn2 spawned mob to path while zone is idle if new flag is set. (#1339)
* Changes to allow any spawn2 to be marked to path even when zone is idle

* Fixed for Kingly review of PR

Co-authored-by: Noudess <noudess@gmail.com>
2021-05-10 01:21:43 -05:00
Paul Coene b335568bf9 Prevent client update while on boat if boat turning (#1343)
Co-authored-by: Noudess <noudess@gmail.com>
2021-05-10 01:15:38 -05:00
JeffyW 0758250ad1 [Installer] $ENV support, formatting, and optimizations (#1340)
* [Installer] $ENV support

Add support for passing in installation variables instead of install_variables.txt.

In particular:
- EQEMU_SERVER_SKIP_UPDATE
- EQEMU_SERVER_SKIP_MAPS_UPDATE
Both work the same as files with the same name.

- MYSQL_DATABASE
- MYSQL_USER
- MYSQL_PASSWORD
All get read into the same $installation_variables collection, and are still overridden by any values found in installation_variables.txt

- MYSQL_HOST
Added to the list of $installation_variables, supported in installation_variables.txt, and overrides the default host for where the database lives (allowing it to be a separate container)

- MYSQL_ROOT_PASSWORD
If set, will use "root" as the user for DROP/CREATE DATABASE calls, to prevent requiring the "eq" user requiring more permission than is given by default with the MySql/MariaDB containers.

* [Installer] new_server_with_bots

Enabling bots requires both updated binaries and some database scripts.  Fetching source and compiling the code is the longest part of setting up a new server.  If you know you want bots, rather than having to do it twice, we can just accept an option to do it all at the same time.

* [Installer] Git/Source/Build optimizations

Source code is the same for bot/non-bot, so switch to a common directory for source and separate directories for build.

If the source directory already exists with a .git subfolder, rather than attempt to re-clone, instead do a git pull to still get the latest code.  Helps when using a shared volume but rebuilding containers.

* [Installer] Formatting / Cleanup

Fixed some indentation, added an existing option to the utility script output, removed some excess newlines, and moved a debug output to help identifying errors.
2021-05-10 01:15:11 -05:00
Paul Coene 843aac631b [Bug Fix] Add debugging and fix edge case where no target for aggro mob (#1344)
Co-authored-by: Noudess <noudess@gmail.com>
2021-05-10 01:10:13 -05:00
hg 0ce7c11d36 [Expeditions] Track DZ member status in world (#1341)
World now caches and tracks member statuses so it can send them to zones
that request them on startup. Prior to this the cle would be searched in
world for every zone startup caching request, now it's only searched once
when a new expedition is created.

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

This also lets world choose non-linkdead members on expedition leader
changes and better detect when a leader change needs to occur
2021-05-10 01:07:19 -05:00
Alex 26d374d52a [Quest API] Add IsRaidTarget() to Perl and Lua (#1347)
- Add $npc->IsRaidTarget() to Perl.
- Add npc:IsRaidTarget() to Lua.
2021-05-10 01:05:46 -05:00
Paul Coene 39f5949441 #grid delete was deleting the grids everywhere (#1346)
Fix to only delete correct zone grid.
2021-05-09 16:39:54 -04:00
hg abf73947f4 [Dynamic Zones] Rename dynamic zone structs (#1327)
* Rename dz member id field

The name of the struct is enough to make this implicit

* Rename dz member enum and struct

Rename ExpeditionMember to DynamicZoneMember

Rename ExpeditionMemberStatus to DynamicZoneMemberStatus

* Rename dz window packet structs

This makes it more clear the window may be used by any dynamic zone
system not just expeditions (live missions fill the window when
player doesn't have an active expedition).

* Rename dz window packet fields
2021-04-27 18:53:56 -05:00
Michael Cook (mackal) 4358e24dab [Bug Fix] Fix use-after-free corruption with some DB calls (#1335) 2021-04-27 18:53:34 -05:00
Michael Cook (mackal) c063d9512e [Rule] Add a rule to disable the Pet Resist buff (#1337)
Spells:July242002PetResists defaults to true
2021-04-27 18:52:39 -05:00
Alex 39de9c04f6 Add new experience modifiers table to GetCharacterTables() and GetPlayerTables() in database_schema.h. (#1338) 2021-04-27 18:52:00 -05:00
Alex 1637ea95cb Fix Perl NPC GetAvoidanceRating() Perl Croak. (#1333) 2021-04-27 17:46:59 -04:00
Paul Coene 6fb687871c Fix calls to GetSafePoints to not pass null_ptr as zonename (#1336)
* Fix calls to GetSafePoints to not pass null_ptr as zonename

* Fix GetSafePoints to check and deal will nullptr being sent as short_zone_name

* Remove unintentinal formatting change

* Fix some typos/cut-n-paste errors I assume

Co-authored-by: Noudess <noudess@gmail.com>
2021-04-27 17:21:37 -04:00
Alex dd06033a58 Add character-specific zone-based experience modifiers. (#1326)
* Add character-specific zone-based experience modifiers.

This will allow server operators to give players individual experience modifiers (regular and AA).

Zone ID 0 will server as a global modifier for players, if no rows are found the modifier defaults to 1.0 so experience is neither increased nor decreased.

Setting a zone-specific modifier will override the zone ID 0 global modifier.

Requires a SQL update: sql/git/required/2021_04_11_character_exp_modifiers.sql

- Add quest::getaaexpmodifierbycharid(character_id, zone_id) to Perl.
- Add eq.get_aa_exp_modifier_by_char_id(character_id, zone_id) to Lua.
- Add quest::getexpmodifierbycharid(character_id, zone_id) to Perl.
- Add eq.get_exp_modifier_by_char_id(character_id, zone_id) to Lua.
- Add quest::setaaexpmodifierbycharid(character_id, zone_id, aa_modifier) to Perl.
- Add eq.set_aa_exp_modifier_by_char_id(character_id, zone_id, aa_modifier) to Lua.
- Add quest::setexpmodifierbycharid(character_id, zone_id, exp_modifier) to Perl.
- Add eq.set_exp_modifier_by_char_id(character_id, zone_id, exp_modifier) to Lua.
- Add $client->GetAAEXPModifier(character_id, zone_id) to Perl.
- Add client:GetAAEXPModifier(character_id, zone_id) to Lua.
- Add $client->GetEXPModifier(character_id, zone_id) to Perl.
- Add client:GetEXPModifier(character_id, zone_id) to Lua.
- Add $client->SetAAEXPModifier(zone_id, aa_modifier) to Perl.
- Add client:SetAAEXPModifier(zone_id, aa_modifier) to Lua.
- Add $client->SetEXPModifier(zone_id, exp_modifier) to Perl.
- Add client:SetEXPModifier(zone_id, exp_modifier) to Lua.

* Removed unneeded [].

* Fix variable name,

* Fix variable name.

* Fix version.h.

* Rename 2021_04_11_character_exp_modifiers.sql to 2021_04_23_character_exp_modifiers.sql

* Update db_update_manifest.txt
2021-04-23 08:47:39 -04:00
Alex 13a50f7806 [Quest API] Add HTML color tag method to Perl and Lua. (#1324)
* Add HTML color tag method to Perl and Lua.
- Add quest::gethexcolorcode(color_name) to Perl.
- Add eq.get_hex_color_code(color_name) to Lua.

Full color list here: https://pastebin.com/rUYKr1ye

* Convert to static and use strcasecmp over strcmp.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-04-22 23:52:00 -05:00
Paul Coene c18562b150 [Bug] Fix ignore_primary_assist. (#1323)
* [Bug] Fix ignore_primary_assist.

* Fix to continue loop instead of return

Co-authored-by: Noudess <noudess@gmail.com>
2021-04-22 23:40:17 -05:00
Michael Cook (mackal) dba3010c89 [Strings] Split String Optimizations (#1325)
* Switch the 2 split calls to SplitString

* Nuke duplicate split in favor of SplitString #1263

* Add a test for SplitString

* Optimize SplitString

Benchmarking:
--------------------------------------------------------------
Benchmark                       Time           CPU Iterations
--------------------------------------------------------------
bench_oldsplit               5201 ns       5201 ns     129500
bench_split                  1269 ns       1269 ns     548906

This is splitting a VERY long SpecialAbilities string. This is ~75%
speed up.
2021-04-22 23:36:39 -05:00
Alex 00fb9bc9f9 [Bug Fix] Zone Heading for Binds, Summons, Teleports, and Zoning. (#1328)
* For as long as I can remember people have had issues with zoning in, facing the wrong way, and walking through a zone line.

With this we will be able to set zone's safe heading as well as preserve heading on summon (NPC or GM) and teleports between zones.

This affects several pre-existing quest methods and extends their parameters to allow for the addition of heading.

The following functions have had heading added.
Lua
- client:SetBindPoint()
- client:SetStartZone()

Perl
- $client->SetBindPoint()
- $client->SetStartZone()
- quest::rebind()

SetStartZone parameter list was fixed also.

This converts some pre-existing methods from glm::vec3() to glm::vec4() and has an overload where necessary to use a glm::vec3() method versus glm::vec4() method.

This shouldn't affect any pre-existing servers and will allow PEQ and others to document safe headings for zones properly.

* Removed possible memory leaks.

* Fix SQL.

* Fix client message.

* Fix debug log.

* Fix log message.

* Fix call in rebind overload.

* Fix floats.

* Add default to column.
2021-04-22 22:49:44 -05:00
splose 5893730704 [Rules] Add rule 'GM:MinStatusToBypassLockedServer' (#1330)
* Add rule 'GM:MinStatusToBypassLockedServer'
Default Status: 100
Description: Players >= this status can log in to the server even when it is locked

* Add rule 'GM:MinStatusToBypassLockedServer'
Default Status: 100
Description: Players >= this status can log in to the server even when it is locked
2021-04-22 22:42:14 -05:00
Alex 0f23bd24cc [Quest API] Convert Client GetLastName() method export to Mob export. (#1331) 2021-04-22 22:41:19 -05:00
Peter Rigby 324d48aa90 [Fix] Moved assigning of AISpellVar variables before AI_Start() so that any values that override the rule values will not be ignored (#1321) 2021-04-07 01:22:42 -05:00
hg dadc1b2843 [Expeditions] Refactor expedition caching (#1315)
Add common expedition base class

Use repository for zone and world expedition caching

World now stores members and leader as Member objects instead of ids

This improves readability of the caching methods and lets world cache
expedition dzs and members like zone. World also now caches expeditions
as unique_ptr which will be necessary for future dz callback lambdas
that capture 'this' so addresses don't change on cache vector resizes.
2021-04-07 01:20:35 -05:00
Michael Cook (mackal) 0534a2c6be Switch scheduled hot zone check to search instead of split (#1313)
Using search_deliminated_string here is significantly faster than
splitting, most likely because of dynamic memory management

Some tests on my system:

----------------------------------------------------
Benchmark             Time           CPU Iterations
----------------------------------------------------
bench_split         864 ns        864 ns     807922
bench_search         35 ns         35 ns   20265205

This test was a case where the string was present somewhere in the
middle which gave a ~96% speed up

----------------------------------------------------
Benchmark             Time           CPU Iterations
----------------------------------------------------
bench_split         936 ns        936 ns     725518
bench_search         61 ns         61 ns   11156359

This test was when the string was not present, which will be the vast
majority of times this is actually checked, was ~93% speed up
2021-04-07 01:17:30 -05:00
RoTPvP 050e78b1b6 Added a check to stop Bard song for Mezz/Stun (#1319)
* Added a check to stop Bard song for Mezz/Stun

* Cleaned Song stun / mezz stop

* Update client_process.cpp

* removed bard check & added else where

* code clean up

Co-authored-by: ProducerZekServer <go@away.com>
2021-04-02 23:44:59 -04:00
Michael Cook (mackal) 084b253ff7 Hack to fix repulsable bard charms (#1320)
This isn't the exactly the right way, but it's behavior is much closer
to live than current for Solon's Song of the Sirens (725), the other
bard charms don't repulse due to mana cost
2021-04-01 14:19:47 -04:00
Michael Cook (mackal) a9a83a2052 [Bug Fix] Misc Bard Song Fixes (#1317)
* Bards song with a mana cost shouldn't repulse

* Bard songs with SE_TemporaryPets shouldn't repulse

This is mostly just an issue with Vet AAs, the actually songs have a
recast, so are already handled

* SE_Familiar should be prevented as well
2021-04-01 14:19:29 -04:00
Akkadius d117ce0bf2 [Hotfix] Incorrect Perl usage method (docs) 2021-03-31 00:18:43 -05:00
hg 10b1f7e1ca Add missing includes to fix windows compile (#1314) 2021-03-29 18:09:36 -05:00
Akkadius 4ac32d89e8 [Hotfix] DB Manifest 2021-03-29 03:01:07 -05:00
Chris Miles 7aa5308f9c [Scheduler] Event scheduler implementation (#1257)
* Event scheduler implementation

* Create 2021_02_17_server_scheduled_events.sql

* Tweak

* Remove unused event [skip ci]

* Cleanup [skip ci]

* PR adjustments

* Database manifest
2021-03-29 02:52:57 -05:00
Michael Cook (mackal) f51bc4daaf [Fix] Clean up Filtered/MessageString functions (#1311)
This solves the OOB issue pointed out in #1304 and cleans up the code a
bit so it should be less error prone
2021-03-29 02:18:03 -05:00
hg 049fe55c7f [Expeditions] Create common dz abstract class (#1312)
This creates an abstract class in common so zone and world can share
most of the implementation. World now has access to the same dz data and
api as zone.

Rename CharacterChange to AddRemoveCharacter for clarity

Rename GetRemainingDuration to GetDurationRemaining for consistency

Move dynamic zone queries to custom repository methods
2021-03-29 02:17:36 -05:00
hg f5cf566fca [Expeditions] Let dz process its expired state (#1310)
Move early empty shutdown and process rate rules to DynamicZone scope

This decouples the expired status check from expeditions into an
internal dz method that can be called by its owning system
2021-03-28 20:43:09 -05:00
Alex 97c11a1199 [Quest API] Add new zone name methods to Perl and Lua. (#1309)
- Add quest::GetZoneShortName(zone_id) to Perl.
- Add quest::GetZoneLongNameByID(zone_id) to Perl.
- Add eq.get_zone_id_by_name(zone_name) to Lua.
- Add eq.get_zone_short_name_by_id(zone_id) to Lua.
- Add eq.get_zone_long_name_by_id(zone_id) to Lua.
- Add eq.get_zone_long_name_by_name(zone_name) to Lua.
2021-03-28 20:25:50 -05:00
Akkadius ba64d6f494 [Installer] Swap unstable powershell download for Perl LWP::Simple call 2021-03-28 20:04:34 -05:00
Alex 410ba4b19a [Rules] Cleanup all unused rules. (#1308) 2021-03-28 18:37:21 -05:00
Paul Coene 74076078bb [Boats] Fix x/y offsets from client to reflect EQ x/y instead of boat heading… (#1296)
* Fix x/y offsets from client to reflect EQ x/y instead of boat heading x/y

* Use std version of math calls and reduce the # of calls

* Remove errant instrumentation

Co-authored-by: Noudess <noudess@gmail.com>
2021-03-28 18:20:02 -05:00
hg d9e23a0303 [Expeditions] Decouple dz updates from expeditions (#1303)
Use internal dz messages to process duration and location changes

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

Add FindDynamicZoneByID to get dz from zone and world system caches
2021-03-28 18:14:36 -05:00
Thalix dbb9c1d4f4 Minor ruletypes.h cleanup (#1306)
Minor ruletypes.h cleanup
2021-03-28 18:06:56 -05:00
Michael Cook (mackal) d202695e88 [Cleanup] Only link Lua with zone (#1288)
Only zone requires to be linked to lua, so let's not link EVERYTHING.

There is probably more clean up we could do, but I know for a fact Lua
is only used by zone.

This probably has some measurable benefits that probably don't really
matter that much :)
2021-03-19 00:12:46 -05:00
Michael Cook (mackal) 323f5ea92e [Bug Fix] Add Bounds Checking to OP_LFGCommand Comment Processing
Theoretically this could be used to corrupt memory, but they would have
to get extremely lucky to actually execute a successful attack
2021-03-18 23:43:13 -05:00
hg 5b74f1e756 [Expeditions] Refactor expedition requests (#1301)
Move ExpeditionLockoutTimer to common

This simplifies expedition request conflict checks and uses repository
for the queries instead of processing the query result directly.
2021-03-18 23:42:41 -05:00
hg ee4af65268 [Expeditions] Cleanup client dz safe return methods (#1300)
This changes Zone::GetDynamicZone to return a pointer instead of a copy
and also lets DynamicZone be forward declared in zone.h
2021-03-18 23:42:20 -05:00
hg 739b975cad [Expeditions] [Quest API] Add expedition IsLocked to Quest API (#1292) 2021-03-16 00:04:08 -05:00
Thalix 5035451af7 [Crash] Bugfix for zone crash caused by #flymode -1 (#1291)
* Update command.cpp

Fixed typo in the command description.

* Bugfix for #flymode zone crash

Bugfix for #flymode zone crash when invalid values are passed. Also, when entering #flymode without parameters, the correct syntax is now displayed.

* Changed as requested
2021-03-16 00:03:35 -05:00
hg 18a3ff5f12 Throttle auto expedition leader changes (#1293)
This fixes unnecessary leader processing on mass dzquits

Also marks leader dirty for empty expeditions in case something goes
wrong (shouldn't be possible after 62e480fe)
2021-03-16 00:01:48 -05:00
hg 0d12bf0b1f [Expeditions] Store description and leader name on dz (#1294)
* Rename dynamic zone source files

* Store description and leader name on dz

Removes the DynamicZoneInfo struct used for switch list window. This
data can be stored on DynamicZone and kept updated by its owning system

* Separate create compass packet method

Cleanup MarkSingleCompassLoc
2021-03-16 00:00:55 -05:00
splose b3fbe1b015 add quest::get_spell_level(uint16 spell_id, uint8 class_id) (#1295) 2021-03-15 23:59:09 -05:00
splose e9cd0b15a2 setting spawn2.version to -1 will now properly spawn mobs in all zone versions (#1299) 2021-03-15 23:57:54 -05:00
Alex cd08c96fa4 [Quest API] Add secondstotime(duration) to Perl and Lua. (#1281)
- Add quest::converttime(duration) to Perl.
- Add eq.convert_time(duration) to Lua.
2021-03-11 21:38:47 -05:00
Paul Coene ac4a993259 Remove unneeded calls to DoAnim() for spells/bardsong (#1290)
* Removed DoAnim() call from spells and bard song.  Tested on rof2 and titanium

Co-authored-by: Noudess <noudess@gmail.com>
2021-03-10 00:07:30 -05:00
Thalix 435bac5599 Update command.cpp (#1289)
Fixed typo in the command description.
2021-03-07 14:40:50 -05:00
Michael Cook (mackal) d5d6b911b0 Merge pull request #1286 from EQEmu/bug_fix/petonspawn_copypasteerror
Fix copy and paste error
2021-03-06 20:09:12 -05:00
Michael Cook (mackal) 29cdca380f Fix copy and paste error 2021-03-06 19:58:18 -05:00
Alex e5f5db69b4 Merge pull request #1280 from EQEmu/bug_fix/strcpy_overlap_GetGroupLeadershipInfo
[ASan] Fix strcpy-param-overlap with GetGroupLeadershipInfo calls
2021-03-05 19:24:42 -08:00
Alex d635e69ee3 Merge pull request #1283 from EQEmu/cleanup/Wformat-overflow
[Cleanup] Make code -Wformat-overflow safe
2021-03-05 19:23:48 -08:00
Alex a1531aa057 Merge pull request #1282 from EQEmu/bug_fix/spawngroup_leak_repop
[Leak] Port SpawnGroup stuff to unique_ptr to fix leak
2021-03-05 19:23:00 -08:00
Alex b24ba221e9 Merge pull request #1279 from EQEmu/bug_fix/group_delete
[ASan] Fix heap-use-after-free issue with groups
2021-03-05 19:20:34 -08:00
Alex 253f0594e4 Merge pull request #1278 from EQEmu/akkadius/fix-skill-caps-loading-consistency
[Bugfix] Fix Skill Caps Loading References
2021-03-05 19:20:11 -08:00
Alex 02517bf6ab Merge pull request #1276 from EQEmu/cleanup/uv_handle_cast_deletes
[ASan] Use casts to silence ASan complaints
2021-03-05 19:19:42 -08:00
Alex 184128a79b Merge pull request #1275 from EQEmu/bug_fix/stack-buffer-overflow_StopLFP
[ASan] Fix stack-buffer-overflow thanks to StopLFP
2021-03-05 19:17:12 -08:00
Alex 93869dbef6 Merge pull request #1273 from EQEmu/hate_list_quest_api
[Quest API] Add GetHateClosest() and GetHateListByDistance(distance) to Perl and Lua.
2021-03-05 19:16:38 -08:00
Alex af82a6c5d5 Merge pull request #1272 from noudess/master
[Bug Fix] Do not summon pet or set new pet state when PC summoned by a mob
2021-03-05 19:16:03 -08:00
Alex fdca333280 Merge pull request #1271 from EQEmu/cleanup/world_client_clearance
[ASan] Make Client::Clearance less gross
2021-03-05 19:14:26 -08:00
Alex c954c08c07 Merge pull request #1267 from EQEmu/bug_fix/realodquest_encounter_crash
[Crash] Fix ReloadQuest on Shutdown crash related to encounters
2021-03-05 19:13:58 -08:00
Michael Cook (mackal) 0b8220be32 Clean up last name handling in NPC::PetOnSpawn
Same as last time
2021-03-05 15:51:59 -05:00
Michael Cook (mackal) f7d40ec88e Clean up Merc::LoadMerc lastname processing
This is still less than ideal, but client's name restrictions should
prevent this from being an actual problem
2021-03-05 15:43:06 -05:00
Michael Cook (mackal) 316336d1cf Nuke ZoneDatabase::GetEventLogs
This wasn't called anywhere and was throwing format-overflow warnings
2021-03-05 15:25:32 -05:00
Michael Cook (mackal) 224c26620e Clean up MOTD processing 2021-03-05 15:24:40 -05:00
Michael Cook (mackal) c6d5864aa9 Port SpawnGroup stuff to unique_ptr to fix leak
This was leaking on #repop, unsure of other cases, smart pointers should
cover us though.

Direct leak of 3600 byte(s) in 18 object(s) allocated from:
    #0 0x7f2b3dbe0d30 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x5645dc7c9dff in ZoneDatabase::LoadSpawnGroups(char const*, unsigned short, SpawnGroupList*) ../zone/spawngroup.cpp:241
    #2 0x5645dc9db3f5 in Zone::Depop(bool) ../zone/zone.cpp:1746
    #3 0x5645dca1ba6b in Zone::Repop(unsigned int) ../zone/zone.cpp:1777
    #4 0x5645db4624b7 in command_repop(Client*, Seperator const*) ../zone/command.cpp:5683

Indirect leak of 6552 byte(s) in 273 object(s) allocated from:
    #0 0x7f26f2ff8d30 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x558d00490bc6 in __gnu_cxx::new_allocator<std::_List_node<SpawnEntry*> >::allocate(unsigned long, void const*) /usr/include/c++/8/ext/new_allocator.h:111
    #2 0x558d00490bc6 in std::allocator_traits<std::allocator<std::_List_node<SpawnEntry*> > >::allocate(std::allocator<std::_List_node<SpawnEntry*> >&, unsigned long) /usr/include/c++/8/bits/alloc_traits.h:436
    #3 0x558d00490bc6 in std::__cxx11::_List_base<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_get_node() /usr/include/c++/8/bits/stl_list.h:450
    #4 0x558d00490bc6 in std::_List_node<SpawnEntry*>* std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_create_node<SpawnEntry* const&>(SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:642
    #5 0x558d00490bc6 in void std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_insert<SpawnEntry* const&>(std::_List_iterator<SpawnEntry*>, SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:1903
    #6 0x558d00490bc6 in std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::push_back(SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:1220
    #7 0x558d00490bc6 in SpawnGroup::AddSpawnEntry(SpawnEntry*) ../zone/spawngroup.cpp:122
    #8 0x558d00490bc6 in ZoneDatabase::LoadSpawnGroups(char const*, unsigned short, SpawnGroupList*) ../zone/spawngroup.cpp:291
    #9 0x558d006a1465 in Zone::Depop(bool) ../zone/zone.cpp:1746
    #10 0x558d006e1adb in Zone::Repop(unsigned int) ../zone/zone.cpp:1777
2021-03-02 12:39:04 -05:00
Michael Cook (mackal) c45395be95 Fix strcpy-param-overlap with GetGroupLeadershipInfo calls
==1810==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7ffef04baf90,0x7ffef04baf98) and [0x7ffef04baf90, 0x7ffef04baf98) overlap
    #0 0x7f163bb9509e  (/lib/x86_64-linux-gnu/libasan.so.5+0x4f09e)
    #1 0x5652caed27b3 in Client::Handle_Connect_OP_ZoneEntry(EQApplicationPacket const*) ../zone/client_packet.cpp:1535

==1918==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7ffddc8057c0,0x7ffddc8057c8) and [0x7ffddc8057c0, 0x7ffddc8057c8) overlap
    #0 0x7fc61ee0e09e  (/lib/x86_64-linux-gnu/libasan.so.5+0x4f09e)
    #1 0x56023c149698 in WorldServer::HandleMessage(unsigned short, EQ::Net::Packet const&) ../zone/worldserver.cpp:1055
2021-02-28 21:42:51 -05:00
Michael Cook (mackal) 6d47351d15 Fix heap-use-after-free issue with groups
==2317==ERROR: AddressSanitizer: heap-use-after-free on address 0x6170000633c0 at pc 0x55ed1d8e8d8b bp 0x7ffda4bef580 sp 0x7ffda4bef578
WRITE of size 8 at 0x6170000633c0 thread T0
    #0 0x55ed1d8e8d8a in Group::SetLeader(Mob*) ../zone/groups.h:80
    #1 0x55ed1d8e8d8a in Group::DisbandGroup(bool) ../zone/groups.cpp:1016

ASan didn't like this
2021-02-28 21:40:50 -05:00
Akkadius 450c748299 Fix database connection pointer bucket consistency 2021-02-28 19:31:46 -06:00
Michael Cook (mackal) cafae9d8c6 Use casts to silence ASan complaints
I don't think these are actually causing any real problems, ASan
complains about them though since it's kind of a code smell I guess and
a potential source of problems. But our case is fine, so cast to silence
them.
2021-02-28 18:01:34 -05:00
Michael Cook (mackal) b82f376bfb Fix stack-buffer-overflow thanks to StopLFP
==1674==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffb47f3068 at pc 0x7f64ee1f531e bp 0x7fffb47f2f50 sp 0x7fffb47f2700
READ of size 432 at 0x7fffb47f3068 thread T0
    #0 0x7f64ee1f531d  (/lib/x86_64-linux-gnu/libasan.so.5+0x3f31d)
    #1 0x55c78e8d002e in WorldServer::UpdateLFP(unsigned int, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int, char const*, GroupLFPMemberEntry*) ../zone/worldserver.cpp:3166
    #2 0x55c78e8d01d9 in WorldServer::StopLFP(unsigned int) ../zone/worldserver.cpp:3180
2021-02-28 17:50:07 -05:00
Michael Cook (mackal) 66f89416d5 Merge pull request #1270 from EQEmu/bug_fix/dbcore_wrong_delete
Fix deletes in DBcore::Open
2021-02-27 15:30:06 -05:00
Michael Cook (mackal) 11d0da9560 Merge pull request #1274 from EQEmu/bug_fix/zlibng-pathfix
Fix zlibng paths for appveyor
2021-02-27 14:09:51 -05:00
Michael Cook (mackal) 8de9e86fed Merge pull request #1266 from EQEmu/bug_fix/init_PhR
Initialize Mob::PhR
2021-02-27 12:29:54 -05:00
Michael Cook (mackal) 05c407fbb2 Fix zlibng paths for appveyor 2021-02-27 12:12:41 -05:00
Michael Cook (mackal) aaf41001f1 zlib-ng1.dll ends up in a different path (#1268) 2021-02-27 02:57:04 -06:00
Alex af517be184 Merge branch 'master' into hate_list_quest_api 2021-02-25 22:58:41 -05:00
Kinglykrab 1af1b7bbdc [Quest API] Add GetHateClosest() and GetHateListByDistance(distance) to Perl/Lua. 2021-02-25 22:53:33 -05:00
Noudess 1f3ce2b34d Remove pet move/follow on non-GM summon PCy 2021-02-25 12:12:25 -05:00
Noudess 2f239fd6a3 Don't take pet guard off when PC is summoned 2021-02-25 07:38:16 -05:00
Michael Cook (mackal) ab005e5950 [Cleanup] Make Client::Clearance less gross
It's still pretty gross, but the bits ASan really hated are less gross
2021-02-25 01:50:58 -05:00
Michael Cook (mackal) 7349f99ba2 Fix deletes in DBcore::Open
These are arrays!
2021-02-25 00:07:36 -05:00
Michael Cook (mackal) 3e7d4d1d6b We want GetEncounterName here instead 2021-02-24 02:52:15 -05:00
Michael Cook (mackal) 43fade82e5 Fix ReloadQuest on Shutdown crash related to encounters
Basically, EntityList::RemoveAllEncounters is called before ReloadQuests
resulting in stale pointers in the lua_encounters map.

We just have to remove the entry from the map.
2021-02-24 01:03:38 -05:00
Michael Cook (mackal) 3630f3ec38 Initialize Mob::PhR 2021-02-23 22:34:14 -05:00
Alex 66d24ff419 [Quest API] Add IsHorse() to Perl and Lua. (#1264) 2021-02-23 20:50:06 -06:00
Alex 2346b0f6ab Fix SQL for NPC Spells. (#1265)
* Fix SQL for NPC Spells.

* Update 2021_02_15_npc_spell_entries_unsigned.sql
2021-02-23 21:32:06 -05:00
Alex 2957f5084d [Library] Update zlibng (#1255)
* Update zlibng

* Set cmake path more directly in zlibng to hopefully fix an issue with the build on drone

* I'm dumb, missing / in path

* Mackal helps with a dumb gitignore issue

* Adding all the files, not sure what's ignoring them and im tired of looking

* Some tweaks to zlibng build to hopefully get it to build properly. works on msvc now
2021-02-23 19:00:26 -06:00
Alex e6dee96266 Convert NPC Spell AI from int16 to uint16. (#1262) 2021-02-23 18:33:33 -06:00
Michael Cook (mackal) 86ce506956 [Cleanup] Nuke Make/AppendAnyLenString (#1251)
* Add a std::string overload for Database::SetMQDetectionFlag

* Replace calls to MakeAnyLenString in client_packet.cpp

At least the SetMQDetectionFlag ones

* Replace MakeAnyLenString calls in client_process

At least SetMQDectectionFlag ones

* Replace MakeAnyLenString in embparser

fmtlib actually is gross here, oh well.

* Replace MakeAnyLenString in merc

* Replace MakeAnyLenString in inventory

Also if'd out an unfinished implementation of Client::GetItemLinkHash

* Replace AppendAnyLenString in zonelist

* Replace AppendAnyLenString in zonelist

* Replace MakeAnyLenString in clientlist

* Nuke MakeAnyLenString/AppendAnyLenString

* Fix formatting string in zonelist
2021-02-23 18:32:19 -06:00
Michael Cook (mackal) 7a46a6595c [Cleanup] use std::make_unique (#1259)
* Convert common/eq_limits.cpp to use make_unique

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

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

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

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

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

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

* Convert common/shareddb.cpp to use make_unique

* Convert eqlaunch/worldserver.cpp to use make_unique

* Convert loginserver/server_manager.cpp to use make_unique

* Convert loginserver/world_server.cpp to use make_unique

* Convert queryserv/worldserver.cpp to use make_unique

* Convert ucs/worldserver.cpp to use make_unique

* Convert world/clientlist.cpp to use make_unique

* Convert world/expedition.cpp to use make_unique

* Convert world/launcher_link.cpp to use make_unique

* Convert world/login_server.cpp to use make_unique

* Convert world/main.cpp to use make_unique

* Convert world/ucs.cpp to use make_unique

* Convert world/web_interface.cpp to use make_unique

* Convert world/zonelist.cpp to use make_unique

* Convert world/zoneserver.cpp to use make_unique

* Convert zone/client.cpp to use make_unique

* Convert zone/corpse.cpp to use make_unique

* Convert zone/dynamiczone.cpp to use make_unique

* Convert zone/expedition.cpp to use make_unique

* Convert zone/main.cpp to use make_unique

* Convert zone/mob_ai.cpp to use make_unique

* Convert zone/mob_movement_manager.cpp to use make_unique

* Convert zone/pathfinder_nav_mesh.cpp to use make_unique

* Convert zone/worldserver.cpp to use make_unique
2021-02-23 18:30:46 -06:00
TurmoilToad fa9478ac44 [Quest API] Perl Entity List Annotations (#1243)
Added category tag annotations for perl entity list methods.
2021-02-23 12:03:16 -06:00
TurmoilToad cc7904e1bc [Quest API] Perl Hate Entry Annotations (#1244)
Added category tag annotations for Hate Entry methods.
2021-02-23 12:02:51 -06:00
TurmoilToad dba69abefc [Quest API] Perl Door Annotations (#1241)
Add category type annotations to door methods.
2021-02-23 12:00:11 -06:00
TurmoilToad 041879c4e6 [Quest API] Perl NPC Annotations (#1245)
Added category tag annotations for NPC methods.
2021-02-23 11:59:57 -06:00
Michael Cook (mackal) 0887eb0976 Fix NPC Scale Manager leaking (#1254)
It should be fine to init further down after the early returns.

This wasn't really a leak that affected performance, but mainly moving
to shutup valgrind
2021-02-23 11:59:03 -06:00
TurmoilToad f8edde9587 [Quest API] Perl Mob Annotations (#1258)
Added category tag annotations for mob methods.
2021-02-23 11:54:01 -06:00
Michael Cook (mackal) 74ce20b256 Add string util search_deliminated_string (#1260)
This function takes a string of deliminated an see if another string is
one of those

This function also verifies it's not finding a substring
2021-02-23 11:52:34 -06:00
TurmoilToad 1cfdd7e4a2 [Quest API] Perl Group Annotations (#1261)
Added category tag annotations for group methods.
2021-02-23 11:51:51 -06:00
Alex bf3593a60d [Experience] Add exp mod to npc types to let a server op change the exp modifier (#1252)
* Add exp mod to npc types to let a server op change the exp modifier a npc gives (useful for custom content)

* Updated version.h
2021-02-23 11:50:38 -06:00
Alex 65704274cb [Quest API] Resolves traindiscs and scribespells issues in Perl/Lua. (#1249) 2021-02-14 19:15:09 -05:00
Michael Cook (mackal) 1bc9e8aff2 Merge pull request #1239 from noudess/sneak-pull
[Game Play Mechanic] Very simple implementation of Sneak Pull
2021-02-14 18:04:30 -05:00
KimLS c23da55b95 Fix for issue in movement manager where a drop aggro can happen and processing continues. 2021-02-14 13:08:33 -08:00
Michael Cook (mackal) 2a37785a7c Merge pull request #1248 from EQEmu/remove_unused_files
[Cleanup] Remove unused files
2021-02-14 14:20:40 -05:00
Michael Cook (mackal) 0ef01165ea Fix some leaks of groups/raids (#1242)
These cases probably are exceedingly rare, but they still need to be
accounted for. (As in, I don't think anyone has run into these cases too
often to cause problems)
2021-02-12 02:07:58 -06:00
Michael Cook (mackal) f9923ffda0 Fix va_list leaks in MakeAnyLenString/AppendAnyLenString (#1240)
Slowly leaking memory for ages!

clang-tidy complained about it
2021-02-12 02:07:47 -06:00
Akkadius 6e765e7ddc Revert "[BUG] Fix for Group Leader Disband Issue"
This reverts commit f854137ca0.
2021-02-12 02:05:20 -06:00
Michael Cook (mackal) 8b4a886d01 Remove unused files
idk where these came from, NUKE EM!
2021-02-12 02:42:03 -05:00
Michael Cook (mackal) 507bbe83f3 LuaJIT calls it lua51.lib/dll on Windows ... (#1247) 2021-02-11 13:52:11 -06:00
Michael Cook (mackal) d33f806efa Add include to PATH_SUFFIXES for Windows builds (#1246) 2021-02-11 12:56:00 -06:00
Noudess d7d9c73e5e Add comment. 2021-02-09 11:32:13 -05:00
Noudess d90d680e8a More formatting 2021-02-09 11:24:25 -05:00
Noudess baa53e134a Fixed missing argument - oops 2021-02-09 10:00:17 -05:00
Noudess 3bafc5b3f4 Change modified sneak pull assist range to a rule. Fixed formatting on decls. 2021-02-09 09:50:22 -05:00
Noudess b2e4e91fbd Very simple implementation of Sneak Pull 2021-02-09 08:31:35 -05:00
Michael Cook (mackal) 10ffcf155d [Lua/Cmake] Prefer LuaJIT over normal Lua (#1235)
* Add a separate FindLuaJit.cmake

* Remove LuaJit from our modified FindLua51.cmake

* Make use of the new FindLuaJit

The reason for splitting them up like this is so we can have a
preference for LuaJIT that's not determined by the search order in
FindLua51.cmake as well as giving the server operators the choice to
prefer normal Lua with the EQEMU_PREFER_LUA cmake option
2021-02-08 23:10:16 -06:00
TurmoilToad ed71543dff Add category tags to new client methods. (#1233)
Add category tags to new client methods.
2021-02-08 23:09:42 -06:00
TurmoilToad 0dcaea1e4e Add category tags for Object methods. (#1232)
Add category tags for Object methods.
2021-02-08 23:09:16 -06:00
TurmoilToad 52a359180c Add category tags for corpse methods (#1234)
Add category tags for corpse methods.
2021-02-08 23:08:41 -06:00
Alex 8f89f38f5c Add ScaleNPC() to Perl and Lua. (#1238) 2021-02-08 23:08:07 -06:00
Alex f2b67ae969 [Quest API] Add Mob-based data bucket methods to Perl/Lua. (#1237)
* Add Mob-based data bucket methods to Perl/Lua.

* Update mob.cpp

* Update perl_mob.cpp
2021-02-08 23:06:33 -06:00
Akkadius ef0398ebd3 Move data aliases after null checks for safety [skip ci] 2021-02-08 21:50:28 -06:00
Akkadius dcc921efcb Update repo with latest template [skip ci] 2021-02-08 21:35:43 -06:00
Akkadius eedd5e2821 [Hotfix] Remove test branch fields from repo 2021-02-08 21:34:33 -06:00
Chris Miles 96b65b848b [Repositories] Insert repository improvements (#1236)
* Insert repository improvements

* Remove no longer necessary code, remove license banner since we have a license at the repo level

* Update template comments
2021-02-08 20:56:44 -06:00
Chris Miles 694d380e66 [Door Opening] Rule to let configure Animal Door Opening (#1231)
* Add rule configuration for letting animals open doors or not

* Handle one more spot

* Make adjustments and add mob property that serves as a check as to whether a mob entity can open doors or not

* Push attribute to mob window
2021-02-07 19:52:58 -06:00
Michael Cook (mackal) 672c09ee11 Provide more search paths for luajit (#1216)
The include folder on my system is /usr/include/luajit-2.0, added some
extra library names since mine was /usr/lib64/libluajit-5.1.so
2021-02-07 18:42:55 -06:00
TurmoilToad ca9756abc9 [Quest API] Perl Client Annotations (#1224)
* Update perl_client.cpp

Added category tags for client methods.

* Update perl_client.cpp

Now with less iis!  (Thanks KK)

* Update perl_client.cpp

Now with fewer slashes!

* Update perl_client.cpp

Now with fewer tabs!
2021-02-07 18:13:04 -06:00
TurmoilToad da7b5b3560 [Quest API] Perl Raid Annotations (#1226)
Added categories tags for raid methods.
2021-02-07 18:12:09 -06:00
TurmoilToad ecc1dd9475 Update perl_questitem.cpp (#1227)
Add category tags for quest_item methods.
2021-02-07 18:11:24 -06:00
Chris Miles 8f7702095b Merge pull request #1228 from EQEmu/anon_afk_client
[Quest API] Add Anon/AFK methods to Perl and Lua.
2021-02-07 18:09:49 -06:00
Chris Miles 13303a1e14 Merge pull request #1230 from EQEmu/bug_fix/name_enforcement
[Character Validation] Enforce some naming limits people were getting around
2021-02-07 18:09:22 -06:00
Chris Miles b184a5d013 Merge pull request #1229 from EQEmu/akkadius/task-code-cleanup
[Refactor and Cleanup] Task Code
2021-02-07 18:06:44 -06:00
Akkadius 9f5ce8e3c9 PR comments 2021-02-07 17:08:16 -06:00
Michael Cook (mackal) 6621338064 Enforce some naming limits people were getting around 2021-02-07 17:00:48 -05:00
Akkadius 00902d8a7e Private member prefixes for proximities and goal lists 2021-02-07 15:44:25 -06:00
Akkadius 01f69bcc51 Update task_client_state.cpp 2021-02-07 15:22:30 -06:00
Akkadius f429df39a9 Update CMakeLists.txt 2021-02-07 15:06:46 -06:00
Akkadius 0c533071d4 Yet more cleanup 2021-02-07 15:00:16 -06:00
Kinglykrab fac9c3469f Add Anon/AFK methods to Perl and Lua. 2021-02-07 00:40:08 -05:00
Akkadius 8414973077 Typo [skip ci] 2021-02-06 21:40:42 -06:00
Akkadius 5fba138a5a Improve GM command interface UI 2021-02-06 21:14:25 -06:00
Akkadius 053bdb8646 More cleanups 2021-02-06 19:19:20 -06:00
Akkadius ff5ea82e38 Split task classes into their own cpp/h files to speed up incremental compilation and make things easier to maintain 2021-02-06 18:52:14 -06:00
Akkadius 55d4865d36 Correct one missed repository pointer 2021-02-06 18:16:39 -06:00
Akkadius b01793081a More cleanup 2021-02-06 17:38:11 -06:00
Chris Miles 18e9c4dc95 Merge pull request #1225 from EQEmu/akkadius/repository-improvements
[Repositories] Explicitly pass database pointers to repository methods
2021-02-06 14:23:54 -06:00
Akkadius ed9f155f7c More logging 2021-02-06 04:37:16 -06:00
Akkadius d83dc339fc Logging cleanups 2021-02-06 04:27:41 -06:00
Akkadius 8d7fdd6549 More cleanups 2021-02-06 04:12:11 -06:00
Akkadius 65f2f823a8 More refactors 2021-02-06 03:57:46 -06:00
Akkadius fac75a3ae0 Move ClientTaskState::RemoveTaskByTaskID to repository methods 2021-02-06 03:46:03 -06:00
Akkadius 19e9c0bc22 Move ClientTaskState::RemoveTask to repository methods 2021-02-06 03:44:36 -06:00
Akkadius 9816608bba Another pass 2021-02-06 03:42:14 -06:00
Akkadius 83b279bac3 Migrate TaskManager::LoadClientState to repository methods 2021-02-06 03:00:14 -06:00
Akkadius 32aeb6197f Refactor and move TaskManager::LoadTasks to load from repositories 2021-02-06 02:33:07 -06:00
Akkadius 11eab9c284 Move TaskManager::LoadTaskSets() loading to repositories 2021-02-06 01:37:30 -06:00
Akkadius 8d863a507b Fourth pass 2021-02-06 01:25:03 -06:00
Akkadius c194e2ac9c Fix linux compile warnings 2021-02-06 01:22:22 -06:00
Akkadius aeb0dbc6ae Third pass 2021-02-06 01:14:32 -06:00
Akkadius 4039cb12ba Second pass 2021-02-06 01:05:34 -06:00
Akkadius b7983d4c20 First pass 2021-02-06 00:45:13 -06:00
Akkadius e8ab176d4a Explicitly pass database pointers to repository methods 2021-02-05 23:00:27 -06:00
Chris Miles b7f7c66a50 Merge pull request #1223 from EQEmu/akkadius/update-repositories-expeditions
[Repositories] Add expedition repositories
2021-02-05 22:45:38 -06:00
Chris Miles 3455863099 Merge pull request #1220 from EQEmu/perl_npc_formatting
Formatting NPC validation macro.
2021-02-05 22:14:34 -06:00
Akkadius 7fe0bbacd4 Add expedition repositories 2021-02-05 18:12:05 -06:00
Michael Cook (mackal) c8dfb72cd2 Merge pull request #1222 from EQEmu/feature/op_clearaa_tit
Identify OP_ClearLeadershipAbilities/OP_ClearAA for Tit
2021-02-05 16:18:19 -05:00
Michael Cook (mackal) 42b34bbf87 Identify OP_ClearLeadershipAbilities/OP_ClearAA for Tit 2021-02-05 14:17:13 -05:00
Kinglykrab 963b8fdd53 Formatting NPC validation macro. 2021-02-02 17:06:55 -05:00
Chris Miles 0923ff040f Merge pull request #1204 from EQEmu/perl_client_macro
[Quest API] Perl Client Validation Macro
2021-02-01 23:24:54 -06:00
Chris Miles 369461f9e1 Merge pull request #1205 from EQEmu/perl_doors_macro
[Quest API] Perl Doors Validation Macro
2021-02-01 23:24:26 -06:00
Chris Miles bb2dcdcb31 Merge pull request #1206 from EQEmu/perl_entity_macro
[Quest API] Perl Entity Validation Macro
2021-02-01 23:24:09 -06:00
Chris Miles e67b3dd6d4 Merge pull request #1207 from EQEmu/perl_group_macro
[Quest API] Perl Group Validation Macro
2021-02-01 23:23:46 -06:00
Chris Miles ddfc0dda42 Merge pull request #1208 from EQEmu/perl_hate_macro
[Quest API] Perl Hate Validation Macro
2021-02-01 23:23:21 -06:00
Chris Miles f7cc51c134 Merge pull request #1209 from EQEmu/perl_mob_macro
[Quest API] Perl Mob Validation Macro
2021-02-01 23:22:52 -06:00
Chris Miles 1b27d9dc9d Merge pull request #1210 from EQEmu/perl_npc_macro
[Quest API] Perl NPC Validation Macro
2021-02-01 23:19:09 -06:00
Chris Miles 8011c4afcc Merge pull request #1211 from EQEmu/perl_object_macro
[Quest API] Perl Object Validation Macro
2021-02-01 23:18:10 -06:00
Chris Miles 69de53c459 Merge pull request #1212 from EQEmu/perl_packet_macro
[Quest API] Perl Packet Validation Macro
2021-02-01 23:17:53 -06:00
Chris Miles 82b3cccc95 Merge pull request #1213 from EQEmu/perl_corpse_macro
[Quest API] Perl Corpse Validation Macro
2021-02-01 23:17:22 -06:00
Chris Miles 91d9a4f73c Merge pull request #1214 from EQEmu/perl_item_macro
[Quest API] Perl Item Validation Macro
2021-02-01 23:17:05 -06:00
Chris Miles 93f83923ce Merge pull request #1215 from EQEmu/perl_raid_macro
[Quest API] Perl Raid Validation Macro
2021-02-01 23:16:41 -06:00
Kinglykrab 9759208ed6 [Quest API] Perl Raid Validation Macro
Add validation macro to all raid methods.
2021-02-01 22:38:19 -05:00
Kinglykrab 9d3d9a97ff [Quest API] Perl Item Validation Macro
Add validation macro to all item methods.
2021-02-01 22:36:26 -05:00
Kinglykrab a29de5963f [Quest API] Perl Corpse Validation Macro
Add validation macro to all corpse methods.
2021-02-01 22:34:47 -05:00
Kinglykrab 381b029ffc [Quest API] Perl Packet Validation Macro
Add validation macro to all packet methods.
2021-02-01 22:32:43 -05:00
Kinglykrab 772c88d020 [Quest API] Perl Object Validation Macro
Add validation macro to all object methods.
2021-02-01 22:30:34 -05:00
Kinglykrab b69213abcc [Quest API] Perl NPC Validation Macro
Add validation macro to all NPC methods.
2021-02-01 22:28:15 -05:00
Kinglykrab 4338d657fc [Quest API] Perl Mob Validation Macro
Add validation macro to all mob methods.
2021-02-01 22:24:36 -05:00
Kinglykrab 2430b38406 [Quest API] Perl Hate Validation Macro
Add validation macro to all hate methods.
2021-02-01 22:16:44 -05:00
Kinglykrab 6cfe7853f5 [Quest API] Perl Group Validation Macro
Add validation macro to all group methods.
2021-02-01 22:10:50 -05:00
Kinglykrab 64c97a5283 [Quest API] Perl Entity Validation Macro
Add validation macro to all entitylist methods.
2021-02-01 22:06:41 -05:00
Kinglykrab f32f4346e7 [Quest API] Perl Doors Validation Macro
Add validation macro to all door methods.
2021-02-01 22:02:17 -05:00
Kinglykrab dcc2dcdb8d Convert perl_client.cpp to use validation macro. 2021-02-01 21:56:47 -05:00
Chris Miles 9b8845949e Merge pull request #1203 from EQEmu/perl_inventory
[Quest API] Add Inventory methods to Perl
2021-02-01 20:16:55 -06:00
Kinglykrab 36bfebfe6a Add Inventory methods to Perl.
- Add $client->GetInventory() to Perl.
- Export Lua Inventory methods to Perl.
 - Add quest::createitem(item_id, charges, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six, attuned) to Perl so you can return a ItemInstance for testing purposes.
2021-02-01 21:07:07 -05:00
Chris Miles 0c70004102 Merge pull request #1201 from splose/npcedit
[Command] Add raidtarget / respawntimer to #npcedit
2021-02-01 12:56:55 -06:00
Chris Miles 5238d30236 Merge pull request #1202 from regneq/master
RandomPath improvements
2021-02-01 12:56:06 -06:00
regneq 58e0ce6a4b fixed the references from previous commits. 2021-01-31 16:53:25 -08:00
regneq e4b437cb5f RandomPath grid type improvement
RandomPath has been changed to the following behavior:

* When stopped at a waypoint, it will now use the waypoint's pause timer if it is non-zero.  If it is zero, it will use the first waypoint's pause timer if that is non-zero.  If both are zero it will use 38 seconds.  Previously it would always use the first waypoint's pause timer if it was non-zero.  This new way is what it should have been from the start, really.

* If any waypoint is flagged as a centerpoint, then the NPCs will always return to that first randomly selected centerpoint waypoint after moving.  I.e. every other move will be to the first waypoint if the bool is set.

If any waypoint has a negative number (-1, -10, etc) in the pause timer. It will not be included in the waypoints to be random.  Instead the npc will just path through it everytime.  This is useful for a path to only select a small area to pause at before returning to it's centerpoints or another random waypoints in between it.
2021-01-31 15:11:45 -08:00
regneq 5a94e82db8 Merge pull request #7 from EQEmu/master
update
2021-01-31 14:01:54 -08:00
Alex 9713d62849 Merge pull request #1200 from hgtw/fix/empty-expedition-invite
Verify expedition is not empty on invites
2021-01-30 21:43:35 -05:00
Matthew Silvia a751339c99 add raidtarget / respawntimer to #npcedit 2021-01-30 19:43:37 -05:00
hg 62e480fed7 Verify expedition is not empty on invites
Fixes an edge case where a member could accept a pending invite into an
empty expedition before world could invalidate it
2021-01-30 18:58:39 -05:00
Chris Miles b74edd9dc2 Merge pull request #1196 from EQEmu/spell_lua_perl
Add new Spell methods to Perl and Lua.
2021-01-30 17:27:15 -06:00
Chris Miles 7eba9552e2 Merge pull request #1193 from noudess/gmmove
Use heading in GMMove and change FaceTarget not to turn boat
2021-01-30 15:29:05 -06:00
Chris Miles 396c300315 Merge pull request #1198 from EQEmu/akkadius/fix-mysqldump-buffer-allocation-edge-case
[Bugfix] Fix MySQL Dump Buffer Allocation
2021-01-29 23:51:19 -06:00
Akkadius c192590af6 Fix issue where sometimes under certain circumstances when issuing a database dump with large data over a network with extended inserts we hit a buffer threshold that kills a MySQL dump with Error 2013 2021-01-29 18:13:37 -06:00
JJ fb5fc935e7 Merge pull request #1197 from EQEmu/perl_target_ring
Fix GetTargetRingX(), GetTargetRingY(), and GetTargetRingZ() in Perl.
2021-01-28 23:34:00 -06:00
JJ 780c7a8476 Merge pull request #1195 from hgtw/feat/color-constants
Add missing chat color constants to Lua
2021-01-28 23:33:44 -06:00
JJ c72e18f082 Merge pull request #1194 from hgtw/fix/unescaped-fmt
Replace unescaped braces in format string
2021-01-28 23:33:31 -06:00
Kinglykrab a90d836bcd Fix GetTargetRingX(), GetTargetRingY(), and GetTargetRingZ() in Perl. 2021-01-28 20:29:50 -05:00
Kinglykrab c0129a6b8a Add new Spell methods to Perl and Lua. 2021-01-28 20:12:57 -05:00
hg a77d2408ac Add missing chat color constants to Lua 2021-01-28 20:10:26 -05:00
hg 6baf8412c6 Replace unescaped braces in format string
Fixes zone crash when this is logged
2021-01-28 19:42:02 -05:00
Noudess 9907984aca Use passed heading in GMMove and change FaceTarget not to turn if npc is boat. 2021-01-26 09:08:45 -05:00
Chris Miles f767a7c076 Merge pull request #1191 from EQEmu/immune_aggro
Add 4 new special attacks to Perl/Lua.
2021-01-25 19:14:28 -06:00
Chris Miles 445fcc2d40 Merge pull request #1188 from EQEmu/message_whisper
Add message(color, message) and whisper(message) to Perl/Lua.
2021-01-25 17:21:56 -06:00
Chris Miles f4ee11ac62 Merge pull request #1189 from EQEmu/popup2
Fix Popup2 Perl croak.
2021-01-25 17:21:40 -06:00
Kinglykrab d30593c35e Add 4 new special attacks to Perl/Lua.
- IMMUNE_DAMAGE_CLIENT (47)
Immune to all damage except NPC damage.

- IMMUNE_DAMAGE_NPC (48)
Immune to all damage except Client damage.

- IMMUNE_AGGRO_CLIENT (49)
Immune to aggro by a Client.

- IMMUNE_AGGRO_NPC (50)
Immune to aggro by an NPC, clients must attack directly to gain aggro, allows pet only boss mechanics and stuff.
2021-01-23 21:36:07 -05:00
Kinglykrab 102263f37d Fix Popup2 Perl croak.
Noticed the Gitbook documentation listed SendFullPopup not Popup2 due to parsing the Perl croaks in the files, causing people not to be able to find the proper way to send a full popup window.
2021-01-23 11:15:21 -05:00
Kinglykrab 19ae461e36 Add message(color, message) and whisper(message) to Perl/Lua.
- Add quest::message(color, message) to Perl.
- Add eq.message(color, message) to Lua.
- Add quest::whisper(message) to Perl.
- Add eq.whisper(message) to Lua.

These methods allow you to use implied client references. The whisper method also converts a widely used plugin in Perl to a Perl and Lua method that works on both Clients and NPCs.
2021-01-23 10:47:44 -05:00
Alex c481d52064 Add HasDisciplineLearned() to Perl/Lua. 2021-01-23 10:23:50 -05:00
Chris Miles 7c69400618 Merge pull request #1175 from EQEmu/akkadius/command-name-adjustment
[Command] Naming suggestions from https://github.com/EQEmu/Server/pull/1170
2021-01-21 18:26:35 -06:00
Chris Miles ca98ea9872 Merge pull request #1180 from noudess/boat
Allow boats flymode to be overridden by local db
2021-01-21 18:26:05 -06:00
Chris Miles 7d40e42cc2 Merge pull request #1177 from hgtw/fix/door-packets
[Bugfix] Don't respawn doors while clients are zoning
2021-01-21 18:22:53 -06:00
Chris Miles f1920f2132 Merge pull request #1178 from hgtw/fix/spawn-condition-crash
[Bugfix] Fix zone crash on spawn condition change
2021-01-21 18:22:27 -06:00
Chris Miles 30490abc50 Merge pull request #1179 from hgtw/fix/zonemap-crash
Fix zone startup crash if maps not installed
2021-01-21 18:22:04 -06:00
Chris Miles c5c0a3a73e Merge pull request #1181 from EQEmu/aa_message
Add AA gain messages.
2021-01-21 18:21:35 -06:00
Chris Miles 0551cfc013 Merge pull request #1182 from EQEmu/race_class
Add Race/Class Name and Bitmask Methods.
2021-01-21 18:19:56 -06:00
Chris Miles 1a2cec58f1 Merge pull request #1184 from EQEmu/finditem
#finditem Changes
2021-01-21 18:19:28 -06:00
Chris Miles a9b992a1b0 Merge pull request #1186 from hgtw/fix/expedition-max
Fix bug that could allow expeditions to exceed max members
2021-01-21 18:18:04 -06:00
hg d87ae839a2 Verify members in db on expedition invites
Fixes an exploit where multiple accepted cross zone invites could race
with cache updates and allow an expedition to exceed its max members
2021-01-21 19:02:00 -05:00
Kinglykrab 0f859a2a0f Preferential changes to #finditem, doesn't show stack options if item isn't stackable.
Only shows 1 or max stack size of item for summoning items. Also resolves the issues some people were having where this command would summon an item with 1 charge instead of max charges because 1 was supplied as charges. In my experience most people who summon items like this want either one item or a full stack of an item and the summon size here is relative to the current item's stack size. Also shows name first instead of ID so the formatting is better.
2021-01-19 18:34:19 -05:00
Kinglykrab 7e1e1651e4 Add GetClassBitmask(), GetClassName(), GetRaceBitmask(), and GetRaceName() to Perl/Lua. 2021-01-18 18:47:32 -05:00
Kinglykrab 1c00edb458 Add AA gain messages. 2021-01-15 19:54:44 -05:00
Noudess eb24e333d7 Allow boats flymode to be overridden by local db 2021-01-11 10:58:08 -05:00
hg 836210404c Fix zone crash on spawn condition change
The NPC pointer held by Spawn2 wasn't reset if the npc was depopped
without a respawn timer by #depop commands or depop(false) quest apis.
If the NPC was part of a spawn condition then the condition would try
to dereference that pointer (which gets deleted) on condition change.
2021-01-08 23:53:06 -05:00
hg 896dd48960 Fix zone startup crash if maps not installed 2021-01-08 20:55:56 -05:00
hg 312ee2b42c Don't respawn doors while clients are zoning
Fixes regression from b08dc02a (PR #1051)

The normal door list sent on zone entry caused unopenable double doors
on clients if an api respawned them while the client was zoning. This
waits until the client finishes zoning and has received the initial
door list before sending any despawn/respawn packets.
2021-01-07 20:05:55 -05:00
Akkadius 3fc1aea3ce Naming suggestions from https://github.com/EQEmu/Server/pull/1170 2021-01-04 11:44:23 -06: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
regneq ed351fb4cb Merge pull request #6 from EQEmu/master
update
2020-10-01 08:02:43 -07: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
regneq 7bea9a7273 Merge pull request #5 from EQEmu/master
eqemu merge update
2020-05-04 08:30:48 -07: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
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
KentaiVZ 8be23a1214 Merge pull request #4 from EQEmu/master
update local
2019-01-28 14:45:02 +11:00
1512 changed files with 421440 additions and 101971 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}"
}
}
+27
View File
@@ -0,0 +1,27 @@
---
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
volumes:
- name: cache
host:
path: /var/lib/cache
steps:
- name: server-build
# Source build script https://github.com/Akkadius/akk-stack/blob/master/containers/eqemu-server/Dockerfile#L20
image: akkadius/eqemu-server:v11
commands:
- sudo chown eqemu:eqemu /drone/src/ * -R
- sudo chown eqemu:eqemu /home/eqemu/.ccache/ * -R
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LUA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="-O0 -g -DNDEBUG" -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
- curl https://raw.githubusercontent.com/Akkadius/eqemu-install-v2/master/eqemu_config.json --output eqemu_config.json
- ./bin/tests
volumes:
- name: cache
path: /home/eqemu/.ccache/
+21 -1
View File
@@ -17,6 +17,8 @@
*.out
*.app
.bash_history
# CMake
CMakeCache.txt
CMakeFiles
@@ -35,4 +37,22 @@ perl/
submodules/*
cmake-build-debug/
.nfs.*
.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/
.idea
-27
View File
@@ -1,27 +0,0 @@
language: cpp
compiler: gcc
dist: trusty
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- mkdir $HOME/usr
- export PATH="$HOME/usr/bin:$PATH"
- wget https://cmake.org/files/v3.11/cmake-3.11.2-Linux-x86_64.sh
- chmod +x cmake-3.11.2-Linux-x86_64.sh
- ./cmake-3.11.2-Linux-x86_64.sh --prefix=$HOME/usr --exclude-subdir --skip-license
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:
- cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LOGIN=ON
- make -j2
- ./bin/tests
+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
}
}
]
}
+80 -14
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.7)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
@@ -12,7 +12,7 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
@@ -20,6 +20,7 @@ IF(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-DNOMINMAX)
ADD_DEFINITIONS(-DCRASH_LOGGING)
ADD_DEFINITIONS(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ELSE(MSVC)
@@ -55,6 +56,7 @@ FIND_PACKAGE(MariaDB)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(OpenSSL)
FIND_PACKAGE(Lua51)
FIND_PACKAGE(LuaJit)
FIND_PACKAGE(PerlLibs)
FIND_PACKAGE(Sodium)
FIND_PACKAGE(mbedTLS)
@@ -87,6 +89,12 @@ ELSE()
MESSAGE(STATUS "* Lua: MISSING *")
ENDIF()
IF(LuaJit_FOUND)
MESSAGE(STATUS "* LuaJIT: FOUND *")
ELSE()
MESSAGE(STATUS "* LuaJIT: MISSING *")
ENDIF()
IF(PerlLibs_FOUND)
MESSAGE(STATUS "* Perl: FOUND *")
ELSE()
@@ -114,7 +122,6 @@ 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_ENABLE_BOTS "Enable Bots" OFF)
OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
@@ -122,6 +129,48 @@ 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)
OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
#PRNG options
OPTION(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF)
MARK_AS_ADVANCED(EQEMU_ADDITIVE_LFIB_PRNG)
OPTION(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF)
MARK_AS_ADVANCED(EQEMU_BIASED_INT_DIST)
SET(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)")
MARK_AS_ADVANCED(EQEMU_CUSTOM_PRNG_ENGINE)
IF(CMAKE_COMPILER_IS_GNUCXX)
OPTION(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF)
MARK_AS_ADVANCED(EQEMU_SFMT19937)
ENDIF()
IF(EQEMU_ADDITIVE_LFIB_PRNG)
ADD_DEFINITIONS(-DUSE_ADDITIVE_LFIB_PRNG)
IF(EQEMU_SFMT19937)
MESSAGE(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.")
SET(EQEMU_SFMT19937 OFF)
ENDIF()
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.")
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
ENDIF()
ENDIF()
IF(EQEMU_SFMT19937)
ADD_DEFINITIONS(-DUSE_SFMT19937)
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.")
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
ENDIF()
ENDIF()
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
ADD_DEFINITIONS(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE})
ENDIF()
IF(EQEMU_BIASED_INT_DIST)
ADD_DEFINITIONS(-DBIASED_INT_DIST)
ENDIF()
IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
@@ -133,11 +182,11 @@ ENDIF(EQEMU_ENABLE_BOTS)
#database
IF(MySQL_FOUND AND MariaDB_FOUND)
SET(DATABASE_LIBRARY_SELECTION MySQL CACHE STRING "Database library to use:
SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:
MySQL
MariaDB"
)
IF(DATABASE_LIBRARY_SELECTION STREQUAL "MySQL")
SET(DATABASE_LIBRARY_TYPE " MySQL")
SET(DATABASE_LIBRARY_LIBS ${MySQL_LIBRARIES})
@@ -168,13 +217,16 @@ IF(OpenSSL_FOUND AND MBEDTLS_FOUND)
OpenSSL
mbedTLS"
)
IF(TLS_LIBRARY_SELECTION STREQUAL "OpenSSL")
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)
IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1")
ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT)
ENDIF()
ELSEIF(TLS_LIBRARY_SELECTION STREQUAL "mbedTLS")
SET(TLS_LIBRARY_TYPE " mbedTLS")
SET(TLS_LIBRARY_ENABLED ON)
@@ -190,6 +242,9 @@ ELSEIF(OpenSSL_FOUND)
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1")
ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT)
ENDIF()
ELSEIF(MBEDTLS_FOUND)
SET(TLS_LIBRARY_TYPE " mbedTLS")
SET(TLS_LIBRARY_ENABLED ON)
@@ -212,7 +267,12 @@ ELSE()
SET(SODIUM_LIBRARY_ENABLED OFF)
ENDIF()
IF(Lua51_FOUND)
IF(LUAJIT_FOUND AND NOT (EQEMU_PREFER_LUA AND Lua51_FOUND))
SET(LUA_LIBRARY_TYPE " LuaJIT")
SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUAJIT_LIBRARY} luabind)
SET(LUA_LIBRARY_INCLUDE ${LUAJIT_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
ELSEIF(Lua51_FOUND )
SET(LUA_LIBRARY_TYPE " Lua 5.1")
SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind)
@@ -239,6 +299,7 @@ IF(ZLIB_FOUND)
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_BINARY_DIR}/libs/zlibng")
ELSE()
SET(ZLIB_LIBRARY_TYPE " zlib")
SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY})
@@ -296,12 +357,12 @@ 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})
SET(ZONE_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)
@@ -312,7 +373,7 @@ 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})
SET(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind)
INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}")
ADD_DEFINITIONS(-DEMBPERL)
ADD_DEFINITIONS(-DEMBPERL_PLUGIN)
@@ -328,9 +389,14 @@ IF(UNIX)
IF(NOT DARWIN)
SET(SERVER_LIBS ${SERVER_LIBS} "rt")
ENDIF()
SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
# Freebsd provides uuids in the C library
IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
ENDIF()
ENDIF()
SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS})
IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED)
MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.")
ENDIF()
@@ -344,13 +410,13 @@ IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_H
ADD_SUBDIRECTORY(libs)
ADD_SUBDIRECTORY(submodules/fmt)
ADD_SUBDIRECTORY(submodules/libuv)
IF(EQEMU_BUILD_ZLIB)
SET(ZLIB_COMPAT ON CACHE BOOL "Compile with zlib compatible API")
SET(ZLIB_ENABLE_TESTS OFF CACHE BOOL "Build test binaries")
ADD_SUBDIRECTORY(libs/zlibng)
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")
+22
View File
@@ -0,0 +1,22 @@
We expect contributors and community members to act professionally and respectfully, and we expect our forums and Discord channels to be dignified environments that expand the community and enhance the learning experience for new members.
Specifically:
* Respect people, their ideas, and their work.
* Be kind. Be courteous. Be welcoming.
* Listen. Consider and acknowledge people's points before responding.
* Be respectful of differing viewpoints and experience levels.
* Accept constructive criticism and work together toward decisions.
* Focus on what is best for the community and users.
Examples of unacceptable behavior by participants include:
* The use of violent threats, trolling, insulting/derogatory comments, abusive or discriminatory language, or personal attacks.
* Public or private harassment.
* Publishing others' private information, such as a physical or electronic address, without explicit permission.
* Conduct which could reasonably be considered inappropriate in a professional setting.
* Advocating for or encouraging any of the above behaviors.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, forum posts, Discord messages, and other contributions that are not aligned with this code of conduct.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project.
+10 -5
View File
@@ -1,7 +1,7 @@
# 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,13 +17,17 @@
|:---:|:---:|:---:|
|**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
* [Install](https://github.com/EQEmu/Server/wiki/Windows-Server)
* [Install Guide](https://docs.eqemu.io/server/installation/server-installation-windows/)
### > Debian/Ubuntu/CentOS/Fedora
* [Install Guide](https://docs.eqemu.io/server/installation/server-installation-linux/)
* 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
> wget --no-check-certificate https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh -O install.sh && chmod 755 install.sh && ./install.sh
> wget --no-check-certificate https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh -O install.sh && chmod 755 install.sh && ./install.sh
## Supported Clients
@@ -52,7 +56,7 @@ forum, although pull requests will be much quicker and easier on all parties.
## Resources
- [EQEmulator Forums](http://www.eqemulator.org/forums)
- [EQEmulator Wiki](https://github.com/EQEmu/Server/wiki)
- [EQEmulator Wiki](https://docs.eqemu.io/)
## Related Repositories
* [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests)
@@ -76,3 +80,4 @@ forum, although pull requests will be much quicker and easier on all parties.
<a href="https://github.com/EQEmu/server/graphs/contributors">
<img src="https://contributors-img.firebaseapp.com/image?repo=EQEmu/server" />
</a>
+2 -2
View File
@@ -16,6 +16,6 @@ build:
verbosity: minimal
after_build:
- cmd: >-
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
appveyor PushArtifact build_x64-bots.zip
appveyor PushArtifact build_x64-bots.zip
+2 -2
View File
@@ -16,6 +16,6 @@ build:
verbosity: minimal
after_build:
- cmd: >-
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
appveyor PushArtifact build_x64-no-bots.zip
appveyor PushArtifact build_x64-no-bots.zip
+1 -1
View File
@@ -3,7 +3,7 @@
############################################
#
# New changelog can be found here
# https://eqemu.gitbook.io/changelog/
# https://docs.eqemu.io/server/changelog/server
#
############################################
# Deprecated
+138 -83
View File
@@ -25,22 +25,31 @@
#include "../../common/platform.h"
#include "../../common/crash.h"
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
#include "../../common/strings.h"
#include "../../common/content/world_content_service.h"
#include "../../common/zone_store.h"
#include "../../common/path_manager.h"
EQEmuLogSys LogSys;
WorldContentService content_service;
ZoneStore zone_store;
PathManager path;
void ExportSpells(SharedDatabase *db);
void ExportSkillCaps(SharedDatabase *db);
void ExportBaseData(SharedDatabase *db);
void ExportDBStrings(SharedDatabase *db);
int main(int argc, char **argv) {
int main(int argc, char **argv)
{
RegisterExecutablePlatform(ExePlatformClientExport);
LogSys.LoadLogSettingsDefaults();
set_exception_handler();
path.LoadPaths();
LogInfo("Client Files Export Utility");
if(!EQEmuConfig::LoadConfig()) {
if (!EQEmuConfig::LoadConfig()) {
LogError("Unable to load configuration file");
return 1;
}
@@ -48,16 +57,42 @@ int main(int argc, char **argv) {
auto Config = EQEmuConfig::get();
SharedDatabase database;
SharedDatabase content_db;
LogInfo("Connecting to database");
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
if (!database.Connect(
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;
}
/* Register Log System and Settings */
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();
/**
* 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());
}
LogSys.SetDatabase(&database)
->SetLogPath(path.GetLogPath())
->LoadLogDatabaseSettings()
->StartFileLogs();
std::string arg_1;
@@ -66,15 +101,15 @@ int main(int argc, char **argv) {
}
if (arg_1 == "spells") {
ExportSpells(&database);
ExportSpells(&content_db);
return 0;
}
if (arg_1 == "skills") {
ExportSkillCaps(&database);
ExportSkillCaps(&content_db);
return 0;
}
if (arg_1 == "basedata") {
ExportBaseData(&database);
ExportBaseData(&content_db);
return 0;
}
if (arg_1 == "dbstring") {
@@ -82,9 +117,9 @@ int main(int argc, char **argv) {
return 0;
}
ExportSpells(&database);
ExportSkillCaps(&database);
ExportBaseData(&database);
ExportSpells(&content_db);
ExportSkillCaps(&content_db);
ExportBaseData(&content_db);
ExportDBStrings(&database);
LogSys.CloseFileLogs();
@@ -92,93 +127,107 @@ int main(int argc, char **argv) {
return 0;
}
void ExportSpells(SharedDatabase *db) {
void ExportSpells(SharedDatabase *db)
{
LogInfo("Exporting Spells");
FILE *f = fopen("export/spells_us.txt", "w");
if(!f) {
std::string file = fmt::format("{}/export/spells_us.txt", path.GetServerPath());
FILE *f = fopen(file.c_str(), "w");
if (!f) {
LogError("Unable to open export/spells_us.txt to write, skipping.");
return;
}
const std::string query = "SELECT * FROM spells_new ORDER BY id";
auto results = db->QueryDatabase(query);
const std::string query = "SELECT * FROM spells_new ORDER BY id";
auto results = db->QueryDatabase(query);
if(results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for(unsigned int i = 0; i < fields; ++i) {
if(i != 0) {
if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for (unsigned int i = 0; i < fields; ++i) {
if (i != 0) {
line.push_back('^');
}
if(row[i] != nullptr) {
if (row[i] != nullptr) {
line += row[i];
}
}
fprintf(f, "%s\n", line.c_str());
}
} else {
}
else {
}
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;
std::string query = StringFormat("SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
class_id, skill_id);
auto results = db->QueryDatabase(query);
if(!results.Success()) {
return false;
}
std::string query = StringFormat(
"SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
class_id, skill_id
);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return false;
}
if (results.RowCount() == 0)
return false;
if (results.RowCount() == 0) {
return false;
}
auto row = results.begin();
if(row[0] && atoi(row[0]) > 0)
return true;
auto row = results.begin();
if (row[0] && atoi(row[0]) > 0) {
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",
class_id, skill_id, level);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return 0;
}
std::string query = StringFormat(
"SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
class_id, skill_id, level
);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return 0;
}
if (results.RowCount() == 0)
return 0;
if (results.RowCount() == 0) {
return 0;
}
auto row = results.begin();
auto row = results.begin();
return atoi(row[0]);
}
void ExportSkillCaps(SharedDatabase *db) {
void ExportSkillCaps(SharedDatabase *db)
{
LogInfo("Exporting Skill Caps");
FILE *f = fopen("export/SkillCaps.txt", "w");
if(!f) {
std::string file = fmt::format("{}/export/SkillCaps.txt", path.GetServerPath());
FILE *f = fopen(file.c_str(), "w");
if (!f) {
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
return;
}
for(int cl = 1; cl <= 16; ++cl) {
for(int skill = 0; skill <= 77; ++skill) {
if(SkillUsable(db, skill, cl)) {
int previous_cap = 0;
for(int level = 1; level <= 100; ++level) {
for (int cl = 1; cl <= 16; ++cl) {
for (int skill = 0; skill <= 77; ++skill) {
if (SkillUsable(db, skill, cl)) {
int previous_cap = 0;
for (int level = 1; level <= 100; ++level) {
int cap = GetSkill(db, skill, cl, level);
if(cap < previous_cap) {
if (cap < previous_cap) {
cap = previous_cap;
}
@@ -192,26 +241,29 @@ void ExportSkillCaps(SharedDatabase *db) {
fclose(f);
}
void ExportBaseData(SharedDatabase *db) {
void ExportBaseData(SharedDatabase *db)
{
LogInfo("Exporting Base Data");
FILE *f = fopen("export/BaseData.txt", "w");
if(!f) {
std::string file = fmt::format("{}/export/BaseData.txt", path.GetServerPath());
FILE *f = fopen(file.c_str(), "w");
if (!f) {
LogError("Unable to open export/BaseData.txt to write, skipping.");
return;
}
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
auto results = db->QueryDatabase(query);
if(results.Success()) {
for (auto row = results.begin();row != results.end();++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if(rowIndex != 0)
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
auto results = db->QueryDatabase(query);
if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if (rowIndex != 0) {
line.push_back('^');
}
if(row[rowIndex] != nullptr) {
if (row[rowIndex] != nullptr) {
line += row[rowIndex];
}
}
@@ -223,27 +275,30 @@ void ExportBaseData(SharedDatabase *db) {
fclose(f);
}
void ExportDBStrings(SharedDatabase *db) {
void ExportDBStrings(SharedDatabase *db)
{
LogInfo("Exporting DB Strings");
FILE *f = fopen("export/dbstr_us.txt", "w");
if(!f) {
std::string file = fmt::format("{}/export/dbstr_us.txt", path.GetServerPath());
FILE *f = fopen(file.c_str(), "w");
if (!f) {
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
return;
}
fprintf(f, "Major^Minor^String(New)\n");
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
auto results = db->QueryDatabase(query);
if(results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if(rowIndex != 0)
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
auto results = db->QueryDatabase(query);
if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if (rowIndex != 0) {
line.push_back('^');
}
if(row[rowIndex] != nullptr) {
if (row[rowIndex] != nullptr) {
line += row[rowIndex];
}
}
+65 -27
View File
@@ -23,9 +23,15 @@
#include "../../common/platform.h"
#include "../../common/crash.h"
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
#include "../../common/strings.h"
#include "../../common/content/world_content_service.h"
#include "../../common/zone_store.h"
#include "../../common/path_manager.h"
EQEmuLogSys LogSys;
WorldContentService content_service;
ZoneStore zone_store;
PathManager path;
void ImportSpells(SharedDatabase *db);
void ImportSkillCaps(SharedDatabase *db);
@@ -37,6 +43,8 @@ int main(int argc, char **argv) {
LogSys.LoadLogSettingsDefaults();
set_exception_handler();
path.LoadPaths();
LogInfo("Client Files Import Utility");
if(!EQEmuConfig::LoadConfig()) {
LogError("Unable to load configuration file.");
@@ -46,24 +54,50 @@ int main(int argc, char **argv) {
auto Config = EQEmuConfig::get();
SharedDatabase database;
SharedDatabase content_db;
LogInfo("Connecting to database");
if(!database.Connect(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");
if (!database.Connect(
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;
}
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();
/**
* 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());
}
ImportSpells(&database);
ImportSkillCaps(&database);
ImportBaseData(&database);
LogSys.SetDatabase(&database)
->SetLogPath(path.GetLogPath())
->LoadLogDatabaseSettings()
->StartFileLogs();
ImportSpells(&content_db);
ImportSkillCaps(&content_db);
ImportBaseData(&content_db);
ImportDBStrings(&database);
LogSys.CloseFileLogs();
return 0;
}
@@ -98,9 +132,10 @@ bool IsStringField(int i) {
void ImportSpells(SharedDatabase *db) {
LogInfo("Importing Spells");
FILE *f = fopen("import/spells_us.txt", "r");
std::string file = fmt::format("{}/import/spells_us.txt", path.GetServerPath());
FILE *f = fopen(file.c_str(), "r");
if(!f) {
LogError("Unable to open import/spells_us.txt to read, skipping.");
LogError("Unable to open {} to read, skipping.", file);
return;
}
@@ -119,8 +154,8 @@ void ImportSpells(SharedDatabase *db) {
}
}
std::string escaped = ::EscapeString(buffer);
auto split = SplitString(escaped, '^');
std::string escaped = ::Strings::Escape(buffer);
auto split = Strings::Split(escaped, '^');
int line_columns = (int)split.size();
std::string sql;
@@ -187,9 +222,10 @@ void ImportSpells(SharedDatabase *db) {
void ImportSkillCaps(SharedDatabase *db) {
LogInfo("Importing Skill Caps");
FILE *f = fopen("import/SkillCaps.txt", "r");
std::string file = fmt::format("{}/import/SkillCaps.txt", path.GetServerPath());
FILE *f = fopen(file.c_str(), "r");
if(!f) {
LogError("Unable to open import/SkillCaps.txt to read, skipping.");
LogError("Unable to open {} to read, skipping.", file);
return;
}
@@ -198,7 +234,7 @@ void ImportSkillCaps(SharedDatabase *db) {
char buffer[2048];
while(fgets(buffer, 2048, f)) {
auto split = SplitString(buffer, '^');
auto split = Strings::Split(buffer, '^');
if(split.size() < 4) {
continue;
@@ -222,9 +258,10 @@ void ImportSkillCaps(SharedDatabase *db) {
void ImportBaseData(SharedDatabase *db) {
LogInfo("Importing Base Data");
FILE *f = fopen("import/BaseData.txt", "r");
std::string file = fmt::format("{}/import/BaseData.txt", path.GetServerPath());
FILE *f = fopen(file.c_str(), "r");
if(!f) {
LogError("Unable to open import/BaseData.txt to read, skipping.");
LogError("Unable to open {} to read, skipping.", file);
return;
}
@@ -233,7 +270,7 @@ void ImportBaseData(SharedDatabase *db) {
char buffer[2048];
while(fgets(buffer, 2048, f)) {
auto split = SplitString(buffer, '^');
auto split = Strings::Split(buffer, '^');
if(split.size() < 10) {
continue;
@@ -267,9 +304,10 @@ void ImportBaseData(SharedDatabase *db) {
void ImportDBStrings(SharedDatabase *db) {
LogInfo("Importing DB Strings");
FILE *f = fopen("import/dbstr_us.txt", "r");
std::string file = fmt::format("{}/import/dbstr_us.txt", path.GetServerPath());
FILE *f = fopen(file.c_str(), "r");
if(!f) {
LogError("Unable to open import/dbstr_us.txt to read, skipping.");
LogError("Unable to open {} to read, skipping.", file);
return;
}
@@ -291,7 +329,7 @@ void ImportDBStrings(SharedDatabase *db) {
}
}
auto split = SplitString(buffer, '^');
auto split = Strings::Split(buffer, '^');
if(split.size() < 2) {
continue;
@@ -300,12 +338,12 @@ void ImportDBStrings(SharedDatabase *db) {
std::string sql;
int id, type;
std::string value;
id = atoi(split[0].c_str());
type = atoi(split[1].c_str());
if(split.size() >= 3) {
value = ::EscapeString(split[2]);
value = ::Strings::Escape(split[2]);
}
sql = StringFormat("INSERT INTO db_str(id, type, value) VALUES(%u, %u, '%s')",
+2 -2
View File
@@ -38,7 +38,7 @@ 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
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
@@ -49,7 +49,7 @@ find_path(LUA_INCLUDE_DIR lua.h
)
find_library(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua luajit
NAMES lua51 lua5.1 lua-5.1 lua
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
+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:
FindLuaJit
---------
Locate LuaJit library This module defines
::
LUAJIT_FOUND, if false, do not try to link to Lua
LUAJIT_LIBRARIES
LUAJIT_INCLUDE_DIR, where to find lua.h
LUAJIT_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(LUAJIT_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1 include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUAJIT_LIBRARY
NAMES luajit51 luajit5.1 luajit-5.1 luajit lua51
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUAJIT_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(LUAJIT_MATH_LIBRARY m)
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit
REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR
VERSION_VAR LUAJIT_VERSION_STRING)
mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
+752 -363
View File
File diff suppressed because it is too large Load Diff
+147
View File
@@ -0,0 +1,147 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2021 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
#include <cstdint>
#include <limits>
#include <type_traits>
#include <algorithm>
#include <iostream>
/*
* This is an additive lagged fibonacci generator as seen in The Art of Computer Programming, Vol. 2
* This should roughly match the implementation that EQ's client uses and be compatible with our Random class
*
* EQ's rand looks like it was from an example implementation that as posted on pscode.com
*
* You might also want to consider defining BIASED_INT_DIST as well to more closely match EQ
*/
namespace EQ {
template<typename UIntType, size_t w, size_t j, size_t k>
class additive_lagged_fibonacci_engine {
static_assert(std::is_unsigned<UIntType>::value, "result_type must be an unsigned integral type");
static_assert(0u < j && j < k, "0 < j < k");
static_assert(0u < w && w <= std::numeric_limits<UIntType>::digits,
"template argument substituting w out of bounds");
public:
using result_type = UIntType;
static constexpr size_t word_size = w;
static constexpr size_t short_lag = j;
static constexpr size_t long_lag = k;
static constexpr result_type default_seed = 19780503u; // default for subtract_with_carry_engine
additive_lagged_fibonacci_engine() : additive_lagged_fibonacci_engine(default_seed) {}
explicit additive_lagged_fibonacci_engine(result_type sd) { seed(sd); }
void seed(result_type seed = default_seed)
{
state1 = long_lag - long_lag;
state2 = long_lag - short_lag;
state[0] = static_cast<int>(seed) & ((1u << word_size) - 1);
state[1] = 1;
for (int i = 2; i < long_lag; ++i)
state[i] = (state[i - 1] + state[i - 2]) & ((1u << word_size) - 1);
return;
}
// TODO: seed via seed_seq
static constexpr result_type min() { return 0; }
static constexpr result_type max() { return ((1u << word_size) - 1) >> 6; }
void discard(unsigned long long z) {
for (; z != 0ULL; --z)
(*this)();
}
result_type operator()() {
result_type rand = (state[state1] + state[state2]) & ((1u << word_size) - 1);
state[state1] = rand;
if (++state1 == long_lag)
state1 = 0;
if (++state2 == long_lag)
state2 = 0;
return rand >> 6;
}
private:
result_type state1;
result_type state2;
result_type state[long_lag];
public:
template<typename UInt, size_t W, size_t J, size_t K>
friend bool operator==(const additive_lagged_fibonacci_engine<UInt, W, J, K> &x,
const additive_lagged_fibonacci_engine<UInt, W, J, K> &y)
{
return std::equal(x.state, x.state + long_lag, y.state) && x.state1 == y.state1 &&
x.state2 == y.state2;
}
template<typename UInt, size_t W, size_t J, size_t K>
friend bool operator!=(const additive_lagged_fibonacci_engine<UInt, W, J, K> &x,
const additive_lagged_fibonacci_engine<UInt, W, J, K> &y)
{ return !(x == y); }
template<typename UInt, size_t W, size_t J, size_t K, typename CharT, typename Traits>
friend std::basic_ostream<CharT, Traits> &
operator<<(std::basic_istream<CharT, Traits> &os, additive_lagged_fibonacci_engine<UInt, W, J, K> &x)
{
using ios_base = typename std::basic_istream<CharT, Traits>::ios_base;
const typename ios_base::fmtflags flags = os.flags();
const CharT fill = os.fill();
const CharT space = os.widen(' ');
os.flags(ios_base::dec | ios_base::fixed | ios_base::left);
os.fill(space);
for (size_t i = 0; i < long_lag; ++i)
os << x.state[i] << space;
os << x.state1 << space << x.state2;
os.flags(flags);
os.fill(fill);
return os;
}
template<typename UInt, size_t W, size_t J, size_t K, typename CharT, typename Traits>
friend std::basic_istream<CharT, Traits> &
operator>>(std::basic_istream<CharT, Traits> &is, additive_lagged_fibonacci_engine<UInt, W, J, K> &x)
{
using ios_base = typename std::basic_istream<CharT, Traits>::ios_base;
const typename ios_base::fmtflags flags = is.flags();
is.flags(ios_base::dec | ios_base::skipws);
for (size_t i = 0; i < long_lag; ++i)
is >> x.state[i];
is >> x.state1;
is >> x.state2;
is.flags(flags);
return is;
}
};
using EQRand = additive_lagged_fibonacci_engine<uint32_t, 30, 24, 55>;
};
-190
View File
@@ -1,190 +0,0 @@
/*
* Boost Software License - Version 1.0 - August 17th, 2003
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
// EQEmu::Any is a modified version of Boost::Any and as such retains the Boost licensing.
#ifndef EQEMU_COMMON_ANY_H
#define EQEMU_COMMON_ANY_H
#include <algorithm>
#include <typeinfo>
namespace EQEmu
{
class Any
{
public:
Any()
: content(nullptr)
{
}
template<typename ValueType>
Any(const ValueType &value)
: content(new Holder<ValueType>(value))
{
}
Any(const Any &other)
: content(other.content ? other.content->clone() : 0)
{
}
~Any()
{
if(content)
delete content;
}
Any& swap(Any &rhs)
{
std::swap(content, rhs.content);
return *this;
}
template<typename ValueType>
Any& operator=(const ValueType &rhs)
{
Any(rhs).swap(*this);
return *this;
}
Any& operator=(Any rhs)
{
rhs.swap(*this);
return *this;
}
bool empty() const
{
return !content;
}
const std::type_info& type() const
{
return content ? content->type() : typeid(void);
}
class Placeholder
{
public:
virtual ~Placeholder()
{
}
virtual const std::type_info& type() const = 0;
virtual Placeholder* clone() const = 0;
};
template<typename ValueType>
class Holder : public Placeholder
{
public:
Holder(const ValueType &value)
: held(value)
{
}
virtual const std::type_info& type() const
{
return typeid(ValueType);
}
virtual Placeholder* clone() const
{
return new Holder(held);
}
ValueType held;
private:
Holder& operator=(const Holder&);
};
private:
template<typename ValueType>
friend ValueType* any_cast(Any*);
template<typename ValueType>
friend ValueType* unsafe_any_cast(Any*);
Placeholder* content;
};
class bad_any_cast : public std::bad_cast
{
public:
virtual const char * what() const throw()
{
return "DBI::bad_any_cast: failed conversion using DBI::any_cast";
}
};
template<typename ValueType>
ValueType* any_cast(Any* operand)
{
return operand &&
operand->type() == typeid(ValueType) ? &static_cast<Any::Holder<ValueType>*>(operand->content)->held : nullptr;
}
template<typename ValueType>
inline const ValueType* any_cast(const Any* operand)
{
return any_cast<ValueType>(const_cast<Any*>(operand));
}
template<typename ValueType>
ValueType any_cast(Any& operand)
{
typedef typename std::remove_reference<ValueType>::type nonref;
nonref* result = any_cast<nonref>(&operand);
if(!result)
throw bad_any_cast();
return *result;
}
template<typename ValueType>
inline ValueType any_cast(const Any& operand)
{
typedef typename std::remove_reference<ValueType>::type nonref;
return any_cast<const nonref&>(const_cast<Any&>(operand));
}
template<typename ValueType>
inline ValueType* unsafe_any_cast(Any* operand)
{
return &static_cast<Any::Holder<ValueType>*>(operand->content)->held;
}
template<typename ValueType>
inline const ValueType* unsafe_any_cast(const Any* operand)
{
return unsafe_any_cast<ValueType>(const_cast<Any*>(operand));
}
}
#endif
+8 -8
View File
@@ -23,18 +23,18 @@
BasePacket::BasePacket(const unsigned char *buf, uint32 len)
{
this->pBuffer=nullptr;
this->size=0;
this->_wpos = 0;
this->_rpos = 0;
this->timestamp.tv_sec = 0;
pBuffer=nullptr;
size=0;
_wpos = 0;
_rpos = 0;
timestamp.tv_sec = 0;
if (len>0) {
this->size=len;
size=len;
pBuffer= new unsigned char[len];
if (buf) {
memcpy(this->pBuffer,buf,len);
memcpy(pBuffer,buf,len);
} else {
memset(this->pBuffer,0,len);
memset(pBuffer,0,len);
}
}
}
+10 -8
View File
@@ -27,16 +27,17 @@ typedef enum {
BT_Extraplanar = 6,
BT_Magical = 7, //this name might be a bit off,
BT_SummonedUndead = 8,
BT_RaidGiant = 9,
// ...
BT_RaidGiant = 9, //Velious era Raid Giant
BT_RaidColdain = 10, //Velious era Raid Coldain
BT_NoTarget = 11, //no name, can't target this bodytype
BT_Vampire = 12,
BT_Atenha_Ra = 13,
BT_Greater_Akheva = 14,
BT_Khati_Sha = 15,
BT_Seru = 16, //not confirmed....
BT_Seru = 16,
BT_Grieg_Veneficus = 17,
BT_Draz_Nurakk = 18,
BT_Zek = 19,
BT_Zek = 19, //"creatures from the Plane of War."
BT_Luggald = 20,
BT_Animal = 21,
BT_Insect = 22,
@@ -46,17 +47,18 @@ typedef enum {
BT_Dragon = 26,
BT_Summoned2 = 27,
BT_Summoned3 = 28,
//29
BT_Dragon2 = 29, //database data indicates this is a dragon type (kunark and DoN?)
BT_VeliousDragon = 30, //might not be a tight set
// ...
BT_Familiar = 31,
BT_Dragon3 = 32,
BT_Boxes = 33,
BT_Muramite = 34, //tribal dudes
// ...
BT_NoTarget2 = 60,
// ...
BT_SwarmPet = 63, //is this valid, or made up?
// ...
BT_SwarmPet = 63, //Looks like weapon proc related temp pets and few misc pets, should not be used for checking swarm pets in general.
BT_MonsterSummon = 64,
// 65, trap or effect related?
BT_InvisMan = 66, //no name, seen on 'InvisMan', can be /targeted
BT_Special = 67
} bodyType;
+18 -4
View File
@@ -378,16 +378,30 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
return "Berserker Guildmaster";
case MERCHANT:
return "Merchant";
case ADVENTURERECRUITER:
case DISCORD_MERCHANT:
return "Discord Merchant";
case ADVENTURE_RECRUITER:
return "Adventure Recruiter";
case ADVENTUREMERCHANT:
case ADVENTURE_MERCHANT:
return "Adventure Merchant";
case CORPSE_CLASS:
return "Corpse Class";
case LDON_TREASURE:
return "LDoN Treasure";
case TRIBUTE_MASTER:
return "Tribute Master";
case 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 MERCENARY_MASTER:
return "Mercenary Liaison";
default:
return "Unknown";
}
+5 -5
View File
@@ -55,17 +55,17 @@
#define BANKER 40
#define MERCHANT 41
#define DISCORD_MERCHANT 59
#define ADVENTURERECRUITER 60
#define ADVENTUREMERCHANT 61
#define LDON_TREASURE 62 // objects you can use /open on first seen in LDONs
#define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far..
#define ADVENTURE_RECRUITER 60
#define ADVENTURE_MERCHANT 61
#define LDON_TREASURE 62 // objects you can use /open on first seen in LDONs, seen on Danvi's Corpse in Akheva
#define TRIBUTE_MASTER 63
#define GUILD_TRIBUTE_MASTER 64 // not sure
#define GUILD_BANKER 66
#define NORRATHS_KEEPERS_MERCHANT 67
#define DARK_REIGN_MERCHANT 68
#define FELLOWSHIP_MASTER 69
#define ALT_CURRENCY_MERCHANT 70
#define MERCERNARY_MASTER 71
#define MERCENARY_MASTER 71
// player class values
+10 -5
View File
@@ -77,7 +77,7 @@ namespace EQEmuCommand {
index++;
}
if (!arguments_filled || argc == 2) {
if (!arguments_filled || argc == 2 || cmd[{"-h", "--help"}]) {
std::string arguments_string;
for (auto &arg : arguments) {
arguments_string += " " + arg;
@@ -96,12 +96,12 @@ namespace EQEmuCommand {
"\nCommand" <<
termcolor::reset << "\n\n" <<
termcolor::green << argv[1] << arguments_string << termcolor::reset << "\n" <<
termcolor::yellow << (!options_string.empty() ? "\nOptions\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(1);
exit(0);
}
}
@@ -168,6 +168,11 @@ namespace EQEmuCommand {
* 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;
@@ -183,11 +188,11 @@ namespace EQEmuCommand {
std::cout << std::endl;
std::exit(1);
std::exit(0);
}
if (ran_command) {
std::exit(1);
std::exit(0);
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
#include <string.h>
#include <zlib.h>
namespace EQEmu
namespace EQ
{
uint32 EstimateDeflateBuffer(uint32 len) {
z_stream zstream;
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
namespace EQEmu
namespace EQ
{
uint32 EstimateDeflateBuffer(uint32 len);
uint32 DeflateData(const char *buffer, uint32 len, char *out_buffer, uint32 out_len_max);
+241
View File
@@ -0,0 +1,241 @@
/**
* 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"
#include "../loottable.h"
#include "../repositories/content_flags_repository.h"
WorldContentService::WorldContentService()
{
SetCurrentExpansion(Expansion::EXPANSION_ALL);
}
int WorldContentService::GetCurrentExpansion() const
{
return current_expansion;
}
WorldContentService *WorldContentService::SetExpansionContext()
{
// do a rule manager reload until where we store expansion is changed to somewhere else
RuleManager::Instance()->LoadRules(GetDatabase(), "default", true);
// pull expansion from rules
int expansion = RuleI(Expansion, CurrentExpansion);
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
content_service.SetCurrentExpansion(expansion);
}
LogInfo(
"Current expansion is [{}] ({})",
GetCurrentExpansion(),
GetCurrentExpansionName()
);
return this;
}
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<ContentFlagsRepository::ContentFlags> &WorldContentService::GetContentFlags() const
{
return content_flags;
}
/**
* @return
*/
std::vector<std::string> WorldContentService::GetContentFlagsEnabled()
{
std::vector<std::string> enabled_flags;
for (auto &f: GetContentFlags()) {
if (f.enabled) {
enabled_flags.emplace_back(f.flag_name);
}
}
return enabled_flags;
}
/**
* @return
*/
std::vector<std::string> WorldContentService::GetContentFlagsDisabled()
{
std::vector<std::string> disabled_flags;
for (auto &f: GetContentFlags()) {
if (!f.enabled) {
disabled_flags.emplace_back(f.flag_name);
}
}
return disabled_flags;
}
/**
* @param content_flags
*/
void WorldContentService::SetContentFlags(std::vector<ContentFlagsRepository::ContentFlags> content_flags)
{
WorldContentService::content_flags = content_flags;
}
/**
* @param content_flag
* @return
*/
bool WorldContentService::IsContentFlagEnabled(const std::string &content_flag)
{
for (auto &f: GetContentFlags()) {
if (f.flag_name == content_flag && f.enabled == true) {
return true;
}
}
return false;
}
/**
* @param content_flag
* @return
*/
bool WorldContentService::IsContentFlagDisabled(const std::string &content_flag)
{
for (auto &f: GetContentFlags()) {
if (f.flag_name == content_flag && f.enabled == false) {
return true;
}
}
return false;
}
bool WorldContentService::DoesPassContentFiltering(const ContentFlags &f)
{
// if we're not set to (-1 All) then fail when we aren't within minimum expansion
if (f.min_expansion > Expansion::EXPANSION_ALL && current_expansion < f.min_expansion && current_expansion != -1) {
return false;
}
// if we're not set to (-1 All) then fail when we aren't within max expansion
if (f.max_expansion > Expansion::EXPANSION_ALL && current_expansion > f.max_expansion && current_expansion != -1) {
return false;
}
// if we don't have any enabled flag in enabled flags, we fail
for (const auto& flag: Strings::Split(f.content_flags)) {
if (!Strings::Contains(GetContentFlagsEnabled(), flag)) {
return false;
}
}
// if we don't have any disabled flag in disabled flags, we fail
for (const auto& flag: Strings::Split(f.content_flags_disabled)) {
if (!Strings::Contains(GetContentFlagsDisabled(), flag)) {
return false;
}
}
return true;
}
void WorldContentService::ReloadContentFlags()
{
std::vector<ContentFlagsRepository::ContentFlags> set_content_flags;
auto flags = ContentFlagsRepository::All(*GetDatabase());
set_content_flags.reserve(flags.size());
for (auto &f: flags) {
set_content_flags.push_back(f);
LogInfo(
"Loaded content flag [{}] [{}]",
f.flag_name,
(f.enabled ? "Enabled" : "Disabled")
);
}
SetContentFlags(set_content_flags);
}
Database *WorldContentService::GetDatabase() const
{
return m_database;
}
WorldContentService *WorldContentService::SetDatabase(Database *database)
{
WorldContentService::m_database = database;
return this;
}
void WorldContentService::SetContentFlag(const std::string &content_flag_name, bool enabled)
{
auto flags = ContentFlagsRepository::GetWhere(
*GetDatabase(),
fmt::format("flag_name = '{}'", content_flag_name)
);
auto f = ContentFlagsRepository::NewEntity();
if (!flags.empty()) {
f = flags.front();
}
f.enabled = enabled ? 1 : 0;
f.flag_name = content_flag_name;
if (!flags.empty()) {
ContentFlagsRepository::UpdateOne(*GetDatabase(), f);
}
else {
ContentFlagsRepository::InsertOne(*GetDatabase(), f);
}
ReloadContentFlags();
}
+191
View File
@@ -0,0 +1,191 @@
/**
* 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>
#include "../loottable.h"
#include "../repositories/content_flags_repository.h"
class Database;
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,
TheDarkenedSea,
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 IsTheDarkenedSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheDarkenedSea || 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 IsCurrentExpansionTheDarkenedSea() { return current_expansion == Expansion::ExpansionNumber::TheDarkenedSea; }
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; }
const std::vector<ContentFlagsRepository::ContentFlags> &GetContentFlags() const;
std::vector<std::string> GetContentFlagsEnabled();
std::vector<std::string> GetContentFlagsDisabled();
bool IsContentFlagEnabled(const std::string& content_flag);
bool IsContentFlagDisabled(const std::string& content_flag);
void SetContentFlags(std::vector<ContentFlagsRepository::ContentFlags> content_flags);
void ReloadContentFlags();
WorldContentService * SetExpansionContext();
bool DoesPassContentFiltering(const ContentFlags& f);
WorldContentService * SetDatabase(Database *database);
Database *GetDatabase() const;
void SetContentFlag(const std::string &content_flag_name, bool enabled);
private:
int current_expansion{};
std::vector<ContentFlagsRepository::ContentFlags> content_flags;
// reference to database
Database *m_database;
};
extern WorldContentService content_service;
#endif //EQEMU_WORLD_CONTENT_SERVICE_H
+66 -2
View File
@@ -2,6 +2,48 @@
#include "eqemu_logsys.h"
#include "crash.h"
inline std::string random_string(size_t length)
{
auto randchar = []() -> char {
const char charset[] = "0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
const size_t max_index = (sizeof(charset) - 1);
return charset[static_cast<size_t>(std::rand()) % max_index];
};
std::string str(length, 0);
std::generate_n(str.begin(), length, randchar);
return str;
}
std::string execute(const std::string &cmd, bool return_result = true)
{
std::string random = "/tmp/" + random_string(25);
const char *file_name = random.c_str();
if (return_result) {
#ifdef _WINDOWS
std::system((cmd + " > " + file_name + " 2>&1").c_str());
#else
std::system((cmd + " > " + file_name + " 2>&1").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;
}
#if defined(_WINDOWS) && defined(CRASH_LOGGING)
#include "StackWalker.h"
@@ -118,12 +160,35 @@ void set_exception_handler() {
#include <unistd.h>
#include <sys/fcntl.h>
#ifdef __FreeBSD__
#include <signal.h>
#include <sys/stat.h>
#endif
void print_trace()
{
auto uid = geteuid();
bool does_gdb_exist = execute("gdb -v").find("GNU") != std::string::npos;
if (!does_gdb_exist) {
LogCrash(
"[Error] GDB is not installed, if you want crash dumps on Linux to work properly you will need GDB installed"
);
std::exit(1);
}
auto uid = geteuid();
std::string temp_output_file = "/tmp/dump-output";
// check for passwordless sudo if not root
if (uid != 0) {
bool has_passwordless_sudo = execute("sudo -n true").find("a password is required") == std::string::npos;
if (!has_passwordless_sudo) {
LogCrash(
"[Error] Current user does not have passwordless sudo installed. It is required to automatically process crash dumps with GDB as non-root."
);
std::exit(1);
}
}
char pid_buf[30];
sprintf(pid_buf, "%d", getpid());
char name_buf[512];
@@ -131,7 +196,6 @@ void print_trace()
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) {
+876
View File
@@ -0,0 +1,876 @@
#pragma once
#include <vector>
#include <string>
#include <sstream>
#include <bitset>
#include <cctype>
#include <ctime>
#include <iomanip>
#include <algorithm>
#if __cplusplus > 201402L
#include <string_view>
#define CRONCPP_IS_CPP17
#endif
namespace cron
{
#ifdef CRONCPP_IS_CPP17
#define HAS_STRING_VIEW
#define STRING_VIEW std::string_view
#define STRING_VIEW_NPOS std::string_view::npos
#define CONSTEXPTR constexpr
#else
#define STRING_VIEW std::string const &
#define STRING_VIEW_NPOS std::string::npos
#define CONSTEXPTR
#endif
using cron_int = uint8_t;
constexpr std::time_t INVALID_TIME = static_cast<std::time_t>(-1);
constexpr size_t INVALID_CRON_INDEX = static_cast<size_t>(-1);
class cronexpr;
namespace detail
{
enum class cron_field
{
second,
minute,
hour_of_day,
day_of_week,
day_of_month,
month,
year
};
template <typename Traits>
static bool find_next(cronexpr const & cex,
std::tm& date,
size_t const dot);
}
struct bad_cronexpr : public std::runtime_error
{
public:
explicit bad_cronexpr(STRING_VIEW message) :
std::runtime_error(message.data())
{}
};
struct cron_standard_traits
{
static const cron_int CRON_MIN_SECONDS = 0;
static const cron_int CRON_MAX_SECONDS = 59;
static const cron_int CRON_MIN_MINUTES = 0;
static const cron_int CRON_MAX_MINUTES = 59;
static const cron_int CRON_MIN_HOURS = 0;
static const cron_int CRON_MAX_HOURS = 23;
static const cron_int CRON_MIN_DAYS_OF_WEEK = 0;
static const cron_int CRON_MAX_DAYS_OF_WEEK = 6;
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
static const cron_int CRON_MIN_MONTHS = 1;
static const cron_int CRON_MAX_MONTHS = 12;
static const cron_int CRON_MAX_YEARS_DIFF = 4;
#ifdef CRONCPP_IS_CPP17
static const inline std::vector<std::string> DAYS = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
static const inline std::vector<std::string> MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
#else
static std::vector<std::string>& DAYS()
{
static std::vector<std::string> days = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
return days;
}
static std::vector<std::string>& MONTHS()
{
static std::vector<std::string> months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
return months;
}
#endif
};
struct cron_oracle_traits
{
static const cron_int CRON_MIN_SECONDS = 0;
static const cron_int CRON_MAX_SECONDS = 59;
static const cron_int CRON_MIN_MINUTES = 0;
static const cron_int CRON_MAX_MINUTES = 59;
static const cron_int CRON_MIN_HOURS = 0;
static const cron_int CRON_MAX_HOURS = 23;
static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
static const cron_int CRON_MIN_MONTHS = 0;
static const cron_int CRON_MAX_MONTHS = 11;
static const cron_int CRON_MAX_YEARS_DIFF = 4;
#ifdef CRONCPP_IS_CPP17
static const inline std::vector<std::string> DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
static const inline std::vector<std::string> MONTHS = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
#else
static std::vector<std::string>& DAYS()
{
static std::vector<std::string> days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
return days;
}
static std::vector<std::string>& MONTHS()
{
static std::vector<std::string> months = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
return months;
}
#endif
};
struct cron_quartz_traits
{
static const cron_int CRON_MIN_SECONDS = 0;
static const cron_int CRON_MAX_SECONDS = 59;
static const cron_int CRON_MIN_MINUTES = 0;
static const cron_int CRON_MAX_MINUTES = 59;
static const cron_int CRON_MIN_HOURS = 0;
static const cron_int CRON_MAX_HOURS = 23;
static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
static const cron_int CRON_MIN_MONTHS = 1;
static const cron_int CRON_MAX_MONTHS = 12;
static const cron_int CRON_MAX_YEARS_DIFF = 4;
#ifdef CRONCPP_IS_CPP17
static const inline std::vector<std::string> DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
static const inline std::vector<std::string> MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
#else
static std::vector<std::string>& DAYS()
{
static std::vector<std::string> days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
return days;
}
static std::vector<std::string>& MONTHS()
{
static std::vector<std::string> months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
return months;
}
#endif
};
class cronexpr;
template <typename Traits = cron_standard_traits>
static cronexpr make_cron(STRING_VIEW expr);
class cronexpr
{
std::bitset<60> seconds;
std::bitset<60> minutes;
std::bitset<24> hours;
std::bitset<7> days_of_week;
std::bitset<31> days_of_month;
std::bitset<12> months;
friend bool operator==(cronexpr const & e1, cronexpr const & e2);
friend bool operator!=(cronexpr const & e1, cronexpr const & e2);
template <typename Traits>
friend bool detail::find_next(cronexpr const & cex,
std::tm& date,
size_t const dot);
friend std::string to_string(cronexpr const & cex);
template <typename Traits>
friend cronexpr make_cron(STRING_VIEW expr);
};
inline bool operator==(cronexpr const & e1, cronexpr const & e2)
{
return
e1.seconds == e2.seconds &&
e1.minutes == e2.minutes &&
e1.hours == e2.hours &&
e1.days_of_week == e2.days_of_week &&
e1.days_of_month == e2.days_of_month &&
e1.months == e2.months;
}
inline bool operator!=(cronexpr const & e1, cronexpr const & e2)
{
return !(e1 == e2);
}
inline std::string to_string(cronexpr const & cex)
{
return
cex.seconds.to_string() + " " +
cex.minutes.to_string() + " " +
cex.hours.to_string() + " " +
cex.days_of_month.to_string() + " " +
cex.months.to_string() + " " +
cex.days_of_week.to_string();
}
namespace utils
{
inline std::time_t tm_to_time(std::tm& date)
{
return std::mktime(&date);
}
inline std::tm* time_to_tm(std::time_t const * date, std::tm* const out)
{
#ifdef _WIN32
errno_t err = localtime_s(out, date);
return 0 == err ? out : nullptr;
#else
return localtime_r(date, out);
#endif
}
inline std::tm to_tm(STRING_VIEW time)
{
std::istringstream str(time.data());
str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
std::tm result;
str >> std::get_time(&result, "%Y-%m-%d %H:%M:%S");
if (str.fail()) throw std::runtime_error("Parsing date failed!");
result.tm_isdst = -1; // DST info not available
return result;
}
inline std::string to_string(std::tm const & tm)
{
std::ostringstream str;
str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
str << std::put_time(&tm, "%Y-%m-%d %H:%M:%S");
if (str.fail()) throw std::runtime_error("Writing date failed!");
return str.str();
}
inline std::string to_upper(std::string text)
{
std::transform(std::begin(text), std::end(text),
std::begin(text), static_cast<int(*)(int)>(std::toupper));
return text;
}
static std::vector<std::string> split(STRING_VIEW text, char const delimiter)
{
std::vector<std::string> tokens;
std::string token;
std::istringstream tokenStream(text.data());
while (std::getline(tokenStream, token, delimiter))
{
tokens.push_back(token);
}
return tokens;
}
CONSTEXPTR inline bool contains(STRING_VIEW text, char const ch) noexcept
{
return STRING_VIEW_NPOS != text.find_first_of(ch);
}
}
namespace detail
{
inline cron_int to_cron_int(STRING_VIEW text)
{
try
{
return static_cast<cron_int>(std::stoul(text.data()));
}
catch (std::exception const & ex)
{
throw bad_cronexpr(ex.what());
}
}
static std::string replace_ordinals(
std::string text,
std::vector<std::string> const & replacement)
{
for (size_t i = 0; i < replacement.size(); ++i)
{
auto pos = text.find(replacement[i]);
if (std::string::npos != pos)
text.replace(pos, 3 ,std::to_string(i));
}
return text;
}
static std::pair<cron_int, cron_int> make_range(
STRING_VIEW field,
cron_int const minval,
cron_int const maxval)
{
cron_int first = 0;
cron_int last = 0;
if (field.size() == 1 && field[0] == '*')
{
first = minval;
last = maxval;
}
else if (!utils::contains(field, '-'))
{
first = to_cron_int(field);
last = first;
}
else
{
auto parts = utils::split(field, '-');
if (parts.size() != 2)
throw bad_cronexpr("Specified range requires two fields");
first = to_cron_int(parts[0]);
last = to_cron_int(parts[1]);
}
if (first > maxval || last > maxval)
{
throw bad_cronexpr("Specified range exceeds maximum");
}
if (first < minval || last < minval)
{
throw bad_cronexpr("Specified range is less than minimum");
}
if (first > last)
{
throw bad_cronexpr("Specified range start exceeds range end");
}
return { first, last };
}
template <size_t N>
static void set_cron_field(
STRING_VIEW value,
std::bitset<N>& target,
cron_int const minval,
cron_int const maxval)
{
if(value.length() > 0 && value[value.length()-1] == ',')
throw bad_cronexpr("Value cannot end with comma");
auto fields = utils::split(value, ',');
if (fields.empty())
throw bad_cronexpr("Expression parsing error");
for (auto const & field : fields)
{
if (!utils::contains(field, '/'))
{
#ifdef CRONCPP_IS_CPP17
auto[first, last] = detail::make_range(field, minval, maxval);
#else
auto range = detail::make_range(field, minval, maxval);
auto first = range.first;
auto last = range.second;
#endif
for (cron_int i = first - minval; i <= last - minval; ++i)
{
target.set(i);
}
}
else
{
auto parts = utils::split(field, '/');
if (parts.size() != 2)
throw bad_cronexpr("Incrementer must have two fields");
#ifdef CRONCPP_IS_CPP17
auto[first, last] = detail::make_range(parts[0], minval, maxval);
#else
auto range = detail::make_range(parts[0], minval, maxval);
auto first = range.first;
auto last = range.second;
#endif
if (!utils::contains(parts[0], '-'))
{
last = maxval;
}
auto delta = detail::to_cron_int(parts[1]);
if(delta <= 0)
throw bad_cronexpr("Incrementer must be a positive value");
for (cron_int i = first - minval; i <= last - minval; i += delta)
{
target.set(i);
}
}
}
}
template <typename Traits>
static void set_cron_days_of_week(
std::string value,
std::bitset<7>& target)
{
auto days = utils::to_upper(value);
auto days_replaced = detail::replace_ordinals(
days,
#ifdef CRONCPP_IS_CPP17
Traits::DAYS
#else
Traits::DAYS()
#endif
);
if (days_replaced.size() == 1 && days_replaced[0] == '?')
days_replaced[0] = '*';
set_cron_field(
days_replaced,
target,
Traits::CRON_MIN_DAYS_OF_WEEK,
Traits::CRON_MAX_DAYS_OF_WEEK);
}
template <typename Traits>
static void set_cron_days_of_month(
std::string value,
std::bitset<31>& target)
{
if (value.size() == 1 && value[0] == '?')
value[0] = '*';
set_cron_field(
value,
target,
Traits::CRON_MIN_DAYS_OF_MONTH,
Traits::CRON_MAX_DAYS_OF_MONTH);
}
template <typename Traits>
static void set_cron_month(
std::string value,
std::bitset<12>& target)
{
auto month = utils::to_upper(value);
auto month_replaced = replace_ordinals(
month,
#ifdef CRONCPP_IS_CPP17
Traits::MONTHS
#else
Traits::MONTHS()
#endif
);
set_cron_field(
month_replaced,
target,
Traits::CRON_MIN_MONTHS,
Traits::CRON_MAX_MONTHS);
}
template <size_t N>
inline size_t next_set_bit(
std::bitset<N> const & target,
size_t /*minimum*/,
size_t /*maximum*/,
size_t offset)
{
for (auto i = offset; i < N; ++i)
{
if (target.test(i)) return i;
}
return INVALID_CRON_INDEX;
}
inline void add_to_field(
std::tm& date,
cron_field const field,
int const val)
{
switch (field)
{
case cron_field::second:
date.tm_sec += val;
break;
case cron_field::minute:
date.tm_min += val;
break;
case cron_field::hour_of_day:
date.tm_hour += val;
break;
case cron_field::day_of_week:
case cron_field::day_of_month:
date.tm_mday += val;
break;
case cron_field::month:
date.tm_mon += val;
break;
case cron_field::year:
date.tm_year += val;
break;
}
if (INVALID_TIME == utils::tm_to_time(date))
throw bad_cronexpr("Invalid time expression");
}
inline void set_field(
std::tm& date,
cron_field const field,
int const val)
{
switch (field)
{
case cron_field::second:
date.tm_sec = val;
break;
case cron_field::minute:
date.tm_min = val;
break;
case cron_field::hour_of_day:
date.tm_hour = val;
break;
case cron_field::day_of_week:
date.tm_wday = val;
break;
case cron_field::day_of_month:
date.tm_mday = val;
break;
case cron_field::month:
date.tm_mon = val;
break;
case cron_field::year:
date.tm_year = val;
break;
}
if (INVALID_TIME == utils::tm_to_time(date))
throw bad_cronexpr("Invalid time expression");
}
inline void reset_field(
std::tm& date,
cron_field const field)
{
switch (field)
{
case cron_field::second:
date.tm_sec = 0;
break;
case cron_field::minute:
date.tm_min = 0;
break;
case cron_field::hour_of_day:
date.tm_hour = 0;
break;
case cron_field::day_of_week:
date.tm_wday = 0;
break;
case cron_field::day_of_month:
date.tm_mday = 1;
break;
case cron_field::month:
date.tm_mon = 0;
break;
case cron_field::year:
date.tm_year = 0;
break;
}
if (INVALID_TIME == utils::tm_to_time(date))
throw bad_cronexpr("Invalid time expression");
}
inline void reset_all_fields(
std::tm& date,
std::bitset<7> const & marked_fields)
{
for (size_t i = 0; i < marked_fields.size(); ++i)
{
if (marked_fields.test(i))
reset_field(date, static_cast<cron_field>(i));
}
}
inline void mark_field(
std::bitset<7> & orders,
cron_field const field)
{
if (!orders.test(static_cast<size_t>(field)))
orders.set(static_cast<size_t>(field));
}
template <size_t N>
static size_t find_next(
std::bitset<N> const & target,
std::tm& date,
unsigned int const minimum,
unsigned int const maximum,
unsigned int const value,
cron_field const field,
cron_field const next_field,
std::bitset<7> const & marked_fields)
{
auto next_value = next_set_bit(target, minimum, maximum, value);
if (INVALID_CRON_INDEX == next_value)
{
add_to_field(date, next_field, 1);
reset_field(date, field);
next_value = next_set_bit(target, minimum, maximum, 0);
}
if (INVALID_CRON_INDEX == next_value || next_value != value)
{
set_field(date, field, static_cast<int>(next_value));
reset_all_fields(date, marked_fields);
}
return next_value;
}
template <typename Traits>
static size_t find_next_day(
std::tm& date,
std::bitset<31> const & days_of_month,
size_t day_of_month,
std::bitset<7> const & days_of_week,
size_t day_of_week,
std::bitset<7> const & marked_fields)
{
unsigned int count = 0;
unsigned int maximum = 366;
while (
(!days_of_month.test(day_of_month - Traits::CRON_MIN_DAYS_OF_MONTH) ||
!days_of_week.test(day_of_week - Traits::CRON_MIN_DAYS_OF_WEEK))
&& count++ < maximum)
{
add_to_field(date, cron_field::day_of_month, 1);
day_of_month = date.tm_mday;
day_of_week = date.tm_wday;
reset_all_fields(date, marked_fields);
}
return day_of_month;
}
template <typename Traits>
static bool find_next(cronexpr const & cex,
std::tm& date,
size_t const dot)
{
bool res = true;
std::bitset<7> marked_fields{ 0 };
std::bitset<7> empty_list{ 0 };
unsigned int second = date.tm_sec;
auto updated_second = find_next(
cex.seconds,
date,
Traits::CRON_MIN_SECONDS,
Traits::CRON_MAX_SECONDS,
second,
cron_field::second,
cron_field::minute,
empty_list);
if (second == updated_second)
{
mark_field(marked_fields, cron_field::second);
}
unsigned int minute = date.tm_min;
auto update_minute = find_next(
cex.minutes,
date,
Traits::CRON_MIN_MINUTES,
Traits::CRON_MAX_MINUTES,
minute,
cron_field::minute,
cron_field::hour_of_day,
marked_fields);
if (minute == update_minute)
{
mark_field(marked_fields, cron_field::minute);
}
else
{
res = find_next<Traits>(cex, date, dot);
if (!res) return res;
}
unsigned int hour = date.tm_hour;
auto updated_hour = find_next(
cex.hours,
date,
Traits::CRON_MIN_HOURS,
Traits::CRON_MAX_HOURS,
hour,
cron_field::hour_of_day,
cron_field::day_of_week,
marked_fields);
if (hour == updated_hour)
{
mark_field(marked_fields, cron_field::hour_of_day);
}
else
{
res = find_next<Traits>(cex, date, dot);
if (!res) return res;
}
unsigned int day_of_week = date.tm_wday;
unsigned int day_of_month = date.tm_mday;
auto updated_day_of_month = find_next_day<Traits>(
date,
cex.days_of_month,
day_of_month,
cex.days_of_week,
day_of_week,
marked_fields);
if (day_of_month == updated_day_of_month)
{
mark_field(marked_fields, cron_field::day_of_month);
}
else
{
res = find_next<Traits>(cex, date, dot);
if (!res) return res;
}
unsigned int month = date.tm_mon;
auto updated_month = find_next(
cex.months,
date,
Traits::CRON_MIN_MONTHS,
Traits::CRON_MAX_MONTHS,
month,
cron_field::month,
cron_field::year,
marked_fields);
if (month != updated_month)
{
if (date.tm_year - dot > Traits::CRON_MAX_YEARS_DIFF)
return false;
res = find_next<Traits>(cex, date, dot);
if (!res) return res;
}
return res;
}
}
template <typename Traits>
static cronexpr make_cron(STRING_VIEW expr)
{
cronexpr cex;
if (expr.empty())
throw bad_cronexpr("Invalid empty cron expression");
auto fields = utils::split(expr, ' ');
fields.erase(
std::remove_if(std::begin(fields), std::end(fields),
[](STRING_VIEW s) {return s.empty(); }),
std::end(fields));
if (fields.size() != 6)
throw bad_cronexpr("cron expression must have six fields");
detail::set_cron_field(fields[0], cex.seconds, Traits::CRON_MIN_SECONDS, Traits::CRON_MAX_SECONDS);
detail::set_cron_field(fields[1], cex.minutes, Traits::CRON_MIN_MINUTES, Traits::CRON_MAX_MINUTES);
detail::set_cron_field(fields[2], cex.hours, Traits::CRON_MIN_HOURS, Traits::CRON_MAX_HOURS);
detail::set_cron_days_of_week<Traits>(fields[5], cex.days_of_week);
detail::set_cron_days_of_month<Traits>(fields[3], cex.days_of_month);
detail::set_cron_month<Traits>(fields[4], cex.months);
return cex;
}
template <typename Traits = cron_standard_traits>
static std::tm cron_next(cronexpr const & cex, std::tm date)
{
time_t original = utils::tm_to_time(date);
if (INVALID_TIME == original) return {};
if (!detail::find_next<Traits>(cex, date, date.tm_year))
return {};
time_t calculated = utils::tm_to_time(date);
if (INVALID_TIME == calculated) return {};
if (calculated == original)
{
add_to_field(date, detail::cron_field::second, 1);
if (!detail::find_next<Traits>(cex, date, date.tm_year))
return {};
}
return date;
}
template <typename Traits = cron_standard_traits>
static std::time_t cron_next(cronexpr const & cex, std::time_t const & date)
{
std::tm val;
std::tm* dt = utils::time_to_tm(&date, &val);
if (dt == nullptr) return INVALID_TIME;
time_t original = utils::tm_to_time(*dt);
if (INVALID_TIME == original) return INVALID_TIME;
if(!detail::find_next<Traits>(cex, *dt, dt->tm_year))
return INVALID_TIME;
time_t calculated = utils::tm_to_time(*dt);
if (INVALID_TIME == calculated) return calculated;
if (calculated == original)
{
add_to_field(*dt, detail::cron_field::second, 1);
if(!detail::find_next<Traits>(cex, *dt, dt->tm_year))
return INVALID_TIME;
}
return utils::tm_to_time(*dt);
}
}
+1 -1
View File
@@ -23,7 +23,7 @@
#include <algorithm>
#include <cmath>
namespace EQEmu {
namespace EQ {
template<typename T>
T Clamp(const T &value, const T &lower, const T &upper)
{
+721 -642
View File
File diff suppressed because it is too large Load Diff
+61 -63
View File
@@ -40,29 +40,11 @@
class MySQLRequestResult;
class Client;
namespace EQEmu
namespace EQ
{
class InventoryProfile;
}
struct EventLogDetails_Struct {
uint32 id;
char accountname[64];
uint32 account_id;
int16 status;
char charactername[64];
char targetname[64];
char timestamp[64];
char descriptiontype[64];
char details[128];
};
struct CharacterEventLog_Struct {
uint32 count;
uint8 eventid;
EventLogDetails_Struct eld[255];
};
struct npcDecayTimes_Struct {
uint16 minlvl;
uint16 maxlvl;
@@ -96,47 +78,70 @@ class PTimerList;
#define SQL(...) #__VA_ARGS__
class LogSettings;
class Database : public DBcore {
public:
Database();
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();
/* Character Creation */
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 DeleteCharacter(char* character_name);
bool MoveCharacterToZone(const char* charname, const char* zonename);
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
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 StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv);
bool UpdateName(const char* oldname, const char* newname);
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 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 SetMQDetectionFlag(const char *accountname, const char *charactername, const std::string &hacked, const char *zone);
bool UpdateName(const char *oldname, const char *newname);
bool CopyCharacter(
const std::string& source_character_name,
const std::string& destination_character_name,
const std::string& destination_account_name
);
/* General Information Queries */
bool AddBannedIP(char* bannedIP, const char* notes); //Add IP address to the banned_ips table.
bool AddGMIP(char* ip_address, char* name);
bool CheckBannedIPs(const char* loginIP); //Check incoming connection against banned IP table.
bool CheckGMIPs(const char* loginIP, uint32 account_id);
bool CheckNameFilter(const char* name, bool surname = false);
bool CheckUsedName(const char* name);
bool AddBannedIP(std::string banned_ip, std::string notes); //Add IP address to the banned_ips table.
bool AddToNameFilter(std::string name);
bool CheckBannedIPs(std::string login_ip); //Check incoming connection against banned IP table.
bool CheckGMIPs(std::string login_ip, uint32 account_id);
bool CheckNameFilter(std::string name, bool surname = false);
bool CheckUsedName(std::string name);
uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0);
uint32 GetAccountIDByChar(uint32 char_id);
uint32 GetAccountIDByName(const char* accname, const char *loginserver, int16* status = 0, uint32* lsid = 0);
uint32 GetAccountIDByName(std::string account_name, std::string loginserver, int16* status = 0, uint32* lsid = 0);
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(std::string character_name, uint32 *account_id, uint32 *zone_id, uint32 *instance_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 GetCharName(uint32 char_id, char* name);
void LoginIP(uint32 AccountID, const char* LoginIP);
std::string GetCharNameByID(uint32 char_id);
std::string GetNPCNameByID(uint32 npc_id);
std::string GetCleanNPCNameByID(uint32 npc_id);
void LoginIP(uint32 account_id, std::string login_ip);
/* Instancing */
@@ -152,7 +157,6 @@ public:
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_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 GetInstanceVersion(uint16 instance_id);
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
@@ -171,7 +175,7 @@ public:
/* Adventure related. */
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win = false, bool remove = false);
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
/* Account Related */
@@ -185,6 +189,8 @@ public:
int16 CheckStatus(uint32 account_id);
void SetAccountCRCField(uint32 account_id, std::string field_name, uint64 checksum);
uint32 CheckLogin(const char* name, const char* password, const char *loginserver, int16* oStatus = 0);
uint32 CreateAccount(const char* name, const char* password, int16 status, const char* loginserver, uint32 lsaccount_id);
uint32 GetAccountIDFromLSID(const std::string& in_loginserver_id, uint32 in_loginserver_account_id, char* in_account_name = 0, int16* in_status = 0);
@@ -192,19 +198,20 @@ public:
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
void SetAgreementFlag(uint32 acctid);
int GetIPExemption(std::string account_ip);
int GetIPExemption(std::string account_ip);
void SetIPExemption(std::string account_ip, int exemption_amount);
int GetInstanceID(uint32 char_id, uint32 zone_id);
/* Groups */
char* GetGroupLeaderForLogin(const char* name,char* leaderbuf);
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
std::string GetGroupLeaderForLogin(std::string character_name);
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
uint32 GetGroupID(const char* name);
void ClearGroup(uint32 gid = 0);
void ClearGroupLeader(uint32 gid = 0);
void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false);
@@ -239,19 +246,11 @@ public:
/* 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, 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, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, 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 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 LoadZoneNames();
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
uint32 GetZoneID(const char* zonename);
uint8 GetPEQZone(uint32 zoneID, uint32 version);
uint8 GetPEQZone(uint32 zone_id, uint32 version);
uint8 GetMinStatus(uint32 zone_id, uint32 instance_version);
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
uint8 GetServerType();
uint8 GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level);
@@ -269,11 +268,10 @@ public:
int CountInvSnapshots();
void ClearInvSnapshots(bool from_now = false);
/* EQEmuLogSys */
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
void SourceDatabaseTableFromUrl(std::string table_name, std::string url);
private:
std::map<uint32,std::string> zonename_array;
Mutex Mvarcache;
VarCache_Struct varcache;
+609
View File
@@ -0,0 +1,609 @@
/**
* 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 "../strings.h"
#include "../eqemu_config.h"
#include "../database_schema.h"
#include "../file.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 Strings::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 Strings::Trim(tables_list);
}
/**
* @return
*/
std::string DatabaseDumpService::GetBotTablesList()
{
std::string tables_list;
std::vector<std::string> tables = DatabaseSchema::GetBotTables();
for (const auto &table : tables) {
tables_list += table + " ";
}
return Strings::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 Strings::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 Strings::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 Strings::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 Strings::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 Strings::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 --max-allowed-packet=1G --net-buffer-length=32704";
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 (IsDumpBotTables()) {
tables_to_dump += GetBotTablesList() + " ";
dump_descriptor += "-bots";
}
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 (!File::Exists(GetSetDumpPath()) && !IsDumpOutputToConsole()) {
File::Makedir(GetSetDumpPath());
}
if (IsDumpDropTableSyntaxOnly()) {
std::vector<std::string> tables = Strings::Split(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"));
// LogDebug("[{}] bot", (IsDumpBotTables() ? "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;
}
bool DatabaseDumpService::IsDumpBotTables() const
{
return dump_bot_tables;
}
void DatabaseDumpService::SetDumpBotTables(bool dump_bot_tables)
{
DatabaseDumpService::dump_bot_tables = dump_bot_tables;
}
+95
View File
@@ -0,0 +1,95 @@
/**
* 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);
bool IsDumpBotTables() const;
void SetDumpBotTables(bool dump_bot_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;
bool dump_bot_tables = 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 GetBotTablesList();
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
+109 -106
View File
@@ -18,11 +18,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/global_define.h"
#include "../common/rulesys.h"
#include "../common/string_util.h"
#include "../common/strings.h"
#include "../common/timer.h"
#include "database.h"
#include "extprofile.h"
#include "path_manager.h"
#include <iomanip>
#include <iostream>
@@ -48,7 +49,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
namespace Convert {
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -189,7 +190,7 @@ namespace Convert {
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ uint32 Items[EQEmu::textures::materialCount];
/*510*/ uint32 Items[EQ::textures::materialCount];
/*546*/ char Name[64];
/*610*/
};
@@ -230,9 +231,9 @@ namespace Convert {
/*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder
/*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];
/*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];
/*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right
@@ -476,7 +477,9 @@ bool Database::CheckDatabaseConversions() {
CheckDatabaseConvertCorpseDeblob();
/* Run EQEmu Server script (Checks for database updates) */
if(system("perl eqemu_server.pl ran_from_world"));
const std::string file = fmt::format("{}/eqemu_server.pl", path.GetServerPath());
system(fmt::format("perl {} ran_from_world", file).c_str());
return true;
}
@@ -961,7 +964,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
std::string rquery = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message)"
"VALUES (%u, '%s')",
character_id,
EscapeString(inspectmessage).c_str()
Strings::Escape(inspectmessage).c_str()
);
auto results = QueryDatabase(rquery);
}
@@ -1097,95 +1100,95 @@ bool Database::CheckDatabaseConvertPPDeblob(){
"e_expended_aa_spent"
")"
"VALUES ("
"%u," // id
"%u," // account_id
"'%s'," // `name`
"'%s'," // last_name
"%u," // gender
"%u," // race
"%u," // class
"%u," // `level`
"%u," // deity
"%u," // birthday
"%u," // last_login
"%u," // time_played
"%u," // pvp_status
"%u," // level2
"%u," // anon
"%u," // gm
"%u," // intoxication
"%u," // hair_color
"%u," // beard_color
"%u," // eye_color_1
"%u," // eye_color_2
"%u," // hair_style
"%u," // beard
"%u," // ability_time_seconds
"%u," // ability_number
"%u," // ability_time_minutes
"%u," // ability_time_hours
"'%s'," // title
"'%s'," // suffix
"%u," // exp
"%u," // points
"%u," // mana
"%u," // cur_hp
"%u," // str
"%u," // sta
"%u," // cha
"%u," // dex
"%u," // `int`
"%u," // agi
"%u," // wis
"%u," // face
"%f," // y
"%f," // x
"%f," // z
"%f," // heading
"%u," // pvp2
"%u," // pvp_type
"%u," // autosplit_enabled
"%u," // zone_change_count
"%u," // drakkin_heritage
"%u," // drakkin_tattoo
"%u," // drakkin_details
"%i," // toxicity
"%u," // hunger_level
"%u," // thirst_level
"%u," // ability_up
"%u," // zone_id
"%u," // zone_instance
"%u," // leadership_exp_on
"%u," // ldon_points_guk
"%u," // ldon_points_mir
"%u," // ldon_points_mmc
"%u," // ldon_points_ruj
"%u," // ldon_points_tak
"%u," // ldon_points_available
"%u," // tribute_time_remaining
"%u," // show_helm
"%u," // career_tribute_points
"%u," // tribute_points
"%u," // tribute_active
"%u," // endurance
"%u," // group_leadership_exp
"%u," // raid_leadership_exp
"%u," // group_leadership_points
"%u," // raid_leadership_points
"%u," // air_remaining
"%u," // pvp_kills
"%u," // pvp_deaths
"%u," // pvp_current_points
"%u," // pvp_career_points
"%u," // pvp_best_kill_streak
"%u," // pvp_worst_death_streak
"%u," // pvp_current_kill_streak
"%u," // aa_points_spent
"%u," // aa_exp
"%u," // aa_points
"%u," // group_auto_consent
"%u," // raid_auto_consent
"%u," // guild_auto_consent
"%u," // id
"%u," // account_id
"'%s'," // `name`
"'%s'," // last_name
"%u," // gender
"%u," // race
"%u," // class
"%u," // `level`
"%u," // deity
"%u," // birthday
"%u," // last_login
"%u," // time_played
"%u," // pvp_status
"%u," // level2
"%u," // anon
"%u," // gm
"%u," // intoxication
"%u," // hair_color
"%u," // beard_color
"%u," // eye_color_1
"%u," // eye_color_2
"%u," // hair_style
"%u," // beard
"%u," // ability_time_seconds
"%u," // ability_number
"%u," // ability_time_minutes
"%u," // ability_time_hours
"'%s'," // title
"'%s'," // suffix
"%u," // exp
"%u," // points
"%u," // mana
"%u," // cur_hp
"%u," // str
"%u," // sta
"%u," // cha
"%u," // dex
"%u," // `int`
"%u," // agi
"%u," // wis
"%u," // face
"%f," // y
"%f," // x
"%f," // z
"%f," // heading
"%u," // pvp2
"%u," // pvp_type
"%u," // autosplit_enabled
"%u," // zone_change_count
"%u," // drakkin_heritage
"%u," // drakkin_tattoo
"%u," // drakkin_details
"%i," // toxicity
"%u," // hunger_level
"%u," // thirst_level
"%u," // ability_up
"%u," // zone_id
"%u," // zone_instance
"%u," // leadership_exp_on
"%u," // ldon_points_guk
"%u," // ldon_points_mir
"%u," // ldon_points_mmc
"%u," // ldon_points_ruj
"%u," // ldon_points_tak
"%u," // ldon_points_available
"%u," // tribute_time_remaining
"%u," // show_helm
"%u," // career_tribute_points
"%u," // tribute_points
"%u," // tribute_active
"%u," // endurance
"%u," // group_leadership_exp
"%u," // raid_leadership_exp
"%u," // group_leadership_points
"%u," // raid_leadership_points
"%u," // air_remaining
"%u," // pvp_kills
"%u," // pvp_deaths
"%u," // pvp_current_points
"%u," // pvp_career_points
"%u," // pvp_best_kill_streak
"%u," // pvp_worst_death_streak
"%u," // pvp_current_kill_streak
"%u," // aa_points_spent
"%u," // aa_exp
"%u," // aa_points
"%u," // group_auto_consent
"%u," // raid_auto_consent
"%u," // guild_auto_consent
"%u," // RestTimer
"%u," // First Logon - References online status for EVENT_CONNECT/EVENT_DISCONNECt
"%u," // Looking for Group
@@ -1198,8 +1201,8 @@ bool Database::CheckDatabaseConvertPPDeblob(){
")",
character_id,
account_id,
EscapeString(pp->name).c_str(),
EscapeString(pp->last_name).c_str(),
Strings::Escape(pp->name).c_str(),
Strings::Escape(pp->last_name).c_str(),
pp->gender,
pp->race,
pp->class_,
@@ -1223,8 +1226,8 @@ bool Database::CheckDatabaseConvertPPDeblob(){
pp->ability_number,
pp->ability_time_minutes,
pp->ability_time_hours,
EscapeString(pp->title).c_str(),
EscapeString(pp->suffix).c_str(),
Strings::Escape(pp->title).c_str(),
Strings::Escape(pp->suffix).c_str(),
pp->exp,
pp->points,
pp->mana,
@@ -1320,18 +1323,18 @@ bool Database::CheckDatabaseConvertPPDeblob(){
if (rquery != ""){ results = QueryDatabase(rquery); }
/* Run Bind Home Convert */
if (pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
if (pp->binds[4].zone_id < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 1)",
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
if (rquery != ""){ results = QueryDatabase(rquery); }
}
/* Run Bind Convert */
if (pp->binds[0].zoneId < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
if (pp->binds[0].zone_id < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 0)",
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
if (rquery != ""){ results = QueryDatabase(rquery); }
}
/* Run Language Convert */
@@ -1396,7 +1399,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
if (rquery != ""){ results = QueryDatabase(rquery); }
/* Run Material Color Convert */
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 (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);
@@ -1452,7 +1455,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){
if (pp->leader_abilities.ranks[i] > 0 && pp->leader_abilities.ranks[i] < 6){
if (first_entry != 1){
rquery = StringFormat("REPLACE INTO `character_leadership_abilities` (id, slot, rank) VALUES (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
rquery = StringFormat("REPLACE INTO `character_leadership_abilities` (id, slot, `rank`) VALUES (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
first_entry = 1;
}
rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
+121 -91
View File
@@ -18,8 +18,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/global_define.h"
#include "../common/rulesys.h"
#include "../common/string_util.h"
#include "../common/strings.h"
#include "../common/timer.h"
#include "../common/repositories/dynamic_zone_members_repository.h"
#include "../common/repositories/dynamic_zones_repository.h"
#include "database.h"
@@ -34,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define strcasecmp _stricmp
#else
#include "unix.h"
#include "../zone/zonedb.h"
#include <netinet/in.h>
#include <sys/time.h>
#endif
@@ -97,42 +100,53 @@ bool Database::CheckInstanceExists(uint16 instance_id) {
bool Database::CheckInstanceExpired(uint16 instance_id)
{
int32 start_time = 0;
int32 duration = 0;
int32 start_time = 0;
int32 duration = 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);
if (!results.Success())
if (!results.Success()) {
return true;
}
if (results.RowCount() == 0)
if (results.RowCount() == 0) {
return true;
}
auto row = results.begin();
start_time = atoi(row[0]);
duration = atoi(row[1]);
start_time = atoi(row[0]);
duration = atoi(row[1]);
never_expires = atoi(row[2]);
if (never_expires == 1)
if (never_expires == 1) {
return false;
}
timeval tv;
timeval tv{};
gettimeofday(&tv, nullptr);
if ((start_time + duration) <= tv.tv_sec)
return true;
return (start_time + duration) <= tv.tv_sec;
return false;
}
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)"
" values(%lu, %lu, %lu, UNIX_TIMESTAMP(), %lu)",
(unsigned long)instance_id, (unsigned long)zone_id, (unsigned long)version, (unsigned long)duration);
std::string query = StringFormat(
"INSERT INTO instance_list (id, zone, version, start_time, duration)"
" values (%u, %u, %u, UNIX_TIMESTAMP(), %u)",
instance_id,
zone_id,
version,
duration
);
auto results = QueryDatabase(query);
return results.Success();
@@ -140,66 +154,84 @@ bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version
bool Database::GetUnusedInstanceID(uint16 &instance_id)
{
uint32 count = RuleI(Zone, ReservedInstances);
uint32 max = 65535;
uint32 max_reserved_instance_id = RuleI(Instances, ReservedInstances);
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);
if (!results.Success())
{
if (!results.Success()) {
instance_id = 0;
return false;
}
if (results.RowCount() == 0)
{
instance_id = 0;
return false;
if (results.RowCount() == 0) {
instance_id = max_reserved_instance_id;
return true;
}
auto row = results.begin();
if (atoi(row[0]) <= max)
{
if (atoi(row[0]) <= max) {
instance_id = atoi(row[0]);
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);
if (!results.Success())
{
if (!results.Success()) {
instance_id = 0;
return false;
}
if (results.RowCount() == 0)
{
if (results.RowCount() == 0) {
instance_id = 0;
return false;
}
count++;
for (auto row = results.begin(); row != results.end(); ++row)
{
if (count < atoi(row[0]))
{
instance_id = count;
max_reserved_instance_id++;
for (auto row = results.begin(); row != results.end(); ++row) {
if (max_reserved_instance_id < atoi(row[0])) {
instance_id = max_reserved_instance_id;
return true;
}
if (count > max)
{
if (max_reserved_instance_id > max) {
instance_id = 0;
return false;
}
count++;
max_reserved_instance_id++;
}
instance_id = count;
instance_id = max_reserved_instance_id;
return true;
}
@@ -276,36 +308,6 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
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)
{
if (!zone)
@@ -472,22 +474,17 @@ void Database::AssignRaidToInstance(uint32 raid_id, uint32 instance_id)
}
void Database::BuryCorpsesInInstance(uint16 instance_id) {
std::string query = StringFormat(
"UPDATE `character_corpses` "
"SET `is_buried` = 1, "
"`instance_id` = 0 "
"WHERE "
"`instance_id` = %u ",
instance_id
);
auto results = QueryDatabase(query);
QueryDatabase(
fmt::format(
"UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id = {}",
instance_id
)
);
}
void Database::DeleteInstance(uint16 instance_id)
{
std::string query = StringFormat("DELETE FROM instance_list WHERE id=%u", instance_id);
QueryDatabase(query);
std::string query;
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
QueryDatabase(query);
@@ -498,6 +495,9 @@ void Database::DeleteInstance(uint16 instance_id)
query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id);
QueryDatabase(query);
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
BuryCorpsesInInstance(instance_id);
}
@@ -509,7 +509,7 @@ void Database::FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 char
char ln[128];
memset(ln, 0, 128);
strcpy(ln, GetGroupLeadershipInfo(gid, ln));
GetGroupLeadershipInfo(gid, ln);
uint32 l_charid = GetCharacterID((const char*)ln);
uint16 l_id = GetInstanceID(zone, l_charid, version);
@@ -548,17 +548,47 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list<uint32> &ch
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);
if (!results.Success())
if (!results.Success()) {
return;
}
if (results.RowCount() == 0)
if (results.RowCount() == 0) {
return;
}
for (auto row = results.begin(); row != results.end(); ++row)
DeleteInstance(atoi(row[0]));
std::vector<std::string> instance_ids;
for (auto row = results.begin(); row != results.end(); ++row) {
instance_ids.emplace_back(row[0]);
}
std::string imploded_instance_ids = Strings::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));
DynamicZoneMembersRepository::DeleteByManyInstances(*this, imploded_instance_ids);
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
}
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
@@ -566,4 +596,4 @@ void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
std::string query = StringFormat("UPDATE `instance_list` SET start_time=UNIX_TIMESTAMP(), "
"duration=%u WHERE id=%u", new_duration, instance_id);
auto results = QueryDatabase(query);
}
}
+169 -48
View File
@@ -22,17 +22,81 @@
#define EQEMU_DATABASE_SCHEMA_H
#include <vector>
#include <map>
namespace DatabaseSchema {
/**
* Gets player tables
* 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_exp_modifiers", "character_id"},
{"character_inspect_messages", "id"},
{"character_instance_safereturns", "character_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_peqzone_flags", "id"},
{"character_potionbelt", "id"},
{"character_skills", "id"},
{"character_spells", "id"},
{"character_task_timers", "character_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"},
{"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()
{
std::vector<std::string> tables = {
return {
"account",
"account_ip",
"account_flags",
@@ -54,7 +118,10 @@ namespace DatabaseSchema {
"character_data",
"character_disciplines",
"character_enabledtasks",
"character_expedition_lockouts",
"character_exp_modifiers",
"character_inspect_messages",
"character_instance_safereturns",
"character_item_recast",
"character_languages",
"character_leadership_abilities",
@@ -63,13 +130,16 @@ namespace DatabaseSchema {
"character_pet_buffs",
"character_pet_info",
"character_pet_inventory",
"character_peqzone_flags",
"character_potionbelt",
"character_skills",
"character_spells",
"character_task_timers",
"character_tasks",
"character_tribute",
"completed_tasks",
"data_buckets",
"discovered_items",
"faction_values",
"friends",
"guild_bank",
@@ -82,17 +152,17 @@ namespace DatabaseSchema {
"inventory_snapshots",
"keyring",
"mail",
"petitions",
"player_titlesets",
"quest_globals",
"sharedbank",
"spell_buckets",
"spell_globals",
"timers",
"titles",
"trader",
"trader_audit",
"zone_flags"
};
return tables;
}
/**
@@ -102,18 +172,14 @@ namespace DatabaseSchema {
*/
static std::vector<std::string> GetContentTables()
{
std::vector<std::string> tables = {
return {
"aa_ability",
"aa_actions",
"aa_effects",
"aa_rank_effects",
"aa_rank_prereqs",
"aa_ranks",
"aa_required_level_cost",
"adventure_template",
"adventure_template_entry",
"adventure_template_entry_flavor",
"altadv_vars",
"alternate_currency",
"auras",
"base_data",
@@ -121,23 +187,21 @@ namespace DatabaseSchema {
"books",
"char_create_combinations",
"char_create_point_allocations",
"class_skill",
"damageshieldtypes",
"doors",
"dynamic_zone_templates",
"faction_association",
"faction_base_data",
"faction_list",
"faction_list_mod",
"fear_hints",
"fishing",
"forage",
"global_loot",
"goallists",
"graveyard",
"grid",
"grid_entries",
"ground_spawns",
"horses",
"instance_list",
"items",
"ldon_trap_entries",
"ldon_trap_templates",
@@ -155,19 +219,15 @@ namespace DatabaseSchema {
"npc_spells_effects_entries",
"npc_spells_entries",
"npc_types",
"npc_types_metadata",
"npc_types_tint",
"object",
"pets",
"pets_beastlord_data",
"pets_equipmentset",
"pets_equipmentset_entries",
"proximities",
"races",
"skill_caps",
"spawn2",
"spawn_condition_values",
"spawn_conditions",
"spawn_events",
"spawnentry",
"spawngroup",
"spells_new",
@@ -176,7 +236,6 @@ namespace DatabaseSchema {
"task_activities",
"tasks",
"tasksets",
"titles",
"tradeskill_recipe",
"tradeskill_recipe_entries",
"traps",
@@ -185,11 +244,7 @@ namespace DatabaseSchema {
"veteran_reward_templates",
"zone",
"zone_points",
"zone_server",
"zoneserver_auth",
};
return tables;
}
/**
@@ -199,34 +254,52 @@ namespace DatabaseSchema {
*/
static std::vector<std::string> GetServerTables()
{
std::vector<std::string> tables = {
"banned_ips",
"bugs",
"bug_reports",
return {
"chatchannels",
"command_settings",
"content_flags",
"db_str",
"discovered_items",
"eqtime",
"eventlog",
"gm_ips",
"hackers",
"ip_exemptions",
"launcher",
"launcher_zones",
"spawn_condition_values",
"spawn_events",
"level_exp_mods",
"logsys_categories",
"name_filter",
"perl_event_export_settings",
"petitions",
"profanity_list",
"reports",
"rule_sets",
"titles",
"rule_values",
"saylink",
"variables",
};
}
return tables;
/**
* 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",
};
}
/**
@@ -237,11 +310,26 @@ namespace DatabaseSchema {
*/
static std::vector<std::string> GetStateTables()
{
std::vector<std::string> tables = {
return {
"adventure_members",
"chatchannels",
"banned_ips",
"bug_reports",
"bugs",
"completed_shared_task_activity_state",
"completed_shared_task_members",
"completed_shared_tasks",
"discord_webhooks",
"dynamic_zone_members",
"dynamic_zones",
"eventlog",
"expedition_lockouts",
"expeditions",
"gm_ips",
"group_id",
"group_leaders",
"hackers",
"instance_list",
"ip_exemptions",
"item_tick",
"lfguild",
"merchantlist_temp",
@@ -249,12 +337,15 @@ namespace DatabaseSchema {
"raid_details",
"raid_leaders",
"raid_members",
"reports",
"respawn_times",
"spell_buckets",
"spell_globals",
"saylink",
"server_scheduled_events",
"shared_task_activity_state",
"shared_task_dynamic_zones",
"shared_task_members",
"shared_tasks",
};
return tables;
}
/**
@@ -264,15 +355,13 @@ namespace DatabaseSchema {
*/
static std::vector<std::string> GetLoginTables()
{
std::vector<std::string> tables = {
return {
"login_accounts",
"login_api_tokens",
"login_server_admins",
"login_server_list_types",
"login_world_servers",
};
return tables;
}
/**
@@ -282,12 +371,44 @@ namespace DatabaseSchema {
*/
static std::vector<std::string> GetVersionTables()
{
std::vector<std::string> tables = {
return {
"db_version",
"inventory_versions",
};
}
return tables;
/**
* @description Gets all player bot tables
* @note These tables have no content in the PEQ daily dump
*
* @return
*/
static std::vector<std::string> GetBotTables()
{
return {
"bot_buffs",
"bot_command_settings",
"bot_create_combinations",
"bot_data",
"bot_group_members",
"bot_groups",
"bot_guild_members",
"bot_heal_rotation_members",
"bot_heal_rotation_targets",
"bot_heal_rotations",
"bot_inspect_messages",
"bot_inventories",
"bot_owner_options",
"bot_pet_buffs",
"bot_pet_inventories",
"bot_pets",
"bot_spell_casting_chances",
"bot_spells_entries",
"bot_stances",
"bot_timers",
"vw_bot_character_mobs",
"vw_bot_groups"
};
}
}
+58 -26
View File
@@ -35,17 +35,31 @@
DBcore::DBcore()
{
mysql_init(&mysql);
pHost = 0;
pUser = 0;
pPassword = 0;
pDatabase = 0;
pCompress = false;
pSSL = false;
pStatus = Closed;
pHost = nullptr;
pUser = nullptr;
pPassword = nullptr;
pDatabase = nullptr;
pCompress = false;
pSSL = false;
pStatus = Closed;
}
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);
safe_delete_array(pHost);
safe_delete_array(pUser);
@@ -69,6 +83,13 @@ MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureO
return QueryDatabase(query.c_str(), query.length(), 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;
@@ -81,6 +102,8 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
Open();
}
// request query. != 0 indicates some kind of error.
if (mysql_real_query(&mysql, query, querylen) != 0) {
unsigned int errorNumber = mysql_errno(&mysql);
@@ -115,14 +138,14 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
/* Implement Logging at the Root */
/**
* Error logging
*/
if (mysql_errno(&mysql) > 0 && strlen(query) > 0) {
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);
LogMySQLError("[{}] [{}]\n[{}]", mysql_errno(&mysql), mysql_error(&mysql), query);
}
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql), errorBuffer);
}
// successful query. get results.
@@ -143,10 +166,8 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
if ((strncasecmp(query, "select", 6) == 0)) {
LogF(
Logs::General,
Logs::MySQLQuery,
"{0} ({1} row{2} returned) ({3}s)",
LogMySQLQuery(
"{0}; -- ({1} row{2} returned) ({3}s)",
query,
requestResult.RowCount(),
requestResult.RowCount() == 1 ? "" : "s",
@@ -154,10 +175,8 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
);
}
else {
LogF(
Logs::General,
Logs::MySQLQuery,
"{0} ({1} row{2} affected) ({3}s)",
LogMySQLQuery(
"{0}; -- ({1} row{2} affected) ({3}s)",
query,
requestResult.RowsAffected(),
requestResult.RowsAffected() == 1 ? "" : "s",
@@ -204,10 +223,10 @@ bool DBcore::Open(
)
{
LockMutex lock(&MDatabase);
safe_delete(pHost);
safe_delete(pUser);
safe_delete(pPassword);
safe_delete(pDatabase);
safe_delete_array(pHost);
safe_delete_array(pUser);
safe_delete_array(pPassword);
safe_delete_array(pDatabase);
pHost = strcpy(new char[strlen(iHost) + 1], iHost);
pUser = strcpy(new char[strlen(iUser) + 1], iUser);
pPassword = strcpy(new char[strlen(iPassword) + 1], iPassword);
@@ -248,6 +267,10 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
}
if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
pStatus = Connected;
std::string connected_origin_host = pHost;
SetOriginHost(connected_origin_host);
return true;
}
else {
@@ -262,8 +285,17 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
}
}
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;
}
+42 -21
View File
@@ -2,8 +2,8 @@
#define DBCORE_H
#ifdef _WINDOWS
#include <winsock2.h>
#include <windows.h>
#include <winsock2.h>
#include <windows.h>
#endif
#include "../common/mutex.h"
@@ -15,36 +15,57 @@
class DBcore {
public:
enum eStatus { Closed, Connected, Error };
enum eStatus {
Closed, Connected, Error
};
DBcore();
~DBcore();
eStatus GetStatus() { return pStatus; }
MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true);
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
eStatus GetStatus() { return pStatus; }
MySQLRequestResult QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce = true);
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
void TransactionBegin();
void TransactionCommit();
void TransactionRollback();
uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen);
void ping();
MYSQL* getMySQL(){ return &mysql; }
uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
void ping();
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:
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:
bool Open(uint32* errnum = 0, char* errbuf = 0);
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
);
MYSQL mysql;
Mutex MDatabase;
private:
bool Open(uint32 *errnum = nullptr, char *errbuf = nullptr);
MYSQL mysql;
Mutex MDatabase;
eStatus pStatus;
char* pHost;
char* pUser;
char* pPassword;
char* pDatabase;
bool pCompress;
uint32 pPort;
bool pSSL;
std::string origin_host;
char *pHost;
char *pUser;
char *pPassword;
char *pDatabase;
bool pCompress;
uint32 pPort;
bool pSSL;
};
+3 -3
View File
@@ -20,7 +20,7 @@
#include "deity.h"
EQEmu::deity::DeityTypeBit EQEmu::deity::ConvertDeityTypeToDeityTypeBit(DeityType deity_type)
EQ::deity::DeityTypeBit EQ::deity::ConvertDeityTypeToDeityTypeBit(DeityType deity_type)
{
switch (deity_type) {
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) {
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) {
case DeityBertoxxulous:
+1 -1
View File
@@ -23,7 +23,7 @@
#include "types.h"
namespace EQEmu
namespace EQ
{
namespace deity {
enum DeityType {
+91
View File
@@ -0,0 +1,91 @@
#include "discord.h"
#include "../http/httplib.h"
#include "../json/json.h"
#include "../strings.h"
#include "../eqemu_logsys.h"
constexpr int MAX_RETRIES = 10;
void Discord::SendWebhookMessage(const std::string &message, const std::string &webhook_url)
{
// validate
if (webhook_url.empty()) {
LogDiscord("[webhook_url] is empty");
return;
}
// validate
if (webhook_url.find("http://") == std::string::npos && webhook_url.find("https://") == std::string::npos) {
LogDiscord("[webhook_url] [{}] does not contain a valid http/s prefix.", webhook_url);
return;
}
// split
auto s = Strings::Split(webhook_url, '/');
// url
std::string base_url = fmt::format("{}//{}", s[0], s[2]);
std::string endpoint = Strings::Replace(webhook_url, base_url, "");
// client
httplib::Client cli(base_url.c_str());
cli.set_connection_timeout(0, 15000000); // 15 sec
cli.set_read_timeout(15, 0); // 15 seconds
cli.set_write_timeout(15, 0); // 15 seconds
httplib::Headers headers = {
{"Content-Type", "application/json"}
};
// payload
Json::Value p;
p["content"] = message;
std::stringstream payload;
payload << p;
bool retry = true;
int retries = 0;
int retry_timer = 1000;
while (retry) {
if (auto res = cli.Post(endpoint.c_str(), payload.str(), "application/json")) {
if (res->status != 200 && res->status != 204) {
LogError("[Discord Client] Code [{}] Error [{}]", res->status, res->body);
}
if (res->status == 429) {
if (!res->body.empty()) {
std::stringstream ss(res->body);
Json::Value response;
try {
ss >> response;
}
catch (std::exception const &ex) {
LogDiscord("JSON serialization failure [{}] via [{}]", ex.what(), res->body);
}
retry_timer = std::stoi(response["retry_after"].asString()) + 500;
}
LogDiscord("Rate limited... retrying message in [{}ms]", retry_timer);
std::this_thread::sleep_for(std::chrono::milliseconds(retry_timer + 500));
}
if (res->status == 204) {
retry = false;
}
if (retries > MAX_RETRIES) {
LogDiscord("Retries exceeded for message [{}]", message);
retry = false;
}
retries++;
}
}
}
std::string Discord::FormatDiscordMessage(uint16 category_id, const std::string &message)
{
if (category_id == Logs::LogCategory::MySQLQuery) {
return fmt::format("```sql\n{}\n```", message);
}
return message + "\n";
}
+15
View File
@@ -0,0 +1,15 @@
#ifndef EQEMU_DISCORD_H
#define EQEMU_DISCORD_H
#include <string>
#include "../types.h"
class Discord {
public:
static void SendWebhookMessage(const std::string& message, const std::string& webhook_url);
static std::string FormatDiscordMessage(uint16 category_id, const std::string& message);
};
#endif //EQEMU_DISCORD_H
+69
View File
@@ -0,0 +1,69 @@
#include "discord_manager.h"
#include "../common/discord/discord.h"
#include "../common/eqemu_logsys.h"
#include "../common/strings.h"
void DiscordManager::QueueWebhookMessage(uint32 webhook_id, const std::string &message)
{
webhook_queue_lock.lock();
webhook_message_queue[webhook_id].emplace_back(message);
webhook_queue_lock.unlock();
}
constexpr int MAX_MESSAGE_LENGTH = 1900;
void DiscordManager::ProcessMessageQueue()
{
if (webhook_message_queue.empty()) {
return;
}
webhook_queue_lock.lock();
for (auto &q: webhook_message_queue) {
LogDiscord("Processing [{}] messages in queue for webhook ID [{}]...", q.second.size(), q.first);
if (q.first >= MAX_DISCORD_WEBHOOK_ID) {
LogDiscord("Out of bounds webhook ID [{}] max [{}]", q.first, MAX_DISCORD_WEBHOOK_ID);
continue;
}
auto webhook = LogSys.GetDiscordWebhooks()[q.first];
std::string message;
for (auto &m: q.second) {
// next message would become too large
bool next_message_too_large = ((int) m.length() + (int) message.length()) > MAX_MESSAGE_LENGTH;
if (next_message_too_large) {
Discord::SendWebhookMessage(
message,
webhook.webhook_url
);
message = "";
}
message += m;
// one single message was too large
// this should rarely happen but the message will need to be split
if ((int) message.length() > MAX_MESSAGE_LENGTH) {
for (unsigned mi = 0; mi < message.length(); mi += MAX_MESSAGE_LENGTH) {
Discord::SendWebhookMessage(
message.substr(mi, MAX_MESSAGE_LENGTH),
webhook.webhook_url
);
}
message = "";
}
}
// final flush
if (!message.empty()) {
Discord::SendWebhookMessage(
message,
webhook.webhook_url
);
}
}
webhook_message_queue.clear();
webhook_queue_lock.unlock();
}
+19
View File
@@ -0,0 +1,19 @@
#ifndef EQEMU_DISCORD_MANAGER_H
#define EQEMU_DISCORD_MANAGER_H
#include <mutex>
#include <map>
#include <vector>
#include "../common/types.h"
class DiscordManager {
public:
void QueueWebhookMessage(uint32 webhook_id, const std::string& message);
void ProcessMessageQueue();
private:
std::mutex webhook_queue_lock{};
std::map<uint32, std::vector<std::string>> webhook_message_queue{};
};
#endif
+649
View File
@@ -0,0 +1,649 @@
#include "dynamic_zone_base.h"
#include "database.h"
#include "eqemu_logsys.h"
#include "repositories/instance_list_repository.h"
#include "repositories/instance_list_player_repository.h"
#include "rulesys.h"
#include "servertalk.h"
#include "util/uuid.h"
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
{
LoadRepositoryResult(std::move(entry));
}
uint32_t DynamicZoneBase::Create()
{
if (GetInstanceID() == 0)
{
CreateInstance();
}
m_uuid = EQ::Util::UUID::Generate().ToString();
m_id = SaveToDatabase();
return m_id;
}
uint32_t DynamicZoneBase::CreateInstance()
{
if (m_instance_id)
{
LogDynamicZones("CreateInstance failed, instance id [{}] already created", m_instance_id);
return 0;
}
if (!m_zone_id)
{
LogDynamicZones("CreateInstance failed, invalid zone id [{}]", m_zone_id);
return 0;
}
uint16_t unused_instance_id = 0;
if (!GetDatabase().GetUnusedInstanceID(unused_instance_id)) // todo: doesn't this race with insert?
{
LogDynamicZones("Failed to find unused instance id");
return 0;
}
m_start_time = std::chrono::system_clock::now();
m_expire_time = m_start_time + m_duration;
auto insert_instance = InstanceListRepository::NewEntity();
insert_instance.id = unused_instance_id;
insert_instance.zone = m_zone_id;
insert_instance.version = m_zone_version;
insert_instance.start_time = static_cast<int>(std::chrono::system_clock::to_time_t(m_start_time));
insert_instance.duration = static_cast<int>(m_duration.count());
insert_instance.never_expires = m_never_expires;
auto instance = InstanceListRepository::InsertOne(GetDatabase(), insert_instance);
if (instance.id == 0)
{
LogDynamicZones("Failed to create instance [{}] for zone [{}]", unused_instance_id, m_zone_id);
return 0;
}
m_instance_id = instance.id;
return m_instance_id;
}
void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry)
{
m_id = dz_entry.id;
m_uuid = std::move(dz_entry.uuid);
m_name = std::move(dz_entry.name);
m_leader.id = dz_entry.leader_id;
m_min_players = dz_entry.min_players;
m_max_players = dz_entry.max_players;
m_instance_id = dz_entry.instance_id;
m_type = static_cast<DynamicZoneType>(dz_entry.type);
m_dz_switch_id = dz_entry.dz_switch_id;
m_compass.zone_id = dz_entry.compass_zone_id;
m_compass.x = dz_entry.compass_x;
m_compass.y = dz_entry.compass_y;
m_compass.z = dz_entry.compass_z;
m_safereturn.zone_id = dz_entry.safe_return_zone_id;
m_safereturn.x = dz_entry.safe_return_x;
m_safereturn.y = dz_entry.safe_return_y;
m_safereturn.z = dz_entry.safe_return_z;
m_safereturn.heading = dz_entry.safe_return_heading;
m_zonein.x = dz_entry.zone_in_x;
m_zonein.y = dz_entry.zone_in_y;
m_zonein.z = dz_entry.zone_in_z;
m_zonein.heading = dz_entry.zone_in_heading;
m_has_zonein = (dz_entry.has_zone_in != 0);
// instance_list portion
m_zone_id = dz_entry.zone;
m_zone_version = dz_entry.version;
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
m_duration = std::chrono::seconds(dz_entry.duration);
m_never_expires = (dz_entry.never_expires != 0);
m_expire_time = m_start_time + m_duration;
}
void DynamicZoneBase::AddMemberFromRepositoryResult(
DynamicZoneMembersRepository::MemberWithName&& entry)
{
auto status = DynamicZoneMemberStatus::Unknown;
if (m_leader.id == entry.character_id)
{
m_leader.name = entry.character_name;
}
AddInternalMember({ entry.character_id, std::move(entry.character_name), status });
}
uint32_t DynamicZoneBase::SaveToDatabase()
{
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
if (m_instance_id != 0)
{
auto insert_dz = DynamicZonesRepository::NewEntity();
insert_dz.uuid = m_uuid;
insert_dz.name = m_name;
insert_dz.leader_id = m_leader.id;
insert_dz.min_players = m_min_players;
insert_dz.max_players = m_max_players;
insert_dz.instance_id = m_instance_id,
insert_dz.type = static_cast<int>(m_type);
insert_dz.dz_switch_id = m_dz_switch_id;
insert_dz.compass_zone_id = m_compass.zone_id;
insert_dz.compass_x = m_compass.x;
insert_dz.compass_y = m_compass.y;
insert_dz.compass_z = m_compass.z;
insert_dz.safe_return_zone_id = m_safereturn.zone_id;
insert_dz.safe_return_x = m_safereturn.x;
insert_dz.safe_return_y = m_safereturn.y;
insert_dz.safe_return_z = m_safereturn.z;
insert_dz.safe_return_heading = m_safereturn.heading;
insert_dz.zone_in_x = m_zonein.x;
insert_dz.zone_in_y = m_zonein.y;
insert_dz.zone_in_z = m_zonein.z;
insert_dz.zone_in_heading = m_zonein.heading;
insert_dz.has_zone_in = m_has_zonein;
auto inserted_dz = DynamicZonesRepository::InsertOne(GetDatabase(), insert_dz);
return inserted_dz.id;
}
return 0;
}
bool DynamicZoneBase::AddMember(const DynamicZoneMember& add_member)
{
if (HasMember(add_member.id))
{
return false;
}
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, add_member.id);
GetDatabase().AddClientToInstance(m_instance_id, add_member.id);
ProcessMemberAddRemove(add_member, false);
SendServerPacket(CreateServerMemberAddRemovePacket(add_member, false).get());
return true;
}
bool DynamicZoneBase::RemoveMember(uint32_t character_id)
{
auto remove_member = GetMemberData(character_id);
return RemoveMember(remove_member);
}
bool DynamicZoneBase::RemoveMember(const std::string& character_name)
{
auto remove_member = GetMemberData(character_name);
return RemoveMember(remove_member);
}
bool DynamicZoneBase::RemoveMember(const DynamicZoneMember& remove_member)
{
if (remove_member.id == 0)
{
return false;
}
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, remove_member.id);
GetDatabase().RemoveClientFromInstance(m_instance_id, remove_member.id);
ProcessMemberAddRemove(remove_member, true);
SendServerPacket(CreateServerMemberAddRemovePacket(remove_member, true).get());
return true;
}
bool DynamicZoneBase::SwapMember(
const DynamicZoneMember& add_member, const std::string& remove_char_name)
{
auto remove_member = GetMemberData(remove_char_name);
if (!add_member.IsValid() || !remove_member.IsValid())
{
return false;
}
// make remove and add atomic to avoid racing with separate world messages
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, remove_member.id);
GetDatabase().RemoveClientFromInstance(m_instance_id, remove_member.id);
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, add_member.id);
GetDatabase().AddClientToInstance(m_instance_id, add_member.id);
ProcessMemberAddRemove(remove_member, true);
ProcessMemberAddRemove(add_member, false);
SendServerPacket(CreateServerMemberSwapPacket(remove_member, add_member).get());
return true;
}
void DynamicZoneBase::RemoveAllMembers()
{
DynamicZoneMembersRepository::RemoveAllMembers(GetDatabase(), m_id);
GetDatabase().RemoveClientsFromInstance(GetInstanceID());
ProcessRemoveAllMembers();
SendServerPacket(CreateServerRemoveAllMembersPacket().get());
}
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
{
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
m_members = members;
// the lower level instance_list_players needs to be kept updated as well
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
std::vector<InstanceListPlayerRepository::InstanceListPlayer> insert_players;
for (const auto& member : m_members)
{
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
member_entry.dynamic_zone_id = m_id;
member_entry.character_id = member.id;
insert_members.emplace_back(member_entry);
InstanceListPlayerRepository::InstanceListPlayer player_entry;
player_entry.id = static_cast<int>(m_instance_id);
player_entry.charid = static_cast<int>(member.id);
insert_players.emplace_back(player_entry);
}
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
InstanceListPlayerRepository::InsertOrUpdateMany(GetDatabase(), insert_players);
}
void DynamicZoneBase::SetCompass(const DynamicZoneLocation& location, bool update_db)
{
ProcessCompassChange(location);
if (update_db)
{
LogDynamicZonesDetail("Saving [{}] compass zone: [{}] xyz: ([{}], [{}], [{}])",
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
DynamicZonesRepository::UpdateCompass(GetDatabase(),
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
SendServerPacket(CreateServerDzLocationPacket(ServerOP_DzSetCompass, location).get());
}
}
void DynamicZoneBase::SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db)
{
SetCompass({ zone_id, x, y, z, 0.0f }, update_db);
}
void DynamicZoneBase::SetSafeReturn(const DynamicZoneLocation& location, bool update_db)
{
m_safereturn = location;
if (update_db)
{
LogDynamicZonesDetail("Saving [{}] safereturn zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
m_id, m_safereturn.zone_id, m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
DynamicZonesRepository::UpdateSafeReturn(GetDatabase(), m_id, m_safereturn.zone_id,
m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
SendServerPacket(CreateServerDzLocationPacket(ServerOP_DzSetSafeReturn, location).get());
}
}
void DynamicZoneBase::SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db)
{
SetSafeReturn({ zone_id, x, y, z, heading }, update_db);
}
void DynamicZoneBase::SetZoneInLocation(const DynamicZoneLocation& location, bool update_db)
{
m_zonein = location;
m_has_zonein = true;
if (update_db)
{
LogDynamicZonesDetail("Saving [{}] zonein zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
m_id, m_zone_id, m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading);
DynamicZonesRepository::UpdateZoneIn(GetDatabase(), m_id, m_zone_id,
m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading, m_has_zonein);
SendServerPacket(CreateServerDzLocationPacket(ServerOP_DzSetZoneIn, location).get());
}
}
void DynamicZoneBase::SetZoneInLocation(float x, float y, float z, float heading, bool update_db)
{
SetZoneInLocation({ 0, x, y, z, heading }, update_db);
}
void DynamicZoneBase::SetSwitchID(int dz_switch_id, bool update_db)
{
m_dz_switch_id = dz_switch_id;
if (update_db)
{
DynamicZonesRepository::UpdateSwitchID(GetDatabase(), m_id, dz_switch_id);
SendServerPacket(CreateServerDzSwitchIDPacket().get());
}
}
void DynamicZoneBase::SetLeader(const DynamicZoneMember& new_leader, bool update_db)
{
m_leader = new_leader;
if (update_db)
{
DynamicZonesRepository::UpdateLeaderID(GetDatabase(), m_id, new_leader.id);
}
}
uint32_t DynamicZoneBase::GetSecondsRemaining() const
{
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
return std::max(0, static_cast<int>(remaining));
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberAddRemovePacket(
const DynamicZoneMember& member, bool removed)
{
constexpr uint32_t pack_size = sizeof(ServerDzMember_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzAddRemoveMember, pack_size);
auto buf = reinterpret_cast<ServerDzMember_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->dz_zone_id = GetZoneID();
buf->dz_instance_id = GetInstanceID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
buf->removed = removed;
buf->character_id = member.id;
buf->character_status = static_cast<uint8_t>(member.status);
strn0cpy(buf->character_name, member.name.c_str(), sizeof(buf->character_name));
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberSwapPacket(
const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member)
{
constexpr uint32_t pack_size = sizeof(ServerDzMemberSwap_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzSwapMembers, pack_size);
auto buf = reinterpret_cast<ServerDzMemberSwap_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->dz_zone_id = GetZoneID();
buf->dz_instance_id = GetInstanceID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
buf->add_character_status = static_cast<uint8_t>(add_member.status);
buf->add_character_id = add_member.id;
buf->remove_character_id = remove_member.id;
strn0cpy(buf->add_character_name, add_member.name.c_str(), sizeof(buf->add_character_name));
strn0cpy(buf->remove_character_name, remove_member.name.c_str(), sizeof(buf->remove_character_name));
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerRemoveAllMembersPacket()
{
constexpr uint32_t pack_size = sizeof(ServerDzID_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzRemoveAllMembers, pack_size);
auto buf = reinterpret_cast<ServerDzID_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->dz_zone_id = GetZoneID();
buf->dz_instance_id = GetInstanceID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzLocationPacket(
uint16_t server_opcode, const DynamicZoneLocation& location)
{
constexpr uint32_t pack_size = sizeof(ServerDzLocation_Struct);
auto pack = std::make_unique<ServerPacket>(server_opcode, pack_size);
auto buf = reinterpret_cast<ServerDzLocation_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
buf->zone_id = location.zone_id;
buf->x = location.x;
buf->y = location.y;
buf->z = location.z;
buf->heading = location.heading;
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzSwitchIDPacket()
{
constexpr uint32_t pack_size = sizeof(ServerDzSwitchID_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzSetSwitchID, pack_size);
auto buf = reinterpret_cast<ServerDzSwitchID_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->dz_switch_id = GetSwitchID();
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberStatusPacket(
uint32_t character_id, DynamicZoneMemberStatus status)
{
constexpr uint32_t pack_size = sizeof(ServerDzMemberStatus_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzUpdateMemberStatus, pack_size);
auto buf = reinterpret_cast<ServerDzMemberStatus_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
buf->status = static_cast<uint8_t>(status);
buf->character_id = character_id;
return pack;
}
uint32_t DynamicZoneBase::GetDatabaseMemberCount()
{
return DynamicZoneMembersRepository::GetCountWhere(GetDatabase(),
fmt::format("dynamic_zone_id = {}", m_id));
}
bool DynamicZoneBase::HasDatabaseMember(uint32_t character_id)
{
if (character_id == 0)
{
return false;
}
auto entries = DynamicZoneMembersRepository::GetWhere(GetDatabase(), fmt::format(
"dynamic_zone_id = {} AND character_id = {}",
m_id, character_id
));
return entries.size() != 0;
}
void DynamicZoneBase::AddInternalMember(const DynamicZoneMember& member)
{
if (!HasMember(member.id))
{
m_members.emplace_back(member);
}
}
void DynamicZoneBase::RemoveInternalMember(uint32_t character_id)
{
m_members.erase(std::remove_if(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) { return member.id == character_id; }
), m_members.end());
}
bool DynamicZoneBase::HasMember(uint32_t character_id)
{
return std::any_of(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) { return member.id == character_id; });
}
bool DynamicZoneBase::HasMember(const std::string& character_name)
{
return std::any_of(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) {
return strcasecmp(member.name.c_str(), character_name.c_str()) == 0;
});
}
DynamicZoneMember DynamicZoneBase::GetMemberData(uint32_t character_id)
{
auto it = std::find_if(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) { return member.id == character_id; });
DynamicZoneMember member_data;
if (it != m_members.end())
{
member_data = *it;
}
return member_data;
}
DynamicZoneMember DynamicZoneBase::GetMemberData(const std::string& character_name)
{
auto it = std::find_if(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) {
return strcasecmp(member.name.c_str(), character_name.c_str()) == 0;
});
DynamicZoneMember member_data;
if (it != m_members.end())
{
member_data = *it;
}
return member_data;
}
bool DynamicZoneBase::SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status)
{
if (status == DynamicZoneMemberStatus::InDynamicZone && !RuleB(DynamicZone, EnableInDynamicZoneStatus))
{
status = DynamicZoneMemberStatus::Online;
}
if (character_id == m_leader.id)
{
m_leader.status = status;
}
auto it = std::find_if(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) { return member.id == character_id; });
if (it != m_members.end() && it->status != status)
{
it->status = status;
return true;
}
return false;
}
void DynamicZoneBase::SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status)
{
auto update_member = GetMemberData(character_id);
if (update_member.IsValid())
{
ProcessMemberStatusChange(character_id, status);
SendServerPacket(CreateServerMemberStatusPacket(character_id, status).get());
}
}
void DynamicZoneBase::ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed)
{
if (!removed)
{
AddInternalMember(member);
}
else
{
RemoveInternalMember(member.id);
}
}
bool DynamicZoneBase::ProcessMemberStatusChange(uint32_t character_id, DynamicZoneMemberStatus status)
{
return SetInternalMemberStatus(character_id, status);
}
std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
{
switch (dz_type)
{
case DynamicZoneType::Expedition:
return "Expedition";
case DynamicZoneType::Tutorial:
return "Tutorial";
case DynamicZoneType::Task:
return "Task";
case DynamicZoneType::Mission:
return "Mission";
case DynamicZoneType::Quest:
return "Quest";
default:
return "Unknown";
}
}
EQ::Net::DynamicPacket DynamicZoneBase::GetSerializedDzPacket()
{
EQ::Net::DynamicPacket dyn_pack;
dyn_pack.PutSerialize(0, *this);
LogDynamicZonesDetail("Serialized server dz size [{}]", dyn_pack.Length());
return dyn_pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzCreatePacket(
uint16_t origin_zone_id, uint16_t origin_instance_id)
{
EQ::Net::DynamicPacket dyn_pack = GetSerializedDzPacket();
auto pack_size = sizeof(ServerDzCreateSerialized_Struct) + dyn_pack.Length();
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
auto buf = reinterpret_cast<ServerDzCreateSerialized_Struct*>(pack->pBuffer);
buf->origin_zone_id = origin_zone_id;
buf->origin_instance_id = origin_instance_id;
buf->cereal_size = static_cast<uint32_t>(dyn_pack.Length());
memcpy(buf->cereal_data, dyn_pack.Data(), dyn_pack.Length());
return pack;
}
void DynamicZoneBase::LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size)
{
LogDynamicZonesDetail("Deserializing server dz size [{}]", cereal_size);
EQ::Util::MemoryStreamReader ss(cereal_data, cereal_size);
cereal::BinaryInputArchive archive(ss);
archive(*this);
}
void DynamicZoneBase::LoadTemplate(const DynamicZoneTemplatesRepository::DynamicZoneTemplates& dz_template)
{
m_zone_id = dz_template.zone_id;
m_zone_version = dz_template.zone_version;
m_name = dz_template.name;
m_min_players = dz_template.min_players;
m_max_players = dz_template.max_players;
m_duration = std::chrono::seconds(dz_template.duration_seconds);
m_dz_switch_id = dz_template.dz_switch_id;
m_compass.zone_id = dz_template.compass_zone_id;
m_compass.x = dz_template.compass_x;
m_compass.y = dz_template.compass_y;
m_compass.z = dz_template.compass_z;
m_safereturn.zone_id = dz_template.return_zone_id;
m_safereturn.x = dz_template.return_x;
m_safereturn.y = dz_template.return_y;
m_safereturn.z = dz_template.return_z;
m_safereturn.heading = dz_template.return_h;
m_has_zonein = dz_template.override_zone_in;
m_zonein.x = dz_template.zone_in_x;
m_zonein.y = dz_template.zone_in_y;
m_zonein.z = dz_template.zone_in_z;
m_zonein.heading = dz_template.zone_in_h;
}
+220
View File
@@ -0,0 +1,220 @@
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
#define COMMON_DYNAMIC_ZONE_BASE_H
#include "eq_constants.h"
#include "net/packet.h"
#include "repositories/dynamic_zones_repository.h"
#include "repositories/dynamic_zone_members_repository.h"
#include "repositories/dynamic_zone_templates_repository.h"
#include <algorithm>
#include <chrono>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
class Database;
class ServerPacket;
struct DynamicZoneMember
{
uint32_t id = 0;
std::string name;
DynamicZoneMemberStatus status = DynamicZoneMemberStatus::Unknown;
DynamicZoneMember() = default;
DynamicZoneMember(uint32_t id, std::string name_)
: id(id), name{std::move(name_)} {}
DynamicZoneMember(uint32_t id, std::string name_, DynamicZoneMemberStatus status_)
: id(id), name{std::move(name_)}, status(status_) {}
bool IsOnline() const { return status == DynamicZoneMemberStatus::Online ||
status == DynamicZoneMemberStatus::InDynamicZone; }
bool IsValid() const { return id != 0 && !name.empty(); }
template<class Archive>
void serialize(Archive& archive)
{
archive(id, name, status);
}
};
struct DynamicZoneLocation
{
uint32_t zone_id = 0;
float x = 0.0f;
float y = 0.0f;
float z = 0.0f;
float heading = 0.0f;
DynamicZoneLocation() = default;
DynamicZoneLocation(uint32_t zone_id_, float x_, float y_, float z_, float heading_)
: zone_id(zone_id_), x(x_), y(y_), z(z_), heading(heading_) {}
template<class Archive>
void serialize(Archive& archive)
{
archive(zone_id, x, y, z, heading);
}
};
class DynamicZoneBase
{
public:
virtual ~DynamicZoneBase() = default;
DynamicZoneBase(const DynamicZoneBase&) = default;
DynamicZoneBase(DynamicZoneBase&&) = default;
DynamicZoneBase& operator=(const DynamicZoneBase&) = default;
DynamicZoneBase& operator=(DynamicZoneBase&&) = default;
DynamicZoneBase() = default;
DynamicZoneBase(uint32_t dz_id) : m_id(dz_id) {}
DynamicZoneBase(DynamicZoneType type) : m_type(type) {}
DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry);
static std::string GetDynamicZoneTypeName(DynamicZoneType dz_type);
virtual void SetSecondsRemaining(uint32_t seconds_remaining) = 0;
int GetDuration() const { return static_cast<int>(m_duration.count()); }
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
uint32_t GetID() const { return m_id; }
uint16_t GetInstanceID() const { return static_cast<uint16_t>(m_instance_id); }
uint32_t GetLeaderID() const { return m_leader.id; }
uint32_t GetMaxPlayers() const { return m_max_players; }
uint32_t GetMemberCount() const { return static_cast<uint32_t>(m_members.size()); }
uint32_t GetMinPlayers() const { return m_min_players; }
uint32_t GetSecondsRemaining() const;
uint16_t GetZoneID() const { return static_cast<uint16_t>(m_zone_id); }
uint32_t GetZoneIndex() const { return (m_instance_id << 16) | (m_zone_id & 0xffff); }
uint32_t GetZoneVersion() const { return m_zone_version; }
int GetSwitchID() const { return m_dz_switch_id; }
DynamicZoneType GetType() const { return m_type; }
const std::string& GetLeaderName() const { return m_leader.name; }
const std::string& GetName() const { return m_name; }
const std::string& GetUUID() const { return m_uuid; }
const DynamicZoneMember& GetLeader() const { return m_leader; }
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
const DynamicZoneLocation& GetZoneInLocation() const { return m_zonein; }
std::chrono::system_clock::duration GetDurationRemaining() const { return m_expire_time - std::chrono::system_clock::now(); }
bool AddMember(const DynamicZoneMember& add_member);
void AddMemberFromRepositoryResult(DynamicZoneMembersRepository::MemberWithName&& entry);
uint32_t GetDatabaseMemberCount();
DynamicZoneMember GetMemberData(uint32_t character_id);
DynamicZoneMember GetMemberData(const std::string& character_name);
EQ::Net::DynamicPacket GetSerializedDzPacket();
bool HasDatabaseMember(uint32_t character_id);
bool HasMember(uint32_t character_id);
bool HasMember(const std::string& character_name);
bool HasMembers() const { return !m_members.empty(); }
bool HasZoneInLocation() const { return m_has_zonein; }
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
bool IsValid() const { return m_instance_id != 0; }
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
void LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size);
void LoadTemplate(const DynamicZoneTemplatesRepository::DynamicZoneTemplates& dz_template);
void RemoveAllMembers();
bool RemoveMember(uint32_t character_id);
bool RemoveMember(const std::string& character_name);
bool RemoveMember(const DynamicZoneMember& remove_member);
void SaveMembers(const std::vector<DynamicZoneMember>& members);
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
void SetLeader(const DynamicZoneMember& leader, bool update_db = false);
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
void SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
void SetName(const std::string& name) { m_name = name; }
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
void SetSwitchID(int dz_switch_id, bool update_db = false);
void SetType(DynamicZoneType type) { m_type = type; }
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
bool SwapMember(const DynamicZoneMember& add_member, const std::string& remove_char_name);
protected:
virtual uint16_t GetCurrentInstanceID() { return 0; }
virtual uint16_t GetCurrentZoneID() { return 0; }
virtual Database& GetDatabase() = 0;
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
virtual bool ProcessMemberStatusChange(uint32_t member_id, DynamicZoneMemberStatus status);
virtual void ProcessRemoveAllMembers(bool silent = false) { m_members.clear(); }
virtual void ProcessSetSwitchID(int dz_switch_id) { m_dz_switch_id = dz_switch_id; }
virtual bool SendServerPacket(ServerPacket* packet) = 0;
void AddInternalMember(const DynamicZoneMember& member);
uint32_t Create();
uint32_t CreateInstance();
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
void RemoveInternalMember(uint32_t character_id);
uint32_t SaveToDatabase();
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
std::unique_ptr<ServerPacket> CreateServerDzCreatePacket(uint16_t origin_zone_id, uint16_t origin_instance_id);
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
std::unique_ptr<ServerPacket> CreateServerDzSwitchIDPacket();
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
std::unique_ptr<ServerPacket> CreateServerRemoveAllMembersPacket();
uint32_t m_id = 0;
uint32_t m_zone_id = 0;
uint32_t m_instance_id = 0;
uint32_t m_zone_version = 0;
uint32_t m_min_players = 0;
uint32_t m_max_players = 0;
int m_dz_switch_id = 0;
bool m_never_expires = false;
bool m_has_zonein = false;
bool m_has_member_statuses = false;
std::string m_name;
std::string m_uuid;
DynamicZoneMember m_leader;
DynamicZoneType m_type{ DynamicZoneType::None };
DynamicZoneLocation m_compass;
DynamicZoneLocation m_safereturn;
DynamicZoneLocation m_zonein;
std::chrono::seconds m_duration;
std::chrono::time_point<std::chrono::system_clock> m_start_time;
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
std::vector<DynamicZoneMember> m_members;
public:
template<class Archive>
void serialize(Archive& archive)
{
archive(
m_id,
m_zone_id,
m_instance_id,
m_zone_version,
m_min_players,
m_max_players,
m_dz_switch_id,
m_never_expires,
m_has_zonein,
m_has_member_statuses,
m_name,
m_uuid,
m_leader,
m_type,
m_compass,
m_safereturn,
m_zonein,
m_duration,
m_start_time,
m_expire_time,
m_members
);
}
};
#endif
+437 -10
View File
@@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,14 @@
*/
#include "emu_constants.h"
#include "bodytypes.h"
#include "data_verification.h"
#include "eqemu_logsys.h"
#include "eqemu_logsys_log_aliases.h"
#include "languages.h"
#include "rulesys.h"
int16 EQEmu::invtype::GetInvTypeSize(int16 inv_type) {
int16 EQ::invtype::GetInvTypeSize(int16 inv_type) {
static const int16 local_array[] = {
POSSESSIONS_SIZE,
BANK_SIZE,
@@ -55,7 +60,7 @@ int16 EQEmu::invtype::GetInvTypeSize(int16 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) {
case catVideo:
return "Video";
@@ -87,7 +92,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)
return catOther;
@@ -115,11 +120,11 @@ EQEmu::bug::CategoryID EQEmu::bug::CategoryNameToCategoryID(const char* category
return catLoNTCG;
if (!strcmp(category_name, "Mercenaries"))
return catMercenaries;
return catOther;
}
const char *EQEmu::constants::GetStanceName(StanceType stance_type) {
const char *EQ::constants::GetStanceName(StanceType stance_type) {
switch (stance_type) {
case stanceUnknown:
return "Unknown";
@@ -146,9 +151,431 @@ const char *EQEmu::constants::GetStanceName(StanceType stance_type) {
}
}
int EQEmu::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
if (stance_type >= EQEmu::constants::stancePassive && stance_type <= EQEmu::constants::stanceBurnAE)
return (stance_type - EQEmu::constants::stancePassive);
int EQ::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
if (EQ::ValueWithin(stance_type, EQ::constants::stancePassive, EQ::constants::stanceBurnAE)) {
return (stance_type - EQ::constants::stancePassive);
}
return 0;
}
const std::map<int, std::string>& EQ::constants::GetLanguageMap()
{
static const std::map<int, std::string> language_map = {
{ LANG_COMMON_TONGUE, "Common Tongue" },
{ LANG_BARBARIAN, "Barbarian" },
{ LANG_ERUDIAN, "Erudian" },
{ LANG_ELVISH, "Elvish" },
{ LANG_DARK_ELVISH, "Dark Elvish" },
{ LANG_DWARVISH, "Dwarvish" },
{ LANG_TROLL, "Troll" },
{ LANG_OGRE, "Ogre" },
{ LANG_GNOMISH, "Gnomish" },
{ LANG_HALFLING, "Halfling" },
{ LANG_THIEVES_CANT, "Thieves Cant" },
{ LANG_OLD_ERUDIAN, "Old Erudian" },
{ LANG_ELDER_ELVISH, "Elder Elvish" },
{ LANG_FROGLOK, "Froglok" },
{ LANG_GOBLIN, "Goblin" },
{ LANG_GNOLL, "Gnoll" },
{ LANG_COMBINE_TONGUE, "Combine Tongue" },
{ LANG_ELDER_TEIRDAL, "Elder Teirdal" },
{ LANG_LIZARDMAN, "Lizardman" },
{ LANG_ORCISH, "Orcish" },
{ LANG_FAERIE, "Faerie" },
{ LANG_DRAGON, "Dragon" },
{ LANG_ELDER_DRAGON, "Elder Dragon" },
{ LANG_DARK_SPEECH, "Dark Speech" },
{ LANG_VAH_SHIR, "Vah Shir" },
{ LANG_ALARAN, "Alaran" },
{ LANG_HADAL, "Hadal" },
{ LANG_UNKNOWN, "Unknown" }
};
return language_map;
}
std::string EQ::constants::GetLanguageName(int language_id)
{
if (EQ::ValueWithin(language_id, LANG_COMMON_TONGUE, LANG_UNKNOWN)) {
return EQ::constants::GetLanguageMap().find(language_id)->second;
}
return std::string();
}
const std::map<uint32, std::string>& EQ::constants::GetLDoNThemeMap()
{
static const std::map<uint32, std::string> ldon_theme_map = {
{ LDoNThemes::Unused, "Unused" },
{ LDoNThemes::GUK, "Deepest Guk" },
{ LDoNThemes::MIR, "Miragul's Menagerie" },
{ LDoNThemes::MMC, "Mistmoore Catacombs" },
{ LDoNThemes::RUJ, "Rujarkian Hills" },
{ LDoNThemes::TAK, "Takish-Hiz" },
};
return ldon_theme_map;
}
std::string EQ::constants::GetLDoNThemeName(uint32 theme_id)
{
if (EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) {
return EQ::constants::GetLDoNThemeMap().find(theme_id)->second;
}
return std::string();
}
const std::map<int8, std::string>& EQ::constants::GetFlyModeMap()
{
static const std::map<int8, std::string> flymode_map = {
{ GravityBehavior::Ground, "Ground" },
{ GravityBehavior::Flying, "Flying" },
{ GravityBehavior::Levitating, "Levitating" },
{ GravityBehavior::Water, "Water" },
{ GravityBehavior::Floating, "Floating" },
{ GravityBehavior::LevitateWhileRunning, "Levitating While Running" },
};
return flymode_map;
}
std::string EQ::constants::GetFlyModeName(int8 flymode_id)
{
if (EQ::ValueWithin(flymode_id, GravityBehavior::Ground, GravityBehavior::LevitateWhileRunning)) {
return EQ::constants::GetFlyModeMap().find(flymode_id)->second;
}
return std::string();
}
const std::map<bodyType, std::string>& EQ::constants::GetBodyTypeMap()
{
static const std::map<bodyType, std::string> bodytype_map = {
{ BT_Humanoid, "Humanoid" },
{ BT_Lycanthrope, "Lycanthrope" },
{ BT_Undead, "Undead" },
{ BT_Giant, "Giant" },
{ BT_Construct, "Construct" },
{ BT_Extraplanar, "Extraplanar" },
{ BT_Magical, "Magical" },
{ BT_SummonedUndead, "Summoned Undead" },
{ BT_RaidGiant, "Raid Giant" },
{ BT_RaidColdain, "Raid Coldain" },
{ BT_NoTarget, "Untargetable" },
{ BT_Vampire, "Vampire" },
{ BT_Atenha_Ra, "Aten Ha Ra" },
{ BT_Greater_Akheva, "Greater Akheva" },
{ BT_Khati_Sha, "Khati Sha" },
{ BT_Seru, "Seru" },
{ BT_Grieg_Veneficus, "Grieg Veneficus" },
{ BT_Draz_Nurakk, "Draz Nurakk" },
{ BT_Zek, "Zek" },
{ BT_Luggald, "Luggald" },
{ BT_Animal, "Animal" },
{ BT_Insect, "Insect" },
{ BT_Monster, "Monster" },
{ BT_Summoned, "Summoned" },
{ BT_Plant, "Plant" },
{ BT_Dragon, "Dragon" },
{ BT_Summoned2, "Summoned 2" },
{ BT_Summoned3, "Summoned 3" },
{ BT_Dragon2, "Dragon 2" },
{ BT_VeliousDragon, "Velious Dragon" },
{ BT_Familiar, "Familiar" },
{ BT_Dragon3, "Dragon 3" },
{ BT_Boxes, "Boxes" },
{ BT_Muramite, "Muramite" },
{ BT_NoTarget2, "Untargetable 2" },
{ BT_SwarmPet, "Swarm Pet" },
{ BT_MonsterSummon, "Monster Summon" },
{ BT_InvisMan, "Invisible Man" },
{ BT_Special, "Special" },
};
return bodytype_map;
}
std::string EQ::constants::GetBodyTypeName(bodyType bodytype_id)
{
if (EQ::constants::GetBodyTypeMap().find(bodytype_id) != EQ::constants::GetBodyTypeMap().end()) {
return EQ::constants::GetBodyTypeMap().find(bodytype_id)->second;
}
return std::string();
}
const std::map<uint8, std::string>& EQ::constants::GetAccountStatusMap()
{
static const std::map<uint8, std::string> account_status_map = {
{ AccountStatus::Player, "Player" },
{ AccountStatus::Steward, "Steward" },
{ AccountStatus::ApprenticeGuide, "Apprentice Guide" },
{ AccountStatus::Guide, "Guide" },
{ AccountStatus::QuestTroupe, "Quest Troupe" },
{ AccountStatus::SeniorGuide, "Senior Guide" },
{ AccountStatus::GMTester, "GM Tester" },
{ AccountStatus::EQSupport, "EQ Support" },
{ AccountStatus::GMStaff, "GM Staff" },
{ AccountStatus::GMAdmin, "GM Admin" },
{ AccountStatus::GMLeadAdmin, "GM Lead Admin" },
{ AccountStatus::QuestMaster, "Quest Master" },
{ AccountStatus::GMAreas, "GM Areas" },
{ AccountStatus::GMCoder, "GM Coder" },
{ AccountStatus::GMMgmt, "GM Mgmt" },
{ AccountStatus::GMImpossible, "GM Impossible" },
{ AccountStatus::Max, "GM Max" }
};
return account_status_map;
}
std::string EQ::constants::GetAccountStatusName(uint8 account_status)
{
for (
auto status_level = EQ::constants::GetAccountStatusMap().rbegin();
status_level != EQ::constants::GetAccountStatusMap().rend();
++status_level
) {
if (account_status >= status_level->first) {
return status_level->second;
}
}
return std::string();
}
const std::map<uint8, std::string>& EQ::constants::GetConsiderLevelMap()
{
static const std::map<uint8, std::string> consider_level_map = {
{ ConsiderLevel::Ally, "Ally" },
{ ConsiderLevel::Warmly, "Warmly" },
{ ConsiderLevel::Kindly, "Kindly" },
{ ConsiderLevel::Amiably, "Amiably" },
{ ConsiderLevel::Indifferently, "Indifferently" },
{ ConsiderLevel::Apprehensively, "Apprehensively" },
{ ConsiderLevel::Dubiously, "Dubiously" },
{ ConsiderLevel::Threateningly, "Threateningly" },
{ ConsiderLevel::Scowls, "Scowls" }
};
return consider_level_map;
}
std::string EQ::constants::GetConsiderLevelName(uint8 faction_consider_level)
{
if (EQ::constants::GetConsiderLevelMap().find(faction_consider_level) != EQ::constants::GetConsiderLevelMap().end()) {
return EQ::constants::GetConsiderLevelMap().find(faction_consider_level)->second;
}
return std::string();
}
const std::map<uint8, std::string>& EQ::constants::GetEnvironmentalDamageMap()
{
static const std::map<uint8, std::string> damage_type_map = {
{ EnvironmentalDamage::Lava, "Lava" },
{ EnvironmentalDamage::Drowning, "Drowning" },
{ EnvironmentalDamage::Falling, "Falling" },
{ EnvironmentalDamage::Trap, "Trap" }
};
return damage_type_map;
}
std::string EQ::constants::GetEnvironmentalDamageName(uint8 damage_type)
{
if (EQ::ValueWithin(damage_type, EnvironmentalDamage::Lava, EnvironmentalDamage::Trap)) {
return EQ::constants::GetEnvironmentalDamageMap().find(damage_type)->second;
}
return std::string();
}
const std::map<uint8, std::string>& EQ::constants::GetStuckBehaviorMap()
{
static const std::map<uint8, std::string> stuck_behavior_map = {
{ StuckBehavior::RunToTarget, "Run To Target" },
{ StuckBehavior::WarpToTarget, "Warp To Target" },
{ StuckBehavior::TakeNoAction, "Take No Action" },
{ StuckBehavior::EvadeCombat, "Evade Combat" }
};
return stuck_behavior_map;
}
std::string EQ::constants::GetStuckBehaviorName(uint8 behavior_id)
{
if (EQ::ValueWithin(behavior_id, StuckBehavior::RunToTarget, StuckBehavior::EvadeCombat)) {
return EQ::constants::GetStuckBehaviorMap().find(behavior_id)->second;
}
return std::string();
}
const std::map<uint8, std::string>& EQ::constants::GetSpawnAnimationMap()
{
static const std::map<uint8, std::string> spawn_animation_map = {
{ SpawnAnimations::Standing, "Standing" },
{ SpawnAnimations::Sitting, "Sitting" },
{ SpawnAnimations::Crouching, "Crouching" },
{ SpawnAnimations::Laying, "Laying" },
{ SpawnAnimations::Looting, "Looting" }
};
return spawn_animation_map;
}
std::string EQ::constants::GetSpawnAnimationName(uint8 animation_id)
{
if (EQ::ValueWithin(animation_id, SpawnAnimations::Standing, SpawnAnimations::Looting)) {
return EQ::constants::GetSpawnAnimationMap().find(animation_id)->second;
}
return std::string();
}
const std::map<int, std::string>& EQ::constants::GetObjectTypeMap()
{
static const std::map<int, std::string> object_type_map = {
{ ObjectTypes::SmallBag, "Small Bag" },
{ ObjectTypes::LargeBag, "Large Bag" },
{ ObjectTypes::Quiver, "Quiver" },
{ ObjectTypes::BeltPouch, "Belt Pouch" },
{ ObjectTypes::WristPouch, "Wrist Pouch" },
{ ObjectTypes::Backpack, "Backpack" },
{ ObjectTypes::SmallChest, "Small Chest" },
{ ObjectTypes::LargeChest, "Large Chest" },
{ ObjectTypes::Bandolier, "Bandolier" },
{ ObjectTypes::Medicine, "Medicine" },
{ ObjectTypes::Tinkering, "Tinkering" },
{ ObjectTypes::Lexicon, "Lexicon" },
{ ObjectTypes::PoisonMaking, "Mortar and Pestle" },
{ ObjectTypes::Quest, "Quest" },
{ ObjectTypes::MixingBowl, "Mixing Bowl" },
{ ObjectTypes::Baking, "Baking" },
{ ObjectTypes::Tailoring, "Tailoring" },
{ ObjectTypes::Blacksmithing, "Blacksmithing" },
{ ObjectTypes::Fletching, "Fletching" },
{ ObjectTypes::Brewing, "Brewing" },
{ ObjectTypes::JewelryMaking, "Jewelry Making" },
{ ObjectTypes::Pottery, "Pottery" },
{ ObjectTypes::Kiln, "Kiln" },
{ ObjectTypes::KeyMaker, "Key Maker" },
{ ObjectTypes::ResearchWIZ, "Lexicon" },
{ ObjectTypes::ResearchMAG, "Lexicon" },
{ ObjectTypes::ResearchNEC, "Lexicon" },
{ ObjectTypes::ResearchENC, "Lexicon" },
{ ObjectTypes::Unknown, "Unknown" },
{ ObjectTypes::ResearchPractice, "Lexicon" },
{ ObjectTypes::Alchemy, "Alchemy" },
{ ObjectTypes::HighElfForge, "High Elf Forge" },
{ ObjectTypes::DarkElfForge, "Dark Elf Forge" },
{ ObjectTypes::OgreForge, "Ogre Forge" },
{ ObjectTypes::DwarfForge, "Dwarf Forge" },
{ ObjectTypes::GnomeForge, "Gnome Forge" },
{ ObjectTypes::BarbarianForge, "Barbarian Forge" },
{ ObjectTypes::IksarForge, "Iksar Forge" },
{ ObjectTypes::HumanForgeOne, "Human Forge" },
{ ObjectTypes::HumanForgeTwo, "Human Forge" },
{ ObjectTypes::HalflingTailoringOne, "Halfling Tailoring" },
{ ObjectTypes::HalflingTailoringTwo, "Halfling Tailoring" },
{ ObjectTypes::EruditeTailoring, "Erudite Tailoring" },
{ ObjectTypes::WoodElfTailoring, "Wood Elf Tailoring" },
{ ObjectTypes::WoodElfFletching, "Wood Elf Fletching" },
{ ObjectTypes::IksarPottery, "Iksar Pottery" },
{ ObjectTypes::Fishing, "Fishing" },
{ ObjectTypes::TrollForge, "Troll Forge" },
{ ObjectTypes::WoodElfForge, "Wood Elf Forge" },
{ ObjectTypes::HalflingForge, "Halfling Forge" },
{ ObjectTypes::EruditeForge, "Erudite Forge" },
{ ObjectTypes::Merchant, "Merchant" },
{ ObjectTypes::FroglokForge, "Froglok Forge" },
{ ObjectTypes::Augmenter, "Augmenter" },
{ ObjectTypes::Churn, "Churn" },
{ ObjectTypes::TransformationMold, "Transformation Mold" },
{ ObjectTypes::DetransformationMold, "Detransformation Mold" },
{ ObjectTypes::Unattuner, "Unattuner" },
{ ObjectTypes::TradeskillBag, "Tradeskill Bag" },
{ ObjectTypes::CollectibleBag, "Collectible Bag" },
{ ObjectTypes::NoDeposit, "No Deposit" }
};
return object_type_map;
}
std::string EQ::constants::GetObjectTypeName(int object_type)
{
if (EQ::ValueWithin(object_type, ObjectTypes::SmallBag, ObjectTypes::NoDeposit)) {
return EQ::constants::GetObjectTypeMap().find(object_type)->second;
}
return std::string();
}
const std::map<uint8, std::string> &EQ::constants::GetWeatherTypeMap()
{
static const std::map<uint8, std::string> weather_type_map = {
{WeatherTypes::None, "None"},
{WeatherTypes::Raining, "Raining"},
{WeatherTypes::Snowing, "Snowing"}
};
return weather_type_map;
}
std::string EQ::constants::GetWeatherTypeName(uint8 weather_type)
{
if (EQ::ValueWithin(weather_type, WeatherTypes::None, WeatherTypes::Snowing)) {
return EQ::constants::GetWeatherTypeMap().find(weather_type)->second;
}
return std::string();
}
const std::map<uint8, std::string> &EQ::constants::GetEmoteEventTypeMap()
{
static const std::map<uint8, std::string> emote_event_type_map = {
{ EmoteEventTypes::LeaveCombat, "Leave Combat" },
{ EmoteEventTypes::EnterCombat, "Enter Combat" },
{ EmoteEventTypes::OnDeath, "On Death" },
{ EmoteEventTypes::AfterDeath, "After Death" },
{ EmoteEventTypes::Hailed, "Hailed" },
{ EmoteEventTypes::KilledPC, "Killed PC" },
{ EmoteEventTypes::KilledNPC, "Killed NPC" },
{ EmoteEventTypes::OnSpawn, "On Spawn" },
{ EmoteEventTypes::OnDespawn, "On Despawn" }
};
return emote_event_type_map;
}
std::string EQ::constants::GetEmoteEventTypeName(uint8 emote_event_type)
{
if (EQ::ValueWithin(emote_event_type, EmoteEventTypes::LeaveCombat, EmoteEventTypes::OnDespawn)) {
return EQ::constants::GetEmoteEventTypeMap().find(emote_event_type)->second;
}
return std::string();
}
const std::map<uint8, std::string> &EQ::constants::GetEmoteTypeMap()
{
static const std::map<uint8, std::string> emote_type_map = {
{ EmoteTypes::Emote, "Emote" },
{ EmoteTypes::Shout, "Shout" },
{ EmoteTypes::Proximity, "Proximity" }
};
return emote_type_map;
}
std::string EQ::constants::GetEmoteTypeName(uint8 emote_type)
{
if (EQ::ValueWithin(emote_type, EmoteTypes::Emote, EmoteTypes::Proximity)) {
return EQ::constants::GetEmoteTypeMap().find(emote_type)->second;
}
return std::string();
}
+270 -15
View File
@@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -22,19 +22,16 @@
#include "eq_limits.h"
#include "emu_versions.h"
#include "bodytypes.h"
#include <string.h>
// local definitions are the result of using hybrid-client or server-only values and methods
namespace EQEmu
namespace EQ
{
using RoF2::IINVALID;
using RoF2::INULL;
namespace inventory {
} /*inventory*/
namespace invtype {
using namespace RoF2::invtype::enum_;
@@ -193,14 +190,14 @@ namespace EQEmu
} // namespace invaug
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_BIT;
using RoF2::constants::EXPANSIONS_MASK;
using RoF2::constants::CHARACTER_CREATION_LIMIT;
const size_t SAY_LINK_OPENER_SIZE = 1;
using RoF2::constants::SAY_LINK_BODY_SIZE;
const size_t SAY_LINK_TEXT_SIZE = 256; // this may be varied until it breaks something (tested:374) - the others are constant
@@ -220,9 +217,186 @@ namespace EQEmu
stanceBurnAE
};
enum BotSpellIDs : int {
Warrior = 3001,
Cleric,
Paladin,
Ranger,
Shadowknight,
Druid,
Monk,
Bard,
Rogue,
Shaman,
Necromancer,
Wizard,
Magician,
Enchanter,
Beastlord,
Berserker
};
enum GravityBehavior : int8 {
Ground,
Flying,
Levitating,
Water,
Floating,
LevitateWhileRunning
};
enum EnvironmentalDamage : uint8 {
Lava = 250,
Drowning,
Falling,
Trap
};
enum StuckBehavior : uint8 {
RunToTarget,
WarpToTarget,
TakeNoAction,
EvadeCombat
};
enum SpawnAnimations : uint8 {
Standing,
Sitting,
Crouching,
Laying,
Looting
};
enum ObjectTypes : int {
SmallBag,
LargeBag,
Quiver,
BeltPouch,
WristPouch,
Backpack,
SmallChest,
LargeChest,
Bandolier,
Medicine,
Tinkering,
Lexicon,
PoisonMaking,
Quest,
MixingBowl,
Baking,
Tailoring,
Blacksmithing,
Fletching,
Brewing,
JewelryMaking,
Pottery,
Kiln,
KeyMaker,
ResearchWIZ,
ResearchMAG,
ResearchNEC,
ResearchENC,
Unknown,
ResearchPractice,
Alchemy,
HighElfForge,
DarkElfForge,
OgreForge,
DwarfForge,
GnomeForge,
BarbarianForge,
IksarForge,
HumanForgeOne,
HumanForgeTwo,
HalflingTailoringOne,
HalflingTailoringTwo,
EruditeTailoring,
WoodElfTailoring,
WoodElfFletching,
IksarPottery,
Fishing,
TrollForge,
WoodElfForge,
HalflingForge,
EruditeForge,
Merchant,
FroglokForge,
Augmenter,
Churn,
TransformationMold,
DetransformationMold,
Unattuner,
TradeskillBag,
CollectibleBag,
NoDeposit
};
enum WeatherTypes : uint8 {
None,
Raining,
Snowing
};
enum EmoteEventTypes : uint8 {
LeaveCombat,
EnterCombat,
OnDeath,
AfterDeath,
Hailed,
KilledPC,
KilledNPC,
OnSpawn,
OnDespawn
};
enum EmoteTypes : uint8 {
Emote,
Shout,
Proximity
};
const char *GetStanceName(StanceType stance_type);
int ConvertStanceTypeToIndex(StanceType stance_type);
extern const std::map<int, std::string>& GetLanguageMap();
std::string GetLanguageName(int language_id);
extern const std::map<uint32, std::string>& GetLDoNThemeMap();
std::string GetLDoNThemeName(uint32 theme_id);
extern const std::map<int8, std::string>& GetFlyModeMap();
std::string GetFlyModeName(int8 flymode_id);
extern const std::map<bodyType, std::string>& GetBodyTypeMap();
std::string GetBodyTypeName(bodyType bodytype_id);
extern const std::map<uint8, std::string>& GetAccountStatusMap();
std::string GetAccountStatusName(uint8 account_status);
extern const std::map<uint8, std::string>& GetConsiderLevelMap();
std::string GetConsiderLevelName(uint8 consider_level);
extern const std::map<uint8, std::string>& GetEnvironmentalDamageMap();
std::string GetEnvironmentalDamageName(uint8 damage_type);
extern const std::map<uint8, std::string>& GetStuckBehaviorMap();
std::string GetStuckBehaviorName(uint8 behavior_id);
extern const std::map<uint8, std::string>& GetSpawnAnimationMap();
std::string GetSpawnAnimationName(uint8 animation_id);
extern const std::map<int, std::string>& GetObjectTypeMap();
std::string GetObjectTypeName(int object_type);
extern const std::map<uint8, std::string>& GetWeatherTypeMap();
std::string GetWeatherTypeName(uint8 weather_type);
extern const std::map<uint8, std::string>& GetEmoteEventTypeMap();
std::string GetEmoteEventTypeName(uint8 emote_event_type);
extern const std::map<uint8, std::string>& GetEmoteTypeMap();
std::string GetEmoteTypeName(uint8 emote_type);
const int STANCE_TYPE_FIRST = stancePassive;
const int STANCE_TYPE_LAST = stanceBurnAE;
const int STANCE_TYPE_COUNT = stanceBurnAE;
@@ -232,7 +406,7 @@ namespace EQEmu
namespace profile {
using RoF2::profile::BANDOLIERS_SIZE;
using RoF2::profile::BANDOLIER_ITEM_COUNT;
using RoF2::profile::POTION_BELT_SIZE;
using RoF2::profile::SKILL_ARRAY_SIZE;
@@ -317,12 +491,93 @@ namespace EQEmu
QuestControlGrid = -1
};
namespace consent {
enum eConsentType : uint8 {
Normal = 0,
Group,
Raid,
Guild
};
}; // namespace consent
} /*EQEmu*/
enum ServerLockType : int {
List,
Lock,
Unlock
};
enum AccountStatus : uint8 {
Player = 0,
Steward = 10,
ApprenticeGuide = 20,
Guide = 50,
QuestTroupe = 80,
SeniorGuide = 81,
GMTester = 85,
EQSupport = 90,
GMStaff = 95,
GMAdmin = 100,
GMLeadAdmin = 150,
QuestMaster = 160,
GMAreas = 170,
GMCoder = 180,
GMMgmt = 200,
GMImpossible = 250,
Max = 255
};
enum Invisibility : uint8 {
Visible,
Invisible,
Special = 255
};
enum AugmentActions : int {
Insert,
Remove,
Swap,
Destroy
};
enum ConsiderLevel : uint8 {
Ally = 1,
Warmly,
Kindly,
Amiably,
Indifferently,
Apprehensively,
Dubiously,
Threateningly,
Scowls
};
enum TargetDescriptionType : uint8 {
LCSelf,
UCSelf,
LCYou,
UCYou,
LCYour,
UCYour
};
enum ReloadWorld : uint8 {
NoRepop = 0,
Repop,
ForceRepop
};
enum MerchantBucketComparison : uint8 {
BucketEqualTo = 0,
BucketNotEqualTo,
BucketGreaterThanOrEqualTo,
BucketLesserThanOrEqualTo,
BucketGreaterThan,
BucketLesserThan,
BucketIsAny,
BucketIsNotAny,
BucketIsBetween,
BucketIsNotBetween
};
#endif /*COMMON_EMU_CONSTANTS_H*/
/* hack list to prevent circular references
eq_limits.h:EQEmu::inventory::LookupEntry::InventoryTypeSize[n];
*/
+30 -9
View File
@@ -71,6 +71,7 @@ N(OP_Camp),
N(OP_CancelSneakHide),
N(OP_CancelTask),
N(OP_CancelTrade),
N(OP_CashReward),
N(OP_CastSpell),
N(OP_ChangeSize),
N(OP_ChannelMessage),
@@ -129,27 +130,29 @@ N(OP_DisciplineTimer),
N(OP_DisciplineUpdate),
N(OP_DiscordMerchantInventory),
N(OP_DoGroupLeadershipAbility),
N(OP_DuelResponse),
N(OP_DuelResponse2),
N(OP_DuelDecline),
N(OP_DuelAccept),
N(OP_DumpName),
N(OP_Dye),
N(OP_DynamicWall),
N(OP_DzAddPlayer),
N(OP_DzChooseZone),
N(OP_DzChooseZoneReply),
N(OP_DzCompass),
N(OP_DzExpeditionEndsWarning),
N(OP_DzExpeditionInfo),
N(OP_DzExpeditionList),
N(OP_DzJoinExpeditionConfirm),
N(OP_DzJoinExpeditionReply),
N(OP_DzLeaderStatus),
N(OP_DzExpeditionInvite),
N(OP_DzExpeditionInviteResponse),
N(OP_DzExpeditionLockoutTimers),
N(OP_DzListTimers),
N(OP_DzMakeLeader),
N(OP_DzMemberList),
N(OP_DzMemberStatus),
N(OP_DzMemberListName),
N(OP_DzMemberListStatus),
N(OP_DzPlayerList),
N(OP_DzQuit),
N(OP_DzRemovePlayer),
N(OP_DzSetLeaderName),
N(OP_DzSwapPlayer),
N(OP_Emote),
N(OP_EndLootRequest),
@@ -271,6 +274,7 @@ N(OP_ItemVerifyRequest),
N(OP_ItemViewUnknown),
N(OP_Jump),
N(OP_KeyRing),
N(OP_KickPlayers),
N(OP_KnowledgeBase),
N(OP_LDoNButton),
N(OP_LDoNDisarmTraps),
@@ -300,6 +304,7 @@ N(OP_LockoutTimerInfo),
N(OP_Login),
N(OP_LoginAccepted),
N(OP_LoginComplete),
N(OP_LoginExpansionPacketData), //added for Rof2 client to send expansion data packet. Requires login_opcodes_sod.conf to be updated.
N(OP_LoginUnknown1),
N(OP_LoginUnknown2),
N(OP_Logout),
@@ -352,7 +357,6 @@ N(OP_OpenContainer),
N(OP_OpenDiscordMerchant),
N(OP_OpenGuildTributeMaster),
N(OP_OpenInventory),
N(OP_OpenNewTasksWindow),
N(OP_OpenTributeMaster),
N(OP_PDeletePetition),
N(OP_PetBuffWindow),
@@ -453,6 +457,7 @@ N(OP_ServerListResponse),
N(OP_SessionReady),
N(OP_SetChatServer),
N(OP_SetChatServer2),
N(OP_SetFace),
N(OP_SetGroupTarget),
N(OP_SetGuildMOTD),
N(OP_SetGuildRank),
@@ -461,6 +466,19 @@ N(OP_SetServerFilter),
N(OP_SetStartCity),
N(OP_SetTitle),
N(OP_SetTitleReply),
N(OP_SharedTaskMemberList),
N(OP_SharedTaskAddPlayer),
N(OP_SharedTaskRemovePlayer),
N(OP_SharedTaskMakeLeader),
N(OP_SharedTaskMemberInvite),
N(OP_SharedTaskInvite),
N(OP_SharedTaskInviteResponse),
N(OP_SharedTaskAcceptNew),
N(OP_SharedTaskMemberChange),
N(OP_SharedTaskPlayerList),
N(OP_SharedTaskSelectWindow),
N(OP_SharedTaskQuit),
N(OP_TaskTimers),
N(OP_Shielding),
N(OP_ShopDelItem),
N(OP_ShopEnd),
@@ -496,7 +514,8 @@ N(OP_TaskActivityComplete),
N(OP_TaskDescription),
N(OP_TaskHistoryReply),
N(OP_TaskHistoryRequest),
N(OP_TaskMemberList),
N(OP_TaskRequestTimer),
N(OP_TaskSelectWindow),
N(OP_Taunt),
N(OP_TestBuff),
N(OP_TGB),
@@ -542,6 +561,7 @@ N(OP_WhoAllRequest),
N(OP_WhoAllResponse),
N(OP_World_Client_CRC1),
N(OP_World_Client_CRC2),
N(OP_World_Client_CRC3),
N(OP_WorldClientReady),
N(OP_WorldComplete),
N(OP_WorldLogout),
@@ -564,4 +584,5 @@ N(OP_ZoneServerReady),
N(OP_ZoneSpawns),
N(OP_ZoneUnavail),
N(OP_ResetAA),
N(OP_UnderWorld),
// mail and chat opcodes located in ../mail_oplist.h
+31 -31
View File
@@ -21,7 +21,7 @@
#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)
return false;
@@ -29,7 +29,7 @@ bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
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)
return ClientVersion::Unknown;
@@ -37,7 +37,7 @@ EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVers
return client_version;
}
const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
const char* EQ::versions::ClientVersionName(ClientVersion client_version)
{
switch (client_version) {
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) {
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) {
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)
return false;
@@ -109,7 +109,7 @@ bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version)
return true;
}
bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version)
bool EQ::versions::IsValidPCMobVersion(MobVersion mob_version)
{
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
return false;
@@ -117,7 +117,7 @@ bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version)
return true;
}
bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version)
bool EQ::versions::IsValidNonPCMobVersion(MobVersion mob_version)
{
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
return false;
@@ -125,7 +125,7 @@ bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version)
return true;
}
bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
bool EQ::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
{
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
return false;
@@ -133,7 +133,7 @@ bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
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)
return MobVersion::Unknown;
@@ -141,7 +141,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_v
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)
return MobVersion::Unknown;
@@ -149,7 +149,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob
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)
return MobVersion::Unknown;
@@ -157,7 +157,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion
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)
return MobVersion::Unknown;
@@ -165,7 +165,7 @@ EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVers
return mob_version;
}
const char* EQEmu::versions::MobVersionName(MobVersion mob_version)
const char* EQ::versions::MobVersionName(MobVersion mob_version)
{
switch (mob_version) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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));
}
uint32 EQEmu::expansions::ConvertExpansionToExpansionBit(Expansion expansion)
uint32 EQ::expansions::ConvertExpansionToExpansionBit(Expansion expansion)
{
switch (expansion) {
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) {
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) {
case Expansion::RoK:
@@ -542,17 +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;
}
+1 -1
View File
@@ -25,7 +25,7 @@
#include <stdlib.h>
namespace EQEmu
namespace EQ
{
namespace versions {
enum class ClientVersion : uint32 {
+554 -2
View File
@@ -65,6 +65,7 @@
#define AT_FindBits 46 // set FindBits, whatever those are!
#define AT_TextureType 48 // TextureType
#define AT_FacePick 49 // Turns off face pick window? maybe ...
#define AT_AntiCheat 51 // sent by the client randomly telling the server how long since last action has occured
#define AT_GuildShow 52 // this is what MQ2 call sit, not sure
#define AT_Offline 53 // Offline mode
@@ -197,6 +198,492 @@ namespace Chat {
const uint16 Stun = 340;
};
// generation SQL:
// SELECT CONCAT(' constexpr uint16 ', UPPER(short_name), ' = ' , zoneidnumber, '; // ', long_name) from zone group by zoneidnumber ORDER BY zoneidnumber;
namespace Zones {
constexpr uint16 QEYNOS = 1; // South Qeynos
constexpr uint16 QEYNOS2 = 2; // North Qeynos
constexpr uint16 QRG = 3; // The Surefall Glade
constexpr uint16 QEYTOQRG = 4; // The Qeynos Hills
constexpr uint16 HIGHPASS = 5; // Highpass Hold
constexpr uint16 HIGHKEEP = 6; // High Keep
constexpr uint16 FREPORTN = 8; // North Freeport
constexpr uint16 FREPORTW = 9; // West Freeport
constexpr uint16 FREPORTE = 10; // East Freeport
constexpr uint16 RUNNYEYE = 11; // The Liberated Citadel of Runnyeye
constexpr uint16 QEY2HH1 = 12; // The Western Plains of Karana
constexpr uint16 NORTHKARANA = 13; // The Northern Plains of Karana
constexpr uint16 SOUTHKARANA = 14; // The Southern Plains of Karana
constexpr uint16 EASTKARANA = 15; // Eastern Plains of Karana
constexpr uint16 BEHOLDER = 16; // Gorge of King Xorbb
constexpr uint16 BLACKBURROW = 17; // Blackburrow
constexpr uint16 PAW = 18; // The Lair of the Splitpaw
constexpr uint16 RIVERVALE = 19; // Rivervale
constexpr uint16 KITHICOR = 20; // Kithicor Forest
constexpr uint16 COMMONS = 21; // West Commonlands
constexpr uint16 ECOMMONS = 22; // East Commonlands
constexpr uint16 ERUDNINT = 23; // The Erudin Palace
constexpr uint16 ERUDNEXT = 24; // Erudin
constexpr uint16 NEKTULOS = 25; // The Nektulos Forest
constexpr uint16 CSHOME = 26; // Sunset Home
constexpr uint16 LAVASTORM = 27; // The Lavastorm Mountains
constexpr uint16 NEKTROPOS = 28; // Nektropos
constexpr uint16 HALAS = 29; // Halas
constexpr uint16 EVERFROST = 30; // Everfrost Peaks
constexpr uint16 SOLDUNGA = 31; // Solusek's Eye
constexpr uint16 SOLDUNGB = 32; // Nagafen's Lair
constexpr uint16 MISTY = 33; // Misty Thicket
constexpr uint16 NRO = 34; // Northern Desert of Ro
constexpr uint16 SRO = 35; // Southern Desert of Ro
constexpr uint16 BEFALLEN = 36; // Befallen
constexpr uint16 OASIS = 37; // Oasis of Marr
constexpr uint16 TOX = 38; // Toxxulia Forest
constexpr uint16 HOLE = 39; // The Hole
constexpr uint16 NERIAKA = 40; // Neriak - Foreign Quarter
constexpr uint16 NERIAKB = 41; // Neriak - Commons
constexpr uint16 NERIAKC = 42; // Neriak - 3rd Gate
constexpr uint16 NERIAKD = 43; // Neriak Palace
constexpr uint16 NAJENA = 44; // Najena
constexpr uint16 QCAT = 45; // The Qeynos Aqueduct System
constexpr uint16 INNOTHULE = 46; // Innothule Swamp
constexpr uint16 FEERROTT = 47; // The Feerrott
constexpr uint16 CAZICTHULE = 48; // Accursed Temple of CazicThule
constexpr uint16 OGGOK = 49; // Oggok
constexpr uint16 RATHEMTN = 50; // The Rathe Mountains
constexpr uint16 LAKERATHE = 51; // Lake Rathetear
constexpr uint16 GROBB = 52; // Grobb
constexpr uint16 AVIAK = 53; // Aviak Village
constexpr uint16 GFAYDARK = 54; // The Greater Faydark
constexpr uint16 AKANON = 55; // Ak'Anon
constexpr uint16 STEAMFONT = 56; // Steamfont Mountains
constexpr uint16 LFAYDARK = 57; // The Lesser Faydark
constexpr uint16 CRUSHBONE = 58; // Crushbone
constexpr uint16 MISTMOORE = 59; // The Castle of Mistmoore
constexpr uint16 KALADIMA = 60; // South Kaladim
constexpr uint16 FELWITHEA = 61; // Northern Felwithe
constexpr uint16 FELWITHEB = 62; // Southern Felwithe
constexpr uint16 UNREST = 63; // The Estate of Unrest
constexpr uint16 KEDGE = 64; // Kedge Keep
constexpr uint16 GUKTOP = 65; // The City of Guk
constexpr uint16 GUKBOTTOM = 66; // The Ruins of Old Guk
constexpr uint16 KALADIMB = 67; // North Kaladim
constexpr uint16 BUTCHER = 68; // Butcherblock Mountains
constexpr uint16 OOT = 69; // Ocean of Tears
constexpr uint16 CAULDRON = 70; // Dagnor's Cauldron
constexpr uint16 AIRPLANE = 71; // The Plane of Sky
constexpr uint16 FEARPLANE = 72; // The Plane of Fear
constexpr uint16 PERMAFROST = 73; // The Permafrost Caverns
constexpr uint16 KERRARIDGE = 74; // Kerra Isle
constexpr uint16 PAINEEL = 75; // Paineel
constexpr uint16 HATEPLANE = 76; // Plane of Hate
constexpr uint16 ARENA = 77; // The Arena
constexpr uint16 FIELDOFBONE = 78; // The Field of Bone
constexpr uint16 WARSLIKSWOOD = 79; // The Warsliks Woods
constexpr uint16 SOLTEMPLE = 80; // The Temple of Solusek Ro
constexpr uint16 DROGA = 81; // The Temple of Droga
constexpr uint16 CABWEST = 82; // Cabilis West
constexpr uint16 SWAMPOFNOHOPE = 83; // The Swamp of No Hope
constexpr uint16 FIRIONA = 84; // Firiona Vie
constexpr uint16 LAKEOFILLOMEN = 85; // Lake of Ill Omen
constexpr uint16 DREADLANDS = 86; // The Dreadlands
constexpr uint16 BURNINGWOOD = 87; // The Burning Wood
constexpr uint16 KAESORA = 88; // Kaesora
constexpr uint16 SEBILIS = 89; // The Ruins of Sebilis
constexpr uint16 CITYMIST = 90; // The City of Mist
constexpr uint16 SKYFIRE = 91; // The Skyfire Mountains
constexpr uint16 FRONTIERMTNS = 92; // Frontier Mountains
constexpr uint16 OVERTHERE = 93; // The Overthere
constexpr uint16 EMERALDJUNGLE = 94; // The Emerald Jungle
constexpr uint16 TRAKANON = 95; // Trakanon's Teeth
constexpr uint16 TIMOROUS = 96; // Timorous Deep
constexpr uint16 KURN = 97; // Kurn's Tower
constexpr uint16 ERUDSXING = 98; // Erud's Crossing
constexpr uint16 STONEBRUNT = 100; // The Stonebrunt Mountains
constexpr uint16 WARRENS = 101; // The Warrens
constexpr uint16 KARNOR = 102; // Karnor's Castle
constexpr uint16 CHARDOK = 103; // Chardok
constexpr uint16 DALNIR = 104; // The Crypt of Dalnir
constexpr uint16 CHARASIS = 105; // The Howling Stones
constexpr uint16 CABEAST = 106; // Cabilis East
constexpr uint16 NURGA = 107; // The Mines of Nurga
constexpr uint16 VEESHAN = 108; // Veeshan's Peak
constexpr uint16 VEKSAR = 109; // Veksar
constexpr uint16 ICECLAD = 110; // The Iceclad Ocean
constexpr uint16 FROZENSHADOW = 111; // The Tower of Frozen Shadow
constexpr uint16 VELKETOR = 112; // Velketor's Labyrinth
constexpr uint16 KAEL = 113; // Kael Drakkel
constexpr uint16 SKYSHRINE = 114; // Skyshrine
constexpr uint16 THURGADINA = 115; // The City of Thurgadin
constexpr uint16 EASTWASTES = 116; // Eastern Wastes
constexpr uint16 COBALTSCAR = 117; // Cobaltscar
constexpr uint16 GREATDIVIDE = 118; // The Great Divide
constexpr uint16 WAKENING = 119; // The Wakening Land
constexpr uint16 WESTWASTES = 120; // The Western Wastes
constexpr uint16 CRYSTAL = 121; // The Crystal Caverns
constexpr uint16 NECROPOLIS = 123; // Dragon Necropolis
constexpr uint16 TEMPLEVEESHAN = 124; // The Temple of Veeshan
constexpr uint16 SIRENS = 125; // Siren's Grotto
constexpr uint16 MISCHIEFPLANE = 126; // The Plane of Mischief
constexpr uint16 GROWTHPLANE = 127; // The Plane of Growth
constexpr uint16 SLEEPER = 128; // The Sleeper's Tomb
constexpr uint16 THURGADINB = 129; // Icewell Keep
constexpr uint16 ERUDSXING2 = 130; // Marauders Mire
constexpr uint16 SHADOWHAVEN = 150; // Shadow Haven
constexpr uint16 BAZAAR = 151; // The Bazaar
constexpr uint16 NEXUS = 152; // Nexus
constexpr uint16 ECHO_ = 153; // The Echo Caverns
constexpr uint16 ACRYLIA = 154; // The Acrylia Caverns
constexpr uint16 SHARVAHL = 155; // The City of Shar Vahl
constexpr uint16 PALUDAL = 156; // The Paludal Caverns
constexpr uint16 FUNGUSGROVE = 157; // The Fungus Grove
constexpr uint16 VEXTHAL = 158; // Vex Thal
constexpr uint16 SSERU = 159; // Sanctus Seru
constexpr uint16 KATTA = 160; // Katta Castellum
constexpr uint16 NETHERBIAN = 161; // Netherbian Lair
constexpr uint16 SSRATEMPLE = 162; // Ssraeshza Temple
constexpr uint16 GRIEGSEND = 163; // Grieg's End
constexpr uint16 THEDEEP = 164; // The Deep
constexpr uint16 SHADEWEAVER = 165; // Shadeweaver's Thicket
constexpr uint16 HOLLOWSHADE = 166; // Hollowshade Moor
constexpr uint16 GRIMLING = 167; // Grimling Forest
constexpr uint16 MSERU = 168; // Marus Seru
constexpr uint16 LETALIS = 169; // Mons Letalis
constexpr uint16 TWILIGHT = 170; // The Twilight Sea
constexpr uint16 THEGREY = 171; // The Grey
constexpr uint16 TENEBROUS = 172; // The Tenebrous Mountains
constexpr uint16 MAIDEN = 173; // The Maiden's Eye
constexpr uint16 DAWNSHROUD = 174; // The Dawnshroud Peaks
constexpr uint16 SCARLET = 175; // The Scarlet Desert
constexpr uint16 UMBRAL = 176; // The Umbral Plains
constexpr uint16 AKHEVA = 179; // The Akheva Ruins
constexpr uint16 ARENA2 = 180; // The Arena Two
constexpr uint16 JAGGEDPINE = 181; // The Jaggedpine Forest
constexpr uint16 NEDARIA = 182; // Nedaria's Landing
constexpr uint16 TUTORIAL = 183; // EverQuest Tutorial
constexpr uint16 LOAD = 184; // Loading Zone
constexpr uint16 LOAD2 = 185; // New Loading Zone
constexpr uint16 HATEPLANEB = 186; // The Plane of Hate
constexpr uint16 SHADOWREST = 187; // Shadowrest
constexpr uint16 TUTORIALA = 188; // The Mines of Gloomingdeep
constexpr uint16 TUTORIALB = 189; // The Mines of Gloomingdeep
constexpr uint16 CLZ = 190; // Loading
constexpr uint16 CODECAY = 200; // The Crypt of Decay
constexpr uint16 POJUSTICE = 201; // The Plane of Justice
constexpr uint16 POKNOWLEDGE = 202; // The Plane of Knowledge
constexpr uint16 POTRANQUILITY = 203; // The Plane of Tranquility
constexpr uint16 PONIGHTMARE = 204; // The Plane of Nightmares
constexpr uint16 PODISEASE = 205; // The Plane of Disease
constexpr uint16 POINNOVATION = 206; // The Plane of Innovation
constexpr uint16 POTORMENT = 207; // Torment, the Plane of Pain
constexpr uint16 POVALOR = 208; // The Plane of Valor
constexpr uint16 BOTHUNDER = 209; // Bastion of Thunder
constexpr uint16 POSTORMS = 210; // The Plane of Storms
constexpr uint16 HOHONORA = 211; // The Halls of Honor
constexpr uint16 SOLROTOWER = 212; // The Tower of Solusek Ro
constexpr uint16 POWAR = 213; // Plane of War
constexpr uint16 POTACTICS = 214; // Drunder, the Fortress of Zek
constexpr uint16 POAIR = 215; // The Plane of Air
constexpr uint16 POWATER = 216; // The Plane of Water
constexpr uint16 POFIRE = 217; // The Plane of Fire
constexpr uint16 POEARTHA = 218; // The Plane of Earth
constexpr uint16 POTIMEA = 219; // The Plane of Time
constexpr uint16 HOHONORB = 220; // The Temple of Marr
constexpr uint16 NIGHTMAREB = 221; // The Lair of Terris Thule
constexpr uint16 POEARTHB = 222; // The Plane of Earth
constexpr uint16 POTIMEB = 223; // The Plane of Time
constexpr uint16 GUNTHAK = 224; // The Gulf of Gunthak
constexpr uint16 DULAK = 225; // Dulak's Harbor
constexpr uint16 TORGIRAN = 226; // The Torgiran Mines
constexpr uint16 NADOX = 227; // The Crypt of Nadox
constexpr uint16 HATESFURY = 228; // Hate's Fury
constexpr uint16 GUKA = 229; // Deepest Guk: Cauldron of Lost Souls
constexpr uint16 RUJA = 230; // The Rujarkian Hills: Bloodied Quarries
constexpr uint16 TAKA = 231; // Takish-Hiz: Sunken Library
constexpr uint16 MIRA = 232; // Miragul's Menagerie: Silent Gallery
constexpr uint16 MMCA = 233; // Mistmoore's Catacombs: Forlorn Caverns
constexpr uint16 GUKB = 234; // The Drowning Crypt
constexpr uint16 RUJB = 235; // The Rujarkian Hills: Halls of War
constexpr uint16 TAKB = 236; // Takish-Hiz: Shifting Tower
constexpr uint16 MIRB = 237; // Miragul's Menagerie: Frozen Nightmare
constexpr uint16 MMCB = 238; // Mistmoore's Catacombs: Dreary Grotto
constexpr uint16 GUKC = 239; // Deepest Guk: Ancient Aqueducts
constexpr uint16 RUJC = 240; // The Rujarkian Hills: Wind Bridges
constexpr uint16 TAKC = 241; // Takish-Hiz: Within the Compact
constexpr uint16 MIRC = 242; // The Spider Den
constexpr uint16 MMCC = 243; // Mistmoore's Catacombs: Struggles within the Progeny
constexpr uint16 GUKD = 244; // The Mushroom Grove
constexpr uint16 RUJD = 245; // The Rujarkian Hills: Prison Break
constexpr uint16 TAKD = 246; // Takish-Hiz: Royal Observatory
constexpr uint16 MIRD = 247; // Miragul's Menagerie: Hushed Banquet
constexpr uint16 MMCD = 248; // Mistmoore's Catacombs: Chambers of Eternal Affliction
constexpr uint16 GUKE = 249; // Deepest Guk: The Curse Reborn
constexpr uint16 RUJE = 250; // The Rujarkian Hills: Drudge Hollows
constexpr uint16 TAKE = 251; // Takish-Hiz: River of Recollection
constexpr uint16 MIRE = 252; // The Frosted Halls
constexpr uint16 MMCE = 253; // Mistmoore's Catacombs: Sepulcher of the Damned
constexpr uint16 GUKF = 254; // Deepest Guk: Chapel of the Witnesses
constexpr uint16 RUJF = 255; // The Rujarkian Hills: Fortified Lair of the Taskmasters
constexpr uint16 TAKF = 256; // Takish-Hiz: Sandfall Corridors
constexpr uint16 MIRF = 257; // The Forgotten Wastes
constexpr uint16 MMCF = 258; // Mistmoore's Catacombs: Scion Lair of Fury
constexpr uint16 GUKG = 259; // The Root Garden
constexpr uint16 RUJG = 260; // The Rujarkian Hills: Hidden Vale of Deceit
constexpr uint16 TAKG = 261; // Takish-Hiz: Balancing Chamber
constexpr uint16 MIRG = 262; // Miragul's Menagerie: Heart of the Menagerie
constexpr uint16 MMCG = 263; // Mistmoore's Catacombs: Cesspits of Putrescence
constexpr uint16 GUKH = 264; // Deepest Guk: Accursed Sanctuary
constexpr uint16 RUJH = 265; // The Rujarkian Hills: Blazing Forge
constexpr uint16 TAKH = 266; // Takish-Hiz: Sweeping Tides
constexpr uint16 MIRH = 267; // The Morbid Laboratory
constexpr uint16 MMCH = 268; // Mistmoore's Catacombs: Aisles of Blood
constexpr uint16 RUJI = 269; // The Rujarkian Hills: Arena of Chance
constexpr uint16 TAKI = 270; // Takish-Hiz: Antiquated Palace
constexpr uint16 MIRI = 271; // The Theater of Imprisoned Horror
constexpr uint16 MMCI = 272; // Mistmoore's Catacombs: Halls of Sanguinary Rites
constexpr uint16 RUJJ = 273; // The Rujarkian Hills: Barracks of War
constexpr uint16 TAKJ = 274; // Takish-Hiz: Prismatic Corridors
constexpr uint16 MIRJ = 275; // Miragul's Menagerie: Grand Library
constexpr uint16 MMCJ = 276; // Mistmoore's Catacombs: Infernal Sanctuary
constexpr uint16 CHARDOKB = 277; // Chardok: The Halls of Betrayal
constexpr uint16 SOLDUNGC = 278; // The Caverns of Exile
constexpr uint16 ABYSMAL = 279; // The Abysmal Sea
constexpr uint16 NATIMBI = 280; // Natimbi, the Broken Shores
constexpr uint16 QINIMI = 281; // Qinimi, Court of Nihilia
constexpr uint16 RIWWI = 282; // Riwwi, Coliseum of Games
constexpr uint16 BARINDU = 283; // Barindu, Hanging Gardens
constexpr uint16 FERUBI = 284; // Ferubi, Forgotten Temple of Taelosia
constexpr uint16 SNPOOL = 285; // Sewers of Nihilia, Pool of Sludg
constexpr uint16 SNLAIR = 286; // Sewers of Nihilia, Lair of Trapp
constexpr uint16 SNPLANT = 287; // Sewers of Nihilia, Purifying Pla
constexpr uint16 SNCREMATORY = 288; // Sewers of Nihilia, Emanating Cre
constexpr uint16 TIPT = 289; // Tipt, Treacherous Crags
constexpr uint16 VXED = 290; // Vxed, the Crumbling Caverns
constexpr uint16 YXTTA = 291; // Yxtta, Pulpit of Exiles
constexpr uint16 UQUA = 292; // Uqua, the Ocean God Chantry
constexpr uint16 KODTAZ = 293; // Kod'Taz, Broken Trial Grounds
constexpr uint16 IKKINZ = 294; // Ikkinz, Chambers of Transcendence
constexpr uint16 QVIC = 295; // Qvic, Prayer Grounds of Calling
constexpr uint16 INKTUTA = 296; // Inktu'Ta, the Unmasked Chapel
constexpr uint16 TXEVU = 297; // Txevu, Lair of the Elite
constexpr uint16 TACVI = 298; // Tacvi, The Broken Temple
constexpr uint16 QVICB = 299; // Qvic, the Hidden Vault
constexpr uint16 WALLOFSLAUGHTER = 300; // Wall of Slaughter
constexpr uint16 BLOODFIELDS = 301; // The Bloodfields
constexpr uint16 DRANIKSSCAR = 302; // Dranik's Scar
constexpr uint16 CAUSEWAY = 303; // Nobles' Causeway
constexpr uint16 CHAMBERSA = 304; // Muramite Proving Grounds
constexpr uint16 CHAMBERSB = 305; // Muramite Proving Grounds
constexpr uint16 CHAMBERSC = 306; // Muramite Proving Grounds
constexpr uint16 CHAMBERSD = 307; // Muramite Proving Grounds
constexpr uint16 CHAMBERSE = 308; // Muramite Proving Grounds
constexpr uint16 CHAMBERSF = 309; // Muramite Proving Grounds
constexpr uint16 PROVINGGROUNDS = 316; // Muramite Proving Grounds
constexpr uint16 ANGUISH = 317; // Anguish, the Fallen Palace
constexpr uint16 DRANIKHOLLOWSA = 318; // Dranik's Hollows
constexpr uint16 DRANIKHOLLOWSB = 319; // Dranik's Hollows
constexpr uint16 DRANIKHOLLOWSC = 320; // Dranik's Hollows
constexpr uint16 DRANIKCATACOMBSA = 328; // Catacombs of Dranik
constexpr uint16 DRANIKCATACOMBSB = 329; // Catacombs of Dranik
constexpr uint16 DRANIKCATACOMBSC = 330; // Catacombs of Dranik
constexpr uint16 DRANIKSEWERSA = 331; // Sewers of Dranik
constexpr uint16 DRANIKSEWERSB = 332; // Sewers of Dranik
constexpr uint16 DRANIKSEWERSC = 333; // Sewers of Dranik
constexpr uint16 RIFTSEEKERS = 334; // Riftseekers' Sanctum
constexpr uint16 HARBINGERS = 335; // Harbinger's Spire
constexpr uint16 DRANIK = 336; // The Ruined City of Dranik
constexpr uint16 BROODLANDS = 337; // The Broodlands
constexpr uint16 STILLMOONA = 338; // Stillmoon Temple
constexpr uint16 STILLMOONB = 339; // The Ascent
constexpr uint16 THUNDERCREST = 340; // Thundercrest Isles
constexpr uint16 DELVEA = 341; // Lavaspinner's Lair
constexpr uint16 DELVEB = 342; // Tirranun's Delve
constexpr uint16 THENEST = 343; // The Nest
constexpr uint16 GUILDLOBBY = 344; // Guild Lobby
constexpr uint16 GUILDHALL = 345; // Guild Hall
constexpr uint16 BARTER = 346; // The Barter Hall
constexpr uint16 ILLSALIN = 347; // Ruins of Illsalin
constexpr uint16 ILLSALINA = 348; // Illsalin Marketplace
constexpr uint16 ILLSALINB = 349; // Temple of Korlach
constexpr uint16 ILLSALINC = 350; // The Nargil Pits
constexpr uint16 DREADSPIRE = 351; // Dreadspire Keep
constexpr uint16 DRACHNIDHIVE = 354; // The Hive
constexpr uint16 DRACHNIDHIVEA = 355; // The Hatchery
constexpr uint16 DRACHNIDHIVEB = 356; // The Cocoons
constexpr uint16 DRACHNIDHIVEC = 357; // Queen Sendaii`s Lair
constexpr uint16 WESTKORLACH = 358; // Stoneroot Falls
constexpr uint16 WESTKORLACHA = 359; // Prince's Manor
constexpr uint16 WESTKORLACHB = 360; // Caverns of the Lost
constexpr uint16 WESTKORLACHC = 361; // Lair of the Korlach
constexpr uint16 EASTKORLACH = 362; // The Undershore
constexpr uint16 EASTKORLACHA = 363; // Snarlstone Dens
constexpr uint16 SHADOWSPINE = 364; // Shadow Spine
constexpr uint16 CORATHUS = 365; // Corathus Creep
constexpr uint16 CORATHUSA = 366; // Sporali Caverns
constexpr uint16 CORATHUSB = 367; // The Corathus Mines
constexpr uint16 NEKTULOSA = 368; // Shadowed Grove
constexpr uint16 ARCSTONE = 369; // Arcstone, Isle of Spirits
constexpr uint16 RELIC = 370; // Relic, the Artifact City
constexpr uint16 SKYLANCE = 371; // Skylance
constexpr uint16 DEVASTATION = 372; // The Devastation
constexpr uint16 DEVASTATIONA = 373; // The Seething Wall
constexpr uint16 RAGE = 374; // Sverag, Stronghold of Rage
constexpr uint16 RAGEA = 375; // Razorthorn, Tower of Sullon Zek
constexpr uint16 TAKISHRUINS = 376; // Ruins of Takish-Hiz
constexpr uint16 TAKISHRUINSA = 377; // The Root of Ro
constexpr uint16 ELDDAR = 378; // The Elddar Forest
constexpr uint16 ELDDARA = 379; // Tunare's Shrine
constexpr uint16 THEATER = 380; // Theater of Blood
constexpr uint16 THEATERA = 381; // Deathknell, Tower of Dissonance
constexpr uint16 FREEPORTEAST = 382; // East Freeport
constexpr uint16 FREEPORTWEST = 383; // West Freeport
constexpr uint16 FREEPORTSEWERS = 384; // Freeport Sewers
constexpr uint16 FREEPORTACADEMY = 385; // Academy of Arcane Sciences
constexpr uint16 FREEPORTTEMPLE = 386; // Temple of Marr
constexpr uint16 FREEPORTMILITIA = 387; // Freeport Militia House: My Precious
constexpr uint16 FREEPORTARENA = 388; // Arena
constexpr uint16 FREEPORTCITYHALL = 389; // City Hall
constexpr uint16 FREEPORTTHEATER = 390; // Theater of the Tranquil
constexpr uint16 FREEPORTHALL = 391; // Hall of Truth: Bounty
constexpr uint16 NORTHRO = 392; // North Desert of Ro
constexpr uint16 SOUTHRO = 393; // South Desert of Ro
constexpr uint16 CRESCENT = 394; // Crescent Reach
constexpr uint16 MOORS = 395; // Blightfire Moors
constexpr uint16 STONEHIVE = 396; // Stone Hive
constexpr uint16 MESA = 397; // Goru`kar Mesa
constexpr uint16 ROOST = 398; // Blackfeather Roost
constexpr uint16 STEPPES = 399; // The Steppes
constexpr uint16 ICEFALL = 400; // Icefall Glacier
constexpr uint16 VALDEHOLM = 401; // Valdeholm
constexpr uint16 FROSTCRYPT = 402; // Frostcrypt, Throne of the Shade King
constexpr uint16 SUNDEROCK = 403; // Sunderock Springs
constexpr uint16 VERGALID = 404; // Vergalid Mines
constexpr uint16 DIREWIND = 405; // Direwind Cliffs
constexpr uint16 ASHENGATE = 406; // Ashengate, Reliquary of the Scale
constexpr uint16 HIGHPASSHOLD = 407; // Highpass Hold
constexpr uint16 COMMONLANDS = 408; // The Commonlands
constexpr uint16 OCEANOFTEARS = 409; // The Ocean of Tears
constexpr uint16 KITHFOREST = 410; // Kithicor Forest
constexpr uint16 BEFALLENB = 411; // Befallen
constexpr uint16 HIGHPASSKEEP = 412; // HighKeep
constexpr uint16 INNOTHULEB = 413; // The Innothule Swamp
constexpr uint16 TOXXULIA = 414; // Toxxulia Forest
constexpr uint16 MISTYTHICKET = 415; // The Misty Thicket
constexpr uint16 KATTACASTRUM = 416; // Katta Castrum
constexpr uint16 THALASSIUS = 417; // Thalassius, the Coral Keep
constexpr uint16 ATIIKI = 418; // Jewel of Atiiki
constexpr uint16 ZHISZA = 419; // Zhisza, the Shissar Sanctuary
constexpr uint16 SILYSSAR = 420; // Silyssar, New Chelsith
constexpr uint16 SOLTERIS = 421; // Solteris, the Throne of Ro
constexpr uint16 BARREN = 422; // Barren Coast
constexpr uint16 BURIEDSEA = 423; // The Buried Sea
constexpr uint16 JARDELSHOOK = 424; // Jardel's Hook
constexpr uint16 MONKEYROCK = 425; // Monkey Rock
constexpr uint16 SUNCREST = 426; // Suncrest Isle
constexpr uint16 DEADBONE = 427; // Deadbone Reef
constexpr uint16 BLACKSAIL = 428; // Blacksail Folly
constexpr uint16 MAIDENSGRAVE = 429; // Maiden's Grave
constexpr uint16 REDFEATHER = 430; // Redfeather Isle
constexpr uint16 SHIPMVP = 431; // The Open Sea
constexpr uint16 SHIPMVU = 432; // The Open Sea
constexpr uint16 SHIPPVU = 433; // The Open Sea
constexpr uint16 SHIPUVU = 434; // The Open Sea
constexpr uint16 SHIPMVM = 435; // The Open Sea
constexpr uint16 MECHANOTUS = 436; // Fortress Mechanotus
constexpr uint16 MANSION = 437; // Meldrath's Majestic Mansion
constexpr uint16 STEAMFACTORY = 438; // The Steam Factory
constexpr uint16 SHIPWORKSHOP = 439; // S.H.I.P. Workshop
constexpr uint16 GYROSPIREB = 440; // Gyrospire Beza
constexpr uint16 GYROSPIREZ = 441; // Gyrospire Zeka
constexpr uint16 DRAGONSCALE = 442; // Dragonscale Hills
constexpr uint16 LOPINGPLAINS = 443; // Loping Plains
constexpr uint16 HILLSOFSHADE = 444; // Hills of Shade
constexpr uint16 BLOODMOON = 445; // Bloodmoon Keep
constexpr uint16 CRYSTALLOS = 446; // Crystallos, Lair of the Awakened
constexpr uint16 GUARDIAN = 447; // The Mechamatic Guardian
constexpr uint16 STEAMFONTMTS = 448; // The Steamfont Mountains
constexpr uint16 CRYPTOFSHADE = 449; // Crypt of Shade
constexpr uint16 DRAGONSCALEB = 451; // Deepscar's Den
constexpr uint16 OLDFIELDOFBONE = 452; // Field of Scale
constexpr uint16 OLDKAESORAA = 453; // Kaesora Library
constexpr uint16 OLDKAESORAB = 454; // Kaesora Hatchery
constexpr uint16 OLDKURN = 455; // Kurn's Tower
constexpr uint16 OLDKITHICOR = 456; // Bloody Kithicor
constexpr uint16 OLDCOMMONS = 457; // Old Commonlands
constexpr uint16 OLDHIGHPASS = 458; // Highpass Hold
constexpr uint16 THEVOIDA = 459; // The Void
constexpr uint16 THEVOIDB = 460; // The Void
constexpr uint16 THEVOIDC = 461; // The Void
constexpr uint16 THEVOIDD = 462; // The Void
constexpr uint16 THEVOIDE = 463; // The Void
constexpr uint16 THEVOIDF = 464; // The Void
constexpr uint16 THEVOIDG = 465; // The Void
constexpr uint16 OCEANGREENHILLS = 466; // Oceangreen Hills
constexpr uint16 OCEANGREENVILLAGE = 467; // Oceangreen Village
constexpr uint16 OLDBLACKBURROW = 468; // BlackBurrow
constexpr uint16 BERTOXTEMPLE = 469; // Temple of Bertoxxulous
constexpr uint16 DISCORD = 470; // Korafax, Home of the Riders
constexpr uint16 DISCORDTOWER = 471; // Citadel of the Worldslayer
constexpr uint16 OLDBLOODFIELD = 472; // Old Bloodfields
constexpr uint16 PRECIPICEOFWAR = 473; // The Precipice of War
constexpr uint16 OLDDRANIK = 474; // City of Dranik
constexpr uint16 TOSKIRAKK = 475; // Toskirakk
constexpr uint16 KORASCIAN = 476; // Korascian Warrens
constexpr uint16 RATHECHAMBER = 477; // Rathe Council Chamber
constexpr uint16 BRELLSREST = 480; // Brell's Rest
constexpr uint16 FUNGALFOREST = 481; // Fungal Forest
constexpr uint16 UNDERQUARRY = 482; // The Underquarry
constexpr uint16 COOLINGCHAMBER = 483; // The Cooling Chamber
constexpr uint16 SHININGCITY = 484; // Kernagir, the Shining City
constexpr uint16 ARTHICREX = 485; // Arthicrex
constexpr uint16 FOUNDATION = 486; // The Foundation
constexpr uint16 LICHENCREEP = 487; // Lichen Creep
constexpr uint16 PELLUCID = 488; // Pellucid Grotto
constexpr uint16 STONESNAKE = 489; // Volska's Husk
constexpr uint16 BRELLSTEMPLE = 490; // Brell's Temple
constexpr uint16 CONVORTEUM = 491; // The Convorteum
constexpr uint16 BRELLSARENA = 492; // Brell's Arena
constexpr uint16 WEDDINGCHAPEL = 493; // Wedding Chapel
constexpr uint16 WEDDINGCHAPELDARK = 494; // Wedding Chapel
constexpr uint16 DRAGONCRYPT = 495; // Lair of the Risen
constexpr uint16 FEERROTT2 = 700; // The Feerrott
constexpr uint16 THULEHOUSE1 = 701; // House of Thule
constexpr uint16 THULEHOUSE2 = 702; // House of Thule, Upper Floors
constexpr uint16 HOUSEGARDEN = 703; // The Grounds
constexpr uint16 THULELIBRARY = 704; // The Library
constexpr uint16 WELL = 705; // The Well
constexpr uint16 FALLEN = 706; // Erudin Burning
constexpr uint16 MORELLCASTLE = 707; // Morell's Castle
constexpr uint16 SOMNIUM = 708; // Sanctum Somnium
constexpr uint16 ALKABORMARE = 709; // Al'Kabor's Nightmare
constexpr uint16 MIRAGULMARE = 710; // Miragul's Nightmare
constexpr uint16 THULEDREAM = 711; // Fear Itself
constexpr uint16 NEIGHBORHOOD = 712; // Sunrise Hills
constexpr uint16 ARGATH = 724; // Argath, Bastion of Illdaera
constexpr uint16 ARELIS = 725; // Valley of Lunanyn
constexpr uint16 SARITHCITY = 726; // Sarith, City of Tides
constexpr uint16 RUBAK = 727; // Rubak Oseka, Temple of the Sea
constexpr uint16 BEASTDOMAIN = 728; // Beasts' Domain
constexpr uint16 RESPLENDENT = 729; // The Resplendent Temple
constexpr uint16 PILLARSALRA = 730; // Pillars of Alra
constexpr uint16 WINDSONG = 731; // Windsong Sanctuary
constexpr uint16 CITYOFBRONZE = 732; // Erillion, City of Bronze
constexpr uint16 SEPULCHER = 733; // Sepulcher of Order
constexpr uint16 EASTSEPULCHER = 734; // Sepulcher East
constexpr uint16 WESTSEPULCHER = 735; // Sepulcher West
constexpr uint16 SHARDSLANDING = 752; // Shard's Landing
constexpr uint16 XORBB = 753; // Valley of King Xorbb
constexpr uint16 KAELSHARD = 754; // Kael Drakkel: The King's Madness
constexpr uint16 EASTWASTESSHARD = 755; // East Wastes: Zeixshi-Kar's Awakening
constexpr uint16 CRYSTALSHARD = 756; // The Crystal Caverns: Fragment of Fear
constexpr uint16 BREEDINGGROUNDS = 757; // The Breeding Grounds
constexpr uint16 EVILTREE = 758; // Evantil, the Vile Oak
constexpr uint16 GRELLETH = 759; // Grelleth's Palace, the Chateau of Filth
constexpr uint16 CHAPTERHOUSE = 760; // Chapterhouse of the Fallen
constexpr uint16 ARTTEST = 996; // Art Testing Domain
constexpr uint16 FHALLS = 998; // The Forgotten Halls
constexpr uint16 APPRENTICE = 999; // Designer Apprentice
}
//ZoneChange_Struct->success values
#define ZONE_ERROR_NOMSG 0
#define ZONE_ERROR_NOTREADY -1
@@ -231,7 +718,7 @@ typedef enum {
FilterPetMisses = 21, //0=show, 1=hide
FilterFocusEffects = 22, //0=show, 1=hide
FilterPetSpells = 23, //0=show, 1=hide
FilterHealOverTime = 24, //0=show, 1=hide
FilterHealOverTime = 24, //0=show, 1=mine only, 2=hide
FilterUnknown25 = 25,
FilterUnknown26 = 26,
FilterUnknown27 = 27,
@@ -318,7 +805,7 @@ static const uint8 DamageTypeUnknown = 0xFF;
**
** (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,
/*1HSlashing*/ 1,
@@ -438,6 +925,10 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
static const uint32 DB_FACTION_GEM_CHOPPERS = 255;
static const uint32 DB_FACTION_HERETICS = 265;
static const uint32 DB_FACTION_KING_AKANON = 333;
enum ChatChannelNames : uint16
{
ChatChannel_Guild = 0,
@@ -464,4 +955,65 @@ namespace ZoneBlockedSpellTypes {
const uint8 Region = 2;
};
enum class DynamicZoneType
{
None = 0,
Expedition,
Tutorial,
Task,
Mission, // Shared Task
Quest
};
enum class DynamicZoneMemberStatus : uint8_t
{
Unknown = 0,
Online,
Offline,
InDynamicZone,
LinkDead
};
enum LDoNThemes {
Unused = 0,
GUK,
MIR,
MMC,
RUJ,
TAK
};
enum LDoNThemeBits {
UnusedBit = 0,
GUKBit = 1,
MIRBit = 2,
MMCBit = 4,
RUJBit = 8,
TAKBit = 16
};
enum StartZoneIndex {
Odus = 0,
Qeynos,
Halas,
Rivervale,
Freeport,
Neriak,
Grobb,
Oggok,
Kaladim,
GreaterFaydark,
Felwithe,
Akanon,
Cabilis,
SharVahl
};
enum FVNoDropFlagRule
{
Disabled = 0,
Enabled = 1,
AdminOnly = 2
};
#endif /*COMMON_EQ_CONSTANTS_H*/
+186 -186
View File
@@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -11,7 +11,7 @@
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
@@ -25,8 +25,8 @@
static bool global_dictionary_init = false;
void EQEmu::InitializeDynamicLookups() {
if (global_dictionary_init == true)
void EQ::InitializeDynamicLookups() {
if (global_dictionary_init)
return;
constants::InitializeDynamicLookups();
@@ -37,12 +37,12 @@ void EQEmu::InitializeDynamicLookups() {
global_dictionary_init = true;
}
static std::unique_ptr<EQEmu::constants::LookupEntry> constants_dynamic_nongm_lookup_entries[EQEmu::versions::ClientVersionCount];
static std::unique_ptr<EQEmu::constants::LookupEntry> constants_dynamic_gm_lookup_entries[EQEmu::versions::ClientVersionCount];
static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu::versions::ClientVersionCount] =
static std::unique_ptr<EQ::constants::LookupEntry> constants_dynamic_nongm_lookup_entries[EQ::versions::ClientVersionCount];
static std::unique_ptr<EQ::constants::LookupEntry> constants_dynamic_gm_lookup_entries[EQ::versions::ClientVersionCount];
static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::versions::ClientVersionCount] =
{
/*[ClientVersion::Unknown] =*/
EQEmu::constants::LookupEntry(
EQ::constants::LookupEntry(
ClientUnknown::constants::EXPANSION,
ClientUnknown::constants::EXPANSION_BIT,
ClientUnknown::constants::EXPANSIONS_MASK,
@@ -50,7 +50,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
ClientUnknown::INULL
),
/*[ClientVersion::Client62] =*/
EQEmu::constants::LookupEntry(
EQ::constants::LookupEntry(
Client62::constants::EXPANSION,
Client62::constants::EXPANSION_BIT,
Client62::constants::EXPANSIONS_MASK,
@@ -58,7 +58,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
Client62::INULL
),
/*[ClientVersion::Titanium] =*/
EQEmu::constants::LookupEntry(
EQ::constants::LookupEntry(
Titanium::constants::EXPANSION,
Titanium::constants::EXPANSION_BIT,
Titanium::constants::EXPANSIONS_MASK,
@@ -66,7 +66,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
Titanium::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::SoF] =*/
EQEmu::constants::LookupEntry(
EQ::constants::LookupEntry(
SoF::constants::EXPANSION,
SoF::constants::EXPANSION_BIT,
SoF::constants::EXPANSIONS_MASK,
@@ -74,7 +74,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
SoF::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::SoD] =*/
EQEmu::constants::LookupEntry(
EQ::constants::LookupEntry(
SoD::constants::EXPANSION,
SoD::constants::EXPANSION_BIT,
SoD::constants::EXPANSIONS_MASK,
@@ -82,7 +82,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
SoD::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::UF] =*/
EQEmu::constants::LookupEntry(
EQ::constants::LookupEntry(
UF::constants::EXPANSION,
UF::constants::EXPANSION_BIT,
UF::constants::EXPANSIONS_MASK,
@@ -90,7 +90,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
UF::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::RoF] =*/
EQEmu::constants::LookupEntry(
EQ::constants::LookupEntry(
RoF::constants::EXPANSION,
RoF::constants::EXPANSION_BIT,
RoF::constants::EXPANSIONS_MASK,
@@ -98,7 +98,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
RoF::constants::SAY_LINK_BODY_SIZE
),
/*[ClientVersion::RoF2] =*/
EQEmu::constants::LookupEntry(
EQ::constants::LookupEntry(
RoF2::constants::EXPANSION,
RoF2::constants::EXPANSION_BIT,
RoF2::constants::EXPANSIONS_MASK,
@@ -108,7 +108,7 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
};
static bool constants_dictionary_init = false;
void EQEmu::constants::InitializeDynamicLookups() {
void EQ::constants::InitializeDynamicLookups() {
if (constants_dictionary_init == true)
return;
constants_dictionary_init = true;
@@ -119,7 +119,7 @@ void EQEmu::constants::InitializeDynamicLookups() {
// 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)
return DynamicGMLookup(client_version);
@@ -127,7 +127,7 @@ const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicLookup(versions::C
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);
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)];
}
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);
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)];
}
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))];
}
static std::unique_ptr<EQEmu::inventory::LookupEntry> inventory_dynamic_nongm_lookup_entries[EQEmu::versions::MobVersionCount];
static std::unique_ptr<EQEmu::inventory::LookupEntry> inventory_dynamic_gm_lookup_entries[EQEmu::versions::MobVersionCount];
static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu::versions::MobVersionCount] =
static std::unique_ptr<EQ::inventory::LookupEntry> inventory_dynamic_nongm_lookup_entries[EQ::versions::MobVersionCount];
static std::unique_ptr<EQ::inventory::LookupEntry> inventory_dynamic_gm_lookup_entries[EQ::versions::MobVersionCount];
static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::versions::MobVersionCount] =
{
/*[MobVersion::Unknown] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
@@ -167,7 +167,7 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
ClientUnknown::INULL
),
ClientUnknown::INULL,
ClientUnknown::INULL,
ClientUnknown::INULL,
@@ -175,15 +175,15 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
ClientUnknown::INULL,
ClientUnknown::INULL,
ClientUnknown::INULL,
false,
false,
false,
false
),
/*[MobVersion::Client62] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
Client62::INULL, Client62::INULL, Client62::INULL,
Client62::INULL, Client62::INULL, Client62::INULL,
Client62::INULL, Client62::INULL, Client62::INULL,
@@ -194,7 +194,7 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
Client62::INULL, Client62::INULL, Client62::INULL,
Client62::INULL
),
Client62::INULL,
Client62::INULL,
Client62::INULL,
@@ -202,16 +202,16 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
Client62::INULL,
Client62::INULL,
Client62::INULL,
false,
false,
false,
false
),
/*[MobVersion::Titanium] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, Titanium::invtype::BANK_SIZE, Titanium::invtype::SHARED_BANK_SIZE,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
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::TRIBUTE_SIZE, Titanium::INULL, Titanium::invtype::GUILD_TRIBUTE_SIZE,
Titanium::invtype::MERCHANT_SIZE, Titanium::INULL, Titanium::invtype::CORPSE_SIZE,
@@ -221,7 +221,7 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
Titanium::INULL, Titanium::INULL, Titanium::INULL,
Titanium::invtype::OTHER_SIZE
),
Titanium::invslot::EQUIPMENT_BITMASK,
Titanium::invslot::GENERAL_BITMASK,
Titanium::invslot::CURSOR_BITMASK,
@@ -229,16 +229,16 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
Titanium::invslot::CORPSE_BITMASK,
Titanium::invbag::SLOT_COUNT,
Titanium::invaug::SOCKET_COUNT,
Titanium::inventory::AllowEmptyBagInBag,
Titanium::inventory::AllowClickCastFromBag,
Titanium::inventory::ConcatenateInvTypeLimbo,
Titanium::inventory::AllowOverLevelEquipment
),
/*[MobVersion::SoF] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, SoF::invtype::BANK_SIZE, SoF::invtype::SHARED_BANK_SIZE,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
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::TRIBUTE_SIZE, SoF::INULL, SoF::invtype::GUILD_TRIBUTE_SIZE,
SoF::invtype::MERCHANT_SIZE, SoF::INULL, SoF::invtype::CORPSE_SIZE,
@@ -248,7 +248,7 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
SoF::INULL, SoF::INULL, SoF::INULL,
SoF::invtype::OTHER_SIZE
),
SoF::invslot::EQUIPMENT_BITMASK,
SoF::invslot::GENERAL_BITMASK,
SoF::invslot::CURSOR_BITMASK,
@@ -256,16 +256,16 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
SoF::invslot::CORPSE_BITMASK,
SoF::invbag::SLOT_COUNT,
SoF::invaug::SOCKET_COUNT,
SoF::inventory::AllowEmptyBagInBag,
SoF::inventory::AllowClickCastFromBag,
SoF::inventory::ConcatenateInvTypeLimbo,
SoF::inventory::AllowOverLevelEquipment
),
/*[MobVersion::SoD] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, SoD::invtype::BANK_SIZE, SoD::invtype::SHARED_BANK_SIZE,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
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::TRIBUTE_SIZE, SoD::INULL, SoD::invtype::GUILD_TRIBUTE_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
),
/*[MobVersion::UF] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, UF::invtype::BANK_SIZE, UF::invtype::SHARED_BANK_SIZE,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
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::TRIBUTE_SIZE, UF::INULL, UF::invtype::GUILD_TRIBUTE_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
),
/*[MobVersion::RoF] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, RoF::invtype::BANK_SIZE, RoF::invtype::SHARED_BANK_SIZE,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
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::TRIBUTE_SIZE, RoF::invtype::TROPHY_TRIBUTE_SIZE, RoF::invtype::GUILD_TRIBUTE_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
),
/*[MobVersion::RoF2] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, RoF2::invtype::BANK_SIZE, RoF2::invtype::SHARED_BANK_SIZE,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
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::TRIBUTE_SIZE, RoF2::invtype::TROPHY_TRIBUTE_SIZE, RoF2::invtype::GUILD_TRIBUTE_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
),
/*[MobVersion::NPC] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::invtype::POSSESSIONS_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, /*InvTypeCorpseSize,*/
@@ -389,8 +389,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL,
EntityLimits::NPC::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -398,9 +398,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::NPCMerchant] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ 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, /*InvTypeCorpseSize,*/
@@ -416,8 +416,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL,
EntityLimits::NPCMerchant::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -425,9 +425,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::Merc] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ 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, /*InvTypeCorpseSize,*/
@@ -443,8 +443,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL,
EntityLimits::Merc::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -452,9 +452,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::Bot] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ 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, /*InvTypeCorpseSize,*/
@@ -470,8 +470,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::Bot::invslot::CURSOR_BITMASK,
EntityLimits::Bot::invslot::POSSESSIONS_BITMASK,
EntityLimits::Bot::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
EQEmu::invaug::SOCKET_COUNT, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
EQ::invaug::SOCKET_COUNT, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -479,9 +479,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::ClientPet] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ 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, /*InvTypeCorpseSize,*/
@@ -497,8 +497,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL,
EntityLimits::ClientPet::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -506,9 +506,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::NPCPet] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ 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, /*InvTypeCorpseSize,*/
@@ -524,8 +524,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL,
EntityLimits::NPCPet::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -533,9 +533,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::MercPet] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ 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, /*InvTypeCorpseSize,*/
@@ -551,8 +551,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL,
EntityLimits::MercPet::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -560,9 +560,9 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::BotPet] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQEmu::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::invtype::POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ 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, /*InvTypeCorpseSize,*/
@@ -578,8 +578,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL,
EntityLimits::BotPet::INULL,
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQEmu::inventory::SocketCount, /*ItemAugSize,*/
0, //EQ::inventory::ContainerCount, /*ItemBagSize,*/
0, //EQ::inventory::SocketCount, /*ItemAugSize,*/
false,
false,
@@ -587,8 +587,8 @@ static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu
false
),
/*[MobVersion::OfflineTitanium] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
Titanium::INULL, Titanium::INULL, Titanium::INULL,
Titanium::invtype::TRADE_SIZE, 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
),
/*[MobVersion::OfflineSoF] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
SoF::INULL, SoF::INULL, SoF::INULL,
SoF::invtype::TRADE_SIZE, 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
),
/*[MobVersion::OfflineSoD] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
SoD::INULL, SoD::INULL, SoD::INULL,
SoD::invtype::TRADE_SIZE, 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
),
/*[MobVersion::OfflineUF] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
UF::INULL, UF::INULL, UF::INULL,
UF::invtype::TRADE_SIZE, 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
),
/*[MobVersion::OfflineRoF] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
RoF::INULL, RoF::INULL, RoF::INULL,
RoF::invtype::TRADE_SIZE, 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
),
/*[MobVersion::OfflineRoF2] =*/
EQEmu::inventory::LookupEntry(
EQEmu::inventory::LookupEntry::InventoryTypeSize_Struct(
EQ::inventory::LookupEntry(
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
RoF2::INULL, RoF2::INULL, RoF2::INULL,
RoF2::invtype::TRADE_SIZE, 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;
void EQEmu::inventory::InitializeDynamicLookups() {
void EQ::inventory::InitializeDynamicLookups() {
if (inventory_dictionary_init == true)
return;
inventory_dictionary_init = true;
@@ -763,7 +763,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
// Notes:
// - Currently, there are only 3 known expansions that affect inventory-related settings in the clients..
// -- Expansion::PoR "Prophecy of Ro" - toggles between 24 (set) and 16 (clear) bank slots
// -- Expansion::TBS "The Buried Sea" - toggles slotPowerSource activated (set) and deactivated (clear)
// -- Expansion::TBS "The Buried Sea" - toggles slotPowerSource activated (set) and deactivated (clear)
// -- Expansion::HoT "House of Thule" - toggles slotGeneral9/slotGeneral10 activated (set) and deactivated (clear)
// - Corspe size does not appear to reflect loss of active possessions slots
// - Inspect size does not appear to reflect loss of active equipment slots
@@ -772,11 +772,11 @@ void EQEmu::inventory::InitializeDynamicLookups() {
// - General9 and General10 slots are activated by GM flag when expansion bit is (clear)
// - Obviously, the client must support the expansion to allow any (set) or override condition
const uint32 dynamic_check_mask =
const uint32 dynamic_check_mask =
(
EQEmu::expansions::bitPoR |
EQEmu::expansions::bitTBS |
EQEmu::expansions::bitHoT
EQ::expansions::bitPoR |
EQ::expansions::bitTBS |
EQ::expansions::bitHoT
);
// if all of the above expansion bits are present, then static references will suffice
@@ -784,7 +784,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
return;
// 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
if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask)
continue;
@@ -794,7 +794,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
continue;
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<mob> == (int)MobVersion::<mob>
inventory_dynamic_nongm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
inventory_dynamic_nongm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
// clamp affected fields to the lowest standard
inventory_dynamic_nongm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE; // bank size
@@ -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]->CorpseBitmask = 0; // we'll fix later
if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitPoR) {
if (RuleI(World, ExpansionSettings) & EQ::expansions::bitPoR) {
// 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;
}
if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitTBS) {
if (RuleI(World, ExpansionSettings) & EQ::expansions::bitTBS) {
// 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;
}
if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitHoT) {
if (RuleI(World, ExpansionSettings) & EQ::expansions::bitHoT) {
// 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;
}
@@ -841,7 +841,7 @@ void EQEmu::inventory::InitializeDynamicLookups() {
}
// 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
if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask)
continue;
@@ -864,18 +864,18 @@ void EQEmu::inventory::InitializeDynamicLookups() {
}
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<client> == (int)MobVersion::<client>
inventory_dynamic_gm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
inventory_dynamic_gm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = 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
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;
}
if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitTBS) {
if (~RuleI(World, ExpansionSettings) & EQ::expansions::bitTBS) {
// update power source
switch (iter) {
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
switch (iter) {
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
}
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)
return DynamicGMLookup(mob_version);
@@ -935,7 +935,7 @@ const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicLookup(versions::M
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);
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)];
}
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);
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)];
}
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))];
}
static std::unique_ptr<EQEmu::behavior::LookupEntry> behavior_dynamic_nongm_lookup_entries[EQEmu::versions::MobVersionCount];
static std::unique_ptr<EQEmu::behavior::LookupEntry> behavior_dynamic_gm_lookup_entries[EQEmu::versions::MobVersionCount];
static const EQEmu::behavior::LookupEntry behavior_static_lookup_entries[EQEmu::versions::MobVersionCount] =
static std::unique_ptr<EQ::behavior::LookupEntry> behavior_dynamic_nongm_lookup_entries[EQ::versions::MobVersionCount];
static std::unique_ptr<EQ::behavior::LookupEntry> behavior_dynamic_gm_lookup_entries[EQ::versions::MobVersionCount];
static const EQ::behavior::LookupEntry behavior_static_lookup_entries[EQ::versions::MobVersionCount] =
{
/*[MobVersion::Unknown] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
true
),
/*[MobVersion::Client62] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
true
),
/*[MobVersion::Titanium] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
Titanium::behavior::CoinHasWeight
),
/*[MobVersion::SoF] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
SoF::behavior::CoinHasWeight
),
/*[MobVersion::SoD] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
SoD::behavior::CoinHasWeight
),
/*[MobVersion::UF] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
UF::behavior::CoinHasWeight
),
/*[MobVersion::RoF] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
RoF::behavior::CoinHasWeight
),
/*[MobVersion::RoF2] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
RoF2::behavior::CoinHasWeight
),
/*[MobVersion::NPC] =*/
EQEmu::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight
EQ::behavior::LookupEntry(
EQ::behavior::CoinHasWeight
),
/*[MobVersion::NPCMerchant] =*/
EQEmu::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight
EQ::behavior::LookupEntry(
EQ::behavior::CoinHasWeight
),
/*[MobVersion::Merc] =*/
EQEmu::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight
EQ::behavior::LookupEntry(
EQ::behavior::CoinHasWeight
),
/*[MobVersion::Bot] =*/
EQEmu::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight
EQ::behavior::LookupEntry(
EQ::behavior::CoinHasWeight
),
/*[MobVersion::ClientPet] =*/
EQEmu::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight
EQ::behavior::LookupEntry(
EQ::behavior::CoinHasWeight
),
/*[MobVersion::NPCPet] =*/
EQEmu::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight
EQ::behavior::LookupEntry(
EQ::behavior::CoinHasWeight
),
/*[MobVersion::MercPet] =*/
EQEmu::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight
EQ::behavior::LookupEntry(
EQ::behavior::CoinHasWeight
),
/*[MobVersion::BotPet] =*/
EQEmu::behavior::LookupEntry(
EQEmu::behavior::CoinHasWeight
EQ::behavior::LookupEntry(
EQ::behavior::CoinHasWeight
),
/*[MobVersion::OfflineTitanium] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
Titanium::behavior::CoinHasWeight
),
/*[MobVersion::OfflineSoF] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
SoF::behavior::CoinHasWeight
),
/*[MobVersion::OfflineSoD] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
SoD::behavior::CoinHasWeight
),
/*[MobVersion::OfflineUF] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
UF::behavior::CoinHasWeight
),
/*[MobVersion::OfflineRoF] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
RoF::behavior::CoinHasWeight
),
/*[MobVersion::OfflineRoF2] =*/
EQEmu::behavior::LookupEntry(
EQ::behavior::LookupEntry(
RoF2::behavior::CoinHasWeight
)
};
static bool behavior_dictionary_init = false;
void EQEmu::behavior::InitializeDynamicLookups() {
void EQ::behavior::InitializeDynamicLookups() {
if (behavior_dictionary_init == true)
return;
behavior_dictionary_init = true;
@@ -1064,7 +1064,7 @@ void EQEmu::behavior::InitializeDynamicLookups() {
// 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)
return DynamicGMLookup(mob_version);
@@ -1072,7 +1072,7 @@ const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicLookup(versions::Mob
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);
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)];
}
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);
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)];
}
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))];
}
static std::unique_ptr<EQEmu::spells::LookupEntry> spells_dynamic_nongm_lookup_entries[EQEmu::versions::ClientVersionCount];
static std::unique_ptr<EQEmu::spells::LookupEntry> spells_dynamic_gm_lookup_entries[EQEmu::versions::ClientVersionCount];
static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::versions::ClientVersionCount] =
static std::unique_ptr<EQ::spells::LookupEntry> spells_dynamic_nongm_lookup_entries[EQ::versions::ClientVersionCount];
static std::unique_ptr<EQ::spells::LookupEntry> spells_dynamic_gm_lookup_entries[EQ::versions::ClientVersionCount];
static const EQ::spells::LookupEntry spells_static_lookup_entries[EQ::versions::ClientVersionCount] =
{
/*[ClientVersion::Unknown] =*/
EQEmu::spells::LookupEntry(
EQ::spells::LookupEntry(
ClientUnknown::INULL,
ClientUnknown::INULL,
ClientUnknown::INULL,
@@ -1113,7 +1113,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
ClientUnknown::INULL
),
/*[ClientVersion::Client62] =*/
EQEmu::spells::LookupEntry(
EQ::spells::LookupEntry(
Client62::INULL,
Client62::INULL,
Client62::INULL,
@@ -1126,7 +1126,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
Client62::INULL
),
/*[ClientVersion::Titanium] =*/
EQEmu::spells::LookupEntry(
EQ::spells::LookupEntry(
Titanium::spells::SPELL_ID_MAX,
Titanium::spells::SPELLBOOK_SIZE,
Titanium::spells::SPELL_GEM_COUNT,
@@ -1139,7 +1139,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
Titanium::spells::MERC_BUFFS
),
/*[ClientVersion::SoF] =*/
EQEmu::spells::LookupEntry(
EQ::spells::LookupEntry(
SoF::spells::SPELL_ID_MAX,
SoF::spells::SPELLBOOK_SIZE,
SoF::spells::SPELL_GEM_COUNT,
@@ -1152,7 +1152,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
SoF::spells::MERC_BUFFS
),
/*[ClientVersion::SoD] =*/
EQEmu::spells::LookupEntry(
EQ::spells::LookupEntry(
SoD::spells::SPELL_ID_MAX,
SoD::spells::SPELLBOOK_SIZE,
SoD::spells::SPELL_GEM_COUNT,
@@ -1165,7 +1165,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
SoD::spells::MERC_BUFFS
),
/*[ClientVersion::UF] =*/
EQEmu::spells::LookupEntry(
EQ::spells::LookupEntry(
UF::spells::SPELL_ID_MAX,
UF::spells::SPELLBOOK_SIZE,
UF::spells::SPELL_GEM_COUNT,
@@ -1178,7 +1178,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
UF::spells::MERC_BUFFS
),
/*[ClientVersion::RoF] =*/
EQEmu::spells::LookupEntry(
EQ::spells::LookupEntry(
RoF::spells::SPELL_ID_MAX,
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
@@ -1191,7 +1191,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
RoF::spells::MERC_BUFFS
),
/*[ClientVersion::RoF2] =*/
EQEmu::spells::LookupEntry(
EQ::spells::LookupEntry(
RoF2::spells::SPELL_ID_MAX,
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
@@ -1206,18 +1206,18 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
};
static bool spells_dictionary_init = false;
void EQEmu::spells::InitializeDynamicLookups() {
void EQ::spells::InitializeDynamicLookups() {
if (spells_dictionary_init == true)
return;
spells_dictionary_init = true;
if (RuleB(World, UseClientBasedExpansionSettings))
return;
// 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)
return DynamicGMLookup(client_version);
@@ -1225,7 +1225,7 @@ const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicLookup(versions::ClientV
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);
if (spells_dynamic_nongm_lookup_entries[static_cast<int>(client_version)])
@@ -1234,16 +1234,16 @@ const EQEmu::spells::LookupEntry* EQEmu::spells::DynamicNonGMLookup(versions::Cl
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);
if (spells_dynamic_gm_lookup_entries[static_cast<int>(client_version)])
return spells_dynamic_gm_lookup_entries[static_cast<int>(client_version)].get();
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))];
}
+10 -10
View File
@@ -31,13 +31,13 @@
#include "../common/patches/rof2_limits.h"
namespace EQEmu
namespace EQ
{
void InitializeDynamicLookups();
namespace constants {
struct LookupEntry {
EQEmu::expansions::Expansion Expansion;
EQ::expansions::Expansion Expansion;
uint32 ExpansionBit;
uint32 ExpansionsMask;
int16 CharacterCreationLimit;
@@ -45,7 +45,7 @@ namespace EQEmu
LookupEntry(const LookupEntry *lookup_entry) { }
LookupEntry(
EQEmu::expansions::Expansion Expansion,
EQ::expansions::Expansion Expansion,
uint32 ExpansionBit,
uint32 ExpansionsMask,
int16 CharacterCreationLimit,
@@ -111,7 +111,7 @@ namespace EQEmu
union {
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;
@@ -244,9 +244,9 @@ namespace ClientUnknown
const int16 INULL = 0;
namespace constants {
const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::EverQuest;
const uint32 EXPANSION_BIT = EQEmu::expansions::bitEverQuest;
const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskEverQuest;
const EQ::expansions::Expansion EXPANSION = EQ::expansions::Expansion::EverQuest;
const uint32 EXPANSION_BIT = EQ::expansions::bitEverQuest;
const uint32 EXPANSIONS_MASK = EQ::expansions::maskEverQuest;
} // namespace constants
@@ -258,9 +258,9 @@ namespace Client62
const int16 INULL = 0;
namespace constants {
const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::EverQuest;
const uint32 EXPANSION_BIT = EQEmu::expansions::bitEverQuest;
const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskEverQuest;
const EQ::expansions::Expansion EXPANSION = EQ::expansions::Expansion::EverQuest;
const uint32 EXPANSION_BIT = EQ::expansions::bitEverQuest;
const uint32 EXPANSIONS_MASK = EQ::expansions::maskEverQuest;
} // namespace constants
+332 -137
View File
@@ -35,6 +35,8 @@ static const uint32 MAX_MERC = 100;
static const uint32 MAX_MERC_GRADES = 10;
static const uint32 MAX_MERC_STANCES = 10;
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
struct CharSelectEquip : EQEmu::textures::Texture_Struct, EQEmu::textures::Tint_Struct {};
struct CharSelectEquip : EQ::textures::Texture_Struct, EQ::textures::Tint_Struct {};
// RoF2-based hybrid struct
struct CharacterSelectEntry_Struct
@@ -142,7 +144,7 @@ struct CharacterSelectEntry_Struct
uint16 Instance;
uint8 Gender;
uint8 Face;
CharSelectEquip Equip[EQEmu::textures::materialCount];
CharSelectEquip Equip[EQ::textures::materialCount];
uint8 Unknown15; // Seen FF
uint8 Unknown19; // Seen FF
uint32 DrakkinTattoo;
@@ -251,7 +253,7 @@ struct Spawn_Struct {
/*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner
/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader
/*0194*/ uint8 unknown0194[3];
/*0197*/ EQEmu::TextureProfile equipment;
/*0197*/ EQ::TextureProfile equipment;
/*0233*/ float runspeed; // Speed when running
/*0036*/ uint8 afk; // 0=no, 1=afk
/*0238*/ uint32 guildID; // Current guild
@@ -282,7 +284,7 @@ union
/*0340*/ uint32 spawnId; // Spawn Id
/*0344*/ float bounding_radius; // used in melee, overrides calc
/*0347*/ uint8 IsMercenary;
/*0348*/ EQEmu::TintProfile equipment_tint;
/*0348*/ EQ::TintProfile equipment_tint;
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
/*0385*/
@@ -372,14 +374,19 @@ struct NewZone_Struct {
/*0684*/ uint16 zone_id;
/*0686*/ uint16 zone_instance;
/*0688*/ uint32 unknown688;
/*0692*/ uint8 unknown692[8];
/*0700*/ float fog_density;
/*0704*/ uint32 SuspendBuffs;
/*0708*/ uint32 FastRegenHP;
/*0712*/ uint32 FastRegenMana;
/*0716*/ uint32 FastRegenEndurance;
/*0720*/ uint32 NPCAggroMaxDist;
/*0724*/
/*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;
/*0704*/ uint32 suspend_buffs;
/*0708*/ uint32 fast_regen_hp;
/*0712*/ uint32 fast_regen_mana;
/*0716*/ uint32 fast_regen_endurance;
/*0720*/ uint32 npc_aggro_max_dist;
/*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*/ uint32 lava_damage; // Seen 50
/*0732*/ uint32 min_lava_damage; // Seen 10
/*0736*/
};
/*
@@ -441,6 +448,7 @@ struct ManaChange_Struct
/*08*/ uint32 spell_id;
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
/*16*/ int32 slot; // -1 normal, otherwise clear ETA and GCD
};
struct SwapSpell_Struct
@@ -734,7 +742,7 @@ struct BandolierItem_Struct
struct Bandolier_Struct
{
char Name[32];
BandolierItem_Struct Items[EQEmu::profile::BANDOLIER_ITEM_COUNT];
BandolierItem_Struct Items[EQ::profile::BANDOLIER_ITEM_COUNT];
};
//len = 72
@@ -748,7 +756,7 @@ struct PotionBeltItem_Struct
//len = 288
struct PotionBelt_Struct
{
PotionBeltItem_Struct Items[EQEmu::profile::POTION_BELT_SIZE];
PotionBeltItem_Struct Items[EQ::profile::POTION_BELT_SIZE];
};
struct MovePotionToBelt_Struct
@@ -824,7 +832,7 @@ struct LeadershipAA_Struct {
* Size: 20 Octets
*/
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -839,7 +847,7 @@ struct SuspendedMinion_Struct
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ EQEmu::TextureMaterialProfile Items;
/*510*/ EQ::TextureMaterialProfile Items;
/*546*/ char Name[64];
/*610*/
};
@@ -931,7 +939,7 @@ struct PlayerProfile_Struct
/*0245*/ uint8 guildbanker;
/*0246*/ uint8 unknown0246[6]; //
/*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;
/*0296*/ uint8 haircolor; // Player hair color
/*0297*/ uint8 beardcolor; // Player beard color
@@ -944,9 +952,9 @@ struct PlayerProfile_Struct
/*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder
/*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];
/*0392*/ EQEmu::TintProfile item_tint;
/*0392*/ EQ::TintProfile item_tint;
/*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY];
/*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right
@@ -970,9 +978,9 @@ struct PlayerProfile_Struct
/*2505*/ uint8 unknown2541[47]; // ?
/*2552*/ uint8 languages[MAX_PP_LANGUAGE];
/*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
/*4632*/ uint32 mem_spells[EQEmu::spells::SPELL_GEM_COUNT];
/*4632*/ uint32 mem_spells[EQ::spells::SPELL_GEM_COUNT];
/*4668*/ uint8 unknown4704[32]; //
/*4700*/ float y; // Player y position
/*4704*/ float x; // Player x position
@@ -1048,7 +1056,7 @@ struct PlayerProfile_Struct
/*7212*/ uint32 tribute_points;
/*7216*/ uint32 unknown7252;
/*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;
/*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use)
/*7744*/ char unknown7780[160];
@@ -1075,7 +1083,7 @@ struct PlayerProfile_Struct
/*12800*/ uint32 expAA;
/*12804*/ uint32 aapoints; //avaliable, unspent
/*12808*/ uint8 unknown12844[36];
/*12844*/ Bandolier_Struct bandoliers[EQEmu::profile::BANDOLIERS_SIZE];
/*12844*/ Bandolier_Struct bandoliers[EQ::profile::BANDOLIERS_SIZE];
/*14124*/ uint8 unknown14160[4506];
/*18630*/ SuspendedMinion_Struct SuspendedMinion; // No longer in use
/*19240*/ uint32 timeentitledonaccount;
@@ -1093,16 +1101,16 @@ struct PlayerProfile_Struct
/*19568*/
// 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; }
void SetPlayerProfileVersion(EQEmu::versions::MobVersion mob_version) { m_player_profile_version = EQEmu::versions::ValidateMobVersion(mob_version); }
void SetPlayerProfileVersion(EQEmu::versions::ClientVersion client_version) { SetPlayerProfileVersion(EQEmu::versions::ConvertClientVersionToMobVersion(client_version)); }
EQ::versions::MobVersion PlayerProfileVersion() { return m_player_profile_version; }
void SetPlayerProfileVersion(EQ::versions::MobVersion mob_version) { m_player_profile_version = EQ::versions::ValidateMobVersion(mob_version); }
void SetPlayerProfileVersion(EQ::versions::ClientVersion client_version) { SetPlayerProfileVersion(EQ::versions::ConvertClientVersionToMobVersion(client_version)); }
private:
// 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
EQEmu::versions::MobVersion m_player_profile_version;
EQ::versions::MobVersion m_player_profile_version;
};
@@ -1213,7 +1221,7 @@ struct WearChange_Struct {
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ uint32 hero_forge_model; // New to VoA
/*018*/ uint32 unknown18; // New to RoF
/*022*/ EQEmu::textures::Tint_Struct color;
/*022*/ EQ::textures::Tint_Struct color;
/*026*/ uint8 wear_slot_id;
/*027*/
};
@@ -1767,7 +1775,7 @@ struct GMZoneRequest_Struct {
/*0068*/ float x;
/*0072*/ float y;
/*0076*/ float z;
/*0080*/ char unknown0080[4];
/*0080*/ float heading;
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
/*0088*/
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
@@ -2121,36 +2129,36 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
EQEmu::ItemData item;
EQ::ItemData item;
uint8 iss_unknown001[6];
};*/
struct Illusion_Struct { //size: 256 - SoF
/*000*/ uint32 spawnid;
/*004*/ char charname[64]; //
/*068*/ uint16 race; //
/*070*/ char unknown006[2];
/*072*/ uint8 gender;
/*073*/ uint8 texture;
/*074*/ uint8 unknown008; //
/*075*/ uint8 unknown009; //
/*076*/ uint8 helmtexture; //
/*077*/ uint8 unknown010; //
/*078*/ uint8 unknown011; //
/*079*/ uint8 unknown012; //
/*080*/ uint32 face; //
/*084*/ uint8 hairstyle; //
/*085*/ uint8 haircolor; //
/*086*/ uint8 beard; //
/*087*/ uint8 beardcolor; //
/*088*/ float size; //
/*092*/ uint32 drakkin_heritage; //
/*096*/ uint32 drakkin_tattoo; //
/*100*/ uint32 drakkin_details; //
/*104*/ EQEmu::TintProfile armor_tint; //
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
/*142*/ uint8 unknown138[114]; //
/*000*/ uint32 spawnid;
/*004*/ char charname[64]; //
/*068*/ uint16 race; //
/*070*/ char unknown006[2];
/*072*/ uint8 gender;
/*073*/ uint8 texture;
/*074*/ uint8 unknown008; //
/*075*/ uint8 unknown009; //
/*076*/ uint8 helmtexture; //
/*077*/ uint8 unknown010; //
/*078*/ uint8 unknown011; //
/*079*/ uint8 unknown012; //
/*080*/ uint32 face; //
/*084*/ uint8 hairstyle; //
/*085*/ uint8 haircolor; //
/*086*/ uint8 beard; //
/*087*/ uint8 beardcolor; //
/*088*/ float size; //
/*092*/ uint32 drakkin_heritage; //
/*096*/ uint32 drakkin_tattoo; //
/*100*/ uint32 drakkin_details; //
/*104*/ EQ::TintProfile armor_tint; //
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
/*142*/ uint8 unknown138[114]; //
/*256*/
};
@@ -2180,22 +2188,23 @@ struct QuestReward_Struct
/*024*/ uint32 silver; // Gives silver to the client
/*028*/ uint32 gold; // Gives gold to the client
/*032*/ uint32 platinum; // Gives platinum to the client
/*036*/ uint32 item_id;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044;
/*048*/ uint32 unknown048;
/*052*/ uint32 unknown052;
/*056*/ uint32 unknown056;
/*060*/ uint32 unknown060;
/*064*/ uint32 unknown064;
/*036*/ int32 item_id[QUESTREWARD_COUNT]; // -1 for nothing
/*068*/
};
struct CashReward_Struct
{
/*000*/ uint32 copper;
/*004*/ uint32 silver;
/*008*/ uint32 gold;
/*012*/ uint32 platinum;
};
// Size: 8
struct Camera_Struct
{
uint32 duration; // Duration in ms
uint32 intensity; // Between 1023410176 and 1090519040
float intensity;
};
struct ZonePoint_Entry {
@@ -2315,9 +2324,12 @@ struct FaceChange_Struct {
/*004*/ uint8 hairstyle;
/*005*/ uint8 beard;
/*006*/ uint8 face;
/*007*/ uint32 drakkin_heritage;
/*011*/ uint32 drakkin_tattoo;
/*015*/ uint32 drakkin_details;
/*007*/ uint8 unused_padding;
/*008*/ uint32 drakkin_heritage;
/*012*/ uint32 drakkin_tattoo;
/*016*/ uint32 drakkin_details;
/*020*/ uint32 entity_id;
/*024*/
//there are only 10 faces for barbs changing woad just
//increase the face value by ten so if there were 8 woad
//designs then there would be 80 barb faces
@@ -2761,7 +2773,7 @@ struct EnvDamage2_Struct {
/*0004*/ uint16 unknown4;
/*0006*/ uint32 damage;
/*0010*/ uint8 unknown10[12];
/*0022*/ uint8 dmgtype; //FA = Lava; FC = Falling
/*0022*/ uint8 dmgtype; // FA = Lava, FB = Drowning, FC = Falling, FD = Trap
/*0023*/ uint8 unknown2[4];
/*0027*/ uint16 constant; //Always FFFF
/*0029*/ uint16 unknown29;
@@ -2972,6 +2984,12 @@ struct ItemViewRequest_Struct {
/*046*/ char unknown046[2];
};
struct ItemAdvancedLoreText_Struct {
int32 item_id;
char item_name[64];
char advanced_lore[ADVANCED_LORE_LENGTH];
};
struct LDONItemViewRequest_Struct {
uint32 item_id;
uint8 unknown004[4];
@@ -3243,7 +3261,7 @@ struct TraderClick_Struct{
};
struct FormattedMessage_Struct{
uint32 unknown0;
uint32 unknown0; // 1 means from world server
uint32 string_id;
uint32 type;
char message[0];
@@ -3251,7 +3269,7 @@ struct FormattedMessage_Struct{
struct SimpleMessage_Struct{
uint32 string_id;
uint32 color;
uint32 unknown8;
uint32 unknown8; // 1 means from world server
};
struct GuildMemberUpdate_Struct {
@@ -3488,8 +3506,8 @@ struct SelectTributeReply_Struct {
struct TributeInfo_Struct {
uint32 active; //0 == inactive, 1 == active
uint32 tributes[EQEmu::invtype::TRIBUTE_SIZE]; //-1 == NONE
uint32 tiers[EQEmu::invtype::TRIBUTE_SIZE]; //all 00's
uint32 tributes[EQ::invtype::TRIBUTE_SIZE]; //-1 == NONE
uint32 tiers[EQ::invtype::TRIBUTE_SIZE]; //all 00's
uint32 tribute_master_id;
};
@@ -3614,14 +3632,17 @@ struct LevelAppearance_Struct { //Sends a little graphic on level up
};
struct MerchantList {
uint32 id;
uint32 slot;
uint32 item;
int16 faction_required;
int8 level_required;
uint16 alt_currency_cost;
uint32 classes_required;
uint8 probability;
uint32 id;
uint32 slot;
uint32 item;
int16 faction_required;
int8 level_required;
uint16 alt_currency_cost;
uint32 classes_required;
uint8 probability;
std::string bucket_name;
std::string bucket_value;
uint8 bucket_comparison;
};
struct TempMerchantList {
@@ -3710,17 +3731,66 @@ struct SetTitleReply_Struct {
uint32 entity_id;
};
struct TaskMemberList_Struct {
/*00*/ uint32 gopher_id;
/*04*/ uint32 unknown04;
/*08*/ uint32 member_count; //1 less than the number of members
/*12*/ char list_pointer[0];
struct SharedTaskMemberList_Struct {
/*00*/ uint32 gopher_id;
/*04*/ uint32 unknown04;
/*08*/ uint32 member_count; //1 less than the number of members
///*12*/ char list_pointer[0];
char member_name[1]; //null terminated string
uint32 monster_mission; // class chosen
uint8 task_leader; //boolean flag
/* list is of the form:
char member_name[1] //null terminated string
uint8 task_leader //boolean flag
*/
};
struct SharedTaskQuit_Struct {
int32 field1;
int32 field2;
int32 field3;
};
struct SharedTaskAddPlayer_Struct {
int32 field1;
int32 field2;
char player_name[64];
};
struct SharedTaskMakeLeader_Struct {
int32 field1;
int32 field2;
char player_name[64];
};
struct SharedTaskRemovePlayer_Struct {
int32 field1;
int32 field2;
char player_name[64];
};
struct SharedTaskInvite_Struct {
int32_t unknown00; // probably the unique character id sent in some packets
int32_t invite_id; // invite id sent back in response
char task_name[64];
char inviter_name[64];
};
struct SharedTaskInviteResponse_Struct {
int32_t unknown00; // 0
int32_t invite_id; // same id sent in the invite, probably for server verification
int8_t accepted; // 0: declined 1: accepted
int8_t padding[3]; // padding garbage probably
};
struct SharedTaskAccept_Struct {
int32_t unknown00;
int32_t unknown04;
uint32_t npc_entity_id; // npc task giver entity id (sent in selection window)
uint32_t task_id;
float reward_multiplier; // added after titanium (sent in selection window)
};
#if 0
// Old struct not used by Task System implementation but left for reference
@@ -3813,7 +3883,7 @@ struct TaskHistory_Struct {
#endif
struct AcceptNewTask_Struct {
uint32 unknown00;
uint32 task_type; // type sent in selection window
uint32 task_id; //set to 0 for 'decline'
uint32 task_master_id; //entity ID
};
@@ -4287,8 +4357,8 @@ struct AARankPrereq_Struct
struct AARankEffect_Struct
{
int32 effect_id;
int32 base1;
int32 base2;
int32 base_value;
int32 limit_value;
int32 slot;
};
@@ -4296,8 +4366,8 @@ struct AARankEffect_Struct
struct AA_Ability {
/*00*/ uint32 skill_id;
/*04*/ uint32 base1;
/*08*/ uint32 base2;
/*04*/ uint32 base_value;
/*08*/ uint32 limit_value;
/*12*/ uint32 slot;
};
@@ -4400,7 +4470,7 @@ struct AnnoyingZoneUnknown_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...
};
@@ -4831,17 +4901,99 @@ struct BuffIcon_Struct
BuffIconEntry_Struct entries[0];
};
struct ExpeditionInfo_Struct
struct ExpeditionInvite_Struct
{
/*000*/ uint32 max_players;
/*004*/ char expedition_name[128];
/*132*/ char leader_name[64];
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004; // added after titanium
/*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];
/*064*/ char expedition_name[64];
/*000*/ uint32 unknown000;
/*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 DynamicZoneInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004; // added after titanium
/*008*/ uint32 assigned; // padded bool, 0: clear info, 1: fill window info
/*012*/ uint32 max_players;
/*016*/ char dz_name[128];
/*144*/ char leader_name[64];
//*208*/ uint32 dz_type; // only in newer clients, if not 1 (expedition type) window does not auto show when dz info assigned
};
struct DynamicZoneMemberEntry_Struct
{
/*000*/ char name[64]; // variable length, null terminated, max 0x40 (64)
/*064*/ uint8 online_status; // 0: unknown, 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct DynamicZoneMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
};
struct DynamicZoneMemberListName_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 DynamicZoneLeaderName_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
@@ -4849,48 +5001,67 @@ struct ExpeditionExpireWarning
/*008*/ uint32 minutes_remaining;
};
struct ExpeditionCompassEntry_Struct
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint32 enabled; //guess
/*004*/ float y;
/*008*/ float x;
/*012*/ float z;
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 dz_switch_id;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct ExpeditionCompass_Struct
struct DynamicZoneCompass_Struct
{
/*000*/ uint32 client_id;
/*000*/ uint32 count;
/*004*/ ExpeditionCompassEntry_Struct entries[0];
/*004*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct ExpeditionMemberEntry_Struct
struct DynamicZoneChooseZoneEntry_Struct
{
char name[64];
char status;
/*000*/ uint16 dz_zone_id; // dz_id pair
/*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;
/*004*/ ExpeditionMemberEntry_Struct entries[0];
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct ExpeditionLockoutEntry_Struct
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 time_left;
/*004*/ char expedition[128];
/*132*/ char expedition_event[128];
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*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;
/*004*/ ExpeditionLockoutEntry_Struct entries[0];
};
struct ExpeditionLeaderSet_Struct
{
/*000*/ char leader_name[64];
/*000*/ char char_name[64];
/*064*/ uint32 unknown064; // always 0
/*068*/ uint8 kick_expedition; // true if /kickplayers exp
/*069*/ uint8 kick_task; // true if /kickplayers task
/*070*/ uint8 padding[2];
};
struct CorpseDrag_Struct
@@ -5340,18 +5511,20 @@ struct MercenaryMerchantResponse_Struct {
struct ServerLootItem_Struct {
uint32 item_id; // uint32 item_id;
int16 equip_slot; // int16 equip_slot;
uint16 charges; // uint8 charges;
uint16 lootslot; // uint16 lootslot;
uint32 aug_1; // uint32 aug_1;
uint32 aug_2; // uint32 aug_2;
uint32 aug_3; // uint32 aug_3;
uint32 aug_4; // uint32 aug_4;
uint32 aug_5; // uint32 aug_5;
uint32 aug_6; // uint32 aug_5;
uint8 attuned;
uint8 min_level;
uint8 max_level;
int16 equip_slot; // int16 equip_slot;
uint16 charges; // uint8 charges;
uint16 lootslot; // uint16 lootslot;
uint32 aug_1; // uint32 aug_1;
uint32 aug_2; // uint32 aug_2;
uint32 aug_3; // uint32 aug_3;
uint32 aug_4; // uint32 aug_4;
uint32 aug_5; // uint32 aug_5;
uint32 aug_6; // uint32 aug_5;
uint8 attuned;
uint16 trivial_min_level;
uint16 trivial_max_level;
uint16 npc_min_level;
uint16 npc_max_level;
};
//Found in client near a ref to the string:
@@ -5423,6 +5596,28 @@ struct SayLinkBodyFrame_Struct {
/*056*/
};
struct Checksum_Struct {
uint64 checksum;
uint8 data[2048];
};
struct UpdateMovementEntry {
/* 00 */ float Y;
/* 04 */ float X;
/* 08 */ float Z;
/* 12 */ uint8 type;
/* 13 */ unsigned int timestamp;
/* 17 */
};
struct UnderWorld {
/* 00 */ int spawn_id;
/* 04 */ float y;
/* 08 */ float x;
/* 12 */ float z;
/* 16 */
};
// Restore structure packing to default
#pragma pack()
+7 -7
View File
@@ -23,7 +23,7 @@
#include "op_codes.h"
#include "crc16.h"
#include "platform.h"
#include "string_util.h"
#include "strings.h"
#include <string>
#include <iomanip>
@@ -406,7 +406,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
if(uint16(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 (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) {
Log(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L,
@@ -453,7 +453,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
(unsigned long)ntohl(ClientStats->packets_received), (unsigned long)ntohl(ClientStats->packets_sent), (unsigned long)ntohl(ClientStats->last_local_delta),
(unsigned long)ntohl(ClientStats->low_delta), (unsigned long)ntohl(ClientStats->average_delta),
(unsigned long)ntohl(ClientStats->high_delta), (unsigned long)ntohl(ClientStats->last_remote_delta));
AdjustRates(ntohl(ClientStats->average_delta));
if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) {
@@ -951,7 +951,7 @@ EQRawApplicationPacket *p=nullptr;
EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode);
if (emu_op == OP_Unknown) {
// Log(Logs::General, Logs::Client_Server_Packet_Unhandled, "Unknown :: [%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->opcode, p->Size(), DumpPacketToString(p).c_str());
}
}
p->SetOpcode(emu_op);
}
}
@@ -1359,11 +1359,11 @@ void EQStream::AdjustRates(uint32 average_delta)
DecayRate=DECAYBASE/average_delta;
if (BytesWritten > RateThreshold)
BytesWritten = RateThreshold + DecayRate;
Log(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
Log(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
RateThreshold, DecayRate, average_delta);
MRate.unlock();
} else {
Log(Logs::Detail, Logs::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L,
Log(Logs::Detail, Logs::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L,
average_delta, AVERAGE_DELTA_MAX);
AverageDelta = AVERAGE_DELTA_MAX;
}
@@ -1374,7 +1374,7 @@ void EQStream::AdjustRates(uint32 average_delta)
BytesWritten = 0;
RateThreshold=RATEBASE/average_delta;
DecayRate=DECAYBASE/average_delta;
Log(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
Log(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
RateThreshold, DecayRate, average_delta);
MRate.unlock();
}
+11 -6
View File
@@ -218,13 +218,13 @@ class EQStream : public EQStreamInterface {
void init(bool resetSession=true);
public:
EQStream() { init(); remote_ip = 0; remote_port = 0; State = UNESTABLISHED;
StreamType = UnknownStream; compressed = true; encoded = false; app_opcode_size = 2;
bytes_sent = 0; bytes_recv = 0; create_time = Timer::GetTimeSeconds(); sessionAttempts = 0;
EQStream() { init(); remote_ip = 0; remote_port = 0; State = UNESTABLISHED;
StreamType = UnknownStream; compressed = true; encoded = false; app_opcode_size = 2;
bytes_sent = 0; bytes_recv = 0; create_time = Timer::GetTimeSeconds(); sessionAttempts = 0;
streamactive = false; }
EQStream(sockaddr_in addr) { init(); remote_ip = addr.sin_addr.s_addr;
remote_port = addr.sin_port; State = UNESTABLISHED; StreamType = UnknownStream;
compressed = true; encoded = false; app_opcode_size = 2; bytes_sent = 0; bytes_recv = 0;
EQStream(sockaddr_in addr) { init(); remote_ip = addr.sin_addr.s_addr;
remote_port = addr.sin_port; State = UNESTABLISHED; StreamType = UnknownStream;
compressed = true; encoded = false; app_opcode_size = 2; bytes_sent = 0; bytes_recv = 0;
create_time = Timer::GetTimeSeconds(); }
virtual ~EQStream() { RemoveData(); SetState(CLOSED); }
void SetMaxLen(uint32 length) { MaxLen=length; }
@@ -243,6 +243,11 @@ class EQStream : public EQStreamInterface {
virtual void SetOpcodeManager(OpcodeManager **opm) { OpMgr = opm; }
virtual OpcodeManager* GetOpcodeManager() const
{
return (*OpMgr);
};
void CheckTimeout(uint32 now, uint32 timeout=30);
bool HasOutgoingData();
void Process(const unsigned char *data, const uint32 length);
+3 -2
View File
@@ -30,7 +30,7 @@ struct EQStreamManagerInterfaceOptions
//World seems to support both compression and xor zone supports one or the others.
//Enforce one or the other in the convienence construct
//Login I had trouble getting to recognize compression at all
//Login I had trouble getting to recognize compression at all
//but that might be because it was still a bit buggy when i was testing that.
if (compressed) {
daybreak_options.encode_passes[0] = EQ::Net::EncodeCompression;
@@ -100,7 +100,8 @@ public:
virtual MatchState CheckSignature(const Signature *sig) { return MatchFailed; }
virtual EQStreamState GetState() = 0;
virtual void SetOpcodeManager(OpcodeManager **opm) = 0;
virtual const EQEmu::versions::ClientVersion ClientVersion() const { return EQEmu::versions::ClientVersion::Unknown; }
virtual OpcodeManager* GetOpcodeManager() const = 0;
virtual const EQ::versions::ClientVersion ClientVersion() const { return EQ::versions::ClientVersion::Unknown; }
virtual Stats GetStats() const = 0;
virtual void ResetStats() = 0;
virtual EQStreamManagerInterface* GetManager() const = 0;
+7 -6
View File
@@ -22,7 +22,7 @@ std::string EQStreamProxy::Describe() const {
return(m_structs->Describe());
}
const EQEmu::versions::ClientVersion EQStreamProxy::ClientVersion() const
const EQ::versions::ClientVersion EQStreamProxy::ClientVersion() const
{
return m_structs->ClientVersion();
}
@@ -38,12 +38,8 @@ void EQStreamProxy::SetOpcodeManager(OpcodeManager **opm)
}
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
if(p == nullptr)
if (p == nullptr) {
return;
if (p->GetOpcode() != OP_SpecialMesg) {
Log(Logs::General, Logs::PacketServerClient, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
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();
@@ -112,3 +108,8 @@ bool EQStreamProxy::CheckState(EQStreamState state) {
return false;
}
OpcodeManager *EQStreamProxy::GetOpcodeManager() const
{
return (*m_opcodes);
}
+4 -2
View File
@@ -28,19 +28,21 @@ public:
virtual void RemoveData();
virtual bool CheckState(EQStreamState state);
virtual std::string Describe() const;
virtual const EQEmu::versions::ClientVersion ClientVersion() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
virtual EQStreamState GetState();
virtual void SetOpcodeManager(OpcodeManager **opm);
virtual Stats GetStats() const;
virtual void ResetStats();
virtual EQStreamManagerInterface* GetManager() const;
virtual OpcodeManager* GetOpcodeManager() const;
protected:
std::shared_ptr<EQStreamInterface> const m_stream; //we own this stream object.
const StructStrategy *const m_structs; //we do not own this object.
//this is a pointer to a pointer to make it less likely that a packet will
//reference an invalid opcode manager when they are being reloaded.
OpcodeManager **const m_opcodes; //we do not own this object.
OpcodeManager **const m_opcodes;
//we do not own this object.
};
#endif /*EQSTREAMPROXY_H_*/
+32 -1
View File
@@ -44,6 +44,12 @@ void EQEmuConfig::parse_config()
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") { LoginLegacy = true; }
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
LoginPassword = _root["server"]["world"]["loginserver"].get("password", "").asString();
// at least today, this is wrong a majority of the time
// remove this if eqemulator ever upgrades its loginserver
if (LoginHost.find("login.eqemulator.net") != std::string::npos) {
LoginLegacy = true;
}
}
else {
char str[32];
@@ -62,17 +68,25 @@ void EQEmuConfig::parse_config()
loginconfig->LoginLegacy = false;
if (_root["server"]["world"][str].get("legacy", "0").asString() == "1") { loginconfig->LoginLegacy = true; }
// at least today, this is wrong a majority of the time
// remove this if eqemulator ever upgrades its loginserver
if (loginconfig->LoginHost.find("login.eqemulator.net") != std::string::npos) {
loginconfig->LoginLegacy = true;
}
loginlist.Insert(loginconfig);
} while (LoginCount < 100);
}
//<locked> from xml converts to json as locked: "", so i default to "false".
//<locked> from xml converts to json as locked: "", so i default to "false".
//The only way to enable locked is by switching to true, meaning this value is always false until manually set true
Locked = false;
if (_root["server"]["world"].get("locked", "false").asString() == "true") { Locked = true; }
WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString();
WorldTCPPort = atoi(_root["server"]["world"]["tcp"].get("port", "9000").asString().c_str());
WorldUDPPort = atoi(_root["server"]["world"]["udp"].get("port", "9000").asString().c_str());
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
TelnetTCPPort = atoi(_root["server"]["world"]["telnet"].get("port", "9001").asString().c_str());
@@ -87,6 +101,10 @@ void EQEmuConfig::parse_config()
WorldHTTPEnabled = true;
}
if (_root["server"].get("disable_config_checks", "false").asString() == "true") {
DisableConfigChecks = true;
}
/**
* UCS
*/
@@ -104,6 +122,15 @@ void EQEmuConfig::parse_config()
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
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
*/
@@ -191,6 +218,9 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
if (var_name == "WorldTCPPort") {
return (itoa(WorldTCPPort));
}
if (var_name == "WorldUDPPort") {
return (itoa(WorldUDPPort));
}
if (var_name == "WorldIP") {
return (WorldIP);
}
@@ -322,6 +352,7 @@ void EQEmuConfig::Dump() const
std::cout << "LoginLegacy = " << LoginLegacy << std::endl;
std::cout << "Locked = " << Locked << std::endl;
std::cout << "WorldTCPPort = " << WorldTCPPort << std::endl;
std::cout << "WorldUDPPort = " << WorldUDPPort << std::endl;
std::cout << "WorldIP = " << WorldIP << std::endl;
std::cout << "TelnetTCPPort = " << TelnetTCPPort << std::endl;
std::cout << "TelnetIP = " << TelnetIP << std::endl;
+27 -8
View File
@@ -20,7 +20,9 @@
#include "json/json.h"
#include "linked_list.h"
#include "path_manager.h"
#include <fstream>
#include <fmt/format.h>
struct LoginConfig {
std::string LoginHost;
@@ -49,6 +51,7 @@ class EQEmuConfig
LinkedList<LoginConfig*> loginlist;
bool Locked;
uint16 WorldTCPPort;
uint16 WorldUDPPort;
std::string WorldIP;
uint16 TelnetTCPPort;
std::string TelnetIP;
@@ -58,6 +61,7 @@ class EQEmuConfig
uint16 WorldHTTPPort;
std::string WorldHTTPMimeFile;
std::string SharedKey;
bool DisableConfigChecks;
// From <chatserver/>
std::string ChatHost;
@@ -74,6 +78,13 @@ class EQEmuConfig
std::string DatabaseDB;
uint16 DatabasePort;
// From <content_database/>
std::string ContentDbHost;
std::string ContentDbUsername;
std::string ContentDbPassword;
std::string ContentDbName;
uint16 ContentDbPort;
// From <qsdatabase> // QueryServ
std::string QSDatabaseHost;
std::string QSDatabaseUsername;
@@ -123,7 +134,7 @@ class EQEmuConfig
void parse_config();
EQEmuConfig()
{
{
}
virtual ~EQEmuConfig() {}
@@ -144,30 +155,38 @@ class EQEmuConfig
}
// Load the config
static bool LoadConfig()
static bool LoadConfig(const std::string& path = "")
{
if (_config != nullptr) {
return true;
}
_config = new EQEmuConfig;
return parseFile();
return parseFile(path);
}
// Load config file and parse data
static bool parseFile() {
static bool parseFile(const std::string& file_path = ".")
{
if (_config == nullptr) {
return LoadConfig();
return LoadConfig(file_path);
}
std::ifstream fconfig(EQEmuConfig::ConfigFile, std::ifstream::binary);
std::string file = fmt::format(
"{}/{}",
(file_path.empty() ? path.GetServerPath() : file_path),
EQEmuConfig::ConfigFile
);
std::ifstream fconfig(file, std::ifstream::binary);
try {
fconfig >> _config->_root;
_config->parse_config();
}
catch (std::exception) {
catch (std::exception &) {
return false;
}
}
return true;
}
+1 -1
View File
@@ -18,7 +18,7 @@
#include "eqemu_exception.h"
namespace EQEmu
namespace EQ
{
Exception::Exception(const char* name, const std::string& description, const char* file, long line)
: line_(line),
+2 -2
View File
@@ -22,7 +22,7 @@
#include <sstream>
#include <exception>
namespace EQEmu
namespace EQ
{
//! EQEmu Exception Class
/*!
@@ -104,7 +104,7 @@ namespace EQEmu
} // EQEmu
#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
+294 -134
View File
@@ -21,9 +21,11 @@
#include "eqemu_logsys.h"
#include "rulesys.h"
#include "platform.h"
#include "string_util.h"
#include "database.h"
#include "strings.h"
#include "misc.h"
#include "discord/discord.h"
#include "repositories/discord_webhooks_repository.h"
#include "repositories/logsys_categories_repository.h"
#include <iostream>
#include <fstream>
@@ -31,6 +33,7 @@
#include <iomanip>
#include <time.h>
#include <sys/stat.h>
#include <algorithm>
std::ofstream process_log;
@@ -45,6 +48,7 @@ std::ofstream process_log;
#include <unistd.h>
#include <sys/stat.h>
#include <thread>
#endif
@@ -87,8 +91,8 @@ namespace Console {
*/
EQEmuLogSys::EQEmuLogSys()
{
on_log_gmsay_hook = [](uint16 log_type, const std::string &) {};
on_log_console_hook = [](uint16 debug_level, uint16 log_type, const std::string &) {};
m_on_log_gmsay_hook = [](uint16 log_type, const std::string &) {};
m_on_log_console_hook = [](uint16 log_type, const std::string &) {};
}
/**
@@ -96,34 +100,46 @@ EQEmuLogSys::EQEmuLogSys()
*/
EQEmuLogSys::~EQEmuLogSys() = default;
void EQEmuLogSys::LoadLogSettingsDefaults()
EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
{
/**
* Get Executable platform currently running this code (Zone/World/etc)
*/
log_platform = GetExecutablePlatformInt();
m_log_platform = GetExecutablePlatformInt();
for (int log_category_id = Logs::AA; log_category_id != Logs::MaxCategoryID; log_category_id++) {
log_settings[log_category_id].log_to_console = 0;
log_settings[log_category_id].log_to_file = 0;
log_settings[log_category_id].log_to_gmsay = 0;
log_settings[log_category_id].log_to_discord = 0;
log_settings[log_category_id].is_category_enabled = 0;
}
file_logs_enabled = false;
m_file_logs_enabled = false;
/**
* Set Defaults
*/
log_settings[Logs::WorldServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ZoneServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::QSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::UCSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loginserver].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HeadlessClient].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::WorldServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ZoneServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::QSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::UCSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loginserver].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HeadlessClient].log_to_console = static_cast<uint8>(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);
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Cheat].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::ChecksumVerification].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ChecksumVerification].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::CombatRecord].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::Discord].log_to_console = static_cast<uint8>(Logs::General);
/**
* RFC 5424
@@ -143,7 +159,8 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
const bool log_to_console = log_settings[log_category_id].log_to_console > 0;
const bool log_to_file = log_settings[log_category_id].log_to_file > 0;
const bool log_to_gmsay = log_settings[log_category_id].log_to_gmsay > 0;
const bool is_category_enabled = log_to_console || log_to_file || log_to_gmsay;
const bool log_to_discord = log_settings[log_category_id].log_to_discord > 0;
const bool is_category_enabled = log_to_console || log_to_file || log_to_gmsay || log_to_discord;
if (is_category_enabled) {
log_settings[log_category_id].is_category_enabled = 1;
}
@@ -152,27 +169,29 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
/**
* Declare process file names for log writing=
*/
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld) {
platform_file_name = "world";
if (EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformWorld) {
m_platform_file_name = "world";
}
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ) {
platform_file_name = "query_server";
else if (EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformQueryServ) {
m_platform_file_name = "query_server";
}
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone) {
platform_file_name = "zone";
else if (EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformZone) {
m_platform_file_name = "zone";
}
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformUCS) {
platform_file_name = "ucs";
else if (EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformUCS) {
m_platform_file_name = "ucs";
}
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin) {
platform_file_name = "login";
else if (EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformLogin) {
m_platform_file_name = "login";
}
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLaunch) {
platform_file_name = "launcher";
else if (EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformLaunch) {
m_platform_file_name = "launcher";
}
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformHC) {
platform_file_name = "hc";
else if (EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformHC) {
m_platform_file_name = "hc";
}
return this;
}
/**
@@ -193,58 +212,12 @@ bool EQEmuLogSys::IsRfc5424LogCategory(uint16 log_category)
);
}
/**
* @param log_category
* @param in_message
* @return
*/
std::string EQEmuLogSys::FormatOutMessageString(
uint16 log_category,
const std::string &in_message
)
{
std::string return_string;
if (IsRfc5424LogCategory(log_category)) {
return_string = "[" + GetPlatformName() + "] ";
}
return return_string + "[" + Logs::LogCategoryName[log_category] + "] " + in_message;
}
/**
* @param debug_level
* @param log_category
* @param 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
*/
if (log_category == Logs::LogCategory::Netcode) {
return;
}
/**
* Check to see if the process that actually ran this is zone
*/
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone) {
on_log_gmsay_hook(log_category, message);
}
}
/**
* @param debug_level
* @param log_category
* @param message
*/
void EQEmuLogSys::ProcessLogWrite(
uint16 debug_level,
uint16 log_category,
const std::string &message
)
@@ -255,17 +228,16 @@ void EQEmuLogSys::ProcessLogWrite(
std::ofstream crash_log;
EQEmuLogSys::MakeDirectory("logs/crashes");
crash_log.open(
StringFormat("logs/crashes/crash_%s_%i.log", platform_file_name.c_str(), getpid()),
StringFormat("logs/crashes/crash_%s_%i.log", m_platform_file_name.c_str(), getpid()),
std::ios_base::app | std::ios_base::out
);
crash_log << time_stamp << " " << message << "\n";
crash_log.close();
}
char time_stamp[80];
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
if (process_log) {
char time_stamp[80];
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
process_log << time_stamp << " " << message << std::endl;
}
}
@@ -361,7 +333,7 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
* @param log_category
* @param message
*/
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string &message)
{
#ifdef _WINDOWS
HANDLE console_handle;
@@ -379,7 +351,7 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category,
std::cout << EQEmuLogSys::GetLinuxConsoleColorFromCategory(log_category) << message << LC_RESET << std::endl;
#endif
on_log_console_hook(debug_level, log_category, message);
m_on_log_console_hook(log_category, message);
}
/**
@@ -436,47 +408,52 @@ void EQEmuLogSys::Out(
...
)
{
bool log_to_console = true;
if (log_settings[log_category].log_to_console < debug_level) {
log_to_console = false;
}
auto l = GetLogsEnabled(debug_level, log_category);
bool log_to_file = true;
if (log_settings[log_category].log_to_file < debug_level) {
log_to_file = false;
}
bool log_to_gmsay = true;
if (log_settings[log_category].log_to_gmsay < debug_level) {
log_to_gmsay = false;
}
const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay;
if (nothing_to_log) {
// bail out if nothing to log
if (!l.log_enabled) {
return;
}
std::string prefix;
if (RuleB(Logging, PrintFileFunctionAndLine)) {
prefix = fmt::format("[{0}::{1}:{2}] ", base_file_name(file), func, line);
}
va_list args;
va_start(args, message);
std::string output_message = vStringFormat(message, args);
va_end(args);
// remove this when we remove all legacy logs
bool ignore_log_legacy_format = (
log_category == Logs::Netcode ||
log_category == Logs::PacketServerClient ||
log_category == Logs::PacketClientServer ||
log_category == Logs::PacketServerToServer
);
std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, prefix + output_message);
// remove this when we remove all legacy logs
std::string output_message = message;
if (!ignore_log_legacy_format) {
va_list args;
va_start(args, message);
output_message = vStringFormat(message, args);
va_end(args);
}
if (log_to_console) {
EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message);
if (l.log_to_console_enabled) {
EQEmuLogSys::ProcessConsoleMessage(
log_category,
fmt::format("[{}] [{}] {}", GetPlatformName(), Logs::LogCategoryName[log_category], prefix + output_message)
);
}
if (log_to_gmsay) {
EQEmuLogSys::ProcessGMSay(debug_level, log_category, output_debug_message);
if (l.log_to_gmsay_enabled) {
m_on_log_gmsay_hook(log_category, output_message);
}
if (log_to_file) {
EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_debug_message);
if (l.log_to_file_enabled) {
EQEmuLogSys::ProcessLogWrite(
log_category,
fmt::format("[{}] [{}] {}", GetPlatformName(), Logs::LogCategoryName[log_category], prefix + output_message)
);
}
if (l.log_to_discord_enabled && m_on_log_discord_hook) {
m_on_log_discord_hook(log_category, log_settings[log_category].discord_webhook_id, output_message);
}
}
@@ -489,7 +466,7 @@ void EQEmuLogSys::SetCurrentTimeStamp(char *time_stamp)
struct tm *time_info;
time(&raw_time);
time_info = localtime(&raw_time);
strftime(time_stamp, 80, "[%m-%d-%Y :: %H:%M:%S]", time_info);
strftime(time_stamp, 80, "[%m-%d-%Y %H:%M:%S]", time_info);
}
/**
@@ -528,53 +505,45 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
/**
* When loading settings, we must have been given a reason in category based logging to output to a file in order to even create or open one...
*/
if (!file_logs_enabled) {
if (!m_file_logs_enabled) {
return;
}
/**
* Zone
*/
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone) {
if (EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformZone) {
if (!log_name.empty()) {
platform_file_name = log_name;
m_platform_file_name = log_name;
}
if (platform_file_name.empty()) {
if (m_platform_file_name.empty()) {
return;
}
LogInfo("Starting File Log [logs/{}_{}.log]", platform_file_name.c_str(), getpid());
LogInfo("Starting File Log [{}/zone/{}_{}.log]", GetLogPath(), m_platform_file_name.c_str(), getpid());
/**
* Make directory if not exists
*/
EQEmuLogSys::MakeDirectory("logs/zone");
// Make directory if not exists
EQEmuLogSys::MakeDirectory(fmt::format("{}/zone", GetLogPath()));
/**
* Open file pointer
*/
// Open file pointer
process_log.open(
StringFormat("logs/zone/%s_%i.log", platform_file_name.c_str(), getpid()),
fmt::format("{}/zone/{}_{}.log", GetLogPath(), m_platform_file_name, getpid()),
std::ios_base::app | std::ios_base::out
);
}
else {
/**
* All other processes
*/
if (platform_file_name.empty()) {
// All other processes
if (m_platform_file_name.empty()) {
return;
}
LogInfo("Starting File Log [logs/{}_{}.log]", platform_file_name.c_str(), getpid());
LogInfo("Starting File Log [{}/{}_{}.log]", GetLogPath(), m_platform_file_name.c_str(), getpid());
/**
* Open file pointer
*/
// Open file pointer
process_log.open(
StringFormat("logs/%s_%i.log", platform_file_name.c_str(), getpid()),
fmt::format("{}/{}_{}.log", GetLogPath(), m_platform_file_name.c_str(), getpid()),
std::ios_base::app | std::ios_base::out
);
}
@@ -601,3 +570,194 @@ void EQEmuLogSys::EnableConsoleLogging()
log_settings[log_index].is_category_enabled = 1;
}
}
EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
{
InjectTablesIfNotExist();
auto categories = LogsysCategoriesRepository::GetWhere(
*m_database,
"TRUE ORDER BY log_category_id"
);
// keep track of categories
std::vector<int> db_categories{};
db_categories.reserve(categories.size());
// loop through database categories
for (auto &c: categories) {
if (c.log_category_id <= Logs::None || c.log_category_id >= Logs::MaxCategoryID) {
continue;
}
log_settings[c.log_category_id].log_to_console = static_cast<uint8>(c.log_to_console);
log_settings[c.log_category_id].log_to_file = static_cast<uint8>(c.log_to_file);
log_settings[c.log_category_id].log_to_gmsay = static_cast<uint8>(c.log_to_gmsay);
log_settings[c.log_category_id].log_to_discord = static_cast<uint8>(c.log_to_discord);
log_settings[c.log_category_id].discord_webhook_id = c.discord_webhook_id;
// Determine if any output method is enabled for the category
// and set it to 1 so it can used to check if category is enabled
const bool log_to_console = log_settings[c.log_category_id].log_to_console > 0;
const bool log_to_file = log_settings[c.log_category_id].log_to_file > 0;
const bool log_to_gmsay = log_settings[c.log_category_id].log_to_gmsay > 0;
const bool log_to_discord = log_settings[c.log_category_id].log_to_discord > 0 &&
log_settings[c.log_category_id].discord_webhook_id > 0;
const bool is_category_enabled = log_to_console || log_to_file || log_to_gmsay || log_to_discord;
if (is_category_enabled) {
log_settings[c.log_category_id].is_category_enabled = 1;
}
// This determines whether or not the process needs to actually file log anything.
// If we go through this whole loop and nothing is set to any debug level, there
// is no point to create a file or keep anything open
if (log_settings[c.log_category_id].log_to_file > 0) {
LogSys.m_file_logs_enabled = true;
}
db_categories.emplace_back(c.log_category_id);
}
// Auto inject categories that don't exist in the database...
for (int i = Logs::AA; i != Logs::MaxCategoryID; i++) {
bool is_missing_in_database = std::find(db_categories.begin(), db_categories.end(), i) == db_categories.end();
bool is_deprecated_category = Strings::Contains(fmt::format("{}", Logs::LogCategoryName[i]), "Deprecated");
if (!is_missing_in_database && is_deprecated_category) {
LogInfo("Logging category [{}] ({}) is now deprecated, deleting from database", Logs::LogCategoryName[i], i);
LogsysCategoriesRepository::DeleteOne(*m_database, i);
}
if (is_missing_in_database && !is_deprecated_category) {
LogInfo(
"Automatically adding new log category [{}] ({})",
Logs::LogCategoryName[i],
i
);
auto new_category = LogsysCategoriesRepository::NewEntity();
new_category.log_category_id = i;
new_category.log_category_description = Strings::Escape(Logs::LogCategoryName[i]);
new_category.log_to_console = log_settings[i].log_to_console;
new_category.log_to_gmsay = log_settings[i].log_to_gmsay;
new_category.log_to_file = log_settings[i].log_to_file;
new_category.log_to_discord = log_settings[i].log_to_discord;
LogsysCategoriesRepository::InsertOne(*m_database, new_category);
}
}
LogInfo("Loaded [{}] log categories", categories.size());
auto webhooks = DiscordWebhooksRepository::GetWhere(*m_database, fmt::format("id < {}", MAX_DISCORD_WEBHOOK_ID));
if (!webhooks.empty()) {
for (auto &w: webhooks) {
m_discord_webhooks[w.id] = {w.id, w.webhook_name, w.webhook_url};
}
LogInfo("Loaded [{}] Discord webhooks", webhooks.size());
}
return this;
}
EQEmuLogSys *EQEmuLogSys::SetDatabase(Database *db)
{
m_database = db;
return this;
}
void EQEmuLogSys::InjectTablesIfNotExist()
{
// do not run injections for zone as its unnecessary hits every time a zone boots
// other processes less frequently ran can pick up injection
if (m_log_platform == EQEmuExePlatform::ExePlatformZone) {
return;
}
// inject discord_webhooks
if (!m_database->DoesTableExist("discord_webhooks")) {
LogInfo("Creating table [discord_webhooks]");
m_database->QueryDatabase(
SQL(
CREATE TABLE discord_webhooks
(
id INT auto_increment primary key NULL,
webhook_name varchar(100) NULL,
webhook_url varchar(255) NULL,
created_at DATETIME NULL,
deleted_at DATETIME NULL
) ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_general_ci;
)
);
}
// inject logsys_categories
if (!m_database->DoesTableExist("logsys_categories")) {
LogInfo("Creating table [logsys_categories]");
m_database->QueryDatabase(
SQL(
CREATE TABLE `logsys_categories` (
`log_category_id` int(11) NOT NULL,
`log_category_description` varchar(150) DEFAULT NULL,
`log_to_console` smallint(11) DEFAULT 0,
`log_to_file` smallint(11) DEFAULT 0,
`log_to_gmsay` smallint(11) DEFAULT 0,
`log_to_discord` smallint(11) DEFAULT 0,
`discord_webhook_id` int(11) DEFAULT 0,
PRIMARY KEY (`log_category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
)
);
}
}
const EQEmuLogSys::DiscordWebhooks *EQEmuLogSys::GetDiscordWebhooks() const
{
return m_discord_webhooks;
}
EQEmuLogSys::LogEnabled EQEmuLogSys::GetLogsEnabled(const Logs::DebugLevel &debug_level, const uint16 &log_category)
{
auto e = LogEnabled{};
e.log_to_console_enabled = log_settings[log_category].log_to_console > 0 &&
log_settings[log_category].log_to_console >= debug_level;
e.log_to_file_enabled = log_settings[log_category].log_to_file > 0 &&
log_settings[log_category].log_to_file >= debug_level;
e.log_to_gmsay_enabled = log_settings[log_category].log_to_gmsay > 0 &&
log_settings[log_category].log_to_gmsay >= debug_level &&
log_category != Logs::LogCategory::Netcode &&
(EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformZone ||
EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformWorld);
e.log_to_discord_enabled = EQEmuLogSys::m_log_platform == EQEmuExePlatform::ExePlatformZone &&
log_settings[log_category].log_to_discord > 0 &&
log_settings[log_category].log_to_discord >= debug_level &&
log_settings[log_category].discord_webhook_id > 0 &&
log_settings[log_category].discord_webhook_id < MAX_DISCORD_WEBHOOK_ID;
e.log_enabled =
e.log_to_console_enabled || e.log_to_file_enabled || e.log_to_gmsay_enabled || e.log_to_discord_enabled;
return e;
}
bool EQEmuLogSys::IsLogEnabled(const Logs::DebugLevel &debug_level, const uint16 &log_category)
{
return GetLogsEnabled(debug_level, log_category).log_enabled;
}
const std::string &EQEmuLogSys::GetLogPath() const
{
return m_log_path;
}
EQEmuLogSys * EQEmuLogSys::SetLogPath(const std::string &log_path)
{
EQEmuLogSys::m_log_path = log_path;
return this;
}
+129 -93
View File
@@ -23,8 +23,9 @@
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <cstdio>
#include <functional>
#include <algorithm>
#ifdef _WIN32
#ifdef utf16_to_utf8
@@ -37,9 +38,9 @@
namespace Logs {
enum DebugLevel {
General = 1, /* 1 - Low-Level general debugging, useful info on single line */
Moderate, /* 2 - Informational based, used in functions, when particular things load */
Detail /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */
General = 1, // 1 - Low-Level general debugging, useful info on single line
Moderate, // 2 - Informational based, used in functions, when particular things load
Detail // 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication
};
/**
@@ -53,7 +54,7 @@ namespace Logs {
AI,
Aggro,
Attack,
PacketClientServer,
DeprecatedCS,
Combat,
Commands,
Crash,
@@ -87,10 +88,10 @@ namespace Logs {
MySQLQuery,
Mercenaries,
QuestDebug,
PacketServerClient,
PacketClientServerUnhandled,
PacketServerClientWithDump,
PacketClientServerWithDump,
DeprecatedSC,
DeprecatedCSU,
DeprecatedSCD,
DeprecatedCSD,
Loginserver,
ClientLogin,
HeadlessClient,
@@ -113,19 +114,40 @@ namespace Logs {
AoeCast,
EntityManagement,
Flee,
Aura,
HotReload,
Merchants,
ZonePoints,
Loot,
Expeditions,
DynamicZones,
Scheduler,
Cheat,
ClientList,
DiaWind,
HTTP,
Saylink,
ChecksumVerification,
CombatRecord,
Hate,
Discord,
Faction,
PacketServerClient,
PacketClientServer,
PacketServerToServer,
MaxCategoryID /* Don't Remove this */
};
/**
* If you add to this, make sure you update LogCategory
*/
static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
static const char *LogCategoryName[LogCategory::MaxCategoryID] = {
"",
"AA",
"AI",
"Aggro",
"Attack",
"Packet :: Client -> Server",
"Deprecated",
"Combat",
"Commands",
"Crash",
@@ -159,10 +181,10 @@ namespace Logs {
"MySQL Query",
"Mercenaries",
"Quest Debug",
"Packet :: Server -> Client",
"Packet :: Client -> Server Unhandled",
"Packet :: Server -> Client (Dump)",
"Packet :: Client -> Server (Dump)",
"Deprecated",
"Deprecated",
"Deprecated",
"Deprecated",
"Login Server",
"Client Login",
"Headless Client",
@@ -185,11 +207,36 @@ namespace Logs {
"AOE Cast",
"Entity Management",
"Flee",
"Aura",
"HotReload",
"Merchants",
"ZonePoints",
"Loot",
"Expeditions",
"DynamicZones",
"Scheduler",
"Cheat",
"ClientList",
"DialogueWindow",
"HTTP",
"Saylink",
"ChecksumVerification",
"CombatRecord",
"Hate",
"Discord",
"Faction",
"Packet-S->C",
"Packet-C->S",
"Packet-S->S"
};
}
#include "eqemu_logsys_log_aliases.h"
class Database;
constexpr uint16 MAX_DISCORD_WEBHOOK_ID = 300;
class EQEmuLogSys {
public:
EQEmuLogSys();
@@ -200,7 +247,8 @@ public:
* This should be handled on deconstructor but to be safe we use it anyways.
*/
void CloseFileLogs();
void LoadLogSettingsDefaults();
EQEmuLogSys *LoadLogSettingsDefaults();
EQEmuLogSys *LoadLogDatabaseSettings();
/**
* @param directory_name
@@ -230,7 +278,7 @@ public:
* Used in file logs to prepend a timestamp entry for logs
* @param time_stamp
*/
void SetCurrentTimeStamp(char* time_stamp);
void SetCurrentTimeStamp(char *time_stamp);
/**
* @param log_name
@@ -251,108 +299,96 @@ public:
uint8 log_to_file;
uint8 log_to_console;
uint8 log_to_gmsay;
uint8 log_to_discord;
int discord_webhook_id;
uint8 is_category_enabled; /* When any log output in a category > 0, set this to 1 as (Enabled) */
};
struct OriginationInfo {
std::string zone_short_name;
std::string zone_long_name;
int instance_id;
};
OriginationInfo origination_info{};
/**
* Internally used memory reference for all log settings per category
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
* Database loaded via Database::LoadLogSettings(log_settings)
* Database loaded via LogSys.SetDatabase(&database)->LoadLogDatabaseSettings();
*/
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
bool file_logs_enabled = false;
struct LogEnabled {
bool log_to_file_enabled;
bool log_to_console_enabled;
bool log_to_gmsay_enabled;
bool log_to_discord_enabled;
bool log_enabled;
};
/**
* Sets Executable platform (Zone/World/UCS) etc.
*/
int log_platform = 0;
LogEnabled GetLogsEnabled(const Logs::DebugLevel &debug_level, const uint16 &log_category);
bool IsLogEnabled(const Logs::DebugLevel &debug_level, const uint16 &log_category);
/**
* File name used in writing logs
*/
std::string platform_file_name;
struct DiscordWebhooks {
int id;
std::string webhook_name;
std::string webhook_url;
};
/**
* GMSay Client Message colors mapped by category
*
* @param log_category
* @return
*/
const DiscordWebhooks *GetDiscordWebhooks() const;
// gmsay
uint16 GetGMSayColorFromCategory(uint16 log_category);
/**
* @param f
*/
void SetGMSayHandler(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
EQEmuLogSys *SetGMSayHandler(std::function<void(uint16 log_type, const std::string &)> f)
{
m_on_log_gmsay_hook = f;
return this;
}
/**
* @param f
*/
void SetConsoleHandler(std::function<void(uint16 debug_level, uint16 log_type, const std::string&)> f) { on_log_console_hook = f; }
EQEmuLogSys *SetDiscordHandler(std::function<void(uint16 log_category, int webhook_id, const std::string &)> f)
{
m_on_log_discord_hook = f;
return this;
}
/**
* Silence console logging
*/
// console
void SetConsoleHandler(
std::function<void(
uint16 log_type,
const std::string &
)> f
) { m_on_log_console_hook = f; }
void SilenceConsoleLogging();
/**
* Turn on all console logging
*/
void EnableConsoleLogging();
// database
EQEmuLogSys *SetDatabase(Database *db);
[[nodiscard]] const std::string &GetLogPath() const;
EQEmuLogSys * SetLogPath(const std::string &log_path);
private:
/**
* Callback pointer to zone process for hooking logs to zone using GMSay
*/
std::function<void(uint16 log_category, const std::string&)> on_log_gmsay_hook;
std::function<void(uint16 debug_level, uint16 log_category, const std::string&)> on_log_console_hook;
// reference to database
Database *m_database;
std::function<void(uint16 log_category, const std::string &)> m_on_log_gmsay_hook;
std::function<void(uint16 log_category, int webhook_id, const std::string &)> m_on_log_discord_hook;
std::function<void(uint16 log_category, const std::string &)> m_on_log_console_hook;
DiscordWebhooks m_discord_webhooks[MAX_DISCORD_WEBHOOK_ID]{};
bool m_file_logs_enabled = false;
int m_log_platform = 0;
std::string m_platform_file_name;
std::string m_log_path;
/**
* Formats log messages like '[Category] This is a log message'
*/
std::string FormatOutMessageString(uint16 log_category, const std::string &in_message);
/**
* Linux console color messages mapped by category
*
* @param log_category
* @return
*/
std::string GetLinuxConsoleColorFromCategory(uint16 log_category);
/**
* Windows console color messages mapped by category
*/
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category);
/**
* @param debug_level
* @param log_category
* @param message
*/
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message);
/**
* @param debug_level
* @param log_category
* @param message
*/
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message);
/**
* @param debug_level
* @param log_category
* @param message
*/
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message);
/**
* @param log_category
* @return
*/
void ProcessConsoleMessage(uint16 log_category, const std::string &message);
void ProcessLogWrite(uint16 log_category, const std::string &message);
bool IsRfc5424LogCategory(uint16 log_category);
void InjectTablesIfNotExist();
};
extern EQEmuLogSys LogSys;
File diff suppressed because it is too large Load Diff
+4
View File
@@ -25,6 +25,10 @@ namespace EQ
uv_run(&m_loop, UV_RUN_DEFAULT);
}
void Shutdown() {
uv_stop(&m_loop);
}
uv_loop_t* Handle() { return &m_loop; }
private:
+4 -4
View File
@@ -1,14 +1,14 @@
#pragma once
#include <any>
#include <functional>
#include <exception>
#include "event_loop.h"
#include "../any.h"
namespace EQ {
class Task
{
public:
typedef std::function<void(const EQEmu::Any&)> ResolveFn;
typedef std::function<void(const std::any&)> ResolveFn;
typedef std::function<void(const std::exception&)> RejectFn;
typedef std::function<void()> FinallyFn;
typedef std::function<void(ResolveFn, RejectFn)> TaskFn;
@@ -19,7 +19,7 @@ namespace EQ {
RejectFn on_catch;
FinallyFn on_finally;
bool has_result;
EQEmu::Any result;
std::any result;
bool has_error;
std::exception error;
};
@@ -63,7 +63,7 @@ namespace EQ {
uv_queue_work(EventLoop::Get().Handle(), m_work, [](uv_work_t* req) {
TaskBaton *baton = (TaskBaton*)req->data;
baton->fn([baton](const EQEmu::Any& result) {
baton->fn([baton](const std::any& result) {
baton->has_error = false;
baton->has_result = true;
baton->result = result;
+2 -2
View File
@@ -60,8 +60,8 @@ namespace EQ
}
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 Enqueue(Fn&& fn, Args&&... args) -> std::future<typename std::invoke_result<Fn, Args...>::type> {
using return_type = typename std::invoke_result<Fn, Args...>::type;
auto task = std::make_shared<std::packaged_task<return_type()>>(
std::bind(std::forward<Fn>(fn), std::forward<Args>(args)...)
+1 -1
View File
@@ -51,7 +51,7 @@ namespace EQ {
void Stop() {
if (m_timer) {
uv_close((uv_handle_t*)m_timer, [](uv_handle_t* handle) {
delete handle;
delete (uv_timer_t *)handle;
});
m_timer = nullptr;
}
+101
View File
@@ -0,0 +1,101 @@
/**
* 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 "expedition_lockout_timer.h"
#include "../common/strings.h"
#include "../common/rulesys.h"
#include "../common/util/uuid.h"
#include <fmt/format.h>
const char* const DZ_REPLAY_TIMER_NAME = "Replay Timer"; // see December 14, 2016 patch notes
ExpeditionLockoutTimer::ExpeditionLockoutTimer(
std::string expedition_uuid, std::string expedition_name,
std::string event_name, uint64_t expire_time, uint32_t duration
) :
m_expedition_uuid{std::move(expedition_uuid)},
m_expedition_name{std::move(expedition_name)},
m_event_name{std::move(event_name)},
m_expire_time(std::chrono::system_clock::from_time_t(expire_time)),
m_duration(duration)
{
if (m_event_name == DZ_REPLAY_TIMER_NAME)
{
m_is_replay_timer = true;
}
}
ExpeditionLockoutTimer ExpeditionLockoutTimer::CreateLockout(
const std::string& expedition_name, const std::string& event_name, uint32_t seconds, std::string uuid)
{
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
if (uuid.empty())
{
uuid = EQ::Util::UUID::Generate().ToString();
}
ExpeditionLockoutTimer lockout{uuid, expedition_name, event_name, 0, seconds};
lockout.Reset(); // sets expire time
return lockout;
}
uint32_t ExpeditionLockoutTimer::GetSecondsRemaining() const
{
auto now = std::chrono::system_clock::now();
if (m_expire_time > now)
{
auto remaining = m_expire_time - now;
return static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(remaining).count());
}
return 0;
}
ExpeditionLockoutTimer::DaysHoursMinutes ExpeditionLockoutTimer::GetDaysHoursMinutesRemaining() const
{
auto seconds = GetSecondsRemaining();
return ExpeditionLockoutTimer::DaysHoursMinutes{
fmt::format_int(seconds / 86400).str(), // days
fmt::format_int((seconds / 3600) % 24).str(), // hours
fmt::format_int((seconds / 60) % 60).str() // minutes
};
}
bool ExpeditionLockoutTimer::IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const
{
return compare_lockout.IsSameLockout(GetExpeditionName(), GetEventName());
}
bool ExpeditionLockoutTimer::IsSameLockout(
const std::string& expedition_name, const std::string& event_name) const
{
return GetExpeditionName() == expedition_name && GetEventName() == event_name;
}
void ExpeditionLockoutTimer::AddLockoutTime(int seconds)
{
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
auto new_duration = std::max(0, static_cast<int>(m_duration.count()) + seconds);
auto start_time = m_expire_time - m_duration;
m_duration = std::chrono::seconds(new_duration);
m_expire_time = start_time + m_duration;
}
+76
View File
@@ -0,0 +1,76 @@
/**
* 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 EXPEDITION_LOCKOUT_TIMER_H
#define EXPEDITION_LOCKOUT_TIMER_H
#include <chrono>
#include <string>
extern const char* const DZ_REPLAY_TIMER_NAME;
class ExpeditionLockoutTimer
{
public:
ExpeditionLockoutTimer() = default;
ExpeditionLockoutTimer(
std::string expedition_uuid, std::string expedition_name,
std::string event_name, uint64_t expire_time, uint32_t duration);
static ExpeditionLockoutTimer CreateLockout(
const std::string& expedition_name, const std::string& event_name,
uint32_t seconds, std::string uuid = {});
struct DaysHoursMinutes
{
std::string days;
std::string hours;
std::string mins;
};
void AddLockoutTime(int seconds);
uint32_t GetDuration() const { return static_cast<uint32_t>(m_duration.count()); }
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
uint64_t GetStartTime() const { return std::chrono::system_clock::to_time_t(m_expire_time - m_duration); }
uint32_t GetSecondsRemaining() const;
DaysHoursMinutes GetDaysHoursMinutesRemaining() const;
const std::string& GetExpeditionName() const { return m_expedition_name; }
const std::string& GetExpeditionUUID() const { return m_expedition_uuid; }
const std::string& GetEventName() const { return m_event_name; }
bool IsExpired() const { return GetSecondsRemaining() == 0; }
bool IsFromExpedition(const std::string& uuid) const { return uuid == m_expedition_uuid; }
bool IsReplayTimer() const { return m_is_replay_timer; }
bool IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const;
bool IsSameLockout(const std::string& expedition_name, const std::string& event_name) const;
void Reset() { m_expire_time = std::chrono::system_clock::now() + m_duration; }
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
void SetExpireTime(uint64_t expire_time) { m_expire_time = std::chrono::system_clock::from_time_t(expire_time); }
void SetUUID(const std::string& uuid) { m_expedition_uuid = uuid; }
private:
bool m_is_replay_timer = false;
std::string m_expedition_uuid; // expedition received in
std::string m_expedition_name;
std::string m_event_name;
std::chrono::seconds m_duration;
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
};
#endif
+1 -1
View File
@@ -40,7 +40,7 @@ struct ExtendedProfile_Struct {
uint16 old_pet_hp; /* Not Used */
uint16 old_pet_mana; /* 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 */
uint32 aa_effects; /* Used */
+22 -22
View File
@@ -20,31 +20,31 @@
#include "races.h"
#include "rulesys.h"
const char *FactionValueToString(FACTION_VALUE fv)
const char *FactionValueToString(FACTION_VALUE faction_value)
{
switch (fv) {
switch (faction_value) {
case FACTION_ALLY:
return ("Ally");
return "Ally";
case FACTION_WARMLY:
return ("Warmly");
return "Warmly";
case FACTION_KINDLY:
return ("Kindly");
case FACTION_AMIABLE:
return ("Amiable");
case FACTION_INDIFFERENT:
return ("Indifferent");
case FACTION_APPREHENSIVE:
return ("Apprehensive");
case FACTION_DUBIOUS:
return ("Dubious");
case FACTION_THREATENLY:
return ("Threatenly");
return "Kindly";
case FACTION_AMIABLY:
return "Amiably";
case FACTION_INDIFFERENTLY:
return "Indifferently";
case FACTION_APPREHENSIVELY:
return "Apprehensively";
case FACTION_DUBIOUSLY:
return "Dubiously";
case FACTION_THREATENINGLY:
return "Threateningly";
case FACTION_SCOWLS:
return ("Scowls, ready to attack.");
return "Scowls";
default:
break;
}
return ("Unknown Faction Con");
return "Unknown";
}
@@ -70,19 +70,19 @@ FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value)
return FACTION_KINDLY;
}
if (character_value >= RuleI(Faction, AmiablyFactionMinimum)) {
return FACTION_AMIABLE;
return FACTION_AMIABLY;
}
if (character_value >= RuleI(Faction, IndifferentlyFactionMinimum)) {
return FACTION_INDIFFERENT;
return FACTION_INDIFFERENTLY;
}
if (character_value >= RuleI(Faction, ApprehensivelyFactionMinimum)) {
return FACTION_APPREHENSIVE;
return FACTION_APPREHENSIVELY;
}
if (character_value >= RuleI(Faction, DubiouslyFactionMinimum)) {
return FACTION_DUBIOUS;
return FACTION_DUBIOUSLY;
}
if (character_value >= RuleI(Faction, ThreateninglyFactionMinimum)) {
return FACTION_THREATENLY;
return FACTION_THREATENINGLY;
}
return FACTION_SCOWLS;
}
+27 -10
View File
@@ -27,13 +27,13 @@ enum FACTION_VALUE {
FACTION_ALLY = 1,
FACTION_WARMLY = 2,
FACTION_KINDLY = 3,
FACTION_AMIABLE = 4,
FACTION_AMIABLY = 4,
FACTION_INDIFFERENT = 5,
FACTION_INDIFFERENTLY = 5,
FACTION_APPREHENSIVE = 6,
FACTION_DUBIOUS = 7,
FACTION_THREATENLY = 8,
FACTION_APPREHENSIVELY = 6,
FACTION_DUBIOUSLY = 7,
FACTION_THREATENINGLY = 8,
FACTION_SCOWLS = 9
};
@@ -50,8 +50,8 @@ struct NPCFactionList {
struct FactionMods
{
int32 base;
int16 min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
int16 max; // The highest your personal earned faction can go - before race/class/diety adjustments.
int16 min; // The lowest your personal earned faction can go - before race/class/deity adjustments.
int16 max; // The highest your personal earned faction can go - before race/class/deity adjustments.
int32 class_mod;
int32 race_mod;
int32 deity_mod;
@@ -61,8 +61,8 @@ struct Faction {
int32 id;
std::map<std::string, int16> mods;
int16 base;
int16 min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
int16 max; // The highest your personal earned faction can go - before race/class/diety adjustments.
int16 min; // The lowest your personal earned faction can go - before race/class/deity adjustments.
int16 max; // The highest your personal earned faction can go - before race/class/deity adjustments.
char name[50];
};
@@ -75,6 +75,23 @@ struct NPCFaction
uint8 temp;
};
const char *FactionValueToString(FACTION_VALUE fv);
// Faction Associations give a much more live like faction system
// Basically the primary faction and magnitude of a faction hit will generate the rest of them
// Largest faction I could find quickly was Lord Inquisitor Seru with 9 total hits (8 associations) so 8 + 2 for max for now
#define MAX_FACTION_ASSOC 10
// this is the ID of a faction association and it's multiplier
struct FactionAssociationHit {
int id;
float multiplier;
};
struct FactionAssociations {
// maybe there should be more data here, fine for now
FactionAssociationHit hits[MAX_FACTION_ASSOC];
};
const char *FactionValueToString(FACTION_VALUE faction_value);
FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value);
#endif
+1 -1
View File
@@ -204,7 +204,7 @@ enum { //some random constants
#define MIN_LEVEL_ALCHEMY 25
//chance ratio that a
#define THREATENLY_ARRGO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly
#define THREATENINGLY_AGGRO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly
//max factions per npc faction list
#define MAX_NPC_FACTIONS 20
+82
View File
@@ -0,0 +1,82 @@
/**
* 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.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
#include <fmt/format.h>
#include <filesystem>
namespace fs = std::filesystem;
/**
* @param name
* @return
*/
bool File::Exists(const std::string &name)
{
return fs::exists(fs::path{name});
}
/**
* @param directory_name
*/
void File::Makedir(const std::string &directory_name)
{
fs::create_directory(directory_name);
fs::permissions(directory_name, fs::perms::owner_all);
}
std::string File::FindEqemuConfigPath()
{
if (File::Exists(fs::path{File::GetCwd() + "/eqemu_config.json"}.string())) {
return File::GetCwd();
}
else if (File::Exists(fs::path{File::GetCwd() + "/../eqemu_config.json"}.string())) {
return canonical(fs::path{File::GetCwd() + "/../"}).string();
}
else if (File::Exists(fs::path{File::GetCwd() + "/login.json"}.string())) {
return File::GetCwd();
}
else if (File::Exists(fs::path{File::GetCwd() + "/../login.json"}.string())) {
return canonical(fs::path{File::GetCwd() + "/../"}).string();
}
return {};
}
std::string File::GetCwd()
{
return fs::current_path().string();
}
+38
View File
@@ -0,0 +1,38 @@
/**
* 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_H
#define EQEMU_FILE_H
#include <filesystem>
namespace fs = std::filesystem;
class File {
public:
static bool Exists(const std::string &name);
static void Makedir(const std::string& directory_name);
static std::string FindEqemuConfigPath();
static std::string GetCwd();
};
bool Exists(const std::string& name);
#endif //EQEMU_FILE_H
+1 -1
View File
@@ -23,7 +23,7 @@
#include "eqemu_exception.h"
#include "types.h"
namespace EQEmu {
namespace EQ {
/*! 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
+1 -1
View File
@@ -23,7 +23,7 @@
#include "eqemu_exception.h"
#include "types.h"
namespace EQEmu {
namespace EQ {
/*! 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
+71 -11
View File
@@ -20,7 +20,7 @@
#include "database.h"
//#include "misc_functions.h"
#include "string_util.h"
#include "strings.h"
#include <cstdlib>
#include <cstring>
@@ -63,7 +63,7 @@ bool BaseGuildManager::LoadGuilds() {
for (auto row=results.begin();row!=results.end();++row)
_CreateGuild(atoi(row[0]), row[1], atoi(row[2]), atoi(row[3]), row[4], row[5], row[6], row[7]);
query = "SELECT guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks";
query = "SELECT guild_id,`rank`,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks";
results = m_db->QueryDatabase(query);
if (!results.Success())
@@ -131,7 +131,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
info = _CreateGuild(guild_id, row[0], atoi(row[1]), atoi(row[2]), row[3], row[4], row[5], row[6]);
query = StringFormat("SELECT guild_id, rank, title, can_hear, can_speak, can_invite, can_remove, can_promote, can_demote, can_motd, can_warpeace "
query = StringFormat("SELECT guild_id, `rank`, title, can_hear, can_speak, can_invite, can_remove, can_promote, can_demote, can_motd, can_warpeace "
"FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id);
results = m_db->QueryDatabase(query);
@@ -268,7 +268,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) {
m_db->DoEscapeString(title_esc, rankInfo.name.c_str(), rankInfo.name.length());
query = StringFormat("INSERT INTO guild_ranks "
"(guild_id,rank,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace)"
"(guild_id,`rank`,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace)"
" VALUES(%d,%d,'%s',%d,%d,%d,%d,%d,%d,%d,%d)",
guild_id, rank, title_esc,
rankInfo.permissions[GUILD_HEAR],
@@ -738,7 +738,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
std::string query;
if(guild_id != GUILD_NONE) {
query = StringFormat("REPLACE INTO guild_members (char_id,guild_id,rank,public_note) VALUES(%d,%d,%d,'')", charid, guild_id, rank);
query = StringFormat("REPLACE INTO guild_members (char_id,guild_id,`rank`,public_note) VALUES(%d,%d,%d,'')", charid, guild_id, rank);
auto results = m_db->QueryDatabase(query);
if (!results.Success()) {
@@ -758,7 +758,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
}
bool BaseGuildManager::DBSetGuildRank(uint32 charid, uint8 rank) {
std::string query = StringFormat("UPDATE guild_members SET rank=%d WHERE char_id=%d", rank, charid);
std::string query = StringFormat("UPDATE guild_members SET `rank`=%d WHERE char_id=%d", rank, charid);
return(QueryWithLogging(query, "setting a guild member's rank"));
}
@@ -912,7 +912,7 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vector<CharGuildInfo
return(false);
//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);
if (!results.Success()) {
return false;
@@ -941,7 +941,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
m_db->DoEscapeString(esc, char_name, nl);
//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);
auto results = m_db->QueryDatabase(query);
if (!results.Success()) {
@@ -969,9 +969,9 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) {
//load up the rank info for each guild.
std::string query;
#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
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
auto results = m_db->QueryDatabase(query);
if (!results.Success()) {
@@ -1208,7 +1208,7 @@ BaseGuildManager::RankInfo::RankInfo() {
BaseGuildManager::GuildInfo::GuildInfo() {
leader_char_id = 0;
minstatus = 0;
minstatus = AccountStatus::Player;
}
uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID)
@@ -1225,6 +1225,66 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID)
return results.RowCount();
}
std::string BaseGuildManager::GetGuildNameByID(uint32 guild_id) const {
if(guild_id == GUILD_NONE) {
return std::string();
}
std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id);
if(res == m_guilds.end()) {
return "Invalid Guild";
}
return res->second->name;
}
std::string BaseGuildManager::GetGuildRankName(uint32 guild_id, uint8 rank) const
{
if(rank > GUILD_MAX_RANK) {
return "Invalid Rank";
}
std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id);
if(res == m_guilds.end()) {
return "Invalid Guild Rank";
}
return res->second->ranks[rank].name;
}
uint32 BaseGuildManager::GetGuildIDByCharacterID(uint32 character_id)
{
if(!m_db) {
return GUILD_NONE;
}
std::string query = fmt::format(
"SELECT `guild_id` FROM `guild_members` WHERE char_id = {} LIMIT 1",
character_id
);
auto results = m_db->QueryDatabase(query);
if(!results.Success() || !results.RowCount()) {
return GUILD_NONE;
}
auto row = results.begin();
auto guild_id = std::stoul(row[0]);
return guild_id;
}
bool BaseGuildManager::IsCharacterInGuild(uint32 character_id, uint32 guild_id)
{
auto current_guild_id = GetGuildIDByCharacterID(character_id);
if (current_guild_id == GUILD_NONE) {
return false;
}
if (guild_id && current_guild_id != guild_id) {
return false;
}
return true;
}
+4
View File
@@ -76,8 +76,12 @@ class BaseGuildManager
bool GetGuildChannel(uint32 GuildID, char *ChannelBuffer) const;
const char *GetRankName(uint32 guild_id, uint8 rank) const;
const char *GetGuildName(uint32 guild_id) const;
std::string GetGuildNameByID(uint32 guild_id) const;
std::string GetGuildRankName(uint32 guild_id, uint8 rank) const;
bool IsCharacterInGuild(uint32 character_id, uint32 guild_id = 0);
bool GetGuildNameByID(uint32 guild_id, std::string &into) const;
uint32 GetGuildIDByName(const char *GuildName);
uint32 GetGuildIDByCharacterID(uint32 character_id);
bool IsGuildLeader(uint32 guild_id, uint32 char_id) const;
uint8 GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 char_id) const;
bool CheckGMStatus(uint32 guild_id, uint8 status) const;
+7469 -1777
View File
File diff suppressed because it is too large Load Diff
+633
View File
@@ -0,0 +1,633 @@
// Copyright (C) 2015 Ben Lewis <benjf5+github@gmail.com>
// Licensed under the MIT license.
// https://github.com/ben-zen/uri-library
#pragma once
#include <cctype>
#include <map>
#include <string>
#include <stdexcept>
#include <utility>
class uri {
/* URIs are broadly divided into two categories: hierarchical and
* non-hierarchical. Both hierarchical URIs and non-hierarchical URIs have a
* few elements in common; all URIs have a scheme of one or more alphanumeric
* characters followed by a colon, and they all may optionally have a query
* component preceded by a question mark, and a fragment component preceded by
* an octothorpe (hash mark: '#'). The query consists of stanzas separated by
* either ampersands ('&') or semicolons (';') (but only one or the other),
* and each stanza consists of a key and an optional value; if the value
* exists, the key and value must be divided by an equals sign.
*
* The following is an example from Wikipedia of a hierarchical URI:
* scheme:[//[user:password@]domain[:port]][/]path[?query][#fragment]
*/
public:
enum class scheme_category {
Hierarchical,
NonHierarchical
};
enum class component {
Scheme,
Content,
Username,
Password,
Host,
Port,
Path,
Query,
Fragment
};
enum class query_argument_separator {
ampersand,
semicolon
};
uri(
char const *uri_text, scheme_category category = scheme_category::Hierarchical,
query_argument_separator separator = query_argument_separator::ampersand
) :
m_category(category),
m_path_is_rooted(false),
m_port(0),
m_separator(separator)
{
setup(std::string(uri_text), category);
};
uri(
std::string const &uri_text, scheme_category category = scheme_category::Hierarchical,
query_argument_separator separator = query_argument_separator::ampersand
) :
m_category(category),
m_path_is_rooted(false),
m_port(0),
m_separator(separator)
{
setup(uri_text, category);
};
uri(
std::map<component, std::string> const &components,
scheme_category category,
bool rooted_path,
query_argument_separator separator = query_argument_separator::ampersand
) :
m_category(category),
m_path_is_rooted(rooted_path),
m_separator(separator)
{
if (components.count(component::Scheme)) {
if (components.at(component::Scheme).length() == 0) {
throw std::invalid_argument("Scheme cannot be empty.");
}
m_scheme = components.at(component::Scheme);
}
else {
throw std::invalid_argument("A URI must have a scheme.");
}
if (category == scheme_category::Hierarchical) {
if (components.count(component::Content)) {
throw std::invalid_argument("The content component is only for use in non-hierarchical URIs.");
}
bool has_username = components.count(component::Username);
bool has_password = components.count(component::Password);
if (has_username && has_password) {
m_username = components.at(component::Username);
m_password = components.at(component::Password);
}
else if ((has_username && !has_password) || (!has_username && has_password)) {
throw std::invalid_argument("If a username or password is supplied, both must be provided.");
}
if (components.count(component::Host)) {
m_host = components.at(component::Host);
}
if (components.count(component::Port)) {
m_port = std::stoul(components.at(component::Port));
}
if (components.count(component::Path)) {
m_path = components.at(component::Path);
}
else {
throw std::invalid_argument("A path is required on a hierarchical URI, even an empty path.");
}
}
else {
if (components.count(component::Username)
|| components.count(component::Password)
|| components.count(component::Host)
|| components.count(component::Port)
|| components.count(component::Path)) {
throw std::invalid_argument("None of the hierarchical components are allowed in a non-hierarchical URI.");
}
if (components.count(component::Content)) {
m_content = components.at(component::Content);
}
else {
throw std::invalid_argument(
"Content is a required component for a non-hierarchical URI, even an empty string."
);
}
}
if (components.count(component::Query)) {
m_query = components.at(component::Query);
}
if (components.count(component::Fragment)) {
m_fragment = components.at(component::Fragment);
}
}
uri(uri const &other, std::map<component, std::string> const &replacements) :
m_category(other.m_category),
m_path_is_rooted(other.m_path_is_rooted),
m_separator(other.m_separator)
{
m_scheme = (replacements.count(component::Scheme))
? replacements.at(component::Scheme) : other.m_scheme;
if (m_category == scheme_category::Hierarchical) {
m_username = (replacements.count(component::Username))
? replacements.at(component::Username) : other.m_username;
m_password = (replacements.count(component::Password))
? replacements.at(component::Password) : other.m_password;
m_host = (replacements.count(component::Host))
? replacements.at(component::Host) : other.m_host;
m_port = (replacements.count(component::Port))
? std::stoul(replacements.at(component::Port)) : other.m_port;
m_path = (replacements.count(component::Path))
? replacements.at(component::Path) : other.m_path;
}
else {
m_content = (replacements.count(component::Content))
? replacements.at(component::Content) : other.m_content;
}
m_query = (replacements.count(component::Query))
? replacements.at(component::Query) : other.m_query;
m_fragment = (replacements.count(component::Fragment))
? replacements.at(component::Fragment) : other.m_fragment;
}
// Copy constructor; just use the copy assignment operator internally.
uri(uri const &other)
{
*this = other;
};
// Copy assignment operator
uri &operator=(uri const &other)
{
if (this != &other) {
m_scheme = other.m_scheme;
m_content = other.m_content;
m_username = other.m_username;
m_password = other.m_password;
m_host = other.m_host;
m_path = other.m_path;
m_query = other.m_query;
m_fragment = other.m_fragment;
m_query_dict = other.m_query_dict;
m_category = other.m_category;
m_port = other.m_port;
m_path_is_rooted = other.m_path_is_rooted;
m_separator = other.m_separator;
}
return *this;
}
~uri() {};
std::string const &get_scheme() const
{
return m_scheme;
};
scheme_category get_scheme_category() const
{
return m_category;
};
std::string const &get_content() const
{
if (m_category != scheme_category::NonHierarchical) {
throw std::domain_error("The content component is only valid for non-hierarchical URIs.");
}
return m_content;
};
std::string const &get_username() const
{
if (m_category != scheme_category::Hierarchical) {
throw std::domain_error("The username component is only valid for hierarchical URIs.");
}
return m_username;
};
std::string const &get_password() const
{
if (m_category != scheme_category::Hierarchical) {
throw std::domain_error("The password component is only valid for hierarchical URIs.");
}
return m_password;
};
std::string const &get_host() const
{
if (m_category != scheme_category::Hierarchical) {
throw std::domain_error("The host component is only valid for hierarchical URIs.");
}
return m_host;
};
unsigned long get_port() const
{
if (m_category != scheme_category::Hierarchical) {
throw std::domain_error("The port component is only valid for hierarchical URIs.");
}
return m_port;
};
std::string const &get_path() const
{
if (m_category != scheme_category::Hierarchical) {
throw std::domain_error("The path component is only valid for hierarchical URIs.");
}
return m_path;
};
std::string const &get_query() const
{
return m_query;
};
std::map<std::string, std::string> const &get_query_dictionary() const
{
return m_query_dict;
};
std::string const &get_fragment() const
{
return m_fragment;
};
std::string to_string() const
{
std::string full_uri;
full_uri.append(m_scheme);
full_uri.append(":");
if (m_content.length() > m_path.length()) {
full_uri.append("//");
if (!(m_username.empty() || m_password.empty())) {
full_uri.append(m_username);
full_uri.append(":");
full_uri.append(m_password);
full_uri.append("@");
}
full_uri.append(m_host);
if (m_port != 0) {
full_uri.append(":");
full_uri.append(std::to_string(m_port));
}
}
if (m_path_is_rooted) {
full_uri.append("/");
}
full_uri.append(m_path);
if (!m_query.empty()) {
full_uri.append("?");
full_uri.append(m_query);
}
if (!m_fragment.empty()) {
full_uri.append("#");
full_uri.append(m_fragment);
}
return full_uri;
};
private:
void setup(std::string const &uri_text, scheme_category category)
{
size_t const uri_length = uri_text.length();
if (uri_length == 0) {
throw std::invalid_argument("URIs cannot be of zero length.");
}
std::string::const_iterator cursor = parse_scheme(
uri_text,
uri_text.begin());
// After calling parse_scheme, *cursor == ':'; none of the following parsers
// expect a separator character, so we advance the cursor upon calling them.
cursor = parse_content(uri_text, (cursor + 1));
if ((cursor != uri_text.end()) && (*cursor == '?')) {
cursor = parse_query(uri_text, (cursor + 1));
}
if ((cursor != uri_text.end()) && (*cursor == '#')) {
cursor = parse_fragment(uri_text, (cursor + 1));
}
init_query_dictionary(); // If the query string is empty, this will be empty too.
};
std::string::const_iterator parse_scheme(
std::string const &uri_text,
std::string::const_iterator scheme_start
)
{
std::string::const_iterator scheme_end = scheme_start;
while ((scheme_end != uri_text.end()) && (*scheme_end != ':')) {
if (!(std::isalnum(*scheme_end) || (*scheme_end == '-')
|| (*scheme_end == '+') || (*scheme_end == '.'))) {
throw std::invalid_argument(
"Invalid character found in the scheme component. Supplied URI was: \""
+ uri_text + "\"."
);
}
++scheme_end;
}
if (scheme_end == uri_text.end()) {
throw std::invalid_argument(
"End of URI found while parsing the scheme. Supplied URI was: \""
+ uri_text + "\"."
);
}
if (scheme_start == scheme_end) {
throw std::invalid_argument(
"Scheme component cannot be zero-length. Supplied URI was: \""
+ uri_text + "\"."
);
}
m_scheme = std::move(std::string(scheme_start, scheme_end));
return scheme_end;
};
std::string::const_iterator parse_content(
std::string const &uri_text,
std::string::const_iterator content_start
)
{
std::string::const_iterator content_end = content_start;
while ((content_end != uri_text.end()) && (*content_end != '?') && (*content_end != '#')) {
++content_end;
}
m_content = std::move(std::string(content_start, content_end));
if ((m_category == scheme_category::Hierarchical) && (m_content.length() > 0)) {
// If it's a hierarchical URI, the content should be parsed for the hierarchical components.
std::string::const_iterator path_start = m_content.begin();
std::string::const_iterator path_end = m_content.end();
if (!m_content.compare(0, 2, "//")) {
// In this case an authority component is present.
std::string::const_iterator authority_cursor = (m_content.begin() + 2);
if (m_content.find_first_of('@') != std::string::npos) {
std::string::const_iterator userpass_divider = parse_username(
uri_text,
m_content,
authority_cursor
);
authority_cursor = parse_password(uri_text, m_content, (userpass_divider + 1));
// After this call, *authority_cursor == '@', so we skip over it.
++authority_cursor;
}
authority_cursor = parse_host(uri_text, m_content, authority_cursor);
if ((authority_cursor != m_content.end()) && (*authority_cursor == ':')) {
authority_cursor = parse_port(uri_text, m_content, (authority_cursor + 1));
}
if ((authority_cursor != m_content.end()) && (*authority_cursor == '/')) {
// Then the path is rooted, and we should note this.
m_path_is_rooted = true;
path_start = authority_cursor + 1;
}
// If we've reached the end and no path is present then set path_start
// to the end.
if (authority_cursor == m_content.end()) {
path_start = m_content.end();
}
}
else if (!m_content.compare(0, 1, "/")) {
m_path_is_rooted = true;
++path_start;
}
// We can now build the path based on what remains in the content string,
// since that's all that exists after the host and optional port component.
m_path = std::move(std::string(path_start, path_end));
}
return content_end;
};
std::string::const_iterator parse_username(
std::string const &uri_text,
std::string const &content,
std::string::const_iterator username_start
)
{
std::string::const_iterator username_end = username_start;
// Since this is only reachable when '@' was in the content string, we can
// ignore the end-of-string case.
while (*username_end != ':') {
if (*username_end == '@') {
throw std::invalid_argument(
"Username must be followed by a password. Supplied URI was: \""
+ uri_text + "\"."
);
}
++username_end;
}
m_username = std::move(std::string(username_start, username_end));
return username_end;
};
std::string::const_iterator parse_password(
std::string const &uri_text,
std::string const &content,
std::string::const_iterator password_start
)
{
std::string::const_iterator password_end = password_start;
while (*password_end != '@') {
++password_end;
}
m_password = std::move(std::string(password_start, password_end));
return password_end;
};
std::string::const_iterator parse_host(
std::string const &uri_text,
std::string const &content,
std::string::const_iterator host_start
)
{
std::string::const_iterator host_end = host_start;
// So, the host can contain a few things. It can be a domain, it can be an
// IPv4 address, it can be an IPv6 address, or an IPvFuture literal. In the
// case of those last two, it's of the form [...] where what's between the
// brackets is a matter of which IPv?? version it is.
while (host_end != content.end()) {
if (*host_end == '[') {
// We're parsing an IPv6 or IPvFuture address, so we should handle that
// instead of the normal procedure.
while ((host_end != content.end()) && (*host_end != ']')) {
++host_end;
}
if (host_end == content.end()) {
throw std::invalid_argument(
"End of content component encountered "
"while parsing the host component. "
"Supplied URI was: \""
+ uri_text + "\"."
);
}
++host_end;
break;
// We can stop looping, we found the end of the IP literal, which is the
// whole of the host component when one's in use.
}
else if ((*host_end == ':') || (*host_end == '/')) {
break;
}
else {
++host_end;
}
}
m_host = std::move(std::string(host_start, host_end));
return host_end;
};
std::string::const_iterator parse_port(
std::string const &uri_text,
std::string const &content,
std::string::const_iterator port_start
)
{
std::string::const_iterator port_end = port_start;
while ((port_end != content.end()) && (*port_end != '/')) {
if (!std::isdigit(*port_end)) {
throw std::invalid_argument(
"Invalid character while parsing the port. "
"Supplied URI was: \"" + uri_text + "\"."
);
}
++port_end;
}
m_port = std::stoul(std::string(port_start, port_end));
return port_end;
};
std::string::const_iterator parse_query(
std::string const &uri_text,
std::string::const_iterator query_start
)
{
std::string::const_iterator query_end = query_start;
while ((query_end != uri_text.end()) && (*query_end != '#')) {
// Queries can contain almost any character except hash, which is reserved
// for the start of the fragment.
++query_end;
}
m_query = std::move(std::string(query_start, query_end));
return query_end;
};
std::string::const_iterator parse_fragment(
std::string const &uri_text,
std::string::const_iterator fragment_start
)
{
m_fragment = std::move(std::string(fragment_start, uri_text.end()));
return uri_text.end();
};
void init_query_dictionary()
{
if (!m_query.empty()) {
// Loop over the query string looking for '&'s, then check each one for
// an '=' to find keys and values; if there's not an '=' then the key
// will have an empty value in the map.
char separator = (m_separator == query_argument_separator::ampersand) ? '&' : ';';
size_t carat = 0;
size_t stanza_end = m_query.find_first_of(separator);
do {
std::string stanza = m_query.substr(
carat,
((stanza_end != std::string::npos) ? (stanza_end - carat) : std::string::npos));
size_t key_value_divider = stanza.find_first_of('=');
std::string key = stanza.substr(0, key_value_divider);
std::string value;
if (key_value_divider != std::string::npos) {
value = stanza.substr((key_value_divider + 1));
}
if (m_query_dict.count(key) != 0) {
throw std::invalid_argument("Bad key in the query string!");
}
m_query_dict.emplace(key, value);
carat = ((stanza_end != std::string::npos) ? (stanza_end + 1)
: std::string::npos);
stanza_end = m_query.find_first_of(separator, carat);
} while ((stanza_end != std::string::npos)
|| (carat != std::string::npos));
}
}
std::string m_scheme;
std::string m_content;
std::string m_username;
std::string m_password;
std::string m_host;
std::string m_path;
std::string m_query;
std::string m_fragment;
std::map<std::string, std::string> m_query_dict;
scheme_category m_category;
unsigned long m_port;
bool m_path_is_rooted;
query_argument_separator m_separator;
};
+169 -107
View File
@@ -25,7 +25,7 @@
//#include "races.h"
//#include "rulesys.h"
//#include "shareddb.h"
#include "string_util.h"
#include "strings.h"
#include "../common/light_source.h"
@@ -33,7 +33,7 @@
#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
void ItemInstQueue::push(EQEmu::ItemInstance* inst)
void ItemInstQueue::push(EQ::ItemInstance* inst)
{
m_list.push_back(inst);
}
// 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);
}
// Remove item from front of queue
EQEmu::ItemInstance* ItemInstQueue::pop()
EQ::ItemInstance* ItemInstQueue::pop()
{
if (m_list.empty())
return nullptr;
EQEmu::ItemInstance* inst = m_list.front();
EQ::ItemInstance* inst = m_list.front();
m_list.pop_front();
return inst;
}
// Remove item from back of queue
EQEmu::ItemInstance* ItemInstQueue::pop_back()
EQ::ItemInstance* ItemInstQueue::pop_back()
{
if (m_list.empty())
return nullptr;
EQEmu::ItemInstance* inst = m_list.back();
EQ::ItemInstance* inst = m_list.back();
m_list.pop_back();
return inst;
}
// 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();
}
//
// class EQEmu::InventoryProfile
// class EQ::InventoryProfile
//
EQEmu::InventoryProfile::~InventoryProfile()
EQ::InventoryProfile::~InventoryProfile()
{
for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) {
safe_delete(iter->second);
@@ -119,18 +119,18 @@ EQEmu::InventoryProfile::~InventoryProfile()
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);
SetGMInventory(m_gm_inventory);
}
void EQEmu::InventoryProfile::SetGMInventory(bool gmi_flag) {
void EQ::InventoryProfile::SetGMInventory(bool gmi_flag) {
m_gm_inventory = gmi_flag;
m_lookup = inventory::DynamicLookup(m_mob_version, gmi_flag);
}
void EQEmu::InventoryProfile::CleanDirty() {
void EQ::InventoryProfile::CleanDirty() {
auto iter = dirty_inst.begin();
while (iter != dirty_inst.end()) {
delete (*iter);
@@ -139,14 +139,14 @@ void EQEmu::InventoryProfile::CleanDirty() {
dirty_inst.clear();
}
void EQEmu::InventoryProfile::MarkDirty(ItemInstance *inst) {
void EQ::InventoryProfile::MarkDirty(ItemInstance *inst) {
if (inst) {
dirty_inst.push_back(inst);
}
}
// 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;
@@ -219,33 +219,33 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const
}
// 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));
}
// Put an item snto specified slot
int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
// Put an item into specified slot
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)
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) {
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_id - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
else if (slot_id <= EQ::invbag::GENERAL_BAGS_END && slot_id >= EQ::invbag::GENERAL_BAGS_BEGIN) {
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)
return EQEmu::invslot::SLOT_INVALID;
return EQ::invslot::SLOT_INVALID;
}
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
if ((slot_id - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank)
return EQEmu::invslot::SLOT_INVALID;
else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
if ((slot_id - EQ::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank)
return EQ::invslot::SLOT_INVALID;
}
else if (slot_id <= EQEmu::invbag::BANK_BAGS_END && slot_id >= EQEmu::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (slot_id - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
else if (slot_id <= EQ::invbag::BANK_BAGS_END && slot_id >= EQ::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (slot_id - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
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)
DeleteItem(slot_id);
@@ -259,17 +259,17 @@ int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
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());
return invslot::slotCursor;
}
EQEmu::ItemInstance* EQEmu::InventoryProfile::GetCursorItem() {
EQ::ItemInstance* EQ::InventoryProfile::GetCursorItem() {
return m_cursor.peek_front();
}
// Swap items in inventory
bool EQEmu::InventoryProfile::SwapItem(
bool EQ::InventoryProfile::SwapItem(
int16 source_slot,
int16 destination_slot,
SwapItemFailState &fail_state,
@@ -280,54 +280,54 @@ bool EQEmu::InventoryProfile::SwapItem(
) {
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) {
fail_state = swapNotAllowed;
return false;
}
}
else if (source_slot <= EQEmu::invbag::GENERAL_BAGS_END && source_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((source_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
else if (source_slot <= EQ::invbag::GENERAL_BAGS_END && source_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
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) {
fail_state = swapNotAllowed;
return false;
}
}
else if (source_slot <= EQEmu::invslot::BANK_END && source_slot >= EQEmu::invslot::BANK_BEGIN) {
if ((source_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
else if (source_slot <= EQ::invslot::BANK_END && source_slot >= EQ::invslot::BANK_BEGIN) {
if ((source_slot - EQ::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed;
return false;
}
}
else if (source_slot <= EQEmu::invbag::BANK_BAGS_END && source_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (source_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
else if (source_slot <= EQ::invbag::BANK_BAGS_END && source_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (source_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed;
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) {
fail_state = swapNotAllowed;
return false;
}
}
else if (destination_slot <= EQEmu::invbag::GENERAL_BAGS_END && destination_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((destination_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
else if (destination_slot <= EQ::invbag::GENERAL_BAGS_END && destination_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
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) {
fail_state = swapNotAllowed;
return false;
}
}
else if (destination_slot <= EQEmu::invslot::BANK_END && destination_slot >= EQEmu::invslot::BANK_BEGIN) {
if ((destination_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
else if (destination_slot <= EQ::invslot::BANK_END && destination_slot >= EQ::invslot::BANK_BEGIN) {
if ((destination_slot - EQ::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed;
return false;
}
}
else if (destination_slot <= EQEmu::invbag::BANK_BAGS_END && destination_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (destination_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
else if (destination_slot <= EQ::invbag::BANK_BAGS_END && destination_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (destination_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize.Bank) {
fail_state = swapNotAllowed;
return false;
@@ -399,7 +399,7 @@ bool EQEmu::InventoryProfile::SwapItem(
}
// Remove item from inventory (with memory delete)
bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
bool EQ::InventoryProfile::DeleteItem(int16 slot_id, int16 quantity) {
// Pop item out of inventory map (or queue)
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
bool EQEmu::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse)
bool EQ::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse)
{
ItemInstance* inst = GetItem(slot_id);
if (!inst)
@@ -445,7 +445,7 @@ bool EQEmu::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse)
// Remove item from bucket without memory delete
// 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;
@@ -488,7 +488,7 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id)
return p;
}
bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity) {
bool EQ::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity) {
if (ItemToTry->Stackable) {
@@ -590,9 +590,71 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
// Checks that user has at least 'quantity' number of items in a given inventory slot
// Returns first slot it was found in, or SLOT_INVALID if not found
bool EQ::InventoryProfile::HasAugmentEquippedByID(uint32 item_id)
{
bool has_equipped = false;
ItemInstance* item = nullptr;
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
item = GetItem(slot_id);
if (item && item->ContainsAugmentByID(item_id)) {
has_equipped = true;
break;
}
}
return has_equipped;
}
int EQ::InventoryProfile::CountAugmentEquippedByID(uint32 item_id)
{
int quantity = 0;
ItemInstance* item = nullptr;
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
item = GetItem(slot_id);
if (item && item->ContainsAugmentByID(item_id)) {
quantity += item->CountAugmentByID(item_id);
}
}
return quantity;
}
bool EQ::InventoryProfile::HasItemEquippedByID(uint32 item_id)
{
bool has_equipped = false;
ItemInstance* item = nullptr;
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
item = GetItem(slot_id);
if (item && item->GetID() == item_id) {
has_equipped = true;
break;
}
}
return has_equipped;
}
int EQ::InventoryProfile::CountItemEquippedByID(uint32 item_id)
{
int quantity = 0;
ItemInstance* item = nullptr;
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
item = GetItem(slot_id);
if (item && item->GetID() == item_id) {
quantity += item->IsStackable() ? item->GetCharges() : 1;
}
}
return quantity;
}
//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.
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;
@@ -642,7 +704,7 @@ int16 EQEmu::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 whe
}
//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;
@@ -688,7 +750,7 @@ int16 EQEmu::InventoryProfile::HasItemByUse(uint8 use, uint8 quantity, uint8 whe
return slot_id;
}
int16 EQEmu::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where)
int16 EQ::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where)
{
int16 slot_id = INVALID_INDEX;
@@ -736,7 +798,7 @@ int16 EQEmu::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where)
// Locate an available inventory slot
// 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
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
@@ -786,7 +848,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...
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().
// If you have a need, use it..but, understand it is not a suitable replacement for InventoryProfile::FindFreeSlot().
//
@@ -924,14 +986,14 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
}
// 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;
// this is not a bag range... using this risks over-writing existing items
//else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END)
// parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE;
//else if (slot_id >= 3100 && slot_id <= 3179) should be {3031..3110}..where did this range come from!!? (verified db save range)
if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) {
parent_slot_id = invslot::GENERAL_BEGIN + (slot_id - invbag::GENERAL_BAGS_BEGIN) / invbag::SLOT_COUNT;
}
@@ -952,7 +1014,7 @@ int16 EQEmu::InventoryProfile::CalcSlotId(int16 slot_id) {
}
// 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))
return INVALID_INDEX;
@@ -977,7 +1039,7 @@ int16 EQEmu::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx) {
return slot_id;
}
uint8 EQEmu::InventoryProfile::CalcBagIdx(int16 slot_id) {
uint8 EQ::InventoryProfile::CalcBagIdx(int16 slot_id) {
uint8 index = 0;
// this is not a bag range... using this risks over-writing existing items
@@ -1006,7 +1068,7 @@ uint8 EQEmu::InventoryProfile::CalcBagIdx(int16 slot_id) {
return index;
}
int16 EQEmu::InventoryProfile::CalcSlotFromMaterial(uint8 material)
int16 EQ::InventoryProfile::CalcSlotFromMaterial(uint8 material)
{
switch (material)
{
@@ -1033,7 +1095,7 @@ int16 EQEmu::InventoryProfile::CalcSlotFromMaterial(uint8 material)
}
}
uint8 EQEmu::InventoryProfile::CalcMaterialFromSlot(int16 equipslot)
uint8 EQ::InventoryProfile::CalcMaterialFromSlot(int16 equipslot)
{
switch (equipslot)
{
@@ -1061,7 +1123,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)
return false;
@@ -1078,7 +1140,7 @@ bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, c
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
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
@@ -1095,7 +1157,7 @@ bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
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)
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
@@ -1112,7 +1174,7 @@ bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id)
}
// 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) ||
(slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) ||
@@ -1126,7 +1188,7 @@ bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id)
return false;
}
int EQEmu::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) {
int EQ::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) {
if (!inst)
return INVALID_INDEX;
@@ -1162,14 +1224,14 @@ int EQEmu::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) {
return INVALID_INDEX;
}
uint8 EQEmu::InventoryProfile::FindBrightestLightType()
uint8 EQ::InventoryProfile::FindBrightestLightType()
{
uint8 brightest_light_type = 0;
for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) {
if ((iter->first < invslot::EQUIPMENT_BEGIN || iter->first > invslot::EQUIPMENT_END))
continue;
if (iter->first == invslot::slotAmmo)
continue;
@@ -1213,7 +1275,7 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType()
return brightest_light_type;
}
void EQEmu::InventoryProfile::dumpEntireInventory() {
void EQ::InventoryProfile::dumpEntireInventory() {
dumpWornItems();
dumpInventory();
@@ -1223,29 +1285,29 @@ void EQEmu::InventoryProfile::dumpEntireInventory() {
std::cout << std::endl;
}
void EQEmu::InventoryProfile::dumpWornItems() {
void EQ::InventoryProfile::dumpWornItems() {
std::cout << "Worn items:" << std::endl;
dumpItemCollection(m_worn);
}
void EQEmu::InventoryProfile::dumpInventory() {
void EQ::InventoryProfile::dumpInventory() {
std::cout << "Inventory items:" << std::endl;
dumpItemCollection(m_inv);
}
void EQEmu::InventoryProfile::dumpBankItems() {
void EQ::InventoryProfile::dumpBankItems() {
std::cout << "Bank items:" << std::endl;
dumpItemCollection(m_bank);
}
void EQEmu::InventoryProfile::dumpSharedBankItems() {
void EQ::InventoryProfile::dumpSharedBankItems() {
std::cout << "Shared Bank items:" << std::endl;
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) {
ItemInstance *t_inst = iter->second;
if (t_inst == inst) {
@@ -1261,10 +1323,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) {
auto inst = it->second;
@@ -1278,7 +1340,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())
return;
@@ -1297,17 +1359,17 @@ void EQEmu::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map<int16
}
// 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)
return nullptr;
}
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
if (slot_id - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
if (slot_id - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
return nullptr;
}
auto it = bucket.find(slot_id);
if (it != bucket.end()) {
return it->second;
@@ -1319,7 +1381,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
// 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...
//
@@ -1356,7 +1418,7 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
result = slot_id;
}
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;
result = slot_id;
}
@@ -1379,7 +1441,7 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
result = slot_id;
}
}
if (result == INVALID_INDEX) {
LogError("InventoryProfile::_PutItem: Invalid slot_id specified ({}) with parent slot id ({})", slot_id, parentSlot);
InventoryProfile::MarkDirty(inst); // Slot not found, clean up
@@ -1389,17 +1451,17 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
}
// 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;
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)
continue;
}
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
else if (iter->first <= EQ::invslot::BANK_END && iter->first >= EQ::invslot::BANK_BEGIN) {
if (iter->first - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
continue;
}
@@ -1416,7 +1478,7 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket,
if (inst->GetAugmentItemID(index) == item_id && quantity <= 1)
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
}
if (!inst->IsClassBag()) { continue; }
for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) {
@@ -1440,14 +1502,14 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket,
}
// 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
// found, it is presented as being available on the cursor. In cases of a parity check, this
// is sufficient. However, in cases where referential criteria is considered, this can lead
// to unintended results. Funtionality should be observed when referencing the return value
// of this query
uint32 quantity_found = 0;
for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) {
@@ -1491,17 +1553,17 @@ int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, u
}
// 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;
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)
continue;
}
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
else if (iter->first <= EQ::invslot::BANK_END && iter->first >= EQ::invslot::BANK_BEGIN) {
if (iter->first - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
continue;
}
@@ -1532,7 +1594,7 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(std::map<int16, ItemInstance*>& buc
}
// 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;
@@ -1566,15 +1628,15 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, u
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) {
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)
continue;
}
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
else if (iter->first <= EQ::invslot::BANK_END && iter->first >= EQ::invslot::BANK_BEGIN) {
if (iter->first - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank)
continue;
}
@@ -1611,11 +1673,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
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) {
auto inst = *iter;
@@ -1653,6 +1715,6 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32
// We only check the visible cursor due to lack of queue processing ability (client allows duplicate in limbo)
break;
}
return EQEmu::invslot::SLOT_INVALID;
return EQ::invslot::SLOT_INVALID;
}
+24 -11
View File
@@ -52,30 +52,30 @@ public:
// Public Methods
/////////////////////////
inline std::list<EQEmu::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 cbegin() { return m_list.cbegin(); }
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 bool empty() { return m_list.empty(); }
void push(EQEmu::ItemInstance* inst);
void push_front(EQEmu::ItemInstance* inst);
EQEmu::ItemInstance* pop();
EQEmu::ItemInstance* pop_back();
EQEmu::ItemInstance* peek_front() const;
void push(EQ::ItemInstance* inst);
void push_front(EQ::ItemInstance* inst);
EQ::ItemInstance* pop();
EQ::ItemInstance* pop_back();
EQ::ItemInstance* peek_front() const;
protected:
/////////////////////////
// Protected Members
/////////////////////////
std::list<EQEmu::ItemInstance*> m_list;
std::list<EQ::ItemInstance*> m_list;
};
// ########################################
// Class: EQEmu::InventoryProfile
// Class: EQ::InventoryProfile
// Character inventory
namespace EQEmu
namespace EQ
{
class InventoryProfile
{
@@ -132,7 +132,7 @@ namespace EQEmu
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = 0, uint8 class_id = 0, uint16 deity_id = 0, uint8 level = 0);
// Remove item from inventory
bool DeleteItem(int16 slot_id, uint8 quantity = 0);
bool DeleteItem(int16 slot_id, int16 quantity = 0);
// Checks All items in a bag for No Drop
bool CheckNoDrop(int16 slot_id, bool recurse = true);
@@ -140,6 +140,18 @@ namespace EQEmu
// Remove item from inventory (and take control of memory)
ItemInstance* PopItem(int16 slot_id);
// Check if player has a specific item equipped by Item ID
bool HasItemEquippedByID(uint32 item_id);
// Check how many of a specific item the player has equipped by Item ID
int CountItemEquippedByID(uint32 item_id);
// Check if player has a specific augment equipped by Item ID
bool HasAugmentEquippedByID(uint32 item_id);
// Check how many of a specific augment the player has equipped by Item ID
int CountAugmentEquippedByID(uint32 item_id);
// Check whether there is space for the specified number of the specified item.
bool HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity);
@@ -190,6 +202,7 @@ namespace EQEmu
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value);
std::string GetCustomItemData(int16 slot_id, std::string identifier);
static int GetItemStatValue(uint32 item_id, const char* identifier);
protected:
///////////////////////////////
// Protected Methods
+36 -36
View File
@@ -19,10 +19,10 @@
#include "inventory_slot.h"
#include "textures.h"
#include "string_util.h"
#include "strings.h"
int8 EQEmu::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index)
int8 EQ::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index)
{
switch (slot_index) {
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))
return textures::textureInvalid;
@@ -56,7 +56,7 @@ int8 EQEmu::inventory::ConvertEquipmentSlotToTextureIndex(const InventorySlot& i
return ConvertEquipmentIndexToTextureIndex(inventory_slot.SlotIndex());
}
int16 EQEmu::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index)
int16 EQ::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index)
{
switch (texture_index) {
case textures::armorHead:
@@ -82,11 +82,11 @@ int16 EQEmu::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index)
}
}
bool EQEmu::InventorySlot::IsValidSlot() const
bool EQ::InventorySlot::IsValidSlot() const
{
if (_typeless)
return false;
int16 slot_count = invtype::GetInvTypeSize(_type_index);
if (!slot_count || _slot_index < invslot::SLOT_BEGIN || _slot_index >= slot_count)
return false;
@@ -100,7 +100,7 @@ bool EQEmu::InventorySlot::IsValidSlot() const
return true;
}
bool EQEmu::InventorySlot::IsDeleteSlot() const
bool EQ::InventorySlot::IsDeleteSlot() const
{
if (_typeless)
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);
}
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)
return false;
@@ -116,7 +116,7 @@ bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index)
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)
return false;
@@ -124,7 +124,7 @@ bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index)
return true;
}
bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index)
bool EQ::InventorySlot::IsCursorIndex(int16 slot_index)
{
if (slot_index == invslot::slotCursor)
return true;
@@ -132,15 +132,15 @@ bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index)
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)
return true;
return false;
}
bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index)
bool EQ::InventorySlot::IsTextureIndex(int16 slot_index)
{
switch (slot_index) {
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) {
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))
return false;
@@ -185,7 +185,7 @@ bool EQEmu::InventorySlot::IsEquipmentSlot() const
return IsEquipmentIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsGeneralSlot() const
bool EQ::InventorySlot::IsGeneralSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -196,7 +196,7 @@ bool EQEmu::InventorySlot::IsGeneralSlot() const
return IsGeneralIndex(_socket_index);
}
bool EQEmu::InventorySlot::IsCursorSlot() const
bool EQ::InventorySlot::IsCursorSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -207,7 +207,7 @@ bool EQEmu::InventorySlot::IsCursorSlot() const
return IsCursorIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsWeaponSlot() const
bool EQ::InventorySlot::IsWeaponSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -218,7 +218,7 @@ bool EQEmu::InventorySlot::IsWeaponSlot() const
return IsWeaponIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsTextureSlot() const
bool EQ::InventorySlot::IsTextureSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -229,7 +229,7 @@ bool EQEmu::InventorySlot::IsTextureSlot() const
return IsTextureIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsTintableSlot() const
bool EQ::InventorySlot::IsTintableSlot() const
{
if (!_typeless && (_type_index != invtype::typePossessions))
return false;
@@ -240,7 +240,7 @@ bool EQEmu::InventorySlot::IsTintableSlot() const
return IsTintableIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsSlot() const
bool EQ::InventorySlot::IsSlot() const
{
if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false;
@@ -254,7 +254,7 @@ bool EQEmu::InventorySlot::IsSlot() const
return true;
}
bool EQEmu::InventorySlot::IsSlotSocket() const
bool EQ::InventorySlot::IsSlotSocket() const
{
if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false;
@@ -268,7 +268,7 @@ bool EQEmu::InventorySlot::IsSlotSocket() const
return true;
}
bool EQEmu::InventorySlot::IsContainer() const
bool EQ::InventorySlot::IsContainer() const
{
if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false;
@@ -282,7 +282,7 @@ bool EQEmu::InventorySlot::IsContainer() const
return true;
}
bool EQEmu::InventorySlot::IsContainerSocket() const
bool EQ::InventorySlot::IsContainerSocket() const
{
if (!_typeless && (_type_index == invtype::TYPE_INVALID))
return false;
@@ -296,12 +296,12 @@ bool EQEmu::InventorySlot::IsContainerSocket() const
return true;
}
EQEmu::InventorySlot EQEmu::InventorySlot::ToTopOwner() const
EQ::InventorySlot EQ::InventorySlot::ToTopOwner() const
{
return InventorySlot(_type_index, _slot_index);
}
EQEmu::InventorySlot EQEmu::InventorySlot::ToOwner() const
EQ::InventorySlot EQ::InventorySlot::ToOwner() const
{
if (IsSlot() || IsSlotSocket() || IsContainer())
return InventorySlot(_type_index, _slot_index);
@@ -312,17 +312,17 @@ EQEmu::InventorySlot EQEmu::InventorySlot::ToOwner() const
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);
}
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);
}
void EQEmu::InventorySlot::SetInvalidSlot()
void EQ::InventorySlot::SetInvalidSlot()
{
_type_index = invtype::TYPE_INVALID;
_slot_index = invslot::SLOT_INVALID;
@@ -330,7 +330,7 @@ void EQEmu::InventorySlot::SetInvalidSlot()
_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))
// return true;
@@ -338,7 +338,7 @@ void EQEmu::InventorySlot::SetInvalidSlot()
// 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))
// return false;
@@ -346,7 +346,7 @@ void EQEmu::InventorySlot::SetInvalidSlot()
// 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())
return true;
@@ -360,11 +360,11 @@ bool inventory_slot_typeless_lessthan(const EQEmu::InventorySlot& lhs, const EQE
return false;
}
bool EQEmu::InventorySlot::operator<(const InventorySlot& rhs) const
bool EQ::InventorySlot::operator<(const InventorySlot& rhs) const
{
if (Typeless() || rhs.Typeless())
return inventory_slot_typeless_lessthan(*this, rhs);
if (TypeIndex() < rhs.TypeIndex())
return true;
@@ -380,10 +380,10 @@ bool EQEmu::InventorySlot::operator<(const InventorySlot& rhs) const
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())
return ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() == rhs.SocketIndex()));
return ((lhs.TypeIndex() == rhs.TypeIndex()) && (lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() == rhs.SocketIndex()));
}
+1 -1
View File
@@ -23,7 +23,7 @@
#include "emu_constants.h"
namespace EQEmu
namespace EQ
{
class InventorySlot;
+155
View File
@@ -18,7 +18,17 @@
*
*/
#include <cstring>
#include <fmt/format.h>
#include <csignal>
#include <vector>
#include "ip_util.h"
#include "http/httplib.h"
#include "http/uri.h"
#include "eqemu_logsys.h"
#include "event/event_loop.h"
#include "net/dns.h"
#include "event/task_scheduler.h"
/**
* @param ip
@@ -70,3 +80,148 @@ bool IpUtil::IsIpInPrivateRfc1918(const std::string &ip)
IpUtil::IsIpInRange(ip, "192.168.0.0", "255.255.0.0")
);
}
/**
* Gets local address - pings google to inspect what interface was used locally
* @return
*/
std::string IpUtil::GetLocalIPAddress()
{
char my_ip_address[16];
unsigned int my_port;
struct sockaddr_in server_address{};
struct sockaddr_in my_address{};
int sockfd;
// Connect to server
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
return "";
}
// Set server_addr
memset(&server_address, 0, sizeof(server_address));
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = inet_addr("172.217.160.99");
server_address.sin_port = htons(80);
// Connect to server
if (connect(sockfd, (struct sockaddr *) &server_address, sizeof(server_address)) < 0) {
close(sockfd);
return "";
}
// Get my ip address and port
memset(&my_address, 0, sizeof(my_address));
socklen_t len = sizeof(my_address);
getsockname(sockfd, (struct sockaddr *) &my_address, &len);
inet_ntop(AF_INET, &my_address.sin_addr, my_ip_address, sizeof(my_ip_address));
my_port = ntohs(my_address.sin_port);
return fmt::format("{}", my_ip_address);
}
/**
* Gets public address
* Uses various websites as options to return raw public IP back to the client
* @return
*/
std::string IpUtil::GetPublicIPAddress()
{
std::vector<std::string> endpoints = {
"http://ifconfig.me",
"http://api.ipify.org",
"http://ipinfo.io/ip",
"http://ipecho.net/plain",
};
for (auto &s: endpoints) {
// http get request
uri u(s);
httplib::Client r(
fmt::format(
"{}://{}",
u.get_scheme(),
u.get_host()
).c_str()
);
httplib::Headers headers = {
{"Content-type", "text/plain; charset=utf-8"},
{"User-Agent", "curl/7.81.0"}
};
r.set_connection_timeout(1, 0);
r.set_read_timeout(1, 0);
r.set_write_timeout(1, 0);
if (auto res = r.Get(fmt::format("/{}", u.get_path()).c_str(), headers)) {
if (res->status == 200) {
if (res->body.find('.') != std::string::npos) {
return res->body;
}
}
}
}
return {};
}
std::string IpUtil::DNSLookupSync(const std::string &addr, int port)
{
auto task_runner = new EQ::Event::TaskScheduler();
auto res = task_runner->Enqueue(
[&]() -> std::string {
bool running = true;
std::string ret;
EQ::Net::DNSLookup(
addr, port, false, [&](const std::string &addr) {
ret = addr;
if (addr.empty()) {
ret = "";
running = false;
}
return ret;
}
);
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
auto &loop = EQ::EventLoop::Get();
while (running) {
if (!ret.empty()) {
running = false;
}
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
if (std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() > 1500) {
LogInfo(
"[DNSLookupSync] Deadline exceeded [{}]",
1500
);
running = false;
}
loop.Process();
}
return ret;
}
);
std::string result = res.get();
safe_delete(task_runner);
return result;
}
bool IpUtil::IsIPAddress(const std::string &ip_address)
{
struct sockaddr_in sa{};
int result = inet_pton(AF_INET, ip_address.c_str(), &(sa.sin_addr));
return result != 0;
}
+8 -1
View File
@@ -30,7 +30,14 @@ public:
static uint32_t IPToUInt(const std::string &ip);
static bool IsIpInRange(const std::string &ip, const std::string &network, const std::string &mask);
static bool IsIpInPrivateRfc1918(const std::string &ip);
static std::string GetLocalIPAddress();
static std::string GetPublicIPAddress();
static std::string DNSLookupSync(
const std::string &addr,
int port
);
static bool IsIPAddress(const std::string &ip_address);
};
#endif //EQEMU_IP_UTIL_H
#endif //EQEMU_IP_UTIL_H
+5 -7
View File
@@ -30,8 +30,9 @@
#include "types.h"
#include "eqemu_exception.h"
#include "eqemu_config.h"
#include "path_manager.h"
namespace EQEmu {
namespace EQ {
struct IPCMutex::Implementation {
#ifdef _WINDOWS
HANDLE mut_;
@@ -40,12 +41,11 @@ namespace EQEmu {
#endif
};
IPCMutex::IPCMutex(std::string name) : locked_(false) {
IPCMutex::IPCMutex(const std::string& name) : locked_(false) {
imp_ = new Implementation;
#ifdef _WINDOWS
auto Config = EQEmuConfig::get();
std::string final_name = Config->SharedMemDir + "EQEmuMutex_";
final_name += name;
std::string final_name = fmt::format("{}/EQEmuMutex_{}", Config->SharedMemDir, name);
imp_->mut_ = CreateMutex(nullptr,
FALSE,
@@ -55,9 +55,7 @@ namespace EQEmu {
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
}
#else
auto Config = EQEmuConfig::get();
std::string final_name = Config->SharedMemDir + name;
final_name += ".lock";
std::string final_name = fmt::format("{}/{}.lock", path.GetSharedMemoryPath(), name);
#ifdef __DARWIN
#if __DARWIN_C_LEVEL < 200809L
+2 -2
View File
@@ -21,7 +21,7 @@
#include <string>
namespace EQEmu {
namespace EQ {
//! Interprocess Named Binary Semaphore (Mutex)
/*!
@@ -37,7 +37,7 @@ namespace EQEmu {
Creates a named binary semaphore, basically a semaphore that is init S <- 1
\param name The name of this mutex.
*/
IPCMutex(std::string name);
IPCMutex(const std::string& name);
//! Destructor
~IPCMutex();
+10 -10
View File
@@ -23,7 +23,7 @@
//#include "deity.h"
uint32 EQEmu::item::ConvertAugTypeToAugTypeBit(uint8 aug_type)
uint32 EQ::item::ConvertAugTypeToAugTypeBit(uint8 aug_type)
{
switch (aug_type) {
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) {
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)))
return false;
@@ -178,37 +178,37 @@ bool EQEmu::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const
return true;
}
bool EQEmu::ItemData::IsClassCommon() const
bool EQ::ItemData::IsClassCommon() const
{
return (ItemClass == item::ItemClassCommon);
}
bool EQEmu::ItemData::IsClassBag() const
bool EQ::ItemData::IsClassBag() const
{
return (ItemClass == item::ItemClassBag);
}
bool EQEmu::ItemData::IsClassBook() const
bool EQ::ItemData::IsClassBook() const
{
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));
}
bool EQEmu::ItemData::IsType2HWeapon() const
bool EQ::ItemData::IsType2HWeapon() const
{
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
}
bool EQEmu::ItemData::IsTypeShield() const
bool EQ::ItemData::IsTypeShield() const
{
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)
return false;
+12 -11
View File
@@ -47,7 +47,7 @@
#include "emu_constants.h"
namespace EQEmu
namespace EQ
{
namespace item {
enum ItemClass {
@@ -370,7 +370,7 @@ namespace EQEmu
uint32 Slots; // Bitfield for which slots this item can be used in
uint32 Price; // Item cost (?)
uint32 Icon; // Icon Number
uint32 LoreGroup; // Later items use LoreGroup instead of LoreFlag. we might want to see about changing this to int32 since it is commonly -1 and is constantly being cast from signed (-1) to unsigned (4294967295)
int32 LoreGroup; // Later items use LoreGroup instead of LoreFlag. we might want to see about changing this to int32 since it is commonly -1 and is constantly being cast from signed (-1) to unsigned (4294967295)
bool LoreFlag; // This will be true if LoreGroup is non-zero
bool PendingLoreFlag;
bool ArtifactFlag;
@@ -434,6 +434,7 @@ namespace EQEmu
//uint32 Unk054;
int16 MaxCharges; // Maximum charges items can hold: -1 if not a chargeable item
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
uint32 HerosForgeModel;// Hero's Forge Armor Model Type (2-13?)
float SellRate; // Sell rate
@@ -472,16 +473,16 @@ namespace EQEmu
uint32 LDoNSold;
uint32 BaneDmgRaceAmt;
uint32 AugRestrict;
uint32 Endur;
uint32 DotShielding;
uint32 Attack;
uint32 Regen;
uint32 ManaRegen;
uint32 EnduranceRegen;
uint32 Haste;
uint32 DamageShield;
int32 Endur;
int32 DotShielding;
int32 Attack;
int32 Regen;
int32 ManaRegen;
int32 EnduranceRegen;
int32 Haste;
int32 DamageShield;
uint32 RecastDelay;
uint32 RecastType;
int RecastType;
uint32 AugDistiller;
bool Attuneable;
bool NoPet;
+1
View File
@@ -203,3 +203,4 @@ F(procname)
F(wornname)
F(focusname)
F(scrollname)
F(subtype)
+167 -128
View File
@@ -23,7 +23,7 @@
//#include "races.h"
#include "rulesys.h"
#include "shareddb.h"
#include "string_util.h"
#include "strings.h"
//#include "../common/light_source.h"
@@ -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;
if(item) {
m_item = new ItemData(*item);
@@ -87,7 +87,7 @@ EQEmu::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
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_item = db->GetItem(item_id);
if(m_item) {
@@ -121,7 +121,7 @@ EQEmu::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 char
m_new_id_file = 0;
}
EQEmu::ItemInstance::ItemInstance(ItemInstTypes use_type) {
EQ::ItemInstance::ItemInstance(ItemInstTypes use_type) {
m_use_type = use_type;
m_item = nullptr;
m_charges = 0;
@@ -143,8 +143,8 @@ EQEmu::ItemInstance::ItemInstance(ItemInstTypes use_type) {
m_new_id_file = 0;
}
// Make a copy of an EQEmu::ItemInstance object
EQEmu::ItemInstance::ItemInstance(const ItemInstance& copy)
// Make a copy of an EQ::ItemInstance object
EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
{
m_use_type=copy.m_use_type;
if(copy.m_item)
@@ -202,7 +202,7 @@ EQEmu::ItemInstance::ItemInstance(const ItemInstance& copy)
}
// Clean up container contents
EQEmu::ItemInstance::~ItemInstance()
EQ::ItemInstance::~ItemInstance()
{
Clear();
safe_delete(m_item);
@@ -211,10 +211,10 @@ EQEmu::ItemInstance::~ItemInstance()
}
// 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'
// Check usage type
if ((m_use_type == ItemInstWorldContainer) && (item_class == item::ItemClassBag))
return true;
@@ -225,35 +225,35 @@ bool EQEmu::ItemInstance::IsType(item::ItemClass item_class) const
return (m_item->ItemClass == item_class);
}
bool EQEmu::ItemInstance::IsClassCommon() const
bool EQ::ItemInstance::IsClassCommon() const
{
return (m_item && m_item->IsClassCommon());
}
bool EQEmu::ItemInstance::IsClassBag() const
bool EQ::ItemInstance::IsClassBag() const
{
return (m_item && m_item->IsClassBag());
}
bool EQEmu::ItemInstance::IsClassBook() const
bool EQ::ItemInstance::IsClassBook() const
{
return (m_item && m_item->IsClassBook());
}
// Is item stackable?
bool EQEmu::ItemInstance::IsStackable() const
bool EQ::ItemInstance::IsStackable() const
{
if (!m_item)
return false;
return m_item->Stackable;
}
bool EQEmu::ItemInstance::IsCharged() const
bool EQ::ItemInstance::IsCharged() const
{
if (!m_item)
return false;
if (m_item->MaxCharges > 1)
return true;
else
@@ -261,7 +261,7 @@ bool EQEmu::ItemInstance::IsCharged() const
}
// 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))
return false;
@@ -270,18 +270,18 @@ bool EQEmu::ItemInstance::IsEquipable(uint16 race, uint16 class_) const
}
// Can equip at this slot?
bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const
bool EQ::ItemInstance::IsEquipable(int16 slot_id) const
{
if (!m_item)
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 ((m_item->Slots & (1 << slot_id)) != 0);
}
bool EQEmu::ItemInstance::IsAugmentable() const
bool EQ::ItemInstance::IsAugmentable() const
{
if (!m_item)
return false;
@@ -294,7 +294,7 @@ bool EQEmu::ItemInstance::IsAugmentable() const
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())
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())
return INVALID_INDEX;
@@ -324,7 +324,7 @@ int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const
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())
return false;
@@ -336,7 +336,7 @@ bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) cons
}
// 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);
if (it != m_contents.end()) {
@@ -346,7 +346,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetItem(uint8 index) const
return nullptr;
}
uint32 EQEmu::ItemInstance::GetItemID(uint8 slot) const
uint32 EQ::ItemInstance::GetItemID(uint8 slot) const
{
ItemInstance *item = GetItem(slot);
if (item)
@@ -355,7 +355,7 @@ uint32 EQEmu::ItemInstance::GetItemID(uint8 slot) const
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)
DeleteItem(index);
@@ -365,7 +365,7 @@ void EQEmu::ItemInstance::PutItem(uint8 index, const ItemInstance& inst)
}
// Remove item inside container
void EQEmu::ItemInstance::DeleteItem(uint8 index)
void EQ::ItemInstance::DeleteItem(uint8 index)
{
ItemInstance* inst = PopItem(index);
safe_delete(inst);
@@ -373,7 +373,7 @@ void EQEmu::ItemInstance::DeleteItem(uint8 index)
// Remove item from container without memory delete
// 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);
if (iter != m_contents.end()) {
@@ -381,12 +381,12 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::PopItem(uint8 index)
m_contents.erase(index);
return inst; // Return pointer that needs to be deleted (or otherwise managed)
}
return nullptr;
}
// Remove all items from container
void EQEmu::ItemInstance::Clear()
void EQ::ItemInstance::Clear()
{
// Destroy container contents
for (auto iter = m_contents.begin(); iter != m_contents.end(); ++iter) {
@@ -396,7 +396,7 @@ void EQEmu::ItemInstance::Clear()
}
// 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...
@@ -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)
return INVALID_INDEX;
@@ -472,11 +472,11 @@ uint8 EQEmu::ItemInstance::FirstOpenSlot() const
return (i < slots) ? i : INVALID_INDEX;
}
uint8 EQEmu::ItemInstance::GetTotalItemCount() const
uint8 EQ::ItemInstance::GetTotalItemCount() const
{
if (!m_item)
return 0;
uint8 item_count = 1;
if (m_item && !m_item->IsClassBag()) { return item_count; }
@@ -486,7 +486,7 @@ uint8 EQEmu::ItemInstance::GetTotalItemCount() const
return item_count;
}
bool EQEmu::ItemInstance::IsNoneEmptyContainer()
bool EQ::ItemInstance::IsNoneEmptyContainer()
{
if (!m_item || !m_item->IsClassBag())
return false;
@@ -500,7 +500,7 @@ bool EQEmu::ItemInstance::IsNoneEmptyContainer()
}
// 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())
return GetItem(slot);
@@ -508,7 +508,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetAugment(uint8 slot) const
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 (ornamentationAugtype == 0) { return nullptr; }
@@ -526,14 +526,14 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentatio
{
continue;
}
return this->GetAugment(i);
return GetAugment(i);
}
}
return nullptr;
}
uint32 EQEmu::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const {
uint32 EQ::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const {
// Not a Hero Forge item.
if (m_ornament_hero_model == 0 || material_slot < 0)
return 0;
@@ -546,10 +546,10 @@ uint32 EQEmu::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const {
return (m_ornament_hero_model * 100) + material_slot;
}
bool EQEmu::ItemInstance::UpdateOrnamentationInfo() {
bool EQ::ItemInstance::UpdateOrnamentationInfo() {
if (!m_item || !m_item->IsClassCommon())
return false;
bool ornamentSet = false;
int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
@@ -582,7 +582,7 @@ bool EQEmu::ItemInstance::UpdateOrnamentationInfo() {
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->ItemType == item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0)
@@ -629,7 +629,7 @@ bool EQEmu::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData
return false;
}
uint32 EQEmu::ItemInstance::GetAugmentItemID(uint8 slot) const
uint32 EQ::ItemInstance::GetAugmentItemID(uint8 slot) const
{
if (!m_item || !m_item->IsClassCommon())
return 0;
@@ -638,15 +638,15 @@ uint32 EQEmu::ItemInstance::GetAugmentItemID(uint8 slot) const
}
// 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())
return;
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 (db == nullptr) { return; /* TODO: add log message for nullptr */ }
@@ -655,32 +655,32 @@ void EQEmu::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item
if (aug) {
PutAugment(slot, *aug);
safe_delete(aug);
}
}
}
// 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())
return;
DeleteItem(index);
}
// 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())
return nullptr;
return PopItem(index);
}
bool EQEmu::ItemInstance::IsAugmented()
bool EQ::ItemInstance::IsAugmented()
{
if (!m_item || !m_item->IsClassCommon())
return false;
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
if (GetAugmentItemID(index))
return true;
@@ -689,8 +689,47 @@ bool EQEmu::ItemInstance::IsAugmented()
return false;
}
bool EQ::ItemInstance::ContainsAugmentByID(uint32 item_id)
{
if (!m_item || !m_item->IsClassCommon()) {
return false;
}
if (!item_id) {
return false;
}
for (uint8 augment_slot = invaug::SOCKET_BEGIN; augment_slot <= invaug::SOCKET_END; ++augment_slot) {
if (GetAugmentItemID(augment_slot) == item_id) {
return true;
}
}
return false;
}
int EQ::ItemInstance::CountAugmentByID(uint32 item_id)
{
int quantity = 0;
if (!m_item || !m_item->IsClassCommon()) {
return quantity;
}
if (!item_id) {
return quantity;
}
for (uint8 augment_slot = invaug::SOCKET_BEGIN; augment_slot <= invaug::SOCKET_END; ++augment_slot) {
if (GetAugmentItemID(augment_slot) == item_id) {
quantity++;
}
}
return quantity;
}
// Has attack/delay?
bool EQEmu::ItemInstance::IsWeapon() const
bool EQ::ItemInstance::IsWeapon() const
{
if (!m_item || !m_item->IsClassCommon())
return false;
@@ -701,7 +740,7 @@ bool EQEmu::ItemInstance::IsWeapon() const
return ((m_item->Damage != 0) && (m_item->Delay != 0));
}
bool EQEmu::ItemInstance::IsAmmo() const
bool EQ::ItemInstance::IsAmmo() const
{
if (!m_item)
return false;
@@ -717,7 +756,7 @@ bool EQEmu::ItemInstance::IsAmmo() const
}
const EQEmu::ItemData* EQEmu::ItemInstance::GetItem() const
const EQ::ItemData* EQ::ItemInstance::GetItem() const
{
if (!m_item)
return nullptr;
@@ -728,13 +767,13 @@ const EQEmu::ItemData* EQEmu::ItemInstance::GetItem() const
return m_item;
}
const EQEmu::ItemData* EQEmu::ItemInstance::GetUnscaledItem() const
const EQ::ItemData* EQ::ItemInstance::GetUnscaledItem() const
{
// No operator calls and defaults to nullptr
return m_item;
}
std::string EQEmu::ItemInstance::GetCustomDataString() const {
std::string EQ::ItemInstance::GetCustomDataString() const {
std::string ret_val;
auto iter = m_custom_data.begin();
while (iter != m_custom_data.end()) {
@@ -753,7 +792,7 @@ std::string EQEmu::ItemInstance::GetCustomDataString() const {
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);
if (iter != m_custom_data.end()) {
return iter->second;
@@ -762,49 +801,49 @@ std::string EQEmu::ItemInstance::GetCustomData(std::string identifier) {
return "";
}
void EQEmu::ItemInstance::SetCustomData(std::string identifier, std::string value) {
void EQ::ItemInstance::SetCustomData(std::string identifier, std::string value) {
DeleteCustomData(identifier);
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);
std::stringstream ss;
ss << value;
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);
std::stringstream ss;
ss << value;
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);
std::stringstream ss;
ss << value;
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);
if (iter != m_custom_data.end()) {
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,
// 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
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; }
else if (InventoryProfile::SupportsContainers(slot_id)) { return true; }
else if (m_item->Slots & (1 << slot_id)) { return true; }
@@ -812,7 +851,7 @@ bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const {
else { return false; }
}
bool EQEmu::ItemInstance::IsDroppable(bool recurse) const
bool EQ::ItemInstance::IsDroppable(bool recurse) const
{
if (!m_item)
return false;
@@ -834,11 +873,11 @@ bool EQEmu::ItemInstance::IsDroppable(bool recurse) const
return false;
}
}
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 (!m_item)
return;
@@ -855,7 +894,7 @@ void EQEmu::ItemInstance::Initialize(SharedDatabase *db) {
}
}
void EQEmu::ItemInstance::ScaleItem() {
void EQ::ItemInstance::ScaleItem() {
if (!m_item)
return;
@@ -939,18 +978,18 @@ void EQEmu::ItemInstance::ScaleItem() {
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);
}
int8 EQEmu::ItemInstance::GetMaxEvolveLvl() const {
int8 EQ::ItemInstance::GetMaxEvolveLvl() const {
if (m_evolveInfo)
return m_evolveInfo->MaxLvl;
else
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.
if (m_evolveInfo)
if (currentlevel != m_evolveInfo->MaxLvl)
@@ -962,24 +1001,24 @@ uint32 EQEmu::ItemInstance::GetKillsNeeded(uint8 currentlevel) {
return kills;
}
void EQEmu::ItemInstance::SetTimer(std::string name, uint32 time) {
void EQ::ItemInstance::SetTimer(std::string name, uint32 time) {
Timer t(time);
t.Start(time, false);
m_timers[name] = t;
}
void EQEmu::ItemInstance::StopTimer(std::string name) {
void EQ::ItemInstance::StopTimer(std::string name) {
auto iter = m_timers.find(name);
if(iter != m_timers.end()) {
m_timers.erase(iter);
}
}
void EQEmu::ItemInstance::ClearTimers() {
void EQ::ItemInstance::ClearTimers() {
m_timers.clear();
}
int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const
int EQ::ItemInstance::GetItemArmorClass(bool augments) const
{
int ac = 0;
const auto item = GetItem();
@@ -993,7 +1032,7 @@ int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const
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();
if (item) {
@@ -1035,7 +1074,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold
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;
const auto item = GetItem();
@@ -1056,9 +1095,9 @@ int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const
return flag;
}
int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const
int EQ::ItemInstance::GetItemElementalDamage(bool augments) const
{
int damage = 0;
int64 damage = 0;
const auto item = GetItem();
if (item) {
damage = item->ElemDmgAmt;
@@ -1077,7 +1116,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const
return damage;
}
int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const
int EQ::ItemInstance::GetItemRecommendedLevel(bool augments) const
{
int level = 0;
const auto item = GetItem();
@@ -1099,7 +1138,7 @@ int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const
return level;
}
int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const
int EQ::ItemInstance::GetItemRequiredLevel(bool augments) const
{
int level = 0;
const auto item = GetItem();
@@ -1121,9 +1160,9 @@ int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const
return level;
}
int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const
int EQ::ItemInstance::GetItemWeaponDamage(bool augments) const
{
int damage = 0;
int64 damage = 0;
const auto item = GetItem();
if (item) {
damage = item->Damage;
@@ -1137,9 +1176,9 @@ int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const
return damage;
}
int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const
int EQ::ItemInstance::GetItemBackstabDamage(bool augments) const
{
int damage = 0;
int64 damage = 0;
const auto item = GetItem();
if (item) {
damage = item->BackstabDmg;
@@ -1153,7 +1192,7 @@ int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const
return damage;
}
int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const
int EQ::ItemInstance::GetItemBaneDamageBody(bool augments) const
{
int body = 0;
const auto item = GetItem();
@@ -1174,7 +1213,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const
return body;
}
int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const
int EQ::ItemInstance::GetItemBaneDamageRace(bool augments) const
{
int race = 0;
const auto item = GetItem();
@@ -1195,9 +1234,9 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const
return race;
}
int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) const
int EQ::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) const
{
int damage = 0;
int64 damage = 0;
const auto item = GetItem();
if (item) {
if (item->BaneDmgBody == against)
@@ -1212,9 +1251,9 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments)
return damage;
}
int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) const
int EQ::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) const
{
int damage = 0;
int64 damage = 0;
const auto item = GetItem();
if (item) {
if (item->BaneDmgRace == against)
@@ -1229,7 +1268,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) co
return damage;
}
int EQEmu::ItemInstance::GetItemMagical(bool augments) const
int EQ::ItemInstance::GetItemMagical(bool augments) const
{
const auto item = GetItem();
if (item) {
@@ -1245,7 +1284,7 @@ int EQEmu::ItemInstance::GetItemMagical(bool augments) const
return 0;
}
int EQEmu::ItemInstance::GetItemHP(bool augments) const
int EQ::ItemInstance::GetItemHP(bool augments) const
{
int hp = 0;
const auto item = GetItem();
@@ -1259,7 +1298,7 @@ int EQEmu::ItemInstance::GetItemHP(bool augments) const
return hp;
}
int EQEmu::ItemInstance::GetItemMana(bool augments) const
int EQ::ItemInstance::GetItemMana(bool augments) const
{
int mana = 0;
const auto item = GetItem();
@@ -1273,7 +1312,7 @@ int EQEmu::ItemInstance::GetItemMana(bool augments) const
return mana;
}
int EQEmu::ItemInstance::GetItemEndur(bool augments) const
int EQ::ItemInstance::GetItemEndur(bool augments) const
{
int endur = 0;
const auto item = GetItem();
@@ -1287,7 +1326,7 @@ int EQEmu::ItemInstance::GetItemEndur(bool augments) const
return endur;
}
int EQEmu::ItemInstance::GetItemAttack(bool augments) const
int EQ::ItemInstance::GetItemAttack(bool augments) const
{
int atk = 0;
const auto item = GetItem();
@@ -1301,7 +1340,7 @@ int EQEmu::ItemInstance::GetItemAttack(bool augments) const
return atk;
}
int EQEmu::ItemInstance::GetItemStr(bool augments) const
int EQ::ItemInstance::GetItemStr(bool augments) const
{
int str = 0;
const auto item = GetItem();
@@ -1315,7 +1354,7 @@ int EQEmu::ItemInstance::GetItemStr(bool augments) const
return str;
}
int EQEmu::ItemInstance::GetItemSta(bool augments) const
int EQ::ItemInstance::GetItemSta(bool augments) const
{
int sta = 0;
const auto item = GetItem();
@@ -1329,7 +1368,7 @@ int EQEmu::ItemInstance::GetItemSta(bool augments) const
return sta;
}
int EQEmu::ItemInstance::GetItemDex(bool augments) const
int EQ::ItemInstance::GetItemDex(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1343,7 +1382,7 @@ int EQEmu::ItemInstance::GetItemDex(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemAgi(bool augments) const
int EQ::ItemInstance::GetItemAgi(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1357,7 +1396,7 @@ int EQEmu::ItemInstance::GetItemAgi(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemInt(bool augments) const
int EQ::ItemInstance::GetItemInt(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1371,7 +1410,7 @@ int EQEmu::ItemInstance::GetItemInt(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemWis(bool augments) const
int EQ::ItemInstance::GetItemWis(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1385,7 +1424,7 @@ int EQEmu::ItemInstance::GetItemWis(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemCha(bool augments) const
int EQ::ItemInstance::GetItemCha(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1399,7 +1438,7 @@ int EQEmu::ItemInstance::GetItemCha(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemMR(bool augments) const
int EQ::ItemInstance::GetItemMR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1413,7 +1452,7 @@ int EQEmu::ItemInstance::GetItemMR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemFR(bool augments) const
int EQ::ItemInstance::GetItemFR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1427,7 +1466,7 @@ int EQEmu::ItemInstance::GetItemFR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemCR(bool augments) const
int EQ::ItemInstance::GetItemCR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1441,7 +1480,7 @@ int EQEmu::ItemInstance::GetItemCR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemPR(bool augments) const
int EQ::ItemInstance::GetItemPR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1455,7 +1494,7 @@ int EQEmu::ItemInstance::GetItemPR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemDR(bool augments) const
int EQ::ItemInstance::GetItemDR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1469,7 +1508,7 @@ int EQEmu::ItemInstance::GetItemDR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemCorrup(bool augments) const
int EQ::ItemInstance::GetItemCorrup(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1483,7 +1522,7 @@ int EQEmu::ItemInstance::GetItemCorrup(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const
int EQ::ItemInstance::GetItemHeroicStr(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1497,7 +1536,7 @@ int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const
int EQ::ItemInstance::GetItemHeroicSta(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1511,7 +1550,7 @@ int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const
int EQ::ItemInstance::GetItemHeroicDex(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1525,7 +1564,7 @@ int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const
int EQ::ItemInstance::GetItemHeroicAgi(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1539,7 +1578,7 @@ int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const
int EQ::ItemInstance::GetItemHeroicInt(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1553,7 +1592,7 @@ int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const
int EQ::ItemInstance::GetItemHeroicWis(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1567,7 +1606,7 @@ int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const
int EQ::ItemInstance::GetItemHeroicCha(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1581,7 +1620,7 @@ int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const
int EQ::ItemInstance::GetItemHeroicMR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1595,7 +1634,7 @@ int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const
int EQ::ItemInstance::GetItemHeroicFR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1609,7 +1648,7 @@ int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const
int EQ::ItemInstance::GetItemHeroicCR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1623,7 +1662,7 @@ int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const
int EQ::ItemInstance::GetItemHeroicPR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1637,7 +1676,7 @@ int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const
int EQ::ItemInstance::GetItemHeroicDR(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1651,7 +1690,7 @@ int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const
int EQ::ItemInstance::GetItemHeroicCorrup(bool augments) const
{
int total = 0;
const auto item = GetItem();
@@ -1665,7 +1704,7 @@ int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const
return total;
}
int EQEmu::ItemInstance::GetItemHaste(bool augments) const
int EQ::ItemInstance::GetItemHaste(bool augments) const
{
int total = 0;
const auto item = GetItem();
+9 -7
View File
@@ -38,7 +38,7 @@ class EvolveInfo; // Stores information about an evolving item family
#include <map>
// Specifies usage type for item inside EQEmu::ItemInstance
// Specifies usage type for item inside EQ::ItemInstance
enum ItemInstTypes
{
ItemInstNormal = 0,
@@ -54,14 +54,14 @@ typedef enum {
class SharedDatabase;
// ########################################
// Class: EQEmu::ItemInstance
// Class: EQ::ItemInstance
// Base class for an instance of an item
// An item instance encapsulates item data + data specific
// to an item instance (includes dye, augments, charges, etc)
namespace EQEmu
namespace EQ
{
class InventoryProfile;
class ItemInstance {
public:
/////////////////////////
@@ -132,6 +132,8 @@ namespace EQEmu
void DeleteAugment(uint8 slot);
ItemInstance* RemoveAugment(uint8 index);
bool IsAugmented();
bool ContainsAugmentByID(uint32 item_id);
int CountAugmentByID(uint32 item_id);
ItemInstance* GetOrnamentationAug(int32 ornamentationAugtype) const;
bool UpdateOrnamentationInfo();
static bool CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll = false);
@@ -222,7 +224,7 @@ namespace EQEmu
inline int32 GetSerialNumber() const { return m_SerialNumber; }
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 StopTimer(std::string name);
void ClearTimers();
@@ -316,13 +318,13 @@ namespace EQEmu
// Items inside of this item (augs or contents);
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, Timer> m_timers;
std::map<std::string, ::Timer> m_timers;
};
}
class EvolveInfo {
public:
friend class EQEmu::ItemInstance;
friend class EQ::ItemInstance;
//temporary
uint16 LvlKills[9];
uint32 FirstItem;

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