From 925b6c04772b0ec76fa31046d60e24eab06bd043 Mon Sep 17 00:00:00 2001 From: Chomper9981 Date: Tue, 24 Feb 2026 16:20:37 +0700 Subject: [PATCH] Load item info for flysword. --- .../Common/DataProcess/generate_item_temp.cs | 66 ++++++++++++++++++- .../Scripts/Common/DataProcess/itemdataman.cs | 3 + 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs index 8bbfc03e83..7d820e95c4 100644 --- a/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/generate_item_temp.cs @@ -1349,6 +1349,7 @@ public static class generate_item_temp content_length = (int)(size - offset); WriteInt(data, ref content_length_ptr, content_length); WriteInt(data, ref item_content, offset); + WriteInt(data, ref offset, ess.food_type); //��Ʒ�Ŀ�װ����־ WriteInt(data, ref offset, ess.hornor); //��Ʒ��Ӧ�����ID guid @@ -1357,7 +1358,69 @@ public static class generate_item_temp itemdataman.set_to_classid(DATA_TYPE.DT_PET_FOOD_ESSENCE, data, -1); return 0; } - + public static int generate_flysword(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls,item_tag_t tag) + { + data = new byte[0]; + size = 0; + + DATA_TYPE datatype = DATA_TYPE.DT_INVALID; + object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype); + if(obj == null || datatype != DATA_TYPE.DT_FLYSWORD_ESSENCE) + return -1; + FLYSWORD_ESSENCE ess = (FLYSWORD_ESSENCE)obj; + size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(FLYSWORD_ESSENCE))); + data = new byte[size]; + int offset = 0; + WriteUInt(data, ref offset, id); + WriteUInt(data, ref offset, 1); + WriteUInt(data, ref offset, (uint)ess.pile_num_max); + WriteInt(data, ref offset, (int)itemdataman.ELEMENTDATAMAN_EQUIP_MASK_FLYSWORD); + WriteInt(data, ref offset, (int)ess.proc_type); + WriteInt(data, ref offset, (int)DATA_TYPE.DT_FLYSWORD_ESSENCE); + if(ess.has_guid == 1){ + int g1,g2; + itemdataman.get_item_guid(id,out g1,out g2); + WriteInt(data, ref offset, g1); + WriteInt(data, ref offset, g2); + } + else{ + WriteInt(data, ref offset, 0); + } + WriteInt(data, ref offset, ess.price); + WriteInt(data, ref offset, 0); //����ʱ�� + + int content_length = 0; + int content_length_ptr = offset; + WriteInt(data, ref offset, 0); + int item_content = offset; + WriteInt(data, ref offset, 0); + content_length = (int)(size - offset); + WriteInt(data, ref content_length_ptr, content_length); + WriteInt(data, ref item_content, offset); + + int t = element_data.RandNormal((int)ess.time_max_min, (int)ess.time_max_max, cls, LOWER.LOWER_TREND); + + // essence + WriteInt(data, ref offset, (int)(t*0.5f)); + WriteInt(data, ref offset, (int)t); + WriteShort(data, ref offset, (short)ess.require_player_level_min); + WriteByte(data, ref offset, (byte)ess.level); + WriteByte(data, ref offset, 0); + WriteInt(data, ref offset, (int)ess.character_combo_id); + WriteInt(data, ref offset, (int)ess.time_increase_per_element); + + float speed = element_data.Rand(ess.speed_increase_min, ess.speed_increase_max, cls, LOWER.LOWER_TREND); + WriteFloat(data, ref offset, speed); + speed = element_data.Rand(ess.speed_rush_increase_min, ess.speed_rush_increase_max, cls, LOWER.LOWER_TREND); + WriteFloat(data, ref offset, speed); + + //���������߱�ǩ + WriteByte(data, ref offset, tag.type); + WriteByte(data, ref offset, (byte)tag.size); + + itemdataman.set_to_classid(DATA_TYPE.DT_FLYSWORD_ESSENCE, data, -1); + return 0; + } public static int generate_townscroll(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls) { DATA_TYPE datatype = DATA_TYPE.DT_INVALID; @@ -1402,6 +1465,7 @@ public static class generate_item_temp itemdataman.set_to_classid(DATA_TYPE.DT_TOWNSCROLL_ESSENCE, data, -1); return 0; } + #region Write Functions private static void WriteUInt(byte[] buf, ref int offset, uint value) { diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs index f484a59ba7..b410939e78 100644 --- a/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/itemdataman.cs @@ -491,6 +491,9 @@ namespace BrewMonster case DATA_TYPE.DT_PET_FOOD_ESSENCE: ret = generate_item_temp.generate_pet_food(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND); break; + case DATA_TYPE.DT_FLYSWORD_ESSENCE: + ret = generate_item_temp.generate_flysword(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND, tag); + break; case DATA_TYPE.DT_TOWNSCROLL_ESSENCE: ret = generate_item_temp.generate_townscroll(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND); break;