Exemplo n.º 1
0
		/// <summary>
		/// Constructs new EnemyHealedEventArgs
		/// </summary>
		/// <param name="enemy">The healed enemy</param>
		/// <param name="healSource">The heal source</param>
		/// <param name="changeType">The health change type</param>
		/// <param name="healAmount">The heal amount</param>
		public EnemyHealedEventArgs(GameLiving enemy, GameObject healSource, GameLiving.eHealthChangeType changeType, int healAmount)
		{
			m_enemy = enemy;
			m_healSource = healSource;
			m_changeType = changeType;
			m_healAmount = healAmount;
		}
Exemplo n.º 2
0
 /// <summary>
 /// Constructs a new region action
 /// </summary>
 /// <param name="actionSource">The action source</param>
 public RegionAction(GameObject actionSource)
     : base(actionSource.CurrentRegion.TimeManager)
 {
     if (actionSource == null)
         throw new ArgumentNullException("actionSource");
     m_actionSource = actionSource;
 }
Exemplo n.º 3
0
        public override System.Collections.IList SelectTargets(GameObject castTarget)
        {
            ArrayList list = new ArrayList();
            GameLiving target = castTarget as GameLiving;

            if (Caster is GamePlayer)
            {
                GamePlayer casterPlayer = (GamePlayer)Caster;
                Group group = casterPlayer.Group;
                if(group == null) return list; // Should not appen since it is checked in ability handler
                int spellRange = CalculateSpellRange();
                if (group != null)
                {
                    lock (group)
                    {
                        foreach (GamePlayer groupPlayer in casterPlayer.GetPlayersInRadius((ushort)m_spell.Radius))
                        {
                            if (casterPlayer.Group.IsInTheGroup(groupPlayer))
                            {
                                if (groupPlayer != casterPlayer && groupPlayer.IsAlive)
                                {
                                    list.Add(groupPlayer);
                                    IControlledBrain npc = groupPlayer.ControlledBrain;
                                    if (npc != null)
                                        if (casterPlayer.IsWithinRadius( npc.Body, spellRange ))
                                            list.Add(npc.Body);
                                }
                            }
                        }
                    }
                }
            }
            return list;
        }    	    	
 /// <summary>
 /// Constructs new TakeDamageEventArgs
 /// </summary>
 /// <param name="damageSource">The damage source</param>
 /// <param name="damageType">The damage type</param>
 /// <param name="damageAmount">The damage amount</param>
 /// <param name="criticalAmount">The critical damage amount</param>
 public TakeDamageEventArgs(GameObject damageSource, eDamageType damageType, int damageAmount, int criticalAmount)
 {
     m_damageSource = damageSource;
     m_damageType = damageType;
     m_damageAmount = damageAmount;
     m_criticalAmount = criticalAmount;
 }
Exemplo n.º 5
0
        public override IList<GameLiving> SelectTargets(GameObject castTarget)
        {
            var list = new List<GameLiving>(8);
            GameLiving target = castTarget as GameLiving;

            if (target == null || Spell.Range == 0)
                target = Caster;

            foreach (GamePlayer player in target.GetPlayersInRadius(false, (ushort)Spell.Radius))
            {
                if (GameServer.ServerRules.IsAllowedToAttack(Caster, player, true))
                {
                    list.Add(player);
                }
            }
            foreach (GameNPC npc in target.GetNPCsInRadius(false, (ushort)Spell.Radius))
            {
                if (GameServer.ServerRules.IsAllowedToAttack(Caster, npc, true))
                {
                    list.Add(npc);
                }
            }

            return list;
        }
Exemplo n.º 6
0
		/// <summary>
		/// Constructs a new Money bag with a value and the position of the dropper
		/// It will disappear after 2 minutes
		/// </summary>
		/// <param name="copperValue">the coppervalue of this bag</param>
		/// <param name="dropper">the gameobject that dropped this bag</param>
		public GameMoney(long copperValue, GameObject dropper):this(copperValue)
		{
			X=dropper.X;
			Y=dropper.Y;
			Z=dropper.Z;
			Heading = dropper.Heading;
			CurrentRegion = dropper.CurrentRegion;
		}
		/// <summary>
		/// Invoked on Player death and deals out
		/// experience/realm points if needed
		/// </summary>
		/// <param name="killedPlayer">player that died</param>
		/// <param name="killer">killer</param>
		public override void OnPlayerKilled(GamePlayer killedPlayer, GameObject killer)
		{
			base.OnPlayerKilled(killedPlayer, killer);
			if (killer == null || killer is GamePlayer)
				killedPlayer.TempProperties.setProperty(KILLED_BY_PLAYER_PROP, KILLED_BY_PLAYER_PROP);
			else
				killedPlayer.TempProperties.removeProperty(KILLED_BY_PLAYER_PROP);
		}
