Example #1
0
        public bool Reborn(MsgInformationEx MsgDTO, object[] param)
        {
            var itemColl = ItemCollectionRecord.Get(MsgDTO.FromQQ);

            if (itemColl.HonorCollections.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你尚未集齐所有非限定物品!", true);
                return(false);
            }

            var normalHonors = itemColl.HonorCollections.Where(h => h.Value.Type == HonorType.Normal).ToList();
            var items        = normalHonors.Select(p => p.Value).SelectMany(h => h.Items.Keys).ToList();

            var allItems = HonorSvc.HonorList.Where(h => !(h is LimitHonorModel)).SelectMany(h => h.Items).Select(p => p.Name);

            if (items.Count != allItems.Count())
            {
                MsgSender.PushMsg(MsgDTO, "你尚未集齐所有非限定物品!", true);
                return(false);
            }

            var response = WaiterSvc.WaitForInformation(MsgDTO, $"请输入想获取的荣誉称号名称(不能超过{RebornHonorLimit}个字)",
                                                        info => info.FromQQ == MsgDTO.FromQQ && info.FromGroup == MsgDTO.FromGroup && info.Msg != null && info.Msg.Length <= RebornHonorLimit, 10);

            if (response == null)
            {
                MsgSender.PushMsg(MsgDTO, "操作取消!");
                return(false);
            }

            var honorName = response.Msg;
            var osPerson  = OSPerson.GetPerson(MsgDTO.FromQQ);

            if (osPerson.HonorNames.Contains(honorName))
            {
                MsgSender.PushMsg(MsgDTO, "你已经获取了该荣誉称号,操作取消!");
                return(false);
            }

            osPerson.Level++;
            osPerson.HonorNames.Add(honorName);

            foreach (var honor in normalHonors.Select(p => p.Key))
            {
                TransHelper.SellHonorToShop(itemColl, honor, osPerson);
            }

            itemColl.Update();
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, $"恭喜【{honorName}】,转生成功!");
            return(true);
        }
Example #2
0
        private bool SellHonor(MsgInformationEx MsgDTO, string honorName)
        {
            var colleRec = ItemCollectionRecord.Get(MsgDTO.FromQQ);

            if (colleRec.HonorCollections.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你尚未拥有任何物品!");
                return(false);
            }

            var items           = HonorSvc.FindHonor(honorName).Items;
            var honorCollection = colleRec.HonorCollections;

            if (!honorCollection.ContainsKey(honorName) || honorCollection[honorName].Items.Count < items.Count)
            {
                MsgSender.PushMsg(MsgDTO, "你尚未集齐该成就下的所有物品!");
                return(false);
            }

            var price = HonorSvc.GetHonorPrice(honorName, MsgDTO.FromQQ);
            var msg   = $"贩卖此成就将获得 {price.CurencyFormat()},是否确认贩卖?";

            if (!WaiterSvc.WaitForConfirm(MsgDTO, msg))
            {
                MsgSender.PushMsg(MsgDTO, "交易取消!");
                return(false);
            }

            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);

            TransHelper.SellHonorToShop(colleRec, honorName, osPerson);

            colleRec.Update();
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, $"贩卖成功!你当前拥有金币 {osPerson.Golds.CurencyFormat()}");
            return(true);
        }