diff options
| author | Shauren <shauren.trinity@gmail.com> | 2018-09-15 17:55:26 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2018-09-15 17:55:26 +0200 |
| commit | 738f37d3cf45d4e10eda9d44a4cb17079b7bbc1b (patch) | |
| tree | 9db45160ed8a0c68090dec2aebb9b73c9f2ea335 /src/server/game/AI | |
| parent | 0f3156d324ff8134171bada01b40f5c23f5c43cc (diff) | |
Core/Maps: Replaced spawnmask with difficulty list
Diffstat (limited to 'src/server/game/AI')
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 32 |
2 files changed, 27 insertions, 7 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index f937c32c0a3..458a4b28c84 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -128,7 +128,7 @@ ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature), _isCombatMovementAllowed(true) { _isHeroic = me->GetMap()->IsHeroic(); - _difficulty = Difficulty(me->GetMap()->GetSpawnMode()); + _difficulty = me->GetMap()->GetDifficultyID(); } void ScriptedAI::AttackStartNoMove(Unit* who) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 83e5d00ec63..79af3ea66b9 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -3871,9 +3871,29 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEn { if (obj && obj->GetMap()->IsDungeon()) { - if ((1 << (obj->GetMap()->GetSpawnMode()+1)) & (*i).event.event_flags) + // TODO: fix it for new maps and difficulties + switch (obj->GetMap()->GetDifficultyID()) { - mEvents.push_back((*i)); + case DIFFICULTY_NORMAL: + case DIFFICULTY_10_N: + if (i->event.event_flags & SMART_EVENT_FLAG_DIFFICULTY_0) + mEvents.emplace_back(std::move(*i)); + break; + case DIFFICULTY_HEROIC: + case DIFFICULTY_25_N: + if (i->event.event_flags & SMART_EVENT_FLAG_DIFFICULTY_1) + mEvents.emplace_back(std::move(*i)); + break; + case DIFFICULTY_10_HC: + if (i->event.event_flags & SMART_EVENT_FLAG_DIFFICULTY_2) + mEvents.emplace_back(std::move(*i)); + break; + case DIFFICULTY_25_HC: + if (i->event.event_flags & SMART_EVENT_FLAG_DIFFICULTY_3) + mEvents.emplace_back(std::move(*i)); + break; + default: + break; } } continue; @@ -3890,24 +3910,24 @@ void SmartScript::GetScript() e = sSmartScriptMgr->GetScript(-((int32)me->GetSpawnId()), mScriptType); if (e.empty()) e = sSmartScriptMgr->GetScript((int32)me->GetEntry(), mScriptType); - FillScript(e, me, nullptr, nullptr); + FillScript(std::move(e), me, nullptr, nullptr); } else if (go) { e = sSmartScriptMgr->GetScript(-((int32)go->GetSpawnId()), mScriptType); if (e.empty()) e = sSmartScriptMgr->GetScript((int32)go->GetEntry(), mScriptType); - FillScript(e, go, nullptr, nullptr); + FillScript(std::move(e), go, nullptr, nullptr); } else if (trigger) { e = sSmartScriptMgr->GetScript((int32)trigger->ID, mScriptType); - FillScript(e, nullptr, trigger, nullptr); + FillScript(std::move(e), nullptr, trigger, nullptr); } else if (sceneTemplate) { e = sSmartScriptMgr->GetScript(sceneTemplate->SceneId, mScriptType); - FillScript(e, nullptr, nullptr, sceneTemplate); + FillScript(std::move(e), nullptr, nullptr, sceneTemplate); } } |
