Commit Graph

852 Commits

Author SHA1 Message Date
CakeLancelot
bab17eb23f
Mobs can now get criticial hits
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.
2021-09-05 13:34:27 -05:00
CakeLancelot
aaaf03128a
Don't aggro to players using MSS 2021-09-05 13:23:05 -05:00
gsemaj
0accd1f345 Make sure a vendor is actually selling the item a player wants to buy 2021-06-20 10:15:02 -04:00
CakeLancelot
bb12a60e04 Cleanly remove player after triggering rapidfire anticheat
Previously, the socket was killed but the player was still technically present.
2021-05-27 00:12:44 -05:00
CakeLancelot
8326ea6e26 Fix sliders stopping in place after one round-trip 2021-05-16 14:39:45 -05:00
Jade
81cc19f985 Fix failed task QItem handling, implement /itemQ command 2021-05-14 14:24:35 -05:00
Jade
19fd4ecb83 Various fixes in Trading.cpp 2021-05-14 14:21:18 -05:00
CakeLancelot
243e4f6d50 Add a fallback to racingCancel if a respawn point isn't found
Fixes segfault when canceling or timing out race in Mandark's House Future.

Also expanded on the comment for why this respawn is necessary.
2021-05-14 14:10:19 -05:00
gsemaj
6f59001be1 Only loop NPC movement if the NPC has a looping path assigned
Allows paths to terminate.
Also fixes a bug where follower NPCs sometimes oscillate their positions.
2021-05-09 08:38:14 -04:00
gsemaj
e5d9e7217e Fix potentially expensive copying of ChunkPos in escort path assignment 2021-05-09 08:36:45 -04:00
5c1bb0acc9 Add enabledpatches config option
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
2021-05-07 21:29:18 +02:00
gsemaj
32daa68458 Clean up /path command handler 2021-05-06 12:17:34 -04:00
gsemaj
2d7aa3c536 Fix EOL in settings.cpp 2021-05-06 12:17:34 -04:00
gsemaj
eb8ec85746 Scan all chunks in instance instead of in view for escort missions 2021-05-06 12:17:34 -04:00
gsemaj
a90ba9ea08 Assign paths with matching taskIDs to escort tasks on task start 2021-05-06 12:17:34 -04:00
gsemaj
974b67d4b6 Move constructPathNPC to Transport 2021-05-06 12:17:34 -04:00
gsemaj
6ae4ab2cbf Move findApplicablePaths to Transport, add taskID argument 2021-05-06 12:17:34 -04:00
gsemaj
9fb41342b3 Fix server crash if patch folder doesn't exist 2021-05-06 12:17:34 -04:00
gsemaj
0ccc66208d Added /path here 2021-05-06 12:17:34 -04:00
gsemaj
ebd3b7b75a Fix path matching breaking prematurely 2021-05-06 12:17:34 -04:00
gsemaj
d41122157f Fix gruntwork paths not saving targeted types 2021-05-06 12:17:34 -04:00
gsemaj
917407f164 Apply finished NPC paths immediately 2021-05-06 12:17:34 -04:00
gsemaj
c393bf7af2 Prioritize ID match over type match when finding a path for an NPC 2021-05-06 12:17:34 -04:00
gsemaj
72b62cd5a4 Don't load NPCs with types not found in the XDT 2021-05-06 12:17:34 -04:00
gsemaj
e508a06eca Automatically flush gruntwork after /path end 2021-05-06 12:17:34 -04:00
gsemaj
f71d2581bd Read completed NPC paths from gruntwork 2021-05-06 12:17:34 -04:00
gsemaj
89a32ac9a4 Write completed NPC paths to gruntwork 2021-05-06 12:17:34 -04:00
gsemaj
c7e2e66a51 Add /path command 2021-05-06 12:17:34 -04:00
gsemaj
37b1d11948 Fix JSON type ambiguity in loadPaths 2021-05-06 12:17:34 -04:00
gsemaj
c960b06227 Apply matching paths to NPCs and mobs on spawn 2021-05-06 12:17:34 -04:00
gsemaj
2721f21427 Fix gruntwork file being flushed to root 2021-05-06 12:17:34 -04:00
gsemaj
d5e65fda3c Update to new path schema + add NPCPath struct 2021-05-06 12:17:34 -04:00
gsemaj
5f29ea93d8 Undo pathing check bypass + update to patched academy tdata 2021-05-06 12:17:34 -04:00
gsemaj
36cb32454d Add force property override feature to patcher
This has a variety of applications, but is particularly useful when we want to replace arrays instead of add onto them
2021-05-06 12:17:34 -04:00
gsemaj
af8dd61967 Clean up tabledata init 2021-05-06 12:17:34 -04:00
gsemaj
26894c8a69 Implement automatic tdata patching 2021-05-06 12:17:34 -04:00
gsemaj
bf12ed4c47 Fix patcher refusing to patch between unsigned and signed integers 2021-05-06 12:17:34 -04:00
gsemaj
59303ba30d Update tdata to patch format, change config constants accordingly 2021-05-06 12:17:34 -04:00
gsemaj
b2a8b86e4c Temporarily disable spawn check for mob pathing 2021-05-06 12:17:34 -04:00
gsemaj
0c05fc4add Offset NPC IDs by 1 to avoid ID 0 2021-05-06 12:17:34 -04:00
gsemaj
c415db3fd3 Implement recursive JSON patching functionality 2021-05-06 12:17:34 -04:00
gsemaj
183586afe4 [refac] Clean up new tdata init routine 2021-05-06 12:17:34 -04:00
gsemaj
e546d3948c [refac] Stop using WarpLocation for coordinates and introduce a Vec3 2021-05-06 12:17:34 -04:00
gsemaj
a0e758f5b7 [refac] Move WarpLocation to Transport.hpp 2021-05-06 12:17:34 -04:00
gsemaj
f58c6b72b3 [refac] Stylistic changes 2021-05-06 12:17:34 -04:00
gsemaj
805fd93b3c Remove academy-specific tdata settings, add patch path 2021-05-06 12:17:34 -04:00
gsemaj
4bcf3af90f Use static JSON key as NPC ID for NPCs and mobs 2021-05-06 12:17:34 -04:00
gsemaj
e761c700dc [refac] Compartmentalize TableData.cpp 2021-05-06 12:17:34 -04:00
gsemaj
14562f889e [refac] Create typedef for nlohmann::json 2021-05-06 12:17:34 -04:00
gsemaj
dd3066849b Make dynamic IDs count down from max instead of up from 0 2021-05-06 12:17:34 -04:00
2658ed5900 Check if the destination chunk exists after leaving the source chunk
This fixes a crash if a player does a /refresh in the zeroeth chunk.
2021-05-02 19:51:59 +02:00
33ea5af8b7 Added speed to CombatNPC
- Mob's constructor sets speed
- MobAI.cpp now uses mob->speed
2021-04-29 19:20:53 -05:00
FinnHornhoover
5517a358ea removed eventcratechance config 2021-04-26 11:26:00 -04:00
FinnHornhoover
4eaf3b2f08 altered event drop logic, fixed taro/fm logic 2021-04-26 11:26:00 -04:00
FinnHornhoover
44fd66b511 restored getTime in rand gen 2021-04-26 11:26:00 -04:00
FinnHornhoover
001a0b8d4b removed drop type field in mobs 2021-04-26 11:26:00 -04:00
FinnHornhoover
20b05a72a0 added mob drop id lookup from mob id 2021-04-26 11:26:00 -04:00
FinnHornhoover
78b87d0f61 register altered rarities correcty in rarity roll 2021-04-26 11:26:00 -04:00
FinnHornhoover
527ca817d5 revised getRarity set logic 2021-04-26 11:26:00 -04:00
FinnHornhoover
80b11b4364 removed my "debugger" 2021-04-26 11:26:00 -04:00
FinnHornhoover
6f636b77f2 rarity index fix for egg crates 2021-04-26 11:26:00 -04:00
FinnHornhoover
8a871f7045 merged itemset types and chances, added bypasses 2021-04-26 11:26:00 -04:00
FinnHornhoover
1779d69078 drop format revision 2021-04-26 11:26:00 -04:00
FinnHornhoover
30de9f668c reference fix 2021-04-26 11:26:00 -04:00
FinnHornhoover
78b17aea72 added better drop handling, parsing, rng 2021-04-26 11:26:00 -04: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
CakeLancelot
f0e21b5051 Fix #198 - dismount packet is now sent if unequipping a vehicle 2021-04-24 23:55:13 -05:00
gsemaj
80d965944c Fix naming scheme in NPCs.json 2021-04-24 11:36:33 -04:00
CakeLancelot
e9709805b7 Mission validation improvements
* 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
2021-04-20 15:38:51 -05:00
gsemaj
fa7c88e214 Rename Vendor.Xpp -> Vendors.Xpp 2021-04-16 13:37:18 -04:00
gsemaj
588e941d3c Fix eggs not entering chunks and add update tabledata 2021-04-16 12:30:22 -04:00
CakeLancelot
fde4a5ff34 Prevent players from collecting the same pod twice in races
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
2021-04-13 21:17:21 -05:00
9b84d9dc4d [refactor] BaseNPC now uses Entity XYZ fields for handling positions
- 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
2021-04-13 20:03:51 -05:00
48fb510b53 Fix playersInView miscount for dead mobs 2021-04-08 19:25:30 +02:00
gsemaj
fd965fbf03 Remove redundant Mob map 2021-04-07 03:03:43 +02:00
65462d01e3 Generalize NPC AI stepping logic
The MobAI::Mobs map still needs to be removed.
2021-03-31 22:28:27 +02:00
3325397d17 Remove Eggs::Eggs and rearrange Entity members a bit 2021-03-31 22:28:27 +02:00
22678fcfc2 Initialize all members of all Entity-derived classes
Also moved some logic out of Mob into CombatNPC.
2021-03-31 22:28:27 +02:00
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
224ffe05e7 [WIP] Convert most of Chunking to Entity-based system
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.
2021-03-31 22:28:27 +02:00
49f1cb0f00 Fix PC_ATTACK_NPCs not being marked as variadic 2021-03-31 22:27:54 +02:00
CakeLancelot
a57953393d [refactor] Convert CNLoginServer handlers to new sendPacket() wrapper
Also remove malformed packet checks, since that is already validated
2021-03-31 21:10:54 +02:00
CakeLancelot
b428eb08e9 [refactor] Continue work on switching over to new sendPacket() wrapper
I also moved the give nano GM command to BuiltinCommands, and added a perms check

