Exemplo n.º 1
0
        public bool Sell(MsgInformationEx MsgDTO, object[] param)
        {
            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "快晴"))
            {
                MsgSender.PushMsg(MsgDTO, "你无法进行该操作!(快晴)");
                return(false);
            }

            var name = param[0] as string;

            var item = HonorSvc.FindItem(name);

            if (item != null)
            {
                return(SellItem(MsgDTO, item));
            }

            if (HonorSvc.FindHonor(name) != null)
            {
                return(SellHonor(MsgDTO, name));
            }

            MsgSender.PushMsg(MsgDTO, "未查找到相关物品或成就!");
            return(false);
        }
Exemplo n.º 2
0
        public bool DispelOneBuff(MsgInformationEx MsgDTO, object[] param)
        {
            var qqNum    = (long)param[0];
            var buffName = param[1] as string;

            if (!OSPersonBuff.CheckBuff(qqNum, buffName))
            {
                MsgSender.PushMsg(MsgDTO, "目标身上没有指定buff!");
                return(false);
            }

            var sourcePerson = OSPerson_Doremi.GetPerson(MsgDTO.FromQQ);

            if (sourcePerson.Golds < 100)
            {
                MsgSender.PushMsg(MsgDTO, "驱散该buff需要100金币,你没有足够的金币!");
                return(false);
            }

            if (!WaiterSvc.WaitForConfirm_Gold(MsgDTO, 100))
            {
                MsgSender.PushMsg(MsgDTO, "操作取消!");
                return(false);
            }

            OSPersonBuff.Remove(qqNum, buffName);

            sourcePerson.Golds -= 100;
            sourcePerson.Update();

            MsgSender.PushMsg(MsgDTO, "驱散成功!");
            return(true);
        }
Exemplo n.º 3
0
        public bool SellMulti(MsgInformationEx MsgDTO, object[] param)
        {
            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "快晴"))
            {
                MsgSender.PushMsg(MsgDTO, "你无法进行该操作!(快晴)");
                return(false);
            }

            var name  = param[0] as string;
            var count = (int)(long)param[1];

            if (count <= 0)
            {
                MsgSender.PushMsg(MsgDTO, "错误的物品数量!");
                return(false);
            }

            var item = HonorSvc.FindItem(name);

            if (item != null)
            {
                SellItem(MsgDTO, item, count);
                return(true);
            }

            MsgSender.PushMsg(MsgDTO, "未查找到相关物品!");
            return(false);
        }
Exemplo n.º 4
0
        public bool FishingBottle(MsgInformationEx MsgDTO, object[] param)
        {
            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "昙天"))
            {
                MsgSender.PushMsg(MsgDTO, "你当前无法捞瓶子!(昙天)");
                return(false);
            }

            if (Rander.RandInt(100) < ItemRate)
            {
                FishItem(MsgDTO);
                return(true);
            }

            var query = MongoService <DriftBottleRecord> .Get(r => r.FromQQ != MsgDTO.FromQQ && r.FromGroup != MsgDTO.FromGroup && !r.ReceivedQQ.HasValue);

            if (query.IsNullOrEmpty())
            {
                FishItem(MsgDTO);
                return(true);
            }

            var bottle = query.RandElement();

            PrintBottle(MsgDTO, bottle);

            bottle.ReceivedGroup = MsgDTO.FromGroup;
            bottle.ReceivedQQ    = MsgDTO.FromQQ;
            bottle.ReceivedTime  = DateTime.Now;

            MongoService <DriftBottleRecord> .Update(bottle);

            return(true);
        }
