rendered paste body#include <iostream>
using namespace std;
#include "mangoslog.h"
#include "ByteBuffer.h"
#include "ItemPrototype.h"
int main() {
mangosLog log;
log.OpenLog("game20060930002.proc.log");
Packet *p;
uint32 id = 0;
while ((p = log.GetNextPacket()) != NULL) {
id++;
if (id > 19786) {
id = id;
}
if (p->GetOpCode() == SMSG_CREATURE_QUERY_RESPONSE) {
ByteBuffer b;
b.append(p->GetData(), p->GetReportedSize());
uint16 opcode;
b >> opcode;
uint32 entry;
b >> entry;
string s;
b >> s;
cout << entry << " - " << s.c_str();
uint8 unk;
b >> unk;
b >> unk;
b >> unk;
b >> s;
cout << " - " << s.c_str() << endl;
}
if (p->GetOpCode() == SMSG_ITEM_QUERY_SINGLE_RESPONSE) {
ByteBuffer b;
ItemPrototype proto;
b.append(p->GetData(), p->GetReportedSize());
uint16 opcode;
string tmp;
b >> opcode;
b >> proto.ItemId;
b >> proto.Class;
b >> proto.SubClass;
b >> proto.Name1;
b >> proto.Name2;
b >> proto.Name3;
b >> proto.Name4;
b >> proto.DisplayInfoID;
b >> proto.Quality;
b >> proto.Flags;
b >> proto.BuyPrice;
b >> proto.SellPrice;
cout << "INSERT INTO ITEM_TEMPLATE (Entry, Class, SubClass, Name, BuyPrice, SellPrice) VALUES (" << proto.ItemId << ", "
<< proto.Class << ", "
<< proto.SubClass << ", "
<< "'" << proto.Name1.c_str() << "', "
<< proto.BuyPrice << ", "
<< proto.SellPrice << ");" << endl;
}
delete p;
}
system("pause");
return 0;
}