Jump to content
  • 0

[Interlude] Changing NPC Title color


Question

Posted

Hello,

 

I have one question. Is any way to change NPC title color without editing client side (npcname-e.dat)? i mean from server side. (Client Interlude). 

 

Or maybe someone already have edited npcname-e.dat with NPC levels and different colors for aggro monsters?

 

Here is my NpcInfo packet

 

protected final void writeImpl()
    {
        if (_activeChar == null)
        {
            return;
        }
        
        if (_activeChar instanceof L2Summon)
        {
            if (((L2Summon) _activeChar).getOwner() != null && ((L2Summon) _activeChar).getOwner().getAppearance().getInvisible())
            {
                return;
            }
        }
        
        writeC(0x16);
        writeD(_activeChar.getObjectId());
        writeD(_idTemplate + 1000000);
        writeD(_isAttackable ? 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(1.1);
        writeF(_pAtkSpd / 277.478340719);
        writeF(_collisionRadius);
        writeF(_collisionHeight);
        writeD(_rhand);
        writeD(0);
        writeD(_lhand);
        writeC(1);
        writeC(_activeChar.isRunning() ? 1 : 0);
        writeC(_activeChar.isInCombat() ? 1 : 0);
        writeC(_activeChar.isAlikeDead() ? 1 : 0);
        writeC(_isSummoned ? 2 : 0);
        writeS(_name);
        writeS(_title);
        
        if (_activeChar instanceof L2Summon)
        {
            writeD(0x01);
            writeD(((L2Summon) _activeChar).getPvpFlag());
            writeD(((L2Summon) _activeChar).getKarma());
        }
        else
        {
            writeD(0);
            writeD(0);
            writeD(0);
        }
        
        writeD(_activeChar.getAbnormalEffect());
        
        if (Config.SHOW_NPC_CREST)
        {
            writeD(_clanId);
            writeD(_clanCrest);
            writeD(_allyId);
            writeD(_allyCrest);
        }
        else
        {
            writeD(0);
            writeD(0);
            writeD(0);
            writeD(0);
        }
        
        writeC(0000); // C2
        
        if (Config.L2JMOD_CHAMPION_ENABLE)
        {
            writeC(_activeChar.isChampion() ? Config.L2JMOD_CHAMP_AURA : 0);
        }
        else
        {
            writeC(0);
        }
        
        writeF(_collisionRadius);
        writeF(_collisionHeight);
        
        writeD(0x00); // C4
        writeD(0x00); // C6
    }

 

2 answers to this question

Recommended Posts

  • 0
Posted

Easy peasy 😄

i have one simple PHP script. 

<?php
$acis = glob("acis/*xml"); // npc folder acis.
$npcs = array();
function one($string,$one,$two){
	$s = @explode($one,$string);
	$s = @explode($two,$s[1]);
	return @$s[0];
}
if (is_array($acis)) {
     foreach($acis as $filename) {
     $file = file_get_contents($filename);
	$file = explode("<npc",$file);
	 unset($file[0]);
	 foreach ($file as &$value) {
	$value = "<npc".$value;
	$id = one($value,'id="','"');
	$type = one($value,'name="type" val="','"');
	$level = one($value,'name="level" val="','"');
	$aggro = one($value,'aggro="','"');
	$npcs[$id] = array("type"=>$type,"level"=>$level,'aggro'=>$aggro);
		 }
	 }
}
$file = file_get_contents("npcnames.txt");
$file = explode("\r\n",$file);
$client = array();
foreach($file as $npc) {
	$ex = explode("	",$npc);
	$client[$ex[0]] = $ex;
}
// 0 - id
// 1 - name
// 2 - title
// 3 - r
// 4 - g
// 5 - b
// 6 - reserved

foreach($npcs as $id => &$npc){
	
if($npc['type'] == "Monster"){
	$client[$id][2] = $npc['level']." Level";
	if($npc['aggro']>0){
	$client[$id][3] = "FF";
	$client[$id][4] = "FF";
	$client[$id][5] = "FF";
	}
}

}

// print npcnames.... CTRL+U in browser.
foreach($client as &$val){
echo implode("	",$val)."\r\n";
}
?>

you can adapt for any pack.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   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.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock