NPC/ect Title Color

k2s

Выдающийся
Участник
Сообщения
43
Розыгрыши
0
Репутация
124
Реакции
71
Баллы
1 338
Привет всем. Возможно кто-то знает куда копать в плане отображения "цвета" титулов monsters,npcs ect.. из клиента? serverSideTitle=0 сам титул берёт из клиента но вот цвет.. Спасибо заранее.
Source int....su

Кто то писал про NpcInfo но дело явно не в нём.
HTML:
package ru.catssoftware.gameserver.network.serverpackets;

import ru.catssoftware.Config;
import ru.catssoftware.gameserver.model.L2Character;
import ru.catssoftware.gameserver.model.L2Summon;
import ru.catssoftware.gameserver.model.actor.instance.L2MonsterInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2NpcInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2SiegeFlagInstance;
import ru.catssoftware.gameserver.network.L2GameClient;

/**
* This class ...
*
* @version $Revision: 1.7.2.4.2.9 $ $Date: 2005/04/11 10:05:54 $
*/
public class NpcInfo extends L2GameServerPacket {
    //   ddddddddddddddddddffffdddcccccSSddd dddddc
    //   ddddddddddddddddddffffdddcccccSSddd dddddccffd

    private static final String _S__22_NPCINFO = "[S] 16 NpcInfo";
    private L2Character _activeChar;
    private int _x, _y, _z, _heading;
    private int _idTemplate;
    private boolean _isSummoned;
    private int _mAtkSpd, _pAtkSpd;
    private int _runSpd, _walkSpd, _swimRunSpd, _swimWalkSpd, _flRunSpd, _flWalkSpd, _flyRunSpd, _flyWalkSpd;
    @SuppressWarnings("unused")
    private int _rhand, _lhand, _chest, _val, _team;
    ;
    private int _collisionHeight, _collisionRadius;
    private String _name = "";
    private String _title = "";
    @SuppressWarnings("unused")
    private int _form = 0;

    /**
     * @param _activeCharracters
     */
    public NpcInfo(L2NpcInstance cha) {
        _activeChar = cha;
        _idTemplate = cha.getTemplate().getIdTemplate();
        _rhand = cha.getRightHandItem();
        _lhand = cha.getLeftHandItem();
        _isSummoned = cha.isShowSummonAnimation();
        _collisionHeight = cha.getCollisionHeight();
        _collisionRadius = cha.getCollisionRadius();
        _name = cha.getName();
        _team = _activeChar.getTeam();

        if (cha.isChampion()) {
            _title = cha.isChampion2() ? Config.CHAMPION_TITLE2 : Config.CHAMPION_TITLE;
            _team = cha.isChampion2() ? Config.CHAMPION_AURA2 : Config.CHAMPION_AURA;;
        } else {
            _title = cha.getTitle();
        }

        if (Config.SHOW_NPC_LVL && _activeChar instanceof L2MonsterInstance) {
            String t = "Lv " + cha.getLevel() + (cha.getAggroRange() > 0 ? "*" : "");
            if (_title != null && !_title.isEmpty()) {
                t += " " + _title;
            }

            _title = t;
        }
        if (_activeChar instanceof L2SiegeFlagInstance) {
            _title = cha.getTitle();
        }

        _x = _activeChar.getX();
        _y = _activeChar.getY();
        _z = _activeChar.getZ();
        _heading = _activeChar.getHeading();
        _mAtkSpd = _activeChar.getMAtkSpd();
        _pAtkSpd = _activeChar.getPAtkSpd();
        _runSpd = _activeChar.getTemplate().getBaseRunSpd();
        _walkSpd = _activeChar.getTemplate().getBaseWalkSpd();
        _swimRunSpd = _flRunSpd = _flyRunSpd = _runSpd;
        _swimWalkSpd = _flWalkSpd = _flyWalkSpd = _walkSpd;
    }

