Jump to content
  • 0

Access L2PcInstance methods in ManaPotion.java


Question

Posted

Hello,

 

Last L2J Revision H5 Stable.

How can i have access to the Method isCombatFlagEquipped() in L2PcInstance from ManaPotion.java?

 

I tried to import L2PcInstance, to get the activeChar in a variable "L2PcInstance activeChar = getActiveChar()" in order to access the method but don't work?

 

How can i do ?

 

My goal :

 

if (!playable.isCombatFlagEquipped())

{

playable.setCurrentMp(playable.getCurrentMp()+Config.MoreManaNoCombat);

}

2 answers to this question

Recommended Posts

  • 0
Posted

public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
{

Using playable should work directly (without any new variable), but as you said you should first verify if playable instanceof L2PcInstance, cause a L2Playable can be a L2Summon aswell.

  • 0
Posted

So i was wrong about the method that i would use.

 

if (!AttackStanceTaskManager.getInstance().getAttackStanceTask(playable)) // in combat mode.

{

playable.setCurrentMp(playable.getCurrentMp()+Config.MoreManaNoCombat);

}

 

Works fine for me..

For ppl that searchs, you need to import import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;

in order to the condition work

 

Thanks, solved.

Guest
This topic is now closed to further replies.


×
×
  • 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