diff options
-rw-r--r-- | sql/updates/world/2012_12_07_00_world_script_texts.sql | 2 | ||||
-rw-r--r-- | src/server/game/AI/CoreAI/UnitAI.h | 11 | ||||
-rw-r--r-- | src/server/game/Scripting/ScriptMgr.cpp | 78 | ||||
-rw-r--r-- | src/server/game/Scripting/ScriptMgr.h | 2 | ||||
-rw-r--r-- | src/server/game/Scripting/ScriptSystem.cpp | 122 | ||||
-rw-r--r-- | src/server/game/Scripting/ScriptSystem.h | 24 |
6 files changed, 2 insertions, 237 deletions
diff --git a/sql/updates/world/2012_12_07_00_world_script_texts.sql b/sql/updates/world/2012_12_07_00_world_script_texts.sql new file mode 100644 index 00000000000..b1362aac796 --- /dev/null +++ b/sql/updates/world/2012_12_07_00_world_script_texts.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS `script_texts`; +DROP TABLE IF EXISTS `custom_texts`; diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 2eab0e89fcd..8b31bb5c54d 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -29,17 +29,6 @@ class Quest; class Unit; struct AISpellInfoType; -// Default script texts -enum GeneralScriptTexts -{ - DEFAULT_TEXT = -1000000, - EMOTE_GENERIC_FRENZY_KILL = -1000001, - EMOTE_GENERIC_FRENZY = -1000002, - EMOTE_GENERIC_ENRAGED = -1000003, - EMOTE_GENERIC_BERSERK = -1000004, - EMOTE_GENERIC_BERSERK_RAID = -1000005 // RaidBossEmote version of the previous one -}; - //Selection method used by SelectTarget enum SelectAggroTarget { diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 6682d3c11e3..216eee949f6 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -160,83 +160,7 @@ class ScriptRegistry if (!V) \ return R; -void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target) -{ - if (!pSource) - { - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i, invalid Source pointer.", iTextEntry); - return; - } - - if (iTextEntry >= 0) - { - sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); - return; - } - const StringTextData* pData = sScriptSystemMgr->GetTextData(iTextEntry); - - if (!pData) - { - sLog->outError(LOG_FILTER_TSCR, "DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); - return; - } - - sLog->outDebug(LOG_FILTER_TSCR, "DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote); - - if (pData->uiSoundId) - { - if (sSoundEntriesStore.LookupEntry(pData->uiSoundId)) - pSource->SendPlaySound(pData->uiSoundId, false); - else - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); - } - - if (pData->uiEmote) - { - if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) - ((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote); - else - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId()); - } - - switch (pData->uiType) - { - case CHAT_TYPE_SAY: - pSource->MonsterSay(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0); - break; - case CHAT_TYPE_YELL: - pSource->MonsterYell(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0); - break; - case CHAT_TYPE_TEXT_EMOTE: - pSource->MonsterTextEmote(iTextEntry, target ? target->GetGUID() : 0); - break; - case CHAT_TYPE_BOSS_EMOTE: - pSource->MonsterTextEmote(iTextEntry, target ? target->GetGUID() : 0, true); - break; - case CHAT_TYPE_WHISPER: - { - if (target && target->GetTypeId() == TYPEID_PLAYER) - pSource->MonsterWhisper(iTextEntry, target->GetGUID()); - else - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); - - break; - } - case CHAT_TYPE_BOSS_WHISPER: - { - if (target && target->GetTypeId() == TYPEID_PLAYER) - pSource->MonsterWhisper(iTextEntry, target->GetGUID(), true); - else - sLog->outError(LOG_FILTER_TSCR, "DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); - - break; - } - case CHAT_TYPE_ZONE_YELL: - pSource->MonsterYellToZone(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0); - break; - } -} ScriptMgr::ScriptMgr() : _scriptCount(0), _scheduledScripts(0) @@ -299,8 +223,6 @@ void ScriptMgr::Unload() void ScriptMgr::LoadDatabase() { - sScriptSystemMgr->LoadScriptTexts(); - sScriptSystemMgr->LoadScriptTextsCustom(); sScriptSystemMgr->LoadScriptWaypoints(); } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 947be2b73fe..df5af95ac30 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -69,8 +69,6 @@ struct OutdoorPvPData; #define VISIBLE_RANGE 166.0f //MAX visible range (size of grid) -// Generic scripting text function. -void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL); /* TODO: Add more script type classes. diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index 41b41b91808..ea1cf6b1994 100644 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -23,128 +23,6 @@ ScriptPointVector const SystemMgr::_empty; -void SystemMgr::LoadScriptTexts() -{ - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts..."); - LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2)); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts additional data..."); - uint32 oldMSTime = getMSTime(); - - // 0 1 2 3 - QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts"); - - if (!result) - { - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); - return; - } - - uint32 uiCount = 0; - - do - { - Field* pFields = result->Fetch(); - StringTextData temp; - - int32 iId = pFields[0].GetInt32(); - temp.uiSoundId = pFields[1].GetUInt32(); - temp.uiType = pFields[2].GetUInt8(); - temp.uiLanguage = pFields[3].GetUInt8(); - temp.uiEmote = pFields[4].GetUInt16(); - - if (iId >= 0) - { - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is not a negative value.", iId); - continue; - } - - if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2) - { - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId); - continue; - } - - if (temp.uiSoundId) - { - if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); - } - - if (!GetLanguageDescByID(temp.uiLanguage)) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage); - - if (temp.uiType > CHAT_TYPE_ZONE_YELL) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType); - - m_mTextDataMap[iId] = temp; - ++uiCount; - } - while (result->NextRow()); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); -} - -void SystemMgr::LoadScriptTextsCustom() -{ - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts..."); - LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3)); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts additional data..."); - - QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts"); - - if (!result) - { - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); - return; - } - - uint32 uiCount = 0; - - do - { - Field* pFields = result->Fetch(); - StringTextData temp; - - int32 iId = pFields[0].GetInt32(); - temp.uiSoundId = pFields[1].GetUInt32(); - temp.uiType = pFields[2].GetUInt8(); - temp.uiLanguage = pFields[3].GetUInt8(); - temp.uiEmote = pFields[4].GetUInt16(); - - if (iId >= 0) - { - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is not a negative value.", iId); - continue; - } - - if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3) - { - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId); - continue; - } - - if (temp.uiSoundId) - { - if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); - } - - if (!GetLanguageDescByID(temp.uiLanguage)) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage); - - if (temp.uiType > CHAT_TYPE_ZONE_YELL) - sLog->outError(LOG_FILTER_SQL, "TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType); - - m_mTextDataMap[iId] = temp; - ++uiCount; - } - while (result->NextRow()); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Custom Texts data.", uiCount); -} - void SystemMgr::LoadScriptWaypoints() { uint32 oldMSTime = getMSTime(); diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h index 4211a63b043..cc65d493f3e 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.h @@ -46,14 +46,6 @@ struct ScriptPointMove typedef std::vector<ScriptPointMove> ScriptPointVector; -struct StringTextData -{ - uint32 uiSoundId; - uint8 uiType; - uint32 uiLanguage; - uint32 uiEmote; -}; - class SystemMgr { friend class ACE_Singleton<SystemMgr, ACE_Null_Mutex>; @@ -61,26 +53,11 @@ class SystemMgr ~SystemMgr() {} public: - //Maps and lists - typedef UNORDERED_MAP<int32, StringTextData> TextDataMap; typedef UNORDERED_MAP<uint32, ScriptPointVector> PointMoveMap; //Database - void LoadScriptTexts(); - void LoadScriptTextsCustom(); void LoadScriptWaypoints(); - //Retrive from storage - StringTextData const* GetTextData(int32 textId) const - { - TextDataMap::const_iterator itr = m_mTextDataMap.find(textId); - - if (itr == m_mTextDataMap.end()) - return NULL; - - return &itr->second; - } - ScriptPointVector const& GetPointMoveList(uint32 creatureEntry) const { PointMoveMap::const_iterator itr = m_mPointMoveMap.find(creatureEntry); @@ -92,7 +69,6 @@ class SystemMgr } protected: - TextDataMap m_mTextDataMap; //additional data for text strings PointMoveMap m_mPointMoveMap; //coordinates for waypoints private: |