Commit Graph

630 Commits

Author SHA1 Message Date
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
Kamil
0e016646ef Properly implement PayZoneFlag and fix safe coord loading
implemented saving PayZoneFlag (is player in the past) and fixed saving coordinates properly with monkeys/instances
2020-12-13 19:51:09 -05:00
Kamil
960f2dd10c Adjust login server logic to new DB 2020-12-13 19:51:09 -05:00
Kamil
2bad1252d3 Small DB fixes 2020-12-13 19:51:09 -05:00
Kamil
31ac9d2e3b Reimplement DB functions 2/2
implemented getCharInfo
implemented delete character
implemented evaluateCustomName
implemented name change function
implemented getPlayer function
implemented functions for buddies
implemented emails
2020-12-13 19:51:09 -05:00
Kamil
eeb3b1ee61 fixed a lot of queries 2020-12-13 19:51:09 -05:00
Kamil
4bf35e5239 added some unique constraints 2020-12-13 19:51:09 -05:00
Kamil
2f5c2a8764 Reimplement DB functions 1/2
implemented addAccount
implemented updateSelected
implemented findAccount validateCharacter isNameFree and isSlotFree
implemented getTableSize function
implemented functions for name save, character creation and finishing tutorial
2020-12-13 19:51:09 -05:00
Kamil
34ca36062c Create basic tables 2020-12-13 19:51:09 -05:00
Kamil
a1062f220b Open DB from settings path 2020-12-13 19:51:09 -05:00
Kamil
c2f640fd97 RIP ORM 2020-12-13 19:51:09 -05:00
actuallyamoose
143bb00ac0
Added checks to prevent buddy warping and item sending across time (#183) 2020-12-13 19:05:11 -05:00
JadeShrineMaiden
b947ff65cf
Various bugfixes
- Eruption is now blocked by stun and sleep.
- Corruption should block all nano abilities.
- Buffs time out for other players
- Timed mission bugfixes (AGAIN)
- Corruption and Eruptions fire quicker.
- Heal egg ids fix
- No power nanos no longer break the system.
- Mobs should no longer restun.
- Mob ability chance calculation adjustments.
- Duration of the power's debuff is sent as iDamage instead of 0, this removes the ugly "Block" that shows up on successful hits.
- Group mob respawning bugfixes
- a bit of a cleanup
2020-12-12 17:22:22 -05:00
1474ff10ac Slight adjustments to the poll() loop
Recheck the entry at the current index after we remove one. This isn't
strictly necessary, since the next pass will get it anyway.

Using a vector as opposed to our own realloc()'d array means indexing
beyond the size() is undefined behavior, so it's better to be safe.
2020-12-12 01:27:28 +01:00
974941f4fa Close our end of the connection when we receive an EOF
This should/might fix the server's CPU usage spiking to 100%.
2020-12-12 01:27:13 +01:00
Gent S
2834891727 Properly output socket errors on Windows 2020-12-08 17:22:14 -05:00
ada8af0b82 Print informative error messages for socket operations
Windows implementation pending.
2020-12-08 15:23:58 -05:00
86e0b1bc13 EINTR is not crash-worthy
This is how it should have been handled anyway. This fixes a (benign)
race condition when the server is killed, as well as gprof builds.

Also updated tdata.
2020-12-08 20:10:02 +01:00
Gent S
d5409ed3f1 Replace bad continue statement with goto in monitor socket iteration 2020-12-08 14:05:34 -05:00
811c9d4d5c Stop iterating in exitDuplicate() after having removed a player
This fixes a crash due to the invalidated iterator continuing to loop.
It should be safe to assume there's only ever one duplicate/stale player.

Also updated tdata.
2020-12-08 01:53:21 +01:00
Gent S
a48fb3a8e8 Don't run nano mission logic at level 36 (fixes "Super Saiyan" bug) 2020-12-06 11:53:41 -05:00
27f396af7e Oops, M_PI is POSIX so it isn't defined in math.h on Windows 2020-12-06 06:02:58 +01:00
8ebabac7c0 Various bugfixes
* Fixed Nano stamina not being halved on respawn
* Reverted the default argument to terminate() change because MSVC is
undable to disambiguate the function pointer passed to sigaction()
* Fatal errors during init (like in TableData) can just call exit(1)
directly anyway (missing "OpenFusion: terminated." be damned)
* Switched to a slightly more portable syntax for getting the version
in the Makefile
* We shouldn't join the shard thread in the signal handler because the
thread the signal handler ends up running in is undefined behaviour and
we don't strictly need to join it anyway

Many of these issues were discovered on OpenBSD.
2020-12-06 05:25:23 +01:00
02c5df5c1b Ours is not to decide the value of pi.
Ours is only to live by it.
2020-12-06 02:45:20 +01:00
dd6fbfb683 Tweak terminate() slightly
* Gave it a default argument, since we never actually care about it, but
it needs to have it to conform to the signal handler prototype
* Constricted the area locked by activeCrit to only the block that deals
with the connections vector, to lower the chance of a future badly
placed call to terminate() deadlocking the server instead
2020-12-06 02:20:46 +01:00
92307063fc Integrate the monitor's listener socket into the shard's poll()
This removes the need for a separate monitor thread.
2020-12-06 01:44:37 +01:00
53d8cb67ba Set monitor connections to non-blocking
Better to just drop monitor connections when the quality is bad than to
risk blocking the shard thread.
2020-12-05 23:16:09 +01:00
6b257887b7 Use an std::vector for PollFDs instead of handling it manually
Lowered poll() timeout to 50, to fix (work around?) slider stutter.
2020-12-05 22:51:17 +01:00
ec7cba644c Clean up polling logic
* Extracted PollFD manipulation and nonblocking socket configuration
into helper functions
* Replaced the connections list with an unordered_map
* Dynamically grow the number of PollFD structures with realloc()

With these changes done, the server's CPU usage is completely diminished
from its old average of ~47% to ~0.07%, with occasional spikes up to ~14%.
2020-12-05 22:47:50 +01:00
269315ca09 Support for poll() (ie. WSAPoll()) on Windows 2020-12-05 22:47:50 +01:00
661061b4eb Switch to non-blocking sockets + poll(); prepare for Windows logic 2020-12-05 22:47:50 +01:00
3a2b488f33 [WIP] fixed a million bugs and one potential one 2020-12-05 22:47:50 +01:00
721b3f440f [WIP] Switched to poll(), but only on Unix 2020-12-05 22:47:50 +01:00
Gent S
b04c377d7c Properly implement item types. 2020-12-04 16:42:58 -05:00
Gent S
794856a63c Clean up item loading from XDT. 2020-12-04 13:57:08 -05:00
Gent S
856a90abcf Fix nano logic in goo damage running without a nano out 2020-12-04 11:59:53 -05:00
88d904e302 Fix FM patches not dealing damage unless invulnerable 2020-12-04 17:48:12 +01:00
46552307cd Disable monitor by default in config file 2020-12-04 17:30:21 +01:00
26024de866 Support the monitor interface on Windows as well
This change required sacrificing both code cleanliness and the specific
error reports from perror(). Those could have been kept with a portable
wrapper, but that's too much work. We'll do it if unforseen errors
arise.
2020-12-04 17:25:32 +01:00
Gent S
85dcdd4cc5 Added /hide command to exclude players from monitor output 2020-12-04 07:24:33 -05:00
Gent S
1ca8094628 Fix regression with disconnected player on Skyway agent. 2020-12-03 15:33:14 -05:00
Gent S
543d0a7afd Fix edge case for nano mission acquisition
This caused players to only get nano missions after exceeding the required FM instead of meeting it.
2020-12-03 00:05:14 -05:00
Gent S
4c398895aa Make /lair fit convention. 2020-12-02 18:41:09 -05:00
e899928928 Do not try to compile the monitor on windows 2020-12-03 00:15:06 +01:00
c8b011913a Make monitor parameters configurable 2020-12-02 23:42:33 +01:00
15b63f3cbd Fix regression with a disconnect check in MobManager::combatStep() 2020-12-02 23:32:38 +01:00
ce1a5a7664 Handle partial transmissions of the buffer to the monitor 2020-12-02 20:19:34 +01:00
c6112d04da Implemented player position monitor interface 2020-12-02 20:19:34 +01:00
Gent S
73f8179836 Make aggro space spheroidal on Z
By doubling the z difference used in distance calculation, mobs above or below the player will aggro less often.
2020-12-02 09:20:33 -05:00
Gent Semaj
86f17b6525
Show announcements in server log 2020-12-01 19:59:18 -05:00
fed3eca378 Display area announcement to invoking player as well
Also clarified that shard- and world-level announcements will not be
implemented as they are not applicable to our single-shard server.
2020-12-01 23:32:45 +01:00
fb9c4140b6 Remove redundant namespace specifiers in PlayerManager::init() 2020-12-01 22:24:18 +01:00
657061083e Lose aggro and do not take damage if invulnerable 2020-12-01 21:37:34 +01:00
8a86c75747 Make sure each group member is alive before healing/buffing them 2020-12-01 21:37:34 +01:00
046e7bb6f1 Do not aggro on players with /invulnerable 2020-12-01 21:37:34 +01:00
1e822f7a6c Removed redundant checks for a nullptr from PlayerManager::getPlayer()
These were written in desparation and never should have been there in
the first place.
2020-12-01 21:37:34 +01:00
c43a3d64fb Removed the Player pointer from CNSocket
It was a leak in the abstraction that we weren't even using that much.
This is technically a de-optimization, but it's okay since it's not a
hot code path.
2020-12-01 21:37:34 +01:00
Titan
7c5d7a70cc Fix enter key sending '\n' in passwords 2020-12-01 14:29:21 -05:00
Titan
c1941654b6 Basic Implementation of a lair unlock command 2020-12-01 14:19:16 -05:00
Gent S
d2d6171d04 Fix gumballs only lasting 1 minute instead of 10 2020-12-01 13:47:54 -05:00
58952be47e Added silent unsummoning
- summonNano now supports an optional "silent" argument
- gumballs now last 10 minutes.
- fixed comments
2020-12-01 13:16:14 -05:00
5771cd014a Various bugfixes and tweaks
- timed missions of all types should work.
- nanos now transmit an unsummon on 0 stamina.
- dying bumps your nanos down to half stamina now.
- enemies use abilities less frequently.
- group recall now works at any distance.
- passive nanos are tweaked to guzzle less stamina.
- cleared out some redundant stuff at the nanoPower handler.
2020-12-01 13:16:14 -05:00
Gent S
c9754902b9 Instance fusion lair NPCs, remove non-mob fusions, stub non-mob paths 2020-12-01 06:07:10 -05:00
Gent S
c508016ca3 Play nano mission animation for nearby players 2020-11-30 20:36:20 -05:00
Gent S
4863d29590 Fix /unsummonW crash on non-mob NPCs 2020-11-30 10:53:34 -05:00
858fbf40be Do not strip newlines from email bodies 2020-11-29 21:31:54 +01:00
Gent S
1d7f8bd133 Mob abilities cleanup 2020-11-28 12:41:00 -05:00
a9ad399bc2 Various Tweaks to Mob skill behavior
- Fixed enemy abilities playing after death
- Nerfed frequency further
- Heal on retreat correctly
- Nerfed damage and corruption skill damage
2020-11-28 11:41:32 -05:00
963205fad6 Added Nullptr check + Made mob abilities less frequent 2020-11-28 11:41:21 -05:00
b836952356 Restructured Arrays to Vectors 2020-11-27 19:02:54 -05:00
6fb652f642 Corruption reflection + Extra adjustments 2020-11-27 16:33:22 -05:00
2cde3e34f6 Active skills, Corruption and Eruption 2020-11-27 16:33:18 -05:00
1371a6da77 Base Variadic MobPowers Handler 2020-11-27 16:32:59 -05:00
d2e89851d6 Non-group buffs do not misbehave + Revive nano stamina fix 2020-11-27 15:40:49 -05:00
Gent S
7cc0a0fc82 Fix group recall and temporarily lift range restriction 2020-11-27 15:31:56 -05:00
c343092bd5 Gumball times out for slots 2 & 3 + Tweaks 2020-11-27 12:01:28 -05:00