Beispiel #1
0
        private void RestoreRoleCustomData(GameClient client, RoleCustomData customData)
        {
            RoleCustomDataItem roleCustomData = null;

            if (customData != null && customData.customDataList != null && customData.customDataList.Count > 0)
            {
                roleCustomData = customData.customDataList.Find((RoleCustomDataItem x) => x.Occupation == client.ClientData.Occupation);
            }
            if (null == roleCustomData)
            {
                roleCustomData = new RoleCustomDataItem();
            }
            client.ClientData.MainQuickBarKeys = roleCustomData.Main_quick_keys;
            GameManager.DBCmdMgr.AddDBCmd(10010, string.Format("{0}:{1}:{2}", client.ClientData.RoleID, 0, roleCustomData.Main_quick_keys), null, client.ServerId);
            int[] rolePoint = new int[4];
            for (int i = 0; i < 4; i++)
            {
                if (roleCustomData.RolePointList != null && i < roleCustomData.RolePointList.Count)
                {
                    rolePoint[i] = roleCustomData.RolePointList[i];
                }
            }
            client.ClientData.PropStrength = Global.GetRoleParamsInt32FromDB(client, "PropStrengthChangeless") + rolePoint[0];
            Global.SaveRoleParamsInt32ValueToDB(client, "PropStrength", client.ClientData.PropStrength, true);
            client.ClientData.PropIntelligence = Global.GetRoleParamsInt32FromDB(client, "PropIntelligenceChangeless") + rolePoint[1];
            Global.SaveRoleParamsInt32ValueToDB(client, "PropIntelligence", client.ClientData.PropIntelligence, true);
            client.ClientData.PropDexterity = Global.GetRoleParamsInt32FromDB(client, "PropDexterityChangeless") + rolePoint[2];
            Global.SaveRoleParamsInt32ValueToDB(client, "PropDexterity", client.ClientData.PropDexterity, true);
            client.ClientData.PropConstitution = Global.GetRoleParamsInt32FromDB(client, "PropConstitutionChangeless") + rolePoint[3];
            Global.SaveRoleParamsInt32ValueToDB(client, "PropConstitution", client.ClientData.PropConstitution, true);
            TalentManager.DBTalentEffectClear(client.ClientData.RoleID, client.ClientData.ZoneID, client.ServerId);
            foreach (TalentEffectItem item in roleCustomData.EffectList)
            {
                TalentManager.ModifyEffect(client, item.ID, item.TalentType, item.Level);
            }
            client.ClientData.DefaultSkillLev = roleCustomData.DefaultSkillLev;
            Global.SaveRoleParamsInt32ValueToDB(client, "DefaultSkillLev", client.ClientData.DefaultSkillLev, true);
            client.ClientData.DefaultSkillUseNum = roleCustomData.DefaultSkillUseNum;
            Global.SaveRoleParamsInt32ValueToDB(client, "DefaultSkillUseNum", client.ClientData.DefaultSkillUseNum, true);
            if (client.ClientData.FuWenTabList != null && client.ClientData.FuWenTabList.Count > 0)
            {
                for (int i = 0; i < client.ClientData.FuWenTabList.Count; i++)
                {
                    int        skillID           = 0;
                    List <int> shenShiActiveList = new List <int>();
                    if (roleCustomData.ShenShiEuipSkill != null && i < roleCustomData.ShenShiEuipSkill.Count)
                    {
                        skillID           = roleCustomData.ShenShiEuipSkill[i].SkillEquip;
                        shenShiActiveList = roleCustomData.ShenShiEuipSkill[i].ShenShiActiveList;
                    }
                    client.ClientData.FuWenTabList[i].SkillEquip        = skillID;
                    client.ClientData.FuWenTabList[i].ShenShiActiveList = shenShiActiveList;
                    Global.sendToDB <int, FuWenTabData>(20316, client.ClientData.FuWenTabList[i], 0);
                }
            }
        }