Commit Graph

1072 Commits

Author SHA1 Message Date
gsemaj 306a75f469 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-08-19 20:46:41 +00:00
gsemaj e4e4a421f4 Get rid of player fire rate suspicion
This was super primitive & jank, and caused false positives.
Will replace with a polished system later on.
2023-08-19 20:46:41 +00:00
gsemaj 2f612ce0e1 Handle case where cmake is invoked outside root 2023-08-19 20:46:41 +00:00
gsemaj 760170af94 Start moving passive power processing to `playerTick` 2023-08-19 20:46:41 +00:00
gsemaj 2f4c8cdd60 Groundwork for new buff system 2023-08-19 20:46:41 +00:00
gsemaj c8f5aab929 Active power classification 2023-08-19 20:46:41 +00:00
gsemaj 9f74b7decb some struct reorg 2023-08-19 20:46:41 +00:00
gsemaj eea4107665 Replace group filter operator with function 2023-08-19 20:46:41 +00:00
gsemaj ad53ec82af Ignore .bak files
for my local backups lol
2023-08-19 20:46:41 +00:00
gsemaj 22c93ac854 Refactor player groups
Group structures are used now. Adds more checks in some places but simplifies things overall.
We can expand this system to entities as well now pretty trivially.
2023-08-19 20:46:41 +00:00
gsemaj 710300c04c (WIP) EXPERIMENTAL GROUP CHANGES 2023-08-19 20:46:41 +00:00
gsemaj 04221f1c5f (WIP) TODO ABILITIES 2023-08-19 20:46:41 +00:00
gsemaj 828f49cd62 Move mob aggro logic into `takeDamage` override
God that feels good
2023-08-19 20:46:41 +00:00
gsemaj 4f49bcea87 (WIP) Move away from rigid states/transitions to allow custom behavior 2023-08-19 20:46:41 +00:00
gsemaj f6094fde58 EntityType -> EntityKind 2023-08-19 20:46:41 +00:00
gsemaj 595dcda1b7 (WIP) onRoamStart hook implementation 2023-08-19 20:46:41 +00:00
gsemaj b6f15824f1 (WIP) Remove `BaseNPC::barkerType` to save space 2023-08-19 20:46:41 +00:00
gsemaj 35e938b8c6 ope 2023-08-19 20:46:41 +00:00
gsemaj 345c9cd3b2 (WIP) onCombatStart hook implementation 2023-08-19 20:46:41 +00:00
gsemaj 68d53feea3 (WIP) onDeath hook implementation 2023-08-19 20:46:41 +00:00
gsemaj 45742e90a2 (WIP) Add src param to transition + certain hooks
Should all hooks have src? I think not
2023-08-19 20:46:41 +00:00
gsemaj 69a478b777 (WIP) Transitions + hook definitions + onRetreat hook implementation 2023-08-19 20:46:41 +00:00
gsemaj c32e5b2d5e (WIP) Point 2: Generalization 2023-08-19 20:46:41 +00:00
gsemaj 3d572432b3 (WIP) Point 1: step functions 2023-08-19 20:46:41 +00:00
gsemaj 0c4cdaeabf (WIP) Start implementing ICombatant
Start by replacing `hitMob` with `takeDamage` interface function.
Simplify `pcAttackChars` a little by utilizing the new interface, then add more interface functions as needed.