Exemplo n.º 8
0
 /// <summary>
 /// Broadcasts a message to players within saydistance from this object
 /// </summary>
 /// <param name="obj">The object that says the message</param>
 /// <param name="msg">The message that the object says</param>
 /// <param name="chattype">The chattype of the message</param>
 /// <param name="IsSaying">Is this object saying the message if false the message will drop the 'objname says' part</param>
 public static void BroadcastMsg(GameObject obj, string msg, eChatType chattype, bool IsSaying)
 {
     foreach (GamePlayer bPlayer in obj.GetPlayersInRadius((ushort)WorldMgr.SAY_DISTANCE))
     {
         if (IsSaying) { bPlayer.Out.SendMessage(obj.Name + " says \"" + msg + "\"", chattype, eChatLoc.CL_ChatWindow); }
         else { bPlayer.Out.SendMessage(msg, chattype, eChatLoc.CL_ChatWindow); }
     }
     return;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Broadcasts a message to players within (whatever) distance from this object
 /// </summary>
 /// <param name="obj">The object that says the message</param>
 /// <param name="msg">The message that the object says</param>
 /// <param name="distance">The distance which the message is heard</param>
 /// <param name="IsSaying">Is this object saying the message if false the message will drop the 'npcname says' part</param>
 public static void BroadcastMsg(GameObject obj, string msg, int distance, bool IsSaying)
 {
     foreach (GamePlayer bPlayer in obj.GetPlayersInRadius((ushort)distance))
     {
         if (IsSaying) { bPlayer.Out.SendMessage(obj.Name + " says \"" + msg + "\"", eChatType.CT_Broadcast, eChatLoc.CL_ChatWindow); }
         else { bPlayer.Out.SendMessage(msg, eChatType.CT_Broadcast, eChatLoc.CL_ChatWindow); }
     }
     return;
 }
Exemplo n.º 10
0
 public override IList SelectTargets(GameObject castTarget)
 {
     ArrayList list = new ArrayList();
     GameLiving target = Caster;
     foreach (GameNPC npc in target.GetNPCsInRadius((ushort)Spell.Radius))
     {
         if (npc is GameNPC && npc.Brain is ControlledNpcBrain)//!(npc is NecromancerPet))
             list.Add(npc);
     }
     return list;
 }
Exemplo n.º 11
0
		/// <summary>
		/// This methode is override to remove XP system
		/// </summary>
		/// <param name="source">the damage source</param>
		/// <param name="damageType">the damage type</param>
		/// <param name="damageAmount">the amount of damage</param>
		/// <param name="criticalAmount">the amount of critical damage</param>
		public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount)
		{
			//Work around the XP system
			if (IsAlive)
			{
				Health -= (damageAmount + criticalAmount);
				if (!IsAlive)
				{
					Health = 0;
					Die(source);
				}
			}
		}
Exemplo n.º 12
0
		/// <summary>
		/// Direct the subpets to attack too
		/// </summary>
		/// <param name="target">The target to attack</param>
		public override void Attack(GameObject target)
		{
			base.Attack(target);
			//Check for any abilities
			CheckAbilities();
			if (Body.ControlledNpcList != null)
			{
				lock (Body.ControlledNpcList)
				{
					foreach (BDPetBrain icb in Body.ControlledNpcList)
						if (icb != null)
							icb.Attack(target);
				}
			}
		}
Exemplo n.º 13
0
        public override void StartAttack(GameObject target)
        {
            base.StartAttack(target);

            if (!TempProperties.getProperty<bool>(ALREADY_GOT_HELP))
            {
                foreach (GameNPC npc in GetNPCsInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    //on initial attack, all fireborn in range add!
                    if (npc.Name == "minotaur fireborn")
                    npc.StartAttack(target);
                }

                TempProperties.setProperty(ALREADY_GOT_HELP, true);
            }
        }
