Server.Items.Corpse.Mobile_CreateCorpseHandler C# (CSharp) Method

Mobile_CreateCorpseHandler() public static method

public static Mobile_CreateCorpseHandler ( Server.Mobile owner, HairInfo hair, FacialHairInfo facialhair, List initialContent, List equipItems ) : Server.Items.Container
owner Server.Mobile
hair Server.HairInfo
facialhair Server.FacialHairInfo
initialContent List
equipItems List
return Server.Items.Container
		public static Container Mobile_CreateCorpseHandler( Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> initialContent, List<Item> equipItems )
		{
			bool shouldFillCorpse = true;

			Corpse c = new Corpse( owner, hair, facialhair, shouldFillCorpse ? equipItems : new List<Item>() );

			owner.Corpse = c;

			if ( shouldFillCorpse )
			{
				for ( int i = 0; i < initialContent.Count; ++i )
				{
					Item item = initialContent[i];

					c.DropItem( item );
                    c.SetRestoreInfo( item, item.Location );
				}
			}
			else
			{
				c.Carved = true; // TODO: Is it needed?
			}

			Point3D loc = owner.Location;
			Map map = owner.Map;

			if ( map == null || map == Map.Internal )
			{
				loc = owner.LogoutLocation;
				map = owner.LogoutMap;
			}

			c.MoveToWorld( loc, map );

			return c;
		}

Usage Example

Ejemplo n.º 1
0
        public new static Container Mobile_CreateCorpseHandler(Mobile owner, HairInfo hair, FacialHairInfo facialhair,
                                                               List <Item> initialContent, List <Item> equipItems)
        {
            var pm = owner as PlayerMobile;

            if (pm == null || BountyInformation.GetBounty(pm) <= 0)
            {
                return(Corpse.Mobile_CreateCorpseHandler(owner, hair, facialhair, initialContent, equipItems));
            }

            Corpse c = new BountyCorpse(owner, hair, facialhair, equipItems);

            //UOSI Logging
            //MoreLogging.WriteLine(owner, "A BountyCorpse has been created!");

            owner.Corpse = c;

            for (var i = 0; i < initialContent.Count; ++i)
            {
                var item = initialContent[i];

                if (Core.AOS && item.Parent == owner.Backpack)
                {
                    c.AddItem(item);
                }
                else
                {
                    c.DropItem(item);
                }

                if (Core.AOS)
                {
                    c.SetRestoreInfo(item, item.Location);
                }
            }

            if (Core.AOS)
            {
                c.RestoreEquip = pm.EquipSnapshot;
            }

            var loc = owner.Location;
            var map = owner.Map;

            if (map == null || map == Map.Internal)
            {
                loc = owner.LogoutLocation;
                map = owner.LogoutMap;
            }

            c.MoveToWorld(loc, map);

            return(c);
        }