Exemplo n.º 5
0
        public bool Fight(MsgInformationEx MsgDTO, object[] param)
        {
            var aimNum = (long)param[0];

            if (MsgDTO.FromQQ == aimNum)
            {
                MsgSender.PushMsg(MsgDTO, "你无法跟自己对决!");
                return(false);
            }

            if (BindAiSvc.AllAiNums.Contains(aimNum))
            {
                MsgSender.PushMsg(MsgDTO, "鱼唇的人类,你无法挑战ai的威严!");
                return(false);
            }

            if (ChessSvc.IsGroupInPlaying(MsgDTO.FromGroup))
            {
                MsgSender.PushMsg(MsgDTO, "本群正在进行一场对决,请稍后再试!");
                return(false);
            }

            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "黄砂"))
            {
                MsgSender.PushMsg(MsgDTO, "你当前无法进行挑战!(黄砂)");
                return(false);
            }

            if (!WaiterSvc.WaitForConfirm(MsgDTO.FromGroup, aimNum, $"{CodeApi.Code_At(MsgDTO.FromQQ)} 正在向你发起一场对决,是否接受?", MsgDTO.BindAi, 10))
            {
                MsgSender.PushMsg(MsgDTO, "对决取消!");
                return(false);
            }

            if (ChessSvc.IsQQInPlaying(MsgDTO.FromQQ))
            {
                MsgSender.PushMsg(MsgDTO, "你正在进行一场对决,请稍后再试!");
                return(false);
            }

            if (ChessSvc.IsQQInPlaying(aimNum))
            {
                MsgSender.PushMsg(MsgDTO, "你的对手正在进行一场对决,请稍后再试!");
                return(false);
            }

            ChessSvc.StartAGame(MsgDTO.FromGroup, MsgDTO.FromQQ, aimNum, (GroupNum, QQNum, Msg, judge) =>
            {
                var msg       = MsgDTO.Clone();
                msg.FromQQ    = QQNum;
                msg.FromGroup = GroupNum;

                var info = WaiterSvc.WaitForInformation(msg, Msg,
                                                        information => information.FromGroup == GroupNum && information.FromQQ == QQNum && judge(information.Msg), 10, true);
                return(info == null ? string.Empty : info.Msg);
            }, MsgDTO.BindAi);

            return(true);
        }
Exemplo n.º 6
0
        private bool DealDiet(MsgInformationEx MsgDTO, string name, long aimQQ, int price)
        {
            var aimDietRec = CookingRecord.Get(aimQQ);

            if (!aimDietRec.CheckDiet(name))
            {
                MsgSender.PushMsg(MsgDTO, "对方没有该菜肴!");
                return(false);
            }

            var dietModel = CookingDietSvc[name];

            if (dietModel.EstimatedPrice < price)
            {
                MsgSender.PushMsg(MsgDTO, $"交易价格不能低于该菜肴的成本价格({dietModel.EstimatedPrice.CurencyFormat()})!");
                return(false);
            }

            var sourceOSPerson = OSPerson.GetPerson(MsgDTO.FromQQ);
            var fee            = OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "苍天") ? 0 : price / 20;

            if (sourceOSPerson.Golds < price + fee)
            {
                MsgSender.PushMsg(MsgDTO, "你没有足够的金币来支付!");
                return(false);
            }

            var count = aimDietRec.CookedDietDic[name];
            var msg   = $"收到来自 {CodeApi.Code_At(MsgDTO.FromQQ)} 的交易请求:\r\n" +
                        $"希望得到的菜肴:{name}\r\n" +
                        $"价格:{price.CurencyFormat()}({dietModel.EstimatedPrice.CurencyFormat()})\r\n" +
                        $"你当前持有:{count}个,是否确认交易?";

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

            var sourceDietRec = CookingRecord.Get(MsgDTO.FromQQ);

            sourceDietRec.AddDiet(name);
            sourceDietRec.Update();

            aimDietRec.DietConsume(name);
            aimDietRec.Update();

            sourceOSPerson.Golds -= price + fee;
            sourceOSPerson.Update();

            var aimOSPerson = OSPerson.GetPerson(aimQQ);

            aimOSPerson.Golds += price;
            aimOSPerson.Update();

            MsgSender.PushMsg(MsgDTO, "交易完毕!");
            return(true);
        }
