Beispiel #1
0
        public static string ProcessRandomWaBaoByZaDanSP(GameClient client, Dictionary <int, SystemXmlItem> SystemXmlItemDic, int nType, out string strRecord, int binding = 0, bool bMuProject = false)
        {
            strRecord = null;
            int gainGoodsID     = 0;
            int gainGoodsNum    = 0;
            int gainGold        = 0;
            int gainYinLiang    = 0;
            int gainExp         = 0;
            int nGoodsLevel     = 0;
            int nAppendProp     = 0;
            int nLuckyProp      = 0;
            int nExcellenceProp = 0;

            int[] goodsInfo  = Global.GetRandomGoods(GameManager.systemParamsList.GetParamValueByName("QiFuTen"));
            int   goodsID    = goodsInfo[0];
            int   nGoodCount = goodsInfo[1];

            if (Global.CanAddGoodsToJinDanCangKu(client, goodsID, 1, binding, "1900-01-01 12:00:00", true))
            {
                int nForgeFallId = goodsInfo[3];
                nGoodsLevel = GameManager.GoodsPackMgr.GetFallGoodsLevel(nForgeFallId);
                int nAppendPropFallId = goodsInfo[4];
                nAppendProp = GameManager.GoodsPackMgr.GetZhuiJiaGoodsLevelID(nAppendPropFallId);
                int nLuckyPropFallId = goodsInfo[5];
                nLuckyProp = GameManager.GoodsPackMgr.GetLuckyGoodsID(nLuckyPropFallId);
                int nExcellencePropFallId = goodsInfo[6];
                nExcellenceProp = GameManager.GoodsPackMgr.GetExcellencePropertysID(goodsID, nExcellencePropFallId);
                int dbRet = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, goodsID, nGoodCount, 0, "", nGoodsLevel, binding, 2000, "", true, 1, "乾坤袋挖宝获取道具", "1900-01-01 12:00:00", 0, 0, nLuckyProp, 0, nExcellenceProp, nAppendProp, 0, null, null, 0, true);
                if (dbRet < 0)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("使用乾坤袋挖宝时背包满,放入物品时错误, RoleID={0}, GoodsID={1}, Binding={2}, Ret={3}", new object[]
                    {
                        client.ClientData.RoleID,
                        goodsID,
                        binding,
                        dbRet
                    }), null, true);
                }
                else
                {
                    Global.BroadcastQianKunDaiGoodsHint(client, goodsID, nType);
                    gainGoodsID  = goodsID;
                    gainGoodsNum = 1;
                    SevenDayGoalEventObject evObj = SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.GetEquipCountByQiFu);
                    evObj.Arg1 = goodsID;
                    evObj.Arg2 = gainGoodsNum;
                    GlobalEventSource.getInstance().fireEvent(evObj);
                }
            }
            else
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("使用乾坤袋挖宝时背包满,无法放入物品, RoleID={0}, GoodsID={1}, Binding={2}", client.ClientData.RoleID, goodsID, binding), null, true);
            }
            string strProp = string.Format("{0}|{1}|{2}|{3}", new object[]
            {
                nGoodsLevel,
                nAppendProp,
                nLuckyProp,
                nExcellenceProp
            });
            string sResult;

            if (bMuProject)
            {
                sResult = string.Format("{0},{1},{2},{3},{4},{5},{6}", new object[]
                {
                    gainGoodsID,
                    nGoodCount,
                    binding,
                    nGoodsLevel,
                    nAppendProp,
                    nLuckyProp,
                    nExcellenceProp
                });
            }
            else
            {
                sResult = string.Format("{0}_{1}_{2}_{3}_{4}_{5}", new object[]
                {
                    gainGoodsID,
                    gainGoodsNum,
                    gainGold,
                    gainYinLiang,
                    gainExp,
                    strProp
                });
            }
            strRecord = string.Format("{0}_{1}_{2}_{3}_{4}_{5}", new object[]
            {
                gainGoodsID,
                gainGoodsNum,
                gainGold,
                gainYinLiang,
                gainExp,
                strProp
            });
            if (gainGoodsID > 0)
            {
                EventLogManager.AddRoleQiFuEvent(client, "【{0}】在祈福抽取中获得了【{1}】", new object[]
                {
                    client.ClientData.RoleName,
                    Global.GetGoodsLogName(new GoodsData
                    {
                        GoodsID        = gainGoodsID,
                        ExcellenceInfo = nExcellenceProp
                    })
                });
            }
            return(sResult);
        }
