exiles merge
This commit is contained in:
@@ -199,7 +199,9 @@ void Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry,
|
||||
if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_CONVERSATION_LINE, line->Id, creator))
|
||||
continue;
|
||||
|
||||
ConversationLineEntry const* convoLine = sConversationLineStore.LookupEntry(line->Id); // never null for conversationTemplate->Lines
|
||||
ConversationLineEntry const* convoLine = sConversationLineStore.LookupEntry(line->Id);
|
||||
if (!convoLine)
|
||||
continue;
|
||||
|
||||
UF::ConversationLine& lineField = lines.emplace_back();
|
||||
lineField.ConversationLineID = line->Id;
|
||||
@@ -226,7 +228,9 @@ void Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry,
|
||||
}
|
||||
}
|
||||
|
||||
_duration = *std::ranges::max_element(_lastLineEndTimes);
|
||||
// A conversation whose lines were all filtered out has no end times.
|
||||
// max_element on that empty map crashed the Re-Sizer conversation.
|
||||
_duration = _lastLineEndTimes.empty() ? 0ms : *std::ranges::max_element(_lastLineEndTimes);
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Conversation::m_conversationData).ModifyValue(&UF::ConversationData::LastLineEndTime), _duration.count());
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Conversation::m_conversationData).ModifyValue(&UF::ConversationData::Lines), std::move(lines));
|
||||
|
||||
|
||||
@@ -6700,10 +6700,17 @@ void Spell::EffectCreatePrivateConversation()
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
|
||||
return;
|
||||
|
||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Conversation::CreateConversation(effectInfo->MiscValue, unitTarget, destTarget->GetPosition(), unitTarget->GetGUID(), GetSpellInfo());
|
||||
// The effect targets the caster and often has no destination. The old
|
||||
// destTarget->GetPosition() placed the conversation at 0,0,0 and crashed
|
||||
// while adding it to the map. The Re-Sizer result spells hit this path.
|
||||
Position pos = unitTarget->GetPosition();
|
||||
if (m_targets.HasDst() && destTarget)
|
||||
pos = destTarget->GetPosition();
|
||||
|
||||
Conversation::CreateConversation(effectInfo->MiscValue, unitTarget, pos, unitTarget->GetGUID(), GetSpellInfo());
|
||||
}
|
||||
|
||||
void Spell::EffectApplyMountEquipment()
|
||||
|
||||
@@ -473,7 +473,8 @@ struct npc_exiles_reach_darkmaul_plains_156736_156716 : public ScriptedAI
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
if (IsResizedBoar())
|
||||
// The Re-Sizer roots the boar. Charging the player from that aura was crashing the channel.
|
||||
if (IsResizedBoar() || !who || me->HasAura(SPELL_RE_SIZING_2))
|
||||
return;
|
||||
|
||||
me->CastSpell(who, SPELL_WANDERING_BOAR_MOB_CHARGE);
|
||||
@@ -806,9 +807,8 @@ public:
|
||||
if (!player || !creature)
|
||||
return;
|
||||
|
||||
caster->ClearChannelObjects();
|
||||
caster->SetChannelSpellId(0);
|
||||
caster->SetChannelVisual({});
|
||||
// The core ends the channel before this aura is removed. Clearing the channel
|
||||
// fields here used to run while that spell was still finishing.
|
||||
|
||||
// GetQuestStatus is an enum. Any non-zero status, including already turned in, used to count as "on the quest".
|
||||
uint32 questId = 0;
|
||||
@@ -817,7 +817,7 @@ public:
|
||||
else if (player->GetQuestStatus(QUEST_H_RE_SIZING_THE_SITUATION) == QUEST_STATUS_INCOMPLETE)
|
||||
questId = QUEST_H_RE_SIZING_THE_SITUATION;
|
||||
|
||||
if (!questId)
|
||||
if (!questId || creature->GetEntry() != NPC_DARKMAUL_PLAINS_WANDERING_BOAR)
|
||||
return;
|
||||
|
||||
// 0 shrinks the boar, 1 bursts it, 2 grows the re-sized boar and sends Lindie home.
|
||||
@@ -861,24 +861,19 @@ public:
|
||||
|
||||
class spell_re_sizing_305716_SpellScript : public SpellScript
|
||||
{
|
||||
void HandleCast()
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetExplTargetUnit();
|
||||
Creature* creature = target ? target->ToCreature() : nullptr;
|
||||
if (!creature || creature->GetEntry() != NPC_DARKMAUL_PLAINS_WANDERING_BOAR)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (!caster || !target || !target->IsCreature())
|
||||
return;
|
||||
|
||||
Creature* creature = target->ToCreature();
|
||||
if (creature->GetEntry() != NPC_DARKMAUL_PLAINS_WANDERING_BOAR)
|
||||
return;
|
||||
|
||||
GetSpell()->SendChannelStart(3000);
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCast += SpellCastFn(spell_re_sizing_305716_SpellScript::HandleCast);
|
||||
OnCheckCast += SpellCheckCastFn(spell_re_sizing_305716_SpellScript::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user