Exemplo n.º 7
0
        public bool Buy(MsgInformationEx MsgDTO, object[] param)
        {
            var name   = param[0] as string;
            var vipSvc = DailyVipShopSvc[name];

            if (vipSvc != null)
            {
                DailyVipShopSvc.Serve(MsgDTO, name);
                return(false);
            }

            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "快晴"))
            {
                MsgSender.PushMsg(MsgDTO, "你无法进行该操作!(快晴)");
                return(false);
            }

            var sellingItems = TransHelper.GetDailySellItems();
            var todayRec     = DailySellItemRareRecord.GetToday();

            if (DateTime.Now.Hour >= todayRec.Hour && DateTime.Now.Hour <= todayRec.Hour + 2)
            {
                sellingItems = sellingItems.Concat(todayRec.Items);
            }

            var sellItem = sellingItems.FirstOrDefault(si => si.Name == name);

            if (sellItem == null)
            {
                MsgSender.PushMsg(MsgDTO, "此物品未在商店中售卖!");
                return(false);
            }

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

            if (osPerson.Golds < sellItem.Price)
            {
                MsgSender.PushMsg(MsgDTO, "你持有的金币不足以购买此物品!");
                return(false);
            }

            var price = OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "极光") ? sellItem.Price * 80 / 100 : sellItem.Price;

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

            var record    = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var incomeMsg = record.ItemIncome(sellItem.Name);

            OSPerson.GoldConsume(osPerson.QQNum, price);

            MsgSender.PushMsg(MsgDTO, $"{incomeMsg}\r\n购买成功!你当前剩余的金币为 {(osPerson.Golds - sellItem.Price).CurencyFormat()}");
            return(true);
        }
Exemplo n.º 8
0
        public int GetHonorPrice(string honorName, long qqNum)
        {
            var honor = FindHonor(honorName);
            var price = honor.Items.Sum(item => item.Rate == 0 ? 1 : item.Price) * 3 / 2;

            if (OSPersonBuff.CheckBuff(qqNum, "疏雨"))
            {
                price += price * 20 / 100;
            }
            return(price);
        }
Exemplo n.º 9
0
        public static int GetItemPrice(DriftBottleItemModel item, long qqNum)
        {
            if (item.Rate == 0)
            {
                return(1);
            }

            var price = item.Price;

            if (OSPersonBuff.CheckBuff(qqNum, "疏雨"))
            {
                price += price * 20 / 100;
            }
            return(price);
        }
Exemplo n.º 10
0
        public bool SellRedundant(MsgInformationEx MsgDTO, object[] param)
        {
            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "快晴"))
            {
                MsgSender.PushMsg(MsgDTO, "你无法进行该操作!(快晴)");
                return(false);
            }

            var record = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var ics    = record.HonorCollections.Values.SelectMany(hc => hc.Items.Where(p => p.Value > 1)).ToList();

            if (ics.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你没有任何多余的物品!");
                return(false);
            }

            var ictm = ics.Select(p => new
            {
                p.Key,
                Count   = p.Value - 1,
                IsLimit = HonorSvc.IsLimitItem(p.Key),
                Price   = HonorSvc.GetItemPrice(HonorSvc.FindItem(p.Key), MsgDTO.FromQQ)
            }).ToList();
            var msg = $"你即将贩卖{ictm.Sum(i => i.Count)}件物品," +
                      $"其中有{ictm.Count(i => i.IsLimit)}件限定物品," +
                      $"共价值{ictm.Sum(p => p.Price * p.Count).CurencyFormat()},是否继续?";

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

            foreach (var ic in ictm)
            {
                record.ItemConsume(ic.Key, ic.Count);
            }
            record.Update();

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

            osPerson.Golds += ictm.Sum(p => p.Price * p.Count);
            osPerson.Update();

            MsgSender.PushMsg(MsgDTO, $"贩卖成功,你当前拥有{osPerson.Golds.CurencyFormat()}!");
            return(true);
        }
