void WeatherMgr::LoadFromDB() { //sLog.outString(" Loading Weather..."); // weather type 0= sunny / 1= fog / 2 = light_rain / 4 = rain / 8 = snow / ?? = sandstorm QueryResult* result = WorldDatabase.Query("SELECT zoneId,high_chance,high_type,med_chance,med_type,low_chance,low_type FROM weather"); if (!result) return; do { Field* fields = result->Fetch(); WeatherInfo* wi = new WeatherInfo; wi->m_zoneId = fields[0].GetUInt32(); wi->m_effectValues[0] = fields[1].GetUInt32(); // high_chance wi->m_effectValues[1] = fields[2].GetUInt32(); // high_type wi->m_effectValues[2] = fields[3].GetUInt32(); // med_chance wi->m_effectValues[3] = fields[4].GetUInt32(); // med_type wi->m_effectValues[4] = fields[5].GetUInt32(); // low_chance wi->m_effectValues[5] = fields[6].GetUInt32(); // low_type m_zoneWeathers[wi->m_zoneId] = wi; wi->_GenerateWeather(); } while (result->NextRow()); Log.Notice("WeatherMgr", "Loaded weather information for %u zones.", result->GetRowCount()); delete result; }
void WeatherMgr::LoadFromDB() { sLog.outString(" Loading Weather..."); QueryResult *result = WorldDatabase.Query( "SELECT * FROM weather" ); if( !result ) { sLog.outString(" Query failed."); return; } // uint32 total =(uint32) result->GetRowCount(); // int num = 0; do { Field *fields = result->Fetch(); WeatherInfo *wi = new WeatherInfo; wi->m_zoneId = fields[0].GetUInt32(); wi->m_effectValues[0] = fields[1].GetUInt32(); wi->m_effectValues[1] = fields[2].GetUInt32(); wi->m_effectValues[2] = fields[3].GetUInt32(); wi->m_effectValues[3] = fields[4].GetUInt32(); wi->m_effectValues[4] = fields[5].GetUInt32(); m_zoneWeathers[wi->m_zoneId] = wi; wi->_GenerateWeather(); } while( result->NextRow() ); delete result; }
void WeatherMgr::LoadFromDB() { QueryResult *result = sDatabase.Query( "SELECT * FROM weather" ); if( !result ) { sLog.outString(" Query failed."); return; } uint32 total =(uint32) result->GetRowCount(); int num = 0; do { Field *fields = result->Fetch(); WeatherInfo *wi = new WeatherInfo; wi->m_zoneId = fields[0].GetUInt32(); wi->m_effectValues[0] = fields[1].GetUInt32(); wi->m_effectValues[1] = fields[2].GetUInt32(); wi->m_effectValues[2] = fields[3].GetUInt32(); wi->m_effectValues[3] = fields[4].GetUInt32(); wi->m_effectValues[4] = fields[5].GetUInt32(); m_zoneWeathers[wi->m_zoneId] = wi; wi->_GenerateWeather(); ++num; if(!(num % 15)) SetProgressBar(num, total, "Zone Weather"); } while( result->NextRow() ); delete result; ClearProgressBar(); }
void WeatherMgr::LoadFromDB() { QueryResult *result = WorldDatabase.Query( "SELECT zoneId,high_chance,high_type,med_chance,med_type,low_chance,low_type FROM weather" ); if( !result ) return; Field *fields = result->Fetch(); WeatherInfo* wi = NULL; do { fields = result->Fetch(); wi = new WeatherInfo(); wi->m_zoneId = fields[0].GetUInt32(); wi->m_effectValues[0] = fields[1].GetUInt32(); // high_chance wi->m_effectValues[1] = fields[2].GetUInt32(); // high_type wi->m_effectValues[2] = fields[3].GetUInt32(); // med_chance wi->m_effectValues[3] = fields[4].GetUInt32(); // med_type wi->m_effectValues[4] = fields[5].GetUInt32(); // low_chance wi->m_effectValues[5] = fields[6].GetUInt32(); // low_type m_zoneWeathers[wi->m_zoneId] = wi; wi->_GenerateWeather(); } while( result->NextRow() ); Log.Notice("WeatherMgr", "Loaded weather information for %u zones.", result->GetRowCount()); delete result; }