aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-08-14 21:29:28 +0200
committerKudlaty <none@none>2009-08-14 21:29:28 +0200
commit5ebba6e2feba94c9b4ee2f476fdd8f5412d1a6f1 (patch)
tree3e2d6443141839e274e7ab84c3b8d60968e4aad2 /src
parentb3c9916177064f968b43a4caa17e13a2489d7284 (diff)
Merge [SD2]
r1272 Rough cleanup of hyjal-related scripts. Mainly applied SD2 code style, but also minor improvement of code and removal of not needed functions. - skip r1273 Move code and use JustSummoned() instead of own system in hyjalAI - skip r1274 Simplify way to determine where to spawn creature and remove already known base area passed in function. Also rename arrays. - skip r1275 Provide updated .patch file after changes in Mangos rev 8255 - skip r1277 Remove adding threat for summoned waves in hyjal and instead move to point when summoned. Also add simple handler to attempt move summoned closer to base bosses when not in combat. - skip r1278 Replace world state functions in misc scripts with new ScriptedInstance function. r1279 Simplify spawning of correct wave in hyjal. Remove no longer needed arguments in related function. Also restore wave timer reset in case all mobs in wave are dead before master timer end. - skip r1280 Added basic support for quest 1324. Patch by jotapdiez Also adding additional data for further development of event. --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp26
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp52
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h1
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp19
-rw-r--r--src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp79
-rw-r--r--src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp19
8 files changed, 126 insertions, 102 deletions
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp
index bde31d5c8af..78a5cbbf1de 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp
@@ -95,25 +95,11 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
NextPortal_Timer = 0;
}
- void UpdateBMWorldState(uint32 id, uint32 state)
- {
- Map::PlayerList const& players = instance->GetPlayers();
-
- if (!players.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* pPlayer = itr->getSource())
- pPlayer->SendUpdateWorldState(id,state);
- }
- }else debug_log("TSCR: Instance Black Portal: UpdateBMWorldState, but PlayerList is empty!");
- }
-
void InitWorldState(bool Enable = true)
{
- UpdateBMWorldState(WORLD_STATE_BM,Enable ? 1 : 0);
- UpdateBMWorldState(WORLD_STATE_BM_SHIELD,100);
- UpdateBMWorldState(WORLD_STATE_BM_RIFT,0);
+ DoUpdateWorldState(WORLD_STATE_BM,Enable ? 1 : 0);
+ DoUpdateWorldState(WORLD_STATE_BM_SHIELD, 100);
+ DoUpdateWorldState(WORLD_STATE_BM_RIFT, 0);
}
bool IsEncounterInProgress()
@@ -172,7 +158,8 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS)
{
--mShieldPercent;
- UpdateBMWorldState(WORLD_STATE_BM_SHIELD,mShieldPercent);
+
+ DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent);
if (!mShieldPercent)
{
@@ -337,7 +324,8 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
if (NextPortal_Timer <= diff)
{
++mRiftPortalCount;
- UpdateBMWorldState(WORLD_STATE_BM_RIFT,mRiftPortalCount);
+
+ DoUpdateWorldState(WORLD_STATE_BM_RIFT, mRiftPortalCount);
DoSpawnPortal();
NextPortal_Timer = RiftWaves[GetRiftWaveId()].NextPortalTime;
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
index 528cfb64583..4683acbc8dc 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
@@ -396,9 +396,9 @@ void hyjalAI::Reset()
if ((!pInstance->GetData(DATA_ALLIANCE_RETREAT) && m_creature->GetEntry() == JAINA) || (pInstance->GetData(DATA_ALLIANCE_RETREAT) && m_creature->GetEntry() == THRALL))
{
//Reset World States
- UpdateWorldState(WORLD_STATE_WAVES, 0);
- UpdateWorldState(WORLD_STATE_ENEMY, 0);
- UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
+ pInstance->DoUpdateWorldState(WORLD_STATE_WAVES, 0);
+ pInstance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0);
+ pInstance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
pInstance->SetData(DATA_RESET_TRASH_COUNT, 0);
}
}else error_log(ERROR_INST_DATA);
@@ -548,8 +548,11 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3])
uint32 stateValue = Count+1;
if (FirstBossDead)
stateValue -= 9; // Subtract 9 from it to give the proper wave number if we are greater than 8
- UpdateWorldState(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number
- UpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state
+
+ // Set world state to our current wave number
+ pInstance->DoUpdateWorldState(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number
+ // Enable world state
+ pInstance->DoUpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state
pInstance->SetData(DATA_TRASH, EnemyCount); // Send data for instance script to update count
@@ -563,9 +566,13 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3])
}
else
{
- UpdateWorldState(WORLD_STATE_WAVES, 0); // Set world state for waves to 0 to disable it.
- UpdateWorldState(WORLD_STATE_ENEMY, 1);
- UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 1); // Set World State for enemies invading to 1.
+ // Set world state for waves to 0 to disable it.
+ pInstance->DoUpdateWorldState(WORLD_STATE_WAVES, 0);
+ pInstance->DoUpdateWorldState(WORLD_STATE_ENEMY, 1);
+
+ // Set World State for enemies invading to 1.
+ pInstance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 1);
+
Summon = false;
}
CheckTimer = 5000;
@@ -573,7 +580,7 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3])
void hyjalAI::StartEvent(Player* pPlayer)
{
- if (!pPlayer || IsDummy)
+ if (!pPlayer || IsDummy || !pInstance)
return;
Talk(BEGIN);
@@ -587,9 +594,9 @@ void hyjalAI::StartEvent(Player* pPlayer)
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- UpdateWorldState(WORLD_STATE_WAVES, 0);
- UpdateWorldState(WORLD_STATE_ENEMY, 0);
- UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
+ pInstance->DoUpdateWorldState(WORLD_STATE_WAVES, 0);
+ pInstance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0);
+ pInstance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
DeSpawnVeins();
}
@@ -639,25 +646,6 @@ void hyjalAI::Talk(uint32 id)
DoScriptText(YellId, m_creature);
}
-void hyjalAI::UpdateWorldState(uint32 id, uint32 state)
-{
- Map* pMap = m_creature->GetMap();
-
- if (!pMap->IsDungeon())
- return;
-
- Map::PlayerList const& players = pMap->GetPlayers();
-
- if (!players.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* pPlayer = itr->getSource())
- pPlayer->SendUpdateWorldState(id,state);
- }
- }else debug_log("TSCR: HyjalAI: UpdateWorldState, but PlayerList is empty");
-}
-
void hyjalAI::Retreat()
{
if (pInstance)
@@ -879,7 +867,7 @@ void hyjalAI::UpdateAI(const uint32 diff)
CheckTimer = 0;
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
BossGUID[i] = 0;
- UpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it
+ pInstance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it
}
}
}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h
index 8f7e40cfdfe..5663516460d 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h
@@ -195,7 +195,6 @@ struct TRINITY_DLL_DECL hyjalAI : public npc_escortAI
void Talk(uint32 id); // Searches for the appropriate yell and sound and uses it to inform the raid of various things
- void UpdateWorldState(uint32 field, uint32 value); // NYI: Requires core support. Updates the world state counter at the top of the UI.
public:
ScriptedInstance* pInstance;
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
index f4acc668f21..c55a02c50a9 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
@@ -211,7 +211,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
case DATA_TRASH:
if (data) Trash = data;
else Trash--;
- UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
+ DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
break;
case TYPE_RETREAT:
if (data == SPECIAL)
@@ -283,20 +283,6 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
return 0;
}
- void UpdateWorldState(uint32 id, uint32 state)
- {
- Map::PlayerList const& players = instance->GetPlayers();
-
- if (!players.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* pPlayer = itr->getSource())
- pPlayer->SendUpdateWorldState(id,state);
- }
- }else debug_log("TSCR: Instance Hyjal: UpdateWorldState, but PlayerList is empty!");
- }
-
std::string GetSaveData()
{
return str_data;
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp
index f5529f3480f..d8fe0694367 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp
@@ -29,17 +29,15 @@ EndScriptData */
## go_barrel_old_hillsbrad
######*/
-bool GOHello_go_barrel_old_hillsbrad(Player* pPlayer, GameObject* _GO)
+bool GOHello_go_barrel_old_hillsbrad(Player* pPlayer, GameObject* pGO)
{
- ScriptedInstance* pInstance = _GO->GetInstanceData();
-
- if (!pInstance)
- return false;
-
- if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE)
- return false;
+ if (ScriptedInstance* pInstance = pGO->GetInstanceData())
+ {
+ if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE)
+ return false;
- pInstance->SetData(TYPE_BARREL_DIVERSION, IN_PROGRESS);
+ pInstance->SetData(TYPE_BARREL_DIVERSION, IN_PROGRESS);
+ }
return false;
}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp
index 1471733c67f..86a0628520c 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp
@@ -75,7 +75,7 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance
return NULL;
}
- void UpdateOHWorldState()
+ void UpdateQuestCredit()
{
Map::PlayerList const& players = instance->GetPlayers();
@@ -84,15 +84,9 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if (Player* pPlayer = itr->getSource())
- {
- pPlayer->SendUpdateWorldState(WORLD_STATE_OH,mBarrelCount);
-
- if (mBarrelCount == 5)
- pPlayer->KilledMonsterCredit(LODGE_QUEST_TRIGGER,0);
- }
+ pPlayer->KilledMonsterCredit(LODGE_QUEST_TRIGGER,0);
}
- }else
- debug_log("TSCR: Instance Old Hillsbrad: UpdateOHWorldState, but PlayerList is empty!");
+ }
}
void OnCreatureCreate(Creature *creature, bool add)
@@ -131,7 +125,7 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance
return;
++mBarrelCount;
- UpdateOHWorldState();
+ DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount);
debug_log("TSCR: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u",mBarrelCount);
@@ -139,8 +133,9 @@ struct TRINITY_DLL_DECL instance_old_hillsbrad : public ScriptedInstance
if (mBarrelCount == 5)
{
- pPlayer->SummonCreature(DRAKE_ENTRY,2128.43,71.01,64.42,1.74,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000);
- m_auiEncounter[0] = DONE;
+ UpdateQuestCredit();
+ pPlayer->SummonCreature(DRAKE_ENTRY, 2128.43, 71.01, 64.42, 1.74, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000);
+ m_auiEncounter[0] = DONE;
}
}
break;
diff --git a/src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp b/src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp
index 3a186a855a1..d8648d605b0 100644
--- a/src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp
+++ b/src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp
@@ -17,7 +17,7 @@
/* ScriptData
SDName: Dustwallow_Marsh
SD%Complete: 95
-SDComment: Quest support: 11180, 558, 11126, 11142, Vendor Nat Pagle
+SDComment: Quest support: 11180, 558, 11126, 11142, 11180. Vendor Nat Pagle
SDCategory: Dustwallow Marsh
EndScriptData */
@@ -27,6 +27,8 @@ npc_restless_apparition
npc_deserter_agitator
npc_lady_jaina_proudmoore
npc_nat_pagle
+npc_private_hendel
+npc_cassa_crimsonwing - handled by npc_taxi
EndContentData */
#include "precompiled.h"
@@ -222,6 +224,75 @@ bool GossipSelect_npc_nat_pagle(Player* pPlayer, Creature* pCreature, uint32 uiS
}
/*######
+## npc_private_hendel
+######*/
+
+enum
+{
+ SAY_PROGRESS_1_TER = -1000411,
+ SAY_PROGRESS_2_HEN = -1000412,
+ SAY_PROGRESS_3_TER = -1000413,
+ SAY_PROGRESS_4_TER = -1000414,
+ EMOTE_SURRENDER = -1000415,
+
+ QUEST_MISSING_DIPLO_PT16 = 1324,
+ FACTION_HOSTILE = 168, //guessed, may be different
+
+ NPC_SENTRY = 5184, //helps hendel
+ NPC_JAINA = 4968, //appears once hendel gives up
+ NPC_TERVOSH = 4967
+};
+
+//TODO: develop this further, end event not created
+struct TRINITY_DLL_DECL npc_private_hendelAI : public ScriptedAI
+{
+ npc_private_hendelAI(Creature* pCreature) : ScriptedAI(pCreature) { }
+
+ void Reset()
+ {
+ me->RestoreFaction();
+ }
+
+ void AttackedBy(Unit* pAttacker)
+ {
+ if (m_creature->getVictim())
+ return;
+
+ if (m_creature->IsFriendlyTo(pAttacker))
+ return;
+
+ AttackStart(pAttacker);
+ }
+
+ void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
+ {
+ if (uiDamage > m_creature->GetHealth() || ((m_creature->GetHealth() - uiDamage)*100 / m_creature->GetMaxHealth() < 20))
+ {
+ uiDamage = 0;
+
+ if (Player* pPlayer = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself())
+ pPlayer->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, m_creature);
+
+ DoScriptText(EMOTE_SURRENDER, m_creature);
+ EnterEvadeMode();
+ }
+ }
+};
+
+bool QuestAccept_npc_private_hendel(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
+{
+ if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT16)
+ pCreature->setFaction(FACTION_HOSTILE);
+
+ return true;
+}
+
+CreatureAI* GetAI_npc_private_hendel(Creature* pCreature)
+{
+ return new npc_private_hendelAI(pCreature);
+}
+
+/*######
##
######*/
@@ -256,5 +327,11 @@ void AddSC_dustwallow_marsh()
newscript->pGossipHello = &GossipHello_npc_nat_pagle;
newscript->pGossipSelect = &GossipSelect_npc_nat_pagle;
newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "npc_private_hendel";
+ newscript->GetAI = &GetAI_npc_private_hendel;
+ newscript->pQuestAccept = &QuestAccept_npc_private_hendel;
+ newscript->RegisterSelf();
}
diff --git a/src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp b/src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp
index e4cfa97b2f9..716c5876c0b 100644
--- a/src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp
+++ b/src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp
@@ -166,13 +166,6 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance
HandleGameObject(ZulJinGateGUID, true);
}
- void UpdateWorldState(uint32 field, uint32 value)
- {
- WorldPacket data(SMSG_UPDATE_WORLD_STATE, 8);
- data << field << value;
- instance->SendToPlayers(&data);
- }
-
std::string GetSaveData()
{
std::ostringstream ss;
@@ -211,7 +204,7 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance
if (QuestMinute)
{
QuestMinute += 15;
- UpdateWorldState(3106, QuestMinute);
+ DoUpdateWorldState(3106, QuestMinute);
}
SummonHostage(0);
}
@@ -224,7 +217,7 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance
if (QuestMinute)
{
QuestMinute += 10;
- UpdateWorldState(3106, QuestMinute);
+ DoUpdateWorldState(3106, QuestMinute);
}
SummonHostage(1);
}
@@ -267,7 +260,7 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance
if (QuestMinute && BossKilled >= 4)
{
QuestMinute = 0;
- UpdateWorldState(3104, 0);
+ DoUpdateWorldState(3104, 0);
}
CheckInstanceStatus();
SaveToDB();
@@ -302,9 +295,9 @@ struct TRINITY_DLL_DECL instance_zulaman : public ScriptedInstance
QuestTimer += 60000;
if (QuestMinute)
{
- UpdateWorldState(3104, 1);
- UpdateWorldState(3106, QuestMinute);
- }else UpdateWorldState(3104, 0);
+ DoUpdateWorldState(3104, 1);
+ DoUpdateWorldState(3106, QuestMinute);
+ }else DoUpdateWorldState(3104, 0);
}
QuestTimer -= diff;
}