Пример #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 = 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);
                }
            }

            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);
        }
Пример #2
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;

            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);
        }
Пример #3
0
        public static Container Mobile_CreateCorpseHandler(
            Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> initialContent, List <Item> equipItems)
        {
            var c = new Corpse(owner, hair, facialhair, equipItems);

            owner.Corpse = c;

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

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

                if (owner.Player)
                {
                    c.SetRestoreInfo(item, item.Location);
                }
            }

            if (!owner.Player)
            {
                c.AssignInstancedLoot();
                c.HasAssignedInstancedLoot = true;
            }
            else
            {
                PlayerMobile 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);

            return(c);
        }
Пример #4
0
        public void MoveCorpse(object o)
        {
            object[] ojs = (object[])o;

            Corpse c    = ojs[0] as Corpse;
            Mobile from = ojs[1] as Mobile;

            if (c != null && from != null)
            {
                c.MoveToWorld(from.Location, from.Map);
            }
        }
Пример #5
0
		public override void CheckProgress()
		{
			PlayerMobile player = System.From;
			Map map = player.Map;

			if ( ( m_Corpse == null || m_Corpse.Deleted ) && ( map == Map.Trammel || map == Map.Felucca ) && player.InRange( m_CorpseLocation, 8 ) )
			{
				m_Corpse = new HagApprenticeCorpse();
				m_Corpse.MoveToWorld( m_CorpseLocation, map );

				Effects.SendLocationEffect( m_CorpseLocation, map, 0x3728, 10, 10 );
				Effects.PlaySound( m_CorpseLocation, map, 0x1FE );

				Mobile imp = new Zeefzorpul();
				imp.MoveToWorld( m_CorpseLocation, map );

				// * You see a strange imp stealing a scrap of paper from the bloodied corpse *
				m_Corpse.SendLocalizedMessageTo( player, 1055049 );

				Timer.DelayCall( TimeSpan.FromSeconds( 3.0 ), new TimerStateCallback( DeleteImp ), imp );
			}
		}
Пример #6
0
        public static Container Mobile_CreateCorpseHandler(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> initialContent, List <Item> equipItems)
        {
            Corpse c = new Corpse(owner, hair, facialhair, equipItems);

            owner.Corpse = c;

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

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

                if (owner.IsPlayer)
                {
                    c.SetRestoreInfo(item, item.Location);
                }
            }

            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);
        }
Пример #7
0
        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);
        }
Пример #8
0
		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;
		}
Пример #9
0
        public static Container Mobile_CreateCorpseHandler(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> initialContent, List <Item> equipItems)
        {
            bool shouldFillCorpse = true;

            Corpse c = null;

            if (owner == null)
            {
                return(c);
            }

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

            if (c == null)
            {
                return(c);
            }

            owner.Corpse = c;

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

                    if (item == null)
                    {
                        continue;
                    }

                    c.DropItem(item);
                }
            }

            else
            {
                c.Carved = true;
            }

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

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

            c.MoveToWorld(loc, map);

            //Creature or Player Ocean Corpse Advanced Decay Rate
            if (!(c.Map == null || c.Map == Map.Internal))
            {
                if (c.Map.Tiles != null)
                {
                    LandTile     landTile = c.Map.Tiles.GetLandTile(c.X, c.Y);
                    StaticTile[] tiles    = c.Map.Tiles.GetStaticTiles(c.X, c.Y, true);

                    bool landHasWater   = false;
                    bool staticHasWater = false;

                    if ((landTile.ID >= 168 && landTile.ID <= 171) || (landTile.ID >= 310 && landTile.ID <= 311))
                    {
                        landHasWater = true;
                    }

                    for (int i = 0; i < tiles.Length; ++i)
                    {
                        StaticTile tile = tiles[i];

                        bool isWater = (tile.ID >= 0x1796 && tile.ID <= 0x17B2);

                        if (isWater)
                        {
                            staticHasWater = true;
                        }
                    }

                    if ((landHasWater || staticHasWater) && c.TotalItems == 0)
                    {
                        if (c.m_DecayTimer != null)
                        {
                            c.m_DecayTimer.Stop();
                        }

                        //Empty PlayerMobile is 30 Seconds Decay
                        if (c.Owner is PlayerMobile)
                        {
                            c.BeginDecay(TimeSpan.FromSeconds(30));
                        }

                        //Empty Creature is 10 Seconds Decay
                        else
                        {
                            c.BeginDecay(TimeSpan.FromSeconds(10));
                        }
                    }
                }
            }

            return(c);
        }
