Beispiel #1
0
 private bool ReturnItem(OpenLottery data, BuyBoCai2SDB buyItem)
 {
     try
     {
         buyItem.IsSend = true;
         BoCaiBuy2DBList.getInstance().AddData(buyItem, 0, false);
         if (!"True".Equals(Global.Send2DB <BuyBoCai2SDB>(2082, buyItem, 0)))
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩]更新数据库标志失败,返回道具,没关系 线程会自动处理旧数据,{0},{1}", buyItem.m_RoleName, buyItem.DataPeriods), null, true);
             return(false);
         }
         int    returnNum = buyItem.BuyNum * data.XiaoHaoDaiBi;
         string strTitle  = "猜大小";
         if (buyItem.BocaiType == 2)
         {
             strTitle = "猜数字";
         }
         string           strIntro  = string.Format("因系统维护原因导致{0}期{1}玩法没有正常开奖,系统将返还您当期下注的欢乐代币。", buyItem.DataPeriods, strTitle);
         List <GoodsData> goodsData = new List <GoodsData>
         {
             HuanLeDaiBiManager.GetInstance().GetHuanLeDaiBi(returnNum)
         };
         return(this.SendMail(buyItem, goodsData, strTitle, strIntro, returnNum, false));
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
     return(false);
 }
Beispiel #2
0
 public bool SendWinItem(OpenLottery data, BuyBoCai2SDB buyItem)
 {
     try
     {
         buyItem.IsSend = true;
         string[] files = data.WinInfo.Split(new char[]
         {
             ','
         });
         List <int> winList;
         BoCaiHelper.String2ListInt(data.strWinNum, out winList);
         int        No1Win = Convert.ToInt32(files[0]);
         int        No2Win = Convert.ToInt32(files[1]);
         int        No3Win = Convert.ToInt32(files[2]);
         List <int> selfBuy;
         BoCaiHelper.String2ListInt(buyItem.strBuyValue, out selfBuy);
         if (selfBuy.Count != winList.Count)
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("[ljl_博彩]selfBuy.Count != winList.Count DataPeriods={0}, type={1}, roleid={2}", data.DataPeriods, data.BocaiType, buyItem.m_RoleID), null, true);
             return(false);
         }
         int sameNum = 0;
         for (int i = 0; i < selfBuy.Count; i++)
         {
             if (selfBuy[i] == winList[i])
             {
                 sameNum++;
             }
         }
         int No     = 0;
         int WinNum = 0;
         if (sameNum == 5)
         {
             No     = 1;
             WinNum = No1Win * buyItem.BuyNum;
         }
         else if (sameNum == 4)
         {
             No     = 2;
             WinNum = No2Win * buyItem.BuyNum;
         }
         else if (sameNum == 3)
         {
             No     = 3;
             WinNum = No3Win * buyItem.BuyNum;
         }
         string strLog = string.Format("猜数字id={6},name={7}, {0}期开奖{1}赢得{2},自己购买{3},{4}注,info={5}", new object[]
         {
             data.DataPeriods,
             data.strWinNum,
             WinNum,
             buyItem.strBuyValue,
             buyItem.BuyNum,
             data.WinInfo,
             buyItem.m_RoleID,
             buyItem.m_RoleName
         });
         if (WinNum < 1)
         {
             buyItem.IsWin = false;
             BoCaiBuy2DBList.getInstance().AddData(buyItem, -1, true);
             return(true);
         }
         buyItem.IsWin = true;
         BoCaiBuy2DBList.getInstance().AddData(buyItem, -1, false);
         if (!"True".Equals(Global.Send2DB <BuyBoCai2SDB>(2082, buyItem, 0)))
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩]更新数据库标志失败,不发奖励,没关系 会自动处理旧数据{0}", strLog), null, true);
             return(false);
         }
         string           strTitle  = "猜数字";
         string           strIntro  = string.Format("恭喜您在{0}期猜数字玩法中,中{2}等奖,获得欢乐代币{1},系统将邮件的形式将您获取的欢乐代币返还与你。", buyItem.DataPeriods, WinNum, No);
         List <GoodsData> goodsData = new List <GoodsData>
         {
             HuanLeDaiBiManager.GetInstance().GetHuanLeDaiBi(WinNum)
         };
         return(this.SendMail(buyItem, goodsData, strTitle, strIntro, WinNum, true));
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
     return(false);
 }
Beispiel #3
0
 public bool SendWinItem(OpenLottery data, BuyBoCai2SDB buyItem, double Rate, bool isSendMail, string winType)
 {
     try
     {
         buyItem.IsSend = true;
         if (!winType.Equals(buyItem.strBuyValue))
         {
             buyItem.IsWin = false;
             BoCaiBuy2DBList.getInstance().AddData(buyItem, -1, true);
             return(true);
         }
         int    WinNum   = (int)(Rate * (double)buyItem.BuyNum * (double)data.XiaoHaoDaiBi);
         string strTitle = "猜大小";
         string strIntro = string.Format("恭喜您在{0}期猜大小玩法中,获得欢乐代币{1},系统将邮件的形式将您获取的欢乐代币返还与你。", buyItem.DataPeriods, WinNum);
         buyItem.IsWin = true;
         string strLog = string.Format("TYPE= {8},id={6},name={7}, {0}期开奖{1}赢得{2},自己购买{3},{4}注,info={5}", new object[]
         {
             data.DataPeriods,
             data.strWinNum,
             WinNum,
             buyItem.strBuyValue,
             buyItem.BuyNum,
             data.WinInfo,
             buyItem.m_RoleID,
             buyItem.m_RoleName,
             buyItem.BocaiType
         });
         BoCaiBuy2DBList.getInstance().AddData(buyItem, -1, false);
         if (!"True".Equals(Global.Send2DB <BuyBoCai2SDB>(2082, buyItem, 0)))
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩]更新数据库标志失败,不发奖励,没关系 会自动处理旧数据{0}", strLog), null, true);
             return(WinNum < 1);
         }
         if (WinNum < 1)
         {
             return(true);
         }
         GoodsData        Goods     = HuanLeDaiBiManager.GetInstance().GetHuanLeDaiBi(WinNum);
         List <GoodsData> goodsData = new List <GoodsData>
         {
             Goods
         };
         if (isSendMail)
         {
             return(this.SendMail(buyItem, goodsData, strTitle, strIntro, WinNum, true));
         }
         GameClient client = GameManager.ClientMgr.FindClient(buyItem.m_RoleID);
         if (client != null && Global.CanAddGoods3(client, Goods.GoodsID, WinNum, Goods.Binding, "1900-01-01 12:00:00", true))
         {
             int ret = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, Goods.GoodsID, Goods.GCount, Goods.Quality, Goods.Props, Goods.Forge_level, Goods.Binding, Goods.Site, Goods.Jewellist, true, 1, "猜大小中奖", "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, null, null, 0, true);
             LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_博彩]放在背包ret={1},{0}", strLog, ret), null, true);
             return(true);
         }
         return(this.SendMail(buyItem, goodsData, strTitle, strIntro, WinNum, true));
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
     return(false);
 }
Beispiel #4
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);
     }
 }
Beispiel #5
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);
     }
 }