Page 1 of 1

Drain from NPC

Posted: Fri Oct 12, 2012 12:45 pm
by St3eT
L2J Revision 5675:
L2JDP Revision 9240:


How i can disable drain from NPC? (not monster, i mean L2Npc, L2Teleporter etc)

Re: Drain from NPC

Posted: Fri Oct 12, 2012 2:59 pm
by Gladicek

Code: Select all

# Defines whether NPCs are attackable by default# Retail: TrueAltAttackableNpcs = True
Set -> False :P

Re: Drain from NPC

Posted: Sun Jun 01, 2014 9:26 pm
by marcoviny
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);

Re: Drain from NPC

Posted: Sun Jun 01, 2014 11:20 pm
by Gries
In retail when you attack an NPC you don't get HP however.

Re: Drain from NPC

Posted: Mon Jun 02, 2014 12:12 am
by marcoviny
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 )

Re: Drain from NPC

Posted: Mon Jun 02, 2014 6:59 pm
by Starter
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);
Why not:

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

Re: Drain from NPC

Posted: Thu Jul 24, 2014 8:03 pm
by marcoviny
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 };

Re: Drain from NPC

Posted: Fri Sep 26, 2014 10:58 pm
by Starter
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 };
Imo less efficient.. No need to send a useless packet if you can cover it via a simple condition check.