Selaa lähdekoodia

BETA: Datapack part for [L6516].
* Unhardcoded Cubic Mastery.
* Moved cubic count to effect parameter.
* Moved divine inspiration slot count to effect parameter.
* Removed iterations every time the maximum cubic count is needed.
* Removed all left overs of `noicon` and `val` in effect's attributes.

Zoey76 11 vuotta sitten
vanhempi
sitoutus
a8d78fa6fe

+ 21 - 3
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/CubicMastery.java

@@ -3,7 +3,6 @@ package handlers.effecthandlers;
 import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.conditions.Condition;
 import com.l2jserver.gameserver.model.effects.AbstractEffect;
-import com.l2jserver.gameserver.model.effects.L2EffectType;
 import com.l2jserver.gameserver.model.skills.BuffInfo;
 
 /**
@@ -12,9 +11,13 @@ import com.l2jserver.gameserver.model.skills.BuffInfo;
  */
 public final class CubicMastery extends AbstractEffect
 {
+	private final int _cubicCount;
+	
 	public CubicMastery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
 	{
 		super(attachCond, applyCond, set, params);
+		
+		_cubicCount = params.getInt("cubicCount", 0);
 	}
 	
 	@Override
@@ -24,9 +27,10 @@ public final class CubicMastery extends AbstractEffect
 	}
 	
 	@Override
-	public L2EffectType getEffectType()
+	public void onStart(BuffInfo info)
 	{
-		return L2EffectType.CUBIC_MASTERY;
+		final int cubicCount = info.getEffected().getActingPlayer().getStat().getMaxCubicCount() + _cubicCount;
+		info.getEffected().getActingPlayer().getStat().setMaxCubicCount(cubicCount);
 	}
 	
 	@Override
@@ -34,4 +38,18 @@ public final class CubicMastery extends AbstractEffect
 	{
 		return info.getSkill().isPassive();
 	}
+	
+	@Override
+	public void onExit(BuffInfo info)
+	{
+		final int cubicCount = info.getEffected().getActingPlayer().getStat().getMaxCubicCount() - _cubicCount;
+		if (cubicCount <= 0)
+		{
+			info.getEffected().getActingPlayer().getStat().setMaxCubicCount(0);
+		}
+		else
+		{
+			info.getEffected().getActingPlayer().getStat().setMaxCubicCount(cubicCount);
+		}
+	}
 }

+ 16 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/EnlargeAbnormalSlot.java

@@ -29,9 +29,13 @@ import com.l2jserver.gameserver.model.skills.BuffInfo;
  */
 public final class EnlargeAbnormalSlot extends AbstractEffect
 {
+	private final int _slots;
+	
 	public EnlargeAbnormalSlot(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
 	{
 		super(attachCond, applyCond, set, params);
+		
+		_slots = params.getInt("slots", 0);
 	}
 	
 	@Override
@@ -40,9 +44,21 @@ public final class EnlargeAbnormalSlot extends AbstractEffect
 		return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer();
 	}
 	
+	@Override
+	public void onStart(BuffInfo info)
+	{
+		info.getEffected().getStat().setMaxBuffCount(info.getEffected().getStat().getMaxBuffCount() + _slots);
+	}
+	
 	@Override
 	public boolean onActionTime(BuffInfo info)
 	{
 		return info.getSkill().isPassive();
 	}
+	
+	@Override
+	public void onExit(BuffInfo info)
+	{
+		info.getEffected().getStat().setMaxBuffCount(Math.max(0, info.getEffected().getStat().getMaxBuffCount() - _slots));
+	}
 }

+ 1 - 12
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/SummonCubic.java

@@ -24,7 +24,6 @@ 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;
-import com.l2jserver.gameserver.model.skills.CommonSkill;
 import com.l2jserver.util.Rnd;
 
 /**
@@ -108,17 +107,7 @@ public final class SummonCubic extends AbstractEffect
 		{
 			// If maximum amount is reached, random cubic is removed.
 			// Players with no mastery can have only one cubic.
-			int allowedCubicCount = 1;
-			// TODO: Unhardcode skill ID check so effect could work on any skill.
-			if (player.isAffectedBySkill(CommonSkill.CUBIC_MASTERY.getId()))
-			{
-				final BuffInfo cubicMastery = player.getEffectList().getBuffInfoBySkillId(CommonSkill.CUBIC_MASTERY.getId());
-				for (AbstractEffect effect : cubicMastery.getEffects())
-				{
-					allowedCubicCount = effect != null ? (int) effect.getValue() : 1;
-				}
-			}
-			
+			final int allowedCubicCount = info.getEffected().getActingPlayer().getStat().getMaxCubicCount();
 			final int currentCubicCount = player.getCubics().size();
 			// Extra cubics are removed, one by one, randomly.
 			for (int i = 0; i <= (currentCubicCount - allowedCubicCount); i++)

+ 3 - 1
L2J_DataPack_BETA/dist/game/data/stats/skills/00100-00199.xml

@@ -1026,7 +1026,9 @@
 		<set name="operateType" val="P" />
 		<set name="targetType" val="SELF" />
 		<for>
-			<effect name="CubicMastery" val="#cubicCount" />
+			<effect name="CubicMastery">
+				<param cubicCount="#cubicCount" />
+			</effect>
 		</for>
 	</skill>
 	<skill id="144" levels="37" name="Dual Weapon Mastery" enchantGroup1="1" enchantGroup2="1">

+ 3 - 1
L2J_DataPack_BETA/dist/game/data/stats/skills/01400-01499.xml

@@ -238,7 +238,9 @@
 		<set name="operateType" val="P" />
 		<set name="targetType" val="SELF" />
 		<for>
-			<effect name="EnlargeAbnormalSlot" val="#slots" />
+			<effect name="EnlargeAbnormalSlot">
+				<param slots="#slots" />
+			</effect>
 		</for>
 	</skill>
 	<skill id="1406" levels="1" name="Summon Feline King" enchantGroup1="5">

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/stats/skills/22200-22299.xml

@@ -465,7 +465,7 @@
 			</and>
 		</cond>
 		<for>
-			<effect name="RestorationRandom" noicon="1" val="0" /> 
+			<effect name="RestorationRandom" /> 
 		</for>
 	</skill>
 	<skill id="22273" levels="1" name="Experienced Adventurer's Treasure Sack">
@@ -484,7 +484,7 @@
 			</and>
 		</cond>
 		<for>
-			<effect name="RestorationRandom" noicon="1" val="0" /> 
+			<effect name="RestorationRandom" /> 
 		</for>
 	</skill>
 	<skill id="22274" levels="1" name="Great Adventurer's Treasure Sack">
@@ -503,7 +503,7 @@
 			</and>
 		</cond>
 		<for>
-			<effect name="RestorationRandom" noicon="1" val="0" /> 
+			<effect name="RestorationRandom" /> 
 		</for>
 	</skill>
 	<skill id="22275" levels="1" name="Rune Jewelry Box - Crystal">