Core/GameObject: Implement GAMEOBJECT_TYPE_NEW_FLAG_DROP

Port From (https://github.com/TrinityCore/TrinityCore/commit/3cfc27f5ca81402ed41973a0206838e7a0352070)
This commit is contained in:
hondacrx
2023-09-04 13:28:15 -04:00
parent 07a2dd9859
commit b74cdf643f
4 changed files with 159 additions and 11 deletions
+18 -2
View File
@@ -3,16 +3,17 @@
using Framework.Constants;
using Framework.Dynamic;
using Game.BattleFields;
using Game.BattleGrounds;
using Game.DataStorage;
using Game.Entities;
using Game.Entities.GameObjectType;
using Game.Maps;
using Game.Networking.Packets;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
using System.Numerics;
namespace Game.Spells
{
@@ -5888,6 +5889,21 @@ namespace Game.Spells
if (target == null)
return;
if (!apply)
{
GameObject gameObjectCaster = target.GetMap().GetGameObject(GetCasterGUID());
if (gameObjectCaster != null)
{
if (gameObjectCaster.GetGoType() == GameObjectTypes.NewFlag)
{
gameObjectCaster.HandleCustomTypeCommand(new SetNewFlagState(FlagState.Dropped, target));
GameObject droppedFlag = gameObjectCaster.SummonGameObject(gameObjectCaster.GetGoInfo().NewFlag.FlagDrop, target.GetPosition(), Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(target.GetOrientation(), 0.0f, 0.0f)), TimeSpan.FromSeconds(gameObjectCaster.GetGoInfo().NewFlag.ExpireDuration / 1000), GameObjectSummonType.TimedDespawn);
if (droppedFlag != null)
droppedFlag.SetOwnerGUID(gameObjectCaster.GetGUID());
}
}
}
BattlegroundMap battlegroundMap = target.GetMap().ToBattlegroundMap();
if (battlegroundMap == null)
return;