you can try this hack. it works but its not nice.
i encoutered the same error. first i thought it would be solved if the cache_xxx.mpq are included but that didn't solve the problem.
as second step i updated stormlib to most recent git revision but that also didn't solvre the problem. as third step I had a look at the mpqs to find the most recent one with the needed dbc which i manually loaded for extraction.Â
remember this is just a hack and not well coded. there need to be a real generic fix for that issue.
void ExtractGameobjectModels()
{
printf("Extracting GameObject models...");
/* DBCFile dbc(LocaleMpq, "DBFilesClientGameObjectDisplayInfo.dbc");
if(!dbc.open())
{
printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format LOCALE!n");
//DBCFile dbc(WorldMpq, "DBFilesClientGameObjectDisplayInfo.dbc");
if (!dbc.open())
{
printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format WORLD!n");
// DIRTY DIRTY HACK !! */
HANDLE localeFile;
char localMPQ[512];
char input_path[1024] = ".";
sprintf(localMPQ, "%s/Data/Cache/patch-base-18273.MPQ", input_path);
if (FileExists(localMPQ) == false)
{ // Use misc.mpq
printf(localMPQ, "%s/Data/%s/locale-%s.MPQ", input_path);
}
if (!SFileOpenArchive(localMPQ, 0, MPQ_OPEN_READ_ONLY, &localeFile))
{
exit(1);
}
printf("Read GameObjectDisplayInfo.dbc file...n");
HANDLE dbcFile;
printf("Handle dbcFile Loadedn");
if (!SFileOpenFileEx(localeFile, "DBFilesClientGameObjectDisplayInfo.dbc", SFILE_OPEN_FROM_MPQ, &dbcFile))
{
printf("First IF loaded File not openedn");
if (!SFileOpenFileEx(localeFile, "DBFilesClientGameObjectDisplayInfo.dbc", SFILE_OPEN_FROM_MPQ, &dbcFile))
{
printf("Fatal error: Cannot find GameObjectDisplayInfo.dbc in archive!n");
exit(1);
}
}
printf("dbc found and loadedn");
DBCFile dbc(localeFile, "DBFilesClientGameObjectDisplayInfo.dbc");
//DBCFile * dbc = new DBCFile(localeFile, "DBFilesClientGameObjectDisplayInfo.dbc");
//DBCFile dbc(dbcFile);
printf("dbc localefile setn");
if (!dbc.open())
{
printf("Fatal error: Invalid Map.dbc file format!n");
exit(1);
}
//delete dbc;
//printf("FATAL ERROR: Map.dbc not found in WORLD data file.n");
//return 1; */
printf("dbc openedn");
// }
// }
std::string basepath = szWorkDirWmo;
printf("szWorkDirWmo loadedn");
basepath += "/";
std::string path;
printf("basepath %s setn", basepath.c_str());
FILE * model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb");
dbc.open();
if (dbc.getRecordCount() > 0)
for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it)
{
path = it->getString(1);
if (path.length() < 4)
continue;
FixNameCase((char*)path.c_str(), path.size());
char * name = GetPlainName((char*)path.c_str());
FixNameSpaces(name, strlen(name));
char * ch_ext = GetExtension(name);
if (!ch_ext)
continue;
strToLower(ch_ext);
bool result = false;
if (!strcmp(ch_ext, ".wmo"))
result = ExtractSingleWmo(path);
else if (!strcmp(ch_ext, ".mdl")) // TODO: extract .mdl files, if needed
continue;
else //if (!strcmp(ch_ext, ".mdx") || !strcmp(ch_ext, ".m2"))
result = ExtractSingleModel(path);
if (result)
{
uint32 displayId = it->getUInt(0);
uint32 path_length = strlen(name);
fwrite(&displayId, sizeof(uint32), 1, model_list);
fwrite(&path_length, sizeof(uint32), 1, model_list);
fwrite(name, sizeof(char), path_length, model_list);
}
}
fclose(model_list);
printf("Done!n");
}