Пример #1
0
 public static void InitFirstWing(GameClient client)
 {
     if (null == client.ClientData.MyWingData)
     {
         WingData wingData = MUWingsManager.AddWingDBCommand(TCPOutPacketPool.getInstance(), client.ClientData.RoleID, 1, client.ServerId);
         client.ClientData.MyWingData = wingData;
     }
 }
        public static void SetZhuHunMax_GM(GameClient client)
        {
            ZhuLingZhuHunLimit i = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID);

            if (i != null)
            {
                client.ClientData.MyWingData.ZhuHunNum = i.ZhuHunLimit;
                MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.JinJieFailedNum, client.ClientData.MyWingData.ForgeLevel, client.ClientData.MyWingData.StarExp, client.ClientData.MyWingData.ZhuLingNum, client.ClientData.MyWingData.ZhuHunNum);
                ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client);
                GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
                if (client._IconStateMgr.CheckReborn(client))
                {
                    client._IconStateMgr.SendIconStateToClient(client);
                }
            }
        }
Пример #3
0
        public static bool UpdateWingDataProps(GameClient client, bool toAdd = true)
        {
            bool result;

            if (null == client.ClientData.MyWingData)
            {
                result = false;
            }
            else if (client.ClientData.MyWingData.WingID <= 0)
            {
                result = false;
            }
            else
            {
                SystemXmlItem baseXmlNode = WingPropsCacheManager.GetWingPropsCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID);
                if (null == baseXmlNode)
                {
                    result = false;
                }
                else
                {
                    MUWingsManager.ChangeWingDataProps(client, baseXmlNode, toAdd);
                    baseXmlNode = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel);
                    if (null == baseXmlNode)
                    {
                        result = false;
                    }
                    else
                    {
                        MUWingsManager.ChangeWingDataProps(client, baseXmlNode, toAdd);
                        result = true;
                    }
                }
            }
            return(result);
        }
        public static ZhuLingZhuHunError ReqZhuHun(GameClient client)
        {
            int oldLevel    = client.ClientData.MyWingData.ZhuHunNum;
            int oldYinLiang = client.ClientData.YinLiang;
            int oldMoney    = client.ClientData.Money1;
            ZhuLingZhuHunError result;

            if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.WingZhuHun, false))
            {
                result = ZhuLingZhuHunError.ZhuHunNotOpen;
            }
            else
            {
                ZhuLingZhuHunLimit i = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID);
                if (i == null)
                {
                    result = ZhuLingZhuHunError.ErrorConfig;
                }
                else if (client.ClientData.MyWingData.ZhuHunNum >= i.ZhuHunLimit)
                {
                    result = ZhuLingZhuHunError.ZhuHunFull;
                }
                else if (Global.GetTotalGoodsCountByID(client, ZhuLingZhuHunManager.ZhuHunCostGoodsID) < ZhuLingZhuHunManager.ZhuHunCostGoodsNum)
                {
                    result = ZhuLingZhuHunError.ZhuHunMaterialNotEnough;
                }
                else if (Global.GetTotalBindTongQianAndTongQianVal(client) < ZhuLingZhuHunManager.ZhuHunCostJinBi)
                {
                    result = ZhuLingZhuHunError.ZhuHunJinBiNotEnough;
                }
                else if (!Global.SubBindTongQianAndTongQian(client, ZhuLingZhuHunManager.ZhuHunCostJinBi, "注魂消耗"))
                {
                    result = ZhuLingZhuHunError.DBSERVERERROR;
                }
                else
                {
                    string strCostList = EventLogManager.NewResPropString(ResLogType.SubJinbi, new object[]
                    {
                        -ZhuLingZhuHunManager.ZhuHunCostJinBi,
                        oldYinLiang,
                        client.ClientData.YinLiang,
                        oldMoney,
                        client.ClientData.Money1
                    });
                    bool bUsedBinding     = true;
                    bool bUsedTimeLimited = false;
                    if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ZhuLingZhuHunManager.ZhuHunCostGoodsID, ZhuLingZhuHunManager.ZhuHunCostGoodsNum, false, out bUsedBinding, out bUsedTimeLimited, false))
                    {
                        result = ZhuLingZhuHunError.DBSERVERERROR;
                    }
                    else
                    {
                        GoodsData goodsDataCost = new GoodsData
                        {
                            GoodsID = ZhuLingZhuHunManager.ZhuHunCostGoodsID,
                            GCount  = ZhuLingZhuHunManager.ZhuHunCostGoodsNum
                        };
                        strCostList += EventLogManager.AddGoodsDataPropString(goodsDataCost);
                        int iRet = MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.JinJieFailedNum, client.ClientData.MyWingData.ForgeLevel, client.ClientData.MyWingData.StarExp, client.ClientData.MyWingData.ZhuLingNum, client.ClientData.MyWingData.ZhuHunNum + 1);
                        if (iRet < 0)
                        {
                            result = ZhuLingZhuHunError.DBSERVERERROR;
                        }
                        else
                        {
                            client.ClientData.MyWingData.ZhuHunNum++;
                            ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client);
                            GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                            GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
                            EventLogManager.AddWingZhuHunEvent(client, oldLevel, client.ClientData.MyWingData.ZhuHunNum, strCostList);
                            if (client._IconStateMgr.CheckReborn(client))
                            {
                                client._IconStateMgr.SendIconStateToClient(client);
                            }
                            result = ZhuLingZhuHunError.Success;
                        }
                    }
                }
            }
            return(result);
        }
