private void OnDeferredLoot(CreatureDeathEventArgs e)
        {
            if (e.Corpse == null || e.Corpse.Deleted || e.ClearCorpse || e.Corpse.Items.IsNullOrEmpty())
            {
                return;
            }

            var dead = e.Creature as BaseCreature;

            if (dead == null)
            {
                return;
            }

            var decay = LootTimeout;

            e.Corpse.Items.ForEachReverse(
                i =>
            {
                if (i != null && !i.Deleted && !Loot.Exists(o => o.Item == i) && ShouldRoll(dead, i))
                {
                    Loot.Add(new DungeonLootEntry(this, i, decay, ActiveGroup));
                }
            });
        }
Example #2
0
        private static void CreatureDeath_Record(CreatureDeathEventArgs e)
        {
            string Location_Data = e.Creature.Map + "*" + e.Creature.Location.X + "*" + e.Creature.Location.Y;

            if (!CreatureDeaths_Locations.Contains(Location_Data))
            {
                CreatureDeaths_Locations.Add(Location_Data);
            }
        }
Example #3
0
        public static void EventSink_CreatureDeath(CreatureDeathEventArgs e)
        {
            var killed = e.Creature;

            foreach (var m in killed.Aggressed.Select(x => x.Defender))
            {
                CheckCombat(m);
            }

            foreach (var m in killed.Aggressors.Select(x => x.Attacker))
            {
                CheckCombat(m);
            }
        }
Example #4
0
        public static void CreatureDeath(CreatureDeathEventArgs e)
        {
            BaseCreature bc     = e.Creature as BaseCreature;
            Mobile       killer = e.Killer;

            if (bc != null && bc.IsSoulBound && killer is PlayerMobile && killer.Backpack != null)
            {
                EtherealSoulbinder es = killer.Backpack.FindItemsByType <EtherealSoulbinder>().Where(x => x.SoulPoint < x.MaxSoulPoint).FirstOrDefault();

                if (es != null)
                {
                    es.SoulPoint += bc.HitsMax / 1000;
                }
            }
        }
