Commit Graph

905 Commits

Author SHA1 Message Date
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
2017b38e23 [refactor] Move mob drop logic from Combat to ItemManager 2021-03-16 19:50:33 +01:00
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
gsemaj
dd41d5b610 [refactor] Split vendor functions and crocpot out of NPCManager 2021-03-15 10:48:27 -04:00
gsemaj
8981ad8c14 [refactor] Separate email functions out of BuddyManager into Email 2021-03-15 10:29:54 -04:00
df1ac82300 [refactor] Separate internal and external DB functions 2021-03-15 00:36:20 +01:00
ec67cc6527 CNServer::start() now uses an iterator instead of indexing repeatedly 2021-03-14 01:33:46 -06:00
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
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
e92a5a2f8b [refactor] Split ItemManager.cpp into Vendor.cpp & Trading.cpp
- added sources to Makefile
- Added Trading::init() to main.cpp
2021-03-12 20:09:45 -06:00
ce197d7db3 [refactor] Extract PlayerMovement.cpp from PlayerManager.cpp 2021-03-13 02:59:18 +01:00
f9c2587557 [refactor] Extract BuiltinCommands.cpp from PlayerManager.cpp
And move itemGMGiveHandler() from ItemManager.
2021-03-13 02:59:18 +01:00
2d7129111a [refactor] Refactor ChatManager
* 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
2021-03-13 02:59:18 +01:00
4cd3a3dabd [refactor] src/contrib, src/mingw -> vendor 2021-03-13 02:58:57 +01:00
f7e9cc2cea Disallow attaching the same item to an email twice
Also fix vendor buying validation not allowing crates to be bought,
since apparently their maximum stack size is 0 in TableData.
2021-03-10 00:13:46 +01:00
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
f5a34b9a3d Reject completion packets for missions that aren't in progress
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.
2021-03-09 18:30:58 +01:00
ffe5947925 Keep track of sold items so we can validate buyback packets 2021-03-09 16:45:38 +01:00
0fbdb1dad2 Improve sanity checks when opening crates and combining items
And ignore ITEM_MOVE packets while trading.
2021-03-08 22:31:25 +01:00
d781fae3ba Merge-in the general changes that were on the injusticefoe branch 2021-03-07 15:56:11 +01:00
3445c0bbc3 Tweaked mob and nano skills 2021-03-07 15:56:02 +01:00
540c37a523 Aggro is now affected by level 2021-03-07 15:56:02 +01:00
33a26cda7c Split mob heal types 2021-03-07 15:56:02 +01:00
dc6de46a1f Added ON_COMBAT trigger 2021-03-07 15:55:51 +01:00
c5e08b81da Implement /ban command 2021-03-07 00:38:24 +01:00
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
f2b1a84ef4 Fix segfault when redeeming more than four items at once 2021-03-06 02:09:21 +01:00
d5fe1cc513 Work around not being able to reach the shard from a local connection
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.
2021-03-05 19:00:13 +01:00
81c2a2a8b3 Mob Leech and Freedom 2021-03-05 14:34:08 +00:00
f7c84c62ed Possibly fixed item duping via trading 2021-03-05 14:18:36 +00:00
da8dde9818 Do not dynamically allocate memory in CNSocket::sendPacket()
Also reorder the rapid fire check in MobManager::pcAttackNpcs(), so the
output packet validation happens immediately before the buffer is
initialized, for clarity.
2021-03-04 19:51:43 +01:00
Gent
29dbe83a0b Skip item stacking logic if items not found in XDT 2021-03-04 11:22:01 -05:00
5fdef50f0f Fix failure to summon the highest NPC_ID
And update tdata.
2021-03-03 23:17:36 +01:00
217168fe50 Improve DB and Nano sanity checks
I'm aware that the DB checks still allow ID 0 items and Nanos, but the
point of those is primarily to prevent invalid memory access.
2021-01-27 02:27:08 +01:00
CakeLancelot
04a17ed862 Record claimed code items, and other misc DB fixes
* 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
2021-01-19 14:05:54 -06:00
74af1ad173 Set iOpt to 1 for mission rewards and disallow trading iOpt 0 items
Co-authored-by: Jade <jadeshrinemaiden@gmail.com>
2021-01-17 22:57:07 +01:00
34bd7c102f Validate emails as they're being sent 2021-01-06 14:30:25 +01:00
CakeLancelot
9e30e55669 eggBuffPlayer now takes duration, and buff duration is read from EggType 2021-01-06 05:56:54 -06:00
46b6d9fcc7 Include CNStructs.hpp in settings.cpp for the ACADEMY define
This fixes the spawn point being wrong.
2021-01-06 12:30:33 +01:00
2bf3fd0975 Further sanity checks for shops 2021-01-06 11:47:07 +01:00
442f85c7a6 Make paths.json academy-specific 2021-01-05 14:07:41 +01:00
b87229aa65 Reject requests to equip items into the wrong slot
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.
2021-01-05 13:17:59 +01:00
deca220d43 Do not auto-register all fast travel destinations for GMs
Instead, players with access level 50 or higher can use /registerall and
/unregisterall.
2021-01-05 12:44:38 +01:00
74e06f1084 Trading Refactor
- Its no longer possible to dupe items by stacking inventory slots in a trade.
- Stacked items work correctly now.
2021-01-04 23:57:50 +01:00
ddc7caf959 Basic Anti rapidfire 2021-01-04 23:57:50 +01:00
6baa0c5b07 Group related fixes
- Group adding is not leader only now
- Group buffs work now
2021-01-04 23:57:50 +01:00
d4eaf83354 Fixed Instancing Bugs 2021-01-04 23:53:44 +01:00
47d13ce39e Fixed Group Mob Retreat 2021-01-04 23:53:38 +01:00
2b95bc660c Fixed Quest Item Bug 2021-01-04 23:52:15 +01:00
0e3fac4d34 Updated tdata and changed how the default JSON paths are resolved 2021-01-04 17:08:44 +01:00
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
Gent S
954cfabde5 Add ID gaps for missing NPCs in Academy 2020-12-31 11:26:17 -05:00
966bd3edd2 Group members share the same mob drops
This includes quest items.
2020-12-31 14:13:14 +01:00
dab204ddaf If compiled for Academy, do not spawn NPCs in the Future zone 2020-12-31 14:13:08 +01:00
bad8ef1d10 Kill players that fall out of the map 2020-12-31 12:51:36 +01:00
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
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
55431362a7 Make sure the current race is cleared when leaving an IZ 2020-12-28 18:40:26 +01:00
07a930fe1c Fix vehicles in IZs for real this time 2020-12-28 18:40:26 +01:00
4060bf25b0 Fix recall removing FM pods if racing 2020-12-28 16:55:13 +01:00
9a79ab3927 Reduce mob range when racing as if the player were sneaking 2020-12-28 16:41:29 +01:00
fc45775666 Add /unwarpable command
GMs should use this before going to weird places where their non-GM
buddies might warp to them and get stuck.
2020-12-28 16:24:24 +01:00
81d0964971 Disallow warping to players using the MSS 2020-12-28 16:13:38 +01:00
868dc8485e Allow GMs to enter private instances 2020-12-28 16:12:57 +01:00
26f4767082 Add additional validation to the recall power 2020-12-28 16:12:23 +01:00
d97444cca5 Remove each group member's vehicle when warping into an instance 2020-12-28 00:50:58 +01:00
ee978e8bc9 Limit group member drops based on proximity 2020-12-27 21:14:16 +01:00
Gent S
bdf283ae4f Make heal nanos heal for the correct amount 2020-12-27 09:23:43 -05:00
f8129b91cb Zero both players' moneyInTrade when initiating a trade 2020-12-26 20:13:23 +01:00
afea9f436f Check if otherPlr is null in nanoRecallHandler() 2020-12-26 20:09:33 +01:00
7985fc475b Fix regression with spawning in an invalid Nano #37 2020-12-24 07:41:22 +01:00
959a708176 Return to the overworld instance when warping to a buddy 2020-12-24 06:05:05 +01:00
44fbb8e81f Fix other group members not respawning properly in Lairs 2020-12-24 05:22:46 +01:00
Gent S
7fe0e19bb0 Fix IZ races rewarding invalid items 2020-12-23 18:31:42 -05:00
Gent S
82d5455da6 Ignore race rewards for EPs that aren't found 2020-12-23 14:53:56 -05:00
Gent S
52389c2c69 Make code redemption case-insensitive 2020-12-23 13:50:12 -05:00
Gent S
ae75324153 Fix duplicate tasks on instanced mission failure 2020-12-23 13:50:12 -05:00
Gent S
a1a5815f1f Fix academy nano missions not going into the 0th slot 2020-12-23 13:50:12 -05:00
Gent S
772f80188e Prevent duplicate running tasks from loading into the Player struct 2020-12-23 13:50:12 -05:00
kamilprzyb
f28c643b48 Allow permanent vehicles 2020-12-23 13:50:12 -05:00
Kamil
5f82658c8d adjusted item codes logic to handle multiple items per code 2020-12-23 13:50:12 -05:00
50b2bdcb16 Fixed Nano Style Issues 2020-12-23 13:50:12 -05:00
Kamil
34dbb59fb1 Implement redeem codes 2020-12-23 13:50:12 -05:00
Kamil
a74c9be2ff Implement Nano capsules 2020-12-23 13:50:12 -05:00
fcdea2e723 Implement multiple-choice mission rewards 2020-12-23 13:50:12 -05:00
90191fd494 Add academy.json loading to TableData
This is where the permanent Academy-exclusive NPCs and mobs will be
loaded from. Resurrect 'Ems work now.
2020-12-23 13:50:12 -05:00
Gent S
effbbd9a5e Fix level-up not triggering and using wrong packets 2020-12-23 13:50:12 -05:00
bc7f4883a2 Add Academy defaults to the config file 2020-12-23 13:50:12 -05:00
e0808ffcbd Read the NPC ID limit from the XDT 2020-12-23 13:50:12 -05:00
9057f31bff Implement Academy level-up 2020-12-23 13:50:12 -05:00
0a9f637123 Do not give the Lightning Gun and Buttercup Nano to new Academy players
And do not mark the two missions from the old Tutorial as completed.
2020-12-23 13:50:12 -05:00
027f513a23 Save Academy Nanos to DB 2020-12-23 13:50:12 -05:00
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
0104bc9329 Enemy ability tweaks
- Battery drain does not set your battery below 0.
- Debuffs cast by enemies take into account intensity now. (Snare will work)
- Used int_max to replace arbitrary 20000, added more comments.
2020-12-22 12:12:02 -05:00
4fc5c092f8 Attack logic and various balance changes
- combatStep was altered, the mob can attack and give chase at the same time. Kiting melee mobs around is much harder.
- Mobs in general are more harder, closer to how it was in retro.
- Nanos styles are less detrimental to battle.
2020-12-22 11:30:57 -05:00
8d1bc94b7e Mission Handling Fixes
- Q. Item count glitches are dealt with
- Warping out now correctly rewinds missions.
2020-12-22 11:30:57 -05:00
322e354f5b Fix indentation in RacingManager.cpp and compilation on Linux 2020-12-22 14:46:09 +01:00
Gent S
8a2073d081 Fix racing timestamps 2020-12-22 01:04:46 -05:00
Gent S
e915c54ed0 Correctly set time limit, rank, and reward 2020-12-22 00:37:04 -05:00
Gent S
e953b51229 Add reward tables for racing 2020-12-22 00:36:39 -05:00
Gent S
b9013149f3 Racing cleanup 2020-12-21 21:02:19 -05:00
Gent S
e6da454c73 Finish racing DB integration 2020-12-21 16:18:08 -05:00
Gent S
598c7ce1d0 Add racing-related DB functions 2020-12-21 16:18:08 -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
Gent S
b81a3761b6 Load instance data from XDT 2020-12-21 16:18:08 -05:00
Gent S
45b8f8f581 Add RacingManager 2020-12-21 16:18:08 -05:00
c3d9883ddb Fix migration on Linux 2020-12-20 23:09:10 +01:00
Gent S
ea12ec9607 Use binary streams to make DB backups, since filesystem has low compat 2020-12-20 15:52:34 -05:00
Gent S
2e173df2ca DB v2 Tweaks 2020-12-19 21:17:07 -05:00
Kamil
1fb48536c2 created external sql file for tables and 1st migration 2020-12-19 20:00:47 -05:00
Kamil
002bfffb62 implemented db migration system 2020-12-19 19:15:14 -05:00
Kamil
140227406c implemented custom error messages in login screen for regex fail or banned account 2020-12-19 19:15:14 -05:00
26d0623d07 Fix Database::sendEmail()
* Do not define an sqlite_stmt* named stmt in a loop such that it shadows
an outer variable of the same name.
* Do not re-prepare a statement that has been reset.
2020-12-19 05:51:06 +01:00
f8a359dfe9 Do not truncate emails to 127 characters
And assert that we never supply a string long enough for
sanitizeText() to truncate.
2020-12-19 05:51:06 +01:00
Gent S
2f44243abb Please.... please take the slider.... 2020-12-18 20:48:09 -05:00
e3561e9d15 Change the default ports to match OG and Retro
The default monitor port can stay on 8003 for now.
2020-12-18 00:24:24 +01:00
80dabf4406 Finalize ALL the statements
* Fixed not being able to modify the DB externally while the script is
running
* Made most DB-related errors print the appropriate error string
* Fixed the settings looking for dbsaveinterval in the shard category
instead of the login category
* Added -shr and -wal to .gitignore (even though we're not actually
using WAL mode)

