Jump to content
  • 0

Drain mode flag.


Question

Posted

Hello again, I have further questions on the flag, as could put that if the players are pvp so they can not drain hp from mobs.

 

If I could help would be appreciated.

3 answers to this question

Recommended Posts

  • 0
Posted


### Eclipse Workspace Patch 1.0
#P Chr.6GMS
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 5263)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -238,6 +238,8 @@
	public static final int STORE_PRIVATE_BUY = 3;
	public static final int STORE_PRIVATE_MANUFACTURE = 5;
	public static final int STORE_PRIVATE_PACKAGE_SELL = 8;
+	
+	private int[] drainIds = {0,25,2};

	/** The table containing all minimum level needed for each Expertise (None, D, C, B, A, S)*/
	private static final int[] EXPERTISE_LEVELS =
@@ -284,6 +286,21 @@
		public void doCast(L2Skill skill)
         {
			super.doCast(skill);
+			
+			//--Cannot use drain skills in mobs--
+			L2Object target = getTarget();
+			L2MonsterInstance m = null;
+			if(target instanceof L2MonsterInstance)
+				m = (L2MonsterInstance) target;
+			if(m != null && getPvpFlag() > 0){
+			for(int i=0; i < drainIds.length; i ++)
+			{
+				if(skill.getId() == drainIds[i]){
+					sendMessage("You can't drain hp from mobs");
+					 return;
+				}
+			}
+			}

			// cancel the recent fake-death protection instantly if the player attacks or casts spells
			getPlayer().setRecentFakeDeath(false);

 

private int[] drainIds = {0,25,2};

 

Put the ids there, 0,25,2 are just lucky ids . It can be done also from skill handlers.

 

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