Exemplo n.º 14
0
        public void Attack(GameObject target)
        {
            foreach (Spell spell in Body.HarmfulSpells)
            {
                if (target.IsAttackable && !target.HasEffect(spell))
                {
                    Body.StopMoving();
                    Body.TargetObject = target;
                    Body.TurnTo(target);
                    Body.CastSpell(spell, SpellLine);
                    return;
                }
            }

            Body.Notify(GameLivingEvent.CastFailed, Body);
        }
Exemplo n.º 15
0
        public override void StartAttack(GameObject attackTarget)
        {
            base.StartAttack(attackTarget);

            foreach (GamePlayer player in GetPlayersInRadius(WorldMgr.SAY_DISTANCE))
            {
                if (player != null)
                    switch (Realm)
                    {
                        case eRealm.Albion:
                            player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameGuard.Albion.StartAttackSay"), eChatType.CT_System, eChatLoc.CL_SystemWindow); break;
                        case eRealm.Midgard:
                            player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameGuard.Midgard.StartAttackSay"), eChatType.CT_System, eChatLoc.CL_SystemWindow); break;
                        case eRealm.Hibernia:
                            player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameGuard.Hibernia.StartAttackSay"), eChatType.CT_System, eChatLoc.CL_SystemWindow); break;
                    }
            }
        }
