fix(DB/SAI): Fixed completing quest "Into The Realm of Shadows" (#12515)

This commit is contained in:
UltraNix
2022-07-25 12:24:51 +02:00
committed by GitHub
parent 35194434d7
commit d0f70b6cbf
2 changed files with 27 additions and 15 deletions
@@ -0,0 +1,2 @@
--
UPDATE `smart_scripts` SET `action_param1`=500 WHERE `entryorguid`=28788 AND `source_type`=0 AND `id`=5;
@@ -847,11 +847,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
} }
case SMART_ACTION_CALL_GROUPEVENTHAPPENS: case SMART_ACTION_CALL_GROUPEVENTHAPPENS:
{ {
if (!unit) for (WorldObject* target : targets)
break; {
if (!IsUnit(target))
continue;
Unit* unitTarget = target->ToUnit();
// If invoker was pet or charm // If invoker was pet or charm
Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself(); Player* player = unitTarget->GetCharmerOrOwnerPlayerOrPlayerItself();
if (player && GetBaseObject()) if (player && GetBaseObject())
{ {
player->GroupEventHappens(e.action.quest.quest, GetBaseObject()); player->GroupEventHappens(e.action.quest.quest, GetBaseObject());
@@ -860,10 +863,17 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
} }
// Special handling for vehicles // Special handling for vehicles
if (Vehicle* vehicle = unit->GetVehicleKit()) if (Vehicle* vehicle = unitTarget->GetVehicleKit())
for (auto & Seat : vehicle->Seats) {
if (Player* player = ObjectAccessor::GetPlayer(*unit, Seat.second.Passenger.Guid)) for (auto& Seat : vehicle->Seats)
{
if (Player* player = ObjectAccessor::GetPlayer(*unitTarget, Seat.second.Passenger.Guid))
{
player->GroupEventHappens(e.action.quest.quest, GetBaseObject()); player->GroupEventHappens(e.action.quest.quest, GetBaseObject());
}
}
}
}
break; break;
} }
case SMART_ACTION_REMOVEAURASFROMSPELL: case SMART_ACTION_REMOVEAURASFROMSPELL: