Jump to content
  • 0

Modify Relax Skill Id 226


Sybar

Question

Hi,

 

I would like to modify Relax Skill ID226 to regenerate MP as well as HP. I did the XML part but need to modify handler for that skill

 

It turns off when HP is full but I need the same for MP. So stop the effect when MP and HP is full

 

Furthermore, I would like that skill to work out-of-combat only. I can't find a condition for XML side so I guess it must be done inside the handler itself.

 

This is for L2J High Five. Thanks

/*
 * Copyright (C) 2004-2013 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 handlers.effecthandlers;

import l2r.gameserver.enums.CtrlIntention;
import l2r.gameserver.model.effects.EffectFlag;
import l2r.gameserver.model.effects.EffectTemplate;
import l2r.gameserver.model.effects.L2Effect;
import l2r.gameserver.model.effects.L2EffectType;
import l2r.gameserver.model.stats.Env;
import l2r.gameserver.network.SystemMessageId;

public class Relax extends L2Effect
{
	public Relax(Env env, EffectTemplate template)
	{
		super(env, template);
	}
	
	@Override
	public L2EffectType getEffectType()
	{
		return L2EffectType.RELAXING;
	}
	
	@Override
	public boolean onStart()
	{
		if (getEffected().isPlayer())
		{
			getEffected().getActingPlayer().sitDown(false);
		}
		else
		{
			getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
		}
		return super.onStart();
	}
	
	@Override
	public boolean onActionTime()
	{
		if (getEffected().isDead())
		{
			return false;
		}
		
		if (getEffected().isPlayer())
		{
			if (!getEffected().getActingPlayer().isSitting())
			{
				return false;
			}
		}
		
		if ((getEffected().getCurrentHp() + 1) > getEffected().getMaxRecoverableHp())
		{
			if (getSkill().isToggle())
			{
				getEffected().sendPacket(SystemMessageId.SKILL_DEACTIVATED_HP_FULL);
				return false;
			}
		}
		
		double manaDam = calc();
		
		if (manaDam > getEffected().getCurrentMp())
		{
			if (getSkill().isToggle())
			{
				getEffected().sendPacket(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP);
				return false;
			}
		}
		
		getEffected().reduceCurrentMp(manaDam);
		return true;
	}
	
	@Override
	public int getEffectFlags()
	{
		return EffectFlag.RELAXING.getMask();
	}
}

Edited by Sybar
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • We are excited to announce that our grand opening is just one hour away!   Join us and experience the thrill of epic battles and daily rewards. Our server is full of challenges and adventures, waiting for you to embark on them. You will meet many like-minded gamers who share your passion for gaming and exploration. With L2OmegaWorld, you will never be bored. We offer a wide range of exciting game modes that will keep you on your toes. Whether you prefer PvP or PvE, we have it all! Our community is friendly and welcoming, so you can be sure to find new friends to play with.   Don't miss out on the chance to become a legend in L2OmegaWorld! Join us now and take part in the grand opening celebrations. Incredible fights and rewards await you!    Site: https://l2omegaworld.com/       Discord: https://discord.com/invite/l2omegaworld
    • WTS Chars: 1.Shilien Saint 78 Nobless, Destro 75 and Bladedancer 62 (same account has bounty hunter 62lvl, no extra charge) ~200E 2. Destroyer 67 and Bounty Hunter 61 ~30E 3. Warsmith 64 (have shots,materials and some B items registered) ~20E 4. Prophet 58 (has GM and GS) ~20E 5. Kamael Female Soulbreaker 44 and Spellsinger 43 ~12E Items: AM Acumen 50 SOES btb 20E Halberd haste +4 20E Destoyer Hammer Haste 10E Tsurugi Duals +4 14E Delusion Focus +7 10E Majestic Robe +0 25E Tallum Heavy +4/3/3/0 25E BW Heavy +3 12E Doom Robe Set 10E Avadon Robe +3 8E Tateossian Set 25E Majestic jewels +3 12E Black Ore set +3 10E Great Wolf 62 + Top items 65E Wolf 42 7E Strider 67 + Top items 13E Kookabura 56 8E 25KK adena 5E 1.4kk AA 3E I am quitting the game, no more free time. Package deals can get LS,enchants,materials,key materials etc PM here, payment by PayPal  
    • You only show half the movement, and without any //show move on.   You probably do idiotic going back and forth, it's the only possibility to get such a desync actually.
    • Hello guys, i have bug in server,in hunter village there is pvp zone in the center how to fix it
    • can you share your files ?  thanks 
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock