Exemplo n.º 1
0
 public static bool Cost(PersonData caster, double cost)
 {
     if (caster.ChaosCount < cost)
     {
         return(false);
     }
     DataRunTime.ChaosChange(caster.GroupQQ, caster.QQ, -cost);
     return(true);
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }