Commit Graph

49 Commits

Author SHA1 Message Date
gsemaj 82bee2051a
[refactor] Active power handling 2023-10-08 16:43:11 -04:00
gsemaj d32827b692
The great re-`#include`
Was getting frustrated by the inconsistency in our include statements,
which were causing me problems. As a result, I went through and manually
re-organized every include statement in non-core files.

I'm just gonna copy my rant from Discord:
FOR HEADER FILES (.hpp):
- everything you use IN THE HEADER must be EXPLICITLY INCLUDED with the exception of things that fall under Core.hpp
- you may NOT include ANYTHING ELSE

FOR SOURCE FILES (.cpp):
- you can #include whatever you want as long as the partner header is included first
- anything that gets included by another include is fair game
- redundant includes are ok because they'll be harmless AS LONG AS our header files stay lean.

the point of this is NOT to optimize the number of includes used all around or make things more efficient necessarily. it's to improve readability & coherence and make it easier to avoid cyclical issues
2023-10-08 16:34:18 -04:00
gsemaj 4b834579c5
[refactor] Remaining ICombatant implementation 2023-10-08 16:33:34 -04:00
dongresource 129d1c2fe3 Use a specialized null value for ChunkPos
This prevents logic errors related to being in chunk 0 0 0.

Also:

* Moved some duplicated chunk teleportation logic to a new helper
  function
* Made ChunkPos into a proper class so it can default to INVALID_CHUNK
  when default-initialized
* Reversed the inclusion order of Chunking.hpp and Entities.hpp to work
  around problems with type definitions
2022-07-24 21:36:03 +02:00
CakeLancelot aa028392f0 Fix #205 - if a player times out a race, warp them back to the start 2021-04-25 15:41:39 -05:00
dongresource 0c8e209360 [WIP] Convert all chunk-related logic to the new system's semantics
Replaced all references to chunk->players and chunk->NPCs with
chunk->entities and all instances of the old NPCClass enum with
EntityType.

