1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- /*
- * Copyright (C) 2004-2015 L2J Server
- *
- * This file is part of L2J Server.
- *
- * L2J Server 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.
- *
- * L2J Server 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.l2jserver.gameserver.network.serverpackets;
- import com.l2jserver.gameserver.model.actor.L2Character;
- import com.l2jserver.gameserver.model.actor.L2Npc;
- /**
- * @author devScarlet, mrTJO
- */
- public final class ServerObjectInfo extends L2GameServerPacket
- {
- private final L2Npc _activeChar;
- private final int _x, _y, _z, _heading;
- private final int _idTemplate;
- private final boolean _isAttackable;
- private final double _collisionHeight, _collisionRadius;
- private final String _name;
-
- public ServerObjectInfo(L2Npc activeChar, L2Character actor)
- {
- _activeChar = activeChar;
- _idTemplate = _activeChar.getTemplate().getDisplayId();
- _isAttackable = _activeChar.isAutoAttackable(actor);
- _collisionHeight = _activeChar.getCollisionHeight();
- _collisionRadius = _activeChar.getCollisionRadius();
- _x = _activeChar.getX();
- _y = _activeChar.getY();
- _z = _activeChar.getZ();
- _heading = _activeChar.getHeading();
- _name = _activeChar.getTemplate().isUsingServerSideName() ? _activeChar.getTemplate().getName() : "";
- }
-
- @Override
- protected final void writeImpl()
- {
- writeC(0x92);
- writeD(_activeChar.getObjectId());
- writeD(_idTemplate + 1000000);
- writeS(_name); // name
- writeD(_isAttackable ? 1 : 0);
- writeD(_x);
- writeD(_y);
- writeD(_z);
- writeD(_heading);
- writeF(1.0); // movement multiplier
- writeF(1.0); // attack speed multiplier
- writeF(_collisionRadius);
- writeF(_collisionHeight);
- writeD((int) (_isAttackable ? _activeChar.getCurrentHp() : 0));
- writeD(_isAttackable ? _activeChar.getMaxHp() : 0);
- writeD(0x01); // object type
- writeD(0x00); // special effects
- }
- }
|