예제 #1
0
        /// <summary>
        /// 激活图鉴-第二个版本
        /// </summary>
        public static int ActivationPictureJudge2(GameClient client, int nPictureJudgeID)
        {
            if (nPictureJudgeID < 0)
            {
                return(-3);
            }

            PictureJudgeData tmpInfo = null;

            if (!Data.PicturejudgeData.TryGetValue(nPictureJudgeID, out tmpInfo))
            {
                return(-10);
            }
            else
            {
                if (tmpInfo == null)
                {
                    return(-4);
                }
            }

            int nGoods = tmpInfo.NeedGoodsID;
            int nNum   = tmpInfo.NeedGoodsNum;

            GoodsData goods = null;

            goods = Global.GetGoodsByID(client, nGoods);

            if (goods == null)
            {
                return(-5);
            }

            bool bActivation = false;
            int  nSub        = 0;

            int nReferCount = 0;

            if (client.ClientData.PictureJudgeReferInfo == null)
            {
                client.ClientData.PictureJudgeReferInfo = new Dictionary <int, int>();
            }

            if (!client.ClientData.PictureJudgeReferInfo.TryGetValue(nPictureJudgeID, out nReferCount)) // 还没提交过图鉴信息
            {
                if (nNum > goods.GCount)
                {
                    nSub = goods.GCount;
                }
                else
                {
                    nSub        = nNum;
                    bActivation = true;
                }

                client.ClientData.PictureJudgeReferInfo.Add(nPictureJudgeID, nSub);
            }
            else
            {
                int ntotal = 0;
                ntotal = goods.GCount + nReferCount;

                if (nNum > ntotal)
                {
                    nSub = goods.GCount;
                    client.ClientData.PictureJudgeReferInfo[nPictureJudgeID] = ntotal;
                }
                else if (nNum == ntotal)
                {
                    nSub        = goods.GCount;
                    bActivation = true;
                    client.ClientData.PictureJudgeReferInfo[nPictureJudgeID] = nNum;
                }
                else
                {
                    nSub        = nNum - nReferCount;
                    bActivation = true;
                    client.ClientData.PictureJudgeReferInfo[nPictureJudgeID] = nNum;
                }
            }

            bool usedBinding     = false;
            bool usedTimeLimited = false;

            if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nGoods, nSub, false, out usedBinding, out usedTimeLimited))
            {
                return(-6);
            }

            // 通知DB   CMD_DB_REFERPICTUREJUDGE
            TCPOutPacket tcpOutPacket = null;
            string       strDbCmd     = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, nPictureJudgeID, client.ClientData.PictureJudgeReferInfo[nPictureJudgeID]);

            TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer2(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                             (int)TCPGameServerCmds.CMD_DB_REFERPICTUREJUDGE, strDbCmd, out tcpOutPacket);

            if (TCPProcessCmdResults.RESULT_FAILED == dbRequestResult)
            {
                return(-7);
            }
            Global.PushBackTcpOutPacket(tcpOutPacket);
            if (bActivation == true)
            {
                if (tmpInfo.PropertyID1 > 0 && tmpInfo.AddPropertyMinValue1 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID1] += tmpInfo.AddPropertyMinValue1;
                }

                if (tmpInfo.PropertyID2 > 0 && tmpInfo.AddPropertyMaxValue1 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID2] += tmpInfo.AddPropertyMaxValue1;
                }

                if (tmpInfo.PropertyID3 > 0 && tmpInfo.AddPropertyMinValue2 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID3] += tmpInfo.AddPropertyMinValue2;
                }

                if (tmpInfo.PropertyID4 > 0 && tmpInfo.AddPropertyMaxValue2 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID4] += tmpInfo.AddPropertyMaxValue2;
                }

                if (tmpInfo.PropertyID5 > 0 && tmpInfo.AddPropertyMinValue3 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID5] += tmpInfo.AddPropertyMinValue3;
                }

                if (tmpInfo.PropertyID6 > 0 && tmpInfo.AddPropertyMaxValue3 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID6] += tmpInfo.AddPropertyMaxValue3;
                }

                if (tmpInfo.PropertyID7 > 0 && tmpInfo.AddPropertyMinValue4 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID7] += tmpInfo.AddPropertyMinValue4;
                }

                if (tmpInfo.PropertyID8 > 0 && tmpInfo.AddPropertyMaxValue4 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID8] += tmpInfo.AddPropertyMaxValue4;
                }

                if (tmpInfo.PropertyID9 > 0 && tmpInfo.AddPropertyMinValue5 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID9] += tmpInfo.AddPropertyMinValue5;
                }

                if (tmpInfo.PropertyID10 > 0 && tmpInfo.AddPropertyMinValue6 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID10] += tmpInfo.AddPropertyMinValue6;
                }

                if (tmpInfo.PropertyID11 > 0 && tmpInfo.AddPropertyMinValue7 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID11] += tmpInfo.AddPropertyMinValue7;
                }

                // 更新标记
                PictureJudgeManager.UpdatePictureJudgeFlag(client, nPictureJudgeID);

                PictureJudgeManager.UpdatePictureJudgeFlag(client, nPictureJudgeID, true);

                GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

                int nCount = 0;
                if (!client.ClientData.PictureJudgeReferTypeInfo.TryGetValue(tmpInfo.PictureJudgeType, out nCount))
                {
                    ++nCount;
                    client.ClientData.PictureJudgeReferTypeInfo.Add(tmpInfo.PictureJudgeType, nCount);
                }
                else
                {
                    ++client.ClientData.PictureJudgeReferTypeInfo[tmpInfo.PictureJudgeType];
                }

                ActivationPictureJudgeExtendPorp(client);
            }

            return(client.ClientData.PictureJudgeReferInfo[nPictureJudgeID]);
        }
