示例#1
0
        /// <summary>
        /// 检查今日抽奖次数有没有用完
        /// </summary>
        /// <param name="qq"></param>
        /// <returns></returns>
        public static bool CheckCount(string qq)
        {
            string last_time = XmlSolve.xml_get("daily_sign_in_time", qq);

            if (last_time == System.DateTime.Today.ToString())  //今天抽过奖了
            {
                int count = 0;
                try
                {
                    count = int.Parse(XmlSolve.xml_get("lottery_count", qq));
                }
                catch { }

                if (count == -Tools.GetXmlNumber("gift", qq) / 5)
                {
                    return(true);
                }
                else
                {
                    XmlSolve.del("lottery_count", qq);
                    XmlSolve.insert("lottery_count", qq, (count - 1).ToString());
                    return(false);
                }
            }
            else  //今天没抽奖
            {
                XmlSolve.del("daily_sign_in_time", qq);
                XmlSolve.insert("daily_sign_in_time", qq, System.DateTime.Today.ToString());
                XmlSolve.del("lottery_count", qq);
                XmlSolve.insert("lottery_count", qq, "4");
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 解禁某人
        /// </summary>
        /// <param name="fromqq"></param>
        /// <param name="banqq"></param>
        /// <param name="group"></param>
        /// <param name="_mahuaApi"></param>
        /// <returns></returns>
        public static string UnbanSomebody(string fromqq, string banqq, string group, IMahuaApi _mahuaApi)
        {
            int    fk  = 0;
            string fks = XmlSolve.xml_get("ban_card", fromqq);

            if (fks != "")
            {
                fk = int.Parse(fks);
            }
            if (fk > 0)
            {
                try
                {
                    TimeSpan span = new TimeSpan(0, 0, 0, 0);
                    _mahuaApi.BanGroupMember(group, banqq, span);
                    fk--;
                    XmlSolve.del("ban_card", fromqq);
                    XmlSolve.insert("ban_card", fromqq, fk.ToString());

                    return(Tools.At(fromqq) + "\r\n[CQ:emoji,id=9989]已将" + banqq + "解除禁言");
                }
                catch
                {
                    return(Tools.At(fromqq) + "\r\n执行失败。");
                }
            }
            else
            {
                return(Tools.At(fromqq) + "\r\n[CQ:emoji,id=128162]你哪儿有禁言卡?");
            }
        }
示例#3
0
        /// <summary>
        /// 禁言某人
        /// </summary>
        /// <param name="fromqq"></param>
        /// <param name="banqq"></param>
        /// <param name="group"></param>
        /// <param name="_mahuaApi"></param>
        /// <returns></returns>
        public static string BanSomebody(string fromqq, string banqq, string group, IMahuaApi _mahuaApi)
        {
            int    fk  = 0;
            string fks = XmlSolve.xml_get("ban_card", fromqq);

            if (fks != "")
            {
                fk = int.Parse(fks);
            }
            if (fk > 0)
            {
                try
                {
                    Random   ran     = new Random(System.DateTime.Now.Millisecond);
                    int      RandKey = ran.Next(0, 60 + Tools.GetXmlNumber("gift", fromqq));
                    TimeSpan span    = new TimeSpan(0, 0, RandKey, 0);
                    _mahuaApi.BanGroupMember(group, banqq, span);
                    fk--;
                    XmlSolve.del("ban_card", fromqq);
                    XmlSolve.insert("ban_card", fromqq, fk.ToString());

                    return(Tools.At(fromqq) + "\r\n[CQ:emoji,id=128683]已将" + banqq + "禁言" + RandKey + "分钟");
                }
                catch
                {
                    return(Tools.At(fromqq) + "\r\n执行失败。");
                }
            }
            else
            {
                return(Tools.At(fromqq) + "\r\n[CQ:emoji,id=128162]你哪儿有禁言卡?");
            }
        }
示例#4
0
        /// <summary>
        /// 获取xml存储的数值
        /// </summary>
        /// <param name="xml"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        public static int GetXmlNumber(string xml, string info)
        {
            string resultStr = XmlSolve.xml_get(xml, info);
            int    result    = 0;

            try
            {
                result = int.Parse(resultStr);
            }
            catch { }
            return(result);
        }
示例#5
0
        /// <summary>
        /// 将xml值增加指定数值
        /// </summary>
        /// <param name="xml"></param>
        /// <param name="info"></param>
        /// <param name="add"></param>
        public static int AddXmlNumber(string xml, string info, int add)
        {
            string resultStr = XmlSolve.xml_get(xml, info);
            int    result    = 0;

            try
            {
                result = int.Parse(resultStr);
            }
            catch { }
            result += add;
            XmlSolve.del(xml, info);
            XmlSolve.insert(xml, info, result.ToString());
            return(result);
        }
示例#6
0
        /// <summary>
        /// 获取禁言卡数量方法
        /// </summary>
        /// <param name="qq"></param>
        /// <returns></returns>
        public static string GetBanCard(string qq)
        {
            int    fk  = 0;
            string fks = XmlSolve.xml_get("ban_card", qq);

            if (fks != "")
            {
                fk = int.Parse(fks);
            }
            return(Tools.At(qq) +
                   "\r\n[CQ:emoji,id=128683]禁言卡可用于禁言或解禁他人,如果接待权限足够。\r\n" +
                   "使用方法:发送禁言或解禁加上@那个人\r\n" +
                   "禁言时长将为1分钟-10分钟随机\r\n" +
                   "获取方式:抽奖时有十分之一的概率获得\r\n" +
                   "你当前剩余的禁言卡数量:" +
                   fk.ToString());
        }
示例#7
0
        /// <summary>
        /// 设置复读概率
        /// </summary>
        /// <param name="input"></param>
        /// <param name="group"></param>
        /// <returns></returns>
        public static string SetRepeat(string input, string group)
        {
            int sum = 0;

            try
            {
                sum = int.Parse(input);
                if (sum > 1000)
                {
                    sum = 1000;
                }
                XmlSolve.del("repeat_settings", group);
                XmlSolve.insert("repeat_settings", group, sum.ToString());
                return("设置完成,复读概率更改为" + sum + "%");
            }
            catch
            {
                return("设置失败,请检查参数");
            }
        }
示例#8
0
        /// <summary>
        /// 获取复读语句
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="group"></param>
        /// <returns></returns>
        public static string GetRepeatString(string msg, string group)
        {
            int sum = 0;

            try
            {
                sum = int.Parse(XmlSolve.xml_get("repeat_settings", group));
                if (GetRandomNumber(0, 100) < sum)
                {
                    if (sum <= 100)
                    {
                        return(msg);
                    }
                    else
                    {
                        string result = "";
                        for (int i = 0; i < sum / 100; i++)
                        {
                            result += msg;
                        }
                        if (GetRandomNumber(0, 100) < sum % 100)
                        {
                            return(result + msg);
                        }
                        else
                        {
                            return(result);
                        }
                    }
                }
                else
                {
                    return("");
                }
            }
            catch
            {
                return("");
            }
        }
示例#9
0
        public static string GetReplay(string fromqq, string msg, IMahuaApi _mahuaApi, string fromgroup = "common")
        {
            if (Tools.MessageControl(5))
            {
                return("");
            }
            if (msg.IndexOf("!ban ") == 0 && msg.Length > 6)
            {
                if ((XmlSolve.AdminCheck(fromqq) >= 1 && fromgroup != "common") || (fromgroup == "common" && fromqq == Tools.adminNumber))
                {
                    string get_msg = msg.Replace("!ban ", "");
                    XmlSolve.insert(fromgroup, get_msg, "[ban]");
                    return("[CQ:emoji,id=128683]" + get_msg);
                }
                else
                {
                    return(prem);
                }
            }
            else if (msg.IndexOf("!unban ") == 0 && msg.Length > 7)
            {
                if ((XmlSolve.AdminCheck(fromqq) >= 1 && fromgroup != "common") || (fromgroup == "common" && fromqq == Tools.adminNumber))
                {
                    string get_msg = msg.Replace("!unban ", "");
                    XmlSolve.remove(fromgroup, get_msg, "[ban]");
                    return("[CQ:emoji,id=9989]" + get_msg);
                }
                else
                {
                    return(prem);
                }
            }
            if (XmlSolve.IsBaned(fromgroup, msg))
            {
                return("");
            }

            string result = "";

            if (msg == "赞我" || msg == "点赞")
            {
                _mahuaApi.SendLike(fromqq);
                result += Tools.At(fromqq) + "已为你点赞[CQ:emoji,id=128077]";
            }
            else if (msg.ToUpper() == "HELP" || msg == "帮助" || msg == "菜单")
            {
                result += Tools.RunLua(File.ReadAllText(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "全局词条的lua脚本/help.lua"),
                                       "fromqq = \"" + fromqq + "\"\r\n" +
                                       "fromgroup = \"" + fromgroup + "\"");
            }
            else if (msg.ToUpper() == "!LUA")
            {
                result += @"[CQ:emoji,id=128295]lua功能使用帮助:
lua 加 代码 直接运行
!luaadd 关键词:代码
!luadel 关键词
!lualist
!luasee 关键词
查看可供使用的api说明:
https://github.com/chenxuuu/receiver-meow/blob/master/lua.md";
            }
            else if (msg.IndexOf("!list ") == 0)
            {
                result += string.Format("[CQ:emoji,id=128221]当前词条回复如下:\r\n{0}\r\n全局词库内容:\r\n{1}",
                                        XmlSolve.list_get(fromgroup, msg.Replace("!list ", "")),
                                        XmlSolve.list_get("common", msg.Replace("!list ", "")));
            }
            else if (msg.IndexOf("!lualist") == 0)
            {
                result += string.Format("[CQ:emoji,id=128295]本群脚本:\r\n{0}\r\n全局脚本:\r\n{1}",
                                        XmlSolve.lua_list_get(fromgroup),
                                        XmlSolve.lua_list_get("common"));
            }
            else if (msg.IndexOf("!luaadd ") == 0 && msg.Length > 10)
            {
                if ((XmlSolve.AdminCheck(fromqq) >= 1 && fromgroup != "common") || (fromgroup == "common" && fromqq == Tools.adminNumber))
                {
                    string luaMsg = msg.Replace("!luaadd ", "");
                    int    len    = luaMsg.IndexOf(":");
                    if (len > 0 && luaMsg.Length > len)
                    {
                        string tmsg = luaMsg.Substring(0, len), tans = luaMsg.Substring(len + 1);
                        XmlSolve.insert(fromgroup, tmsg, "[lua]" + fromqq + "." + tans);
                        result += "[CQ:emoji,id=9989]添加完成!\r\n词条:" + tmsg + "\r\n回答为一个脚本";
                    }
                    else
                    {
                        result += "格式错误!";
                    }
                }
                else
                {
                    result += prem;
                }
            }
            else if (msg.IndexOf("!luadel ") == 0 && msg.Length > 8)
            {
                if ((XmlSolve.AdminCheck(fromqq) >= 1 && fromgroup != "common") || (fromgroup == "common" && fromqq == Tools.adminNumber))
                {
                    string get_msg = msg.Replace("!luadel ", "");
                    XmlSolve.luadel(fromgroup, get_msg);
                    result += "[CQ:emoji,id=128465]删除完成!\r\n脚本触发词为:" + get_msg;
                }
                else
                {
                    result += prem;
                }
            }
            else if (msg.IndexOf("!luasee ") == 0 && msg.Length > 8)
            {
                if ((XmlSolve.AdminCheck(fromqq) >= 1 && fromgroup != "common") || (fromgroup == "common" && fromqq == Tools.adminNumber))
                {
                    string get_msg = msg.Replace("!luasee ", "");
                    result += XmlSolve.xml_get(fromgroup, get_msg);
                }
                else
                {
                    result += prem;
                }
            }
            else if (msg.IndexOf("!add ") == 0 && msg.IndexOf(":") >= 0 && msg.IndexOf(":") < msg.Length)
            {
                if ((XmlSolve.AdminCheck(fromqq) >= 1 && fromgroup != "common") || (fromgroup == "common" && fromqq == Tools.adminNumber))
                {
                    string get_msg = msg.Replace("!add ", "");

                    int    len = get_msg.IndexOf(":");
                    string tmsg = get_msg.Substring(0, len), tans = get_msg.Substring(len + 1);
                    if (len >= 0 && tans.Length > 0)
                    {
                        XmlSolve.insert(fromgroup, tmsg, tans);
                        result += "[CQ:emoji,id=9989]添加完成!\r\n词条:" + tmsg + "\r\n回答为:" + tans;
                    }
                    else
                    {
                        result += "格式错误!";
                    }
                }
                else
                {
                    result += prem;
                }
            }
            else if (msg.IndexOf("!del ") == 0 && msg.IndexOf(":") >= 0 && msg.IndexOf(":") < msg.Length)
            {
                if ((XmlSolve.AdminCheck(fromqq) >= 1 && fromgroup != "common") || (fromgroup == "common" && fromqq == Tools.adminNumber))
                {
                    string get_msg = msg.Replace("!del ", "");

                    int    len = get_msg.IndexOf(":");
                    string tmsg = get_msg.Substring(0, len), tans = get_msg.Substring(len + 1);
                    if (len >= 0 && tans.Length > 0)
                    {
                        XmlSolve.remove(fromgroup, tmsg, tans);
                        result += "[CQ:emoji,id=128465]删除完成!\r\n词条:" + tmsg + "\r\n回答为:" + tans;
                    }
                    else
                    {
                        result += "格式错误!";
                    }
                }
                else
                {
                    result += prem;
                }
            }
            else if (msg.IndexOf("!delall ") == 0 && msg.Length > 8)
            {
                if ((XmlSolve.AdminCheck(fromqq) >= 1 && fromgroup != "common") || (fromgroup == "common" && fromqq == Tools.adminNumber))
                {
                    string get_msg = msg.Replace("!delall ", "");
                    if (get_msg.Length > 0)
                    {
                        XmlSolve.del(fromgroup, get_msg);
                        result += "[CQ:emoji,id=128465]删除完成!\r\n触发词:" + get_msg;
                    }
                    else
                    {
                        result += "格式错误!";
                    }
                }
                else
                {
                    result += prem;
                }
            }
            else if (msg.IndexOf("[CQ:hb,title=") != -1 && msg.IndexOf("]") != -1 && fromgroup == "common")
            {
                XmlSolve.insert("admin_list", "给我列一下狗管理", fromqq);
                result += "已给予" + fromqq + "词条编辑权限。";
            }
            else if (msg.IndexOf("!addadmin ") == 0 && fromqq == Tools.adminNumber)
            {
                XmlSolve.insert("admin_list", "给我列一下狗管理", msg.Replace("!addadmin ", ""));
                result += "已添加一位狗管理";
            }
            else if (msg.IndexOf("!deladmin ") == 0 && fromqq == Tools.adminNumber)
            {
                XmlSolve.remove("admin_list", "给我列一下狗管理", msg.Replace("!deladmin ", ""));
                result += "已删除一位狗管理";
            }
            else if (msg == "给我列一下狗管理")
            {
                result += "当前狗管理如下:\r\n" + XmlSolve.list_get("admin_list", "给我列一下狗管理");
            }
            else if (msg == "今日黄历" || msg == "今日运势" || msg == "今天运势" || msg == "今天黄历")
            {
                result += TodaysAlmanac.GetAlmanac(fromqq, DateTime.Now.DayOfYear);
            }
            else if (msg == "昨日黄历" || msg == "昨日运势" || msg == "昨天运势" || msg == "昨天黄历")
            {
                result += TodaysAlmanac.GetAlmanac(fromqq, DateTime.Now.DayOfYear - 1);
            }
            else if (msg == "明日黄历" || msg == "明日运势" || msg == "明天运势" || msg == "明天黄历")
            {
                result += TodaysAlmanac.GetAlmanac(fromqq, DateTime.Now.DayOfYear + 1);
            }
            else if (msg == "抽奖" && fromgroup != "common")
            {
                result += LotteryEvent.Lottery(fromqq, _mahuaApi, fromgroup);
            }
            else if (msg == "禁言卡")
            {
                result += LotteryEvent.GetBanCard(fromqq);
            }
            else if (msg.IndexOf("禁言") == 0 && msg.Length > 2 && fromgroup != "common")
            {
                result += LotteryEvent.BanSomebody(fromqq, Tools.GetNumber(msg), fromgroup, _mahuaApi);
            }
            else if (msg.IndexOf("解禁") == 0 && msg.Length > 2 && fromgroup != "common")
            {
                result += LotteryEvent.UnbanSomebody(fromqq, Tools.GetNumber(msg), fromgroup, _mahuaApi);
            }
            else if (msg.IndexOf("&#91;送礼物&#93; 为[CQ:at,qq=" + Tools.qqNumber + "] 送出 ") == 0 && fromgroup != "common")
            {
                result += LotteryEvent.ReceiveGift(fromqq);
            }
            else if (msg.IndexOf("空气质量") == 0)
            {
                result += Tools.GetAir(msg, fromqq);
            }
            else if (msg.IndexOf("cmd ") == 0 && fromqq == Tools.adminNumber)
            {
                result += Tools.execCMD(HttpUtility.HtmlDecode(msg.Replace("cmd ", "")));
            }
            else if (msg.IndexOf("bedrock ") == 0 && fromqq == Tools.adminNumber && Tools.special.Length > 0)
            {
                Tools.HttpGet("http://localhost:2333/list", "");
                result += Tools.HttpGet("http://localhost:2333/" + HttpUtility.HtmlDecode(msg.Replace("bedrock ", "")), "") + "--返回";
            }
            else if (msg.IndexOf("复读") == 0 && fromgroup != "common")
            {
                if (XmlSolve.AdminCheck(fromqq) >= 1)
                {
                    result += Tools.At(fromqq) + Tools.SetRepeat(Tools.GetNumber(msg), fromgroup);
                }
                else
                {
                    result += prem;
                }
            }
            else if (msg.IndexOf("搜动画") != -1 || msg.IndexOf("搜番") != -1 ||
                     msg.IndexOf("查动画") != -1 || msg.IndexOf("查番") != -1)
            {
                result += Tools.At(fromqq) + "\r\n" + WhatAnime.GetAnime(msg.Replace("\r", "").Replace("\n", ""));
            }
            else if (msg.IndexOf("番号") == 0 && msg.Length > 4 && Tools.special.Length > 0)
            {
                result += Tools.At(fromqq) + Tools.GetAVInfo(msg.Substring(2));
            }
            else if (msg.IndexOf("lua") == 0 && msg.Length > 4)
            {
                result += Tools.At(fromqq) + "\r\n" + Tools.RunLua(HttpUtility.HtmlDecode(msg.Substring(4)),
                                                                   string.Format("fromqq=\"{0}\"\r\nfromgroup=\"{1}\"\r\n", fromqq, fromgroup));
            }
            else if (fromgroup == "241464054") //糖拌群
            {
                result += MinecraftSolve.SolvePlayer(fromqq, msg, _mahuaApi);
            }
            else if (fromgroup == "567145439") //分赃群
            {
                result += MinecraftSolve.SolveAdmin(fromqq, msg, _mahuaApi);
            }
            else if (fromgroup == "543632048") //基岩版
            {
                if (msg.IndexOf("领铁轨") == 0)
                {
                    if (msg.Length <= 3)
                    {
                        return(Tools.At(fromqq) + "请用格式“领铁轨”加上id,领取铁轨");
                    }
                    else
                    {
                        Tools.HttpGet("http://localhost:2333/give " + msg.Replace("领铁轨", "") + " rail 64", "");
                        Tools.HttpGet("http://localhost:2333/give " + msg.Replace("领铁轨", "") + " golden_rail 64", "");
                        Tools.HttpGet("http://localhost:2333/give " + msg.Replace("领铁轨", "") + " redstone_torch 10", "");
                        return(Tools.At(fromqq) + "已发放,请查收");
                    }
                }
            }
            if (result == "")
            {
                result += XmlSolve.ReplayGroupStatic(fromgroup, msg, fromqq);
            }

            if (result == "")
            {
                result += Tools.GetRepeatString(msg, fromgroup);
            }

            return(result);
        }
示例#10
0
        /// <summary>
        /// 处理玩家群消息
        /// </summary>
        /// <param name="qq"></param>
        /// <param name="msg"></param>
        /// <param name="_mahuaApi"></param>
        /// <returns></returns>
        public static string SolvePlayer(string qq, string msg, IMahuaApi _mahuaApi)
        {
            bool   wait   = true;
            string player = XmlSolve.xml_get("bind_qq_wait", qq);

            if (player == "")
            {
                player = XmlSolve.xml_get("bind_qq", qq);
                wait   = false;
            }
            if (player == "")
            {
                if (msg.IndexOf("绑定") != 0)
                {
                    return(Tools.At(qq) + "检测到你还没有绑定游戏账号,请发送“绑定”加自己的游戏id来绑定账号");
                }
                else
                {
                    if (!CheckID(msg.Replace("绑定", "")))
                    {
                        return(Tools.At(qq) + "你绑定的id为“" + msg.Replace("绑定", "").Replace(" ", "空格") + "”,不符合规范,请换一个id绑定");
                    }
                    else
                    {
                        XmlSolve.insert("bind_qq_wait", qq, msg.Replace("绑定", ""));
                        _mahuaApi.SendGroupMessage("567145439", "接待喵糖拌管理:\r\n玩家id:" + msg.Replace("绑定", "") + "\r\n已成功绑定QQ:" + qq +
                                                   "\r\n请及时检查该玩家是否已经提交白名单申请https://wj.qq.com/mine.html" +
                                                   "\r\n如果符合要求,请回复“通过”+qq来给予白名单" +
                                                   "\r\n如果不符合要求,请回复“不通过”+qq+空格+原因来给打回去重填");
                        return(Tools.At(qq) + "绑定id:" + msg.Replace("绑定", "") + "成功!" +
                               "\r\n请耐心等待管理员审核白名单申请哟~" +
                               "\r\n如未申请请打开此链接:https://wj.qq.com/s/1308067/143c" +
                               "\r\n如果过去24小时仍未被审核,请回复“催促审核”来进行催促");
                    }
                }
            }
            else  //绑定过的情况下
            {
                if (msg == "激活")
                {
                    if (wait)
                    {
                        return(Tools.At(qq) + "你还没通过审核呢,想什么呢");
                    }
                    else
                    {
                        return(Tools.At(qq) + "请在服务器输入命令/code " + AddNewCode(player) + "来激活本账号\r\n" +
                               "命令只能使用一次,请尽快使用,失效可重新获取");
                    }
                }
                else if (msg == "催促审核")
                {
                    if (wait)
                    {
                        _mahuaApi.SendGroupMessage("567145439", "接待喵糖拌管理:\r\n玩家id:" + msg.Replace("绑定", "") + "\r\n进行了催促审核" + qq +
                                                   "\r\n请及时检查该玩家是否已经提交白名单申请https://wj.qq.com/mine.html" +
                                                   "\r\n如果符合要求,请回复“通过”+qq来给予白名单" +
                                                   "\r\n如果不符合要求,请回复“不通过”+qq+空格+原因来给打回去重填");
                        return(Tools.At(qq) + "催促成功,还没回你就去找管理员");
                    }
                    else
                    {
                        return(Tools.At(qq) + "你已经有权限了,发送“激活”来获取权限吧");
                    }
                }
                else if (msg == "签到" || msg.IndexOf("[CQ:sign,") != -1)
                {
                    string last_time = XmlSolve.xml_get("daily_mc_sign_in_time", qq);

                    if (last_time == System.DateTime.Today.ToString())
                    {
                        return(Tools.At(qq) + "你今天已经签过到啦!");
                    }

                    string qdTimesStr = XmlSolve.xml_get("daily_sign_in_count", qq);
                    string CoinStr    = XmlSolve.xml_get("money", qq);

                    int CoinsTemp, qdTimesTemp;

                    if (CoinStr != "")
                    {
                        CoinsTemp = int.Parse(CoinStr);
                    }
                    else
                    {
                        CoinsTemp = 0;
                    }

                    if (qdTimesStr != "")
                    {
                        qdTimesTemp = int.Parse(qdTimesStr);
                    }
                    else
                    {
                        qdTimesTemp = 1;
                    }

                    if (last_time == System.DateTime.Today.AddDays(-1).ToString())
                    {
                        qdTimesTemp++;
                    }
                    else
                    {
                        qdTimesTemp = 1;
                    }

                    Random ran     = new Random(System.DateTime.Now.Millisecond);
                    int    RandKey = ran.Next(100, 501);
                    CoinsTemp += RandKey + qdTimesTemp * 5;

                    XmlSolve.del("money", qq);
                    XmlSolve.del("daily_mc_sign_in_time", qq);
                    XmlSolve.del("daily_sign_in_count", qq);
                    XmlSolve.insert("money", qq, CoinsTemp.ToString());
                    XmlSolve.insert("daily_sign_in_count", qq, qdTimesTemp.ToString());
                    XmlSolve.insert("daily_mc_sign_in_time", qq, System.DateTime.Today.ToString());
                    Tools.AddXmlNumber("daily_sign_in_count_all", System.DateTime.Today.ToString(), 1);

                    return(Tools.At(qq) + "\r\n签到成功!已连续签到" + qdTimesTemp.ToString() + "天\r\n获得游戏币" + RandKey + "+" + qdTimesTemp.ToString() + "*5枚!\r\n银行内游戏币" + CoinsTemp + "枚\r\n取钱请回复“取钱”加金额\r\n发送“查询”可查询余额");
                }
                else if (msg == "查询")
                {
                    string CoinStr = XmlSolve.xml_get("money", qq);
                    if (CoinStr != "")
                    {
                        return(Tools.At(qq) + "你的群内余额为" + CoinStr);
                    }
                    else
                    {
                        return(Tools.At(qq) + "你的群内余额为0");
                    }
                }
                else if (msg.IndexOf("取钱") == 0)
                {
                    int CoinsTemp = 0;
                    try
                    {
                        CoinsTemp = int.Parse(Tools.GetNumber(msg));
                    }
                    catch
                    {
                        return(Tools.At(qq) + "格式错误!");
                    }
                    if (CoinsTemp == 0)
                    {
                        return(Tools.At(qq) + "请输入大于0的数字");
                    }

                    string CoinStr = XmlSolve.xml_get("money", qq);
                    if (CoinStr != "")
                    {
                        int CoinsHave = int.Parse(CoinStr);
                        if (CoinsHave < CoinsTemp)
                        {
                            return(Tools.At(qq) + "你的钱不够");
                        }

                        CoinsHave -= CoinsTemp;
                        XmlSolve.del("money", qq);
                        XmlSolve.insert("money", qq, CoinsHave.ToString());
                        _mahuaApi.SendPrivateMessage(qq, "请在服务器中使用/code " +
                                                     GetCode("eco give " + player + " " + CoinsTemp.ToString()) +
                                                     "来领取取出的" + CoinsTemp + "金币");
                        return(Tools.At(qq) + "已取出" + CoinsTemp + "金币");
                    }
                    else
                    {
                        return(Tools.At(qq) + "你的钱不够");
                    }
                }
            }
            return("");
        }
示例#11
0
        /// <summary>
        /// 处理管理群消息
        /// </summary>
        /// <param name="qq"></param>
        /// <param name="msg"></param>
        /// <param name="_mahuaApi"></param>
        /// <returns></returns>
        public static string SolveAdmin(string qq, string msg, IMahuaApi _mahuaApi)
        {
            if (msg.IndexOf("删除") == 0)
            {
                if (msg.Replace("删除", "") != "")
                {
                    XmlSolve.del("bind_qq_wait", msg.Replace("删除", ""));
                    XmlSolve.del("bind_qq", msg.Replace("删除", ""));
                    return("已删除QQ:" + msg.Replace("删除", "") + "所绑定的id。");
                }
            }
            else if (msg.IndexOf("通过") == 0)
            {
                string player = XmlSolve.xml_get("bind_qq_wait", msg.Replace("通过", ""));
                if (player != "")
                {
                    XmlSolve.del("bind_qq_wait", msg.Replace("通过", ""));
                    XmlSolve.insert("bind_qq", msg.Replace("通过", ""), player);
                    _mahuaApi.SendGroupMessage("241464054", Tools.At(msg.Replace("通过", "")) + "你的白名单申请已经通过了哟~" +
                                               "\r\n在群里发送“激活”即可获取激活账号的方法哦~" +
                                               "\r\n你的id:" + player);
                    return("已通过QQ:" + msg.Replace("通过", "") + ",id:" + player + "的白名单申请");
                }
                else
                {
                    return("参数不对或该玩家不在待审核玩家数据中");
                }
            }
            else if (msg.IndexOf("不通过") == 0)
            {
                if (msg.IndexOf("不通过 ") == 0)
                {
                    return("命令关键字后不要加空格,直接加玩家id");
                }
                string player = "";
                string reason = "";
                string qq_get = "";
                int    len    = msg.Replace("不通过", "").IndexOf(":");
                if (len >= 0)
                {
                    player = XmlSolve.xml_get("bind_qq_wait", msg.Replace("不通过", "").Substring(0, len));
                    reason = msg.Replace("不通过", "").Substring(len + 1);
                }

                if (player != "")
                {
                    _mahuaApi.SendGroupMessage("241464054", Tools.At(qq_get) + "你的白名单申请并没有通过。" +
                                               "\r\n原因:" + reason +
                                               "\r\n请按照原因重新填写白名单:https://wj.qq.com/s/1308067/143c" +
                                               "\r\n你的id:" + player);
                    return("已不通过QQ:" + qq_get + ",id:" + player + "的白名单申请,原因:" + reason);
                }
                else
                {
                    return("参数不对或该玩家不在待审核玩家数据中");
                }
            }
            else if (msg == "空间")
            {
                return
                    ("服务器盘剩余空间:" + ((float)GetHardDiskFreeSpace("D") / 1024).ToString(".00") + "GB\r\n" +
                     "备份盘剩余空间:" + ((float)GetHardDiskFreeSpace("E") / 1024).ToString(".00") + "GB");
            }
            else if (msg == "即时备份" && qq == Tools.adminNumber)
            {
                System.Diagnostics.Process.Start(@"D:\backup.bat");
                return("备份任务已开始");  //567145439
            }
            else if (msg.IndexOf("命令") == 0)
            {
                return("命令/" + msg.Replace("命令", "") + "的执行码为:/code " + GetCode(msg.Replace("命令", "")));
            }
            return("");
        }
示例#12
0
        /// <summary>
        /// 获取网址前缀
        /// </summary>
        /// <returns></returns>
        public static string GetUrl()
        {
            string url = XmlSolve.ReplayGroupStatic("common", "javliburl");//获取保存的url

            return(url);
        }
示例#13
0
 /// <summary>
 /// 将xml值更改为指定值
 /// </summary>
 /// <param name="xml"></param>
 /// <param name="info"></param>
 /// <param name="add"></param>
 public static void SetXmlString(string xml, string info, string str)
 {
     XmlSolve.del(xml, info);
     XmlSolve.insert(xml, info, str);
 }
示例#14
0
 /// <summary>
 /// 获取xml存储的字符串
 /// </summary>
 /// <param name="xml"></param>
 /// <param name="info"></param>
 /// <returns></returns>
 public static string GetXmlString(string xml, string info)
 {
     return(XmlSolve.xml_get(xml, info));
 }