From 2b7ad0e335ddfaaba9767fbc42c4377c91247c4d Mon Sep 17 00:00:00 2001 From: Le Duc Anh Date: Sat, 11 Oct 2025 09:50:36 +0700 Subject: [PATCH 1/2] add get id data type function --- .../Common/DataProcess/elementdataman.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs index 1a039ea41e..d15158babc 100644 --- a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs @@ -23,6 +23,7 @@ namespace ModelRenderer.Scripts.GameData } } + #region Dictionary for mapping id with other stuffs public Dictionary essence_id_data_type_map = new Dictionary(); public Dictionary essence_index_id_map = new Dictionary(); public Dictionary essence_id_data_map = new Dictionary(); @@ -46,7 +47,9 @@ namespace ModelRenderer.Scripts.GameData public Dictionary addon_id_data_type_map = new Dictionary(); public Dictionary addon_index_id_map = new Dictionary(); public Dictionary addon_id_data_map = new Dictionary(); + #endregion + #region Arrays for storing the data public EQUIPMENT_ADDON[] equipment_addon_array = new EQUIPMENT_ADDON[0]; public WEAPON_MAJOR_TYPE[] weapon_major_type_array = new WEAPON_MAJOR_TYPE[0]; public WEAPON_SUB_TYPE[] weapon_sub_type_array = new WEAPON_SUB_TYPE[0]; @@ -283,6 +286,7 @@ namespace ModelRenderer.Scripts.GameData public FASHION_SUITE_ESSENCE[] fashion_suite_essence_array = new FASHION_SUITE_ESSENCE[0]; public FASHION_BEST_COLOR_CONFIG[] fashion_best_color_config_array = new FASHION_BEST_COLOR_CONFIG[0]; public SIGN_AWARD_CONFIG[] sign_award_config_array = new SIGN_AWARD_CONFIG[0]; + #endregion public int load_data(string pathname = "") { @@ -1480,6 +1484,34 @@ namespace ModelRenderer.Scripts.GameData return id; } + /// + /// Go through the id - DATA_TYPE map and return the id with the given data type. + /// + /// The id space to search in. Each id space has its own id - DATA_TYPE map. + /// The data type to search for. + /// The id with the given data type. Return 0 if no id is found. + public uint get_id_with_data_type(ID_SPACE idSpace, DATA_TYPE dataType) + { + switch (idSpace) + { + case ID_SPACE.ID_SPACE_ESSENCE: + foreach (var item in essence_id_data_type_map) + { + if (item.Value == dataType) + { + return item.Key; + } + } + break; + // TODO: Add other id spaces here. + default: + return 0; + } + + return 0; + } + + void add_id_data(ID_SPACE idSpace, uint id, object data) { switch (idSpace) From fab1fd053425c9e67294564e7d5a578894bc2b00 Mon Sep 17 00:00:00 2001 From: Le Duc Anh Date: Sat, 11 Oct 2025 09:56:30 +0700 Subject: [PATCH 2/2] fix data type size --- Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs index 38e4576d16..0a4014bbf6 100644 --- a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs +++ b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs @@ -5,6 +5,10 @@ using ModelRenderer.Scripts.Common; namespace BrewMonster { + public class ExpTypesConstants + { + public const int NUM_WEAPON_TYPE = 14; + } public class ElementDataConstants { public const int ELEMENTDATA_NUM_PROFESSION = 12; // Number of professions @@ -4870,7 +4874,7 @@ namespace BrewMonster [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public ushort[] name; // name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = ExpTypesConstants.NUM_WEAPON_TYPE)] public uint[] action_mask; // fashion weapon action masks }