void InstanceMgr::Load(TaskList * l) { new FormationMgr; new WorldStateTemplateManager; sWorldStateTemplateManager.LoadFromDB(); QueryResult *result; // Create all non-instance type maps. result = CharacterDatabase.Query( "SELECT MAX(id) FROM instances" ); if( result ) { m_InstanceHigh = result->Fetch()[0].GetUInt32()+1; delete result; } else m_InstanceHigh = 1; // create maps for any we don't have yet. StorageContainerIterator<MapInfo> * itr = LimitedMapInfoStorage.MakeIterator(); while(!itr->AtEnd()) { MapInfo* mapinfo = itr->Get(); if( mapinfo->mapid >= NUM_MAPS ) { Log.Warning("InstanceMgr", "One or more of your worldmap_info rows specifies an invalid map: %u", mapinfo->mapid ); itr->Inc(); continue; } if(m_maps[mapinfo->mapid] == NULL) l->AddTask(new Task(new CallbackP1<InstanceMgr,uint32>(this, &InstanceMgr::_CreateMap, mapinfo->mapid))); if( mapinfo->flags != 1 && mapinfo->cooldown == 0) //Transport maps have 0 update_distance since you don't load into them ;) { Log.Warning("InstanceMgr", "Your worldmap_info has no cooldown for map %u.", itr->Get()->mapid); itr->Get()->cooldown = TIME_MINUTE * 30; } itr->Inc(); } itr->Destruct(); l->wait(); // load saved instances _LoadInstances(); }
void InstanceMgr::Load(uint32 mapid) { QueryResult *result; sWorldStateTemplateManager.LoadFromDB(mapid); // Create all non-instance type maps. result = CharacterDatabase.Query( "SELECT MAX(id) FROM instances WHERE mapid = '%i'", mapid); if( result ) { m_InstanceHigh = result->Fetch()[0].GetUInt32()+1; delete result; } else m_InstanceHigh = 1; _CreateMap(mapid); // load saved instances _LoadInstances(); }
void InstanceMgr::Load(set<uint32> mapids) { // Create all non-instance type maps. QueryResult *result = CharacterDatabase.Query( "SELECT MAX(id) FROM instances" ); if( result ) { m_InstanceHigh = result->Fetch()[0].GetUInt32()+1; delete result; } else m_InstanceHigh = 1; for(set<uint32>::iterator itr = mapids.begin(); itr != mapids.end(); itr++) { sWorld.loadmaps.insert(*itr); sWorldStateTemplateManager.LoadFromDB(*itr); _CreateMap(*itr); } // load saved instances _LoadInstances(); }
void InstanceMgr::Load(TaskList* l) { new FormationMgr; // Create all non-instance type maps. QueryResult* result = CharacterDatabase.Query("SELECT MAX(id) FROM instances"); if(result) { m_InstanceHigh = result->Fetch()[0].GetUInt32() + 1; delete result; } else m_InstanceHigh = 1; // load each map we have in the database. result = WorldDatabase.Query("SELECT DISTINCT Map FROM creature_spawns"); if(result) { do { if(WorldMapInfoStorage.LookupEntry(result->Fetch()[0].GetUInt32()) == NULL) continue; if(result->Fetch()[0].GetUInt32() >= NUM_MAPS) { Log.Error("InstanceMgr", "One or more of your creature_spawns rows specifies an invalid map: %u", result->Fetch()[0].GetUInt32()); continue; } //_CreateMap(result->Fetch()[0].GetUInt32()); l->AddTask(new Task(new CallbackP1<InstanceMgr, uint32>(this, &InstanceMgr::_CreateMap, result->Fetch()[0].GetUInt32()))); } while(result->NextRow()); delete result; } l->wait(); // create maps for any we don't have yet. StorageContainerIterator<MapInfo> * itr = WorldMapInfoStorage.MakeIterator(); while(!itr->AtEnd()) { if(itr->Get()->mapid >= NUM_MAPS) { Log.Error("InstanceMgr", "One or more of your worldmap_info rows specifies an invalid map: %u", itr->Get()->mapid); continue; } if(m_maps[itr->Get()->mapid] == NULL) { l->AddTask(new Task(new CallbackP1<InstanceMgr, uint32>(this, &InstanceMgr::_CreateMap, itr->Get()->mapid))); } //_CreateMap(itr->Get()->mapid); itr->Inc(); } itr->Destruct(); l->wait(); // load reset times result = CharacterDatabase.Query("SELECT setting_id, setting_value FROM server_settings WHERE setting_id LIKE 'next_instance_reset_%%'"); if(result) { do { const char* id = result->Fetch()[0].GetString(); uint32 value = result->Fetch()[1].GetUInt32(); if(strlen(id) <= 20) continue; uint32 mapId = atoi(id + 20); if(mapId >= NUM_MAPS) continue; m_nextInstanceReset[mapId] = value; } while(result->NextRow()); delete result; } // load saved instances _LoadInstances(); }
void InstanceMgr::Load(TaskList* l) { new FormationMgr; // Create all non-instance type maps. QueryResult* result = CharacterDatabase.Query("SELECT MAX(id) FROM instances"); if (result) { m_InstanceHigh = result->Fetch()[0].GetUInt32() + 1; delete result; } else m_InstanceHigh = 1; // load each map we have in the database. result = WorldDatabase.Query("SELECT DISTINCT Map FROM creature_spawns"); if (result) { do { if (sMySQLStore.GetWorldMapInfo(result->Fetch()[0].GetUInt32()) == nullptr) continue; if (result->Fetch()[0].GetUInt32() >= NUM_MAPS) { LOG_ERROR("One or more of your creature_spawns rows specifies an invalid map: %u", result->Fetch()[0].GetUInt32()); continue; } //_CreateMap(result->Fetch()[0].GetUInt32()); l->AddTask(new Task(new CallbackP1<InstanceMgr, uint32>(this, &InstanceMgr::_CreateMap, result->Fetch()[0].GetUInt32()))); } while (result->NextRow()); delete result; } l->wait(); // create maps for any we don't have yet. MySQLDataStore::WorldMapInfoContainer const* its = sMySQLStore.GetWorldMapInfoStore(); for (MySQLDataStore::WorldMapInfoContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) { if (itr->second.mapid >= NUM_MAPS) { LOG_ERROR("One or more of your worldmap_info rows specifies an invalid map: %u", itr->second.mapid); continue; } if (m_maps[itr->second.mapid] == NULL) { l->AddTask(new Task(new CallbackP1<InstanceMgr, uint32>(this, &InstanceMgr::_CreateMap, itr->second.mapid))); } } l->wait(); // load reset times result = CharacterDatabase.Query("SELECT setting_id, setting_value FROM server_settings WHERE setting_id LIKE 'next_instance_reset_%%'"); if (result) { do { const char* id = result->Fetch()[0].GetString(); uint32 value = result->Fetch()[1].GetUInt32(); if (strlen(id) <= 20) continue; uint32 mapId = atoi(id + 20); if (mapId >= NUM_MAPS) continue; m_nextInstanceReset[mapId] = value; } while (result->NextRow()); delete result; } // load saved instances _LoadInstances(); }
void InstanceMgr::Load(TaskList * l) { new FormationMgr; new WorldStateTemplateManager; sWorldStateTemplateManager.LoadFromDB(); // Create all non-instance type maps. QueryResult *result = CharacterDatabase.Query( "SELECT MAX(id) FROM instances" ); if( result ) { m_InstanceHigh = result->Fetch()[0].GetUInt32()+1; delete result; } else m_InstanceHigh = 1; // load each map we have in the database. result = WorldDatabase.Query("SELECT DISTINCT Map FROM creature_spawns"); if(result) { do { if(WorldMapInfoStorage.LookupEntry(result->Fetch()[0].GetUInt32()) == NULL) continue; if( result->Fetch()[0].GetUInt32() >= NUM_MAPS ) { Log.Warning("InstanceMgr", "One or more of your creature_spawns rows specifies an invalid map: %u", result->Fetch()[0].GetUInt32() ); continue; } //_CreateMap(result->Fetch()[0].GetUInt32()); l->AddTask(new Task(new CallbackP1<InstanceMgr,uint32>(this, &InstanceMgr::_CreateMap, result->Fetch()[0].GetUInt32()))); } while(result->NextRow()); delete result; } l->wait(); // create maps for any we don't have yet. StorageContainerIterator<MapInfo> * itr = WorldMapInfoStorage.MakeIterator(); while(!itr->AtEnd()) { if( itr->Get()->mapid >= NUM_MAPS ) { Log.Warning("InstanceMgr", "One or more of your worldmap_info rows specifies an invalid map: %u", itr->Get()->mapid ); continue; } if(m_maps[itr->Get()->mapid] == NULL) { l->AddTask(new Task(new CallbackP1<InstanceMgr,uint32>(this, &InstanceMgr::_CreateMap, itr->Get()->mapid))); } //_CreateMap(itr->Get()->mapid); itr->Inc(); } itr->Destruct(); l->wait(); // load saved instances _LoadInstances(); }
void InstanceMgr::Load(TaskList * l) { new FormationMgr; new WorldStateTemplateManager; sWorldStateTemplateManager.LoadFromDB(); // Create all non-instance type maps. QueryResult *result = CharacterDatabase.Query( "SELECT MAX(id) FROM instances" ); if( result ) { m_InstanceHigh = result->Fetch()[0].GetUInt32()+1; delete result; } else m_InstanceHigh = 1; // load each map we have in the database. result = WorldDatabase.Query("SELECT DISTINCT Map FROM creature_spawns"); if(result) { do { if(WorldMapInfoStorage.LookupEntry(result->Fetch()[0].GetUInt32()) == NULL) continue; if( result->Fetch()[0].GetUInt32() >= NUM_MAPS ) { Log.Warning("InstanceMgr", "One or more of your creature_spawns rows specifies an invalid map: %u", result->Fetch()[0].GetUInt32() ); continue; } //_CreateMap(result->Fetch()[0].GetUInt32()); l->AddTask(new Task(new NoSharedPtrCallbackP1<InstanceMgr,uint32>(this, &InstanceMgr::_CreateMap, result->Fetch()[0].GetUInt32()))); } while(result->NextRow()); delete result; } l->wait(); // create maps for any we don't have yet. StorageContainerIterator<MapInfo> * itr = WorldMapInfoStorage.MakeIterator(); while(!itr->AtEnd()) { if( itr->Get()->mapid >= NUM_MAPS ) { Log.Warning("InstanceMgr", "One or more of your worldmap_info rows specifies an invalid map: %u", itr->Get()->mapid ); itr->Inc(); continue; } #ifdef EXCLUDE_TEST_MAPS MapEntry *me = dbcMap.LookupEntry(itr->Get()->mapid); if (me && !me->multimap_id) { Log.Notice("InstanceMgr", "Skipped test map: %u (hearthstoneConfig.h)", itr->Get()->mapid ); itr->Inc(); continue; } #endif if(m_maps[itr->Get()->mapid] == NULL) { l->AddTask(new Task(new NoSharedPtrCallbackP1<InstanceMgr,uint32>(this, &InstanceMgr::_CreateMap, itr->Get()->mapid))); } if( itr->Get()->flags != 1 && itr->Get()->cooldown == 0 ) { Log.Warning("InstanceMgr", "Your worldmap_info has no cooldown for map %u.", itr->Get()->mapid); itr->Get()->cooldown = TIME_MINUTE * 30; } //_CreateMap(itr->Get()->mapid); itr->Inc(); } itr->Destruct(); l->wait(); // load saved instances _LoadInstances(); }