mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 08:00:48 +01:00
Merge branch 'master' into 4.3.4
Conflicts: src/server/game/AI/CoreAI/PetAI.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Handlers/QuestHandler.cpp src/server/game/Spells/SpellEffects.cpp src/server/scripts/EasternKingdoms/stormwind_city.cpp
This commit is contained in:
@@ -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)
|
||||
@@ -293,14 +217,13 @@ void ScriptMgr::Unload()
|
||||
SCR_CLEAR(PlayerScript);
|
||||
SCR_CLEAR(GuildScript);
|
||||
SCR_CLEAR(GroupScript);
|
||||
SCR_CLEAR(UnitScript);
|
||||
|
||||
#undef SCR_CLEAR
|
||||
}
|
||||
|
||||
void ScriptMgr::LoadDatabase()
|
||||
{
|
||||
sScriptSystemMgr->LoadScriptTexts();
|
||||
sScriptSystemMgr->LoadScriptTextsCustom();
|
||||
sScriptSystemMgr->LoadScriptWaypoints();
|
||||
}
|
||||
|
||||
@@ -1416,6 +1339,22 @@ void ScriptMgr::OnGroupDisband(Group* group)
|
||||
FOREACH_SCRIPT(GroupScript)->OnDisband(group);
|
||||
}
|
||||
|
||||
// Unit
|
||||
void ScriptMgr::ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage)
|
||||
{
|
||||
FOREACH_SCRIPT(UnitScript)->ModifyPeriodicDamageAurasTick(target, attacker, damage);
|
||||
}
|
||||
|
||||
void ScriptMgr::ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage)
|
||||
{
|
||||
FOREACH_SCRIPT(UnitScript)->ModifyMeleeDamage(target, attacker, damage);
|
||||
}
|
||||
|
||||
void ScriptMgr::ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage)
|
||||
{
|
||||
FOREACH_SCRIPT(UnitScript)->ModifySpellDamageTaken(target, attacker, damage);
|
||||
}
|
||||
|
||||
SpellScriptLoader::SpellScriptLoader(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
@@ -1440,6 +1379,12 @@ FormulaScript::FormulaScript(const char* name)
|
||||
ScriptRegistry<FormulaScript>::AddScript(this);
|
||||
}
|
||||
|
||||
UnitScript::UnitScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<UnitScript>::AddScript(this);
|
||||
}
|
||||
|
||||
WorldMapScript::WorldMapScript(const char* name, uint32 mapId)
|
||||
: ScriptObject(name), MapScript<Map>(mapId)
|
||||
{
|
||||
@@ -1474,7 +1419,7 @@ ItemScript::ItemScript(const char* name)
|
||||
}
|
||||
|
||||
CreatureScript::CreatureScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
: UnitScript(name)
|
||||
{
|
||||
ScriptRegistry<CreatureScript>::AddScript(this);
|
||||
}
|
||||
@@ -1528,7 +1473,7 @@ ConditionScript::ConditionScript(const char* name)
|
||||
}
|
||||
|
||||
VehicleScript::VehicleScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
: UnitScript(name)
|
||||
{
|
||||
ScriptRegistry<VehicleScript>::AddScript(this);
|
||||
}
|
||||
@@ -1552,7 +1497,7 @@ AchievementCriteriaScript::AchievementCriteriaScript(const char* name)
|
||||
}
|
||||
|
||||
PlayerScript::PlayerScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
: UnitScript(name)
|
||||
{
|
||||
ScriptRegistry<PlayerScript>::AddScript(this);
|
||||
}
|
||||
@@ -1598,6 +1543,7 @@ template class ScriptRegistry<AchievementCriteriaScript>;
|
||||
template class ScriptRegistry<PlayerScript>;
|
||||
template class ScriptRegistry<GuildScript>;
|
||||
template class ScriptRegistry<GroupScript>;
|
||||
template class ScriptRegistry<UnitScript>;
|
||||
|
||||
// Undefine utility macros.
|
||||
#undef GET_SCRIPT_RET
|
||||
|
||||
Reference in New Issue
Block a user