Core/Misc: Graveyards can now use conditions, SourceType = 27, SourceEntry = graveyard_zone.ID

This commit is contained in:
hondacrx
2018-03-18 11:43:59 -04:00
parent 874e5b7b2c
commit 6ecc0ae762
9 changed files with 26 additions and 11 deletions
+10 -1
View File
@@ -835,8 +835,12 @@ namespace Game
return CliDB.WorldSafeLocsStorage.LookupByKey(4);
else return null;
}
public WorldSafeLocsRecord GetClosestGraveYard(float x, float y, float z, uint MapId, Team team)
public WorldSafeLocsRecord GetClosestGraveYard(WorldLocation location, Team team, WorldObject conditionObject)
{
float x, y, z;
location.GetPosition(out x, out y, out z);
uint MapId = location.GetMapId();
// search for zone associated closest graveyard
uint zoneId = Global.MapMgr.GetZoneId(MapId, x, y, z);
if (zoneId == 0)
@@ -858,6 +862,8 @@ namespace Game
var range = GraveYardStorage.LookupByKey(zoneId);
MapRecord mapEntry = CliDB.MapStorage.LookupByKey(MapId);
ConditionSourceInfo conditionSource = new ConditionSourceInfo(conditionObject);
// not need to check validity of map object; MapId _MUST_ be valid here
if (range.Empty() && !mapEntry.IsBattlegroundOrArena())
{
@@ -893,6 +899,9 @@ namespace Game
if (data.team != 0 && team != 0 && data.team != (uint)team)
continue;
if (conditionObject != null && !Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.Graveyard, data.safeLocId, conditionSource))
continue;
// find now nearest graveyard at other map
if (MapId != entry.MapID)
{