Core/Script: Code style.

Signed-off-by: Gyx <[email protected]>
This commit is contained in:
Gyx
2012-03-16 19:40:57 +08:00
parent ddc0f5d7d6
commit bef1b0c402
55 changed files with 220 additions and 137 deletions
+5 -3
View File
@@ -360,7 +360,9 @@ public:
//Edit Player Spell //Edit Player Spell
static bool HandleModifySpellCommand(ChatHandler* handler, const char* args) static bool HandleModifySpellCommand(ChatHandler* handler, const char* args)
{ {
if (!*args) return false; if (!*args)
return false;
char* pspellflatid = strtok((char*)args, " "); char* pspellflatid = strtok((char*)args, " ");
if (!pspellflatid) if (!pspellflatid)
return false; return false;
@@ -1141,10 +1143,10 @@ public:
static bool HandleModifyRepCommand(ChatHandler* handler, const char* args) static bool HandleModifyRepCommand(ChatHandler* handler, const char* args)
{ {
if (!*args) return false; if (!*args)
return false;
Player* target = handler->getSelectedPlayer(); Player* target = handler->getSelectedPlayer();
if (!target) if (!target)
{ {
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+2 -1
View File
@@ -108,6 +108,7 @@ public:
{ {
if (!*args) if (!*args)
return false; return false;
char* charID = handler->extractKeyFromLink((char*)args, "Hcreature_entry"); char* charID = handler->extractKeyFromLink((char*)args, "Hcreature_entry");
if (!charID) if (!charID)
return false; return false;
@@ -135,7 +136,7 @@ public:
return true; return true;
} }
Creature* creature = new Creature; Creature* creature = new Creature();
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, (uint32)teamval, x, y, z, o)) if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, (uint32)teamval, x, y, z, o))
{ {
delete creature; delete creature;
+2 -1
View File
@@ -277,7 +277,8 @@ public:
std::string show = show_str; std::string show = show_str;
// Check // Check
if ((show != "add") && (show != "mod") && (show != "del") && (show != "listid")) return false; if ((show != "add") && (show != "mod") && (show != "del") && (show != "listid"))
return false;
char* arg_id = strtok(NULL, " "); char* arg_id = strtok(NULL, " ");
uint32 id = 0; uint32 id = 0;
@@ -303,9 +303,11 @@ public:
prisonerGUID = guid; prisonerGUID = guid;
} }
uint64 GetGUID(int32 /*id*/) { return prisonerGUID; } uint64 GetGUID(int32 /*id*/)
{
return prisonerGUID;
}
}; };
}; };
class go_acherus_soul_prison : public GameObjectScript class go_acherus_soul_prison : public GameObjectScript
@@ -702,7 +704,9 @@ public:
void Reset() void Reset()
{ {
Creature* deathcharger = me->FindNearestCreature(28782, 30); Creature* deathcharger = me->FindNearestCreature(28782, 30);
if (!deathcharger) return; if (!deathcharger)
return;
deathcharger->RestoreFaction(); deathcharger->RestoreFaction();
deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -713,7 +717,9 @@ public:
void JustDied(Unit* killer) void JustDied(Unit* killer)
{ {
Creature* deathcharger = me->FindNearestCreature(28782, 30); Creature* deathcharger = me->FindNearestCreature(28782, 30);
if (!deathcharger) return; if (!deathcharger)
return;
if (killer->GetTypeId() == TYPEID_PLAYER && deathcharger->GetTypeId() == TYPEID_UNIT && deathcharger->IsVehicle()) if (killer->GetTypeId() == TYPEID_PLAYER && deathcharger->GetTypeId() == TYPEID_UNIT && deathcharger->IsVehicle())
{ {
deathcharger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); deathcharger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
@@ -319,7 +319,8 @@ public:
if (wait <= diff) if (wait <= diff)
{ {
wait = 1000; wait = 1000;
if (!me->getVictim()) return; if (!me->getVictim())
return;
me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveFleeing(me->getVictim()); me->GetMotionMaster()->MoveFleeing(me->getVictim());
} }
@@ -803,12 +804,16 @@ public:
void Despawn() void Despawn()
{ {
if (!debuffGUID) return; if (!debuffGUID)
return;
Unit* debuff = Unit::GetUnit((*me), debuffGUID); Unit* debuff = Unit::GetUnit((*me), debuffGUID);
if (debuff) if (debuff)
{
debuff->SetVisible(false); debuff->SetVisible(false);
debuffGUID = 0; debuffGUID = 0;
} }
}
void JustDied(Unit* /*killer*/) { if (!sprouted) Despawn(); } void JustDied(Unit* /*killer*/) { if (!sprouted) Despawn(); }
@@ -676,7 +676,9 @@ public:
void TeleportAllPlayersBack() void TeleportAllPlayersBack()
{ {
Map* map = me->GetMap(); Map* map = me->GetMap();
if (!map->IsDungeon()) return; if (!map->IsDungeon())
return;
Map::PlayerList const &PlayerList = map->GetPlayers(); Map::PlayerList const &PlayerList = map->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{ {
@@ -425,7 +425,8 @@ class instance_uldaman : public InstanceMapScript
void OnCreatureCreate(Creature* creature) void OnCreatureCreate(Creature* creature)
{ {
switch (creature->GetEntry()) { switch (creature->GetEntry())
{
case 4857: // Stone Keeper case 4857: // Stone Keeper
SetFrozenState (creature); SetFrozenState (creature);
vStoneKeeper.push_back(creature->GetGUID()); vStoneKeeper.push_back(creature->GetGUID());
@@ -458,8 +459,8 @@ class instance_uldaman : public InstanceMapScript
uiArchaedasGUID = creature->GetGUID(); uiArchaedasGUID = creature->GetGUID();
break; break;
} // end switch }
} // end OnCreatureCreate }
uint64 GetData64(uint32 identifier) uint64 GetData64(uint32 identifier)
{ {
@@ -374,7 +374,9 @@ class boss_janalai : public CreatureScript
//Teleport every Player into the middle //Teleport every Player into the middle
Map* map = me->GetMap(); Map* map = me->GetMap();
if (!map->IsDungeon()) return; if (!map->IsDungeon())
return;
Map::PlayerList const &PlayerList = map->GetPlayers(); Map::PlayerList const &PlayerList = map->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* i_pl = i->getSource()) if (Player* i_pl = i->getSource())
@@ -109,7 +109,8 @@ class instance_zulaman : public InstanceMapScript
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -188,7 +189,9 @@ class instance_zulaman : public InstanceMapScript
void Load(const char* load) void Load(const char* load)
{ {
if (!load) return; if (!load)
return;
std::istringstream ss(load); std::istringstream ss(load);
//sLog->outError("TSCR: Zul'aman loaded, %s.", ss.str().c_str()); //sLog->outError("TSCR: Zul'aman loaded, %s.", ss.str().c_str());
char dataHead; // S char dataHead; // S
@@ -68,7 +68,6 @@ public:
{ {
instance = creature->GetInstanceScript(); instance = creature->GetInstanceScript();
go = false; go = false;
pos = 0;
} }
uint32 SwarmTimer; uint32 SwarmTimer;
@@ -76,7 +75,6 @@ public:
uint32 AuraTimer; uint32 AuraTimer;
uint32 InfernoTimer; uint32 InfernoTimer;
bool go; bool go;
uint32 pos;
void Reset() void Reset()
{ {
@@ -119,7 +117,6 @@ public:
void WaypointReached(uint32 i) void WaypointReached(uint32 i)
{ {
pos = i;
if (i == 7 && instance) if (i == 7 && instance)
{ {
Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE)); Unit* target = Unit::GetUnit((*me), instance->GetData64(DATA_JAINAPROUDMOORE));
@@ -110,7 +110,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -607,7 +607,8 @@ public:
if (WisperTimer <= diff) if (WisperTimer <= diff)
{ {
Map* map = me->GetMap(); Map* map = me->GetMap();
if (!map->IsDungeon()) return; if (!map->IsDungeon())
return;
//Play random sound to the zone //Play random sound to the zone
Map::PlayerList const &PlayerList = map->GetPlayers(); Map::PlayerList const &PlayerList = map->GetPlayers();
@@ -199,18 +199,6 @@ public:
+## go_troll_cage +## go_troll_cage
+######*/ +######*/
void initBlyCrewMember(InstanceScript* instance, uint32 entry, float x, float y, float z)
{
if (Creature* crew = instance->instance->GetCreature(instance->GetData64(entry)))
{
crew->SetReactState(REACT_AGGRESSIVE);
crew->SetWalk(true);
crew->SetHomePosition(x, y, z, 0);
crew->GetMotionMaster()->MovePoint(1, x, y, z);
crew->setFaction(FACTION_FREED);
}
}
class go_troll_cage : public GameObjectScript class go_troll_cage : public GameObjectScript
{ {
public: public:
@@ -231,6 +219,18 @@ public:
return false; return false;
} }
private:
void initBlyCrewMember(InstanceScript* instance, uint32 entry, float x, float y, float z)
{
if (Creature* crew = instance->instance->GetCreature(instance->GetData64(entry)))
{
crew->SetReactState(REACT_AGGRESSIVE);
crew->SetWalk(true);
crew->SetHomePosition(x, y, z, 0);
crew->GetMotionMaster()->MovePoint(1, x, y, z);
crew->setFaction(FACTION_FREED);
}
}
}; };
/*###### /*######
+6 -3
View File
@@ -385,7 +385,8 @@ public:
void MoveInLineOfSight(Unit* who) void MoveInLineOfSight(Unit* who)
{ {
if (!who || (!who->isAlive())) return; if (!who || (!who->isAlive()))
return;
if (me->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress) if (me->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress)
{ {
@@ -433,8 +434,10 @@ public:
if (BigWill) if (BigWill)
{ {
Creature* creature = Unit::GetCreature((*me), BigWill); Creature* creature = Unit::GetCreature((*me), BigWill);
if (creature) { if (creature)
if (creature->isAlive()) { {
if (creature->isAlive())
{
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
creature->setDeathState(JUST_DIED); creature->setDeathState(JUST_DIED);
@@ -87,7 +87,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -236,7 +237,8 @@ public:
for (std::set<uint64>::const_iterator itr = InitiandGUIDs.begin(); itr != InitiandGUIDs.end(); ++itr) for (std::set<uint64>::const_iterator itr = InitiandGUIDs.begin(); itr != InitiandGUIDs.end(); ++itr)
{ {
Creature* cr = instance->GetCreature(*itr); Creature* cr = instance->GetCreature(*itr);
if (!cr || (cr && cr->isAlive())) return 0; if (!cr || (cr && cr->isAlive()))
return 0;
} }
return 1; return 1;
case DATA_JEDOGA_TRIGGER_SWITCH: return switchtrigger; case DATA_JEDOGA_TRIGGER_SWITCH: return switchtrigger;
@@ -136,7 +136,8 @@ public:
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
//Return since we have no target //Return since we have no target
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
// Without he comes up through the air to players on the bridge after krikthir if players crossing this bridge! // Without he comes up through the air to players on the bridge after krikthir if players crossing this bridge!
CheckDistance(fMaxDistance, diff); CheckDistance(fMaxDistance, diff);
@@ -64,7 +64,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (auiEncounter[i] == IN_PROGRESS) return true; if (auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -408,7 +408,8 @@ struct boss_faction_championsAI : public ScriptedAI
void AttackStart(Unit* who) void AttackStart(Unit* who)
{ {
if (!who) return; if (!who)
return;
if (me->Attack(who, true)) if (me->Attack(who, true))
{ {
@@ -494,7 +495,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiNatureGraspTimer <= uiDiff) if (m_uiNatureGraspTimer <= uiDiff)
{ {
@@ -588,7 +590,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiHeroismOrBloodlustTimer <= uiDiff) if (m_uiHeroismOrBloodlustTimer <= uiDiff)
{ {
@@ -687,7 +690,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiBubbleTimer <= uiDiff) if (m_uiBubbleTimer <= uiDiff)
{ {
@@ -786,7 +790,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiPsychicScreamTimer <= uiDiff) if (m_uiPsychicScreamTimer <= uiDiff)
{ {
@@ -879,7 +884,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiPsychicScreamTimer <= uiDiff) if (m_uiPsychicScreamTimer <= uiDiff)
{ {
@@ -990,7 +996,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiFearTimer <= uiDiff) if (m_uiFearTimer <= uiDiff)
{ {
@@ -1093,7 +1100,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiCounterspellTimer <= uiDiff) if (m_uiCounterspellTimer <= uiDiff)
{ {
@@ -1204,7 +1212,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiDisengageTimer <= uiDiff) if (m_uiDisengageTimer <= uiDiff)
{ {
@@ -1312,7 +1321,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiBarkskinTimer <= uiDiff) if (m_uiBarkskinTimer <= uiDiff)
{ {
@@ -1424,7 +1434,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiBladestormTimer <= uiDiff) if (m_uiBladestormTimer <= uiDiff)
{ {
@@ -1534,7 +1545,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiIceboundFortitudeTimer <= uiDiff) if (m_uiIceboundFortitudeTimer <= uiDiff)
{ {
@@ -1636,7 +1648,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiFanOfKnivesTimer <= uiDiff) if (m_uiFanOfKnivesTimer <= uiDiff)
{ {
@@ -1773,7 +1786,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiHeroismOrBloodlustTimer <= uiDiff) if (m_uiHeroismOrBloodlustTimer <= uiDiff)
{ {
@@ -1873,7 +1887,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiRepeteanceTimer <= uiDiff) if (m_uiRepeteanceTimer <= uiDiff)
{ {
@@ -1951,7 +1966,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiDevourMagicTimer <= uiDiff) if (m_uiDevourMagicTimer <= uiDiff)
{ {
@@ -2000,7 +2016,8 @@ public:
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (m_uiClawTimer <= uiDiff) if (m_uiClawTimer <= uiDiff)
{ {
@@ -2011,11 +2028,8 @@ public:
boss_faction_championsAI::UpdateAI(uiDiff); boss_faction_championsAI::UpdateAI(uiDiff);
} }
}; };
}; };
/*========================================================*/
void AddSC_boss_faction_champions() void AddSC_boss_faction_champions()
{ {
new boss_toc_champion_controller(); new boss_toc_champion_controller();
@@ -454,7 +454,8 @@ struct boss_jormungarAI : public ScriptedAI
void UpdateAI(uint32 const diff) void UpdateAI(uint32 const diff)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged) if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged)
{ {
@@ -199,7 +199,8 @@ struct boss_twin_baseAI : public ScriptedAI
void MovementInform(uint32 uiType, uint32 uiId) void MovementInform(uint32 uiType, uint32 uiId)
{ {
if (uiType != POINT_MOTION_TYPE) return; if (uiType != POINT_MOTION_TYPE)
return;
switch (uiId) switch (uiId)
{ {
@@ -585,7 +586,8 @@ struct mob_unleashed_ballAI : public ScriptedAI
void MovementInform(uint32 uiType, uint32 uiId) void MovementInform(uint32 uiType, uint32 uiId)
{ {
if (uiType != POINT_MOTION_TYPE) return; if (uiType != POINT_MOTION_TYPE)
return;
switch (uiId) switch (uiId)
{ {
@@ -388,7 +388,8 @@ class npc_fizzlebang_toc : public CreatureScript
void MovementInform(uint32 uiType, uint32 uiId) void MovementInform(uint32 uiType, uint32 uiId)
{ {
if (uiType != POINT_MOTION_TYPE) return; if (uiType != POINT_MOTION_TYPE)
return;
switch (uiId) switch (uiId)
{ {
@@ -411,9 +412,11 @@ class npc_fizzlebang_toc : public CreatureScript
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!instance) return; if (!instance)
return;
if (instance->GetData(TYPE_EVENT_NPC) != NPC_FIZZLEBANG) return; if (instance->GetData(TYPE_EVENT_NPC) != NPC_FIZZLEBANG)
return;
m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER);
if (m_uiUpdateTimer <= uiDiff) if (m_uiUpdateTimer <= uiDiff)
@@ -537,8 +540,11 @@ class npc_tirion_toc : public CreatureScript
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!instance) return; if (!instance)
if (instance->GetData(TYPE_EVENT_NPC) != NPC_TIRION) return; return;
if (instance->GetData(TYPE_EVENT_NPC) != NPC_TIRION)
return;
m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER);
if (m_uiUpdateTimer <= uiDiff) if (m_uiUpdateTimer <= uiDiff)
@@ -833,8 +839,11 @@ class npc_garrosh_toc : public CreatureScript
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!instance) return; if (!instance)
if (instance->GetData(TYPE_EVENT_NPC) != NPC_GARROSH) return; return;
if (instance->GetData(TYPE_EVENT_NPC) != NPC_GARROSH)
return;
m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER);
if (m_uiUpdateTimer <= uiDiff) if (m_uiUpdateTimer <= uiDiff)
@@ -911,8 +920,11 @@ class npc_varian_toc : public CreatureScript
void UpdateAI(const uint32 uiDiff) void UpdateAI(const uint32 uiDiff)
{ {
if (!instance) return; if (!instance)
if (instance->GetData(TYPE_EVENT_NPC) != NPC_VARIAN) return; return;
if (instance->GetData(TYPE_EVENT_NPC) != NPC_VARIAN)
return;
m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER); m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER);
if (m_uiUpdateTimer <= uiDiff) if (m_uiUpdateTimer <= uiDiff)
@@ -83,7 +83,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -131,7 +131,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -100,7 +100,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -97,7 +97,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -221,7 +221,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -75,7 +75,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -566,7 +566,9 @@ public:
void KilledUnit(Unit* victim) void KilledUnit(Unit* victim)
{ {
if (victim == me) return; if (victim == me)
return;
// TODO: Find better way to handle emote // TODO: Find better way to handle emote
switch (urand(0, 1)) switch (urand(0, 1))
{ {
@@ -747,7 +749,8 @@ public:
final.y = 2 * final.y - initial.y; final.y = 2 * final.y - initial.y;
Creature* Trigger = me->SummonCreature(23069, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000); Creature* Trigger = me->SummonCreature(23069, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000);
if (!Trigger) return; if (!Trigger)
return;
Trigger->SetSpeed(MOVE_WALK, 3); Trigger->SetSpeed(MOVE_WALK, 3);
Trigger->SetWalk(true); Trigger->SetWalk(true);
@@ -2137,9 +2140,11 @@ public:
void UpdateAI(const uint32 /*diff*/) void UpdateAI(const uint32 /*diff*/)
{ {
if (!UpdateVictim()) return; if (!UpdateVictim())
return;
if (me->getVictim()->GetTypeId() != TYPEID_PLAYER) return; // Only cast the below on players. if (me->getVictim()->GetTypeId() != TYPEID_PLAYER)
return; // Only cast the below on players.
if (!me->getVictim()->HasAura(SPELL_PARALYZE)) if (!me->getVictim()->HasAura(SPELL_PARALYZE))
{ {
@@ -197,8 +197,11 @@ public:
uint32 random = rand()%6; uint32 random = rand()%6;
float x = Coords[random].x; float x = Coords[random].x;
float y = Coords[random].y; float y = Coords[random].y;
Creature* Soul = me->SummonCreature(CREATURE_ENSLAVED_SOUL, x, y, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0); Creature* Soul = me->SummonCreature(CREATURE_ENSLAVED_SOUL, x, y, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!Soul) return false; if (!Soul)
return false;
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{ {
CAST_AI(npc_enslaved_soul::npc_enslaved_soulAI, Soul->AI())->ReliquaryGUID = me->GetGUID(); CAST_AI(npc_enslaved_soul::npc_enslaved_soulAI, Soul->AI())->ReliquaryGUID = me->GetGUID();
@@ -320,7 +320,8 @@ public:
void AttackStart(Unit* who) void AttackStart(Unit* who)
{ {
if (!who || IsBanished) return; if (!who || IsBanished)
return;
if (who->isTargetableForAttack() && who != me) if (who->isTargetableForAttack() && who != me)
DoStartMovement(who); DoStartMovement(who);
@@ -316,7 +316,8 @@ public:
void SetThreatList(Creature* Blossom) void SetThreatList(Creature* Blossom)
{ {
if (!Blossom) return; if (!Blossom)
return;
std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
@@ -130,7 +130,9 @@ public:
bool RemoveImpalingSpine() bool RemoveImpalingSpine()
{ {
if (!SpineTargetGUID) return false; if (!SpineTargetGUID)
return false;
Unit* target = Unit::GetUnit(*me, SpineTargetGUID); Unit* target = Unit::GetUnit(*me, SpineTargetGUID);
if (target && target->HasAura(SPELL_IMPALING_SPINE)) if (target && target->HasAura(SPELL_IMPALING_SPINE))
target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE); target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
@@ -313,7 +313,8 @@ public:
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if (!EventBegun) return; if (!EventBegun)
return;
if (EndEventTimer) if (EndEventTimer)
{ {
@@ -118,7 +118,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -112,7 +112,8 @@ public:
void EnterCombat(Unit* /*who*/) void EnterCombat(Unit* /*who*/)
{ {
if (!victimGUID) return; if (!victimGUID)
return;
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
@@ -383,13 +383,12 @@ public:
void MoveInLineOfSight(Unit* who) void MoveInLineOfSight(Unit* who)
{ {
if (!who || me->getVictim()) return; if (!who || me->getVictim())
return;
if (who->isInAccessiblePlaceFor(me) && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 45)) if (who->isInAccessiblePlaceFor(me) && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 45))
{
AttackStart(who); AttackStart(who);
} }
}
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
@@ -77,7 +77,8 @@ public:
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -158,7 +158,9 @@ class boss_kelidan_the_breaker : public CreatureScript
uint64 GetChanneled(Creature* channeler1) uint64 GetChanneled(Creature* channeler1)
{ {
SummonChannelers(); SummonChannelers();
if (!channeler1) return 0; if (!channeler1)
return 0;
uint8 i; uint8 i;
for (i=0; i<5; ++i) for (i=0; i<5; ++i)
{ {
@@ -80,7 +80,9 @@ class instance_magtheridons_lair : public InstanceMapScript
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -78,7 +78,8 @@ class instance_the_eye : public InstanceMapScript
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -93,7 +93,8 @@ class instance_arcatraz : public InstanceMapScript
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS) return true; if (m_auiEncounter[i] == IN_PROGRESS)
return true;
return false; return false;
} }
@@ -492,7 +492,8 @@ public:
void MoveInLineOfSight(Unit* who) void MoveInLineOfSight(Unit* who)
{ {
if (!who || (!who->isAlive())) return; if (!who || (!who->isAlive()))
return;
if (me->IsWithinDistInMap(who, 50.0f)) if (me->IsWithinDistInMap(who, 50.0f))
{ {
@@ -18,7 +18,7 @@
#include "ScriptPCH.h" #include "ScriptPCH.h"
enum Yells enum Texts
{ {
SAY_INTRO = 0, SAY_INTRO = 0,
SAY_AGGRO = 1, SAY_AGGRO = 1,
@@ -18,7 +18,7 @@
#include "ScriptPCH.h" #include "ScriptPCH.h"
enum Yells enum Texts
{ {
SAY_AGGRO = 0, SAY_AGGRO = 0,
SAY_EARTHQUAKE = 1, SAY_EARTHQUAKE = 1,
@@ -1739,7 +1739,8 @@ public:
uint32 entry = 0; uint32 entry = 0;
uint32 credit = 0; uint32 credit = 0;
switch (me->GetEntry()) { switch (me->GetEntry())
{
case ENTRY_ENRAGED_FIRE_SPIRIT: case ENTRY_ENRAGED_FIRE_SPIRIT:
entry = ENTRY_FIERY_SOUL; entry = ENTRY_FIERY_SOUL;
//credit = SPELL_FIERY_SOUL_CAPTURED_CREDIT; //credit = SPELL_FIERY_SOUL_CAPTURED_CREDIT;
+5 -9
View File
@@ -148,9 +148,8 @@ public:
bool OnGossipHello(Player* player, GameObject* /*go*/) bool OnGossipHello(Player* player, GameObject* /*go*/)
{ {
if (player->HasSkill(SKILL_TAILORING) && player->GetBaseSkillValue(SKILL_TAILORING) >= 280 && !player->HasSpell(26086)) if (player->HasSkill(SKILL_TAILORING) && player->GetBaseSkillValue(SKILL_TAILORING) >= 280 && !player->HasSpell(26086))
{
player->CastSpell(player, 26095, false); player->CastSpell(player, 26095, false);
}
return true; return true;
} }
}; };
@@ -167,9 +166,8 @@ public:
bool OnGossipHello(Player* player, GameObject* /*go*/) bool OnGossipHello(Player* player, GameObject* /*go*/)
{ {
if (player->HasSkill(SKILL_ENGINEERING) && player->GetBaseSkillValue(SKILL_ENGINEERING) >= 300 && !player->HasSpell(22704)) if (player->HasSkill(SKILL_ENGINEERING) && player->GetBaseSkillValue(SKILL_ENGINEERING) >= 300 && !player->HasSpell(22704))
{
player->CastSpell(player, 22864, false); player->CastSpell(player, 22864, false);
}
return true; return true;
} }
}; };
@@ -232,9 +230,8 @@ public:
bool OnGossipHello(Player* player, GameObject* /*go*/) bool OnGossipHello(Player* player, GameObject* /*go*/)
{ {
if (player->HasSkill(SKILL_ALCHEMY) && player->GetSkillValue(SKILL_ALCHEMY) >= 300 && !player->HasSpell(24266)) if (player->HasSkill(SKILL_ALCHEMY) && player->GetSkillValue(SKILL_ALCHEMY) >= 300 && !player->HasSpell(24266))
{
player->CastSpell(player, 24267, false); player->CastSpell(player, 24267, false);
}
return true; return true;
} }
}; };
@@ -492,6 +489,7 @@ enum eDalaranCrystal
}; };
#define GO_TELE_TO_DALARAN_CRYSTAL_FAILED "This teleport crystal cannot be used until the teleport crystal in Dalaran has been used at least once." #define GO_TELE_TO_DALARAN_CRYSTAL_FAILED "This teleport crystal cannot be used until the teleport crystal in Dalaran has been used at least once."
class go_tele_to_dalaran_crystal : public GameObjectScript class go_tele_to_dalaran_crystal : public GameObjectScript
{ {
public: public:
@@ -500,10 +498,8 @@ public:
bool OnGossipHello(Player* player, GameObject* /*go*/) bool OnGossipHello(Player* player, GameObject* /*go*/)
{ {
if (player->GetQuestRewardStatus(QUEST_TELE_CRYSTAL_FLAG)) if (player->GetQuestRewardStatus(QUEST_TELE_CRYSTAL_FLAG))
{
return false; return false;
}
else
player->GetSession()->SendNotification(GO_TELE_TO_DALARAN_CRYSTAL_FAILED); player->GetSession()->SendNotification(GO_TELE_TO_DALARAN_CRYSTAL_FAILED);
return true; return true;