mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Core: ported headers cleanup from master branch
This commit is contained in:
@@ -16,21 +16,29 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "InstanceScript.h"
|
||||
#include "AreaBoundary.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "GameObject.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "Player.h"
|
||||
#include "Pet.h"
|
||||
#include "WorldSession.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "ScriptReloadMgr.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptReloadMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
#include <cstdarg>
|
||||
#include <sstream>
|
||||
|
||||
BossBoundaryData::~BossBoundaryData()
|
||||
{
|
||||
@@ -109,6 +117,16 @@ ObjectGuid InstanceScript::GetGuidData(uint32 type) const
|
||||
return GetObjectGuid(type);
|
||||
}
|
||||
|
||||
Creature* InstanceScript::GetCreature(uint32 type)
|
||||
{
|
||||
return instance->GetCreature(GetObjectGuid(type));
|
||||
}
|
||||
|
||||
GameObject* InstanceScript::GetGameObject(uint32 type)
|
||||
{
|
||||
return instance->GetGameObject(GetObjectGuid(type));
|
||||
}
|
||||
|
||||
void InstanceScript::SetHeaders(std::string const& dataHeaders)
|
||||
{
|
||||
for (char header : dataHeaders)
|
||||
@@ -116,14 +134,14 @@ void InstanceScript::SetHeaders(std::string const& dataHeaders)
|
||||
headers.push_back(header);
|
||||
}
|
||||
|
||||
void InstanceScript::LoadBossBoundaries(const BossBoundaryData& data)
|
||||
void InstanceScript::LoadBossBoundaries(BossBoundaryData const& data)
|
||||
{
|
||||
for (BossBoundaryEntry const& entry : data)
|
||||
if (entry.BossId < bosses.size())
|
||||
bosses[entry.BossId].boundary.push_back(entry.Boundary);
|
||||
}
|
||||
|
||||
void InstanceScript::LoadMinionData(const MinionData* data)
|
||||
void InstanceScript::LoadMinionData(MinionData const* data)
|
||||
{
|
||||
while (data->entry)
|
||||
{
|
||||
@@ -135,7 +153,7 @@ void InstanceScript::LoadMinionData(const MinionData* data)
|
||||
TC_LOG_DEBUG("scripts", "InstanceScript::LoadMinionData: " UI64FMTD " minions loaded.", uint64(minions.size()));
|
||||
}
|
||||
|
||||
void InstanceScript::LoadDoorData(const DoorData* data)
|
||||
void InstanceScript::LoadDoorData(DoorData const* data)
|
||||
{
|
||||
while (data->entry)
|
||||
{
|
||||
@@ -518,9 +536,9 @@ void InstanceScript::DoSendNotifyToInstance(char const* format, ...)
|
||||
}
|
||||
|
||||
// Update Achievement Criteria for all players in instance
|
||||
void InstanceScript::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /*= 0*/, Unit* unit /*= NULL*/)
|
||||
void InstanceScript::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /*= 0*/, Unit* unit /*= nullptr*/)
|
||||
{
|
||||
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
Map::PlayerList const& PlayerList = instance->GetPlayers();
|
||||
|
||||
if (!PlayerList.isEmpty())
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
@@ -531,7 +549,7 @@ void InstanceScript::DoUpdateAchievementCriteria(AchievementCriteriaTypes type,
|
||||
// Start timed achievement for all players in instance
|
||||
void InstanceScript::DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
|
||||
{
|
||||
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
Map::PlayerList const& PlayerList = instance->GetPlayers();
|
||||
|
||||
if (!PlayerList.isEmpty())
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
@@ -542,7 +560,7 @@ void InstanceScript::DoStartTimedAchievement(AchievementCriteriaTimedTypes type,
|
||||
// Stop timed achievement for all players in instance
|
||||
void InstanceScript::DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
|
||||
{
|
||||
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
Map::PlayerList const& PlayerList = instance->GetPlayers();
|
||||
|
||||
if (!PlayerList.isEmpty())
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
@@ -571,7 +589,7 @@ void InstanceScript::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
|
||||
// Cast spell on all players in instance
|
||||
void InstanceScript::DoCastSpellOnPlayers(uint32 spell)
|
||||
{
|
||||
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
Map::PlayerList const& PlayerList = instance->GetPlayers();
|
||||
|
||||
if (!PlayerList.isEmpty())
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
@@ -579,14 +597,19 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell)
|
||||
player->CastSpell(player, spell, true);
|
||||
}
|
||||
|
||||
bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/)
|
||||
bool InstanceScript::ServerAllowsTwoSideGroups()
|
||||
{
|
||||
return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP);
|
||||
}
|
||||
|
||||
bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= nullptr*/, uint32 /*miscvalue1*/ /*= 0*/)
|
||||
{
|
||||
TC_LOG_ERROR("misc", "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
|
||||
instance->GetId(), criteria_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
void InstanceScript::SendEncounterUnit(uint32 type, Unit* unit /*= NULL*/, uint8 param1 /*= 0*/, uint8 param2 /*= 0*/)
|
||||
void InstanceScript::SendEncounterUnit(uint32 type, Unit* unit /*= nullptr*/, uint8 param1 /*= 0*/, uint8 param2 /*= 0*/)
|
||||
{
|
||||
// size of this packet is at most 15 (usually less)
|
||||
WorldPacket data(SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT, 15);
|
||||
@@ -658,6 +681,16 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceScript::UpdateEncounterStateForKilledCreature(uint32 creatureId, Unit* source)
|
||||
{
|
||||
UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, creatureId, source);
|
||||
}
|
||||
|
||||
void InstanceScript::UpdateEncounterStateForSpellCast(uint32 spellId, Unit* source)
|
||||
{
|
||||
UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, spellId, source);
|
||||
}
|
||||
|
||||
std::string InstanceScript::GetBossStateName(uint8 state)
|
||||
{
|
||||
// See enum EncounterState in InstanceScript.h
|
||||
@@ -679,3 +712,11 @@ std::string InstanceScript::GetBossStateName(uint8 state)
|
||||
return "INVALID";
|
||||
}
|
||||
}
|
||||
|
||||
bool InstanceHasScript(WorldObject const* obj, char const* scriptName)
|
||||
{
|
||||
if (InstanceMap* instance = obj->GetMap()->ToInstanceMap())
|
||||
return instance->GetScriptName() == scriptName;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user