Commit Graph

619 Commits

Author SHA1 Message Date
Gent S 5cbb8538c0 Get rid of PlayerView. For good. 2020-11-19 17:36:49 -05:00
Gent S d2e776b672 Fix mission rewards stacking on top of each other 2020-11-19 14:07:29 -05:00
Titan b08fb52272 Implement /announce 2020-11-19 14:05:34 -05:00
Gent S 0075457f81 Temporarily remove sanity check for egg pickup distance 2020-11-17 13:51:35 -05:00
Gent S 12baece1b2 Fix opening C.R.A.T.E.S. resetting your boost counters 2020-11-17 13:48:20 -05:00
Kamil c77f99e849 moved bullets removal call 2020-11-16 21:38:49 -05:00
Kamil d17890af68 cleanup 2020-11-16 21:38:49 -05:00
Kamil 6c1d8c3527 updated comment 2020-11-16 21:38:49 -05:00
Kamil 59ab81d3c6 fixed weapon boosts being used with 0 batteryW 2020-11-16 21:38:49 -05:00
Kamil 9cee8f2c87 added cleaning up player's bullets on exit 2020-11-16 21:38:49 -05:00
Kamil a483b0fb44 fully implemented rockets and grenades 2020-11-16 21:38:49 -05:00
Gent S 8ad3f3aabd CHUNKPOS macro -> ChunkPos typedef 2020-11-16 09:59:53 -05:00
Gent S b22ba781c8 Possible fix for chunking desyncs + CHUNKPOS macro 2020-11-15 14:41:56 -05:00
Gent 4d1d77ceaf Switch to getTime() for egg and buff ticking 2020-11-11 23:50:39 -05:00
Gent 7135767cc4 Egg checks, fixes, and cleanup
fixed not taking egg buff flag into consideration in mob manager

fixed stamina bug and improved sanity check

