예제 #1
0
        public static void CreateCorpses(Mobile from)
        {
            int maxCorpses = Utility.Random(1, 4);

            maxCorpses += Utility.Random(2);

            for (int i = 0; i < maxCorpses; i++)
            {
                Point3D loc = from.Location;
                loc.X += Utility.RandomMinMax(-1, 1);
                loc.Y += Utility.RandomMinMax(-1, 1);

                FakeCorpse fc = new FakeCorpse(from);
                fc.MoveToWorld(loc, Map.Felucca);
            }
        }
예제 #2
0
        public static void CreateCorpses(Mobile from)
        {
            int maxCorpses = Utility.Random(1, 4);

            maxCorpses += Utility.Random(2);

            for (int i = 0; i < maxCorpses; i++)
            {
                Point3D loc = from.Location;
                loc.X += Utility.RandomMinMax(-1, 1);
                loc.Y += Utility.RandomMinMax(-1, 1);

                FakeCorpse fc = new FakeCorpse(from);
                fc.MoveToWorld(loc, Map.Felucca);
            }
        }
예제 #3
0
            public InternalTimer(FakeCorpse c, TimeSpan delay)
                : base(delay)
			{
				m_Corpse = c;
				Priority = TimerPriority.OneSecond;
			}
예제 #4
0
        public override void Kill()
        {
            //Stop the protection timer, if we have one.
            Spells.Second.ProtectionSpell.StopTimer(this);
            //Stop the reflect timer, if we have one.
            MagicReflectSpell.StopTimer(this);

            EndAction(typeof(BasePotion));

            #region base.Kill() (used for the auto cut "lastcorpse" fix)
            if (!CanBeDamaged())
                return;
            if (!Alive || IsDeadBondedPet)
                return;
            if (Deleted)
                return;
            if (!Region.OnBeforeDeath(this))
                return;
            if (!OnBeforeDeath())
                return;

            BankBox box = FindBankNoCreate();

            if (box != null && box.Opened)
                box.Close();

            if (NetState != null)
                NetState.CancelAllTrades();

            if (Spell != null)
                Spell.OnCasterKilled();

            if (Target != null)
                Target.Cancel(this, TargetCancelType.Canceled);

            DisruptiveAction();

            Warmode = false;

            DropHolding();

            Hits = 0;
            Stam = 0;
            Mana = 0;

            Poison = null;
            Combatant = null;

            if (Paralyzed)
                Paralyzed = false;

            if (Frozen)
                Frozen = false;

            List<Item> content = new List<Item>();
            List<Item> equip = new List<Item>();
            List<Item> moveToPack = new List<Item>();

            List<Item> itemsCopy = new List<Item>(Items);

            Container pack = Backpack;

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

                if (item == pack)
                    continue;

                DeathMoveResult res = GetParentMoveResultFor(item);

                switch (res)
                {
                    case DeathMoveResult.MoveToCorpse:
                        {
                            content.Add(item);
                            equip.Add(item);
                            break;
                        }
                    case DeathMoveResult.MoveToBackpack:
                        {
                            moveToPack.Add(item);
                            break;
                        }
                }
            }

            if (pack != null)
            {
                List<Item> packCopy = new List<Item>(pack.Items);

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

                    DeathMoveResult res = GetInventoryMoveResultFor(item);

                    if (res == DeathMoveResult.MoveToCorpse)
                        content.Add(item);
                    else
                        moveToPack.Add(item);
                }

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

                    if (RetainPackLocsOnDeath && item.Parent == pack)
                        continue;

                    pack.DropItem(item);
                }
            }

            HairInfo hair = null;
            if (HairItemID != 0)
                hair = new HairInfo(HairItemID, HairHue);

            FacialHairInfo facialhair = null;
            if (FacialHairItemID != 0)
                facialhair = new FacialHairInfo(FacialHairItemID, FacialHairHue);



            #region auto cut "serial" fix
            int maxCorpses = Utility.Random(1, 4);

            maxCorpses += Utility.Random(2);

            for (int i = 0; i < maxCorpses; i++)
            {
                Point3D loc = Location;
                loc.X += Utility.RandomMinMax(-1, 1);
                loc.Y += Utility.RandomMinMax(-1, 1);

                FakeCorpse fc = new FakeCorpse(this);
                fc.MoveToWorld(loc, Map.Felucca);

                fc.Stackable = true;
                fc.Amount = 590;
                fc.Amount = Body.BodyID-2; // protocol defines that for itemid 0x2006, amount=body
                fc.Stackable = false;
            }
            #endregion

            Container c = (CreateCorpseHandler == null ? null : CreateCorpseHandler(this, hair, facialhair, content, equip));

            if (Map != null)
            {
                Packet animPacket = null;
                Packet remPacket = null;

                IPooledEnumerable eable = Map.GetClientsInRange(Location);

                foreach (NetState state in eable)
                {
                    if (state != NetState && (!state.Mobile.HasFilter || InLOS(state.Mobile)))
                    {
                        //Fix be here
                        if (animPacket == null)
                            animPacket = Packet.Acquire(new DeathAnimation(this, null));

                        state.Send(animPacket);

                        if (!state.Mobile.CanSee(this))
                        {
                            if (remPacket == null)
                                remPacket = RemovePacket;

                            state.Send(remPacket);
                        }
                    }
                }

                Packet.Release(animPacket);

                eable.Free();
            }

            Region.OnDeath(this);
            OnDeath(c);
            #endregion
        }
예제 #5
0
 public InternalTimer(FakeCorpse c, TimeSpan delay)
     : base(delay)
 {
     m_Corpse = c;
     Priority = TimerPriority.OneSecond;
 }