From d10d61cc94432407700014bb81ae02f478b1fc17 Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Fri, 13 Jan 2023 22:04:02 +0000
Subject: [PATCH] Addition of GiveItemByExp effect handler.
---
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
.../scripts/handlers/EffectMasterHandler.java | 1 +
.../effecthandlers/GiveItemByExp.java | 87 +++++++++++++++++++
.../game/data/stats/skills/documentation.txt | 1 +
60 files changed, 1780 insertions(+)
create mode 100644 L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_10.3_MasterClass/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
create mode 100644 L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 8f845cab36..cdeb4b913c 100644
--- a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -166,6 +166,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt
index 9a26f93539..9223719131 100644
--- a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt
@@ -138,6 +138,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 510c75ae2d..71fa17ac0e 100644
--- a/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -169,6 +169,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/documentation.txt
index 17e3932a4c..209507eee7 100644
--- a/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_05.0_Salvation/dist/game/data/stats/skills/documentation.txt
@@ -141,6 +141,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 7ce038bf63..637d14d756 100644
--- a/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -170,6 +170,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/documentation.txt
index 14ce2fc2f1..970cce1e75 100644
--- a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/skills/documentation.txt
@@ -142,6 +142,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 7ce038bf63..637d14d756 100644
--- a/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -170,6 +170,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/documentation.txt
index 14ce2fc2f1..970cce1e75 100644
--- a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/skills/documentation.txt
@@ -142,6 +142,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 125c0a8e17..3a708eb83b 100644
--- a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -170,6 +170,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt
index f3b83fbc93..07f3057a62 100644
--- a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/skills/documentation.txt
@@ -142,6 +142,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 41d1207e3a..8171887ff7 100644
--- a/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -171,6 +171,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/documentation.txt
index ce3b41f0b8..4412e81a68 100644
--- a/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/skills/documentation.txt
@@ -143,6 +143,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/EffectMasterHandler.java
index d99611e231..0c07e24d42 100644
--- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -172,6 +172,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/documentation.txt
index 0b43751407..877b7ae53d 100644
--- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/stats/skills/documentation.txt
@@ -143,6 +143,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/EffectMasterHandler.java
index ee70cc0fea..4e3528352a 100644
--- a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -174,6 +174,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/documentation.txt
index 9cd993dc4a..6a33212641 100644
--- a/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/skills/documentation.txt
@@ -145,6 +145,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_10.3_MasterClass/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_10.3_MasterClass/dist/game/data/scripts/handlers/EffectMasterHandler.java
index ee70cc0fea..4e3528352a 100644
--- a/L2J_Mobius_10.3_MasterClass/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_10.3_MasterClass/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -174,6 +174,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_10.3_MasterClass/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_10.3_MasterClass/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_10.3_MasterClass/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/documentation.txt
index 9cd993dc4a..6a33212641 100644
--- a/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_10.3_MasterClass/dist/game/data/stats/skills/documentation.txt
@@ -145,6 +145,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 5f28fb2fe7..c4a78aeb58 100644
--- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -160,6 +160,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/stats/skills/documentation.txt
index 1bcd1dce4d..b2c26c0b17 100644
--- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/stats/skills/documentation.txt
@@ -132,6 +132,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 5b189d6c4f..7badde3de7 100644
--- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -162,6 +162,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/stats/skills/documentation.txt
index 9175a06f17..b92efba097 100644
--- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/stats/skills/documentation.txt
@@ -134,6 +134,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 8e94882ee2..704b062098 100644
--- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -165,6 +165,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/stats/skills/documentation.txt
index 168a005626..d1d8352ab1 100644
--- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/stats/skills/documentation.txt
@@ -137,6 +137,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 8e94882ee2..704b062098 100644
--- a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -165,6 +165,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/stats/skills/documentation.txt
index 168a005626..d1d8352ab1 100644
--- a/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Classic_2.9.5_Saviors/dist/game/data/stats/skills/documentation.txt
@@ -137,6 +137,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 8e94882ee2..704b062098 100644
--- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -165,6 +165,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt
index 168a005626..d1d8352ab1 100644
--- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt
@@ -137,6 +137,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java
index cbb02a274f..2ea9feeef2 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -165,6 +165,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt
index 4acf346d5f..35437e2b25 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt
@@ -137,6 +137,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java
index e9133e8c7e..5eb688c5f6 100644
--- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -162,6 +162,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_Interlude/dist/game/data/stats/skills/documentation.txt
index f6be15b767..9fdb9727a2 100644
--- a/L2J_Mobius_Classic_Interlude/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Classic_Interlude/dist/game/data/stats/skills/documentation.txt
@@ -134,6 +134,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 5514083d73..8ea083023f 100644
--- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -166,6 +166,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveClanReputation", GiveClanReputation::new);
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt
index 7dcdd9c89c..c2c8f36678 100644
--- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt
@@ -138,6 +138,7 @@ GetMomentum: Increases momentum by a given value at fixed rate.
GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/EffectMasterHandler.java
index 08e6133f02..d3097f0b6d 100644
--- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -167,6 +167,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
EffectHandler.getInstance().registerHandler("GiveHonorCoins", GiveHonorCoins::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/stats/skills/documentation.txt
index ae256a5dc1..f386cf9ad0 100644
--- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/stats/skills/documentation.txt
@@ -139,6 +139,7 @@ GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
GiveHonorCoins: Gives a given amount of Honor Coins. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/EffectMasterHandler.java
index a697a7da9f..ec9133fa03 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -169,6 +169,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
EffectHandler.getInstance().registerHandler("GiveHonorCoins", GiveHonorCoins::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/skills/documentation.txt
index 523eb34449..e258305bf1 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/skills/documentation.txt
@@ -141,6 +141,7 @@ GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
GiveHonorCoins: Gives a given amount of Honor Coins. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)
diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java
index a697a7da9f..ec9133fa03 100644
--- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java
+++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java
@@ -169,6 +169,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveExpAndSp", GiveExpAndSp::new);
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
EffectHandler.getInstance().registerHandler("GiveHonorCoins", GiveHonorCoins::new);
+ EffectHandler.getInstance().registerHandler("GiveItemByExp", GiveItemByExp::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
new file mode 100644
index 0000000000..c5a3f7790f
--- /dev/null
+++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/GiveItemByExp.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.effecthandlers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.events.EventType;
+import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayableExpChanged;
+import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+
+/**
+ * @author Mobius
+ */
+public class GiveItemByExp extends AbstractEffect
+{
+ private static final Map CREATURE_VALUES = new ConcurrentHashMap<>();
+
+ private final long _exp;
+ private final int _itemId;
+
+ public GiveItemByExp(StatSet params)
+ {
+ _exp = params.getLong("exp", 0);
+ _itemId = params.getInt("itemId", 0);
+ }
+
+ @Override
+ public void onStart(Creature effector, Creature effected, Skill skill, Item item)
+ {
+ if (effected.isPlayer())
+ {
+ effected.addListener(new ConsumerEventListener(effected, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getPlayable(), (event.getNewExp() - event.getOldExp())), this));
+ }
+ }
+
+ @Override
+ public void onExit(Creature effector, Creature effected, Skill skill)
+ {
+ if (effected.isPlayer())
+ {
+ CREATURE_VALUES.remove(effected.getActingPlayer());
+ effected.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
+ }
+ }
+
+ private void onExperienceReceived(Playable playable, long exp)
+ {
+ if (exp < 1)
+ {
+ return;
+ }
+
+ final Player player = playable.getActingPlayer();
+ final long sum = CREATURE_VALUES.getOrDefault(player, 0L) + exp;
+ if (sum >= _exp)
+ {
+ CREATURE_VALUES.remove(player);
+ player.addItem("GiveItemByExp effect", _itemId, 1, player, true);
+ }
+ else
+ {
+ CREATURE_VALUES.put(player, sum);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/stats/skills/documentation.txt
index 523eb34449..e258305bf1 100644
--- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/stats/skills/documentation.txt
+++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/stats/skills/documentation.txt
@@ -141,6 +141,7 @@ GiveClanReputation: Gives clan reputation points to a players clan. (l2jmobius)
GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
GiveHonorCoins: Gives a given amount of Honor Coins. (l2jmobius)
+GiveItemByExp: Gives an item when a certain amount of EXP is gathered. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveXp: Gives a given amount of XP. (l2jmobius)