Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-04-11 08:40:56 -06:00
committed by GitHub
51 changed files with 3015 additions and 145 deletions

View File

@@ -1000,8 +1000,8 @@ public:
{
Player* player = handler->GetSession()->GetPlayer();
handler->PSendSysMessage("Checking LoS %s -> %s:", player->GetName().c_str(), unit->GetName().c_str());
handler->PSendSysMessage(" VMAP LoS: %s", player->IsWithinLOSInMap(unit, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
handler->PSendSysMessage(" GObj LoS: %s", player->IsWithinLOSInMap(unit, LINEOFSIGHT_CHECK_GOBJECT) ? "clear" : "obstructed");
handler->PSendSysMessage(" VMAP LoS: %s", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
handler->PSendSysMessage(" GObj LoS: %s", player->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_GOBJECT_ALL) ? "clear" : "obstructed");
handler->PSendSysMessage("%s is %sin line of sight of %s.", unit->GetName().c_str(), (player->IsWithinLOSInMap(unit) ? "" : "not "), player->GetName().c_str());
return true;
}

View File

@@ -21,6 +21,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "blackwing_lair.h"
#include "SpellScript.h"
enum Say
{
@@ -247,8 +248,28 @@ class go_suppression_device : public GameObjectScript
}
};
class spell_suppression_aura : public SpellScript
{
PrepareSpellScript(spell_suppression_aura);
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if([&](WorldObject* target) -> bool
{
Unit* unit = target->ToUnit();
return !unit || unit->HasAuraType(SPELL_AURA_MOD_STEALTH);
});
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_suppression_aura::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
void AddSC_boss_broodlord()
{
new boss_broodlord();
new go_suppression_device();
RegisterSpellScript(spell_suppression_aura);
}

View File

@@ -256,7 +256,7 @@ public:
me->SetVisible(true);
me->SetPhaseMask(1, true);
me->ReplaceAllNpcFlags(NPCFlags(1));
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
me->SetFaction(FACTION_FRIENDLY);
me->SetStandState(UNIT_STAND_STATE_SIT_HIGH_CHAIR);
me->RemoveAura(SPELL_NEFARIANS_BARRIER);
@@ -284,6 +284,7 @@ public:
if (action == ACTION_KILLED)
{
summons.DespawnEntry(NPC_BONE_CONSTRUCT);
Unit::Kill(me, me);
}
}
@@ -472,7 +473,7 @@ public:
Talk(SAY_GAMESBEGIN_1);
events.ScheduleEvent(EVENT_START_EVENT, 4000);
me->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
// Due to Nefarius despawning himself on Vael, we need to update the guid on instance to prevent unwanted behaviours as encounter not resetting at all.

View File

@@ -306,6 +306,7 @@ public:
razorgore->AI()->DoAction(TALK_EGG_BROKEN_RAND);
egg->SetLootState(GO_READY);
egg->UseDoorOrButton(10000);
egg->SetRespawnTime(WEEK);
}
}
}

View File

@@ -310,6 +310,8 @@ public:
break;
case SPECIAL:
if (EggEvent == NOT_STARTED)
SetData(DATA_EGG_EVENT, IN_PROGRESS);
if (++EggCount >= EggList.size())
{
if (Creature* razor = instance->GetCreature(razorgoreGUID))
@@ -321,8 +323,6 @@ public:
_events.ScheduleEvent(EVENT_RAZOR_PHASE_TWO, 1000);
_events.CancelEvent(EVENT_RAZOR_SPAWN);
}
if (EggEvent == NOT_STARTED)
SetData(DATA_EGG_EVENT, IN_PROGRESS);
break;
}
}
@@ -400,6 +400,7 @@ public:
summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
summon->SetReactState(REACT_PASSIVE);
summon->SetStandState(UNIT_STAND_STATE_DEAD);
summon->SetHomePosition(summon->GetPosition());
if (Creature* nefarius = instance->GetCreature(victorNefariusGUID))
{
@@ -447,7 +448,7 @@ public:
}
}
_events.ScheduleEvent(EVENT_RAZOR_SPAWN, 12000, 17000);
_events.ScheduleEvent(EVENT_RAZOR_SPAWN, 15000);
}
break;
case EVENT_RAZOR_PHASE_TWO:

View File

