Skip to content

Commit

Permalink
update Action; quest event
Browse files Browse the repository at this point in the history
Allow ACID to award quest completion to entire group of target and not
just a single target by using the unused parameter 3
  • Loading branch information
Phatcat authored and cyberium committed Aug 31, 2017
1 parent 11d8e3b commit 33e093f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion doc/EventAI.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ For all ACTION_T_RANDOM Actions, When a Particular Param is selected for the Eve
12 ACTION_T_SUMMON CreatureID, Target, Duration Summons a Creature ID (Param1) for (Param3) duration after Evade (In MS) and orders it to attack (Param2) target (specified below). Spawns on top of NPC who summons it.
13 ACTION_T_THREAT_SINGLE_PCT Threat%, Target Modifies a threat by (Param1) percent on a target (Param2).
14 ACTION_T_THREAT_ALL_PCT Threat% Modifies a threat by (Param1) on all targets in the threat list (using -100% here will result in full aggro dump).
15 ACTION_T_QUEST_EVENT QuestID, Target Calls AreaExploredOrEventHappens with (Param1) for a target in (Param2).
15 ACTION_T_QUEST_EVENT QuestID, Target, RewardGroup Calls AreaExploredOrEventHappens with (Param1) for a target in (Param2). Param3 decides if award entire group (1 = yes, 0 = no).
16 ACTION_T_QUEST_CASTCREATUREGO CreatureID, SpellId, Target Sends CastCreatureOrGo for a creature specified by CreatureId (Param1) with provided spell id (Param2) for a target in (Param3).
17 ACTION_T_SET_UNIT_FIELD Field_Number, Value, Target Sets a unit field (Param1) to provided value (Param2) on a target in (Param3).
18 ACTION_T_SET_UNIT_FLAG Flags, Target Sets flag (flags can be used together to modify multiple flags at once) on a target (Param2).
Expand Down Expand Up @@ -616,6 +616,7 @@ This is commonly used to allow an NPC to drop threat for all players to zero.
--------------------------
Parameter 1: QuestID - The Quest Template ID. The value here must be a valid quest template ID. Furthermore, the quest should have SpecialFlags | 2 as it would need to be completed by an external event which is the activation of this action.
Parameter 2: Target - The Target Type defining whom the quest should be completed for. The value in this field needs to be a valid target type as specified in the reference tables below.
Parameter 3: RewardGroup - Used to decide if entire group should be rewarded (1 = entire group, 0 = single target)

This action will satisfy the external completion requirement for the quest for the specified target defined by the target type.
NOTE: This action can only be used with player targets so it must be ensured that the target type will point to a player.
Expand Down
10 changes: 9 additions & 1 deletion src/game/AI/EventAI/CreatureEventAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,22 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
case ACTION_T_QUEST_EVENT:
{
if (Unit* target = GetTargetByType(action.quest_event.target, pActionInvoker, pAIEventSender, reportTargetError))
{
if (target->GetTypeId() == TYPEID_PLAYER)
((Player*)target)->AreaExploredOrEventHappens(action.quest_event.questId);
{
Player* playerTarget = static_cast<Player*>(target);
if (action.quest_event.rewardGroup)
playerTarget->GroupEventHappens(action.quest_event.questId, m_creature);
else
playerTarget->AreaExploredOrEventHappens(action.quest_event.questId);
}
}
else if (reportTargetError)
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target);
break;
}
case ACTION_T_CAST_EVENT:
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER))
{
Expand Down
1 change: 1 addition & 0 deletions src/game/AI/EventAI/CreatureEventAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ struct CreatureEventAI_Action
{
uint32 questId;
uint32 target;
uint32 rewardGroup;
} quest_event;
// ACTION_T_CAST_EVENT = 16
struct
Expand Down

0 comments on commit 33e093f

Please sign in to comment.