Move area trigger storage from DBC to database (#742)

Renamed AreaTrigger + related stuff to AreaTriggerTeleport
This commit is contained in:
Kaev 2018-01-02 22:08:08 +01:00 committed by Yehonal
parent b669d24a1f
commit 05cd8c8c61
43 changed files with 1431 additions and 124 deletions

File diff suppressed because it is too large Load diff

View file

@ -1174,17 +1174,17 @@ class SmartTrigger : public AreaTriggerScript
SmartTrigger() : AreaTriggerScript("SmartTrigger") {}
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
bool OnTrigger(Player* player, AreaTrigger const* trigger)
{
if (!player->IsAlive())
return false;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "AreaTrigger %u is using SmartTrigger script", trigger->id);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "AreaTrigger %u is using SmartTrigger script", trigger->entry);
#endif
SmartScript script;
script.OnInitialize(NULL, trigger);
script.ProcessEventsFor(SMART_EVENT_AREATRIGGER_ONTRIGGER, player, trigger->id);
script.ProcessEventsFor(SMART_EVENT_AREATRIGGER_ONTRIGGER, player, trigger->entry);
return true;
}
};

View file

@ -4096,7 +4096,7 @@ void SmartScript::OnUpdate(uint32 const diff)
}
}
void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEntry const* at)
void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger const* at)
{
if (e.empty())
{
@ -4105,7 +4105,7 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEn
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript: EventMap for Entry %u is empty but is using SmartScript.", obj->GetEntry());
if (at)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript: EventMap for AreaTrigger %u is empty but is using SmartScript.", at->id);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript: EventMap for AreaTrigger %u is empty but is using SmartScript.", at->entry);
#endif
return;
}
@ -4132,7 +4132,7 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEn
if (mEvents.empty() && obj)
sLog->outErrorDb("SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry());
if (mEvents.empty() && at)
sLog->outErrorDb("SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->id);
sLog->outErrorDb("SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->entry);
}
void SmartScript::GetScript()
@ -4154,12 +4154,12 @@ void SmartScript::GetScript()
}
else if (trigger)
{
e = sSmartScriptMgr->GetScript((int32)trigger->id, mScriptType);
e = sSmartScriptMgr->GetScript((int32)trigger->entry, mScriptType);
FillScript(e, NULL, trigger);
}
}
void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at)
void SmartScript::OnInitialize(WorldObject* obj, AreaTrigger const* at)
{
if (obj)//handle object based scripts
{
@ -4189,7 +4189,7 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at)
mScriptType = SMART_SCRIPT_TYPE_AREATRIGGER;
trigger = at;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is AreaTrigger %u", trigger->id);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is AreaTrigger %u", trigger->entry);
#endif
}
else

View file

@ -23,9 +23,9 @@ class SmartScript
SmartScript();
~SmartScript();
void OnInitialize(WorldObject* obj, AreaTriggerEntry const* at = NULL);
void OnInitialize(WorldObject* obj, AreaTrigger const* at = NULL);
void GetScript();
void FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEntry const* at);
void FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger const* at);
void ProcessEventsFor(SMART_EVENT e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL);
void ProcessEvent(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL);
@ -267,7 +267,7 @@ class SmartScript
uint64 meOrigGUID;
GameObject* go;
uint64 goOrigGUID;
AreaTriggerEntry const* trigger;
AreaTrigger const* trigger;
SmartScriptType mScriptType;
uint32 mEventPhase;

View file

