protected void Save()
{
//Wrap our function inside a catcher
try
{
//Open our packet reader
PacketReader Reader = new PacketReader(PacketInformation.buffer);
string player_path;
byte[] file;
//Switch on byte
switch (Reader.Byte())
{
case 1:
//Save quickbar information
player_path = Environment.CurrentDirectory + @"\player\info\quickbar\" + Character.Information.Name + ".dat";
file = System.IO.File.ReadAllBytes(player_path);
byte Slot = Reader.Byte();
byte sType = Reader.Byte();
Slot *= 5;
file[Slot] = sType;
file[Slot + 1] = Reader.Byte();
file[Slot + 2] = Reader.Byte();
file[Slot + 3] = Reader.Byte();
file[Slot + 4] = Reader.Byte();
System.IO.File.WriteAllBytes(player_path, file);
break;
case 2:
//Save autopotion information
player_path = Environment.CurrentDirectory + @"\player\info\autopot\" + Character.Information.Name + ".dat";
file = System.IO.File.ReadAllBytes(player_path);
file[0] = Reader.Byte();
file[1] = Reader.Byte();
file[2] = Reader.Byte();
file[3] = Reader.Byte();
file[4] = Reader.Byte();
file[5] = Reader.Byte();
file[6] = Reader.Byte();
System.IO.File.WriteAllBytes(player_path, file);
UpdateHp();
UpdateMp();
break;
}
Reader.Close();
}
catch (Exception ex)
{
Console.WriteLine("Save quickbar and autopotion error {0}", ex);
Systems.Debugger.Write(ex);
}
}