fwiffo
Sorceror
In mobile.cs, you have to put this at the beginning of course:
and, using actual SVN code, you have to mod the LiftItemDupe as this:
This way, special item properties usually like BaseItemType prop, for items normally non stackable, could be duplicated, thanks to reflection.
Remember that any prop will be duplicated, so you can make stackable any type of item, even atypical.
Bye
PS: you can also use any server version you wish, but this mod was made and tested on latest svn
PPS: by tested I mean on a server with a hundred of players.
Code:
using System.Reflection;
and, using actual SVN code, you have to mod the LiftItemDupe as this:
Code:
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.Hue;
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;
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 );
PropertyInfo[] properties = oldItem.GetType().GetProperties();
for (int i = 0; i < properties.Length; i++)
{
try
{
if (properties[i].CanRead && properties[i].CanWrite)
{
properties[i].SetValue(item, properties[i].GetValue(oldItem, null), null);
}
}
catch
{
return null;
}
}
item.Amount = oldItem.Amount - amount;
oldItem.Amount = amount;
oldItem.OnAfterDuped(item);
return item;
}
This way, special item properties usually like BaseItemType prop, for items normally non stackable, could be duplicated, thanks to reflection.
Remember that any prop will be duplicated, so you can make stackable any type of item, even atypical.
Bye
PS: you can also use any server version you wish, but this mod was made and tested on latest svn
PPS: by tested I mean on a server with a hundred of players.