    public NpcInfo(L2Summon cha, int val) {
        _activeChar = cha;
        _idTemplate = cha.getTemplate().getIdTemplate();
        _rhand = cha.getWeapon();
        _lhand = 0;
        _chest = cha.getArmor();
        _val = val;
        _collisionHeight = _activeChar.getTemplate().getCollisionHeight();
        _collisionRadius = _activeChar.getTemplate().getCollisionRadius();

        _name = cha.getName();
        _title = cha.getOwner() != null ? (cha.getOwner().isOnline() == 0 ? "" : cha.getOwner().getName()) : ""; // when owner online, summon will show in title owner name
        int npcId = cha.getTemplate().getNpcId();
        if (npcId == 16041 || npcId == 16042) {
            if (cha.getLevel() > 84) {
                _form = 3;
            } else if (cha.getLevel() > 79) {
                _form = 2;
            } else if (cha.getLevel() > 74) {
                _form = 1;
            }
        } else if (npcId == 16025 || npcId == 16037) {
            if (cha.getLevel() > 69) {
                _form = 3;
            } else if (cha.getLevel() > 64) {
                _form = 2;
            } else if (cha.getLevel() > 59) {
                _form = 1;
            }
        }

        _x = _activeChar.getX();
        _y = _activeChar.getY();
        _z = _activeChar.getZ();
        _heading = _activeChar.getHeading();
        _mAtkSpd = _activeChar.getMAtkSpd();
        _pAtkSpd = _activeChar.getPAtkSpd();
        _runSpd = cha.getPetSpeed();
        _walkSpd = cha.isMountable() ? 45 : 30;
        _swimRunSpd = _flRunSpd = _flyRunSpd = _runSpd;
        _swimWalkSpd = _flWalkSpd = _flyWalkSpd = _walkSpd;
        _team = _activeChar.getTeam();
    }

    @Override
    protected void writeImpl(L2GameClient client, L2PcInstance activeChar) {
        if (_activeChar instanceof L2Summon) {
            if (((L2Summon) _activeChar).getOwner() != null && ((L2Summon) _activeChar).getOwner().getAppearance().isInvisible()) {
                return;
            }
        }
        writeC(0x16);
        writeD(_activeChar.getObjectId());
        writeD(_idTemplate + 1000000); // npctype id
        writeD(_activeChar.isAutoAttackable(activeChar) ? 1 : 0);
        writeD(_x);
        writeD(_y);
        writeD(_z);
        writeD(_heading);
        writeD(0x00);
        writeD(_mAtkSpd);
        writeD(_pAtkSpd);
        writeD(_runSpd);
        writeD(_walkSpd);
        writeD(_swimRunSpd/*0x32*/); // swimspeed
        writeD(_swimWalkSpd/*0x32*/); // swimspeed
        writeD(_flRunSpd);
        writeD(_flWalkSpd);
        writeD(_flyRunSpd);
        writeD(_flyWalkSpd);
        writeF(1.1/*_activeChar.getProperMultiplier()*/);
        //writeF(1/*_activeChar.getAttackSpeedMultiplier()*/);
        writeF(_pAtkSpd / 277.478340719);
        writeF(_collisionRadius);
        writeF(_collisionHeight);
        writeD(_rhand); // right hand weapon
        writeD(0);
        writeD(_lhand); // left hand weapon
        writeC(1); // name above char 1=true ... ??
        writeC(_activeChar.isRunning() ? 1 : 0);
        writeC(_activeChar.isInCombat() ? 1 : 0);
        writeC(_activeChar.isAlikeDead() ? 1 : 0);
        writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false  1=true   2=summoned (only works if model has a summon animation)
        writeS(_name);
        writeS(_title);
        writeD(0);
        writeD(0);
        writeD(0000); // hmm karma ??

        writeD(_activeChar.getAbnormalEffect()); // C2
        writeD(0000); // C2
        writeD(0000); // C2
        writeD(0000); // C2
        writeD(0000); // C2
        writeC(0000); // C2

        writeC(_team); // C3  team circle 1-blue, 2-red
        writeF(_collisionRadius);
        writeF(_collisionHeight);
        writeD(0x00); // C4
        writeD(0x00); // C6
    }

