Esempio n. 1
0
 private void GetBoCai(GameClient client, int nID, string[] cmdParams, ref GetBoCaiResult mgsData)
 {
     try
     {
         int BocaiType = Convert.ToInt32(cmdParams[1]);
         mgsData.Info      = 0;
         mgsData.BocaiType = BocaiType;
         if (2 == BocaiType)
         {
             FunctionSendManager.GetInstance().AddFunction(FunctionType.CaiShuZi, client.ClientData.RoleID);
             BoCaiCaiShuZi.GetInstance().OpenGetBoCai(client.ClientData.RoleID, ref mgsData);
         }
         else if (1 == BocaiType)
         {
             FunctionSendManager.GetInstance().AddFunction(FunctionType.CaiDaXiao, client.ClientData.RoleID);
             BoCaiCaiDaXiao.GetInstance().OpenGetBoCai(client.ClientData.RoleID, ref mgsData);
         }
         else
         {
             mgsData.Info = 1;
         }
     }
     catch (Exception ex)
     {
         mgsData.Info = 100;
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
 }
Esempio n. 2
0
 public bool startup()
 {
     TCPCmdDispatcher.getInstance().registerProcessorEx(2082, 4, 4, BoCaiManager.getInstance(), TCPCmdFlags.IsStringArrayParams);
     TCPCmdDispatcher.getInstance().registerProcessorEx(2083, 2, 2, BoCaiManager.getInstance(), TCPCmdFlags.IsStringArrayParams);
     TCPCmdDispatcher.getInstance().registerProcessorEx(2085, 1, 1, BoCaiManager.getInstance(), TCPCmdFlags.IsStringArrayParams);
     TCPCmdDispatcher.getInstance().registerProcessorEx(2086, 4, 4, BoCaiManager.getInstance(), TCPCmdFlags.IsStringArrayParams);
     this.NotifyEnterHandler1 = new EventSourceEx <KFCallMsg> .HandlerData
     {
         ID        = 0,
         EventType = 10039,
         Handler   = new Func <KFCallMsg, bool>(this.KFCallMsgFunc)
     };
     this.NotifyEnterHandler2 = new EventSourceEx <KFCallMsg> .HandlerData
     {
         ID        = 0,
         EventType = 10040,
         Handler   = new Func <KFCallMsg, bool>(this.KFCallMsgFunc)
     };
     KFCallManager.MsgSource.registerListener(10039, this.NotifyEnterHandler1);
     KFCallManager.MsgSource.registerListener(10040, this.NotifyEnterHandler2);
     BoCaiCaiShuZi.GetInstance().Init();
     BoCaiCaiDaXiao.GetInstance().Init();
     BoCaiShopManager.GetInstance().Init();
     return(true);
 }
Esempio n. 3
0
        public bool KFCallMsgFunc(KFCallMsg msg)
        {
            try
            {
                switch (msg.KuaFuEventType)
                {
                case 10039:
                {
                    KFStageData data = msg.Get <KFStageData>();
                    if (null != data)
                    {
                        if (data.BoCaiType == BoCaiTypeEnum.Bocai_CaiShuzi)
                        {
                            BoCaiCaiShuZi.GetInstance().SetStageData(data, true);
                        }
                        else if (data.BoCaiType == BoCaiTypeEnum.Bocai_Dice)
                        {
                            BoCaiCaiDaXiao.GetInstance().SetStageData(data, true);
                        }
                    }
                    else
                    {
                        BoCaiCaiDaXiao.GetInstance().SetStageData(data, true);
                        BoCaiCaiShuZi.GetInstance().SetStageData(data, true);
                    }
                    break;
                }

                case 10040:
                {
                    OpenLottery data2 = msg.Get <OpenLottery>();
                    if (null != data2)
                    {
                        if (data2.BocaiType == 2)
                        {
                            BoCaiCaiShuZi.GetInstance().SetOpenLotteryData(data2, false, false);
                        }
                        else if (data2.BocaiType == 1)
                        {
                            BoCaiCaiDaXiao.GetInstance().SetOpenLotteryData(data2, false, true);
                        }
                    }
                    else
                    {
                        BoCaiCaiDaXiao.GetInstance().SetOpenLotteryData(data2, false, true);
                        BoCaiCaiShuZi.GetInstance().SetOpenLotteryData(data2, false, false);
                    }
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]跨服消息{0}", ex.ToString()), null, true);
            }
            return(true);
        }
Esempio n. 4
0
 public static int LoadConfig(bool isReload = true)
 {
     try
     {
         List <CaiShuZiConfig> _CaiShuZiCfgList;
         BoCaiConfigMgr.LoadCaiShuZi(out _CaiShuZiCfgList);
         List <CaiDaXiaoConfig> _CaiDaXiaoCfgList;
         BoCaiConfigMgr.LoadCaiDaXiao(out _CaiDaXiaoCfgList);
         List <BoCaiConfigMgr.DaiBiShiYongData> _DaiBiShiYongCfgList;
         BoCaiConfigMgr.LoadDaiBiShiYong(out _DaiBiShiYongCfgList);
         List <DuiHuanShangChengConfig> _DuiHuanShangChengCgfList;
         BoCaiConfigMgr.Load_DuiHuanShangCheng(out _DuiHuanShangChengCgfList);
         lock (BoCaiConfigMgr.CaiShuZiCfgList)
         {
             BoCaiConfigMgr.CaiShuZiCfgList = _CaiShuZiCfgList;
         }
         lock (BoCaiConfigMgr.CaiDaXiaoCfgList)
         {
             BoCaiConfigMgr.CaiDaXiaoCfgList = _CaiDaXiaoCfgList;
         }
         lock (BoCaiConfigMgr.DaiBiShiYongCfgList)
         {
             BoCaiConfigMgr.DaiBiShiYongCfgList = _DaiBiShiYongCfgList;
         }
         lock (BoCaiConfigMgr.DuiHuanShangChengCgfList)
         {
             BoCaiConfigMgr.DuiHuanShangChengCgfList = _DuiHuanShangChengCgfList;
         }
         if (isReload)
         {
             BoCaiCaiDaXiao.GetInstance().BigTimeUpData(true);
             BoCaiCaiShuZi.GetInstance().BigTimeUpData(true);
         }
         return(1);
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
     return(0);
 }
Esempio n. 5
0
 public void BoCaiPriorityActivity(GameClient client)
 {
     BoCaiCaiShuZi.GetInstance().PriorityActivity(client);
     BoCaiCaiDaXiao.GetInstance().PriorityActivity(client);
 }
Esempio n. 6
0
 private void BuyCaiShuzi(GameClient client, int BuyNum, string strBuyVal, ref BuyBoCaiResult mgsData)
 {
     try
     {
         List <int> buyList;
         BoCaiHelper.String2ListInt(strBuyVal, out buyList);
         if (buyList.Count != 5 || BuyNum < 1)
         {
             mgsData.Info = 2;
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩] BuyCaiShuzi 购买内容 {0}, BuyNum={1} ", strBuyVal, BuyNum), null, true);
         }
         else
         {
             for (int i = 0; i < buyList.Count; i++)
             {
                 if (buyList[i] > 9 || buyList[i] < 0)
                 {
                     mgsData.Info = 2;
                     return;
                 }
             }
             if (!BoCaiCaiShuZi.GetInstance().IsCanBuy())
             {
                 mgsData.Info = 7;
             }
             else
             {
                 ReturnValue <bool> msgData = TcpCall.KFBoCaiManager.IsCanBuy(2, strBuyVal, BuyNum, BoCaiCaiShuZi.GetInstance().GetDataPeriods());
                 if (!msgData.IsReturn)
                 {
                     mgsData.Info = 8;
                 }
                 else if (!msgData.Value)
                 {
                     mgsData.Info = 5;
                 }
                 else
                 {
                     int XiaoHaoDaiBi = BoCaiCaiShuZi.GetInstance().GetXiaoHaoDaiBi();
                     if (XiaoHaoDaiBi < 1)
                     {
                         mgsData.Info = 3;
                         LogManager.WriteLog(LogTypes.Error, "[ljl_博彩]XiaoHaoDaiBi /GuDingLeiXing<1", null, true);
                     }
                     else
                     {
                         int useItemNum = BuyNum * XiaoHaoDaiBi;
                         if (!HuanLeDaiBiManager.GetInstance().HuanledaibiEnough(client, useItemNum))
                         {
                             mgsData.Info = 4;
                         }
                         else
                         {
                             int          allNum = BuyNum;
                             BuyBoCai2SDB DbData = BoCaiCaiShuZi.GetInstance().BuyBocai(client, BuyNum, strBuyVal, ref allNum);
                             if (null == DbData)
                             {
                                 mgsData.Info = 8;
                                 BoCaiCaiShuZi.GetInstance().BuyBocai(client, -BuyNum, strBuyVal, ref allNum);
                                 LogManager.WriteLog(LogTypes.Error, "[ljl_博彩]BoCaiCaiShuZi.GetInstance().BuyBocai err", null, true);
                             }
                             else if (!HuanLeDaiBiManager.GetInstance().UseHuanledaibi(client, useItemNum))
                             {
                                 mgsData.Info = 4;
                             }
                             else
                             {
                                 ReturnValue <bool> msgData2 = TcpCall.KFBoCaiManager.BuyBoCai(new KFBuyBocaiData
                                 {
                                     BocaiType = 2,
                                     RoleID    = DbData.m_RoleID,
                                     RoleName  = DbData.m_RoleName,
                                     ZoneID    = DbData.ZoneID,
                                     ServerID  = DbData.ServerId,
                                     BuyNum    = DbData.BuyNum,
                                     BuyValue  = DbData.strBuyValue
                                 });
                                 if (!msgData2.IsReturn)
                                 {
                                     mgsData.Info = 8;
                                 }
                                 else if (!msgData2.Value)
                                 {
                                     GameManager.logDBCmdMgr.AddMessageLog(-1, "欢乐代币", "购买失败扣物品成功中心2次通信", client.ClientData.RoleName, client.ClientData.RoleName, "减少", useItemNum, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId, "");
                                     mgsData.Info = 5;
                                 }
                                 else
                                 {
                                     DbData.BuyNum = allNum;
                                     BoCaiBuy2DBList.getInstance().AddData(DbData, useItemNum, true);
                                     BoCaiCaiShuZi.GetInstance().CopyBuyList(out mgsData.ItemList, DbData.m_RoleID);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         mgsData.Info = 100;
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
 }