Ejemplo n.º 1
0
        public bool MyKitchen(MsgInformationEx MsgDTO, object[] param)
        {
            var cookingRec = CookingRecord.Get(MsgDTO.FromQQ);
            var level      = CookingLevelSvc.LocationLevel(cookingRec.TotalPrice);
            var msg        = $"【{level.Name}(lv.{level.Level})】\r\n";
            var itemColle  = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var dietList   = cookingRec.LearndDietMenu.Select(diet =>
            {
                var Diet = CookingDietSvc[diet];
                if (!Diet.Flavorings.IsNullOrEmpty() && !cookingRec.CheckFlavorings(Diet.Flavorings) ||
                    !Diet.Materials.IsNullOrEmpty() && !itemColle.CheckItem(Diet.Materials))
                {
                    return($"{diet}(材料不足)");
                }

                return(diet);
            });

            msg +=
                $"已学会的菜谱:{string.Join(",", dietList)}\r\n";
            msg += $"当前持有菜肴:{string.Join(",", cookingRec.CookedDietDic.Select(p => $"{p.Key}*{p.Value}"))}\r\n";
            msg += $"当前持有调味料:{string.Join(",", cookingRec.FlavoringDic.Select(p => $"{p.Key}*{p.Value}"))}\r\n";
            msg += $"推荐学习菜谱:【{CookingDietSvc.SuggestDiet(cookingRec.LearndDietMenu)?.Name}】";

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
Ejemplo n.º 2
0
        public bool MyCookingHistory(MsgInformationEx MsgDTO, object[] param)
        {
            var cookingRec = CookingRecord.Get(MsgDTO.FromQQ);
            var history    = cookingRec.CookingHistory;

            if (history.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你尚未烹饪过任何东西!");
                return(false);
            }

            var sumDietCount = history.Sum(p => p.Value);
            var totalPrice   = cookingRec.TotalPrice;

            var curLevel  = CookingLevelSvc.LocationLevel(totalPrice);
            var nextLevel = CookingLevelSvc[curLevel.Level + 1];

            var msg = $"你总共烹饪过 {sumDietCount} 道菜肴\r\n" +
                      $"总共消耗了物品 {cookingRec.ItemConsumeDic.Sum(p => p.Value)} 个,调味料 {cookingRec.FlavoringTotal} 个\r\n" +
                      $"总价值:{totalPrice.CurencyFormat()}\r\n" +
                      $"当前烹饪评级为:【{curLevel.Name}(lv.{curLevel.Level})】,距离下一等级【{nextLevel.Name}({nextLevel.Level})】还差 {(nextLevel.NeedPrice - totalPrice).CurencyFormat()}";

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }