Commit Graph

167 Commits

Author SHA1 Message Date
dongresource 8afe175bd1 No reason not to include the Academy packet in there 2021-03-31 21:10:54 +02:00
dongresource 55b140f673 [refactor] Initial conversion to new packet handler interfaces
Manually converted PlayerManager, PlayerMovement and a few parts of
Combat to the new system.
2021-03-31 21:10:54 +02:00
dongresource 124ea33959 Disallow vehicles in non-overworld instances 2021-03-19 02:20:13 +01:00
CPunch 574f0cab09 Added a wrapper for U16toU8, called AUTOU16TOU8
- U16toU8 now requires a max arument to be passed
2021-03-17 23:41:47 -05:00
dongresource 610a683804 [refactor] E g g s 2021-03-17 22:28:24 +01:00
dongresource a55a34e09a [refactor] Move files to core/ and servers/ subdirectories
CNProtocol, CNShared, CNStructs and Defines are now in core/.
CNLoginServer, CNShardServer and Monitor are now in servers/.

core/Core.hpp wraps all the core headers except for CNShared.hpp.

Defines.cpp has been renamed to Packets.cpp, and so has its
corresponding namespace, but not the header file. This is in preparation
for upcoming changes.
2021-03-17 20:16:48 +01:00
dongresource e9bc2fe561 [refactor] Remove the word 'Manager' from most source files/namespaces
ChatManager -> Chat
MissionManager -> Missions
NanoManager -> Nanos
TransportManager -> Transport
ChunkManager -> Chunking
BuddyManager -> Buddies
GroupManager -> Groups
RacingManager -> Racing
ItemManager -> Items

NPCManager and PlayerManager remain.

Note: You can use git log --follow src/file.cpp to trace the history of
a file from before it was renamed.
2021-03-17 20:16:43 +01:00
dongresource cee09f6344 [refactor] Mark all internal functions static
All packet handlers and helper functions that are only used in the
source file they're declared in have been taken out of the namespaces in
the corresponding header files, have been marked static, and have been
reordered to avoid the need for declarations at the top of each source
file.

Each source file now contains a "using namespace" directive so that the
static functions don't need to prefix the source file's symbols with
their namespace. All redundant namespace prefixes found have been
removed.

An unused nano power resetting function in NanoManager has been removed.
2021-03-16 22:54:41 +01:00
dongresource c5776b9322 [refactor] Split Database.cpp into db subdirectory
* Database.hpp is still the only external include file (moved to db/)
* The header is still uppercase to match its namespace
* db/internal.hpp is the shared header for the DB source files
* Added -Isrc/ compile flag for src-relative include paths
* Hoisted CHDR above CSRC in Makefile (it was bothering me)
* make clean now removes all objects in the subdirectories as well
2021-03-16 02:13:24 +01:00
dongresource 2024fb4969 [refactor] Split MobManager.cpp into MobAI.cpp and Combat.cpp
This is terrible. It was a mistake to do this before cleaning up the
actual code. It might be better not to use this commit and to do this
refactor in a different order or something.
2021-03-13 23:55:16 +01:00
dongresource ae279100d7 [refactor] Extract Abilities.cpp from {Nano,Mob}Manager.cpp
I've kept all the functions in their original namespaces for now, since
putting them all into the same one will cause collissions, and this is
all getting rewritten soon anyway.
2021-03-13 21:22:29 +01:00
dongresource ce197d7db3 [refactor] Extract PlayerMovement.cpp from PlayerManager.cpp 2021-03-13 02:59:18 +01:00
dongresource f9c2587557 [refactor] Extract BuiltinCommands.cpp from PlayerManager.cpp
And move itemGMGiveHandler() from ItemManager.
2021-03-13 02:59:18 +01:00
dongresource 89eb0b140b Use the right packet for when a player falls out of the world
SUDDEN_DEAD is more appropriate than goo damage for this.
Also made it so other players can see when someone does a /health 0, for
comedic effect.
2021-03-09 21:23:57 +01:00
dongresource ffe5947925 Keep track of sold items so we can validate buyback packets 2021-03-09 16:45:38 +01:00
dongresource 5e569d4324 Disallow selling Croc-Potted items
Also, make sure to explicitly terminate the connection when a player is
kicked, and align a few fields in tables.sql.
2021-03-07 00:38:24 +01:00
Jade d4eaf83354 Fixed Instancing Bugs 2021-01-04 23:53:44 +01:00
dongresource 4516227a7b Fix a few GM issues
* Invert access check when kicking players
* Add validation to ensure only GMs can PVP
* Account for instance in /teleport2me
2021-01-01 21:38:03 +01:00
dongresource a12acbb68f Implement most of the remaining client-side GM commands
* Muting a player's freechat
* Kicking players
* Querying info about a player
* Teleporting yourself to a player
* Teleporting a player to yourself
* Teleporting a player to another player
* Teleporting a player to arbitrary coords
* Teleporting a player to arbitrary coords in an arbitrary mapnum
* /unstick

