public ItemTemplate ParseItem(Extractor.RecordType recordType, int recnum, byte[] data, List<string> itemNamesSqlList)
{
int rectype = (int)recordType;
this.br = new BufferedReader(rectype, recnum, data);
ItemTemplate aoi = new ItemTemplate();
aoi.ID = recnum;
this.br.Skip(16);
int num = this.br.Read3F1();
int argc0 = 0;
int num2 = num - 1;
int num3 = argc0;
while (true)
{
int arg1c2 = num3;
int num4 = num2;
if (arg1c2 > num4)
{
break;
}
int attrkey = this.br.ReadInt32();
int attrval = this.br.ReadInt32();
if (attrkey == 54)
{
aoi.Quality = attrval;
}
else
{
aoi.Stats.Add(attrkey, attrval);
}
num3++;
}
this.br.Skip(8);
short num5 = this.br.ReadInt16();
short num6 = this.br.ReadInt16();
string itemname = string.Empty;
if (num5 > 0)
{
itemname = this.br.ReadString(num5);
}
if (itemNamesSqlList != null)
{
itemNamesSqlList.Add(string.Format("( {0} , '{1}' , '{2}', '{3}' ) ",
recnum,
itemname.Replace("'", "''"),
Enum.GetName(typeof(Extractor.RecordType), recordType),
aoi.getItemAttribute(79)));
}
if (num6 > 0)
{
this.br.ReadString(num6); // Read and discard Description
}
bool flag4 = true;
checked
{
while (this.br.Ptr < this.br.Buffer.Length - 8 && flag4)
{
switch (this.br.ReadInt32()) // what are these ints ?
{
case 2:
this.ParseFunctionSet(aoi.Events);
break;
case 3:
case 5:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 15:
case 16:
case 17:
case 18:
case 19:
case 21:
goto IL_4BF;
case 4:
this.ParseAtkDefSet(aoi.Attack, aoi.Defend);
break;
case 6:
{
this.br.Skip(4);
int count = this.br.Read3F1() * 8;
this.br.Skip(count);
break;
}
case 14:
this.ParseAnimSoundSet(1, aoi);
break;
case 20:
this.ParseAnimSoundSet(2, aoi);
break;
case 22:
this.ParseActionSet(aoi.Actions);
break;
case 23:
this.ParseShopHash(aoi.Events);
break;
default:
goto IL_4BF;
}
continue;
IL_4BF:
flag4 = false;
}
}
return aoi;
}