int main(int argc, char **argv) { LoadDBCStores("/opt/mangos_335/share/dbc"); dump_all(sAchievementStore); dump_all(sAchievementCriteriaStore); dump_all(sGemPropertiesStore); dump_all(sItemStore, true); dump_all(sItemExtendedCostStore); dump_all(sSpellStore, true); dump_all(sSpellCastTimesStore); dump_all(sSpellDifficultyStore); dump_all(sSpellDurationStore); dump_all(sSpellItemEnchantmentStore); dump_all(sSpellRadiusStore); dump_all(sSpellRangeStore); dump_all(sSpellShapeshiftStore); dump_all(sSummonPropertiesStore); return 0; }
void World::SetInitialWorldSettings() { std::string dataPath="./"; srand((unsigned int)time(NULL)); m_lastTick = time(NULL); time_t tiempo; char hour[3]; char minute[3]; char second[3]; struct tm *tmPtr; tiempo = time(NULL); tmPtr = localtime(&tiempo); strftime( hour, 3, "%H", tmPtr ); strftime( minute, 3, "%M", tmPtr ); strftime( second, 3, "%S", tmPtr ); if(!sConfig.GetString("DataDir",&dataPath)) dataPath="./"; else { if((dataPath.at(dataPath.length()-1)!='/') && (dataPath.at(dataPath.length()-1)!='\\')) dataPath.append("/"); } sLog.outString("Using DataDir %s ...",dataPath.c_str()); // Non-critical warning about conf file version uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0); if(!confVersion) { sLog.outString("*****************************************************************************"); sLog.outString(" WARNING: mangosd.conf does not include a ConfVersion variable."); sLog.outString(" Your conf file may be out of date!"); sLog.outString("*****************************************************************************"); clock_t pause = 3000 + clock(); while (pause > clock()); } else { if (confVersion < _MANGOSDCONFVERSION) { sLog.outString("*****************************************************************************"); sLog.outString(" WARNING: Your mangosd.conf version indicates your conf file is out of date!"); sLog.outString(" Please check for updates, as your current default values may cause"); sLog.outString(" strange behavior."); sLog.outString("*****************************************************************************"); clock_t pause = 3000 + clock(); while (pause > clock()); } } regen_values[RATE_HEALTH] = sConfig.GetFloatDefault("Rate.Health", 1); regen_values[RATE_POWER_MANA] = sConfig.GetFloatDefault("Rate.Power1", 1); regen_values[RATE_POWER_RAGE] = sConfig.GetFloatDefault("Rate.Power2", 1); regen_values[RATE_POWER_FOCUS] = sConfig.GetFloatDefault("Rate.Power3", 1); regen_values[RATE_DROP_ITEMS] = sConfig.GetFloatDefault("Rate.Drop.Items", 1); regen_values[RATE_DROP_MONEY] = sConfig.GetFloatDefault("Rate.Drop.Money", 1); regen_values[RATE_XP_KILL] = sConfig.GetFloatDefault("Rate.XP.Kill", 1); regen_values[RATE_XP_QUEST] = sConfig.GetFloatDefault("Rate.XP.Quest", 1); regen_values[RATE_XP_EXPLORE] = sConfig.GetFloatDefault("Rate.XP.Explore", 1); regen_values[RATE_CREATURE_DAMAGE] = sConfig.GetFloatDefault("Rate.Creature.Damage", 1); regen_values[RATE_AGGRO] = sConfig.GetFloatDefault("Rate.Aggro", 1); m_configs[CONFIG_LOG_LEVEL] = sConfig.GetIntDefault("LogLevel", 0); m_configs[CONFIG_LOG_WORLD] = sConfig.GetIntDefault("LogWorld", 0); m_configs[CONFIG_COMPRESSION] = sConfig.GetIntDefault("Compression", 1); if(m_configs[CONFIG_COMPRESSION] < 1 || m_configs[CONFIG_COMPRESSION] > 9) { sLog.outError("Compression level (%i) must be in range 1..9. Using default compression level (1),.",m_configs[CONFIG_COMPRESSION]); m_configs[CONFIG_COMPRESSION] = 1; } m_configs[CONFIG_INTERVAL_SAVE] = sConfig.GetIntDefault("PlayerSaveInterval", 900000); m_configs[CONFIG_INTERVAL_GRIDCLEAN] = sConfig.GetIntDefault("GridCleanUpDelay", 300000); m_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfig.GetIntDefault("MapUpdateInterval", 100); m_configs[CONFIG_INTERVAL_CHANGEWEATHER] = sConfig.GetIntDefault("ChangeWeatherInterval", 600000); m_configs[CONFIG_PORT_WORLD] = sConfig.GetIntDefault("WorldServerPort", 8085); m_configs[CONFIG_PORT_REALM] = sConfig.GetIntDefault("RealmServerPort", 3724); m_configs[CONFIG_SOCKET_SELECTTIME] = sConfig.GetIntDefault("SocketSelectTime", 10000); m_configs[CONFIG_GETXP_DISTANCE] = sConfig.GetIntDefault("MaxDistance", 5500); m_configs[CONFIG_GETXP_LEVELDIFF] = sConfig.GetIntDefault("MaxLevelDiff", 10); m_configs[CONFIG_SIGHT_MONSTER] = sConfig.GetIntDefault("MonsterSight", 400); m_configs[CONFIG_SIGHT_GUARDER] = sConfig.GetIntDefault("GuarderSight", 500); m_configs[CONFIG_GAME_TYPE] = sConfig.GetIntDefault("GameType", 0); m_configs[CONFIG_ALLOW_TWO_SIDE_ACCOUNTS] = sConfig.GetIntDefault("AllowTwoSideAccounts", 0); m_configs[CONFIG_MAX_PLAYER_LEVEL] = sConfig.GetIntDefault("MaxPlayerLevel", 60); m_configs[CONFIG_MAX_PRIMARY_TRADE_SKILL] = sConfig.GetIntDefault("MaxPrimaryTradeSkill", 2); m_configs[CONFIG_WISPERING_TO_GM] = sConfig.GetIntDefault("WhisperingToGM",0); m_gameTime = (3600*atoi(hour))+(atoi(minute)*60)+(atoi(second)); // check existance map files (startup race areas). if( !MapManager::ExistMAP(0,-6240.32, 331.033) ||!MapManager::ExistMAP(0,-8949.95,-132.493) ||!MapManager::ExistMAP(0,-8949.95,-132.493) ||!MapManager::ExistMAP(1,-618.518,-4251.67) ||!MapManager::ExistMAP(0, 1676.35, 1677.45) ||!MapManager::ExistMAP(1, 10311.3, 832.463) ||!MapManager::ExistMAP(1,-2917.58,-257.98)) { sLog.outError("Correct *.map files not found by path '%smap'. Please place *.map files in directory by this path or correct DataDir value in mangosd.conf file.",dataPath.c_str()); exit(1); } //duplicate //sDatabase.PExecute("UPDATE `character` SET `online` = 0"); //Update realm list loginDatabase.PExecute("UPDATE `realmlist` SET `icon` = %u WHERE `id` = '%d'", m_configs[CONFIG_GAME_TYPE],sConfig.GetIntDefault("RealmID", 0)); // remove bones after restart sDatabase.PExecute("DELETE FROM `corpse` WHERE `bones_flag` = '1'"); new ChannelMgr; sLog.outString("Initialize data stores..."); LoadDBCStores(dataPath); sLog.outString( "Loading Quests..." ); objmgr.LoadQuests(); sLog.outString( "Loading NPC Texts..." ); objmgr.LoadGossipText(); sLog.outString( "Loading Quest Area Triggers..." ); objmgr.LoadAreaTriggerPoints(); sLog.outString( "Loading Items..." ); objmgr.LoadItemPrototypes(); objmgr.LoadAuctions(); objmgr.LoadAuctionItems(); objmgr.LoadMailedItems(); sLog.outString( "Loading Creature templates..." ); objmgr.LoadCreatureTemplates(); sLog.outString( "Loading Guilds..." ); objmgr.LoadGuilds(); sLog.outString( "Loading Teleport Coords..." ); objmgr.LoadTeleportCoords(); objmgr.SetHighestGuids(); sLog.outString( "Loading Loot Tables..." ); LoadLootTables(); sLog.outString( "Loading Game Object Templates..." ); objmgr.LoadGameobjectInfo(); sLog.outString( "Initializing Scripts..." ); if(!LoadScriptingModule()) exit(1); m_timers[WUPDATE_OBJECTS].SetInterval(0); m_timers[WUPDATE_SESSIONS].SetInterval(0); m_timers[WUPDATE_WEATHERS].SetInterval(1000); m_timers[WUPDATE_AUCTIONS].SetInterval(1000); sLog.outString( "WORLD: Starting BattleGround System" ); sBattleGroundMgr.CreateInitialBattleGrounds(); MaNGOS::Game::Initialize(); sLog.outString( "WORLD: SetInitialWorldSettings done" ); sLog.outString( "WORLD: Starting Event System" ); StartEventSystem(); //Start Addon stuff bool temp = sConfig.GetBoolDefault("AddonDefault", 1); sLog.outString( "WORLD: Starting Addon System, AddonDefault:%d (%s all addons not registered in DB)", temp, temp? "Enabled" : "Disabled" ); sAddOnHandler.SetAddonDefault(temp); sAddOnHandler._LoadFromDB(); sLog.outString( "WORLD: Starting Corpse Handler" ); // global event to erase corpses/bones // deleting expired bones time > 20 minutes and corpses > 3 days // it is run each 20 minutes // need good tests on windows AddEvent(&HandleCorpsesErase,NULL,20*60,false,true); }