aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/ScriptMgr.cpp
diff options
context:
space:
mode:
authorkaelima <kaelima@live.se>2012-12-21 00:00:16 +0100
committerkaelima <kaelima@live.se>2012-12-21 00:00:16 +0100
commit0a88787dfc747437b6278a044a425b6483e61b37 (patch)
tree65942c84524890446a79ef67fd1ea2ce622a8544 /src/server/game/Scripting/ScriptMgr.cpp
parent8f27dfda627903997b67cab9ebb4c5b365da201e (diff)
parent4116ba75e3bef999c3111943c3b389ffc195b686 (diff)
Merge git://github.com/TrinityCore/TrinityCore into mmaps
Conflicts: src/server/game/Entities/Vehicle/Vehicle.cpp src/server/game/Movement/MovementGenerator.h src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp src/server/game/Movement/MovementGenerators/PointMovementGenerator.h src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h src/server/game/Movement/Spline/MoveSpline.h
Diffstat (limited to 'src/server/game/Scripting/ScriptMgr.cpp')
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/ScriptMgr.cpp107
1 files changed, 27 insertions, 80 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 6682d3c11e3..401b0e1728b 100755..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)
@@ -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,13 @@ FormulaScript::FormulaScript(const char* name)
ScriptRegistry<FormulaScript>::AddScript(this);
}
+UnitScript::UnitScript(const char* name, bool addToScripts)
+ : ScriptObject(name)
+{
+ if (addToScripts)
+ ScriptRegistry<UnitScript>::AddScript(this);
+}
+
WorldMapScript::WorldMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<Map>(mapId)
{
@@ -1474,7 +1420,7 @@ ItemScript::ItemScript(const char* name)
}
CreatureScript::CreatureScript(const char* name)
- : ScriptObject(name)
+ : UnitScript(name, false)
{
ScriptRegistry<CreatureScript>::AddScript(this);
}
@@ -1552,7 +1498,7 @@ AchievementCriteriaScript::AchievementCriteriaScript(const char* name)
}
PlayerScript::PlayerScript(const char* name)
- : ScriptObject(name)
+ : UnitScript(name, false)
{
ScriptRegistry<PlayerScript>::AddScript(this);
}
@@ -1598,6 +1544,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