Core/SAI: Add the ability to remove UNIT_FIELD_BYTES_1 in SAI (action

91)
This commit is contained in:
runningnak3d
2011-02-07 10:15:54 -07:00
parent f7eba9c940
commit 97882544e1
3 changed files with 21 additions and 4 deletions
@@ -1233,7 +1233,16 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
if (!targets) return;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
if (IsUnit((*itr)))
(*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_1, 3, e.action.unitByte.byte);
(*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_1, 3, e.action.setunitByte.byte1);
break;
}
case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets) return;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
if (IsUnit((*itr)))
(*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, e.action.delunitByte.byte1);
break;
}
default:
@@ -767,6 +767,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
case SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST:
case SMART_ACTION_RANDOM_MOVE:
case SMART_ACTION_SET_UNIT_FIELD_BYTES_1:
case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
@@ -446,7 +446,9 @@ enum SMART_ACTION
SMART_ACTION_SET_UNIT_FIELD_BYTES_1 = 90, // bytes, target
SMART_ACTION_END = 91,
SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1 = 91, // bytes, target
SMART_ACTION_END = 92,
};
struct SmartAction
@@ -789,8 +791,13 @@ struct SmartAction
struct
{
uint32 byte;
} unitByte;
uint32 byte1;
} setunitByte;
struct
{
uint32 byte1;
} delunitByte;
struct
{