コード例 #1
0
ファイル: Filter.cs プロジェクト: noobdawn/QQGroup_POE
/*
 * [禁用]%侦测 @目标:查询目标的属性
 * [禁用]%升级:查看可升级的属性
 * [禁用]%升级 属性id:升级对应属性"*/

        public static SendParam MakeParam(string groupQQ, string qq, string content)
        {
            if (content == "%帮助")
            {
                _S.Response(groupQQ, qq, HELP_TEXT);
                return(null);
            }
            //防止刷屏,滤除短长度的内容
            if (!content.StartsWith("%") && content.Length < 6)
            {
                return(null);
            }
            SendParam param = new SendParam();

            param.GroupQQ = groupQQ;
            param.QQ      = qq;
            param.content = content;
            param.param   = content.Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            param.caster  = DataRunTime.GetPerson_Add(groupQQ, qq);
            param.target  = null;
            if (param.param.Length > 1)
            {
                if (param.param[1].Length >= 10)
                {
                    string otherqq = param.param[1].Substring(7);
                    otherqq = otherqq.Substring(0, otherqq.Length - 1);
                    long t;
                    if (long.TryParse(otherqq, out t))
                    {
                        param.target = DataRunTime.GetPerson_Add(param.GroupQQ, otherqq);
                    }
                }
            }
            return(param);
        }
コード例 #2
0
 private void AutoAdd(object sender, ElapsedEventArgs e)
 {
     time++;
     if (time > 60)
     {
         DataRunTime.ChaosStep();
         time -= 60;
     }
 }
コード例 #3
0
ファイル: Support.cs プロジェクト: noobdawn/QQGroup_POE
 public static bool Cost(PersonData caster, double cost)
 {
     if (caster.ChaosCount < cost)
     {
         return(false);
     }
     DataRunTime.ChaosChange(caster.GroupQQ, caster.QQ, -cost);
     return(true);
 }
コード例 #4
0
ファイル: IRQQMain.cs プロジェクト: noobdawn/QQGroup_POE
 ///插件即将被销毁
 public static int IR_DestroyPlugin()
 {
     Timeslice.Close();
     if (modules != null)
     {
         for (int i = 0; i < modules.Length; i++)
         {
             modules[i] = null;
         }
     }
     DataRunTime.Save();
     return(0);
 }
コード例 #5
0
ファイル: Repeat.cs プロジェクト: noobdawn/QQGroup_POE
        public bool WhenParamIn(SendParam param)
        {
            string p = param.GroupQQ + param.QQ;

            if (GQplusQQ == p)
            {
                RepeatTimes++;
            }
            GQplusQQ = p;
            if (RepeatTimes >= 5)
            {
                DataRunTime.ChaosChange(param.GroupQQ, param.QQ, -3);
                _S.Response(param.GroupQQ, param.QQ, "Response_to_Repeat", param.QQ, 3);
                return(false);
            }
            return(true);
        }
コード例 #6
0
 public bool WhenParamIn(SendParam param)
 {
     //命令
     if (param.param[0] == _S.GetText("Command_to_Statistics") && param.param.Length == 1)
     {
         StringBuilder builder = new StringBuilder();
         builder.AppendLine(_S.GetText("Response_to_Statistics"));
         var result = DataRunTime.GetTop(param.GroupQQ);
         for (int i = 0; i < Math.Min(5, result.Count); i++)
         {
             builder.AppendLine(_S.GetText("Response_to_Query", result[i].NickName, result[i].ChaosCount, result[i].ExCount));
         }
         builder.AppendLine(_S.GetText("Response_to_Statistics_1"));
         _S.Response(param.GroupQQ, param.QQ, builder.ToString());
     }
     return(true);
 }
コード例 #7
0
ファイル: IRQQMain.cs プロジェクト: noobdawn/QQGroup_POE
        public static string IR_Create()
        {
            LitJson.JsonData j        = new LitJson.JsonData();
            string           szBuffer = "插件名称{" + pluginName + "}\n插件版本{" + pluginVersion + "}\n插件作者{" + pluginAuthor + "}\n插件说明{" + pluginDescribe + "}\n插件skey{" + pluginSkey + "}插件sdk{" + pluginSdk + "}";

            Timeslice.Open();
            DataRunTime.Load();
            _S.InitLocalization();
            modules = new IModule[]
            {
                new Statistics(),
                //new Arena(),
                new SomeAPI(),
                new Stock(),
                new Bank(),
            };
            return(szBuffer);
        }
コード例 #8
0
        public bool WhenParamIn(SendParam param)
        {
            //低保
            DataRunTime.ChaosChange(param.GroupQQ, param.QQ, 1);
            //随机
            int rand   = _S.RandomInt(0, 10000);
            int rdCoin = 0;

            if (rand <= 1)
            {
                rdCoin = _S.RandomInt(1000, 3000);
                DataRunTime.ChaosChange(param.GroupQQ, param.QQ, rdCoin);
                _S.Response(param.GroupQQ, param.QQ, "GoodLuck_2", param.caster.QQ, rdCoin);
            }
            else if (rand <= 50)
            {
                rdCoin = _S.RandomInt(50, 150);
                DataRunTime.ChaosChange(param.GroupQQ, param.QQ, rdCoin);
                _S.Response(param.GroupQQ, param.QQ, "GoodLuck_1", param.caster.QQ, rdCoin);
            }
            else if (rand <= 300)
            {
                rdCoin = _S.RandomInt(20, 50);
                DataRunTime.ChaosChange(param.GroupQQ, param.QQ, rdCoin);
                _S.Response(param.GroupQQ, param.QQ, "GoodLuck_0", param.caster.QQ, rdCoin);
            }
            //命令
            if (param.param[0] == _S.GetText("Command_to_Query") && param.target == null)
            {
                _S.Response(param.GroupQQ, param.QQ, "Response_to_Query", param.caster.NickName, param.caster.ChaosCount, param.caster.ExCount);
            }
            if (param.param[0] == _S.GetText("Command_to_Query_Other") && param.target != null)
            {
                _S.Response(param.GroupQQ, param.QQ, "Response_to_Query", param.target.NickName, param.target.ChaosCount, param.target.ExCount);
            }
            //GM
            //if (param.param[0] == _S.GetText("Command_to_GMAdd") && param.QQ == Config.God)
            //{
            //    int count = int.Parse(param.param[1]);
            //    DataRunTime.GMChaos(param.GroupQQ, count);
            //    _S.Response(param.GroupQQ, param.QQ, "Response_to_GMAdd", count);
            //}
            return(true);
        }
