Core/Entities: Phasing rewrite
This commit is contained in:
@@ -271,7 +271,7 @@ namespace Game.Conditions
|
||||
condMeets = (ConditionValue2 == Global.WorldMgr.getWorldState((WorldStates)ConditionValue1));
|
||||
break;
|
||||
case ConditionTypes.PhaseId:
|
||||
condMeets = obj.IsInPhase(ConditionValue1);
|
||||
condMeets = obj.GetPhaseShift().HasPhase(ConditionValue1);
|
||||
break;
|
||||
case ConditionTypes.Title:
|
||||
if (player != null)
|
||||
@@ -303,7 +303,7 @@ namespace Game.Conditions
|
||||
condMeets = unit.IsInWater();
|
||||
break;
|
||||
case ConditionTypes.TerrainSwap:
|
||||
condMeets = obj.IsInTerrainSwap(ConditionValue1);
|
||||
condMeets = obj.GetPhaseShift().HasVisibleMapId(ConditionValue1);
|
||||
break;
|
||||
case ConditionTypes.StandState:
|
||||
{
|
||||
|
||||
@@ -307,17 +307,7 @@ namespace Game
|
||||
Global.ObjectMgr.LoadGossipMenuItems();
|
||||
Global.SpellMgr.UnloadSpellInfoImplicitTargetConditionLists();
|
||||
|
||||
Log.outInfo(LogFilter.Server, "Re-Loading `terrain_phase_info` Table for Conditions!");
|
||||
Global.ObjectMgr.LoadTerrainPhaseInfo();
|
||||
|
||||
Log.outInfo(LogFilter.Server, "Re-Loading `terrain_swap_defaults` Table for Conditions!");
|
||||
Global.ObjectMgr.LoadTerrainSwapDefaults();
|
||||
|
||||
Log.outInfo(LogFilter.Server, "Re-Loading `terrain_worldmap` Table for Conditions!");
|
||||
Global.ObjectMgr.LoadTerrainWorldMaps();
|
||||
|
||||
Log.outInfo(LogFilter.Server, "Re-Loading `phase_area` Table for Conditions!");
|
||||
Global.ObjectMgr.LoadAreaPhases();
|
||||
Global.ObjectMgr.UnloadPhaseConditions();
|
||||
}
|
||||
|
||||
SQLResult result = DB.World.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, " +
|
||||
@@ -689,29 +679,36 @@ namespace Game
|
||||
{
|
||||
if (cond.SourceEntry == 0)
|
||||
{
|
||||
bool found = false;
|
||||
var map = Global.ObjectMgr.GetAreaAndZonePhases();
|
||||
foreach (var key in map.Keys)
|
||||
PhaseInfoStruct phaseInfo = Global.ObjectMgr.GetPhaseInfo(cond.SourceGroup);
|
||||
if (phaseInfo != null)
|
||||
{
|
||||
foreach (PhaseInfoStruct phase in map[key])
|
||||
bool found = false;
|
||||
foreach (uint areaId in phaseInfo.Areas)
|
||||
{
|
||||
if (phase.Id == cond.SourceGroup)
|
||||
List<PhaseAreaInfo> phases = Global.ObjectMgr.GetPhasesForArea(areaId);
|
||||
if (phases != null)
|
||||
{
|
||||
phase.Conditions.Add(cond);
|
||||
found = true;
|
||||
foreach (PhaseAreaInfo phase in phases)
|
||||
{
|
||||
if (phase.PhaseInfo.Id == cond.SourceGroup)
|
||||
{
|
||||
phase.Conditions.Add(cond);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
return true;
|
||||
if (found)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var phases = Global.ObjectMgr.GetPhasesForAreaOrZoneForLoading((uint)cond.SourceEntry);
|
||||
foreach (PhaseInfoStruct phase in phases)
|
||||
var phases = Global.ObjectMgr.GetPhasesForArea((uint)cond.SourceEntry);
|
||||
foreach (PhaseAreaInfo phase in phases)
|
||||
{
|
||||
if (phase.Id == cond.SourceGroup)
|
||||
if (phase.PhaseInfo.Id == cond.SourceGroup)
|
||||
{
|
||||
phase.Conditions.Add(cond);
|
||||
return true;
|
||||
@@ -1990,15 +1987,9 @@ namespace Game
|
||||
|| condition.MinExpansionLevel > WorldConfig.GetIntValue(WorldCfg.Expansion)))
|
||||
return false;
|
||||
|
||||
if (condition.PhaseID != 0 && !player.IsInPhase(condition.PhaseID))
|
||||
return false;
|
||||
|
||||
if (condition.PhaseGroupID != 0)
|
||||
{
|
||||
var phases = Global.DB2Mgr.GetPhasesForGroup(condition.PhaseGroupID);
|
||||
if (!phases.Intersect(player.GetPhases()).Any())
|
||||
if (condition.PhaseID != 0 || condition.PhaseGroupID != 0 || condition.PhaseUseFlags != 0)
|
||||
if (!PhasingHandler.InDbPhaseShift(player, (PhaseUseFlagsValues)condition.PhaseUseFlags, condition.PhaseID, condition.PhaseGroupID))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (condition.QuestKillID != 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user