Jump to content
  • 0

Mana Potion


kadabra

Question


/*

* 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.itemhandlers;



import com.l2jserver.Config;

import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;

import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;

import com.l2jserver.gameserver.model.actor.L2Playable;

import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;

import com.l2jserver.gameserver.network.SystemMessageId;

import com.l2jserver.gameserver.network.serverpackets.SystemMessage;



public class ManaPotion extends ItemSkills

{

/**

 * 

 * @see com.l2jserver.gameserver.handler.IItemHandler#useItem(com.l2jserver.gameserver.model.actor.L2Playable, com.l2jserver.gameserver.model.L2ItemInstance, boolean)

 */

@Override

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

{

	L2PcInstance activeChar=(L2PcInstance) playable;

	boolean isPet = playable instanceof L2PetInstance;

	if (isPet)

		activeChar = ((L2PetInstance) playable).getOwner();

	else if (playable instanceof L2PcInstance)

		activeChar = (L2PcInstance) playable;

	else

		return false;

	if (!Config.ENABLE_MANA_POTIONS_SUPPORT)

	{

	playable.sendPacket(SystemMessageId.NOTHING_HAPPENED);
		return super.useItem(playable, item, forceUse);

	}



	if (item.getItemId()==728 && item.getCount()>0&& playable.getPvpFlag() == 0)

	{
		double aux  = playable.getCurrentMp();

		playable.setCurrentMp(playable.getCurrentMp()+300);

		playable.sendMessage((playable.getCurrentMp()-aux)+"Mana Bonus restored[Not Flaged]");			
	}

return super.useItem(playable, item, forceUse);
}

}

I'm having a problem, the bonus in pvp works well, but is not in pvp, I mean normal mode one can use as many times you want the potions of mp .. and not spend

 

I can do?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

item.getCount()>0&&

I doubt it simply compiles correctly, and so you can even use it. You probably got GS log about failed handler loading.

Link to comment
Share on other sites

  • 0

clear, the code is in pvp mode, only consumes 100 mp, and it works perfect.

I to them agrege MP potions of delay and when the char is not in pvp mode can use the potions you want and do not eat anything I mean? in normal mode "with delay" does not waste potions

 

----------

3. WARNING in scripts/handlers/itemhandlers/ManaPotion.java (at line 69)

L2PcInstance activeChar=(L2PcInstance) playable;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.



×
×
  • Create New...