Implement quest_relations table (#114)
This commit is contained in:
parent
7d841211ca
commit
fbf53e316e
@ -286,7 +286,7 @@ bool ChatHandler::HandleReloadAllQuestCommand(char* /*args*/)
|
||||
|
||||
sLog.outString("Re-Loading Quests Relations...");
|
||||
sObjectMgr.LoadQuestRelations();
|
||||
SendGlobalSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded.", SEC_MODERATOR);
|
||||
SendGlobalSysMessage("DB table `quest_relations` reloaded.", SEC_MODERATOR);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -403,17 +403,17 @@ bool ChatHandler::HandleReloadCommandCommand(char* /*args*/)
|
||||
|
||||
bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(char* /*args*/)
|
||||
{
|
||||
sLog.outString("Loading Quests Relations... (`creature_questrelation`)");
|
||||
sLog.outString("Loading creature quest givers...");
|
||||
sObjectMgr.LoadCreatureQuestRelations();
|
||||
SendGlobalSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded.", SEC_MODERATOR);
|
||||
SendGlobalSysMessage("DB table `quest_relations` (creature quest givers) reloaded.", SEC_MODERATOR);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(char* /*args*/)
|
||||
{
|
||||
sLog.outString("Loading Quests Relations... (`creature_involvedrelation`)");
|
||||
sLog.outString("Loading creature quest takers...");
|
||||
sObjectMgr.LoadCreatureInvolvedRelations();
|
||||
SendGlobalSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded.", SEC_MODERATOR);
|
||||
SendGlobalSysMessage("DB table `quest_relations` (creature quest takers) reloaded.", SEC_MODERATOR);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -442,17 +442,17 @@ bool ChatHandler::HandleReloadGossipMenuCommand(char* /*args*/)
|
||||
|
||||
bool ChatHandler::HandleReloadGOQuestRelationsCommand(char* /*args*/)
|
||||
{
|
||||
sLog.outString("Loading Quests Relations... (`gameobject_questrelation`)");
|
||||
sLog.outString("Loading gameobject quest givers...");
|
||||
sObjectMgr.LoadGameobjectQuestRelations();
|
||||
SendGlobalSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded.", SEC_MODERATOR);
|
||||
SendGlobalSysMessage("DB table `quest_relations` (gameobject quest givers) reloaded.", SEC_MODERATOR);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(char* /*args*/)
|
||||
{
|
||||
sLog.outString("Loading Quests Relations... (`gameobject_involvedrelation`)");
|
||||
sLog.outString("Loading gameobject quest takers...");
|
||||
sObjectMgr.LoadGameobjectInvolvedRelations();
|
||||
SendGlobalSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded.", SEC_MODERATOR);
|
||||
SendGlobalSysMessage("DB table `quest_relations` (gameobject quest takers) reloaded.", SEC_MODERATOR);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -460,7 +460,7 @@ bool ChatHandler::HandleReloadQuestAreaTriggersCommand(char* /*args*/)
|
||||
{
|
||||
sLog.outString("Re-Loading Quest Area Triggers...");
|
||||
sObjectMgr.LoadQuestAreaTriggers();
|
||||
SendGlobalSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded.", SEC_MODERATOR);
|
||||
SendGlobalSysMessage("DB table `quest_relations` (quest area triggers) reloaded.", SEC_MODERATOR);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4653,7 +4653,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
|
||||
{
|
||||
mQuestAreaTriggerMap.clear(); // need for reload case
|
||||
|
||||
QueryResult* result = WorldDatabase.Query("SELECT id,quest FROM areatrigger_involvedrelation");
|
||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry, quest FROM quest_relations WHERE actor = %d", QA_AREATRIGGER);
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
@ -4681,20 +4681,20 @@ void ObjectMgr::LoadQuestAreaTriggers()
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID);
|
||||
if (!atEntry)
|
||||
{
|
||||
sLog.outErrorDb("Table `areatrigger_involvedrelation` has area trigger (ID: %u) not listed in `AreaTrigger.dbc`.", trigger_ID);
|
||||
sLog.outErrorDb("Table `quest_relations` has area trigger (ID: %u) not listed in `AreaTrigger.dbc`.", trigger_ID);
|
||||
continue;
|
||||
}
|
||||
|
||||
Quest const* quest = GetQuestTemplate(quest_ID);
|
||||
if (!quest)
|
||||
{
|
||||
sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID);
|
||||
sLog.outErrorDb("Table `quest_relations` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT))
|
||||
{
|
||||
sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID);
|
||||
sLog.outErrorDb("Table `quest_relations` has record (id: %u) for not quest %u, but quest not have flag QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID);
|
||||
|
||||
// this will prevent quest completing without objective
|
||||
const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT);
|
||||
@ -6231,13 +6231,13 @@ void ObjectMgr::DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_
|
||||
cell_guids.corpses.erase(player_guid);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, char const* table)
|
||||
void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, QuestActor actor, QuestRole role)
|
||||
{
|
||||
map.clear(); // need for reload case
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
QueryResult* result = WorldDatabase.PQuery("SELECT id,quest FROM %s", table);
|
||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry, quest FROM quest_relations WHERE actor = %d AND role = %d", actor, role);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@ -6246,7 +6246,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, char const* tab
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outErrorDb(">> Loaded 0 quest relations from %s. DB table `%s` is empty.", table, table);
|
||||
sLog.outErrorDb(">> Loaded 0 quest relations. DB table `quest_relations` is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -6262,7 +6262,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, char const* tab
|
||||
|
||||
if (mQuestTemplates.find(quest) == mQuestTemplates.end())
|
||||
{
|
||||
sLog.outErrorDb("Table `%s: Quest %u listed for entry %u does not exist.", table, quest, id);
|
||||
sLog.outErrorDb("Table `quest_relations`: Quest %u listed for entry %u does not exist.", quest, id);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -6275,62 +6275,62 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, char const* tab
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u quest relations from %s", count, table);
|
||||
sLog.outString(">> Loaded %u %s quest %s from `quest_relations`", count, (actor == 1) ? "gameobject" : "creature", (role == 1) ? "takers" : "givers");
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameobjectQuestRelations()
|
||||
{
|
||||
LoadQuestRelationsHelper(m_GOQuestRelations, "gameobject_questrelation");
|
||||
LoadQuestRelationsHelper(m_GOQuestRelations, QA_GAMEOBJECT, QR_START);
|
||||
|
||||
for (QuestRelationsMap::iterator itr = m_GOQuestRelations.begin(); itr != m_GOQuestRelations.end(); ++itr)
|
||||
{
|
||||
GameObjectInfo const* goInfo = GetGameObjectInfo(itr->first);
|
||||
if (!goInfo)
|
||||
{ sLog.outErrorDb("Table `gameobject_questrelation` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second); }
|
||||
{ sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second); }
|
||||
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
{ sLog.outErrorDb("Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
|
||||
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameobjectInvolvedRelations()
|
||||
{
|
||||
LoadQuestRelationsHelper(m_GOQuestInvolvedRelations, "gameobject_involvedrelation");
|
||||
LoadQuestRelationsHelper(m_GOQuestInvolvedRelations, QA_GAMEOBJECT, QR_END);
|
||||
|
||||
for (QuestRelationsMap::iterator itr = m_GOQuestInvolvedRelations.begin(); itr != m_GOQuestInvolvedRelations.end(); ++itr)
|
||||
{
|
||||
GameObjectInfo const* goInfo = GetGameObjectInfo(itr->first);
|
||||
if (!goInfo)
|
||||
{ sLog.outErrorDb("Table `gameobject_involvedrelation` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second); }
|
||||
{ sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second); }
|
||||
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
{ sLog.outErrorDb("Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
|
||||
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureQuestRelations()
|
||||
{
|
||||
LoadQuestRelationsHelper(m_CreatureQuestRelations, "creature_questrelation");
|
||||
LoadQuestRelationsHelper(m_CreatureQuestRelations, QA_CREATURE, QR_START);
|
||||
|
||||
for (QuestRelationsMap::iterator itr = m_CreatureQuestRelations.begin(); itr != m_CreatureQuestRelations.end(); ++itr)
|
||||
{
|
||||
CreatureInfo const* cInfo = GetCreatureTemplate(itr->first);
|
||||
if (!cInfo)
|
||||
{ sLog.outErrorDb("Table `creature_questrelation` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second); }
|
||||
{ sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second); }
|
||||
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
|
||||
{ sLog.outErrorDb("Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
|
||||
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureInvolvedRelations()
|
||||
{
|
||||
LoadQuestRelationsHelper(m_CreatureQuestInvolvedRelations, "creature_involvedrelation");
|
||||
LoadQuestRelationsHelper(m_CreatureQuestInvolvedRelations, QA_CREATURE, QR_END);
|
||||
|
||||
for (QuestRelationsMap::iterator itr = m_CreatureQuestInvolvedRelations.begin(); itr != m_CreatureQuestInvolvedRelations.end(); ++itr)
|
||||
{
|
||||
CreatureInfo const* cInfo = GetCreatureTemplate(itr->first);
|
||||
if (!cInfo)
|
||||
{ sLog.outErrorDb("Table `creature_involvedrelation` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second); }
|
||||
{ sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second); }
|
||||
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
|
||||
{ sLog.outErrorDb("Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
|
||||
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1202,7 +1202,7 @@ class ObjectMgr
|
||||
private:
|
||||
void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment);
|
||||
void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr);
|
||||
void LoadQuestRelationsHelper(QuestRelationsMap& map, char const* table);
|
||||
void LoadQuestRelationsHelper(QuestRelationsMap& map, QuestActor actor, QuestRole role);
|
||||
void LoadVendors(char const* tableName, bool isTemplates);
|
||||
void LoadTrainers(char const* tableName, bool isTemplates);
|
||||
|
||||
|
@ -487,7 +487,7 @@ ChatCommand* ChatHandler::getCommandTable()
|
||||
|
||||
{ "config", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadConfigCommand, "", NULL },
|
||||
|
||||
{ "areatrigger_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestAreaTriggersCommand, "", NULL },
|
||||
{ "areatrigger_quest_end", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestAreaTriggersCommand, "", NULL },
|
||||
{ "areatrigger_tavern", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTavernCommand, "", NULL },
|
||||
{ "areatrigger_teleport", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTeleportCommand, "", NULL },
|
||||
{ "command", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCommandCommand, "", NULL },
|
||||
@ -496,9 +496,9 @@ ChatCommand* ChatHandler::getCommandTable()
|
||||
{ "creature_ai_summons", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadEventAISummonsCommand, "", NULL },
|
||||
{ "creature_ai_texts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadEventAITextsCommand, "", NULL },
|
||||
{ "creature_battleground", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadBattleEventCommand, "", NULL },
|
||||
{ "creature_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestInvRelationsCommand, "", NULL },
|
||||
{ "creature_quest_end", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestInvRelationsCommand, "", NULL },
|
||||
{ "creature_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesCreatureCommand, "", NULL },
|
||||
{ "creature_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestRelationsCommand, "", NULL },
|
||||
{ "creature_quest_start", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestRelationsCommand, "", NULL },
|
||||
{ "creature_template_classlevelstats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreaturesStatsCommand, "", NULL },
|
||||
{ "db_script_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDbScriptStringCommand, "", NULL },
|
||||
{ "dbscripts_on_creature_death", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDBScriptsOnCreatureDeathCommand, "", NULL },
|
||||
@ -513,9 +513,9 @@ ChatCommand* ChatHandler::getCommandTable()
|
||||
{ "fishing_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesFishingCommand, "", NULL },
|
||||
{ "game_graveyard_zone", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameGraveyardZoneCommand, "", NULL },
|
||||
{ "game_tele", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameTeleCommand, "", NULL },
|
||||
{ "gameobject_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestInvRelationsCommand, "", NULL },
|
||||
{ "gameobject_quest_end", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestInvRelationsCommand, "", NULL },
|
||||
{ "gameobject_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesGameobjectCommand, "", NULL },
|
||||
{ "gameobject_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestRelationsCommand, "", NULL },
|
||||
{ "gameobject_quest_start", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestRelationsCommand, "", NULL },
|
||||
{ "gameobject_battleground", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadBattleEventCommand, "", NULL },
|
||||
{ "gossip_menu", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuCommand, "", NULL },
|
||||
{ "gossip_menu_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuCommand, "", NULL },
|
||||
|
@ -163,6 +163,19 @@ enum QuestSpecialFlags
|
||||
|
||||
#define QUEST_SPECIAL_FLAG_DB_ALLOWED (QUEST_SPECIAL_FLAG_REPEATABLE | QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT)
|
||||
|
||||
enum QuestActor
|
||||
{
|
||||
QA_CREATURE = 0,
|
||||
QA_GAMEOBJECT = 1,
|
||||
QA_AREATRIGGER = 2,
|
||||
};
|
||||
|
||||
enum QuestRole
|
||||
{
|
||||
QR_START = 0,
|
||||
QR_END = 1,
|
||||
};
|
||||
|
||||
struct QuestLocale
|
||||
{
|
||||
QuestLocale() { ObjectiveText.resize(QUEST_OBJECTIVES_COUNT); }
|
||||
|
@ -37,7 +37,7 @@
|
||||
#define CHAR_DB_UPDATE_DESCRIPTION "characters_pvpstats"
|
||||
|
||||
#define WORLD_DB_VERSION_NR 21
|
||||
#define WORLD_DB_STRUCTURE_NR 10
|
||||
#define WORLD_DB_STRUCTURE_NR 11
|
||||
#define WORLD_DB_CONTENT_NR 1
|
||||
#define WORLD_DB_UPDATE_DESCRIPTION "warden_table_redone"
|
||||
#define WORLD_DB_UPDATE_DESCRIPTION "quest_relations"
|
||||
#endif // __REVISION_H__
|
||||
|
Loading…
x
Reference in New Issue
Block a user