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;
+25 -15
View File
@@ -847,23 +847,33 @@ 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 invoker was pet or charm
Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself();
if (player && GetBaseObject())
{ {
player->GroupEventHappens(e.action.quest.quest, GetBaseObject()); if (!IsUnit(target))
LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player {}, group credit for quest {}", continue;
unit->GetGUID().ToString(), e.action.quest.quest);
}
// Special handling for vehicles Unit* unitTarget = target->ToUnit();
if (Vehicle* vehicle = unit->GetVehicleKit()) // If invoker was pet or charm
for (auto & Seat : vehicle->Seats) Player* player = unitTarget->GetCharmerOrOwnerPlayerOrPlayerItself();
if (Player* player = ObjectAccessor::GetPlayer(*unit, Seat.second.Passenger.Guid)) if (player && GetBaseObject())
player->GroupEventHappens(e.action.quest.quest, GetBaseObject()); {
player->GroupEventHappens(e.action.quest.quest, GetBaseObject());
LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player {}, group credit for quest {}",
unit->GetGUID().ToString(), e.action.quest.quest);
}
// Special handling for vehicles
if (Vehicle* vehicle = unitTarget->GetVehicleKit())
{
for (auto& Seat : vehicle->Seats)
{
if (Player* player = ObjectAccessor::GetPlayer(*unitTarget, Seat.second.Passenger.Guid))
{
player->GroupEventHappens(e.action.quest.quest, GetBaseObject());
}
}
}
}
break; break;
} }
case SMART_ACTION_REMOVEAURASFROMSPELL: case SMART_ACTION_REMOVEAURASFROMSPELL: