Core/Misc: Graveyards can now use conditions, SourceType = 27, SourceEntry = graveyard_zone.ID
This commit is contained in:
@@ -100,7 +100,8 @@ namespace Framework.Constants
|
||||
SpellProc = 24,
|
||||
TerrainSwap = 25,
|
||||
Phase = 26,
|
||||
Max = 27
|
||||
Graveyard = 27,
|
||||
Max = 28
|
||||
}
|
||||
|
||||
public enum RelationType
|
||||
|
||||
@@ -1743,7 +1743,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
public virtual WorldSafeLocsRecord GetClosestGraveYard(Player player)
|
||||
{
|
||||
return Global.ObjectMgr.GetClosestGraveYard(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ(), player.GetMapId(), player.GetTeam());
|
||||
return Global.ObjectMgr.GetClosestGraveYard(player, player.GetTeam(), player);
|
||||
}
|
||||
|
||||
public void StartCriteriaTimer(CriteriaTimedTypes type, uint entry)
|
||||
|
||||
@@ -660,7 +660,7 @@ namespace Game.Chat
|
||||
if (bf != null)
|
||||
nearestLoc = bf.GetClosestGraveYard(player);
|
||||
else
|
||||
nearestLoc = Global.ObjectMgr.GetClosestGraveYard(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ(), player.GetMapId(), player.GetTeam());
|
||||
nearestLoc = Global.ObjectMgr.GetClosestGraveYard(player, player.GetTeam(), player);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1123,7 +1123,7 @@ namespace Game.Chat
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
uint zone_id = player.GetZoneId();
|
||||
|
||||
WorldSafeLocsRecord graveyard = Global.ObjectMgr.GetClosestGraveYard(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ(), player.GetMapId(), team);
|
||||
WorldSafeLocsRecord graveyard = Global.ObjectMgr.GetClosestGraveYard(player, team, null);
|
||||
if (graveyard != null)
|
||||
{
|
||||
uint graveyardId = graveyard.Id;
|
||||
|
||||
@@ -1074,6 +1074,13 @@ namespace Game
|
||||
case ConditionSourceType.GossipMenuOption:
|
||||
case ConditionSourceType.SmartEvent:
|
||||
break;
|
||||
case ConditionSourceType.Graveyard:
|
||||
if (!CliDB.WorldSafeLocsStorage.ContainsKey(cond.SourceEntry))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"{cond.ToString()} SourceEntry in `condition` table, does not exist in WorldSafeLocs.db2, ignoring.");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Log.outError(LogFilter.Sql, $"{cond.ToString()} Invalid ConditionSourceType in `condition` table, ignoring.");
|
||||
break;
|
||||
|
||||
@@ -727,7 +727,7 @@ namespace Game.Entities
|
||||
// If map is dungeon find linked graveyard
|
||||
if (GetMap().IsDungeon())
|
||||
{
|
||||
WorldSafeLocsRecord entry = Global.ObjectMgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
|
||||
WorldSafeLocsRecord entry = Global.ObjectMgr.GetClosestGraveYard(this, GetTeam(), this);
|
||||
if (entry != null)
|
||||
m_bgData.joinPos = new WorldLocation(entry.MapID, entry.Loc.X, entry.Loc.Y, entry.Loc.Z, 0.0f);
|
||||
else
|
||||
|
||||
@@ -4657,7 +4657,7 @@ namespace Game.Entities
|
||||
if (bf != null)
|
||||
ClosestGrave = bf.GetClosestGraveYard(this);
|
||||
else
|
||||
ClosestGrave = Global.ObjectMgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
|
||||
ClosestGrave = Global.ObjectMgr.GetClosestGraveYard(this, GetTeam(), this);
|
||||
}
|
||||
|
||||
// stop countdown until repop
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -276,8 +276,7 @@ namespace Game
|
||||
WorldLocation corpseLocation = GetPlayer().GetCorpseLocation();
|
||||
if (GetPlayer().HasCorpse())
|
||||
{
|
||||
corpseGrave = Global.ObjectMgr.GetClosestGraveYard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(),
|
||||
corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), GetPlayer().GetTeam());
|
||||
corpseGrave = Global.ObjectMgr.GetClosestGraveYard(corpseLocation, GetPlayer().GetTeam(), GetPlayer());
|
||||
}
|
||||
|
||||
// now can spawn bones
|
||||
@@ -286,8 +285,7 @@ namespace Game
|
||||
// teleport to nearest from corpse graveyard, if different from nearest to player ghost
|
||||
if (corpseGrave != null)
|
||||
{
|
||||
WorldSafeLocsRecord ghostGrave = Global.ObjectMgr.GetClosestGraveYard(
|
||||
GetPlayer().GetPositionX(), GetPlayer().GetPositionY(), GetPlayer().GetPositionZ(), GetPlayer().GetMapId(), GetPlayer().GetTeam());
|
||||
WorldSafeLocsRecord ghostGrave = Global.ObjectMgr.GetClosestGraveYard(GetPlayer(), GetPlayer().GetTeam(), GetPlayer());
|
||||
|
||||
if (corpseGrave != ghostGrave)
|
||||
GetPlayer().TeleportTo(corpseGrave.MapID, corpseGrave.Loc.X, corpseGrave.Loc.Y, corpseGrave.Loc.Z, GetPlayer().GetOrientation());
|
||||
|
||||
Reference in New Issue
Block a user