Hopefully the DB code is now free of resource leaks and undefined
behaviour.
2020-12-18 00:17:35 +01:00
Gent S
d3e5b9c485 Potentially fix slider collisions
- Lerp circuit once instead of on a per-slider basis to avoid FPE differences
- Spawn sliders every k points instead of once per stop
2020-12-16 20:37:12 -05:00
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
618a8d0a9f Reimplement NPC barking 2020-12-15 19:16:05 -05:00
d25e7ca4fc Implement rudimentary NPC scripting framework and Lord Fuse boss fight 2020-12-15 23:19:29 +01:00
3359ca0c3e Moved common NPC summoning logic into a helper function 2020-12-15 23:19:29 +01:00
0dd478b9f0 Tweak Lair respawns slightly
* Respawn the player in the air, not on the ground
* Do save the player's current instance, just to lessen the chance of
validation not catching stale recall coords.
2020-12-15 23:19:29 +01:00
Gent S
d03c4f109f Add chat dump to monitor 2020-12-15 09:58:11 -05:00
Gent S
792a317b48 Indicate high account level in logged player name 2020-12-15 09:53:45 -05:00
f74c40cf69 Prevent division by zero by also checking iWalkSpeed for 0 2020-12-15 02:11:18 +01:00
442d7853a5 In the absence of a Resurrect 'Em in a Lair, respawn at the entrance 2020-12-15 00:26:29 +01:00
fcd9b55ea7 Clean up formatting in Database.cpp
* Single quotes for strings
* Semicolons at the end of all commands
* No double colons around identifiers
* Spaces for alignment
* Some parts indented for readability