    @Override
    public boolean canBroadcast(L2PcInstance activeChar) {
        if (_activeChar instanceof L2Summon && ((L2Summon) _activeChar).getOwner() == activeChar) {
            return false;
        }

        if (activeChar == null || !activeChar.canSee(_activeChar)) {
            return false;
        }

        return true;
    }

    /* (non-Javadoc)
     * @see ru.catssoftware.gameserver.serverpackets.ServerBasePacket#getType()
     */
    @Override
    public String getType() {
        return _S__22_NPCINFO;
    }
}

Сабж пишите по теме пожалуйста. Спасибо.
 
цвет в npcName

Код:
npc_begin    id=25855    name=[u,Меллиса\0]    nick=[u,Верховная Жрица Крови\0]    nickcolor=9CE8A9FF    npc_end
 
  • Мне нравится
Реакции: k2s
20001 a,Gremlin\0 a,Level 1\0 B0 FF B0 -1
В NpcName-*.dat указывается и титул и его цвет в формате BGR.
 
  • Мне нравится
Реакции: k2s
Нет это не зависит от клиента. Эта проблема скорее на стороне сервера.
 
Ну если в NpcInfo все в порядке, значит в клиентской части цвет титула != ожидаемому.
 
Последнее редактирование модератором:
Гость, если флаг цвета титула имеет значение не 0, то используется серверный цвет, в ином случае за цвет отвечает клиент.
У меня, например, пакет выглядит так:
Код:
/*
* 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 ru.catssoftware.gameserver.network.serverpackets;

import lombok.extern.slf4j.Slf4j;
import ru.catssoftware.gameserver.Build;
import ru.catssoftware.gameserver.Config;
import ru.catssoftware.gameserver.cache.ClanCache;
import ru.catssoftware.gameserver.config.AltgameConfig;
import ru.catssoftware.gameserver.model.L2Character;
import ru.catssoftware.gameserver.model.L2Clan;
import ru.catssoftware.gameserver.model.L2Summon;
import ru.catssoftware.gameserver.model.actor.EEnvType;
import ru.catssoftware.gameserver.model.actor.instance.L2MonsterInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2NpcInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance;
import ru.catssoftware.gameserver.network.BroadcastPacket;

/**
* This class ...
*
* @version $Revision: 1.7.2.4.2.9 $ $Date: 2005/04/11 10:05:54 $
*/
@Slf4j
public class NpcInfo extends L2GameServerPacket implements BroadcastPacket {
   private static final String _S__22_NPCINFO = "[S ] 16 NpcInfo";
   private L2Character _activeChar;
   private int _x, _y, _z, _heading;
   private int _idTemplate;
   private boolean _isSummoned;
   private int _allyId, _clanId, allyCrest, clanCrest;
   private int _mAtkSpd, _pAtkSpd;
   private int _runSpd, _walkSpd, _swimRunSpd, _swimWalkSpd, _flRunSpd, _flWalkSpd, _flyRunSpd, _flyWalkSpd;
   private int _rhand, _lhand;
   private int _collisionHeight, _collisionRadius;
   private String _name = "";
   private String _title = "";
   private int pvpFlag;
   private EEnvType env;
   private double _moveMultiplier;
   private float _atkSpdMultiplier;
 