@ -148,7 +148,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
case SMART_SCRIPT_TYPE_AREATRIGGER:
{
if (!sAreaTriggerStore.LookupEntry((uint32)temp.entryOrGuid))
if (!sObjectMgr->GetAreaTrigger((uint32)temp.entryOrGuid))
{
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;

View file

@ -1761,7 +1761,7 @@ class SmartAIMgr
bool IsAreaTriggerValid(SmartScriptHolder const& e, uint32 entry)
{
if (!sAreaTriggerStore.LookupEntry(entry))
if (!sObjectMgr->GetAreaTrigger(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;

View file

@ -303,7 +303,7 @@ bool BattlegroundEY::SetupBattleground()
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
{
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(_capturePointInfo[i]._areaTrigger);
AreaTrigger const* at = sObjectMgr->GetAreaTrigger(_capturePointInfo[i]._areaTrigger);
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 0, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);

View file

@ -47,7 +47,6 @@ static WMOAreaInfoByTripple sWMOAreaInfoByTripple;
DBCStorage <AchievementEntry> sAchievementStore(Achievementfmt);
DBCStorage <AchievementCategoryEntry> sAchievementCategoryStore(AchievementCategoryfmt);
DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore(AchievementCriteriafmt);
DBCStorage <AreaTriggerEntry> sAreaTriggerStore(AreaTriggerEntryfmt);
DBCStorage <AuctionHouseEntry> sAuctionHouseStore(AuctionHouseEntryfmt);
DBCStorage <BankBagSlotPricesEntry> sBankBagSlotPricesStore(BankBagSlotPricesEntryfmt);
DBCStorage <BattlemasterListEntry> sBattlemasterListStore(BattlemasterListEntryfmt);
@ -258,7 +257,6 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sAchievementStore, dbcPath, "Achievement.dbc", &CustomAchievementfmt, &CustomAchievementIndex);
LoadDBC(availableDbcLocales, bad_dbc_files, sAchievementCategoryStore, dbcPath, "Achievement_Category.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sAchievementCriteriaStore, dbcPath, "Achievement_Criteria.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sAreaTriggerStore, dbcPath, "AreaTrigger.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sAreaGroupStore, dbcPath, "AreaGroup.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sAreaPOIStore, dbcPath, "AreaPOI.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sAuctionHouseStore, dbcPath, "AuctionHouse.dbc");

View file

@ -57,7 +57,6 @@ extern DBCStorage <AchievementCategoryEntry> sAchievementCategoryStore;
extern DBCStorage <AreaTableEntry> sAreaTableStore;
extern DBCStorage <AreaGroupEntry> sAreaGroupStore;
extern DBCStorage <AreaPOIEntry> sAreaPOIStore;
extern DBCStorage <AreaTriggerEntry> sAreaTriggerStore;
extern DBCStorage <AuctionHouseEntry> sAuctionHouseStore;
extern DBCStorage <BankBagSlotPricesEntry> sBankBagSlotPricesStore;
extern DBCStorage <BarberShopStyleEntry> sBarberShopStyleStore;

View file

@ -561,20 +561,6 @@ struct AreaPOIEntry
//uint32 val2; //53
};
struct AreaTriggerEntry
{
uint32 id; // 0 m_ID
uint32 mapid; // 1 m_ContinentID
float x; // 2 m_x
float y; // 3 m_y
float z; // 4 m_z
float radius; // 5 m_radius
float box_x; // 6 m_box_length
float box_y; // 7 m_box_width
float box_z; // 8 m_box_heigh
float box_orientation; // 9 m_box_yaw
};
struct AuctionHouseEntry
{
uint32 houseId; // 0 index

View file

@ -15,15 +15,13 @@ char const AchievementCriteriafmt[] = "niiiiiiiixxxxxxxxxxxxxxxxxiiiix";
char const AreaTableEntryfmt[] = "niiiixxxxxissssssssssssssssxiiiiixxx";
char const AreaGroupEntryfmt[] = "niiiiiii";
char const AreaPOIEntryfmt[] = "niiiiiiiiiiifffixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
char const AreaTriggerEntryfmt[] = "niffffffff";
char const AuctionHouseEntryfmt[] = "niiixxxxxxxxxxxxxxxxx";
char const BankBagSlotPricesEntryfmt[] = "ni";
char const BarberShopStyleEntryfmt[] = "nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
char const BattlemasterListEntryfmt[] = "niiiiiiiiixssssssssssssssssxiixx";
char const CharStartOutfitEntryfmt[] = "dbbbXiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char const CharTitlesEntryfmt[] = "nxssssssssssssssssxssssssssssssssssxi";
char const ChatChannelsEntryfmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxx";
// ChatChannelsEntryfmt, index not used (more compact store)
char const ChatChannelsEntryfmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxx"; // ChatChannelsEntryfmt, index not used (more compact store)
char const ChrClassesEntryfmt[] = "nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
char const ChrRacesEntryfmt[] = "nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
char const CinematicSequencesEntryfmt[] = "nxxxxxxxxx";

View file

@ -224,7 +224,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
// No teleport coords in database, load from areatriggers
if (dungeon.type != LFG_TYPE_RANDOM && dungeon.x == 0.0f && dungeon.y == 0.0f && dungeon.z == 0.0f)
{
AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(dungeon.map);
AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(dungeon.map);
if (!at)
{
sLog->outError("LFGMgr::LoadLFGDungeons: Failed to load dungeon %s, cant find areatrigger for map %u", dungeon.name.c_str(), dungeon.map);

View file

@ -2978,9 +2978,9 @@ void Player::SetInWater(bool apply)
getHostileRefManager().updateThreatTables();
}
bool Player::IsInAreaTriggerRadius(const AreaTriggerEntry* trigger) const
bool Player::IsInAreaTriggerRadius(const AreaTrigger* trigger) const
{
if (!trigger || GetMapId() != trigger->mapid)
if (!trigger || GetMapId() != trigger->map)
return false;
if (trigger->radius > 0.f)
@ -2992,8 +2992,8 @@ bool Player::IsInAreaTriggerRadius(const AreaTriggerEntry* trigger) const
}
else
{
Position center = {trigger->x, trigger->y, trigger->z, trigger->box_orientation};
if (!IsWithinBox(center, trigger->box_x / 2.f, trigger->box_y / 2.f, trigger->box_z / 2.f))
Position center = {trigger->x, trigger->y, trigger->z, trigger->orientation};
if (!IsWithinBox(center, trigger->length / 2.f, trigger->width / 2.f, trigger->height / 2.f))
return false;
}
@ -7608,7 +7608,7 @@ void Player::UpdateArea(uint32 newArea)
}
else if (!(areaFlags & AREA_FLAG_CAPITAL))
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(GetInnTriggerId());
AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(GetInnTriggerId());
if (!atEntry || !IsInAreaTriggerRadius(atEntry))
RemoveRestState();
}
@ -17784,7 +17784,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (uint32 destInstId = sInstanceSaveMgr->PlayerGetDestinationInstanceId(this, mapId, GetDifficulty(mapEntry->IsRaid())))
{
instanceId = destInstId;
if (AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId))
if (AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId))
{
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
fixed = true;
@ -17876,7 +17876,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
{
bool fixed = false;
if (mapEntry->Instanceable())
if (AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId))
if (AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId))
{
fixed = true;
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
@ -17922,7 +17922,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// if the player is in an instance and it has been reset in the meantime teleport him to the entrance
if ((instanceId && !sInstanceSaveMgr->GetInstanceSave(instanceId) && !mapEntry->IsBattlegroundOrArena()) || (!instanceId && mapEntry->IsDungeon()))
{
AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId);
AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId);
if (at)
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
else
@ -17936,7 +17936,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (!map)
{
instanceId = 0;
AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(mapId);
AreaTriggerTeleport const* at = sObjectMgr->GetGoBackTrigger(mapId);
if (at)
{
sLog->outError("Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());

View file

@ -19,6 +19,7 @@
#include "Unit.h"
#include "Battleground.h"
#include "WorldSession.h"
#include "ObjectMgr.h"
#include <string>
#include <vector>
@ -1128,7 +1129,7 @@ class Player : public Unit, public GridObject<Player>
bool IsInWater(bool allowAbove = false) const;
bool IsUnderWater() const;
bool IsFalling() const;
bool IsInAreaTriggerRadius(const AreaTriggerEntry* trigger) const;
bool IsInAreaTriggerRadius(const AreaTrigger* trigger) const;
void SendInitialPacketsBeforeAddToMap();
void SendInitialPacketsAfterAddToMap();

View file

@ -5551,7 +5551,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
uint32 trigger_ID = fields[0].GetUInt32();
uint32 quest_ID = fields[1].GetUInt32();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID);
AreaTrigger const* atEntry = GetAreaTrigger(trigger_ID);
if (!atEntry)
{
sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID);
@ -5609,7 +5609,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
uint32 Trigger_ID = fields[0].GetUInt32();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID);
if (!atEntry)
{
sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
@ -5648,7 +5648,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
uint32 Trigger_ID = fields[0].GetUInt32();
const char *scriptName = fields[1].GetCString();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID);
if (!atEntry)
{
sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
@ -6048,11 +6048,62 @@ void ObjectMgr::RemoveGraveyardLink(uint32 id, uint32 zoneId, TeamId teamId, boo
}
}
void ObjectMgr::LoadAreaTriggers()
{
uint32 oldMSTime = getMSTime();
_areaTriggerStore.clear();
QueryResult result = WorldDatabase.Query("SELECT entry, map, x, y, z, radius, length, width, height, orientation FROM areatrigger");
if (!result)
{
sLog->outString(">> Loaded 0 area trigger definitions. DB table `areatrigger` is empty.");
sLog->outString();
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
++count;
AreaTrigger at;
at.entry = fields[0].GetUInt32();
at.map = fields[1].GetUInt32();
at.x = fields[2].GetFloat();
at.y = fields[3].GetFloat();
at.z = fields[4].GetFloat();
at.radius = fields[5].GetFloat();
at.length = fields[6].GetFloat();
at.width = fields[7].GetFloat();
at.height = fields[8].GetFloat();
at.orientation = fields[9].GetFloat();
MapEntry const* mapEntry = sMapStore.LookupEntry(at.map);
if (!mapEntry)
{
sLog->outErrorDb("Area trigger (ID:%u) map (ID: %u) does not exist in `Map.dbc`.", at.entry, at.map);
continue;
}
_areaTriggerStore[at.entry] = at;
} while (result->NextRow());
sLog->outString(">> Loaded %u area trigger definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
void ObjectMgr::LoadAreaTriggerTeleports()
{
uint32 oldMSTime = getMSTime();
_areaTriggerStore.clear(); // need for reload case
_areaTriggerTeleportStore.clear(); // need for reload case
// 0 1 2 3 4 5
QueryResult result = WorldDatabase.Query("SELECT ID, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
@ -6074,7 +6125,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
uint32 Trigger_ID = fields[0].GetUInt32();
AreaTrigger at;
AreaTriggerTeleport at;
at.target_mapId = fields[1].GetUInt16();
at.target_X = fields[2].GetFloat();
@ -6082,7 +6133,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
at.target_Z = fields[4].GetFloat();
at.target_Orientation = fields[5].GetFloat();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID);
if (!atEntry)
{
sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
@ -6102,7 +6153,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
continue;
}
_areaTriggerStore[Trigger_ID] = at;
_areaTriggerTeleportStore[Trigger_ID] = at;
} while (result->NextRow());
@ -6212,7 +6263,7 @@ void ObjectMgr::LoadAccessRequirements()
/*
* Searches for the areatrigger which teleports players out of the given map with instance_template.parent field support
*/
AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
AreaTriggerTeleport const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
{
bool useParentDbValue = false;
uint32 parentId = 0;
@ -6232,11 +6283,11 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
}
uint32 entrance_map = uint32(mapEntry->entrance_map);
for (AreaTriggerContainer::const_iterator itr = _areaTriggerStore.begin(); itr != _areaTriggerStore.end(); ++itr)
for (AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.begin(); itr != _areaTriggerTeleportStore.end(); ++itr)
if ((!useParentDbValue && itr->second.target_mapId == entrance_map) || (useParentDbValue && itr->second.target_mapId == parentId))
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
if (atEntry && atEntry->mapid == Map)
AreaTrigger const* atEntry = GetAreaTrigger(itr->first);
if (atEntry && atEntry->map == Map)
return &itr->second;
}
return NULL;
@ -6245,9 +6296,9 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
/**
* Searches for the areatrigger which teleports players to the given map
*/
AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const
AreaTriggerTeleport const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const
{
for (AreaTriggerContainer::const_iterator itr = _areaTriggerStore.begin(); itr != _areaTriggerStore.end(); ++itr)
for (AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.begin(); itr != _areaTriggerTeleportStore.end(); ++itr)
{
if (itr->second.target_mapId == Map) // Id is used to determine correct Scarlet Monastery instance
{

View file

@ -389,7 +389,7 @@ struct SpellClickInfo
typedef std::multimap<uint32, SpellClickInfo> SpellClickInfoContainer;
typedef std::pair<SpellClickInfoContainer::const_iterator, SpellClickInfoContainer::const_iterator> SpellClickInfoMapBounds;
struct AreaTrigger
struct AreaTriggerTeleport
{
uint32 target_mapId;
float target_X;
@ -398,6 +398,20 @@ struct AreaTrigger
float target_Orientation;
};
struct AreaTrigger
{
uint32 entry;
uint32 map;
float x;
float y;
float z;
float radius;
float length;
float width;
float height;
float orientation;
};
struct BroadcastText
{
BroadcastText() : Id(0), Language(0), EmoteId0(0), EmoteId1(0), EmoteId2(0),
@ -685,6 +699,8 @@ class ObjectMgr
typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerContainer;
typedef UNORDERED_MAP<uint32, AreaTriggerTeleport> AreaTriggerTeleportContainer;
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptContainer;
typedef UNORDERED_MAP<uint32, AccessRequirement*> AccessRequirementContainer;
@ -812,6 +828,14 @@ class ObjectMgr
return NULL;
}
AreaTriggerTeleport const* GetAreaTriggerTeleport(uint32 trigger) const
{
AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.find(trigger);
if (itr != _areaTriggerTeleportStore.end())
return &itr->second;
return NULL;
}
AccessRequirement const* GetAccessRequirement(uint32 mapid, Difficulty difficulty) const
{
AccessRequirementContainer::const_iterator itr = _accessRequirementStore.find(MAKE_PAIR32(mapid, difficulty));
@ -820,8 +844,8 @@ class ObjectMgr
return NULL;
}
AreaTrigger const* GetGoBackTrigger(uint32 Map) const;
AreaTrigger const* GetMapEntranceTrigger(uint32 Map) const;
AreaTriggerTeleport const* GetGoBackTrigger(uint32 Map) const;
AreaTriggerTeleport const* GetMapEntranceTrigger(uint32 Map) const;
uint32 GetAreaTriggerScriptId(uint32 trigger_id);
SpellScriptsBounds GetSpellScriptsBounds(uint32 spell_id);
@ -984,6 +1008,7 @@ class ObjectMgr
void LoadGossipText();
void LoadAreaTriggers();
void LoadAreaTriggerTeleports();
void LoadAccessRequirements();
void LoadQuestAreaTriggers();
@ -1333,6 +1358,7 @@ class ObjectMgr
TavernAreaTriggerContainer _tavernAreaTriggerStore;
GossipTextContainer _gossipTextStore;
AreaTriggerContainer _areaTriggerStore;
AreaTriggerTeleportContainer _areaTriggerTeleportStore;
AreaTriggerScriptContainer _areaTriggerScriptStore;
AccessRequirementContainer _accessRequirementStore;
DungeonEncounterContainer _dungeonEncounterStore;

View file

@ -991,7 +991,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar) || !pCurrChar->CheckInstanceLoginValid())
{
AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(pCurrChar->GetMapId());
AreaTriggerTeleport const* at = sObjectMgr->GetGoBackTrigger(pCurrChar->GetMapId());
if (at)
pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation());
else

View file

@ -886,7 +886,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
return;
}
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId);
AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(triggerId);
if (!atEntry)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
@ -900,7 +900,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
player->GetName().c_str(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId);
player->GetName().c_str(), atEntry->map, player->GetMapId(), player->GetGUIDLow(), triggerId);
#endif
return;
}
@ -919,7 +919,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
if (sObjectMgr->IsTavernAreaTrigger(triggerId))
{
// set resting flag we are in the inn
player->SetRestState(atEntry->id);
player->SetRestState(atEntry->entry);
if (sWorld->IsFFAPvPRealm())
player->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
@ -938,7 +938,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
if (pvp->HandleAreaTrigger(_player, triggerId))
return;
AreaTrigger const* at = sObjectMgr->GetAreaTrigger(triggerId);
AreaTriggerTeleport const* at = sObjectMgr->GetAreaTriggerTeleport(triggerId);
if (!at)
return;

View file

@ -933,12 +933,12 @@ GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go)
return tmpscript->GetAI(go);
}
bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger)
bool ScriptMgr::OnAreaTrigger(Player* player, AreaTrigger const* trigger)
{
ASSERT(player);
ASSERT(trigger);
GET_SCRIPT_RET(AreaTriggerScript, sObjectMgr->GetAreaTriggerScriptId(trigger->id), tmpscript, false);
GET_SCRIPT_RET(AreaTriggerScript, sObjectMgr->GetAreaTriggerScriptId(trigger->entry), tmpscript, false);
return tmpscript->OnTrigger(player, trigger);
}

