Skip to content

Commit

Permalink
Merge pull request #16523 from tkrokli/smart_action_set_corpse_delay
Browse files Browse the repository at this point in the history
[3.3.5][6.x]Core/SmartScript: create SMART_ACTION_SET_CORPSE_DELAY
(cherry picked from commit 8e152e0)
  • Loading branch information
MitchesD authored and Shauren committed Apr 8, 2016
1 parent c0ec641 commit 92b74d6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/server/game/AI/SmartScripts/SmartScript.cpp
Expand Up @@ -2362,6 +2362,21 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
}
}
case SMART_ACTION_SET_CORPSE_DELAY:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
break;

for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (IsCreature(*itr))
(*itr)->ToCreature()->SetCorpseDelay(e.action.corpseDelay.timer);
}

delete targets;
break;
}
default:
TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry " SI64FMTD " SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;
Expand Down
1 change: 1 addition & 0 deletions src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
Expand Up @@ -1263,6 +1263,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_REMOVE_GO_FLAG:
case SMART_ACTION_SUMMON_CREATURE_GROUP:
case SMART_ACTION_RISE_UP:
case SMART_ACTION_SET_CORPSE_DELAY:
break;
default:
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry " SI64FMTD " SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
Expand Down
8 changes: 7 additions & 1 deletion src/server/game/AI/SmartScripts/SmartScriptMgr.h
Expand Up @@ -552,8 +552,9 @@ enum SMART_ACTION
SMART_ACTION_START_CLOSEST_WAYPOINT = 113, // wp1, wp2, wp3, wp4, wp5, wp6, wp7
SMART_ACTION_RISE_UP = 114, // distance
SMART_ACTION_RANDOM_SOUND = 115, // soundId1, soundId2, soundId3, soundId4, soundId5, onlySelf
SMART_ACTION_SET_CORPSE_DELAY = 116, // timer

SMART_ACTION_END = 116
SMART_ACTION_END = 117
};

struct SmartAction
Expand Down Expand Up @@ -1042,6 +1043,11 @@ struct SmartAction
uint32 onlySelf;
} randomSound;

struct
{
uint32 timer;
} corpseDelay;

//! Note for any new future actions
//! All parameters must have type uint32

Expand Down

0 comments on commit 92b74d6

Please sign in to comment.