   public NpcInfo(L2NpcInstance npc)
   {
     _activeChar = npc;
   
     if(Build.getInstance().isDebug() && npc.isDecayed()) {
       log.warn("{} {} - {} decayed and sent npcinfo", npc.getNpcId(), npc.getName(), npc.getObjectId(), new RuntimeException());
     }
   
     _idTemplate = npc.getTemplate().getIdTemplate();
     _rhand = npc.getRightHandItem();
     _lhand = npc.getLeftHandItem();
     _isSummoned = npc.isShowSummonAnimation();
     _collisionHeight = npc.getCollisionHeight();
     _collisionRadius = npc.getCollisionRadius();
   
     if(npc.getTemplate().isServerSideName())
       _name = npc.getName();

     if (AltgameConfig.SHOW_NPC_LVL && _activeChar instanceof L2MonsterInstance)
       _title = "Lv " + npc.getLevel() + (npc.getAggroRange() > 0 ? "*" : "") + "" + npc.getTitle();
     else if(npc.getTemplate().isServerSideTitle())
       _title = npc.getTitle();

     _x = _activeChar.getX();
     _y = _activeChar.getY();
     _z = _activeChar.getZ();
     _heading = _activeChar.getHeading();
     _mAtkSpd = _activeChar.getMAtkSpd();
     _pAtkSpd = _activeChar.getPAtkSpd();
   
     _moveMultiplier = _activeChar.getStat().getMovementSpeedMultiplier();
     _atkSpdMultiplier = _activeChar.getStat().getAttackSpeedMultiplier();
   
     _runSpd = (int) Math.round(_activeChar.getRunSpeed() / _moveMultiplier);
     _walkSpd = (int) Math.round(_activeChar.getStat().getWalkSpeed() / _moveMultiplier);
     _swimRunSpd = (int) Math.round((_activeChar.getRunSpeed() / 2) / _moveMultiplier);
     _swimWalkSpd = (int) Math.round((_activeChar.getStat().getWalkSpeed() / 2) / _moveMultiplier);
     _flyRunSpd = _runSpd;
     _flyWalkSpd = _walkSpd;
     _flRunSpd = 0x00;
     _flWalkSpd = 0x00;

     if (AltgameConfig.ALT_SHOW_NPC_CREST && npc.isNpc() && npc.getZone("Town") != null && npc.getCastle().getOwnerId() != 0)
     {
       L2Clan clan = ClanCache.getInstance().get(npc.getCastle().getOwnerId());
       _clanId = clan.getClanId();
       clanCrest = clan.getClanCrestId();
       _allyId = clan.getAllyId();
       allyCrest = clan.getAllyCrestId();
     }
   
     env = _activeChar.getEnvironment();
   }

   public NpcInfo(L2Summon cha)
   {
     _activeChar = cha;
   
     if(Build.getInstance().isDebug() && cha.isDecayed()) {
       log.info("{} {} - {} decayed and sent npcinfo", cha.getNpcId(), cha.getName(), cha.getObjectId(), new RuntimeException());
     }
   
     _idTemplate = cha.getTemplate().getIdTemplate();
     _rhand = cha.getWeapon();
     _lhand = 0;
     _collisionHeight = _activeChar.getTemplate().getCollisionHeight();
     _collisionRadius = _activeChar.getTemplate().getCollisionRadius();

     _name = cha.getName();
     _title = cha.getOwner() != null ? (!cha.getOwner().isOnline() ? "" : cha.getOwner().getName()) : ""; // when owner online, summon will show in title owner name
     _x = _activeChar.getX();
     _y = _activeChar.getY();
     _z = _activeChar.getZ();
     _heading = _activeChar.getHeading();
     _mAtkSpd = _activeChar.getMAtkSpd();
     _pAtkSpd = _activeChar.getPAtkSpd();
   
     _moveMultiplier = _activeChar.getStat().getMovementSpeedMultiplier();
     _atkSpdMultiplier = _activeChar.getStat().getAttackSpeedMultiplier();
   
     _runSpd = (int) Math.round(_activeChar.getRunSpeed() / _moveMultiplier);
     _walkSpd = (int) Math.round(_activeChar.getStat().getWalkSpeed() / _moveMultiplier);
     _swimRunSpd = (int) Math.round((_activeChar.getRunSpeed() / 2) / _moveMultiplier);
     _swimWalkSpd = (int) Math.round((_activeChar.getStat().getWalkSpeed() / 2) / _moveMultiplier);
     _flyRunSpd = _runSpd;
     _flyWalkSpd = _walkSpd;
     _flRunSpd = 0x00; //safe fall parameter. TODO Pointer need check it on falling in GF pts
     _flWalkSpd = 0x00;
   
     pvpFlag = cha.getOwner().getPvpFlag();

     L2PcInstance owner = cha.getOwner();

     // NPC crest system
     if (AltgameConfig.ALT_SHOW_SUMMON_CREST && owner != null && owner.getClan() != null)
     {
       L2Clan clan = ClanCache.getInstance().get(owner.getClanId());
       _clanId = clan.getClanId();
       clanCrest = clan.getClanCrestId();
       _allyId = clan.getAllyId();
       allyCrest = clan.getAllyCrestId();
     }
   
     env = _activeChar.getEnvironment();
   }


