Exemplo 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);
     }
 }
Exemplo 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);
 }
Exemplo 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);
        }
Exemplo 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);
 }
Exemplo n.º 5
0
 public void BoCaiPriorityActivity(GameClient client)
 {
     BoCaiCaiShuZi.GetInstance().PriorityActivity(client);
     BoCaiCaiDaXiao.GetInstance().PriorityActivity(client);
 }
Exemplo n.º 6
0
 public void OldtterySet(int BoCaiType, long DataPeriods)
 {
     try
     {
         LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_博彩]处理历史开奖 BoCaiType={0}, 处理界限 DataPeriods={1}", BoCaiType, DataPeriods), null, true);
         GetOpenList DBData;
         if (!BoCaiManager.getInstance().GetOpenList2DB(BoCaiType, out DBData))
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("[ljl_博彩]处理历史开奖 读库失败 GetOpenList2DB BoCaiType={0}, DataPeriods={1}", BoCaiType, DataPeriods), null, true);
         }
         else
         {
             foreach (OpenLottery item in DBData.ItemList)
             {
                 OpenLottery Temp = item;
                 if (BoCaiType != 1)
                 {
                     if (BoCaiType == 2)
                     {
                         if (item.DataPeriods >= Convert.ToInt64(string.Format("{0}1", TimeUtil.NowDataTimeString("yyMMdd"))))
                         {
                             continue;
                         }
                     }
                 }
                 if (string.IsNullOrEmpty(item.strWinNum) || string.IsNullOrEmpty(item.WinInfo))
                 {
                     ReturnValue <List <OpenLottery> > Data = TcpCall.KFBoCaiManager.GetOpenLottery(BoCaiType, item.DataPeriods, true);
                     if (!Data.IsReturn)
                     {
                         return;
                     }
                     List <OpenLottery> kuafuList = Data.Value;
                     if (kuafuList == null || kuafuList.Count < 1)
                     {
                         continue;
                     }
                     Temp = kuafuList[0];
                 }
                 if (Temp != null && Temp.DataPeriods >= 1L && Temp.XiaoHaoDaiBi >= 0)
                 {
                     Global.Send2DB <OpenLottery>(2084, Temp, 0);
                     List <BuyBoCai2SDB> ItemList;
                     if (!BoCaiManager.getInstance().GetBuyList2DB(BoCaiType, Temp.DataPeriods, out ItemList, 2))
                     {
                         LogManager.WriteLog(LogTypes.Error, string.Format("[ljl_博彩]获取购买记录失败 BoCaiType={0},DataPeriods={1}", BoCaiType, Temp.DataPeriods), null, true);
                     }
                     else if (ItemList.Count < 1)
                     {
                         Temp.IsAward = true;
                         Global.Send2DB <OpenLottery>(2084, Temp, 0);
                         LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_博彩]还有0人没处理 完成处理历史开奖 BoCaiType={0}, DataPeriods={1}", BoCaiType, Temp.DataPeriods), null, true);
                         continue;
                     }
                     if (string.IsNullOrEmpty(Temp.strWinNum) || string.IsNullOrEmpty(Temp.WinInfo))
                     {
                         LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_博彩] 没有开过奖处理历史退回{0}", Temp.DataPeriods), null, true);
                         foreach (BuyBoCai2SDB buyItem in ItemList)
                         {
                             if (!this.ReturnItem(Temp, buyItem))
                             {
                                 Temp.IsAward = false;
                             }
                         }
                         if (Temp.IsAward)
                         {
                             Global.Send2DB <OpenLottery>(2084, Temp, 0);
                         }
                     }
                     else
                     {
                         LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_博彩]处理历史开奖{0}", Temp.DataPeriods), null, true);
                         foreach (BuyBoCai2SDB buyItem in ItemList)
                         {
                             if (buyItem.BocaiType == 1)
                             {
                                 string winType;
                                 double Rate = BoCaiCaiDaXiao.GetInstance().CompensateRate(Temp.strWinNum, Temp.WinInfo, out winType);
                                 if (Rate < 1.0)
                                 {
                                     LogManager.WriteLog(LogTypes.Info, "[ljl_博彩] 开奖 赔率 < 1 ", null, true);
                                 }
                                 else if (!this.SendWinItem(Temp, buyItem, Rate, true, winType))
                                 {
                                     Temp.IsAward = false;
                                 }
                             }
                             else if (buyItem.BocaiType == 2)
                             {
                                 if (!this.SendWinItem(Temp, buyItem))
                                 {
                                     Temp.IsAward = false;
                                 }
                             }
                             else
                             {
                                 Temp.IsAward = false;
                                 LogManager.WriteLog(LogTypes.Error, string.Format("[ljl_博彩]购买记录 类型不对 BoCaiType={0},DataPeriods={1}", BoCaiType, Temp.DataPeriods), null, true);
                             }
                         }
                         if (Temp.IsAward)
                         {
                             Global.Send2DB <OpenLottery>(2084, Temp, 0);
                         }
                     }
                 }
             }
             ReturnValue <List <OpenLottery> > KFData = TcpCall.KFBoCaiManager.GetOpenLottery(BoCaiType, DBData.MaxDataPeriods, false);
             if (KFData.IsReturn)
             {
                 List <OpenLottery> KuaFuList = KFData.Value;
                 if (null != KuaFuList)
                 {
                     foreach (OpenLottery item in KuaFuList)
                     {
                         Global.Send2DB <OpenLottery>(2084, item, 0);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
 }
Exemplo n.º 7
0
 private void BuyCaiDaXiao(GameClient client, int BuyNum, string strBuyVal, ref BuyBoCaiResult mgsData)
 {
     try
     {
         int value = Convert.ToInt32(strBuyVal);
         if (1 > value || value > 3 || BuyNum < 1)
         {
             mgsData.Info = 2;
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩]BuyCaiDaXiao 购买内容 {0}, BuyNum={1} ", strBuyVal, BuyNum), null, true);
         }
         else if (!BoCaiCaiDaXiao.GetInstance().IsCanBuy())
         {
             mgsData.Info = 7;
         }
         else
         {
             ReturnValue <bool> msgData = TcpCall.KFBoCaiManager.IsCanBuy(1, strBuyVal, BuyNum + BoCaiCaiDaXiao.GetInstance().GetBuyNum(client.ClientData.RoleID), BoCaiCaiDaXiao.GetInstance().GetDataPeriods());
             if (!msgData.IsReturn)
             {
                 mgsData.Info = 8;
             }
             else if (!msgData.Value)
             {
                 mgsData.Info = 7;
             }
             else
             {
                 int useItemNum = BoCaiCaiDaXiao.GetInstance().GetXiaoHaoDaiBi() * BuyNum;
                 if (useItemNum < 1)
                 {
                     mgsData.Info = 3;
                     LogManager.WriteLog(LogTypes.Error, "[ljl_博彩]XiaoHaoDaiBi /GuDingLeiXing<1", null, true);
                 }
                 else if (!HuanLeDaiBiManager.GetInstance().HuanledaibiEnough(client, useItemNum))
                 {
                     mgsData.Info = 4;
                 }
                 else
                 {
                     int          allNum = BuyNum;
                     BuyBoCai2SDB DbData = BoCaiCaiDaXiao.GetInstance().BuyBocai(client, BuyNum, strBuyVal, ref allNum);
                     if (null == DbData)
                     {
                         mgsData.Info = 8;
                         BoCaiCaiDaXiao.GetInstance().BuyBocai(client, -BuyNum, strBuyVal, ref allNum);
                         LogManager.WriteLog(LogTypes.Error, "[ljl_博彩]BoCaiCaiDaXiao.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 = 1,
                             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);
                             BoCaiCaiDaXiao.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);
     }
 }