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,
|
SpellProc = 24,
|
||||||
TerrainSwap = 25,
|
TerrainSwap = 25,
|
||||||
Phase = 26,
|
Phase = 26,
|
||||||
Max = 27
|
Graveyard = 27,
|
||||||
|
Max = 28
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RelationType
|
public enum RelationType
|
||||||
|
|||||||
@@ -1743,7 +1743,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
public virtual WorldSafeLocsRecord GetClosestGraveYard(Player player)
|
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)
|
public void StartCriteriaTimer(CriteriaTimedTypes type, uint entry)
|
||||||
|
|||||||
@@ -660,7 +660,7 @@ namespace Game.Chat
|
|||||||
if (bf != null)
|
if (bf != null)
|
||||||
nearestLoc = bf.GetClosestGraveYard(player);
|
nearestLoc = bf.GetClosestGraveYard(player);
|
||||||
else
|
else
|
||||||
nearestLoc = Global.ObjectMgr.GetClosestGraveYard(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ(), player.GetMapId(), player.GetTeam());
|
nearestLoc = Global.ObjectMgr.GetClosestGraveYard(player, player.GetTeam(), player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1123,7 +1123,7 @@ namespace Game.Chat
|
|||||||
Player player = handler.GetSession().GetPlayer();
|
Player player = handler.GetSession().GetPlayer();
|
||||||
uint zone_id = player.GetZoneId();
|
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)
|
if (graveyard != null)
|
||||||
{
|
{
|
||||||
uint graveyardId = graveyard.Id;
|
uint graveyardId = graveyard.Id;
|
||||||
|
|||||||
@@ -1074,6 +1074,13 @@ namespace Game
|
|||||||
case ConditionSourceType.GossipMenuOption:
|
case ConditionSourceType.GossipMenuOption:
|
||||||
case ConditionSourceType.SmartEvent:
|
case ConditionSourceType.SmartEvent:
|
||||||
break;
|
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:
|
default:
|
||||||
Log.outError(LogFilter.Sql, $"{cond.ToString()} Invalid ConditionSourceType in `condition` table, ignoring.");
|
Log.outError(LogFilter.Sql, $"{cond.ToString()} Invalid ConditionSourceType in `condition` table, ignoring.");
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -727,7 +727,7 @@ namespace Game.Entities
|
|||||||
// If map is dungeon find linked graveyard
|
// If map is dungeon find linked graveyard
|
||||||
if (GetMap().IsDungeon())
|
if (GetMap().IsDungeon())
|
||||||
{
|
{
|
||||||
WorldSafeLocsRecord entry = Global.ObjectMgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
|
WorldSafeLocsRecord entry = Global.ObjectMgr.GetClosestGraveYard(this, GetTeam(), this);
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
m_bgData.joinPos = new WorldLocation(entry.MapID, entry.Loc.X, entry.Loc.Y, entry.Loc.Z, 0.0f);
|
m_bgData.joinPos = new WorldLocation(entry.MapID, entry.Loc.X, entry.Loc.Y, entry.Loc.Z, 0.0f);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -4657,7 +4657,7 @@ namespace Game.Entities
|
|||||||
if (bf != null)
|
if (bf != null)
|
||||||
ClosestGrave = bf.GetClosestGraveYard(this);
|
ClosestGrave = bf.GetClosestGraveYard(this);
|
||||||
else
|
else
|
||||||
ClosestGrave = Global.ObjectMgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
|
ClosestGrave = Global.ObjectMgr.GetClosestGraveYard(this, GetTeam(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop countdown until repop
|
// stop countdown until repop
|
||||||
|
|||||||
@@ -835,8 +835,12 @@ namespace Game
|
|||||||
return CliDB.WorldSafeLocsStorage.LookupByKey(4);
|
return CliDB.WorldSafeLocsStorage.LookupByKey(4);
|
||||||
else return null;
|
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
|
// search for zone associated closest graveyard
|
||||||
uint zoneId = Global.MapMgr.GetZoneId(MapId, x, y, z);
|
uint zoneId = Global.MapMgr.GetZoneId(MapId, x, y, z);
|
||||||
if (zoneId == 0)
|
if (zoneId == 0)
|
||||||
@@ -858,6 +862,8 @@ namespace Game
|
|||||||
var range = GraveYardStorage.LookupByKey(zoneId);
|
var range = GraveYardStorage.LookupByKey(zoneId);
|
||||||
MapRecord mapEntry = CliDB.MapStorage.LookupByKey(MapId);
|
MapRecord mapEntry = CliDB.MapStorage.LookupByKey(MapId);
|
||||||
|
|
||||||
|
ConditionSourceInfo conditionSource = new ConditionSourceInfo(conditionObject);
|
||||||
|
|
||||||
// not need to check validity of map object; MapId _MUST_ be valid here
|
// not need to check validity of map object; MapId _MUST_ be valid here
|
||||||
if (range.Empty() && !mapEntry.IsBattlegroundOrArena())
|
if (range.Empty() && !mapEntry.IsBattlegroundOrArena())
|
||||||
{
|
{
|
||||||
@@ -893,6 +899,9 @@ namespace Game
|
|||||||
if (data.team != 0 && team != 0 && data.team != (uint)team)
|
if (data.team != 0 && team != 0 && data.team != (uint)team)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (conditionObject != null && !Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.Graveyard, data.safeLocId, conditionSource))
|
||||||
|
continue;
|
||||||
|
|
||||||
// find now nearest graveyard at other map
|
// find now nearest graveyard at other map
|
||||||
if (MapId != entry.MapID)
|
if (MapId != entry.MapID)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -276,8 +276,7 @@ namespace Game
|
|||||||
WorldLocation corpseLocation = GetPlayer().GetCorpseLocation();
|
WorldLocation corpseLocation = GetPlayer().GetCorpseLocation();
|
||||||
if (GetPlayer().HasCorpse())
|
if (GetPlayer().HasCorpse())
|
||||||
{
|
{
|
||||||
corpseGrave = Global.ObjectMgr.GetClosestGraveYard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(),
|
corpseGrave = Global.ObjectMgr.GetClosestGraveYard(corpseLocation, GetPlayer().GetTeam(), GetPlayer());
|
||||||
corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), GetPlayer().GetTeam());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now can spawn bones
|
// now can spawn bones
|
||||||
@@ -286,8 +285,7 @@ namespace Game
|
|||||||
// teleport to nearest from corpse graveyard, if different from nearest to player ghost
|
// teleport to nearest from corpse graveyard, if different from nearest to player ghost
|
||||||
if (corpseGrave != null)
|
if (corpseGrave != null)
|
||||||
{
|
{
|
||||||
WorldSafeLocsRecord ghostGrave = Global.ObjectMgr.GetClosestGraveYard(
|
WorldSafeLocsRecord ghostGrave = Global.ObjectMgr.GetClosestGraveYard(GetPlayer(), GetPlayer().GetTeam(), GetPlayer());
|
||||||
GetPlayer().GetPositionX(), GetPlayer().GetPositionY(), GetPlayer().GetPositionZ(), GetPlayer().GetMapId(), GetPlayer().GetTeam());
|
|
||||||
|
|
||||||
if (corpseGrave != ghostGrave)
|
if (corpseGrave != ghostGrave)
|
||||||
GetPlayer().TeleportTo(corpseGrave.MapID, corpseGrave.Loc.X, corpseGrave.Loc.Y, corpseGrave.Loc.Z, GetPlayer().GetOrientation());
|
GetPlayer().TeleportTo(corpseGrave.MapID, corpseGrave.Loc.X, corpseGrave.Loc.Y, corpseGrave.Loc.Z, GetPlayer().GetOrientation());
|
||||||
|
|||||||
Reference in New Issue
Block a user