1. I am having a little trouble figuring our what properties of an item contain the map / lock data in order to duplicate the item.

    Any pointers or examples would be greatly appreciated, I did search but couldn't find anything, not entirely sure I know what I am looking for either >.<

    Edit, updated:
    Code:
            private Item copyItem(Item item)
            {
                Item copy = ItemManager.CreateByItemID(item.info.itemid, item.amount, item.IsBlueprint());            // If weapon get ammo type and amount
                var weapon = item.GetHeldEntity() as BaseProjectile;
                if (weapon != null)
                {
                    (copy.GetHeldEntity() as BaseProjectile).primaryMagazine.contents = weapon.primaryMagazine.contents;
                    (copy.GetHeldEntity() as BaseProjectile).primaryMagazine.ammoType = weapon.primaryMagazine.ammoType;
                }            // If map copy images
                var map = item.GetHeldEntity() as MapEntity;
                if (map != null)
                {
                    (copy.GetHeldEntity() as MapEntity).fogImages = map.fogImages;
                    (copy.GetHeldEntity() as MapEntity).paintImages = map.paintImages;
                }            copy.skin = item.skin;
                copy.condition = item.condition;
                copy.instanceData = item.instanceData;
                copy.contents = item.contents;            return copy;
            }
    
     
    Last edited by a moderator: Aug 17, 2015
  2. item.GetHeldEntity() as MapEntity? and what lock data do you want?
     
  3. Perfect! Just what I needed for the map thanks :)

    For the lock I was referring to the door.key item but I have just found that the lock information is contained in item.instanceData
     
  4. I am trying to copy a gun, it copies the attachments but then the contents of the gun becomes glitched and the attachments wont view, removing the attachment will give you it but then the slots of the weapon become glitched and cant accept attachments again.
     
  5. Code:
    copy.contents = item.contents;
    That's a very bad practice.
    You should create a new instance of every item in item.contents and only then move it to copy.contents.
    You may use copyItem(Item item) in recursion for neatness.
     
  6. can you please show me an example of copying an item and its contents please :)