Commit graph

56 commits

Author SHA1 Message Date
Renovate Bot 768172d13a Update dependency commons-io:commons-io to v2.7 2020-09-02 00:11:02 +02:00
Renovate Bot 8c768fadac Update akka packages to v2.6.8 2020-09-02 00:10:49 +02:00
Renovate Bot c3222ef568 Update dependency com.github.t3hnar:scala-bcrypt to v4.3.0 2020-09-02 00:01:19 +02:00
Jakob Gillich 0429003863 Auto publish docs 2020-08-26 06:19:00 +02:00
Jakob Gillich f4fd78fc5d Restructure repository
* Move /common/src to /src
* Move services to net.psforever package
* Move /pslogin to /server
2020-08-26 06:19:00 +02:00
Jakob Gillich 3bdc681c9d Avatar Persistence
* Add AvatarActor: Responsible for managing the session's avatar object
* Convert Avatar object to case class
* Add persistence for BEP, CEP, implants, certs and cosmetics
* Add cosmetic chat commands and handle UI packet
* Add /setbr, /setcr, /certadd, /addbep, /addcep GM commands
* Convert zone maps to JSON
* Update to Scala 2.13.3 and fix warnings
* Fix MAX cooldowns not being applied when purchased manually
* Normalize database table names to singular
* Add docker image build
2020-08-22 16:19:13 +02:00
Jakob Gillich 1efbedcf8e Fix coverage exclusions 2020-08-22 16:19:13 +02:00
Jakob Gillich ff8f787b81 Add Sentry 2020-08-22 16:19:13 +02:00
Jakob Gillich 3345e56b38 Building persistence
Buildings will now persist their faction in the database. At least
that's what I want you to believe this change is.

What it actually is: A rework of InterstellarCluster and groundwork
for further reworks.

InterstellarClusterService: This is the old InterstellarCluster, but
as a service (it has always been one in secret). It was converted to
a typed actor and it now handles all spawn point requests.

ZoneActor: Basically ZoneControl, but as a typed actor. It's more of a
stub right now, the eventual goal is to have it own the `Zone` object
rather than the other way around.

BuildingActor: BuildingControl, but as a typed actor.

Also includes some minor improvements to ChatActor and sets
SupervisorStrategy.restart for all typed actors (which is the default
for classic actors, but not for typed actors - we may want to get more
sophisticated here in the future).
2020-08-22 16:19:13 +02:00
Jakob Gillich 4634dffe00 ChatActor
This removes roughly 1k LOC from WorldSessionActor and moves
them to a new ChatActor. That was the initial goal anyway, but it
wasn't that simple. There was no clear location to put this new actor,
I didn't want to put it in pslogin since it isn't part of the "login server"
(and neither is WSA). But since the new actor would have to talk to
WSA and common does not depend on pslogin, I had a choice of
putting more actors in pslogin or putting everything in common. I
chose the latter.

ChatActor and SessionActor (formerly WorldSessionActor) now live
in `common/actors/session`. Since WSA also depends on other
actors in pslogin, most of the pslogin code was moved to either
common/login or common/util. PsLogin as the main entry point
remains in pslogin since having the main code compile to a library
has some advantages, and it will allow us to produce binaries
for distinct login/world servers in the future if desired. For a second
take, I'd suggest moving common to /src in the root directory.

This change is enabled by a new immutable `Zone` object that is
passed from SessionActor to ChatActor. Most of its members are
still mutable references, and the code at the moment does depend
on this being the case. Changes to the session object in
SessionActor are forwarded through a SetZone message to
ChatActor. As we split out more code into actors, we could
use EventBus or typed Topic's instead.

Also included is a reworked ChatService that was converted to a
typed actor and uses the built-in Receptionist facility for service
discovery. By receiving the session object from ChatActor, it can
be much smarter about who to send messages to, rather than
sending all messages to everyone and having them figure it out.
But as this session object is not updated, it can only use static
properties like player name and faction and not fluid properties
like position.

