This fixes a UX issue, where if you accidentally capitalized a letter
in the username when logging in, it would instead create a new account.
The behavior was confusing, since to the user it looks as if their
characters were deleted or progress was not saved.
In order for this to work, duplicate accounts (e.g. username and USERNAME)
need to be deleted/renamed. The server will *detect* if any duplicates
exist. If any are found, it will direct the server operator to a pruning
script, or they can choose to resolve the duplicates manually.
This wasn't strictly necessary as this command has outlived its
usefulness, but I had gone ahead and rewritten it because it was (barring
taskStart()) the only place in the codebase that accesses Chunking::chunks
outside of Chunking.cpp. This became apparent during a (currently paused)
effort to improve the API that the Chunking namespace exposes to the
rest of the codebase.
I went ahead and rewrote the rest of this command as it was poorly
implemented anyway. This has been sitting in my working directory
uncommitted for a few months, so I may as well push it.
Explanation: it was uncertain whether mobs could perform critical hits, since the color of damage numbers didn't change at all. However, I found that male characters will actually use a different sound effect when receiving a crit (I confirmed this SFX appeared in old FF videos), so I went ahead and re-enabled it.
The server administrator must now specify which patches they want the
server to load (if deviating from the defaults). There are multiple
reasons for this:
* It's useful to be able to pick and choose which patches you want to
boot the server with; without having to move the directories in and out
of the patch directory
* This way, we can have different default patches for different builds
of the game (104 vs 1013)
* ...ergo, it's easier to rapidly switch builds without having to
rearrange your workspace to properly run them
* This also allows us to remove the std::filesystem stuff, which has
spotty compatibility with slightly older (but still current) versions of
the compilers
* Players can no longer complete tasks that aren't in their journal
* Minimum level requirement is now enforced when starting missions
* You can no longer start missions that are already completed
* Implement TASK_START_FAIL for when startTask() returns false
Instead of ringCount, there is now a set of all ring IDs collected during the race.
Note: further validation measures are still required to ensure legitimate times/scores
- fixed many references to Entity.appearanceData.i[XYZ] to use the base Entity XYZ values
- BaseNPC::enterIntoViewOf grabs the position from the base Entity XYZ values
- NPCManager::updateNPCPosition updates the base Entity XYZ values
- MobAI.c/deadStep() also sends it's packet based on the Entity XYZ values
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.
Player and all NPCs now have a common superclass, with virtual functions
so smooth over shared behavior. EntityRef is a simple class that points
to an arbitrary Entity.
This commit is not yet functional.
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.
This change subtly broke the poll() loop when a connection was removed,
because erasing an entry from fds would invalidate the iterator that
was still being used.
This reverts commit ec67cc6527.
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.
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.
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.
* 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
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.
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.
* Extracted all commands into CustomCommands.cpp
* Moved all chat-related packet handlers into ChatManger.cpp
* Cleaned up redundant includes
* Unified handler naming scheme
* Made all command handlers in CustomCommands.cpp static
Also reject players requesting more than 6 missions.
This is just a minimal measure to prevent replaying mission completion
packets. This part of the codebase will be largely refactored soon, so
more through changes can wait.
In certain circumstances, like when running a private server through
Hamachi, the shard IP will be set to an address the local machine can't
reach itself from, preventing only the local player from getting past
character selection. This workaround detects local connections and
sends a loopback address for the shard instead of the configured one.
This makes those use cases feasible.
Also reorder the rapid fire check in MobManager::pcAttackNpcs(), so the
output packet validation happens immediately before the buffer is
initialized, for clarity.
* Create new table to store redeemed codes
* Check if a player already used a code when using /redeem
* Change Coordinate columns to non-plural form
* Fixed EmailItems unique constraint not being specific enough
* Bumped DB version to 3
This is important because the client can genuinely send such an invalid
packet by mistake during normal gameplay.
If a sanity check fails, we don't need to send any sort of "move it but
keep it where it is" packet, since simply ignoring the invalid request
doesn't softlock the client.
Also improved validation of inventory slot indexes.