View file

@ -586,7 +586,7 @@ class AreaTriggerScript : public ScriptObject
bool IsDatabaseBound() const { return true; }
// Called when the area trigger is activated by a player.
virtual bool OnTrigger(Player* /*player*/, AreaTriggerEntry const* /*trigger*/) { return false; }
virtual bool OnTrigger(Player* /*player*/, AreaTrigger const* /*trigger*/) { return false; }
};
class BattlegroundScript : public ScriptObject
@ -1136,7 +1136,7 @@ class ScriptMgr
public: /* AreaTriggerScript */
bool OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger);
bool OnAreaTrigger(Player* player, AreaTrigger const* trigger);
public: /* BattlegroundScript */

View file

@ -1545,7 +1545,10 @@ void World::SetInitialWorldSettings()
sLog->outString("Loading SpellArea Data..."); // must be after quest load
sSpellMgr->LoadSpellAreas();
sLog->outString("Loading AreaTrigger definitions...");
sLog->outString("Loading Area Trigger definitions");
sObjectMgr->LoadAreaTriggers();
sLog->outString("Loading Area Trigger Teleport definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
sLog->outString("Loading Access Requirements...");

View file

@ -362,7 +362,7 @@ public:
if (!areaTriggerId)
return false;
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(areaTriggerId);
AreaTrigger const* at = sObjectMgr->GetAreaTrigger(areaTriggerId);
if (!at)
{
handler->PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, areaTriggerId);
@ -370,9 +370,9 @@ public:
return false;
}
if (!MapManager::IsValidMapCoord(at->mapid, at->x, at->y, at->z))
if (!MapManager::IsValidMapCoord(at->map, at->x, at->y, at->z))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, at->x, at->y, at->mapid);
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, at->x, at->y, at->map);
handler->SetSentErrorMessage(true);
return false;
}
@ -387,7 +387,7 @@ public:
else
player->SaveRecallPosition();
player->TeleportTo(at->mapid, at->x, at->y, at->z, player->GetOrientation());
player->TeleportTo(at->map, at->x, at->y, at->z, player->GetOrientation());
return true;
}

View file

@ -58,6 +58,7 @@ public:
{ "achievement_criteria_data", SEC_ADMINISTRATOR, true, &HandleReloadAchievementCriteriaDataCommand, "" },
{ "achievement_reward", SEC_ADMINISTRATOR, true, &HandleReloadAchievementRewardCommand, "" },
{ "all", SEC_ADMINISTRATOR, true, nullptr, "", reloadAllCommandTable },
{ "areatrigger", SEC_ADMINISTRATOR, true, &HandleReloadAreaTriggerCommand, "" },
{ "areatrigger_involvedrelation", SEC_ADMINISTRATOR, true, &HandleReloadQuestAreaTriggersCommand, "" },
{ "areatrigger_tavern", SEC_ADMINISTRATOR, true, &HandleReloadAreaTriggerTavernCommand, "" },
{ "areatrigger_teleport", SEC_ADMINISTRATOR, true, &HandleReloadAreaTriggerTeleportCommand, "" },
@ -351,9 +352,17 @@ public:
return true;
}
static bool HandleReloadAreaTriggerCommand(ChatHandler* handler, const char* /*args*/)
{
sLog->outString("Re-Loading Area Trigger definitions...");
sObjectMgr->LoadAreaTriggers();
handler->SendGlobalGMSysMessage("DB table `areatrigger` reloaded.");
return true;
}
static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, const char* /*args*/)
{
sLog->outString("Re-Loading AreaTrigger teleport definitions...");
sLog->outString("Re-Loading Area Trigger teleport definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
handler->SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded.");
return true;

View file

@ -76,7 +76,7 @@ class at_ring_of_law : public AreaTriggerScript
public:
at_ring_of_law() : AreaTriggerScript("at_ring_of_law") { }
bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
bool OnTrigger(Player* player, const AreaTrigger* /*at*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
{

View file

@ -597,7 +597,7 @@ class at_dragonspire_hall : public AreaTriggerScript
public:
at_dragonspire_hall() : AreaTriggerScript("at_dragonspire_hall") { }
bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
bool OnTrigger(Player* player, const AreaTrigger* /*at*/)
{
if (player && player->IsAlive())
{
@ -621,7 +621,7 @@ class at_blackrock_stadium : public AreaTriggerScript
public:
at_blackrock_stadium() : AreaTriggerScript("at_blackrock_stadium") { }
bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
bool OnTrigger(Player* player, const AreaTrigger* /*at*/)
{
if (player && player->IsAlive())
{

View file

@ -203,7 +203,7 @@ class at_malfurion_stormrage : public AreaTriggerScript
public:
at_malfurion_stormrage() : AreaTriggerScript("at_malfurion_stormrage") { }
bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
bool OnTrigger(Player* player, const AreaTrigger* /*at*/)
{
if (player->GetInstanceScript() && !player->FindNearestCreature(NPC_MALFURION_STORMRAGE, 15.0f) &&
player->GetQuestStatus(QUEST_THE_CHARGE_OF_DRAGONFLIGHTS) == QUEST_STATUS_REWARDED && player->GetQuestStatus(QUEST_ERANIKUS_TYRANT_OF_DREAMS) != QUEST_STATUS_REWARDED)

View file

@ -512,7 +512,7 @@ class AreaTrigger_at_sunwell_madrigosa : public AreaTriggerScript
AreaTrigger_at_sunwell_madrigosa() : AreaTriggerScript("at_sunwell_madrigosa") {}
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
if (instance->GetBossState(DATA_MADRIGOSA) != DONE)

View file

@ -487,7 +487,7 @@ class AreaTrigger_at_sunwell_eredar_twins : public AreaTriggerScript
AreaTrigger_at_sunwell_eredar_twins() : AreaTriggerScript("at_sunwell_eredar_twins") {}
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
if (instance->GetBossState(DATA_EREDAR_TWINS_INTRO) != DONE)

View file

@ -148,7 +148,7 @@ class at_twilight_grove : public AreaTriggerScript
public:
at_twilight_grove() : AreaTriggerScript("at_twilight_grove") { }
bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
bool OnTrigger(Player* player, const AreaTrigger* /*at*/)
{
if (player->HasQuestForItem(ITEM_FRAGMENT) && !player->HasItemCount(ITEM_FRAGMENT))
player->SummonCreature(NPC_TWILIGHT_CORRUPTER, -10328.16f, -489.57f, 49.95f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 240000);

View file

@ -853,7 +853,7 @@ class at_bring_your_orphan_to : public AreaTriggerScript
public:
at_bring_your_orphan_to() : AreaTriggerScript("at_bring_your_orphan_to") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
bool OnTrigger(Player* player, AreaTrigger const* trigger)
{
if (player->isDead() || !player->HasAura(SPELL_ORPHAN_OUT))
return false;
@ -861,7 +861,7 @@ class at_bring_your_orphan_to : public AreaTriggerScript
uint32 questId = 0;
uint32 orphanId = 0;
switch (trigger->id)
switch (trigger->entry)
{
case AT_DOWN_AT_THE_DOCKS:
questId = QUEST_DOWN_AT_THE_DOCKS;

View file

@ -106,7 +106,7 @@ class at_ancient_leaf : public AreaTriggerScript
public:
at_ancient_leaf() : AreaTriggerScript("at_ancient_leaf") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (player->IsGameMaster() || !player->IsAlive())
return false;

View file

@ -450,7 +450,7 @@ class at_baltharus_plateau : public AreaTriggerScript
public:
at_baltharus_plateau() : AreaTriggerScript("at_baltharus_plateau") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
{

View file

@ -1296,7 +1296,7 @@ class at_hor_shadow_throne : public AreaTriggerScript
public:
at_hor_shadow_throne() : AreaTriggerScript("at_hor_shadow_throne") { }
bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
bool OnTrigger(Player* player, const AreaTrigger* /*at*/)
{
if (player->IsGameMaster())
return false;
@ -1996,7 +1996,7 @@ class at_hor_battered_hilt_start : public AreaTriggerScript
public:
at_hor_battered_hilt_start() : AreaTriggerScript("at_hor_battered_hilt_start") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (player->HasAura(70013))
if (InstanceScript* instance = player->GetInstanceScript())
@ -2010,7 +2010,7 @@ class at_hor_battered_hilt_throw : public AreaTriggerScript
public:
at_hor_battered_hilt_throw() : AreaTriggerScript("at_hor_battered_hilt_throw") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (player->HasAura(70013))
if (InstanceScript* instance = player->GetInstanceScript())

View file

@ -1556,7 +1556,7 @@ class at_tyrannus_event_starter : public AreaTriggerScript
public:
at_tyrannus_event_starter() : AreaTriggerScript("at_tyrannus_event_starter") { }
bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
bool OnTrigger(Player* player, const AreaTrigger* /*at*/)
{
InstanceScript* inst = player->GetInstanceScript();
if (!inst)

View file

@ -1745,7 +1745,7 @@ class at_sindragosa_lair : public AreaTriggerScript
public:
at_sindragosa_lair() : AreaTriggerScript("at_sindragosa_lair") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
{

View file

@ -2245,7 +2245,7 @@ class at_icc_saurfang_portal : public AreaTriggerScript
public:
at_icc_saurfang_portal() : AreaTriggerScript("at_icc_saurfang_portal") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
InstanceScript* instance = player->GetInstanceScript();
if (!instance || instance->GetBossState(DATA_DEATHBRINGER_SAURFANG) != DONE)
@ -2288,7 +2288,7 @@ class at_icc_shutdown_traps : public AreaTriggerScript
public:
at_icc_shutdown_traps() : AreaTriggerScript("at_icc_shutdown_traps") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
instance->SetData(DATA_COLDFLAME_JETS, DONE);
@ -2301,7 +2301,7 @@ class at_icc_start_blood_quickening : public AreaTriggerScript
public:
at_icc_start_blood_quickening() : AreaTriggerScript("at_icc_start_blood_quickening") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
instance->SetData(DATA_BLOOD_QUICKENING_STATE, IN_PROGRESS);
@ -2314,7 +2314,7 @@ class at_icc_start_frostwing_gauntlet : public AreaTriggerScript
public:
at_icc_start_frostwing_gauntlet() : AreaTriggerScript("at_icc_start_frostwing_gauntlet") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
if (instance->GetBossState(DATA_SISTER_SVALNA) != DONE)
@ -3710,7 +3710,7 @@ class at_icc_gauntlet_event : public AreaTriggerScript
public:
at_icc_gauntlet_event() : AreaTriggerScript("at_icc_gauntlet_event") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
if (instance->GetBossState(DATA_SINDRAGOSA_GAUNTLET) == NOT_STARTED && !player->IsGameMaster())
@ -3725,7 +3725,7 @@ class at_icc_putricide_trap : public AreaTriggerScript
public:
at_icc_putricide_trap() : AreaTriggerScript("at_icc_putricide_trap") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (InstanceScript* instance = player->GetInstanceScript())
if (instance->GetData(DATA_PUTRICIDE_TRAP_STATE) == NOT_STARTED && !player->IsGameMaster())
@ -3740,7 +3740,7 @@ class at_icc_spire_frostwyrm : public AreaTriggerScript
public:
at_icc_spire_frostwyrm() : AreaTriggerScript("at_icc_spire_frostwyrm") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (Creature* frostwyrm = player->FindNearestCreature(NPC_SPIRE_FROSTWYRM, 150.0f, true))
if (frostwyrm->GetPositionZ() > 250.0f && frostwyrm->AI())

View file

@ -64,7 +64,7 @@ class at_frozen_throne_teleport : public AreaTriggerScript
public:
at_frozen_throne_teleport() : AreaTriggerScript("at_frozen_throne_teleport") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (player->IsInCombat())
{

View file

@ -465,7 +465,7 @@ class AreaTrigger_at_celestial_planetarium_enterance : public AreaTriggerScript
{
}
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (player->IsAlive())
if (uint32 questId = (player->GetMap()->Is25ManRaid() ? 13816 : 13607 /*QUEST_CELESTIAL_PLANETARIUM*/))

View file

@ -1033,7 +1033,7 @@ class at_q24545_frostmourne_cavern : public AreaTriggerScript
public:
at_q24545_frostmourne_cavern() : AreaTriggerScript("at_q24545_frostmourne_cavern") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (player->GetPhaseMask() & 2)
if (Creature* c = player->FindNearestCreature(NPC_SAC_LICH_KING, 60.0f, true))

View file

@ -143,7 +143,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
{
case TEAM_ALLIANCE:
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_A);
AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(SI_AREATRIGGER_A);
if (atEntry)
{
// 5.0f is safe-distance
@ -177,7 +177,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
break;
case TEAM_HORDE:
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_H);
AreaTrigger const* atEntry = sObjectMgr->GetAreaTrigger(SI_AREATRIGGER_H);
if (atEntry)
{
// 5.0f is safe-distance

View file

@ -273,7 +273,7 @@ class at_shattered_halls_execution : public AreaTriggerScript
public:
at_shattered_halls_execution() : AreaTriggerScript("at_shattered_halls_execution") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/)
{
if (InstanceScript* instanceScript = player->GetInstanceScript())
instanceScript->SetData(DATA_ENTERED_ROOM, DATA_ENTERED_ROOM);

View file

@ -560,7 +560,7 @@ class at_commander_dawnforge : public AreaTriggerScript
public:
at_commander_dawnforge() : AreaTriggerScript("at_commander_dawnforge") { }
bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
bool OnTrigger(Player* player, const AreaTrigger* /*at*/)
{
//if player lost aura or not have at all, we should not try start event.
if (!player->HasAura(SPELL_SUNFURY_DISGUISE))

View file

@ -38,7 +38,7 @@ class AreaTrigger_at_voltarus_middle : public AreaTriggerScript
{
}
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (player->IsAlive() && !player->IsInCombat())
if (player->HasItemCount(39319)) // Scepter of Domination
@ -71,7 +71,7 @@ class AreaTrigger_at_coilfang_waterfall : public AreaTriggerScript
{
}
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (GameObject* go = GetClosestGameObjectWithEntry(player, GO_COILFANG_WATERFALL, 35.0f))
if (go->getLootState() == GO_READY)
@ -103,7 +103,7 @@ class AreaTrigger_at_legion_teleporter : public AreaTriggerScript
{
}
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (player->IsAlive() && !player->IsInCombat())
{
@ -145,7 +145,7 @@ class AreaTrigger_at_stormwright_shelf : public AreaTriggerScript
{
}
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (!player->isDead() && player->GetQuestStatus(QUEST_STRENGTH_OF_THE_TEMPEST) == QUEST_STATUS_INCOMPLETE)
player->CastSpell(player, SPELL_CREATE_TRUE_POWER_OF_THE_TEMPEST, false);
@ -173,7 +173,7 @@ class AreaTrigger_at_scent_larkorwi : public AreaTriggerScript
{
}
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (!player->isDead() && player->GetQuestStatus(QUEST_SCENT_OF_LARKORWI) == QUEST_STATUS_INCOMPLETE)
{
@ -204,7 +204,7 @@ class AreaTrigger_at_last_rites : public AreaTriggerScript
{
}
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
bool OnTrigger(Player* player, AreaTrigger const* trigger)
{
QuestStatus QLR = player->GetQuestStatus(QUEST_LAST_RITES);
QuestStatus QBT = player->GetQuestStatus(QUEST_BREAKING_THROUGH);
@ -214,7 +214,7 @@ class AreaTrigger_at_last_rites : public AreaTriggerScript
WorldLocation pPosition;
switch (trigger->id)
switch (trigger->entry)
{
case 5332:
case 5338:
@ -263,12 +263,12 @@ class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript
AreaTrigger_at_sholazar_waygate() : AreaTriggerScript("at_sholazar_waygate") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
bool OnTrigger(Player* player, AreaTrigger const* trigger)
{
if (!player->isDead() && (player->GetQuestStatus(QUEST_MEETING_A_GREAT_ONE) != QUEST_STATUS_NONE ||
(player->GetQuestStatus(QUEST_THE_MAKERS_OVERLOOK) == QUEST_STATUS_REWARDED && player->GetQuestStatus(QUEST_THE_MAKERS_PERCH) == QUEST_STATUS_REWARDED)))
{
switch (trigger->id)
switch (trigger->entry)
{
case AT_SHOLAZAR:
player->CastSpell(player, SPELL_SHOLAZAR_TO_UNGORO_TELEPORT, true);
@ -300,7 +300,7 @@ class AreaTrigger_at_nats_landing : public AreaTriggerScript
public:
AreaTrigger_at_nats_landing() : AreaTriggerScript("at_nats_landing") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
if (!player->IsAlive() || !player->HasAura(SPELL_FISH_PASTE))
return false;
@ -335,7 +335,7 @@ class AreaTrigger_at_sentry_point : public AreaTriggerScript
public:
AreaTrigger_at_sentry_point() : AreaTriggerScript("at_sentry_point") { }
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/)
{
auto quest_status = player->GetQuestStatus(QUEST_MISSING_DIPLO_PT14);
if (!player->IsAlive() || quest_status == QUEST_STATUS_NONE || quest_status == QUEST_STATUS_REWARDED)
@ -378,9 +378,9 @@ class AreaTrigger_at_brewfest : public AreaTriggerScript
_triggerTimes[AT_BREWFEST_DUROTAR] = _triggerTimes[AT_BREWFEST_DUN_MOROGH] = 0;
}
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
bool OnTrigger(Player* player, AreaTrigger const* trigger)
{
uint32 triggerId = trigger->id;
uint32 triggerId = trigger->entry;
// Second trigger happened too early after first, skip for now
if (sWorld->GetGameTime() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
return false;
@ -431,15 +431,15 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
_triggerTimes[AT_AREA_52_SOUTH] = _triggerTimes[AT_AREA_52_NORTH] = _triggerTimes[AT_AREA_52_WEST] = _triggerTimes[AT_AREA_52_EAST] = 0;
}
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
bool OnTrigger(Player* player, AreaTrigger const* trigger)
{
float x = 0.0f, y = 0.0f, z = 0.0f;
if (!player->IsAlive())
return false;
uint32 triggerId = trigger->id;
if (sWorld->GetGameTime() - _triggerTimes[trigger->id] < SUMMON_COOLDOWN)
uint32 triggerId = trigger->entry;
if (sWorld->GetGameTime() - _triggerTimes[trigger->entry] < SUMMON_COOLDOWN)
return false;
switch (triggerId)
@ -468,7 +468,7 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
player->SummonCreature(NPC_SPOTLIGHT, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 5000);
player->AddAura(SPELL_A52_NEURALYZER, player);
_triggerTimes[trigger->id] = sWorld->GetGameTime();
_triggerTimes[trigger->entry] = sWorld->GetGameTime();
return false;
}