Also:
* Renamed misleading setSpecialPlayer() to setValuePlayer()
* Revamped monitor logic
* Added server-side checks to account level 50 commands
* Made sure even trade chat is run through sanitizeText()
* Moved setSpecialState() closer to its calling functions
* Interpret client commands even in Buddy and Group chat (but not in
Trade chat)
2020-12-31 12:51:31 +01:00
dongresource c78b3ca69f Do not cancel the ongoing race on recall
Also do not remove the player's vehicle if the player isn't on a
vehicle.
2020-12-31 03:00:54 +01:00
dongresource 55431362a7 Make sure the current race is cleared when leaving an IZ 2020-12-28 18:40:26 +01:00
dongresource 4060bf25b0 Fix recall removing FM pods if racing 2020-12-28 16:55:13 +01:00
kamilprzyb f28c643b48 Allow permanent vehicles 2020-12-23 13:50:12 -05:00
dongresource fcdea2e723 Implement multiple-choice mission rewards 2020-12-23 13:50:12 -05:00
dongresource a99f95d15f Initial Academy support
Support for the Academy's Nano system is complete, but they're not being
saved to the DB yet.
2020-12-23 13:50:12 -05:00
Gent S ea47f67b2b Properly utilize instance data in map info packet 2020-12-21 16:18:08 -05:00
Gent S 91ea8be72e Implement basic race handling 2020-12-21 16:18:08 -05:00
dongresource f7a6615379 Tweak mob roaming logic and a few other values
This fixes the crash with mobs with a very small m_iIdleRange and avoids
unnecessary looping.

Co-authored-by: JadeShrineMaiden <69916714+JadeShrineMaiden@users.noreply.github.com>
2020-12-17 02:35:55 +01:00
Gent S 792a317b48 Indicate high account level in logged player name 2020-12-15 09:53:45 -05:00
dongresource 442d7853a5 In the absence of a Resurrect 'Em in a Lair, respawn at the entrance 2020-12-15 00:26:29 +01:00
Kamil 04112377ea Implement setting for disabling first use tips 2020-12-13 19:51:09 -05:00
Kamil bd3a91e530 Properly implement first use flags 2020-12-13 19:51:09 -05:00
dongresource 811c9d4d5c Stop iterating in exitDuplicate() after having removed a player
This fixes a crash due to the invalidated iterator continuing to loop.
It should be safe to assume there's only ever one duplicate/stale player.

Also updated tdata.
2020-12-08 01:53:21 +01:00
dongresource 8ebabac7c0 Various bugfixes
* Fixed Nano stamina not being halved on respawn
* Reverted the default argument to terminate() change because MSVC is
undable to disambiguate the function pointer passed to sigaction()
* Fatal errors during init (like in TableData) can just call exit(1)
directly anyway (missing "OpenFusion: terminated." be damned)
* Switched to a slightly more portable syntax for getting the version
in the Makefile
* We shouldn't join the shard thread in the signal handler because the
thread the signal handler ends up running in is undefined behaviour and
we don't strictly need to join it anyway

Many of these issues were discovered on OpenBSD.
2020-12-06 05:25:23 +01:00
dongresource fb9c4140b6 Remove redundant namespace specifiers in PlayerManager::init() 2020-12-01 22:24:18 +01:00
dongresource 1e822f7a6c Removed redundant checks for a nullptr from PlayerManager::getPlayer()
These were written in desparation and never should have been there in
the first place.
2020-12-01 21:37:34 +01:00
dongresource c43a3d64fb Removed the Player pointer from CNSocket
It was a leak in the abstraction that we weren't even using that much.
This is technically a de-optimization, but it's okay since it's not a
hot code path.
2020-12-01 21:37:34 +01:00
Jade 5771cd014a Various bugfixes and tweaks
- timed missions of all types should work.
- nanos now transmit an unsummon on 0 stamina.
- dying bumps your nanos down to half stamina now.
- enemies use abilities less frequently.
- group recall now works at any distance.
- passive nanos are tweaked to guzzle less stamina.
- cleared out some redundant stuff at the nanoPower handler.
2020-12-01 13:16:14 -05:00
Jade d2e89851d6 Non-group buffs do not misbehave + Revive nano stamina fix 2020-11-27 15:40:49 -05:00
Jade c343092bd5 Gumball times out for slots 2 & 3 + Tweaks 2020-11-27 12:01:28 -05:00
Jade fe7ec44554 Restructuring, Cleaning up and Bugfixes
* Added findTargets, a new helper function that reads out the packet for targets.
* Restructured and removed leftover redundant code.
2020-11-26 23:01:19 -05:00
Jade 299fc1b461 Refactored Nano Powers
* All nano power functions have been merged into one goliath of a function.
* Nano powers consume the correct amount of stamina.
* Bugfixed gumball issues, gumballed nanos now perform better.
* Revive powers now work correctly.
* Recall powers both self and group are functional.
* Removed nanoBuff.
* Added a new applyBuff function, this allows for quick and easy application of nano skills.
* Numerous other bugfixes.
2020-11-26 23:01:19 -05:00
Gent S 8073c68bd5 Make /fusionmatter properly update fusion matter 2020-11-26 22:33:43 -05:00
Gent S 57060e9b6f Fix spawning in the unknown when no Resurrect 'Ems are nearby 2020-11-26 11:03:42 -05:00
Gent S faf2a0ee7d Fix freefalling after MSS DC 2020-11-26 10:01:48 -05:00
Gent S e3568ea506 Fix viewableChunks memory leaks 2020-11-25 22:49:37 -05:00
Gent S b0aea27418 Fix player revive packet carrying wrong values
Oops
2020-11-25 20:38:48 -05:00
Gent S db98af9775 Fix chunk desync on revive 2020-11-25 17:50:57 -05:00
Gent S 07a1927b9f Force chunk update in sendPlayerTo 2020-11-22 19:22:33 -05:00
Gent S c5fa397724 Fix player entering chunks twice on load 2020-11-21 11:46:56 -05:00