mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Maps: Split Ebon Hold and Exile's reach by faction and removed forced sanctuary hack
This commit is contained in:
@@ -152,8 +152,6 @@ struct AreaTableEntry
|
||||
// helpers
|
||||
bool IsSanctuary() const
|
||||
{
|
||||
if (ContinentID == 609)
|
||||
return true;
|
||||
return (Flags[0] & AREA_FLAG_SANCTUARY) != 0;
|
||||
}
|
||||
|
||||
@@ -2538,11 +2536,27 @@ struct MapEntry
|
||||
|
||||
bool IsContinent() const
|
||||
{
|
||||
return ID == 0 || ID == 1 || ID == 530 || ID == 571 || ID == 870 || ID == 1116 || ID == 1220;
|
||||
switch (ID)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 530:
|
||||
case 571:
|
||||
case 870:
|
||||
case 1116:
|
||||
case 1220:
|
||||
case 1642:
|
||||
case 1643:
|
||||
case 2222:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsDynamicDifficultyMap() const { return (Flags[0] & MAP_FLAG_CAN_TOGGLE_DIFFICULTY) != 0; }
|
||||
bool IsGarrison() const { return (Flags[0] & MAP_FLAG_GARRISON) != 0; }
|
||||
bool IsSplitByFaction() const { return ID == 609 || ID == 2175; }
|
||||
};
|
||||
|
||||
struct MapChallengeModeEntry
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
#include "Map.h"
|
||||
#include "Player.h"
|
||||
#include "ScenarioMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldStateMgr.h"
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <numeric>
|
||||
|
||||
@@ -236,6 +238,9 @@ Map* MapManager::CreateMap(uint32 mapId, Player* player, uint32 loginInstanceId
|
||||
else
|
||||
{
|
||||
newInstanceId = 0;
|
||||
if (entry->IsSplitByFaction())
|
||||
newInstanceId = player->GetTeamId();
|
||||
|
||||
map = FindMap_i(mapId, newInstanceId);
|
||||
if (!map)
|
||||
map = CreateWorldMap(mapId, newInstanceId);
|
||||
@@ -396,3 +401,25 @@ void MapManager::FreeInstanceId(uint32 instanceId)
|
||||
_nextInstanceId = std::min(instanceId, _nextInstanceId);
|
||||
_freeInstanceIds->set(instanceId, true);
|
||||
}
|
||||
|
||||
// hack to allow conditions to access what faction owns the map (these worldstates should not be set on these maps)
|
||||
class SplitByFactionMapScript : public WorldMapScript
|
||||
{
|
||||
public:
|
||||
SplitByFactionMapScript(char const* name, uint32 mapId) : WorldMapScript(name, mapId)
|
||||
{
|
||||
}
|
||||
|
||||
void OnCreate(Map* map) override
|
||||
{
|
||||
sWorldStateMgr->SetValue(WS_TEAM_IN_INSTANCE_ALLIANCE, map->GetInstanceId() == TEAM_ALLIANCE, false, map);
|
||||
sWorldStateMgr->SetValue(WS_TEAM_IN_INSTANCE_HORDE, map->GetInstanceId() == TEAM_HORDE, false, map);
|
||||
}
|
||||
};
|
||||
|
||||
void MapManager::AddSC_BuiltInScripts()
|
||||
{
|
||||
for (MapEntry const* mapEntry : sMapStore)
|
||||
if (mapEntry->IsWorldMap() && mapEntry->IsSplitByFaction())
|
||||
new SplitByFactionMapScript(Trinity::StringFormat("world_map_set_faction_worldstates_%u", mapEntry->ID).c_str(), mapEntry->ID);
|
||||
}
|
||||
|
||||
@@ -126,6 +126,8 @@ class TC_GAME_API MapManager
|
||||
void DecreaseScheduledScriptCount(std::size_t count) { _scheduledScripts -= count; }
|
||||
bool IsScriptScheduled() const { return _scheduledScripts > 0; }
|
||||
|
||||
void AddSC_BuiltInScripts();
|
||||
|
||||
private:
|
||||
using MapKey = std::pair<uint32, uint32>;
|
||||
typedef std::map<MapKey, Map*> MapMapType;
|
||||
|
||||
@@ -1229,6 +1229,9 @@ void ScriptMgr::Initialize()
|
||||
// LFGScripts
|
||||
lfg::AddSC_LFGScripts();
|
||||
|
||||
// MapScripts
|
||||
sMapMgr->AddSC_BuiltInScripts();
|
||||
|
||||
// Load all static linked scripts through the script loader function.
|
||||
ASSERT(_script_loader_callback,
|
||||
"Script loader callback wasn't registered!");
|
||||
|
||||
Reference in New Issue
Block a user