   @Override
   public void write()
   {
     if(_activeChar instanceof L2Summon) //FIXME Pointer костыль еще тот. после переписки суммонов удалить.
       if(((L2Summon) _activeChar).getOwner() != null && ((L2Summon) _activeChar).getOwner().getAppearance().isInvisible())
         return;
     writeC(0x16);
     writeD(_activeChar.getObjectId());
     writeD(_idTemplate + 1000000); // npctype id
     writeD(_activeChar.isAutoAttackable(getActiveChar()) ? 1 : 0);
     writeD(_x);
     writeD(_y);
     writeD(_z);
     writeD(_heading);
     writeD(0x00);
     writeD(_mAtkSpd);
     writeD(_pAtkSpd);
     writeD(_runSpd);
     writeD(_walkSpd);
     writeD(_swimRunSpd);
     writeD(_swimWalkSpd);
     writeD(_flRunSpd);
     writeD(_flWalkSpd);
     writeD(_flyRunSpd);
     writeD(_flyWalkSpd);
     writeF(_moveMultiplier);
     writeF(_atkSpdMultiplier);
     writeF(_collisionRadius);
     writeF(_collisionHeight);
     writeD(_rhand);
     writeD(0); //chest
     writeD(_lhand);
     writeC(1); //show name
     writeC(_activeChar.isRunning() ? 1 : 0);
     writeC(_activeChar.isInCombat() ? 1 : 0);
     writeC(_activeChar.isAlikeDead() ? 1 : 0);
     writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false  1=true  2=summoned (only works if model has a summon animation)
     writeS(_name);

     if (Config.CHAMPION_CUSTOM_TITLE && _activeChar.getAttackable() != null && _activeChar.getAttackable().isChampion())
       writeS(getActiveChar().getLang().getMessage(_activeChar.getAttackable().getChampion() == 1 ? "CHAMPION_TITLE_BLUE" : "CHAMPION_TITLE_RED"));
     else
       writeS(_title);

     writeD(Build.getInstance().isDebug() ? 0x00ee22 : 0x000000); //title color
     writeD(pvpFlag); //pvp flag
     writeD(0x00); //karma

     writeD(_activeChar.getAbnormalEffect());
     writeD(_clanId);
     writeD(clanCrest);
     writeD(_allyId);
     writeD(allyCrest);
     writeC(env.getType());

     writeC(_activeChar.getTeam()); //1-blue, 2-red
     writeF(_collisionRadius);
     writeF(_collisionHeight);

     writeD(0x00); //TODO: enchant
     writeD(_activeChar.isFlying() ? 0x01 : 0x00);
   }

   @Deprecated
   @Override
   public boolean canBroadcast(L2PcInstance activeChar)
   {
     if (_activeChar.isSummon() && _activeChar.getPlayer() == activeChar)
       return false;

     return activeChar != null && activeChar.canSee(_activeChar, false);

   }

