From 0956641ab1befe7decba22da795c549c5cd27846 Mon Sep 17 00:00:00 2001
From: HorridoJoho <HorridoJoho@l2jserver.com>
Date: Sun, 5 Dec 2021 23:55:28 +0100
Subject: [PATCH] Working on effects.

+ Added BonusCountUp effect
* Renamed and moved NevitsHourglass effect to BonusTimeLimitUp
* Modified EffectMasterHandler
---
 .../handlers/EffectMasterHandler.java         |  4 +-
 .../effecthandlers/instant/BonusCountUp.java  | 55 +++++++++++++++++++
 .../BonusTimeLimitUp.java}                    | 15 ++---
 3 files changed, 64 insertions(+), 10 deletions(-)
 create mode 100644 src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/BonusCountUp.java
 rename src/main/java/com/l2jserver/datapack/handlers/effecthandlers/{instant/NevitHourglass.java => pump/BonusTimeLimitUp.java} (84%)

diff --git a/src/main/java/com/l2jserver/datapack/handlers/EffectMasterHandler.java b/src/main/java/com/l2jserver/datapack/handlers/EffectMasterHandler.java
index ab5775cf57..527e9433f1 100644
--- a/src/main/java/com/l2jserver/datapack/handlers/EffectMasterHandler.java
+++ b/src/main/java/com/l2jserver/datapack/handlers/EffectMasterHandler.java
@@ -53,6 +53,7 @@ import com.l2jserver.datapack.handlers.effecthandlers.pump.BlockDamage;
 import com.l2jserver.datapack.handlers.effecthandlers.pump.BlockDebuff;
 import com.l2jserver.datapack.handlers.effecthandlers.pump.BlockParty;
 import com.l2jserver.datapack.handlers.effecthandlers.pump.BlockResurrection;
+import com.l2jserver.datapack.handlers.effecthandlers.pump.BonusTimeLimitUp;
 import com.l2jserver.datapack.handlers.effecthandlers.pump.ChangeFishingMastery;
 import com.l2jserver.datapack.handlers.effecthandlers.pump.CrystalGradeModify;
 import com.l2jserver.datapack.handlers.effecthandlers.pump.CubicMastery;
@@ -193,7 +194,8 @@ public final class EffectMasterHandler {
 		Mp.class,
 		MpPerMax.class,
 		Mute.class,
-		NevitHourglass.class,
+		BonusCountUp.class,
+		BonusTimeLimitUp.class,
 		NoblesseBless.class,
 		OpenChest.class,
 		OpenCommonRecipeBook.class,
diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/BonusCountUp.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/BonusCountUp.java
new file mode 100644
index 0000000000..21eef1ab00
--- /dev/null
+++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/BonusCountUp.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2004-2021 L2J DataPack
+ * 
+ * This file is part of L2J DataPack.
+ * 
+ * L2J DataPack 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.
+ * 
+ * L2J DataPack 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 <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.datapack.handlers.effecthandlers.instant;
+
+import com.l2jserver.gameserver.model.StatsSet;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.conditions.Condition;
+import com.l2jserver.gameserver.model.effects.AbstractEffect;
+import com.l2jserver.gameserver.model.skills.BuffInfo;
+
+/**
+ * This effect instantly raises recommendations to give out by the specified count.
+ * @author HorridoJoho
+ * @since 2.6.3.0
+ */
+public class BonusCountUp extends AbstractEffect {
+	private final int _count;
+	
+	protected BonusCountUp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) {
+		super(attachCond, applyCond, set, params);
+		_count = set.getInt("count", 0);
+	}
+	
+	@Override
+	public void onStart(BuffInfo info) {
+		super.onStart(info);
+		
+		L2PcInstance player = info.getEffected().getActingPlayer();
+		if (player != null)
+		{
+			player.setRecomLeft(player.getRecomLeft() + _count);
+		}
+	}
+
+	@Override
+	public boolean isInstant() {
+		return true;
+	}
+}
diff --git a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/NevitHourglass.java b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BonusTimeLimitUp.java
similarity index 84%
rename from src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/NevitHourglass.java
rename to src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BonusTimeLimitUp.java
index d10d208ea3..9290a28c98 100644
--- a/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/instant/NevitHourglass.java
+++ b/src/main/java/com/l2jserver/datapack/handlers/effecthandlers/pump/BonusTimeLimitUp.java
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2004-2021 L2J DataPack
+ * Copyright © 2004-2021 L2J DataPack
  * 
  * This file is part of L2J DataPack.
  * 
@@ -16,7 +16,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package com.l2jserver.datapack.handlers.effecthandlers.instant;
+package com.l2jserver.datapack.handlers.effecthandlers.pump;
 
 import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.conditions.Condition;
@@ -31,15 +31,12 @@ import com.l2jserver.gameserver.network.serverpackets.UserInfo;
  * @author Maneco2
  * @since 2.6.3.0
  */
-public final class NevitHourglass extends AbstractEffect {
+public final class BonusTimeLimitUp extends AbstractEffect {
+	private final int _time;
 	
-	public NevitHourglass(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) {
+	public BonusTimeLimitUp(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) {
 		super(attachCond, applyCond, set, params);
-	}
-	
-	@Override
-	public boolean isInstant() {
-		return true;
+		_time = set.getInt("time", 0);
 	}
 	
 	@Override
-- 
GitLab