02-12-2012, 10:26 PM
[highlight=csharp]
public static List LoadFromFile(string FileName, int Version)
{
List skills = new List();
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
using (BinaryReader b = new BinaryReader(File.Open(FileName, FileMode.Open)))
{
int lastid = b.ReadInt32();
while (b.BaseStream.Position
{
cSkill temp = new cSkill();
if (Version == 2012)
{
temp.SkillID = SkillID;
temp.Class = b.ReadInt32();
temp.Job = b.ReadInt32();
temp.Pet = b.ReadInt32();
temp.Name = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.Type = b.ReadByte();
temp.Flag = b.ReadInt32();
temp.SorcFlag = b.ReadInt32();
temp.Levels = b.ReadByte();
temp.AppRange = b.ReadSingle();
temp.FireRange = b.ReadSingle();
temp.FireRange2 = b.ReadSingle();
temp.TargetType = b.ReadByte();
temp.TargetNum = b.ReadByte();
temp.UseState = b.ReadInt32();
temp.WeaponType = b.ReadInt32();
temp.WeaponType2 = b.ReadInt32();
temp.MagicIndex1 = b.ReadInt32();
temp.MagicLevel1 = b.ReadByte();
temp.MagicIndex2 = b.ReadInt32();
temp.MagicLevel2 = b.ReadByte();
temp.MagicIndex3 = b.ReadInt32();
temp.MagicLevel3 = b.ReadByte();
temp.Unknown1 = b.ReadInt32();
temp.UseKind = b.ReadInt32();
temp.ReadyTime = b.ReadInt32();
temp.StillTime = b.ReadInt32();
temp.FireTime = b.ReadInt32();
temp.CoolTime = b.ReadInt32();
temp.a_ready_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_ready_effect = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_still_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_effect1 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_effect2 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_effect3 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_object_type = b.ReadByte();
temp.a_fire_object_speed = b.ReadSingle();
temp.a_fire_object_x = b.ReadSingle();
temp.a_fire_object_z = b.ReadSingle();
temp.a_fire_object_h = b.ReadSingle();
temp.a_fire_object_coord = b.ReadByte();
temp.a_fire_object_delay_count = b.ReadByte();
temp.a_fire_object_delay0 = b.ReadSingle();
temp.a_fire_object_delay1 = b.ReadSingle();
temp.a_fire_object_delay2 = b.ReadSingle();
temp.a_fire_object_delay3 = b.ReadSingle();
temp.a_fire_dest_animation = b.ReadSingle();
temp.b_ready_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_ready_effect = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_still_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_effect1 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_effect2 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_effect3 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_object_type = b.ReadByte();
temp.b_fire_object_speed = b.ReadSingle();
temp.b_fire_object_x = b.ReadSingle();
temp.b_fire_object_z = b.ReadSingle();
temp.b_fire_object_h = b.ReadSingle();
temp.b_fire_object_coord = b.ReadByte();
temp.b_fire_object_delay_count = b.ReadByte();
temp.b_fire_object_delay0 = b.ReadSingle();
temp.b_fire_object_delay1 = b.ReadSingle();
temp.b_fire_object_delay2 = b.ReadSingle();
temp.b_fire_object_delay3 = b.ReadSingle();
temp.b_fire_dest_animation = b.ReadSingle();
temp.ExtraEffect = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.descr = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.tooltip = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.tex_id = b.ReadInt32();
temp.tex_row = b.ReadInt32();
temp.tex_col = b.ReadInt32();
temp.LevelData = new cSkillLevel[temp.Levels];
for (byte lvl = 1; lvl
{
cSkillLevel temp2 = temp.LevelData[lvl];
temp2.SkillID = SkillID;
temp2.Level = lvl;
temp2.Need_HP = b.ReadInt32();
temp2.Need_MP = b.ReadInt32();
temp2.Need_GP = b.ReadInt32();
temp2.DureTime = b.ReadInt32();
temp2.Power = b.ReadInt32();
temp2.Use_Item1_Id = b.ReadInt32();
temp2.Use_Item1_Amount = b.ReadInt32();
temp2.Use_Item2_Id = b.ReadInt32();
temp2.Use_Item2_Amount = b.ReadInt32();
temp2.Need_Level = b.ReadInt32();
temp2.Need_SP = b.ReadInt32();
temp2.Need_Skill1_Id = b.ReadInt32();
temp2.Need_Skill1_Level = b.ReadByte();
temp2.Need_Skill2_Id = b.ReadInt32();
temp2.Need_Skill2_Level = b.ReadByte();
temp2.Need_Skill3_Id = b.ReadInt32();
temp2.Need_Skill3_Level = b.ReadByte();
temp2.Need_Item1_Id = b.ReadInt32();
temp2.Need_Item1_Amount = b.ReadInt32();
temp2.Need_Item2_Id = b.ReadInt32();
temp2.Need_Item2_Amount = b.ReadInt32();
temp2.Need_Item3_Id = b.ReadInt32();
temp2.Need_Item3_Amount = b.ReadInt32();
temp2.Need_Strength = b.ReadInt32();
temp2.Need_Dexterity = b.ReadInt32();
temp2.Need_Intelligence = b.ReadInt32();
temp2.Need_Constitution = b.ReadInt32();
temp2.App_Magic1_Id = b.ReadInt32();
temp2.App_Magic1_Level = b.ReadByte();
temp2.App_Magic2_Id = b.ReadInt32();
temp2.App_Magic2_Level = b.ReadByte();
temp2.App_Magic3_Id = b.ReadInt32();
temp2.App_Magic3_Level = b.ReadByte();
temp2.Magic1_Id = b.ReadInt32();
temp2.Magic1_Level = b.ReadByte();
temp2.Magic2_Id = b.ReadInt32();
temp2.Magic2_Level = b.ReadByte();
temp2.Magic3_Id = b.ReadInt32();
temp2.Magic3_Level = b.ReadByte();
temp2.Learn_GP = b.ReadInt32();
}
}
if (Version == 2008)
{
int SkillID = b.ReadInt32();
temp.SkillID = SkillID;
temp.Class = b.ReadInt32();
temp.Job = b.ReadInt32();
temp.Pet = b.ReadInt32();
temp.Name = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.Type = b.ReadByte();
temp.Flag = b.ReadInt32();
temp.SorcFlag = b.ReadInt32();
temp.Levels = b.ReadByte();
temp.AppRange = b.ReadSingle();
temp.FireRange = b.ReadSingle();
temp.FireRange2 = b.ReadSingle();
temp.TargetType = b.ReadByte();
temp.TargetNum = b.ReadByte();
temp.UseState = b.ReadInt32();
temp.WeaponType = b.ReadInt32();
temp.WeaponType2 = b.ReadInt32();
temp.MagicIndex1 = b.ReadInt32();
temp.MagicLevel1 = b.ReadByte();
temp.MagicIndex2 = b.ReadInt32();
temp.MagicLevel2 = b.ReadByte();
temp.MagicIndex3 = b.ReadInt32();
temp.MagicLevel3 = b.ReadByte();
temp.Unknown1 = 0;
temp.UseKind = b.ReadInt32();
temp.ReadyTime = b.ReadInt32();
temp.StillTime = b.ReadInt32();
temp.FireTime = b.ReadInt32();
temp.CoolTime = b.ReadInt32();
temp.a_ready_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_ready_effect = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_still_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_effect1 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_effect2 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_effect3 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.a_fire_object_type = b.ReadByte();
temp.a_fire_object_speed = b.ReadSingle();
temp.a_fire_object_x = b.ReadSingle();
temp.a_fire_object_z = b.ReadSingle();
temp.a_fire_object_h = b.ReadSingle();
temp.a_fire_object_coord = b.ReadByte();
temp.a_fire_object_delay_count = b.ReadByte();
temp.a_fire_object_delay0 = b.ReadSingle();
temp.a_fire_object_delay1 = b.ReadSingle();
temp.a_fire_object_delay2 = b.ReadSingle();
temp.a_fire_object_delay3 = b.ReadSingle();
temp.a_fire_dest_animation = b.ReadSingle();
temp.b_ready_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_ready_effect = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_still_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_animation = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_effect1 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_effect2 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_effect3 = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.b_fire_object_type = b.ReadByte();
temp.b_fire_object_speed = b.ReadSingle();
temp.b_fire_object_x = b.ReadSingle();
temp.b_fire_object_z = b.ReadSingle();
temp.b_fire_object_h = b.ReadSingle();
temp.b_fire_object_coord = b.ReadByte();
temp.b_fire_object_delay_count = b.ReadByte();
temp.b_fire_object_delay0 = b.ReadSingle();
temp.b_fire_object_delay1 = b.ReadSingle();
temp.b_fire_object_delay2 = b.ReadSingle();
temp.b_fire_object_delay3 = b.ReadSingle();
temp.b_fire_dest_animation = b.ReadSingle();
temp.ExtraEffect = "";
temp.descr = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.tooltip = enc.GetString(b.ReadBytes(b.ReadInt32()));
temp.tex_id = b.ReadInt32();
temp.tex_row = b.ReadInt32();
temp.tex_col = b.ReadInt32();
temp.LevelData = new cSkillLevel[temp.Levels];
for (byte lvl = 1; lvl
{
cSkillLevel temp2 = temp.LevelData[lvl];
temp2.SkillID = SkillID;
temp2.Level = lvl;
temp2.Need_HP = b.ReadInt32();
temp2.Need_MP = b.ReadInt32();
temp2.Need_GP = 0;
temp2.DureTime = b.ReadInt32();
temp2.Power = b.ReadInt32();
temp2.Use_Item1_Id = b.ReadInt32();
temp2.Use_Item1_Amount = b.ReadInt32();
temp2.Use_Item2_Id = b.ReadInt32();
temp2.Use_Item2_Amount = b.ReadInt32();
temp2.Need_Level = b.ReadInt32();
temp2.Need_SP = b.ReadInt32();
temp2.Need_Skill1_Id = b.ReadInt32();
temp2.Need_Skill1_Level = b.ReadByte();
temp2.Need_Skill2_Id = b.ReadInt32();
temp2.Need_Skill2_Level = b.ReadByte();
temp2.Need_Skill3_Id = b.ReadInt32();
temp2.Need_Skill3_Level = b.ReadByte();
temp2.Need_Item1_Id = b.ReadInt32();
temp2.Need_Item1_Amount = b.ReadInt32();
temp2.Need_Item2_Id = b.ReadInt32();
temp2.Need_Item2_Amount = b.ReadInt32();
temp2.Need_Item3_Id = b.ReadInt32();
temp2.Need_Item3_Amount = b.ReadInt32();
temp2.Need_Strength = b.ReadInt32();
temp2.Need_Dexterity = b.ReadInt32();
temp2.Need_Intelligence = b.ReadInt32();
temp2.Need_Constitution = b.ReadInt32();
temp2.App_Magic1_Id = b.ReadInt32();
temp2.App_Magic1_Level = b.ReadByte();
temp2.App_Magic2_Id = b.ReadInt32();
temp2.App_Magic2_Level = b.ReadByte();
temp2.App_Magic3_Id = b.ReadInt32();
temp2.App_Magic3_Level = b.ReadByte();
temp2.Magic1_Id = b.ReadInt32();
temp2.Magic1_Level = b.ReadByte();
temp2.Magic2_Id = b.ReadInt32();
temp2.Magic2_Level = b.ReadByte();
temp2.Magic3_Id = b.ReadInt32();
temp2.Magic3_Level = b.ReadByte();
temp2.Learn_GP = b.ReadInt32();
}
}
skills.Add(temp);
}
b.Close();
}
return skills;
}
[/highlight]
Enjoy



and Im sure I will lol