Addition of AddHomunculusPoints effect handler.

Contributed by nasseka.
This commit is contained in:
MobiusDevelopment
2021-07-01 23:16:42 +00:00
parent f1c9c24194
commit 8379bbcffc
8 changed files with 158 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("AbsorbDamage", AbsorbDamage::new); EffectHandler.getInstance().registerHandler("AbsorbDamage", AbsorbDamage::new);
EffectHandler.getInstance().registerHandler("Accuracy", Accuracy::new); EffectHandler.getInstance().registerHandler("Accuracy", Accuracy::new);
EffectHandler.getInstance().registerHandler("AddHate", AddHate::new); EffectHandler.getInstance().registerHandler("AddHate", AddHate::new);
EffectHandler.getInstance().registerHandler("AddHomunculusPoints", AddHomunculusPoints::new);
EffectHandler.getInstance().registerHandler("AddHuntingTime", AddHuntingTime::new); EffectHandler.getInstance().registerHandler("AddHuntingTime", AddHuntingTime::new);
EffectHandler.getInstance().registerHandler("AdditionalPotionCp", AdditionalPotionCp::new); EffectHandler.getInstance().registerHandler("AdditionalPotionCp", AdditionalPotionCp::new);
EffectHandler.getInstance().registerHandler("AdditionalPotionHp", AdditionalPotionHp::new); EffectHandler.getInstance().registerHandler("AdditionalPotionHp", AdditionalPotionHp::new);

View File

@@ -0,0 +1,62 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package handlers.effecthandlers;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
/**
* Item Effect: Increase Homunculus points permanently.
* @author `NasSeKa`
*/
public class AddHomunculusPoints extends AbstractEffect
{
private final int _amount;
public AddHomunculusPoints(StatSet params)
{
_amount = params.getInt("amount", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
if (!effected.isPlayer())
{
return;
}
final PlayerInstance player = effected.getActingPlayer();
final int upgradePoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) + _amount;
player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, upgradePoints);
player.sendPacket(SystemMessageId.YOU_VE_OBTAINED_UPGRADE_POINTS);
player.sendPacket(new ExHomunculusPointInfo(player));
}
}

View File

@@ -77,6 +77,19 @@
<!-- Double-click to obtain 10 homunculus upgrade points. --> <!-- Double-click to obtain 10 homunculus upgrade points. -->
<icon>icon.skill0000</icon> <icon>icon.skill0000</icon>
<operateType>A1</operateType> <operateType>A1</operateType>
<magicLevel>1</magicLevel>
<isMagic>4</isMagic>
<magicCriticalRate>5</magicCriticalRate>
<hitCancelTime>0</hitCancelTime>
<targetType>SELF</targetType>
<affectScope>SINGLE</affectScope>
<itemConsumeCount>1</itemConsumeCount>
<itemConsumeId>81812</itemConsumeId> <!-- Homunculus Upgrade Points - 10 -->
<effects>
<effect name="AddHomunculusPoints">
<amount>10</amount>
</effect>
</effects>
</skill> </skill>
<skill id="39716" toLevel="1" name="Transparent Sigil Appearance Stone"> <skill id="39716" toLevel="1" name="Transparent Sigil Appearance Stone">
<icon>icon.skill0000</icon> <icon>icon.skill0000</icon>

View File

@@ -17647,6 +17647,9 @@ public class SystemMessageId
@ClientString(id = 13086, message = "The XP recovery fee has changed. Please try again.") @ClientString(id = 13086, message = "The XP recovery fee has changed. Please try again.")
public static SystemMessageId THE_XP_RECOVERY_FEE_HAS_CHANGED_PLEASE_TRY_AGAIN; public static SystemMessageId THE_XP_RECOVERY_FEE_HAS_CHANGED_PLEASE_TRY_AGAIN;
@ClientString(id = 13238, message = "You've obtained upgrade points.")
public static SystemMessageId YOU_VE_OBTAINED_UPGRADE_POINTS;
@ClientString(id = 13136, message = "The enchant value is decreased by 1.") @ClientString(id = 13136, message = "The enchant value is decreased by 1.")
public static SystemMessageId THE_ENCHANT_VALUE_IS_DECREASED_BY_1; public static SystemMessageId THE_ENCHANT_VALUE_IS_DECREASED_BY_1;

