Решил поделится структурой файлов для хроник Grand Crusade:
SkillName-RU.dat стостоит из двух частей:
1 часть:
Код:
public String str;
private int str_id;
2 часть:
Код:
public int id;
public short lvl;
public short sub_lvl;
public int pr_id;
public short pr_lvl;
public short pr_sblvl;
public int name_id;
public int info_id;
public int stats_id;
private int enchant_name_id;
private int enchant_name_param_id;
private int enchant_desc_id;
private int enchant_desc_param_id;
Как считать 3-х байтовый размер таблицы:
Код:
public int readCompactInt() throws IOException
{
int output = 0;
boolean signed = false;
for (int i = 0; i < 5; i++)
{
int x = in.read();
if (x < 0)
{
throw new EOFException();
}
if (i == 0)
{
if ((x & 0x80) > 0)
{
signed = true;
}
output |= (x & 0x3F);
if ((x & 0x40) == 0)
{
break;
}
}
else if (i == 4)
{
output |= (x & 0x1F) << (6 + (3 * 7));
}
else
{
output |= (x & 0x7F) << (6 + ((i - 1) * 7));
if ((x & 0x80) == 0)
{
break;
}
}
}
if (signed)
{
output *= -1;
}
return output;
}
П.С. Брал за основу тулзу от asmi (l2clientstuff) и переделывал специально для dat.
@Unsigned
private int npcId;
private int class_sid;
private int mesh_sid;
// ========================== //
@Length(lengthType = LengthType.BYTE)
private int tex1_sid[];
// ========================== //
@Length(lengthType = LengthType.BYTE)
private int tex2_sid[];
@Length(3)
private byte[] unknown;
// ========================== //
@Length(lengthType = LengthType.BYTE)
public short skills[];
// ========================== //
private float npc_speed;
// ========================== //
@Length(lengthType = LengthType.BYTE)
private int unk_1_sid[];
// ========================== //
@Length(lengthType = LengthType.BYTE)
private int snd1_sid[];
// ========================== //
@Length(lengthType = LengthType.BYTE)
private int snd2_sid[];
// ========================== //
@Length(lengthType = LengthType.BYTE)
private Struct1 snd3_sid[];
// ========================== //
@Length(lengthType = LengthType.BYTE)
private RBEffect rb_effect[];
@Length(2)
private byte unknown2[];
// ========================== //
//@Length(lengthType = LengthType.BYTE)
private byte quest;
// ========================== //
@Length(lengthType = LengthType.BYTE)
private int unk_2[];
// ========================== //
private byte sound_rad;
private byte sound_vol;
private byte sound_rnd;
private byte unknown_4;
private byte unknown_5;
@Length(lengthType = LengthType.BYTE)
private int unk_6_sid[];
@Length(20)
private byte unk22[];
public short ground_high; // ground_run
public short ground_low; // ground_walk
public float collision_radius;
public float collision_radius_2;
public float collision_height;
public float collision_height_2;
public int slot_rhand;
public int slot_lhand;
public int slot_chest; // Always 0
public double org_hp;
public double org_mp;
private short unknown1000;
Код:
public static class RBEffect
{
private short rb_effect;
private byte rb_effect_fl;
}
public static class Struct1
{
private int snd3_sid;
private float snd3_unk;
}
@Unsigned - readShort() & 0xffff
@Length - аннотация для массивов, если установлено значение, то просто считывает опр. количество данных того же типа, если же указан lengthType, то размер считывается из данных с указанным типом.
П.С. Файл не полностью разобран, некоторые поля не названы. Основное я получил из этого файла.