Ejemplo n.º 1
0
        public void Rewards(Aisling user, bool equipLoot)
        {
            foreach (var items in SkillRewards)
            {
                if (!Skill.GiveTo(user.Client, items))
                {
                }
            }



            foreach (var items in SpellRewards)
            {
                if (!Spell.GiveTo(user, items))
                {
                }
            }

            foreach (var items in ItemRewards)
            {
                if (ServerContext.GlobalItemTemplateCache.ContainsKey(items))
                {
                    var template = ServerContext.GlobalItemTemplateCache[items];

                    var obj = Item.Create(user, template);
                    if (!obj.GiveTo(user, true))
                    {
                        obj.Release(user, user.Position);
                    }
                }
            }

            foreach (var legends in LegendRewards)
            {
                user.LegendBook.AddLegend(new Legend.LegendItem
                {
                    Category = "Quest Reward",
                    Color    = legends.Color,
                    Icon     = legends.Icon,
                    Value    = legends.Value
                });
            }


            if (ExpRewards.Count > 0)
            {
                ExpRewards.ForEach(i => Monster.DistributeExperience(user, i));
            }


            if (GoldReward > 0)
            {
                user.GoldPoints += (int)GoldReward;
                user.Client.SendMessage(0x02, string.Format("You are awarded {0} gold.", GoldReward));
            }

            if (equipLoot)
            {
                EquipRewards(user);
                user.Client.Refresh();
            }

            user.Client.SendStats(StatusFlags.All);
        }