public static bool HandleEffects(WorldClient client, CharacterItemRecord item)
        {
            bool remove = false;

            if (!ConditionProvider.ParseAndEvaluate(client, item.GetTemplate().Criteria))
            {
                client.Character.Reply("Vous ne possédez pas les critères nécessaires pour utiliser cet objet.");
                return(remove);
            }
            var effects = item.GetEffects();

            foreach (var effect in effects)
            {
                var function = Functions.ToList().Find(x => x.Key == (EffectsEnum)effect.actionId);
                if (function.Value != null)
                {
                    try
                    {
                        if (function.Value(client, effect, item.UID))
                        {
                            remove = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        client.Character.NotificationError(ex.Message);
                    }
                }
                else
                {
                    client.Character.NotificationError((EffectsEnum)effect.actionId + " is not handled");
                }
            }
            return(remove);
        }
 public static bool HandleEffects(WorldClient client, CharacterItemRecord item)
 {
     bool remove = false;
     if (!ConditionProvider.ParseAndEvaluate(client,item.GetTemplate().Criteria))
     {
         client.Character.Reply("Vous ne possédez pas les critères nécessaires pour utiliser cet objet.");
         return remove;
     }
     var effects = item.GetEffects();
     foreach (var effect in effects)
     {
         var function = Functions.ToList().Find(x => x.Key == (EffectsEnum)effect.actionId);
         if (function.Value != null)
         {
             try
             {
                 if (function.Value(client, effect, item.UID))
                     remove = true;
             }
             catch (Exception ex)
             {
                 client.Character.NotificationError(ex.Message);
             }
         }
         else
         {
             client.Character.NotificationError((EffectsEnum)effect.actionId + " is not handled");
         }
     }
     return remove;
 }
 public BidShopItemRecord(int bidshopid, uint price, int quantity, CharacterItemRecord item)
 {
     this.BidShopId    = bidshopid;
     this.OwnerId      = item.CharacterId;
     this.UID          = item.UID;
     this.GID          = item.GID;
     this.Effects      = item.Effects;
     this.Price        = price;
     this.Quantity     = (uint)quantity;
     this.m_realEffect = item.GetEffects();
 }
        public static bool Handle(Character character, CharacterItemRecord item)
        {
            if (!CriteriaProvider.EvaluateCriterias(character.Client, item.Template.Criteria))
            {
                character.TextInformation(TextInformationTypeEnum.TEXT_INFORMATION_ERROR, 34);

                return(false);
            }

            var function = Handlers.FirstOrDefault(x => x.Key.GId == item.GId);

            if (function.Value != null)
            {
                return((bool)function.Value.Invoke(null, new object[] { character, item }));
            }
            else
            {
                function = Handlers.FirstOrDefault(x => x.Key.ItemType == item.Template.TypeEnum);
                if (function.Value != null)
                {
                    return((bool)function.Value.Invoke(null, new object[] { character, item }));
                }

                foreach (var effect in item.GetEffects <Effect>())
                {
                    function = Handlers.FirstOrDefault(x => x.Key.Effect == effect.EffectEnum);
                    if (function.Value != null)
                    {
                        try {
                            return((bool)function.Value.Invoke(null, new object[] { character, effect }));
                        }
                        catch (Exception ex) {
                            character.ReplyError(ex.ToString());

                            return(false);
                        }
                    }
                    else
                    {
                        character.Reply(effect.EffectEnum + " is not handled");
                        return(false);
                    }
                }

                return(false);
            }
        }