Пример #5
0
        public static ZhuLingZhuHunError ReqZhuHun(GameClient client)
        {
            if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.WingZhuHun))
            {
                return(ZhuLingZhuHunError.ZhuHunNotOpen);
            }

            ZhuLingZhuHunLimit l = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID);

            if (l == null)
            {
                return(ZhuLingZhuHunError.ErrorConfig);
            }

            if (client.ClientData.MyWingData.ZhuHunNum >= l.ZhuHunLimit)
            {
                return(ZhuLingZhuHunError.ZhuHunFull);
            }

            if (Global.GetTotalGoodsCountByID(client, ZhuLingZhuHunManager.ZhuHunCostGoodsID) < ZhuLingZhuHunManager.ZhuHunCostGoodsNum)
            {
                return(ZhuLingZhuHunError.ZhuHunMaterialNotEnough);
            }

            if (Global.GetTotalBindTongQianAndTongQianVal(client) < ZhuLingZhuHunManager.ZhuHunCostJinBi)
            {
                return(ZhuLingZhuHunError.ZhuHunJinBiNotEnough);
            }

            if (!Global.SubBindTongQianAndTongQian(client, ZhuLingZhuHunManager.ZhuHunCostJinBi, "注魂消耗"))
            {
                return(ZhuLingZhuHunError.DBSERVERERROR);
            }

            bool bUsedBinding     = true;
            bool bUsedTimeLimited = false;

            if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener,
                                                      Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client,
                                                      ZhuLingZhuHunManager.ZhuHunCostGoodsID, ZhuLingZhuHunManager.ZhuHunCostGoodsNum, false, out bUsedBinding, out bUsedTimeLimited))
            {
                return(ZhuLingZhuHunError.DBSERVERERROR);
            }

            int iRet = MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, client.ClientData.MyWingData.WingID,
                                                      client.ClientData.MyWingData.JinJieFailedNum, client.ClientData.MyWingData.ForgeLevel,
                                                      client.ClientData.MyWingData.StarExp, client.ClientData.MyWingData.ZhuLingNum, client.ClientData.MyWingData.ZhuHunNum + 1);

            if (iRet < 0)
            {
                return(ZhuLingZhuHunError.DBSERVERERROR);
            }

            client.ClientData.MyWingData.ZhuHunNum++;
            ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client);
            // 通知客户端属性变化
            GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
            // 总生命值和魔法值变化通知(同一个地图才需要通知)
            GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

            return(ZhuLingZhuHunError.Success);
        }