*Add config option CheckDB to check if the contents in FULL folder are applied.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-17 14:09:17 -05:00
parent cf99758b0b
commit 2d569883e6
8 changed files with 46 additions and 0 deletions

View File

@@ -564,6 +564,8 @@ struct TRINITY_DLL_DECL npc_ros_dark_riderAI : public ScriptedAI
deathcharger->RestoreFaction();
deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if(!me->m_Vehicle && deathcharger->isVehicle() && CAST_VEH(deathcharger)->HasEmptySeat(0))
me->EnterVehicle(CAST_VEH(deathcharger));
}
void JustDied(Unit *killer)

View File

@@ -8474,3 +8474,19 @@ void ObjectMgr::RemoveGMTicket(uint64 ticketGuid, int64 source, bool permanently
RemoveGMTicket(ticket, source, permanently);
}
bool ObjectMgr::CheckDB() const
{
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(28511);
if(!cInfo || cInfo->spells[4] != 51890)
return false;
cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(30068);
if(!cInfo || cInfo->faction_A != 21)
return false;
cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(28768);
if(!cInfo || !cInfo->ScriptID)
return false;
return true;
}

View File

@@ -866,6 +866,7 @@ class ObjectMgr
GmTicketList m_GMTicketList;
uint64 GenerateGMTicketId();
bool CheckDB() const;
protected:
// first free id for selected id type

View File

@@ -3626,3 +3626,13 @@ void SpellMgr::LoadSpellLinked()
sLog.outString();
sLog.outString( ">> Loaded %u linked spells", count );
}
bool SpellMgr::CheckDB() const
{
SpellScriptTarget::const_iterator lower = GetBeginSpellScriptTarget(30531);
SpellScriptTarget::const_iterator upper = GetEndSpellScriptTarget(30531);
if(lower == upper || lower->second.targetEntry != 17256)
return false;
return true;
}

View File

@@ -1065,6 +1065,8 @@ class SpellMgr
void LoadPetDefaultSpells();
void LoadSpellAreas();
bool CheckDB() const;
private:
SpellScriptTarget mSpellScriptTarget;
SpellChainMap mSpellChains;

View File

@@ -1087,6 +1087,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfig.GetBoolDefault("ShowKickInWorld", false);
m_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfig.GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
m_configs[CONFIG_MIN_LOG_UPDATE] = sConfig.GetIntDefault("MinRecordUpdateTimeDiff", 10);
m_configs[CONFIG_CHECK_DB] = sConfig.GetBoolDefault("CheckDB", true);
std::string forbiddenmaps = sConfig.GetStringDefault("ForbiddenMaps", "");
char * forbiddenMaps = new char[forbiddenmaps.length() + 1];
@@ -1485,6 +1486,13 @@ void World::SetInitialWorldSettings()
if(!LoadScriptingModule())
exit(1);
/// Check db
if(m_configs[CONFIG_CHECK_DB] && (!objmgr.CheckDB() || !spellmgr.CheckDB()))
{
sLog.outError("Your world DB is outdated. Please reapply sqls in sql\\FULL folder, or disable CheckDB option in config file (not recommended).");
exit(1);
}
///- Initialize game time and timers
sLog.outDebug( "DEBUG:: Initialize game time and timers" );
m_gameTime = time(NULL);

View File

@@ -232,6 +232,7 @@ enum WorldConfigs
CONFIG_SHOW_KICK_IN_WORLD,
CONFIG_INTERVAL_LOG_UPDATE,
CONFIG_MIN_LOG_UPDATE,
CONFIG_CHECK_DB,
CONFIG_ENABLE_SINFO_LOGIN,
CONFIG_PET_LOS,
CONFIG_OFFHAND_CHECK_AT_TALENTS_RESET,

View File

@@ -1620,6 +1620,11 @@ Ra.Secure = 1
# to a newly created character.
# Default: "" - send no text
#
# CheckDB
# Check if your DB is outdated. Disabling this option means that you decide to use a DB which is
# not compatible with TrinityCore and are ready for all kinds of bugs.
# Default: 1 = enable
#
###################################################################################################################
PlayerStart.AllReputation = 0
@@ -1640,3 +1645,4 @@ ShowKickInWorld = 0
RecordUpdateTimeDiffInterval = 60000
MinRecordUpdateTimeDiff = 10
PlayerStart.String = ""
CheckDB = 1