Esempio n. 1
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. 2
0
        private void GetShopInfo(GameClient client, int nID, int roleID)
        {
            BoCaiShopInfo msgData = new BoCaiShopInfo();

            try
            {
                msgData.Info = 0;
                BoCaiShopManager.GetInstance().GetSelfBuyData(roleID, ref msgData);
            }
            catch (Exception ex)
            {
                msgData.Info = 100;
                LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
            }
            client.sendCmd <BoCaiShopInfo>(nID, msgData, false);
        }
Esempio n. 3
0
        private string BuyItem(GameClient client, int nID, string[] cmdParams)
        {
            string msgInfo = "";

            try
            {
                if (GameManager.systemParamsList.GetParamValueIntByName("HuanLeDuiHuan", -1) < 1L)
                {
                    return(string.Format("{0}{1}", msgInfo, 7));
                }
                int    ID      = Convert.ToInt32(cmdParams[1]);
                int    BuyNum  = Convert.ToInt32(cmdParams[2]);
                string WuPinID = cmdParams[3];
                msgInfo = string.Format("{0}:{1}:{2}:", cmdParams[1], cmdParams[2], cmdParams[3]);
                DuiHuanShangChengConfig cfg = BoCaiConfigMgr.GetBoCaiShopConfig(ID, WuPinID);
                if (null == cfg)
                {
                    return(string.Format("{0}{1}", msgInfo, 14));
                }
                int       useItemNum = cfg.DaiBiJiaGe * BuyNum;
                GoodsData Goods      = GlobalNew.ParseGoodsData(WuPinID);
                if (null == Goods)
                {
                    return(string.Format("{0}{1}", msgInfo, 14));
                }
                if (!HuanLeDaiBiManager.GetInstance().HuanledaibiEnough(client, useItemNum))
                {
                    return(string.Format("{0}{1}", msgInfo, 4));
                }
                if (!Global.CanAddGoods3(client, Goods.GoodsID, BuyNum, Goods.Binding, "1900-01-01 12:00:00", true))
                {
                    return(string.Format("{0}{1}", msgInfo, 13));
                }
                KFBoCaiShopDB item = new KFBoCaiShopDB();
                item.BuyNum  = BuyNum;
                item.ID      = ID;
                item.WuPinID = WuPinID;
                item.RoleID  = client.ClientData.RoleID;
                item.Periods = Convert.ToInt32(TimeUtil.NowDataTimeString("yyMMdd"));
                if (cfg.MeiRiShangXianDan > -1)
                {
                    if (BuyNum > cfg.MeiRiShangXianDan)
                    {
                        return(string.Format("{0}{1}", msgInfo, 17));
                    }
                    if (!BoCaiShopManager.GetInstance().CanBuyItem(item, cfg.MeiRiShangXianDan))
                    {
                        return(string.Format("{0}{1}", msgInfo, 18));
                    }
                }
                if (!HuanLeDaiBiManager.GetInstance().UseHuanledaibi(client, useItemNum))
                {
                    return(string.Format("{0}{1}", msgInfo, 4));
                }
                int ret = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, Goods.GoodsID, BuyNum, 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},RoleID={0},WuPinID={2},name={3}", new object[]
                {
                    client.ClientData.RoleID,
                    ret,
                    WuPinID,
                    client.ClientData.RoleName
                }), null, true);
                return(string.Format("{0}{1}", msgInfo, 0));
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
            }
            return(string.Format("{0}{1}", msgInfo, 100));
        }