The server compiles but will not yet run properly.
2021-03-31 22:28:27 +02:00
dongresource 7f9cdfc9ae Use direct members instead of pointers for viewableChunks and buyback
We had avoided putting STL containers into Players back when we thought
Players was still POD and needed to remain POD, but it turned out that
neither were the case all along, so there's no need for the indirection.
2021-03-31 21:10:54 +02:00
dongresource 688f13e649 [refactor] Implement generic, validating sendPacket() wrapper 2021-03-31 21:10:54 +02: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 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 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 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
Kamil bd3a91e530 Properly implement first use flags 2020-12-13 19:51:09 -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 e50a4c2edd Experimental chunk refactor. 2020-11-19 17:37:02 -05:00
Gent S 5cbb8538c0 Get rid of PlayerView. For good. 2020-11-19 17:36:49 -05:00
Gent S 8ad3f3aabd CHUNKPOS macro -> ChunkPos typedef 2020-11-16 09:59:53 -05:00
Gent S b22ba781c8 Possible fix for chunking desyncs + CHUNKPOS macro 2020-11-15 14:41:56 -05:00
dongresource a1145aced4 Chat strings are now sanitized.
* Only plain, printable ASCII is allowed for now.
* Local chat is now printed to the server console, but group chat is
still private
* Added a helper function to print character names and IDs
2020-10-31 21:31:25 +01:00
Gent d4aed0abf4 Add support for unique instances 2020-10-15 11:46:53 -04:00
Zenpock bd34bb294c Instance Stuff
custom instance commands
warping takes you into instances
npcs show up only in the instance they are supposed to be inside.
2020-10-15 11:44:15 -04:00
dongresource 5a80c53e79 Remove the pointer to the deallocated chunk from the current player/NPC.
This fixes the Great Crash Bug(tm).
2020-10-15 04:36:38 +02:00
JadeShrineMaiden b8f586bc10
Groups, Group Nano powers and Revive (#129)
* Initial Group Implementation

* Request/refuse/join and leave groups.
* Chat into groups.
* Get status updates on every group member each tick.
* Owner leaving the group destroys the entire group.

* Added more nano powers

* Revive for both variants work.
* Many nano powers now have a group variant working.
* Enemy checks for aggro before retreating.
* Enemies keep aggro on dead players with revive nanos out.

* Further Nano powers + Bugfixes

* Infection damage now relies on bitcondition flags.
* Antidote power now works.
* Improved how groups handle leaving players.
* Fixed mob aggro range.
* Group Healing is now functional.
* Possibly fixed the player being unselectable bug.
* Fixed indentations.

* Dismiss nano when starting a MSS ride

* Sneak, Invisibility and Bugfixes

* Sneak and invisibility affect mob aggro.
* Possibly bugfixed equips not showing to other players.
* Aggro checking is less likely to cause nullptr related crashes.

* Group PR cleanup.

* Made sure to label all hacky workarounds
* Implemented the Antidote nano power the right way
* Cleaned up the way various little things are written

Didn't have the opportunity to actually test groups.

Co-authored-by: CakeLancelot <CakeLancelot@users.noreply.github.com>
Co-authored-by: CPunch <sethtstubbs@gmail.com>
Co-authored-by: dongresource <dongresource@protonmail.com>
2020-10-05 01:54:08 +02:00
Gent a9837d6c1b Finish MSS commands + convert stack to vector 2020-10-03 11:24:45 -04:00
Gent 1b55ab44e3 Add helper function to get socket from player ID
Co-authored-by: Jade <jadeshrinemaiden@gmail.com>
2020-10-02 17:02:31 -04:00
CPunch 4cd7b7cb53 added basework for instancing 2020-09-30 20:44:37 -05:00
JadeShrineMaiden efb3df7133 Implemented GM SpecialState Handling
Co-authored-by: dongresource <dongresource@protonmail.com>
2020-09-27 22:19:21 +02:00
Gent db33ca2bbb Prevent player position from updating when flying
Only chunk is updated instead to maintain visibility
2020-09-24 18:43:58 -04:00
Gent 7dfc888552 Basic slider implementation 2020-09-23 00:08:51 -04:00
CPunch f4db0830ba huge refactoring, chunking added 2020-09-17 17:45:43 -05:00
dongresource f7571607ba Only send live checks when the connection has been silent for a while.
Also:
* Made the timeout configurable
* Removed the stale randomcharacters config option
* Switched to time_t for time values, even though it doesn't really
matter that much
* Halved the keepAliveTimer frequency
2020-09-16 17:45:53 +02:00
kamilprzyb fc57cae37d added saving character when a connection with shard is killed 2020-09-14 01:38:04 +02:00
kamilprzyb 11801c1f89 Rewrote DB to use ORM, added all remaining features to LoginServer and refactored it 2020-09-02 00:37:09 +02:00
dongresource 72a811d6ab Implemented guide changing.
This means the Time Machine works as well.
2020-08-28 22:22:24 +02:00
dongresource d964a83d6d Respawn points work now.
Note that some of them weren't present in clientnpc and will need to be
manually added later.
2020-08-25 03:34:53 +02:00
dongresource 14bc368073 Dynamically allocate the Player struct in PlayerView.
This way we're not always passing it around by value.
Note that the Player structs in CNSharedData are still
pass-by-reference. Will probably change this later.
2020-08-25 00:59:55 +02:00
Onii-chan afbf309c7e
Add player revive, vehicle mount/dismount and more (#33) 2020-08-24 16:04:56 -05:00
dongresource 651ccba932 Replace ifdef guards with #pragma once
tl;dr this has potentially significant compilation speed benefits.
2020-08-23 19:14:54 +02:00
CPunch 0d27412d81 added getNearbyPlayers 2020-08-23 10:42:37 -05:00
CPunch 35b424c531 fixed warnings for VC++ 2020-08-22 13:38:27 -05:00
Onii-chan 56bf0db20d
Added more nano features (commands, equip & unequip, powers) (#26)
* Revert "fixed window build"

This reverts commit b94f602537.

* Revert "Revert "fixed window build""

This reverts commit dac4457ed2.

* Add nano power feature

* Update CNShardServer.hpp

* Update CNShardServer.hpp

* Test: Add nano power feature

Nano powers are set to the first power in its selection by default.

* Update NanoManager.cpp

* Test: More nano features

* Update NanoManager.hpp

* Update PlayerManager.hpp

* Update PlayerManager.cpp

* Updated indentations

* Update PlayerManager.cpp

* Add DEBUGLOG()

Co-authored-by: CPunch <sethtstubbs@gmail.com>
2020-08-22 13:02:08 -05:00
CPunch 6857f50c30 added basic NPCManager 2020-08-20 16:43:48 -05:00
CakeLancelot 14d556976d Add zipline, slide, cannon, and jump pad packets
Cannon still looks wonky from other player's PoV, something's up with the rotation - will investigate later.
2020-08-20 11:26:26 -05:00
CPunch f2059c9ce1 merged motd and exit patch by dongresource 2020-08-19 12:22:54 -05:00
CPunch 24d30a05bf added heartbeat support 2020-08-18 20:34:39 -05:00
CPunch 9d366e3720 inital commit 2020-08-18 15:42:30 -05:00