   @Override
   public String getType()
   {
     return _S__22_NPCINFO;
   }
}
 
Последнее редактирование:
  • Мне нравится
Реакции: k2s
b3trayer, спасай :) перерыл всё.. Проблема осталась... :unsure:
Куда еще копнуть кроме NpcInfo?
 
// fixed. check isServerSideTitle() & isServerSideName()
 
Гость, если флаг цвета титула имеет значение не 0, то используется серверный цвет, в ином случае за цвет отвечает клиент.
У меня, например, пакет выглядит так:
Код:
/*
* 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 ru.catssoftware.gameserver.network.serverpackets;

import lombok.extern.slf4j.Slf4j;
import ru.catssoftware.gameserver.Build;
import ru.catssoftware.gameserver.Config;
import ru.catssoftware.gameserver.cache.ClanCache;
import ru.catssoftware.gameserver.config.AltgameConfig;
import ru.catssoftware.gameserver.model.L2Character;
import ru.catssoftware.gameserver.model.L2Clan;
import ru.catssoftware.gameserver.model.L2Summon;
import ru.catssoftware.gameserver.model.actor.EEnvType;
import ru.catssoftware.gameserver.model.actor.instance.L2MonsterInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2NpcInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance;
import ru.catssoftware.gameserver.network.BroadcastPacket;

/**
* This class ...
*
* @version $Revision: 1.7.2.4.2.9 $ $Date: 2005/04/11 10:05:54 $
*/
@Slf4j
public class NpcInfo extends L2GameServerPacket implements BroadcastPacket {
   private static final String _S__22_NPCINFO = "[S ] 16 NpcInfo";
   private L2Character _activeChar;
   private int _x, _y, _z, _heading;
   private int _idTemplate;
   private boolean _isSummoned;
   private int _allyId, _clanId, allyCrest, clanCrest;
   private int _mAtkSpd, _pAtkSpd;
   private int _runSpd, _walkSpd, _swimRunSpd, _swimWalkSpd, _flRunSpd, _flWalkSpd, _flyRunSpd, _flyWalkSpd;
   private int _rhand, _lhand;
   private int _collisionHeight, _collisionRadius;
   private String _name = "";
   private String _title = "";
   private int pvpFlag;
   private EEnvType env;
   private double _moveMultiplier;
   private float _atkSpdMultiplier;

   public NpcInfo(L2NpcInstance npc)
   {
     _activeChar = npc;
  
     if(Build.getInstance().isDebug() && npc.isDecayed()) {
       log.warn("{} {} - {} decayed and sent npcinfo", npc.getNpcId(), npc.getName(), npc.getObjectId(), new RuntimeException());
     }
  
     _idTemplate = npc.getTemplate().getIdTemplate();
     _rhand = npc.getRightHandItem();
     _lhand = npc.getLeftHandItem();
     _isSummoned = npc.isShowSummonAnimation();
     _collisionHeight = npc.getCollisionHeight();
     _collisionRadius = npc.getCollisionRadius();
  
     if(npc.getTemplate().isServerSideName())
       _name = npc.getName();

     if (AltgameConfig.SHOW_NPC_LVL && _activeChar instanceof L2MonsterInstance)
       _title = "Lv " + npc.getLevel() + (npc.getAggroRange() > 0 ? "*" : "") + "" + npc.getTitle();
     else if(npc.getTemplate().isServerSideTitle())
       _title = npc.getTitle();

     _x = _activeChar.getX();
     _y = _activeChar.getY();
     _z = _activeChar.getZ();
     _heading = _activeChar.getHeading();
     _mAtkSpd = _activeChar.getMAtkSpd();
     _pAtkSpd = _activeChar.getPAtkSpd();
  
     _moveMultiplier = _activeChar.getStat().getMovementSpeedMultiplier();
     _atkSpdMultiplier = _activeChar.getStat().getAttackSpeedMultiplier();
  
     _runSpd = (int) Math.round(_activeChar.getRunSpeed() / _moveMultiplier);
     _walkSpd = (int) Math.round(_activeChar.getStat().getWalkSpeed() / _moveMultiplier);
     _swimRunSpd = (int) Math.round((_activeChar.getRunSpeed() / 2) / _moveMultiplier);
     _swimWalkSpd = (int) Math.round((_activeChar.getStat().getWalkSpeed() / 2) / _moveMultiplier);
     _flyRunSpd = _runSpd;
     _flyWalkSpd = _walkSpd;
     _flRunSpd = 0x00;
     _flWalkSpd = 0x00;

     if (AltgameConfig.ALT_SHOW_NPC_CREST && npc.isNpc() && npc.getZone("Town") != null && npc.getCastle().getOwnerId() != 0)
     {
       L2Clan clan = ClanCache.getInstance().get(npc.getCastle().getOwnerId());
       _clanId = clan.getClanId();
       clanCrest = clan.getClanCrestId();
       _allyId = clan.getAllyId();
       allyCrest = clan.getAllyCrestId();
     }
  
     env = _activeChar.getEnvironment();
   }