예제 #2
0
        /// <summary>
        /// 初始化玩家的图鉴属性
        /// </summary>
        public static void InitPlayerPictureJudgePorperty(GameClient client)
        {
            foreach (var Picturejudgeinfo in m_PictureJudgeInfo)
            {
                int nIndex = -1;
                nIndex = GetPictureJudgeFlagIndex(Picturejudgeinfo.Key);

                if (nIndex < 0)
                {
                    continue;
                }

                if (!PictureJudgeFlagIsTrue(client, Picturejudgeinfo.Key))
                {
                    continue;
                }

                PictureJudgeData tmpInfo = null;
                tmpInfo = Data.PicturejudgeData[Picturejudgeinfo.Key];

                if (tmpInfo == null)
                {
                    continue;
                }

                if (tmpInfo.PropertyID1 >= 0 && tmpInfo.AddPropertyMinValue1 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID1] += tmpInfo.AddPropertyMinValue1;
                }

                if (tmpInfo.PropertyID2 >= 0 && tmpInfo.AddPropertyMaxValue1 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID2] += tmpInfo.AddPropertyMaxValue1;
                }

                if (tmpInfo.PropertyID3 >= 0 && tmpInfo.AddPropertyMinValue2 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID3] += tmpInfo.AddPropertyMinValue2;
                }

                if (tmpInfo.PropertyID4 >= 0 && tmpInfo.AddPropertyMaxValue2 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID4] += tmpInfo.AddPropertyMaxValue2;
                }

                if (tmpInfo.PropertyID5 >= 0 && tmpInfo.AddPropertyMinValue3 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID5] += tmpInfo.AddPropertyMinValue3;
                }

                if (tmpInfo.PropertyID6 >= 0 && tmpInfo.AddPropertyMaxValue3 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID6] += tmpInfo.AddPropertyMaxValue3;
                }

                if (tmpInfo.PropertyID7 >= 0 && tmpInfo.AddPropertyMinValue4 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID7] += tmpInfo.AddPropertyMinValue4;
                }

                if (tmpInfo.PropertyID8 >= 0 && tmpInfo.AddPropertyMaxValue4 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID8] += tmpInfo.AddPropertyMaxValue4;
                }

                if (tmpInfo.PropertyID9 >= 0 && tmpInfo.AddPropertyMinValue5 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID9] += tmpInfo.AddPropertyMinValue5;
                }

                if (tmpInfo.PropertyID10 >= 0 && tmpInfo.AddPropertyMinValue6 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID10] += tmpInfo.AddPropertyMinValue6;
                }

                if (tmpInfo.PropertyID11 >= 0 && tmpInfo.AddPropertyMinValue7 > 0)
                {
                    client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID11] += tmpInfo.AddPropertyMinValue7;
                }

                int nCount = 0;
                if (!client.ClientData.PictureJudgeReferTypeInfo.TryGetValue(tmpInfo.PictureJudgeType, out nCount))
                {
                    ++nCount;
                    client.ClientData.PictureJudgeReferTypeInfo.Add(tmpInfo.PictureJudgeType, nCount);
                }
                else
                {
                    ++client.ClientData.PictureJudgeReferTypeInfo[tmpInfo.PictureJudgeType];
                }
            }

            ActivationPictureJudgeExtendPorp(client);
        }
