L2J Revision 5675:
L2JDP Revision 9240:
How i can disable drain from NPC? (not monster, i mean L2Npc, L2Teleporter etc)
Drain from NPC
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
- St3eT
- Posts: 961
- Joined: Sun Mar 07, 2010 6:50 pm
- Gladicek
- Posts: 634
- Joined: Wed Jan 19, 2011 6:25 pm
- Location: Czech Republic
Re: Drain from NPC
Code: Select all
# Defines whether NPCs are attackable by default# Retail: TrueAltAttackableNpcs = True


L2J retired
- marcoviny
- Posts: 45
- Joined: Sun Nov 07, 2010 6:22 pm
Re: Drain from NPC
Index: java/com/l2jserver/gameserver/model/actor/L2Character.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/L2Character.java (revision 5420)
+++ java/com/l2jserver/gameserver/model/actor/L2Character.java (working copy)
@@ -1984,6 +2178,8 @@
// Before start AI Cast Broadcast Fly Effect is Need
if (skill.getFlyType() != null && (this instanceof L2PcInstance))
ThreadPoolManager.getInstance().scheduleEffect(new FlyToLocationTask(this, target, skill), 50);
+ else if (skill.getFlyType() != null && (target instanceof L2NpcInstance))
+ return;
MagicUseTask mut = new MagicUseTask(targets, skill, hitTime, coolTime, simultaneously, shotSave);
===================================================================
--- java/com/l2jserver/gameserver/model/actor/L2Character.java (revision 5420)
+++ java/com/l2jserver/gameserver/model/actor/L2Character.java (working copy)
@@ -1984,6 +2178,8 @@
// Before start AI Cast Broadcast Fly Effect is Need
if (skill.getFlyType() != null && (this instanceof L2PcInstance))
ThreadPoolManager.getInstance().scheduleEffect(new FlyToLocationTask(this, target, skill), 50);
+ else if (skill.getFlyType() != null && (target instanceof L2NpcInstance))
+ return;
MagicUseTask mut = new MagicUseTask(targets, skill, hitTime, coolTime, simultaneously, shotSave);
Last edited by marcoviny on Mon Jun 02, 2014 12:09 am, edited 1 time in total.
- Gries
- Posts: 307
- Joined: Fri Jun 17, 2011 9:45 am
Re: Drain from NPC
In retail when you attack an NPC you don't get HP however.
- marcoviny
- Posts: 45
- Joined: Sun Nov 07, 2010 6:22 pm
Re: Drain from NPC
Me Edit make exactelly like from retail
(to mobs and chars [in pvp ] rush might work normally but if you server even configurated to not attack npc, RUSH WORKS, with this code RUSH NOT WORK IN NPC )
(to mobs and chars [in pvp ] rush might work normally but if you server even configurated to not attack npc, RUSH WORKS, with this code RUSH NOT WORK IN NPC )
-
- Posts: 484
- Joined: Sat Jan 23, 2010 4:42 pm
Re: Drain from NPC
Why not:marcoviny wrote:Index: java/com/l2jserver/gameserver/model/actor/L2Character.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/L2Character.java (revision 5420)
+++ java/com/l2jserver/gameserver/model/actor/L2Character.java (working copy)
@@ -1984,6 +2178,8 @@
// Before start AI Cast Broadcast Fly Effect is Need
if (skill.getFlyType() != null && (this instanceof L2PcInstance))
ThreadPoolManager.getInstance().scheduleEffect(new FlyToLocationTask(this, target, skill), 50);
+ else if (skill.getFlyType() != null && (target instanceof L2NpcInstance))
+ return;
MagicUseTask mut = new MagicUseTask(targets, skill, hitTime, coolTime, simultaneously, shotSave);
Code: Select all
// Before start AI Cast Broadcast Fly Effect is Need if (skill.getFlyType() != null && !target.isNpc()) { ThreadPoolManager.getInstance().scheduleEffect(new FlyToLocationTask(this, target, skill), 50); }
I have promises to keep and miles to go before I sleep.
- marcoviny
- Posts: 45
- Joined: Sun Nov 07, 2010 6:22 pm
Re: Drain from NPC
Index: dist/game/data/scripts/handlers/targethandlers/TargetOne.java
===================================================================
--- dist/game/data/scripts/handlers/targethandlers/TargetOne.java (revision 8913)
+++ dist/game/data/scripts/handlers/targethandlers/TargetOne.java (working copy)
@@ -17,6 +17,7 @@
import com.l2jserver.gameserver.handler.ITargetTypeHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2Skill;
+import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.templates.skills.L2TargetType;
@@ -58,6 +59,12 @@
activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
return _emptyTargetList;
}
+ // TO RUSH NOT WORK AGAINS NPCS
+ if (skill.getFlyType() != null && (target instanceof L2NpcInstance))
+ {
+ activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
+ return _emptyTargetList;
+ }
// If a target is found, return it in a table else send a system message TARGET_IS_INCORRECT
return new L2Character[] { target };
===================================================================
--- dist/game/data/scripts/handlers/targethandlers/TargetOne.java (revision 8913)
+++ dist/game/data/scripts/handlers/targethandlers/TargetOne.java (working copy)
@@ -17,6 +17,7 @@
import com.l2jserver.gameserver.handler.ITargetTypeHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2Skill;
+import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.templates.skills.L2TargetType;
@@ -58,6 +59,12 @@
activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
return _emptyTargetList;
}
+ // TO RUSH NOT WORK AGAINS NPCS
+ if (skill.getFlyType() != null && (target instanceof L2NpcInstance))
+ {
+ activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
+ return _emptyTargetList;
+ }
// If a target is found, return it in a table else send a system message TARGET_IS_INCORRECT
return new L2Character[] { target };
-
- Posts: 484
- Joined: Sat Jan 23, 2010 4:42 pm
Re: Drain from NPC
Imo less efficient.. No need to send a useless packet if you can cover it via a simple condition check.marcoviny wrote:Index: dist/game/data/scripts/handlers/targethandlers/TargetOne.java
===================================================================
--- dist/game/data/scripts/handlers/targethandlers/TargetOne.java (revision 8913)
+++ dist/game/data/scripts/handlers/targethandlers/TargetOne.java (working copy)
@@ -17,6 +17,7 @@
import com.l2jserver.gameserver.handler.ITargetTypeHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2Skill;
+import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.templates.skills.L2TargetType;
@@ -58,6 +59,12 @@
activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
return _emptyTargetList;
}
+ // TO RUSH NOT WORK AGAINS NPCS
+ if (skill.getFlyType() != null && (target instanceof L2NpcInstance))
+ {
+ activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
+ return _emptyTargetList;
+ }
// If a target is found, return it in a table else send a system message TARGET_IS_INCORRECT
return new L2Character[] { target };
I have promises to keep and miles to go before I sleep.