Exemplo n.º 16
0
        public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount)
        {
            //Check if this encounter mob is tethered and if so, ignore any damage done both outside of or too far from it's tether range.
            if (this.TetherRange > 100)
            {
                // if controlled NPC - do checks for owner instead
                if (source is GameNPC)
                {
                    IControlledBrain controlled = ((GameNPC)source).Brain as IControlledBrain;
                    if (controlled != null)
                    {
                        source = controlled.GetPlayerOwner();
                    }
                }

                if (IsOutOfTetherRange)
                {
                    if (source is GamePlayer)
                    {
                        GamePlayer player = source as GamePlayer;
                        player.Out.SendMessage("The " + this.Name + " is too far from its encounter area, your damage fails to have an effect on it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow);
                        return;
                    }
                    return;
                }
                else
                {
                    if (IsWithinRadius(source, this.TetherRange))
                    {
                        base.TakeDamage(source, damageType, damageAmount, criticalAmount);
                        return;
                    }
                    if (source is GamePlayer)
                    {
                        GamePlayer player = source as GamePlayer;
                        player.Out.SendMessage("You are too far from the " + this.Name + ", your damage fails to effect it!", eChatType.CT_Important, eChatLoc.CL_ChatWindow);
                    }
                    return;
                }
            }
            else
                base.TakeDamage(source, damageType, damageAmount, criticalAmount);
        }
Exemplo n.º 17
0
		/// <summary>
        /// Generate loot for given mob
		/// </summary>
		/// <param name="mob"></param>
		/// <param name="killer"></param>
		/// <returns></returns>
		public override LootList GenerateLoot(GameNPC mob, GameObject killer)
		{
			LootList loot = base.GenerateLoot(mob, killer);

			int lvl = mob.Level + 1;
			if (lvl < 1) lvl = 1;
			int minLoot = 2 + ((lvl * lvl * lvl) >> 3);

			long moneyCount = minLoot + Util.Random(minLoot >> 1);
			moneyCount = (long)((double)moneyCount * ServerProperties.Properties.MONEY_DROP);

			ItemTemplate money = new ItemTemplate();
			money.Model = 488;
			money.Name = "bag of coins";
			money.Level = 0;

			money.Price = moneyCount;
			
			loot.AddFixed(money, 1);
			return loot;
		}
Exemplo n.º 18
0
		public override void Attack(GameObject target)
		{
			GameLiving defender = target as GameLiving;
			if(defender == null)
			{
				return;
			}

			if(!GameServer.ServerRules.IsAllowedToAttack(Body, defender, true))
			{
				return;
			}

			if(AggressionState == eAggressionState.Passive)
			{
				AggressionState = eAggressionState.Defensive;
				UpdatePetWindow();
			}
			m_orderAttackTarget = defender;
			AttackMostWanted();
			Body.StartAttack(m_orderAttackTarget);
			return;
		}
Exemplo n.º 19
0
		public override void StartAttack(GameObject attackTarget)
		{
			if (attackTarget == null)
				return;

			if (attackTarget is GameLiving && GameServer.ServerRules.IsAllowedToAttack(this, (GameLiving)attackTarget, true) == false)
				return;

			if (Brain is IControlledBrain)
			{
				if ((Brain as IControlledBrain).AggressionState == eAggressionState.Passive)
					return;
				GamePlayer playerowner;
				if ((playerowner = ((IControlledBrain)Brain).GetPlayerOwner()) != null)
					playerowner.Stealth(false);
			}

			TargetObject = attackTarget;
			if (TargetObject.Realm == 0 || Realm == 0)
				m_lastAttackTickPvE = m_CurrentRegion.Time;
			else
				m_lastAttackTickPvP = m_CurrentRegion.Time;

			if (m_attackers.Count == 0)
			{
				if (SpellTimer == null)
					SpellTimer = new SpellAction(this);
				if (!SpellTimer.IsAlive)
					SpellTimer.Start(1);
			}

			if (Brain is TurretMainPetTankBrain)
			{
				base.StartAttack(TargetObject);
			}
		}
Exemplo n.º 20
0
		/// <summary>
		/// Sends a message to the chat window of players inside
		/// a specific distance of the center object
		/// </summary>
		/// <param name="centerObject">The center object of the message</param>
		/// <param name="message">The message to send</param>
		/// <param name="chatType">The type of message to send</param>
		/// <param name="distance">The distance around the center where players will receive the message</param>
		/// <param name="excludes">An optional list of excluded players</param>
		/// <remarks>If the center object is a player, he will get the message too</remarks>
		public static void ChatToArea(GameObject centerObject, string message, eChatType chatType, ushort distance, params GameObject[] excludes)
		{
			MessageToArea(centerObject, message, chatType, eChatLoc.CL_ChatWindow, distance, excludes);
		}
Exemplo n.º 21
0
 /// <summary>
 /// Constructs a new DespawnTimer.
 /// </summary>
 /// <param name="timerOwner">The owner of this timer.</param>
 /// <param name="npc">The GameNPC to despawn when the time is up.</param>
 /// <param name="delay">The time after which the add is supposed to despawn.</param>
 public DespawnTimer(GameObject timerOwner, GameNPC npc, int delay)
     : base(timerOwner.CurrentRegion.TimeManager)
 {
     m_npc = npc;
     Start(delay);
 }
Exemplo n.º 22
0
        /// <summary>
        /// Post a message in the server news and award a dragon kill point for
        /// every XP gainer in the raid.
        /// </summary>
        /// <param name="killer">The living that got the killing blow.</param>
        protected void ReportNews(GameObject killer)
        {
            int numPlayers = AwardDragonKillPoint();
            String message = String.Format("{0} has been slain by a force of {1} warriors!", Name, numPlayers);
            NewsMgr.CreateNews(message, killer.Realm, eNewsType.PvE, true);

            if (Properties.GUILD_MERIT_ON_DRAGON_KILL > 0)
            {
                foreach (GamePlayer player in GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    if (player.IsEligibleToGiveMeritPoints)
                    {
                        GuildEventHandler.MeritForNPCKilled(player, this, Properties.GUILD_MERIT_ON_DRAGON_KILL);
                    }
                }
            }
        }
Exemplo n.º 23
0
 /// <summary>
 /// Take action upon someone healing the enemy.
 /// </summary>
 /// <param name="enemy">The living that was healed.</param>
 /// <param name="healSource">The source of the heal.</param>
 /// <param name="changeType">The way the living was healed.</param>
 /// <param name="healAmount">The amount that was healed.</param>
 public override void EnemyHealed(GameLiving enemy, GameObject healSource, eHealthChangeType changeType, int healAmount)
 {
     base.EnemyHealed(enemy, healSource, changeType, healAmount);
     Brain.Notify(GameLivingEvent.EnemyHealed, this,
         new EnemyHealedEventArgs(enemy, healSource, changeType, healAmount));
 }
Exemplo n.º 24
0
 /// <summary>
 /// Take some amount of damage inflicted by another GameObject.
 /// </summary>
 /// <param name="source">The object inflicting the damage.</param>
 /// <param name="damageType">The type of damage.</param>
 /// <param name="damageAmount">The amount of damage inflicted.</param>
 /// <param name="criticalAmount">The critical amount of damage inflicted</param>
 public override void TakeDamage(GameObject source, eDamageType damageType, int damageAmount, int criticalAmount)
 {
     m_healthPercentOld = HealthPercent;
     base.TakeDamage(source, damageType, damageAmount, criticalAmount);
     Brain.Notify(GameObjectEvent.TakeDamage, this,
         new TakeDamageEventArgs(source, damageType, damageAmount, criticalAmount));
 }
Exemplo n.º 25
0
        /// <summary>
        /// Invoked when the dragon dies.
        /// </summary>
        /// <param name="killer">The living that got the killing blow.</param>
        public override void Die(GameObject killer)
        {
            // debug
            if (killer == null)
                log.Error("Dragon Killed: killer is null!");
            else
                log.Debug("Dragon Killed: killer is " + killer.Name + ", attackers:");

            bool canReportNews = true;

            // due to issues with attackers the following code will send a notify to all in area in order to force quest credit
            foreach (GamePlayer player in GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Notify(GameLivingEvent.EnemyKilled, killer, new EnemyKilledEventArgs(this));

                if (canReportNews && GameServer.ServerRules.CanGenerateNews(player) == false)
                {
                    if (player.Client.Account.PrivLevel == (int)ePrivLevel.Player)
                        canReportNews = false;
                }
            }

            base.Die(killer);

            foreach (String message in m_deathAnnounce)
            {
                BroadcastMessage(String.Format(message, Name));
            }

            if (canReportNews)
            {
                ReportNews(killer);
            }
        }
Exemplo n.º 26
0
		/// <summary>
		/// Sends a message to the system window of players inside
		/// INFO_DISTANCE radius of the center object
		/// </summary>
		/// <param name="centerObject">The center object of the message</param>
		/// <param name="message">The message to send</param>
		/// <param name="chatType">The type of message to send</param>
		/// <remarks>If the centerObject is a player, he won't receive the message</remarks>
		public static void SystemToOthers(GameObject centerObject, string message, eChatType chatType)
		{
			SystemToArea(centerObject, message, chatType, WorldMgr.INFO_DISTANCE, centerObject);
		}
Exemplo n.º 27
0
		/// <summary>
		/// Sends a message to the system window of players inside
		/// INFO_DISTANCE radius of the center object
		/// </summary>
		/// <param name="centerObject">The center object of the message</param>
		/// <param name="message">The message to send</param>
		/// <param name="chatType">The type of message to send</param>
		/// <param name="excludes">An optional list of excluded players</param>
		public static void SystemToArea(GameObject centerObject, string message, eChatType chatType, params GameObject[] excludes)
		{
			SystemToArea(centerObject, message, chatType, WorldMgr.INFO_DISTANCE, excludes);
		}
Exemplo n.º 28
0
		/// <summary>
		/// Sends a text message to players within a specific radius of another object
		/// </summary>
		/// <param name="centerObject">The center object</param>
		/// <param name="message">The message to send</param>
		/// <param name="chatType">The chat typ</param>
		/// <param name="chatLoc">The chat location</param>
		/// <param name="distance">The distance</param>
		/// <param name="excludes">A list of GameObjects to exlude from the message</param>
		public static void MessageToArea(GameObject centerObject, string message, eChatType chatType, eChatLoc chatLoc, ushort distance, params GameObject[] excludes)
		{
			if (message == null || message.Length <= 0) return;
			bool excluded;
			foreach(GamePlayer player in centerObject.GetPlayersInRadius(distance))
			{
				excluded = false;
				if(excludes!=null)
				{
					foreach(GameObject obj in excludes)
						if(obj == player)
						{
							excluded = true;
							break;
						}
				}
				if (!excluded)
				{
					player.MessageFromArea(centerObject, message, chatType, chatLoc);
				}
			}
		}
Exemplo n.º 29
0
		/// <summary>
		/// Sends a message to the system window of players inside
		/// INFO_DISTANCE radius of the center object
		/// </summary>
		/// <param name="centerObject">The center object of the message</param>
		/// <param name="chatType">The type of message to send</param>
		/// <param name="LanguageMessageID">The language message ID</param>
		/// <param name="args">The Translation args</param>
		/// <remarks>If the centerObject is a player, he won't receive the message</remarks>
		public static void SystemToOthers2(GameObject centerObject, eChatType chatType, string LanguageMessageID, params object[] args)
		{
			if (LanguageMessageID == null || LanguageMessageID.Length <= 0) return;
			foreach (GamePlayer player in centerObject.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
			{
				if (!(centerObject is GamePlayer && centerObject == player))
				{
					player.MessageFromArea(centerObject, LanguageMgr.GetTranslation(player.Client.Account.Language, LanguageMessageID, args), chatType, eChatLoc.CL_SystemWindow);
				}
			}
		}
Exemplo n.º 30
0
		public override LootList GenerateLoot(GameNPC mob, GameObject killer)
		{
			LootList loot = base.GenerateLoot(mob, killer);

			try
			{
				GamePlayer player = null;

				if (killer is GamePlayer)
				{
					player = killer as GamePlayer;
				}
				else if (killer is GameNPC && (killer as GameNPC).Brain is IControlledBrain)
				{
					player = ((killer as GameNPC).Brain as ControlledNpcBrain).GetPlayerOwner();
				}

				// allow the leader to decide the loot realm
				if (player != null && player.Group != null)
				{
					player = player.Group.Leader;
				}

				if (player != null)
				{
					List<MobXLootTemplate> killedMobXLootTemplates = null;
					
					// Graveen: we first privilegiate the loottemplate named 'templateid' if it exists	
					if (mob.NPCTemplate != null && m_mobXLootTemplates.ContainsKey(mob.NPCTemplate.TemplateId.ToString()))
					{
						killedMobXLootTemplates = m_mobXLootTemplates[mob.NPCTemplate.TemplateId.ToString()];
					}
					// else we are choosing the loottemplate named 'mob name'
					// this is easily allowing us to affect different level choosen loots to different level choosen mobs
					// with identical names
					else if (m_mobXLootTemplates.ContainsKey(mob.Name.ToLower()))
					{
						killedMobXLootTemplates = m_mobXLootTemplates[mob.Name.ToLower()];
					}

					// MobXLootTemplate contains a loot template name and the max number of drops allowed for that template.
					// We don't need an entry in MobXLootTemplate in order to drop loot, only to control the max number of drops.

					// LootTemplate contains a template name and an itemtemplateid (id_nb).
					// TemplateName usually equals Mob name, so if you want to know what drops for a mob:
					// select * from LootTemplate where templatename = 'mob name';
					// It is possible to have TemplateName != MobName but this works only if there is an entry in MobXLootTemplate for the MobName.

					if (killedMobXLootTemplates == null)
					{
						// If there is no MobXLootTemplate entry then every item in this mobs LootTemplate can drop.
						// In addition, we can use LootTemplate.Count to determine how many of a fixed (100% chance) item can drop
						if (m_lootTemplates.ContainsKey(mob.Name.ToLower()))
						{
							Dictionary<string, LootTemplate> lootTemplatesToDrop = m_lootTemplates[mob.Name.ToLower()];

							if (lootTemplatesToDrop != null)
							{
								foreach (LootTemplate lootTemplate in lootTemplatesToDrop.Values)
								{
									ItemTemplate drop = GameServer.Database.FindObjectByKey<ItemTemplate>(lootTemplate.ItemTemplateID);

									if (drop != null && (drop.Realm == (int)player.Realm || drop.Realm == 0 || player.CanUseCrossRealmItems))
									{
										if (lootTemplate.Chance == 100)
										{
											loot.AddFixed(drop, lootTemplate.Count);
										}
										else
										{
											loot.AddRandom(lootTemplate.Chance, drop, 1);
										}
									}
								}
							}
						}
					}
					else
					{
						// MobXLootTemplate exists and tells us the max number of items that can drop.
						// Because we are restricting the max number of items to drop we need to traverse the list
						// and add every 100% chance items to the loots Fixed list and add the rest to the Random list
						// due to the fact that 100% items always drop regardless of the drop limit

						List<LootTemplate> lootTemplatesToDrop = new List<LootTemplate>();
						foreach (MobXLootTemplate mobXLootTemplate in killedMobXLootTemplates)
						{
							loot = GenerateLootFromMobXLootTemplates(mobXLootTemplate, lootTemplatesToDrop, loot, player);

							if (lootTemplatesToDrop != null)
							{
								foreach (LootTemplate lootTemplate in lootTemplatesToDrop)
								{
									ItemTemplate drop = GameServer.Database.FindObjectByKey<ItemTemplate>(lootTemplate.ItemTemplateID);

									if (drop != null && (drop.Realm == (int)player.Realm || drop.Realm == 0 || player.CanUseCrossRealmItems))
									{
										loot.AddRandom(lootTemplate.Chance, drop, 1);
									}
								}
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				log.ErrorFormat("Error in LootGeneratorTemplate for mob {0}.  Exception: {1} {2}", mob.Name, ex.Message, ex.StackTrace);
			}

			return loot;
		}