skill convert processing

This commit is contained in:
NguyenVanDat
2025-10-31 17:50:04 +07:00
parent b08f6c9de5
commit 4316661cb2
15 changed files with 1695 additions and 1260 deletions
+13
View File
@@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/contentModel.xml
/.idea.perfect-world-unity.iml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+9 -5
View File
@@ -17,11 +17,14 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/47e9cf78f2614f72ae7df046d55ebcf24a400/d6/1d32d257/RoleInfo.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/152439c387994a8da523328132967f8d46ae00/25/5b31e7ab/ThrowHelper.cs" root0="FORCE_HIGHLIGHTING" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 4
}]]></component>
<component name="ProblemsViewState">
<option name="selectedTabId" value="SWEA" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 4
}</component>
<component name="ProjectId" id="32GqMZwPghqrbXiQw3BfBEQJAAE" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
@@ -32,7 +35,7 @@
"ModuleVcsDetector.initialDetectionPerformed": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"git-widget-placeholder": "main",
"git-widget-placeholder": "feature/skill-data",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
@@ -118,6 +121,7 @@
<option name="unityProject" value="true" />
<option name="unityProjectFolder" value="true" />
</component>
<component name="UnityUnitTestConfiguration" currentTestLauncher="Both" />
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
</component>
@@ -1,5 +1,6 @@
fileFormatVersion: 2
guid: d0c06c588e2a6442488a3542551fb243
guid: 95c82a23114631b428b9fff51c373a39
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bac3638b875256b479fb1e463c6e213d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 464b57f0bb61a1143a27580c5fe83dca
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1519,7 +1519,17 @@ namespace ModelRenderer.Scripts.GameData
return 0;
}
public T GetMap<T>(ID_SPACE type) where T : class
{
object result = type switch
{
ID_SPACE.ID_SPACE_ESSENCE => essence_index_id_map,
ID_SPACE.ID_SPACE_CONFIG => config_id_data_map,
_ => null
};
return result as T;
}
void add_id_data(ID_SPACE idSpace, uint id, object data)
{
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8a66485e503bcc04fa01f3cc91813a50
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,32 @@
using System.Collections.Generic;
using UnityEngine;
public class CECComboSkillState
{
public static CECComboSkillState instance;
public static CECComboSkillState Instance {
get
{
if (instance == null)
{
instance = new CECComboSkillState();
}
return instance;
}
set => instance = value;
}
private Dictionary<uint, CECSkill> m_inherentSkillMap = new Dictionary<uint, CECSkill>();
public CECSkill GetInherentSkillByID(uint skillID)
{
if (m_inherentSkillMap.TryGetValue(skillID, out CECSkill skill))
{
return skill;
}
else
{
return null;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b844e9caa9f65d74d8430fa7e120d665
@@ -1,23 +1,164 @@
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
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
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
SKILL_BASE, // ͨ / Normal skill
SKILL_EVIL, // ɼ / Immortal skill
SKILL_GOD, // ħ / Demonic skill
}
}
@@ -29,33 +29,33 @@ namespace BrewMonster.Scripts.Skills
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct LearnRequirement
{
public int level; // 等级要求 // Level requirement
public int sp; // 技能点 // Skill points
public int money; // 金钱 // Money
public int level; // ȼҪ // Level requirement
public int sp; // ܵ // Skill points
public int money; // Ǯ // Money
public int profession; // ְҵ // Profession
public int rank; // 阶级别 // Rank level
public int realm_level; // 境界等级 // Realm level
public int rank; // ׼ // Rank level
public int realm_level; // ȼ // Realm level
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct PetRequirement
{
public int level; // 等级级别 // Level requirement
public int sp; // 宠物技能点 // Pet skill points
public int list; // 宠物技能列表 // Pet skill list
public int lsize; // 列表大小 // List size
public int level; // ȼ // Level requirement
public int sp; // ܵ // Pet skill points
public int list; // б // Pet skill list
public int lsize; // бС // List size
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct GoblinRequirement
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public int[] genius; // 小精灵技能天赋 // Goblin skill talents
public int[] genius; // С // Goblin skill talents
public int profession; // ְҵ // Profession
public int sp; // 精灵元气 // Spirit points
public int money; // 精灵金钱 // Money
public int level; // 小精灵等级 // Goblin level
public int mp; // 小精灵当前魔法点数 // Current magic points
public int sp; // Ԫ // Spirit points
public int money; // Ǯ // Money
public int level; // Сȼ // Goblin level
public int mp; // С鵱ǰħ // Current magic points
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
@@ -89,7 +89,7 @@ namespace BrewMonster.Scripts.Skills
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public int[] genius; //С
public int profession; //ְҵ
public int level; //小锟斤拷锟斤拷燃锟斤拷锟斤拷锟斤拷诩锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟?
public int level; //Сȼڼ?
public int move_env; //˵ǰƶ
};
@@ -114,11 +114,14 @@ namespace BrewMonster.Scripts.Skills
//TODO: Implement this
return 0;
}
public static ElementSkill Create(uint id, int n)
{
return Skill.Create(id, n);
}
//
public virtual ushort[] GetName() { return null;}
public virtual byte[] GetNativeName() { return null;}
// 锟斤拷锟斤拷锟斤拷锟?,锟斤拷skill_type
// ?,skill_type
public virtual byte GetType() { return 1; }
// ͼ
public virtual byte[] GetIcon() { return null; }
@@ -130,7 +133,7 @@ namespace BrewMonster.Scripts.Skills
public virtual int GetCoolingTime() { return 5000; }
// ִʱλ
public virtual int GetExecuteTime() { return 1000; }
// 目锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷, 0:锟斤拷锟斤拷目锟疥,1:锟斤拷要目锟疥,2:目锟斤拷锟斤拷锟斤拷锟绞?锟斤拷, 3:目锟斤拷锟斤拷锟轿?锟斤拷锟斤拷, 4:目锟斤拷锟斤拷锟轿?锟斤拷锟斤拷
// Ŀ, 0:Ŀ꣬1:ҪĿ꣬2:Ŀ?, 3:Ŀ?, 4:Ŀ?
public virtual int GetTargetType(){return 0;}
// Чͷž: <-0.001Ŀ -0.001-0.001 ĬϹ룬>0.001 ͷž
public virtual float GetPrayRange(float range, float prayplus) { return 0; }
@@ -146,7 +149,7 @@ namespace BrewMonster.Scripts.Skills
public virtual int GetRequiredBook() { return 0;}
// ѧϰҪǮ
public virtual int GetRequiredMoney() { return 0;}
// 学习锟斤拷锟襟境斤拷燃锟?
// ѧϰ󾳽ȼ?
public virtual int GetRequiredRealmLevel() { return 0; }
// ǰ
public virtual Dictionary<uint, int> GetRequiredSkill() => new Dictionary<uint, int>();
@@ -154,7 +157,7 @@ namespace BrewMonster.Scripts.Skills
public virtual int GetShowOrder() { return 0; }
// üܼ
public virtual int SetLevel(int level) { return 0; }
// 锟斤拷锟斤拷锟斤拷蠹侗锟?
// 󼶱?
public virtual int GetMaxLevel() { return 0; }
// Ƿ
@@ -163,7 +166,7 @@ namespace BrewMonster.Scripts.Skills
public virtual bool IsAutoAttack(){return false;}
// ˲
public virtual bool IsInstant(){return false;}
// 锟角凤拷锟斤拷锟斤拷锟斤拷锟?
// Ƿ?
public virtual bool IsDurative() { return false; }
// ɱ˷Χ
public virtual int GetRangeType() { return 0; }
@@ -187,7 +190,7 @@ namespace BrewMonster.Scripts.Skills
// ж
public virtual bool ValidWeapon(int w) { return true; }
// 0, 锟缴癸拷锟斤拷1锟斤拷锟斤拷锟斤拷锟斤拷匹锟戒;2, mp锟斤拷锟姐;3锟斤拷位锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟姐;4锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷悖?5锟斤拷锟斤拷锟斤拷ID, 6锟斤拷未选锟斤拷目锟斤拷
// 0, ɹ1ƥ䣻2, mp㣻3λ㣻4?5ID, 6δѡĿ
public int Condition(UseRequirement info)
{
return 0;
+48 -24
View File
@@ -6,7 +6,7 @@ namespace BrewMonster.Scripts.Skills
public class Range
{
/// <summary>0=point 1=line 2=self sphere 3=target sphere 4=cone 5=self</summary>
public char type; // 0点 1线 2自身球 3目标球 4圆锥形 5自身
public char type; // 0 1 2 3Ŀ 4Բ׶ 5
public bool IsPoint() { return type == 0; }
public bool IsLine() { return type == 1; }
@@ -18,9 +18,33 @@ namespace BrewMonster.Scripts.Skills
}
// 占位技能类 // Placeholder Skill class
// ռλ // Placeholder Skill class
public class Skill : ElementSkill
{
protected SkillStub stub;
// protected PlayerWrapper player;
protected uint id;
protected uint level;
Skill(uint i, SkillStub s)
{
id = i;
stub = s;
}
public static Skill Create(uint id, int n)
{
SkillStub stub = SkillStub.GetStub(id);
if(stub == null)
return null;
Skill skill = new Skill(id, stub);
int max = skill.GetMaxLevel();
if(n>max)
skill.SetLevel(max);
else
skill.SetLevel(n);
return skill;
}
}
public abstract class SkillStub
@@ -34,11 +58,11 @@ namespace BrewMonster.Scripts.Skills
public ushort[] name; // // Skill name
public byte[] nativename; // // Native name
public byte[] icon; // ͼ // Skill icon
public int max_level; // 锟斤拷锟斤拷锟斤拷蠹侗锟? // Maximum level
public byte type; // 锟斤拷锟斤拷锟斤拷锟? 1锟斤拷锟斤拷锟斤拷锟斤拷 2锟斤拷锟斤拷锟斤拷锟斤拷 3锟斤拷锟斤拷锟劫伙拷 4锟斤拷锟斤拷 5锟斤拷锟斤拷 // Skill type: 1-Normal 2-Special 3-Partner 4-Mount 5-Other
public int max_level; // 󼶱? // Maximum level
public byte type; // ? 1 2 3ٻ 4 5 // Skill type: 1-Normal 2-Special 3-Partner 4-Mount 5-Other
// Execute condition
public bool allow_ride; // 锟斤拷锟斤拷锟叫? // Allow while riding
public bool allow_ride; // ? // Allow while riding
public short attr; // , 1256 ѡһ Ĭϣ // Attribute: 1-Metal 2-Earth 3-Wood 4-Water 5-Fire 6-Special (Choose one, default none)
public int rank; // // Rank
public int eventflag; // Event flag
@@ -56,26 +80,26 @@ namespace BrewMonster.Scripts.Skills
public Dictionary<uint, int> pre_skills;
// Execute condition
public bool allow_land; // 陆地有效 // Effective on land
public bool allow_air; // 空中有效 // Effective in air
public bool allow_water; // 水中有效 // Effective in water
public bool notuse_in_combat; // 战斗状态不可用 // Cannot use in combat state
public int restrict_corpse; // 只对尸体有效 // Only effective on corpses
public bool restrict_change; // 是否可以变身 // Whether can transform
public bool restrict_attach; // 是否可以附身 // Whether can possess
public bool auto_attack; // 使用后是否自动攻击 // Whether to auto attack after use
public char time_type; // 瞬发类型 // Instant cast type
public bool allow_land; // ½Ч // Effective on land
public bool allow_air; // Ч // Effective in air
public bool allow_water; // ˮЧ // Effective in water
public bool notuse_in_combat; // ս״̬ // Cannot use in combat state
public int restrict_corpse; // ֻʬЧ // Only effective on corpses
public bool restrict_change; // ǷԱ // Whether can transform
public bool restrict_attach; // ǷԸ // Whether can possess
public bool auto_attack; // ʹúǷԶ // Whether to auto attack after use
public char time_type; // ˲ // Instant cast type
public char long_range;
public char posdouble; // 位置选择 // Position selection
public int clslimit; // 职业限制 // Class restriction
public char posdouble; // λѡ // Position selection
public int clslimit; // ְҵ // Class restriction
public int commoncooldown; // 公共冷却mask bit0-4 技能冷却0-4 bit5-9 物品冷却0-4
public int commoncooldown; // ȴmask bit0-4 ȴ0-4 bit5-9 Ʒȴ0-4
// Common cooldown mask bit0-4 skill cooldown 0-4 bit5-9 item cooldown 0-4
public int commoncooldowntime; // 冷却时间,单位毫秒 // Cooldown time in milliseconds
public int commoncooldowntime; // ȴʱλ // Cooldown time in milliseconds
public int itemcost; // 释放时消耗物品 >0有效 // Item cost when casting, effective if >0
public int itemcost; // ͷʱƷ >0Ч // Item cost when casting, effective if >0
// 连击相关 // Combo related
// // Combo related
public int combosk_preskill;
public int combosk_interval;
public int combosk_nobreak;
@@ -122,7 +146,7 @@ namespace BrewMonster.Scripts.Skills
return null;
}
// 以下为从C++转换的接口 // The following methods are converted from C++
// ΪC++תĽӿ // The following methods are converted from C++
public uint GetId() { return id; }
public int GetCls() { return cls; }
public ushort[] GetName() { return name; }
@@ -131,9 +155,9 @@ namespace BrewMonster.Scripts.Skills
public Range GetRange() { return range; }
public int GetItemCost() { return itemcost; }
public bool IsMovingSkill() { return is_movingcast; }
public new byte GetType() { return type; } // 隐藏System.Object.GetType // Hide System.Object.GetType
public new byte GetType() { return type; } // System.Object.GetType // Hide System.Object.GetType
// 运行时相关虚函数 // Runtime-related virtual functions
// ʱ // Runtime-related virtual functions
public virtual int GetCoolingtime(Skill skill) { return 0; }
public virtual int GetRequiredSp(Skill skill) { return 0; }
public virtual int GetRequiredLevel(Skill skill) { return 0; }
@@ -148,7 +172,7 @@ namespace BrewMonster.Scripts.Skills
public virtual bool CheckComboSkExtraCondition(Skill skill) { return true; }
public virtual int GetIntroduction(Skill skill, ushort[] descBuffer, int descBufferLen, ushort[] titleBuffer) { return 0; }
// 武器有效性检查 // Validate weapon restriction
// ЧԼ // Validate weapon restriction
public bool ValidWeapon(int weapon)
{
if (restrict_weapons != null)
File diff suppressed because it is too large Load Diff