Compare commits

...

231 Commits

Author SHA1 Message Date
KimLS 307923598b Merge fixes 2019-08-24 23:39:31 -07:00
KimLS 644d9c15c6 Update gitignore to ignore editor config 2019-08-24 14:30:41 -07:00
KimLS cf4f628340 Remove editor config 2019-08-24 14:29:57 -07:00
Michael Cook (mackal) 83cae7aaf3 Merge pull request #886 from KinglyKrab/master
Export Getter/Setter alternate currency methods to Perl and Lua.
2019-08-20 19:01:45 -04:00
Kinglykrab 08d197fe15 Export Getter/Setter alternate currency methods to Perl and Lua.
- GetAlternateCurrencyValue(currency_id) - Returns the amount of the alternate currency you have.

- SetAlternateCurrencyValue(currency_id, amount) - Allows you to directly set the amount of an alternate currency.
2019-08-20 18:12:27 -04:00
Akkadius 6fb1d95518 Implemented command #spawneditmass <search> <option> <value> with options [respawn_time] currently implemented 2019-08-16 04:33:51 -05:00
Akkadius bf25937ee0 Command #npceditmass now lists column options when one isn't properly specified 2019-08-16 03:39:15 -05:00
Akkadius 05e7c473df Simplified the use of roamboxes and improved the AI for roambox pathing 2019-08-16 03:25:34 -05:00
Akkadius c149e6ca5f Add a heading option to #goto 2019-08-15 22:56:03 -05:00
Uleat 537e3931ef Don't need the zlib1.ilk file... [skip ci] 2019-08-15 22:20:58 -04:00
Chris Miles 9476f9e417 Update SECURITY.md 2019-08-15 20:21:09 -05:00
Chris Miles 1f4753b719 Create SECURITY.md 2019-08-15 20:20:33 -05:00
Uleat 65c05f227b Added zlib1.dll debug symbols to eqemu_server.pl download [skip ci] 2019-08-15 21:10:51 -04:00
Michael Cook (mackal) ef6b2976a3 Make SE_SummonPC only clear aggro for beneficial spells 2019-08-14 23:06:34 -04:00
Michael Cook (mackal) 7b4908957d Clean up EntityList::QuestJournalledSayClose 2019-08-13 15:19:20 -04:00
Michael Cook (mackal) 963da70506 Change how we handle null quest initiator in QuestManager::say
Timers etc triggered say's don't have an initiator but should still
work.

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

This also fully documents the packet and expands the uses of
quest::say/QuestSay
2019-07-18 00:56:46 -04:00
Michael Cook (mackal) 16d6014a87 Merge pull request #859 from eqft/feature/rule_for_gm_level_cmd_with_target
Convert constant check in level_command() to a Rule
2019-07-16 13:43:02 -04:00
Michael Cook (mackal) 7801b295d6 Merge pull request #869 from regneq/master
added variable to chatchannels as well as various changed to chatchannel and using language / language skills d…
2019-07-16 13:39:33 -04:00
regneq 460468224e various changed to chatchannel and using language / language skills derived from takp code. 2019-07-14 20:03:30 -07:00
KimLS 6bdc9b6ba5 Add support for single account login to both world and login server, should also work with eqemu login server, can be turned off in rules if you don't mind the side effects double logins cause. Also lowered the linkdead time to 30s + 90s default (2min) 2019-07-13 16:16:15 -07:00
Uleat 7181b46608 Merge branch 'master' of https://github.com/EQEmu/Server 2019-07-13 00:44:09 -04:00
Uleat eb8cd1a5b4 Fix for build zlib option when not using vcpkg 2019-07-13 00:43:56 -04:00
KimLS 8af508d8c5 Merge remote-tracking branch 'origin/master' into unstable 2019-07-12 00:11:46 -07:00
Chris Miles a8e65cdce1 Merge pull request #826 from livermana/master
fix for mob movement getting 'stuck' when paths don't have updated lo…
2019-07-11 18:41:50 -05:00
Michael Cook (mackal) 1ba78d0988 Switch to char_traits::length in SerializeBuffer
This benches a bit faster
2019-07-10 14:33:33 -04:00
Akkadius 35eb5b24dd Implement flymode 2019-07-10 03:39:07 -05:00
Michael Cook (mackal) dfa90aaac5 Fix OP_SpecialMesg encoding
This broke with newer GCCs. It also worked even though the code was just
wrong before???
2019-07-10 01:44:59 -04:00
Michael Cook (mackal) 525813be02 Adjust VARSTRUCT_ENCODE_STRING macros for smarter compilers
This is no more dangerous than what we were doing before (not checking
return value of sprintf) Maybe we should sometime
2019-07-10 01:20:51 -04:00
Uleat 87b1d32ce8 Updated PerlembParser::ExportItemVariables to new inventory standard 2019-07-08 21:58:47 -04:00
KimLS f85644a09c Merge fix for master 2019-07-05 21:07:56 -07:00
Akkadius 915bbe32f0 Add submodule commands to linux installer [skip ci] 2019-07-03 01:09:55 -05:00
Akkadius 151cb5f286 Update changelog.txt 2019-07-03 01:00:03 -05:00
Akkadius c8d6895526 See changelog 2019-07-03 00:59:49 -05:00
Akkadius dce5d774e2 Merge branch 'master' of https://github.com/EQEmu/Server into feature/eqemu-api-data-service-netstats-ws 2019-07-03 00:36:26 -05:00
Chris Miles 69c57d8715 Merge pull request #867 from N0ctrnl/patch-7
Updated libsodium18 package location for Ubuntu
2019-07-02 01:23:32 -05:00
Kurt Gilpin a42d77c204 Updated libsodium18 package location for Ubuntu 2019-07-01 22:29:51 -05:00
Chris Miles 6757f61249 Merge pull request #858 from jalavoy/master
Updating linux installer script
2019-07-01 21:17:47 -05:00
Akkadius 6e51783d4b Don't send reload all rules messages to non-gm's 2019-07-01 15:37:12 -05:00
Akkadius a4f68f755f Update system_tables.txt 2019-07-01 02:52:06 -05:00
Akkadius 8d67c1aed7 Merge branch 'master' of https://github.com/EQEmu/Server into feature/eqemu-api-data-service-netstats-ws 2019-07-01 01:28:49 -05:00
Akkadius 1e90e64178 Merge branch 'master' into feature/eqemu-api-data-service-netstats-ws 2019-07-01 00:52:34 -05:00
KimLS f50d502f3d Fix for x86 zlib issue 2019-06-30 18:28:11 -07:00
KimLS 1a6c6cf768 Delete old ngzlib lib 2019-06-30 18:20:31 -07:00
KimLS c5ffb44edb Merge fix 2019-06-30 18:19:56 -07:00
KimLS e086f53b97 Zlib ng 2019-06-30 18:13:46 -07:00
KimLS e0637e29f1 double semicolon 2019-06-30 18:03:15 -07:00
Uleat d7c110041a Added full support in eqemu_server.pl for downloading both stable and unstable bots binaries 2019-06-27 21:08:08 -04:00
Uleat 6c73fee075 Added bot command 'petgetlost' to dismiss summoned pets 2019-06-27 19:00:02 -04:00
KimLS 40980a9d39 Don't link zlib when we're not using it 2019-06-24 19:52:24 -07:00
KimLS d906f79e6f Merge remote-tracking branch 'origin/master' into unstable 2019-06-24 17:45:44 -07:00
KimLS 8293225ecc Merge remote-tracking branch 'origin/feature/eqemu-api-data-service-netstats-ws' into unstable 2019-06-24 17:45:37 -07:00
KimLS e06a845921 Idle wip 2019-06-24 17:45:31 -07:00
KimLS aa4aced94d Zlib ng optional dependency 2019-06-24 17:35:33 -07:00
Uleat ee49ad3ce9 Reworked BotDatabase into a functional add-on for ZoneDatabase 2019-06-24 18:13:25 -04:00
KimLS 0e0027ca20 Decoupling eventloop singleton from the event loop (for now not complete but later we will) 2019-06-24 00:15:02 -07:00
KimLS 5c7ab59fd3 More cmake streamlining 2019-06-23 19:39:17 -07:00
Akkadius 89691d6c32 Change websocket listener verbiage 2019-06-23 21:33:24 -05:00
KimLS 120cf6a4b8 Add mbedtls as an alternative to OpenSSL, plan to implement TLS connections later 2019-06-23 17:04:33 -07:00
Akkadius 09b633e374 Merge branch 'master' into feature/eqemu-api-data-service-netstats-ws 2019-06-23 22:51:21 +00:00
Akkadius 18fa056a38 Merge branch 'master' into feature/eqemu-api-data-service-netstats-ws 2019-06-23 17:26:11 -05:00
Uleat 2e9cf7dbd7 Added bot owner option 'stats update' 2019-06-22 22:53:35 -04:00
KimLS 3ddfed8bb6 Change to make cmake files a little more straight forward 2019-06-22 19:42:20 -07:00
KimLS 586eb9e5c1 Fix for bad cmakefile 2019-06-22 19:05:54 -07:00
KimLS 32227d19ce Merge fix 2019-06-22 18:59:34 -07:00
KimLS c233379894 Changes to packet, fixes for lua compile issue 2019-06-22 17:00:15 -07:00
KimLS a51a1d7106 Change out luabind as in the PR 2019-06-22 16:23:14 -07:00
KimLS 6d05903170 Use builtin find lua 2019-06-22 16:15:59 -07:00
Uleat c9d4bb178f Added level to NPC spell list logging .. and some additional debug logging for same 2019-06-22 19:05:41 -04:00
KimLS 4ae0f2a1d7 Remove old non-compliant win32 defines. 2019-06-22 16:00:06 -07:00
Uleat 5d138891d8 Fix for insufficient spell mana logging 2019-06-22 06:42:06 -04:00
Justin Wienckowski 5fdf976137 Add an optional SQL to add the new rule to the rule_values table. Default value is unchanged. 2019-06-21 20:02:42 -07:00
Uleat a8d3ba41a7 Fix for non-BOTS compile failure 2019-06-21 18:36:33 -04:00
Uleat 2cd910ad86 Added ping() call to botdb 2019-06-21 07:58:47 -04:00
Uleat e903b06c22 Added const cast Entity::CastToBot() 2019-06-21 06:00:58 -04:00
Uleat ca874cb861 Fix for NukeItem not taking items from general bags properly 2019-06-20 22:09:49 -04:00
Uleat a2a13e9779 Revert "fixed opcode for deleteing a item out of a player's inventory slot"
This reverts commit 65e429a596.
2019-06-20 19:37:08 -04:00
Uleat 104edee427 Fix for fishing not working correctly (thanks mackal!) 2019-06-19 23:20:43 -04:00
Uleat 6256660972 Fix for possible memory leak with mercenaries and bots 2019-06-19 20:01:57 -04:00
Uleat 0541eec8bf Fix for thrown weapons hitting self 2019-06-19 17:47:24 -04:00
Uleat c74c46263a Merge pull request #861 from KinglyKrab/master
Export Mob::GetItemStat(item_id, identifier) to Lua.
2019-06-16 21:09:49 -04:00
Kinglykrab 51c51b0d72 Export Mob::GetItemStat(item_id, identifier) to Lua. 2019-06-16 19:56:07 -04:00
Uleat f4e609ef0a Merge pull request #860 from KinglyKrab/master
New Perl/Lua buff functionality.
2019-06-16 19:51:43 -04:00
Kinglykrab 9356b5dc7f New Perl/Lua buff functionality.
- Client::FindMemmedSpellBySlot(slot)
	This allows you to find memmed spells by a specific slot.
	Example: https://i.imgur.com/06OFT3c.png
	Perl Example: https://pastebin.com/BCr6KqSS

- Client::MemmedCount()
	This will find the number of memmed spells the client has.
	Example: https://i.imgur.com/cY26DEl.png
	Perl Example: https://pastebin.com/T3ahSUgi
2019-06-16 12:53:23 -04:00
Justin Wienckowski 6a31af81ee Add GM:MinStatusToLevelTarget rule, which determines the GM status needed to use the #level command on your target. 2019-06-16 00:43:18 -07:00
James Lavoy 2a308b1f14 moderning and updating installer script
fixing tabs

adding perl-json

adding sodium

adding openssl

removing debian stuff, refactoring rhel stuff

changing some fedora stuff

more fedora crap

dnf doesn't like newlines in group install?
2019-06-15 21:08:13 -06:00
Uleat 8681d0acf7 Merge pull request #855 from KinglyKrab/master
New Perl/Lua buff functionality.
2019-06-13 19:17:53 -04:00
Kinglykrab 7d1362732d New Perl/Lua buff functionality.
- Mob::FindBuffBySlot(slot)
	This allows you to find buffs by a specific slot.
	Example: https://i.imgur.com/VG68cxs.png
	Perl Example: https://pastebin.com/8HvMAC4h

- Mob::BuffCount()
	This will find the active number of buffs an NPC/client has.
	Example: https://i.imgur.com/jrLRBwV.png
	Perl Example: https://pastebin.com/Wmg16wwp
