本文整理汇总了C#中Server.Item.OnAfterDuped方法的典型用法代码示例。如果您正苦于以下问题:C# Item.OnAfterDuped方法的具体用法?C# Item.OnAfterDuped怎么用?C# Item.OnAfterDuped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Item
的用法示例。
在下文中一共展示了Item.OnAfterDuped方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LiftItemDupe
public static Item LiftItemDupe( Item oldItem, int amount )
{
Item item;
try
{
item = (Item) Activator.CreateInstance( oldItem.GetType() );
}
catch
{
Console.WriteLine( "Warning: 0x{0:X}: Item must have a zero paramater constructor to be separated from a stack. '{1}'.", oldItem.Serial.Value, oldItem.GetType().Name );
return null;
}
item.Visible = oldItem.Visible;
item.Movable = oldItem.Movable;
item.LootType = oldItem.LootType;
item.Direction = oldItem.Direction;
item.Hue = oldItem.PrivateHue;
item.ItemID = oldItem.ItemID;
item.Location = oldItem.Location;
item.Layer = oldItem.Layer;
item.Name = oldItem.Name;
item.Weight = oldItem.Weight;
item.Amount = oldItem.Amount - amount;
item.Map = oldItem.Map;
item.QuestItem = oldItem.QuestItem;
oldItem.Amount = amount;
oldItem.OnAfterDuped( item );
if ( oldItem.Parent is Mobile )
( (Mobile) oldItem.Parent ).AddItem( item );
else if ( oldItem.Parent is Item )
( (Item) oldItem.Parent ).AddItem( item );
item.Delta( ItemDelta.Update );
return item;
}
示例2: Dupe
private void Dupe(Container pack, Item copy)
{
bool done = false;
Type t = copy.GetType();
ConstructorInfo c = t.GetConstructor(Type.EmptyTypes);
if (c != null)
{
try
{
object o = c.Invoke(null);
if (o != null && o is Item)
{
Item newItem = (Item)o;
CopyProperties(newItem, copy);
copy.OnAfterDuped(newItem);
newItem.Parent = null;
pack.DropItem(newItem);
newItem.InvalidateProperties();
if(copy is Container)
{
DupeContainer((Container)copy, (Container)newItem);
}
}
done = true;
}
catch { }
}
if (!done)
{
Console.WriteLine("Unable to copy an item in a Pandora's Gift Box. All items must have a 0 parameter constructor.");
}
}