mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-05 12:03:48 +00:00
fix(Scripts/Brewfest): Rewritten Coren Direbrew's fight(#8040)
- Closes #7890
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -503,6 +503,8 @@ struct GameObjectTemplate
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_BUTTON:
|
||||
return button.linkedTrap;
|
||||
case GAMEOBJECT_TYPE_CHEST:
|
||||
return chest.linkedTrapId;
|
||||
case GAMEOBJECT_TYPE_SPELL_FOCUS:
|
||||
@@ -885,6 +887,9 @@ public:
|
||||
void SetLootGenerationTime() { m_lootGenerationTime = time(nullptr); }
|
||||
[[nodiscard]] uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
|
||||
|
||||
[[nodiscard]] GameObject* GetLinkedTrap();
|
||||
void SetLinkedTrap(GameObject* linkedTrap) { m_linkedTrap = linkedTrap->GetGUID(); }
|
||||
|
||||
[[nodiscard]] bool hasQuest(uint32 quest_id) const override;
|
||||
[[nodiscard]] bool hasInvolvedQuest(uint32 quest_id) const override;
|
||||
bool ActivateToQuest(Player* target) const;
|
||||
@@ -1007,6 +1012,9 @@ protected:
|
||||
ObjectGuid::LowType m_lootRecipientGroup;
|
||||
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
|
||||
uint32 m_lootGenerationTime;
|
||||
|
||||
ObjectGuid m_linkedTrap;
|
||||
|
||||
private:
|
||||
void CheckRitualList();
|
||||
void ClearRitualList();
|
||||
|
||||
@@ -3800,6 +3800,8 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
|
||||
// xinef: this is wrong
|
||||
//ExecuteLogEffectSummonObject(effIndex, linkedGO);
|
||||
|
||||
pGameObj->SetLinkedTrap(linkedGO);
|
||||
|
||||
// Wild object not have owner and check clickable by players
|
||||
map->AddToMap(linkedGO, true);
|
||||
}
|
||||
@@ -5696,6 +5698,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
|
||||
// xinef: this is wrong
|
||||
//linkedGO->SetOwnerGUID(m_caster->GetGUID());
|
||||
//ExecuteLogEffectSummonObject(effIndex, linkedGO);
|
||||
pGameObj->SetLinkedTrap(linkedGO);
|
||||
|
||||
cMap->AddToMap(linkedGO, true);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@ enum DataTypes
|
||||
DATA_GOLEM_LORD_ARGELMACH_INIT = 31,
|
||||
DATA_GOLEM_LORD_ARGELMACH_ADDS = 32,
|
||||
|
||||
DATA_MAGMUS = 33
|
||||
DATA_MAGMUS = 33,
|
||||
|
||||
DATA_COREN = 34
|
||||
};
|
||||
|
||||
enum CreatureIds
|
||||
|
||||
@@ -42,7 +42,9 @@ enum Creatures
|
||||
NPC_DOOMFORGE_ARCANASMITH = 8900,
|
||||
NPC_RAGEREAVER_GOLEM = 8906,
|
||||
NPC_WRATH_HAMMER_CONSTRUCT = 8907,
|
||||
NPC_GOLEM_LORD_ARGELMACH = 8983
|
||||
NPC_GOLEM_LORD_ARGELMACH = 8983,
|
||||
|
||||
NPC_COREN_DIREBREW = 23872
|
||||
};
|
||||
|
||||
enum GameObjects
|
||||
@@ -119,6 +121,7 @@ public:
|
||||
ObjectGuid PhalanxGUID;
|
||||
ObjectGuid MagmusGUID;
|
||||
ObjectGuid MoiraGUID;
|
||||
ObjectGuid CorenGUID;
|
||||
|
||||
ObjectGuid GoArena1GUID;
|
||||
ObjectGuid GoArena2GUID;
|
||||
@@ -177,6 +180,9 @@ public:
|
||||
case NPC_MOIRA:
|
||||
MoiraGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_COREN_DIREBREW:
|
||||
CorenGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_ANGERREL:
|
||||
TombBossGUIDs[0] = creature->GetGUID();
|
||||
break;
|
||||
@@ -487,6 +493,8 @@ public:
|
||||
return PhalanxGUID;
|
||||
case DATA_MOIRA:
|
||||
return MoiraGUID;
|
||||
case DATA_COREN:
|
||||
return CorenGUID;
|
||||
case DATA_ARENA1:
|
||||
return GoArena1GUID;
|
||||
case DATA_ARENA2:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user