예제 #3
0
        /// <summary>
        /// 激活图鉴
        /// </summary>
        public static int ActivationPictureJudge(GameClient client, int nPictureJudgeID)
        {
            if (nPictureJudgeID < 0)
            {
                return(-3);
            }

            PictureJudgeData tmpInfo = null;

            tmpInfo = Data.PicturejudgeData[nPictureJudgeID];

            if (tmpInfo == null)
            {
                return(-4);
            }

            int nGoods = tmpInfo.NeedGoodsID;
            int nNum   = tmpInfo.NeedGoodsNum;

            GoodsData goods = null;

            goods = Global.GetGoodsByID(client, nGoods);

            if (goods == null || nNum > goods.GCount)
            {
                return(-5);
            }

            bool usedBinding     = false;
            bool usedTimeLimited = false;

            if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nGoods, nNum, false, out usedBinding, out usedTimeLimited))
            {
                return(-6);
            }

            if (tmpInfo.PropertyID1 > 0 && tmpInfo.AddPropertyMinValue1 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID1] += tmpInfo.AddPropertyMinValue1;
            }

            if (tmpInfo.PropertyID2 > 0 && tmpInfo.AddPropertyMaxValue1 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID2] += tmpInfo.AddPropertyMaxValue1;
            }

            if (tmpInfo.PropertyID3 > 0 && tmpInfo.AddPropertyMinValue2 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID3] += tmpInfo.AddPropertyMinValue2;
            }

            if (tmpInfo.PropertyID4 > 0 && tmpInfo.AddPropertyMaxValue2 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID4] += tmpInfo.AddPropertyMaxValue2;
            }

            if (tmpInfo.PropertyID5 > 0 && tmpInfo.AddPropertyMinValue3 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID5] += tmpInfo.AddPropertyMinValue3;
            }

            if (tmpInfo.PropertyID6 > 0 && tmpInfo.AddPropertyMaxValue3 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID6] += tmpInfo.AddPropertyMaxValue3;
            }

            if (tmpInfo.PropertyID7 > 0 && tmpInfo.AddPropertyMinValue4 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID7] += tmpInfo.AddPropertyMinValue4;
            }

            if (tmpInfo.PropertyID8 > 0 && tmpInfo.AddPropertyMaxValue4 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID8] += tmpInfo.AddPropertyMaxValue4;
            }

            if (tmpInfo.PropertyID9 > 0 && tmpInfo.AddPropertyMinValue5 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID9] += tmpInfo.AddPropertyMinValue5;
            }

            if (tmpInfo.PropertyID10 > 0 && tmpInfo.AddPropertyMinValue6 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID10] += tmpInfo.AddPropertyMinValue6;
            }

            if (tmpInfo.PropertyID11 > 0 && tmpInfo.AddPropertyMinValue7 > 0)
            {
                client.ClientData.PictureJudgeProp.SecondPropsValue[tmpInfo.PropertyID11] += tmpInfo.AddPropertyMinValue7;
            }

            // 更新标记
            PictureJudgeManager.UpdatePictureJudgeFlag(client, nPictureJudgeID);

            PictureJudgeManager.UpdatePictureJudgeFlag(client, nPictureJudgeID, true);

            GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

            return(1);
        }