Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2025-01-09 19:56:11 +08:00
20 changed files with 346 additions and 109 deletions
+1 -1
View File
@@ -1275,7 +1275,7 @@ public:
if (!sObjectMgr->SetCreatureLinkedRespawn(creature->GetSpawnId(), linkguid))
{
handler->SendErrorMessage("Selected creature can't link with guid '%u'", linkguid);
handler->SendErrorMessage("Selected creature can't link with guid '{}'", linkguid);
return false;
}
+1 -1
View File
@@ -179,7 +179,7 @@ public:
/// - Send the message
// Use SendAreaTriggerMessage for fastest delivery.
player->GetSession()->SendAreaTriggerMessage("%s", msg.c_str());
player->GetSession()->SendAreaTriggerMessage("{}", msg);
player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
// Confirmation message
@@ -342,7 +342,7 @@ class spell_entropius_negative_energy_periodic : public AuraScript
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
uint32 targetCount = aurEff->GetTickNumber() > 12 ? 1 : aurEff->GetTickNumber() / 12;
uint32 targetCount = (aurEff->GetTickNumber() + 11) / 12;
GetTarget()->CastCustomSpell(aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, SPELLVALUE_MAX_TARGETS, targetCount);
}
@@ -98,7 +98,7 @@ struct boss_akilzon : public BossAI
});
ScheduleTimedEvent(20s, 30s, [&] {
if (scheduler.GetNextGroupOcurrence(GROUP_ELECTRICAL_STORM) > 5s)
if (scheduler.GetNextGroupOccurrence(GROUP_ELECTRICAL_STORM) > 5s)
DoCastRandomTarget(SPELL_GUST_OF_WIND, 1);
}, 20s, 30s);
@@ -135,7 +135,8 @@ enum Misc
MAX_ADD_COUNT = 4,
ADDITIONAL_CLASS_SPRIEST = 11,
AURA_SHADOW_FORM = 15473,
GROUP_CLASS_ABILITY = 1
GROUP_CLASS_ABILITY = 1,
GROUP_DRAIN_POWER = 2
};
enum AbilityTarget
@@ -242,12 +243,15 @@ struct boss_hexlord_malacrass : public BossAI
BossAI::Reset();
_currentClass = CLASS_NONE;
_classAbilityTimer = 10000ms;
_timeUntilNextDrainPower = 0ms;
SpawnAdds();
ScheduleHealthCheckEvent(80, [&] {
ScheduleTimedEvent(1s, [&] {
scheduler.Schedule(1s, GROUP_DRAIN_POWER, [this](TaskContext context)
{
DoCastSelf(SPELL_DRAIN_POWER, true);
Talk(SAY_DRAIN_POWER);
}, 30s);
context.Repeat(30s);
});
});
}
@@ -282,6 +286,14 @@ struct boss_hexlord_malacrass : public BossAI
ScheduleTimedEvent(30s, [&]{
scheduler.CancelGroup(GROUP_CLASS_ABILITY);
DoCastSelf(SPELL_SPIRIT_BOLTS);
// Delay Drain Power if it's currently within 10s of being cast
// TODO: see what is wrong with GetNextGroupOccurrence as the timers don't seem correct on resets
_timeUntilNextDrainPower = scheduler.GetNextGroupOccurrence(GROUP_DRAIN_POWER);
if (_timeUntilNextDrainPower > 0s && _timeUntilNextDrainPower < 10s)
{
std::chrono::milliseconds delayTime = 10s - _timeUntilNextDrainPower + 1s;
scheduler.DelayGroup(GROUP_DRAIN_POWER, delayTime);
}
scheduler.Schedule(10s, [this](TaskContext)
{
if (Creature* siphonTrigger = me->SummonCreature(NPC_TEMP_TRIGGER, me->GetPosition(), TEMPSUMMON_TIMED_DESPAWN, 30000))
@@ -354,6 +366,7 @@ struct boss_hexlord_malacrass : public BossAI
private:
uint8 _currentClass;
std::chrono::milliseconds _classAbilityTimer;
std::chrono::milliseconds _timeUntilNextDrainPower;
std::vector<uint8> _creatureIndex;
};
@@ -464,7 +464,7 @@ class spell_summon_all_players_dummy: public SpellScript
Position pos = GetCaster()->GetPosition();
targets.remove_if([&, pos](WorldObject* target) -> bool
{
return target->IsWithinBox(pos, 18.0f, 18.0f, 18.0f);
return target->IsWithinBox(pos, 22.0f, 28.0f, 28.0f);
});
}
@@ -682,22 +682,6 @@ private:
SummonList _summons;
};
struct WorldTriggerHutPred
{
bool operator()(Creature* trigger) const
{
return trigger->GetOrientation() > 2.7f || (trigger->GetOrientation() < 2.7f && 1270.0f < trigger->GetPositionY() && trigger->GetPositionY() < 1280.0f);
}
};
struct WorldTriggerDrumPred
{
bool operator()(Creature* trigger) const
{
return !WorldTriggerHutPred()(trigger);
}
};
enum AmanishiScout
{
NPC_WORLD_TRIGGER = 22515,
@@ -708,6 +692,18 @@ enum AmanishiScout
SPELL_SHOOT = 16496
};
inline bool IsHut(Creature* trigger)
{
return trigger->GetPositionX() < -90.0f // South of Jan'alai area
&& ((trigger->GetOrientation() > 2.7f) || (trigger->GetOrientation() < 2.7f && 1270.0f < trigger->GetPositionY() && trigger->GetPositionY() < 1280.0f));
}
inline bool IsDrum(Creature* trigger)
{
return trigger->GetPositionX() < -90.0f // South of Jan'alai area
&& !IsHut(trigger);
}
struct npc_amanishi_scout : public ScriptedAI
{
npc_amanishi_scout(Creature* creature) : ScriptedAI(creature) { }
@@ -725,7 +721,7 @@ struct npc_amanishi_scout : public ScriptedAI
// Move to Drum
std::list<Creature*> triggers;
GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 50.0f);
triggers.remove_if(WorldTriggerHutPred());
triggers.remove_if([](Creature* trigger) {return !IsDrum(trigger);});
triggers.sort(Acore::ObjectDistanceOrderPred(me));
if (!triggers.empty())
{
@@ -826,7 +822,7 @@ class spell_summon_amanishi_sentries : public SpellScript
{
std::list<Creature*> triggers;
GetCreatureListWithEntryInGrid(triggers, GetHitUnit(), NPC_WORLD_TRIGGER, 50.0f);
triggers.remove_if(WorldTriggerDrumPred());
triggers.remove_if([](Creature* trigger) {return !IsHut(trigger);});
if (triggers.empty())
return;
Creature* trigger = Acore::Containers::SelectRandomContainerElement(triggers);
@@ -268,7 +268,7 @@ public:
Map::PlayerList const& playerList = me->GetMap()->GetPlayers();
for(Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
if (Player* player = itr->GetSource())
if (!player->IsGameMaster() && player->IsAlive() && me->GetHomePosition().GetExactDist2d(player) < 52.0f && me->IsWithinLOSInMap(player) && !player->HasInvisibilityAura() && !player->HasStealthAura() && !player->HasUnattackableAura())
if (!player->IsGameMaster() && player->IsAlive() && me->GetHomePosition().GetExactDist2d(player) < 52.0f && me->IsWithinLOSInMap(player) && !player->HasInvisibilityAura() && !player->HasStealthAura() && !player->HasUnattackableAura() && !player->HasAura(5384))
return true;
return false;
}