here is some of the code i used
void loadspells() {
FileStream fs = new FileStream(@"c:\program files\software\magic.dat",FileMode.Open);
BinaryReader br = new BinaryReader(fs);
String sName;
int iImageNum;
int iMana;
int iManaInc;
int iSkill;
int iSkillLvl;
for (int i=1;i<60;i++) {
br.ReadUInt32();
sName = GetNonTerminatedString(br.ReadChars(50)).Trim(); // name
sName += "<br>" + GetNonTerminatedString(br.ReadChars(50)).Trim(); // casting
br.ReadByte().ToString();
br.ReadInt16().ToString();
iImageNum = br.ReadInt16();//imagenum
br.ReadInt16().ToString();
br.ReadInt16().ToString();
iMana = br.ReadInt16(); //mana cast
iManaInc = br.ReadInt16(); //inc/dec per lvl
iSkill = br.ReadByte(); //skill
iSkillLvl = br.ReadByte(); //skill lvl needed
br.ReadByte().ToString();
br.ReadInt16().ToString();
br.ReadInt16().ToString();
br.ReadInt16().ToString();
br.ReadInt16().ToString();
textBox1.Text += "<tr>\r\n";
if (iImageNum != 0) {
textBox1.Text += "<td><img src='./images/8/" + iImageNum.ToString() + ".jpg'></td>\r\n";
} else {
textBox1.Text += "<td> </td>\r\n";
}
textBox1.Text += "<td>" + sName + "</td>\r\n";
if (iSkill == 0) {
textBox1.Text += "<td>Wizardry</td>\r\n";
} else
if (iSkill == 1) {
textBox1.Text += "<td>Thaumaturgy</td>\r\n";
} else
if (iSkill == 2) {
textBox1.Text += "<td>Necromancy</td>\r\n";
} else
if (iSkill == 3) {
textBox1.Text += "<td>Elemental Magics</td>\r\n";
} else {
textBox1.Text += "<td>Magery</td>\r\n";
}
textBox1.Text += "<td>" + iSkillLvl.ToString() + "</td>\r\n";
textBox1.Text += "<td>" + iMana.ToString() + "</td>\r\n";
textBox1.Text += "<td>" + iManaInc.ToString() + "</td>\r\n";
textBox1.Text += "</tr>\r\n";
}
br.Close();
fs.Close();
}
void loadskills() {
FileStream fs = new FileStream(@"c:\program files\software\skills.dat",FileMode.Open);
BinaryReader br = new BinaryReader(fs);
String sName;
String sName2;
String sName3;
int iImageNum;
for (int i=0;i<33;i++) {
sName = GetNonTerminatedString(br.ReadChars(20)).Trim(); // name
sName2 = GetNonTerminatedString(br.ReadChars(10)).Trim(); // additional file
br.ReadByte().ToString();
br.ReadByte().ToString();
sName3 = GetNonTerminatedString(br.ReadChars(25)).Trim(); // additional file
for (int z=0;z<68;z++) {
br.ReadByte().ToString();
}
textBox1.Text += "<tr>\r\n";
iImageNum = i+101;
if (iImageNum < 122) {
textBox1.Text += "<td><img src='./images/7/" + iImageNum.ToString() + ".jpg'></td>\r\n";
} else {
textBox1.Text += "<td> </td>\r\n";
}
if (sName2 == "") {
textBox1.Text += "<td>" + sName + "</td>\r\n";
} else {
textBox1.Text += "<td><a href='" + sName2 + ".htm'> "+ sName + "</a></td>\r\n";
}
textBox1.Text += "<td>" + sName3 + "</td>\r\n";
textBox1.Text += "</tr>\r\n";
}
br.Close();
fs.Close();
}
int getimagenum(int iPicture) {
FileStream fs = new FileStream(@"c:\program files\software\objects.dat",FileMode.Open);
BinaryReader br = new BinaryReader(fs);
int iImageNum = 0;
int iTemp = 0;
fs.Seek((499*iPicture)-446,SeekOrigin.Begin);
iImageNum = br.ReadByte();
fs.Seek((499*iPicture)-349,SeekOrigin.Begin);
iTemp = br.ReadByte();
iImageNum = (iTemp*256) + iImageNum;
br.Close();
fs.Close();
return iImageNum;
}
void loadobjects() {
FileStream fs = new FileStream(@"c:\program files\software\objects.dat",FileMode.Open);
FileStream fs2 = new FileStream(@"c:\test.txt",FileMode.Create);
StreamWriter sw = new StreamWriter(fs2);
BinaryReader br = new BinaryReader(fs);
String sTemp;
String sTemp2 = "";
int iImage = 0;
int iImage2 = 0;
int iTemp = 0;
int iRed = 0;
int iGreen = 0;
int iBlue = 0;
// for (int i=0;i<428;i++) {
for (int i=0;i<428;i++) {
fs.Seek((499*i),SeekOrigin.Begin);
sTemp2 = GetNonTerminatedString(br.ReadChars(25)).Trim(); //name
br.ReadChars(25);
br.ReadByte();br.ReadByte();
iImage = br.ReadByte();
iImage2 = br.ReadByte();
fs.Seek((499*i)+149,SeekOrigin.Begin);
iTemp = br.ReadByte();
iImage = (iTemp*256) + iImage;
iTemp = br.ReadByte();
iImage2 = (iTemp*256) + iImage2;
fs.Seek((499*i)+78,SeekOrigin.Begin);
iRed = br.ReadByte(); //(if over 100) -100 * 8
iGreen = br.ReadByte();
iBlue = br.ReadByte();
sTemp = "<tr><td>";
sTemp += sTemp2;
sTemp += "</td><td>";
if (iImage == 0) {
sTemp += " ";
} else {
if (iRed > 99) {
string sDir = @"c:\Program Files\software\ArtDir\5\" + iImage.ToString() + ".pc1";
FileStream fs3 = new FileStream(sDir,FileMode.Open);
pictureBox1.Image = ConvGamma(LoadPC1(fs3),iRed-99,iGreen-99,iBlue-99);
sDir = @"c:\inetpub\wwwroot\faldon\images\5\image" + iImage.ToString() + iRed.ToString() + iGreen.ToString() +iBlue.ToString() +".jpg";
pictureBox1.Image.Save(sDir,System.Drawing.Imaging.ImageFormat.Jpeg);
fs3.Close();
sTemp += "<img src='./images/5/image" + iImage.ToString() + iRed.ToString() + iGreen.ToString() +iBlue.ToString() + ".jpg'>";
} else {
sTemp += "<img src='./images/5/" + iImage.ToString() + ".jpg'>";
}
}
sTemp += "</td><td>";
if (iImage2 == 0) {
sTemp += " ";
} else {
if (iRed > 99) {
string sDir = @"c:\Program Files\software\ArtDir\5\" + iImage2.ToString() + ".pc1";
FileStream fs3 = new FileStream(sDir,FileMode.Open);
pictureBox1.Image = ConvGamma(LoadPC1(fs3),iRed-99,iGreen-99,iBlue-99);
sDir = @"c:\inetpub\wwwroot\faldon\images\5\image" + iImage2.ToString() + iRed.ToString() + iGreen.ToString() +iBlue.ToString() +".jpg";
pictureBox1.Image.Save(sDir,System.Drawing.Imaging.ImageFormat.Jpeg);
fs3.Close();
sTemp += "<img src='./images/5/image" + iImage2.ToString() + iRed.ToString() + iGreen.ToString() +iBlue.ToString() + ".jpg'>";
} else {
sTemp += "<img src='./images/5/" + iImage2.ToString() + ".jpg'>";
}
}
sTemp += "</td></tr>";
sw.WriteLine(sTemp);
}
textBox1.Text = "done.\r\n";
sw.Close();
fs2.Close();
br.Close();
fs.Close();
}
void showskill(string skillnum, string skillval) {
if (skillnum == "10") {
textBox1.Text += "<td>Alchemy</td>\r\n";
textBox1.Text += "<td>" + skillval + "</td>\r\n";
} else
if (skillnum == "11") {
textBox1.Text += "<td>Cooking</td>\r\n";
textBox1.Text += "<td>" + skillval + "</td>\r\n";
} else
if (skillnum == "24") {
textBox1.Text += "<td>Blacksmithing</td>\r\n";
textBox1.Text += "<td>" + skillval + "</td>\r\n";
} else
if (skillnum == "25") {
textBox1.Text += "<td>Enchanting</td>\r\n";
textBox1.Text += "<td>" + skillval + "</td>\r\n";
} else
if (skillnum == "26") {
textBox1.Text += "<td>Carpentry</td>\r\n";
textBox1.Text += "<td>" + skillval + "</td>\r\n";
} else
if (skillnum == "30") {
textBox1.Text += "<td>Goldsmithing</td>\r\n";
textBox1.Text += "<td>" + skillval + "</td>\r\n";
} else
if (skillnum == "31") {
textBox1.Text += "<td>Scribery</td>\r\n";
textBox1.Text += "<td>" + skillval + "</td>\r\n";
} else
if (skillnum == "0") {
textBox1.Text += "<td> </td>\r\n";
textBox1.Text += "<td> </td>\r\n";
} else {
textBox1.Text += "<td>" + skillnum + "</td>\r\n";
textBox1.Text += "<td>" + skillval + "</td>\r\n";
}
}
void loadskills2() {
FileStream fs = new FileStream(@"c:\program files\software\smithing.ext",FileMode.Open);
StreamReader sr = new StreamReader(fs);
String sName = "";
String sSkill0 = "";
String sSkill0Val = "";
String sSkill1 = "";
String sSkill1Val = "";
String sSkill2 = "";
String sSkill2Val = "";
String sTemp = "";
String sTemp2 = "";
int iTemp;
int iTemp2=0;
sTemp = sr.ReadLine();
sTemp = sr.ReadLine();
sTemp = sr.ReadLine();
sTemp = sr.ReadLine();
sTemp = sr.ReadLine();
sTemp = sr.ReadLine();
sTemp = sr.ReadLine();
sTemp = sr.ReadLine();
sTemp2 = sTemp.Substring(sTemp.LastIndexOf("=")+1);
iTemp = Convert.ToInt16(sTemp2);
for (int i=0;i<iTemp;i++) {
//[info]
sTemp = sr.ReadLine();
for (int j=0;j<10;j++) {
sTemp = sr.ReadLine();
sTemp2 = sTemp.Substring(0,sTemp.LastIndexOf("="));
if (sTemp2 == "name") {
sName = sTemp.Substring(sTemp.LastIndexOf("=")+1);
} else
if (sTemp2 == "skill0") {
sSkill0 = sTemp.Substring(sTemp.LastIndexOf("=")+1);
} else
if (sTemp2 == "skill0val") {
sSkill0Val = sTemp.Substring(sTemp.LastIndexOf("=")+1);
} else
if (sTemp2 == "skill1") {
sSkill1 = sTemp.Substring(sTemp.LastIndexOf("=")+1);
} else
if (sTemp2 == "skill1val") {
sSkill1Val = sTemp.Substring(sTemp.LastIndexOf("=")+1);
} else
if (sTemp2 == "skill2") {
sSkill2 = sTemp.Substring(sTemp.LastIndexOf("=")+1);
} else
if (sTemp2 == "skill2val") {
sSkill2Val = sTemp.Substring(sTemp.LastIndexOf("=")+1);
} else
if (sTemp2 == "picture") {
iTemp2 = Convert.ToInt16(sTemp.Substring(sTemp.LastIndexOf("=")+1));
iTemp2 = getimagenum(iTemp2);
}
}
textBox1.Text += "<tr>\r\n";
// textBox1.Text += "<td> </td>\r\n";
textBox1.Text += "<td><img src='./images/5/" + iTemp2.ToString() + ".jpg'></td>\r\n";
textBox1.Text += "<td>" + sName + "</td>\r\n";
showskill(sSkill0,sSkill0Val);
showskill(sSkill1,sSkill1Val);
showskill(sSkill2,sSkill2Val);
textBox1.Text += "</tr>\r\n";
}
sr.Close();
fs.Close();
}