using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using LitJson;
|
|
|
namespace Snxxz.UI
|
{
|
|
public class RoleParticularModel : Model, IBeforePlayerDataInitialize
|
{
|
|
public override void Init()
|
{
|
}
|
|
public override void UnInit()
|
{
|
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
viewPlayerType = -1;
|
}
|
|
public int viewPlayer { get; private set; }
|
|
public int viewPlayerType { get; private set; } //0-查看装备 1-查看战力 2-王者仙盟 3-仙盟宴会传功
|
|
private Dictionary<int, ViewPlayerData> viewPlayerDataDic = new Dictionary<int, ViewPlayerData>();
|
private Dictionary<int, ulong> funcFightPowerDict = new Dictionary<int, ulong>();
|
public event Action PowerUpdate;
|
|
public ViewPlayerData GetViewPlayerData(int player)
|
{
|
ViewPlayerData viewPlayerData = null;
|
viewPlayerDataDic.TryGetValue(player, out viewPlayerData);
|
return viewPlayerData;
|
}
|
|
public void ViewRoleEquip(int playerID)
|
{
|
viewPlayerType = 0;
|
ViewRoleParticulars(playerID);
|
}
|
|
public void ViewRoleFightPower(int playerID)
|
{
|
viewPlayerType = 1;
|
ViewRoleParticulars(playerID);
|
}
|
|
public void ViewKingFairyLeader(int _playerId)
|
{
|
viewPlayerType = 2;
|
ViewRoleParticulars(_playerId);
|
}
|
|
public void ViewFairyFeastTransmit(int _playerId)
|
{
|
viewPlayerType = 3;
|
ViewRoleParticulars(_playerId);
|
}
|
|
public void ViewFairyCrossServerOneVsOne(int _playerId)
|
{
|
viewPlayerType = 4;
|
ViewRoleParticulars(_playerId);
|
}
|
public void ViewFairyArenaRobot(int playerID,ViewPlayerData _viewPlayerData)
|
{
|
ViewPlayerData viewPlayerData = null;
|
viewPlayer = playerID;
|
if (!viewPlayerDataDic.TryGetValue(playerID, out viewPlayerData))
|
{
|
viewPlayerDataDic.Add(playerID, _viewPlayerData);
|
}
|
else
|
{
|
viewPlayerDataDic[playerID] = _viewPlayerData;
|
}
|
|
viewPlayerType = 4;
|
ShowRoleParticulars(_viewPlayerData);
|
}
|
|
public void ViewCrossServerPlayerEquip(int _playerId)
|
{
|
viewPlayerType = CrossServerUtility.IsCrossServer() ? 5 : 4;
|
ViewRoleParticulars(_playerId);
|
}
|
|
public void ViewCrossPlayerFightPower(int _playerId)
|
{
|
viewPlayerType = CrossServerUtility.IsCrossServer() ? 6 : 7;
|
ViewRoleParticulars(_playerId);
|
}
|
|
private void ViewRoleParticulars(int playerID)
|
{
|
if (viewPlayerType != 2)
|
{
|
if (playerID == PlayerDatas.Instance.baseData.PlayerID)
|
{
|
return;
|
}
|
}
|
if (playerID == 0)
|
{
|
return;
|
}
|
viewPlayer = playerID;
|
if (viewPlayerDataDic.ContainsKey(playerID))
|
{
|
ViewPlayerData viewPlayerData = viewPlayerDataDic[playerID];
|
if ((DateTime.Now - viewPlayerData.getTime).TotalSeconds < 30)
|
{
|
ShowRoleParticulars(viewPlayerData);
|
return;
|
}
|
}
|
switch (viewPlayerType)
|
{
|
case 4:
|
case 7:
|
{
|
CC002_tagCGViewCrossPlayerInfo c002 = new CC002_tagCGViewCrossPlayerInfo();
|
c002.PlayerID = (uint)playerID;
|
GameNetSystem.Instance.SendInfo(c002);
|
}
|
break;
|
case 5:
|
case 6:
|
{
|
CA212_tagCMViewPlayerInfo pak = new CA212_tagCMViewPlayerInfo();
|
pak.PlayerID = (uint)playerID;
|
GameNetSystem.Instance.SendToCrossServer(pak);
|
}
|
break;
|
default:
|
{
|
CA212_tagCMViewPlayerInfo pak = new CA212_tagCMViewPlayerInfo();
|
pak.PlayerID = (uint)playerID;
|
GameNetSystem.Instance.SendInfo(pak);
|
}
|
break;
|
}
|
}
|
|
public void OnRevRoleEquip(HA705_tagSCQueryPlayerCacheResult package)
|
{
|
if (viewPlayer != package.PlayerID || viewPlayerType == -1)
|
{
|
return;
|
}
|
ViewPlayerData viewPlayerData = null;
|
if (!viewPlayerDataDic.TryGetValue((int)package.PlayerID, out viewPlayerData))
|
{
|
viewPlayerData = new ViewPlayerData();
|
viewPlayerData.getTime = DateTime.Now;
|
viewPlayerDataDic.Add((int)package.PlayerID, viewPlayerData);
|
}
|
|
viewPlayerData.getTime = DateTime.Now;
|
viewPlayerData.rolePropData = JsonMapper.ToObject<RolePropData>(package.PropData);
|
|
viewPlayerData.rolePlusData = new RolePlusData();
|
viewPlayerData.rolePlusData.AnalysisRolePlusData(package.PlusData);
|
|
ShowRoleParticulars(viewPlayerData);
|
}
|
|
public void OnRevRoleFuncPower(HA3A1_tagMCModuleFightPowerInfo package)
|
{
|
if (package.MFPCnt == 0)
|
return;
|
for (int i = 0; i < package.MFPList.Length; i++)
|
{
|
funcFightPowerDict[package.MFPList[i].MfpType] = package.MFPList[i].FightPower;
|
}
|
if (PowerUpdate != null)
|
{
|
PowerUpdate();
|
}
|
}
|
|
public ulong GetFuncFightPower(int type)
|
{
|
if (funcFightPowerDict.ContainsKey(type))
|
{
|
return funcFightPowerDict[type];
|
}
|
return 0;
|
}
|
|
#region 查看玩家坐骑灵宠属性
|
List<int> skills = new List<int>();
|
Dictionary<int, float> propertyDict = new Dictionary<int, float>();
|
public int GetHorseFightPower(List<HorseInfo> horses)
|
{
|
var fightPower = 0;
|
for (int i = 0; i < horses.Count; i++)
|
{
|
fightPower += GetHorseFightPower(horses[i].id, horses[i].lv);
|
}
|
return fightPower;
|
}
|
|
public int GetHorseFightPower(int _id, int lv)
|
{
|
var fightPower = GetHorseSkillFightPower(_id, lv);
|
var horseUpConfig = HorseUpConfig.GetHorseIDAndLV(_id, lv);
|
if (horseUpConfig == null)
|
{
|
return 0;
|
}
|
Dictionary<int, int> dict = new Dictionary<int, int>();
|
int[] propertys = horseUpConfig.AttrType;
|
int[] values = horseUpConfig.AttrValue;
|
for (int i = 0; i < propertys.Length; i++)
|
{
|
if (propertys[i] == (int)PropertyType.ATK || propertys[i] == (int)PropertyType.HP)
|
{
|
if (!dict.ContainsKey(propertys[i]))
|
{
|
dict.Add(propertys[i], values[i]);
|
}
|
else
|
{
|
dict[propertys[i]] += values[i];
|
}
|
}
|
}
|
fightPower += UIHelper.GetFightPower(dict);
|
var config = HorseConfig.Get(_id);
|
fightPower += config.InitFightPower;
|
return fightPower;
|
}
|
|
public int GetHorseSkillFightPower(int _id, int lv)
|
{
|
var fightPower = 0;
|
HorseUpConfig.GetHorseSkills(_id, lv, true, ref skills);
|
for (int i = 0; i < skills.Count; i++)
|
{
|
Dictionary<int, int> dict1 = null;
|
Dictionary<int, int> dict2 = null;
|
var skillConfig = SkillConfig.Get(skills[i]);
|
if (skillConfig == null)
|
{
|
continue;
|
}
|
if (skillConfig.Effect1 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect1 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect1 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
Dictionary<int, int> dict = single ? dict1 : dict2;
|
dict = GetHorseSkillProperty(skillConfig.EffectValue11, skillConfig.EffectValue12, skillConfig.EffectValue13, single);
|
}
|
if (skillConfig.Effect2 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect2 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect2 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
Dictionary<int, int> dict = single ? dict1 : dict2;
|
dict = GetHorseSkillProperty(skillConfig.EffectValue21, skillConfig.EffectValue22, skillConfig.EffectValue23, single);
|
}
|
if (skillConfig.Effect3 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect3 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect3 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
Dictionary<int, int> dict = single ? dict1 : dict2;
|
dict = GetHorseSkillProperty(skillConfig.EffectValue31, skillConfig.EffectValue32, skillConfig.EffectValue33, single);
|
}
|
if (skillConfig.Effect4 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect4 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect4 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
Dictionary<int, int> dict = single ? dict1 : dict2;
|
dict = GetHorseSkillProperty(skillConfig.EffectValue41, skillConfig.EffectValue42, skillConfig.EffectValue43, single);
|
}
|
if (skillConfig.Effect5 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect5 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect5 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
Dictionary<int, int> dict = single ? dict1 : dict2;
|
dict = GetHorseSkillProperty(skillConfig.EffectValue51, skillConfig.EffectValue52, skillConfig.EffectValue53, single);
|
}
|
if (skillConfig.Effect6 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect6 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect6 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
Dictionary<int, int> dict = single ? dict1 : dict2;
|
dict = GetHorseSkillProperty(skillConfig.EffectValue61, skillConfig.EffectValue62, skillConfig.EffectValue63, single);
|
}
|
fightPower += dict1 == null ? 0 : UIHelper.GetFightPower(dict1);
|
fightPower += dict2 == null ? 0 : UIHelper.GetFightPower(dict2);
|
fightPower += skillConfig.FightPower;
|
}
|
return fightPower;
|
}
|
|
public void GetHorseProperty(List<HorseInfo> horses, ref Dictionary<int, int> propertyDict)
|
{
|
if (propertyDict == null)
|
{
|
return;
|
}
|
propertyDict.Clear();
|
for (int i = 0; i < horses.Count; i++)
|
{
|
HorseUpConfig horseUpConfig = HorseUpConfig.GetHorseIDAndLV(horses[i].id, horses[i].lv);
|
if (horseUpConfig == null)
|
{
|
continue;
|
}
|
GetHorseProperty(horses[i].id, horses[i].lv, ref propertyDict);
|
int[] propertys = horseUpConfig.AttrType;
|
int[] values = horseUpConfig.AttrValue;
|
for (int k = 0; k < propertys.Length; k++)
|
{
|
if (!propertyDict.ContainsKey(propertys[k]))
|
{
|
propertyDict.Add(propertys[k], values[k]);
|
}
|
else
|
{
|
if (propertys[k] == (int)PropertyType.MoveSpeed)
|
{
|
if (values[k] > propertyDict[propertys[k]])
|
{
|
propertyDict[propertys[k]] = values[k];
|
}
|
}
|
else
|
{
|
propertyDict[propertys[k]] += values[k];
|
}
|
}
|
}
|
}
|
}
|
|
public void GetHorseProperty(int _id, int lv, ref Dictionary<int, int> propertyDict)
|
{
|
HorseUpConfig.GetHorseSkills(_id, lv, true, ref skills);
|
for (int i = 0; i < skills.Count; i++)
|
{
|
Dictionary<int, int> dict1 = null;
|
Dictionary<int, int> dict2 = null;
|
var skillConfig = SkillConfig.Get(skills[i]);
|
if (skillConfig == null)
|
{
|
continue;
|
}
|
if (skillConfig.Effect1 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect1 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect1 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
if (single)
|
{
|
dict1 = GetHorseSkillProperty(skillConfig.EffectValue11, skillConfig.EffectValue12, skillConfig.EffectValue13, single);
|
}
|
else
|
{
|
dict2 = GetHorseSkillProperty(skillConfig.EffectValue11, skillConfig.EffectValue12, skillConfig.EffectValue13, single);
|
}
|
}
|
if (skillConfig.Effect2 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect2 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect2 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
if (single)
|
{
|
dict1 = GetHorseSkillProperty(skillConfig.EffectValue21, skillConfig.EffectValue22, skillConfig.EffectValue23, single);
|
}
|
else
|
{
|
dict2 = GetHorseSkillProperty(skillConfig.EffectValue21, skillConfig.EffectValue22, skillConfig.EffectValue23, single);
|
}
|
}
|
if (skillConfig.Effect3 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect3 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect3 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
if (single)
|
{
|
dict1 = GetHorseSkillProperty(skillConfig.EffectValue31, skillConfig.EffectValue32, skillConfig.EffectValue33, single);
|
}
|
else
|
{
|
dict2 = GetHorseSkillProperty(skillConfig.EffectValue31, skillConfig.EffectValue32, skillConfig.EffectValue33, single);
|
}
|
}
|
if (skillConfig.Effect4 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect4 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect4 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
if (single)
|
{
|
dict1 = GetHorseSkillProperty(skillConfig.EffectValue41, skillConfig.EffectValue42, skillConfig.EffectValue43, single);
|
}
|
else
|
{
|
dict2 = GetHorseSkillProperty(skillConfig.EffectValue41, skillConfig.EffectValue42, skillConfig.EffectValue43, single);
|
}
|
}
|
if (skillConfig.Effect5 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect5 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect5 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
if (single)
|
{
|
dict1 = GetHorseSkillProperty(skillConfig.EffectValue51, skillConfig.EffectValue52, skillConfig.EffectValue53, single);
|
}
|
else
|
{
|
dict2 = GetHorseSkillProperty(skillConfig.EffectValue51, skillConfig.EffectValue52, skillConfig.EffectValue53, single);
|
}
|
}
|
if (skillConfig.Effect6 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1
|
|| skillConfig.Effect6 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty2)
|
{
|
bool single = skillConfig.Effect6 == (int)RidingAndPetActivationModel.RidingAndPetProperty.MountProperty1;
|
if (single)
|
{
|
dict1 = GetHorseSkillProperty(skillConfig.EffectValue61, skillConfig.EffectValue62, skillConfig.EffectValue63, single);
|
}
|
else
|
{
|
dict2 = GetHorseSkillProperty(skillConfig.EffectValue61, skillConfig.EffectValue62, skillConfig.EffectValue63, single);
|
}
|
}
|
if (dict1 != null)
|
{
|
PastePropertyDict(dict1, propertyDict);
|
}
|
if (dict2 != null)
|
{
|
PastePropertyDict(dict2, propertyDict);
|
}
|
}
|
}
|
|
private void PastePropertyDict(Dictionary<int, int> source, Dictionary<int, int> target)
|
{
|
foreach (var key in source.Keys)
|
{
|
if (!target.ContainsKey(key))
|
{
|
target.Add(key, source[key]);
|
}
|
else
|
{
|
target[key] += source[key];
|
}
|
}
|
}
|
|
int[] qualitys;
|
string[] qualityTitles;
|
public string GetQualityDisplay(int quality)
|
{
|
if (qualitys == null)
|
{
|
var config = FuncConfigConfig.Get("PetQuality");
|
qualitys = ConfigParse.GetMultipleStr<int>(config.Numerical1);
|
qualityTitles = ConfigParse.GetMultipleStr(config.Numerical2);
|
}
|
for (int i = 0; i < qualitys.Length; i++)
|
{
|
if (quality == qualitys[i])
|
{
|
return qualityTitles[i];
|
}
|
}
|
return string.Empty;
|
}
|
private Dictionary<int, int> GetHorseSkillProperty(int condition, int property, int percent, bool single)
|
{
|
Dictionary<int, int> dict = new Dictionary<int, int>();
|
dict.Add(6, 0);
|
dict.Add(7, 0);
|
|
var viewplayer = GetViewPlayerData(viewPlayer);
|
var horses = viewplayer.rolePlusData.horses;
|
|
if (single)
|
{
|
var horseInfo = horses.Find((x) =>
|
{
|
return x.id == condition;
|
});
|
HorseUpConfig horseUpConfig = HorseUpConfig.GetHorseIDAndLV(horseInfo.id, horseInfo.lv);
|
if (horseUpConfig == null)
|
{
|
return dict;
|
}
|
int[] propertys = horseUpConfig.AttrType;
|
int[] values = horseUpConfig.AttrValue;
|
for (int k = 0; k < propertys.Length; k++)
|
{
|
if (propertys[k] == property && dict.ContainsKey(property))
|
{
|
dict[property] += (int)(values[k] * ((float)percent / 10000));
|
}
|
}
|
}
|
else
|
{
|
for (int i = 0; i < horses.Count; i++)
|
{
|
HorseConfig horseConfig = HorseConfig.Get(horses[i].id);
|
if (horseConfig == null)
|
{
|
continue;
|
}
|
if (horseConfig.Quality == condition)
|
{
|
HorseUpConfig horseUpConfig = HorseUpConfig.GetHorseIDAndLV(horses[i].id, horses[i].lv);
|
int[] propertys = horseUpConfig.AttrType;
|
int[] values = horseUpConfig.AttrValue;
|
for (int k = 0; k < propertys.Length; k++)
|
{
|
if (propertys[k] == property && dict.ContainsKey(property))
|
{
|
dict[property] += (int)(values[k] * ((float)percent / 10000));
|
}
|
}
|
}
|
}
|
}
|
return dict;
|
}
|
|
public int GetPetFightPower(List<PetInfo> pets)
|
{
|
var fightPower = 0;
|
for (int i = 0; i < pets.Count; i++)
|
{
|
fightPower += GetPetFightPower(pets[i].id, pets[i].lv);
|
}
|
return fightPower;
|
}
|
|
public int GetPetFightPower(int id, int lv)
|
{
|
var fightPower = 0;
|
var config = PetInfoConfig.Get(id);
|
var _init_fightpower = 0;
|
int.TryParse(config.InitFightPower, out _init_fightpower);
|
fightPower += _init_fightpower;
|
PetInfoConfig.GetPetSkills(id, lv, true, ref skills);
|
var petUpConfig = PetClassCostConfig.GetPetIdAndRank(id, lv);
|
if (petUpConfig != null)
|
{
|
Dictionary<int, int> propertyDict = new Dictionary<int, int>();
|
propertyDict.Add(77, petUpConfig.AtkAdd);
|
propertyDict.Add(78, petUpConfig.AtkAdd);
|
fightPower += UIHelper.GetFightPower(propertyDict);// Mathf.FloorToInt(petUpConfig.AtkAdd * 2.5f);
|
}
|
for (int i = 0; i < skills.Count; i++)
|
{
|
var skillConfig = SkillConfig.Get(skills[i]);
|
if (skillConfig != null)
|
{
|
fightPower += skillConfig.FightPower;
|
}
|
}
|
return fightPower;
|
}
|
|
public int GetPetAtkProperty(List<PetInfo> pets)
|
{
|
var atk = 0;
|
for (int i = 0; i < pets.Count; i++)
|
{
|
atk += GetPetAtkProperty(pets[i].id, pets[i].lv, pets);
|
}
|
return atk;
|
}
|
|
public int GetPetAtkProperty(int id, int lv, List<PetInfo> pets)
|
{
|
var atk = 0;
|
var petUpConfig = PetClassCostConfig.GetPetIdAndRank(id, lv);
|
if (petUpConfig != null)
|
{
|
atk += petUpConfig.AtkAdd;
|
}
|
PetInfoConfig.GetPetSkills(id, lv, true, ref skills);
|
for (int i = 0; i < skills.Count; i++)
|
{
|
atk += GetPetAtkSkillProperty(skills[i], pets);
|
}
|
return atk;
|
}
|
|
public int GetPetAtkSkillProperty(int skillId, List<PetInfo> pets)
|
{
|
SkillConfig skillconfig = SkillConfig.Get(skillId);
|
if (skillconfig == null)
|
{
|
return 0;
|
}
|
if (skillconfig.Effect1 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
|
{
|
return GetPetAttack(skillconfig.EffectValue11, skillconfig.EffectValue12, pets);
|
}
|
else if (skillconfig.Effect2 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
|
{
|
return GetPetAttack(skillconfig.EffectValue21, skillconfig.EffectValue22, pets);
|
}
|
else if (skillconfig.Effect3 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
|
{
|
return GetPetAttack(skillconfig.EffectValue31, skillconfig.EffectValue32, pets);
|
}
|
else if (skillconfig.Effect4 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
|
{
|
return GetPetAttack(skillconfig.EffectValue41, skillconfig.EffectValue42, pets);
|
}
|
else if (skillconfig.Effect5 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
|
{
|
return GetPetAttack(skillconfig.EffectValue51, skillconfig.EffectValue52, pets);
|
}
|
else if (skillconfig.Effect6 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
|
{
|
return GetPetAttack(skillconfig.EffectValue61, skillconfig.EffectValue62, pets);
|
}
|
return 0;
|
}
|
|
int GetPetAttack(int quality, int value, List<PetInfo> pets)
|
{
|
var atk = 0;
|
for (int i = 0; i < pets.Count; i++)
|
{
|
var config = PetInfoConfig.Get(pets[i].id);
|
if (config != null && config.Quality == quality)
|
{
|
var petUpConfig = PetClassCostConfig.GetPetIdAndRank(pets[i].id, pets[i].lv);
|
atk += petUpConfig == null ? 0 : petUpConfig.AtkAdd;
|
}
|
}
|
return (int)(atk * ((float)value / 10000));
|
}
|
|
public bool viewPetStone { get; set; }
|
#endregion
|
|
public event Action<ViewPlayerData> UpdatePlayerParticularEvent;
|
public event Action<int, ViewPlayerData> viewPlayerUpdate;
|
private void ShowRoleParticulars(ViewPlayerData _viewPlayerData)
|
{
|
switch (viewPlayerType)
|
{
|
case 0:
|
case 4:
|
case 5:
|
if (!WindowCenter.Instance.IsOpen<RoleParticularsWin>())
|
{
|
RoleParticularsWin.viewType = viewPlayerType;
|
WindowCenter.Instance.Open<RoleParticularsWin>();
|
}
|
break;
|
case 1:
|
case 6:
|
case 7:
|
if (!WindowCenter.Instance.IsOpen<ViewFuncPowerWin>())
|
{
|
WindowCenter.Instance.Open<ViewFuncPowerWin>();
|
}
|
break;
|
case 2:
|
if (UpdatePlayerParticularEvent != null)
|
{
|
UpdatePlayerParticularEvent(_viewPlayerData);
|
}
|
break;
|
case 3:
|
if (viewPlayerUpdate != null)
|
{
|
viewPlayerUpdate(3, _viewPlayerData);
|
}
|
break;
|
}
|
viewPlayerType = -1;
|
}
|
|
public class ViewPlayerData
|
{
|
public ItemData[] itemDatas;
|
public RolePropData rolePropData;
|
public RolePlusData rolePlusData;
|
|
public DateTime getTime;
|
|
public int GetEquipSuitLevel()
|
{
|
return 0;
|
}
|
|
public int GetItemId(RoleEquipType type)
|
{
|
if (rolePropData.EquipShowID != null)
|
{
|
foreach (var id in rolePropData.EquipShowID)
|
{
|
var itemConfig = ItemConfig.Get(id);
|
if (itemConfig != null && itemConfig.EquipPlace == (int)type)
|
{
|
return id;
|
}
|
}
|
}
|
return 0;
|
}
|
|
public bool IsCrossServerPlayer()
|
{
|
return rolePropData.ServerGroupID != 0
|
&& rolePropData.ServerGroupID != PlayerDatas.Instance.baseData.ServerGroupId;
|
}
|
}
|
|
[Serializable]
|
public class ItemData
|
{
|
public int ItemID;
|
public string UserData;
|
public int ItemIndex;
|
public int IsSuit;
|
public int IsBind;
|
public Dictionary<int, List<int>> useDataDict { get; set; }
|
public void AnalysisUserData()
|
{
|
if (UserData != null && UserData != string.Empty)
|
{
|
useDataDict = ConfigParse.Analysis(UserData);
|
}
|
}
|
}
|
|
[Serializable]
|
public struct RolePropData
|
{
|
public int LV;
|
public int RealmLV;
|
public string Name;
|
public string FamilyName;
|
public int Job;
|
public int JobRank;
|
public int FamilyID;
|
public long FightPower;
|
public uint EquipShowSwitch;
|
public int ServerGroupID;
|
public int VIPLV;
|
public int[] EquipShowID;
|
public int[] LingGenPoint;
|
public long MaxHP;
|
|
public int MinAtk;
|
public int MaxAtk;
|
public int Def;
|
public int Hit;
|
public int Miss;
|
public int SkillAtkRate; // 技能攻击比例加成
|
public int SkillAtkRateReduce; // 技能攻击比例减少
|
public int LuckyHitRate; // 会心一击几率
|
public int LuckyHitVal; // 会心一击伤害固定值
|
public int LuckyHitRateReduce; // 会心一击概率抗性
|
public int LuckyHitReduce; // 会心一击伤害减免固定值
|
public int SuperHitRate; // 暴击概率
|
public int SuperHit; // 暴击伤害固定值
|
public int SuperHitRateReduce; // 暴击概率抗性
|
public int SuperHitReduce; // 暴击伤害抗性固定值
|
public int IceAtk; // 真实伤害 固定值
|
public int IceDef; // 真实伤害防御 固定值
|
public int IgnoreDefRate; // 无视防御几率
|
public int IgnoreDefRateReduce; // 无视防御概率抗性
|
public int IgnoreDefReducePer; // 无视防御伤害减免
|
public int DamagePVE; //伤害输出计算固定值PVE
|
public int DamagePerPVP; // 伤害输出计算百分比PVP
|
public int DamagePerPVPReduce; //伤害输出计算百分比PVP减少
|
public int DamagePVP; // PVP固定伤害
|
public int DamagePVPReduce; // PVP固定减伤
|
public int FinalHurt; // 最终固定伤害增加
|
public int FinalHurtReduce; // 最终固定伤害减少
|
public int FinalHurtPer; // 最终伤害百分比
|
public int FinalHurtReducePer; // 最终伤害减少百分比
|
public int OnlyFinalHurt; // 额外输出伤害
|
public int DamChanceDef; // 20%的概率抵御伤害比率
|
public int NPCHurtAddPer; // 对怪物伤害加成
|
public int AtkBackHPPer; // 攻击回复血量固定值
|
public int PVPAtkBackHP; // PVP攻击回血
|
public int FaintRate; // 击晕概率
|
public int FaintDefRate; // 击晕抵抗概率
|
}
|
|
public class RolePlusData
|
{
|
Dictionary<int, ulong> fightPowerDict = new Dictionary<int, ulong>();
|
Dictionary<int, int> godWeaponDict = new Dictionary<int, int>();
|
Dictionary<int, int> treasureDict = new Dictionary<int, int>();
|
public List<HorseInfo> horses = new List<HorseInfo>();
|
public List<PetInfo> pets = new List<PetInfo>();
|
public List<AlchemyDrug> alchemyDrugs = new List<AlchemyDrug>();
|
public int Horse { get; private set; } //改为等级
|
public int Pet { get; private set; }
|
|
public int AtkSpeed { get; private set; }
|
public int Rune { get; private set; }
|
public int orangeEquipsCount { get; private set; }
|
public int totalGemsLevel { get; private set; }
|
public int totalEquipWashLevel { get; private set; }
|
public int totalEquipStarLevel { get; private set; }
|
public int totalEquipStrengthLevel { get; private set; }
|
public int totalEquipEvolveLevel { get; private set; }
|
public int totalSkillLevel { get; private set; }
|
|
public ulong GetFightPower(int type)
|
{
|
if (fightPowerDict != null && fightPowerDict.ContainsKey(type))
|
{
|
return fightPowerDict[type];
|
}
|
return 0;
|
}
|
|
public int GetTreasureCount(int _type)
|
{
|
if (treasureDict.ContainsKey(_type))
|
{
|
return treasureDict[_type];
|
}
|
return 0;
|
}
|
|
public int GetGodWeaponLevel(int type)
|
{
|
if (godWeaponDict.ContainsKey(type))
|
{
|
return godWeaponDict[type];
|
}
|
return 0;
|
}
|
|
public int GetUseAlchemyDrugsCount()
|
{
|
var count = 0;
|
foreach (var alchemyDrug in alchemyDrugs)
|
{
|
var config = AttrFruitConfig.Get(alchemyDrug.item);
|
if (config != null && config.FuncID == 2)
|
{
|
count += alchemyDrug.count;
|
}
|
}
|
return count;
|
}
|
|
|
public void AnalysisRolePlusData(string jsonStr)
|
{
|
try
|
{
|
var jsonData = JsonMapper.ToObject(jsonStr);
|
if (jsonData.Keys.Contains("FightPowerDict"))
|
{
|
var jsonPlusData = jsonData["FightPowerDict"];
|
if (jsonPlusData.IsObject)
|
{
|
foreach (var key in jsonPlusData.Keys)
|
{
|
int type = int.Parse(key);
|
fightPowerDict.Add(type, ulong.Parse(jsonPlusData[key].ToString()));
|
}
|
}
|
}
|
if (jsonData.Keys.Contains("EquipOrangeCount"))
|
{
|
var jsonPlusData = jsonData["EquipOrangeCount"];
|
orangeEquipsCount = int.Parse(jsonPlusData.ToString());
|
}
|
if (jsonData.Keys.Contains("TotalEquipStar"))
|
{
|
var jsonPlusData = jsonData["TotalEquipStar"];
|
totalEquipStarLevel = int.Parse(jsonPlusData.ToString());
|
}
|
if (jsonData.Keys.Contains("TotalPlusLV"))
|
{
|
var jsonPlusData = jsonData["TotalPlusLV"];
|
totalEquipStrengthLevel = int.Parse(jsonPlusData.ToString());
|
}
|
if (jsonData.Keys.Contains("TotalPlusEvolveLV"))
|
{
|
var jsonPlusData = jsonData["TotalPlusEvolveLV"];
|
totalEquipEvolveLevel = int.Parse(jsonPlusData.ToString());
|
}
|
if (jsonData.Keys.Contains("TotalStoneLV"))
|
{
|
var jsonPlusData = jsonData["TotalStoneLV"];
|
totalGemsLevel = int.Parse(jsonPlusData.ToString());
|
}
|
if (jsonData.Keys.Contains("TotalEquipWashLV"))
|
{
|
var jsonPlusData = jsonData["TotalEquipWashLV"];
|
totalEquipWashLevel = int.Parse(jsonPlusData.ToString());
|
}
|
if (jsonData.Keys.Contains("TotalSkillLV"))
|
{
|
var jsonPlusData = jsonData["TotalSkillLV"];
|
totalSkillLevel = int.Parse(jsonPlusData.ToString());
|
}
|
if (jsonData.Keys.Contains("GodWeapon"))
|
{
|
var jsonPlusData = jsonData["GodWeapon"];
|
if (jsonPlusData.IsObject)
|
{
|
foreach (var key in jsonPlusData.Keys)
|
{
|
int id = int.Parse(key);
|
godWeaponDict.Add(id, int.Parse(jsonPlusData[key].ToString()));
|
}
|
}
|
}
|
if (jsonData.Keys.Contains("Horse"))
|
{
|
var jsonPlusData = jsonData["Horse"];
|
//if (jsonPlusData.IsArray)
|
//{
|
// var horseInfos = JsonMapper.ToObject<HorseInfo[]>(jsonPlusData.ToJson());
|
// if (horseInfos != null && horseInfos.Length > 0)
|
// {
|
// horses.AddRange(horseInfos);
|
// }
|
// horses.Sort(Compare);
|
//}
|
|
if (jsonPlusData.IsObject)
|
{
|
foreach (var key in jsonPlusData.Keys)
|
{
|
if (key == "LV")
|
{
|
Horse = int.Parse(jsonPlusData[key].ToString());
|
}
|
}
|
}
|
|
|
}
|
else
|
{
|
Horse = 0;
|
}
|
if (jsonData.Keys.Contains("Pet"))
|
{
|
var jsonPlusData = jsonData["Pet"];
|
if (jsonPlusData.IsObject)
|
{
|
foreach (var _key in jsonPlusData.Keys)
|
{
|
if (_key.Equals("AtkSpeed"))
|
{
|
AtkSpeed = int.Parse(jsonPlusData[_key].ToString());
|
}
|
else if (_key.Equals("PetLV"))
|
{
|
var petInfos = JsonMapper.ToObject<PetInfo[]>(jsonPlusData[_key].ToJson());
|
if (petInfos != null && petInfos.Length > 0)
|
{
|
for (int i = 0; i < petInfos.Length; i++)
|
{
|
var petInfo = petInfos[i];
|
pets.Add(new PetInfo()
|
{
|
id = petInfo.id,
|
lv = petInfo.lv + 1,
|
});
|
}
|
}
|
}
|
}
|
pets.Sort(Compare);
|
}
|
Pet = pets.Count;
|
}
|
else
|
{
|
Pet = 0;
|
}
|
if (jsonData.Keys.Contains("Rune"))
|
{
|
var jsonPlusData = jsonData["Rune"];
|
Rune = int.Parse(jsonPlusData.ToString());
|
}
|
else
|
{
|
Rune = 0;
|
}
|
if (jsonData.Keys.Contains("MagicWeapon"))
|
{
|
var jsonPlusData = jsonData["MagicWeapon"];
|
if (jsonPlusData.IsObject)
|
{
|
foreach (var _key in jsonPlusData.Keys)
|
{
|
int _type = int.Parse(_key);
|
treasureDict.Add(_type, int.Parse(jsonPlusData[_key].ToString()));
|
}
|
}
|
}
|
if (jsonData.Keys.Contains("Fruit"))
|
{
|
var jsonPlusData = jsonData["Fruit"];
|
if (jsonPlusData.IsObject)
|
{
|
foreach (var _key in jsonPlusData.Keys)
|
{
|
var _itemId = int.Parse(_key);
|
var _count = int.Parse(jsonPlusData[_key].ToString());
|
alchemyDrugs.Add(new AlchemyDrug()
|
{
|
item = _itemId,
|
count = _count,
|
});
|
}
|
}
|
}
|
}
|
catch (Exception e)
|
{
|
DebugEx.Log(e.StackTrace);
|
}
|
}
|
|
int Compare(PetInfo x, PetInfo y)
|
{
|
var config_x = PetInfoConfig.Get(x.id);
|
var config_y = PetInfoConfig.Get(y.id);
|
if (config_x == null || config_y == null)
|
{
|
return 0;
|
}
|
return -config_x.Sort.CompareTo(config_y.Sort);
|
}
|
|
int Compare(HorseInfo x, HorseInfo y)
|
{
|
var config_x = HorseConfig.Get(x.id);
|
var config_y = HorseConfig.Get(y.id);
|
if (config_x == null || config_y == null)
|
{
|
return 0;
|
}
|
return -config_x.Sort.CompareTo(config_y.Sort);
|
}
|
}
|
|
public struct HorseInfo
|
{
|
public int id;
|
public int lv;
|
}
|
|
public struct PetInfo
|
{
|
public int id;
|
public int lv;
|
}
|
|
public struct AlchemyDrug
|
{
|
public int item;
|
public int count;
|
}
|
}
|
}
|
|