aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp26
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h6
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp236
-rw-r--r--src/server/game/Globals/ObjectMgr.h33
-rw-r--r--src/server/game/Miscellaneous/Language.h4
-rw-r--r--src/server/game/Texts/CreatureTextMgr.cpp77
-rw-r--r--src/server/game/Texts/CreatureTextMgr.h3
-rw-r--r--src/server/game/World/World.cpp4
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp49
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp4
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h3
-rw-r--r--src/server/shared/Database/Implementation/WorldDatabase.cpp2
14 files changed, 334 insertions, 120 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index d2562459522..75cfbc44ea5 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -38,25 +38,29 @@
#include "MoveSplineInit.h"
#include "GameEventMgr.h"
-class TrinityStringTextBuilder
+class BroadcastTextBuilder
{
public:
- TrinityStringTextBuilder(WorldObject* obj, ChatMsg msgtype, int32 id, uint32 language, WorldObject* target)
- : _source(obj), _msgType(msgtype), _textId(id), _language(language), _target(target)
+ BroadcastTextBuilder(WorldObject const* obj, ChatMsg msgtype, uint32 id, WorldObject const* target, uint32 gender = GENDER_MALE)
+ : _source(obj), _msgType(msgtype), _textId(id), _target(target), _gender(gender)
{
}
size_t operator()(WorldPacket* data, LocaleConstant locale) const
{
- std::string text = sObjectMgr->GetTrinityString(_textId, locale);
- return ChatHandler::BuildChatPacket(*data, _msgType, Language(_language), _source, _target, text, 0, "", locale);
+ BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
+ std::string text = "";
+ if (bct)
+ ObjectMgr::GetLocaleString(_gender == GENDER_MALE ? bct->MaleText : bct->FemaleText, locale, text);
+
+ return ChatHandler::BuildChatPacket(*data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, text, 0, "", locale);
}
- WorldObject* _source;
+ WorldObject const* _source;
ChatMsg _msgType;
- int32 _textId;
- uint32 _language;
- WorldObject* _target;
+ uint32 _textId;
+ WorldObject const* _target;
+ uint32 _gender;
};
SmartScript::SmartScript()
@@ -760,7 +764,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
me->DoFleeToGetAssistance();
if (e.action.flee.withEmote)
{
- TrinityStringTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, LANG_FLEE, LANG_UNIVERSAL, NULL);
+ BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_FLEE_FOR_ASSIST, NULL, me->getGender());
sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE);
}
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow());
@@ -1003,7 +1007,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
me->CallForHelp((float)e.action.callHelp.range);
if (e.action.callHelp.withEmote)
{
- TrinityStringTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, LANG_CALL_FOR_HELP, LANG_UNIVERSAL, NULL);
+ BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_CALL_FOR_HELP, NULL, me->getGender());
sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE);
}
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature %u", me->GetGUIDLow());
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 78a26e7e836..660066b0258 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -1313,6 +1313,12 @@ enum SmartCastFlags
SMARTCAST_COMBAT_MOVE = 0x40 //Prevents combat movement if cast successful. Allows movement on range, OOM, LOS
};
+enum BroadcastTextIds
+{
+ BROADCAST_TEXT_CALL_FOR_HELP = 2541,
+ BROADCAST_TEXT_FLEE_FOR_ASSIST = 1150
+};
+
// one line in DB is one event
struct SmartScriptHolder
{
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 4bfbee62977..1dac1fff9f0 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -381,7 +381,8 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
AddLocaleString(fields[2 + 2 * (i - 1)].GetString(), locale, data.OptionText);
AddLocaleString(fields[2 + 2 * (i - 1) + 1].GetString(), locale, data.BoxText);
}
- } while (result->NextRow());
+ }
+ while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
@@ -5186,17 +5187,28 @@ void ObjectMgr::LoadGossipText()
{
uint32 oldMSTime = getMSTime();
- QueryResult result = WorldDatabase.Query("SELECT * FROM npc_text");
+ QueryResult result = WorldDatabase.Query("SELECT ID, "
+ "text0_0, text0_1, BroadcastTextID0, lang0, prob0, em0_0, em0_1, em0_2, em0_3, em0_4, em0_5, "
+ "text1_0, text1_1, BroadcastTextID1, lang1, prob1, em1_0, em1_1, em1_2, em1_3, em1_4, em1_5, "
+ "text2_0, text2_1, BroadcastTextID2, lang2, prob2, em2_0, em2_1, em2_2, em2_3, em2_4, em2_5, "
+ "text3_0, text3_1, BroadcastTextID3, lang3, prob3, em3_0, em3_1, em3_2, em3_3, em3_4, em3_5, "
+ "text4_0, text4_1, BroadcastTextID4, lang4, prob4, em4_0, em4_1, em4_2, em4_3, em4_4, em4_5, "
+ "text5_0, text5_1, BroadcastTextID5, lang5, prob5, em5_0, em5_1, em5_2, em5_3, em5_4, em5_5, "
+ "text6_0, text6_1, BroadcastTextID6, lang6, prob6, em6_0, em6_1, em6_2, em6_3, em6_4, em6_5, "
+ "text7_0, text7_1, BroadcastTextID7, lang7, prob7, em7_0, em7_1, em7_2, em7_3, em7_4, em7_5 "
+ "FROM npc_text");
+
- int count = 0;
if (!result)
{
- TC_LOG_INFO("server.loading", ">> Loaded %u npc texts", count);
+ TC_LOG_INFO("server.loading", ">> Loaded 0 npc texts, table is empty!");
return;
}
+
_gossipTextStore.rehash(result->GetRowCount());
- int cic;
+ uint32 count = 0;
+ uint8 cic;
do
{
@@ -5205,32 +5217,44 @@ void ObjectMgr::LoadGossipText()
Field* fields = result->Fetch();
- uint32 Text_ID = fields[cic++].GetUInt32();
- if (!Text_ID)
+ uint32 id = fields[cic++].GetUInt32();
+ if (!id)
{
- TC_LOG_ERROR("sql.sql", "Table `npc_text` has record wit reserved id 0, ignore.");
+ TC_LOG_ERROR("sql.sql", "Table `npc_text` has record with reserved id 0, ignore.");
continue;
}
- GossipText& gText = _gossipTextStore[Text_ID];
+ GossipText& gText = _gossipTextStore[id];
- for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; i++)
+ for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
{
gText.Options[i].Text_0 = fields[cic++].GetString();
gText.Options[i].Text_1 = fields[cic++].GetString();
-
- gText.Options[i].BroadcastTextID = fields[cic++].GetUInt32(); // Need for correct loading order
-
+ gText.Options[i].BroadcastTextID = fields[cic++].GetUInt32();
gText.Options[i].Language = fields[cic++].GetUInt8();
gText.Options[i].Probability = fields[cic++].GetFloat();
- for (uint8 j=0; j < MAX_GOSSIP_TEXT_EMOTES; ++j)
+ for (uint8 j = 0; j < MAX_GOSSIP_TEXT_EMOTES; ++j)
{
- gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt16();
- gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt16();
+ gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt16();
+ gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt16();
}
}
- } while (result->NextRow());
+
+ for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; i++)
+ {
+ if (gText.Options[i].BroadcastTextID)
+ {
+ if (!sObjectMgr->GetBroadcastText(gText.Options[i].BroadcastTextID))
+ {
+ TC_LOG_ERROR("sql.sql", "GossipText (Id: %u) in table `npc_text` has non-existing or incompatible BroadcastTextID%u %u.", id, i, gText.Options[i].BroadcastTextID);
+ gText.Options[i].BroadcastTextID = 0;
+ }
+ }
+ }
+
+ }
+ while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -8279,8 +8303,8 @@ void ObjectMgr::LoadGossipMenuItems()
_gossipMenuItemsStore.clear();
QueryResult result = WorldDatabase.Query(
- // 0 1 2 3 4 5 6 7 8 9 10
- "SELECT menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, action_menu_id, action_poi_id, box_coded, box_money, box_text "
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12
+ "SELECT menu_id, id, option_icon, option_text, OptionBroadcastTextID, option_id, npc_option_npcflag, action_menu_id, action_poi_id, box_coded, box_money, box_text, BoxBroadcastTextID "
"FROM gossip_menu_option ORDER BY menu_id, id");
if (!result)
@@ -8301,29 +8325,49 @@ void ObjectMgr::LoadGossipMenuItems()
gMenuItem.OptionIndex = fields[1].GetUInt16();
gMenuItem.OptionIcon = fields[2].GetUInt32();
gMenuItem.OptionText = fields[3].GetString();
- gMenuItem.OptionType = fields[4].GetUInt8();
- gMenuItem.OptionNpcflag = fields[5].GetUInt32();
- gMenuItem.ActionMenuId = fields[6].GetUInt32();
- gMenuItem.ActionPoiId = fields[7].GetUInt32();
- gMenuItem.BoxCoded = fields[8].GetBool();
- gMenuItem.BoxMoney = fields[9].GetUInt32();
- gMenuItem.BoxText = fields[10].GetString();
+ gMenuItem.OptionBroadcastTextId = fields[4].GetUInt32();
+ gMenuItem.OptionType = fields[5].GetUInt8();
+ gMenuItem.OptionNpcflag = fields[6].GetUInt32();
+ gMenuItem.ActionMenuId = fields[7].GetUInt32();
+ gMenuItem.ActionPoiId = fields[8].GetUInt32();
+ gMenuItem.BoxCoded = fields[9].GetBool();
+ gMenuItem.BoxMoney = fields[10].GetUInt32();
+ gMenuItem.BoxText = fields[11].GetString();
+ gMenuItem.BoxBroadcastTextId = fields[12].GetUInt32();
if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX)
{
- TC_LOG_ERROR("sql.sql", "Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon);
+ TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon);
gMenuItem.OptionIcon = GOSSIP_ICON_CHAT;
}
+ if (gMenuItem.OptionBroadcastTextId)
+ {
+ if (!GetBroadcastText(gMenuItem.OptionBroadcastTextId))
+ {
+ TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible OptionBroadcastTextId %u, ignoring.", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionBroadcastTextId);
+ gMenuItem.OptionBroadcastTextId = 0;
+ }
+ }
+
if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX)
- TC_LOG_ERROR("sql.sql", "Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType);
+ TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType);
if (gMenuItem.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId))
{
- TC_LOG_ERROR("sql.sql", "Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId);
+ TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId);
gMenuItem.ActionPoiId = 0;
}
+ if (gMenuItem.BoxBroadcastTextId)
+ {
+ if (!GetBroadcastText(gMenuItem.BoxBroadcastTextId))
+ {
+ TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible BoxBroadcastTextId %u, ignoring.", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.BoxBroadcastTextId);
+ gMenuItem.BoxBroadcastTextId = 0;
+ }
+ }
+
_gossipMenuItemsStore.insert(GossipMenuItemsContainer::value_type(gMenuItem.MenuId, gMenuItem));
++count;
}
@@ -8553,6 +8597,140 @@ void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids)
}
}
+void ObjectMgr::LoadBroadcastTexts()
+{
+ uint32 oldMSTime = getMSTime();
+
+ _broadcastTextStore.clear(); // for reload case
+
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12
+ QueryResult result = WorldDatabase.Query("SELECT ID, Language, MaleText, FemaleText, EmoteID0, EmoteID1, EmoteID2, EmoteDelay0, EmoteDelay1, EmoteDelay2, SoundId, Unk1, Unk2 FROM broadcast_text");
+ if (!result)
+ {
+ TC_LOG_INFO("server.loading", ">> Loaded 0 broadcast texts. DB table `broadcast_text` is empty.");
+ return;
+ }
+
+ uint32 count = 0;
+
+ do
+ {
+ Field* fields = result->Fetch();
+
+ BroadcastText bct;
+
+ bct.Id = fields[0].GetUInt32();
+ bct.Language = fields[1].GetUInt32();
+ AddLocaleString(fields[2].GetString(), DEFAULT_LOCALE, bct.MaleText);
+ AddLocaleString(fields[3].GetString(), DEFAULT_LOCALE, bct.FemaleText);
+ bct.EmoteId0 = fields[4].GetUInt32();
+ bct.EmoteId1 = fields[5].GetUInt32();
+ bct.EmoteId2 = fields[6].GetUInt32();
+ bct.EmoteDelay0 = fields[7].GetUInt32();
+ bct.EmoteDelay1 = fields[8].GetUInt32();
+ bct.EmoteDelay2 = fields[9].GetUInt32();
+ bct.SoundId = fields[10].GetUInt32();
+ bct.Unk1 = fields[11].GetUInt32();
+ bct.Unk2 = fields[12].GetUInt32();
+
+ if (bct.SoundId)
+ {
+ if (!sSoundEntriesStore.LookupEntry(bct.SoundId))
+ {
+ TC_LOG_INFO("sql.sql", "BroadcastText (Id: %u) in table `broadcast_text` has SoundId %u but sound does not exist. Skipped.", bct.Id, bct.SoundId);
+ // don't load bct of higher expansions
+ continue;
+ }
+ }
+
+ if (!GetLanguageDescByID(bct.Language))
+ {
+ TC_LOG_INFO("sql.sql", "BroadcastText (Id: %u) in table `broadcast_text` using Language %u but Language does not exist. Skipped.", bct.Id, bct.Language);
+ // don't load bct of higher expansions
+ continue;
+ }
+
+ if (bct.EmoteId0)
+ {
+ if (!sEmotesStore.LookupEntry(bct.EmoteId0))
+ {
+ TC_LOG_INFO("sql.sql", "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId0 %u but emote does not exist. Skipped.", bct.Id, bct.EmoteId0);
+ // don't load bct of higher expansions
+ continue;
+ }
+ }
+
+ if (bct.EmoteId1)
+ {
+ if (!sEmotesStore.LookupEntry(bct.EmoteId1))
+ {
+ TC_LOG_INFO("sql.sql", "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId1 %u but emote does not exist. Skipped.", bct.Id, bct.EmoteId1);
+ // don't load bct of higher expansions
+ continue;
+ }
+ }
+
+ if (bct.EmoteId2)
+ {
+ if (!sEmotesStore.LookupEntry(bct.EmoteId2))
+ {
+ TC_LOG_INFO("sql.sql", "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId2 %u but emote does not exist. Skipped.", bct.Id, bct.EmoteId2);
+ // don't load bct of higher expansions
+ continue;
+ }
+ }
+
+ _broadcastTextStore[bct.Id] = bct;
+
+ ++count;
+ }
+ while (result->NextRow());
+
+ TC_LOG_INFO("server.loading", ">> Loaded %u broadcast texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+}
+
+void ObjectMgr::LoadBroadcastTextLocales()
+{
+ uint32 oldMSTime = getMSTime();
+
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+ QueryResult result = WorldDatabase.Query("SELECT Id, MaleText_loc1, MaleText_loc2, MaleText_loc3, MaleText_loc4, MaleText_loc5, MaleText_loc6, MaleText_loc7, MaleText_loc8, FemaleText_loc1, FemaleText_loc2, FemaleText_loc3, FemaleText_loc4, FemaleText_loc5, FemaleText_loc6, FemaleText_loc7, FemaleText_loc8 FROM locales_broadcast_text");
+
+ if (!result)
+ {
+ TC_LOG_INFO("server.loading", ">> Loaded 0 broadcast text locales. DB table `locales_broadcast_text` is empty.");
+ return;
+ }
+
+ uint32 count = 0;
+
+ do
+ {
+ Field* fields = result->Fetch();
+
+ uint32 id = fields[0].GetUInt32();
+ BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id);
+ if (bct == _broadcastTextStore.end())
+ {
+ TC_LOG_INFO("sql.sql", "BroadcastText (Id: %u) in table `locales_broadcast_text` does not exist or is incompatible. Skipped!", id);
+ // don't load bct of higher expansions
+ continue;
+ }
+
+ for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
+ {
+ LocaleConstant locale = LocaleConstant(i);
+ ObjectMgr::AddLocaleString(fields[1 + (i - 1)].GetString(), locale, bct->second.MaleText);
+ ObjectMgr::AddLocaleString(fields[9 + (i - 1)].GetString(), locale, bct->second.FemaleText);
+ }
+
+ ++count;
+ }
+ while (result->NextRow());
+
+ TC_LOG_INFO("server.loading", ">> Loaded %u broadcast text locales in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+}
+
void ObjectMgr::LoadDbScriptStrings()
{
LoadTrinityStrings("db_script_string", MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID);
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index bddf73408fa..eba9483cf36 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -411,6 +411,26 @@ struct AreaTriggerStruct
float target_Orientation;
};
+struct BroadcastText
+{
+ uint32 Id;
+ uint32 Language;
+ StringVector MaleText;
+ StringVector FemaleText;
+ uint32 EmoteId0;
+ uint32 EmoteId1;
+ uint32 EmoteId2;
+ uint32 EmoteDelay0;
+ uint32 EmoteDelay1;
+ uint32 EmoteDelay2;
+ uint32 SoundId;
+ uint32 Unk1;
+ uint32 Unk2;
+ // uint32 WDBVerified;
+};
+
+typedef UNORDERED_MAP<uint32, BroadcastText> BroadcastTextContainer;
+
typedef std::set<uint32> CellGuidSet;
typedef std::map<uint32/*player guid*/, uint32/*instance*/> CellCorpseSet;
struct CellObjectGuids
@@ -527,6 +547,7 @@ struct GossipMenuItems
uint32 OptionIndex;
uint8 OptionIcon;
std::string OptionText;
+ uint32 OptionBroadcastTextId;
uint32 OptionType;
uint32 OptionNpcflag;
uint32 ActionMenuId;
@@ -534,6 +555,7 @@ struct GossipMenuItems
bool BoxCoded;
uint32 BoxMoney;
std::string BoxText;
+ uint32 BoxBroadcastTextId;
ConditionList Conditions;
};
@@ -901,6 +923,8 @@ class ObjectMgr
void LoadSpellScriptNames();
void ValidateSpellScripts();
+ void LoadBroadcastTexts();
+ void LoadBroadcastTextLocales();
bool LoadTrinityStrings(char const* table, int32 min_value, int32 max_value);
bool LoadTrinityStrings() { return LoadTrinityStrings("trinity_string", MIN_TRINITY_STRING_ID, MAX_TRINITY_STRING_ID); }
void LoadDbScriptStrings();
@@ -1046,6 +1070,14 @@ class ObjectMgr
return NULL;
}
+ BroadcastText const* GetBroadcastText(uint32 id) const
+ {
+ BroadcastTextContainer::const_iterator itr = _broadcastTextStore.find(id);
+ if (itr != _broadcastTextStore.end())
+ return &itr->second;
+ return NULL;
+ }
+
CreatureData const* GetCreatureData(uint32 guid) const
{
CreatureDataContainer::const_iterator itr = _creatureDataStore.find(guid);
@@ -1384,6 +1416,7 @@ class ObjectMgr
/// Stores temp summon data grouped by summoner's entry, summoner's type and group id
TempSummonDataContainer _tempSummonDataStore;
+ BroadcastTextContainer _broadcastTextStore;
ItemTemplateContainer _itemTemplateStore;
ItemLocaleContainer _itemLocaleStore;
QuestLocaleContainer _questLocaleStore;
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index 2e4d831288a..6740cd13d6c 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -1082,12 +1082,12 @@ enum TrinityStrings
LANG_GOINFO_NAME = 5027,
LANG_GOINFO_LOOTID = 5028,
LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029,
- LANG_FLEE = 5030,
+ // unused = 5030,
LANG_NPCINFO_AIINFO = 5031,
LANG_COMMAND_NO_BATTLEGROUND_FOUND = 5032,
LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033,
LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034,
- LANG_CALL_FOR_HELP = 5035,
+ // unused = 5035,
LANG_NPCINFO_EQUIPMENT = 5036,
LANG_NPCINFO_MECHANIC_IMMUNE = 5037,
LANG_NPCINFO_UNIT_FIELD_FLAGS = 5038,
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index 7d7e9eb7c21..f048c0fe527 100644
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -28,7 +28,7 @@
class CreatureTextBuilder
{
public:
- CreatureTextBuilder(WorldObject* obj, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
+ CreatureTextBuilder(WorldObject const* obj, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
: _source(obj), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target)
{
}
@@ -40,7 +40,7 @@ class CreatureTextBuilder
return ChatHandler::BuildChatPacket(*data, _msgType, Language(_language), _source, _target, text, 0, "", locale);
}
- WorldObject* _source;
+ WorldObject const* _source;
ChatMsg _msgType;
uint8 _textGroup;
uint32 _textId;
@@ -51,7 +51,7 @@ class CreatureTextBuilder
class PlayerTextBuilder
{
public:
- PlayerTextBuilder(WorldObject* obj, WorldObject* speaker, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
+ PlayerTextBuilder(WorldObject const* obj, WorldObject const* speaker, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
: _source(obj), _talker(speaker), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target)
{
}
@@ -63,8 +63,8 @@ class PlayerTextBuilder
return ChatHandler::BuildChatPacket(*data, _msgType, Language(_language), _talker, _target, text, 0, "", locale);
}
- WorldObject* _source;
- WorldObject* _talker;
+ WorldObject const* _source;
+ WorldObject const* _talker;
ChatMsg _msgType;
uint8 _textGroup;
uint32 _textId;
@@ -97,34 +97,39 @@ void CreatureTextMgr::LoadCreatureTexts()
Field* fields = result->Fetch();
CreatureTextEntry temp;
- temp.entry = fields[0].GetUInt32();
- temp.group = fields[1].GetUInt8();
- temp.id = fields[2].GetUInt8();
- temp.text = fields[3].GetString();
- temp.type = ChatMsg(fields[4].GetUInt8());
- temp.lang = Language(fields[5].GetUInt8());
- temp.probability = fields[6].GetFloat();
- temp.emote = Emote(fields[7].GetUInt32());
- temp.duration = fields[8].GetUInt32();
- temp.sound = fields[9].GetUInt32();
+ temp.entry = fields[0].GetUInt32();
+ temp.group = fields[1].GetUInt8();
+ temp.id = fields[2].GetUInt8();
+ temp.text = fields[3].GetString();
+ temp.type = ChatMsg(fields[4].GetUInt8());
+ temp.lang = Language(fields[5].GetUInt8());
+ temp.probability = fields[6].GetFloat();
+ temp.emote = Emote(fields[7].GetUInt32());
+ temp.duration = fields[8].GetUInt32();
+ temp.sound = fields[9].GetUInt32();
+ temp.BroadcastTextId = fields[10].GetUInt32();
if (temp.sound)
{
- if (!sSoundEntriesStore.LookupEntry(temp.sound)){
+ if (!sSoundEntriesStore.LookupEntry(temp.sound))
+ {
TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
temp.sound = 0;
}
}
+
if (!GetLanguageDescByID(temp.lang))
{
TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
temp.lang = LANG_UNIVERSAL;
}
+
if (temp.type >= MAX_CHAT_MSG_TYPE)
{
TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
temp.type = CHAT_MSG_SAY;
}
+
if (temp.emote)
{
if (!sEmotesStore.LookupEntry(temp.emote))
@@ -133,18 +138,28 @@ void CreatureTextMgr::LoadCreatureTexts()
temp.emote = EMOTE_ONESHOT_NONE;
}
}
- //entry not yet added, add empty TextHolder (list of groups)
+
+ if (temp.BroadcastTextId)
+ {
+ if (!sObjectMgr->GetBroadcastText(temp.BroadcastTextId))
+ {
+ TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_texts` has non-existing or incompatible BroadcastTextId %u.", temp.entry, temp.group, temp.id, temp.BroadcastTextId);
+ temp.BroadcastTextId = 0;
+ }
+ }
+
+ // entry not yet added, add empty TextHolder (list of groups)
if (mTextMap.find(temp.entry) == mTextMap.end())
++creatureCount;
- //add the text into our entry's group
+ // add the text into our entry's group
mTextMap[temp.entry][temp.group].push_back(temp);
++textCount;
- } while (result->NextRow());
+ }
+ while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
-
}
void CreatureTextMgr::LoadCreatureTextLocales()
@@ -316,14 +331,12 @@ void CreatureTextMgr::SendSound(Creature* source, uint32 sound, ChatMsg msgType,
void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, ChatMsg msgType, WorldObject const* whisperTarget, CreatureTextRange range, Team team, bool gmOnly) const
{
- float dist = GetRangeForChatType(msgType);
-
switch (msgType)
{
case CHAT_MSG_MONSTER_WHISPER:
case CHAT_MSG_RAID_BOSS_WHISPER:
{
- if (range == TEXT_RANGE_NORMAL)//ignores team and gmOnly
+ if (range == TEXT_RANGE_NORMAL) // ignores team and gmOnly
{
if (!whisperTarget || whisperTarget->GetTypeId() != TYPEID_PLAYER)
return;
@@ -379,6 +392,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data,
break;
}
+ float dist = GetRangeForChatType(msgType);
source->SendMessageToSetInRange(data, dist, true);
}
@@ -458,18 +472,17 @@ std::string CreatureTextMgr::GetLocalizedChatString(uint32 entry, uint8 textGrou
if (groupItr == holderItr->second.end())
return "";
- std::string baseText = groupItr->text;
- if (locale == DEFAULT_LOCALE)
- return baseText;
-
if (locale > MAX_LOCALES)
- return baseText;
+ locale = DEFAULT_LOCALE;
- LocaleCreatureTextMap::const_iterator locItr = mLocaleTextMap.find(CreatureTextId(entry, uint32(textGroup), id));
- if (locItr == mLocaleTextMap.end())
- return baseText;
+ std::string baseText = groupItr->text;
- ObjectMgr::GetLocaleString(locItr->second.Text, locale, baseText);
+ if (locale != DEFAULT_LOCALE)
+ {
+ LocaleCreatureTextMap::const_iterator locItr = mLocaleTextMap.find(CreatureTextId(entry, uint32(textGroup), id));
+ if (locItr != mLocaleTextMap.end())
+ ObjectMgr::GetLocaleString(locItr->second.Text, locale, baseText);
+ }
return baseText;
}
diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h
index 6ef983e18e5..99c31b0829d 100644
--- a/src/server/game/Texts/CreatureTextMgr.h
+++ b/src/server/game/Texts/CreatureTextMgr.h
@@ -36,6 +36,7 @@ struct CreatureTextEntry
Emote emote;
uint32 duration;
uint32 sound;
+ uint32 BroadcastTextId;
};
enum CreatureTextRange
@@ -186,7 +187,7 @@ void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder
case CHAT_MSG_MONSTER_WHISPER:
case CHAT_MSG_RAID_BOSS_WHISPER:
{
- if (range == TEXT_RANGE_NORMAL) //ignores team and gmOnly
+ if (range == TEXT_RANGE_NORMAL) // ignores team and gmOnly
{
if (!whisperTarget || whisperTarget->GetTypeId() != TYPEID_PLAYER)
return;
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 9c4b5bce621..a5725676571 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1398,6 +1398,10 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading instances...");
sInstanceSaveMgr->LoadInstances();
+ TC_LOG_INFO("server.loading", "Loading Broadcast texts...");
+ sObjectMgr->LoadBroadcastTexts();
+ sObjectMgr->LoadBroadcastTextLocales();
+
TC_LOG_INFO("server.loading", "Loading Localization strings...");
uint32 oldMSTime = getMSTime();
sObjectMgr->LoadCreatureLocales();
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 369a8e87289..51eea4c2c6f 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -91,13 +91,8 @@ public:
// ok, normal (creature/GO starting) quest
if (player->CanAddQuest(quest, true))
- {
player->AddQuestAndCheckCompletion(quest, NULL);
- if (player->CanCompleteQuest(entry))
- player->CompleteQuest(entry);
- }
-
return true;
}
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index 2b50c525f78..7d80d0c20b7 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -24,17 +24,13 @@ Script Data End */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
-#include "ScriptedGossip.h"
-#include "gnomeregan.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "Player.h"
-
-#define GOSSIP_START_EVENT "I am ready to being"
+#include "gnomeregan.h"
enum BlastmasterEmi
{
- GOSSIP_TEXT_EMI = 1693,
-
SAY_BLASTMASTER_0 = 0,
SAY_BLASTMASTER_1 = 1,
SAY_BLASTMASTER_2 = 2,
@@ -93,34 +89,6 @@ public:
return GetInstanceAI<npc_blastmaster_emi_shortfuseAI>(creature);
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
- {
- player->PlayerTalkClass->ClearMenus();
- if (action == GOSSIP_ACTION_INFO_DEF+1)
- {
- if (npc_escortAI* pEscortAI = CAST_AI(npc_blastmaster_emi_shortfuse::npc_blastmaster_emi_shortfuseAI, creature->AI()))
- pEscortAI->Start(true, false, player->GetGUID());
-
- creature->setFaction(player->getFaction());
- creature->AI()->SetData(1, 0);
-
- player->CLOSE_GOSSIP_MENU();
- }
- return true;
- }
-
- bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
- {
- InstanceScript* instance = creature->GetInstanceScript();
-
- if (instance && instance->GetData(TYPE_EVENT) == NOT_STARTED)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
-
- player->SEND_GOSSIP_MENU(GOSSIP_TEXT_EMI, creature->GetGUID());
-
- return true;
- }
-
struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
{
npc_blastmaster_emi_shortfuseAI(Creature* creature) : npc_escortAI(creature)
@@ -152,6 +120,19 @@ public:
}
}
+ void sGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) OVERRIDE
+ {
+ if (gossipListId == 0)
+ {
+ Start(true, false, player->GetGUID());
+
+ me->setFaction(player->getFaction());
+ SetData(1, 0);
+
+ player->PlayerTalkClass->SendCloseGossip();
+ }
+ }
+
void NextStep(uint32 uiTimerStep, bool bNextStep = true, uint8 uiPhaseStep = 0)
{
uiTimer = uiTimerStep;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
index c0e49fa43fb..9e02bb9bcf6 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
@@ -586,7 +586,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case 5060:
case 5070:
case 5080:
- return NPC_LICH_KING_1;
+ return NPC_LICH_KING;
break;
case 120:
case 122:
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
index fdefde10b4f..6e835345d8b 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
@@ -275,7 +275,7 @@ class boss_lich_king_toc : public CreatureScript
if (!_instance)
return;
- if (_instance->GetData(TYPE_EVENT_NPC) != NPC_LICH_KING_1)
+ if (_instance->GetData(TYPE_EVENT_NPC) != NPC_LICH_KING)
return;
_updateTimer = _instance->GetData(TYPE_EVENT_TIMER);
@@ -764,7 +764,7 @@ class npc_tirion_toc : public CreatureScript
case 5005:
_updateTimer = 8*IN_MILLISECONDS;
_instance->SetData(TYPE_EVENT, 5010);
- me->SummonCreature(NPC_LICH_KING_1, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5);
+ me->SummonCreature(NPC_LICH_KING, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5);
break;
case 5020:
Talk(SAY_STAGE_4_03);
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
index 17e4f2869c6..562105c0866 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
@@ -184,8 +184,7 @@ enum CreatureIds
NPC_FIZZLEBANG = 35458,
NPC_GARROSH = 34995,
NPC_VARIAN = 34990,
- NPC_LICH_KING_0 = 16980,
- NPC_LICH_KING_1 = 35877,
+ NPC_LICH_KING = 35877,
NPC_THRALL = 34994,
NPC_PROUDMOORE = 34992,
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index f64ad558e74..1a9c9869bac 100644
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -25,7 +25,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_SEL_QUEST_POOLS, "SELECT entry, pool_entry FROM pool_quest", CONNECTION_SYNCH);
PrepareStatement(WORLD_DEL_CRELINKED_RESPAWN, "DELETE FROM linked_respawn WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_REP_CREATURE_LINKED_RESPAWN, "REPLACE INTO linked_respawn (guid, linkedGuid) VALUES (?, ?)", CONNECTION_ASYNC);
- PrepareStatement(WORLD_SEL_CREATURE_TEXT, "SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound FROM creature_text", CONNECTION_SYNCH);
+ PrepareStatement(WORLD_SEL_CREATURE_TEXT, "SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound, BroadcastTextID FROM creature_text", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_SMART_SCRIPTS, "SELECT entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o FROM smart_scripts ORDER BY entryorguid, source_type, id, link", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_SMARTAI_WP, "SELECT entry, pointid, position_x, position_y, position_z FROM waypoints ORDER BY entry, pointid", CONNECTION_SYNCH);
PrepareStatement(WORLD_DEL_GAMEOBJECT, "DELETE FROM gameobject WHERE guid = ?", CONNECTION_ASYNC);