Core/SAI: Implemented SMART_EVENT_GO_STATE_CHANGED and SMART_ACTION_GO_SET_LOOT_STATE

Signed-off-by: Subv2112 <s.v.h21@hotmail.com>
This commit is contained in:
Subv2112
2012-01-06 11:09:01 -05:00
parent a79ea3dcdf
commit aaa255b83d
8 changed files with 51 additions and 3 deletions

View File

@@ -1797,6 +1797,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
// TODO: Resume path when reached jump location
break;
}
case SMART_ACTION_GO_SET_LOOT_STATE:
{
ObjectList targets = GetTargets();
if (!targets)
return;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
if (IsGameObject(*itr))
(*itr)->ToGameObject()->SetLootState(e.action.setGoLootState.state);
delete targets;
break;
}
case SMART_ACTION_SEND_GOSSIP_MENU:
{
if (!GetBaseObject())
@@ -2619,6 +2633,13 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
ProcessAction(e, NULL, var0);
break;
}
case SMART_EVENT_GO_STATE_CHANGED:
{
if (e.event.goStateChanged.state != var0)
return;
ProcessAction(e, unit, var0, var1);
break;
}
default:
sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType());
break;