Ejemplo n.º 1
0
        public bool ShopInfo_Rare(MsgInformationEx MsgDTO, object[] param)
        {
            var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);
            var golds    = osPerson.Golds;

            var todayRec    = DailySellItemRareRecord.GetToday();
            var tomorrowRec = DailySellItemRareRecord.GetTomorrow();

            if (todayRec.IsOver)
            {
                MsgSender.PushMsg(MsgDTO,
                                  $"稀有商店休息中~\r\n下次开放时间:明天 {tomorrowRec.Hour}:00:00 ~ {tomorrowRec.Hour + 3}:00:00");
                return(false);
            }

            if (todayRec.IsBefore)
            {
                MsgSender.PushMsg(MsgDTO,
                                  $"稀有商店休息中~\r\n下次开放时间:今天 {todayRec.Hour}:00:00 ~ {todayRec.Hour + 3}:00:00");
                return(false);
            }

            var sellItems = todayRec.Items;
            var record    = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var itemsStr  = string.Join("\r\n", sellItems.Select(si =>
                                                                 $"{si.Name}({HonorSvc.FindHonorFullName(si.Name)})({record.GetCount(si.Name)})({si.Attr}):{si.Price.CurencyFormat()}"));

            var msg = $"当前售卖的商品:\r\n{itemsStr}\r\n你当前持有 {golds.CurencyFormat()}";

            MsgSender.PushMsg(MsgDTO, msg);

            return(true);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public static DailySellItemRareRecord GetTomorrow()
        {
            var dataStr = DateTime.Now.AddDays(1).ToString("yyyyMMdd");
            var record  = MongoService <DailySellItemRareRecord> .GetOnly(p => p.DateStr == dataStr);

            if (record != null)
            {
                return(record);
            }

            record = new DailySellItemRareRecord()
            {
                DateStr = dataStr,
                Hour    = 6 + Rander.RandInt(16),
                Items   = CreateDailySellItems_Rare()
            };
            MongoService <DailySellItemRareRecord> .Insert(record);

            return(record);
        }