   public NpcInfo(L2Summon cha)
   {
     _activeChar = cha;
  
     if(Build.getInstance().isDebug() && cha.isDecayed()) {
       log.info("{} {} - {} decayed and sent npcinfo", cha.getNpcId(), cha.getName(), cha.getObjectId(), new RuntimeException());
     }
  
     _idTemplate = cha.getTemplate().getIdTemplate();
     _rhand = cha.getWeapon();
     _lhand = 0;
     _collisionHeight = _activeChar.getTemplate().getCollisionHeight();
     _collisionRadius = _activeChar.getTemplate().getCollisionRadius();

     _name = cha.getName();
     _title = cha.getOwner() != null ? (!cha.getOwner().isOnline() ? "" : cha.getOwner().getName()) : ""; // when owner online, summon will show in title owner name
     _x = _activeChar.getX();
     _y = _activeChar.getY();
     _z = _activeChar.getZ();
     _heading = _activeChar.getHeading();
     _mAtkSpd = _activeChar.getMAtkSpd();
     _pAtkSpd = _activeChar.getPAtkSpd();
  
     _moveMultiplier = _activeChar.getStat().getMovementSpeedMultiplier();
     _atkSpdMultiplier = _activeChar.getStat().getAttackSpeedMultiplier();
  
     _runSpd = (int) Math.round(_activeChar.getRunSpeed() / _moveMultiplier);
     _walkSpd = (int) Math.round(_activeChar.getStat().getWalkSpeed() / _moveMultiplier);
     _swimRunSpd = (int) Math.round((_activeChar.getRunSpeed() / 2) / _moveMultiplier);
     _swimWalkSpd = (int) Math.round((_activeChar.getStat().getWalkSpeed() / 2) / _moveMultiplier);
     _flyRunSpd = _runSpd;
     _flyWalkSpd = _walkSpd;
     _flRunSpd = 0x00; //safe fall parameter. TODO Pointer need check it on falling in GF pts
     _flWalkSpd = 0x00;
  
     pvpFlag = cha.getOwner().getPvpFlag();

     L2PcInstance owner = cha.getOwner();

     // NPC crest system
     if (AltgameConfig.ALT_SHOW_SUMMON_CREST && owner != null && owner.getClan() != null)
     {
       L2Clan clan = ClanCache.getInstance().get(owner.getClanId());
       _clanId = clan.getClanId();
       clanCrest = clan.getClanCrestId();
       _allyId = clan.getAllyId();
       allyCrest = clan.getAllyCrestId();
     }
  
     env = _activeChar.getEnvironment();
   }


