示例#1
0
        protected override string ProduceChatMessage(BotContext botContext)
        {
            if (DateTime.Compare(currentDealDate.Date, DateTime.Today) != 0)
            {
                pendingPurchases.Clear();
                currentDealDate.Date = DateTime.Today;
                dealEntry.Deal       = dailyDealAction.Deal;
            }

            UserEntry buyer = CoopShopUtility.GetUserEntry(botContext);

            if (buyer == null)
            {
                return("");
            }

            foreach (UserEntry user in pendingPurchases)
            {
                if (user.Name.CompareTo(buyer.Name) == 0)
                {
                    pendingPurchases.Remove(user);

                    if (buyer.Balance < dealEntry.Price)
                    {
                        return(buyer.Name + ", you no longer have enough points!");
                    }

                    string chatMessage   = buyer.Name + " wishes to buy " + dealEntry.Name + " for " + dealEntry.Price + " points.";
                    string returnMessage = buyer.Name + ", a purchase request has been sent to Monukai for '" + dealEntry.Name + "'!";

                    if ((dealEntry.Quantity - 1) <= 0)
                    {
                        pendingPurchases.Clear();
                        dailyDealAction.Reroll();
                        dealEntry.Deal = dailyDealAction.Deal;
                    }
                    else
                    {
                        dealEntry.Quantity = dealEntry.Quantity - 1;
                        dailyDealAction.ComputeMessage();
                    }

                    botContext.SteamFriend.SendChatMessage(new SteamID(Convert.ToUInt64("76561198030277114")), EChatEntryType.ChatMsg, chatMessage);

                    return(returnMessage);
                }
            }

            return("It does not appear you have attempted to buy this deal, do so with '!buydeal'");
        }