Trap improvements.
This commit is contained in:
parent
dadc28d8ed
commit
5b09bdea20
@ -77,6 +77,7 @@ import com.l2jmobius.gameserver.model.TeleportWhereType;
|
||||
import com.l2jmobius.gameserver.model.TimeStamp;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.stat.CharStat;
|
||||
import com.l2jmobius.gameserver.model.actor.status.CharStatus;
|
||||
import com.l2jmobius.gameserver.model.actor.tasks.character.HitTask;
|
||||
@ -2477,10 +2478,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
*/
|
||||
public final String getTitle()
|
||||
{
|
||||
// Champion titles
|
||||
if (isChampion())
|
||||
{
|
||||
return Config.CHAMP_TITLE;
|
||||
}
|
||||
// Custom level titles
|
||||
if (Config.SHOW_NPC_LVL && isMonster())
|
||||
{
|
||||
String t = "Lv " + getLevel() + (((L2MonsterInstance) this).isAggressive() ? "*" : "");
|
||||
@ -2490,6 +2493,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
}
|
||||
return t;
|
||||
}
|
||||
// Set trap title
|
||||
if (isTrap() && (((L2TrapInstance) this).getOwner() != null))
|
||||
{
|
||||
_title = ((L2TrapInstance) this).getOwner().getName();
|
||||
}
|
||||
return _title != null ? _title : "";
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ import com.l2jmobius.gameserver.model.olympiad.OlympiadGameManager;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AbstractNpcInfo.TrapInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
|
||||
@ -159,16 +159,6 @@ public final class L2TrapInstance extends L2Npc
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkTarget(L2Character target)
|
||||
{
|
||||
if (!target.isInsideRadius(this, 300, false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _skill.getSkill().getTarget(this, target, false, true, false) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
@ -287,7 +277,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
{
|
||||
if (_isTriggered || canBeSeen(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(new TrapInfo(this, activeChar));
|
||||
activeChar.sendPacket(new NpcInfo(this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +326,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
}
|
||||
|
||||
_isTriggered = true;
|
||||
broadcastPacket(new TrapInfo(this, null));
|
||||
broadcastPacket(new NpcInfo(this));
|
||||
setTarget(target);
|
||||
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(this, target, TrapAction.TRAP_TRIGGERED), this);
|
||||
|
@ -18,8 +18,6 @@ package com.l2jmobius.gameserver.model.actor.tasks.npc.trap;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
|
||||
@ -59,13 +57,9 @@ public class TrapTask implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
for (L2Character target : L2World.getInstance().getVisibleObjects(_trap, L2Character.class))
|
||||
if (!_trap.getSkill().getTargetsAffected(_trap, _trap).isEmpty())
|
||||
{
|
||||
if (_trap.checkTarget(target))
|
||||
{
|
||||
_trap.triggerTrap(target);
|
||||
break;
|
||||
}
|
||||
_trap.triggerTrap(_trap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,145 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 com.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
public abstract class AbstractNpcInfo implements IClientOutgoingPacket
|
||||
{
|
||||
protected int _x, _y, _z, _heading;
|
||||
protected int _idTemplate;
|
||||
protected boolean _isAttackable, _isSummoned;
|
||||
protected int _mAtkSpd, _pAtkSpd;
|
||||
protected final int _runSpd, _walkSpd;
|
||||
protected final int _swimRunSpd, _swimWalkSpd;
|
||||
protected final int _flyRunSpd, _flyWalkSpd;
|
||||
protected double _moveMultiplier;
|
||||
|
||||
protected int _rhand, _lhand, _chest, _enchantEffect;
|
||||
protected double _collisionHeight, _collisionRadius;
|
||||
protected String _name = "";
|
||||
protected String _title = "";
|
||||
|
||||
public AbstractNpcInfo(L2Character cha)
|
||||
{
|
||||
_isSummoned = cha.isShowSummonAnimation();
|
||||
_x = cha.getX();
|
||||
_y = cha.getY();
|
||||
_z = cha.getZ();
|
||||
_heading = cha.getHeading();
|
||||
_mAtkSpd = cha.getMAtkSpd();
|
||||
_pAtkSpd = cha.getPAtkSpd();
|
||||
_moveMultiplier = cha.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(cha.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(cha.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(cha.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(cha.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = cha.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = cha.isFlying() ? _walkSpd : 0;
|
||||
}
|
||||
|
||||
public static class TrapInfo extends AbstractNpcInfo
|
||||
{
|
||||
private final L2TrapInstance _trap;
|
||||
|
||||
public TrapInfo(L2TrapInstance cha, L2Character attacker)
|
||||
{
|
||||
super(cha);
|
||||
|
||||
_trap = cha;
|
||||
_idTemplate = cha.getTemplate().getDisplayId();
|
||||
_isAttackable = cha.isAutoAttackable(attacker);
|
||||
_rhand = 0;
|
||||
_lhand = 0;
|
||||
_collisionHeight = _trap.getTemplate().getfCollisionHeight();
|
||||
_collisionRadius = _trap.getTemplate().getfCollisionRadius();
|
||||
if (cha.getTemplate().isUsingServerSideName())
|
||||
{
|
||||
_name = cha.getName();
|
||||
}
|
||||
_title = cha.getOwner() != null ? cha.getOwner().getName() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.NPC_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_trap.getObjectId());
|
||||
packet.writeD(_idTemplate + 1000000); // npctype id
|
||||
packet.writeD(_isAttackable ? 1 : 0);
|
||||
packet.writeD(_x);
|
||||
packet.writeD(_y);
|
||||
packet.writeD(_z);
|
||||
packet.writeD(_heading);
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(_mAtkSpd);
|
||||
packet.writeD(_pAtkSpd);
|
||||
packet.writeD(_runSpd);
|
||||
packet.writeD(_walkSpd);
|
||||
packet.writeD(_swimRunSpd);
|
||||
packet.writeD(_swimWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeF(_moveMultiplier);
|
||||
packet.writeF(_trap.getAttackSpeedMultiplier());
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(_rhand); // right hand weapon
|
||||
packet.writeD(_chest);
|
||||
packet.writeD(_lhand); // left hand weapon
|
||||
packet.writeC(1); // name above char 1=true ... ??
|
||||
packet.writeC(1);
|
||||
packet.writeC(_trap.isInCombat() ? 1 : 0);
|
||||
packet.writeC(_trap.isAlikeDead() ? 1 : 0);
|
||||
packet.writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_name);
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_title);
|
||||
packet.writeD(0x00); // title color 0 = client default
|
||||
|
||||
packet.writeD(_trap.getPvpFlag());
|
||||
packet.writeD(_trap.getReputation());
|
||||
|
||||
packet.writeD(0); // was AVE and was adding stealth
|
||||
packet.writeD(0x00); // clan id
|
||||
packet.writeD(0x00); // crest id
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeC(0000); // C2
|
||||
|
||||
packet.writeC(_trap.getTeam().getId());
|
||||
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(0x00); // C4
|
||||
packet.writeD(0x00); // C6
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(0); // CT1.5 Pet form and skills
|
||||
packet.writeC(0x01);
|
||||
packet.writeC(0x01);
|
||||
packet.writeD(0x00);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -134,7 +134,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
|
||||
addComponentType(NpcInfoType.NAME);
|
||||
}
|
||||
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion())
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion() || npc.isTrap())
|
||||
{
|
||||
addComponentType(NpcInfoType.TITLE);
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ import com.l2jmobius.gameserver.model.TeleportWhereType;
|
||||
import com.l2jmobius.gameserver.model.TimeStamp;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.stat.CharStat;
|
||||
import com.l2jmobius.gameserver.model.actor.status.CharStatus;
|
||||
import com.l2jmobius.gameserver.model.actor.tasks.character.HitTask;
|
||||
@ -2481,10 +2482,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
*/
|
||||
public final String getTitle()
|
||||
{
|
||||
// Champion titles
|
||||
if (isChampion())
|
||||
{
|
||||
return Config.CHAMP_TITLE;
|
||||
}
|
||||
// Custom level titles
|
||||
if (Config.SHOW_NPC_LVL && isMonster())
|
||||
{
|
||||
String t = "Lv " + getLevel() + (((L2MonsterInstance) this).isAggressive() ? "*" : "");
|
||||
@ -2494,6 +2497,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
}
|
||||
return t;
|
||||
}
|
||||
// Set trap title
|
||||
if (isTrap() && (((L2TrapInstance) this).getOwner() != null))
|
||||
{
|
||||
_title = ((L2TrapInstance) this).getOwner().getName();
|
||||
}
|
||||
return _title != null ? _title : "";
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ import com.l2jmobius.gameserver.model.olympiad.OlympiadGameManager;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AbstractNpcInfo.TrapInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
|
||||
@ -159,16 +159,6 @@ public final class L2TrapInstance extends L2Npc
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkTarget(L2Character target)
|
||||
{
|
||||
if (!target.isInsideRadius(this, 300, false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _skill.getSkill().getTarget(this, target, false, true, false) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
@ -287,7 +277,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
{
|
||||
if (_isTriggered || canBeSeen(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(new TrapInfo(this, activeChar));
|
||||
activeChar.sendPacket(new NpcInfo(this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +326,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
}
|
||||
|
||||
_isTriggered = true;
|
||||
broadcastPacket(new TrapInfo(this, null));
|
||||
broadcastPacket(new NpcInfo(this));
|
||||
setTarget(target);
|
||||
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(this, target, TrapAction.TRAP_TRIGGERED), this);
|
||||
|
@ -18,8 +18,6 @@ package com.l2jmobius.gameserver.model.actor.tasks.npc.trap;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
|
||||
@ -59,13 +57,9 @@ public class TrapTask implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
for (L2Character target : L2World.getInstance().getVisibleObjects(_trap, L2Character.class))
|
||||
if (!_trap.getSkill().getTargetsAffected(_trap, _trap).isEmpty())
|
||||
{
|
||||
if (_trap.checkTarget(target))
|
||||
{
|
||||
_trap.triggerTrap(target);
|
||||
break;
|
||||
}
|
||||
_trap.triggerTrap(_trap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,145 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 com.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
public abstract class AbstractNpcInfo implements IClientOutgoingPacket
|
||||
{
|
||||
protected int _x, _y, _z, _heading;
|
||||
protected int _idTemplate;
|
||||
protected boolean _isAttackable, _isSummoned;
|
||||
protected int _mAtkSpd, _pAtkSpd;
|
||||
protected final int _runSpd, _walkSpd;
|
||||
protected final int _swimRunSpd, _swimWalkSpd;
|
||||
protected final int _flyRunSpd, _flyWalkSpd;
|
||||
protected double _moveMultiplier;
|
||||
|
||||
protected int _rhand, _lhand, _chest, _enchantEffect;
|
||||
protected double _collisionHeight, _collisionRadius;
|
||||
protected String _name = "";
|
||||
protected String _title = "";
|
||||
|
||||
public AbstractNpcInfo(L2Character cha)
|
||||
{
|
||||
_isSummoned = cha.isShowSummonAnimation();
|
||||
_x = cha.getX();
|
||||
_y = cha.getY();
|
||||
_z = cha.getZ();
|
||||
_heading = cha.getHeading();
|
||||
_mAtkSpd = cha.getMAtkSpd();
|
||||
_pAtkSpd = cha.getPAtkSpd();
|
||||
_moveMultiplier = cha.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(cha.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(cha.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(cha.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(cha.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = cha.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = cha.isFlying() ? _walkSpd : 0;
|
||||
}
|
||||
|
||||
public static class TrapInfo extends AbstractNpcInfo
|
||||
{
|
||||
private final L2TrapInstance _trap;
|
||||
|
||||
public TrapInfo(L2TrapInstance cha, L2Character attacker)
|
||||
{
|
||||
super(cha);
|
||||
|
||||
_trap = cha;
|
||||
_idTemplate = cha.getTemplate().getDisplayId();
|
||||
_isAttackable = cha.isAutoAttackable(attacker);
|
||||
_rhand = 0;
|
||||
_lhand = 0;
|
||||
_collisionHeight = _trap.getTemplate().getfCollisionHeight();
|
||||
_collisionRadius = _trap.getTemplate().getfCollisionRadius();
|
||||
if (cha.getTemplate().isUsingServerSideName())
|
||||
{
|
||||
_name = cha.getName();
|
||||
}
|
||||
_title = cha.getOwner() != null ? cha.getOwner().getName() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.NPC_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_trap.getObjectId());
|
||||
packet.writeD(_idTemplate + 1000000); // npctype id
|
||||
packet.writeD(_isAttackable ? 1 : 0);
|
||||
packet.writeD(_x);
|
||||
packet.writeD(_y);
|
||||
packet.writeD(_z);
|
||||
packet.writeD(_heading);
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(_mAtkSpd);
|
||||
packet.writeD(_pAtkSpd);
|
||||
packet.writeD(_runSpd);
|
||||
packet.writeD(_walkSpd);
|
||||
packet.writeD(_swimRunSpd);
|
||||
packet.writeD(_swimWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeF(_moveMultiplier);
|
||||
packet.writeF(_trap.getAttackSpeedMultiplier());
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(_rhand); // right hand weapon
|
||||
packet.writeD(_chest);
|
||||
packet.writeD(_lhand); // left hand weapon
|
||||
packet.writeC(1); // name above char 1=true ... ??
|
||||
packet.writeC(1);
|
||||
packet.writeC(_trap.isInCombat() ? 1 : 0);
|
||||
packet.writeC(_trap.isAlikeDead() ? 1 : 0);
|
||||
packet.writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_name);
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_title);
|
||||
packet.writeD(0x00); // title color 0 = client default
|
||||
|
||||
packet.writeD(_trap.getPvpFlag());
|
||||
packet.writeD(_trap.getReputation());
|
||||
|
||||
packet.writeD(0); // was AVE and was adding stealth
|
||||
packet.writeD(0x00); // clan id
|
||||
packet.writeD(0x00); // crest id
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeC(0000); // C2
|
||||
|
||||
packet.writeC(_trap.getTeam().getId());
|
||||
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(0x00); // C4
|
||||
packet.writeD(0x00); // C6
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(0); // CT1.5 Pet form and skills
|
||||
packet.writeC(0x01);
|
||||
packet.writeC(0x01);
|
||||
packet.writeD(0x00);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -134,7 +134,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
|
||||
addComponentType(NpcInfoType.NAME);
|
||||
}
|
||||
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion())
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion() || npc.isTrap())
|
||||
{
|
||||
addComponentType(NpcInfoType.TITLE);
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ import com.l2jmobius.gameserver.model.TeleportWhereType;
|
||||
import com.l2jmobius.gameserver.model.TimeStamp;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.stat.CharStat;
|
||||
import com.l2jmobius.gameserver.model.actor.status.CharStatus;
|
||||
import com.l2jmobius.gameserver.model.actor.tasks.character.HitTask;
|
||||
@ -2481,10 +2482,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
*/
|
||||
public final String getTitle()
|
||||
{
|
||||
// Champion titles
|
||||
if (isChampion())
|
||||
{
|
||||
return Config.CHAMP_TITLE;
|
||||
}
|
||||
// Custom level titles
|
||||
if (Config.SHOW_NPC_LVL && isMonster())
|
||||
{
|
||||
String t = "Lv " + getLevel() + (((L2MonsterInstance) this).isAggressive() ? "*" : "");
|
||||
@ -2494,6 +2497,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
}
|
||||
return t;
|
||||
}
|
||||
// Set trap title
|
||||
if (isTrap() && (((L2TrapInstance) this).getOwner() != null))
|
||||
{
|
||||
_title = ((L2TrapInstance) this).getOwner().getName();
|
||||
}
|
||||
return _title != null ? _title : "";
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ import com.l2jmobius.gameserver.model.olympiad.OlympiadGameManager;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AbstractNpcInfo.TrapInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
|
||||
@ -159,16 +159,6 @@ public final class L2TrapInstance extends L2Npc
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkTarget(L2Character target)
|
||||
{
|
||||
if (!target.isInsideRadius(this, 300, false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _skill.getSkill().getTarget(this, target, false, true, false) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
@ -287,7 +277,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
{
|
||||
if (_isTriggered || canBeSeen(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(new TrapInfo(this, activeChar));
|
||||
activeChar.sendPacket(new NpcInfo(this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +326,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
}
|
||||
|
||||
_isTriggered = true;
|
||||
broadcastPacket(new TrapInfo(this, null));
|
||||
broadcastPacket(new NpcInfo(this));
|
||||
setTarget(target);
|
||||
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(this, target, TrapAction.TRAP_TRIGGERED), this);
|
||||
|
@ -18,8 +18,6 @@ package com.l2jmobius.gameserver.model.actor.tasks.npc.trap;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
|
||||
@ -59,13 +57,9 @@ public class TrapTask implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
for (L2Character target : L2World.getInstance().getVisibleObjects(_trap, L2Character.class))
|
||||
if (!_trap.getSkill().getTargetsAffected(_trap, _trap).isEmpty())
|
||||
{
|
||||
if (_trap.checkTarget(target))
|
||||
{
|
||||
_trap.triggerTrap(target);
|
||||
break;
|
||||
}
|
||||
_trap.triggerTrap(_trap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,145 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 com.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
public abstract class AbstractNpcInfo implements IClientOutgoingPacket
|
||||
{
|
||||
protected int _x, _y, _z, _heading;
|
||||
protected int _idTemplate;
|
||||
protected boolean _isAttackable, _isSummoned;
|
||||
protected int _mAtkSpd, _pAtkSpd;
|
||||
protected final int _runSpd, _walkSpd;
|
||||
protected final int _swimRunSpd, _swimWalkSpd;
|
||||
protected final int _flyRunSpd, _flyWalkSpd;
|
||||
protected double _moveMultiplier;
|
||||
|
||||
protected int _rhand, _lhand, _chest, _enchantEffect;
|
||||
protected double _collisionHeight, _collisionRadius;
|
||||
protected String _name = "";
|
||||
protected String _title = "";
|
||||
|
||||
public AbstractNpcInfo(L2Character cha)
|
||||
{
|
||||
_isSummoned = cha.isShowSummonAnimation();
|
||||
_x = cha.getX();
|
||||
_y = cha.getY();
|
||||
_z = cha.getZ();
|
||||
_heading = cha.getHeading();
|
||||
_mAtkSpd = cha.getMAtkSpd();
|
||||
_pAtkSpd = cha.getPAtkSpd();
|
||||
_moveMultiplier = cha.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(cha.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(cha.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(cha.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(cha.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = cha.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = cha.isFlying() ? _walkSpd : 0;
|
||||
}
|
||||
|
||||
public static class TrapInfo extends AbstractNpcInfo
|
||||
{
|
||||
private final L2TrapInstance _trap;
|
||||
|
||||
public TrapInfo(L2TrapInstance cha, L2Character attacker)
|
||||
{
|
||||
super(cha);
|
||||
|
||||
_trap = cha;
|
||||
_idTemplate = cha.getTemplate().getDisplayId();
|
||||
_isAttackable = cha.isAutoAttackable(attacker);
|
||||
_rhand = 0;
|
||||
_lhand = 0;
|
||||
_collisionHeight = _trap.getTemplate().getfCollisionHeight();
|
||||
_collisionRadius = _trap.getTemplate().getfCollisionRadius();
|
||||
if (cha.getTemplate().isUsingServerSideName())
|
||||
{
|
||||
_name = cha.getName();
|
||||
}
|
||||
_title = cha.getOwner() != null ? cha.getOwner().getName() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.NPC_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_trap.getObjectId());
|
||||
packet.writeD(_idTemplate + 1000000); // npctype id
|
||||
packet.writeD(_isAttackable ? 1 : 0);
|
||||
packet.writeD(_x);
|
||||
packet.writeD(_y);
|
||||
packet.writeD(_z);
|
||||
packet.writeD(_heading);
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(_mAtkSpd);
|
||||
packet.writeD(_pAtkSpd);
|
||||
packet.writeD(_runSpd);
|
||||
packet.writeD(_walkSpd);
|
||||
packet.writeD(_swimRunSpd);
|
||||
packet.writeD(_swimWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeF(_moveMultiplier);
|
||||
packet.writeF(_trap.getAttackSpeedMultiplier());
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(_rhand); // right hand weapon
|
||||
packet.writeD(_chest);
|
||||
packet.writeD(_lhand); // left hand weapon
|
||||
packet.writeC(1); // name above char 1=true ... ??
|
||||
packet.writeC(1);
|
||||
packet.writeC(_trap.isInCombat() ? 1 : 0);
|
||||
packet.writeC(_trap.isAlikeDead() ? 1 : 0);
|
||||
packet.writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_name);
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_title);
|
||||
packet.writeD(0x00); // title color 0 = client default
|
||||
|
||||
packet.writeD(_trap.getPvpFlag());
|
||||
packet.writeD(_trap.getReputation());
|
||||
|
||||
packet.writeD(0); // was AVE and was adding stealth
|
||||
packet.writeD(0x00); // clan id
|
||||
packet.writeD(0x00); // crest id
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeC(0000); // C2
|
||||
|
||||
packet.writeC(_trap.getTeam().getId());
|
||||
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(0x00); // C4
|
||||
packet.writeD(0x00); // C6
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(0); // CT1.5 Pet form and skills
|
||||
packet.writeC(0x01);
|
||||
packet.writeC(0x01);
|
||||
packet.writeD(0x00);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -134,7 +134,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
|
||||
addComponentType(NpcInfoType.NAME);
|
||||
}
|
||||
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion())
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion() || npc.isTrap())
|
||||
{
|
||||
addComponentType(NpcInfoType.TITLE);
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ import com.l2jmobius.gameserver.model.TeleportWhereType;
|
||||
import com.l2jmobius.gameserver.model.TimeStamp;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.stat.CharStat;
|
||||
import com.l2jmobius.gameserver.model.actor.status.CharStatus;
|
||||
import com.l2jmobius.gameserver.model.actor.tasks.character.HitTask;
|
||||
@ -2481,10 +2482,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
*/
|
||||
public final String getTitle()
|
||||
{
|
||||
// Champion titles
|
||||
if (isChampion())
|
||||
{
|
||||
return Config.CHAMP_TITLE;
|
||||
}
|
||||
// Custom level titles
|
||||
if (Config.SHOW_NPC_LVL && isMonster())
|
||||
{
|
||||
String t = "Lv " + getLevel() + (((L2MonsterInstance) this).isAggressive() ? "*" : "");
|
||||
@ -2494,6 +2497,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
}
|
||||
return t;
|
||||
}
|
||||
// Set trap title
|
||||
if (isTrap() && (((L2TrapInstance) this).getOwner() != null))
|
||||
{
|
||||
_title = ((L2TrapInstance) this).getOwner().getName();
|
||||
}
|
||||
return _title != null ? _title : "";
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ import com.l2jmobius.gameserver.model.olympiad.OlympiadGameManager;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AbstractNpcInfo.TrapInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
|
||||
@ -159,16 +159,6 @@ public final class L2TrapInstance extends L2Npc
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkTarget(L2Character target)
|
||||
{
|
||||
if (!target.isInsideRadius(this, 300, false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _skill.getSkill().getTarget(this, target, false, true, false) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
@ -287,7 +277,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
{
|
||||
if (_isTriggered || canBeSeen(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(new TrapInfo(this, activeChar));
|
||||
activeChar.sendPacket(new NpcInfo(this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +326,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
}
|
||||
|
||||
_isTriggered = true;
|
||||
broadcastPacket(new TrapInfo(this, null));
|
||||
broadcastPacket(new NpcInfo(this));
|
||||
setTarget(target);
|
||||
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(this, target, TrapAction.TRAP_TRIGGERED), this);
|
||||
|
@ -18,8 +18,6 @@ package com.l2jmobius.gameserver.model.actor.tasks.npc.trap;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
|
||||
@ -59,13 +57,9 @@ public class TrapTask implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
for (L2Character target : L2World.getInstance().getVisibleObjects(_trap, L2Character.class))
|
||||
if (!_trap.getSkill().getTargetsAffected(_trap, _trap).isEmpty())
|
||||
{
|
||||
if (_trap.checkTarget(target))
|
||||
{
|
||||
_trap.triggerTrap(target);
|
||||
break;
|
||||
}
|
||||
_trap.triggerTrap(_trap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,145 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 com.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
public abstract class AbstractNpcInfo implements IClientOutgoingPacket
|
||||
{
|
||||
protected int _x, _y, _z, _heading;
|
||||
protected int _idTemplate;
|
||||
protected boolean _isAttackable, _isSummoned;
|
||||
protected int _mAtkSpd, _pAtkSpd;
|
||||
protected final int _runSpd, _walkSpd;
|
||||
protected final int _swimRunSpd, _swimWalkSpd;
|
||||
protected final int _flyRunSpd, _flyWalkSpd;
|
||||
protected double _moveMultiplier;
|
||||
|
||||
protected int _rhand, _lhand, _chest, _enchantEffect;
|
||||
protected double _collisionHeight, _collisionRadius;
|
||||
protected String _name = "";
|
||||
protected String _title = "";
|
||||
|
||||
public AbstractNpcInfo(L2Character cha)
|
||||
{
|
||||
_isSummoned = cha.isShowSummonAnimation();
|
||||
_x = cha.getX();
|
||||
_y = cha.getY();
|
||||
_z = cha.getZ();
|
||||
_heading = cha.getHeading();
|
||||
_mAtkSpd = cha.getMAtkSpd();
|
||||
_pAtkSpd = cha.getPAtkSpd();
|
||||
_moveMultiplier = cha.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(cha.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(cha.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(cha.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(cha.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = cha.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = cha.isFlying() ? _walkSpd : 0;
|
||||
}
|
||||
|
||||
public static class TrapInfo extends AbstractNpcInfo
|
||||
{
|
||||
private final L2TrapInstance _trap;
|
||||
|
||||
public TrapInfo(L2TrapInstance cha, L2Character attacker)
|
||||
{
|
||||
super(cha);
|
||||
|
||||
_trap = cha;
|
||||
_idTemplate = cha.getTemplate().getDisplayId();
|
||||
_isAttackable = cha.isAutoAttackable(attacker);
|
||||
_rhand = 0;
|
||||
_lhand = 0;
|
||||
_collisionHeight = _trap.getTemplate().getfCollisionHeight();
|
||||
_collisionRadius = _trap.getTemplate().getfCollisionRadius();
|
||||
if (cha.getTemplate().isUsingServerSideName())
|
||||
{
|
||||
_name = cha.getName();
|
||||
}
|
||||
_title = cha.getOwner() != null ? cha.getOwner().getName() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.NPC_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_trap.getObjectId());
|
||||
packet.writeD(_idTemplate + 1000000); // npctype id
|
||||
packet.writeD(_isAttackable ? 1 : 0);
|
||||
packet.writeD(_x);
|
||||
packet.writeD(_y);
|
||||
packet.writeD(_z);
|
||||
packet.writeD(_heading);
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(_mAtkSpd);
|
||||
packet.writeD(_pAtkSpd);
|
||||
packet.writeD(_runSpd);
|
||||
packet.writeD(_walkSpd);
|
||||
packet.writeD(_swimRunSpd);
|
||||
packet.writeD(_swimWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeF(_moveMultiplier);
|
||||
packet.writeF(_trap.getAttackSpeedMultiplier());
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(_rhand); // right hand weapon
|
||||
packet.writeD(_chest);
|
||||
packet.writeD(_lhand); // left hand weapon
|
||||
packet.writeC(1); // name above char 1=true ... ??
|
||||
packet.writeC(1);
|
||||
packet.writeC(_trap.isInCombat() ? 1 : 0);
|
||||
packet.writeC(_trap.isAlikeDead() ? 1 : 0);
|
||||
packet.writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_name);
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_title);
|
||||
packet.writeD(0x00); // title color 0 = client default
|
||||
|
||||
packet.writeD(_trap.getPvpFlag());
|
||||
packet.writeD(_trap.getReputation());
|
||||
|
||||
packet.writeD(0); // was AVE and was adding stealth
|
||||
packet.writeD(0x00); // clan id
|
||||
packet.writeD(0x00); // crest id
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeC(0000); // C2
|
||||
|
||||
packet.writeC(_trap.getTeam().getId());
|
||||
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(0x00); // C4
|
||||
packet.writeD(0x00); // C6
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(0); // CT1.5 Pet form and skills
|
||||
packet.writeC(0x01);
|
||||
packet.writeC(0x01);
|
||||
packet.writeD(0x00);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -134,7 +134,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
|
||||
addComponentType(NpcInfoType.NAME);
|
||||
}
|
||||
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion())
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion() || npc.isTrap())
|
||||
{
|
||||
addComponentType(NpcInfoType.TITLE);
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ import com.l2jmobius.gameserver.model.TeleportWhereType;
|
||||
import com.l2jmobius.gameserver.model.TimeStamp;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.stat.CharStat;
|
||||
import com.l2jmobius.gameserver.model.actor.status.CharStatus;
|
||||
import com.l2jmobius.gameserver.model.actor.tasks.character.HitTask;
|
||||
@ -2481,10 +2482,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
*/
|
||||
public final String getTitle()
|
||||
{
|
||||
// Champion titles
|
||||
if (isChampion())
|
||||
{
|
||||
return Config.CHAMP_TITLE;
|
||||
}
|
||||
// Custom level titles
|
||||
if (Config.SHOW_NPC_LVL && isMonster())
|
||||
{
|
||||
String t = "Lv " + getLevel() + (((L2MonsterInstance) this).isAggressive() ? "*" : "");
|
||||
@ -2494,6 +2497,11 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
}
|
||||
return t;
|
||||
}
|
||||
// Set trap title
|
||||
if (isTrap() && (((L2TrapInstance) this).getOwner() != null))
|
||||
{
|
||||
_title = ((L2TrapInstance) this).getOwner().getName();
|
||||
}
|
||||
return _title != null ? _title : "";
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ import com.l2jmobius.gameserver.model.olympiad.OlympiadGameManager;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AbstractNpcInfo.TrapInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
|
||||
@ -159,16 +159,6 @@ public final class L2TrapInstance extends L2Npc
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkTarget(L2Character target)
|
||||
{
|
||||
if (!target.isInsideRadius(this, 300, false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _skill.getSkill().getTarget(this, target, false, true, false) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
@ -287,7 +277,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
{
|
||||
if (_isTriggered || canBeSeen(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(new TrapInfo(this, activeChar));
|
||||
activeChar.sendPacket(new NpcInfo(this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +326,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
}
|
||||
|
||||
_isTriggered = true;
|
||||
broadcastPacket(new TrapInfo(this, null));
|
||||
broadcastPacket(new NpcInfo(this));
|
||||
setTarget(target);
|
||||
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(this, target, TrapAction.TRAP_TRIGGERED), this);
|
||||
|
@ -18,8 +18,6 @@ package com.l2jmobius.gameserver.model.actor.tasks.npc.trap;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
|
||||
@ -59,13 +57,9 @@ public class TrapTask implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
for (L2Character target : L2World.getInstance().getVisibleObjects(_trap, L2Character.class))
|
||||
if (!_trap.getSkill().getTargetsAffected(_trap, _trap).isEmpty())
|
||||
{
|
||||
if (_trap.checkTarget(target))
|
||||
{
|
||||
_trap.triggerTrap(target);
|
||||
break;
|
||||
}
|
||||
_trap.triggerTrap(_trap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,145 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 com.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
public abstract class AbstractNpcInfo implements IClientOutgoingPacket
|
||||
{
|
||||
protected int _x, _y, _z, _heading;
|
||||
protected int _idTemplate;
|
||||
protected boolean _isAttackable, _isSummoned;
|
||||
protected int _mAtkSpd, _pAtkSpd;
|
||||
protected final int _runSpd, _walkSpd;
|
||||
protected final int _swimRunSpd, _swimWalkSpd;
|
||||
protected final int _flyRunSpd, _flyWalkSpd;
|
||||
protected double _moveMultiplier;
|
||||
|
||||
protected int _rhand, _lhand, _chest, _enchantEffect;
|
||||
protected double _collisionHeight, _collisionRadius;
|
||||
protected String _name = "";
|
||||
protected String _title = "";
|
||||
|
||||
public AbstractNpcInfo(L2Character cha)
|
||||
{
|
||||
_isSummoned = cha.isShowSummonAnimation();
|
||||
_x = cha.getX();
|
||||
_y = cha.getY();
|
||||
_z = cha.getZ();
|
||||
_heading = cha.getHeading();
|
||||
_mAtkSpd = cha.getMAtkSpd();
|
||||
_pAtkSpd = cha.getPAtkSpd();
|
||||
_moveMultiplier = cha.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(cha.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(cha.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(cha.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(cha.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = cha.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = cha.isFlying() ? _walkSpd : 0;
|
||||
}
|
||||
|
||||
public static class TrapInfo extends AbstractNpcInfo
|
||||
{
|
||||
private final L2TrapInstance _trap;
|
||||
|
||||
public TrapInfo(L2TrapInstance cha, L2Character attacker)
|
||||
{
|
||||
super(cha);
|
||||
|
||||
_trap = cha;
|
||||
_idTemplate = cha.getTemplate().getDisplayId();
|
||||
_isAttackable = cha.isAutoAttackable(attacker);
|
||||
_rhand = 0;
|
||||
_lhand = 0;
|
||||
_collisionHeight = _trap.getTemplate().getfCollisionHeight();
|
||||
_collisionRadius = _trap.getTemplate().getfCollisionRadius();
|
||||
if (cha.getTemplate().isUsingServerSideName())
|
||||
{
|
||||
_name = cha.getName();
|
||||
}
|
||||
_title = cha.getOwner() != null ? cha.getOwner().getName() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.NPC_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_trap.getObjectId());
|
||||
packet.writeD(_idTemplate + 1000000); // npctype id
|
||||
packet.writeD(_isAttackable ? 1 : 0);
|
||||
packet.writeD(_x);
|
||||
packet.writeD(_y);
|
||||
packet.writeD(_z);
|
||||
packet.writeD(_heading);
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(_mAtkSpd);
|
||||
packet.writeD(_pAtkSpd);
|
||||
packet.writeD(_runSpd);
|
||||
packet.writeD(_walkSpd);
|
||||
packet.writeD(_swimRunSpd);
|
||||
packet.writeD(_swimWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeD(_flyRunSpd);
|
||||
packet.writeD(_flyWalkSpd);
|
||||
packet.writeF(_moveMultiplier);
|
||||
packet.writeF(_trap.getAttackSpeedMultiplier());
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(_rhand); // right hand weapon
|
||||
packet.writeD(_chest);
|
||||
packet.writeD(_lhand); // left hand weapon
|
||||
packet.writeC(1); // name above char 1=true ... ??
|
||||
packet.writeC(1);
|
||||
packet.writeC(_trap.isInCombat() ? 1 : 0);
|
||||
packet.writeC(_trap.isAlikeDead() ? 1 : 0);
|
||||
packet.writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_name);
|
||||
packet.writeD(-1); // High Five NPCString ID
|
||||
packet.writeS(_title);
|
||||
packet.writeD(0x00); // title color 0 = client default
|
||||
|
||||
packet.writeD(_trap.getPvpFlag());
|
||||
packet.writeD(_trap.getReputation());
|
||||
|
||||
packet.writeD(0); // was AVE and was adding stealth
|
||||
packet.writeD(0x00); // clan id
|
||||
packet.writeD(0x00); // crest id
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeD(0000); // C2
|
||||
packet.writeC(0000); // C2
|
||||
|
||||
packet.writeC(_trap.getTeam().getId());
|
||||
|
||||
packet.writeF(_collisionRadius);
|
||||
packet.writeF(_collisionHeight);
|
||||
packet.writeD(0x00); // C4
|
||||
packet.writeD(0x00); // C6
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(0); // CT1.5 Pet form and skills
|
||||
packet.writeC(0x01);
|
||||
packet.writeC(0x01);
|
||||
packet.writeD(0x00);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -134,7 +134,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
|
||||
addComponentType(NpcInfoType.NAME);
|
||||
}
|
||||
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion())
|
||||
if (npc.getTemplate().isUsingServerSideTitle() || (Config.SHOW_NPC_LVL && npc.isMonster()) || npc.isChampion() || npc.isTrap())
|
||||
{
|
||||
addComponentType(NpcInfoType.TITLE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user