The following chat commands were added:
command, note, gmbroadcast, [nc|tr|vs|broadcast, gmtell, gmpopup
and !whitetext
2020-08-22 16:19:13 +02:00
Jakob Gillich 4dd24ff01a Fix packed binary
I moved PsLogin into a package but didn't update `packMain`
2020-07-23 21:53:45 +02:00
Jakob Gillich 752a195178
Add command line interface
Comes with a flag to run flyway baseline automatically
2020-07-14 19:31:59 +02:00
Jakob Gillich e0defe8240
Persistence #1 featuring quill (#508)
* Add .scalafmt.conf

* Adopt quill for database access

* Removed postgresql-async
* Refactored all instances of database access
* Creating duplicate characters of the same account is no longer possible
* Rewrote large parts of LoginSessionActor

* Implement migrations

* Move overrides into subdirectory

* Make usernames case insensitive

* Use LOWER(?) comparison instead of storing lowercased username

* import scala.util.{Success, Failure}

* Add config and joda-time dependencies

* Add sbt-scalafmt

* Use defaultWithAlign scalafmt preset

* Format all

* Add scalafix

* Remove unused imports

* Don't lowercase username when inserting

* Update readme

* Listen on worldserver.Hostname address

* Remove database test on startup

It could fail when the global thread pool is busy loading zone
maps. Migrations run on the main thread and also serve the
purpose of verifying the database configuration so it's fine to
remove the test altogether.

* Refactor chat message handlers, zones

What started as a small change to how zones are stored turned
into a pretty big effort of refactoring the chat message handler.
The !hack command was removed, the /capturebase commandwas added.

* Expose db ports in docker-compose.yml

* Silence property override log

* Rework configuration

* Unify configuration using the typesafe.config library
* Add configuration option for public address
* Configuration is now loaded from application.conf rather than worldserver.ini
* Refactor PsLogin and remove unnecessary logging
* Move pslogin into net.psforever.pslogin namespace

* Fix coverage
2020-07-13 23:54:05 -04:00
Jakob Gillich 116860b3be
XTools V3
* Use command line interface instead of hard-coded paths
* Takes in both .gcap and parsed gcapy files
* Add pack config to allow system-wide installation
* Slightly change output format from [C|S] -> [C|s] to C [<<<|>>>] S
* Add some documentation to README
2020-06-10 14:26:32 +02:00
Mazo e56f4dfd3b Remove unnecessary dependency 2020-06-05 21:51:47 +01:00
Mazo d58550dc3b Add missing dependency on common package 2020-06-05 21:12:08 +01:00
Mazo 094cb3046f Move XToolsV2 into a new tools/decode-packets project 2020-06-05 21:08:54 +01:00
Mazo 663616ddf1 XTools V2 2020-06-05 21:08:23 +01:00
Fate-JH bd82d332fa
Let's Move Item, Together, Again (#445)
* mix-in code for akka messaging move item, currently testing on infantry only

* adjusted structure of COntainable so callbacks are separate from message-producing functions, are separate from message-sending functionality; massaged LockerContainer until it could support control agency and created a wrapper for its Equipment interfacing; the control structure starts and stops when PlayerControl starts and stops, and it converts whenever necessary

* added failsafe conditions to Containable, such as blocking certain messages while completing a MoveItem call, or blocking all messages to reset disruptive MoveItem calls; depiction message callbacks for Player, Locker, and Vehicle, to properly depict the manipulation of items; eliminated the old code from WSA

* added useful comments to Containable; moved functionality for deployables, and for container'ing, and dropping logic out from WSA and distributed it appropriately

* handling terminal operations - buying an exosuit and selecting an infantry loadout; starting work on support for more persistent equipment timers local to the avatar (that were removed in this update; see wsa changes)

* linked terminal page/message with routing policy

* tuning vehicle loadout management and display

* separated use time from purchase time and applied a system that limits either if that same event would recur too soon; tuning exosuit and loadout changes

* some ask timeout handling and comments

* normalizing item on ground interactions

* rearranging the project structure

* merged with master; commas removed

* fixing tests

* added description strings to Tasks; adjusted the completion conditions for some Tasks

* a failed purchase will not block future purchases; increased timeout on move-item tasks

* corpses, even one's own, should have properly moveable inventories

* for better persistence, until GlobalDefinitions is renovated, moved the object id->name map onto the avatar object, for the purpose of timers; replaced a use of values in GridInventory for a map conversion

* max loadouts and max exosuit switch use same cooldown now; hopefully better clarifcation regarding held arm position

* manual merge-rebase of master with hand reconstruction of WorldSessionActor and PlayerControl, and variations for other files necessary to maintain both inventory operations and login reliability

* test fixes; MAX exo-suit cooldown is now five minutes again
2020-06-04 16:39:08 -04:00
FateJH 7162aa9c17 reactivating sbt-unidocs plugin 2020-05-29 19:12:07 -04:00
Jakob Gillich e51e970e51
Update to Scala 2.13 & Akka 2.6.5 (#461)
* update scala to 2.13 & update dependencies

* fix test

* import scodec-akka

* scala 2.13 fixes

* Work around futures not completing when awaited within object constructor

Co-authored-by: Mazo <mazo2@hotmail.com>
2020-05-26 16:16:22 -04:00
Mazo 896fa7bf07 Revert "Let's Move Item, Together (#429)"
This reverts commit 3f2240947b.
2020-05-16 19:10:06 +01:00
Fate-JH 3f2240947b
Let's Move Item, Together (#429)
* mix-in code for akka messaging move item, currently testing on infantry only

* adjusted structure of COntainable so callbacks are separate from message-producing functions, are separate from message-sending functionality; massaged LockerContainer until it could support control agency and created a wrapper for its Equipment interfacing; the control structure starts and stops when PlayerControl starts and stops, and it converts whenever necessary

* added failsafe conditions to Containable, such as blocking certain messages while completing a MoveItem call, or blocking all messages to reset disruptive MoveItem calls; depiction message callbacks for Player, Locker, and Vehicle, to properly depict the manipulation of items; eliminated the old code from WSA

* added useful comments to Containable; moved functionality for deployables, and for container'ing, and dropping logic out from WSA and distributed it appropriately

* handling terminal operations - buying an exosuit and selecting an infantry loadout; starting work on support for more persistent equipment timers local to the avatar (that were removed in this update; see wsa changes)

* linked terminal page/message with routing policy

* tuning vehicle loadout management and display

* separated use time from purchase time and applied a system that limits either if that same event would recur too soon; tuning exosuit and loadout changes

* some ask timeout handling and comments

* normalizing item on ground interactions

* rearranging the project structure

* merged with master; commas removed

* fixing tests

* added description strings to Tasks; adjusted the completion conditions for some Tasks

* a failed purchase will not block future purchases; increased timeout on move-item tasks

* corpses, even one's own, should have properly moveable inventories

* for better persistence, until GlobalDefinitions is renovated, moved the object id->name map onto the avatar object, for the purpose of timers; replaced a use of values in GridInventory for a map conversion

* max loadouts and max exosuit switch use same cooldown now; hopefully better clarifcation regarding held arm position
2020-05-16 12:18:08 -04:00
Chord a80e869fb9 Map performance critical actors to dedicated dispatchers
Using built-in akka configs, we are able to map Actors to dispatchers in
a fine-grained way. Now each session router, network listener, and zone
have a dedicated set of threads. Currently all WorldSessions are sharing
a single worker pool, which means that the server could still crash if
all worker threads are exhausted. To prevent conditions like these, the
amount of time spent on single actors based on time and number of
messages can be tuned.Threads when not receiving work exit to save
resources.

Also all .conf files are now included in the resource packing process.
Users should create user.conf to override these .conf files to avoid
losing edits when updating the server version.
2020-05-12 07:41:46 +02:00
Chord c5528ac6a4 Revert missing class loader strategy 2020-05-11 15:24:10 +02:00
Chord 82e8840176 Create PsAdmin framework
PsAdmin uses a dedicated TCP port to allow for remote queries and
command to be sent to the running World/Login server. Commands are a
single command followed by zero or more arguments.

Commands may require access to the ActorSystem, so they will get their
own dedicated actors to be able to handle the different messages
required that can be sent in response to a query. The return line is in
JSON to allow for easy parsing by applications, such as web servers.
An interactive client is easy as being able to parse json and buffer
command input.

Some basic commands are implemented for now:

* shutdown - kills the actor system
* list_players - gets a list of players on the interstellar cluster
* dump_config - get the running config
* thread_dump - dumps all thread backtraces (useful for prod debugging)

More advanced commands like kick/ban will require additional testing.
2020-05-11 04:18:29 +02:00
Mazo 61360d97e0
Kamon tweaks (#401)
* Move application.conf to src/main/resources

* Change ClassLoaderLayeringStrategy for Kanela / Kamon to intiialize properly

* Attempt at reducing PTSv3 log spam

* Silence some more logspam

* Disable oshi logging entirely
2020-05-04 00:27:41 -04:00
Mazo eabb952683
Add kamon.io metrics reporting (#395)
* Add kamon.io metrics reporting

* Line length + whitespace
2020-04-29 14:59:12 -04:00
pschord b1be0ffdb3
Upgrade SBT to 1.3.6 (#322) 2020-01-13 17:59:24 -05:00
pschord d08911d07c Account and Character Database and Config Improvements (#317)
* Create Account/DB abstraction

* Fix crash when removing boomers from deconstructed player

* Extend config to include database and worldserver info

* Improve ConfigParser tests

* Add database setup documentation

* Add xTriad to THANKS file

**

* Increase bcrypt rounds and fix readme link
2020-01-10 11:13:37 -05:00
pschord ae7f8bf71d Enable quiet tests using SBT config (#318)
* Enable quiet tests using SBT config

* Add logback-test.xml config to reduce log messages

* Hide "resolving" messages in CI environment

* Improve ScalaTest options to reduce SuiteStart events

* Hide EVEN MORE Specs2 output
2020-01-08 08:33:25 -05:00
Chord bf21491859 TravisCI: re-enable coverage, exclude WorldSessionActor
* Update badge to travis-ci.com
* Add artifact upload to S3 testing for future CI based server deploys
2019-12-13 13:48:15 -05:00
Mazo 7b6063055a Basic lattice functionality (#296)
* Move isMoving check to outer block to fix scoping issues

* Initial basic lattice functionality

* Small tweaks to tests
2019-12-10 09:17:54 -05:00
Fate-JH a5a85e6cc3
Upper Body Angle (#292)
* constrain angles on specialized yaw and pitch fields

* integrated new Angular Codec into OCM and OCDM of avatar; corrected tests; wrote shortcut for whether a unit is moving (under its own power)

* apply clamp

* Accessed containers while moving

Removed unintentional code duplication outside of conditional.
2019-11-29 11:14:25 -05:00
Chord 9836e48ac7 Fix flaky actor tests by de-parallelizing 2019-10-22 14:35:17 -04:00
pschord 33e4f2b35e
SBT: add support for unified docs (#284)
Unified documentation can be generated with the sbt unidoc command.
2019-10-21 16:29:36 -04:00
pschord c3d19b5377
Create PSForever config framework (#283)
We can now parse arbitrary INI configuration entries. This will allow
server customization and testing without recompiling the server.
2019-10-21 14:12:26 -04:00
Chord 6a876d5b57 Add feature flag to SBT scalac options 2019-10-11 11:50:00 -04:00
FateJH e6646c2352 deleted unnecessary intermediary class; modified current Actor tests to operate under akka-testkit, which required changing the dependencies 2017-08-16 18:23:09 -04:00
FateJH 1b789154bf added compiler flag '-language:postFixOps' to stop warnings about time post-fix notation ('100 milliseconds') 2017-05-05 08:22:17 -04:00
Chord 04ae44c3a9 Improve LoginRespMessage, write test, and begin DB 2017-03-04 14:55:43 -05:00
L-11 88b6974edc Initial support for server REPL (#68)
* Initial support for server console

* Expand README

* Fix unmanagedClasspath for `sbt pslogin/console`
2016-08-26 23:46:57 -04:00
Chord ccad92a555 Increase client keep alive interval, add dynamic log files 2016-08-05 18:12:51 -04:00
Chord ae6687c38f Create advance session management and reaping 2016-07-30 21:08:40 -04:00
Chord 6c86ac92a7 Fix logback debug file and bump version 2016-07-29 03:02:58 -04:00
Chord ce5461da66 Travis: enable code coverage 2016-07-26 22:31:54 -04:00
Chord 1168022db9 Add resource directories and config/ 2016-07-26 21:48:58 -04:00
Chord 35a592476f Add classpath for native pscrypto libraries 2016-07-26 20:41:02 -04:00
Chord 7af6f64429 Rebump scodec-akka due to fix 2016-06-04 13:23:37 -04:00
Chord 50fb65ac57 Version bump scodec and specs2
Also fix assorted casting errors and improve test case readability
2016-06-03 21:47:45 -04:00