A lot of the combat logic is tied to the `Mob` class. Need to start moving stuff over to CombatNPC.
2023-08-19 20:46:41 +00:00
gsemaj ed866fbee4 (WIP) Move ICombatant functions around a bit 2023-08-19 20:46:41 +00:00
gsemaj 5ab0112298 (WIP) Initial ICombatant draft 2023-08-19 20:46:41 +00:00
dongresource 4494ba5932 [refactor] Get rid of NPC.hpp
This file was already obsoleted at the start of the refactor, but seems
to have escaped notice until now.
2023-08-19 20:46:41 +00:00
dongresource 803073213e [refactor] Replace a few uses of magic numbers with enums 2023-08-19 20:46:41 +00:00
dongresource 4153d5cd30 [refactor] Cosmetic cleanup in Fuse fight functions 2023-08-19 20:46:41 +00:00
dongresource 71f1f6edb9 [refactor] Remove redundant coord args from most entity constructors
Mobs and CombatNPCs still need theirs in order to properly set their
roaming and spawn coords. Assignment of the latter has been moved to the
CombatNPC constructor, where it should have already been.
2023-08-19 20:46:41 +00:00
gsemaj 32fad56d38 [WIP] Stub power handler 2023-08-19 20:46:41 +00:00
gsemaj af7b99195f [WIP] Use EntityRef instead of CNSocket in ability handler 2023-08-19 20:46:41 +00:00
gsemaj efc00e63b3 [WIP] Replace appearance data with individual fields
Storing certain things in appearance data and others in their own fields
was gross. Now everything is stored on the same level and functions have
been added to generate appearance data when it's needed by the client.
2023-08-19 20:46:41 +00:00
gsemaj 7ab01b098d [WIP] Rename Entity.type -> Entity.kind 2023-08-19 20:46:41 +00:00
gsemaj 32db574700 [WIP] Fix Nanos -> Abilities namespace calls 2023-08-19 20:46:41 +00:00
gsemaj c965024d1c [WIP] Initial merge of ability namespaces & features 2023-08-19 20:46:41 +00:00
gsemaj 650f947451 Add .dockerignore file
Fixes an issue where if you had a version.h file generated from cmake,
it would be used in the Dockerfile even though the container uses make.
2023-08-19 18:22:21 +00:00
gsemaj b12aecad63
Fix vscode launch configs for Windows 2023-07-11 13:52:22 -04:00
gsemaj 5bf0c8f3ea
Add launch configurations for vscode 2023-07-11 12:29:47 -04:00
gsemaj 2ddc956c9b
Fix sqlite casing and syntax error in cmakelists 2023-07-11 12:29:08 -04:00
gsemaj 4f0ae027a5 Add Dockerfile and docker-compose 2023-06-30 03:31:45 -04:00
dongresource 23ab908366 Refuse to start if there are invalid NPC types in the JSONs
This fixes an issue where there server would start up fine even if NPC
types from a later build were found in the gruntwork file. Because of
the semantics of the C++ array indexing operator, the index into NPCData
in loadGruntworkPost() would silently create extra entries in the
nlohmann::json array, which would break future NPC type limit checks and
subsequently crash the server at the next invocation of /summonW, and
likely other places.

We fix this by refusing to start the server if any invalid NPC types are
found, because simply skipping them in the gruntwork file would silently
omit them from further writes to the gruntwork file, which would be
undesirable data loss.
2023-06-22 02:43:26 +02:00
dongresource be6a4c0a5d Enforce minimum supported libsqlite version
The server now checks the libsqlite both at compile time and on server
startup. The version the executable was built with and the one it's
running with may be different, so long as they're both at or above the
minimum supported version. One or both version numbers are printed on
startup, depending on if they're identical or not.

The compile-time ("Built with") version depends on the sqlite3.h header
used during compilation, while the runtime ("Using") version depends on
either:

* The sqlite3.c version used during compilation, if statically linked.
  (Which may be different from the header version and still compile and run
  fine.)
* The version of the libsqlite3.so or sqlite3.dll that the server
  loaded, if dynamically linked. Version mismatches here are normal,
  especially on Unix systems with their own system libraries.

The current minimum version is 3.33.0, from 2020-08-14, as that's the
one that introduced the UPDATE-FROM syntax used during login by
Database::updateSelectedByPlayerId().

Also rearranged the prints and initialization calls in main() slightly.
2023-03-19 01:41:07 +01:00
dongresource 8eb1af20c8 Clean up tdata file loading logic slightly
The earlier addition of empty file checks made it just a bit too cumbersome.
2023-03-13 21:42:59 +01:00
dongresource e73daa0865 Skip loadGruntworkPre() if there's no gruntwork
Previously, only loadGruntworkPost() would be skipped if the gruntwork
was null, but it was never null at that point because loadGruntworkPre()
would inadvertently create gruntwork["paths"] when it indexes it to
iterate through it.

Now, the gruntwork loading messages will no longer be misleadingly
printed to stdout when there isn't a gruntwork file.
2023-03-13 05:58:49 +01:00
dongresource 743a39c125 Tolerate empty gruntwork file
This prevents the server from failing to start if a gruntwork file
exists, but happens to be empty.
2023-03-13 05:18:27 +01:00
dongresource a9af8713bc Reject network messages too small for the packet size field 2023-03-12 01:45:18 +01:00
dongresource 4825267537 Use memcpy() instead of casting to load keys
UBSAN complains about the casting approach because it loads a 64-bit
integer from the defaultKeys string which isn't guaranteed to be 64-bit
aligned, which is undefined behavior.
2023-03-11 23:16:09 +01:00
dongresource a92cfaff25 Differentiate new connection messages on the login and shard ports 2023-03-11 21:54:56 +01:00