2019-06-13 18:20:33 -04:00
Akkadius 86ed2c1e76 Pets shouldn't be scanning for aggro 2019-06-12 01:50:01 -05:00
Akkadius d817f08373 Fix issue with pets causing players to be aggroed and ignoring distance checks 2019-06-12 01:27:55 -05:00
Akkadius 882e3742d9 Make sure AC / Corrup and PhR do not auto scale unles auto scale criteria is met 2019-06-11 15:26:01 -05:00
Akkadius 660416065e Fix scaling and display for cor / phr 2019-06-11 15:19:27 -05:00
Chris Miles 79d8a6329c Merge pull request #854 from EQEmu/feature/file-load-tweaks
Feature/file load tweaks
2019-06-10 00:48:45 -05:00
Akkadius a2dd1fc753 Update eqemu_server.pl 2019-06-10 00:40:11 -05:00
Akkadius ce41cf9cd5 Load mail_opcodes.conf dynamically 2019-06-10 00:29:24 -05:00
Akkadius c0e07cec01 Loader adjustments 2019-06-10 00:01:18 -05:00
Akkadius 3c8ecd6715 Cleanup files if exist 2019-06-09 23:47:15 -05:00
Akkadius b6e592db13 Remove more defaults 2019-06-09 23:38:42 -05:00
Akkadius 94cce09253 Remove perl defaults 2019-06-09 23:36:54 -05:00
Akkadius f6a96ae941 Remove no longer used html template files 2019-06-09 23:36:19 -05:00
Michael Cook (mackal) 290133803e Add a hard off for NPC scaling for Merc/Bot
They don't need it. We may want to add this to actually be in the DB for
normal NPCs in the future.
2019-06-10 00:36:18 -04:00
Michael Cook (mackal) 4627bfe271 Mercs shouldn't do global loot (I think) 2019-06-10 00:30:04 -04:00
Uleat c3e10a7409 Merge pull request #853 from dencelle/master
fixed opcode for deleteing a item out of a player's inventory slot
2019-06-09 19:11:06 -04:00
dencelle 65e429a596 fixed opcode for deleteing a item out of a player's inventory slot 2019-06-09 22:36:23 +00:00
Michael Cook (mackal) 63933f53c8 Merge pull request #851 from fryguy503/lua_stand_crouch
LUA/PERL - IsStanding() and IsCrouching() - Returns as bools
2019-06-08 14:09:44 -04:00
Trust d23a6e646e LUA/PERL - IsStanding() and IsCrouching() - Returns as bools 2019-06-08 04:48:06 +00:00
Uleat 2690e4de4d Redirected bots binaries remote to appveyor artifact repo (thanks Akkadius!) [skip ci] 2019-05-27 20:27:23 -04:00
Chris Miles 1122d29e19 Update system_tables.txt 2019-05-26 03:37:52 -05:00
Akkadius b2aa696a3a Add get_zone_attributes back in 2019-05-25 23:11:21 -05:00
Akkadius 40b63f74ee Add logging calls 2019-05-25 18:46:07 -05:00
Akkadius 9c931ced4e Allow local admin login 2019-05-20 00:49:05 -05:00
KimLS 52276d06b0 Remove c++17 construct, a bridge too far for now 2019-05-17 00:29:51 -07:00
KimLS 597c4e8c60 Rename websocket_server so it no longer shares a name with its own type 2019-05-17 00:22:32 -07:00
KimLS 5b41060588 Swap out recast for our own submod 2019-05-17 00:18:32 -07:00
KimLS c737504645 Subscription changes 2019-05-17 00:09:38 -07:00
KimLS e277e55718 Merge remote-tracking branch 'origin/master' into feature/eqemu-api-data-service-netstats-ws 2019-05-16 14:38:12 -07:00
KimLS 5936d865b5 Apply patches to recast 2019-05-16 14:37:52 -07:00
KimLS f2d47927b8 Update cmake to point at our static recast, need to apply our patches to it now 2019-05-16 14:28:15 -07:00
KimLS 4836db73d7 Recast navigation 2019-05-16 14:24:08 -07:00
KimLS e00cd4afd9 Remove recast module 2019-05-16 14:13:13 -07:00
KimLS ebca112769 Implement a basic websockets server 2019-05-16 00:12:21 -07:00
KimLS 5bfcef600f Removed submodule 2019-05-14 13:06:46 -07:00
KimLS 845dd339b2 Remove websocketpp 2019-05-14 13:04:36 -07:00
KimLS 09b91f5229 Change hash from enum to int, older gcc versions have trouble with that 2019-05-12 21:09:06 -07:00
KimLS 0eeb73b436 Fix for lvalue ref trying to bind to a rvalue 2019-05-11 00:10:47 -07:00
Alex ad790ac8ef Merge pull request #840 from noudess/master
Roambox patch for navmesh and large roamboxes in hilly zones
2019-05-02 18:38:00 -07:00
Akkadius d7abf3f26c Change compression level in deflate 2019-05-01 16:23:24 -05:00
Akkadius 6739eea78b Change NPC scaling classification order check 2019-05-01 15:26:16 -05:00
Uleat cd3125ced0 Added safety to SuspendMinion spell index dereference 2019-04-28 21:20:52 -04:00
Uleat 72e0320509 Fix for loginserver crashes 2019-04-25 01:11:56 -04:00
Chris Miles 15ff0bf5c3 Merge pull request #843 from noudess/RandomizeFeatures
Expose RandomizeFeatures which supercedes plugin::RandomFeatures in functionality
2019-04-24 16:53:33 -05:00
Paul Coene a402f01514 Update perl_mob.cpp 2019-04-24 17:26:17 -04:00
Paul Coene dfe4bb5b78 Update lua_mob.cpp 2019-04-24 10:32:09 -04:00
Paul Coene c24bfaf35f Update lua_mob.h 2019-04-24 10:30:24 -04:00
Paul Coene 7dc1e10956 Update perl_mob.cpp 2019-04-24 10:10:48 -04:00
KimLS 63198d974e Merge branch 'feature/eqemu-api-data-service-netstats' of github.com:EQEmu/Server into feature/eqemu-api-data-service-netstats 2019-04-16 01:09:31 -07:00
KimLS cd8ab727aa Tweaks from other branch 2019-04-16 01:09:25 -07:00
Akkadius 1d88b063aa Change compression level in deflate 2019-04-15 00:12:11 -05:00
Michael Cook (mackal) 54da27424f Implement Foraging AA
Currently this SPA is only checked for AA bonuses since a non-permanent
bonus doesn't make sense. Plus I'm not sure the client is aware of it in
spells/gear
2019-04-14 00:18:23 -04:00
Michael Cook (mackal) 6e1f317c60 Merge pull request #839 from briankinney/rule-based-faction-thresholds
Rule based faction thresholds
2019-04-13 16:01:29 -04:00
Brian Kinney 3e8ef681a3 Change defaults to the values intended by recent update 2019-04-13 15:04:43 -04:00
Michael Cook (mackal) e009e064f3 Merge pull request #842 from noudess/faction_min_max
Fix the auto-correct mechanism on illegal faction
2019-04-13 12:56:58 -04:00
Michael Cook (mackal) 9654beda9f Merge pull request #841 from noudess/use_model
Fix version to match committed manifest
2019-04-13 12:56:48 -04:00
Paul Coene 3105577c1b Fix the auto-correct mechanism on illegal faction
Auto correct was not using the new client_base_data for min/max.
2019-04-13 12:39:45 -04:00
Paul Coene c06774ca61 Fix version to match committed manifest 2019-04-13 07:22:16 -04:00
Noudess e1e3d99a79 Change range of values to accomodate large roamboxes 2019-04-12 20:13:30 -04:00
Noudess 8942c0ea24 Merge remote-tracking branch 'upstream/master' 2019-04-12 20:11:16 -04:00
Chris Miles 1603ea097f Merge pull request #832 from noudess/master
Added model field to npc_types to allow using a diff graphic without losing race
2019-04-12 18:48:04 -05:00
Paul Coene 0426a15fec Update mob.cpp 2019-04-12 19:34:28 -04:00
Paul Coene 5b374927f2 Update mob.cpp 2019-04-12 19:16:00 -04:00
Noudess d59170f84f Fix some formatting and fix some incorrect constants. 2019-04-12 19:09:47 -04:00
Brian Kinney 8aaf39d2d9 Fix incorrect rule categories in SQL 2019-04-12 15:29:05 -04:00
Brian Kinney 2bb305305a Use rules to configure faction thresholds
Default to legacy values. Updated "accurate" values are available in optional database script
2019-04-12 15:25:32 -04:00
Brian Kinney e8127f4b8a Merge pull request #1 from EQEmu/master
Update from Root Repository
2019-04-12 13:51:51 -04:00
Noudess 762de03be7 Merge 2019-04-12 10:50:11 -04:00
Noudess f18b9c99b5 Merge remote-tracking branch 'upstream/master' 2019-04-12 10:35:10 -04:00
Alex 8f9a859c56 Merge pull request #838 from noudess/roamboxfix
Fix SetCurrentWP to allow negatives
2019-04-11 15:02:19 -07:00
Paul Coene 5e008a5a97 Fix SetCurrentWP to allow negatives
Needed to make new roambox constants (that were used instead of 666) actually work.
2019-04-03 15:56:12 -04:00
Michael Cook (mackal) fa2052236c Update some spell immune message colors Fixes #833
Should probably go and do some captures on live, but MQ2Cast's source is
probably correct
2019-03-27 18:20:39 -04:00
Noudess f75c5b6fc8 Fix db version. 2019-03-25 19:32:46 -04:00
Noudess 63045fadd9 Manifest and sql to add model to npc_types to override race if presentwq 2019-03-25 19:29:57 -04:00
Akkadius 850b32f2ca Adjust constants 2019-03-25 18:24:16 -05:00
Noudess 60d5c11c43 Added a use_model field to npc_types to override race-graphics, maintain race. 2019-03-25 19:21:33 -04:00
Chris Miles 03458b88a4 Merge pull request #831 from noudess/master
Fix issue with roambox wait time after switch to new movement code.
2019-03-25 18:12:05 -05:00
Noudess 0852468b88 Add constants for waypoints 2019-03-25 17:54:17 -04:00
Noudess 3d1dda888d Use constants for waypoint values that are not actual waypoints 2019-03-25 14:58:26 -04:00
Noudess a4c171cb1d Fix issue with roambox wait time after switch to navmesh. 2019-03-15 10:28:23 -04:00
Michael Cook (mackal) 20de6acfea Merge pull request #829 from noudess/master
Fix Spin() to use old mechanism so the npc actually spins again.
2019-03-14 12:56:44 -04:00
Michael Cook (mackal) 9c42f28b0d Make Database::CheckStatus() 2038 safe 2019-03-12 14:31:23 -04:00
Noudess 75d3329d37 Fix Spin() to use old mechanism so the npc actually spins again. 2019-03-11 18:24:02 -04:00
Chris Miles 26a95998da Merge pull request #828 from noudess/master
Fix issue with perl script not updating itself correctly
2019-03-11 12:46:26 -07:00
Noudess 6715977a1f Change the system call to an exec. Fix the misnamed argument. 2019-03-11 13:15:55 -04:00
adam 7a28a6e9a7 fix for mob movement getting 'stuck' when paths don't have updated locations. 2019-02-22 19:17:09 -05:00
481 changed files with 24700 additions and 22500 deletions
-23
View File
@@ -1,23 +0,0 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8
[*.cpp]
indent_style = tab
[*.h]
indent_style = tab
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
+3 -13
View File
@@ -23,21 +23,11 @@ CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
Build/
build/
Build32/
build32/
Build64/
build64/
Build_32/
build_32/
Build_64/
build_64/
x64/
x86/
[Bb]uild*/
log/
logs/
vcpkg/
.idea/*
*cbp
*cbp
.editorconfig
+7 -4
View File
@@ -1,6 +1,3 @@
[submodule "submodules/websocketpp"]
path = submodules/websocketpp
url = https://github.com/zaphoyd/websocketpp.git
[submodule "submodules/glm"]
path = submodules/glm
url = https://github.com/g-truc/glm.git
@@ -13,6 +10,12 @@
[submodule "submodules/cereal"]
path = submodules/cereal
url = https://github.com/USCiLab/cereal.git
[submodule "submodules/websocketpp"]
path = submodules/websocketpp
url = https://github.com/zaphoyd/websocketpp.git
[submodule "submodules/recastnavigation"]
path = submodules/recastnavigation
url = https://github.com/recastnavigation/recastnavigation.git
url = https://github.com/EQEmu/recastnavigation.git
[submodule "submodules/zlibng"]
path = submodules/zlibng
url = https://github.com/zlib-ng/zlib-ng.git
+245 -299
View File
@@ -1,122 +1,24 @@
#EQEmu CMake
#Variables used:
#EQEMU_DISABLE_CRT_SECURE_WARNINGS
#EQEMU_FAST_FLOATINGPOINT
#EQEMU_ENABLE_CRASH_LOGGING
#EQEMU_DISABLE_SAFESEH
#EQEMU_BUILD_MSVC_MP
#EQEMU_DEBUG_LEVEL
#EQEMU_LOG_LEVEL_STATUS
#EQEMU_LOG_LEVEL_NORMAL
#EQEMU_LOG_LEVEL_ERROR
#EQEMU_LOG_LEVEL_DEBUG
#EQEMU_LOG_LEVEL_QUEST
#EQEMU_LOG_LEVEL_COMMANDS
#EQEMU_LOG_LEVEL_CRASH
#EQEMU_DEPOP_INVALIDATES_CACHE
#EQEMU_ENABLE_BOTS
#EQEMU_DISABLE_LOGSYS
#EQEMU_COMMANDS_LOGGING
#EQEMU_BUILD_SERVER
#EQEMU_BUILD_LOGIN
#EQEMU_BUILD_TESTS
#EQEMU_BUILD_PERL
#EQEMU_BUILD_LUA
#EQEMU_SANITIZE_LUA_LIBS
#EQEMU_BUILD_CLIENT_FILES
#EQEMU_USE_MAP_MMFS
#EQEMU_MAP_DIR
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
IF(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
ENDIF()
#FindMySQL is located here so lets make it so CMake can find it
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
#Our project name is EQEmu
PROJECT(EQEmu)
#Default build type is set to RelWithDebInfo for generators that honor that like makefiles
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_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dependencies" "${CMAKE_PREFIX_PATH}")
#Add our various windows definitions
IF(MSVC OR MINGW)
ADD_DEFINITIONS(-D_WINDOWS)
IF(CMAKE_CL_64)
ADD_DEFINITIONS(-DWIN64)
ELSE(CMAKE_CL_64)
ADD_DEFINITIONS(-DWIN32)
ENDIF(CMAKE_CL_64)
ENDIF(MSVC OR MINGW)
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
IF(MSVC)
IF(CMAKE_CL_64)
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64")
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x64")
SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x64")
SET(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openssl_x64")
SET(SODIUM_INCLUDE_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/include")
IF(MSVC_VERSION GREATER 1800)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v140/dynamic")
ELSEIF(MSVC_VERSION EQUAL 1800)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v120/dynamic")
ELSE()
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v110/dynamic")
ENDIF()
ELSE(CMAKE_CL_64)
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86")
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86")
SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x86")
SET(SODIUM_INCLUDE_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/include")
SET(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openssl_x86")
IF(MSVC_VERSION GREATER 1800)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v140/dynamic")
ELSEIF(MSVC_VERSION EQUAL 1800)
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v120/dynamic")
ELSE()
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v110/dynamic")
ENDIF()
ENDIF(CMAKE_CL_64)
#disable CRT warnings on windows cause they're annoying as shit and we use C functions everywhere
OPTION(EQEMU_DISABLE_CRT_SECURE_WARNINGS "Disable Secure CRT Warnings" ON)
IF(EQEMU_DISABLE_CRT_SECURE_WARNINGS)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ENDIF(EQEMU_DISABLE_CRT_SECURE_WARNINGS)
#fast FP if you'd like it
OPTION(EQEMU_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON)
IF(EQEMU_FAST_FLOATINGPOINT)
ADD_DEFINITIONS(/fp:fast)
ENDIF(EQEMU_FAST_FLOATINGPOINT)
#crash logging currently only works on windows x86/x64
OPTION(EQEMU_ENABLE_CRASH_LOGGING "Enable crash logging" ON)
IF(EQEMU_ENABLE_CRASH_LOGGING)
ADD_DEFINITIONS(-DCRASH_LOGGING)
ENDIF(EQEMU_ENABLE_CRASH_LOGGING)
OPTION(EQEMU_BUILD_MSVC_MP "Enable build with multiple processes." ON)
IF(EQEMU_BUILD_MSVC_MP)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ENDIF(EQEMU_BUILD_MSVC_MP)
#We want to compile /MT not /MD so we change that
FOREACH(flag_var CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
IF(${flag_var} MATCHES "/MD")
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
ENDIF(${flag_var} MATCHES "/MD")
ENDFOREACH(flag_var)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-DNOMINMAX)
ADD_DEFINITIONS(-DCRASH_LOGGING)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ELSE(MSVC)
#Normally set by perl but we don't use the perl flags anymore so we set it.
ADD_DEFINITIONS(-DHAS_UNION_SEMUN)
ENDIF(MSVC)
@@ -133,180 +35,239 @@ IF(UNIX)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
ENDIF(UNIX)
#debug level, 5 is default. Most people wont ever change this but it's there if you want to
SET(EQEMU_DEBUG_LEVEL 5 CACHE STRING "EQEmu debug level:
0 - Quiet mode Errors to file Status and Normal ignored
1 - Status and Normal to console, Errors to logfile
2 - Status, Normal, and Error to console and logfile
3 - Light debug release errors and status
4 - Moderate debug release errors and status
5 - Maximum debug release errors and status
10 - More errors than you ever wanted to see"
)
SET(EQEMU_LOG_LEVEL_STATUS 2 CACHE STRING "EQEmu logging level for [Status]:
0 - Disabled
1 - Ouput to File Enabled
2 - Output to stdout Enabled
3 - Output to File and stdout Enabled
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_NORMAL 3 CACHE STRING "EQEmu logging level for [Normal]:
0 - Disabled
1 - Ouput to File Enabled
2 - Output to stdout Enabled
3 - Output to File and stdout Enabled
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_ERROR 2 CACHE STRING "EQEmu logging level for [Error]:
0 - Disabled
1 - Ouput to File Enabled
2 - Output to stdout Enabled
3 - Output to File and stdout Enabled
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_DEBUG 3 CACHE STRING "EQEmu logging level for [Debug]:
0 - Disabled
1 - Ouput to File Enabled
2 - Output to stdout Enabled
3 - Output to File and stdout Enabled
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_QUEST 2 CACHE STRING "EQEmu logging level for [Quest]:
0 - Disabled
1 - Ouput to File Enabled
2 - Output to stdout Enabled
3 - Output to File and stdout Enabled
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_COMMANDS 1 CACHE STRING "EQEmu logging level for [Commands]:
0 - Disabled
1 - Ouput to File Enabled
2 - Output to stdout Enabled
3 - Output to File and stdout Enabled
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
SET(EQEMU_LOG_LEVEL_CRASH 3 CACHE STRING "EQEmu logging level for [Crash]:
0 - Disabled
1 - Ouput to File Enabled
2 - Output to stdout Enabled
3 - Output to File and stdout Enabled
8 - Output to stderr Enabled
9 - Output to File and stderr Enabled
11 - Output to File, stdout and stderr Enabled"
)
MARK_AS_ADVANCED(EQEMU_LOG_LEVEL_STATUS EQEMU_LOG_LEVEL_NORMAL EQEMU_LOG_LEVEL_ERROR EQEMU_LOG_LEVEL_DEBUG EQEMU_LOG_LEVEL_QUEST EQEMU_LOG_LEVEL_COMMANDS EQEMU_LOG_LEVEL_CRASH)
#NPC Types Cache Behavior
OPTION(EQEMU_DEPOP_INVALIDATES_CACHE "#repop invalidates the npc_types cache (will cause a larger database hit on #repop but is more convienent)." ON)
#Bots are a compile time option so on/off
OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF)
#Disable entire _mlog system (excludes trade/command logs)
OPTION(EQEMU_DISABLE_LOGSYS "Disable Logging INI System" ON)
#Enable GM Command log system
OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
ENDIF(EQEMU_COMMANDS_LOGGING)
IF(EQEMU_DISABLE_LOGSYS)
ADD_DEFINITIONS(-DDISABLE_LOGSYS)
ENDIF(EQEMU_DISABLE_LOGSYS)
IF(EQEMU_ENABLE_BOTS)
ADD_DEFINITIONS(-DBOTS)
ENDIF(EQEMU_ENABLE_BOTS)
#What to build
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
OPTION(EQEMU_BUILD_LOGIN "Build the login server." OFF)
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
#C++11 stuff
IF(NOT MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reserved-user-defined-literal")
ENDIF()
ENDIF(NOT MSVC)
#Various definitions
IF(EQEMU_BUILD_PERL)
ADD_DEFINITIONS(-DEMBPERL)
ADD_DEFINITIONS(-DEMBPERL_PLUGIN)
ENDIF(EQEMU_BUILD_PERL)
IF(EQEMU_BUILD_LUA)
ADD_DEFINITIONS(-DLUA_EQEMU)
ENDIF(EQEMU_BUILD_LUA)
#Disabled until reevaluation performed
#OPTION(EQEMU_USE_MAP_MMFS "Create and use Zone Map MMF files." OFF)
#IF(EQEMU_USE_MAP_MMFS)
# ADD_DEFINITIONS(-DUSE_MAP_MMFS)
#ENDIF(EQEMU_USE_MAP_MMFS)
SET(EQEMU_MAP_DIR "./Maps" CACHE STRING "The dir that maps, water maps, and paths are located in.")
ADD_DEFINITIONS(-DEQDEBUG=${EQEMU_DEBUG_LEVEL})
ADD_DEFINITIONS(-DINVERSEXY)
ADD_DEFINITIONS(-DFIELD_ITEMS)
ADD_DEFINITIONS(-DMAP_DIR="${EQEMU_MAP_DIR}")
ADD_DEFINITIONS(-DLOG_LEVEL_STATUS=${EQEMU_LOG_LEVEL_STATUS})
ADD_DEFINITIONS(-DLOG_LEVEL_NORMAL=${EQEMU_LOG_LEVEL_NORMAL})
ADD_DEFINITIONS(-DLOG_LEVEL_ERROR=${EQEMU_LOG_LEVEL_ERROR})
ADD_DEFINITIONS(-DLOG_LEVEL_DEBUG=${EQEMU_LOG_LEVEL_DEBUG})
ADD_DEFINITIONS(-DLOG_LEVEL_QUEST=${EQEMU_LOG_LEVEL_QUEST})
ADD_DEFINITIONS(-DLOG_LEVEL_COMMANDS=${EQEMU_LOG_LEVEL_COMMANDS})
ADD_DEFINITIONS(-DLOG_LEVEL_CRASH=${EQEMU_LOG_LEVEL_CRASH})
ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT)
ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL)
#Find everything we need
FIND_PACKAGE(ZLIB REQUIRED)
FIND_PACKAGE(MySQL REQUIRED)
IF(EQEMU_BUILD_PERL)
FIND_PACKAGE(PerlLibs REQUIRED)
INCLUDE_DIRECTORIES(SYSTEM "${PERL_INCLUDE_PATH}")
ENDIF(EQEMU_BUILD_PERL)
FIND_PACKAGE(MySQL)
FIND_PACKAGE(MariaDB)
FIND_PACKAGE(Boost REQUIRED)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(OpenSSL)
FIND_PACKAGE(Lua51)
FIND_PACKAGE(PerlLibs)
FIND_PACKAGE(Sodium)
FIND_PACKAGE(mbedTLS)
SET(SERVER_LIBS common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} uv_a fmt RecastNavigation::Detour)
MESSAGE(STATUS "**************************************************")
MESSAGE(STATUS "* Library Detection *")
MESSAGE(STATUS "**************************************************")
IF(MYSQL_FOUND)
MESSAGE(STATUS "* MySQL: FOUND *")
ELSE()
MESSAGE(STATUS "* MySQL: MISSING *")
ENDIF()
IF(MARIADB_FOUND)
MESSAGE(STATUS "* MariaDB: FOUND *")
ELSE()
MESSAGE(STATUS "* MariaDB: MISSING *")
ENDIF()
IF(ZLIB_FOUND)
MESSAGE(STATUS "* ZLIB: FOUND *")
ELSE()
MESSAGE(STATUS "* ZLIB: MISSING *")
ENDIF()
IF(Lua51_FOUND)
MESSAGE(STATUS "* Lua: FOUND *")
ELSE()
MESSAGE(STATUS "* Lua: MISSING *")
ENDIF()
IF(PerlLibs_FOUND)
MESSAGE(STATUS "* Perl: FOUND *")
ELSE()
MESSAGE(STATUS "* Perl: MISSING *")
ENDIF()
FIND_PACKAGE(Sodium REQUIRED)
IF(SODIUM_FOUND)
OPTION(EQEMU_ENABLE_SECURITY "Use Encryption For TCP Connections" ON)
IF(EQEMU_ENABLE_SECURITY)
INCLUDE_DIRECTORIES(SYSTEM "${SODIUM_INCLUDE_DIRS}")
ADD_DEFINITIONS(-DENABLE_SECURITY)
SET(SERVER_LIBS ${SERVER_LIBS} ${SODIUM_LIBRARIES})
MESSAGE(STATUS "* libsodium: FOUND *")
ELSE()
MESSAGE(STATUS "* libsodium: MISSING *")
ENDIF()
IF(OpenSSL_FOUND)
MESSAGE(STATUS "* OpenSSL: FOUND *")
ELSE()
MESSAGE(STATUS "* OpenSSL: MISSING *")
ENDIF()
IF(MBEDTLS_FOUND)
MESSAGE(STATUS "* mbedTLS: FOUND *")
ELSE()
MESSAGE(STATUS "* mbedTLS: MISSING *")
ENDIF()
MESSAGE(STATUS "**************************************************")
#options
OPTION(EQEMU_DEPOP_INVALIDATES_CACHE "#repop invalidates the npc_types cache (will cause a larger database hit on #repop but is more convienent)." ON)
OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF)
OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
ENDIF(EQEMU_COMMANDS_LOGGING)
IF(EQEMU_ENABLE_BOTS)
ADD_DEFINITIONS(-DBOTS)
ENDIF(EQEMU_ENABLE_BOTS)
#database
#prefer mariadb to mysql (arbitrary)
IF(MySQL_FOUND AND MariaDB_FOUND)
SET(DATABASE_LIBRARY_TYPE "MariaDB")
SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES})
SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR})
ELSEIF(MariaDB_FOUND)
SET(DATABASE_LIBRARY_TYPE "MariaDB")
SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES})
SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR})
ELSEIF(MySQL_FOUND)
SET(DATABASE_LIBRARY_TYPE " MySQL")
SET(DATABASE_LIBRARY_LIBS ${MySQL_LIBRARIES})
SET(DATABASE_LIBRARY_INCLUDE ${MySQL_INCLUDE_DIR})
ELSE()
MESSAGE(FATAL_ERROR "One of MySQL or MariaDB is a required dependency.")
ENDIF()
#security
#prefer openssl to mbedtls (arbitrary)
IF(OpenSSL_FOUND AND MBEDTLS_FOUND)
SET(SSL_LIBRARY_TYPE " OpenSSL")
SET(SSL_LIBRARY_ENABLED ON)
SET(SSL_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
SET(SSL_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
ELSEIF(OpenSSL_FOUND)
SET(SSL_LIBRARY_TYPE " OpenSSL")
SET(SSL_LIBRARY_ENABLED ON)
SET(SSL_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
SET(SSL_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
ELSEIF(MBEDTLS_FOUND)
SET(SSL_LIBRARY_TYPE " mbedTLS")
SET(SSL_LIBRARY_ENABLED ON)
SET(SSL_LIBRARY_LIBS ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
SET(SSL_LIBRARY_INCLUDE ${MBEDTLS_INCLUDE_DIR})
ELSE()
SET(SSL_LIBRARY_TYPE "Disabled")
SET(SSL_LIBRARY_ENABLED OFF)
ENDIF()
IF(SODIUM_FOUND)
SET(SODIUM_LIBRARY_TYPE "Libsodium")
SET(SODIUM_LIBRARY_ENABLED ON)
SET(SODIUM_LIBRARY_LIBS ${SODIUM_LIBRARIES})
SET(SODIUM_LIBRARY_INCLUDE ${SODIUM_INCLUDE_DIRS})
ADD_DEFINITIONS(-DENABLE_SECURITY)
ELSE()
SET(SODIUM_LIBRARY_TYPE " Disabled")
SET(SODIUM_LIBRARY_ENABLED OFF)
ENDIF()
IF(Lua51_FOUND)
SET(LUA_LIBRARY_TYPE " Lua 5.1")
SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind)
SET(LUA_LIBRARY_INCLUDE ${LUA_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
IF(EQEMU_BUILD_LUA)
ADD_DEFINITIONS(-DLUA_EQEMU)
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
IF(EQEMU_SANITIZE_LUA_LIBS)
ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS)
ENDIF()
ENDIF()
ELSE()
SET(LUA_LIBRARY_TYPE "Disabled")
ENDIF()
IF(PerlLibs_FOUND)
SET(PERL_LIBRARY_TYPE " Perl")
SET(PERL_LIBRARY_LIBS ${PERL_LIBRARY})
SET(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH})
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
IF(EQEMU_BUILD_PERL)
ADD_DEFINITIONS(-DEMBPERL)
ADD_DEFINITIONS(-DEMBPERL_PLUGIN)
ENDIF()
ELSE()
SET(PERL_LIBRARY_TYPE "Disabled")
ENDIF()
#use zlib if exists
IF(ZLIB_FOUND)
OPTION(EQEMU_BUILD_ZLIB "Build internal version of zlib." OFF)
IF(EQEMU_BUILD_ZLIB)
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/submodules/zlibng")
ELSE()
SET(ZLIB_LIBRARY_TYPE " zlib")
SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY})
SET(ZLIB_LIBRARY_INCLUDE ${ZLIB_INCLUDE_DIRS})
ENDIF()
ELSE()
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/submodules/zlibng")
ENDIF()
MESSAGE(STATUS "")
MESSAGE(STATUS "**************************************************")
MESSAGE(STATUS "* Library Usage *")
MESSAGE(STATUS "**************************************************")
MESSAGE(STATUS "* Database: ${DATABASE_LIBRARY_TYPE} *")
MESSAGE(STATUS "* TLS: ${SSL_LIBRARY_TYPE} *")
MESSAGE(STATUS "* Sodium: ${SODIUM_LIBRARY_TYPE} *")
MESSAGE(STATUS "* Lua: ${LUA_LIBRARY_TYPE} *")
MESSAGE(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *")
MESSAGE(STATUS "* zlib: ${ZLIB_LIBRARY_TYPE} *")
MESSAGE(STATUS "**************************************************")
#setup server libs and headers
SET(SERVER_LIBS common ${DATABASE_LIBRARY_LIBS} ${ZLIB_LIBRARY_LIBS} ${Boost_LIBRARIES} uv_a fmt RecastNavigation::Detour)
INCLUDE_DIRECTORIES(SYSTEM "${DATABASE_LIBRARY_INCLUDE}")
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_LIBRARY_INCLUDE}")
INCLUDE_DIRECTORIES(SYSTEM "${Boost_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/glm")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/cereal/include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/fmt/include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/libuv/include" )
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DebugUtils/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Detour/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourCrowd/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourTileCache/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Recast/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp")
IF(SSL_LIBRARY_ENABLED)
SET(SERVER_LIBS ${SERVER_LIBS} ${SSL_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${SSL_LIBRARY_INCLUDE}")
ENDIF()
IF(SODIUM_LIBRARY_ENABLED)
SET(SERVER_LIBS ${SERVER_LIBS} ${SODIUM_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${SODIUM_LIBRARY_INCLUDE}")
ENDIF()
IF(EQEMU_BUILD_LUA)
SET(SERVER_LIBS ${SERVER_LIBS} ${LUA_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${LUA_LIBRARY_INCLUDE}")
ENDIF()
IF(EQEMU_BUILD_PERL)
SET(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}")
ENDIF()
IF(WIN32)
@@ -321,34 +282,9 @@ IF(UNIX)
SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
ENDIF()
IF(EQEMU_BUILD_LUA)
FIND_PACKAGE(EQLua51 REQUIRED)
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
SET(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/boost")
FIND_PACKAGE(Boost REQUIRED)
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
IF(EQEMU_SANITIZE_LUA_LIBS)
ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS)
ENDIF(EQEMU_SANITIZE_LUA_LIBS)
ENDIF(EQEMU_BUILD_LUA)
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES(SYSTEM "${MySQL_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/glm")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/cereal/include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/fmt/include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/libuv/include" )
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DebugUtils/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Detour/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourCrowd/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourTileCache/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Recast/Include")
IF(EQEMU_BUILD_LOGIN AND NOT SSL_LIBRARY_ENABLED)
MESSAGE(FATAL_ERROR "Login server requires a SSL Library to build.")
ENDIF()
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
ADD_SUBDIRECTORY(common)
@@ -356,11 +292,20 @@ IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_H
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(submodules/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")
ADD_SUBDIRECTORY(submodules/recastnavigation)
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
MESSAGE(STATUS "Libs: ${SERVER_LIBS}")
IF(EQEMU_BUILD_SERVER)
ADD_SUBDIRECTORY(shared_memory)
ADD_SUBDIRECTORY(world)
@@ -369,6 +314,7 @@ IF(EQEMU_BUILD_SERVER)
ADD_SUBDIRECTORY(queryserv)
ADD_SUBDIRECTORY(eqlaunch)
ENDIF(EQEMU_BUILD_SERVER)
IF(EQEMU_BUILD_LOGIN)
ADD_SUBDIRECTORY(loginserver)
ENDIF(EQEMU_BUILD_LOGIN)
+6
View File
@@ -70,3 +70,9 @@ forum, although pull requests will be much quicker and easier on all parties.
* GPL Perl - GPL / ActiveState (under the assumption that this is a free project)
* CPPUnit - GLP StringUtilities - Apache
* LUA - MIT
## Contributors
<a href="https://github.com/EQEmu/server/graphs/contributors">
<img src="https://contributors-img.firebaseapp.com/image?repo=EQEmu/server" />
</a>
+3
View File
@@ -0,0 +1,3 @@
# Security Policy - Reporting Vulnerabilities
When reporting active hacks, exploits and other vulnerabilities, please describe how to reproduce said report and if you can provide context into a possible solution
+69
View File
@@ -1,5 +1,74 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 8/16/2019 ==
Akkadius: Simplified the use of roamboxes and improved the AI for roambox pathing https://i.imgur.com/z33u7y9.gif
Akkadius: Implemented command #roambox set <box_size> [move_delay]
Akkadius: Implemented command #roambox remove
Akkadius: Implemented LUA NPC:SetSimpleRoamBox(box_size, [move_distance], [move_delay]);
Akkadius: Implemented Perl $npc->SetSimpleRoamBox(box_size, [move_distance], [move_delay]);
Akkadius: Spawngroup data now hot reloads on #repop
Akkadius: Command #npceditmass now lists column options when one isn't properly specified
Akkadius: Implemented command #spawneditmass <search> <option> <value> with options [respawn_time] currently implemented
== 8/11/2019 ==
Akkadius: Added bulk edit command #npceditmass <column-to-search> <column-search-value> <change-column> <change-value>
Akkadius: Modified #findzone to include clickable saylinks to both regular zone (if able) and private gmzone instances
Akkadius: Added #findzone expansion <expansion-number> to show zones via expansion
== 8/6/2019 ==
Akkadius: Optimizations to movement updates to eliminate ghosting possibilities in larger zones
== 7/22/2019 ==
Uleat: Added script 'vcxproj_dependencies.py' - a script to help determine conflicting project dependencies (alpha-stage)
== 7/10/2019 ==
Akkadius: Add #npcedit flymode [0 = ground, 1 = flying, 2 = levitate, 3 = water, 4 = floating]
Akkadius: Added "flymode" to npc_types database table
== 7/3/2019 ==
Akkadius/KLS:
- Optimizations to packet updates introduced back into the source post network code overhaul
- Optimizations made to position update packets by sending updates far less frequently when not in line with zone:max_movement_update_range
- Optimizations made to position updates in respect to the much higher resolution of navmesh path-finding that we were using. We have cut down
on the resolution of path finding / updating so that we reduce the CPU overhead of path-finding and subsequent client update packets that
get generated this action
- Optimization made by adjusting ZLIB compression rate that was accidentally set to a compression level of 4 a long time ago
- Added #netstats admin command to troubleshoot connection issues in detail
- Websocket server is now available in zone and is bound to the same UDP port that the zoneserver listens on
- Currently implemented websocket API calls at the zone level
get_packet_statistics
get_opcode_list
get_npc_list_detail
get_door_list_detail
get_corpse_list_detail
get_object_list_detail
get_mob_list_detail
get_client_list_detail
get_zone_attributes
get_logsys_categories
set_logging_level
- Example of a Typescript client: https://gist.github.com/Akkadius/52d12d0379f36cf81c51b3b7da13db37
- Library Changes
- We now use git submodules for libraries / dependencies versus manually downloading to the dependencies folder and/or storing
said dependencies within our codebase itself
- To update dependencies (Required for compiling)
- git submodule init
- git submodule update
- Libraries now in submodules
- [glm] https://github.com/g-truc/glm.git
- [flm] https://github.com/fmtlib/fmt.git
- [libuv] https://github.com/libuv/libuv.git
- [cereal] https://github.com/USCiLab/cereal.git
- [websocketpp] https://github.com/zaphoyd/websocketpp.git
- [recastnavigation] https://github.com/EQEmu/recastnavigation.git
== 6/24/2019 ==
Uleat: Reworked BotDatabase into a functional add-on for ZoneDatabase
- Eliminated the database connection associated with class BotDatabase
- All behaviors remain the same with the exception of the calling object
-- To invoke a BotDatabase function, use database.botdb.<f> rather than botdb.<f>
== 3/1/2019 ==
Noudess: Major faction conversion to use client data.
+1 -1
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
add_subdirectory(import)
add_subdirectory(export)
+1 -1
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
SET(export_sources
main.cpp
+1 -1
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
SET(import_sources
main.cpp
-124
View File
@@ -1,124 +0,0 @@
#CMake - Cross Platform Makefile Generator
#Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions
#are met:
#
#* Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
#* Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
#* Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
#HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This module defines
# LUA51_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
IF(LUA_ROOT)
FIND_PATH(LUA_INCLUDE_DIR
NAMES lua.h
HINTS
ENV LUA_DIR
PATHS
${LUA_ROOT}
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include src
)
FIND_LIBRARY(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua
HINTS
ENV LUA_DIR
PATHS
${LUA_ROOT}
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib bin
)
ELSE(LUA_ROOT)
FIND_PATH(LUA_INCLUDE_DIR
NAMES lua.h
HINTS
ENV LUA_DIR
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
)
FIND_LIBRARY(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua
HINTS
ENV LUA_DIR
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib bin
)
ENDIF(LUA_ROOT)
IF(LUA_LIBRARY)
# include the math library for Unix
IF(UNIX AND NOT APPLE)
FIND_LIBRARY(LUA_MATH_LIBRARY m)
SET(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
ELSE()
SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
ENDIF()
ENDIF()
IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
UNSET(lua_version_str)
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
+87
View File
@@ -0,0 +1,87 @@
# - Find mariadbclient
#
# -*- cmake -*-
#
# Find the native MariaDB includes and library
#
# MariaDB_INCLUDE_DIR - where to find mysql.h, etc.
# MariaDB_LIBRARIES - List of libraries when using MariaDB.
# MariaDB_FOUND - True if MariaDB found.
# The following can be used as a hint as to where to search:
# MARIADB_ROOT
IF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARIES)
# Already in cache, be silent
SET(MariaDB_FIND_QUIETLY TRUE)
ENDIF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARIES)
# Include dir
IF(MARIADB_ROOT)
FIND_PATH(MariaDB_INCLUDE_DIR
NAMES mariadb_version.h
PATHS ${MARIADB_ROOT}/include
PATH_SUFFIXES mysql mariadb
NO_DEFAULT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
)
FIND_PATH(MariaDB_INCLUDE_DIR
NAMES mariadb_version.h
PATH_SUFFIXES mysql mariadb
)
ELSE(MARIADB_ROOT)
FIND_PATH(MariaDB_INCLUDE_DIR
NAMES mariadb_version.h
PATH_SUFFIXES mysql mariadb
)
ENDIF(MARIADB_ROOT)
# Library
SET(MariaDB_NAMES libmariadb)
IF(MARIADB_ROOT)
FIND_LIBRARY(MariaDB_LIBRARY
NAMES ${MariaDB_NAMES}
PATHS ${MARIADB_ROOT}/lib
PATH_SUFFIXES mysql mariadb
NO_DEFAULT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
)
FIND_LIBRARY(MariaDB_LIBRARY
NAMES ${MariaDB_NAMES}
PATH_SUFFIXES mysql mariadb
)
ELSE(MARIADB_ROOT)
FIND_LIBRARY(MariaDB_LIBRARY
NAMES ${MariaDB_NAMES} mariadbclient_r mariadbclient
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
PATH_SUFFIXES mysql mariadb
)
ENDIF(MARIADB_ROOT)
IF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY)
SET(MariaDB_FOUND TRUE)
SET(MariaDB_LIBRARIES ${MariaDB_LIBRARY})
ELSE (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY)
SET(MariaDB_FOUND FALSE)
SET(MariaDB_LIBRARIES)
ENDIF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set MariaDB_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MariaDB DEFAULT_MSG MariaDB_LIBRARY MariaDB_INCLUDE_DIR)
IF(MariaDB_FOUND)
SET( MariaDB_LIBRARY_RELEASE ${MariaDB_LIBRARY} )
SET( MariaDB_LIBRARY_DEBUG ${MariaDB_LIBRARY} )
SET( MariaDB_LIBRARIES ${MariaDB_LIBRARY_RELEASE} ${MariaDB_LIBRARY_DEBUG} )
ELSE(MariaDB_FOUND)
SET( MariaDB_LIBRARIES )
ENDIF(MariaDB_FOUND)
MARK_AS_ADVANCED(
MariaDB_LIBRARY_DEBUG
MariaDB_LIBRARY_RELEASE
MariaDB_INCLUDE_DIR
)
+93
View File
@@ -0,0 +1,93 @@
# - Try to find mbedTLS
# Once done this will define
#
# Read-Only variables
# MBEDTLS_FOUND - system has mbedTLS
# MBEDTLS_INCLUDE_DIR - the mbedTLS include directory
# MBEDTLS_LIBRARY_DIR - the mbedTLS library directory
# MBEDTLS_LIBRARIES - Link these to use mbedTLS
# MBEDTLS_LIBRARY - path to mbedTLS library
# MBEDX509_LIBRARY - path to mbedTLS X.509 library
# MBEDCRYPTO_LIBRARY - path to mbedTLS Crypto library
#
# Hint
# MBEDTLS_ROOT_DIR can be pointed to a local mbedTLS installation.
SET(_MBEDTLS_ROOT_HINTS
${MBEDTLS_ROOT_DIR}
ENV MBEDTLS_ROOT_DIR
)
SET(_MBEDTLS_ROOT_HINTS_AND_PATHS
HINTS ${_MBEDTLS_ROOT_HINTS}
PATHS ${_MBEDTLS_ROOT_PATHS}
)
FIND_PATH(MBEDTLS_INCLUDE_DIR
NAMES mbedtls/version.h
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES include
)
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES)
# Already in cache, be silent
SET(MBEDTLS_FIND_QUIETLY TRUE)
ENDIF()
FIND_LIBRARY(MBEDTLS_LIBRARY
NAMES mbedtls libmbedtls
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES library
)
FIND_LIBRARY(MBEDX509_LIBRARY
NAMES mbedx509 libmbedx509
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES library
)
FIND_LIBRARY(MBEDCRYPTO_LIBRARY
NAMES mbedcrypto libmbedcrypto
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES library
)
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY)
SET(MBEDTLS_FOUND TRUE)
ENDIF()
IF(MBEDTLS_FOUND)
# split mbedTLS into -L and -l linker options, so we can set them for pkg-config
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_DIR ${MBEDTLS_LIBRARY} PATH)
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY} NAME_WE)
GET_FILENAME_COMPONENT(MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY} NAME_WE)
GET_FILENAME_COMPONENT(MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY} NAME_WE)
STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
IF(NOT MBEDTLS_FIND_QUIETLY)
MESSAGE(STATUS "Found mbedTLS:")
FILE(READ ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLSCONTENT)
STRING(REGEX MATCH "MBEDTLS_VERSION_STRING +\"[0-9|.]+\"" MBEDTLSMATCH ${MBEDTLSCONTENT})
IF (MBEDTLSMATCH)
STRING(REGEX REPLACE "MBEDTLS_VERSION_STRING +\"([0-9|.]+)\"" "\\1" MBEDTLS_VERSION ${MBEDTLSMATCH})
MESSAGE(STATUS " version ${MBEDTLS_VERSION}")
ENDIF(MBEDTLSMATCH)
MESSAGE(STATUS " TLS: ${MBEDTLS_LIBRARY}")
MESSAGE(STATUS " X509: ${MBEDX509_LIBRARY}")
MESSAGE(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}")
ENDIF(NOT MBEDTLS_FIND_QUIETLY)
ELSE(MBEDTLS_FOUND)
IF(MBEDTLS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find mbedTLS")
ENDIF(MBEDTLS_FIND_REQUIRED)
ENDIF(MBEDTLS_FOUND)
MARK_AS_ADVANCED(
MBEDTLS_INCLUDE_DIR
MBEDTLS_LIBRARY_DIR
MBEDTLS_LIBRARIES
MBEDTLS_LIBRARY
MBEDX509_LIBRARY
MBEDCRYPTO_LIBRARY
)
+11 -2
View File
@@ -1,5 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
SET(common_sources
base_packet.cpp
classes.cpp
@@ -86,6 +85,8 @@ SET(common_sources
net/servertalk_server_connection.cpp
net/tcp_connection.cpp
net/tcp_server.cpp
net/websocket_server.cpp
net/websocket_server_connection.cpp
patches/patches.cpp
patches/sod.cpp
patches/sod_limits.cpp
@@ -210,6 +211,7 @@ SET(common_headers
xml_parser.h
zone_numbers.h
event/event_loop.h
event/idle.h
event/task.h
event/timer.h
json/json.h
@@ -230,6 +232,8 @@ SET(common_headers
net/servertalk_server_connection.h
net/tcp_connection.h
net/tcp_server.h
net/websocket_server.h
net/websocket_server_connection.h
patches/patches.h
patches/sod.h
patches/sod_limits.h
@@ -268,6 +272,7 @@ SET(common_headers
SOURCE_GROUP(Event FILES
event/event_loop.h
event/idle.h
event/timer.h
event/task.h
)
@@ -309,6 +314,10 @@ SOURCE_GROUP(Net FILES
net/tcp_connection.h
net/tcp_server.cpp
net/tcp_server.h
net/websocket_server.cpp
net/websocket_server.h
net/websocket_server_connection.cpp
net/websocket_server_connection.h
)
SOURCE_GROUP(Patches FILES
+1 -1
View File
@@ -23,7 +23,7 @@
* 2005-08-05 v5 - Removed most Lint (http://www.gimpel.com/) errors... thanks to Okko Willeboordse!
*
**********************************************************************/
#ifdef _WINDOWS
#ifdef _WIN32
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
+1 -1
View File
@@ -9,7 +9,7 @@
* 2013-01-26 - Modified by KimLS(KLS) for EQEmu's purposes
*
**********************************************************************/
#ifdef _WINDOWS
#ifdef _WIN32
// #pragma once is supported starting with _MCS_VER 1000,
// so we need not to check the version (because we only support _MSC_VER >= 1100)!
#pragma once
+2 -1
View File
@@ -23,7 +23,7 @@
#include <stdio.h>
#include <string.h>
#ifdef _WINDOWS
#ifdef _WIN32
#include <time.h>
#include <winsock2.h>
#include <windows.h>
@@ -75,6 +75,7 @@ public:
uint32 ReadUInt32() { uint32 value = *(uint32 *)(pBuffer + _rpos); _rpos += sizeof(uint32); return value; }
uint32 ReadUInt32(uint32 Offset) const { uint32 value = *(uint32 *)(pBuffer + Offset); return value; }
void ReadString(char *str) { uint32 len = static_cast<uint32>(strlen((char *)(pBuffer + _rpos))) + 1; memcpy(str, pBuffer + _rpos, len); _rpos += len; }
void ReadString(std::string &str) { str = reinterpret_cast<char *>(pBuffer + _rpos); _rpos += str.length() + 1; }
void ReadString(char *str, uint32 Offset, uint32 MaxLength) const;
uint32 GetWritePosition() { return _wpos; }
+1 -1
View File
@@ -18,7 +18,7 @@
#include "condition.h"
#ifdef _WINDOWS
#ifdef _WIN32
Condition::Condition()
{
+2 -2
View File
@@ -20,7 +20,7 @@
#include "global_define.h"
#include "mutex.h"
#ifndef WIN32
#ifndef _WIN32
#include <pthread.h>
#endif
@@ -30,7 +30,7 @@
class Condition {
private:
#ifdef WIN32
#ifdef _WIN32
enum {
SignalEvent = 0,
BroadcastEvent,
+1 -1
View File
@@ -2,7 +2,7 @@
#include "eqemu_logsys.h"
#include "crash.h"
#if defined(_WINDOWS) && defined(CRASH_LOGGING)
#if defined(_WIN32) && defined(CRASH_LOGGING)
#include "StackWalker.h"
class EQEmuStackWalker : public StackWalker
+14 -17
View File
@@ -30,7 +30,7 @@
#include <string.h>
// Disgrace: for windows compile
#ifdef _WINDOWS
#ifdef _WIN32
#include <windows.h>
#define snprintf _snprintf
#define strncasecmp _strnicmp
@@ -171,30 +171,27 @@ void Database::LoginIP(uint32 AccountID, const char* LoginIP) {
QueryDatabase(query);
}
int16 Database::CheckStatus(uint32 account_id) {
std::string query = StringFormat("SELECT `status`, UNIX_TIMESTAMP(`suspendeduntil`) as `suspendeduntil`, UNIX_TIMESTAMP() as `current`"
" FROM `account` WHERE `id` = %i", account_id);
int16 Database::CheckStatus(uint32 account_id)
{
std::string query = StringFormat(
"SELECT `status`, TIMESTAMPDIFF(SECOND, NOW(), `suspendeduntil`) FROM `account` WHERE `id` = %i",
account_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
auto results = QueryDatabase(query);
if (!results.Success())
return 0;
}
if (results.RowCount() != 1)
return 0;
auto row = results.begin();
int16 status = atoi(row[0]);
int32 suspendeduntil = 0;
// MariaDB initalizes with NULL if unix_timestamp() is out of range
if (row[1] != nullptr) {
suspendeduntil = atoi(row[1]);
}
auto row = results.begin();
int16 status = atoi(row[0]);
int32 date_diff = 0;
int32 current = atoi(row[2]);
if (row[1] != nullptr)
date_diff = atoi(row[1]);
if(suspendeduntil > current)
if (date_diff > 0)
return -1;
return status;
+2 -10
View File
@@ -82,17 +82,9 @@ struct VarCache_Struct {
};
class PTimerList;
# define _ISNAN_(a) std::isnan(a)
#ifdef _WINDOWS
#if _MSC_VER > 1700 // greater than 2012 (2013+)
# define _ISNAN_(a) std::isnan(a)
#else
# include <float.h>
# define _ISNAN_(a) _isnan(a)
#endif
#else
# define _ISNAN_(a) std::isnan(a)
#endif
#define SQL(...) #__VA_ARGS__
class Database : public DBcore {
public:
+2 -2
View File
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <iostream>
// Disgrace: for windows compile
#ifdef _WINDOWS
#ifdef _WIN32
#include <windows.h>
#define snprintf _snprintf
#define strncasecmp _strnicmp
@@ -476,7 +476,7 @@ bool Database::CheckDatabaseConversions() {
CheckDatabaseConvertCorpseDeblob();
/* Run EQEmu Server script (Checks for database updates) */
system("perl eqemu_server.pl ran_from_world");
if(system("perl eqemu_server.pl ran_from_world"));
return true;
}
+1 -1
View File
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <iostream>
// Disgrace: for windows compile
#ifdef _WINDOWS
#ifdef _WIN32
#include <windows.h>
#define snprintf _snprintf
#define strncasecmp _strnicmp
+2 -2
View File
@@ -1,4 +1,4 @@
#ifdef _WINDOWS
#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -13,7 +13,7 @@
#include <mysqld_error.h>
#include <string.h>
#ifdef _WINDOWS
#ifdef _WIN32
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DBCORE_H
#define DBCORE_H
#ifdef _WINDOWS
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
+10
View File
@@ -77,6 +77,10 @@ namespace EQEmu
} // namespace invtype
namespace DevTools {
const int32 GM_ACCOUNT_STATUS_LEVEL = 150;
}
namespace popupresponse {
const int32 SERVER_INTERNAL_USE_BASE = 2000000000;
const int32 MOB_INFO_DISMISS = 2000000001;
@@ -307,6 +311,12 @@ namespace EQEmu
} // namespace bug
enum WaypointStatus : int {
RoamBoxPauseInProgress = -3,
QuestControlNoGrid = -2,
QuestControlGrid = -1
};
} /*EQEmu*/
#endif /*COMMON_EMU_CONSTANTS_H*/
+129 -193
View File
@@ -71,7 +71,7 @@
//#define AT_Trader 300 // Bazaar Trader Mode (not present in SoF or RoF2)
// animations for AT_Anim
#define ANIM_FREEZE 102
#define ANIM_FREEZE 102
#define ANIM_STAND 0x64
#define ANIM_SIT 0x6e
#define ANIM_CROUCH 0x6f
@@ -87,199 +87,114 @@ typedef enum {
_eaMaxAppearance
} EmuAppearance;
// msg_type's for custom usercolors
#define MT_Say 256
#define MT_Tell 257
#define MT_Group 258
#define MT_Guild 259
#define MT_OOC 260
#define MT_Auction 261
#define MT_Shout 262
#define MT_Emote 263
#define MT_Spells 264
#define MT_YouHitOther 265
#define MT_OtherHitsYou 266
#define MT_YouMissOther 267
#define MT_OtherMissesYou 268
#define MT_Broadcasts 269
#define MT_Skills 270
#define MT_Disciplines 271
#define MT_Unused1 272
#define MT_DefaultText 273
#define MT_Unused2 274
#define MT_MerchantOffer 275
#define MT_MerchantBuySell 276
#define MT_YourDeath 277
#define MT_OtherDeath 278
#define MT_OtherHits 279
#define MT_OtherMisses 280
#define MT_Who 281
#define MT_YellForHelp 282
#define MT_NonMelee 283
#define MT_WornOff 284
#define MT_MoneySplit 285
#define MT_LootMessages 286
#define MT_DiceRoll 287
#define MT_OtherSpells 288
#define MT_SpellFailure 289
#define MT_Chat 290
#define MT_Channel1 291
#define MT_Channel2 292
#define MT_Channel3 293
#define MT_Channel4 294
#define MT_Channel5 295
#define MT_Channel6 296
#define MT_Channel7 297
#define MT_Channel8 298
#define MT_Channel9 299
#define MT_Channel10 300
#define MT_CritMelee 301
#define MT_SpellCrits 302
#define MT_TooFarAway 303
#define MT_NPCRampage 304
#define MT_NPCFlurry 305
#define MT_NPCEnrage 306
#define MT_SayEcho 307
#define MT_TellEcho 308
#define MT_GroupEcho 309
#define MT_GuildEcho 310
#define MT_OOCEcho 311
#define MT_AuctionEcho 312
#define MT_ShoutECho 313
#define MT_EmoteEcho 314
#define MT_Chat1Echo 315
#define MT_Chat2Echo 316
#define MT_Chat3Echo 317
#define MT_Chat4Echo 318
#define MT_Chat5Echo 319
#define MT_Chat6Echo 320
#define MT_Chat7Echo 321
#define MT_Chat8Echo 322
#define MT_Chat9Echo 323
#define MT_Chat10Echo 324
#define MT_DoTDamage 325
#define MT_ItemLink 326
#define MT_RaidSay 327
#define MT_MyPet 328
#define MT_DS 329
#define MT_Leadership 330
#define MT_PetFlurry 331
#define MT_PetCrit 332
#define MT_FocusEffect 333
#define MT_Experience 334
#define MT_System 335
#define MT_PetSpell 336
#define MT_PetResponse 337
#define MT_ItemSpeech 338
#define MT_StrikeThrough 339
#define MT_Stun 340
namespace Chat {
const uint16 White = 0;
const uint16 DimGray = 1;
const uint16 Default = 1;
const uint16 Green = 2;
const uint16 BrightBlue = 3;
const uint16 LightBlue = 4;
const uint16 Magenta = 5;
const uint16 Gray = 6;
const uint16 LightGray = 7;
const uint16 NPCQuestSay = 10;
const uint16 DarkGray = 12;
const uint16 Red = 13;
const uint16 Lime = 14;
const uint16 Yellow = 15;
const uint16 Blue = 16;
const uint16 LightNavy = 17;
const uint16 Cyan = 18;
const uint16 Black = 20;
// TODO: Really should combine above and below into one
//from showeq
enum ChatColor
{
/*
CC_Default = 0,
CC_DarkGrey = 1,
CC_DarkGreen = 2,
CC_DarkBlue = 3,
CC_Purple = 5,
CC_LightGrey = 6,
*/
CC_WhiteSmoke = 0, // FF|F0F0F0
CC_Green = 2, // FF|008000
CC_BrightBlue = 3, // FF|0040FF
CC_Magenta = 5, // FF|F000F0
CC_Gray = 6, // FF|808080
CC_LightGray = 7, // FF|E0E0E0
//CC_WhiteSmoke2 = 10, // FF|F0F0F0
CC_DarkGray = 12, // FF|A0A0A0
CC_Red = 13, // FF|F00000
CC_Lime = 14, // FF|00F000
CC_Yellow = 15, // FF|F0F000
CC_Blue = 16, // FF|0000F0
CC_LightNavy = 17, // FF|0000AF
CC_Cyan = 18, // FF|00F0F0
CC_Black = 20, // FF|000000
// any index <= 255 that is not defined above
CC_DimGray = 1, // FF|606060
CC_Default = 1,
CC_User_Say = 256,
CC_User_Tell = 257,
CC_User_Group = 258,
CC_User_Guild = 259,
CC_User_OOC = 260,
CC_User_Auction = 261,
CC_User_Shout = 262,
CC_User_Emote = 263,
CC_User_Spells = 264,
CC_User_YouHitOther = 265,
CC_User_OtherHitYou = 266,
CC_User_YouMissOther = 267,
CC_User_OtherMissYou = 268,
CC_User_Duels = 269,
CC_User_Skills = 270,
CC_User_Disciplines = 271,
CC_User_Default = 273,
CC_User_MerchantOffer = 275,
CC_User_MerchantExchange = 276,
CC_User_YourDeath = 277,
CC_User_OtherDeath = 278,
CC_User_OtherHitOther = 279,
CC_User_OtherMissOther = 280,
CC_User_Who = 281,
CC_User_Yell = 282,
CC_User_NonMelee = 283,
CC_User_SpellWornOff = 284,
CC_User_MoneySplit = 285,
CC_User_Loot = 286,
CC_User_Random = 287,
CC_User_OtherSpells = 288,
CC_User_SpellFailure = 289,
CC_User_ChatChannel = 290,
CC_User_Chat1 = 291,
CC_User_Chat2 = 292,
CC_User_Chat3 = 293,
CC_User_Chat4 = 294,
CC_User_Chat5 = 295,
CC_User_Chat6 = 296,
CC_User_Chat7 = 297,
CC_User_Chat8 = 298,
CC_User_Chat9 = 299,
CC_User_Chat10 = 300,
CC_User_MeleeCrit = 301,
CC_User_SpellCrit = 302,
CC_User_TooFarAway = 303,
CC_User_NPCRampage = 304,
CC_User_NPCFurry = 305,
CC_User_NPCEnrage = 306,
CC_User_EchoSay = 307,
CC_User_EchoTell = 308,
CC_User_EchoGroup = 309,
CC_User_EchoGuild = 310,
CC_User_EchoOOC = 311,
CC_User_EchoAuction = 312,
CC_User_EchoShout = 313,
CC_User_EchoEmote = 314,
CC_User_EchoChat1 = 315,
CC_User_EchoChat2 = 316,
CC_User_EchoChat3 = 317,
CC_User_EchoChat4 = 318,
CC_User_EchoChat5 = 319,
CC_User_EchoChat6 = 320,
CC_User_EchoChat7 = 321,
CC_User_EchoChat8 = 322,
CC_User_EchoChat9 = 323,
CC_User_EchoChat10 = 324,
CC_User_UnusedAtThisTime = 325,
CC_User_ItemTags = 326,
CC_User_RaidSay = 327,
CC_User_MyPet = 328,
CC_User_DamageShield = 329,
/**
* User colors
*/
const uint16 Say = 256;
const uint16 Tell = 257;
const uint16 Group = 258;
const uint16 Guild = 259;
const uint16 OOC = 260;
const uint16 Auction = 261;
const uint16 Shout = 262;
const uint16 Emote = 263;
const uint16 Spells = 264;
const uint16 YouHitOther = 265;
const uint16 OtherHitYou = 266;
const uint16 YouMissOther = 267;
const uint16 OtherMissYou = 268;
const uint16 Broadcasts = 269;
const uint16 Skills = 270;
const uint16 Disciplines = 271;
const uint16 Unused1 = 272;
const uint16 DefaultText = 273;
const uint16 Unused2 = 274;
const uint16 MerchantOffer = 275;
const uint16 MerchantExchange = 276;
const uint16 YourDeath = 277;
const uint16 OtherDeath = 278;
const uint16 OtherHitOther = 279;
const uint16 OtherMissOther = 280;
const uint16 Who = 281;
const uint16 YellForHelp = 282;
const uint16 NonMelee = 283;
const uint16 SpellWornOff = 284;
const uint16 MoneySplit = 285;
const uint16 Loot = 286;
const uint16 DiceRoll = 287;
const uint16 OtherSpells = 288;
const uint16 SpellFailure = 289;
const uint16 ChatChannel = 290;
const uint16 Chat1 = 291;
const uint16 Chat2 = 292;
const uint16 Chat3 = 293;
const uint16 Chat4 = 294;
const uint16 Chat5 = 295;
const uint16 Chat6 = 296;
const uint16 Chat7 = 297;
const uint16 Chat8 = 298;
const uint16 Chat9 = 299;
const uint16 Chat10 = 300;
const uint16 MeleeCrit = 301;
const uint16 SpellCrit = 302;
const uint16 TooFarAway = 303;
const uint16 NPCRampage = 304;
const uint16 NPCFlurry = 305;
const uint16 NPCEnrage = 306;
const uint16 EchoSay = 307;
const uint16 EchoTell = 308;
const uint16 EchoGroup = 309;
const uint16 EchoGuild = 310;
const uint16 EchoOOC = 311;
const uint16 EchoAuction = 312;
const uint16 EchoShout = 313;
const uint16 EchoEmote = 314;
const uint16 EchoChat1 = 315;
const uint16 EchoChat2 = 316;
const uint16 EchoChat3 = 317;
const uint16 EchoChat4 = 318;
const uint16 EchoChat5 = 319;
const uint16 EchoChat6 = 320;
const uint16 EchoChat7 = 321;
const uint16 EchoChat8 = 322;
const uint16 EchoChat9 = 323;
const uint16 EchoChat10 = 324;
const uint16 DotDamage = 325;
const uint16 ItemLink = 326;
const uint16 RaidSay = 327;
const uint16 MyPet = 328;
const uint16 DamageShield = 329;
const uint16 LeaderShip = 330;
const uint16 PetFlurry = 331;
const uint16 PetCritical = 332;
const uint16 FocusEffect = 333;
const uint16 Experience = 334;
const uint16 System = 335;
const uint16 PetSpell = 336;
const uint16 PetResponse = 337;
const uint16 ItemSpeech = 338;
const uint16 StrikeThrough = 339;
const uint16 Stun = 340;
};
//ZoneChange_Struct->success values
@@ -523,4 +438,25 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
enum ChatChannelNames : uint16
{
ChatChannel_Guild = 0,
ChatChannel_Group = 2,
ChatChannel_Shout = 3,
ChatChannel_Auction = 4,
ChatChannel_OOC = 5,
ChatChannel_Broadcast = 6,
ChatChannel_Tell = 7,
ChatChannel_Say = 8,
ChatChannel_Petition = 10,
ChatChannel_GMSAY = 11,
ChatChannel_TellEcho = 14,
ChatChannel_Raid = 15,
ChatChannel_UNKNOWN_Guild = 17,
ChatChannel_UNKNOWN_GMSAY = 18,
ChatChannel_UCSRelay = 20,
ChatChannel_Emotes = 22
};
#endif /*COMMON_EQ_CONSTANTS_H*/
+14
View File
@@ -1188,6 +1188,20 @@ struct SpecialMesg_Struct
/*24*/ char message[1]; // What is being said?
};
struct SpecialMesgHeader_Struct
{
/*00*/ char SpeakMode; // 2 shouts, 4 %1 %2, 3 %2, 5 tells group, 0 copy, default says
/*01*/ char JournalMode; // 1 and 2 go to journal
/*02*/ char language;
/*03*/ uint32 msg_type; // Color of text (see MT_*** below)
/*07*/ uint32 target_spawn_id; // Who is it being said to?
/*11*/ // speaker's name
/*xx*/ // unknown, location, client doesn't care
/*xx*/ // unknown
/*xx*/ // unknown
/*xx*/ // message
};
/*
** When somebody changes what they're wearing or give a pet a weapon (model changes)
** Length: 19 Bytes
+2 -2
View File
@@ -27,7 +27,6 @@ struct EQStreamManagerInterfaceOptions
EQStreamManagerInterfaceOptions(int port, bool encoded, bool compressed) {
opcode_size = 2;
track_opcode_stats = false;
//World seems to support both compression and xor zone supports one or the others.
//Enforce one or the other in the convienence construct
@@ -54,8 +53,9 @@ public:
EQStreamManagerInterface(const EQStreamManagerInterfaceOptions &options) { m_options = options; }
virtual ~EQStreamManagerInterface() { };
EQStreamManagerInterfaceOptions GetOptions() { return m_options; }
const EQStreamManagerInterfaceOptions& GetOptions() const { return m_options; }
EQStreamManagerInterfaceOptions& MutateOptions() { return m_options; }
virtual void SetOptions(const EQStreamManagerInterfaceOptions& options) = 0;
protected:
EQStreamManagerInterfaceOptions m_options;
};
+82 -48
View File
@@ -26,24 +26,26 @@
std::string EQEmuConfig::ConfigFile = "eqemu_config.json";
EQEmuConfig *EQEmuConfig::_config = nullptr;
void EQEmuConfig::parse_config() {
ShortName = _root["server"]["world"].get("shortname", "").asString();
LongName = _root["server"]["world"].get("longname", "").asString();
void EQEmuConfig::parse_config()
{
ShortName = _root["server"]["world"].get("shortname", "").asString();
LongName = _root["server"]["world"].get("longname", "").asString();
WorldAddress = _root["server"]["world"].get("address", "").asString();
LocalAddress = _root["server"]["world"].get("localaddress", "").asString();
MaxClients = atoi(_root["server"]["world"].get("maxclients", "-1").asString().c_str());
SharedKey = _root["server"]["world"].get("key", "").asString();
LoginCount = 0;
MaxClients = atoi(_root["server"]["world"].get("maxclients", "-1").asString().c_str());
SharedKey = _root["server"]["world"].get("key", "").asString();
LoginCount = 0;
if (_root["server"]["world"]["loginserver"].isObject()) {
LoginHost = _root["server"]["world"]["loginserver"].get("host", "login.eqemulator.net").asString();
LoginPort = atoi(_root["server"]["world"]["loginserver"].get("port", "5998").asString().c_str());
LoginHost = _root["server"]["world"]["loginserver"].get("host", "login.eqemulator.net").asString();
LoginPort = atoi(_root["server"]["world"]["loginserver"].get("port", "5998").asString().c_str());
LoginLegacy = false;
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") LoginLegacy = true;
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
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();
} else {
}
else {
char str[32];
loginlist.Clear();
do {
@@ -53,76 +55,104 @@ void EQEmuConfig::parse_config() {
}
auto loginconfig = new LoginConfig;
loginconfig->LoginHost = _root["server"]["world"][str].get("host", "login.eqemulator.net").asString();
loginconfig->LoginPort = atoi(_root["server"]["world"][str].get("port", "5998").asString().c_str());
loginconfig->LoginAccount = _root["server"]["world"][str].get("account", "").asString();
loginconfig->LoginHost = _root["server"]["world"][str].get("host", "login.eqemulator.net").asString();
loginconfig->LoginPort = atoi(_root["server"]["world"][str].get("port", "5998").asString().c_str());
loginconfig->LoginAccount = _root["server"]["world"][str].get("account", "").asString();
loginconfig->LoginPassword = _root["server"]["world"][str].get("password", "").asString();
loginconfig->LoginLegacy = false;
if (_root["server"]["world"][str].get("legacy", "0").asString() == "1") loginconfig->LoginLegacy = true;
if (_root["server"]["world"][str].get("legacy", "0").asString() == "1") { loginconfig->LoginLegacy = true; }
loginlist.Insert(loginconfig);
} while (LoginCount < 100);
}
//<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();
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());
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
TelnetTCPPort = atoi(_root["server"]["world"]["telnet"].get("port", "9001").asString().c_str());
TelnetEnabled = false;
if (_root["server"]["world"]["telnet"].get("enabled", "false").asString() == "true") TelnetEnabled = true;
if (_root["server"]["world"]["telnet"].get("enabled", "false").asString() == "true") { TelnetEnabled = true; }
WorldHTTPMimeFile = _root["server"]["world"]["http"].get("mimefile", "mime.types").asString();
WorldHTTPPort = atoi(_root["server"]["world"]["http"].get("port", "9080").asString().c_str());
WorldHTTPEnabled = false;
if (_root["server"]["world"]["http"].get("enabled", "false").asString() == "true") WorldHTTPEnabled = true;
WorldHTTPPort = atoi(_root["server"]["world"]["http"].get("port", "9080").asString().c_str());
WorldHTTPEnabled = false;
if (_root["server"]["world"]["http"].get("enabled", "false").asString() == "true") {
WorldHTTPEnabled = true;
}
/**
* UCS
*/
ChatHost = _root["server"]["chatserver"].get("host", "eqchat.eqemulator.net").asString();
ChatPort = atoi(_root["server"]["chatserver"].get("port", "7778").asString().c_str());
MailHost = _root["server"]["mailserver"].get("host", "eqmail.eqemulator.net").asString();
MailPort = atoi(_root["server"]["mailserver"].get("port", "7778").asString().c_str());
/**
* Database
*/
DatabaseUsername = _root["server"]["database"].get("username", "eq").asString();
DatabasePassword = _root["server"]["database"].get("password", "eq").asString();
DatabaseHost = _root["server"]["database"].get("host", "localhost").asString();
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
DatabaseHost = _root["server"]["database"].get("host", "localhost").asString();
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
QSDatabaseHost = _root["server"]["qsdatabase"].get("host", "localhost").asString();
QSDatabasePort = atoi(_root["server"]["qsdatabase"].get("port", "3306").asString().c_str());
/**
* QS
*/
QSDatabaseHost = _root["server"]["qsdatabase"].get("host", "localhost").asString();
QSDatabasePort = atoi(_root["server"]["qsdatabase"].get("port", "3306").asString().c_str());
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
/**
* Zones
*/
DefaultStatus = atoi(_root["server"]["zones"].get("defaultstatus", 0).asString().c_str());
ZonePortLow = atoi(_root["server"]["zones"]["ports"].get("low", "7000").asString().c_str());
ZonePortHigh = atoi(_root["server"]["zones"]["ports"].get("high", "7999").asString().c_str());
ZonePortLow = atoi(_root["server"]["zones"]["ports"].get("low", "7000").asString().c_str());
ZonePortHigh = atoi(_root["server"]["zones"]["ports"].get("high", "7999").asString().c_str());
SpellsFile = _root["server"]["files"].get("spells", "spells_us.txt").asString();
OpCodesFile = _root["server"]["files"].get("opcodes", "opcodes.conf").asString();
PluginPlFile = _root["server"]["files"].get("plugin.pl", "plugin.pl").asString();
/**
* Files
*/
SpellsFile = _root["server"]["files"].get("spells", "spells_us.txt").asString();
OpCodesFile = _root["server"]["files"].get("opcodes", "opcodes.conf").asString();
MailOpCodesFile = _root["server"]["files"].get("mail_opcodes", "mail_opcodes.conf").asString();
PluginPlFile = _root["server"]["files"].get("plugin.pl", "plugin.pl").asString();
MapDir = _root["server"]["directories"].get("maps", "Maps/").asString();
QuestDir = _root["server"]["directories"].get("quests", "quests/").asString();
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
/**
* Directories
*/
MapDir = _root["server"]["directories"].get("maps", "Maps/").asString();
QuestDir = _root["server"]["directories"].get("quests", "quests/").asString();
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
LuaModuleDir = _root["server"]["directories"].get("lua_modules", "lua_modules/").asString();
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
/**
* Logs
*/
LogPrefix = _root["server"]["launcher"].get("logprefix", "logs/zone-").asString();
LogSuffix = _root["server"]["launcher"].get("logsuffix", ".log").asString();
RestartWait = atoi(_root["server"]["launcher"]["timers"].get("restart", "10000").asString().c_str());
TerminateWait = atoi(_root["server"]["launcher"]["timers"].get("reterminate", "10000").asString().c_str());
InitialBootWait = atoi(_root["server"]["launcher"]["timers"].get("initial", "20000").asString().c_str());
/**
* Launcher
*/
RestartWait = atoi(_root["server"]["launcher"]["timers"].get("restart", "10000").asString().c_str());
TerminateWait = atoi(_root["server"]["launcher"]["timers"].get("reterminate", "10000").asString().c_str());
InitialBootWait = atoi(_root["server"]["launcher"]["timers"].get("initial", "20000").asString().c_str());
ZoneBootInterval = atoi(_root["server"]["launcher"]["timers"].get("interval", "2000").asString().c_str());
#ifdef WIN32
#ifdef _WIN32
ZoneExe = _root["server"]["launcher"].get("exe", "zone.exe").asString();
#else
ZoneExe = _root["server"]["launcher"].get("exe", "./zone").asString();
@@ -230,6 +260,9 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
if (var_name == "OpCodesFile") {
return (OpCodesFile);
}
if (var_name == "MailOpCodesFile") {
return (MailOpCodesFile);
}
if (var_name == "PluginPlFile") {
return (PluginPlFile);
}
@@ -312,6 +345,7 @@ void EQEmuConfig::Dump() const
std::cout << "QSDatabasePort = " << QSDatabasePort << std::endl;
std::cout << "SpellsFile = " << SpellsFile << std::endl;
std::cout << "OpCodesFile = " << OpCodesFile << std::endl;
std::cout << "MailOpcodesFile = " << MailOpCodesFile << std::endl;
std::cout << "PluginPlFile = " << PluginPlFile << std::endl;
std::cout << "MapDir = " << MapDir << std::endl;
std::cout << "QuestDir = " << QuestDir << std::endl;
@@ -322,6 +356,6 @@ void EQEmuConfig::Dump() const
std::cout << "LogDir = " << LogDir << std::endl;
std::cout << "ZonePortLow = " << ZonePortLow << std::endl;
std::cout << "ZonePortHigh = " << ZonePortHigh << std::endl;
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
std::cout << "DefaultStatus = " << (int) DefaultStatus << std::endl;
// std::cout << "DynamicCount = " << DynamicCount << std::endl;
}
+1
View File
@@ -84,6 +84,7 @@ class EQEmuConfig
// From <files/>
std::string SpellsFile;
std::string OpCodesFile;
std::string MailOpCodesFile;
std::string PluginPlFile;
// From <directories/>
+14 -19
View File
@@ -33,7 +33,7 @@
std::ofstream process_log;
#ifdef _WINDOWS
#ifdef _WIN32
#include <direct.h>
#include <conio.h>
#include <iostream>
@@ -81,20 +81,13 @@ namespace Console {
};
}
enum GameChatColor {
yellow = 15,
red = 13,
light_green = 14,
light_cyan = 258,
light_purple = 5
};
/**
* EQEmuLogSys Constructor
*/
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 &) {};
bool file_logs_enabled = false;
int log_platform = 0;
}
@@ -305,22 +298,22 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
switch (log_category) {
case Logs::Status:
case Logs::Normal:
return GameChatColor::yellow;
return Chat::Yellow;
case Logs::MySQLError:
case Logs::Error:
return GameChatColor::red;
return Chat::Red;
case Logs::MySQLQuery:
case Logs::Debug:
return GameChatColor::light_green;
return Chat::Lime;
case Logs::Quests:
return GameChatColor::light_cyan;
return Chat::Group;
case Logs::Commands:
case Logs::Mercenaries:
return GameChatColor::light_purple;
return Chat::Magenta;
case Logs::Crash:
return GameChatColor::red;
return Chat::Red;
default:
return GameChatColor::yellow;
return Chat::Yellow;
}
}
@@ -331,7 +324,7 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
*/
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
{
#ifdef _WINDOWS
#ifdef _WIN32
HANDLE console_handle;
console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_FONT_INFOEX info = { 0 };
@@ -346,6 +339,8 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category,
#else
std::cout << EQEmuLogSys::GetLinuxConsoleColorFromCategory(log_category) << message << LC_RESET << std::endl;
#endif
on_log_console_hook(debug_level, log_category, message);
}
/**
@@ -413,7 +408,7 @@ void EQEmuLogSys::SetCurrentTimeStamp(char *time_stamp)
*/
void EQEmuLogSys::MakeDirectory(const std::string &directory_name)
{
#ifdef _WINDOWS
#ifdef _WIN32
struct _stat st;
if (_stat(directory_name.c_str(), &st) == 0) // exists
return;
@@ -505,4 +500,4 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
std::ios_base::app | std::ios_base::out
);
}
}
}
+3 -1
View File
@@ -240,7 +240,8 @@ public:
*/
uint16 GetGMSayColorFromCategory(uint16 log_category);
void OnLogHookCallBackZone(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
void SetGMSayHandler(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
void SetConsoleHandler(std::function<void(uint16 debug_level, uint16 log_type, const std::string&)> f) { on_log_console_hook = f; }
private:
@@ -248,6 +249,7 @@ 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;
/**
* Formats log messages like '[Category] This is a log message'
+12 -12
View File
@@ -8,30 +8,30 @@ namespace EQ
class EventLoop
{
public:
static EventLoop &Get() {
static thread_local EventLoop inst;
return inst;
EventLoop() {
memset(&m_loop, 0, sizeof(uv_loop_t));
uv_loop_init(&m_loop);
}
~EventLoop() {
uv_loop_close(&m_loop);
}
EventLoop(const EventLoop&) = delete;
EventLoop& operator=(const EventLoop&) = delete;
static EventLoop &GetDefault() {
static thread_local EventLoop inst;
return inst;
}
void Process() {
uv_run(&m_loop, UV_RUN_NOWAIT);
}
uv_loop_t* Handle() { return &m_loop; }
private:
EventLoop() {
memset(&m_loop, 0, sizeof(uv_loop_t));
uv_loop_init(&m_loop);
}
EventLoop(const EventLoop&);
EventLoop& operator=(const EventLoop&);
private:
uv_loop_t m_loop;
};
}
+22 -17
View File
@@ -24,8 +24,12 @@ namespace EQ {
std::exception error;
};
Task(TaskFn fn) {
m_fn = fn;
Task(EventLoop &loop, TaskFn fn) : _loop(loop) {
_fn = fn;
}
Task(TaskFn fn) : _loop(EventLoop::GetDefault()) {
_fn = fn;
}
~Task() {
@@ -33,34 +37,34 @@ namespace EQ {
}
Task& Then(ResolveFn fn) {
m_then = fn;
_then = fn;
return *this;
}
Task& Catch(RejectFn fn) {
m_catch = fn;
_catch = fn;
return *this;
}
Task& Finally(FinallyFn fn) {
m_finally = fn;
_fin = fn;
return *this;
}
void Run() {
uv_work_t *m_work = new uv_work_t;
memset(m_work, 0, sizeof(uv_work_t));
uv_work_t *work = new uv_work_t;
memset(work, 0, sizeof(uv_work_t));
TaskBaton *baton = new TaskBaton();
baton->fn = m_fn;
baton->on_then = m_then;
baton->on_catch = m_catch;
baton->on_finally = m_finally;
baton->fn = _fn;
baton->on_then = _then;
baton->on_catch = _catch;
baton->on_finally = _fin;
baton->has_result = false;
baton->has_error = false;
m_work->data = baton;
work->data = baton;
uv_queue_work(EventLoop::Get().Handle(), m_work, [](uv_work_t* req) {
uv_queue_work(_loop.Handle(), work, [](uv_work_t* req) {
TaskBaton *baton = (TaskBaton*)req->data;
baton->fn([baton](const EQEmu::Any& result) {
@@ -92,9 +96,10 @@ namespace EQ {
}
private:
TaskFn m_fn;
ResolveFn m_then;
RejectFn m_catch;
FinallyFn m_finally;
TaskFn _fn;
ResolveFn _then;
RejectFn _catch;
FinallyFn _fin;
EventLoop &_loop;
};
}
+34 -20
View File
@@ -6,16 +6,29 @@ namespace EQ {
class Timer
{
public:
Timer(std::function<void(Timer *)> cb)
Timer(EventLoop &loop, std::function<void(Timer *)> cb) : _loop(loop)
{
m_timer = nullptr;
m_cb = cb;
_timer = nullptr;
_cb = cb;
}
Timer(uint64_t duration_ms, bool repeats, std::function<void(Timer *)> cb)
Timer(EventLoop &loop, uint64_t duration_ms, bool repeats, std::function<void(Timer *)> cb) : _loop(loop)
{
m_timer = nullptr;
m_cb = cb;
_timer = nullptr;
_cb = cb;
Start(duration_ms, repeats);
}
Timer(std::function<void(Timer *)> cb) : _loop(EventLoop::GetDefault())
{
_timer = nullptr;
_cb = cb;
}
Timer(uint64_t duration_ms, bool repeats, std::function<void(Timer *)> cb) : _loop(EventLoop::GetDefault())
{
_timer = nullptr;
_cb = cb;
Start(duration_ms, repeats);
}
@@ -25,21 +38,21 @@ namespace EQ {
}
void Start(uint64_t duration_ms, bool repeats) {
auto loop = EventLoop::Get().Handle();
if (!m_timer) {
m_timer = new uv_timer_t;
memset(m_timer, 0, sizeof(uv_timer_t));
uv_timer_init(loop, m_timer);
m_timer->data = this;
auto loop = EventLoop::GetDefault().Handle();
if (!_timer) {
_timer = new uv_timer_t;
memset(_timer, 0, sizeof(uv_timer_t));
uv_timer_init(loop, _timer);
_timer->data = this;
if (repeats) {
uv_timer_start(m_timer, [](uv_timer_t *handle) {
uv_timer_start(_timer, [](uv_timer_t *handle) {
Timer *t = (Timer*)handle->data;
t->Execute();
}, duration_ms, duration_ms);
}
else {
uv_timer_start(m_timer, [](uv_timer_t *handle) {
uv_timer_start(_timer, [](uv_timer_t *handle) {
Timer *t = (Timer*)handle->data;
t->Stop();
t->Execute();
@@ -49,19 +62,20 @@ namespace EQ {
}
void Stop() {
if (m_timer) {
uv_close((uv_handle_t*)m_timer, [](uv_handle_t* handle) {
if (_timer) {
uv_close((uv_handle_t*)_timer, [](uv_handle_t* handle) {
delete handle;
});
m_timer = nullptr;
_timer = nullptr;
}
}
private:
void Execute() {
m_cb(this);
_cb(this);
}
uv_timer_t *m_timer;
std::function<void(Timer*)> m_cb;
EventLoop &_loop;
uv_timer_t *_timer;
std::function<void(Timer*)> _cb;
};
}
+10 -12
View File
@@ -18,6 +18,7 @@
#include "faction.h"
#include "races.h"
#include "rulesys.h"
const char *FactionValueToString(FACTION_VALUE fv)
{
@@ -59,34 +60,31 @@ FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value)
if (fm) {
character_value += fm->base + fm->class_mod + fm->race_mod + fm->deity_mod;
}
if (character_value >= 1100) {
if (character_value >= RuleI(Faction, AllyFactionMinimum)) {
return FACTION_ALLY;
}
if (character_value >= 750 && character_value <= 1099) {
if (character_value >= RuleI(Faction, WarmlyFactionMinimum)) {
return FACTION_WARMLY;
}
if (character_value >= 500 && character_value <= 749) {
if (character_value >= RuleI(Faction, KindlyFactionMinimum)) {
return FACTION_KINDLY;
}
if (character_value >= 100 && character_value <= 499) {
if (character_value >= RuleI(Faction, AmiablyFactionMinimum)) {
return FACTION_AMIABLE;
}
if (character_value >= 0 && character_value <= 99) {
if (character_value >= RuleI(Faction, IndifferentlyFactionMinimum)) {
return FACTION_INDIFFERENT;
}
if (character_value >= -100 && character_value <= -1) {
if (character_value >= RuleI(Faction, ApprehensivelyFactionMinimum)) {
return FACTION_APPREHENSIVE;
}
if (character_value >= -500 && character_value <= -101) {
if (character_value >= RuleI(Faction, DubiouslyFactionMinimum)) {
return FACTION_DUBIOUS;
}
if (character_value >= -750 && character_value <= -501) {
if (character_value >= RuleI(Faction, ThreateninglyFactionMinimum)) {
return FACTION_THREATENLY;
}
if (character_value <= -751) {
return FACTION_SCOWLS;
}
return FACTION_INDIFFERENT;
return FACTION_SCOWLS;
}
// this function should check if some races have more than one race define
+2 -2
View File
@@ -17,7 +17,7 @@
*/
// WHY IS THIS UP HERE
#if defined(_DEBUG) && defined(WIN32)
#if defined(_DEBUG) && defined(_WIN32)
#ifndef _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
@@ -27,7 +27,7 @@
#ifndef EQDEBUG_H
#define EQDEBUG_H
#ifdef _WINDOWS
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
+2 -2
View File
@@ -23,6 +23,6 @@
#include "eq_packet_structs.h"
#ifndef WIN32
#ifndef _WIN32
#include <netinet/in.h> //for htonl
#endif
#endif
+6 -6
View File
@@ -17,7 +17,7 @@
*/
#include "ipc_mutex.h"
#ifdef _WINDOWS
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#undef WIN32_LEAN_AND_MEAN
@@ -33,7 +33,7 @@
namespace EQEmu {
struct IPCMutex::Implementation {
#ifdef _WINDOWS
#ifdef _WIN32
HANDLE mut_;
#else
int fd_;
@@ -42,7 +42,7 @@ namespace EQEmu {
IPCMutex::IPCMutex(std::string name) : locked_(false) {
imp_ = new Implementation;
#ifdef _WINDOWS
#ifdef _WIN32
auto Config = EQEmuConfig::get();
std::string final_name = Config->SharedMemDir + "EQEmuMutex_";
final_name += name;
@@ -82,7 +82,7 @@ namespace EQEmu {
}
IPCMutex::~IPCMutex() {
#ifdef _WINDOWS
#ifdef _WIN32
if(locked_) {
ReleaseMutex(imp_->mut_);
}
@@ -103,7 +103,7 @@ namespace EQEmu {
return false;
}
#ifdef _WINDOWS
#ifdef _WIN32
DWORD wait_result = WaitForSingleObject(imp_->mut_, INFINITE);
if(wait_result != WAIT_OBJECT_0) {
return false;
@@ -121,7 +121,7 @@ namespace EQEmu {
if(!locked_) {
return false;
}
#ifdef _WINDOWS
#ifdef _WIN32
if(!ReleaseMutex(imp_->mut_)) {
return false;
}
+5 -5
View File
@@ -17,7 +17,7 @@
*/
#include "memory_mapped_file.h"
#ifdef _WINDOWS
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/types.h>
@@ -36,7 +36,7 @@
namespace EQEmu {
struct MemoryMappedFile::Implementation {
#ifdef _WINDOWS
#ifdef _WIN32
HANDLE mapped_object_;
#else
int fd_;
@@ -47,7 +47,7 @@ namespace EQEmu {
: filename_(filename), size_(size) {
imp_ = new Implementation;
#ifdef _WINDOWS
#ifdef _WIN32
DWORD total_size = size + sizeof(shared_memory_struct);
HANDLE file = CreateFile(filename.c_str(),
GENERIC_READ | GENERIC_WRITE,
@@ -116,7 +116,7 @@ namespace EQEmu {
size_ = size;
fclose(f);
#ifdef _WINDOWS
#ifdef _WIN32
DWORD total_size = size + sizeof(shared_memory_struct);
HANDLE file = CreateFile(filename.c_str(),
GENERIC_READ | GENERIC_WRITE,
@@ -172,7 +172,7 @@ namespace EQEmu {
}
MemoryMappedFile::~MemoryMappedFile() {
#ifdef _WINDOWS
#ifdef _WIN32
if(imp_->mapped_object_) {
CloseHandle(imp_->mapped_object_);
}
+4 -4
View File
@@ -1,4 +1,4 @@
#ifdef _WINDOWS
#ifdef _WIN32
// VS6 doesn't like the length of STL generated names: disabling
#pragma warning(disable:4786)
#endif
@@ -10,7 +10,7 @@
#include <iostream>
#include <zlib.h>
#ifndef WIN32
#ifndef _WIN32
#include <sys/time.h>
#endif
@@ -24,7 +24,7 @@
std::map<int,std::string> DBFieldNames;
#ifndef WIN32
#ifndef _WIN32
#if defined(FREEBSD) || defined(__CYGWIN__)
int print_stacktrace()
{
@@ -526,7 +526,7 @@ std::string generate_key(int length)
{
std::string key;
//TODO: write this for win32...
#ifndef WIN32
#ifndef _WIN32
int i;
timeval now;
static const char *chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+1 -1
View File
@@ -24,7 +24,7 @@ void decode(char *in, char *out);
void encode_chunk(char *in, int len, char *out);
void decode_chunk(char *in, char *out);
#ifndef WIN32
#ifndef _WIN32
int print_stacktrace();
#endif
+10 -10
View File
@@ -22,19 +22,19 @@
#include <string.h>
#include <time.h>
#ifndef WIN32
#ifndef _WIN32
#include <netinet/in.h>
#include <sys/socket.h>
#endif
#include <iostream>
#include <iomanip>
#ifdef _WINDOWS
#ifdef _WIN32
#include <io.h>
#endif
#include "../common/timer.h"
#include "../common/seperator.h"
#ifdef _WINDOWS
#ifdef _WIN32
#include <windows.h>
#define snprintf _snprintf
@@ -73,7 +73,7 @@ void CoutTimestamp(bool ms) {
int32 filesize(FILE* fp) {
#ifdef _WINDOWS
#ifdef _WIN32
return _filelength(_fileno(fp));
#else
struct stat file_stat;
@@ -88,7 +88,7 @@ int32 filesize(FILE* fp) {
}
uint32 ResolveIP(const char* hostname, char* errbuf) {
#ifdef _WINDOWS
#ifdef _WIN32
static InitWinsock ws;
#endif
if (errbuf)
@@ -99,14 +99,14 @@ uint32 ResolveIP(const char* hostname, char* errbuf) {
return 0;
}
struct sockaddr_in server_sin;
#ifdef _WINDOWS
#ifdef _WIN32
PHOSTENT phostent = nullptr;
#else
struct hostent *phostent = nullptr;
#endif
server_sin.sin_family = AF_INET;
if ((phostent = gethostbyname(hostname)) == nullptr) {
#ifdef _WINDOWS
#ifdef _WIN32
if (errbuf)
snprintf(errbuf, ERRBUF_SIZE, "Unable to get the host name. Error: %i", WSAGetLastError());
#else
@@ -115,7 +115,7 @@ uint32 ResolveIP(const char* hostname, char* errbuf) {
#endif
return 0;
}
#ifdef _WINDOWS
#ifdef _WIN32
memcpy ((char FAR *)&(server_sin.sin_addr), phostent->h_addr, phostent->h_length);
#else
memcpy ((char*)&(server_sin.sin_addr), phostent->h_addr, phostent->h_length);
@@ -136,7 +136,7 @@ bool ParseAddress(const char* iAddress, uint32* oIP, uint16* oPort, char* errbuf
return false;
}
#ifdef _WINDOWS
#ifdef _WIN32
InitWinsock::InitWinsock() {
WORD version = MAKEWORD (1,1);
WSADATA wsadata;
@@ -157,7 +157,7 @@ const char * itoa(int num) {
return temp;
}
#ifndef WIN32
#ifndef _WIN32
const char * itoa(int num, char* a,int b) {
static char temp[_ITOA_BUFLEN];
memset(temp,0,_ITOA_BUFLEN);
+3 -3
View File
@@ -32,8 +32,8 @@
//
#define VARSTRUCT_DECODE_TYPE(Type, Buffer) *(Type *)Buffer; Buffer += sizeof(Type);
#define VARSTRUCT_DECODE_STRING(String, Buffer) strcpy(String, Buffer); Buffer += strlen(String)+1;
#define VARSTRUCT_ENCODE_STRING(Buffer, String) { sprintf(Buffer, "%s", String); Buffer += strlen(String) + 1; }
#define VARSTRUCT_ENCODE_INTSTRING(Buffer, Number) { sprintf(Buffer, "%i", Number); Buffer += strlen(Buffer) + 1; }
#define VARSTRUCT_ENCODE_STRING(Buffer, String) { int length = sprintf(Buffer, "%s", String); Buffer += length + 1; }
#define VARSTRUCT_ENCODE_INTSTRING(Buffer, Number) { int length = sprintf(Buffer, "%i", Number); Buffer += length + 1; }
#define VARSTRUCT_ENCODE_TYPE(Type, Buffer, Value) { *(Type *)Buffer = Value; Buffer += sizeof(Type); }
#define VARSTRUCT_SKIP_TYPE(Type, Buffer) Buffer += sizeof(Type);
@@ -77,7 +77,7 @@ uint32 Catch22(uint32 mask);
#define _ITOA_BUFLEN 25
const char *itoa(int num); //not thread safe
#ifndef _WINDOWS
#ifndef _WIN32
const char *itoa(int num, char* a,int b);
#endif
+7 -7
View File
@@ -25,7 +25,7 @@
#endif
#ifdef _WINDOWS
#ifdef _WIN32
bool IsTryLockSupported();
bool TrylockSupported = IsTryLockSupported();
@@ -69,7 +69,7 @@ Mutex::Mutex() {
#if DEBUG_MUTEX_CLASS >= 7
std::cout << "Constructing Mutex" << std::endl;
#endif
#ifdef _WINDOWS
#ifdef _WIN32
InitializeCriticalSection(&CSMutex);
#else
pthread_mutexattr_t attr;
@@ -85,7 +85,7 @@ Mutex::Mutex() {
}
Mutex::~Mutex() {
#ifdef _WINDOWS
#ifdef _WIN32
DeleteCriticalSection(&CSMutex);
#else
#endif
@@ -95,14 +95,14 @@ void Mutex::lock() {
#if DEBUG_MUTEX_CLASS >= 5
if (!trylock()) {
std::cout << "Locking Mutex: Having to wait" << std::endl;
#ifdef _WINDOWS
#ifdef _WIN32
EnterCriticalSection(&CSMutex);
#else
pthread_mutex_lock(&CSMutex);
#endif
}
#else
#ifdef _WINDOWS
#ifdef _WIN32
EnterCriticalSection(&CSMutex);
#else
pthread_mutex_lock(&CSMutex);
@@ -111,7 +111,7 @@ void Mutex::lock() {
}
bool Mutex::trylock() {
#ifdef _WINDOWS
#ifdef _WIN32
#if(_WIN32_WINNT >= 0x0400)
if (TrylockSupported)
return TryEnterCriticalSection(&CSMutex);
@@ -129,7 +129,7 @@ bool Mutex::trylock() {
}
void Mutex::unlock() {
#ifdef _WINDOWS
#ifdef _WIN32
LeaveCriticalSection(&CSMutex);
#else
pthread_mutex_unlock(&CSMutex);
+2 -2
View File
@@ -17,7 +17,7 @@
*/
#ifndef MYMUTEX_H
#define MYMUTEX_H
#ifdef _WINDOWS
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#else
@@ -36,7 +36,7 @@ public:
bool trylock();
protected:
private:
#if defined WIN32 || defined WIN64
#if defined _WIN32
CRITICAL_SECTION CSMutex;
#else
pthread_mutex_t CSMutex;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef MYSQL_REQUEST_RESULT_H
#define MYSQL_REQUEST_RESULT_H
#ifdef _WINDOWS
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef MYSQL_REQUEST_ROW_H
#define MYSQL_REQUEST_ROW_H
#ifdef _WINDOWS
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
+16 -4
View File
@@ -13,7 +13,7 @@ EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager()
memset(&m_timer, 0, sizeof(uv_timer_t));
memset(&m_socket, 0, sizeof(uv_udp_t));
Attach(EQ::EventLoop::Get().Handle());
Attach(EQ::EventLoop::GetDefault().Handle());
}
EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager(const DaybreakConnectionManagerOptions &opts)
@@ -23,7 +23,7 @@ EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager(const DaybreakConn
memset(&m_timer, 0, sizeof(uv_timer_t));
memset(&m_socket, 0, sizeof(uv_udp_t));
Attach(EQ::EventLoop::Get().Handle());
Attach(EQ::EventLoop::GetDefault().Handle());
}
EQ::Net::DaybreakConnectionManager::~DaybreakConnectionManager()
@@ -368,6 +368,7 @@ void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream, bool reliab
packet.PutUInt8(0, 0);
packet.PutPacket(1, p);
InternalQueuePacket(packet, stream, reliable);
return;
}
InternalQueuePacket(p, stream, reliable);
@@ -384,7 +385,7 @@ EQ::Net::DaybreakConnectionStats EQ::Net::DaybreakConnection::GetStats()
void EQ::Net::DaybreakConnection::ResetStats()
{
m_stats = DaybreakConnectionStats();
m_stats.Reset();
}
void EQ::Net::DaybreakConnection::Process()
@@ -417,6 +418,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
auto opcode = p.GetInt8(1);
if (p.GetInt8(0) == 0 && (opcode == OP_KeepAlive || opcode == OP_OutboundPing)) {
m_stats.bytes_after_decode += p.Length();
return;
}
@@ -425,6 +427,8 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
if (m_owner->m_on_error_message) {
m_owner->m_on_error_message(fmt::format("Tossed packet that failed CRC of type {0:#x}", p.Length() >= 2 ? p.GetInt8(1) : 0));
}
m_stats.bytes_after_decode += p.Length();
return;
}
@@ -453,6 +457,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
}
}
m_stats.bytes_after_decode += temp.Length();
ProcessDecodedPacket(StaticPacket(temp.Data(), temp.Length()));
}
else {
@@ -471,10 +476,12 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
}
}
m_stats.bytes_after_decode += temp.Length();
ProcessDecodedPacket(StaticPacket(temp.Data(), temp.Length()));
}
}
else {
m_stats.bytes_after_decode += p.Length();
ProcessDecodedPacket(p);
}
}
@@ -993,7 +1000,7 @@ uint32_t Deflate(const uint8_t* in, uint32_t in_len, uint8_t* out, uint32_t out_
zstream.avail_in = in_len;
zstream.opaque = Z_NULL;
deflateInit(&zstream, Z_FINISH);
deflateInit(&zstream, Z_BEST_SPEED);
zstream.next_out = out;
zstream.avail_out = out_len;
@@ -1285,6 +1292,9 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p)
};
if (PacketCanBeEncoded(p)) {
m_stats.bytes_before_encode += p.Length();
DynamicPacket out;
out.PutPacket(0, p);
@@ -1332,6 +1342,8 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p)
return;
}
m_stats.bytes_before_encode += p.Length();
uv_udp_send_t *send_req = new uv_udp_send_t;
sockaddr_in send_addr;
uv_ip4_addr(m_endpoint.c_str(), m_port, &send_addr);
+22 -2
View File
@@ -91,6 +91,24 @@ namespace EQ
resent_fragments = 0;
resent_full = 0;
datarate_remaining = 0.0;
bytes_after_decode = 0;
bytes_before_encode = 0;
}
void Reset() {
recv_bytes = 0;
sent_bytes = 0;
min_ping = 0xFFFFFFFFFFFFFFFFUL;
max_ping = 0;
avg_ping = 0;
created = Clock::now();
dropped_datarate_packets = 0;
resent_packets = 0;
resent_fragments = 0;
resent_full = 0;
datarate_remaining = 0.0;
bytes_after_decode = 0;
bytes_before_encode = 0;
}
uint64_t recv_bytes;
@@ -111,6 +129,8 @@ namespace EQ
uint64_t resent_fragments;
uint64_t resent_full;
double datarate_remaining;
uint64_t bytes_after_decode;
uint64_t bytes_before_encode;
};
class DaybreakConnectionManager;
@@ -237,7 +257,7 @@ namespace EQ
resend_delay_min = 150;
resend_delay_max = 5000;
connect_delay_ms = 500;
stale_connection_ms = 90000;
stale_connection_ms = 60000;
connect_stale_ms = 5000;
crc_length = 2;
max_packet_size = 512;
@@ -249,7 +269,7 @@ namespace EQ
simulated_in_packet_loss = 0;
simulated_out_packet_loss = 0;
tic_rate_hertz = 60.0;
resend_timeout = 90000;
resend_timeout = 30000;
connection_close_time = 2000;
outgoing_data_rate = 0.0;
}
+1 -1
View File
@@ -21,7 +21,7 @@ namespace EQ
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
auto loop = EQ::EventLoop::Get().Handle();
auto loop = EQ::EventLoop::GetDefault().Handle();
uv_getaddrinfo_t *resolver = new uv_getaddrinfo_t();
memset(resolver, 0, sizeof(uv_getaddrinfo_t));
auto port_str = std::to_string(port);
+9 -6
View File
@@ -13,6 +13,13 @@ EQ::Net::EQStreamManager::~EQStreamManager()
{
}
void EQ::Net::EQStreamManager::SetOptions(const EQStreamManagerInterfaceOptions &options)
{
m_options = options;
auto &opts = m_daybreak.GetOptions();
opts = options.daybreak_options;
}
void EQ::Net::EQStreamManager::DaybreakNewConnection(std::shared_ptr<DaybreakConnection> connection)
{
std::shared_ptr<EQStream> stream(new EQStream(this, connection));
@@ -65,9 +72,7 @@ void EQ::Net::EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req)
opcode = p->GetOpcodeBypass();
}
else {
if (m_owner->GetOptions().track_opcode_stats) {
m_packet_sent_count[p->GetOpcode()]++; //Wont bother with bypass tracking of these since those are rare for testing anyway
}
m_packet_sent_count[static_cast<int>(p->GetOpcode())]++; //Wont bother with bypass tracking of these since those are rare for testing anyway
opcode = (*m_opcode_manager)->EmuToEQ(p->GetOpcode());
}
@@ -117,9 +122,7 @@ EQApplicationPacket *EQ::Net::EQStream::PopPacket() {
}
EmuOpcode emu_op = (*m_opcode_manager)->EQToEmu(opcode);
if (m_owner->GetOptions().track_opcode_stats) {
m_packet_recv_count[emu_op]++;
}
m_packet_recv_count[static_cast<int>(emu_op)]++;
EQApplicationPacket *ret = new EQApplicationPacket(emu_op, (unsigned char*)p->Data() + m_owner->GetOptions().opcode_size, p->Length() - m_owner->GetOptions().opcode_size);
ret->SetProtocolOpcode(opcode);
+3 -2
View File
@@ -19,6 +19,7 @@ namespace EQ
EQStreamManager(const EQStreamManagerInterfaceOptions &options);
~EQStreamManager();
virtual void SetOptions(const EQStreamManagerInterfaceOptions& options);
void OnNewConnection(std::function<void(std::shared_ptr<EQStream>)> func) { m_on_new_connection = func; }
void OnConnectionStateChange(std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
private:
@@ -65,8 +66,8 @@ namespace EQ
std::shared_ptr<DaybreakConnection> m_connection;
OpcodeManager **m_opcode_manager;
std::deque<std::unique_ptr<EQ::Net::Packet>> m_packet_queue;
std::unordered_map<EmuOpcode, int> m_packet_recv_count;
std::unordered_map<EmuOpcode, int> m_packet_sent_count;
std::unordered_map<int, int> m_packet_recv_count;
std::unordered_map<int, int> m_packet_sent_count;
friend class EQStreamManager;
};
}
+6 -279
View File
@@ -1,279 +1,16 @@
#include "packet.h"
#include "endian.h"
#include <fmt/format.h>
#include <cctype>
#include <fmt/format.h>
void EQ::Net::Packet::PutInt8(size_t offset, int8_t value)
bool EQ::Net::StaticPacket::Resize(size_t new_size)
{
if (Length() < offset + 1) {
if (!Resize(offset + 1)) {
throw std::out_of_range("Packet::PutInt8(), could not resize packet and would of written past the end.");
}
if (new_size > _max_len) {
return false;
}
*(int8_t*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutInt16(size_t offset, int16_t value)
{
if (Length() < offset + 2) {
if (!Resize(offset + 2)) {
throw std::out_of_range("Packet::PutInt16(), could not resize packet and would of written past the end.");
}
}
*(int16_t*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutInt32(size_t offset, int32_t value)
{
if (Length() < offset + 4) {
if (!Resize(offset + 4)) {
throw std::out_of_range("Packet::PutInt32(), could not resize packet and would of written past the end.");
}
}
*(int32_t*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutInt64(size_t offset, int64_t value)
{
if (Length() < offset + 8) {
if (!Resize(offset + 8)) {
throw std::out_of_range("Packet::PutInt64(), could not resize packet and would of written past the end.");
}
}
*(int64_t*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutUInt8(size_t offset, uint8_t value)
{
if (Length() < offset + 1) {
if (!Resize(offset + 1)) {
throw std::out_of_range("Packet::PutUInt8(), could not resize packet and would of written past the end.");
}
}
*(uint8_t*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutUInt16(size_t offset, uint16_t value)
{
if (Length() < offset + 2) {
if (!Resize(offset + 2)) {
throw std::out_of_range("Packet::PutUInt16(), could not resize packet and would of written past the end.");
}
}
*(uint16_t*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutUInt32(size_t offset, uint32_t value)
{
if (Length() < offset + 4) {
if (!Resize(offset + 4)) {
throw std::out_of_range("Packet::PutUInt32(), could not resize packet and would of written past the end.");
}
}
*(uint32_t*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutUInt64(size_t offset, uint64_t value)
{
if (Length() < offset + 8) {
if (!Resize(offset + 8)) {
throw std::out_of_range("Packet::PutUInt64(), could not resize packet and would of written past the end.");
}
}
*(uint64_t*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutFloat(size_t offset, float value)
{
if (Length() < offset + 4) {
if (!Resize(offset + 4)) {
throw std::out_of_range("Packet::PutFloat(), could not resize packet and would of written past the end.");
}
}
*(float*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutDouble(size_t offset, double value)
{
if (Length() < offset + 8) {
if (!Resize(offset + 8)) {
throw std::out_of_range("Packet::PutDouble(), could not resize packet and would of written past the end.");
}
}
*(double*)((char*)Data() + offset) = value;
}
void EQ::Net::Packet::PutString(size_t offset, const std::string &str)
{
if (Length() < offset + str.length()) {
if (!Resize(offset + str.length())) {
throw std::out_of_range("Packet::PutString(), could not resize packet and would of written past the end.");
}
}
memcpy(((char*)Data() + offset), str.c_str(), str.length());
}
void EQ::Net::Packet::PutCString(size_t offset, const char *str)
{
size_t sz = strlen(str);
if (Length() < offset + sz + 1) {
if (!Resize(offset + sz + 1)) {
throw std::out_of_range("Packet::PutCString(), could not resize packet and would of written past the end.");
}
}
memcpy(((char*)Data() + offset), str, sz);
*((char*)Data() + offset + sz) = 0;
}
void EQ::Net::Packet::PutPacket(size_t offset, const Packet &p)
{
if (p.Length() == 0) {
return;
}
if (Length() < offset + p.Length()) {
if (!Resize(offset + p.Length())) {
throw std::out_of_range("Packet::PutPacket(), could not resize packet and would of written past the end.");
}
}
memcpy(((char*)Data() + offset), p.Data(), p.Length());
}
void EQ::Net::Packet::PutData(size_t offset, void *data, size_t length)
{
if (length == 0) {
return;
}
if (Length() < offset + length) {
if (!Resize(offset + length)) {
throw std::out_of_range("Packet::PutData(), could not resize packet and would of written past the end.");
}
}
memcpy(((char*)Data() + offset), data, length);
}
int8_t EQ::Net::Packet::GetInt8(size_t offset) const
{
if (Length() < offset + 1) {
throw std::out_of_range("Packet read out of range.");
}
return *(int8_t*)((char*)Data() + offset);
}
int16_t EQ::Net::Packet::GetInt16(size_t offset) const
{
if (Length() < offset + 2) {
throw std::out_of_range("Packet read out of range.");
}
return *(int16_t*)((char*)Data() + offset);
}
int32_t EQ::Net::Packet::GetInt32(size_t offset) const
{
if (Length() < offset + 4) {
throw std::out_of_range("Packet read out of range.");
}
return *(int32_t*)((char*)Data() + offset);
}
int64_t EQ::Net::Packet::GetInt64(size_t offset) const
{
if (Length() < offset + 8) {
throw std::out_of_range("Packet read out of range.");
}
return *(int64_t*)((char*)Data() + offset);
}
uint8_t EQ::Net::Packet::GetUInt8(size_t offset) const
{
if (Length() < offset + 1) {
throw std::out_of_range("Packet read out of range.");
}
return *(uint8_t*)((char*)Data() + offset);
}
uint16_t EQ::Net::Packet::GetUInt16(size_t offset) const
{
if (Length() < offset + 2) {
throw std::out_of_range("Packet read out of range.");
}
return *(uint16_t*)((char*)Data() + offset);
}
uint32_t EQ::Net::Packet::GetUInt32(size_t offset) const
{
if (Length() < offset + 4) {
throw std::out_of_range("Packet read out of range.");
}
return *(uint32_t*)((char*)Data() + offset);
}
uint64_t EQ::Net::Packet::GetUInt64(size_t offset) const
{
if (Length() < offset + 8) {
throw std::out_of_range("Packet read out of range.");
}
return *(uint64_t*)((char*)Data() + offset);
}
float EQ::Net::Packet::GetFloat(size_t offset) const
{
if (Length() < offset + 4) {
throw std::out_of_range("Packet read out of range.");
}
return *(float*)((char*)Data() + offset);
}
double EQ::Net::Packet::GetDouble(size_t offset) const
{
if (Length() < offset + 8) {
throw std::out_of_range("Packet read out of range.");
}
return *(double*)((char*)Data() + offset);
}
std::string EQ::Net::Packet::GetString(size_t offset, size_t length) const
{
if (Length() < offset + length) {
throw std::out_of_range("Packet read out of range.");
}
return std::string((char*)Data() + offset, (char*)Data() + offset + length);
}
std::string EQ::Net::Packet::GetCString(size_t offset) const
{
if (Length() < offset + 1) {
throw std::out_of_range("Packet read out of range.");
}
char *str = ((char*)Data() + offset);
return std::string(str);
_len = new_size;
return true;
}
char ToSafePrint(unsigned char in) {
@@ -342,13 +79,3 @@ std::string EQ::Net::Packet::ToString(size_t line_length) const
return ret;
}
bool EQ::Net::StaticPacket::Resize(size_t new_size)
{
if (new_size > m_max_data_length) {
return false;
}
m_data_length = new_size;
return true;
}
+691 -67
View File
@@ -13,8 +13,7 @@ namespace EQ {
class Packet
{
public:
Packet() : m_stream(std::ios::out | std::ios::binary) { }
virtual ~Packet() { }
Packet() = default;
virtual const void *Data() const = 0;
virtual void *Data() = 0;
@@ -24,6 +23,617 @@ namespace EQ {
virtual bool Resize(size_t new_size) = 0;
virtual void Reserve(size_t new_size) = 0;
std::string ToString() const;
std::string ToString(size_t line_length) const;
void SetWritePos(size_t offset) { _wpos = offset; }
void SetReadPos(size_t offset) { _rpos = offset; }
//Position Independent Output Interface
void PutInt8(size_t offset, int8_t value) {
if (Length() < offset + sizeof(int8_t)) {
if (!Resize(offset + sizeof(int8_t))) {
throw std::out_of_range("Packet::PutInt8(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<int8_t*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(int8_t);
}
void PutInt16(size_t offset, int16_t value) {
if (Length() < offset + sizeof(int16_t)) {
if (!Resize(offset + sizeof(int16_t))) {
throw std::out_of_range("Packet::PutInt16(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<int16_t*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(int16_t);
}
void PutInt32(size_t offset, int32_t value) {
if (Length() < offset + sizeof(int32_t)) {
if (!Resize(offset + sizeof(int32_t))) {
throw std::out_of_range("Packet::PutInt32(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<int32_t*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(int32_t);
}
void PutInt64(size_t offset, int64_t value) {
if (Length() < offset + sizeof(int64_t)) {
if (!Resize(offset + sizeof(int64_t))) {
throw std::out_of_range("Packet::PutInt64(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<int64_t*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(int64_t);
}
void PutUInt8(size_t offset, uint8_t value) {
if (Length() < offset + sizeof(uint8_t)) {
if (!Resize(offset + sizeof(uint8_t))) {
throw std::out_of_range("Packet::PutUInt8(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<uint8_t*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(uint8_t);
}
void PutUInt16(size_t offset, uint16_t value) {
if (Length() < offset + sizeof(uint16_t)) {
if (!Resize(offset + sizeof(uint16_t))) {
throw std::out_of_range("Packet::PutUInt16(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<uint16_t*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(uint16_t);
}
void PutUInt32(size_t offset, uint32_t value) {
if (Length() < offset + sizeof(uint32_t)) {
if (!Resize(offset + sizeof(uint32_t))) {
throw std::out_of_range("Packet::PutUInt32(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<uint32_t*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(uint32_t);
}
void PutUInt64(size_t offset, uint64_t value) {
if (Length() < offset + sizeof(uint64_t)) {
if (!Resize(offset + sizeof(uint64_t))) {
throw std::out_of_range("Packet::PutUInt64(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<uint64_t*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(uint64_t);
}
void PutFloat(size_t offset, float value) {
if (Length() < offset + sizeof(float)) {
if (!Resize(offset + sizeof(float))) {
throw std::out_of_range("Packet::PutFloat(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<float*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(float);
}
void PutDouble(size_t offset, double value) {
if (Length() < offset + sizeof(double)) {
if (!Resize(offset + sizeof(double))) {
throw std::out_of_range("Packet::PutDouble(), could not resize packet and would of written past the end.");
}
}
*reinterpret_cast<double*>(static_cast<char*>(Data()) + offset) = value;
_wpos = offset + sizeof(double);
}
void PutString(size_t offset, const std::string &str) {
if (Length() < offset + str.length()) {
if (!Resize(offset + str.length())) {
throw std::out_of_range("Packet::PutString(), could not resize packet and would of written past the end.");
}
}
std::memcpy((static_cast<char*>(Data()) + offset), str.c_str(), str.length());
_wpos = offset + str.length();
}
void PutCString(size_t offset, const char *str) {
size_t sz = strlen(str);
if (Length() < offset + sz + sizeof(int8_t)) {
if (!Resize(offset + sz + sizeof(int8_t))) {
throw std::out_of_range("Packet::PutCString(), could not resize packet and would of written past the end.");
}
}
std::memcpy((static_cast<char*>(Data()) + offset), str, sz);
*(static_cast<char*>(Data()) + offset + sz) = 0;
_wpos = offset + sz + sizeof(int8_t);
}
void PutPacket(size_t offset, const Packet &p) {
if (p.Length() == 0) {
return;
}
if (Length() < offset + p.Length()) {
if (!Resize(offset + p.Length())) {
throw std::out_of_range("Packet::PutPacket(), could not resize packet and would of written past the end.");
}
}
std::memcpy((static_cast<char*>(Data()) + offset), p.Data(), p.Length());
_wpos = offset + p.Length();
}
void PutData(size_t offset, void *data, size_t length) {
if (length == 0) {
return;
}
if (Length() < offset + length) {
if (!Resize(offset + length)) {
throw std::out_of_range("Packet::PutData(), could not resize packet and would of written past the end.");
}
}
std::memcpy((static_cast<char*>(Data()) + offset), data, length);
_wpos = offset + length;
}
//Position Dependent Output Interface
void PutInt8(int8_t value) {
PutInt8(_wpos, value);
}
void PutInt16(int16_t value) {
PutInt16(_wpos, value);
}
void PutInt32(int32_t value) {
PutInt32(_wpos, value);
}
void PutInt64(int64_t value) {
PutInt64(_wpos, value);
}
void PutUInt8(uint8_t value) {
PutUInt8(_wpos, value);
}
void PutUInt16(uint16_t value) {
PutUInt16(_wpos, value);
}
void PutUInt32(uint32_t value) {
PutUInt32(_wpos, value);
}
void PutUInt64(uint64_t value) {
PutUInt64(_wpos, value);
}
void PutFloat(float value) {
PutFloat(_wpos, value);
}
void PutDouble(double value) {
PutDouble(_wpos, value);
}
void PutString(const std::string &str) {
PutString(_wpos, str);
}
void PutCString(const char *str) {
PutCString(_wpos, str);
}
void PutPacket(const Packet &p) {
PutPacket(_wpos, p);
}
void PutData(void *data, size_t length) {
PutData(_wpos, data, length);
}
//Position Independent Input Interface
int8_t GetInt8(size_t offset) const {
if (Length() < offset + sizeof(int8_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const int8_t*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
int16_t GetInt16(size_t offset) const {
if (Length() < offset + sizeof(int16_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const int16_t*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
int32_t GetInt32(size_t offset) const {
if (Length() < offset + sizeof(int32_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const int32_t*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
int64_t GetInt64(size_t offset) const {
if (Length() < offset + sizeof(int64_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const int64_t*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
uint8_t GetUInt8(size_t offset) const {
if (Length() < offset + sizeof(uint8_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const uint8_t*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
uint16_t GetUInt16(size_t offset) const {
if (Length() < offset + sizeof(uint16_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const uint16_t*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
uint32_t GetUInt32(size_t offset) const {
if (Length() < offset + sizeof(uint32_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const uint32_t*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
uint64_t GetUInt64(size_t offset) const {
if (Length() < offset + sizeof(uint64_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const uint64_t*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
float GetFloat(size_t offset) const {
if (Length() < offset + sizeof(float)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const float*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
double GetDouble(size_t offset) const {
if (Length() < offset + sizeof(double)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const double*>(reinterpret_cast<const int8_t*>(Data()) + offset);
}
std::string GetString(size_t offset, size_t length) const {
if (Length() < offset + length) {
throw std::out_of_range("Packet read out of range.");
}
return std::string(reinterpret_cast<const int8_t*>(Data()) + offset, reinterpret_cast<const int8_t*>(Data()) + offset + length);
}
std::string GetCString(size_t offset) const {
if (Length() < offset) {
throw std::out_of_range("Packet read out of range.");
}
auto sz = strlen(static_cast<const char*>(Data()));
if (Length() < offset + sz + sizeof(int8_t)) {
throw std::out_of_range("Packet read out of range.");
}
const char *str = reinterpret_cast<const char*>(reinterpret_cast<const int8_t*>(Data()) + offset);
return std::string(str);
}
//Position Dependent Input Interface
int8_t GetInt8() {
auto offset = _rpos;
if (Length() < offset + sizeof(int8_t)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(int8_t);
return *reinterpret_cast<int8_t*>(static_cast<char*>(Data()) + offset);
}
int16_t GetInt16() {
auto offset = _rpos;
if (Length() < offset + sizeof(int16_t)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(int16_t);
return *reinterpret_cast<int16_t*>(static_cast<char*>(Data()) + offset);
}
int32_t GetInt32() {
auto offset = _rpos;
if (Length() < offset + sizeof(int32_t)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(int32_t);
return *reinterpret_cast<int32_t*>(static_cast<char*>(Data()) + offset);
}
int64_t GetInt64() {
auto offset = _rpos;
if (Length() < offset + sizeof(int64_t)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(int64_t);
return *reinterpret_cast<int64_t*>(static_cast<char*>(Data()) + offset);
}
uint8_t GetUInt8() {
auto offset = _rpos;
if (Length() < offset + sizeof(uint8_t)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(uint8_t);
return *reinterpret_cast<uint8_t*>(static_cast<char*>(Data()) + offset);
}
uint16_t GetUInt16() {
auto offset = _rpos;
if (Length() < offset + sizeof(uint16_t)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(uint16_t);
return *reinterpret_cast<uint16_t*>(static_cast<char*>(Data()) + offset);
}
uint32_t GetUInt32() {
auto offset = _rpos;
if (Length() < offset + sizeof(uint32_t)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(uint32_t);
return *reinterpret_cast<uint32_t*>(static_cast<char*>(Data()) + offset);
}
uint64_t GetUInt64() {
auto offset = _rpos;
if (Length() < offset + sizeof(uint64_t)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(uint64_t);
return *reinterpret_cast<uint64_t*>(static_cast<char*>(Data()) + offset);
}
float GetFloat() {
auto offset = _rpos;
if (Length() < offset + sizeof(float)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(float);
return *reinterpret_cast<float*>(static_cast<char*>(Data()) + offset);
}
double GetDouble() {
auto offset = _rpos;
if (Length() < offset + sizeof(double)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sizeof(double);
return *reinterpret_cast<double*>(static_cast<char*>(Data()) + offset);
}
std::string GetString(size_t length) {
auto offset = _rpos;
if (Length() < offset + length) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + length;
return std::string(static_cast<char*>(Data()) + offset, static_cast<char*>(Data()) + offset + length);
}
std::string GetCString() {
auto offset = _rpos;
if (Length() < offset + sizeof(int8_t)) {
throw std::out_of_range("Packet read out of range.");
}
auto sz = strlen(static_cast<const char*>(Data()));
if (Length() < offset + sz + sizeof(int8_t)) {
throw std::out_of_range("Packet read out of range.");
}
_rpos = offset + sz + sizeof(int8_t);
char *str = (static_cast<char*>(Data()) + offset);
return std::string(str);
}
int8_t& operator[](size_t offset) {
if (Length() < offset + sizeof(int8_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<int8_t*>(static_cast<char*>(Data()) + offset);
}
const int8_t& operator[](size_t offset) const {
if (Length() < offset + sizeof(int8_t)) {
throw std::out_of_range("Packet read out of range.");
}
return *reinterpret_cast<const int8_t*>(static_cast<const char*>(Data()) + offset);
}
//Stream Output Interface
Packet &operator<<(int8_t v) {
PutInt8(v);
return *this;
}
Packet &operator<<(int16_t v) {
PutInt16(v);
return *this;
}
Packet &operator<<(int32_t v) {
PutInt32(v);
return *this;
}
Packet &operator<<(int64_t v) {
PutInt64(v);
return *this;
}
Packet &operator<<(uint8_t v) {
PutUInt8(v);
return *this;
}
Packet &operator<<(uint16_t v) {
PutUInt16(v);
return *this;
}
Packet &operator<<(uint32_t v) {
PutUInt32(v);
return *this;
}
Packet &operator<<(uint64_t v) {
PutUInt64(v);
return *this;
}
Packet &operator<<(float v) {
PutFloat(v);
return *this;
}
Packet &operator<<(double v) {
PutDouble(v);
return *this;
}
Packet &operator<<(const std::string &v) {
PutString(v.data());
return *this;
}
Packet &operator<<(const char *v) {
PutCString(v);
return *this;
}
Packet &operator<<(const Packet &v) {
PutPacket(v);
return *this;
}
//Stream Input Interface
Packet &operator>>(int8_t &v) {
v = GetInt8();
return *this;
}
Packet &operator>>(int16_t &v) {
v = GetInt16();
return *this;
}
Packet &operator>>(int32_t &v) {
v = GetInt32();
return *this;
}
Packet &operator>>(int64_t &v) {
v = GetInt64();
return *this;
}
Packet &operator>>(uint8_t &v) {
v = GetUInt8();
return *this;
}
Packet &operator>>(uint16_t &v) {
v = GetUInt16();
return *this;
}
Packet &operator>>(uint32_t &v) {
v = GetUInt32();
return *this;
}
Packet &operator>>(uint64_t &v) {
v = GetUInt64();
return *this;
}
Packet &operator>>(float &v) {
v = GetFloat();
return *this;
}
Packet &operator>>(double &v) {
v = GetDouble();
return *this;
}
Packet &operator>>(std::string &v) {
v = GetCString();
return *this;
}
// Seriliazation
template<typename T>
T GetSerialize(size_t offset) const
{
@@ -36,11 +646,12 @@ namespace EQ {
template<typename T>
void PutSerialize(size_t offset, const T &value) {
m_stream.clear();
cereal::BinaryOutputArchive output(m_stream);
std::stringstream stream;
cereal::BinaryOutputArchive output(stream);
output(value);
auto str = m_stream.str();
auto str = stream.str();
if (Length() < offset + str.length()) {
if (!Resize(offset + str.length())) {
throw std::out_of_range("Packet::PutSerialize(), could not resize packet and would of written past the end.");
@@ -49,82 +660,95 @@ namespace EQ {
memcpy((char*)Data() + offset, &str[0], str.length());
}
void PutInt8(size_t offset, int8_t value);
void PutInt16(size_t offset, int16_t value);
void PutInt32(size_t offset, int32_t value);
void PutInt64(size_t offset, int64_t value);
void PutUInt8(size_t offset, uint8_t value);
void PutUInt16(size_t offset, uint16_t value);
void PutUInt32(size_t offset, uint32_t value);
void PutUInt64(size_t offset, uint64_t value);
void PutFloat(size_t offset, float value);
void PutDouble(size_t offset, double value);
void PutString(size_t offset, const std::string &str);
void PutCString(size_t offset, const char *str);
void PutPacket(size_t offset, const Packet &p);
void PutData(size_t offset, void *data, size_t length);
int8_t GetInt8(size_t offset) const;
int16_t GetInt16(size_t offset) const;
int32_t GetInt32(size_t offset) const;
int64_t GetInt64(size_t offset) const;
uint8_t GetUInt8(size_t offset) const;
uint16_t GetUInt16(size_t offset) const;
uint32_t GetUInt32(size_t offset) const;
uint64_t GetUInt64(size_t offset) const;
float GetFloat(size_t offset) const;
double GetDouble(size_t offset) const;
std::string GetString(size_t offset, size_t length) const;
std::string GetCString(size_t offset) const;
std::string ToString() const;
std::string ToString(size_t line_length) const;
protected:
std::stringstream m_stream;
size_t _rpos{ 0 };
size_t _wpos{ 0 };
};
class StaticPacket : public Packet
{
public:
StaticPacket(void *data, size_t size) { m_data = data; m_data_length = size; m_max_data_length = size; }
virtual ~StaticPacket() { }
StaticPacket(const StaticPacket &o) { m_data = o.m_data; m_data_length = o.m_data_length; }
StaticPacket& operator=(const StaticPacket &o) { m_data = o.m_data; m_data_length = o.m_data_length; return *this; }
StaticPacket(StaticPacket &&o) { m_data = o.m_data; m_data_length = o.m_data_length; }
StaticPacket(void *data, size_t len) : _data(data), _len(len), _max_len(len) {
}
virtual const void *Data() const { return m_data; }
virtual void *Data() { return m_data; }
virtual size_t Length() const { return m_data_length; }
virtual size_t Length() { return m_data_length; }
virtual bool Clear() { return false; }
virtual bool Resize(size_t new_size);
virtual void Reserve(size_t new_size) { }
StaticPacket(const StaticPacket &o) : _data(o._data), _len(o._len), _max_len(o._max_len) {
_rpos = o._rpos;
_wpos = o._wpos;
}
StaticPacket& operator=(const StaticPacket& o) {
_data = o._data;
_len = o._len;
_max_len = o._max_len;
_rpos = o._rpos;
_wpos = o._wpos;
return *this;
}
StaticPacket(StaticPacket &&o) noexcept : _data(o._data), _len(o._len), _max_len(o._max_len) {
_rpos = o._rpos;
_wpos = o._wpos;
}
const void *Data() const override { return _data; }
void *Data() override { return _data; }
size_t Length() const override { return _len; }
size_t Length() override { return _len; }
bool Clear() override { return false; }
bool Resize(size_t new_size) override;
void Reserve(size_t new_size) override { }
protected:
void *m_data;
size_t m_data_length;
size_t m_max_data_length;
void *_data;
size_t _len;
size_t _max_len;
};
class DynamicPacket : public Packet
{
public:
DynamicPacket() { }
virtual ~DynamicPacket() { }
DynamicPacket(DynamicPacket &&o) { m_data = std::move(o.m_data); }
DynamicPacket(const DynamicPacket &o) { m_data = o.m_data; }
DynamicPacket& operator=(const DynamicPacket &o) { m_data = o.m_data; return *this; }
const static size_t DefaultSize = 4096;
DynamicPacket() {
_data.reserve(DefaultSize);
}
DynamicPacket(size_t size) {
_data.reserve(size);
}
DynamicPacket(const DynamicPacket& o) : _data(o._data) {
_rpos = o._rpos;
_wpos = o._wpos;
}
DynamicPacket& operator=(const DynamicPacket& o) {
_data = o._data;
_rpos = o._rpos;
_wpos = o._wpos;
}
DynamicPacket(DynamicPacket &&o) noexcept : _data(o.MoveData()) {
_rpos = o._rpos;
_wpos = o._wpos;
}
std::vector<int8_t>&& MoveData() {
_rpos = 0;
_wpos = 0;
return std::move(_data);
}
const void *Data() const override { return _data.data(); }
void *Data() override { return _data.data(); }
size_t Length() const override { return _data.size(); }
size_t Length() override { return _data.size(); }
bool Clear() override { _data.clear(); return true; }
bool Resize(size_t new_size) override { _data.resize(new_size); return true; }
void Reserve(size_t new_size) override { _data.reserve(new_size); }
virtual const void *Data() const { return &m_data[0]; }
virtual void *Data() { return &m_data[0]; }
virtual size_t Length() const { return m_data.size(); }
virtual size_t Length() { return m_data.size(); }
virtual bool Clear() { m_data.clear(); return true; }
virtual bool Resize(size_t new_size) { m_data.resize(new_size, 0); return true; }
virtual void Reserve(size_t new_size) { m_data.reserve(new_size); }
protected:
std::vector<char> m_data;
std::vector<int8_t> _data;
};
}
}
} // namespace Net
} // namespace EQ
+2 -2
View File
@@ -23,7 +23,7 @@ void EQ::Net::TCPConnection::Connect(const std::string &addr, int port, bool ipv
std::function<void(std::shared_ptr<EQ::Net::TCPConnection>)> cb;
};
auto loop = EQ::EventLoop::Get().Handle();
auto loop = EQ::EventLoop::GetDefault().Handle();
uv_tcp_t *socket = new uv_tcp_t;
memset(socket, 0, sizeof(uv_tcp_t));
uv_tcp_init(loop, socket);
@@ -142,7 +142,7 @@ void EQ::Net::TCPConnection::Write(const char *data, size_t count)
WriteBaton *baton = new WriteBaton;
baton->connection = this;
baton->buffer = new char[count];;
baton->buffer = new char[count];
uv_write_t *write_req = new uv_write_t;
memset(write_req, 0, sizeof(uv_write_t));
+2 -2
View File
@@ -32,7 +32,7 @@ void EQ::Net::TCPServer::Listen(const std::string &addr, int port, bool ipv6, st
m_on_new_connection = cb;
auto loop = EQ::EventLoop::Get().Handle();
auto loop = EQ::EventLoop::GetDefault().Handle();
m_socket = new uv_tcp_t;
memset(m_socket, 0, sizeof(uv_tcp_t));
uv_tcp_init(loop, m_socket);
@@ -53,7 +53,7 @@ void EQ::Net::TCPServer::Listen(const std::string &addr, int port, bool ipv6, st
return;
}
auto loop = EQ::EventLoop::Get().Handle();
auto loop = EQ::EventLoop::GetDefault().Handle();
uv_tcp_t *client = new uv_tcp_t;
memset(client, 0, sizeof(uv_tcp_t));
uv_tcp_init(loop, client);
+265
View File
@@ -0,0 +1,265 @@
#include "websocket_server.h"
#include "../event/event_loop.h"
#include "../event/timer.h"
#include <fmt/format.h>
#include <map>
#include <unordered_set>
#include <array>
struct MethodHandlerEntry
{
MethodHandlerEntry() {
status = 0;
}
MethodHandlerEntry(EQ::Net::WebsocketServer::MethodHandler h, int s) {
handler = h;
status = s;
}
EQ::Net::WebsocketServer::MethodHandler handler;
int status;
};
struct EQ::Net::WebsocketServer::Impl
{
std::unique_ptr<TCPServer> server;
std::unique_ptr<EQ::Timer> ping_timer;
std::map<std::shared_ptr<websocket_connection>, std::unique_ptr<WebsocketServerConnection>> connections;
std::map<std::string, MethodHandlerEntry> methods;
websocket_server ws_server;
LoginHandler login_handler;
std::array<std::unordered_set<WebsocketServerConnection*>, SubscriptionEventMax> subscriptions;
};
EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
{
_impl.reset(new Impl());
_impl->server.reset(new EQ::Net::TCPServer());
_impl->server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
auto wsc = _impl->ws_server.get_connection();
WebsocketServerConnection *c = new WebsocketServerConnection(this, connection, wsc);
_impl->connections.insert(std::make_pair(wsc, std::unique_ptr<WebsocketServerConnection>(c)));
});
_impl->ws_server.set_write_handler(
[this](websocketpp::connection_hdl hdl, char const *data, size_t size) -> websocketpp::lib::error_code {
auto c = _impl->ws_server.get_con_from_hdl(hdl);
auto iter = _impl->connections.find(c);
if (iter != _impl->connections.end()) {
iter->second->GetTCPConnection()->Write(data, size);
}
return websocketpp::lib::error_code();
});
_impl->ping_timer.reset(new EQ::Timer(5000, true, [this](EQ::Timer *t) {
auto iter = _impl->connections.begin();
while (iter != _impl->connections.end()) {
try {
auto &connection = iter->second;
connection->GetWebsocketConnection()->ping("keepalive");
}
catch (std::exception) {
iter->second->GetTCPConnection()->Disconnect();
}
iter++;
}
}));
_impl->methods.insert(std::make_pair("login", MethodHandlerEntry(std::bind(&WebsocketServer::Login, this, std::placeholders::_1, std::placeholders::_2), 0)));
_impl->methods.insert(std::make_pair("subscribe", MethodHandlerEntry(std::bind(&WebsocketServer::Subscribe, this, std::placeholders::_1, std::placeholders::_2), 0)));
_impl->methods.insert(std::make_pair("unsubscribe", MethodHandlerEntry(std::bind(&WebsocketServer::Unsubscribe, this, std::placeholders::_1, std::placeholders::_2), 0)));
_impl->login_handler = [](const WebsocketServerConnection* connection, const std::string& user, const std::string& pass) {
WebsocketLoginStatus ret;
ret.account_name = "admin";
if (connection->RemoteIP() == "127.0.0.1" || connection->RemoteIP() == "::") {
ret.logged_in = true;
return ret;
}
ret.logged_in = false;
return ret;
};
_impl->ws_server.clear_access_channels(websocketpp::log::alevel::all);
}
EQ::Net::WebsocketServer::~WebsocketServer()
{
}
void EQ::Net::WebsocketServer::ReleaseConnection(WebsocketServerConnection *connection)
{
UnsubscribeAll(connection);
_impl->connections.erase(connection->GetWebsocketConnection());
}
Json::Value EQ::Net::WebsocketServer::HandleRequest(WebsocketServerConnection *connection, const std::string &method, const Json::Value &params)
{
Json::Value err;
if (method != "login") {
if (!connection->IsAuthorized()) {
throw WebsocketException("Not logged in");
}
}
auto iter = _impl->methods.find(method);
if (iter != _impl->methods.end()) {
auto &s = iter->second;
if (s.status > connection->GetStatus()) {
throw WebsocketException("Status too low");
}
return s.handler(connection, params);
}
throw WebsocketException("Unknown Method");
}
void EQ::Net::WebsocketServer::SetMethodHandler(const std::string &method, MethodHandler handler, int required_status)
{
//Reserved method names
if (method == "subscribe" ||
method == "unsubscribe" ||
method == "login") {
return;
}
_impl->methods[method] = MethodHandlerEntry(handler, required_status);
}
void EQ::Net::WebsocketServer::SetLoginHandler(LoginHandler handler)
{
_impl->login_handler = handler;
}
void EQ::Net::WebsocketServer::DispatchEvent(WebsocketSubscriptionEvent evt, Json::Value data, int required_status)
{
try {
Json::Value event_obj;
event_obj["type"] = "event";
event_obj["event"] = (int)evt;
event_obj["data"] = data;
std::stringstream payload;
payload << event_obj;
for (auto &iter : _impl->connections) {
auto &c = iter.second;
if (c->GetStatus() >= required_status && IsSubscribed(c.get(), evt)) {
c->GetWebsocketConnection()->send(payload.str());
}
}
}
catch (std::exception) {
}
}
Json::Value EQ::Net::WebsocketServer::Login(WebsocketServerConnection *connection, const Json::Value &params)
{
Json::Value ret;
try {
Json::Value ret;
auto user = params[0].asString();
auto pass = params[1].asString();
auto r = _impl->login_handler(connection, user, pass);
if (r.logged_in) {
connection->SetAuthorized(true, r.account_name, r.account_id, 255);
ret["status"] = "Ok";
}
else if (user == "admin" && (connection->RemoteIP() == "127.0.0.1" || connection->RemoteIP() == "::")) {
r.logged_in = true;
r.account_id = 0;
connection->SetAuthorized(true, r.account_name, r.account_id, 255);
ret["status"] = "Ok";
}
else {
connection->SetAuthorized(false, "", 0, 0);
ret["status"] = "Not Authorized";
}
return ret;
}
catch (std::exception) {
throw WebsocketException("Unable to process login request");
}
}
Json::Value EQ::Net::WebsocketServer::Subscribe(WebsocketServerConnection *connection, const Json::Value &params)
{
Json::Value ret;
try {
auto evt = params[0].asInt();
if (evt < 0 || evt >= SubscriptionEventMax) {
throw WebsocketException("Not a valid subscription");
}
DoSubscribe(connection, (WebsocketSubscriptionEvent)evt);
ret["status"] = "Ok";
return ret;
}
catch (WebsocketException &ex) {
throw ex;
}
catch (std::exception) {
throw WebsocketException("Unable to process unsubscribe request");
}
}
Json::Value EQ::Net::WebsocketServer::Unsubscribe(WebsocketServerConnection *connection, const Json::Value &params)
{
Json::Value ret;
try {
auto evt = params[0].asInt();
if (evt < 0 || evt >= SubscriptionEventMax) {
throw WebsocketException("Not a valid subscription");
}
DoUnsubscribe(connection, (WebsocketSubscriptionEvent)evt);
ret["status"] = "Ok";
return ret;
}
catch (WebsocketException &ex) {
throw ex;
}
catch (std::exception) {
throw WebsocketException("Unable to process unsubscribe request");
}
}
void EQ::Net::WebsocketServer::DoSubscribe(WebsocketServerConnection *connection, WebsocketSubscriptionEvent sub) {
auto &s = _impl->subscriptions[sub];
auto iter = s.find(connection);
if (iter == s.end()) {
s.insert(connection);
}
}
void EQ::Net::WebsocketServer::DoUnsubscribe(WebsocketServerConnection *connection, WebsocketSubscriptionEvent sub) {
auto &s = _impl->subscriptions[sub];
s.erase(connection);
}
bool EQ::Net::WebsocketServer::IsSubscribed(WebsocketServerConnection *connection, WebsocketSubscriptionEvent sub) {
auto &s = _impl->subscriptions[sub];
return s.count(connection) == 1;
}
void EQ::Net::WebsocketServer::UnsubscribeAll(WebsocketServerConnection *connection) {
for (auto i = 0; i < SubscriptionEventMax; ++i) {
DoUnsubscribe(connection, (WebsocketSubscriptionEvent)i);
}
}
+74
View File
@@ -0,0 +1,74 @@
#pragma once
#include "websocket_server_connection.h"
#include "../json/json.h"
#include <memory>
#include <functional>
#include <exception>
namespace EQ
{
namespace Net
{
enum WebsocketSubscriptionEvent : int
{
SubscriptionEventNone,
SubscriptionEventLog,
SubscriptionEventMax
};
struct WebsocketLoginStatus
{
bool logged_in;
std::string account_name;
uint32 account_id;
int status;
};
class WebsocketException : public std::exception
{
public:
WebsocketException(const std::string &msg)
: _msg(msg.empty() ? "Unknown Error" : msg) { }
~WebsocketException() throw() {}
virtual char const *what() const throw() {
return _msg.c_str();
}
private:
const std::string _msg;
};
class WebsocketServer
{
public:
typedef std::function<Json::Value(WebsocketServerConnection*, const Json::Value&)> MethodHandler;
typedef std::function<WebsocketLoginStatus(WebsocketServerConnection*, const std::string&, const std::string&)> LoginHandler;
WebsocketServer(const std::string &addr, int port);
~WebsocketServer();
void SetMethodHandler(const std::string& method, MethodHandler handler, int required_status);
void SetLoginHandler(LoginHandler handler);
void DispatchEvent(WebsocketSubscriptionEvent evt, Json::Value data = Json::Value(), int required_status = 0);
private:
void ReleaseConnection(WebsocketServerConnection *connection);
Json::Value HandleRequest(WebsocketServerConnection *connection, const std::string& method, const Json::Value &params);
Json::Value Login(WebsocketServerConnection *connection, const Json::Value &params);
Json::Value Subscribe(WebsocketServerConnection *connection, const Json::Value &params);
Json::Value Unsubscribe(WebsocketServerConnection *connection, const Json::Value &params);
void DoSubscribe(WebsocketServerConnection *connection, WebsocketSubscriptionEvent sub);
void DoUnsubscribe(WebsocketServerConnection *connection, WebsocketSubscriptionEvent sub);
bool IsSubscribed(WebsocketServerConnection *connection, WebsocketSubscriptionEvent sub);
void UnsubscribeAll(WebsocketServerConnection *connection);
struct Impl;
std::unique_ptr<Impl> _impl;
friend class WebsocketServerConnection;
};
}
}
+153
View File
@@ -0,0 +1,153 @@
#include "websocket_server_connection.h"
#include "websocket_server.h"
#include "../timer.h"
#include "../util/uuid.h"
#include <sstream>
#include <fmt/format.h>
struct EQ::Net::WebsocketServerConnection::Impl {
WebsocketServer *parent;
std::shared_ptr<TCPConnection> connection;
std::shared_ptr<websocket_connection> ws_connection;
std::string id;
bool authorized;
std::string account_name;
uint32 account_id;
int status;
};
EQ::Net::WebsocketServerConnection::WebsocketServerConnection(WebsocketServer *parent,
std::shared_ptr<TCPConnection> connection,
std::shared_ptr<websocket_connection> ws_connection)
{
_impl.reset(new Impl());
_impl->parent = parent;
_impl->connection = connection;
_impl->id = EQ::Util::UUID::Generate().ToString();
_impl->authorized = false;
_impl->account_id = 0;
_impl->status = 0;
_impl->ws_connection = ws_connection;
_impl->ws_connection->set_message_handler(std::bind(&WebsocketServerConnection::OnMessage, this, std::placeholders::_1, std::placeholders::_2));
_impl->ws_connection->start();
connection->OnDisconnect([this](EQ::Net::TCPConnection *connection) {
_impl->parent->ReleaseConnection(this);
});
connection->OnRead([this](EQ::Net::TCPConnection *c, const unsigned char *buffer, size_t buffer_size) {
_impl->ws_connection->read_all((const char*)buffer, buffer_size);
});
connection->Start();
}
EQ::Net::WebsocketServerConnection::~WebsocketServerConnection()
{
}
std::string EQ::Net::WebsocketServerConnection::GetID() const
{
return _impl->id;
}
bool EQ::Net::WebsocketServerConnection::IsAuthorized() const
{
return _impl->authorized;
}
std::string EQ::Net::WebsocketServerConnection::GetAccountName() const
{
return _impl->account_name;
}
uint32 EQ::Net::WebsocketServerConnection::GetAccountID() const
{
return _impl->account_id;
}
int EQ::Net::WebsocketServerConnection::GetStatus() const
{
return _impl->status;
}
std::string EQ::Net::WebsocketServerConnection::RemoteIP() const
{
return _impl->connection->RemoteIP();
}
int EQ::Net::WebsocketServerConnection::RemotePort() const
{
return _impl->connection->RemotePort();
}
std::shared_ptr<EQ::Net::websocket_connection> EQ::Net::WebsocketServerConnection::GetWebsocketConnection()
{
return _impl->ws_connection;
}
std::shared_ptr<EQ::Net::TCPConnection> EQ::Net::WebsocketServerConnection::GetTCPConnection()
{
return _impl->connection;
}
void EQ::Net::WebsocketServerConnection::OnMessage(websocketpp::connection_hdl hdl, websocket_message_ptr msg)
{
BenchTimer timer;
timer.reset();
if (msg->get_opcode() == websocketpp::frame::opcode::text) {
try {
auto &payload = msg->get_payload();
std::stringstream ss(payload);
Json::Value root;
ss >> root;
auto method = root["method"].asString();
auto params = root["params"];
std::string id = "";
auto idNode = root["id"];
if (!idNode.isNull() && idNode.isString()) {
id = idNode.asString();
}
Json::Value response;
response["type"] = "method";
response["data"] = _impl->parent->HandleRequest(this, method, params);
response["method"] = method;
if(id != "") {
response["id"] = id;
}
SendResponse(response, timer.elapsed());
}
catch (std::exception &ex) {
Json::Value error;
error["type"] = "method";
error["error"] = fmt::format("{0}", ex.what());
SendResponse(error, timer.elapsed());
}
}
}
void EQ::Net::WebsocketServerConnection::SendResponse(const Json::Value &response, double time_elapsed)
{
Json::Value root = response;
root["execution_time"] = std::to_string(time_elapsed);
std::stringstream payload;
payload << root;
_impl->ws_connection->send(payload.str());
}
void EQ::Net::WebsocketServerConnection::SetAuthorized(bool v, const std::string account_name, uint32 account_id, int status)
{
_impl->authorized = v;
_impl->account_name = account_name;
_impl->account_id = account_id;
_impl->status = status;
}
+46
View File
@@ -0,0 +1,46 @@
#pragma once
#include "tcp_server.h"
#include "../types.h"
#include "../json/json-forwards.h"
#include <websocketpp/config/core.hpp>
#include <websocketpp/server.hpp>
namespace EQ
{
namespace Net
{
typedef websocketpp::server<websocketpp::config::core> websocket_server;
typedef websocketpp::connection<websocketpp::config::core> websocket_connection;
typedef websocket_server::message_ptr websocket_message_ptr;
class WebsocketServer;
class WebsocketServerConnection
{
public:
WebsocketServerConnection(WebsocketServer *parent,
std::shared_ptr<TCPConnection> connection,
std::shared_ptr<websocket_connection> ws_connection);
~WebsocketServerConnection();
std::string GetID() const;
bool IsAuthorized() const;
std::string GetAccountName() const;
uint32 GetAccountID() const;
int GetStatus() const;
std::string RemoteIP() const;
int RemotePort() const;
private:
std::shared_ptr<websocket_connection> GetWebsocketConnection();
std::shared_ptr<TCPConnection> GetTCPConnection();
void OnMessage(websocketpp::connection_hdl hdl, websocket_message_ptr msg);
void SendResponse(const Json::Value &response, double time_elapsed);
void SetAuthorized(bool v, const std::string account_name, uint32 account_id, int status);
struct Impl;
std::unique_ptr<Impl> _impl;
friend class WebsocketServer;
};
}
}
+2 -1
View File
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "eqemu_logsys.h"
#include "emu_opcodes.h"
#include "opcodemgr.h"
@@ -31,7 +32,7 @@ OpcodeManager::OpcodeManager() {
bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, bool report_errors) {
FILE *opf = fopen(filename, "r");
if(opf == nullptr) {
fprintf(stderr, "Unable to open opcodes file '%s'. Thats bad.\n", filename);
Log(Logs::General, Logs::Error, "Unable to open opcodes file '%s'", filename);
return(false);
}
+1 -1
View File
@@ -29,7 +29,7 @@
//#endif
#include <string.h>
#ifdef _WINDOWS
#ifdef _WIN32
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
+1 -1
View File
@@ -23,7 +23,7 @@
#include "packet_dump.h"
#include "packet_functions.h"
#ifndef WIN32
#ifndef _WIN32
#include <netinet/in.h>
#endif
+21 -33
View File
@@ -3199,47 +3199,35 @@ namespace RoF
EQApplicationPacket *in = *p;
*p = nullptr;
SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer;
SerializeBuffer buf(in->size);
buf.WriteInt8(in->ReadUInt8()); // speak mode
buf.WriteInt8(in->ReadUInt8()); // journal mode
buf.WriteInt8(in->ReadUInt8()); // language
buf.WriteInt32(in->ReadUInt32()); // message type
buf.WriteInt32(in->ReadUInt32()); // target spawn id
unsigned char *__emu_buffer = in->pBuffer;
std::string name;
in->ReadString(name); // NPC names max out at 63 chars
std::string old_message = &emu->message[strlen(emu->sayer)];
buf.WriteString(name);
buf.WriteInt32(in->ReadUInt32()); // loc
buf.WriteInt32(in->ReadUInt32());
buf.WriteInt32(in->ReadUInt32());
std::string old_message;
std::string new_message;
in->ReadString(old_message);
ServerToRoFSayLink(new_message, old_message);
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
in->size = strlen(emu->sayer) + new_message.length() + 25;
in->pBuffer = new unsigned char[in->size];
buf.WriteString(new_message);
char *OutBuffer = (char *)in->pBuffer;
auto outapp = new EQApplicationPacket(OP_SpecialMesg, buf);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id);
VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]);
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
dest->FastQueuePacket(&outapp, ack_req);
delete in;
}
ENCODE(OP_Stun)
+21 -33
View File
@@ -3266,47 +3266,35 @@ namespace RoF2
EQApplicationPacket *in = *p;
*p = nullptr;
SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer;
SerializeBuffer buf(in->size);
buf.WriteInt8(in->ReadUInt8()); // speak mode
buf.WriteInt8(in->ReadUInt8()); // journal mode
buf.WriteInt8(in->ReadUInt8()); // language
buf.WriteInt32(in->ReadUInt32()); // message type
buf.WriteInt32(in->ReadUInt32()); // target spawn id
unsigned char *__emu_buffer = in->pBuffer;
std::string name;
in->ReadString(name); // NPC names max out at 63 chars
std::string old_message = &emu->message[strlen(emu->sayer)];
buf.WriteString(name);
buf.WriteInt32(in->ReadUInt32()); // loc
buf.WriteInt32(in->ReadUInt32());
buf.WriteInt32(in->ReadUInt32());
std::string old_message;
std::string new_message;
in->ReadString(old_message);
ServerToRoF2SayLink(new_message, old_message);
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
in->size = strlen(emu->sayer) + new_message.length() + 25;
in->pBuffer = new unsigned char[in->size];
buf.WriteString(new_message);
char *OutBuffer = (char *)in->pBuffer;
auto outapp = new EQApplicationPacket(OP_SpecialMesg, buf);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id);
VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]);
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
dest->FastQueuePacket(&outapp, ack_req);
delete in;
}
ENCODE(OP_Stun)
+21 -33
View File
@@ -2069,47 +2069,35 @@ namespace SoD
EQApplicationPacket *in = *p;
*p = nullptr;
SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer;
SerializeBuffer buf(in->size);
buf.WriteInt8(in->ReadUInt8()); // speak mode
buf.WriteInt8(in->ReadUInt8()); // journal mode
buf.WriteInt8(in->ReadUInt8()); // language
buf.WriteInt32(in->ReadUInt32()); // message type
buf.WriteInt32(in->ReadUInt32()); // target spawn id
unsigned char *__emu_buffer = in->pBuffer;
std::string name;
in->ReadString(name); // NPC names max out at 63 chars
std::string old_message = &emu->message[strlen(emu->sayer)];
buf.WriteString(name);
buf.WriteInt32(in->ReadUInt32()); // loc
buf.WriteInt32(in->ReadUInt32());
buf.WriteInt32(in->ReadUInt32());
std::string old_message;
std::string new_message;
in->ReadString(old_message);
ServerToSoDSayLink(new_message, old_message);
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
in->size = strlen(emu->sayer) + new_message.length() + 25;
in->pBuffer = new unsigned char[in->size];
buf.WriteString(new_message);
char *OutBuffer = (char *)in->pBuffer;
auto outapp = new EQApplicationPacket(OP_SpecialMesg, buf);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id);
VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]);
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
dest->FastQueuePacket(&outapp, ack_req);
delete in;
}
ENCODE(OP_Stun)
+27 -33
View File
@@ -1116,7 +1116,10 @@ namespace SoF
}
OUT(deity);
OUT(intoxication);
OUT_array(spellSlotRefresh, spells::SPELL_GEM_COUNT);
eq->spellSlotRefresh[9] = 0; // 10th slot is not valid in this release
OUT(abilitySlotRefresh);
OUT(points); // Relocation Test
// OUT(unknown0166[4]);
@@ -1177,7 +1180,10 @@ namespace SoF
}
// OUT(unknown4184[128]);
OUT_array(mem_spells, spells::SPELL_GEM_COUNT);
eq->mem_spells[9] = 0xFFFFFFFFU; // 10th slot is not valid in this release
// OUT(unknown04396[32]);
OUT(platinum);
OUT(gold);
@@ -1720,47 +1726,35 @@ namespace SoF
EQApplicationPacket *in = *p;
*p = nullptr;
SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer;
SerializeBuffer buf(in->size);
buf.WriteInt8(in->ReadUInt8()); // speak mode
buf.WriteInt8(in->ReadUInt8()); // journal mode
buf.WriteInt8(in->ReadUInt8()); // language
buf.WriteInt32(in->ReadUInt32()); // message type
buf.WriteInt32(in->ReadUInt32()); // target spawn id
unsigned char *__emu_buffer = in->pBuffer;
std::string name;
in->ReadString(name);
std::string old_message = &emu->message[strlen(emu->sayer)];
buf.WriteString(name);
buf.WriteInt32(in->ReadUInt32()); // loc
buf.WriteInt32(in->ReadUInt32());
buf.WriteInt32(in->ReadUInt32());
std::string old_message;
std::string new_message;
in->ReadString(old_message);
ServerToSoFSayLink(new_message, old_message);
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
in->size = strlen(emu->sayer) + new_message.length() + 25;
in->pBuffer = new unsigned char[in->size];
buf.WriteString(new_message);
char *OutBuffer = (char *)in->pBuffer;
auto outapp = new EQApplicationPacket(OP_SpecialMesg, buf);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id);
VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]);
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
dest->FastQueuePacket(&outapp, ack_req);
delete in;
}
ENCODE(OP_Stun)
+4
View File
@@ -328,7 +328,11 @@ namespace SoF
const int SPELL_ID_MAX = 15999;
const int SPELLBOOK_SIZE = 480;
// Be careful not to confuse these two..SoF disc release has a special requirement...
// - The number of available spell gems HAS NOT increased from 9 at this point
// - The profile allocation HAS increased to 10 at this point
const int SPELL_GEM_COUNT = static_cast<uint32>(CastingSlot::MaxGems);
const int SPELL_GEM_PROFILE_SIZE = 10; // special case declaration
const int LONG_BUFFS = 25;
const int SHORT_BUFFS = 15;
+3 -3
View File
@@ -885,7 +885,7 @@ struct PlayerProfile_Struct //23576 Octets
/*00060*/ BindStruct binds[5]; // Bind points (primary is first)
/*00160*/ uint32 deity; // deity
/*00164*/ uint32 intoxication; // Alcohol level (in ticks till sober?)
/*00168*/ uint32 spellSlotRefresh[spells::SPELL_GEM_COUNT]; // Refresh time (millis) - 4 Octets Each
/*00168*/ uint32 spellSlotRefresh[spells::SPELL_GEM_PROFILE_SIZE]; // Refresh time (millis) - 4 Octets Each
/*00208*/ uint32 abilitySlotRefresh;
/*00212*/ uint8 haircolor; // Player hair color
/*00213*/ uint8 beardcolor; // Player beard color
@@ -912,7 +912,7 @@ struct PlayerProfile_Struct //23576 Octets
/*04173*/ uint8 unknown02264[147]; // was [139]
/*04312*/ uint32 spell_book[spells::SPELLBOOK_SIZE]; // List of the Spells in spellbook 480 = 60 pages
/*06232*/ uint8 unknown4184[128]; // was [136]
/*06396*/ uint32 mem_spells[spells::SPELL_GEM_COUNT]; // List of spells memorized
/*06396*/ uint32 mem_spells[spells::SPELL_GEM_PROFILE_SIZE]; // List of spells memorized
/*06436*/ uint8 unknown04396[28]; //#### uint8 unknown04396[32]; in Titanium ####[28]
/*06464*/ uint32 platinum; // Platinum Pieces on player
/*06468*/ uint32 gold; // Gold Pieces on player
@@ -3768,7 +3768,7 @@ struct AnnoyingZoneUnknown_Struct {
};
struct LoadSpellSet_Struct {
uint32 spell[spells::SPELL_GEM_COUNT];
uint32 spell[spells::SPELL_GEM_PROFILE_SIZE];
uint32 unknown;
};
+21 -33
View File
@@ -1420,47 +1420,35 @@ namespace Titanium
EQApplicationPacket *in = *p;
*p = nullptr;
SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer;
SerializeBuffer buf(in->size);
buf.WriteInt8(in->ReadUInt8()); // speak mode
buf.WriteInt8(in->ReadUInt8()); // journal mode
buf.WriteInt8(in->ReadUInt8()); // language
buf.WriteInt32(in->ReadUInt32()); // message type
buf.WriteInt32(in->ReadUInt32()); // target spawn id
unsigned char *__emu_buffer = in->pBuffer;
std::string name;
in->ReadString(name); // NPC names max out at 63 chars
std::string old_message = &emu->message[strlen(emu->sayer)];
buf.WriteString(name);
buf.WriteInt32(in->ReadUInt32()); // loc
buf.WriteInt32(in->ReadUInt32());
buf.WriteInt32(in->ReadUInt32());
std::string old_message;
std::string new_message;
in->ReadString(old_message);
ServerToTitaniumSayLink(new_message, old_message);
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
in->size = strlen(emu->sayer) + new_message.length() + 25;
in->pBuffer = new unsigned char[in->size];
buf.WriteString(new_message);
char *OutBuffer = (char *)in->pBuffer;
auto outapp = new EQApplicationPacket(OP_SpecialMesg, buf);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id);
VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]);
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
dest->FastQueuePacket(&outapp, ack_req);
delete in;
}
ENCODE(OP_TaskDescription)
+21 -33
View File
@@ -2369,47 +2369,35 @@ namespace UF
EQApplicationPacket *in = *p;
*p = nullptr;
SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer;
SerializeBuffer buf(in->size);
buf.WriteInt8(in->ReadUInt8()); // speak mode
buf.WriteInt8(in->ReadUInt8()); // journal mode
buf.WriteInt8(in->ReadUInt8()); // language
buf.WriteInt32(in->ReadUInt32()); // message type
buf.WriteInt32(in->ReadUInt32()); // target spawn id
unsigned char *__emu_buffer = in->pBuffer;
std::string name;
in->ReadString(name); // NPC names max out at 63 chars
std::string old_message = &emu->message[strlen(emu->sayer)];
buf.WriteString(name);
buf.WriteInt32(in->ReadUInt32()); // loc
buf.WriteInt32(in->ReadUInt32());
buf.WriteInt32(in->ReadUInt32());
std::string old_message;
std::string new_message;
in->ReadString(old_message);
ServerToUFSayLink(new_message, old_message);
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
in->size = strlen(emu->sayer) + new_message.length() + 25;
in->pBuffer = new unsigned char[in->size];
buf.WriteString(new_message);
char *OutBuffer = (char *)in->pBuffer;
auto outapp = new EQApplicationPacket(OP_SpecialMesg, buf);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type);
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id);
VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]);
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]);
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
dest->FastQueuePacket(&outapp, ack_req);
delete in;
}
ENCODE(OP_Stun)
+8 -8
View File
@@ -22,7 +22,7 @@
#include "global_define.h"
#include "types.h"
#include "proc_launcher.h"
#ifdef _WINDOWS
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/types.h>
@@ -39,7 +39,7 @@
ProcLauncher ProcLauncher::s_launcher;
#ifdef _WINDOWS
#ifdef _WIN32
const ProcLauncher::ProcRef ProcLauncher::ProcError = 0xFFFFFFFF;
#else
const ProcLauncher::ProcRef ProcLauncher::ProcError = -1;
@@ -47,7 +47,7 @@ const ProcLauncher::ProcRef ProcLauncher::ProcError = -1;
ProcLauncher::ProcLauncher()
{
#ifndef WIN32
#ifndef _WIN32
if(signal(SIGCHLD, ProcLauncher::HandleSigChild) == SIG_ERR)
fprintf(stderr, "Unable to register child signal handler. Thats bad.");
m_signalCount = 0;
@@ -55,7 +55,7 @@ ProcLauncher::ProcLauncher()
}
void ProcLauncher::Process() {
#ifdef _WINDOWS
#ifdef _WIN32
std::map<ProcRef, Spec *>::iterator cur, end, tmp;
cur = m_running.begin();
end = m_running.end();
@@ -112,7 +112,7 @@ void ProcLauncher::ProcessTerminated(std::map<ProcRef, Spec *>::iterator &it) {
if(it->second->handler != nullptr)
it->second->handler->OnTerminate(it->first, it->second);
#ifdef _WINDOWS
#ifdef _WIN32
CloseHandle(it->second->proc_info.hProcess);
#else //!WIN32
#endif //!WIN32
@@ -125,7 +125,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) {
Spec *it = to_launch;
to_launch = nullptr;
#ifdef _WINDOWS
#ifdef _WIN32
STARTUPINFO siStartInfo;
BOOL bFuncRetn = FALSE;
@@ -283,7 +283,7 @@ bool ProcLauncher::Terminate(const ProcRef &proc, bool graceful) {
//we do not remove it from the list until we have been notified
//that they have been terminated.
#ifdef _WINDOWS
#ifdef _WIN32
if(!TerminateProcess(res->second->proc_info.hProcess, 0)) {
return(false);
}
@@ -325,7 +325,7 @@ void ProcLauncher::TerminateAll(bool final) {
}
#ifndef WIN32
#ifndef _WIN32
void ProcLauncher::HandleSigChild(int signum) {
if(signum == SIGCHLD) {
ProcLauncher::get()->m_signalCount++;
+3 -3
View File
@@ -33,7 +33,7 @@ public:
static ProcLauncher *get() { return(&s_launcher); }
static void ProcessInThisThread();
#ifdef WIN32
#ifdef _WIN32
typedef DWORD ProcRef;
static const ProcRef ProcError;
#else
@@ -55,7 +55,7 @@ public:
std::string logFile; //empty = do not redirect output.
protected:
//None of these fields get copied around
#ifdef WIN32
#ifdef _WIN32
PROCESS_INFORMATION proc_info;
#endif
};
@@ -83,7 +83,7 @@ protected:
private:
static ProcLauncher s_launcher;
#ifndef WIN32
#ifndef _WIN32
uint32 m_signalCount;
static void HandleSigChild(int signum);
#endif
+1 -1
View File
@@ -23,7 +23,7 @@
#include "database.h"
#include "string_util.h"
#ifdef _WINDOWS
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
int gettimeofday (timeval *tp, ...);
+2 -5
View File
@@ -121,11 +121,8 @@ private:
int m_activeRuleset;
std::string m_activeName;
#ifdef WIN64
uint32 m_RuleIntValues [_IntRuleCount ];
#else
int m_RuleIntValues [_IntRuleCount ];
#endif
int32 m_RuleIntValues [_IntRuleCount ];
float m_RuleRealValues[_RealRuleCount];
uint32 m_RuleBoolValues[_BoolRuleCount];
+16 -5
View File
@@ -205,6 +205,7 @@ RULE_CATEGORY_END()
RULE_CATEGORY(GM)
RULE_INT(GM, MinStatusToSummonItem, 250)
RULE_INT(GM, MinStatusToZoneAnywhere, 250)
RULE_INT(GM, MinStatusToLevelTarget, 100)
RULE_CATEGORY_END()
RULE_CATEGORY(World)
@@ -225,8 +226,6 @@ RULE_BOOL(World, MaxClientsSetByStatus, false) // If True, IP Limiting will be s
RULE_BOOL(World, EnableIPExemptions, false) // If True, ip_exemptions table is used, if there is no entry for the IP it will default to RuleI(World, MaxClientsPerIP)
RULE_BOOL(World, ClearTempMerchantlist, true) // Clears temp merchant items when world boots.
RULE_BOOL(World, DeleteStaleCorpeBackups, true) // Deletes stale corpse backups older than 2 weeks.
RULE_INT(World, AccountSessionLimit, -1) //Max number of characters allowed on at once from a single account (-1 is disabled)
RULE_INT(World, ExemptAccountLimitStatus, -1) //Min status required to be exempt from multi-session per account limiting (-1 is disabled)
RULE_BOOL(World, GMAccountIPList, false) // Check ip list against GM Accounts, AntiHack GM Accounts.
RULE_INT(World, MinGMAntiHackStatus, 1) //Minimum GM status to check against AntiHack list
RULE_INT(World, SoFStartZoneID, -1) //Sets the Starting Zone for SoF Clients separate from Titanium Clients (-1 is disabled)
@@ -241,10 +240,11 @@ RULE_BOOL (World, IPLimitDisconnectAll, false)
RULE_BOOL(World, MaxClientsSimplifiedLogic, false) // New logic that only uses ExemptMaxClientsStatus and MaxClientsPerIP. Done on the loginserver. This mimics the P99-style special IP rules.
RULE_INT (World, TellQueueSize, 20)
RULE_BOOL(World, StartZoneSameAsBindOnCreation, true) //Should the start zone ALWAYS be the same location as your bind?
RULE_BOOL(World, EnforceCharacterLimitAtLogin, false)
RULE_CATEGORY_END()
RULE_CATEGORY(Zone)
RULE_INT(Zone, ClientLinkdeadMS, 180000) //the time a client remains link dead on the server after a sudden disconnection
RULE_INT(Zone, ClientLinkdeadMS, 90000) //the time a client remains link dead on the server after a sudden disconnection
RULE_INT(Zone, GraveyardTimeMS, 1200000) //ms time until a player corpse is moved to a zone's graveyard, if one is specified for the zone
RULE_BOOL(Zone, EnableShadowrest, 1) // enables or disables the shadowrest zone feature for player corpses. Default is turned on.
RULE_BOOL(Zone, UsePlayerCorpseBackups, true) // Keeps backups of player corpses.
@@ -683,10 +683,10 @@ RULE_CATEGORY_END()
RULE_CATEGORY(Network)
RULE_INT(Network, ResendDelayBaseMS, 100)
RULE_REAL(Network, ResendDelayFactor, 1.5)
RULE_INT(Network, ResendDelayMinMS, 100)
RULE_INT(Network, ResendDelayMinMS, 300)
RULE_INT(Network, ResendDelayMaxMS, 5000)
RULE_REAL(Network, ClientDataRate, 0.0) // KB / sec, 0.0 disabled
RULE_BOOL(Network, TrackOpcodeStats, false)
RULE_BOOL(Network, CompressZoneStream, true)
RULE_CATEGORY_END()
RULE_CATEGORY(QueryServ)
@@ -735,6 +735,17 @@ RULE_BOOL(Bugs, UseOldReportingMethod, true) // Forces the use of the old bug re
RULE_BOOL(Bugs, DumpTargetEntity, false) // Dumps the target entity, if one is provided
RULE_CATEGORY_END()
RULE_CATEGORY(Faction)
RULE_INT(Faction, AllyFactionMinimum, 1100)
RULE_INT(Faction, WarmlyFactionMinimum, 750)
RULE_INT(Faction, KindlyFactionMinimum, 500)
RULE_INT(Faction, AmiablyFactionMinimum, 100)
RULE_INT(Faction, IndifferentlyFactionMinimum, 0)
RULE_INT(Faction, ApprehensivelyFactionMinimum, -100)
RULE_INT(Faction, DubiouslyFactionMinimum, -500)
RULE_INT(Faction, ThreateninglyFactionMinimum, -750)
RULE_CATEGORY_END()
#undef RULE_CATEGORY
#undef RULE_INT
#undef RULE_REAL
+1 -1
View File
@@ -143,7 +143,7 @@ public:
void WriteString(const char *str)
{
assert(str != nullptr);
auto len = strlen(str) + 1;
auto len = std::char_traits<char>::length(str) + 1;
if (m_pos + len > m_capacity)
Grow(m_capacity + len);
memcpy(m_buffer + m_pos, str, len);
+65 -94
View File
@@ -15,109 +15,80 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Serverinfo.cpp - Server information gathering functions, used in #serverinfo - Windows specific
// I'm not sure quite how to get this exact information in *nix, hopefully someone can fill that in
// -T7g
// Implement preliminary support for *nix variants
// misanthropicfiend
#ifdef _WINDOWS
#include <windows.h>
#include "serverinfo.h"
#include <uv.h>
char Ver_name[100];
DWORD Ver_build, Ver_min, Ver_maj, Ver_pid;
size_t EQ::GetRSS()
{
size_t rss = 0;
int GetOS() {
strcpy(Ver_name, "Unknown operating system");
OSVERSIONINFO Ver_os;
Ver_os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if(!(GetVersionEx(&Ver_os))) return 1;
Ver_build = Ver_os.dwBuildNumber & 0xFFFF;
Ver_min = Ver_os.dwMinorVersion;
Ver_maj = Ver_os.dwMajorVersion;
Ver_pid = Ver_os.dwPlatformId;
if ((Ver_pid == 1) && (Ver_maj == 4))
{
if ((Ver_min < 10) && (Ver_build == 950))
{
strcpy(Ver_name, "Microsoft Windows 95");
}
else if ((Ver_min < 10) &&
((Ver_build > 950) && (Ver_build <= 1080)))
{
strcpy(Ver_name, "Microsoft Windows 95 SP1");
}
else if ((Ver_min < 10) && (Ver_build > 1080))
{
strcpy(Ver_name, "Microsoft Windows 95 OSR2");
}
else if ((Ver_min == 10) && (Ver_build == 1998))
{
strcpy(Ver_name, "Microsoft Windows 98");
}
else if ((Ver_min == 10) &&
((Ver_build > 1998) && (Ver_build < 2183)))
{
strcpy(Ver_name, "Microsoft Windows 98, Service Pack 1");
}
else if ((Ver_min == 10) && (Ver_build >= 2183))
{
strcpy(Ver_name, "Microsoft Windows 98 Second Edition");
}
else if (Ver_min == 90)
{
strcpy(Ver_name, "Microsoft Windows ME");
}
}
else if (Ver_pid == 2)
{
if ((Ver_maj == 3) && (Ver_min == 51))
{
strcpy(Ver_name, "Microsoft Windows NT 3.51");
}
else if ((Ver_maj == 4) && (Ver_min == 0))
{
strcpy(Ver_name, "Microsoft Windows NT 4");
}
else if ((Ver_maj == 5) && (Ver_min == 0))
{
strcpy(Ver_name, "Microsoft Windows 2000");
}
else if ((Ver_maj == 5) && (Ver_min == 1))
{
strcpy(Ver_name, "Microsoft Windows XP");
}
else if ((Ver_maj == 5) && (Ver_min == 2))
{
strcpy(Ver_name, "Microsoft Windows 2003");
}
if (0 != uv_resident_set_memory(&rss)) {
return 0;
}
return 0;
return rss;
}
#else
double EQ::GetUptime()
{
double uptime = 0.0;
#include <sys/utsname.h>
#include <stdio.h>
#include <string.h>
char* GetOS(char* os_string) {
utsname info;
if(uname(&info)==0) {
snprintf(os_string, 99, "%s %s %s %s %s", info.sysname, info.nodename, info.release, info.version, info.machine);
} else {
strncpy(os_string, "Error determining OS & version!", 25);
if (0 != uv_uptime(&uptime)) {
return 0.0;
}
return os_string;
return uptime;
}
#endif
size_t EQ::GetPID()
{
return uv_os_getpid();
}
std::vector<eq_cpu_info_t> EQ::GetCPUs()
{
std::vector<eq_cpu_info_t> ret;
uv_cpu_info_t *cpu_info = nullptr;
int count = 0;
if (0 != uv_cpu_info(&cpu_info, &count)) {
return ret;
}
ret.reserve(count);
for (int i = 0; i < count; ++i) {
eq_cpu_info_t r;
auto &entry = cpu_info[i];
r.model = entry.model;
r.speed = entry.speed / 1000.0;
r.time_user = entry.cpu_times.user;
r.time_sys = entry.cpu_times.sys;
r.time_idle = entry.cpu_times.idle;
r.time_nice = entry.cpu_times.nice;
r.time_irq = entry.cpu_times.irq;
ret.push_back(r);
}
uv_free_cpu_info(cpu_info, count);
return ret;
}
eq_utsname_t EQ::GetOS()
{
eq_utsname_t ret;
uv_utsname_t name;
if (0 != uv_os_uname(&name)) {
return ret;
}
ret.machine = name.machine;
ret.release = name.release;
ret.sysname = name.sysname;
ret.version = name.version;
return ret;
}
+28 -10
View File
@@ -15,15 +15,33 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SERVERINFO_H
#define SERVERINFO_H
#pragma once
#ifdef _WINDOWS
extern char Ver_name[36];
extern DWORD Ver_build, Ver_min, Ver_maj, Ver_pid;
int GetOS();
#else
char* GetOS(char* os_string);
#endif
#include <string>
#include <vector>
#endif
typedef struct eq_cpu_info_s {
std::string model;
double speed;
uint64_t time_user;
uint64_t time_nice;
uint64_t time_sys;
uint64_t time_idle;
uint64_t time_irq;
} eq_cpu_info_t;
typedef struct eq_utsname_s {
std::string sysname;
std::string release;
std::string version;
std::string machine;
} eq_utsname_t;
namespace EQ
{
size_t GetRSS();
double GetUptime();
size_t GetPID();
std::vector<eq_cpu_info_t> GetCPUs();
eq_utsname_t GetOS();
}
+20 -1
View File
@@ -80,6 +80,7 @@
#define ServerOP_GroupJoin 0x003e //for joining ooz folks
#define ServerOP_UpdateSpawn 0x003f
#define ServerOP_SpawnStatusChange 0x0040
#define ServerOP_DropClient 0x0041 // DropClient
#define ServerOP_ReloadTasks 0x0060
#define ServerOP_DepopAllPlayersCorpses 0x0061
#define ServerOP_ReloadTitles 0x0062
@@ -213,6 +214,15 @@ enum { QSG_LFGuild_PlayerMatches = 0, QSG_LFGuild_UpdatePlayerInfo, QSG_LFGuild_
#define ServerOP_Speech 0x4513
enum {
UserToWorldStatusWorldUnavail = 0,
UserToWorldStatusSuccess = 1,
UserToWorldStatusSuspended = -1,
UserToWorldStatusBanned = -2,
UserToWorldStatusWorldAtCapacity = -3,
UserToWorldStatusAlreadyOnline = -4
};
/************ PACKET RELATED STRUCT ************/
class ServerPacket
{
@@ -308,11 +318,17 @@ struct ServerZoneIncomingClient_Struct {
uint32 accid;
int16 admin;
uint32 charid;
uint32 lsid;
bool tellsoff;
char charname[64];
char lskey[30];
};
struct ServerZoneDropClient_Struct
{
uint32 lsid;
};
struct ServerChangeWID_Struct {
uint32 charid;
uint32 newwid;
@@ -343,7 +359,8 @@ struct ServerChannelMessage_Struct {
bool noreply;
uint16 chan_num;
uint32 guilddbid;
uint16 language;
uint8 language;
uint8 lang_skill;
uint8 queued; // 0 = not queued, 1 = queued, 2 = queue full, 3 = offline
char message[0];
};
@@ -856,6 +873,8 @@ struct ServerRaidGroupAction_Struct { //add / remove depends on opcode.
struct ServerRaidMessage_Struct {
uint32 rid;
uint32 gid;
uint8 language;
uint8 lang_skill;
char from[64];
char message[0];
};
+1 -1
View File
@@ -77,7 +77,7 @@
#include "classes.h"
#include "spdat.h"
#ifndef WIN32
#ifndef _WIN32
#include <stdlib.h>
#include "unix.h"
#endif
+1 -1
View File
@@ -590,7 +590,7 @@ typedef enum {
#define SE_CorruptionCounter 369 // implemented
#define SE_ResistCorruption 370 // implemented
#define SE_AttackSpeed4 371 // implemented - stackable slow effect 'Inhibit Melee'
#define SE_ForageSkill 372 // *not implemented[AA] Will increase the skill cap for those that have the Forage skill and grant the skill and raise the cap to those that do not.
#define SE_ForageSkill 372 // implemented[AA] Will increase the skill cap for those that have the Forage skill and grant the skill and raise the cap to those that do not.
#define SE_CastOnFadeEffectAlways 373 // implemented - Triggers if fades after natural duration OR from rune/numhits fades.
#define SE_ApplyEffect 374 // implemented
#define SE_DotCritDmgIncrease 375 // implemented - Increase damage of DoT critical amount
+23 -2
View File
@@ -17,7 +17,7 @@
#include "string_util.h"
#include <algorithm>
#ifdef _WINDOWS
#ifdef _WIN32
#include <windows.h>
#define snprintf _snprintf
@@ -27,6 +27,8 @@
#else
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#endif
#ifndef va_copy
@@ -119,10 +121,29 @@ std::vector<std::string> SplitString(const std::string &str, char delim) {
while(std::getline(ss, item, delim)) {
ret.push_back(item);
}
return ret;
}
std::string implode(std::string glue, std::vector<std::string> src)
{
if (src.empty()) {
return {};
}
std::ostringstream output;
std::vector<std::string>::iterator src_iter;
for (src_iter = src.begin(); src_iter != src.end(); src_iter++) {
output << *src_iter << glue;
}
std::string final_output = output.str();
final_output.resize (output.str().size () - glue.size());
return final_output;
}
std::string EscapeString(const std::string &s) {
std::string ret;
+1
View File
@@ -30,6 +30,7 @@ const std::string ucfirst(std::string s);
std::vector<std::string> split(std::string str_to_split, char delimiter);
const std::string StringFormat(const char* format, ...);
const std::string vStringFormat(const char* format, va_list args);
std::string implode(std::string glue, std::vector<std::string> src);
std::vector<std::string> SplitString(const std::string &s, char delim);
std::string EscapeString(const char *src, size_t sz);
std::string EscapeString(const std::string &s);
+2 -2
View File
@@ -18,7 +18,7 @@
// Disgrace: for windows compile
#ifndef WIN32
#ifndef _WIN32
#include <sys/time.h>
#else
#include <sys/timeb.h>
@@ -64,7 +64,7 @@ Timer::Timer(uint32 start, uint32 timer, bool iUseAcurateTiming = false) {
}
/* Reimplemented for MSVC - Bounce */
#ifdef _WINDOWS
#ifdef _WIN32
int gettimeofday (timeval *tp, ...)
{
timeb tb;
+1 -1
View File
@@ -22,7 +22,7 @@
#include <chrono>
// Disgrace: for windows compile
#ifdef _WINDOWS
#ifdef _WIN32
#include "global_define.h"
int gettimeofday (timeval *tp, ...);
#endif
+5 -5
View File
@@ -29,7 +29,7 @@ typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;
#ifdef _WINDOWS
#ifdef _WIN32
#pragma warning( disable : 4200 )
#endif
@@ -42,7 +42,7 @@ typedef unsigned short ushort;
typedef unsigned char uchar;
typedef const char Const_char; //for perl XS
#ifdef _WINDOWS
#ifdef _WIN32
#if (!defined(_MSC_VER) || (defined(_MSC_VER) && _MSC_VER < 1900))
#define snprintf _snprintf
#endif
@@ -61,7 +61,7 @@ typedef const char Const_char; //for perl XS
#define H32(i) ((uint32) (i >> 32))
#define L16(i) ((uint16) i)
#ifndef WIN32
#ifndef _WIN32
// More WIN32 compatability
typedef unsigned long DWORD;
typedef unsigned char BYTE;
@@ -79,14 +79,14 @@ typedef const char Const_char; //for perl XS
#endif
#ifdef _WINDOWS
#ifdef _WIN32
#define DLLFUNC extern "C" __declspec(dllexport)
#else
#define DLLFUNC extern "C"
#endif
// htonll and ntohll already defined on windows
#ifndef WIN32
#ifndef _WIN32
# if defined(__linux__)
# include <endian.h>
# elif defined(__FreeBSD__) || defined(__NetBSD__)
+1 -1
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _WINDOWS
#ifndef _WIN32
#include "unix.h"
#include <string.h>
+1 -1
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _WINDOWS
#ifndef _WIN32
#ifndef __UNIX_H__
#define __UNIX_H__
#include <unistd.h>
+3 -3
View File
@@ -10,16 +10,16 @@
// this doesn't do shit for C++ but libc++ and GCC 6.1+ use it to define some macros
#include <ciso646>
#ifndef WIN32
#ifndef _WIN32
extern "C" { //the perl headers dont do this for us...
#endif
#include <perl.h>
#include <XSUB.h>
#ifndef WIN32
#ifndef _WIN32
};
#endif
#ifdef WIN32
#ifdef _WIN32
#ifndef snprintf
#define snprintf _snprintf
#endif
+3 -3
View File
@@ -31,16 +31,16 @@
*/
#define CURRENT_BINARY_DATABASE_VERSION 9138
#define CURRENT_BINARY_DATABASE_VERSION 9141
#ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9022
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9024
#else
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
#endif
#define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__
#ifndef WIN32
#ifndef _WIN32
#define LAST_MODIFIED __TIME__
#else
#define LAST_MODIFIED __TIMESTAMP__
-2
View File
@@ -1,2 +0,0 @@
*.*
*
+1 -1
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
SET(eqlaunch_sources
eqlaunch.cpp
+2 -2
View File
@@ -70,7 +70,7 @@ int main(int argc, char *argv[]) {
Log(Logs::Detail, Logs::Launcher, "Could not set signal handler");
return 1;
}
#ifndef WIN32
#ifndef _WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
Log(Logs::Detail, Logs::Launcher, "Could not set signal handler");
return 1;
@@ -136,7 +136,7 @@ int main(int argc, char *argv[]) {
zones.erase(rem);
}
EQ::EventLoop::Get().Process();
EQ::EventLoop::GetDefault().Process();
Sleep(5);
}
+1 -1
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
SET(hc_sources
eq.cpp
+55 -32
View File
@@ -1,38 +1,61 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Build for LuaBind
# Ryan Pavlik <rpavlik@iastate.edu>
# http://academic.cleardefinition.com/
# Iowa State University HCI Graduate Program/VRAC
SET(lb_sources
src/class.cpp
src/class_info.cpp
src/class_registry.cpp
src/class_rep.cpp
src/create_class.cpp
src/error.cpp
src/exception_handler.cpp
src/function.cpp
src/inheritance.cpp
src/link_compatibility.cpp
src/object_rep.cpp
src/open.cpp
src/pcall.cpp
src/scope.cpp
src/stack_content_by_name.cpp
src/weak_ref.cpp
src/wrapper_base.cpp
cmake_minimum_required(VERSION 3.0)
project(LuaBind)
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "9")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(NOT LUA_FOUND AND NOT LUA51_FOUND)
find_package(Lua51 REQUIRED)
set(LUA_INCLUDE_DIRS "${LUA_INCLUDE_DIR}")
endif()
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# We are the top-level project
include(CTest)
option(LUABIND_INSTALL "Install the LuaBind library and headers" ON)
option(LUABIND_BUILD_DOCS "Build documentation files" OFF)
option(LUABIND_BUILD_SHARED "Build luabind as a shared library?" OFF)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Requiring C++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
if(MSVC)
# Requiring C++11
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /std:c++11")
endif()
set(BUILD_SHARED_LIBS ${LUABIND_BUILD_SHARED})
if(BUILD_SHARED_LIBS)
add_definitions(-DLUABIND_DYNAMIC_LINK)
endif()
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}"
${LUA_INCLUDE_DIRS}
)
SET(lb_headers
add_subdirectory(src)
)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
ADD_LIBRARY(luabind ${lb_sources} ${lb_headers})
if(LUABIND_BUILD_DOCS)
add_subdirectory(doc)
endif()
IF(UNIX)
set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations)
ENDIF(UNIX)
IF(MSVC)
set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS " /W0 " )
ENDIF(MSVC)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

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