diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs index 598086940a..45aa4f3edb 100644 --- a/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/elementdataman.cs @@ -1765,15 +1765,11 @@ namespace ModelRenderer.Scripts.GameData break; case ID_SPACE.ID_SPACE_ADDON: - BMLogger.Log("[thn] weapon addon map count: " + addon_id_data_map.Count); - BMLogger.Log("[thn] weapon addon id: " + id); if (addon_id_data_map.TryGetValue(id, out data)) { - dataType = addon_id_data_type_map[id]; return data; } - BMLogger.Log("[thn] weapon addon data: " + data); break; default: diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs index ea8eeec9a1..36685b2f41 100644 --- a/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs @@ -35,12 +35,12 @@ public static class generate_item_temp if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP) { float[] drop_probability_socket = { ess.drop_probability_socket0, ess.drop_probability_socket1, ess.drop_probability_socket2 }; - hole_num = (uint)element_data.RandSelect_SPECIFIC_LOWER(drop_probability_socket.ToList(), SPECIFIC.SPECIFIC_RAND, LOWER.LOWER_TREND); //�׶�����Ŀ + hole_num = (uint)element_data.RandSelect(drop_probability_socket.ToList(), cls, LOWER.LOWER_TREND); //�׶�����Ŀ } else //if(normal_addon == element_data::ADDON_LIST_PRODUCE || normal_addon == element_data::ADDON_LIST_SPEC) { float[] make_probability_socket = { ess.make_probability_socket0, ess.make_probability_socket1, ess.make_probability_socket2 }; - hole_num = (uint)element_data.RandSelect_SPECIFIC_LOWER(make_probability_socket.ToList(), SPECIFIC.SPECIFIC_RAND, LOWER.LOWER_TREND); //�׶�����Ŀ + hole_num = (uint)element_data.RandSelect(make_probability_socket.ToList(), cls, LOWER.LOWER_TREND); //�׶�����Ŀ } size += hole_num*sizeof(int); // size ����hole_num������type @@ -54,7 +54,7 @@ public static class generate_item_temp byte[] addon_buf = new byte[candidate_num*Marshal.SizeOf(typeof(itemdataman._addon))]; float[] probability_addon_num = { ess.probability_addon_num0, ess.probability_addon_num1, ess.probability_addon_num2, ess.probability_addon_num3, ess.probability_addon_num4, ess.probability_addon_num5 }; //log each probability_addon_num - uint addon_num = (uint)element_data.RandSelect_NORMAL_LOWER(probability_addon_num.ToList(), NORMAL.NORMAL_RAND, LOWER.LOWER_TREND); //���Ա���Ŀ����Ŀ + uint addon_num = (uint)element_data.RandSelect(probability_addon_num.ToList(), cls, LOWER.LOWER_TREND); //���Ա���Ŀ����Ŀ uint addon_size = 0; // if(ess->fixed_props) @@ -106,7 +106,6 @@ public static class generate_item_temp } size += addon_size; - BMLogger.Log("[thn]generate_weapon, addon_size: " + addon_size); // allocate the buffer with exact length // *data = (char *)abase::fastalloc(size); @@ -200,7 +199,7 @@ public static class generate_item_temp // temp = element_data::RandNormal(ess->durability_drop_min, ess->durability_drop_max, cls,element_data::UPPER_TREND); // if(temp > temp2) temp = temp2; // } - int temp2 = element_data.RandNormal_NORMAL_LOWER(ess.durability_min, ess.durability_max, NORMAL.NORMAL_RAND, LOWER.LOWER_TREND); + int temp2 = element_data.RandNormal(ess.durability_min, ess.durability_max, cls, LOWER.LOWER_TREND); int temp = temp2; if(normal_addon != GEN_ADDON_MODE.ADDON_LIST_DROP || (ess.proc_type & 0x1000) != 0) { @@ -208,7 +207,7 @@ public static class generate_item_temp } else { - temp = element_data.RandNormal_NORMAL_UPPER(ess.durability_drop_min, ess.durability_drop_max, NORMAL.NORMAL_RAND, UPPER.UPPER_TREND); + temp = element_data.RandNormal(ess.durability_drop_min, ess.durability_drop_max, cls, UPPER.UPPER_TREND); if(temp > temp2) temp = temp2; } @@ -222,8 +221,9 @@ public static class generate_item_temp // memcpy(buf,tag,tag_size); // buf += tag_size; WriteShort(data, ref offset, (short)Marshal.SizeOf(typeof(_weapon_essence))); + WriteByte(data, ref offset, tag.type); // MadeFrom - WriteByte(data, ref offset, 0); + WriteByte(data, ref offset, (byte)tag.size); //essence //char ����[]; //ÿ�ֲ�ͬװ���ı���ṹ���? // char * essence_ptr = buf; @@ -262,9 +262,9 @@ public static class generate_item_temp WriteInt(data, ref offset, ess.level); WriteUInt(data, ref offset, ess.require_projectile); WriteInt(data, ref offset, ess.damage_low); - WriteInt(data, ref offset, element_data.RandNormal_NORMAL_LOWER(ess.damage_high_min, ess.damage_high_max, NORMAL.NORMAL_RAND, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, element_data.RandNormal(ess.damage_high_min, ess.damage_high_max, cls, LOWER.LOWER_TREND)); WriteInt(data, ref offset, ess.magic_damage_low); - WriteInt(data, ref offset, element_data.RandNormal_NORMAL_LOWER(ess.magic_damage_high_min, ess.magic_damage_high_max, NORMAL.NORMAL_RAND, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, element_data.RandNormal(ess.magic_damage_high_min, ess.magic_damage_high_max, cls, LOWER.LOWER_TREND)); // WEAPON_SUB_TYPE * subtype = (WEAPON_SUB_TYPE * )get_data_ptr(ess->id_sub_type, ID_SPACE_ESSENCE, datatype); // if(subtype == NULL || datatype != DT_WEAPON_SUB_TYPE) // { @@ -286,7 +286,7 @@ public static class generate_item_temp { subtype = (WEAPON_SUB_TYPE)sub_type_temp; float[] probability_attack_speed = { subtype.probability_fastest, subtype.probability_fast, subtype.probability_normal, subtype.probability_slow, subtype.probability_slowest }; - int index = element_data.RandSelect_SPECIFIC_MIDDLE(probability_attack_speed.ToList(), SPECIFIC.SPECIFIC_RAND, MIDDLE.MIDDLE_TREND); + int index = element_data.RandSelect(probability_attack_speed.ToList(), cls, MIDDLE.MIDDLE_TREND); WriteInt(data, ref offset, (int)(subtype.attack_speed*20f + 0.1f) + (index - 2)); } @@ -354,7 +354,7 @@ public static class generate_item_temp int RE_num = 0; if(!b_fixed) { - RE_num = element_data.RandSelect_SPECIFIC_LOWER(count_prop.ToList(), SPECIFIC.SPECIFIC_RAND, LOWER.LOWER_TREND); + RE_num = element_data.RandSelect(count_prop.ToList(), cls, LOWER.LOWER_TREND); } if(RE_num == 5) return; // Ensure RE_num is within valid range for md_adjust array (0-4) @@ -382,7 +382,7 @@ public static class generate_item_temp } int low = res_list[index *2].low; int high= res_list[index *2+1].high; - res[index] = (int)(element_data.RandNormal_NORMAL_LOWER(low, high, NORMAL.NORMAL_RAND, LOWER.LOWER_TREND) * adj); + res[index] = (int)(element_data.RandNormal(low, high, cls, LOWER.LOWER_TREND) * adj); } } public static int generate_armor(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls, @@ -405,19 +405,19 @@ public static class generate_item_temp if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP) { float[] drop_probability_socket = { ess.drop_probability_socket0, ess.drop_probability_socket1, ess.drop_probability_socket2 }; - hole_num = (short)element_data.RandSelect_SPECIFIC_LOWER(drop_probability_socket.ToList(), SPECIFIC.SPECIFIC_RAND, LOWER.LOWER_TREND); //�׶�����Ŀ + hole_num = (short)element_data.RandSelect(drop_probability_socket.ToList(), cls, LOWER.LOWER_TREND); //�׶�����Ŀ } else //if(normal_addon == element_data::ADDON_LIST_PRODUCE || normal_addon == element_data::ADDON_LIST_SPEC) { float[] make_probability_socket = { ess.make_probability_socket0, ess.make_probability_socket1, ess.make_probability_socket2 }; - hole_num = (short)element_data.RandSelect_SPECIFIC_MIDDLE(make_probability_socket.ToList(), SPECIFIC.SPECIFIC_RAND, MIDDLE.MIDDLE_TREND); //�׶�����Ŀ + hole_num = (short)element_data.RandSelect(make_probability_socket.ToList(), cls, MIDDLE.MIDDLE_TREND); //�׶�����Ŀ } size += (uint)(hole_num*sizeof(int)); // size ����hole_num������type size += (uint)Marshal.SizeOf(typeof(item_tag_t)); uint candidate_num = itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS; byte[] addon_buf = new byte[candidate_num*Marshal.SizeOf(typeof(itemdataman._addon))]; float[] probability_addon_num = { ess.probability_addon_num0, ess.probability_addon_num1, ess.probability_addon_num2, ess.probability_addon_num3, ess.probability_addon_num4 }; - uint addon_num = (uint)element_data.RandSelect_SPECIFIC_LOWER(probability_addon_num.ToList(), SPECIFIC.SPECIFIC_RAND, LOWER.LOWER_TREND); //���Ա���Ŀ����Ŀ + uint addon_num = (uint)element_data.RandSelect(probability_addon_num.ToList(), cls, LOWER.LOWER_TREND); //���Ա���Ŀ����Ŀ uint addon_size = 0; if(ess.fixed_props!=0) { @@ -495,7 +495,7 @@ public static class generate_item_temp WriteShort(data, ref offset, (short)ess.require_agility); WriteShort(data, ref offset, (short)ess.require_energy); - int temp2 = element_data.RandNormal_NORMAL_LOWER(ess.durability_min, ess.durability_max, NORMAL.NORMAL_RAND, LOWER.LOWER_TREND); + int temp2 = element_data.RandNormal(ess.durability_min, ess.durability_max, cls, LOWER.LOWER_TREND); int temp = temp2; if(normal_addon != GEN_ADDON_MODE.ADDON_LIST_DROP || (ess.proc_type & 0x1000) != 0) { @@ -503,19 +503,20 @@ public static class generate_item_temp } else { - temp = element_data.RandNormal_NORMAL_UPPER(ess.durability_drop_min, ess.durability_drop_max, NORMAL.NORMAL_RAND, UPPER.UPPER_TREND); + temp = element_data.RandNormal(ess.durability_drop_min, ess.durability_drop_max, cls, UPPER.UPPER_TREND); if(temp > temp2) temp = temp2; } WriteInt(data, ref offset, temp); // durability WriteInt(data, ref offset, temp2); // max_durability WriteShort(data, ref offset, (short)Marshal.SizeOf(typeof(ARMOR_ESSENCE))); - WriteTag(data, ref offset, tag); + WriteByte(data, ref offset, (byte)tag.type); // MadeFrom + WriteByte(data, ref offset, (byte)tag.size); int essence_ptr = offset; - WriteInt(data, ref offset, element_data.RandNormal_NORMAL_LOWER(ess.defence_low, ess.defence_high, NORMAL.NORMAL_RAND, LOWER.LOWER_TREND)); - WriteInt(data, ref offset, element_data.RandNormal_NORMAL_LOWER(ess.armor_enhance_low, ess.armor_enhance_high, NORMAL.NORMAL_RAND, LOWER.LOWER_TREND)); - WriteInt(data, ref offset, element_data.RandNormal_NORMAL_LOWER(ess.mp_enhance_low, ess.mp_enhance_high, NORMAL.NORMAL_RAND, LOWER.LOWER_TREND)); - WriteInt(data, ref offset, element_data.RandNormal_NORMAL_LOWER(ess.hp_enhance_low, ess.hp_enhance_high, NORMAL.NORMAL_RAND, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, element_data.RandNormal(ess.defence_low, ess.defence_high, cls, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, element_data.RandNormal(ess.armor_enhance_low, ess.armor_enhance_high, cls, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, element_data.RandNormal(ess.mp_enhance_low, ess.mp_enhance_high, cls, LOWER.LOWER_TREND)); + WriteInt(data, ref offset, element_data.RandNormal(ess.hp_enhance_low, ess.hp_enhance_high, cls, LOWER.LOWER_TREND)); int[] res = {0,0,0,0,0}; List res_list = ess.magic_defences.ToList(); generate_magic_defense(res, res_list, cls, ess.force_all_magic_defences != 0 || ess.fixed_props!=0); diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs index 3f61028741..b4085ec4c8 100644 --- a/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs @@ -36,7 +36,7 @@ namespace BrewMonster return lower + (upper - lower) * rng / (float)RAND_MAX; } - public static int RandNormal(int lower, int upper) { return Rand(lower, upper); } + public static int RandNormal(float lower, float upper) { return (int)Rand(lower, upper); } public static float RandUniform() { return Rand(0f, 1f); } public static int RandSelect(List option) @@ -146,97 +146,115 @@ namespace BrewMonster } public static class element_data { - public static int RandNormal(int lower, int upper, TCls c) where TCls : SpecCls - { - return c.RandNormal(lower, upper); - } - public static int RandSelect(List option, TCls c) where TCls : SpecCls - { - return c.RandSelect(option); - } - public static float Rand(float lower, float upper, TCls c) where TCls : SpecCls - { - return c.Rand(lower, upper); - } - public static int RandSelect_NORMAL_LOWER(List option, NORMAL normalType, LOWER lowerTrend) - { - return abase.abase.RandSelect(option); - } - public static int RandSelect_NORMAL_MIDDLE(List option, NORMAL normalType, MIDDLE middleTrend) - { - return abase.abase.RandSelect(option); - } - public static int RandSelect_SPECIFIC_LOWER(List option, SPECIFIC specificType, LOWER lowerTrend) + public static int RandNormal(int lower, int upper, TCls c ,TTrend trend) { + if(c != null && c.Equals(NORMAL.NORMAL_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + else if (trend != null && trend.Equals(UPPER.UPPER_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + else if (trend != null && trend.Equals(ANY.ANY_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + } + else if(c != null && c.Equals(SPECIFIC.SPECIFIC_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return lower; + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return (lower + upper) / 2; + } + else if (trend != null && trend.Equals(UPPER.UPPER_TREND)) + { + return upper; + } + else if (trend != null && trend.Equals(ANY.ANY_TREND)) + { + return abase.abase.RandNormal(lower, upper); + } + } return 0; } - public static int RandSelect_SPECIFIC_MIDDLE(List option, SPECIFIC specificType, MIDDLE middleTrend) + public static int RandSelect(List option, TCls c, TTrend trend) { - return option.Count / 2; + if(c != null && c.Equals(NORMAL.NORMAL_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return abase.abase.RandSelect(option); + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return abase.abase.RandSelect(option); + } + } + else if(c != null && c.Equals(SPECIFIC.SPECIFIC_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return 0; + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return option.Count /2; + } + } + return 0; } - public static int RandNormal_NORMAL_LOWER(int lower, int upper, NORMAL normalType, LOWER lowerTrend) + public static float Rand(float lower, float upper, TCls c, TTrend trend) { - return abase.abase.RandNormal(lower, upper); - } - public static int RandNormal_NORMAL_UPPER(int lower, int upper, NORMAL normalType, UPPER upperTrend) - { - return abase.abase.RandNormal(lower, upper); - } - public static int RandNormal_NORMAL_MIDDLE(int lower, int upper, NORMAL normalType, MIDDLE middleTrend) - { - return abase.abase.RandNormal(lower, upper); - } - public static int RandNormal_NORMAL_ANY(int lower, int upper, NORMAL normalType, ANY anyTrend) - { - return abase.abase.RandNormal(lower, upper); - } - public static int RandNormal_SPECIFIC_LOWER(int lower, int upper, SPECIFIC specificType, LOWER lowerTrend) - { - return lower; - } - public static int RandNormal_SPECIFIC_UPPER(int lower, int upper, SPECIFIC specificType, UPPER upperTrend) - { - return upper; - } - public static int RandNormal_SPECIFIC_MIDDLE(int lower, int upper, SPECIFIC specificType, MIDDLE middleTrend) - { - return (upper + lower) / 2; - } - public static int RandNormal_SPECIFIC_ANY(int lower, int upper, SPECIFIC specificType, ANY anyTrend) - { - return abase.abase.RandNormal(lower, upper); - } - public static float Rand_NORMAL_LOWER(float lower, float upper, NORMAL normalType, LOWER lowerTrend) - { - return abase.abase.Rand(lower, upper); - } - public static float Rand_NORMAL_MIDDLE(float lower, float upper, NORMAL normalType, MIDDLE middleTrend) - { - return abase.abase.Rand(lower, upper); - } - public static float Rand_NORMAL_UPPER(float lower, float upper, NORMAL normalType, UPPER upperTrend) - { - return abase.abase.Rand(lower, upper); - } - public static float Rand_NORMAL_ANY(float lower, float upper, NORMAL normalType, ANY anyTrend) - { - return abase.abase.Rand(lower, upper); - } - public static float Rand_SPECIFIC_LOWER(float lower, float upper, SPECIFIC specificType, LOWER lowerTrend) - { - return lower; - } - public static float Rand_SPECIFIC_MIDDLE(float lower, float upper, SPECIFIC specificType, MIDDLE middleTrend) - { - return (upper + lower) / 2; - } - public static float Rand_SPECIFIC_UPPER(float lower, float upper, SPECIFIC specificType, UPPER upperTrend) - { - return upper; - } - public static float Rand_SPECIFIC_ANY(float lower, float upper, SPECIFIC specificType, ANY anyTrend) - { - return abase.abase.Rand(lower, upper); + if(c != null && c.Equals(NORMAL.NORMAL_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return abase.abase.Rand(lower, upper); + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return abase.abase.Rand(lower, upper); + } + else if (trend != null && trend.Equals(UPPER.UPPER_TREND)) + { + return abase.abase.Rand(lower, upper); + } + else if (trend != null && trend.Equals(ANY.ANY_TREND)) + { + return abase.abase.Rand(lower, upper); + } + } + else if(c != null && c.Equals(SPECIFIC.SPECIFIC_RAND)) + { + if (trend != null && trend.Equals(LOWER.LOWER_TREND)) + { + return lower; + } + else if (trend != null && trend.Equals(MIDDLE.MIDDLE_TREND)) + { + return (lower + upper) / 2; + } + else if (trend != null && trend.Equals(UPPER.UPPER_TREND)) + { + return upper; + } + else if (trend != null && trend.Equals(ANY.ANY_TREND)) + { + return abase.abase.Rand(lower, upper); + } + } + return 0; } } public enum GEN_ADDON_MODE @@ -424,9 +442,8 @@ namespace BrewMonster uint size = 0; int ret = 0; DATA_TYPE datatype = DATA_TYPE.DT_INVALID; - item_tag_t tag = new item_tag_t((byte)ITEM_MAKE_TAG.IMT_SHOP, (byte)'0'); + item_tag_t tag = new item_tag_t((byte)ITEM_MAKE_TAG.IMT_SHOP, (byte)0); //uint id = _edm.get_first_data_id(ID_SPACE.ID_SPACE_ESSENCE,ref datatype); - BMLogger.Log("[THN]itemdataman: generate_item_for_sell: _edm.essence_id_data_type_map.Count: " + _edm.essence_id_data_type_map.Count); for (int i = 0; i < _edm.essence_id_data_type_map.Count; i++) { ret = 0; @@ -749,8 +766,7 @@ namespace BrewMonster // } #endregion - } - BMLogger.Log("[THN]itemdataman: generate_item_for_sell: sale_item_ptr_array.Count: " + sale_item_ptr_array.Count); + } return 0; } @@ -833,8 +849,8 @@ namespace BrewMonster { //���ɶ��addon�����ܻ��в�������ʧ�� - if(addon_num == 0) - return 0; + //if(addon_num == 0) + //return 0; byte[] addon_sld = addon_buffer; int i,j; int anum = 0; @@ -910,7 +926,7 @@ namespace BrewMonster { uint un = 0; //ASSERT(addon_size == 0); - if(element_data.Rand_NORMAL_LOWER(0f,1f,NORMAL.NORMAL_RAND,LOWER.LOWER_TREND) < unique_prob) + if(element_data.Rand(0f,1f,cls,LOWER.LOWER_TREND) < unique_prob) { un = 1; addon_size = generate_equipment_addon_buffer(dt, unique, 16, addon_buf,0, un); @@ -923,7 +939,7 @@ namespace BrewMonster { uint un = 0; //ASSERT(addon_size == 0); - if(element_data.Rand_NORMAL_LOWER(0f,1f,NORMAL.NORMAL_RAND,LOWER.LOWER_TREND) < unique_prob) + if(element_data.Rand(0f,1f,cls,LOWER.LOWER_TREND) < unique_prob) { un = 1; addon_size = generate_equipment_addon_buffer(dt, unique, 16, addon_buf,0, un); diff --git a/Assets/PerfectWorld/Scripts/Inventory/EC_IvtrType.cs b/Assets/PerfectWorld/Scripts/Inventory/EC_IvtrType.cs index 17a088ea27..27a4b3dcf8 100644 --- a/Assets/PerfectWorld/Scripts/Inventory/EC_IvtrType.cs +++ b/Assets/PerfectWorld/Scripts/Inventory/EC_IvtrType.cs @@ -2,7 +2,10 @@ namespace BrewMonster.Scripts { public class InventoryConst { + // Equipment endurance scale public const int ENDURANCE_SCALE = 100; + // NUM_MAGICCLASS + public const int NUM_MAGICCLASS = 5; // Index of item in equipment inventory public const int EQUIPIVTR_WEAPON = 0; public const int EQUIPIVTR_HEAD = 1; diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrArmor.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrArmor.cs new file mode 100644 index 0000000000..1a87d95aae --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrArmor.cs @@ -0,0 +1,537 @@ +// /* +// * FILE: EC_IvtrWeapon.cpp +// * +// * DESCRIPTION: +// * +// * CREATED BY: Duyuxin, 2004/11/19 +// * +// * HISTORY: +// * +// * Copyright (c) 2004 Archosaur Studio, All Rights Reserved. +// */ + +// #include "EC_Global.h" +// #include "EC_IvtrWeapon.h" +// #include "EC_Game.h" +// #include "EC_FixedMsg.h" +// #include "EC_GameRun.h" +// #include "EC_HostPlayer.h" +// #include "EC_RTDebug.h" +// #include "elementdataman.h" +// #include "EC_Configs.h" +using BrewMonster; +using ModelRenderer.Scripts.GameData; +using System.Collections.Generic; +using BrewMonster.Network; +using BrewMonster.Scripts.Managers; +using BrewMonster.Scripts; +#region C# regions +// #define new A_DEBUG_NEW + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Define and Macro +// // +// /////////////////////////////////////////////////////////////////////////// + + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Reference to External variables and functions +// // +// /////////////////////////////////////////////////////////////////////////// + + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Local Types and Variables and Global variables +// // +// /////////////////////////////////////////////////////////////////////////// + + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Local functions +// // +// /////////////////////////////////////////////////////////////////////////// + +// /////////////////////////////////////////////////////////////////////////// +// // +// // Implement CECIvtrWeapon +// // +// /////////////////////////////////////////////////////////////////////////// +#endregion + +namespace PerfectWorld.Scripts.Managers +{ + + public class EC_IvtrArmor : EC_IvtrEquip + { + //Attributes + //Weapon essence data + protected IVTR_ESSENCE_ARMOR m_Essence; + // data in database + protected ARMOR_MAJOR_TYPE m_pDBMajorType; + protected ARMOR_SUB_TYPE m_pDBSubType; + protected ARMOR_ESSENCE m_pDBEssence; + + public EC_IvtrArmor(int tid, int expire_date) : base(tid, expire_date) + { + m_iCID = ICID_WEAPON; + elementdataman pDB = ElementDataManProvider.GetElementDataMan(); + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + m_pDBEssence = (ARMOR_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_pDBMajorType = (ARMOR_MAJOR_TYPE)pDB.get_data_ptr(m_pDBEssence.id_major_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_pDBSubType = (ARMOR_SUB_TYPE)pDB.get_data_ptr(m_pDBEssence.id_sub_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + m_iPileLimit = m_pDBEssence.pile_num_max; + m_iPrice = m_pDBEssence.price; + m_iShopPrice = m_pDBEssence.shop_price; + m_i64EquipMask = EC_IvtrEquip.ICID_WEAPON; + m_iProcType = (int)m_pDBEssence.proc_type; + + FixProps = m_pDBEssence.fixed_props; + RepairFee = m_pDBEssence.repairfee; + ReputationReq = m_pDBEssence.require_reputation; + } + public EC_IvtrArmor(EC_IvtrArmor other) : base(other) + { + m_pDBEssence = other.m_pDBEssence; + m_pDBMajorType = other.m_pDBMajorType; + m_pDBSubType = other.m_pDBSubType; + m_Essence = other.m_Essence; + } + + // CECIvtrWeapon::~CECIvtrWeapon() + // { + // } + + public override bool SetItemInfo(byte[] pInfoData, int iDataLen) + { + base.SetItemInfo(pInfoData, iDataLen); + if(pInfoData == null || iDataLen == 0) + { + return true; + } + + try + { + CECDataReader dr = new CECDataReader(pInfoData ,iDataLen); + // Skip equip requirements and endurance + dr.Offset(6 * sizeof(short), CECDataReader.SEEK_CUR); + dr.Offset(2 * sizeof(int), CECDataReader.SEEK_CUR); + int iEssenceSize = dr.ReadShort(); + // Skip maker's information + dr.ReadByte(); + int iMakerLen = dr.ReadByte(); + dr.Offset(iMakerLen, CECDataReader.SEEK_CUR); + byte[] iEssenceData = dr.ReadData(iEssenceSize); + m_Essence = new IVTR_ESSENCE_ARMOR(iEssenceData); + // ���븽������˵�� + if(m_pDBEssence.fixed_props != 0 && m_pDBEssence.probability_addon_num0 != 1.0f) + { + // Get database data + elementdataman pDataMan = ElementDataManProvider.GetElementDataMan(); + CECStringTab PropTab = EC_Game.GetItemExtProp(); + int i, iSize = 0; + for(i=0;i<32;i++) + { + if(m_pDBEssence.addons[i].id_addon != 0) + iSize++; + } + if(iSize > 0 && Props.Count == 0) + { + Props.Capacity = iSize; + for(i=0;i<32;i++) + { + if(m_pDBEssence.addons[i].id_addon != 0) + { + Property Prop = new Property(); + Prop.Type = (int)m_pDBEssence.addons[i].id_addon; + Prop.Embed = false; + Prop.Suite = false; + Prop.Engraved = false; + Prop.Local = false; + byte bType = PropTab.GetWideString(Prop.Type) != null ? (byte)0xff : (byte)0xff; + DATA_TYPE DataType = DATA_TYPE.DT_INVALID; + object pData = pDataMan.get_data_ptr(m_pDBEssence.addons[i].id_addon, ID_SPACE.ID_SPACE_ADDON, ref DataType); + if (DataType != DATA_TYPE.DT_EQUIPMENT_ADDON) + { + return false; + } + EQUIPMENT_ADDON pAddon = (EQUIPMENT_ADDON)pData; + Prop.NumParam = pAddon.num_params; + for(int j=0; j < Prop.NumParam; j++) + { + if(j==0) + { + Prop.Params[0] = pAddon.param1; + } + else if(j==1) + { + Prop.Params[1] = pAddon.param2; + } + else if(j==2) + { + Prop.Params[2] = pAddon.param3; + } + } + Props.Add(Prop); + } + } + } + } + return true; + } + catch ( System.Exception e) + { + return false; + } + } + // Get item default information from database + public override void DefaultInfo() + { + LevelReq = m_pDBEssence.require_level; + StrengthReq = m_pDBEssence.require_strength; + AgilityReq = m_pDBEssence.require_agility; + ReputationReq = m_pDBEssence.require_reputation; + CurEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE; + MaxEndurance = m_pDBEssence.durability_min * ENDURANCE_SCALE; + } + // Get item icon file name + public override string GetIconFile() + { + return m_pDBEssence.FileIcon; + } + // Get item name + public override string GetName() + { + return m_pDBEssence.Name; + } + // Get preview info + public override string GetPreviewInfo() + { + int[] aPEEVals = new int[MAX_PEEINDEX]; + int[] aRefines = new int[MAX_REFINEINDEX]; + for(int i=0; i 0) + { + AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMESOCKET), GetName(), Holes.Count); + } + else + { + AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName()); + } + // Refine level + if (RefineLvl > 0) + AddDescText(-1, true, "{0} +{1}", pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), RefineLvl); + else + m_strDesc += "\\r"; + AddIDDescText(); + AddBindDescText(); + // Is destroying? + AddDestroyingDesc((int)m_pDBEssence.id_drop_after_damaged, m_pDBEssence.num_drop_after_damaged); + AddExpireTimeDesc(); + // Sub class name + AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_CLASSNAME), m_pDBSubType.name.ToString()); + // Weapon level + AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), m_pDBEssence.level); + + // Physical defence + if (m_Essence.defense - aPEEVals[PEEI_PHYDEF] + aRefines[REFINE_PHYDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PHYDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.defense - aPEEVals[PEEI_PHYDEF] + aRefines[REFINE_PHYDEF]); + } + // Dodge + if (m_Essence.armor - aPEEVals[PEEI_DODGE] + aRefines[REFINE_DODGE] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_DODGE)); + AddDescText(white, true, " +{0}", m_Essence.armor - aPEEVals[PEEI_DODGE] + aRefines[REFINE_DODGE]); + } + // HP + if (m_Essence.hp_enhance - aPEEVals[PEEI_HP] + aRefines[REFINE_HP] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDHP)); + AddDescText(white, true, " +{0}", m_Essence.hp_enhance - aPEEVals[PEEI_HP] + aRefines[REFINE_HP]); + } + // MP + if (m_Essence.mp_enhance - aPEEVals[PEEI_MP] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDMP)); + AddDescText(white, true, " +{0}", m_Essence.mp_enhance - aPEEVals[PEEI_MP]); + } + // Gold Resistance + if (m_Essence.resistance[0] - aPEEVals[PEEI_GOLDDEF] + aRefines[REFINE_GOLDDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_GOLDDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[0] - aPEEVals[PEEI_GOLDDEF] + aRefines[REFINE_GOLDDEF]); + } + // Wood Resistance + if (m_Essence.resistance[1] - aPEEVals[PEEI_WOODDEF] + aRefines[REFINE_WOODDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WOODDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[1] - aPEEVals[PEEI_WOODDEF] + aRefines[REFINE_WOODDEF]); + } + // Water Resistance + if (m_Essence.resistance[2] - aPEEVals[PEEI_WATERDEF] + aRefines[REFINE_WATERDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WATERDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[2] - aPEEVals[PEEI_WATERDEF] + aRefines[REFINE_WATERDEF]); + } + // Fire Resistance + if (m_Essence.resistance[3] - aPEEVals[PEEI_FIREDEF] + aRefines[REFINE_FIREDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_FIREDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[3] - aPEEVals[PEEI_FIREDEF] + aRefines[REFINE_FIREDEF]); + } + // Earth Resistance + if (m_Essence.resistance[4] - aPEEVals[PEEI_EARTHDEF] + aRefines[REFINE_EARTHDEF] != 0) + { + AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_EARTHDEFENCE)); + AddDescText(white, true, " +{0}", m_Essence.resistance[4] - aPEEVals[PEEI_EARTHDEF] + aRefines[REFINE_EARTHDEF]); + } + // Endurance + int col = white; + if (CurEndurance == 0) + col = red; + else if ((dwPEE & PEE_ENDURANCE) != 0) + col = lblue; + AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENDURANCE)); + AddDescText(col, true, " {0}/{1}", VisualizeEndurance(CurEndurance), VisualizeEndurance(MaxEndurance)); + + // Profession requirement + AddProfReqDesc((uint)ProfReq); + // Level requirment + if (LevelReq != 0) + { + col = pHost.GetMaxLevelSofar() >= LevelReq ? white : red; + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), LevelReq); + } + // Strength requirment + if (StrengthReq != 0) + { + col = pHost.GetExtendProps().bs.strength < StrengthReq ? red : ((dwPEE & PEE_STRENGTHREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_STRENGTHREQ), StrengthReq); + } + // Agility requirment + if (AgilityReq != 0) + { + col = pHost.GetExtendProps().bs.agility < AgilityReq ? red : ((dwPEE & PEE_AGILITYREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_AGILITYREQ), AgilityReq); + } + // Vitality requirment + if (VitalityReq != 0) + { + col = pHost.GetExtendProps().bs.vitality < VitalityReq ? red : ((dwPEE & PEE_VITALITYREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_VITALITYREQ), VitalityReq); + } + // Energy requirment + if (EnergyReq != 0) + { + col = pHost.GetExtendProps().bs.energy < EnergyReq ? red : ((dwPEE & PEE_ENERGYREQ) != 0 ? lblue : white); + AddDescText(col, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ENERGYREQ), EnergyReq); + } + // Reputation requirement + AddReputationReqDesc(); + // Add addon properties + if (!string.IsNullOrEmpty(strAddon)) + m_strDesc += strAddon; + // Build tessera description + BuildTesseraDesc(); + if(m_pDBEssence.fixed_props == 0 && m_bIsInNPCPack) + AddDescText((int)DescriptipionMsg.ITEMDESC_COL2_BRIGHTBLUE, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_HASRANDOM_PROP)); + // Price + AddPriceDesc(white, bRepair); + AddSharpenerDesc(); + AddEngravedDesc(); + AddMakerDesc(); + AddSuiteDesc(); + AddExtDescText(); + return m_strDesc; + } + // // Does this equipment has random property ? + public bool HasRandomProp() + { + for (int i = 0; i < Props.Count; i++) + { + if (!Props[i].Embed && !Props[i].Engraved && Props[i].Type == 472) + return true; + } + return false; + } + public int GetRefineMaterialNum() + { + return m_pDBEssence.material_need; + } + public override uint GetRefineAddOn() + { + return (uint)m_pDBEssence.levelup_addon; + } + public override string GetDropModel() + { + return m_pDBEssence.FileMatter; + } + public override bool IsRare() + { + return base.IsRare() || m_pDBEssence.level >= 6; + } + public override int GetItemLevel() + { + return m_pDBEssence.level; + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrArmor.cs.meta b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrArmor.cs.meta new file mode 100644 index 0000000000..3b702f712f --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrArmor.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c94b2c779cdb94d398d4aa10eb44cac6 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs index 19ec8ee42d..12546f0fe8 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrEquip.cs @@ -754,6 +754,8 @@ namespace PerfectWorld.Scripts.Managers /// private void ReadMakerInfo(CECDataReader dr) { + // Debug: Log the bytes at current position before reading + // We need to check what bytes are actually at the reader position MadeFrom = dr.ReadByte(); int makerLen = dr.ReadByte(); if (makerLen > 0) @@ -764,8 +766,17 @@ namespace PerfectWorld.Scripts.Managers makerLen -= sizeof(ushort); byte[] makerData = dr.ReadData(makerLen); - string maker = System.Text.Encoding.Unicode.GetString(makerData, 0, makerData.Length); - + // Find null terminator (0x00 0x00 for Unicode) and decode only up to that point + int actualLength = makerLen; + for (int i = 0; i < makerLen - 1; i += 2) + { + if (makerData[i] == 0 && makerData[i + 1] == 0) + { + actualLength = i; + break; + } + } + string maker = System.Text.Encoding.Unicode.GetString(makerData, 0, actualLength).TrimEnd('\0'); if (string.IsNullOrEmpty(maker)) { return; @@ -779,14 +790,23 @@ namespace PerfectWorld.Scripts.Managers { //m_strMaker = ACString((ACHAR*)dr.Read_Data(iMakerLen), iMakerLen / sizeof (ACHAR)); byte[] makerData = dr.ReadData(makerLen); - Maker = System.Text.Encoding.Unicode.GetString(makerData, 0, makerData.Length); + // Find null terminator (0x00 0x00 for Unicode) and decode only up to that point + int actualLength = makerLen; + for (int i = 0; i < makerLen - 1; i += 2) + { + if (makerData[i] == 0 && makerData[i + 1] == 0) + { + actualLength = i; + break; + } + } + Maker = System.Text.Encoding.Unicode.GetString(makerData, 0, actualLength).TrimEnd('\0'); } } else { Maker = ""; } - BMLogger.Log("[thn]CECIvtrEquip::ReadMakerInfo, Maker: " + Maker); } /// @@ -2158,16 +2178,11 @@ namespace PerfectWorld.Scripts.Managers RefineLvl = 0; PropNum = 0; EmbedNum = 0; - BMLogger.Log("[thn]CECIvtrEquip::ParseProperties, Props.Count: " + Props.Count); if (Props.Count == 0) return; foreach (Property prop in Props) { - Debug.Log("[thn]CECIvtrEquip::ParseProperties, prop.Type: " + prop.Type); - Debug.Log("[thn]CECIvtrEquip::ParseProperties, prop.Embed: " + prop.Embed); - Debug.Log("[thn]CECIvtrEquip::ParseProperties, prop.Suite: " + prop.Suite); - Debug.Log("[thn]CECIvtrEquip::ParseProperties, prop.Engraved: " + prop.Engraved); int level = 0; if (prop.Embed) { @@ -4104,24 +4119,18 @@ namespace PerfectWorld.Scripts.Managers /// protected void BuildAddOnPropDesc(int[] aPEEVals, int[] aRefines) { - BMLogger.Log("[THN]EC_IvtrEquip: BuildAddOnPropDesc: Props.Count: " + Props.Count); if (Props.Count == 0) return; // Change color m_strDesc += GetColorString(DescriptipionMsg.ITEMDESC_COL_LIGHTBLUE); - BMLogger.Log("[THN]EC_IvtrEquip: BuildAddOnPropDesc: m_strDesc: " + m_strDesc); - Debug.Log("[THN]EC_IvtrEquip: BuildAddOnPropDesc: Props.Count: " + Props.Count); foreach (Property prop in Props) { // Properties added by Embedded stone will be printed by BuildTesseraDesc() later // Ignore suite properties also if (prop.Embed || prop.Suite || prop.Engraved) continue; - BMLogger.Log("[THN]EC_IvtrEquip: BuildAddOnPropDesc: prop.Type: " + prop.Type); - BMLogger.Log("[THN]EC_IvtrEquip: BuildAddOnPropDesc: prop.Params: " + prop.Params[0] + " " + prop.Params[1] + " " + prop.Params[2]); AddOneAddOnPropDesc(prop.Type, prop.Params, aPEEVals, aRefines, prop.Local); - BMLogger.Log("[THN]EC_IvtrEquip: BuildAddOnPropDesc: m_strDesc: " + m_strDesc); } } @@ -4131,7 +4140,6 @@ namespace PerfectWorld.Scripts.Managers public int GetSoulPowerAdded() { int added = 0; - int propertyCount = Props.Count; foreach (Property prop in Props) { @@ -4536,21 +4544,26 @@ namespace PerfectWorld.Scripts.Managers if (string.IsNullOrEmpty(Maker)) return; + BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc: Maker: " + Maker); m_strDesc += "\\r"; // For signed marks (IMT_SIGN), Maker already contains color codes and formatted text. if (MadeFrom == (byte)ITEM_MAKE_TAG.IMT_SIGN) { + BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc IF: Maker: " + Maker); m_strDesc += Maker; } else { + BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc ELSE: Maker: " + Maker); // Normal "made by" line using item-desc string if available string fmt = GetItemDescString(DescriptipionMsg.ITEMDESC_MADEFROM); if (string.IsNullOrEmpty(fmt)) { fmt = "Made by {0}"; } + BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc ELSE: fmt: " + fmt); AddDescText((int)DescriptipionMsg.ITEMDESC_COL_GREEN, false, fmt, Maker); + BMLogger.Log("[THN]EC_IvtrEquip: AddMakerDesc ELSE: m_strDesc: " + m_strDesc); } } diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs index 129416724c..92590d7e46 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs @@ -818,10 +818,12 @@ namespace BrewMonster.Scripts.Managers { case DATA_TYPE.DT_WEAPON_ESSENCE: pItem = new EC_IvtrWeapon(tid, expire_date); - BMLogger.Log("[THN]EC_IvtrItem: CreateItem: Weapon Item: tid: " + tid + ", expire_date: " + expire_date + ", pItem: " + pItem); + break; + case DATA_TYPE.DT_ARMOR_ESSENCE: + pItem = new EC_IvtrArmor(tid, expire_date); break; default: - BMLogger.Log("[THN]EC_IvtrItem: CreateItem: Default Item: tid: " + tid + ", expire_date: " + expire_date + ", pItem: " + pItem); + BMLogger.Log("[THN]EC_IvtrItem: CreateItem: Default Item: tid: " + tid + ", expire_date: " + expire_date + ", pItem: " + pItem.GetName()); break; } pItem.SetCount(iCount); @@ -1472,8 +1474,6 @@ namespace BrewMonster.Scripts.Managers { // Optional: show internal id for debugging AddDescText(0, true, "ID: {0}", m_tid); - BMLogger.Log("[THN]EC_IvtrItem: AddIDDescText: m_tid: " + m_tid); - BMLogger.Log("[THN]EC_IvtrItem: AddIDDescText: m_strDesc: " + m_strDesc); } protected void AddBindDescText() diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs index 965f28b649..d95633329b 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrType.cs @@ -107,11 +107,25 @@ namespace BrewMonster.Scripts.Managers public struct IVTR_ESSENCE_ARMOR { // TODO : implement data later - // int defense; - // int armor; - // int mp_enhance; - // int hp_enhance; - // int resistance[NUM_MAGICCLASS]; + public int defense; + public int armor; + public int mp_enhance; + public int hp_enhance; + public int[] resistance; + public IVTR_ESSENCE_ARMOR(byte[] data) + { + Debug.Log("IVTR_ESSENCE_ARMOR: data.Length: " + data.Length); + resistance = new int[InventoryConst.NUM_MAGICCLASS]; + CECDataReader dr = new (data, data.Length); + defense = dr.ReadInt(); + armor = dr.ReadInt(); + mp_enhance = dr.ReadInt(); + hp_enhance = dr.ReadInt(); + for(int i = 0; i < InventoryConst.NUM_MAGICCLASS; i++) + { + resistance[i] = dr.ReadInt(); + } + } }; public struct IVTR_ESSENCE_FASHION diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrWeapon.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrWeapon.cs index 318e03c7e2..6613a03129 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrWeapon.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrWeapon.cs @@ -284,7 +284,7 @@ namespace PerfectWorld.Scripts.Managers AddDescText(namecol, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName()); } if (RefineLvl > 0) - AddDescText(-1, true, "{0} {1}", pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), RefineLvl); + AddDescText(-1, true, "{0} +{1}", pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), RefineLvl); else m_strDesc += "\\r"; AddIDDescText(); @@ -293,7 +293,7 @@ namespace PerfectWorld.Scripts.Managers AddDestroyingDesc((int)m_pDBEssence.id_drop_after_damaged, m_pDBEssence.num_drop_after_damaged); AddExpireTimeDesc(); // Sub class name - AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_CLASSNAME), m_Essence.weapon_type.ToString()); + AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_CLASSNAME), m_pDBSubType.name.ToString()); // Weapon level AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), m_Essence.weapon_level); // Attack speed @@ -376,10 +376,10 @@ namespace PerfectWorld.Scripts.Managers m_strDesc += strAddon; // Build tessera description BuildTesseraDesc(); - // Price - AddPriceDesc(white, bRepair); if(m_pDBEssence.fixed_props == 0 && m_bIsInNPCPack) AddDescText((int)DescriptipionMsg.ITEMDESC_COL2_BRIGHTBLUE, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_HASRANDOM_PROP)); + // Price + AddPriceDesc(white, bRepair); AddSharpenerDesc(); AddEngravedDesc(); AddMakerDesc(); diff --git a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs index 89d4492329..4025adeb25 100644 --- a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs @@ -368,7 +368,6 @@ namespace BrewMonster.Network public static void GetRoleBaseInfo(int iNumRole, List aRoleIDs) { - BMLogger.Log($"GetRoleBaseInfo: {iNumRole} {string.Join(", ", aRoleIDs)}"); Instance._gameSession.GetRoleBaseInfo(iNumRole, aRoleIDs); } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs index f17662e05c..ed88106549 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs @@ -55,6 +55,7 @@ namespace BrewMonster.UI return -1; m_Item[nIndex].strDataName[nSubIndex] = strName; m_Item[nIndex].dwData[nSubIndex] = dwItemData; + Debug.Log("[THN]AUIListBox: SetItemData: nIndex: " + nIndex + ", dwItemData: " + dwItemData + ", nSubIndex: " + nSubIndex + ", strName: " + strName); m_Item[nIndex].SetActOnClickBtn(m_OnClickBtn, nIndex); return nIndex; diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs index e6b4c0231c..db0b980284 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs @@ -3117,7 +3117,6 @@ namespace BrewMonster.UI if (Enum.IsDefined(typeof(SERVICE_TYPE), idFunction)) { SERVICE_TYPE k = (SERVICE_TYPE)idFunction; - BMLogger.Log($" PopupCorrespondingServiceDialog: {k}"); } if (idFunction == (int)SERVICE_TYPE.NPC_SELL || idFunction == (int)SERVICE_TYPE.NPC_BUY) diff --git a/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs b/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs index de8eeb4b6f..7421e320c7 100644 --- a/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs +++ b/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs @@ -128,7 +128,6 @@ namespace BrewMonster.Scripts.UI { idItem = ad.m_CandItems[i - 1].m_AwardItems[j - 1].m_ulItemTemplId; pItem = EC_IvtrItem.CreateItem((int)idItem, 0, 1); - var pWeapon = pItem as EC_IvtrWeapon; nNum = ad.m_CandItems[i - 1].m_AwardItems[j - 1].m_ulItemNum; if (nNum > 1) { @@ -139,8 +138,8 @@ namespace BrewMonster.Scripts.UI else pImage.SetText(_AL("")); - pWeapon.GetDetailDataFromLocal(); - string strDesc = pWeapon.GetDesc(); + pItem.GetDetailDataFromLocal(); + string strDesc = pItem.GetDesc(); pImage.SetHint(strDesc); // TODO //Debug.Log("[THN]CDlgAward: pItem.GetDesc():" + pItem.GetDesc()); // af_GetFileTitle(pItem.GetIconFile(), strFile); // TODO diff --git a/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs b/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs index 6eb4e68544..d9c0f8cc13 100644 --- a/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs +++ b/Assets/PerfectWorld/Scripts/UI/Login/LoginScreenUI.cs @@ -102,14 +102,11 @@ namespace BrewMonster.UI /// private void OnGetRoleListComplete(List roleInfos) { - BMLogger.Log($"OnGetRoleListComplete {roleInfos.Count}"); - _roleInfos = roleInfos; } private void OnClickSelectCharacter(RoleInfo roleInfo) { - BMLogger.Log($"OnClickSelectCharacter {roleInfo.name}"); UnityGameSession.SelectRoleAsync(roleInfo, OnSelectRoleComplete); }