本文整理汇总了C#中Server.Item.GetProperties方法的典型用法代码示例。如果您正苦于以下问题:C# Item.GetProperties方法的具体用法?C# Item.GetProperties怎么用?C# Item.GetProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Item
的用法示例。
在下文中一共展示了Item.GetProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddItemPropertyTooltip
private void AddItemPropertyTooltip( Item item )
{
item.GetProperties( new ObjectPropertyListTooltip( this ) );
}
示例2: GetItemProperties
/// <summary>
/// Gets an html formatted string with all the properies for the item
/// </summary>
/// <returns>A string object containing the html structure corresponding to the item properties</returns>
private static string GetItemProperties( Item item )
{
if ( item == null || item.PropertyList == null )
{
return AuctionSystem.ST[ 78 ];
}
if ( Core.AOS )
{
#region AoS
ObjectPropertyList plist = new ObjectPropertyList( item );
item.GetProperties( plist );
byte[] data = plist.UnderlyingStream.UnderlyingStream.ToArray();
ArrayList list = new ArrayList();
int index = 15; // First localization number index
while ( true )
{
uint number = 0;
if ( index + 4 >= data.Length )
{
break;
}
number = (uint) ( data[ index++ ] << 24 | data[ index++ ] << 16 | data[ index++ ] << 8 | data[ index++ ] );
ushort length = 0;
if ( index + 2 > data.Length )
{
break;
}
length = (ushort) ( data[ index++ ] << 8 | data[ index++ ] );
// Read the string
int end = index + length;
if ( end >= data.Length )
{
end = data.Length - 1;
}
System.Text.StringBuilder s = new System.Text.StringBuilder();
while ( index + 2 <= end + 1 )
{
short next = (short) ( data[ index++ ] | data[ index++ ] << 8 );
if ( next == 0 )
break;
s.Append( System.Text.Encoding.Unicode.GetString( BitConverter.GetBytes( next ) ) );
}
list.Add( ComputeProperty( (int) number, s.ToString() ) );
}
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append( "<basefont color=#FFFFFF><p>" );
foreach( string prop in list )
{
sb.AppendFormat( "{0}<br>", prop );
}
return sb.ToString();
#endregion
}
else
{
#region Non AoS
StringBuilder sb = new StringBuilder();
sb.Append( "<basefont color=#FFFFFF><p>" );
// Get the item name
if ( item.Name != null && item.Name.Length > 0 )
{
sb.AppendFormat( "{0}<br>", item.Name );
}
else
{
sb.AppendFormat( "{0}<br>", Capitalize( m_StringList.Table[ item.LabelNumber ] as string ) );
}
// Amount
if ( item.Amount > 1 )
{
sb.AppendFormat( AuctionSystem.ST[ 152 ] , item.Amount.ToString("#,0" ) );
}
// Loot type
if ( item.LootType != LootType.Regular )
{
sb.AppendFormat( "{0}<br>", item.LootType.ToString() );
//.........这里部分代码省略.........
示例3: GetItemName
public static string GetItemName(Item item)
{
if (StringList == null || item.Name != null)
return item.Name;
ObjectPropertyList opl = new ObjectPropertyList(item);
item.GetProperties(opl);
if (opl == null)
{
//if there was a problem with this process, just return null
return null;
}
//since the object property list is based on a packet object, the property info is packed away in a packet format
byte[] data = opl.UnderlyingStream.UnderlyingStream.ToArray();
int index = 15; // First localization number index
string basestring = null;
//reset the number property
uint number = 0;
//if there's not enough room for another record, quit
if (index + 4 >= data.Length)
{
return null;
}
//read number property from the packet data
number = (uint)(data[index++] << 24 | data[index++] << 16 | data[index++] << 8 | data[index++]);
//reset the length property
ushort length = 0;
//if there's not enough room for another record, quit
if (index + 2 > data.Length)
{
return null;
}
//read length property from the packet data
length = (ushort)(data[index++] << 8 | data[index++]);
//determine the location of the end of the string
int end = index + length;
//truncate if necessary
if (end >= data.Length)
{
end = data.Length - 1;
}
//read the string into a StringBuilder object
StringBuilder s = new StringBuilder();
while (index + 2 <= end + 1)
{
short next = (short)(data[index++] | data[index++] << 8);
if (next == 0)
break;
s.Append(Encoding.Unicode.GetString(BitConverter.GetBytes(next)));
}
basestring = StringList.GetString((int)number);
string args = s.ToString();
if (args == null || args == String.Empty)
{
return basestring;
}
string[] parms = args.Split('\t');
try
{
if (parms.Length > 1)
{
for (int i = 0; i < parms.Length; i++)
{
parms[i] = parms[i].Trim(' ');
if (parms[i].IndexOf("#") == 0)
{
parms[i] = StringList.GetString(Convert.ToInt32(parms[i].Substring(1, parms[i].Length - 1)));
}
}
}
else if (parms.Length == 1 && parms[0].IndexOf("#") == 0)
{
parms[0] = StringList.GetString(Convert.ToInt32(args.Substring(1, parms[0].Length - 1)));
}
}
catch
{
return null;
}
//.........这里部分代码省略.........