Haven't checked the following files yet:
Eggs
Groups
Missions
MobAI
2021-03-31 21:10:54 +02:00
CakeLancelot
4a22449f5e [refactor] Switch a bulk of the codebase to the new sendPacket() wrapper
Remaining files to go over:
Nanos
NPCManager
Racing
Trading
Vendors
2021-03-31 21:10:54 +02:00
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
8afe175bd1 No reason not to include the Academy packet in there 2021-03-31 21:10:54 +02:00
0f687cc6b3 [refactor] Remove redundant packet size checks
Done with a vim macro, since I didn't want to bother hacking up a
multi-line deletion script in sed or awk (or Python).
2021-03-31 21:10:54 +02:00
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
688f13e649 [refactor] Implement generic, validating sendPacket() wrapper 2021-03-31 21:10:54 +02:00
ef7d0148c6 [refactor] Validate all inbound packets before handling them 2021-03-31 21:10:54 +02:00
7c7d9f1be8 Revert "CNServer::start() now uses an iterator instead of indexing repeatedly"
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.
2021-03-31 21:07:47 +02:00
CakeLancelot
919c14be0d Include CNStructs in settings.cpp so the ACADEMY define gets picked up 2021-03-20 18:53:22 -05:00
124ea33959 Disallow vehicles in non-overworld instances 2021-03-19 02:20:13 +01:00
69266d1cda Added Chat and Egg initalizers to main() 2021-03-17 23:46:30 -05:00
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
610a683804 [refactor] E g g s 2021-03-17 22:28:24 +01:00
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
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
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
04c56ce426 [refactor] Move Croc Pot logic to Vendor.cpp 2021-03-16 21:08:08 +01:00