Not everything is perfectly consistent, but it should all be pretty
readable now.

Non-SQL changes:
* Opening braces shouldn't be on their own line
* Removed trailing spaces
* exit(1) should be used instead of terminate(0) during server init
2020-12-14 22:41:28 +01:00
Gent S
f1a2723274 Don't write mob HP to gruntwork 2020-12-14 10:00:07 -05:00
Gent S
5431d21d27 Always grab mob HP from XDT 2020-12-14 00:26:17 -05:00
454e0284af Remove vendored libsqlite from the repository
We now link to the system's library.

Windows implementation pending. MSVC build will be broken for a short
while.
2020-12-14 03:44:58 +01:00
Gent S
94b7864b02 Shut up warnings 2020-12-13 20:52:59 -05:00
Gent S
166bfdfc4f Terminate if existing DB doesn't have meta table 2020-12-13 20:43:24 -05:00
Gent S
156e9bf902 Fix newline characters being stripped from emails 2020-12-13 20:18:36 -05:00
Gent S
c8ff130b78 Update buddy warp to new DB 2020-12-13 19:54:09 -05:00
Gent S
ec23e72215 Notify client of email send failure 2020-12-13 19:51:31 -05:00
Gent S
a1274756ce Fix guide not getting updated in new DB 2020-12-13 19:51:09 -05:00
Kamil
05f4746af4 "Created" meta column + cleanup 2020-12-13 19:51:09 -05: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
Kamil
66ecc45fce Change SkyWayFlags to blob for consistency 2020-12-13 19:51:09 -05:00
Kamil
7aef973ef1 Add meta table to DB 2020-12-13 19:51:09 -05:00
Kamil
a12faac0e2 Account level changes
tied account levels to accounts instead of players. implemented account banning logic in db
2020-12-13 19:51:09 -05:00
Kamil
4dc48198ab Implement player blocking 2020-12-13 19:51:09 -05:00
Kamil
3e855cbdac Close DB properly 2020-12-13 19:51:09 -05:00
Kamil
889fc985c4 Reimplement the bank 2020-12-13 19:51:09 -05:00
Kamil
c709d458f4 Fix iterators and query typo 2020-12-13 19:51:09 -05:00