Core/Battlegrounds: Move to scripts And a lot of misc commits i couldn't recover.

Port From (https://github.com/TrinityCore/TrinityCore/commit/d0d5d309bb5877dc2fcb27f6cb123707a31ec1e8)
This commit is contained in:
Hondacrx
2024-08-04 15:18:22 -04:00
parent bca02a24b0
commit e9b21a91be
139 changed files with 8322 additions and 8700 deletions
+2 -12
View File
@@ -2152,11 +2152,7 @@ namespace Game.Spells
{
Player playerTarget = target.ToPlayer();
if (playerTarget != null)
{
var playerCondition = CliDB.PlayerConditionStorage.LookupByKey(mountDisplay.PlayerConditionID);
if (playerCondition != null)
return ConditionManager.IsPlayerMeetingCondition(playerTarget, playerCondition);
}
return ConditionManager.IsPlayerMeetingCondition(playerTarget, mountDisplay.PlayerConditionID);
return true;
}).ToList();
@@ -2886,13 +2882,7 @@ namespace Game.Spells
Player player = target.ToPlayer();
if (!apply && player != null && GetSpellInfo().HasAuraInterruptFlag(SpellAuraInterruptFlags.StealthOrInvis))
{
if (player.InBattleground())
{
Battleground bg = player.GetBattleground();
if (bg != null)
bg.EventPlayerDroppedFlag(player);
}
else
if (!player.InBattleground())
Global.OutdoorPvPMgr.HandleDropFlag(player, GetSpellInfo().Id);
}
}
+1 -24
View File
@@ -1217,19 +1217,7 @@ namespace Game.Spells
if (goInfo.GetNoDamageImmune() != 0 && player.HasUnitFlag(UnitFlags.Immune))
return;
if (goInfo.type == GameObjectTypes.FlagStand)
{
//CanUseBattlegroundObject() already called in CheckCast()
// in Battlegroundcheck
Battleground bg = player.GetBattleground();
if (bg != null)
{
if (bg.GetTypeID() == BattlegroundTypeId.EY)
bg.EventPlayerClickedOnFlag(player, gameObjTarget);
return;
}
}
else if (m_spellInfo.Id == 1842 && gameObjTarget.GetGoInfo().type == GameObjectTypes.Trap && gameObjTarget.GetOwner() != null)
if (m_spellInfo.Id == 1842 && gameObjTarget.GetGoInfo().type == GameObjectTypes.Trap && gameObjTarget.GetOwner() != null)
{
gameObjTarget.SetLootState(LootState.JustDeactivated);
return;
@@ -2611,17 +2599,6 @@ namespace Game.Spells
// Wild object not have owner and check clickable by players
map.AddToMap(go);
if (go.GetGoType() == GameObjectTypes.FlagDrop)
{
Player player = m_caster.ToPlayer();
if (player != null)
{
Battleground bg = player.GetBattleground();
if (bg != null)
bg.SetDroppedFlagGUID(go.GetGUID(), bg.GetPlayerTeam(player.GetGUID()) == Team.Alliance ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance);
}
}
GameObject linkedTrap = go.GetLinkedTrap();
if (linkedTrap != null)
{
+3 -6
View File
@@ -3181,10 +3181,8 @@ namespace Game.Spells
{
foreach (SpellXSpellVisualRecord visual in _visuals)
{
var playerCondition = CliDB.PlayerConditionStorage.LookupByKey(visual.CasterPlayerConditionID);
if (playerCondition != null)
if (caster == null || !caster.IsPlayer() || !ConditionManager.IsPlayerMeetingCondition(caster.ToPlayer(), playerCondition))
continue;
if (caster == null || !caster.IsPlayer() || !ConditionManager.IsPlayerMeetingCondition(caster.ToPlayer(), visual.CasterPlayerConditionID))
continue;
var unitCondition = CliDB.UnitConditionStorage.LookupByKey(visual.CasterUnitConditionID);
if (unitCondition != null)
@@ -3753,8 +3751,7 @@ namespace Game.Spells
if (ShowFutureSpellPlayerConditionID == 0)
return false;
var playerCondition = CliDB.PlayerConditionStorage.LookupByKey(ShowFutureSpellPlayerConditionID);
return playerCondition == null || ConditionManager.IsPlayerMeetingCondition(player, playerCondition);
return ConditionManager.IsPlayerMeetingCondition(player, ShowFutureSpellPlayerConditionID);
}
public bool HasLabel(uint labelId)
-7
View File
@@ -5010,13 +5010,6 @@ namespace Game.Entities
if (player == null || (auraSpell > 0 && !player.HasAura((uint)auraSpell)) || (auraSpell < 0 && player.HasAura((uint)-auraSpell)))
return false;
if (player != null)
{
Battleground bg = player.GetBattleground();
if (bg != null)
return bg.IsSpellAllowed(spellId, player);
}
// Extra conditions -- leaving the possibility add extra conditions...
switch (spellId)
{