KilRoy Написал:А кто всё же добрый, и есть ли разобранный пакет ServerObjectInfo ?
Вроде для статуй там еще что-то несётся в пакете:
[SRC="java"]
writeD();//charId
writeD(0x00);//id: 0
writeS(0x00); //char name
writeD(0x00); //isAttackable : 0
writeD(_x); //x
writeD(_y); //y
writeD(_z); //z
writeD(13261); //heading: 13261 (0x000033CD)
writeF(1);//moveMult: 1
writeF(1);//ASpdMult: 1
writeF(30);//collisionRad: 30
writeF(40); //collisionHeight: 40
writeD(0x00);//curHP:0
writeD(0x00);//maxHP:0
writeD(7);//objType: 7
writeD(0x00);//SpecEffects:0[/SRC]
пакет
[SRC="java"]public class ServerObjectInfo extends L2GameServerPacket {
private NpcInstance _activeChar;
private int _x, _y, _z, _heading;
private int _idTemplate;
private boolean _isAttackable;
private double _collisionHeight, _collisionRadius;
private String _name;
private int _type;
public ServerObjectInfo(NpcInstance activeChar, Creature actor)
{
_activeChar = activeChar;
_idTemplate = _activeChar.getTemplate().npcId;
_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().name;
_type = 4;
if(_activeChar instanceof StatueInstance)
{
_idTemplate = 0;
_name = _activeChar.getName();
_isAttackable = false;
_collisionHeight = 30;
_collisionRadius = 40;
_type = 7;
}
}
@Override
protected 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(_type); // object type
writeD(0x00); // special effects
if(_type == 7)
{
StatueInstance statue = (StatueInstance) _activeChar;
writeD(statue.getRecordId());
writeD(0x00); // ???
writeD(statue.getSocialId());
writeD(statue.getSocialFrame());
writeD(statue.getClassId());
writeD(statue.getRace());
writeD(statue.getSex());
writeD(statue.getHairStyle());
writeD(statue.getHairColor());
writeD(statue.getFace());
writeD(statue.getNecklace());
writeD(statue.getHead());
writeD(statue.getRHand());
writeD(statue.getLHand());
writeD(statue.getGloves());
writeD(statue.getChest());
writeD(statue.getPants());
writeD(statue.getBoots());
writeD(statue.getCloak());
writeD(statue.getHair1());
writeD(statue.getHair2());
}
}
}[/SRC]
private NpcInstance _activeChar;
private int _x, _y, _z, _heading;
private int _idTemplate;
private boolean _isAttackable;
private double _collisionHeight, _collisionRadius;
private String _name;
private int _type;
public ServerObjectInfo(NpcInstance activeChar, Creature actor)
{
_activeChar = activeChar;
_idTemplate = _activeChar.getTemplate().npcId;
_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().name;
_type = 4;
if(_activeChar instanceof StatueInstance)
{
_idTemplate = 0;
_name = _activeChar.getName();
_isAttackable = false;
_collisionHeight = 30;
_collisionRadius = 40;
_type = 7;
}
}
@Override
protected 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(_type); // object type
writeD(0x00); // special effects
if(_type == 7)
{
StatueInstance statue = (StatueInstance) _activeChar;
writeD(statue.getRecordId());
writeD(0x00); // ???
writeD(statue.getSocialId());
writeD(statue.getSocialFrame());
writeD(statue.getClassId());
writeD(statue.getRace());
writeD(statue.getSex());
writeD(statue.getHairStyle());
writeD(statue.getHairColor());
writeD(statue.getFace());
writeD(statue.getNecklace());
writeD(statue.getHead());
writeD(statue.getRHand());
writeD(statue.getLHand());
writeD(statue.getGloves());
writeD(statue.getChest());
writeD(statue.getPants());
writeD(statue.getBoots());
writeD(statue.getCloak());
writeD(statue.getHair1());
writeD(statue.getHair2());
}
}
}[/SRC]
StatueInstance это обычный контейнер
StatueInstance
[SRC="java"]package l2p.gameserver.model.instances;
import l2p.gameserver.dao.CharacterDAO;
import l2p.gameserver.templates.npc.NpcTemplate;
/**
* Created with IntelliJ IDEA.
* User: Darvin
* Date: 08.09.12
* Time: 5:12
*/
public class StatueInstance extends NpcInstance {
private int _recordId;
private int _socialId;
private int _socialFrame;
private int _sex;
private int _hairStyle;
private int _hairColor;
private int _face;
private int _necklace = 0;
private int _head = 0;
private int _classId = 0;
private int _rHand = 0;
private int _lHand = 0;
private int _gloves = 0;
private int _chest = 0;
private int _pants = 0;
private int _boots = 0;
private int _cloak = 0;
private int _hair1 = 0;
private int _hair2 = 0;
private int _race = 0;
public StatueInstance(int objectId, NpcTemplate template, int playerObjId, int loc[], int items[], int appearance[])
{
super(objectId, template);
_recordId = loc[4];
_socialId = 0;
_socialFrame = 0;
_necklace = items[0];
_head = items[1];
_rHand = items[2];
_lHand = items[3];
_gloves = items[4];
_chest = items[5];
_pants = items[6];
_boots = items[7];
_cloak = items[8];
_hair1 = items[9];
_hair2 = items[10];
setName(CharacterDAO.getInstance().getNameByObjectId(playerObjId));
_classId = appearance[0];
_race = appearance[1];
_sex = appearance[2];
_hairStyle = appearance[3];
_hairColor = appearance[4];
_face = appearance[5];
setIsInvul(true);
setXYZ(loc[0], loc[1], loc[2]);
setHeading(loc[3]);
spawnMe();
}
public int getRecordId() {
return _recordId;
}
public int getSocialId() {
return _socialId;
}
public int getSocialFrame() {
return _socialFrame;
}
public int getClassId() {
return _classId;
}
public int getRace() {
return _race;
}
public int getSex() {
return _sex;
}
public int getHairStyle() {
return _hairStyle;
}
public int getHairColor() {
return _hairColor;
}
public int getFace() {
return _face;
}
public int getNecklace() {
return _necklace;
}
public int getHead() {
return _head;
}
public int getRHand() {
return _rHand;
}
public int getLHand() {
return _lHand;
}
public int getGloves() {
return _gloves;
}
public int getChest() {
return _chest;
}
public int getPants() {
return _pants;
}
public int getBoots() {
return _boots;
}
public int getCloak() {
return _cloak;
}
public int getHair1() {
return _hair1;
}
public int getHair2() {
return _hair2;
}
}
[/SRC]
import l2p.gameserver.dao.CharacterDAO;
import l2p.gameserver.templates.npc.NpcTemplate;
/**
* Created with IntelliJ IDEA.
* User: Darvin
* Date: 08.09.12
* Time: 5:12
*/
public class StatueInstance extends NpcInstance {
private int _recordId;
private int _socialId;
private int _socialFrame;
private int _sex;
private int _hairStyle;
private int _hairColor;
private int _face;
private int _necklace = 0;
private int _head = 0;
private int _classId = 0;
private int _rHand = 0;
private int _lHand = 0;
private int _gloves = 0;
private int _chest = 0;
private int _pants = 0;
private int _boots = 0;
private int _cloak = 0;
private int _hair1 = 0;
private int _hair2 = 0;
private int _race = 0;
public StatueInstance(int objectId, NpcTemplate template, int playerObjId, int loc[], int items[], int appearance[])
{
super(objectId, template);
_recordId = loc[4];
_socialId = 0;
_socialFrame = 0;
_necklace = items[0];
_head = items[1];
_rHand = items[2];
_lHand = items[3];
_gloves = items[4];
_chest = items[5];
_pants = items[6];
_boots = items[7];
_cloak = items[8];
_hair1 = items[9];
_hair2 = items[10];
setName(CharacterDAO.getInstance().getNameByObjectId(playerObjId));
_classId = appearance[0];
_race = appearance[1];
_sex = appearance[2];
_hairStyle = appearance[3];
_hairColor = appearance[4];
_face = appearance[5];
setIsInvul(true);
setXYZ(loc[0], loc[1], loc[2]);
setHeading(loc[3]);
spawnMe();
}
public int getRecordId() {
return _recordId;
}
public int getSocialId() {
return _socialId;
}
public int getSocialFrame() {
return _socialFrame;
}
public int getClassId() {
return _classId;
}
public int getRace() {
return _race;
}
public int getSex() {
return _sex;
}
public int getHairStyle() {
return _hairStyle;
}
public int getHairColor() {
return _hairColor;
}
public int getFace() {
return _face;
}
public int getNecklace() {
return _necklace;
}
public int getHead() {
return _head;
}
public int getRHand() {
return _rHand;
}
public int getLHand() {
return _lHand;
}
public int getGloves() {
return _gloves;
}
public int getChest() {
return _chest;
}
public int getPants() {
return _pants;
}
public int getBoots() {
return _boots;
}
public int getCloak() {
return _cloak;
}
public int getHair1() {
return _hair1;
}
public int getHair2() {
return _hair2;
}
}
[/SRC]