Commit graph

7715 commits

Author SHA1 Message Date
Kita
50ba039f91 refactor(scripts): Changed DP scripts to be compiled at build time
Introduced ScriptLoader interface and friends to decouple script loading from DP
2024-11-12 22:51:32 +00:00
Zoey76
49b5c82a6e Unhardcoding Adventure Guildsman 2024-11-10 20:11:09 -03:00
Kita
19d7e5e85e Merged in feature/logging-slf4j (pull request #126)
Migrated logging to slf4j

* style: Added load times logging to Gameserver

* refactor(logging): Migrated logging to slf4j

Fixed some warnings along the way

* refactor(logging): Removed slf4j bridge and JUL

* Minor changes to loggers refactor

Approved-by: Zoey76
2024-11-09 21:43:03 +00:00
Kita
1c9a8fe89e fix(enchant): Fixed enchant support items not usable on the last level of their range 2024-11-07 17:36:58 +00:00
Kita
e40d895cc8 refactor: Migrated EnchantScroll logging to slf4j 2024-11-07 17:36:58 +00:00
Kita
b7c80a182f perf(items): Improved performance of items loading
Parallelized files loading
2024-11-07 17:35:09 +00:00
Kita
1a16db7a2d perf(skills): Improved performance of skills loading
Parallelized files loading
2024-11-07 17:35:09 +00:00
Kita
0468645fd8 perf(zones): Improved performance of zones loading by 75%
Constrained intersection checks to regions containing the bounding box
of the zone.
2024-11-07 14:30:47 -03:00
Kita
ce02fd5167 refactor: Migrated L2WorldRegion to slf4j logging
Minor warning fixes
2024-11-07 14:30:46 -03:00
Kita
8fcdf4489e fix(targets): Fixed Jinia & Kegor buffs not affecting players in Freya instance
The buffs use NOT_FRIEND as the affectObject, which was not affecting players when cast by NPCs due to player.isAutoAttackable(npc) returning false.

Fixes: Bless of Sword (6287), Jinia's Prayer (6288), Kegor's Courage (6289)
2024-11-06 18:48:06 +00:00
Zoey76
da226cdf8a Refactored Object ID Generation
Until now, the `L2Character` constructor directly invoked the
`IdFactory` to generate an Object ID for each new instance. While this
approach simplified the creation process by deferring ID generation to
the constructor, it introduced a tight coupling between various instance
types and `IdFactory`. This coupling increased the complexity of
testing, as multiple components required mocking to isolate `IdFactory`
interactions.

This refactor decouples `IdFactory` by shifting Object ID generation
responsibility outside the constructor. Going forward, new entities
should receive their Object ID as a constructor parameter. This change
enhances testability by allowing instances to be created without
directly relying on `IdFactory`, simplifying mock requirements and
improving modularity.
2024-11-03 20:52:15 -03:00
Zoey76
fb162193d5 Updated Dependencies
Updated SLF4J from 2.0.12 to 2.0.16
Updated GSON from 2.10.1 to 2.11.0
Updated JDA from 5.0.0-beta.22 to 5.1.2
Updated L2J Server Commons from 2.6.7.1 to 2.6.8.0
Updated JUnit Jupiter from 5.10.2 to 5.11.3
Updated Mockito Core from 5.11.0 to 5.14.2
Removed deprecated Mockito Inline
Updated AssertJ from 3.25.3 to 3.26.3
Updated Dependency Check plugin from 9.1.0 to 10.0.4
Updated Maven Jar plugin from 3.3.0 to 3.4.2
Updated Maven Surefire plugin from 3.2.5 to 3.5.1
2024-11-02 20:10:43 -03:00
Kita
9fc97fd3c9 Merged in fix/traps-detect-defuse (pull request #120)
Fixed traps detection & defusing

* refactor: Made L2Object.isVisibleFor() slightly more generic

Changed signature to take L2Character as param instead of L2PcInstance
Moved L2TrapInstance.canBeSeen() logic to an override of isVisibleFor()

* fix(traps): Fixed trap detection skills not revealing traps

Caused by incorrect visibility check in AffectObject.INVISIBLE

Fixes: Detect Trap (470), Find Trap (623)

* fix(traps): Fixed trap defusing skills not removing traps

Caused by traps not being returned by TargetType.ENEMY and being set as invul on summon.
Fixed non defusable trap in Emerald Square, caused by it being set to invul instead of immortal, which prevents negative effects.

Fixes: Defuse Trap (471), Remove Trap (624)


Approved-by: Zoey76
2024-11-02 02:08:57 +00:00
Kita
54b6fb7bdc fix(targets): Fixed targeting for Mass Surrender summoner skills
Fixed POINT_BLANK scope calculating affectObject using target as the caster
Fixed debuffs with targetType SUMMON not being castable. Caused by the server seeing them as debuffs being cast on the summon, as opposed to from the summon.
Added a couple of unit tests for Skill
2024-11-02 01:37:42 +00:00
Kita
56d24c2bfa style: Unified tests naming to camelCase & visibility to package-private 2024-10-27 16:11:34 +00:00
Kita
c12142b506 fix(targets): Fixed AffectScope test failures 2024-10-26 14:24:17 +01:00
Zoey76
d6d789c24c Fixed RANGE_SORT_BY_HP affect scope
- Included target, it was being excluded.
- Added affect scope filtering.
- Added support for "target index" in a list of effected targets,
required for "Chain Heal" skill that decreases the power of the skill on
each effected target.
- Fixes #229

Reported by: FinalDestination, Hadriel
Thanks: Pablo Recchia, HorridoJoho, Kita
2024-10-25 20:38:37 -03:00
Kita
e8bf06114d fix: Fixed inverted door emitter flag
This was causing doors with emitters to appear closed when open and vice-versa.
Affected are all doors in Nornil's Garden and Hellbound's barrier to the Battered Lands
2024-10-16 19:06:58 +01:00
Charus
b5e4432e67 feature/dimension_keepers + onQuestAccept event 2024-06-02 22:10:06 +03:00
Zoey76
a7213a541e Skill Learn rework
- Refactored `AcquireSkillList` packet to avoid wasting memory.
- Removed `L2Trainer` instance, it will be handled in Datapack.
- Removed custom `L2Npc` "no teach HTML" code, it will be handled in
Datapack.
- Removed custom `L2NpcInstance` "show skill list" code, it will be
handled in Datapack.
- Removed custom `L2NpcTemplate` "teach info", , it will be handled in
Datapack using retail-like categories.
- Minor refactor of `L2SkillLearn` to use `LinkedList`, it should reduce
the memory foot print.
- Removed custom `NpcData` "learn data", it should reduce the memory
foot print and start up time.
- Added PlayerMenuSelected event and onMenuSelected method.
- Added/fixed PlayerSkillLearned and onAcquireSkill, now
onLearnSkillRequested, using event system.
- Fixes to link bypass.
2024-05-10 22:06:15 -03:00
Zoey76
fad4e334eb Removing legacy onEvent method and renaming onAdvEvent to onEvent. 2024-04-24 19:04:16 -03:00
Zoey76
48d623e8fa Refactoring Events
Renamed `IBaseEvent` to `BaseEvent`.
Removed `ON_` and `On` from all event types and events.
Converted all events DTOs to Java records.
Renamed all methods to `bind` instead of `add`.
2024-04-24 15:14:05 -03:00
Zoey76
dba15e94cb Unhardcoding Officer Tolonis AI
Implemented Learn Skill Requested event.
Using Java records to represent events.
Removed `ON_` and `On` from event type and event object.
The `onLearnSkillRequested` method will receive the event object instead
of several parameters.
Methods to reference NPCs to the event will start with `bind` instead of
`add`.
A `setLearnSkillRequested(...)` method was avoided.

The rest of the changes to existing events will be done in a separated
commit.
2024-04-24 01:40:05 -03:00
Zoey76
8a423b73fa Minor typo fixing in configuration texts 2024-04-23 19:11:09 -03:00
Zoey76
bfe59d2e03 Minor configuration rework related to L2J_HOME
Centralized code using OWNER configuration framework.
Added the ability to create the path to custom configs (prevents an
exception if the user didn't create it in advance).
2024-04-20 16:15:03 -03:00
Zoey76
cca3ff0110 Updating Dependencies 2024-04-11 19:21:39 -03:00
Zoey76
3c35c6f276 Copyright Update 2024 2024-04-11 18:30:01 -03:00
Zoey76
0bbf8be037 Replacing Java Util Logging with SLF4J
Added and fixed JavaDocs.
Fixed typos in logs.
Simplified Quest methods.
2024-02-27 17:06:06 -03:00
HorridoJoho
2a2ea58963 Fix maven java compiler configs.
Remove the -proc:full configuration from pom.xml. We target Java 21, but
the JDK21 does not support "full" (it is the default value, but it can
not be set on the command line). "full" is only supported on JDK22+.

https://inside.java/2023/10/23/quality-heads-up/
2024-02-23 21:02:06 +01:00
Zoey76
a9d81c12f1 Adding a "ci" profile to run Dependency Checks
If you are going to contribute to L2J, please run it locally with `mvnw
clean install -Pci` so you can check that there are no known
vulnerabilities.
2023-12-18 00:59:34 -03:00
Zoey76
ad38939fd3 Updating JDA (Discord Java SDK) from 4.4.0 to 5.0.0-beta.18
Followed the guide: https://jda.wiki/introduction/migration-v4-v5/

The idea is to reduce the vulnerabilities, but some of them are still
present in this version...

Known vulnerabilities in JDA:
CVE-2023-35116
CVE-2022-24329
CVE-2023-3635
2023-12-16 18:47:20 -03:00
Zoey76
93c00daf0f Fixing Warnings and Build Errors
Warning 1:
WARNING: A Java agent has been loaded dynamically
(\.m2\repository\net\bytebuddy\byte-buddy-agent\1.14.9\byte-buddy-agent-1.14.9.jar)
WARNING: If a serviceability tool is in use, please run with
-XX:+EnableDynamicAgentLoading to hide this warning
WARNING: If a serviceability tool is not in use, please run with
-Djdk.instrument.traceUsage for more information
WARNING: Dynamic loading of agents will be disallowed by default in a
future release

Warning 2:
Annotation processing is enabled because one or more processors were
found on the class path. A future release of javac may disable
annotation processing unless at least one processor is specified by name
(-processor), or a search path is specified (--processor-path,
--processor-module-path), or annotation processing is enabled explicitly
(-proc:only, -proc:full).
Use -Xlint:-options to suppress this message.
Use -proc:none to disable annotation processing.

Warning 3:
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot
loader classes because bootstrap classpath has been appended
2023-12-16 17:42:31 -03:00
Zoey76
37ea166a09 Adding nvdApiKey property so we can get rid of the NDA warning.
Set your NVD API Key as an environment variable:
NVD_API_KEY=<api key>

Get your own API Key at
https://nvd.nist.gov/developers/request-an-api-key
2023-12-13 16:54:31 -03:00
Zoey76
903fdc0f8b Updated Game Server to Java 21
Updated Log4J to 2.22.0
Updated L2j Commons to 2.6.7.0
Updated Geo Driver to 2.6.5.0
Updated Dependency Check to 9.0.2
2023-12-02 19:40:19 -03:00
Zoey76
6183fed005 Maven Update
Updated Maven Wrapper to 3.2.0
Updated Maven to 3.9.5
Minor fixes preparing for Java 21
2023-11-25 11:23:17 -03:00
Sky
0b461a8a59 Fixed when Herbs are not applied and the system message is not printed when a mob is killed by a spell while herb auto-loot is on.
Reported by: @HD321kbps, @Maneco2
2023-11-21 00:38:08 +00:00
Zoey76
e0671bc8e7 Dependency Update 2023-11-19 19:49:00 -03:00
Sky
493258a00e monsters ignore the pvp checks in ENEMY_ONLY 2023-11-17 23:55:28 +00:00
HorridoJoho
aceabd673c Fix missing changes for Hero load-/saving 2023-11-12 18:11:34 +01:00
HorridoJoho
ddb0d85a05 Use setBoolean for bool fields in database
Required by datapack and database update. Previously, boolean fields in
the database were of type enum ('true','false'). The datapack changes
this to type bool.
2023-11-05 11:43:57 +01:00
Zoey76
96e9612256 Refactoring AbstractEffect
Replaced JUL with SLF4J.
Simplified createEffect method.

Requires datapack update.
2023-10-30 17:02:54 -03:00
Zoey76
099e6fbadd Refactoring L2AttackableAI
Changed _skill to protected.
Now L2AttackableAI won't implement Runnable anymore.
Externalized class FearTask to reduce the size of L2AttackableAI.
Removed method getActiveChar(), replaced it with a covariant version of
getActor() method, honoring OOP.
Renamed variables from me and npc to actor.
Using Java 10 local variable type inference where it's possible.
Other minor fixes.
2023-10-29 22:24:33 -03:00
Zoey76
ac23515f57 Adding basic unit test for IDropCalculationStrategy 2023-10-27 22:51:03 -03:00
Zoey76
e010e5ae69 General Project Formatting
Updated project formatter and code clean up settings.
Using Pattern Matching for instanceof.
Minor optimizations.
Removed redundant code.
2023-10-24 23:05:59 -03:00
Zoey76
f1deb6d7d9 Updating Dependencies
SLF4J from 2.0.6 to 2.0.9
Log4J from 2.19.0 to 2.21.0
JDA from 4.3.0_330 to v4.4.0
L2j Commons from 2.6.6.1 to 2.6.6.4
JUnit from 5.9.2 to 5.10.0
Mockito from 5.0.0 to 5.6.0
Mockito Inline from 5.0.0 to 5.2.0
Maven Surefire from 3.0.0-M8 to 3.1.2
Maven Assembly from 3.4.2 to 3.6.0

Removed JDA's custom repository, version 4.x uses jitpack.io.

Fixed build final name.

Added Dependency Check Maven Plugin
2023-10-22 18:01:52 -03:00
Charus
6a976bb1aa Moving dimensional rift npc's to ai scripts 2023-07-16 02:45:56 +03:00
Charus
311882cb40 SSQ Teleporters to AI script (core) 2023-06-23 13:17:51 +03:00
Charus
85f117da48 Seven Signs AI core support 2023-06-22 02:31:52 +03:00
Charus
92707a1dfe moving blacksmith of mammon to ai script 2023-06-08 03:29:57 +03:00
Charus
54a96add14 moving black marketeer to ai script 2023-06-08 03:15:08 +03:00