Example #1
0
        private static int TalentWash(GameClient client, int washType)
        {
            int result;

            if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.Talent, false))
            {
                result = TalentResultType.EnoOpen;
            }
            else if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot6))
            {
                result = TalentResultType.EnoOpen;
            }
            else
            {
                TalentData talentData = client.ClientData.MyTalentData;
                int        washCount  = TalentManager.GetTalentUseCount(talentData);
                if (washCount <= 0)
                {
                    result = TalentResultType.EnoTalentCount;
                }
                else
                {
                    if (washType == 0)
                    {
                        int needDiamond = TalentManager.GetWashDiamond(washCount);
                        if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, needDiamond, "天赋洗点", true, true, false, DaiBiSySType.TianFuXiDian))
                        {
                            return(TalentResultType.EnoDiamond);
                        }
                    }
                    else
                    {
                        int goodsId    = 0;
                        int goodsCount = 0;
                        TalentManager.GetWashGoods(out goodsId, out goodsCount);
                        GoodsData goodsData = Global.GetGoodsByID(client, goodsId);
                        if (goodsData == null)
                        {
                            return(TalentResultType.EnoWash);
                        }
                        if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, goodsData, goodsCount, false, false))
                        {
                            return(TalentResultType.EnoWash);
                        }
                    }
                    if (!TalentManager.DBTalentEffectClear(client.ClientData.RoleID, client.ClientData.ZoneID, client.ServerId))
                    {
                        result = TalentResultType.EFail;
                    }
                    else
                    {
                        talentData.CountList[1] = 0;
                        talentData.CountList[2] = 0;
                        talentData.CountList[3] = 0;
                        talentData.EffectList   = new List <TalentEffectItem>();
                        TalentPropData propData = client.ClientData.MyTalentPropData;
                        propData.ResetProps();
                        TalentManager.SetTalentProp(client, TalentEffectType.PropBasic, propData.PropItem);
                        TalentManager.SetTalentProp(client, TalentEffectType.PropExt, propData.PropItem);
                        TalentManager.RefreshProp(client);
                        result = TalentResultType.Success;
                    }
                }
            }
            return(result);
        }