コード例 #9
0
ファイル: Support.cs プロジェクト: noobdawn/QQGroup_POE
        public static double[] Damage(PersonData caster, PersonData target, double dmg, bool allowHealCaster, bool hurtSelf = false)
        {
            double[] result = new double[2];
            if (caster.GroupQQ != target.GroupQQ)
            {
                return(result);
            }
            if (!hurtSelf && caster.QQ == target.QQ)
            {
                return(result);
            }
            double realLost = DataRunTime.ChaosChange(target.GroupQQ, target.QQ, -dmg);
            int    recover  = (int)(Math.Abs(realLost) * _S.GetPropertyValue((int)EnumProperty.HealSelf, (int)(caster.Properties[(int)EnumProperty.HealSelf])));

            DataRunTime.ChaosChange(caster.GroupQQ, caster.QQ, recover);
            result[0] = realLost;
            result[1] = recover;
            return(result);
        }
コード例 #10
0
ファイル: Stock.cs プロジェクト: noobdawn/QQGroup_POE
        public bool WhenParamIn(SendParam param)
        {
            //if (!done) return true;
            var taxrate = GetTax(param.caster);

            if (param.param[0] == _S.GetText("Command_to_QueryStock") && param.param.Length == 1)
            {
                _S.Response(param.GroupQQ, param.QQ, "Response_to_QueryStockPerson", curExPrice, param.QQ, (int)(taxrate * 100));
                //_S.Response(param.GroupQQ, param.QQ, intro);
                return(false);
            }
            int opCnt;
            int realCost;

            if (param.param[0] == _S.GetText("Command_to_Buy") && param.param.Length == 1)
            {
                opCnt = (int)Math.Floor(param.caster.ChaosCount / (curExPrice * (1 + taxrate)));
                if (opCnt == 0)
                {
                    return(false);
                }
                realCost = (int)Math.Ceiling(opCnt * curExPrice * (1 + taxrate));
                if (_S.Cost(param.caster, realCost))
                {
                    DataRunTime.ExChange(param.GroupQQ, param.QQ, opCnt);
                    ExStockChange(opCnt);
                    TaxAdd(param.caster);
                    _S.Response(param.GroupQQ, param.QQ, "Response_to_StockOp", param.caster.QQ, param.caster.ChaosCount, param.caster.ExCount);
                }
                return(false);
            }
            if (param.param[0] == _S.GetText("Command_to_Buy") && param.param.Length == 2 && int.TryParse(param.param[1], out opCnt))
            {
                if (opCnt <= 0)
                {
                    return(false);
                }
                realCost = (int)Math.Ceiling(opCnt * curExPrice * (1 + taxrate));
                if (_S.Cost(param.caster, realCost))
                {
                    DataRunTime.ExChange(param.GroupQQ, param.QQ, opCnt);
                    ExStockChange(opCnt);
                    TaxAdd(param.caster);
                    _S.Response(param.GroupQQ, param.QQ, "Response_to_StockOp", param.caster.QQ, param.caster.ChaosCount, param.caster.ExCount);
                }
                return(false);
            }
            if (param.param[0] == _S.GetText("Command_to_Sell") && param.param.Length == 1)
            {
                opCnt = param.caster.ExCount;
                if (opCnt == 0)
                {
                    return(false);
                }
                opCnt    = -opCnt;
                realCost = Math.Abs((int)Math.Floor(opCnt * curExPrice * (1 - taxrate)));
                DataRunTime.ExChange(param.GroupQQ, param.QQ, opCnt);
                DataRunTime.ChaosChange(param.GroupQQ, param.QQ, realCost);
                ExStockChange(opCnt);
                TaxAdd(param.caster);
                _S.Response(param.GroupQQ, param.QQ, "Response_to_StockOp", param.caster.QQ, param.caster.ChaosCount, param.caster.ExCount);
                return(false);
            }
            if (param.param[0] == _S.GetText("Command_to_Sell") && param.param.Length == 2 && int.TryParse(param.param[1], out opCnt))
            {
                if (opCnt <= 0)
                {
                    return(false);
                }
                if (opCnt > param.caster.ExCount)
                {
                    return(false);
                }
                opCnt    = -opCnt;
                realCost = Math.Abs((int)Math.Floor(opCnt * curExPrice * (1 - taxrate)));
                DataRunTime.ExChange(param.GroupQQ, param.QQ, opCnt);
                DataRunTime.ChaosChange(param.GroupQQ, param.QQ, realCost);
                ExStockChange(opCnt);
                TaxAdd(param.caster);
                _S.Response(param.GroupQQ, param.QQ, "Response_to_StockOp", param.caster.QQ, param.caster.ChaosCount, param.caster.ExCount);
                return(false);
            }
            return(true);
        }