   @Override
   public void write()
   {
     if(_activeChar instanceof L2Summon) //FIXME Pointer костыль еще тот. после переписки суммонов удалить.
       if(((L2Summon) _activeChar).getOwner() != null && ((L2Summon) _activeChar).getOwner().getAppearance().isInvisible())
         return;
     writeC(0x16);
     writeD(_activeChar.getObjectId());
     writeD(_idTemplate + 1000000); // npctype id
     writeD(_activeChar.isAutoAttackable(getActiveChar()) ? 1 : 0);
     writeD(_x);
     writeD(_y);
     writeD(_z);
     writeD(_heading);
     writeD(0x00);
     writeD(_mAtkSpd);
     writeD(_pAtkSpd);
     writeD(_runSpd);
     writeD(_walkSpd);
     writeD(_swimRunSpd);
     writeD(_swimWalkSpd);
     writeD(_flRunSpd);
     writeD(_flWalkSpd);
     writeD(_flyRunSpd);
     writeD(_flyWalkSpd);
     writeF(_moveMultiplier);
     writeF(_atkSpdMultiplier);
     writeF(_collisionRadius);
     writeF(_collisionHeight);
     writeD(_rhand);
     writeD(0); //chest
     writeD(_lhand);
     writeC(1); //show name
     writeC(_activeChar.isRunning() ? 1 : 0);
     writeC(_activeChar.isInCombat() ? 1 : 0);
     writeC(_activeChar.isAlikeDead() ? 1 : 0);
     writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false  1=true  2=summoned (only works if model has a summon animation)
     writeS(_name);

     if (Config.CHAMPION_CUSTOM_TITLE && _activeChar.getAttackable() != null && _activeChar.getAttackable().isChampion())
       writeS(getActiveChar().getLang().getMessage(_activeChar.getAttackable().getChampion() == 1 ? "CHAMPION_TITLE_BLUE" : "CHAMPION_TITLE_RED"));
     else
       writeS(_title);

     writeD(Build.getInstance().isDebug() ? 0x00ee22 : 0x000000); //title color
     writeD(pvpFlag); //pvp flag
     writeD(0x00); //karma

     writeD(_activeChar.getAbnormalEffect());
     writeD(_clanId);
     writeD(clanCrest);
     writeD(_allyId);
     writeD(allyCrest);
     writeC(env.getType());

     writeC(_activeChar.getTeam()); //1-blue, 2-red
     writeF(_collisionRadius);
     writeF(_collisionHeight);

     writeD(0x00); //TODO: enchant
     writeD(_activeChar.isFlying() ? 0x01 : 0x00);
   }

   @Deprecated
   @Override
   public boolean canBroadcast(L2PcInstance activeChar)
   {
     if (_activeChar.isSummon() && _activeChar.getPlayer() == activeChar)
       return false;

     return activeChar != null && activeChar.canSee(_activeChar, false);

   }

   @Override
   public String getType()
   {
     return _S__22_NPCINFO;
   }
}
Не понял, что ты имеешь в виду? Флаг цвета титула у нас 1, в нем отправляется цвет. Но как клиенту узнать, юзать полученный цвет или свой? Одна догадка - если цвет равен 0, то юзаем клиетский цвет. Но если и 0 тоже узается как серверный (черный цвет)? И для чего нужен еще один "лишний" байт (значений то 3, а байтов выделено 4).
 
Не понял, что ты имеешь в виду? Флаг цвета титула у нас 1, в нем отправляется цвет. Но как клиенту узнать, юзать полученный цвет или свой? Одна догадка - если цвет равен 0, то юзаем клиетский цвет. Но если и 0 тоже узается как серверный (черный цвет)? И для чего нужен еще один "лишний" байт (значений то 3, а байтов выделено 4).
Для цвета байты, для цвета. И отправляется 4 байта, всегда. Или кто-то из присутствующих видел черный титул?:) Маловероятно, что этот благородный дедуля, был бы рад черному титулу.
zNpszQy.png
 
Последнее редактирование модератором:
Назад
Сверху Снизу