Jump to content

[декомпил] SM_NPC_INFO


Recommended Posts

        writeF(_npc.getX());// x
        writeF(_npc.getY());// y
        writeF(_npc.getZ());// z
        writeD(_npc.getObjectId()); //
        writeD(npcId); // nameId
        writeD(npcId); // polymorphedNameId

        writeC(npcTypeId); // flag

        writeH(_npc.getState()); // action
        writeC(_npc.getHeading()); // dir
        writeD(npcTemplate.getNameId()); // desc
        writeD(npcTemplate.getTitleId());// title

        writeC(0);// stance
        writeD(0);// guildId (если > 0 отобращает плащ легиона соотвествубщий id)
        writeS("");// guildName (пока не уверен, возможно тут выборка между guildName и masterName)

        writeD(creatorId);// masterId
        writeS(masterName);// masterName

        writeC(hpRatio);// %hp
        writeD(_npc.getCreatureStats().getMaxHp());
        writeC(_npc.getCreatureStats().getLevel());// lvl

        NpcEquip npcequip = GameStaticData.getInstance().getNpcsEquips().get(npcId);
        if (npcequip == null) {
            writeH(0x00); // Для версии ниже 4.6
            // writeD(0x00) //Для 4.6+ 
        } else {
            writeH(npcequip.getItemsmask()); // Для версии ниже 4.6
            // writeD(npcequip.getItemsmask()) //Для 4.6+ 
            for (item : npcequip.getNpcequip()) {
                writeD(item.nameId()); // weapon_name_id
                writeQ(0); // duyInfo
                writeH(0); // duyInfo
                //writeH(0); // Для 4.6+ 
            }
        }
        writeF(_npc.getCreatureStats().getBounds().getFront());
        writeF(_npc.getCreatureStats().getBounds().getUpper());
        writeF(_npc.getCreatureStats().getRunSpeed());// runSpeed

        writeH(_npc.getCreatureStats().getAttackDelay()); // orgAttackDelay
        writeH(_npc.getCreatureStats().getAttackDelay()); // curAttackDelay

        writeC(_npc.isFlag() ? 0x13 : _npc.isNewSpawn() ? 0x01 : 0x00); //PutObjectType

        writeF(_npc.getX());// moving x
        writeF(_npc.getY());// moving y
        writeF(_npc.getZ());// moving z
        writeC(0); // moving type

        SpawnNpc spawn = _npc.getSpawnTemplate();
        if (spawn == null)
            writeH(0);
        else
            writeH(spawn.getEditorId()); // EditorId

        int cutSceneId = 0;

        if (cutSceneId > 0) {
            writeD(0); // cutSceneId
            writeD(0); // spawnTime
        }
        writeH(0); // groupType
        writeH(0); // partType
        writeC(_npc.getVisualState()); // invisibleLevel
        int spawnCutSceneId = 0;
        if ( spawnCutSceneId > 0 ){
            writeH(0); // 2048
            writeH(0); // spawnCutSceneId
        } else {
            writeH(_npc.getNpcObjectType().getId()); // creationType
        }
        writeC(0); // hasLootRight
        writeD(_npc.getTarget() == null ? 0 : _npc.getTarget().getObjectId());
        writeD(TownService.getInstance().getTownIdByPosition(_npc)); // Если NPC не в 700000000 локациях, то рандомное число


Сниффер под 4.6 это проглатывает с удовольствием.
image.thumb.png.e218ab61a012643c9479359966fa1208.png

  • Like 2
Link to comment
Share on other sites

  • TidalPoo changed the title to [декомпил] SM_NPC_INFO

Есть очень интересный момент в этом всём...

writeC(_npc.isFlag() ? 0x13 : _npc.isNewSpawn() ? 0x01 : 0x00); //PutObjectType

А интересен он тем, то PutObjectType меняется в зависимости от ситуации:

  • Если NPC появляется при помощи телепорта, то тут используется id 3
  • если NPC появляется "полем зрения", то используется Id 0
  • спавном - 1
  • выход из инвиза - 5

Подобная ситуация происходит и в SM_DELETE, когда нужно убрать NPC, в этом пакете есть RemoveObjectType

Необходимые id для данного байта скину позже.

Кстати это же касается и игрока.
 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...