Is good solution but... i added Rank in the Item.cs (Common, uncommon, rare, etc..) so... every item have a rank, my idea is change the color of the name item. For example, for the weapons with attrs (vanq, accurate, etc) this label (of the attrs) show in the normal color, no of the item rank.What worked for me is overriding the default behavior of the OnSingleClick and sending this:
from.Send( new UnicodeMessage( item.Serial, item.ItemID, MessageType.Label, colorhere, 3, "", "", texthere));
Oh, you mean you wat one of the item's word to be colored and the rest normal?
Would you mind giving some examples of what you want to achieve?
if (item.Name != null)
name = item.Name;
else if (item.DefaultName != null)
name = item.DefaultName;
else
name = Cliloc.Convert(item.LabelNumber, null);
from.Send( new UnicodeMessage( item.Serial, item.ItemID, MessageType.Label, colorhere, 3, "", "", name));
using System;
using System.IO;
using System.Text;
using System.Collections;
using Server.Network;
namespace Server
{
public static class Cliloc
{
public static void Configure()
{
Load();
}
private static readonly string m_ClilocFile = "Cliloc.enu";
private static Hashtable m_Table;
public static Hashtable Table
{
get { return m_Table; }
}
private static byte[] m_Buffer = new byte[1024];
public static void Load()
{
Console.Write( "Cliloc: Loading..." );
m_Table = new Hashtable();
string path = Core.FindDataFile( m_ClilocFile );
if ( path == null )
{
Console.WriteLine( "Cliloc file was not found" );
Console.WriteLine( "Make sure your Scripts/Misc/DataPath.cs is properly configured" );
Console.WriteLine( "After pressing return an exception will be thrown and the server will terminate" );
throw new Exception( String.Format( "Cliloc: {0} not found", path ) );
}
using ( BinaryReader bin = new BinaryReader( new FileStream( path, FileMode.Open, FileAccess.Read, FileShare.Read ) ) )
{
bin.ReadInt32();
bin.ReadInt16();
while ( bin.BaseStream.Length != bin.BaseStream.Position )
{
int number = bin.ReadInt32();
bin.ReadByte();
int length = bin.ReadInt16();
if ( length > m_Buffer.Length )
m_Buffer = new byte[(length + 1023) & ~1023];
bin.Read( m_Buffer, 0, length );
string text = Encoding.UTF8.GetString( m_Buffer, 0, length );
m_Table[number] = text;
}
}
Console.WriteLine( "done" );
}
public static string Convert( int number, string args )
{
string result = (string)m_Table[number];
if ( result == null )
return String.Format( "Missing Cliloc: #{0}", number );
if ( args == null || args == "" )
return result;
string[] split = args.Split( '\t' );
StringBuilder resultBuilder = new StringBuilder( result );
for ( int i = 0; i < split.Length; i++ )
{
int pos = result.IndexOf( String.Format( "~{0}_", i + 1 ) );
if ( pos != -1 )
{
int endPos = result.IndexOf( '~', pos + 1 );
string keyword = result.Substring( pos, endPos - pos + 1 );
resultBuilder.Replace( keyword, split[i] );
}
}
return resultBuilder.ToString();
}
public static string Convert( int number, string args, AffixType affixType, string affix )
{
bool append = ( ( affixType & AffixType.Prepend ) == 0 );
StringBuilder resultBuilder = new StringBuilder( Convert( number, args ) );
if ( append )
resultBuilder.Append( affix );
else
resultBuilder.Insert( 0, affix );
return resultBuilder.ToString();
}
public static string ConvertEquipmentInfo( Item item, EquipmentInfo info )
{
StringBuilder resultBuilder = new StringBuilder();
bool crafted = false;
if ( info.Crafter != null )
{
resultBuilder.AppendFormat( "Crafted by {0}", info.Crafter.Name );
crafted = true;
}
if ( info.Attributes.Length != 0 )
{
if ( crafted )
resultBuilder.Append( ' ' );
resultBuilder.Append( '[' );
for ( int i = 0; i < info.Attributes.Length; i++ )
{
if ( i != 0 )
resultBuilder.Append( '/' );
EquipInfoAttribute attr = info.Attributes[i];
resultBuilder.Append( Cliloc.Convert( attr.Number, null ) );
if ( attr.Charges != -1 )
resultBuilder.AppendFormat( ": {0}", attr.Charges );
}
resultBuilder.Append( ']' );
}
return resultBuilder.ToString();
}
}
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.