Beispiel #1
0
        public static Container Mobile_CreateCorpseHandler( Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> initialContent, List<Item> equipItems )
        {
            bool shouldFillCorpse = true;

            //if ( owner is BaseCreature )
            //	shouldFillCorpse = !((BaseCreature)owner).IsBonded;

            Corpse c;
            if( owner is MilitiaFighter )
                c = new MilitiaFighterCorpse( owner, hair, facialhair, shouldFillCorpse ? equipItems : new List<Item>() );
            else
                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];

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

                    if ( owner.Player && Core.AOS )
                        c.SetRestoreInfo( item, item.Location );
                }

                if ( !owner.Player )
                    c.AssignInstancedLoot();
            }
            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;
        }
Beispiel #2
0
		public static Container Mobile_CreateCorpseHandler(
			Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> initialContent, List<Item> equipItems)
		{
			var bc = owner as BaseCreature;

			bool champspawn = false;

			if (bc != null)
			{
				var region = Region.Find(owner.Location, owner.Map) as ChampionSpawnRegion;

				if (region != null)
				{
					ChampionSpawn spawn = region.Spawn;

					if (spawn != null && spawn.IsChampionSpawn(bc))
					{
						champspawn = true;
					}
				}
			}

			Corpse c;
			Corpse p = null;

			if (owner is MilitiaFighter)
			{
				c = new MilitiaFighterCorpse(owner, hair, facialhair, equipItems);
			}
			else
			{
				c = new Corpse(owner, hair, facialhair, equipItems, champspawn);
			}

			owner.Corpse = c;

			var proxyEquip = new List<Item>();

			for (int i = initialContent.Count - 1; i >= 0; i--)
			{
				Item item = initialContent[i];

				if (owner.Player)
				{
					c.DropItem(owner, item);
				}
				else
				{
					if (equipItems.Contains(item))
					{
						proxyEquip.Add(DupeProxyEquipped(item));
					}

					if (item.GetSavedFlag(0x02))
					{
						item.LootType = LootType.Blessed;
						item.SetSavedFlag(0x02, false);
					}

					if (!item.GetSavedFlag(0x01))
					{
						c.DropItem(owner, item);
					}
				}
			}

			if (proxyEquip.Count > 0)
			{
				c.Stackable = true;
				c.Amount = 508; //Original corpse is invisible
				c.Stackable = false;
				c.Hair = null;
				c.FacialHair = null;

				if (owner is MilitiaFighter)
				{
					p = new MilitiaFighterCorpse(owner, hair, facialhair, proxyEquip);
				}
				else
				{
					p = new Corpse(owner, hair, facialhair, proxyEquip);
				}

				foreach (Item t in proxyEquip)
				{
					p.DropItem(owner, t);
				}

				p.ProxyCorpse = c;
				owner.Corpse = p;
			}

			if (c.EraAOS)
			{
				var pm = owner as PlayerMobile;

				if (pm != null)
				{
					c.RestoreEquip = pm.EquipSnapshot;
				}
			}

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

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

			c.MoveToWorld(loc, map);

			if (p != null)
			{
				p.MoveToWorld(loc, map);
			}

			return p ?? c;
		}