Files
test/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs
T
2025-10-31 17:50:04 +07:00

164 lines
6.1 KiB
C#

using System.Collections.Generic;
using ModelRenderer.Scripts.GameData;
namespace BrewMonster.Scripts.Skills
{
class CECHostSkillModel
{
public static CECHostSkillModel instance;
public static CECHostSkillModel Instance {
get
{
if (instance == null)
{
instance = new CECHostSkillModel();
}
return instance;
}
set => instance = value;
}
public void Initialize()
{
// Çå¿ÕËùÓм¼ÄÜ£¬·ÀÖ¹ÒòΪ¶à¸ö½ÇÉ«µÇ¼µ¼ÖÂÖØ¸´¼ÓÔØ¼¼ÄÜ
Release();
InitAllSkillsOfCurProf();
/*FindAllNPCsOfCurProf();
std::set<int> rootSkills = GetRootSkillSet();
InitSkillTreeHeightMap(rootSkills);
InitSkillTreeRootMap(rootSkills);
m_bInitialized = true;
// ÖØÐ´¦ÀíNPCLIST
ProcessServiceList();*/
}
public void InitAllSkillsOfCurProf()
{
// --- B1: Thu thập toàn bộ skill từ các NPC có cung cấp dịch vụ học skill ---
HashSet<uint> npcSkills = new HashSet<uint>();
{
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE dt = DATA_TYPE.DT_NPC_ESSENCE;
// uint id = pDB.get_id_with_data_type(ID_SPACE.ID_SPACE_ESSENCE, dt);
var map = pDB.GetMap<Dictionary<uint, DATA_TYPE>>(ID_SPACE.ID_SPACE_ESSENCE);
uint id;
foreach (var item in map)
{
if (item.Value == dt)
{
id = item.Key;
}
else
{
continue;
}
NPC_ESSENCE npcEssence = (NPC_ESSENCE)pDB.get_data_ptr(id, ID_SPACE.ID_SPACE_ESSENCE,ref dt);
if (npcEssence.id_skill_service != 0 &&
(npcEssence.combined_switch & (uint)NPC_COMBINED_SWITCH.NCS_IGNORE_DISTANCE_CHECK) != 0)
{
NPC_SKILL_SERVICE skillService = (NPC_SKILL_SERVICE)pDB.get_data_ptr(
npcEssence.id_skill_service, ID_SPACE. ID_SPACE_ESSENCE, ref dt
);
for (int i = 0; i < skillService.id_skills.Length; i++)
{
uint skillId = skillService.id_skills[i];
if (skillId != 0 &&
CECComboSkillState.Instance.GetInherentSkillByID(skillId) == null)
{
npcSkills.Add(skillId);
}
}
}
}
}
// --- B2: Duyệt tất cả skill, lọc skill theo class hiện tại của người chơi ---
uint curID = 0;
while ((curID = ElementSkill.NextSkill(curID)) != 0)
{
ElementSkill pSkill = ElementSkill.Create(curID, 1);
/*int cls = pSkill.GetCls();
int playerCls = g_pGame.GetGameRun().GetHostPlayer().GetProfession();
bool isSameClass = (cls == playerCls || cls == 255);
bool isProvidedByNPC = npcSkills.Contains(curID);
if (isSameClass && isProvidedByNPC)
{
m_allProfSkills[curID] = pSkill;
if (!m_allRankProfSkills.ContainsKey(pSkill.GetRank()))
m_allRankProfSkills[pSkill.GetRank()] = new List<int>();
m_allRankProfSkills[pSkill.GetRank()].Add(curID);
}
else
{
pSkill.Destroy();
}*/
}
// --- B3: Sắp xếp skill trong từng rank theo thứ tự hiển thị ---
/*foreach (var kvp in m_allRankProfSkills)
{
kvp.Value.Sort((lhs, rhs) =>
{
var lSkill = GNET.ElementSkill.Create(lhs, 1);
var rSkill = GNET.ElementSkill.Create(rhs, 1);
bool result;
if (lSkill.GetType() == GNET.ElementSkill.TYPE_PASSIVE &&
rSkill.GetType() != GNET.ElementSkill.TYPE_PASSIVE)
{
result = false;
}
else if (lSkill.GetType() != GNET.ElementSkill.TYPE_PASSIVE &&
rSkill.GetType() == GNET.ElementSkill.TYPE_PASSIVE)
{
result = true;
}
else
{
result = lSkill.GetShowOrder() < rSkill.GetShowOrder();
}
lSkill.Destroy();
rSkill.Destroy();
return result ? -1 : 1;
});
}*/
}
private void Release()
{
throw new System.NotImplementedException();
}
}
public enum enumSkillFitLevelState
{
SKILL_FIT_LEVEL, // ȼ / Skill meets level, cultivation, realm requirements
SKILL_NOT_FIT_LEVEL, // ܲȼ / Skill does not meet level, cultivation, realm requirements
}
public enum enumSkillLearnedState
{
SKILL_NOT_LEARNED, // δѧϰ / Skill not learned
SKILL_LEARNED, // ѧϰ / Skill learned but not at max level
SKILL_FULL, // / Skill at max level
SKILL_OVERRIDDEN, // ѱ / Skill has been overridden
}
public enum enumEvilGod
{
SKILL_BASE, // ͨ / Normal skill
SKILL_EVIL, // ɼ / Immortal skill
SKILL_GOD, // ħ / Demonic skill
}
}