aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp15
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp1
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h8
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp45
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp39
5 files changed, 74 insertions, 34 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index c08d1508774..859282891fb 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -2330,6 +2330,21 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
}
}
+ case SMART_ACTION_SET_CORPSE_DELAY:
+ {
+ ObjectList* targets = GetTargets(e, unit);
+ if (!targets)
+ break;
+
+ for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
+ {
+ if (IsCreature(*itr))
+ (*itr)->ToCreature()->SetCorpseDelay(e.action.corpseDelay.timer);
+ }
+
+ delete targets;
+ break;
+ }
default:
TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index ef3357fa6ed..3fe6fcdb4ae 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -1214,6 +1214,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_REMOVE_GO_FLAG:
case SMART_ACTION_SUMMON_CREATURE_GROUP:
case SMART_ACTION_RISE_UP:
+ case SMART_ACTION_SET_CORPSE_DELAY:
break;
default:
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index c0ea648462d..d60834c9fef 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -551,8 +551,9 @@ enum SMART_ACTION
SMART_ACTION_START_CLOSEST_WAYPOINT = 113, // wp1, wp2, wp3, wp4, wp5, wp6, wp7
SMART_ACTION_RISE_UP = 114, // distance
SMART_ACTION_RANDOM_SOUND = 115, // soundId1, soundId2, soundId3, soundId4, soundId5, onlySelf
+ SMART_ACTION_SET_CORPSE_DELAY = 116, // timer
- SMART_ACTION_END = 116
+ SMART_ACTION_END = 117
};
struct SmartAction
@@ -1034,6 +1035,11 @@ struct SmartAction
uint32 onlySelf;
} randomSound;
+ struct
+ {
+ uint32 timer;
+ } corpseDelay;
+
//! Note for any new future actions
//! All parameters must have type uint32
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 6fcd72c4934..b6272b81693 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -13750,28 +13750,41 @@ void Unit::UpdateCharmAI()
break;
case TYPEID_PLAYER:
{
- if (Unit* charmer = GetCharmer()) // if we are currently being charmed, then we should apply charm AI
+ if (IsCharmed()) // if we are currently being charmed, then we should apply charm AI
{
- if (Creature* creatureCharmer = charmer->ToCreature()) // this should only ever happen for creature charmers
- {
- i_disabledAI = i_AI;
- // first, we check if the creature's own AI specifies an override playerai for its owned players
- if (PlayerAI* charmAI = creatureCharmer->IsAIEnabled ? creatureCharmer->AI()->GetAIForCharmedPlayer(ToPlayer()) : nullptr)
- i_AI = charmAI;
- else // otherwise, we default to the generic one
- i_AI = new SimpleCharmedPlayerAI(ToPlayer());
- }
- else
+ i_disabledAI = i_AI;
+
+ UnitAI* newAI = nullptr;
+ // first, we check if the creature's own AI specifies an override playerai for its owned players
+ if (Unit* charmer = GetCharmer())
{
- TC_LOG_ERROR("misc", "Attempt to assign charm AI to player %s who is charmed by non-creature %s.", GetGUID().ToString().c_str(), charmer->GetGUID().ToString().c_str());
+ if (Creature* creatureCharmer = charmer->ToCreature())
+ {
+ if (PlayerAI* charmAI = creatureCharmer->IsAIEnabled ? creatureCharmer->AI()->GetAIForCharmedPlayer(ToPlayer()) : nullptr)
+ newAI = charmAI;
+ }
+ else
+ {
+ TC_LOG_ERROR("misc", "Attempt to assign charm AI to player %s who is charmed by non-creature %s.", GetGUID().ToString().c_str(), GetCharmerGUID().ToString().c_str());
+ }
}
+ if (!newAI) // otherwise, we default to the generic one
+ newAI = new SimpleCharmedPlayerAI(ToPlayer());
+ i_AI = newAI;
}
else
{
- // we allow the charmed PlayerAI to clean up
- i_AI->OnCharmed(false);
- // then delete it
- delete i_AI;
+ if (i_AI)
+ {
+ // we allow the charmed PlayerAI to clean up
+ i_AI->OnCharmed(false);
+ // then delete it
+ delete i_AI;
+ }
+ else
+ {
+ TC_LOG_ERROR("misc", "Attempt to remove charm AI from player %s who doesn't currently have charm AI.", GetGUID().ToString().c_str());
+ }
// and restore our previous PlayerAI (if we had one)
i_AI = i_disabledAI;
i_disabledAI = nullptr;
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
index 118d28e2142..612b59f7312 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
@@ -35,15 +35,24 @@ enum Gameobject
GO_ATALAI_STATUE4 = 148833,
GO_ATALAI_STATUE5 = 148834,
GO_ATALAI_STATUE6 = 148835,
- GO_ATALAI_IDOL = 148836,
GO_ATALAI_LIGHT1 = 148883,
GO_ATALAI_LIGHT2 = 148937
-
};
enum CreatureIds
{
- NPC_MALFURION_STORMRAGE = 15362
+ NPC_ATALALARION = 8580
+};
+
+Position const StatuePositions[]
+{
+ { -515.553f, 95.25821f, -173.707f, 0.0f },
+ { -419.8487f, 94.48368f, -173.707f, 0.0f },
+ { -491.4003f, 135.9698f, -173.707f, 0.0f },
+ { -491.4909f, 53.48179f, -173.707f, 0.0f },
+ { -443.8549f, 136.1007f, -173.707f, 0.0f },
+ { -443.4171f, 53.83124f, -173.707f, 0.0f },
+ { -466.5134f, 95.19822f, -189.6463f, 0.03490658f }
};
class instance_sunken_temple : public InstanceMapScript
@@ -77,7 +86,6 @@ public:
ObjectGuid GOAtalaiStatue4;
ObjectGuid GOAtalaiStatue5;
ObjectGuid GOAtalaiStatue6;
- ObjectGuid GOAtalaiIdol;
uint32 State;
@@ -98,7 +106,6 @@ public:
case GO_ATALAI_STATUE4: GOAtalaiStatue4 = go->GetGUID(); break;
case GO_ATALAI_STATUE5: GOAtalaiStatue5 = go->GetGUID(); break;
case GO_ATALAI_STATUE6: GOAtalaiStatue6 = go->GetGUID(); break;
- case GO_ATALAI_IDOL: GOAtalaiIdol = go->GetGUID(); break;
}
}
@@ -155,7 +162,10 @@ public:
if (s1 && s2 && s3 && s4 && s5 && !s6)
{
if (GameObject* pAtalaiStatue6 = instance->GetGameObject(GOAtalaiStatue6))
+ {
UseStatue(pAtalaiStatue6);
+ UseLastStatue(pAtalaiStatue6);
+ }
s6 = true;
State = 0;
}
@@ -169,18 +179,13 @@ public:
go->SetUInt32Value(GAMEOBJECT_FLAGS, 4);
}
- /*
- void UseLastStatue(GameObject* go)
- {
- AtalaiStatue1->SummonGameObject(GO_ATALAI_LIGHT2, AtalaiStatue1->GetPositionX(), AtalaiStatue1->GetPositionY(), AtalaiStatue1->GetPositionZ(), 0, 0, 0, 0, 0, 100);
- AtalaiStatue2->SummonGameObject(GO_ATALAI_LIGHT2, AtalaiStatue2->GetPositionX(), AtalaiStatue2->GetPositionY(), AtalaiStatue2->GetPositionZ(), 0, 0, 0, 0, 0, 100);
- AtalaiStatue3->SummonGameObject(GO_ATALAI_LIGHT2, AtalaiStatue3->GetPositionX(), AtalaiStatue3->GetPositionY(), AtalaiStatue3->GetPositionZ(), 0, 0, 0, 0, 0, 100);
- AtalaiStatue4->SummonGameObject(GO_ATALAI_LIGHT2, AtalaiStatue4->GetPositionX(), AtalaiStatue4->GetPositionY(), AtalaiStatue4->GetPositionZ(), 0, 0, 0, 0, 0, 100);
- AtalaiStatue5->SummonGameObject(GO_ATALAI_LIGHT2, AtalaiStatue5->GetPositionX(), AtalaiStatue5->GetPositionY(), AtalaiStatue5->GetPositionZ(), 0, 0, 0, 0, 0, 100);
- AtalaiStatue6->SummonGameObject(GO_ATALAI_LIGHT2, AtalaiStatue6->GetPositionX(), AtalaiStatue6->GetPositionY(), AtalaiStatue6->GetPositionZ(), 0, 0, 0, 0, 0, 100);
- go->SummonGameObject(148838, -488.997, 96.61, -189.019, -1.52, 0, 0, 0, 0, 100);
- }
- */
+ void UseLastStatue(GameObject* go)
+ {
+ for (uint8 i = 0; i < 6; ++i)
+ go->SummonGameObject(GO_ATALAI_LIGHT2, StatuePositions[i].GetPositionX(), StatuePositions[i].GetPositionY(), StatuePositions[i].GetPositionZ(), StatuePositions[i].GetOrientation(), 0, 0, 0, 0, 0);
+
+ go->SummonCreature(NPC_ATALALARION, StatuePositions[6].GetPosition(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200);
+ }
void SetData(uint32 type, uint32 data) override
{