Beispiel #2
0
        public static string ProcessRandomWaBaoByZaDan(GameClient client, Dictionary <int, SystemXmlItem> SystemXmlItemDic, int nType, out string strRecord, int binding = 0, bool bMuProject = false)
        {
            strRecord = null;
            int gainGoodsID  = 0;
            int gainGoodsNum = 0;
            int gainGold     = 0;
            int gainYinLiang = 0;
            int gainExp      = 0;
            int randomNum    = Global.GetRandomNumber(1, 100001);
            List <SystemXmlItem> itemList = new List <SystemXmlItem>();

            foreach (SystemXmlItem systemWaBaoItem in SystemXmlItemDic.Values)
            {
                if (randomNum >= systemWaBaoItem.GetIntValue("StartValues", -1) && randomNum <= systemWaBaoItem.GetIntValue("EndValues", -1))
                {
                    itemList.Add(systemWaBaoItem);
                    break;
                }
            }
            string result;

            if (itemList.Count <= 0)
            {
                result = "";
            }
            else
            {
                List <string> mstTextList     = new List <string>();
                int           index           = Global.GetRandomNumber(0, itemList.Count);
                SystemXmlItem waBaoItem       = itemList[index];
                int           nGoodsLevel     = 0;
                int           nAppendProp     = 0;
                int           nLuckyProp      = 0;
                int           nExcellenceProp = 0;
                int           nGoodCount      = waBaoItem.GetIntValue("Num", -1);
                int           goodsID         = waBaoItem.GetIntValue("GoodsID", -1);
                if (goodsID > 0)
                {
                    if (Global.CanAddGoodsToJinDanCangKu(client, goodsID, 1, binding, "1900-01-01 12:00:00", true))
                    {
                        int nForgeFallId = waBaoItem.GetIntValue("QiangHuaFallID", -1);
                        if (nForgeFallId != -1)
                        {
                            nGoodsLevel = GameManager.GoodsPackMgr.GetFallGoodsLevel(nForgeFallId);
                        }
                        int nAppendPropFallId = waBaoItem.GetIntValue("ZhuiJiaFallID", -1);
                        if (nAppendPropFallId != -1)
                        {
                            nAppendProp = GameManager.GoodsPackMgr.GetZhuiJiaGoodsLevelID(nAppendPropFallId);
                        }
                        int nLuckyPropFallId = waBaoItem.GetIntValue("LckyProbability", -1);
                        if (nLuckyPropFallId != -1)
                        {
                            int nValue = GameManager.GoodsPackMgr.GetLuckyGoodsID(nLuckyPropFallId);
                            if (nValue >= 1)
                            {
                                nLuckyProp = 1;
                            }
                        }
                        int nExcellencePropFallId = waBaoItem.GetIntValue("ZhuoYueFallID", -1);
                        if (nExcellencePropFallId != -1)
                        {
                            nExcellenceProp = GameManager.GoodsPackMgr.GetExcellencePropertysID(goodsID, nExcellencePropFallId);
                        }
                        int dbRet = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, goodsID, nGoodCount, 0, "", nGoodsLevel, binding, 2000, "", true, 1, "乾坤袋挖宝获取道具", "1900-01-01 12:00:00", 0, 0, nLuckyProp, 0, nExcellenceProp, nAppendProp, 0, null, null, 0, true);
                        if (dbRet < 0)
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("使用乾坤袋挖宝时背包满,放入物品时错误, RoleID={0}, GoodsID={1}, Binding={2}, Ret={3}", new object[]
                            {
                                client.ClientData.RoleID,
                                goodsID,
                                binding,
                                dbRet
                            }), null, true);
                        }
                        else
                        {
                            Global.BroadcastQianKunDaiGoodsHint(client, goodsID, nType);
                            gainGoodsID  = goodsID;
                            gainGoodsNum = 1;
                            SevenDayGoalEventObject evObj = SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.GetEquipCountByQiFu);
                            evObj.Arg1 = goodsID;
                            evObj.Arg2 = gainGoodsNum;
                            GlobalEventSource.getInstance().fireEvent(evObj);
                        }
                    }
                    else
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("使用乾坤袋挖宝时背包满,无法放入物品, RoleID={0}, GoodsID={1}, Binding={2}", client.ClientData.RoleID, goodsID, binding), null, true);
                    }
                }
                int minMoney = waBaoItem.GetIntValue("MinMoney", -1);
                int maxMoney = waBaoItem.GetIntValue("MaxMoney", -1);
                if (minMoney >= 0 && maxMoney > minMoney)
                {
                    int giveMoney = Global.GetRandomNumber(minMoney, maxMoney);
                    if (giveMoney > 0)
                    {
                        GameManager.ClientMgr.AddUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, giveMoney, "开启乾坤袋二", false);
                        gainYinLiang = giveMoney;
                    }
                }
                int minBindYuanBao = waBaoItem.GetIntValue("MinBindYuanBao", -1);
                int maxBindYuanBao = waBaoItem.GetIntValue("MaxBindYuanBao", -1);
                if (minBindYuanBao >= 0 && maxBindYuanBao > minBindYuanBao)
                {
                    int giveBingYuanBao = Global.GetRandomNumber(minBindYuanBao, maxBindYuanBao);
                    if (giveBingYuanBao > 0)
                    {
                        GameManager.ClientMgr.AddUserGold(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, giveBingYuanBao, "开启乾坤袋二");
                        gainGold = giveBingYuanBao;
                    }
                }
                int minExp = waBaoItem.GetIntValue("MinExp", -1);
                int maxExp = waBaoItem.GetIntValue("MaxExp", -1);
                if (minExp >= 0 && maxExp > minExp)
                {
                    int giveExp = Global.GetRandomNumber(minExp, maxExp);
                    if (giveExp > 0)
                    {
                        GameManager.ClientMgr.ProcessRoleExperience(client, (long)giveExp, false, true, false, "none");
                        gainExp = giveExp;
                    }
                }
                string strProp = string.Format("{0}|{1}|{2}|{3}", new object[]
                {
                    nGoodsLevel,
                    nAppendProp,
                    nLuckyProp,
                    nExcellenceProp
                });
                string sResult;
                if (bMuProject)
                {
                    sResult = string.Format("{0},{1},{2},{3},{4},{5},{6}", new object[]
                    {
                        gainGoodsID,
                        nGoodCount,
                        binding,
                        nGoodsLevel,
                        nAppendProp,
                        nLuckyProp,
                        nExcellenceProp
                    });
                }
                else
                {
                    sResult = string.Format("{0}_{1}_{2}_{3}_{4}_{5}", new object[]
                    {
                        gainGoodsID,
                        gainGoodsNum,
                        gainGold,
                        gainYinLiang,
                        gainExp,
                        strProp
                    });
                }
                strRecord = string.Format("{0}_{1}_{2}_{3}_{4}_{5}", new object[]
                {
                    gainGoodsID,
                    gainGoodsNum,
                    gainGold,
                    gainYinLiang,
                    gainExp,
                    strProp
                });
                if (gainGoodsID > 0)
                {
                    EventLogManager.AddRoleQiFuEvent(client, "【{0}】在祈福抽取中获得了【{1}】", new object[]
                    {
                        client.ClientData.RoleName,
                        Global.GetGoodsLogName(new GoodsData
                        {
                            GoodsID        = gainGoodsID,
                            ExcellenceInfo = nExcellenceProp
                        })
                    });
                }
                result = sResult;
            }
            return(result);
        }