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

@@ -0,0 +1,50 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1632342398795739900');
-- Coren Direbrew Implementation
SET @CGUID := 240000;
UPDATE `creature` SET `position_x`=891.8394, `position_y`=-129.1829, `position_z`=-49.65985, `orientation`=5.253441, `MovementType`=2 WHERE `guid`=@CGUID;
DELETE FROM `creature_addon` WHERE `guid`=@CGUID;
INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES
(@CGUID,@CGUID*10,0,0,1,0,NULL);
DELETE FROM `waypoint_data` WHERE `id` IN (@CGUID*10);
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`action`,`action_chance`,`wpguid`) VALUES
(@CGUID*10,0,888.4606, -130.909, -49.7434,0,0,0,100,0),
(@CGUID*10,1,895.4048, -126.9586, -49.74198,0,0,0,100,0);
UPDATE `gameobject_template` SET `data2`=10000, `ScriptName`='go_direbrew_mole_machine' WHERE `entry`=188508;
UPDATE `gameobject_template` SET `displayId`=1287, `data4`=2, `VerifiedBuild`=0 WHERE `entry`=188509;
UPDATE `creature_template` SET `unit_flags`=33024 WHERE `entry`=23795;
UPDATE `creature_template` SET `ScriptName`='npc_direbrew_antagonist' WHERE `entry`=23795;
UPDATE `creature_template` SET `ScriptName`='npc_direbrew_minion' WHERE `entry`=26776;
UPDATE `creature_template` SET `ScriptName`='npc_coren_direbrew_sisters' WHERE `entry` IN(26764,26822);
UPDATE `creature_template` SET `unit_flags`=256, `ScriptName`='npc_coren_direbrew' WHERE `entry`=23872;
DELETE FROM `disables` WHERE `sourceType`=0 AND `entry`=50313;
INSERT INTO `disables` (`sourceType`, `entry`, `flags`, `params_0`, `params_1`, `comment`) VALUES
(0,50313,64,0,0,'Disable LOS for Spell Mole Machine Emerge');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN(47344,52850);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(13,1,47344,0,0,31,0,3,26764,0,0,0,0,'','Spell Request Second mug targets Ilsa Direbrew'),
(13,1,52850,0,0,31,0,3,23872,0,0,0,0,'','Spell Port to Coren target Coren Direbrew');
DELETE FROM `creature_template_addon` WHERE `entry` IN (26764,26822);
INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES
(26764, 0, 0, 0, 1, 0, '47759 47760'),
(26822, 0, 0, 0, 1, 0, '47759 47760');
DELETE FROM `spell_script_names` WHERE `ScriptName` IN (
'spell_direbrew_summon_mole_machine_target_picker',
'spell_direbrew_disarm',
'spell_send_mug_control_aura',
'spell_send_mug_target_picker',
'spell_request_second_mug',
'spell_barreled_control_aura');
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(47407,'spell_direbrew_disarm'),
(47691,'spell_direbrew_summon_mole_machine_target_picker'),
(47369,'spell_send_mug_control_aura'),
(47370,'spell_send_mug_target_picker'),
(47344,'spell_request_second_mug'),
(50278,'spell_barreled_control_aura');

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)

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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