Exemple #1
0
        public static bool CostMoney(GameClient client, int moneyType, int modifyValue, ref string strCostList, string logMsg, bool consume = true)
        {
            bool subRes = false;

            if (moneyType <= 50)
            {
                if (moneyType <= 8)
                {
                    if (moneyType == 1)
                    {
                        int useJinBi    = modifyValue;
                        int useYinLiang = 0;
                        if (modifyValue > client.ClientData.Money1)
                        {
                            useJinBi    = client.ClientData.Money1;
                            useYinLiang = modifyValue - useJinBi;
                        }
                        subRes = GameManager.ClientMgr.SubMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, useJinBi, logMsg);
                        if (subRes)
                        {
                            strCostList += EventLogManager.AddResPropString(strCostList, (ResLogType)moneyType, new object[]
                            {
                                -useJinBi
                            });
                            if (useYinLiang > 0)
                            {
                                subRes = GameManager.ClientMgr.SubUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, useYinLiang, logMsg, false);
                                if (subRes)
                                {
                                    strCostList += EventLogManager.AddResPropString(strCostList, ResLogType.ZuanShi, new object[]
                                    {
                                        -useYinLiang
                                    });
                                }
                            }
                        }
                        return(subRes);
                    }
                    if (moneyType == 8)
                    {
                        subRes = GameManager.ClientMgr.SubUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, modifyValue, logMsg, false);
                        goto IL_425;
                    }
                }
                else
                {
                    switch (moneyType)
                    {
                    case 13:
                        subRes = GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, -modifyValue, logMsg, true, true, false);
                        goto IL_425;

                    case 14:
                        break;

                    case 15:
                        subRes = Global.AddZaJinDanJiFen(client, -modifyValue, logMsg, false);
                        goto IL_425;

                    default:
                        if (moneyType == 40)
                        {
                            subRes = GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, modifyValue, logMsg, true, true, false, DaiBiSySType.None);
                            goto IL_425;
                        }
                        if (moneyType == 50)
                        {
                            subRes = GameManager.ClientMgr.SubUserGold(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, modifyValue, logMsg, false);
                            goto IL_425;
                        }
                        break;
                    }
                }
            }
            else if (moneyType <= 120)
            {
                switch (moneyType)
                {
                case 99:
                    subRes = true;
                    GameManager.ClientMgr.ModifyLangHunFenMoValue(client, -modifyValue, logMsg, true, true);
                    goto IL_425;

                case 100:
                case 102:
                case 103:
                case 104:
                case 105:
                    break;

                case 101:
                    subRes = GameManager.ClientMgr.ModifyZaiZaoValue(client, -modifyValue, logMsg, true, true, false);
                    goto IL_425;

                case 106:
                    subRes = GameManager.ClientMgr.ModifyMUMoHeValue(client, -modifyValue, logMsg, true, true, false);
                    goto IL_425;

                case 107:
                    subRes = GameManager.ClientMgr.ModifyYuanSuFenMoValue(client, -modifyValue, logMsg, true, false);
                    goto IL_425;

                case 108:
                    subRes = true;
                    SingletonTemplate <GuardStatueManager> .Instance().AddGuardPoint(client, -modifyValue, logMsg);

                    goto IL_425;

                case 109:
                    subRes = GameManager.FluorescentGemMgr.DecFluorescentPoint(client, modifyValue, logMsg, false);
                    goto IL_425;

                default:
                    switch (moneyType)
                    {
                    case 119:
                        subRes = GameManager.ClientMgr.ModifyOrnamentCharmPointValue(client, -modifyValue, logMsg, true, true, false);
                        goto IL_425;

                    case 120:
                        subRes = true;
                        GameManager.ClientMgr.ModifyShenLiJingHuaPointsValue(client, -modifyValue, logMsg, true, true);
                        goto IL_425;
                    }
                    break;
                }
            }
            else
            {
                switch (moneyType)
                {
                case 129:
                    subRes = GameManager.ClientMgr.ModifyFuWenZhiChenPointsValue(client, -modifyValue, logMsg, true, true, false);
                    goto IL_425;

                case 130:
                    subRes = GameManager.ClientMgr.ModifyAlchemyElementValue(client, -modifyValue, logMsg, true, false);
                    goto IL_425;

                case 131:
                    break;

                case 132:
                    subRes = GameManager.ClientMgr.ModifyJueXingValue(client, -modifyValue, logMsg, false);
                    goto IL_425;

                case 133:
                    subRes = GameManager.ClientMgr.ModifyJueXingZhiChenValue(client, -modifyValue, logMsg, true, true, false);
                    goto IL_425;

                default:
                    switch (moneyType)
                    {
                    case 139:
                        subRes = GameManager.ClientMgr.ModifyHunJingValue(client, -modifyValue, logMsg, true, true, false);
                        goto IL_425;

                    case 140:
                        subRes = GameManager.ClientMgr.ModifyMountPointValue(client, -modifyValue, logMsg, true, true, false);
                        goto IL_425;

                    default:
                        if (moneyType == 163)
                        {
                            subRes = GameManager.ClientMgr.ModifyLuckStarValue(client, -modifyValue, logMsg, false, DaiBiSySType.None);
                            goto IL_425;
                        }
                        break;
                    }
                    break;
                }
            }
            LogManager.WriteLog(LogTypes.Error, " CheckHasMoney 不支持的货币类型:" + moneyType, null, true);
IL_425:
            if (subRes)
            {
                strCostList += EventLogManager.AddResPropString(strCostList, (ResLogType)moneyType, new object[]
                {
                    -modifyValue
                });
            }
            return(subRes);
        }