Exemplo n.º 11
0
        private void FishItem(MsgInformationEx MsgDTO)
        {
            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "梅雨") && Rander.RandInt(100) < 30)
            {
                MsgSender.PushMsg(MsgDTO, "欸呀呀,捞瓶子失败了!(梅雨)", true);
                return;
            }

            var item      = HonorSvc.RandItem();
            var record    = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var honorName = HonorSvc.FindHonorName(item.Name);

            var count     = 1;
            var vipArmers = VipArmerRecord.Get(MsgDTO.FromQQ);

            if (vipArmers.CheckArmer("安妮的镜子"))
            {
                count = 2;
            }
            vipArmers.Armers.Remove(p => p.Name == "安妮的镜子");
            vipArmers.Update();

            DriftBottleAnalyzeRecord.Record(item.Name, count);

            var s   = record.ItemIncome(item.Name, count);
            var msg = "你捞到了 \r\n" +
                      $"{(string.IsNullOrEmpty(item.PicPath) ? string.Empty : $"{CodeApi.Code_Image_Relational(item.PicPath)}\r\n")}" +
                      $"{item.Name}{(count > 1 ? $"*{count}" : string.Empty)} \r\n" +
                      $"    {item.Description} \r\n" +
                      $"稀有率为 {HonorSvc.ItemRate(item)}%\r\n" +
                      $"售价为:{item.Price} 金币\r\n" +
                      $"特性:{(item.Attributes == null ? "无" : string.Join(",", item.Attributes))}\r\n" +
                      $"你总共拥有该物品 {record.HonorCollections[honorName].Items[item.Name]}个";

            if (!string.IsNullOrEmpty(s))
            {
                msg += $"\r\n{s}";
            }

            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "钻石尘") && Rander.RandInt(100) < 50)
            {
                OSPerson.GoldConsume(MsgDTO.FromQQ, 40);
                msg += "\r\n欸呀呀,你丢失了40金币(钻石尘)";
            }

            MsgSender.PushMsg(MsgDTO, msg, true);
        }
Exemplo n.º 12
0
        public bool DealWith(MsgInformationEx MsgDTO, object[] param)
        {
            if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "快晴"))
            {
                MsgSender.PushMsg(MsgDTO, "你无法进行该操作!(快晴)");
                return(false);
            }

            var aimQQ = (long)param[0];
            var name  = param[1] as string;
            var price = (int)(long)param[2];

            if (aimQQ == MsgDTO.FromQQ)
            {
                MsgSender.PushMsg(MsgDTO, "你无法和自己交易!");
                return(false);
            }

            if (price <= 0)
            {
                MsgSender.PushMsg(MsgDTO, "价格异常!");
                return(false);
            }

            if (HonorSvc.FindItem(name) != null)
            {
                return(DealItem(MsgDTO, name, aimQQ, price));
            }

            if (CookingDietSvc[name] != null)
            {
                return(DealDiet(MsgDTO, name, aimQQ, price));
            }

            MsgSender.PushMsg(MsgDTO, "未查找到相关物品信息!");
            return(false);
        }
Exemplo n.º 13
0
        private bool DealItem(MsgInformationEx MsgDTO, string name, long aimQQ, int price)
        {
            var aimRecord = ItemCollectionRecord.Get(aimQQ);

            if (!aimRecord.CheckItem(name))
            {
                MsgSender.PushMsg(MsgDTO, "对方没有该物品!");
                return(false);
            }

            var originPrice = HonorSvc.GetItemPrice(HonorSvc.FindItem(name), aimQQ);

            if (originPrice > price)
            {
                MsgSender.PushMsg(MsgDTO, $"收购价格无法低于系统价格({originPrice.CurencyFormat()})!");
                return(false);
            }

            var sourceOSPerson = OSPerson.GetPerson(MsgDTO.FromQQ);
            var fee            = OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "苍天") ? 0 : price / 20;

            if (sourceOSPerson.Golds < price + fee)
            {
                MsgSender.PushMsg(MsgDTO, "你没有足够的金币来支付!");
                return(false);
            }

            var count = aimRecord.GetCount(name);
            var msg   = $"收到来自 {CodeApi.Code_At(MsgDTO.FromQQ)} 的交易请求:\r\n" +
                        $"希望得到的物品:{name}\r\n" +
                        $"价格:{price.CurencyFormat()}({originPrice.CurencyFormat()})\r\n" +
                        $"你当前持有:{count}个,是否确认交易?";

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

            aimRecord.ItemConsume(name);
            aimRecord.Update();

            var sourceRecord = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var content      = sourceRecord.ItemIncome(name);

            if (!string.IsNullOrEmpty(content))
            {
                MsgSender.PushMsg(MsgDTO, content, true);
            }

            var aimOSPerson = OSPerson.GetPerson(aimQQ);

            sourceOSPerson.Golds -= price + fee;
            aimOSPerson.Golds    += price;

            sourceOSPerson.Update();
            aimOSPerson.Update();

            MsgSender.PushMsg(MsgDTO, "交易完毕!");
            return(true);
        }