Drain from NPC

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
St3eT
Posts: 961
Joined: Sun Mar 07, 2010 6:50 pm

Drain from NPC

Post by St3eT »

L2J Revision 5675:
L2JDP Revision 9240:


How i can disable drain from NPC? (not monster, i mean L2Npc, L2Teleporter etc)
If i should be black sheep for sure no as punishment
Image
User avatar
Gladicek
Posts: 634
Joined: Wed Jan 19, 2011 6:25 pm
Location: Czech Republic

Re: Drain from NPC

Post by Gladicek »

Code: Select all

# Defines whether NPCs are attackable by default# Retail: TrueAltAttackableNpcs = True
Set -> False :P
Image
L2J retired
User avatar
marcoviny
Posts: 45
Joined: Sun Nov 07, 2010 6:22 pm

Re: Drain from NPC

Post 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);
Last edited by marcoviny on Mon Jun 02, 2014 12:09 am, edited 1 time in total.
User avatar
Gries
Posts: 307
Joined: Fri Jun 17, 2011 9:45 am

Re: Drain from NPC

Post by Gries »

In retail when you attack an NPC you don't get HP however.
User avatar
marcoviny
Posts: 45
Joined: Sun Nov 07, 2010 6:22 pm

Re: Drain from NPC

Post 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 )
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

Re: Drain from NPC

Post 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);        }
I have promises to keep and miles to go before I sleep.
User avatar
marcoviny
Posts: 45
Joined: Sun Nov 07, 2010 6:22 pm

Re: Drain from NPC

Post 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 };
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

Re: Drain from NPC

Post 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.
I have promises to keep and miles to go before I sleep.
Post Reply