Skip to content

Access L2PcInstance methods in ManaPotion.java

Featured Replies

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);

}

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.

  • Author

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.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.