fix(Scripts/Brewfest): Rewritten Coren Direbrew's fight(#8040)

- Closes #7890
This commit is contained in:
UltraNix
2021-10-08 21:03:38 +02:00
committed by GitHub
parent a035be19a6
commit 4947887644
7 changed files with 824 additions and 327 deletions

View File

@@ -185,6 +185,12 @@ void GameObject::RemoveFromWorld()
if (Transport* transport = GetTransport())
transport->RemovePassenger(this, true);
// If linked trap exists, despawn it
if (GameObject* linkedTrap = GetLinkedTrap())
{
linkedTrap->Delete();
}
WorldObject::RemoveFromWorld();
if (m_spawnId)
@@ -711,6 +717,12 @@ void GameObject::Update(uint32 diff)
}
case GO_JUST_DEACTIVATED:
{
// If nearby linked trap exists, despawn it
if (GameObject* linkedTrap = GetLinkedTrap())
{
linkedTrap->Delete();
}
//if Gameobject should cast spell, then this, but some GOs (type = 10) should be destroyed
if (GetGoType() == GAMEOBJECT_TYPE_GOOBER)
{
@@ -1202,24 +1214,12 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
if (range < 1.0f)
range = 5.0f;
// search nearest linked GO
GameObject* trapGO = nullptr;
{
// using original GO distance
CellCoord p(Acore::ComputeCellCoord(GetPositionX(), GetPositionY()));
Cell cell(p);
Acore::NearestGameObjectEntryInObjectRangeCheck go_check(*target, trapEntry, range);
Acore::GameObjectLastSearcher<Acore::NearestGameObjectEntryInObjectRangeCheck> checker(this, trapGO, go_check);
TypeContainerVisitor<Acore::GameObjectLastSearcher<Acore::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
cell.Visit(p, object_checker, *GetMap(), *target, range);
}
// found correct GO
// xinef: we should use the trap (checks for despawn type)
if (trapGO)
trapGO->Use(target); //trapGO->CastSpell(target, trapInfo->trap.spellId);
if (GameObject* trapGO = GetLinkedTrap())
{
trapGO->Use(target); // trapGO->CastSpell(target, trapInfo->trap.spellId);
}
}
GameObject* GameObject::LookupFishingHoleAround(float range)
@@ -2431,6 +2431,11 @@ bool GameObject::IsLootAllowedFor(Player const* player) const
return true;
}
GameObject* GameObject::GetLinkedTrap()
{
return ObjectAccessor::GetGameObject(*this, m_linkedTrap);
}
void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) const
{
if (!target)