Hello guys.
I want to code following to for the MMORPG Nostale (or rather the String files of it).
There is a monster.txt (where the monster strings are)
and there is a monster.dat (where the stats from the monsters are, including string name and VNUM (!))
There are examples for the files I told you.
monster.txt
Quote:
zts1e Kleiner Fuchs
zts2e Fuchs
zts3e Großer Fuchs
zts4e Müder Dusifuchs
zts5e Dusifuchs
zts6e Nervöser Dusifuchs
(and so on, it continues with about 5000 lines)
|
monster.dat
Quote:
#================================================= =======
VNUM 0
NAME zts1e
LEVEL 16
RACE 0 1
ATTRIB 0 0 13 0 1 0
HP/MP 0 0
EXP 0 0
PREATT 0 0 8 8 400
SETTING 0 0 -1 0 0 0
ETC 8 1 0 0 0 0 0
PETINFO 1 10 0 50
EFF 200 0 0
ZSKILL 0 1 3 2 12 0 0
WINFO 0 0 0
WEAPON 16 1 0 0 0 11 -20
AINFO 0 0
ARMOR 16 0 -25 0 0
SKILL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PARTNER 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BASIC 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
CARD 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
MODE 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ITEM 2000 9000 1 16 800 1 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0
#================================================= =======
#================================================= =======
VNUM 1
NAME zts2e
LEVEL 22
RACE 0 1
ATTRIB 0 0 11 0 0 2
HP/MP 0 0
EXP 0 0
PREATT 0 0 8 8 600
SETTING 0 0 -1 0 0 0
ETC 8 1 0 0 0 0 0
PETINFO 5 5 1 60
EFF 200 0 0
ZSKILL 0 1 3 2 12 0 0
WINFO 0 0 1
WEAPON 22 1 0 0 0 11 -20
AINFO 0 1
ARMOR 22 0 -25 0 0
SKILL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PARTNER 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BASIC 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
CARD 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
MODE 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ITEM 2000 9000 1 69 600 1 79 600 1 87 600 1 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0
#================================================= =======
#================================================= =======
VNUM 2
NAME zts3e
LEVEL 25
RACE 0 1
ATTRIB 0 0 10 0 0 2
HP/MP 0 0
EXP 0 0
PREATT 0 0 8 8 600
SETTING 0 0 -1 0 0 0
ETC 8 1 0 0 0 0 0
PETINFO 10 2 0 70
EFF 200 0 0
ZSKILL 0 1 3 2 12 0 0
WINFO 0 0 1
WEAPON 25 1 0 0 0 11 -20
AINFO 0 1
ARMOR 25 0 -25 0 0
SKILL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PARTNER 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BASIC 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
CARD 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
MODE 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ITEM 2000 10000 1 505 700 1 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0
#================================================= =======
(and so on, it continues with more than 5000 lines
|
My plan is to check line by line if the first string of monster.txt is contained in the monster.dat each 25 lines. And if so, I want to return the value to the console output
So my problem is that I already know how to
read the first 25 lines to one string (using StringBuilder) and get the value after "VNUM" (this is what I want get returned). But I don't know how to to that with the rest of the files.
My code
Code:
string path = @"D:\Daniel\Desktop\.NOS unpacked\STRINGS\NSgtdData\";
string filename = "monster.dat";
StringBuilder sb = new StringBuilder();
using (StreamReader sr = new StreamReader(path + filename))
{
String line;
int i = 0;
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
if (i < 25)
{
sb.AppendLine(line);
string a = Console.ReadLine();
if (sb.ToString().Contains(a))
{
string[] words = sb.ToString().Split(' ');
foreach (string word in words)
{
if(word.Contains(a))
{
int index = word.IndexOf("M\t") +2;
string piece = word.Substring(index);
string[] array = piece.Split('\t');
Console.WriteLine(array[0]);
}
// Console.WriteLine(word);
}
// Console.WriteLine(sb.ToString());
Console.WriteLine("DONE!");
}
i++;
}
}
}
I hope you understand and you can help me a bit.
PS: I also speak German! :P