Esempio n. 1
0
        /// <summary>
        /// 按照抽卡结果生成图片
        /// </summary>
        /// <param name="count">抽卡次数</param>
        /// <returns></returns>
        public static string GetPicPath(int count, PoolInfo poolInfo, CQGroupMessageEventArgs e)
        {
            List <PoolContent> ls = new List <PoolContent>();

            for (int i = 0; i < count; i++)
            {
                var item = poolInfo.PoolContents[RandomGacha(poolInfo)];
                ls = FoldItem(item, ls);
            }
            Event_GroupMessage.SubDiamond(e, poolInfo.PerGachaConsumption * count);
            PicHelper combine = new PicHelper();

            ls = ls.OrderByDescending(x => x.Value).ToList();
            string CQAt = poolInfo.ResultAt ? CQApi.CQCode_At(e.FromQQ).ToSendString() : string.Empty;

            return(CQAt + combine.GeneratePic(poolInfo, ls, Event_GroupMessage.GetDiamond(e)));
        }
Esempio n. 2
0
        /// <summary>
        /// 判断能否抽卡,并发送一定的自定义信息
        /// </summary>
        /// <param name="e"></param>
        /// <param name="poolInfo"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static bool CanGacha(CQGroupMessageEventArgs e, PoolInfo poolInfo, int count)
        {
            if (!Event_GroupMessage.GroupInini(e))
            {
                return(false);
            }
            if (!Event_GroupMessage.IDExist(e))
            {
                e.FromGroup.SendGroupMessage(Event_GroupMessage.noReg.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]"));
                return(false);
            }
            int diamond = Event_GroupMessage.GetDiamond(e);

            if (diamond < count * poolInfo.PerGachaConsumption)
            {
                e.FromGroup.SendGroupMessage(Event_GroupMessage.lowDiamond.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                return(false);
            }
            e.FromGroup.SendGroupMessage(Event_GroupMessage.BP10.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]"));
            return(true);
        }