@@ -1763,7 +1763,9 @@ public:
{
float destX = summoner->GetPositionX() + cos(angle + a * M_PI) * i * 10.0f;
float destY = summoner->GetPositionY() + std::sin(angle + a * M_PI) * i * 10.0f;
if (summoner->GetMap()->isInLineOfSight(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ() + 10.0f, destX, destY, summoner->GetPositionZ() + 10.0f, summoner->GetPhaseMask(), LINEOFSIGHT_ALL_CHECKS) && destX > 4585.0f && destY > 2716.0f && destY < 2822.0f)
if (summoner->GetMap()->isInLineOfSight(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ() + 10.0f, destX, destY,
summoner->GetPositionZ() + 10.0f, summoner->GetPhaseMask(), LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing) &&
destX > 4585.0f && destY > 2716.0f && destY < 2822.0f)
{
float destZ = summoner->GetMapHeight(summoner->GetPhaseMask(), destX, destY, summoner->GetPositionZ());
if (std::fabs(destZ - summoner->GetPositionZ()) < 10.0f) // valid z found

View File

@@ -1285,7 +1285,7 @@ public:
float ox, oy, oz;
_caster->GetPosition(ox, oy, oz);
DynamicMapTree const& dTree = unit->GetMap()->GetDynamicMapTree();
return !dTree.isInLineOfSight(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ() + 2.f, ox, oy, oz + 2.f, unit->GetPhaseMask());
return !dTree.isInLineOfSight(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ() + 2.f, ox, oy, oz + 2.f, unit->GetPhaseMask(), VMAP::ModelIgnoreFlags::Nothing);
}
private:

View File

@@ -125,7 +125,8 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!activated && who->GetTypeId() == TYPEID_PLAYER)
if (me->GetExactDist2d(who) <= 25.0f && me->GetMap()->isInLineOfSight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 5.0f, who->GetPositionX(), who->GetPositionY(), who->GetPositionZ() + 5.0f, 2, LINEOFSIGHT_ALL_CHECKS))
if (me->GetExactDist2d(who) <= 25.0f && me->GetMap()->isInLineOfSight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 5.0f,
who->GetPositionX(), who->GetPositionY(), who->GetPositionZ() + 5.0f, 2, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing))
{
activated = true;
me->RemoveAura(64615);

View File

@@ -0,0 +1,74 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "SpellInfo.h"
#include "SpellScript.h"
#include "Unit.h"
#include "utgarde_pinnacle.h"
enum UtgardeSpells
{
SPELL_BEAST_MARK_NORMAL = 48876,
SPELL_BEAST_MARK_DAMAGE_N = 48877,
SPELL_BEAST_MARK_DAMAGE_H = 59233
};
// 48876 - Beast's Mark
// 59237 - Beast's Mark
class spell_utgarde_pinnacle_beast_mark : public AuraScript
{
PrepareAuraScript(spell_utgarde_pinnacle_beast_mark);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_BEAST_MARK_DAMAGE_N, SPELL_BEAST_MARK_DAMAGE_H });
}
bool CheckProc(ProcEventInfo& eventInfo)
{
if (DamageInfo* damageInfo = eventInfo.GetDamageInfo())
{
Unit* attacker = damageInfo->GetAttacker();
if (!attacker || !damageInfo->GetDamage())
return false;
return attacker->GetCreatureType() == CREATURE_TYPE_BEAST;
}
return false;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
Unit* target = GetTarget();
uint32 spellId = (m_scriptSpellId == SPELL_BEAST_MARK_NORMAL) ? SPELL_BEAST_MARK_DAMAGE_N : SPELL_BEAST_MARK_DAMAGE_H;
target->CastSpell(target, spellId, aurEff);
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_utgarde_pinnacle_beast_mark::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_utgarde_pinnacle_beast_mark::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
void AddSC_utgarde_pinnacle()
{
RegisterSpellScript(spell_utgarde_pinnacle_beast_mark);
}

View File

@@ -111,6 +111,7 @@ void AddSC_boss_palehoof();
void AddSC_boss_skadi();
void AddSC_boss_ymiron();
void AddSC_instance_utgarde_pinnacle();
void AddSC_utgarde_pinnacle();
void AddSC_utgarde_keep();
void AddSC_boss_archavon(); //Vault of Archavon
void AddSC_boss_emalon();
@@ -276,6 +277,7 @@ void AddNorthrendScripts()
AddSC_boss_skadi();
AddSC_boss_ymiron();
AddSC_instance_utgarde_pinnacle();
AddSC_utgarde_pinnacle();
AddSC_utgarde_keep();
AddSC_boss_archavon(); //Vault of Archavon
AddSC_boss_emalon();

View File

@@ -3493,7 +3493,8 @@ class spell_item_eggnog : public SpellScript
enum GoblinBomb
{
SPELL_SUMMON_GOBLIN_BOMB = 13258,
SPELL_SUMMON_GOBLIN_BOMB = 13258,
SPELL_MALFUNCTION_EXPLOSION = 13261
};
// 23134 - Goblin Bomb
@@ -3503,14 +3504,14 @@ class spell_item_goblin_bomb : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SUMMON_GOBLIN_BOMB });
return ValidateSpellInfo({ SPELL_SUMMON_GOBLIN_BOMB, SPELL_MALFUNCTION_EXPLOSION });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
{
caster->CastSpell(caster, SPELL_SUMMON_GOBLIN_BOMB, true, GetCastItem());
caster->CastSpell(caster, roll_chance_i(95) ? SPELL_SUMMON_GOBLIN_BOMB : SPELL_MALFUNCTION_EXPLOSION, true, GetCastItem());
}
}