Merge pull request 'feature/item-data-man' (#134) from feature/item-data-man into develop
Reviewed-on: https://git.brew.monster/Unity/perfect-world-unity/pulls/134
This commit is contained in:
@@ -347,7 +347,7 @@ public static class generate_item_temp
|
||||
itemdataman.set_to_classid(DATA_TYPE.DT_WEAPON_ESSENCE, data, -1);
|
||||
return 0;
|
||||
}
|
||||
private static void generate_magic_defense<RAND_CLASS>(int[] res, List<ARMOR_ESSENCE.MagicDefence> res_list , RAND_CLASS cls,
|
||||
private static void generate_magic_defense<RAND_CLASS>(int[] res, List<MagicDefence> res_list , RAND_CLASS cls,
|
||||
bool b_fixed = false) //
|
||||
{
|
||||
float[] count_prop = {0.35f,0.25f,0.20f,0.15f,0.05f,0.051f};
|
||||
@@ -403,6 +403,7 @@ public static class generate_item_temp
|
||||
data = new byte[size];
|
||||
int offset = 0;
|
||||
short hole_num = 0;
|
||||
|
||||
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 };
|
||||
@@ -519,7 +520,7 @@ public static class generate_item_temp
|
||||
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.mp_enhance_low, ess.mp_enhance_high, cls, LOWER.LOWER_TREND));
|
||||
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.hp_enhance_low, ess.hp_enhance_high, cls, LOWER.LOWER_TREND));
|
||||
int[] res = {0,0,0,0,0};
|
||||
List<ARMOR_ESSENCE.MagicDefence> res_list = ess.magic_defences.ToList();
|
||||
List<MagicDefence> res_list = ess.magic_defences.ToList();
|
||||
generate_magic_defense(res, res_list, cls, ess.force_all_magic_defences != 0 || ess.fixed_props!=0);
|
||||
WriteInt(data, ref offset, res[0]);
|
||||
WriteInt(data, ref offset, res[1]);
|
||||
@@ -558,6 +559,366 @@ public static class generate_item_temp
|
||||
itemdataman.set_to_classid(DATA_TYPE.DT_ARMOR_ESSENCE, data, -1);
|
||||
return 0;
|
||||
}
|
||||
public static int generate_decoration<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls,
|
||||
GEN_ADDON_MODE normal_addon ,item_tag_t tag,List<int> sa_list = null)
|
||||
{
|
||||
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
|
||||
int i=0;
|
||||
data = new byte[0];
|
||||
size = 0;
|
||||
object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype);
|
||||
if(obj == null || datatype != DATA_TYPE.DT_DECORATION_ESSENCE)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
DECORATION_ESSENCE ess = (DECORATION_ESSENCE)obj;
|
||||
|
||||
size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(_item_content)) + Marshal.SizeOf(typeof(DECORATION_ESSENCE)));
|
||||
// ��
|
||||
uint hole_num = 0; //������Ŀ
|
||||
|
||||
// ���addons
|
||||
byte[] addon_buf = new byte[itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS*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<RAND_CLASS, LOWER>(probability_addon_num.ToList(), cls, LOWER.LOWER_TREND); //���Ա���Ŀ����Ŀ
|
||||
|
||||
uint addon_size = 0;
|
||||
if(ess.fixed_props != 0)
|
||||
{
|
||||
addon_size = itemdataman.generate_equipment_addon_buffer_2(DATA_TYPE.DT_DECORATION_ESSENCE, ess.addons.Select(a => (int)a.id_addon).ToList(), addon_buf,0, addon_num);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_DROP)
|
||||
addon_size = itemdataman.generate_equipment_addon_buffer(DATA_TYPE.DT_DECORATION_ESSENCE, ess.addons.Select(a => (int)a.id_addon).ToList(), 32, addon_buf,0, addon_num);
|
||||
else if(normal_addon == GEN_ADDON_MODE.ADDON_LIST_PRODUCE)
|
||||
addon_size = itemdataman.generate_equipment_addon_buffer(DATA_TYPE.DT_DECORATION_ESSENCE, ess.rands.Select(a => (int)a.id_rand).ToList(), 32, addon_buf,0, addon_num);
|
||||
else if (normal_addon == GEN_ADDON_MODE.ADDON_LIST_SPEC)
|
||||
{
|
||||
addon_size = itemdataman.generate_spec_addon_buffer(DATA_TYPE.DT_DECORATION_ESSENCE,addon_buf,0,itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS, addon_num,sa_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
addon_size = 0;
|
||||
addon_num = 0;
|
||||
}
|
||||
}
|
||||
size += addon_size;
|
||||
|
||||
//����tag size
|
||||
//ASSERT(tag_size >= sizeof(short));
|
||||
size += tag.size;
|
||||
|
||||
|
||||
// allocate the buffer with exact length
|
||||
data = new byte[size];
|
||||
int offset = 0;
|
||||
|
||||
|
||||
WriteUInt(data, ref offset, id); //��Ʒ��ģ��ID
|
||||
WriteUInt(data, ref offset, 1); //��Ʒ������
|
||||
WriteUInt(data, ref offset, (uint)ess.pile_num_max); //��Ʒ�Ķѵ�����
|
||||
|
||||
object sub_type_temp = itemdataman._edm.get_data_ptr(ess.id_sub_type, ID_SPACE.ID_SPACE_ESSENCE, ref datatype);
|
||||
if(sub_type_temp == null || datatype != DATA_TYPE.DT_DECORATION_SUB_TYPE)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
DECORATION_SUB_TYPE sub_type = (DECORATION_SUB_TYPE)sub_type_temp;
|
||||
|
||||
WriteInt(data, ref offset, (int)(sub_type.equip_mask|(addon_num>0?0x40000000:0))); //��Ʒ�Ŀ�װ����־
|
||||
WriteUInt(data, ref offset, ess.proc_type); //��Ʒ�Ĵ�����ʽ
|
||||
WriteInt(data, ref offset, (int)DATA_TYPE.DT_DECORATION_ESSENCE); //��Ʒ��Ӧ�����ID
|
||||
WriteInt(data, ref offset, (int)DATA_TYPE.DT_DECORATION_ESSENCE); //��Ʒ��Ӧ�����ID
|
||||
if(ess.has_guid == 1){
|
||||
int g1,g2;
|
||||
itemdataman.get_item_guid(id,out g1,out g2);
|
||||
WriteInt(data, ref offset, g1); //��Ʒ��Ӧ�����ID guid
|
||||
WriteInt(data, ref offset, g2); //��Ʒ��Ӧ�����ID guid
|
||||
}
|
||||
else{
|
||||
WriteInt(data, ref offset, 0); //��Ʒ��Ӧ�����ID guid
|
||||
WriteInt(data, ref offset, 0); //��Ʒ��Ӧ�����ID guid
|
||||
}
|
||||
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);
|
||||
|
||||
// prerequisition
|
||||
int require_ptr = offset;
|
||||
WriteShort(data, ref offset, (short)ess.require_level);
|
||||
WriteShort(data, ref offset, (short)(ess.character_combo_id&0xFFFF));
|
||||
WriteShort(data, ref offset, (short)ess.require_strength);
|
||||
WriteShort(data, ref offset, (short)ess.require_tili);
|
||||
WriteShort(data, ref offset, (short)ess.require_agility);
|
||||
WriteShort(data, ref offset, (short)ess.require_energy);
|
||||
|
||||
int temp2 = element_data.RandNormal<RAND_CLASS, LOWER>(ess.durability_min, ess.durability_max, cls, LOWER.LOWER_TREND);
|
||||
int temp;
|
||||
if(normal_addon != GEN_ADDON_MODE.ADDON_LIST_DROP || (ess.proc_type & 0x1000) != 0)
|
||||
{
|
||||
temp = temp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = element_data.RandNormal<RAND_CLASS, UPPER>(ess.durability_drop_min, ess.durability_drop_max, cls, UPPER.UPPER_TREND);
|
||||
if(temp > temp2) temp = temp2;
|
||||
}
|
||||
WriteInt(data, ref offset, temp); //prerequisition durability
|
||||
WriteInt(data, ref offset, temp2); //prerequisition max_durability
|
||||
|
||||
//���������߱�ǩע���ǩ���ڱ����С�ͱ�������֮��
|
||||
WriteShort(data, ref offset, (short)Marshal.SizeOf(typeof(DECORATION_ESSENCE))); //װ�������С���ֽڣ�
|
||||
|
||||
WriteByte(data, ref offset, tag.type); // MadeFrom
|
||||
WriteByte(data, ref offset, (byte)tag.size);
|
||||
|
||||
|
||||
// ����
|
||||
int essence_ptr = offset;
|
||||
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.damage_low, ess.damage_high, cls, LOWER.LOWER_TREND)); //int damage;
|
||||
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.magic_damage_low, ess.magic_damage_high, cls, LOWER.LOWER_TREND)); //int magic_damage;
|
||||
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.defence_low, ess.defence_high, cls, LOWER.LOWER_TREND)); //int defense;
|
||||
WriteInt(data, ref offset, element_data.RandNormal<RAND_CLASS, LOWER>(ess.armor_enhance_low, ess.armor_enhance_high, cls, LOWER.LOWER_TREND)); //int armor;
|
||||
|
||||
//����
|
||||
int[] res = {0,0,0,0,0};
|
||||
List<MagicDefence> res_list = ess.magic_defences.ToList<MagicDefence>();
|
||||
generate_magic_defense(res,res_list,cls,ess.fixed_props!=0);
|
||||
|
||||
WriteInt(data, ref offset, res[0]);
|
||||
WriteInt(data, ref offset, res[1]);
|
||||
WriteInt(data, ref offset, res[2]);
|
||||
WriteInt(data, ref offset, res[3]);
|
||||
WriteInt(data, ref offset, res[4]);
|
||||
|
||||
// ��
|
||||
WriteShort(data, ref offset, (short)hole_num); //������Ŀ
|
||||
WriteShort(data, ref offset, (short)0); //����������������
|
||||
|
||||
// addon
|
||||
WriteInt(data, ref offset, (int)addon_num);
|
||||
int addon_sld = offset;
|
||||
|
||||
addon_data addon_data = new addon_data();
|
||||
prerequisition prerequisition = new prerequisition();
|
||||
// Read prerequisition from data buffer (where it was written) once before the loop
|
||||
int require_ptr_copy = require_ptr;
|
||||
ReadPrerequisition(data, ref require_ptr_copy, out prerequisition);
|
||||
for(i = 0; i < addon_num; i++)
|
||||
{
|
||||
ReadInt(addon_buf, ref addon_sld, out addon_data.id);
|
||||
ReadAddonData(addon_buf, ref addon_sld, out addon_data);
|
||||
itemdataman.addon_update_ess_data(addon_data, essence_ptr, Marshal.SizeOf(typeof(_weapon_essence)), prerequisition);
|
||||
addon_sld += ((addon_data.id & 0x6000)>>13)*sizeof(int)+sizeof(int);
|
||||
}
|
||||
itemdataman.update_require_data(ref prerequisition);
|
||||
int require_ptr_write = require_ptr;
|
||||
WritePrerequisition(data, ref require_ptr_write, prerequisition);
|
||||
if(addon_size > 0)
|
||||
{
|
||||
Array.Copy(addon_buf, 0, data, offset, (int)addon_size);
|
||||
offset += (int)addon_size;
|
||||
}
|
||||
itemdataman.set_to_classid(DATA_TYPE.DT_DECORATION_ESSENCE, data, -1);
|
||||
//if id == 335 log all addon data
|
||||
if(id == 335)
|
||||
{
|
||||
BMLogger.Log("Log for item with id: " + id);
|
||||
for(int j = 0; j < addon_num; j++)
|
||||
{
|
||||
ReadInt(addon_buf, ref addon_sld, out addon_data.id);
|
||||
ReadAddonData(addon_buf, ref addon_sld, out addon_data);
|
||||
BMLogger.Log("addon_data.id: " + addon_data.id);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public static int generate_projectile<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls)
|
||||
{
|
||||
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
|
||||
data = new byte[0];
|
||||
size = 0;
|
||||
object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype);
|
||||
if(obj == null || datatype != DATA_TYPE.DT_PROJECTILE_ESSENCE)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
PROJECTILE_ESSENCE ess = (PROJECTILE_ESSENCE)obj;
|
||||
size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(_item_content)) + Marshal.SizeOf(typeof(PROJECTILE_ESSENCE)));
|
||||
|
||||
byte[] addon_buf = new byte[itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS*Marshal.SizeOf(typeof(itemdataman._addon))];
|
||||
uint addon_num = 4; //���Ա���Ŀ����Ŀ�̶� 4
|
||||
uint addon_size = 0;
|
||||
|
||||
addon_size = itemdataman.generate_equipment_addon_buffer_2(DATA_TYPE.DT_PROJECTILE_ESSENCE, new List<int> { (int)ess.id_addon0, (int)ess.id_addon1, (int)ess.id_addon2, (int)ess.id_addon3 }, addon_buf,0, addon_num);
|
||||
size += addon_size;
|
||||
|
||||
//����tag size
|
||||
size += sizeof(short);
|
||||
|
||||
// allocate the buffer with exact length
|
||||
data = new byte[size];
|
||||
int offset = 0;
|
||||
|
||||
WriteUInt(data, ref offset, id); //��Ʒ��ģ��ID
|
||||
WriteUInt(data, ref offset, 1); //��Ʒ������
|
||||
WriteUInt(data, ref offset, (uint)ess.pile_num_max); //��Ʒ�Ķѵ�����
|
||||
WriteInt(data, ref offset, (int)(itemdataman.ELEMENTDATAMAN_EQUIP_MASK_PROJECTILE|(addon_num>0?0x40000000:0))); //��Ʒ�Ŀ�װ����־
|
||||
WriteInt(data, ref offset, (int)ess.proc_type); //��Ʒ�Ĵ�����ʽ
|
||||
WriteInt(data, ref offset, (int)DATA_TYPE.DT_PROJECTILE_ESSENCE); //��Ʒ��Ӧ�����ID
|
||||
if(ess.has_guid == 1){
|
||||
int g1,g2;
|
||||
itemdataman.get_item_guid(id,out g1,out g2);
|
||||
WriteInt(data, ref offset, g1); //��Ʒ��Ӧ�����ID guid
|
||||
WriteInt(data, ref offset, g2); //��Ʒ��Ӧ�����ID guid
|
||||
}
|
||||
else{
|
||||
WriteInt(data, ref offset, 0); //��Ʒ��Ӧ�����ID guid
|
||||
WriteInt(data, ref offset, 0); //��Ʒ��Ӧ�����ID guid
|
||||
}
|
||||
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);
|
||||
|
||||
// prerequisition
|
||||
int require_ptr = offset;
|
||||
//����int����6��
|
||||
WriteShort(data, ref offset, 0); //prerequisition level
|
||||
WriteShort(data, ref offset, -1); // 0xFFFF = -1
|
||||
WriteShort(data, ref offset, 0);
|
||||
WriteShort(data, ref offset, 0); //prerequisition strength
|
||||
WriteShort(data, ref offset, 0); //prerequisition agility
|
||||
WriteShort(data, ref offset, 0); //prerequisition energy
|
||||
|
||||
WriteInt(data, ref offset, 1); //prerequisition durability
|
||||
WriteInt(data, ref offset, 1); //prerequisition max_durability
|
||||
WriteShort(data, ref offset, (short)Marshal.SizeOf(typeof(PROJECTILE_ESSENCE))); //װ�������С���ֽڣ�
|
||||
WriteByte(data, ref offset, (byte)ITEM_MAKE_TAG.IMT_NULL);
|
||||
WriteByte(data, ref offset, 0);
|
||||
|
||||
// projectile_essence ����
|
||||
int essence_ptr = offset;
|
||||
WriteInt(data, ref offset, (int)ess.type); //��ҩ����
|
||||
WriteInt(data, ref offset, ess.damage_enhance); //��������������
|
||||
WriteInt(data, ref offset, ess.damage_scale_enhance); //���ձ������ӹ�����
|
||||
WriteInt(data, ref offset, ess.require_weapon_level_min); //��Ҫ�����ȼ�
|
||||
WriteInt(data, ref offset, ess.require_weapon_level_max); //��Ҫ�����ȼ�
|
||||
|
||||
// ��
|
||||
WriteShort(data, ref offset, (short)0);
|
||||
WriteShort(data, ref offset, (short)0);
|
||||
|
||||
|
||||
// addon
|
||||
WriteInt(data, ref offset, (int)addon_num);
|
||||
|
||||
int addon_sld = offset;
|
||||
addon_data addon_data = new addon_data();
|
||||
prerequisition prerequisition = new prerequisition();
|
||||
// Read prerequisition from data buffer (where it was written) once before the loop
|
||||
int require_ptr_copy = require_ptr;
|
||||
ReadPrerequisition(data, ref require_ptr_copy, out prerequisition);
|
||||
for(int i = 0; i < addon_num; i++)
|
||||
{
|
||||
ReadInt(addon_buf, ref addon_sld, out addon_data.id);
|
||||
ReadAddonData(addon_buf, ref addon_sld, out addon_data);
|
||||
itemdataman.addon_update_ess_data(addon_data, essence_ptr, Marshal.SizeOf(typeof(_weapon_essence)), prerequisition);
|
||||
addon_sld += ((addon_data.id & 0x6000)>>13)*sizeof(int)+sizeof(int);
|
||||
}
|
||||
itemdataman.update_require_data(ref prerequisition);
|
||||
int require_ptr_write = require_ptr;
|
||||
WritePrerequisition(data, ref require_ptr_write, prerequisition);
|
||||
if(addon_size > 0)
|
||||
{
|
||||
Array.Copy(addon_buf, 0, data, offset, (int)addon_size);
|
||||
offset += (int)addon_size;
|
||||
}
|
||||
itemdataman.set_to_classid(DATA_TYPE.DT_PROJECTILE_ESSENCE, data, -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
public static int generate_fashion_item<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls, item_tag_t tag)
|
||||
{
|
||||
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
|
||||
data = new byte[0];
|
||||
size = 0;
|
||||
object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype);
|
||||
if(obj == null || datatype != DATA_TYPE.DT_FASHION_ESSENCE)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
FASHION_ESSENCE ess = (FASHION_ESSENCE)obj;
|
||||
size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(FASHION_ESSENCE)));
|
||||
|
||||
//ASSERT(tag_size >= 2);
|
||||
size += tag.size;
|
||||
object obj_sub_type = itemdataman._edm.get_data_ptr(ess.id_sub_type, idspace, ref datatype);
|
||||
if(obj_sub_type == null || datatype != DATA_TYPE.DT_FASHION_SUB_TYPE)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
FASHION_SUB_TYPE sub_type = (FASHION_SUB_TYPE)obj_sub_type;
|
||||
data = new byte[size];
|
||||
int offset =0;
|
||||
WriteUInt(data, ref offset, id); //��Ʒ��ģ��ID
|
||||
WriteUInt(data, ref offset, 1); //��Ʒ������
|
||||
WriteUInt(data, ref offset, (uint)ess.pile_num_max); //��Ʒ�Ķѵ�����
|
||||
WriteUInt(data, ref offset, sub_type.equip_fashion_mask); //��Ʒ�Ŀ�װ����־���̶�ֵ����
|
||||
WriteInt(data, ref offset, (int)ess.proc_type); //��Ʒ�Ĵ�����ʽ
|
||||
WriteInt(data, ref offset, (int)DATA_TYPE.DT_FASHION_ESSENCE); //��Ʒ��Ӧ�����ID
|
||||
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, 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);
|
||||
|
||||
short color = (short)element_data.RandNormal<RAND_CLASS, ANY>(0, 0x7FFF, cls, ANY.ANY_TREND);
|
||||
WriteShort(data, ref offset, (short)ess.require_level);
|
||||
|
||||
WriteShort(data, ref offset, color);
|
||||
WriteShort(data, ref offset, (short)ess.gender);
|
||||
|
||||
WriteByte(data, ref offset, tag.type);
|
||||
WriteByte(data, ref offset, (byte)tag.size);
|
||||
|
||||
itemdataman.set_to_classid(DATA_TYPE.DT_FASHION_ESSENCE, data, -1);
|
||||
return 0;
|
||||
}
|
||||
public static int generate_tasknormalmatter<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls,
|
||||
GEN_ADDON_MODE normal_addon ,item_tag_t tag,List<int> sa_list = null)
|
||||
{
|
||||
@@ -950,6 +1311,51 @@ public static class generate_item_temp
|
||||
itemdataman.set_to_classid(DATA_TYPE.DT_PET_FOOD_ESSENCE, data, -1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int generate_townscroll<RAND_CLASS>(uint id, ID_SPACE idspace, out byte[] data, out uint size, RAND_CLASS cls)
|
||||
{
|
||||
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
|
||||
data = new byte[0];
|
||||
size = 0;
|
||||
object obj = itemdataman._edm.get_data_ptr(id, idspace, ref datatype);
|
||||
if(obj == null || datatype != DATA_TYPE.DT_TOWNSCROLL_ESSENCE)
|
||||
return -1;
|
||||
TOWNSCROLL_ESSENCE ess = (TOWNSCROLL_ESSENCE)obj;
|
||||
size = (uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(TOWNSCROLL_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, 0);
|
||||
WriteInt(data, ref offset, (int)ess.proc_type);
|
||||
WriteInt(data, ref offset, (int)DATA_TYPE.DT_TOWNSCROLL_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, 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);
|
||||
WriteInt(data, ref offset, (int )(ess.use_time * 20)); //ʹ��ʱ��
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -458,6 +458,17 @@ namespace BrewMonster
|
||||
ret = generate_item_temp.generate_armor(id, ID_SPACE.ID_SPACE_ESSENCE,
|
||||
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
|
||||
break;
|
||||
case DATA_TYPE.DT_DECORATION_ESSENCE:
|
||||
ret = generate_item_temp.generate_decoration(id,ID_SPACE.ID_SPACE_ESSENCE,
|
||||
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
|
||||
break;
|
||||
case DATA_TYPE.DT_PROJECTILE_ESSENCE:
|
||||
ret = generate_item_temp.generate_projectile(id,ID_SPACE.ID_SPACE_ESSENCE,
|
||||
out item,out size,SPECIFIC.SPECIFIC_RAND);
|
||||
break;
|
||||
case DATA_TYPE.DT_FASHION_ESSENCE:
|
||||
ret = generate_item_temp.generate_fashion_item(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND, tag);
|
||||
break;
|
||||
case DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE:
|
||||
ret = generate_item_temp.generate_tasknormalmatter(id,ID_SPACE.ID_SPACE_ESSENCE,
|
||||
out item,out size,SPECIFIC.SPECIFIC_RAND,GEN_ADDON_MODE.ADDON_LIST_SHOP,tag);
|
||||
@@ -477,6 +488,10 @@ 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_TOWNSCROLL_ESSENCE:
|
||||
ret = generate_item_temp.generate_townscroll(id, ID_SPACE.ID_SPACE_ESSENCE, out item, out size, SPECIFIC.SPECIFIC_RAND);
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -1;
|
||||
break;
|
||||
|
||||
@@ -253,7 +253,12 @@ namespace BrewMonster
|
||||
+ ByteToStringUtils.ByteArrayToCP936String(file_model_left) + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct MagicDefence
|
||||
{
|
||||
public int low; // Minimum magic defense
|
||||
public int high; // Maximum magic defense
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct ARMOR_MAJOR_TYPE
|
||||
{
|
||||
@@ -326,12 +331,7 @@ namespace BrewMonster
|
||||
public int defence_low; // Minimum physical defense
|
||||
public int defence_high; // Maximum physical defense
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct MagicDefence
|
||||
{
|
||||
public int low; // Minimum magic defense
|
||||
public int high; // Maximum magic defense
|
||||
}
|
||||
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public MagicDefence[] magic_defences; // Magic defenses for 5 elements
|
||||
@@ -495,13 +495,6 @@ namespace BrewMonster
|
||||
public int defence_low; // Minimum physical defense
|
||||
public int defence_high; // Maximum physical defense
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct MagicDefence
|
||||
{
|
||||
public int low; // Minimum magic defense
|
||||
public int high; // Maximum magic defense
|
||||
}
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public MagicDefence[] magic_defences; // Magic defenses for 5 elements
|
||||
|
||||
@@ -750,6 +743,7 @@ namespace BrewMonster
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public ushort[] name; // Fashion sub-type name
|
||||
public string Name => ByteToStringUtils.UshortArrayToCP936String(name);
|
||||
|
||||
public uint equip_fashion_mask; // Fashion equipment slot mask
|
||||
}
|
||||
@@ -774,6 +768,8 @@ namespace BrewMonster
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_matter; // Matter model file path
|
||||
|
||||
public string FileMatter => ByteToStringUtils.ByteArrayToCP936String(file_matter);
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_icon; // Icon file path
|
||||
|
||||
@@ -1605,10 +1601,11 @@ namespace BrewMonster
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_matter; // Material file path
|
||||
public string FileMatter => ByteToStringUtils.ByteArrayToCP936String(file_matter);
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_icon; // Icon file path
|
||||
|
||||
public string FileIcon => ByteToStringUtils.ByteArrayToCP936String(file_icon);
|
||||
public float use_time; // Use time (seconds)
|
||||
|
||||
public int price; // Price
|
||||
@@ -1629,9 +1626,11 @@ namespace BrewMonster
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_matter; // Material file path
|
||||
public string FileMatter => ByteToStringUtils.ByteArrayToCP936String(file_matter);
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_icon; // Icon file path
|
||||
public string FileIcon => ByteToStringUtils.ByteArrayToCP936String(file_icon);
|
||||
|
||||
public int price; // Price
|
||||
public int shop_price; // Shop price
|
||||
@@ -1746,6 +1745,7 @@ namespace BrewMonster
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_icon; // Icon file path
|
||||
public string FileIcon { get { return ByteToStringUtils.ByteArrayToCP936String(file_icon); } }
|
||||
|
||||
public int pile_num_max; // Max stack count
|
||||
public uint has_guid; // Whether item has GUID
|
||||
@@ -1762,9 +1762,11 @@ namespace BrewMonster
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_matter; // Material file path
|
||||
public string FileMatter { get { return ByteToStringUtils.ByteArrayToCP936String(file_matter); } }
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_icon; // Icon file path
|
||||
public string FileIcon { get { return ByteToStringUtils.ByteArrayToCP936String(file_icon); } }
|
||||
|
||||
public int price; // Price
|
||||
public int shop_price; // Shop price
|
||||
@@ -1854,6 +1856,7 @@ namespace BrewMonster
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public ushort[] name; // name, max 15 chars
|
||||
public string Name => ByteToStringUtils.UshortArrayToUnicodeString(name);
|
||||
}
|
||||
|
||||
public struct PROJECTILE_ESSENCE
|
||||
@@ -1866,12 +1869,14 @@ namespace BrewMonster
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_model; // model file path
|
||||
public string FileModel { get { return ByteToStringUtils.ByteArrayToCP936String(file_model); } }
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_matter; // matter file path
|
||||
|
||||
public string FileMatter { get { return ByteToStringUtils.ByteArrayToCP936String(file_matter); } }
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_icon; // icon file path
|
||||
public string FileIcon { get { return ByteToStringUtils.ByteArrayToCP936String(file_icon); } }
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_firegfx; // fire effect file
|
||||
@@ -3015,9 +3020,11 @@ namespace BrewMonster
|
||||
public string FileIcon1 => ByteToStringUtils.ByteArrayToCP936String(file_icon1);
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_icon2; // state 2 icon path
|
||||
public string FileIcon2 => ByteToStringUtils.ByteArrayToCP936String(file_icon2);
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_icon3; // state 3 icon path
|
||||
public string FileIcon3 => ByteToStringUtils.ByteArrayToCP936String(file_icon3);
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public byte[] file_icon4; // state 4 icon path
|
||||
|
||||
|
||||
@@ -1,19 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using BrewMonster;
|
||||
using ModelRenderer.Scripts.Common;
|
||||
using ModelRenderer.Scripts.GameData;
|
||||
using UnityEngine;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using BrewMonster.Scripts;
|
||||
using CSNetwork.GPDataType;
|
||||
using System.Runtime.InteropServices;
|
||||
namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
/// <summary>
|
||||
/// Arrow item class (cac loai mui ten)
|
||||
/// </summary>
|
||||
public class EC_IvtrArrow : EC_IvtrEquip
|
||||
{
|
||||
protected IVTR_ESSENCE_ARROW m_Essence; // Arrow essence data
|
||||
|
||||
// Data in database
|
||||
protected PROJECTILE_TYPE m_pDBType;
|
||||
protected PROJECTILE_ESSENCE m_pDBEssence;
|
||||
/// <summary>
|
||||
/// Not create logic yet (add summary later)
|
||||
/// Arrow item class (cac loai mui ten)
|
||||
/// </summary>
|
||||
/// <param name="tid">Template id</param>
|
||||
/// <param name="expire_date">Expire date</param>
|
||||
public EC_IvtrArrow(int tid, int expire_date) : base(tid, expire_date)
|
||||
{
|
||||
m_iCID = (int)InventoryClassId.ICID_ARROW;
|
||||
|
||||
m_Essence = new IVTR_ESSENCE_ARROW();
|
||||
|
||||
// Get database data
|
||||
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
|
||||
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
|
||||
m_pDBEssence = (PROJECTILE_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
|
||||
m_pDBType = (PROJECTILE_TYPE)pDB.get_data_ptr((uint)m_pDBEssence.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_iProcType = (int)m_pDBEssence.proc_type;
|
||||
m_i64EquipMask = EC_IvtrType.EQUIP_MASK64_PROJECTILE;
|
||||
}
|
||||
|
||||
public EC_IvtrArrow(EC_IvtrArrow other) : base(other)
|
||||
{
|
||||
m_pDBType = other.m_pDBType;
|
||||
m_pDBEssence = other.m_pDBEssence;
|
||||
m_Essence = other.m_Essence;
|
||||
}
|
||||
|
||||
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(5 * sizeof (int), CECDataReader.SEEK_CUR);
|
||||
|
||||
int iEssenceSize = dr.ReadInt();
|
||||
//ASSERT(iEssenceSize == sizeof (IVTR_ESSENCE_ARROW));
|
||||
|
||||
m_Essence = new IVTR_ESSENCE_ARROW(dr.ReadData(iEssenceSize));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError("CECIvtrArrow::SetItemInfo, data read error (" + e.GetType() + e.StackTrace + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get item icon file name
|
||||
public override string GetIconFile()
|
||||
{
|
||||
return m_pDBEssence.FileIcon;
|
||||
}
|
||||
|
||||
// Get item name
|
||||
public override string GetName()
|
||||
{
|
||||
// Try Unicode first (for Vietnamese/wide char names), then fallback to CP936
|
||||
if (m_pDBEssence.name != null && m_pDBEssence.name.Length > 0)
|
||||
{
|
||||
string s = ByteToStringUtils.UshortArrayToUnicodeString(m_pDBEssence.name);
|
||||
if (!string.IsNullOrEmpty(s) && !string.IsNullOrWhiteSpace(s))
|
||||
return s;
|
||||
// Fallback to legacy CP936 if Unicode was empty
|
||||
s = ByteToStringUtils.UshortArrayToCP936String(m_pDBEssence.name);
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
return s;
|
||||
}
|
||||
return base.GetName(); // Fallback to base class method
|
||||
}
|
||||
|
||||
// Get item description text
|
||||
protected override string GetNormalDesc(bool bRepair)
|
||||
{
|
||||
if (m_bNeedUpdate)
|
||||
return "";
|
||||
|
||||
// Build addon and refine properties and save it
|
||||
m_strDesc = "";
|
||||
BuildAddOnPropDesc(null, null);
|
||||
string strAddon = m_strDesc;
|
||||
|
||||
m_strDesc = "";
|
||||
|
||||
// Try to build item description
|
||||
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
||||
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
|
||||
int namecol = DecideNameCol();
|
||||
|
||||
if (m_iCount > 1)
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
|
||||
else
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
|
||||
|
||||
AddIDDescText();
|
||||
|
||||
AddExpireTimeDesc();
|
||||
|
||||
// Weapon requirement
|
||||
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_WEAPONREQ), m_Essence.iWeaponReqLow,
|
||||
m_Essence.iWeaponReqHigh, m_pDBType.Name);
|
||||
|
||||
// Damage enhance
|
||||
if (m_pDBEssence.damage_enhance != 0)
|
||||
{
|
||||
AddDescText(-1, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_ADDPHYDAMAGE));
|
||||
AddDescText(-1, true, " %+d", m_pDBEssence.damage_enhance);
|
||||
}
|
||||
|
||||
// Add addon properties
|
||||
if (strAddon.Length > 0)
|
||||
m_strDesc += strAddon;
|
||||
|
||||
// Price
|
||||
AddPriceDesc(white, bRepair);
|
||||
|
||||
// Suite description
|
||||
AddSuiteDesc();
|
||||
|
||||
// Extend description
|
||||
AddExtDescText();
|
||||
|
||||
return m_strDesc;
|
||||
}
|
||||
|
||||
// Get drop model for shown
|
||||
public override string GetDropModel()
|
||||
{
|
||||
return m_pDBEssence.FileMatter;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using BrewMonster;
|
||||
using ModelRenderer.Scripts.Common;
|
||||
using ModelRenderer.Scripts.GameData;
|
||||
using UnityEngine;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using BrewMonster.Scripts;
|
||||
using CSNetwork.GPDataType;
|
||||
using System.Runtime.InteropServices;
|
||||
namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
public class EC_IvtrFashion : EC_IvtrItem
|
||||
public class EC_IvtrFashion : EC_IvtrEquip
|
||||
{
|
||||
protected int m_iGender; // required gender
|
||||
protected ushort m_wColor; // color in X1R5G5B5 format
|
||||
protected uint m_color; // color in X8R8G8B8 format
|
||||
|
||||
protected IVTR_ESSENCE_FASHION m_Essence; // Fashion essence data
|
||||
|
||||
// Data in database
|
||||
protected FASHION_MAJOR_TYPE m_pDBMajorType;
|
||||
protected FASHION_SUB_TYPE m_pDBSubType;
|
||||
protected FASHION_ESSENCE m_pDBEssence;
|
||||
/// <summary>
|
||||
/// Not create logic yet (add summary later)
|
||||
/// </summary>
|
||||
@@ -10,10 +33,210 @@ namespace PerfectWorld.Scripts.Managers
|
||||
/// <param name="expire_date">Expire date</param>
|
||||
public EC_IvtrFashion(int tid, int expire_date) : base(tid, expire_date)
|
||||
{
|
||||
m_iCID = (int)InventoryClassId.ICID_FASHION;
|
||||
|
||||
m_Essence = new IVTR_ESSENCE_FASHION();
|
||||
|
||||
// Get database data
|
||||
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
|
||||
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
|
||||
m_pDBEssence = (FASHION_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
|
||||
m_pDBMajorType = (FASHION_MAJOR_TYPE)pDB.get_data_ptr(m_pDBEssence.id_major_type, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
|
||||
m_pDBSubType = (FASHION_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 = m_pDBSubType.equip_fashion_mask;
|
||||
m_iProcType = (int)m_pDBEssence.proc_type;
|
||||
|
||||
// reset the info
|
||||
DefaultInfo();
|
||||
}
|
||||
|
||||
public EC_IvtrFashion(EC_IvtrFashion other) : base(other)
|
||||
{
|
||||
m_pDBEssence = other.m_pDBEssence;
|
||||
m_pDBMajorType = other.m_pDBMajorType;
|
||||
m_pDBSubType = other.m_pDBSubType;
|
||||
m_Essence = other.m_Essence;
|
||||
m_iGender = other.m_iGender;
|
||||
m_wColor = other.m_wColor;
|
||||
m_color = other.m_color;
|
||||
}
|
||||
|
||||
// Set item detail information
|
||||
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
|
||||
{
|
||||
// Note: because fashion is not an absolute equipment, so skip
|
||||
// CECIvtrEquip::SetItemInfo().
|
||||
|
||||
if (pInfoData == null || iDataLen == 0)
|
||||
{
|
||||
m_bNeedUpdate = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
CECDataReader dr = new CECDataReader(pInfoData, iDataLen);
|
||||
var size = Marshal.SizeOf<IVTR_ESSENCE_FASHION>();
|
||||
m_Essence = new IVTR_ESSENCE_FASHION(dr.ReadData(size));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError("CECIvtrFashion::SetItemInfo, data read error (" + e.GetType() + e.StackTrace + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
LevelReq = m_Essence.require_level;
|
||||
m_wColor = m_Essence.color;
|
||||
m_iGender = m_Essence.gender;
|
||||
|
||||
m_color = (uint)FASHION_WORDCOLOR_TO_A3DCOLOR(m_wColor).GetHashCode();
|
||||
|
||||
m_bNeedUpdate = false;
|
||||
return true;
|
||||
}
|
||||
// Get item default information from database
|
||||
public override void DefaultInfo()
|
||||
{
|
||||
LevelReq = m_pDBEssence.require_level;
|
||||
m_wColor = 0x7fff;
|
||||
m_iGender = m_pDBEssence.gender;
|
||||
m_color = 0xffffffff;
|
||||
|
||||
// these data also stored in essence, sync it here
|
||||
m_Essence.require_level = LevelReq;
|
||||
m_Essence.color = m_wColor;
|
||||
m_Essence.gender = (ushort)m_iGender;
|
||||
}
|
||||
public static Color FASHION_WORDCOLOR_TO_A3DCOLOR(ushort color)
|
||||
{
|
||||
return new Color(((color & (0x1f << 10)) >> 7), ((color & (0x1f << 5)) >> 2), ((color & 0x1f) << 3));
|
||||
}
|
||||
public string GetSubTypeName()
|
||||
{
|
||||
// Try Unicode first (for Vietnamese/wide char names), then fallback to CP936
|
||||
if (m_pDBSubType.name != null && m_pDBSubType.name.Length > 0)
|
||||
{
|
||||
string s = ByteToStringUtils.UshortArrayToUnicodeString(m_pDBSubType.name);
|
||||
if (!string.IsNullOrEmpty(s) && !string.IsNullOrWhiteSpace(s))
|
||||
return s;
|
||||
// Fallback to legacy CP936 if Unicode was empty
|
||||
s = ByteToStringUtils.UshortArrayToCP936String(m_pDBSubType.name);
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
return s;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
protected override string GetNormalDesc(bool bRepair)
|
||||
{
|
||||
if (m_bNeedUpdate)
|
||||
return "";
|
||||
|
||||
m_strDesc = "";
|
||||
|
||||
// Try to build item description
|
||||
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
||||
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
||||
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
|
||||
int red = (int)DescriptipionMsg.ITEMDESC_COL_RED;
|
||||
int namecol = DecideNameCol();
|
||||
|
||||
// Item name
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
|
||||
|
||||
AddIDDescText();
|
||||
|
||||
AddBindDescText();
|
||||
|
||||
AddExpireTimeDesc();
|
||||
|
||||
// Sub class name
|
||||
AddDescText(white, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_CLASSNAME), GetSubTypeName());
|
||||
|
||||
// Color
|
||||
// Use m_iScaleType == SCALE_BUY to judge whether this item is in NPC's pack,
|
||||
// this may not be a valid way
|
||||
if (m_pDBEssence.equip_location != (int)enumSkinShow.enumSkinShowArmet && m_pDBEssence.equip_location != (int)enumSkinShow.enumSkinShowHand)
|
||||
{
|
||||
if (m_iScaleType == (int)EC_IvtrItem.ScaleType.SCALE_BUY)
|
||||
{
|
||||
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COLOR));
|
||||
AddDescText(white, true, (" ???"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Extract RGB components from m_color (X8R8G8B8 format)
|
||||
int colorRed = (int)((m_color >> 16) & 0xFF);
|
||||
int colorGreen = (int)((m_color >> 8) & 0xFF);
|
||||
int colorBlue = (int)(m_color & 0xFF);
|
||||
string szCol = string.Format("^{0:X2}{1:X2}{2:X2}", colorRed, colorGreen, colorBlue);
|
||||
|
||||
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COLOR));
|
||||
m_strDesc += " ";
|
||||
AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COLORRECT), szCol);
|
||||
}
|
||||
|
||||
}
|
||||
// Level requirment
|
||||
if (LevelReq > 0)
|
||||
{
|
||||
int lcol = pHost.GetMaxLevelSofar() >= LevelReq ? white : red;
|
||||
AddDescText(lcol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVELREQ), LevelReq);
|
||||
}
|
||||
// fashion weapon profession requirment and weapon action type
|
||||
if (m_pDBEssence.equip_location == (int)enumSkinShow.enumSkinShowHand)
|
||||
{
|
||||
AddDescText(-1, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_LEVEL), m_pDBEssence.level);
|
||||
AddProfReqDesc(m_pDBEssence.character_combo_id);
|
||||
AddActionTypeDescText((int)m_pDBEssence.action_type);
|
||||
}
|
||||
|
||||
// Gender requirement
|
||||
CECStringTab pFixMsg = EC_Game.GetFixedMsgs();
|
||||
int col = (pHost.GetGender() == m_iGender) ? white : red;
|
||||
AddDescText(col, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_GENDERREQ));
|
||||
m_strDesc += " ";
|
||||
if (m_iGender == (int)GENDER.GENDER_MALE)
|
||||
AddDescText(col, true, pFixMsg.GetWideString((int)FixedMsg.FIXMSG_GENDER_MALE));
|
||||
else
|
||||
AddDescText(col, true, pFixMsg.GetWideString((int)FixedMsg.FIXMSG_GENDER_FEMALE));
|
||||
|
||||
// Price
|
||||
AddPriceDesc(white, bRepair);
|
||||
|
||||
// Fashion level
|
||||
if (m_pDBEssence.level > 0)
|
||||
{
|
||||
m_strDesc += "\\r";
|
||||
m_strDesc += pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_COL_WHITE);
|
||||
for (int i=0; i < m_pDBEssence.level; i++)
|
||||
m_strDesc += pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_PENTAGON);
|
||||
}
|
||||
|
||||
// Extend description
|
||||
AddExtDescText();
|
||||
|
||||
return m_strDesc;
|
||||
}
|
||||
public bool HasRandomProp()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get drop model for shown
|
||||
public override string GetDropModel()
|
||||
{
|
||||
return m_pDBEssence.FileMatter;
|
||||
}
|
||||
|
||||
public int GetFashionSuiteID()
|
||||
{
|
||||
Dictionary<int, int> suiteEquipTab = EC_Game.GetSuiteEquipTab();
|
||||
return suiteEquipTab.ContainsKey(TemplateId) ? suiteEquipTab[TemplateId] : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,7 +807,8 @@ namespace BrewMonster.Scripts.Managers
|
||||
var pItem = new EC_IvtrItem(tid, expire_date);
|
||||
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
|
||||
object data = ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
|
||||
Debug.Log("Create item data: DataType: " + DataType);
|
||||
//Active this to log the data type of item when creating an item
|
||||
//Debug.Log("Create item data: DataType: " + DataType + " tid: " + tid );
|
||||
switch(DataType)
|
||||
{
|
||||
case DATA_TYPE.DT_WEAPON_ESSENCE:
|
||||
@@ -844,7 +845,7 @@ namespace BrewMonster.Scripts.Managers
|
||||
pItem = new EC_IvtrFlysword(tid, expire_date);
|
||||
break;
|
||||
case DATA_TYPE.DT_TOWNSCROLL_ESSENCE:
|
||||
pItem = new EC_IvtrTownscroll(tid, expire_date);
|
||||
pItem = new EC_IvtrTownScroll(tid, expire_date);
|
||||
break;
|
||||
case DATA_TYPE.DT_UNIONSCROLL_ESSENCE:
|
||||
pItem = new EC_IvtrUnionscroll(tid, expire_date);
|
||||
@@ -859,7 +860,7 @@ namespace BrewMonster.Scripts.Managers
|
||||
pItem = new EC_IvtrTossMat(tid, expire_date);
|
||||
break;
|
||||
case DATA_TYPE.DT_TASKMATTER_ESSENCE:
|
||||
pItem = new EC_IvtrTaskmatter(tid, expire_date);
|
||||
pItem = new EC_IvtrTaskItem(tid, expire_date);
|
||||
break;
|
||||
case DATA_TYPE.DT_STONE_ESSENCE:
|
||||
pItem = new EC_IvtrStone(tid, expire_date);
|
||||
|
||||
@@ -77,7 +77,6 @@ namespace PerfectWorld.Scripts.Managers
|
||||
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
||||
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
|
||||
int namecol = DecideNameCol();
|
||||
BMLogger.Log("GetNormalDesc: m_pDBEssence.Name:" + m_pDBEssence.Name + " m_iCount:" + m_iCount);
|
||||
if (m_iCount > 1)
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
|
||||
else
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using BrewMonster;
|
||||
using ModelRenderer.Scripts.Common;
|
||||
using ModelRenderer.Scripts.GameData;
|
||||
using UnityEngine;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using BrewMonster.Scripts;
|
||||
using CSNetwork.GPDataType;
|
||||
using System.Runtime.InteropServices;
|
||||
namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
public class EC_IvtrTaskItem : EC_IvtrItem
|
||||
{
|
||||
protected TASKMATTER_ESSENCE m_pDBEssence;
|
||||
/// <summary>
|
||||
/// Not create logic yet (add summary later)
|
||||
/// </summary>
|
||||
/// <param name="tid">Template id</param>
|
||||
/// <param name="expire_date">Expire date</param>
|
||||
public EC_IvtrTaskItem(int tid, int expire_date) : base(tid, expire_date)
|
||||
{
|
||||
m_iCID = (int)InventoryClassId.ICID_TASKITEM;
|
||||
|
||||
// Get database data
|
||||
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
|
||||
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
|
||||
m_pDBEssence = (TASKMATTER_ESSENCE)pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
|
||||
|
||||
m_iPileLimit = m_pDBEssence.pile_num_max;
|
||||
m_iPrice = 0;
|
||||
m_iShopPrice = 0;
|
||||
m_iProcType = (int)m_pDBEssence.proc_type;
|
||||
m_i64EquipMask = 0;
|
||||
|
||||
m_bNeedUpdate = false;
|
||||
}
|
||||
|
||||
public EC_IvtrTaskItem(EC_IvtrTaskItem other) : base(other)
|
||||
{
|
||||
m_pDBEssence = other.m_pDBEssence;
|
||||
}
|
||||
|
||||
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
|
||||
{
|
||||
base.SetItemInfo(pInfoData, iDataLen);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get item icon file name
|
||||
public override string GetIconFile()
|
||||
{
|
||||
return m_pDBEssence.FileIcon;
|
||||
}
|
||||
|
||||
// Get item name
|
||||
public override string GetName()
|
||||
{
|
||||
// Try Unicode first (for Vietnamese/wide char names), then fallback to CP936
|
||||
if (m_pDBEssence.name != null && m_pDBEssence.name.Length > 0)
|
||||
{
|
||||
string s = ByteToStringUtils.UshortArrayToUnicodeString(m_pDBEssence.name);
|
||||
if (!string.IsNullOrEmpty(s) && !string.IsNullOrWhiteSpace(s))
|
||||
return s;
|
||||
// Fallback to legacy CP936 if Unicode was empty
|
||||
s = ByteToStringUtils.UshortArrayToCP936String(m_pDBEssence.name);
|
||||
if (!string.IsNullOrEmpty(s))
|
||||
return s;
|
||||
}
|
||||
return base.GetName(); // Fallback to base class method
|
||||
}
|
||||
// Get item description text
|
||||
protected override string GetNormalDesc(bool bRepair)
|
||||
{
|
||||
m_strDesc = string.Empty;
|
||||
|
||||
// Try to build item description
|
||||
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
||||
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
|
||||
int namecol = DecideNameCol();
|
||||
|
||||
if (m_iCount > 1)
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
|
||||
else
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
|
||||
|
||||
AddIDDescText();
|
||||
|
||||
AddExpireTimeDesc();
|
||||
|
||||
// Task item
|
||||
AddDescText(white, false, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_TASKITEM));
|
||||
|
||||
// Extend description
|
||||
AddExtDescText();
|
||||
|
||||
return m_strDesc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec738837a1a3f40e38926d3365da3df5
|
||||
@@ -1,20 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using BrewMonster;
|
||||
using ModelRenderer.Scripts.Common;
|
||||
using ModelRenderer.Scripts.GameData;
|
||||
using UnityEngine;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using BrewMonster.Scripts;
|
||||
using CSNetwork.GPDataType;
|
||||
using System.Runtime.InteropServices;
|
||||
namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
/// <summary>
|
||||
/// Task Normal Matter Item.(non interactable quest item). it is a part of IvtrTaskItem(C++)
|
||||
/// </summary>
|
||||
public class EC_IvtrTaskNmMatter : EC_IvtrItem
|
||||
{
|
||||
protected TASKNORMALMATTER_ESSENCE m_pDBEssence;
|
||||
/// <summary>
|
||||
/// Not create logic yet (add summary later)
|
||||
/// Constructor for Task Normal Matter Item.
|
||||
/// </summary>
|
||||
/// <param name="tid">Template id</param>
|
||||
/// <param name="expire_date">Expire date</param>
|
||||
public EC_IvtrTaskNmMatter(int tid, int expire_date) : base(tid, expire_date)
|
||||
{
|
||||
m_iCID = (int)InventoryClassId.ICID_TASKNMMATTER;
|
||||
|
||||
// Get database data
|
||||
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
|
||||
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
|
||||
m_pDBEssence = (TASKNORMALMATTER_ESSENCE)pDB.get_data_ptr((uint)tid, 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_iProcType = (int)m_pDBEssence.proc_type;
|
||||
m_bNeedUpdate = false;
|
||||
}
|
||||
|
||||
public EC_IvtrTaskNmMatter(EC_IvtrTaskNmMatter other) : base(other)
|
||||
{
|
||||
m_pDBEssence = other.m_pDBEssence;
|
||||
}
|
||||
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
|
||||
{
|
||||
base.SetItemInfo(pInfoData, iDataLen);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get item icon file name
|
||||
public override string GetIconFile()
|
||||
{
|
||||
return m_pDBEssence.FileIcon;
|
||||
}
|
||||
|
||||
// Get item description text
|
||||
protected override string GetNormalDesc(bool bRepair)
|
||||
{
|
||||
m_strDesc = string.Empty;
|
||||
|
||||
// Try to build item description
|
||||
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
||||
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
|
||||
int namecol = DecideNameCol();
|
||||
|
||||
if (m_iCount > 1)
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
|
||||
else
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
|
||||
|
||||
AddIDDescText();
|
||||
|
||||
AddExpireTimeDesc();
|
||||
|
||||
// Price
|
||||
AddPriceDesc(white, bRepair);
|
||||
|
||||
// Extend description
|
||||
AddExtDescText();
|
||||
|
||||
return m_strDesc;
|
||||
}
|
||||
public override string GetDropModel()
|
||||
{
|
||||
return m_pDBEssence.FileMatter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using BrewMonster.Scripts.Managers;
|
||||
namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
public class EC_IvtrTaskmatter : EC_IvtrItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Not create logic yet (add summary later)
|
||||
/// </summary>
|
||||
/// <param name="tid">Template id</param>
|
||||
/// <param name="expire_date">Expire date</param>
|
||||
public EC_IvtrTaskmatter(int tid, int expire_date) : base(tid, expire_date)
|
||||
{
|
||||
}
|
||||
|
||||
public EC_IvtrTaskmatter(EC_IvtrTaskmatter other) : base(other)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee5181c9a0786409fb452d21d947eab7
|
||||
@@ -1,20 +1,95 @@
|
||||
using BrewMonster;
|
||||
using ModelRenderer.Scripts.GameData;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using BrewMonster.Scripts;
|
||||
using CSNetwork.GPDataType;
|
||||
namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
public class EC_IvtrTownscroll : EC_IvtrItem
|
||||
/// <summary>
|
||||
/// Town scroll item class (hoi thanh phu). It is a part of EC_IvtrScroll(c++)
|
||||
/// TownScroll allow player to teleport to towns inside one map.
|
||||
/// </summary>
|
||||
public class EC_IvtrTownScroll : EC_IvtrItem
|
||||
{
|
||||
protected TOWNSCROLL_ESSENCE m_pDBEssence;
|
||||
/// <summary>
|
||||
/// Not create logic yet (add summary later)
|
||||
/// Constructor for Town Scroll
|
||||
/// </summary>
|
||||
/// <param name="tid">Template id</param>
|
||||
/// <param name="expire_date">Expire date</param>
|
||||
public EC_IvtrTownscroll(int tid, int expire_date) : base(tid, expire_date)
|
||||
public EC_IvtrTownScroll(int tid, int expire_date) : base(tid, expire_date)
|
||||
{
|
||||
m_iCID = (int)InventoryClassId.ICID_TOWNSCROLL;
|
||||
|
||||
// Get database data
|
||||
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
|
||||
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
|
||||
m_pDBEssence = (TOWNSCROLL_ESSENCE)pDB.get_data_ptr((uint)tid, 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_iProcType = (int)m_pDBEssence.proc_type;
|
||||
m_i64EquipMask = 0;
|
||||
m_bUseable = true;
|
||||
m_dwUseFlags = (uint)UseCondition.USE_PERSIST;
|
||||
|
||||
m_bNeedUpdate = false;
|
||||
}
|
||||
|
||||
public EC_IvtrTownscroll(EC_IvtrTownscroll other) : base(other)
|
||||
public EC_IvtrTownScroll(EC_IvtrTownScroll other) : base(other)
|
||||
{
|
||||
m_pDBEssence = other.m_pDBEssence;
|
||||
}
|
||||
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
|
||||
{
|
||||
base.SetItemInfo(pInfoData, iDataLen);
|
||||
return true;
|
||||
}
|
||||
public override string GetIconFile()
|
||||
{
|
||||
return m_pDBEssence.FileIcon;
|
||||
}
|
||||
// Get item cool time
|
||||
public int GetCoolTime(ref int piMax)
|
||||
{
|
||||
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
||||
return pHost ? pHost.GetCoolTime((int)CoolTimeIndex.GP_CT_TOWNSCROLL, ref piMax) : 0;
|
||||
}
|
||||
|
||||
protected override string GetNormalDesc(bool bRepair)
|
||||
{
|
||||
m_strDesc = string.Empty;
|
||||
|
||||
// Try to build item description
|
||||
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
||||
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
|
||||
int namecol = DecideNameCol();
|
||||
|
||||
if (m_iCount > 1)
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
|
||||
else
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
|
||||
|
||||
AddIDDescText();
|
||||
|
||||
AddExpireTimeDesc();
|
||||
|
||||
// Price
|
||||
AddPriceDesc(white, bRepair);
|
||||
|
||||
// Extend description
|
||||
AddExtDescText();
|
||||
|
||||
return m_strDesc;
|
||||
}
|
||||
// Get drop model for shown
|
||||
public override string GetDropModel()
|
||||
{
|
||||
return m_pDBEssence.FileMatter;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,104 @@
|
||||
using BrewMonster;
|
||||
using ModelRenderer.Scripts.GameData;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using BrewMonster.Scripts;
|
||||
using CSNetwork.GPDataType;
|
||||
namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
/// <summary>
|
||||
/// Transmit scroll item(Da dich chuyen). It is a part of EC_IvtrConsume(c++)
|
||||
/// TransmitScroll allow player to teleport to other maps' towns.
|
||||
/// </summary>
|
||||
public class EC_IvtrTransmitScroll : EC_IvtrItem
|
||||
{
|
||||
protected TRANSMITSCROLL_ESSENCE m_pDBEssence;
|
||||
/// <summary>
|
||||
/// Not create logic yet (add summary later)
|
||||
/// Constructor for Transmit Scroll
|
||||
/// </summary>
|
||||
/// <param name="tid">Template id</param>
|
||||
/// <param name="expire_date">Expire date</param>
|
||||
public EC_IvtrTransmitScroll(int tid, int expire_date) : base(tid, expire_date)
|
||||
{
|
||||
m_iCID = (int)InventoryClassId.ICID_TRANSMITSCROLL;
|
||||
|
||||
// Get database data
|
||||
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
|
||||
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
|
||||
m_pDBEssence = (TRANSMITSCROLL_ESSENCE)pDB.get_data_ptr((uint)tid, 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_iProcType = (int)m_pDBEssence.proc_type;
|
||||
m_i64EquipMask = 0;
|
||||
m_bUseable = true;
|
||||
m_dwUseFlags = (uint)UseCondition.USE_PERSIST;
|
||||
|
||||
m_bNeedUpdate = false;
|
||||
}
|
||||
|
||||
public EC_IvtrTransmitScroll(EC_IvtrTransmitScroll other) : base(other)
|
||||
{
|
||||
m_pDBEssence = other.m_pDBEssence;
|
||||
}
|
||||
public override bool SetItemInfo(byte[] pInfoData, int iDataLen)
|
||||
{
|
||||
base.SetItemInfo(pInfoData, iDataLen);
|
||||
return true;
|
||||
}
|
||||
public override string GetIconFile()
|
||||
{
|
||||
return m_pDBEssence.FileIcon;
|
||||
}
|
||||
public int GetCoolTime(ref int piMax)
|
||||
{
|
||||
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
||||
if (!pHost)
|
||||
return 0;
|
||||
int iTime = pHost.GetCoolTime((int)CoolTimeIndex.GP_CT_TOWNSCROLL, ref piMax);
|
||||
return iTime;
|
||||
}
|
||||
|
||||
protected override string GetNormalDesc(bool bRepair)
|
||||
{
|
||||
m_strDesc = string.Empty;
|
||||
|
||||
// Try to build item description
|
||||
CECStringTab pDescTab = EC_Game.GetItemDesc();
|
||||
int white = (int)DescriptipionMsg.ITEMDESC_COL_WHITE;
|
||||
int namecol = DecideNameCol();
|
||||
|
||||
if (m_iCount > 1)
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAMENUMBER), GetName(), m_iCount);
|
||||
else
|
||||
AddDescText(namecol, true, pDescTab.GetWideString((int)DescriptipionMsg.ITEMDESC_NAME), GetName());
|
||||
|
||||
AddIDDescText();
|
||||
|
||||
AddExpireTimeDesc();
|
||||
|
||||
// Price
|
||||
AddPriceDesc(white, bRepair);
|
||||
|
||||
// Extend description
|
||||
AddExtDescText();
|
||||
|
||||
return m_strDesc;
|
||||
}
|
||||
// Get drop model for shown
|
||||
public override string GetDropModel()
|
||||
{
|
||||
return m_pDBEssence.FileMatter;
|
||||
}
|
||||
|
||||
// Check item use condition
|
||||
public override bool CheckUseCondition()
|
||||
{
|
||||
if( EC_Game.GetGameRun().GetHostPlayer().IsFighting() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,6 @@ namespace BrewMonster.Scripts.Managers
|
||||
public float attack_short_range;
|
||||
public IVTR_ESSENCE_WEAPON( byte[] data)
|
||||
{
|
||||
Debug.Log("IVTR_ESSENCE_WEAPON: data.Length: " + data.Length);
|
||||
CECDataReader dr = new (data, data.Length);
|
||||
weapon_type = dr.ReadShort();
|
||||
weapon_dealy = dr.ReadShort();
|
||||
@@ -87,12 +86,20 @@ namespace BrewMonster.Scripts.Managers
|
||||
};
|
||||
public struct IVTR_ESSENCE_ARROW
|
||||
{
|
||||
// TODO : implement data later
|
||||
// DWORD dwBowMask;
|
||||
// int iDamage;
|
||||
// int iDamageScale;
|
||||
// int iWeaponReqLow;
|
||||
// int iWeaponReqHigh;
|
||||
public int dwBowMask;
|
||||
public int iDamage;
|
||||
public int iDamageScale;
|
||||
public int iWeaponReqLow;
|
||||
public int iWeaponReqHigh;
|
||||
public IVTR_ESSENCE_ARROW(byte[] data)
|
||||
{
|
||||
CECDataReader dr = new (data, data.Length);
|
||||
dwBowMask = dr.ReadInt();
|
||||
iDamage = dr.ReadInt();
|
||||
iDamageScale = dr.ReadInt();
|
||||
iWeaponReqLow = dr.ReadInt();
|
||||
iWeaponReqHigh = dr.ReadInt();
|
||||
}
|
||||
};
|
||||
public struct IVTR_ESSENCE_DECORATION
|
||||
{
|
||||
@@ -103,7 +110,6 @@ namespace BrewMonster.Scripts.Managers
|
||||
public int[] resistance;
|
||||
public IVTR_ESSENCE_DECORATION(byte[] data)
|
||||
{
|
||||
Debug.Log("IVTR_ESSENCE_DECORATION: data.Length: " + data.Length);
|
||||
CECDataReader dr = new (data, data.Length);
|
||||
damage = dr.ReadInt();
|
||||
magic_damage = dr.ReadInt();
|
||||
@@ -141,10 +147,16 @@ namespace BrewMonster.Scripts.Managers
|
||||
};
|
||||
public struct IVTR_ESSENCE_FASHION
|
||||
{
|
||||
// TODO : implement data later
|
||||
// int require_level;
|
||||
// unsigned short color;
|
||||
// unsigned short gender;
|
||||
public int require_level;
|
||||
public ushort color;
|
||||
public ushort gender;
|
||||
public IVTR_ESSENCE_FASHION(byte[] data)
|
||||
{
|
||||
CECDataReader dr = new (data, data.Length);
|
||||
require_level = dr.ReadInt();
|
||||
color = dr.ReadUShort();
|
||||
gender = dr.ReadUShort();
|
||||
}
|
||||
};
|
||||
public struct IVTR_ESSENCE_FLYSWORD
|
||||
{
|
||||
|
||||
@@ -211,7 +211,6 @@ namespace PerfectWorld.Scripts.Managers
|
||||
// Get item name
|
||||
public override string GetName()
|
||||
{
|
||||
BMLogger.Log("[THN]EC_IvtrWeapon: GetName: m_pDBEssence.Name: " + m_pDBEssence.Name);
|
||||
return m_pDBEssence.Name;
|
||||
}
|
||||
// Get preview info
|
||||
|
||||
@@ -1891,4 +1891,18 @@ namespace BrewMonster
|
||||
public static byte SKIN_FASHION_FOOT_INDEX = 9;
|
||||
public static byte NUM_SKIN_INDEX = 10;
|
||||
}
|
||||
public enum enumSkinShow
|
||||
{
|
||||
enumSkinShowNone = 0,
|
||||
enumSkinShowUpperBody,
|
||||
enumSkinShowWrist,
|
||||
enumSkinShowLowerBody,
|
||||
enumSkinShowFoot,
|
||||
enumSkinShowUpperAndLower,
|
||||
enumSkinShowUpperAndWrist,
|
||||
enumSkinShowLowerAndFoot,
|
||||
enumSkinShowUpperLowerAndWrist,
|
||||
enumSkinShowArmet,
|
||||
enumSkinShowHand,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user