Example #5
0
        public static void OnCreatureDeath(CreatureDeathEventArgs e)
        {
            BaseCreature bc = e.Creature as BaseCreature;
            Container    c  = e.Corpse;

            if (bc != null && c != null && !c.Deleted && !bc.Controlled && !bc.Summoned)
            {
                CheckDrop(bc, c);
            }

            if (e.Killer is BaseVoidCreature)
            {
                ((BaseVoidCreature)e.Killer).Mutate(VoidEvolution.Killing);
            }
        }
        public virtual void HandleCreatureDeath(CreatureDeathEventArgs e)
        {
            if (!CheckCreatureDeath(e))
            {
                return;
            }

            var dead = e.Creature as BaseCreature;

            if (dead == null)
            {
                return;
            }

            OnCreatureDeath(dead, e.Corpse, e.ForcedLoot);

            var gold = ConsumeGold(e.ForcedLoot);

            if (e.Corpse != null && !e.Corpse.Deleted)
            {
                gold += ConsumeGold(e.Corpse.Items);
            }

            if (gold > 0)
            {
                gold -= GiveGold(ActiveGroup, gold);

                while (gold > 0)
                {
                    var g = GenerateGold(e.ForcedLoot, (int)Math.Min(Int32.MaxValue, gold));

                    if (g > 0)
                    {
                        gold -= g;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (ActiveGroup.Count > 1 && LootMode == DungeonLootMode.Advanced)
            {
                Timer.DelayCall(OnDeferredLoot, e);
            }
        }
		public static void OnDeath(CreatureDeathEventArgs e)
		{
			if (!Enabled)
			{
				return;
			}

			var c = e.Creature as BaseCreature;

			if (c == null)
			{
				return;
			}

			Type type = c.GetType();

			if (!BroadcastTypes.Any(type.IsEqualOrChildOf))
			{
				return;
			}

			string[] team =
				c.DamageEntries.Not(de => de.DamageGiven <= 0 || de.HasExpired)
				 .Where(de => de.Damager is PlayerMobile && !String.IsNullOrWhiteSpace(de.Damager.RawName))
				 .OrderByDescending(de => de.DamageGiven)
				 .Select(de => de.Damager.RawName.WrapUOHtmlColor(de.Damager.GetNotorietyColor()))
				 .ToArray();

			if (team.Length <= 0)
			{
				return;
			}

			string text = String.Format(
				"{0} minutes ago, {1} was slain by {2}!",
				(int)AnnounceDelay.TotalMinutes,
				c.RawName.ToUpperWords().WrapUOHtmlColor(c.GetNotorietyColor()),
				String.Join(", ", team));

			Timer.DelayCall(
				AnnounceDelay,
				() =>
				NetState.Instances.Where(ns => ns != null && ns.Mobile is PlayerMobile)
						.ForEach(ns => ns.Mobile.SendNotification<CreatureDeathNotifyGump>(text, true, 1.0, 30.0)));
		}
        public static void OnDeath(CreatureDeathEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            var c = e.Creature as BaseCreature;

            if (c == null)
            {
                return;
            }

            Type type = c.GetType();

            if (!BroadcastTypes.Any(type.IsEqualOrChildOf))
            {
                return;
            }

            string[] team =
                c.DamageEntries.Not(de => de.DamageGiven <= 0 || de.HasExpired)
                .Where(de => de.Damager is PlayerMobile && !String.IsNullOrWhiteSpace(de.Damager.RawName))
                .OrderByDescending(de => de.DamageGiven)
                .Select(de => de.Damager.RawName.WrapUOHtmlColor(de.Damager.GetNotorietyColor()))
                .ToArray();

            if (team.Length <= 0)
            {
                return;
            }

            string text = String.Format(
                "{0} minutes ago, {1} was slain by {2}!",
                (int)AnnounceDelay.TotalMinutes,
                c.RawName.ToUpperWords().WrapUOHtmlColor(c.GetNotorietyColor()),
                String.Join(", ", team));

            Timer.DelayCall(
                AnnounceDelay,
                () =>
                NetState.Instances.Where(ns => ns != null && ns.Mobile is PlayerMobile)
                .ForEach(ns => ns.Mobile.SendNotification <CreatureDeathNotifyGump>(text, true, 1.0, 30.0)));
        }
Example #9
0
        private static void HandleCreatureDeath(CreatureDeathEventArgs e)
        {
            var d = GetDungeon(e.Creature);

            if (d == null && e.Corpse != null)
            {
                var z = e.Corpse.GetRegion <DungeonZone>();

                if (z != null)
                {
                    d = z.Dungeon;
                }
            }

            if (d != null)
            {
                d.HandleCreatureDeath(e);
            }
        }
Example #10
0
        public static void OnCreatureDeath(CreatureDeathEventArgs e)
        {
            var killed = e.Creature as BaseCreature;

            if (killed != null && Beacons != null && Beacons.Any(b => b.Spawn != null && b.Spawn.ContainsKey(killed)))
            {
                double chance = killed is PirateCrew ? 0.15 : 0.025;

                if (chance >= Utility.RandomDouble())
                {
                    var m = killed.RandomPlayerWithLootingRights();

                    if (m != null)
                    {
                        m.AddToBackpack(new MaritimeCargo());
                        m.SendLocalizedMessage(1158907); // You recover maritime trade cargo!
                    }
                }
            }
        }
Example #11
0
        public static void EventSink_CreatureDeath(CreatureDeathEventArgs e)
        {
            Mobile killed = e.Creature;

            for (var index = 0; index < killed.Aggressed.Count; index++)
            {
                var x = killed.Aggressed[index];

                Mobile m = x.Defender;
                CheckCombat(m);
            }

            for (var index = 0; index < killed.Aggressors.Count; index++)
            {
                var x = killed.Aggressors[index];

                Mobile m = x.Attacker;
                CheckCombat(m);
            }
        }
Example #12
0
        public static void CreatureDeath(CreatureDeathEventArgs e)
        {
            Mobile killer = e.Killer;

            if (killer is BaseCreature kbc && kbc.Controlled && kbc.ControlMaster != null)
            {
                killer = kbc.ControlMaster;
            }

            if (e.Creature is BaseCreature bc && bc.IsSoulBound && killer is PlayerMobile && killer.Backpack != null)
            {
                EtherealSoulbinder es = killer.Backpack.FindItemsByType <EtherealSoulbinder>().OrderByDescending(x => x.SoulPoint < x.MaxSoulPoint).First();

                if (es != null)
                {
                    var hm     = bc.HitsMax;
                    var scaler = hm > 1000 ? 1000 : 100;

                    es.SoulPoint += (double)(hm / scaler) * PotionOfGloriousFortune.GetBonus(killer, PotionEventType.Soulbinder);
                }
            }
        }
Example #13
0
        public static void CreatureDeath(CreatureDeathEventArgs e)
        {
            Mobile killer = e.Killer;

            if (e.Creature is BaseCreature bc && bc.IsSoulBound && killer is PlayerMobile && killer.Backpack != null)
            {
                EtherealSoulbinder es = killer.Backpack.FindItemsByType <EtherealSoulbinder>().Where(x => x.SoulPoint < x.MaxSoulPoint).FirstOrDefault();

                if (es != null)
                {
                    var hm = bc.HitsMax;

                    if (hm > 1000)
                    {
                        es.SoulPoint += (double)hm / 1000;
                    }
                    else
                    {
                        es.SoulPoint += (double)hm / 100;
                    }
                }
            }
        }
        public static void OnCreatureDeath(CreatureDeathEventArgs e)
        {
            var killed = e.Creature as BaseCreature;

            bool any = false;

            if (Beacons != null)
            {
                for (var index = 0; index < Beacons.Count; index++)
                {
                    var b = Beacons[index];

                    if (b.Spawn != null && b.Spawn.ContainsKey(killed))
                    {
                        any = true;
                        break;
                    }
                }
            }

            if (killed != null && Beacons != null && any)
            {
                double chance = killed is PirateCrew ? 0.15 : 0.025;

                if (chance >= Utility.RandomDouble())
                {
                    var m = killed.RandomPlayerWithLootingRights();

                    if (m != null)
                    {
                        m.AddToBackpack(new MaritimeCargo());
                        m.SendLocalizedMessage(1158907); // You recover maritime trade cargo!
                    }
                }
            }
        }
        public virtual bool CheckCreatureDeath(CreatureDeathEventArgs e)
        {
            e.PreventDelete = true;

            return(true);
        }