Egg cleanups
2020-11-11 23:19:07 -05:00
Kamil 0ecf76c5ec moved egg summoning to a custom ChatManager command 2020-11-11 23:19:07 -05:00
Kamil 9087baae3c Polished reading egg json data 2020-11-11 23:19:07 -05:00
Kamil 95b5da8932 temp chunk issue fix 2020-11-11 23:19:07 -05:00
Kamil f733aa60f0 added a chunk sanity check
removed unneccesary include
2020-11-11 23:19:07 -05:00
Kamil d102fabc2f set up gruntwork 2020-11-11 23:19:07 -05:00
Kamil 6d4afd0c6a fixed goo damage not taking all flags into account 2020-11-11 23:19:07 -05:00
Kamil 8003518e18 made particles for picking up eggs work, made damage and heal eggs work 2020-11-11 23:19:07 -05:00
Kamil 859b24229a added a condition to not send mob/egg _ENTER packet when it's HP is 0 2020-11-11 23:19:07 -05:00
Kamil 674d5112f3 implemented basic eggs functionality 2020-11-11 23:19:07 -05:00
kamilprzyb de99522340 added removing buffs on player exit 2020-11-11 23:19:07 -05:00
kamilprzyb c7006b46ed EggBuffs now stores debuff timestamp instead of remaining time 2020-11-11 23:19:07 -05:00
kamilprzyb 45ed99ae35 implemented player debuff 2020-11-11 23:19:07 -05:00
kamilprzyb f2ff4c7f4d added basic player buffs implementation 2020-11-11 23:19:07 -05:00
dongresource 2744ed64e3 Fix a bug where the server would crash if Drain killed a mob. 2020-11-11 23:35:00 +01:00
Gent 90754665a0 Refactor buddy request-by-name 2020-11-11 09:06:41 -05:00
Gent 4454faffc3 Add garbage collection for non-existent players 2020-11-10 18:16:06 -05:00
Gent 34f2aef248 Fix seg fault in buddy data for deleted player 2020-11-10 18:00:34 -05:00
Gent 121c65d7ea Fix not being able to attach weapons to emails 2020-11-09 21:33:02 -05:00
Gent f53de8d521 Explicitly update buddy records in DB
this should fix the bug where removing a buddy while they're offline won't take you off their list until you disconnect
2020-11-09 05:04:06 -05:00
Gent 8a68958ed4 Fix players being able to become buddies twice 2020-11-09 04:41:20 -05:00
Gent d7a8d2d453 Sanitize email subject + body 2020-11-08 15:37:17 -05:00
darkredtitan 5293573116
Allow period and numbers in firstname/lastname regex check (#144)
* Remove unnecessary whitespace check in regex
* Allow dot characters in names (except at the beginning of a name)
* Allow numbers in names
2020-11-08 14:34:02 -06:00
Gent d505b09e98 Email bugfixes
- Fix item flag not getting updated
- Fix attachments getting written to the same slot
2020-11-08 14:58:51 -05:00
Gent 8f90fdaac4 Integrate email handlers with DB 2020-11-08 14:39:17 -05:00
Gent 3a55a9b66f Add email structs and functions to DB
Mutex locks included
2020-11-08 14:37:33 -05:00
Gent 36e9370ff4 Add email packet handlers w/ sample data 2020-11-08 14:26:03 -05:00
Gent 3f5a9c8811 Fix buddy list not syncing properly
I couldn't reproduce this on my public server, but the list would show up empty sometimes on initial login on my local server, so I threw it in for good measure.
2020-11-08 13:58:44 -05:00
Gent 30de5c1734 Sanitize buddy chat strings 2020-11-08 13:31:10 -05:00
Gent c7591c6ce2 Implement buddy warp 2020-11-08 12:54:05 -05:00
Gent 7be79010fc Buddy DB integration 2020-11-08 12:42:27 -05:00
Gent 803f1a246a Buddy code cleanup
- Get rid of buddyCnt, self-nullptr checks, and redundant playermap loops in chat handlers
- Add helper function to find available buddy slot
- Reorganize a bit
2020-11-08 00:08:43 -05:00
SengokuNadeko 262dca7dd6 Buddy rework, adjustments, and fixes
I cleaned up the code a bit (I'll clean it up more as I make more progress) and fixed a bug with buddy slots. Now buddies aren't overwritten!
A few reworks and adjustments

I reworked the buddyIDs array to store only player UIDs instead of IDs. I also reworked buddy deleting so that it deletes buddies from the array.
Code cleanup

Cleaned up some of the code. I mainly just removed useless helper methods.
2020-11-07 23:39:41 -05:00
Gent 26460c0167 Add battery caps for combat rewards & commands 2020-11-07 21:51:16 -05:00
Jade 83c378c9c2 Added /notify and /players admin commands
Co-authored-by: dongresource <dongresource@protonmail.com>
2020-11-03 21:07:59 +01:00
dongresource a1145aced4 Chat strings are now sanitized.
* Only plain, printable ASCII is allowed for now.
* Local chat is now printed to the server console, but group chat is
still private
* Added a helper function to print character names and IDs
2020-10-31 21:31:25 +01:00
Jade d21f727e9d Moved Debuff handling to Combat + Bugfixes
* Majority of mob debuff handling is moved to combatStep().
* Drain now kills the mob and does 40% overall damage.
* Bumped up active nano debuff durations, debuffs like drain linger longer but damage less.
* Debuffs are cleared upon mob death and retreating.
* Patched out vehicle off success packet spam
* Boosts and potions now cost the right amount (100 taros) and give the right quantity (100).
* Damage was tweaked slightly. At higher levels you are more likely to fall prey to rand().
* Enemies now use run animations during combat and retreating.
2020-10-31 15:55:44 +00:00
Gent S f3b9ecd791 Add missing sanity checks to quitTask and useItem 2020-10-25 18:33:02 -04:00
Gent S 609d3cdb99 Remove redundant instance deletion 2020-10-25 18:14:35 -04:00
Titan 6d97aaa1d0 Make nano skill change consume FM & power items 2020-10-24 18:31:07 -04:00
Gent 4ab686bc46 Fix abused unordered map 2020-10-24 18:30:02 -04:00
CakeLancelot 2302c28ac5
Merge pull request #141 from CakeLancelot/orm-update
Update sqlite_orm to 1.6
2020-10-24 14:31:57 -05:00
Jade c8497a4856
Implement two more mission types + tweaks & fixes
* Weapons will consume your batteries fully.
* Nerfed enemy damage at lower levels.
* Further reworked drain, uses a static variable as a timer (lastDrainTime)
* resendMobHP has been repurposed to drainMobHP.
* Players heal faster after a sizable cooldown.
* Nano type advantage is more noticeable during combat.

Implemented two more mission types + Tweaks

* Item delivery quests now work.
* Timed missions now work.
* All escort missions (type 6) are skipped.
* /minfo now also prints the terminator npc.
* Weapon battery consumption tweaked
* Fixed indentations.
* Heal nanos have better output (25% -> 35%)
* Damage formula had a slight tweak.
* Bugfixed weapon equipping.
* Other tweaks
2020-10-24 14:04:42 -04:00
Jade 177c5f0f17
Nano Drain, Debuffs are timed
* Nano drain power works, currently does 30% damage over a period of 3 seconds.
* Stun, Sleep and Snare powers will now run out of time on mobs.
* A few other adjustments to mob mobility.
2020-10-24 14:00:00 -04:00
Jade 2782706355
Group warping & mob movement smoothing
* Warping into IZs and Fusion Lairs now will also take into account your group members.
* MobManager lerp does not confusingly divide speed by 2 anymore.
* Mobs pursue their targets more smoothly, they will avoid phasing into the player during combat.
* Nerfed retreat speed by a factor of 1.5, normal mobs retreated way too quickly however mobs like Don Doom and Bad Max do not retreat fast enough.
* Bugfixed sendPlayerTo, it did not call updatePlayerPosition leaving undesirable anomalies.
2020-10-24 14:00:00 -04:00
CakeLancelot a969988b5c Update sqlite_orm to 1.6 2020-10-24 09:47:46 -05:00
Jade cc06fdcf60 Possibly fixed all chunking desyncs
* Players/NPCs that initialize chunks now correctly pull their main chunk into their viewdata.
* Tested on the public server, seems to have solved the chunking issues.
2020-10-24 03:47:34 +01:00
dongresource 3b5af415fb Fixed the NULL Player* in PlayerManager::players bug. 2020-10-23 05:32:14 +02:00
Gent 2b650b0bed Cleaned up warp code. 2020-10-22 13:14:24 -04:00
CakeLancelot 512647974d Fix Numbuh 3's sneak and revive abilities being swapped
Also fix a small typo
2020-10-21 10:05:48 -05:00
dongresource c9f9b093f4 Bugfixes.
* Add newly created chunks to nearby players and NPCs. This fixes the
slider/static path mob pop-in problem.
* Update a player's chunks when resurrecting. This fixes a mob desync
problem.
* Use a private instance for the Time Lab
* Spawn a slider for every stop
* Fix mobs in private lairs using the template chunk mobs's current
health for their max health
* Don't call into the JSON lib in the loop in aggroCheck(). This is an
optimization found after using gprof.
* Don't print NPC deletions to console. This stops the spam when a
private instance is deleted.
* Changed default view distance to half the length of a map tile, so
chunks are aligned to map tiles
* Update tdata reference
2020-10-21 02:38:30 +02:00
Gent 49d8ed2e36 Slider path, fixes, tweaks 2020-10-20 10:40:50 -04:00
dongresource 10534886b8 Cleanup for 1.2.
Cleaned up whitespace, comments, brace style, etc.
Updated tdata reference.
2020-10-19 20:48:57 +02:00
dongresource e97b58ccaf Fixed private instance memory leaks. 2020-10-19 04:30:12 +02:00
dongresource 55be58cc24 /summonW now supports summoning non-mob NPCs.
/npcr will now rotate gruntwork NPCs in-place instead of making separate
rotation entries that wouldn't have been loaded properly anyway.
2020-10-19 03:45:58 +02:00
JadeShrineMaiden deb3e5b897
Added /minfo and /tasks (#137)
* /minfo returns your current active mission's: id, task id, task type, task objective marker id and enemy ids if applicable.
* /tasks returns all the active mission ids and task ids.
2020-10-18 23:02:51 +02:00
dongresource 4a5857a126 QoL improvements.
* Use macros for extracting map numbers and player IDs from instance IDs
* Add docstrings to all commands
* Remove /test command
* Sync with tdata
2020-10-18 22:43:22 +02:00
dongresource bbd695cad1 Minor tweaks.
* The server now refuses to start if any JSONs fail to load
* Mobs now take height into account when losing aggro on a player
* Mobs now aggro on the closest player in range, rather then on the
earliest one to connect to the server of the ones in range
* /summonW now works in IZs and Lairs as well
* Lowered the extra height that mobs spawn at with /summonW to prevent
glitching problems
2020-10-18 04:17:52 +02:00
dongresource 3ce8cf2129 Cleaned up item drop logic.
* Replaced bad exception logic with C-style error returns in ItemManager
* Removed unnecessary instances of objects being passed by value
* Fixed whitespace problems
* Added new config options to the default config.ini
* Updated tabledata reference
2020-10-18 01:30:37 +02:00
dongresource 7f716c7278 Fixed exception usage in TableData. 2020-10-18 01:30:37 +02:00
kamilprzyb dd54668697 functional crates (no more plungers) (#133)
* FM, Taros and Boosts awards from killing mobs should be pretty
accurate now. A temporary formula for adjusting player/mob level gap is
implemented, but it will probably need to be adjusted in the future

* Mobs now drop correct crates

* Crates can be opened and give you correct items This includes
regular mob crates, world boss crates, mission crates, IZ race crates,
E.G.G.E.R.s, golden Eggs, and Event Crates.  Keep in mind that neither
IZ races or golden Eggs are implemented, but if you spawn such a crate
it can be opened.

* All data is read from a json file, for which I'm going to release a
tool soon so it's easily adjustable

* There is a new setting for enabling events, which enables dropping
extra event crates These are Knishmas, Halloween and Easter
2020-10-18 01:30:37 +02:00
Gent ab5857e7e2 Fix re-crocpotting (#134) 2020-10-16 19:54:05 -04:00
Gent da725d21e6 Delete instances with no players 2020-10-16 11:50:03 -04:00
Gent 6473951b9a Instance tweaks + fixes
Instanced mobs tick, fusions stay dead, missions reset on enter
2020-10-15 17:07:58 -04:00
Gent 3050801399 Make /warp and /goto put you in the overworld 2020-10-15 17:07:58 -04:00
Gent efd729710f Kick players out of instances when they leave 2020-10-15 17:07:58 -04:00
Gent 85530ef57f Implement instance copying
and make respawn points match the player instance
2020-10-15 17:07:58 -04:00
Gent b87f20e2dc Make instance missions reset upon warping out 2020-10-15 17:04:38 -04:00
Gent d4aed0abf4 Add support for unique instances 2020-10-15 11:46:53 -04:00
Gent c1fd51b721 Expand gruntwork to instances
Add NPC instance gruntwork data

Add instance-related commands
- /instance (instance ID)
- /npci [instance ID]
2020-10-15 11:44:15 -04:00
Zenpock bd34bb294c Instance Stuff
custom instance commands
warping takes you into instances
npcs show up only in the instance they are supposed to be inside.
2020-10-15 11:44:15 -04:00
dongresource 5a80c53e79 Remove the pointer to the deallocated chunk from the current player/NPC.
This fixes the Great Crash Bug(tm).
2020-10-15 04:36:38 +02:00
dongresource 5784e77654 Misc changes.
The first two fixes were caught by infer. The Big Bug(tm) remains
unfixed.

* Fixed the Leech nano power
* Fixed an unlikely nullptr dereference in ItemManager
* /toggleai now makes mobs retreat immediately, instead of waiting for
their next movement tick
* Static path mobs will now stop in place instead of retreating to
their spawn points when AI is disabled
* Changed the misleading config option name from "chunksize" to
"viewdistance", since it's actually only a third of the chunk size
2020-10-14 23:15:02 +02:00
dongresource 6ee5e6d1ae Load NPC angles from NPCs.json. 2020-10-14 02:34:00 +02:00
dongresource 3586b76888 Fixed the slider not being in the overworld instance. 2020-10-14 02:34:00 +02:00
CPunch 843b2e6e38 chunks are now cleaned up when not in use 2020-10-13 17:30:19 -05:00
dongresource a8c8065920 Ah, yes. Windows. 2020-10-13 21:57:41 +02:00
dongresource 63414ea9a2 The /summon command can now spawn up to 100 NPCs at a time.
Note that /unsummon can only remove one at a time.
2020-10-13 21:50:14 +02:00
dongresource 599bbedd8c Implemented static paths for mobs (like Don Doom and Bad Max).
* Mobs now retreat to where they were when they were roaming; not their
spawn point
* /toggleai still sends them back to their spawn point however
* Fixed a bug where mobs would respawn where they were killed instead of
their proper spawn point
* Fixed mobs roaming despite simulatemobs being set to false
* Updated tdata submodule
2020-10-13 21:44:43 +02:00
dongresource c792fb9d0d Clang lied to me.
It's reasonable that you can't use inline like this, but in my defense
it worked until MobManager.o was recomplied, I think.
2020-10-12 21:18:03 +02:00
dongresource f8d64234d7 Spawn mobs above ground to alleviate hill/building phasing issues. 2020-10-12 21:08:19 +02:00
dongresource 901e011740 Mobs roam proper distances now.
* Mob roaming is now integrated into the TransportManager
* Doubled the roaming distance, since it was clearly too small
* Tripled retreat speed
* Made use of NPCManager::sendToViewable() in TransportManager
2020-10-12 21:08:19 +02:00
Gent a53f38b87d Fix spawned vehicles expiring instantly 2020-10-12 14:06:28 -04:00
CPunch f3b6f9619b added /help 2020-10-12 02:08:10 -05:00
dongresource 4d687a82ea
Merge pull request #132 from JadeShrineMaiden/test
Bugfixes + Damage Formula Adjustment
2020-10-11 20:59:40 +02:00
Jade d99dad261c Bugfixes + Damage Formula Adjustment
* Entering/exiting groups should apply/remove group buffs.
* Fixed issues with nanos losing all stamina from various revives/warp away.
* Heavily tweaked damage formula, nano types now boost/decrease damage.
* Weapons can consume battery returning extra damage, battery consumed depends on enemy level.
2020-10-11 18:39:52 +01:00
Gent 1564cc7724 Make proximity NPC search a helper function 2020-10-10 23:18:01 -04:00
dongresource 2b9d0f6bab Fix GROUP_JOIN_FAIL being initialized as a GROUP_INVITE_FAIL.
This was a vulnerability, since JOIN_FAIL is larger than INVITE_FAIL.
2020-10-09 18:24:16 +02:00
dongresource 9f280c2c31 Validate arguments to /level and /summonW; fix retreatStep() bug. 2020-10-08 20:20:12 +02:00
dongresource bae834fefa The login server now sends live checks.
This should stop server providers from kicking tutorial players as
inactive TCP connections. The interval is generous for that reason.

Also snuck in a change that makes mobs retreat all the way to their
spawn points, to aid during mob gruntwork with /toggleai.
2020-10-08 01:21:48 +02:00
dongresource 1fe23b97fd Fixed RunningNPCRotations being forgotten across server invocations. 2020-10-07 21:13:26 +02:00
dongresource 0d0332e551 Added /toggleai command for easier mob placement and testing. 2020-10-07 20:38:32 +02:00
dongresource 7a83a3b45c
Merge pull request #131 from JadeShrineMaiden/bugfix
Bugfixes
2020-10-07 19:52:11 +02:00
dongresource 606384445c Added /summonW and /unsummonW gruntwork commands.
Also:
* Filled in the battery fileds in the REWARD_ITEM packets in
MissionManager.
* Removed redundant NPC_ENTER in npcSummonHandler()
2020-10-07 19:29:59 +02:00
Jade 7caa73caca Bugfixes
* Groups can now be abandoned using the "leave group" button.
* Non-group passive powers no longer buff the group leader instead of buffing the summoner.
* Adjusted various warning causing code pieces.
* Adjusted potions and battery prices.
2020-10-07 18:25:49 +01:00
Gent 5ed332d836 Make /npcr use the nearest NPC 2020-10-06 20:09:18 -04:00
Gent 42fc018097 Add chunk reload command /refresh 2020-10-06 18:00:17 -04:00
Gent 1b68b5e2e2 Add NPC rotation command /npcr 2020-10-06 17:59:33 -04:00
Gent 5009fe1994 Implement temporary NPC rotations 2020-10-06 17:59:12 -04:00
Gent 4873eba160 Add overload to updateNPCPosition with rotation arg 2020-10-06 17:57:46 -04:00
dongresource d4d0f388c4 Implemented saving gruntwork results to file.
* Monkey Skyway paths are now saved in a format compatible with
paths.json
* flush() is called on every periodic DB save in addition to the /flush
and /mss N export commands
* Monkeys now accept WIP routes
2020-10-06 21:53:21 +02:00
dongresource ce58411ff8 Added /population and /level commands.
Also made /mss an access level 30 command, for safety.
2020-10-05 02:33:30 +02:00
dongresource 661070dc3a Cleaned up whitespace.
Incantation: sed -i 's/[ \t]*$//g' src/*.[ch]pp

Also switched BuddyManager from tabs to spaces using vim's :retab command.
2020-10-05 02:03:13 +02:00
JadeShrineMaiden b8f586bc10
Groups, Group Nano powers and Revive (#129)
* Initial Group Implementation

* Request/refuse/join and leave groups.
* Chat into groups.
* Get status updates on every group member each tick.
* Owner leaving the group destroys the entire group.

* Added more nano powers

* Revive for both variants work.
* Many nano powers now have a group variant working.
* Enemy checks for aggro before retreating.
* Enemies keep aggro on dead players with revive nanos out.

* Further Nano powers + Bugfixes

* Infection damage now relies on bitcondition flags.
* Antidote power now works.
* Improved how groups handle leaving players.
* Fixed mob aggro range.
* Group Healing is now functional.
* Possibly fixed the player being unselectable bug.
* Fixed indentations.

* Dismiss nano when starting a MSS ride

* Sneak, Invisibility and Bugfixes

* Sneak and invisibility affect mob aggro.
* Possibly bugfixed equips not showing to other players.
* Aggro checking is less likely to cause nullptr related crashes.

* Group PR cleanup.

* Made sure to label all hacky workarounds
* Implemented the Antidote nano power the right way
* Cleaned up the way various little things are written

Didn't have the opportunity to actually test groups.

Co-authored-by: CakeLancelot <CakeLancelot@users.noreply.github.com>
Co-authored-by: CPunch <sethtstubbs@gmail.com>
Co-authored-by: dongresource <dongresource@protonmail.com>
2020-10-05 01:54:08 +02:00
CPunch 131eb94919 removed stale comment 2020-10-04 12:52:16 -05:00
CPunch 755bb75306 U8toU16 now respects buffer sizes 2020-10-04 12:50:58 -05:00
Gent a9837d6c1b Finish MSS commands + convert stack to vector 2020-10-03 11:24:45 -04:00
Gent 47da895544 Add basic MSS gruntwork commands 2020-10-03 11:20:51 -04:00
CPunch a852c26e5e minor command refactor 2020-10-02 19:20:59 -05:00
CPunch 316239dadc comments + better test command 2020-10-02 18:59:07 -05:00
CPunch f5939353b1 added basic command handler 2020-10-02 18:50:47 -05:00
Gent cbd04c2ce6 Unsummon nano when stamina runs out 2020-10-02 17:03:11 -04:00
Gent 1b55ab44e3 Add helper function to get socket from player ID
Co-authored-by: Jade <jadeshrinemaiden@gmail.com>
2020-10-02 17:02:31 -04:00
dongresource 21b7500e13 Define NOMINMAX globally to work around VS nonsense. 2020-10-02 22:04:23 +02:00
dongresource 35a2110698 Save connected players to DB when gracefully terminating the server. 2020-10-02 19:34:09 +02:00
dongresource 2fe4b2bac1 Rewrote quest bitfield char[128] <-> int64_t[16] logic.
* This should fix the problem with some completed missions being
forgotten
* We no longer explicitly shuffle bits around. Instead we just cast
and copy the full buffer
* Character creation initializes the quest blob with 128 zeroes, since
that happens later on anyway, but we're robust against different quest
flag sizes just in case
* I haven't looked at the actual flag-setting logic, so if the bug is in
there, this won't fix that one, but it does fix the one where the least
significant bit of every 64-bit flag doesn't get saved to the blob
* I'm still cautious about storing the various bitfields as signed
values even though the client does it that way, since while shifting
into the sign bit is undefined behaviour in C/C++, it may *not* be in
C#. And of course the client implementation may just be buggy as well.
2020-10-02 19:34:09 +02:00
CPunch 839f9a813c remove player from map in weird edgecase 2020-10-01 19:20:44 -05:00
dongresource 4fe4aeb0d3 Properly clean up players that have been kicked as duplicates.
This should fix the issue with null pointers in PlayerManager::players.
2020-10-02 01:37:50 +02:00
Gent 3c734e3e76 Fixed crash on killing summoned NPC 2020-10-01 10:36:52 -04:00
CPunch 4cd7b7cb53 added basework for instancing 2020-09-30 20:44:37 -05:00
CPunch 8ff97ec0b3
Merge pull request #123 from gsemaj/items
Add simple item stacking logic
2020-09-30 18:37:31 -05:00
CPunch 5f65c1530b
Merge pull request #122 from JadeShrineMaiden/bugfix
Various bugfixes and adjustments
2020-09-30 18:37:16 -05:00
Gent 2c831ee115 Match maxed stack behavior to OG 2020-09-30 16:23:46 -04:00
Gent 941e986ee1 Fix incorrectly set item cost 2020-09-30 13:30:19 -04:00
Gent 1eb806af58 Add item stacking logic 2020-09-30 13:29:56 -04:00
Jade ab990116a2 Various bugfixes and adjustments
* Nano missions should now stop repeating.
* Bitwise operators are now used to handle buff/debuff bitfields.
* Changing nano powers will no longer grant you infinite buffs.
* Mobs now heal up client-side after retreating, this comes with candy effect being played however.
* Lower level mobs now hit harder.
* Nanos drain stamina quicker when they grant passive powers.
* Healing, damage and leech powers scale up with your level.
* Player on player damage now accounts for damage and armor.
2020-09-29 22:27:48 +01:00
dongresource fb281b0237 Lock all Database operations.
All DB functions that are called outside of Database.cpp are now locked
by the same mutex. This might be a bit overkill, but it's not a hot code
path, so it doesn't matter. Better to avoid the potential deadlocks if
we made it too granular.

From now on a clear distinction must be made between external and
internal functions in Database.cpp, or else deadlock will occur.

Note that sqlite database operations are already locked, but if execute
multiple transactions within the same operation, it could have still
caused problems.

I also removed the DbPlayer fetch when writing to DB by making it a part
of the Player struct. This, by itself, should have fixed the crash we found.
2020-09-29 16:47:39 +02:00
CPunch 3f35d2e960 sanity check to fix possible FPE 2020-09-28 15:31:01 -05:00
CPunch 884b844d65 minor refactoring 2020-09-28 13:11:13 -05:00
dongresource 4079806436 Support the /batteryN and /batteryW commands.
Also up the PVP damage to 700.
2020-09-28 18:54:39 +02:00
JadeShrineMaiden efb3df7133 Implemented GM SpecialState Handling
Co-authored-by: dongresource <dongresource@protonmail.com>
2020-09-27 22:19:21 +02:00
dongresource c9be0e5402 Do not tick dead players.
This fixes the "dancing in Fusion Matter" bug.
Also (temporarily?) added updateNPCPosition() to the suppression list.
Might want to take it out again (along with some of the other ones) if
we do end up implementing Chunk GC.
2020-09-27 20:29:26 +02:00
dongresource 97c2c532f1
Merge pull request #117 from gsemaj/slider
Load sliders from paths.json
2020-09-27 20:03:41 +02:00
dongresource a324f3fda9
Merge pull request #118 from JadeShrineMaiden/moblocomotion
Greased up enemies
2020-09-27 20:02:52 +02:00
dongresource 6ea47ddb56 Fixes.
* Mobs should account for height when aggroing on nearby players
* We don't need to keep track of lastHealTime for each player separately
* Warp attendants no longer steal the players weapon and money
2020-09-27 19:58:37 +02:00
CPunch 2b4a1387f9 stubbed BuddyManager 2020-09-27 12:23:49 -05:00
Gent Semaj b03cc563eb Fix mobs not aggroing 2020-09-27 03:05:55 -04:00
Gent Semaj dd374b2ea1 Fix boosts and potions not updating on reward 2020-09-27 03:05:55 -04:00
CPunch f8f2088e38 fixed player health regen 2020-09-27 01:13:27 -05:00
CPunch 062302a7aa fixed potential threading/socket issue 2020-09-27 00:12:26 -05:00
Jade a5d3160588 Mob movement smoothening + Bugfixes
* Mobs now move at a tickrate per second of 2 as opposed to less than 1 before.
* How lerping works was changed slightly, mobs are bumped down to half the speed to account for the higher tickrate.
* Damage formula was altered to more closely match the OG game.
2020-09-27 05:43:50 +01:00
Jade 4fea2ae896 Variable damage to/from mobs
* Player weapons and armor ratings are taken into account when damaging/getting damaged by mobs.
* Players have a 5% chance to critical strike mobs, this doubles the player's weapon power.
* Aside from player and mob stat based damage variance, there is also an inherent 20% variance to any damage.
2020-09-27 02:53:03 +01:00
Gent 56a92d302f Add curve parameter to lerp 2020-09-26 19:24:07 -04:00
Gent 0ea5712f8c Load sliders from paths.json 2020-09-26 19:24:07 -04:00
dongresource b4fb449e69 Fix VS build. 2020-09-27 01:00:31 +02:00
dongresource 4fa6618abb Implemented player tick (health/nano stamina).
* The player now heals while not in combat
* Nanos lose stamina while active, regain it while resting
* Using active nano powers drains stamina
* Standing in FM patches/lakes now deals damage
* Fixed a memory error in npcAttackPc()
* Mobs now aggro when a player gets close
* Mobs now give up the chase if the player gets out of the combat zone;
they no longer try chasing until they themselves have left it
* Added a few missing break statements in the loops in BuddyManager

Other players are not yet instantly notified of health/stamina updates,
as finding the correct way to do this has proven tricky. FM patch damage
updates other player's views just fine, though.
2020-09-27 00:16:15 +02:00
dongresource 43d268e142 Enough with the plungers already.
At least from killed mobs.
2020-09-26 16:45:32 +02:00
dongresource 9657aaf202 Tuned various values.
* The player no longer receives the Blossom nano mission until they've
left the future
* As a temporary measure for the sake of the public server, Fusions in
respawn in their lairs after 2.5 minutes
* Changed default player damage value to 150
* Mobs now drop the correct amount of FM, as well as a close
approximation of the correct amount of taros
* You can no longer break the FM cap in the Future zone
* Fixed the updateFusionMatter() bug the right way this time
* Completing a nano mission now subtracts FM as it should
* Setting a Nano's power no longer reports 0 FM to the client
2020-09-26 03:48:45 +02:00
dongresource dccd92aff9 The Future is now playable.
* Sync'd tdata so it has all the lair NPCs
* Bypassed Eduardo escort task
* Fixed the level 36 updateFusionMatter() memory error
* Fixed qitems being deleted even if the player fails to complete the
mission due to not having any inventory space, thus softlocking the
mission
2020-09-25 23:10:02 +02:00
CPunch 1b35aab958
Merge pull request #115 from kamilprzyb/master
Quick fix for saving nano missions
2020-09-25 15:06:14 -05:00
Gent 0931cf1fbc Fix client/server summoned nano discrepancy on revive 2020-09-25 10:57:32 -04:00
kamilprzyb 8c63cd575c quick fix for saving running nano missions 2020-09-25 11:30:59 +02:00
CPunch 5068b38c5e
Merge pull request #100 from SengokuNadeko/master
Buddy System
2020-09-25 00:48:01 -05:00
CPunch 231a4a441b
Merge pull request #112 from gsemaj/slider
Load NPC paths from JSON + update submodule ref
2020-09-25 00:37:53 -05:00
kamilprzyb d4f1515f5d
Time to go, gumballs and nano potions (#113)
* set up "go to the time machine" button working

* warping to the past now sets PayZoneFlag and removes all active missions

* added gumballs functionality

* added nano potions functionality

* formatting fix
2020-09-25 00:35:27 -05:00
CPunch e5a24bcb70
Merge pull request #114 from gsemaj/bugfix1
Prevent player position from updating when flying on monkey
2020-09-25 00:33:42 -05:00
CPunch 874479d1cf fixed NPC spawning bug 2020-09-24 21:32:14 -05:00
CPunch 8f84c4c2f8 updateNPCPosition now tracks chunks 2020-09-24 20:58:20 -05:00
dongresource 279cb78d5f Mob-related cleanup.
* NPCs now keep track of their chunk information like PlayerView does
for players
* NPCManager::sendToViewable() parallels PlayerManager::sendToViewable()
* Nano damage and debuffs now count as attacking a mob
* Mobs will de-aggro if something else killed their target
2020-09-25 02:00:26 +02:00
dongresource 72d625fd8d Summoned mobs are now actually treated as mobs.
Unfortunetly, this necessitated keeping around yet more JSON objects for
the duration of the server's runtime.
It also involved unifying the way NPC IDs are handled, such that they
may be allocated and deallocated out of order.

If any NPCID-related bugs occour, this commit should be regarded as
the prime suspect.
2020-09-25 00:51:18 +02:00
Gent db33ca2bbb Prevent player position from updating when flying
Only chunk is updated instead to maintain visibility
2020-09-24 18:43:58 -04:00
dongresource cfb3d25bc5 Lerp mob movement a little.
We'll lerp a little harder later. Also retreat if kited
too far.
2020-09-24 23:11:14 +02:00
dongresource 1f18104a6f Mobs fight back now.
There is still a lot of tuning, lerping and cleanup to do.
2020-09-24 23:11:14 +02:00
dongresource 006d1000c7 Add Address Sanitizer suppression list.
This replaces the unnecessary deallocations on program termination.
Passing in the suppression list environment variable via setenv()
doesn't seem to work, so I've added a comment in the Makefile to explain
invocation.
2020-09-24 23:11:14 +02:00
Gent 72c16587e0 Load NPC paths from JSON 2020-09-24 10:32:46 -04:00
CPunch c33f218e56 updateFusionMatter now sets fusion matter 2020-09-23 16:04:58 -05:00
CPunch 4caca07856
Merge pull request #109 from gsemaj/slider
Basic slider implementation
2020-09-23 14:49:26 -05:00
CPunch 63c14aff58
Merge pull request #110 from kamilprzyb/vehicles_pr
Fixed Time and implemented vehicles expiring
2020-09-23 14:48:38 -05:00
CPunch 78930916ad added support for nano missions 2020-09-23 14:44:27 -05:00
SengokuNadeko 9cfced88c9
Stubbed buddy warping
After testing warping a lot I saw how buggy it is. I decided to stub it for this PR and work on it in a later PR.
2020-09-23 13:52:21 -04:00
Gent f2596bfb6a Add NPC chunk management + Generalize lerp 2020-09-23 12:06:25 -04:00
Gent 65bd2d120b Add NPC pathing queues 2020-09-23 10:29:29 -04:00
kamilprzyb 7bcdc111da fixed comments formating, added zeroing out player->toRemoveVehicle after removing vehicle 2020-09-23 11:21:32 +02:00
kamilprzyb 016c48645e adjusted timestamp function to always return value in seconds 2020-09-23 11:05:18 +02:00
kamilprzyb 09f1f67778 implemented checking vehicle time limit on use 2020-09-23 10:20:47 +02:00
Gent 7dfc888552 Basic slider implementation 2020-09-23 00:08:51 -04:00
Gent 6f05f0f2c8 Add NPCClass enum 2020-09-22 23:41:43 -04:00
dongresource c722044bf5 The Sleep, Stun and Snare powers now affect mobs.
They currently don't expire after a set amount of time.
Attacking a sleeping monster does wake it up, but doesn't remove the
debuff status client-side yet.
2020-09-22 22:22:10 +02:00
kamilprzyb 076f89927d changed vehicle iTimeLimit to be stored in seconds instead of miliseconds 2020-09-22 21:49:24 +02:00
dongresource 95a79ec815 Switched MobManager::step() to the timer.
It doesn't really need to run on every shard step. This makes it a lot
less hot.
2020-09-22 21:31:08 +02:00
kamilprzyb 7ba9b9a54f replaced high_resolution_clock with system_time for timestamps 2020-09-22 21:15:47 +02:00
dongresource ba5998d53a Added a config option to disable mob movement and combat.
This will come in handy when gruntwork starts.
Also fixed a bug where the ACCLEVEL setting was read as a boolean.
2020-09-22 20:53:44 +02:00
dongresource ac1fd1e5be Implemented mob roaming.
Will likely need further tuning.
Mobs in vacant chunks are skipped.
2020-09-22 20:33:10 +02:00
dongresource 94ab5b8b64 Seed the random number generator. 2020-09-22 20:32:40 +02:00
SengokuNadeko e0e474924d
Implemented buddy warping
Buddy warping now works, if anything else needs to be added/redone in regards to this feel free to let me know ^
2020-09-22 13:02:00 -04:00
kamilprzyb 0931c88541 fixed size bug 2020-09-22 13:41:28 +02:00
kamilprzyb 5a58908462 vehicle has a proper expiration day when bought, implemented checking expired vehicles while login 2020-09-22 13:16:09 +02:00
kamilprzyb 00f64ce992 added sanity check for killing mission mobs 2020-09-22 10:18:29 +02:00
Gent 153b3a9ef5 Sync tabledata submodule + fix transportation bugs 2020-09-22 00:42:46 -04:00
CakeLancelot adf017b07c
Move from isGM to Account Levels (#106)
Co-authored-by: dongresource <dongresource@protonmail.com>
2020-09-22 04:26:12 +02:00
dongresource 5d8bb7f8a5
Merge pull request #95 from gsemaj/monkeys
Paths framework + Monkey Skyway System framework
2020-09-22 03:54:01 +02:00
Gent 2c8243e136 General MSS fixes + tweaks
Add alert message for unpathed skyway routes
Fix overflow during lerp + add Future routes
Add documentation for MSS
Fix potential MSS registration bug
Minor tweaks + styling
Update packet broadcast
2020-09-21 21:43:39 -04:00
dongresource 12fbdc9621 Wait about 2s before despawning killed mobs.
This gives them enough time to play their death animations before
they disappear.
2020-09-22 00:23:18 +02:00
dongresource a768a4f539 Fixed halved NPC distance and renamed config option to chunksize. 2020-09-21 23:30:05 +02:00
dongresource d6357197d3 Use the chunk's visibility lists when respawning mobs. 2020-09-21 23:13:13 +02:00
CPunch 4cc1cf4f7e minor chunk refactor 2020-09-21 14:55:34 -05:00
CPunch b67a0b6946 removed usewebapi 2020-09-21 14:49:08 -05:00
kamilprzyb 5e0948ea93
Database saving update (#104)
* implemented saving BatteryN and BatteryW

* implemented saving mentor

* moved int64->blob parsing to a separate function

* moved parsing blob->int64 to a separate function

* added functions for parsing int32->blob and vice versa

* added functions for parsing int16->blob and vice versa

* WIP saving quest items and active tasks

* Quest items are stored in inventory table instead of blob

* added sanity check for missionId

* saving active missions works

* removed unneccesary include

* implemented saving warplocationflag, skywaylocationflag and currentmissionid in database

* INFO DB message now shows how many accounts and player characters are in the database

* fixed dbsaveinterval being in [login] instead of [shard]

* fixed mission quit:
- fixed wrong json name, causing qitems not deleting properly
- quitting mission now resets npc kill count

* adjusted saving active missions

* removed blob parsing functions that ended up being unused

* removed accidentaly added include

* removed sending PCStyle2 on Player Enter

* added a sanity check in itemMoveHandler

* removed MapNum from PCLoad, as client doesn't even read it

* set BuddyWarpCooldown to 60s on PCLoad

* fixed a bug causing EXIT DUPLICATE not working

* added creation and last login timestamps to accounts and players

* added a sanity check for P_CL2LS_REQ_PC_EXIT_DUPLICATE

* implemented web api support, toggled by new setting (off by default)

* add usewebapi to config

Co-authored-by: Gent <gentsemaj@live.com>
2020-09-21 14:43:53 -05:00
SengokuNadeko 90134cd1fa
Buddy deleting/blocking works and code clean up
Added in buddy deleting and buddy blocking. I also cleaned up some of the code and added some comments to the code.
2020-09-21 14:28:04 -04:00
dongresource 321dca3f79 Use PC_MAXHEALTH() in the rest of the codebase.
+ minor fixups
2020-09-21 19:51:30 +02:00
JadeShrineMaiden 113ecc8f60 Refactored passive nano powers. 2020-09-21 19:51:30 +02:00
dongresource dc9de5a54a Cleaned up implementation of active nano powers. 2020-09-21 19:51:30 +02:00
JadeShrineMaiden 0fc072d591 Initial implementation of nano powers. 2020-09-21 19:51:30 +02:00
Gent 135424b855 Update player visibility on skyway 2020-09-20 15:24:17 -04:00
Gent a5ffe26c44 Move lerp to td init, add variable gap size 2020-09-20 15:24:17 -04:00
Gent 6a78a301c9 Skyway lerp tuning 2020-09-20 15:24:17 -04:00
Gent a5c40b66f5 Add basic Monkey Skyway functionality 2020-09-20 15:24:17 -04:00
CakeLancelot 94583e534b
Merge pull request #102 from darkredtitan/LoadisGMfromConfig.ini
Respect config.ini GM settings
Upon character creation, the GM value from the config will now be used instead of always being set to false. The default in Settings.cpp has also been changed to be consistent with the config.ini in the repo.
2020-09-20 14:04:33 -05:00
darkredtitan ff7c78d545 Change default value for GM to true 2020-09-20 20:50:58 +02:00
CakeLancelot 77df7b7160
Merge pull request #92 from gsemaj/crocpot
Implement Croc Pot item combining
Fix vehicle type override
2020-09-20 13:40:36 -05:00
darkredtitan 6eb21e6d67 Respect config.ini GM settings 2020-09-20 19:53:33 +02:00
CPunch 228a181b74 removed ChunkManager::removeNPC() 2020-09-20 10:34:43 -05:00
Gent c6ec1c46c2 Add documentation for getItemType() 2020-09-19 16:38:50 -04:00
Gent d1c5e272a8 Fix vehicle type override 2020-09-19 15:26:16 -04:00
SengokuNadeko 9bb19efc99
Updated main.cpp for buddy manager init function 2020-09-19 15:08:03 -04:00
SengokuNadeko 7757238a47
Buddy System draft (W.I.P)
The w.i.p buddy system
2020-09-19 15:07:09 -04:00
CakeLancelot 4d437bcb34
Merge pull request #97 from gsemaj/bugfix1
Preventing spawning of invalid items using /itemN
Fix fusion matter amount not displaying on enter
2020-09-19 07:46:56 -05:00
Gent 5dbca0b7b1 Fix fusion matter amount not displaying on enter 2020-09-18 23:26:20 -04:00
CPunch ce9285bab5 support for /unsummon 2020-09-18 16:24:15 -05:00
Gent cd7fec2d5b Fix invalid item bug 2020-09-18 14:45:51 -04:00
CPunch d9d781c37d whoops, everyone had gm 2020-09-18 02:10:30 -05:00
Gent b929d12902 Implement Croc Pot item combining 2020-09-17 23:55:57 -04:00
CPunch 9f78735caa fixed socket reference bug 2020-09-17 22:44:37 -05:00
CPunch 31ef03610d temp fix and small refactor 2020-09-17 21:41:09 -05:00
CPunch 22e3e9e4de fixed 'player clone' bug 2020-09-17 18:03:23 -05:00
CPunch f4db0830ba huge refactoring, chunking added 2020-09-17 17:45:43 -05:00
dongresource 001564a257 Hotfix to stop crashing the server.
This will need to be fixed properly; probably while we implement
chunking.
2020-09-17 21:22:31 +02:00
dongresource e79f179628 Mobs respawn now.
Began work on mob logic. Also cleaned up TableData a little.
2020-09-17 01:43:48 +02:00
dongresource e03da83ff3 Rearranged the codebase a little.
* Deleted empty Player.cpp
* Moved the helper functions from the obsolete CNStructs.cpp into
main.cpp and deleted it
* Renamed CombatManager to MobManager, as that will likely become it's
main focus soon
2020-09-16 21:46:15 +02:00
dongresource 5efc8ac089 Switched getTime() to std::chrono on all platforms. 2020-09-16 20:14:00 +02:00
dongresource efda6673b5 Print server version when starting up.
Also added -ldl to fix cmake compilation on Unix systems.
2020-09-16 20:12:56 +02:00
dongresource f7571607ba Only send live checks when the connection has been silent for a while.
Also:
* Made the timeout configurable
* Removed the stale randomcharacters config option
* Switched to time_t for time values, even though it doesn't really
matter that much
* Halved the keepAliveTimer frequency
2020-09-16 17:45:53 +02:00
Gent 148d90f4f1 "Boosts and potions!"
Fixed crate opening such that the item has an iOpt of 1.
2020-09-14 18:36:50 +02:00
Gent a976fef2b4 Implement vendor stack logic 2020-09-14 10:25:15 -04:00
Gent da8c833587 Implement buyback
Sellability tweak


Add additional item categories
2020-09-14 10:25:15 -04:00
Gent c91022030c Load item tables + price implementation 2020-09-14 10:25:15 -04:00