Commit Graph

93 Commits

Author SHA1 Message Date
P0nk
813768ec47 Remove AddWorld,AddChannel,RemoveWorld,RemoveChannel cmds
These are incredibly error prone and hinder the database migration work.
2024-09-29 07:32:20 +02:00
P0nk
647e67f6e8 Auto-create account in both MySQL and PG 2024-09-26 07:59:27 +02:00
P0nk
b85233359f Save new chr to PG (doesn't work yet because no account) 2024-09-25 18:31:38 +02:00
P0nk
767c4402e7 Route chr creation to dummy CharacterCreator 2024-09-25 07:21:27 +02:00
P0nk
a9967d53b1 Fix chr loading due to "monster_card" table not found 2024-09-25 06:58:19 +02:00
P0nk
0c9643fd7e CharacterSaver integration test with Testcontainers 2024-09-15 11:41:03 +02:00
P0nk
e57d2a9ee2 Create account, chr tables & save chr to Postgres 2024-09-14 17:44:48 +02:00
P0nk
7297cd09b6 Separate PG from MySQL chr saving 2024-09-14 14:56:15 +02:00
P0nk
08eeeb54dc Rename ...Dao -> ...Repository 2024-09-14 12:06:09 +02:00
P0nk
f41268cdde Handle disconnect solely in TransitionService 2024-09-13 22:59:55 +02:00
P0nk
559fe2d550 Merge branch 'refs/heads/master' into feat/postgresql-database
# Conflicts:
#	config.yaml
#	docker-compose.yml
#	pom.xml
#	src/main/java/client/Character.java
#	src/main/java/client/Client.java
#	src/main/java/client/MonsterBook.java
#	src/main/java/client/command/commands/gm0/BuyBackCommand.java
#	src/main/java/client/processor/stat/AssignAPProcessor.java
#	src/main/java/config/ServerConfig.java
#	src/main/java/net/server/channel/Channel.java
#	src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java
#	src/main/java/net/server/channel/handlers/BuddylistModifyHandler.java
#	src/main/java/net/server/channel/handlers/CloseRangeDamageHandler.java
#	src/main/java/net/server/channel/handlers/EnterMTSHandler.java
#	src/main/java/net/server/channel/handlers/NPCTalkHandler.java
#	src/main/java/net/server/channel/handlers/RangedAttackHandler.java
#	src/main/java/net/server/channel/handlers/SummonDamageHandler.java
#	src/main/java/net/server/channel/handlers/UseCashItemHandler.java
#	src/main/java/net/server/handlers/login/CreateCharHandler.java
#	src/main/java/net/server/world/World.java
#	src/main/java/scripting/npc/NPCConversationManager.java
#	src/main/java/server/ItemInformationProvider.java
#	src/main/java/server/life/Monster.java
#	src/main/java/server/life/MonsterInformationProvider.java
#	src/main/java/server/maps/MapleMap.java
#	src/main/java/tools/PacketCreator.java
#	src/test/java/service/NoteServiceTest.java
#	src/test/java/testutil/Any.java
2024-09-02 20:43:55 +02:00
P0nk
4e743128e9 Remove all wildcard imports 2024-05-22 08:33:44 +02:00
P0nk
033d91ed71 Merge branch 'master' into feat/postgresql-database
# Conflicts:
#	config.yaml
#	src/main/java/config/ServerConfig.java
2023-11-08 21:21:07 +01:00
P0nk
0aee9d7c3f Fix unable to create playernpc
The initialization of the running world counters depended on worlds already having been initialized, so I made that dependency more explicit.
2023-09-19 12:56:51 +02:00
P0nk
cd75e85bec Move some autoban logic to new BanService 2023-08-10 22:52:09 +02:00
P0nk
cb31121fe7 Disconnect client with TransitionService 2023-08-10 21:58:55 +02:00
P0nk
d5682a5f65 Add client disconnection logic to TransitionService
Problem: disconnecting requires access to CharacterSaver,
which is not available in Client.
Having it in a service like this solves that problem.

Next step is to migrate all calls to Client#disconnect and Client#forceDisconnect
to their TransitionService counterparts.
2023-08-08 21:51:12 +02:00
P0nk
48d9aaa871 Clean up Client - visibleWorlds & canRequestCharlist
canRequestCharlist is a relic from the past when "View all char"
functionality was hacked together with wrong packets.

visibleWorlds I'm less sure about. I suppose it's useful if you add world
(via command) while someone is still on the login screen.
But the functionality of adding/removing worlds live is a recipe for disaster
and will eventually (likely) be removed.
2023-08-06 20:02:39 +02:00
P0nk
2686b2b02d Disconnect client by throwing exception in handler
This makes it easier to add checks in handlers, which should improve security over time.
I think this approach is more readable and testable than calling Client#disconnect straight up,
while it also decentralizes the handling.
2023-08-06 15:48:49 +02:00
P0nk
4e39142fb3 Direct almost all chr saving through CharacterSaver
Client#disconnectInternal remains.
Had to remove some configurable save points to keep it simple.
2023-08-04 16:14:51 +02:00
P0nk
05b7ec77c8 Add ChannelService to handle cc'ing 2023-08-04 15:01:49 +02:00
P0nk
f6aa8ceba6 Rewrite MonsterBook, touch up chr loading
Temporarily disabled loading monster cards from db
2023-07-25 21:27:35 +02:00
P0nk
785f74ed21 Fix HelpCommand not working without static CommandsExecutor 2023-03-31 07:59:43 +02:00
P0nk
5f0e9a355b Move Shop stuff to own package 2023-03-30 06:47:07 +02:00
P0nk
fe9dd75a23 Instantiate shops in ShopFactory 2023-03-29 21:59:00 +02:00
P0nk
c71ca7f4d5 Inject ShopFactory 2023-03-29 20:51:31 +02:00
P0nk
cc88d382e6 Monster drops are retrieved from DropProvider (postgres db)
This commit emphasizes the need for events to be reworked.
This is the chain of constructors the DropProvider has to pass through to reach MapleMap:
Channel -> EventScriptManager -> EventManager -> EventInstanceManager -> MapManager -> MapleMap
2023-03-16 08:31:38 +01:00
P0nk
eed94ec34a Refactor CommandsExecutor - is no longer static singleton
Preparing for change in Command#handle,
which is going to take a CommandContext as an additional argument.
This way we can pass in command dependencies in a safe way
instead of requiring them to access static methods.
2023-03-15 22:56:40 +01:00
P0nk
703ae30a27 Move "steal item" logic to DropProvider 2023-03-15 22:22:14 +01:00
P0nk
c0c0a2d2d9 Get maker reagent from PG db, rework processor (no statics) 2023-03-02 08:18:13 +01:00
P0nk
f6f3c9c3e3 Initiate Postgres connection pool on startup 2023-02-25 00:11:33 +01:00
P0nk
8bb825ef02 Add Docker compose support for Postgres 2023-02-24 23:42:13 +01:00
P0nk
f1192279bf Add Flyway, run db migration in local PostgreSQL db
First step in my plan to switch away from MySQL.
2023-02-24 21:49:00 +01:00
P0nk
387437cada Workaround for Guild dependence on NoteDao 2022-12-27 11:05:00 +01:00
P0nk
af14da987e Replace FredrickProcessor dependence on NoteDao 2022-12-27 11:04:11 +01:00
P0nk
389b3ad2a4 Add NoteService to handle note operations
NoteService should be the only class with access to NoteDao;
nowhere else should NoteDao be accessed directly.

Channel dependencies are static in PacketProcessor, for now.
Ideally they would be injected in the constructor,
but since the constructor is private and I don't want to open
up that can of worms, I'll leave it like this.
At the very least, now we have a way of injecting services into
the handlers. This will make further restructuring way easier.
2022-12-27 10:34:55 +01:00
P0nk
618f312b84 Remove thread tracker system 2022-08-11 14:57:26 +02:00
P0nk
7e848618e8 Stop using monitored locks in Server 2022-08-11 12:07:38 +02:00
Đạt Nhân Trương
0ef3e69638 Clean up code, replace switch and try-with-resource where possible. 2022-08-07 21:51:10 +07:00
P0nk
2b680c02c8 Mute GraalVM warning spam on startup 2022-08-03 07:57:01 +02:00
P0nk
89ababc5c0 Fix logs being cut off during shutdown 2022-06-19 07:58:17 +02:00
P0nk
513c9b615d Rework View all characters - fix packet and limit max chrs
Thanks to Lehava#4668 for finding the packet structure
2022-03-26 15:51:16 +01:00
P0nk
aceb410331 Stop using java.util.logging.Logger, start using slf4j 2022-02-10 21:49:47 +01:00
P0nk
2bbfd46105 Stop logging with System.out.println, start using slf4j 2022-02-10 21:40:54 +01:00
P0nk
8b630f7357 Migrate yet another batch of FilePrinter users to Slf4j
One FilePrinter.printError() method removed, one more to go
2022-02-09 21:05:22 +01:00
P0nk
0c60606b4e Migrate another batch of FilePrinter users to slf4j.Logger
Another FilePrinter method removed.
2022-02-08 21:08:59 +01:00
P0nk
451d86b5b4 Bump log4j to 2.15.0
2.14.1 and earlier (famously) contains a RCE exploit.
2021-12-11 17:59:41 +01:00
P0nk
4cf3135d48 Fix family loading on server startup
Worlds need to be initialized before families due to an interdependency
2021-11-18 21:17:33 +01:00
P0nk
cdc17ef3dd Use TimeUnit for time calculations 2021-09-10 19:08:58 +02:00
P0nk
6be6ea9927 Reformat and clean up "net" package 2021-09-09 23:26:02 +02:00