void main() { dbc.open("Spell.dbc"); if(!dbc.getFieldCount()) { printf("error, could not open dbc file\n"); exit(1); } else printf("Opened DBC with %u fields and %u rows\n",(int)dbc.getFieldCount(),(int)dbc.getRecordCount()); dump_as_sql(); // getch(); }
SkillNameMgr::SkillNameMgr() { DBCFile SkillDBC; if(!SkillDBC.open(format("%s/SkillLine.dbc", sWorld.DBCPath.c_str()).c_str())) { Log.Error( "SkillNameMgr", "Cannot find file %s/SkillLine.dbc", sWorld.DBCPath.c_str()); return; } //This will become the size of the skill name lookup table maxskill = SkillDBC.getRecord(SkillDBC.getRecordCount()-1).getUInt(0); //SkillNames = (char **) malloc(maxskill * sizeof(char *)); SkillNames = new char * [maxskill+1]; //(+1, arrays count from 0.. not 1.) memset(SkillNames,0,(maxskill+1) * sizeof(char *)); for(uint32 i = 0; i < SkillDBC.getRecordCount(); i++) { unsigned int SkillID = SkillDBC.getRecord(i).getUInt(0); const char *SkillName = SkillDBC.getRecord(i).getString(3); SkillNames[SkillID] = new char [strlen(SkillName)+1]; //When the DBCFile gets cleaned up, so does the record data, so make a copy of it.. memcpy(SkillNames[SkillID],SkillName,strlen(SkillName)+1); } }
LfgMgr::LfgMgr() { DBCFile f; if(f.open("DBC/LFGDungeons.dbc")) { for(uint32 i = 0; i < f.getRecordCount(); ++i) { DBCFile::Record r = f.getRecord(i); uint32 id = r.getUInt(0); uint32 typ = r.getUInt(20); if(id >= MAX_DUNGEONS) printf("!! WARNING !! LFGDungeons contains an out of range dungeon id %u.\n", id); else LfgDungeonTypes[id] = typ; } } else printf("!! WARNING !! LFGDungeons.dbc not found, LFG tool will not function correctly.\n"); }
// copied from contrib/extractor/System.cpp void ReadLiquidTypeTableDBC() { switch(expansion) { case 0: { printf("Setting liquid types..."); LiqType = new uint16[21]; memset(LiqType, 0xff, (21)*sizeof(uint16)); LiqType[1] = 0; LiqType[2] = 1; LiqType[3] = 2; LiqType[4] = 3; LiqType[21] = 3; printf("Done! (5 LiqTypes set)\n"); }break; case 1: { printf("Setting liquid types..."); LiqType = new uint16[62]; memset(LiqType, 0xff, (62)*sizeof(uint16)); LiqType[1] = 0; LiqType[2] = 1; LiqType[3] = 2; LiqType[4] = 3; LiqType[21] = 3; LiqType[41] = 0; LiqType[61] = 0; printf("Done! (7 LiqTypes set)\n"); }break; default: { printf("Read LiquidType.dbc file..."); DBCFile* dbc = new DBCFile("DBFilesClient\\LiquidType.dbc"); dbc->open(); size_t LiqType_count = dbc->getRecordCount(); size_t LiqType_maxid = dbc->getRecord(LiqType_count - 1).getUInt(0); LiqType = new uint16[LiqType_maxid + 1]; memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); for(uint32 x = 0; x < LiqType_count; ++x) LiqType[dbc->getRecord(x).getUInt(0)] = dbc->getRecord(x).getUInt(3); printf("Done! (%u LiqTypes loaded)\n", LiqType_count); }break; } }
int main(int argc, char ** argv) { bool success=true; const char *versionString = "V4.00 2012_02"; // Use command line arguments, when some if (!processArgv(argc, argv, versionString)) return 1; // some simple check if working dir is dirty else { std::string sdir = std::string(szWorkDirWmo) + "/dir"; std::string sdir_bin = std::string(szWorkDirWmo) + "/dir_bin"; struct stat status; if (!stat(sdir.c_str(), &status) || !stat(sdir_bin.c_str(), &status)) { printf("Your output directory seems to be polluted, please use an empty directory!\n"); printf("<press return to exit>"); char garbage[2]; return scanf("%c", garbage); } } printf("Extract %s. Beginning work ....\n\n",versionString); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if (mkdir(szWorkDirWmo #if defined(__linux__) || defined(__APPLE__) , 0711 #endif )) success = (errno == EEXIST); LoadCommonMPQFiles(CONF_TargetBuild); for (int i = 0; i < LOCALES_COUNT; ++i) { //Open MPQs if (!LoadLocaleMPQFile(i)) { if (GetLastError() != ERROR_PATH_NOT_FOUND) printf("Unable to load %s locale archives!\n", Locales[i]); continue; } printf("Detected and using locale: %s\n", Locales[i]); break; } ReadLiquidTypeTableDBC(); // extract data if (success) success = ExtractWmo(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if (success) { DBCFile * dbc = new DBCFile(LocaleMpq, "DBFilesClient\\Map.dbc"); if (!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); return 1; } map_count=dbc->getRecordCount (); map_ids=new map_id[map_count]; for (unsigned int x=0;x<map_count;++x) { map_ids[x].id=dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); printf("Map - %s\n",map_ids[x].name); } delete dbc; ParsMapFiles(); delete [] map_ids; //nError = ERROR_SUCCESS; // Extract models, listed in GameObjectDisplayInfo.dbc ExtractGameobjectModels(); } SFileCloseArchive(LocaleMpq); SFileCloseArchive(WorldMpq); printf("\n"); if (!success) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); getchar(); } printf("Extract %s. Work complete. No errors.\n",versionString); delete [] LiqType; return 0; }
int main(int argc, char ** argv) { bool success=true; const char *versionString = "V3.00 2010_07"; // Use command line arguments, when some if (!processArgv(argc, argv, versionString)) return 1; // some simple check if working dir is dirty else { std::string sdir = std::string(szWorkDirWmo) + "/dir"; std::string sdir_bin = std::string(szWorkDirWmo) + "/dir_bin"; struct stat status; if (!stat(sdir.c_str(), &status) || !stat(sdir_bin.c_str(), &status)) { printf("Your output directory seems to be polluted, please use an empty directory!\n"); printf("<press return to exit>"); char garbage[2]; return scanf("%c", garbage); } } printf("Extract %s. Beginning work ....\n",versionString); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if (mkdir(szWorkDirWmo #ifdef __linux__ , 0711 #endif )) success = (errno == EEXIST); // prepare archive name list std::vector<std::string> archiveNames; fillArchiveNameVector(archiveNames); for (size_t i = 0; i < archiveNames.size(); ++i) { MPQArchive *archive = new MPQArchive(archiveNames[i].c_str()); if (!gOpenArchives.size() || gOpenArchives.front() != archive) delete archive; } if (gOpenArchives.empty()) { printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path); return 1; } // extract data if (success) success = ExtractWmo(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if (success) { DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); if (!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); return 1; } map_count=dbc->getRecordCount (); map_ids=new map_id[map_count]; for (unsigned int x = 0; x < map_count; ++x) { map_ids[x].id=dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); printf("Map - %s\n",map_ids[x].name); } delete dbc; ParsMapFiles(); delete[] map_ids; //nError = ERROR_SUCCESS; } printf("\n"); if (!success) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); getchar(); } printf("Extract %s. Work complete. No errors.\n",versionString); return 0; }
int main(int argc, char ** argv) { bool success = true; const char *versionString = "V4.03 2015_05"; // Use command line arguments, when some if (!processArgv(argc, argv, versionString)) return 1; // some simple check if working dir is dirty else { std::string sdir = std::string(szWorkDirWmo) + "/dir"; std::string sdir_bin = std::string(szWorkDirWmo) + "/dir_bin"; struct stat status; if (!stat(sdir.c_str(), &status) || !stat(sdir_bin.c_str(), &status)) { printf("Your output directory seems to be polluted, please use an empty directory!\n"); printf("<press return to exit>"); char garbage[2]; return scanf("%c", garbage); } } printf("Extract %s. Beginning work ....\n\n", versionString); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if (mkdir(szWorkDirWmo #if defined(__linux__) || defined(__APPLE__) , 0711 #endif )) success = (errno == EEXIST); int FirstLocale = -1; for (int i = 0; i < TOTAL_LOCALES; ++i) { if (i == LOCALE_none) continue; if (!OpenCascStorage(i)) continue; FirstLocale = i; uint32 build = ReadBuild(i); if (!build) { CascCloseStorage(CascStorage); continue; } printf("Detected client build: %u\n\n", build); break; } if (!OpenCascStorage(FirstLocale)) { if (GetLastError() != ERROR_PATH_NOT_FOUND) printf("Unable to open storage!\n"); return 1; } // Extract models, listed in GameObjectDisplayInfo.dbc ExtractGameobjectModels(); ReadLiquidTypeTableDBC(); // extract data if (success) success = ExtractWmo(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if (success) { DBCFile * dbc = new DBCFile(CascStorage, "DBFilesClient\\Map.dbc"); if (!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); return 1; } map_count = dbc->getRecordCount(); map_ids = new map_id[map_count]; for (unsigned int x = 0; x < map_count; ++x) { map_ids[x].id = dbc->getRecord(x).getUInt(0); const char* map_name = dbc->getRecord(x).getString(1); size_t max_map_name_length = sizeof(map_ids[x].name); if (strlen(map_name) >= max_map_name_length) { delete dbc; delete[] map_ids; printf("FATAL ERROR: Map name too long.\n"); return 1; } strncpy(map_ids[x].name, map_name, max_map_name_length); map_ids[x].name[max_map_name_length - 1] = '\0'; printf("Map - %s\n", map_ids[x].name); } delete dbc; ParsMapFiles(); delete [] map_ids; } CascCloseStorage(CascStorage); printf("\n"); if (!success) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n", versionString, preciseVectorData); getchar(); } printf("Extract %s. Work complete. No errors.\n", versionString); delete [] LiqType; return 0; }
int main(int argc, char ** argv) { //char tmp[512]; // FILE* pDatei; // char tmp[512]; // char tmp1[512]; //char tmp2[512]; // char tmp3[512]; // char tmp4[512]; // char szMpqName[MAX_PATH] = ""; // char szListFile[MAX_PATH] = ""; int nError = ERROR_SUCCESS; char *versionString = "V2.4 2007_07_12"; // Use command line arguments, when some if(!processArgv(argc, argv, versionString)) return 1; printf("Extract %s. Beginning work ....\n",versionString); // Set the lowest priority to allow running in the background SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if(nError == ERROR_SUCCESS) { //if(!CreateDirectory(szWorkDirMaps, NULL)) // nError = GetLastError(); if(!CreateDirectory(szWorkDirWmo, NULL)) nError = GetLastError(); if(nError == ERROR_ALREADY_EXISTS) nError = ERROR_SUCCESS; } //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // patch goes first -> fake priority handling std::vector<MPQArchive*> archives; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx std::vector<std::string> archiveNames; fillArchiveNameVector(archiveNames); for (size_t i=0; i<archiveNames.size(); i++) { archives.push_back(new MPQArchive(archiveNames[i].c_str())); } ExtractWmo(archiveNames); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if(nError == ERROR_SUCCESS) { DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); dbc->open(); map_count=dbc->getRecordCount (); map_ids=new map_id[map_count]; for(unsigned int x=0;x<map_count;x++) { map_ids[x].id=dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); printf("Map - %s\n",map_ids[x].name); } delete dbc; ParsMapFiles(); delete [] map_ids; nError = ERROR_SUCCESS; } clreol(); if(nError != ERROR_SUCCESS) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); _getch(); } printf("Extract %s. Work complete. No errors.",versionString); }
void LootMgr::LoadLootTables(const char * szTableName,LootStore * LootTable) { DBCFile *dbc = new DBCFile(); dbc->open("DBC/ItemRandomProperties.dbc"); _propCount = dbc->getRecordCount(); delete dbc; //HM_NAMESPACE::hash_map<uint32, std::vector<loot_tb> > loot_db; //HM_NAMESPACE::hash_map<uint32, std::vector<loot_tb> >::iterator itr; vector< pair< uint32, vector< pair<uint32, float> > > > db_cache; vector< pair< uint32, vector< pair<uint32, float> > > >::iterator itr; db_cache.reserve(10000); LootStore::iterator tab; printf("Waiting on SQL...\r"); QueryResult *result =sDatabase.Query("SELECT entryid, itemid, percentchance FROM %s ORDER BY entryid ASC",szTableName); if(!result) { sLog.outError("\rWARNING: Loading loot from table %s failed.", szTableName); return; } uint32 entry_id = 0; uint32 last_entry = 0; uint32 total =(uint32) result->GetRowCount(); int pos = 0; vector< pair<uint32, float> > ttab; do { Field *fields = result->Fetch(); entry_id = fields[0].GetUInt32(); if(entry_id < last_entry) { sLog.outError("WARNING: Out of order loot table being loaded.\n"); return; } if(entry_id != last_entry) { if(last_entry != 0) db_cache.push_back( make_pair( last_entry, ttab) ); ttab.clear(); } ttab.push_back( make_pair(fields[1].GetUInt32(), fields[2].GetFloat()) ); /*loot_tb t; t.itemid = fields[1].GetUInt32(); t.chance = fields[2].GetFloat(); loot_db[fields[0].GetUInt32()].push_back(t);*/ last_entry = entry_id; ++pos; if(!(pos % 10000)) SetProgressBar(pos, total, szTableName); } while( result->NextRow() ); ClearProgressBar(); pos = 0; total = db_cache.size(); ItemPrototype* proto; uint32 itemid; //for(itr=loot_db.begin();itr!=loot_db.end();++itr) for( itr = db_cache.begin(); itr != db_cache.end(); ++itr) { entry_id = (*itr).first; if(LootTable->end()==LootTable->find(entry_id)) { StoreLootList list; //list.count = itr->second.size(); list.count = (*itr).second.size(); list.items=new StoreLootItem[list.count]; uint32 ind=0; //for(std::vector<loot_tb>::iterator itr2=itr->second.begin();itr2!=itr->second.end();++itr2) for(vector< pair<uint32, float> >::iterator itr2 = (*itr).second.begin(); itr2 != (*itr).second.end(); ++itr2) { //Omit items that are not in db to prevent future bugs //uint32 itemid=(*itr2).itemid; itemid = (*itr2).first; proto=objmgr.GetItemPrototype(itemid); if(!proto) { list.items[ind].item.itemid=0; //sLog.outDetail("WARNING: Loot %u contains item %u that does not exist in the DB.",entry_id,(*itr2).itemid); } else { list.items[ind].item.itemid=itemid; list.items[ind].item.displayid=proto->DisplayInfoID; //list.items[ind].chance=(*itr2).chance; list.items[ind].chance=(*itr2).second; PropStore::iterator ptab =LootProperties.find(itemid); if( LootProperties.end()==ptab) list.items[ind].prop=NULL; else list.items[ind].prop=ptab->second; if(LootTable == &GOLoot) { if(proto->Class == ITEM_CLASS_QUEST) { //printf("Quest item \"%s\" allocated to quest ", proto->Name1.c_str()); sQuestMgr.SetGameObjectLootQuest(itr->first, itemid); quest_loot_go[entry_id].insert(proto->ItemId); } } } ind++; } (*LootTable)[entry_id]=list; } ++pos; if(!(pos % 1000)) SetProgressBar(pos, total, szTableName); } ClearProgressBar(); //sLog.outString(" %d loot templates loaded from %s", db_cache.size(), szTableName); // loot_db.clear(); delete result; }
void dump_as_sql() { if(SPELL_COLUMN_COUNT!=dbc.getFieldCount()) { printf("error,column counts do not match update code for latest dbc format\n"); exit(1); } printf("will start dumping data into sql file (we will drop not required fields!)\n"); FILE *fsql=fopen("dbc_spell.sql","w"); //drop table if already exist fprintf(fsql,"%s","DROP TABLE IF EXISTS `dbc_spell`;\n"); //create the table fprintf(fsql,"%s","CREATE TABLE dbc_spell (\n"); for(int i=0;i<SPELL_COLUMN_COUNT;i++) if(sql_translation_table[i][2][0]=='0') { if(sql_translation_table[i][0][0]=='u') fprintf(fsql,"\t `%s` INT (11) UNSIGNED DEFAULT '0' NOT NULL,\n",sql_translation_table[i][1]); else if(sql_translation_table[i][0][0]=='i') fprintf(fsql,"\t `%s` INT (11) DEFAULT '0' NOT NULL,\n",sql_translation_table[i][1]); else if(sql_translation_table[i][0][0]=='f') fprintf(fsql,"\t `%s` FLOAT DEFAULT '0' NOT NULL,\n",sql_translation_table[i][1]); else if(sql_translation_table[i][0][0]=='s') fprintf(fsql,"\t `%s` VARCHAR(2000),\n",sql_translation_table[i][1]); } fprintf(fsql,"%s","PRIMARY KEY(id), UNIQUE(id), INDEX(id));\n"); fprintf(fsql,"\n\n"); //start dumping the data from the DBC char tstr[2000]; for(unsigned int j=0;j<dbc.getRecordCount();j++) { //we start a new insert block if((j % SQL_INSERTS_PER_QUERY) == 0) { fprintf(fsql,"%s","INSERT INTO dbc_spell ("); for(int i=0;i<SPELL_COLUMN_COUNT-1;i++) if(sql_translation_table[i][2][0]=='0') fprintf(fsql,"`%s`,",sql_translation_table[i][1]); fprintf(fsql,"`%s`) values \n",sql_translation_table[SPELL_COLUMN_COUNT-1][1]); fprintf(fsql," ("); } else fprintf(fsql,",("); for(int i=0;i<SPELL_COLUMN_COUNT;i++) if(sql_translation_table[i][2][0]=='0') { if(i!=0) fprintf(fsql,","); if(sql_translation_table[i][0][0]=='u') fprintf(fsql,"%u",dbc.getRecord(j).getUInt(i)); else if(sql_translation_table[i][0][0]=='i') fprintf(fsql,"%d",dbc.getRecord(j).getInt(i)); else if(sql_translation_table[i][0][0]=='f') fprintf(fsql,"%f",dbc.getRecord(j).getFloat(i)); else if(sql_translation_table[i][0][0]=='s') { const char *dstr=dbc.getRecord(j).getString(i); int otherindex=0; for(unsigned int k=0;k<=strlen(dstr);k++) if(dstr[k]=='\'' || dstr[k]=='"' || dstr[k]=='#' || dstr[k]=='-') { tstr[otherindex++] = '\\'; tstr[otherindex++] = dstr[k]; } else tstr[otherindex++] = dstr[k]; fprintf(fsql,"\"%s\"",tstr); } } //we need to end an insert block if(((j+1) % SQL_INSERTS_PER_QUERY)==0) fprintf(fsql,");\n"); else fprintf(fsql,")\n"); } fprintf(fsql,";"); fprintf(fsql,"\n\n"); fclose(fsql); }
int main(int argc, char * arg[]) { printf("AscNHalf map extractor for versions 3.2.2 \n"); printf("============================================================\n\n"); FILE * tf; const char* localeNames[] = { "enUS", "enGB", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES", "ruRU", 0 }; int maxPatches = 3; int locale = -1; char tmp[100]; tf = fopen("Data/common.MPQ", "r"); if (!tf) { printf("Could not find Data/common.MPQ\n"); return 1; } fclose(tf); new MPQArchive("Data/common.MPQ"); tf = fopen("Data/common-2.MPQ", "r"); if (!tf) { printf("Could not find Data/common-2.MPQ\n"); return 1; } fclose(tf); new MPQArchive("Data/common-2.MPQ"); for( size_t i = 0; localeNames[i] != 0; i++ ) { sprintf(tmp, "Data/%s/locale-%s.MPQ", localeNames[i], localeNames[i]); tf = fopen(tmp, "r"); if (!tf) continue; fclose(tf); locale = i; new MPQArchive(tmp); } tf = fopen("Data/expansion.MPQ", "r"); if (tf) { fclose(tf); new MPQArchive("Data/expansion.MPQ"); if ( -1 != locale ) { sprintf(tmp, "Data/%s/expansion-locale-%s.MPQ", localeNames[locale], localeNames[locale]); new MPQArchive(tmp); } } tf = fopen("Data/lichking.MPQ", "r"); if (tf) { fclose(tf); new MPQArchive("Data/lichking.MPQ"); if ( -1 != locale ) { sprintf(tmp, "Data/%s/lichking-locale-%s.MPQ", localeNames[locale], localeNames[locale]); new MPQArchive(tmp); } } tf = fopen("Data/patch.MPQ", "r"); if (tf) { fclose(tf); new MPQArchive("Data/patch.MPQ"); for(int i = 2; i <= maxPatches; i++) { sprintf(tmp, "Data/patch-%d.MPQ", i); tf = fopen(tmp, "r"); if (!tf) continue; fclose(tf); new MPQArchive(tmp); } if ( -1 != locale ) { sprintf(tmp, "Data/%s/patch-%s.MPQ", localeNames[locale], localeNames[locale]); tf = fopen(tmp, "r"); if (tf) { fclose(tf); new MPQArchive(tmp); for(int i = 2; i <= maxPatches; i++) { sprintf(tmp, "Data/%s/patch-%s-%d.MPQ", localeNames[locale], localeNames[locale], i); tf = fopen(tmp, "r"); if (!tf) continue; fclose(tf); new MPQArchive(tmp); } } } } printf("\nExtracting DBC Files: Identifying files...\n"); std::set<std::string> dbcFiles; int itc = 0; for(std::vector<MPQArchive*>::iterator it = gOpenArchives.begin(); it != gOpenArchives.end(); ++it) { std::vector<std::string> files; files = (*it)->GetFileList(); for (vector<string>::iterator iter = files.begin(); iter != files.end(); ++iter) if (iter->rfind(".dbc") == iter->length() - strlen(".dbc")) dbcFiles.insert(*iter); SimpleProgressBar(++itc, gOpenArchives.size()); } CleanCache(); ClearProgressBar(); printf("Extracting...\n"); CreateDirectory("DBC", NULL); // extract DBCs int count = 0; for (set<string>::iterator iter = dbcFiles.begin(); iter != dbcFiles.end(); ++iter) { string filename = "DBC\\"; filename += (iter->c_str() + strlen("DBFilesClient\\")); if(ExtractFile(iter->c_str(), filename)) ++count; SimpleProgressBar(count, dbcFiles.size()); } CleanCache(); ClearProgressBar(); printf("Extracted %u DBC files\n\n", count); //map.dbc DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); dbc->open(); MapCount = dbc->getRecordCount (); map_ids = new map_id[MapCount]; for(unsigned int x = 0; x < MapCount; x++) { map_ids[x].id = dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name, dbc->getRecord(x).getString(1)); } delete dbc; CreateDirectory("maps", NULL); ExtractMapsFromMpq(); delete [] map_ids; return 0; // Exit The Program }
int main(int argc, char ** argv) { //char tmp[512]; // FILE* pDatei; // char tmp[512]; // char tmp1[512]; //char tmp2[512]; // char tmp3[512]; // char tmp4[512]; // char szMpqName[MAX_PATH] = ""; // char szListFile[MAX_PATH] = ""; int nError = ERROR_SUCCESS; char *versionString = "V2.4 2007_07_12"; // Use command line arguments, when some if(!processArgv(argc, argv, versionString)) return 1; printf("Extract %s. Beginning work ....\n",versionString); // Set the lowest priority to allow running in the background SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if(nError == ERROR_SUCCESS) { //if(!CreateDirectory(szWorkDirMaps, NULL)) // nError = GetLastError(); if(!CreateDirectory(szWorkDirWmo, NULL)) nError = GetLastError(); if(nError == ERROR_ALREADY_EXISTS) nError = ERROR_SUCCESS; } // prepare archive name list std::vector<std::string> archiveNames; fillArchiveNameVector(archiveNames); if(!gOpenArchives.Open(archiveNames)) { printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path); return 1; } // extract data ExtractWmo(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if(nError == ERROR_SUCCESS) { DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); if(!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); return 1; } map_count=dbc->getRecordCount (); map_ids=new map_id[map_count]; for(unsigned int x=0;x<map_count;++x) { map_ids[x].id=dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); printf("Map - %s\n",map_ids[x].name); } delete dbc; ParsMapFiles(); delete [] map_ids; nError = ERROR_SUCCESS; } clreol(); if(nError != ERROR_SUCCESS) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); _getch(); } printf("Extract %s. Work complete. No errors.",versionString); }
int main(int argc, char** argv) { printf("mangos-zero vmap (version %s) extractor\n\n", szRawVMAPMagic); bool success = true; // Use command line arguments, when some if (!processArgv(argc, argv)) { return 1; } // some simple check if working dir is dirty else { std::string sdir = std::string(szWorkDirWmo) + "/dir"; std::string sdir_bin = std::string(szWorkDirWmo) + "/dir_bin"; struct stat status; if (!stat(sdir.c_str(), &status) || !stat(sdir_bin.c_str(), &status)) { printf("Your output directory seems to be polluted, please use an empty directory!\n"); printf("<press return to exit>"); char garbage[2]; int ret = scanf("%c", garbage); return 1; } } printf("Beginning work ....\n"); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if (mkdir(szWorkDirWmo #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) , 0711 #endif )) { success = (errno == EEXIST); } // prepare archive name list std::vector<std::string> archiveNames; fillArchiveNameVector(archiveNames); for (size_t i = 0; i < archiveNames.size(); ++i) { MPQArchive* archive = new MPQArchive(archiveNames[i].c_str()); if (!gOpenArchives.size() || gOpenArchives.front() != archive) { delete archive; } } if (gOpenArchives.empty()) { printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n", input_path); return 1; } ReadLiquidTypeTableDBC(); // extract data if (success) { success = ExtractWmo(); } //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if (success) { DBCFile* dbc = new DBCFile("DBFilesClient\\Map.dbc"); if (!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); return 1; } map_count = dbc->getRecordCount(); map_ids = new map_id[map_count]; for (unsigned int x = 0; x < map_count; ++x) { map_ids[x].id = dbc->getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc->getRecord(x).getString(1)); printf("Map - %s\n", map_ids[x].name); } delete dbc; ParsMapFiles(); delete [] map_ids; //nError = ERROR_SUCCESS; // Extract models, listed in DameObjectDisplayInfo.dbc ExtractGameobjectModels(); } printf("\n"); if (!success) { printf("ERROR: Work NOT complete.\n Precise vector data=%d.\nPress any key.\n", preciseVectorData); getchar(); } printf("Work complete. No errors.\n"); delete [] LiqType; return 0; }
int main(int argc, char ** argv) { bool success=true; const char *versionString = "V2.90 2010_05"; // Use command line arguments, when some if(!processArgv(argc, argv, versionString)) return 1; printf("Extract %s. Beginning work ....\n",versionString); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if(mkdir(szWorkDirWmo #ifdef __linux__ , 0711 #endif )) success = (errno == EEXIST); // prepare archive name list std::vector<std::string> archiveNames; fillArchiveNameVector(archiveNames); for (size_t i=0; i < archiveNames.size(); ++i) { MPQArchive *archive = new MPQArchive(archiveNames[i].c_str()); if(!gOpenArchives.size() || gOpenArchives.front() != archive) delete archive; } if(gOpenArchives.empty()) { printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path); return 1; } ReadLiquidTypeTableDBC(); // extract data if(success) success = ExtractWmo(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if(success) { DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); if(!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); return 1; } map_count=dbc->getRecordCount (); map_ids=new map_id[map_count]; for(unsigned int x=0;x<map_count;++x) { map_ids[x].id=dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); printf("Map - %s\n",map_ids[x].name); } delete dbc; ParsMapFiles(); delete [] map_ids; //nError = ERROR_SUCCESS; } clreol(); if(!success) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); getchar(); } printf("Extract %s. Work complete. No errors.\n",versionString); delete [] LiqType; return 0; }