Exemplo n.º 1
0
        public static int GetSkillLevel(GameClient client, int skillID)
        {
            int level = 0;

            if (client.ClientData.MyTalentData.IsOpen)
            {
                TalentPropData talentData = client.ClientData.MyTalentPropData;
                if (talentData.SkillOneValue.ContainsKey(skillID))
                {
                    level += talentData.SkillOneValue[skillID];
                }
                else
                {
                    SystemXmlItem systemMagic = null;
                    if (!GameManager.SystemMagicsMgr.SystemXmlItemDict.TryGetValue(skillID, out systemMagic))
                    {
                        return(level);
                    }
                    int nParentMagicID = systemMagic.GetIntValue("ParentMagicID", -1);
                    if (nParentMagicID > 0)
                    {
                        SkillData ParentSkillData = Global.GetSkillDataByID(client, nParentMagicID);
                        if (null != ParentSkillData)
                        {
                            if (talentData.SkillOneValue.ContainsKey(ParentSkillData.SkillID))
                            {
                                level += talentData.SkillOneValue[ParentSkillData.SkillID];
                            }
                        }
                    }
                }
                level += talentData.SkillAllValue;
            }
            return(level);
        }
Exemplo n.º 2
0
        public static void initTalentEffectProp(GameClient client)
        {
            TalentData myTalentData = TalentManager.GetTalentData(client);

            if (myTalentData != null && myTalentData.IsOpen)
            {
                TalentPropData myPropData = client.ClientData.MyTalentPropData;
                myPropData.ResetProps();
                foreach (TalentEffectItem item in myTalentData.EffectList)
                {
                    TalentInfo talentInfo = TalentManager.GetTalentInfoByID(client.ClientData.Occupation, item.ID);
                    if (talentInfo.LevelMax >= item.Level)
                    {
                        item.ItemEffectList = talentInfo.EffectList[item.Level];
                        foreach (TalentEffectInfo info in item.ItemEffectList)
                        {
                            switch (info.EffectType)
                            {
                            case 1:
                                myPropData.PropItem.BaseProps[info.EffectID] += (double)((int)info.EffectValue);
                                break;

                            case 2:
                                myPropData.PropItem.ExtProps[info.EffectID] += info.EffectValue;
                                break;

                            case 3:
                                if (myPropData.SkillOneValue.ContainsKey(info.EffectID))
                                {
                                    Dictionary <int, int> skillOneValue;
                                    int effectID;
                                    (skillOneValue = myPropData.SkillOneValue)[effectID = info.EffectID] = skillOneValue[effectID] + (int)info.EffectValue;
                                }
                                else
                                {
                                    myPropData.SkillOneValue.Add(info.EffectID, (int)info.EffectValue);
                                }
                                break;

                            case 4:
                                myPropData.SkillAllValue += (int)info.EffectValue;
                                break;
                            }
                        }
                    }
                }
                TalentManager.InitSpecialProp(client);
                client.ClientData.MyTalentData.SkillOneValue = client.ClientData.MyTalentPropData.SkillOneValue;
                client.ClientData.MyTalentData.SkillAllValue = client.ClientData.MyTalentPropData.SkillAllValue;
                TalentManager.SetTalentProp(client, TalentEffectType.PropBasic, myPropData.PropItem);
                TalentManager.SetTalentProp(client, TalentEffectType.PropExt, myPropData.PropItem);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 初始天赋效果属性
        /// </summary>
        public static void initTalentEffectProp(GameClient client)
        {
            TalentData myTalentData = GetTalentData(client);

            if (myTalentData == null || !myTalentData.IsOpen)
            {
                return;
            }

            TalentPropData myPropData = client.ClientData.MyTalentPropData;

            myPropData.ResetProps();

            foreach (TalentEffectItem item in myTalentData.EffectList)
            {
                TalentInfo talentInfo = GetTalentInfoByID(client.ClientData.Occupation, item.ID);
                if (talentInfo.LevelMax < item.Level)
                {
                    continue;
                }

                item.ItemEffectList = talentInfo.EffectList[item.Level];

                //计算效果值
                foreach (TalentEffectInfo info in item.ItemEffectList)
                {
                    switch (info.EffectType)
                    {
                    case (int)TalentEffectType.PropBasic:
                        myPropData.PropItem.BaseProps[info.EffectID] += (int)info.EffectValue;
                        break;

                    case (int)TalentEffectType.PropExt:
                        myPropData.PropItem.ExtProps[info.EffectID] += info.EffectValue;
                        break;

                    case (int)TalentEffectType.SkillOne:
                    {
                        if (myPropData.SkillOneValue.ContainsKey(info.EffectID))
                        {
                            myPropData.SkillOneValue[info.EffectID] += (int)info.EffectValue;
                        }
                        else
                        {
                            myPropData.SkillOneValue.Add(info.EffectID, (int)info.EffectValue);
                        }
                    }
                    break;

                    case (int)TalentEffectType.SkillAll:
                        myPropData.SkillAllValue += (int)info.EffectValue;
                        break;
                    } //switch
                }     //foreach 计算效果值
            }

            InitSpecialProp(client);

            client.ClientData.MyTalentData.SkillOneValue = client.ClientData.MyTalentPropData.SkillOneValue;
            client.ClientData.MyTalentData.SkillAllValue = client.ClientData.MyTalentPropData.SkillAllValue;

            SetTalentProp(client, TalentEffectType.PropBasic, myPropData.PropItem);
            SetTalentProp(client, TalentEffectType.PropExt, myPropData.PropItem);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 洗点
        /// </summary>
        /// <param name="client"></param>
        /// <param name="washType">洗点类型 TalentWashType</param>
        /// <returns></returns>
        private static int TalentWash(GameClient client, int washType)
        {
            //开放
            if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.Talent))
            {
                return(TalentResultType.EnoOpen);
            }

            // 如果1.6的功能没开放
            if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot6))
            {
                return(TalentResultType.EnoOpen);
            }

            TalentData talentData = client.ClientData.MyTalentData;

            //点数
            int washCount = GetTalentUseCount(talentData);

            if (washCount <= 0)
            {
                return(TalentResultType.EnoTalentCount);
            }

            bool result = false;

            if (washType == (int)TalentWashType.Diamond)
            {
                int needDiamond = GetWashDiamond(washCount);
                result = GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, needDiamond, "天赋洗点");
                if (!result)
                {
                    return(TalentResultType.EnoDiamond);
                }
            }
            else
            { //从背包中找装备
                int goodsId    = 0;
                int goodsCount = 0;
                GetWashGoods(out goodsId, out goodsCount);
                GoodsData goodsData = Global.GetGoodsByID(client, goodsId);
                if (goodsData == null)
                {
                    return(TalentResultType.EnoWash);
                }

                //扣除物品
                result = GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener,
                                                              Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, goodsData, goodsCount, false);
                if (!result)
                {
                    return(TalentResultType.EnoWash);
                }
            }

            //清除数据库加点数据
            result = DBTalentEffectClear(client.ClientData.RoleID, client.ClientData.ZoneID, client.ServerId);
            if (!result)
            {
                return(TalentResultType.EFail);
            }

            //分配点数
            talentData.CountList[(int)TalentType.Savage] = 0;
            talentData.CountList[(int)TalentType.Tough]  = 0;
            talentData.CountList[(int)TalentType.Quick]  = 0;

            //效果
            talentData.EffectList = new List <TalentEffectItem>();

            //属性清空
            TalentPropData propData = client.ClientData.MyTalentPropData;

            propData.ResetProps();

            SetTalentProp(client, TalentEffectType.PropBasic, propData.PropItem);
            SetTalentProp(client, TalentEffectType.PropExt, propData.PropItem);

            RefreshProp(client);
            return(TalentResultType.Success);
        }
Exemplo n.º 5
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);
        }