Пример #10
0
        public static Container Mobile_CreateCorpseHandler(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> initialContent, List<Item> equipedItems)
        {
            bool shouldFillCorpse = true;

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

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

            owner.Corpse = c;

            if ( shouldFillCorpse )
            {
                for ( int i = 0; i < initialContent.Count; ++i )
                {
                    Item 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 );
                }
            }
            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;
        }
Пример #11
0
        public static Container Mobile_CreateCorpseHandler( Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> initialContent, List<Item> equipItems )
        {
            Corpse c = new Corpse( owner, hair, facialhair, equipItems );
            owner.Corpse = c;

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

                if ( owner.IsPlayer && item.Parent == owner.Backpack )
                    c.AddItem( item );
                else
                    c.DropItem( item );

                if ( owner.IsPlayer )
                    c.SetRestoreInfo( item, item.Location );
            }

            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;
        }
Пример #12
0
        public void TryEndSummon(Mobile m, List <Corpse> corpses)
        {
            if (_Timers.ContainsKey(m))
            {
                _Timers.Remove(m);
            }

            if (corpses == null || corpses.Count == 0)
            {
                m.SendLocalizedMessage(1071511); // The staff glows slightly, then fades. Its magic is unable to locate a corpse of yours to recover.
                return;
            }

            bool tooFar         = false;
            bool notEnoughTime  = false;
            bool tooManySummons = false;
            bool success        = true;

            if (_SummonAll)
            {
                List <Corpse> copy = new List <Corpse>(corpses);

                for (var index = 0; index < copy.Count; index++)
                {
                    Corpse c = copy[index];

                    bool remove = false;

                    if (c.Map != m.Map)
                    {
                        remove = true;
                        tooFar = true;
                    }

                    if (c.Killer is PlayerMobile && c.Killer != m && c.TimeOfDeath + TimeSpan.FromSeconds(180) > DateTime.UtcNow)
                    {
                        remove        = true;
                        notEnoughTime = true;
                    }

                    if (Corpse.PlayerCorpses != null && Corpse.PlayerCorpses.ContainsKey(c) && Corpse.PlayerCorpses[c] >= 3)
                    {
                        remove         = true;
                        tooManySummons = true;
                    }

                    if (remove)
                    {
                        corpses.Remove(c);
                    }
                }

                if (corpses.Count == 0)
                {
                    success = false;
                }
            }
            else
            {
                Corpse c = corpses[0];

                if (c.Map != m.Map)
                {
                    tooFar = true;
                }

                if (c.Killer is PlayerMobile && c.Killer != m && c.TimeOfDeath + TimeSpan.FromSeconds(180) > DateTime.UtcNow)
                {
                    notEnoughTime = true;
                }

                if (Corpse.PlayerCorpses != null && Corpse.PlayerCorpses.ContainsKey(c) && Corpse.PlayerCorpses[c] >= 3)
                {
                    tooManySummons = true;
                }

                if (tooFar || notEnoughTime || tooManySummons)
                {
                    if (tooFar)
                    {
                        m.SendLocalizedMessage(1071512); // ...but the corpse is too far away!
                    }
                    else if (notEnoughTime)
                    {
                        m.SendLocalizedMessage(1071515); // ...but not enough time has passed since you were slain in battle!
                    }
                    else
                    {
                        m.SendLocalizedMessage(1071517); // ...but the corpse has already been summoned too many times!
                    }
                    success = false;
                }
            }

            if (success)
            {
                m.PlaySound(0xFA);

                for (var index = 0; index < corpses.Count; index++)
                {
                    Corpse c = corpses[index];

                    c.MoveToWorld(m.Location, m.Map);

                    if (Corpse.PlayerCorpses != null && Corpse.PlayerCorpses.ContainsKey(c))
                    {
                        Corpse.PlayerCorpses[c]++;
                    }
                }

                if (_SummonAll)
                {
                    m.SendLocalizedMessage(1071530, corpses.Count.ToString()); // ...and succeeds in summoning ~1_COUNT~ of them!

                    if (tooFar)
                    {
                        m.SendLocalizedMessage(1071513); // ...but one of them is too far away!
                    }
                    else if (notEnoughTime)
                    {
                        m.SendLocalizedMessage(1071516); // ...but one of them deflects the magic because of the stain of war!
                    }
                    else if (tooManySummons)
                    {
                        m.SendLocalizedMessage(1071519); // ...but one of them has already been summoned too many times!
                    }
                }
                else
                {
                    m.SendLocalizedMessage(1071529); // ...and succeeds in the summoning of it!
                }
                if (Charges <= 0)
                {
                    m.SendLocalizedMessage(1071509); // The staff has been reduced to pieces!
                    Delete();
                }
                else
                {
                    Charges--;
                }
            }
        }