View File

@@ -37,6 +37,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("AbsorbDamage", AbsorbDamage::new); EffectHandler.getInstance().registerHandler("AbsorbDamage", AbsorbDamage::new);
EffectHandler.getInstance().registerHandler("Accuracy", Accuracy::new); EffectHandler.getInstance().registerHandler("Accuracy", Accuracy::new);
EffectHandler.getInstance().registerHandler("AddHate", AddHate::new); EffectHandler.getInstance().registerHandler("AddHate", AddHate::new);
EffectHandler.getInstance().registerHandler("AddHomunculusPoints", AddHomunculusPoints::new);
EffectHandler.getInstance().registerHandler("AddHuntingTime", AddHuntingTime::new); EffectHandler.getInstance().registerHandler("AddHuntingTime", AddHuntingTime::new);
EffectHandler.getInstance().registerHandler("AdditionalPotionCp", AdditionalPotionCp::new); EffectHandler.getInstance().registerHandler("AdditionalPotionCp", AdditionalPotionCp::new);
EffectHandler.getInstance().registerHandler("AdditionalPotionHp", AdditionalPotionHp::new); EffectHandler.getInstance().registerHandler("AdditionalPotionHp", AdditionalPotionHp::new);

View File

@@ -0,0 +1,62 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package handlers.effecthandlers;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPointInfo;
/**
* Item Effect: Increase Homunculus points permanently.
* @author `NasSeKa`
*/
public class AddHomunculusPoints extends AbstractEffect
{
private final int _amount;
public AddHomunculusPoints(StatSet params)
{
_amount = params.getInt("amount", 0);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
if (!effected.isPlayer())
{
return;
}
final PlayerInstance player = effected.getActingPlayer();
final int upgradePoints = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) + _amount;
player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, upgradePoints);
player.sendPacket(SystemMessageId.YOU_VE_OBTAINED_UPGRADE_POINTS);
player.sendPacket(new ExHomunculusPointInfo(player));
}
}

View File

@@ -77,6 +77,19 @@
<!-- Double-click to obtain 10 homunculus upgrade points. --> <!-- Double-click to obtain 10 homunculus upgrade points. -->
<icon>icon.skill0000</icon> <icon>icon.skill0000</icon>
<operateType>A1</operateType> <operateType>A1</operateType>
<magicLevel>1</magicLevel>
<isMagic>4</isMagic>
<magicCriticalRate>5</magicCriticalRate>
<hitCancelTime>0</hitCancelTime>
<targetType>SELF</targetType>
<affectScope>SINGLE</affectScope>
<itemConsumeCount>1</itemConsumeCount>
<itemConsumeId>81812</itemConsumeId> <!-- Homunculus Upgrade Points - 10 -->
<effects>
<effect name="AddHomunculusPoints">
<amount>10</amount>
</effect>
</effects>
</skill> </skill>
<skill id="39716" toLevel="1" name="Transparent Sigil Appearance Stone"> <skill id="39716" toLevel="1" name="Transparent Sigil Appearance Stone">
<icon>icon.skill0000</icon> <icon>icon.skill0000</icon>

View File

@@ -17647,6 +17647,9 @@ public class SystemMessageId
@ClientString(id = 13086, message = "The XP recovery fee has changed. Please try again.") @ClientString(id = 13086, message = "The XP recovery fee has changed. Please try again.")
public static SystemMessageId THE_XP_RECOVERY_FEE_HAS_CHANGED_PLEASE_TRY_AGAIN; public static SystemMessageId THE_XP_RECOVERY_FEE_HAS_CHANGED_PLEASE_TRY_AGAIN;
@ClientString(id = 13238, message = "You've obtained upgrade points.")
public static SystemMessageId YOU_VE_OBTAINED_UPGRADE_POINTS;
@ClientString(id = 13136, message = "The enchant value is decreased by 1.") @ClientString(id = 13136, message = "The enchant value is decreased by 1.")
public static SystemMessageId THE_ENCHANT_VALUE_IS_DECREASED_BY_1; public static SystemMessageId THE_ENCHANT_VALUE_IS_DECREASED_BY_1;