435 lines
21 KiB
C#
435 lines
21 KiB
C#
using BrewMonster.ELEMENT_DATA;
|
||
using ModelRenderer.Scripts.GameData;
|
||
using BrewMonster;
|
||
using System.Runtime.InteropServices;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System;
|
||
public static class generate_item_temp
|
||
{
|
||
public static int generate_weapon<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;
|
||
data = new byte[0];
|
||
size = 0;
|
||
int i=0;
|
||
object obj = itemdataman._edm.get_data_ptr(id, idspace,ref datatype);
|
||
if(obj == null || datatype != DATA_TYPE.DT_WEAPON_ESSENCE)
|
||
{
|
||
return -1;
|
||
}
|
||
WEAPON_ESSENCE ess = (WEAPON_ESSENCE)obj;
|
||
|
||
//$$$$$$$$$$$ ���ڼ�����Ʒû�ж��������Բ�������
|
||
|
||
if(ess.id_sub_type == 300 || ess.id_sub_type == 293 || ess.id_sub_type == 76 || ess.id_sub_type == 291)
|
||
{
|
||
return -1;
|
||
}
|
||
size =(uint)(Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(_item_content)) + Marshal.SizeOf(typeof(_weapon_essence)));
|
||
|
||
// �����?
|
||
uint 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 };
|
||
hole_num = element_data.RandSelect_SPECIFIC_LOWER(drop_probability_socket.ToList(), SPECIFIC.SPECIFIC_RAND, 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 = element_data.RandSelect_SPECIFIC_LOWER(make_probability_socket.ToList(), SPECIFIC.SPECIFIC_RAND, LOWER.LOWER_TREND); //������Ŀ
|
||
}
|
||
size += hole_num*sizeof(int); // size ����hole_num������type
|
||
|
||
//����tag size
|
||
//ASSERT(tag_size >= sizeof(short));
|
||
size += tag.size;
|
||
|
||
|
||
// ���addons
|
||
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, ess.probability_addon_num5 };
|
||
uint addon_num = element_data.RandSelect_SPECIFIC_LOWER(probability_addon_num.ToList(), SPECIFIC.SPECIFIC_RAND, LOWER.LOWER_TREND); //���Ա���Ŀ����Ŀ
|
||
|
||
uint addon_size = 0;
|
||
if(ess.fixed_props!=0)
|
||
{
|
||
// this list store the addon id
|
||
// addon_size = generate_equipment_addon_buffer_2(DT_WEAPON_ESSENCE, (int*)&(ess->addons[0]), sizeof(int)+sizeof(float),32, addon_buf,addon_num);
|
||
List<int> addon_list = ess.addons.Select(a => (int)a.id_addon).ToList();
|
||
addon_size = itemdataman.generate_equipment_addon_buffer_2(DATA_TYPE.DT_WEAPON_ESSENCE, addon_list, addon_buf,0, ref addon_num);
|
||
}
|
||
else
|
||
{
|
||
if(addon_num > 0 || normal_addon == GEN_ADDON_MODE.ADDON_LIST_SPEC)
|
||
{
|
||
List<int> unique_list = ess.uniques.Select(a => (int)a.id_unique).ToList();
|
||
List<int> produce_list = ess.rands.Select(a => (int)a.id_rand).ToList();
|
||
List<int> addons_list = ess.addons.Select(a => (int)a.id_addon).ToList();
|
||
itemdataman.generate_template_addon(
|
||
DATA_TYPE.DT_WEAPON_ESSENCE,ess.probability_unique,
|
||
unique_list,produce_list,addons_list,
|
||
addon_buf,ref addon_num,ref addon_size,cls,normal_addon,sa_list);
|
||
}
|
||
else
|
||
{
|
||
if (normal_addon == GEN_ADDON_MODE.ADDON_LIST_SPEC)
|
||
{
|
||
addon_size = itemdataman.generate_spec_addon_buffer(DATA_TYPE.DT_WEAPON_ESSENCE,addon_buf,0,itemdataman.ELEMENTDATAMAN_MAX_NUM_ADDONS, ref addon_num,sa_list);
|
||
}
|
||
}
|
||
}
|
||
|
||
size += addon_size;
|
||
|
||
// allocate the buffer with exact length
|
||
// *data = (char *)abase::fastalloc(size);
|
||
|
||
data = new byte[size];
|
||
//byte[] buf = data;
|
||
int offset = 0;
|
||
|
||
// *(unsigned int*)buf = id; buf += sizeof(unsigned int); //��Ʒ��ģ��ID
|
||
// *(size_t*)buf = 1; buf += sizeof(size_t); //��Ʒ������
|
||
// *(size_t*)buf = ess->pile_num_max; buf += sizeof(size_t); //��Ʒ�Ķѵ�����
|
||
// *(int*)buf = ELEMENTDATAMAN_EQUIP_MASK_WEAPON|(addon_num?0x40000000:0); buf += sizeof(int); //��Ʒ�Ŀ�װ����־���̶�ֵ����
|
||
// *(int*)buf = ess->proc_type; buf += sizeof(int); //��Ʒ�Ĵ�����ʽ
|
||
// *(int*)buf = DT_WEAPON_ESSENCE; buf += sizeof(int); //��Ʒ��Ӧ�����ID
|
||
WriteUInt(data, ref offset, id);
|
||
WriteUInt(data, ref offset, 1);
|
||
WriteInt(data, ref offset, ess.pile_num_max);
|
||
WriteInt(data, ref offset,(int)(itemdataman.ELEMENTDATAMAN_EQUIP_MASK_WEAPON|(addon_num>0?0x40000000:0)));
|
||
WriteUInt(data, ref offset, ess.proc_type);
|
||
WriteInt(data, ref offset, (int)DATA_TYPE.DT_WEAPON_ESSENCE);
|
||
// if(ess->has_guid == 1){
|
||
// int g1,g2;
|
||
// get_item_guid(id,g1,g2);
|
||
// *(int*)buf = g1; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid
|
||
// *(int*)buf = g2; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid
|
||
// }
|
||
// else{
|
||
// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid
|
||
// *(int*)buf = 0; buf += sizeof(int); //��Ʒ��Ӧ�����ID guid
|
||
// }
|
||
// *(int*)buf = ess->price; buf += sizeof(int); //��Ʒ�ļ۸�
|
||
// *(int*)buf = 0; buf += sizeof(int); //����ʱ��
|
||
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);
|
||
|
||
// size_t* content_length = (size_t*)buf; buf += sizeof(size_t); //��סbuf��ָ�룬�Ժ�����
|
||
// char ** item_content = (char **)buf; buf += sizeof(char *); //��סbuf��ָ�룬�Ժ�����
|
||
// *item_content = buf;
|
||
// *content_length = (char *)(*data)+size-buf;
|
||
|
||
// Then content_length store the length of the content.
|
||
// The item_content store the position of the start point of the content.
|
||
// Skip content_length and item_content pointer. So the remain is the content.
|
||
// After that we can calculate the content_length and item_content pointer.
|
||
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
|
||
// char * require_ptr = buf;
|
||
// *(short*)buf = ess->require_level; buf += sizeof(short); //prerequisition level
|
||
// *(short*)buf = ess->character_combo_id&0xFFFF; buf += sizeof(short); //prerequisition race
|
||
// *(short*)buf = ess->require_strength; buf += sizeof(short); //prerequisition strength
|
||
// *(short*)buf = ess->require_tili; buf += sizeof(short); //prerequisition val
|
||
// *(short*)buf = ess->require_agility; buf += sizeof(short); //prerequisition agility
|
||
// *(short*)buf = ess->require_energy; buf += sizeof(short); //prerequisition energy
|
||
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(ess->durability_min, ess->durability_max, cls,element_data::LOWER_TREND);
|
||
// int temp;
|
||
// if(normal_addon != element_data::ADDON_LIST_DROP || ess->proc_type & 0x1000)
|
||
// {
|
||
// temp = temp2;
|
||
// }
|
||
// else
|
||
// {
|
||
// 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 temp = temp2;
|
||
if(normal_addon != GEN_ADDON_MODE.ADDON_LIST_DROP || (ess.proc_type & 0x1000) != 0)
|
||
{
|
||
temp = temp2;
|
||
}
|
||
else
|
||
{
|
||
temp = element_data.RandNormal_NORMAL_UPPER(ess.durability_drop_min, ess.durability_drop_max, NORMAL.NORMAL_RAND, UPPER.UPPER_TREND);
|
||
if(temp > temp2) temp = temp2;
|
||
}
|
||
|
||
// *(int*)buf = temp; buf += sizeof(int); //prerequisition durability
|
||
// *(int*)buf = temp2; buf += sizeof(int); //prerequisition max_durability
|
||
WriteInt(data, ref offset, temp); // durability
|
||
WriteInt(data, ref offset, temp2); // max_durability
|
||
|
||
// //���������߱�ǩע���ǩ���ڱ����С�ͱ�������֮��
|
||
// *(short*)buf = sizeof(_weapon_essence); buf += sizeof(short); //װ�������С���ֽڣ�?
|
||
// memcpy(buf,tag,tag_size);
|
||
// buf += tag_size;
|
||
WriteShort(data, ref offset, (short)Marshal.SizeOf(typeof(_weapon_essence)));
|
||
WriteTag(data, ref offset, tag);
|
||
|
||
//essence //char ����[]; //ÿ�ֲ�ͬװ���ı���ṹ���?
|
||
// char * essence_ptr = buf;
|
||
int essence_ptr = offset;
|
||
// switch(ess->short_range_mode)
|
||
// {
|
||
// default:
|
||
// case 0: *(short*)buf = 1; break; //Զ��
|
||
// case 1: *(short*)buf = 0; break; //����
|
||
// case 2: *(short*)buf = 2; break; //�̿ͽ���
|
||
// }
|
||
// buf += sizeof(short); //�������? ��Ӧģ����Ľ���Զ�̱��?
|
||
switch(ess.short_range_mode)
|
||
{
|
||
default:
|
||
case 0:
|
||
WriteShort(data, ref offset, (short)1);
|
||
break;
|
||
case 1:
|
||
WriteShort(data, ref offset, (short)0);
|
||
break;
|
||
case 2:
|
||
WriteShort(data, ref offset, (short)2);
|
||
break;
|
||
}
|
||
// *(short*)buf = 0; buf += sizeof(short); //���ֵ����ʹ��?
|
||
// *(int*)buf = ess->id_major_type; buf += sizeof(int); //�������� ��Ӧģ����Ĵ���? ���絶�� ������
|
||
// *(int*)buf = ess->level; buf += sizeof(int); //�������� ijЩ������Ҫ��������
|
||
// *(int*)buf = ess->require_projectile; buf += sizeof(int); //��Ҫ��ҩ������
|
||
// *(int*)buf = ess->damage_low; buf += sizeof(int); //����������С��ֵ
|
||
// *(int*)buf = element_data::RandNormal(ess->damage_high_min, ess->damage_high_max, cls,element_data::LOWER_TREND); buf += sizeof(int); //������������ֵ
|
||
// *(int*)buf = ess->magic_daage_low; buf += sizeof(int); //ħ����������?
|
||
// *(int*)buf = element_data::RandNormal(ess->magic_damage_high_min, ess->magic_damage_high_max, cls,element_data::LOWER_TREND); buf += sizeof(int); //ħ������
|
||
WriteShort(data, ref offset, (short)0);
|
||
WriteUInt(data, ref offset, ess.id_major_type);
|
||
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, 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));
|
||
|
||
// 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)
|
||
// {
|
||
// // assert(false);
|
||
// *(int*)buf = 0; buf += sizeof(int);
|
||
// }
|
||
// else
|
||
// {
|
||
// unsigned int index = element_data::RandSelect(&(subtype->probability_fastest), sizeof(float), 5, cls,element_data::MIDDLE_TREND);
|
||
// *(int*)buf = (int)(subtype->attack_speed*20.f + 0.1f) + (index - 2); buf += sizeof(int); //ģ���е���0.05����?
|
||
// }
|
||
WEAPON_SUB_TYPE subtype = new WEAPON_SUB_TYPE();
|
||
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_WEAPON_SUB_TYPE)
|
||
{
|
||
WriteInt(data, ref offset, 0);
|
||
}
|
||
else
|
||
{
|
||
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);
|
||
WriteInt(data, ref offset, (int)(subtype.attack_speed*20f + 0.1f) + (index - 2));
|
||
}
|
||
|
||
// *(float*)buf = ess->attack_range; buf += sizeof(float);
|
||
// *(float*)buf = subtype->attack_short_range; buf += sizeof(float);
|
||
// *(short*)buf = hole_num; buf += sizeof(short); //������Ŀ
|
||
// *(short*)buf = 0; buf += sizeof(short); //����������������
|
||
// for(i=0; i<hole_num; i++)
|
||
// {
|
||
// *(int*)buf = 0; buf += sizeof(int); //����Ƕ��������ͣ�û�ж���?0
|
||
// }
|
||
WriteFloat(data, ref offset, ess.attack_range);
|
||
WriteFloat(data, ref offset, subtype.attack_short_range);
|
||
WriteShort(data, ref offset, (short)hole_num);
|
||
WriteShort(data, ref offset, (short)0);
|
||
for(i = 0; i < hole_num; i++)
|
||
{
|
||
WriteInt(data, ref offset, 0);
|
||
}
|
||
|
||
// addons
|
||
// *(int*)buf = addon_num; buf += sizeof(int);
|
||
WriteInt(data, ref offset, (int)addon_num);
|
||
// char * addon_sld = addon_buf;
|
||
int addon_sld = offset;
|
||
// for(i=0; i<addon_num; i++)
|
||
// {
|
||
// int id = *(int*)addon_sld;
|
||
// addon_update_ess_data(*(addon_data*)addon_sld, essence_ptr, sizeof(_weapon_essence), (prerequisition*)require_ptr);
|
||
// addon_sld += ((id & 0x6000)>>13)*sizeof(int)+sizeof(int);
|
||
// }
|
||
addon_data addon_data = new addon_data();
|
||
prerequisition prerequisition = new 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);
|
||
ReadPrerequisition(addon_buf, ref require_ptr, out prerequisition);
|
||
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);
|
||
}
|
||
|
||
// memcpy(buf, addon_buf, addon_size);
|
||
// set_to_classid(DT_WEAPON_ESSENCE, (item_data*)(*data), -1);
|
||
itemdataman.update_require_data(prerequisition);
|
||
// Copy the entire addon buffer instead of writing a single addon_data
|
||
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_WEAPON_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)
|
||
{
|
||
// DATA_TYPE datatype;
|
||
DATA_TYPE datatype = DATA_TYPE.DT_INVALID;
|
||
data = new byte[0];
|
||
size = 0;
|
||
int i=0;
|
||
// TASKNORMALMATTER_ESSENCE * ess = (TASKNORMALMATTER_ESSENCE *)get_data_ptr(id, idspace, datatype);
|
||
object obj = itemdataman._edm.get_data_ptr(id, idspace,ref datatype);
|
||
if(obj == null || datatype != DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE)
|
||
{
|
||
return -1;
|
||
}
|
||
TASKNORMALMATTER_ESSENCE ess = (TASKNORMALMATTER_ESSENCE)obj;
|
||
size =(uint) (Marshal.SizeOf(typeof(item_data)) + Marshal.SizeOf(typeof(TASKNORMALMATTER_ESSENCE)));
|
||
data = new byte[size];
|
||
int offset = 0;
|
||
WriteUInt(data, ref offset, ess.id);
|
||
WriteUInt(data, ref offset, 1);
|
||
WriteInt(data, ref offset, ess.pile_num_max);
|
||
WriteInt(data, ref offset, 0);
|
||
WriteUInt(data, ref offset, ess.proc_type);
|
||
WriteInt(data, ref offset, (int)DATA_TYPE.DT_TASKNORMALMATTER_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;
|
||
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);
|
||
|
||
itemdataman.set_to_classid(DATA_TYPE.DT_TASKNORMALMATTER_ESSENCE, data, -1);
|
||
return 0;
|
||
}
|
||
private static void WriteUInt(byte[] buf, ref int offset, uint value)
|
||
{
|
||
Array.Copy(BitConverter.GetBytes(value), 0, buf, offset, 4);
|
||
offset = offset + 4;
|
||
}
|
||
private static void WriteInt(byte[] buf, ref int offset, int value)
|
||
{
|
||
Array.Copy(BitConverter.GetBytes(value), 0, buf, offset, 4);
|
||
offset = offset + 4;
|
||
}
|
||
private static void WriteShort(byte[] buf, ref int offset, short value)
|
||
{
|
||
Array.Copy(BitConverter.GetBytes(value), 0, buf, offset, 2);
|
||
offset = offset + 2;
|
||
}
|
||
private static void WriteFloat(byte[] buf, ref int offset, float value)
|
||
{
|
||
Array.Copy(BitConverter.GetBytes(value), 0, buf, offset, 4);
|
||
offset = offset + 4;
|
||
}
|
||
private static void WriteTag(byte[] buf, ref int offset, item_tag_t tag)
|
||
{
|
||
Array.Copy(BitConverter.GetBytes(tag.type), 0, buf, offset, 1);
|
||
offset = offset + 1;
|
||
Array.Copy(BitConverter.GetBytes(tag.size), 0, buf, offset, 1);
|
||
offset = offset + 1;
|
||
}
|
||
private static void WriteAddonData(byte[] buf, ref int offset, addon_data value)
|
||
{
|
||
WriteInt(buf, ref offset, value.id);
|
||
for(int i = 0; i < 3; i++)
|
||
{
|
||
WriteInt(buf, ref offset, value.arg[i]);
|
||
}
|
||
}
|
||
private static void ReadInt(byte[] buf, ref int offset, out int value)
|
||
{
|
||
value = BitConverter.ToInt32(buf, offset);
|
||
offset = offset + 4;
|
||
}
|
||
private static void ReadAddonData(byte[] buf, ref int offset, out addon_data value)
|
||
{
|
||
value = new addon_data();
|
||
value.id = BitConverter.ToInt32(buf, offset);
|
||
offset = offset + 4;
|
||
value.arg = new int[3];
|
||
for(int i = 0; i < 3; i++)
|
||
{
|
||
value.arg[i] = BitConverter.ToInt32(buf, offset);
|
||
offset = offset + 4;
|
||
}
|
||
}
|
||
private static void ReadPrerequisition(byte[] buf, ref int offset, out prerequisition value)
|
||
{
|
||
value = new prerequisition();
|
||
value.level = BitConverter.ToInt16(buf, offset);
|
||
offset = offset + 2;
|
||
value.race = BitConverter.ToInt16(buf, offset);
|
||
offset = offset + 2;
|
||
value.strength = BitConverter.ToInt16(buf, offset);
|
||
offset = offset + 2;
|
||
}
|
||
} |