| | |
| | | Dictionary<int, TreasureSkill> treasureSkills = new Dictionary<int, TreasureSkill>();
|
| | | Dictionary<int, List<int>> jobTreasureSkills = new Dictionary<int, List<int>>();
|
| | | Dictionary<int, int> m_ExpertSkills = new Dictionary<int, int>();
|
| | | Dictionary<int, int> m_ExpertActiveLevels = new Dictionary<int, int>();
|
| | |
|
| | | public List<int> skillLevelUpItems = new List<int>();
|
| | |
|
| | |
| | | public event Action<int> skillLevelUpRefresh;
|
| | | public event Action<int, int> potentialLevelRefresh;
|
| | | public event Action expertSkillRefresh;
|
| | | public event Action<int> expertActiveRefresh;
|
| | | public override void Init()
|
| | | {
|
| | | ParseConfig();
|
| | |
| | | skill.Reset();
|
| | | }
|
| | | m_ExpertSkills.Clear();
|
| | | m_ExpertActiveLevels.Clear();
|
| | | serverInited = false;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | private void PlayerDataRefreshEvent(PlayerDataType dataType)
|
| | | {
|
| | | if (dataType == PlayerDataType.LV)
|
| | | if (!serverInited)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (dataType == PlayerDataType.LV
|
| | | || dataType == PlayerDataType.CDBPlayerRefresh_Mater
|
| | | || dataType == PlayerDataType.CDBPlayerRefresh_Wood
|
| | | || dataType == PlayerDataType.CDBPlayerRefresh_Water
|
| | | || dataType == PlayerDataType.CDBPlayerRefresh_Fire
|
| | | || dataType == PlayerDataType.CDBPlayerRefresh_Earth)
|
| | | {
|
| | | UpdateRedpoint();
|
| | | }
|
| | |
| | | void ParseConfig()
|
| | | {
|
| | | var configs = TreasureSkillConfig.GetValues();
|
| | | var index = 0;
|
| | | foreach (var config in configs)
|
| | | {
|
| | | TreasureSkill treasureSkill;
|
| | | if (!treasureSkills.TryGetValue(config.limitSkillId, out treasureSkill))
|
| | | {
|
| | | treasureSkill = new TreasureSkill(config.limitSkillId, index);
|
| | | treasureSkill = new TreasureSkill(config.limitSkillId);
|
| | | treasureSkills.Add(config.limitSkillId, treasureSkill);
|
| | | index++;
|
| | | }
|
| | | treasureSkill.potentials.Add(new TreasurePotential(config.id, 0, config.limitLevel, treasureSkill.redpoint.id));
|
| | | treasureSkill.potentials.Add(new TreasurePotential(config.id, 0, config.limitLevel, treasureSkill.expertRedpoint.id));
|
| | | var skillConfig = SkillConfig.Get(config.limitSkillId);
|
| | |
|
| | | List<int> skills;
|
| | |
| | | return treasureSkills.TryGetValue(skillId, out treasureSkill);
|
| | | }
|
| | |
|
| | | public bool TryGetExpertSkill(int skillId,out int _skill)
|
| | | public bool TryGetExpertSkill(int skillId, out int _skill)
|
| | | {
|
| | | return m_ExpertSkills.TryGetValue(skillId, out _skill);
|
| | | return m_ExpertSkills.TryGetValue(skillId, out _skill) && _skill != 0;
|
| | | }
|
| | |
|
| | | public bool TryGetPotential(int skillId, out TreasurePotential potential)
|
| | |
| | | return potential != null;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool TryGetExpertActiveLevel(int skillId, out int level)
|
| | | {
|
| | | return m_ExpertActiveLevels.TryGetValue(skillId, out level);
|
| | | }
|
| | |
|
| | | public void OnReceivePackage(int oldSkillID, int newSkillID)
|
| | |
| | | {
|
| | | var data = package.InfoList[i];
|
| | | m_ExpertSkills[(int)data.MainSkillID] = (int)data.ElementSkillID;
|
| | |
|
| | | for (int j = 0; j < data.SkillCnt; j++)
|
| | | {
|
| | | m_ExpertActiveLevels[(int)data.ActiveSkill[j].SkillID] = data.ActiveSkill[j].ActiveLV;
|
| | | if (serverInited)
|
| | | {
|
| | | if (expertActiveRefresh != null)
|
| | | {
|
| | | expertActiveRefresh((int)data.ActiveSkill[j].SkillID);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | if (expertSkillRefresh != null)
|
| | | {
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | public bool TryLevelUpPotential(int skillId, out int error)
|
| | | {
|
| | | error = 0;
|
| | | TreasurePotential potential;
|
| | | if (TryGetPotential(skillId, out potential))
|
| | | {
|
| | | if (potential.level >= potential.maxLevel)
|
| | | {
|
| | | error = 11;
|
| | | return false;
|
| | | }
|
| | | var config = potential.GetSkillConfig(potential.level);
|
| | | if (config.LearnSkillReq != 0 && config.LearnSkillLV > 0)
|
| | | {
|
| | | TreasurePotential requirePotential;
|
| | | if (!TryGetPotential(config.LearnSkillReq, out requirePotential)
|
| | | || requirePotential.level < config.LearnSkillLV)
|
| | | {
|
| | | error = 12;
|
| | | return false;
|
| | | }
|
| | | }
|
| | | var upConfig = potential.GetSkillConfig(potential.level + 1);
|
| | | var count = packModel.GetItemCountByID(PackType.Item, upConfig.ExAttr4);
|
| | | if (count < upConfig.ExAttr5)
|
| | | {
|
| | | error = 13;
|
| | | return false;
|
| | | }
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | public void DisplayLevelUpError(int error)
|
| | | {
|
| | | switch (error)
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | public bool ExistAnyUnlockPotential(int skillId)
|
| | | public bool ExistAnyActiveExpert(int skillId)
|
| | | {
|
| | | TreasureSkill treasureSkill;
|
| | | if (TryGetSkill(skillId, out treasureSkill))
|
| | | {
|
| | | for (int i = 0; i < treasureSkill.potentials.Count; i++)
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.LV >= treasureSkill.potentials[i].limitLevel)
|
| | | var level = 0;
|
| | | if (TryGetExpertActiveLevel(treasureSkill.potentials[i].id, out level)
|
| | | && level > 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public bool SatisfyActiveExpert(int skillId)
|
| | | {
|
| | | TreasurePotential expert;
|
| | | if (!TryGetPotential(skillId, out expert))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | if (PlayerDatas.Instance.baseData.LV < expert.limitLevel)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | var level = 0;
|
| | | TryGetExpertActiveLevel(skillId, out level);
|
| | | var skillConfig = SkillConfig.Get(skillId + level);
|
| | | var requireProperty = skillConfig.RequireProperty();
|
| | | var requireValue = skillConfig.RequirePropertyValue();
|
| | | return UIHelper.GetPropertyValue((PropertyType)requireProperty) >= requireValue;
|
| | | }
|
| | |
|
| | | public void SetAlreadyRemind()
|
| | |
| | | }
|
| | |
|
| | | var expertSkill = 0;
|
| | | if (funcOpen && skill.level > 0
|
| | | && !TryGetExpertSkill(skill.skillId, out expertSkill)
|
| | | && ExistAnyUnlockPotential(skill.skillId))
|
| | | if (funcOpen && !TryGetExpertSkill(skill.skillId, out expertSkill)
|
| | | && ExistAnyActiveExpert(skill.skillId))
|
| | | {
|
| | | skill.expertRedpoint.state = RedPointState.Simple;
|
| | | skill.expertSelectRedpoint.state = RedPointState.Simple;
|
| | | }
|
| | | else
|
| | | {
|
| | | skill.expertRedpoint.state = RedPointState.None;
|
| | | skill.expertSelectRedpoint.state = RedPointState.None;
|
| | | }
|
| | |
|
| | | foreach (var expert in skill.potentials)
|
| | | {
|
| | | if (funcOpen && skill.level > 0 && SatisfyActiveExpert(expert.id))
|
| | | {
|
| | | expert.activeRedpoint.state = RedPointState.Simple;
|
| | | }
|
| | | else
|
| | | {
|
| | | expert.activeRedpoint.state = RedPointState.None;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | public Redpoint redpoint { get; private set; }
|
| | | public Redpoint levelUpRedpoint { get; private set; }
|
| | | public Redpoint expertRedpoint { get; private set; }
|
| | | public Redpoint expertSelectRedpoint { get; private set; }
|
| | | public List<TreasurePotential> potentials { get; private set; }
|
| | |
|
| | | public TreasureSkill(int skillId, int redpointIndex)
|
| | | public TreasureSkill(int skillId)
|
| | | {
|
| | | this.skillId = skillId;
|
| | | potentials = new List<TreasurePotential>();
|
| | |
| | | maxLevel = config.SkillMaxLV;
|
| | |
|
| | | redpoint = new Redpoint(10304,
|
| | | TreasureSkillModel.REDPOINTID_BASE + redpointIndex);
|
| | | TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
|
| | | levelUpRedpoint = new Redpoint(redpoint.id,
|
| | | TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
|
| | | expertRedpoint = new Redpoint(redpoint.id,
|
| | | TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
|
| | | expertSelectRedpoint = new Redpoint(expertRedpoint.id,
|
| | | TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
|
| | | }
|
| | |
|
| | |
| | | public readonly int id;
|
| | | public readonly int maxLevel;
|
| | | public readonly int limitLevel;
|
| | | public readonly Redpoint activeRedpoint;
|
| | | public int level { get; private set; }
|
| | |
|
| | | public TreasurePotential(int id, int level,int limitLevel, int redpointBase)
|
| | | public TreasurePotential(int id, int level, int limitLevel, int redpointBase)
|
| | | {
|
| | | this.id = id;
|
| | | this.level = level;
|
| | |
| | |
|
| | | var config = SkillConfig.Get(id);
|
| | | maxLevel = config.SkillMaxLV;
|
| | |
|
| | | activeRedpoint = new Redpoint(redpointBase,
|
| | | TreasureSkillModel.REDPOINTID_BASE + TreasureSkillModel.redpointIndex++);
|
| | | }
|
| | |
|
| | | public SkillConfig GetSkillConfig(int level)
|