Addition of GiveSpiritExp effect handler.

This commit is contained in:
MobiusDevelopment
2021-01-06 23:25:20 +00:00
parent b139be070b
commit a54260c6d2
12 changed files with 280 additions and 0 deletions

View File

@@ -162,6 +162,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new);
EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new);
EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new);
EffectHandler.getInstance().registerHandler("GiveSpiritExp", GiveSpiritExp::new);
EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new);
EffectHandler.getInstance().registerHandler("Grow", Grow::new);
EffectHandler.getInstance().registerHandler("HairAccessorySet", HairAccessorySet::new);

View File

@@ -0,0 +1,68 @@
/*
* 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.enums.ElementalType;
import org.l2jmobius.gameserver.model.ElementalSpirit;
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;
/**
* @author Mobius
*/
public class GiveSpiritExp extends AbstractEffect
{
private final ElementalType _type;
private final int _amount;
public GiveSpiritExp(StatSet params)
{
_type = params.getEnum("type", ElementalType.class, ElementalType.NONE);
_amount = params.getInt("amount");
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
if (effected == null)
{
return;
}
final PlayerInstance player = effected.getActingPlayer();
if (player == null)
{
return;
}
final ElementalSpirit spirit = player.getElementalSpirit(_type);
if (spirit != null)
{
spirit.addExperience(_amount);
}
}
}

View File

@@ -133,6 +133,7 @@ GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius)
GiveFame: Gives a given amount of Fame. (l2jmobius)
GiveRecommendation: Gives recommendations to a player. Blue name.
GiveSp: Gives a given amount of SP.
GiveSpiritExp: Adds set amount of experience to spirit. (l2jmobius)
GiveXp: Gives a given amount of XP. (l2jmobius)
Grow: Sets NPC collision to its growth collision.
HairAccessorySet: See/Unsee hair accessory.