mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 20:52:22 -04:00
Core/PacketIO: Rewrite updatefield handling
This commit is contained in:
@@ -809,7 +809,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (IsUnit(*itr))
|
||||
{
|
||||
(*itr)->ToUnit()->SetUInt32Value(UNIT_NPC_EMOTESTATE, e.action.emote.emote);
|
||||
(*itr)->ToUnit()->SetEmoteState(Emote(e.action.emote.emote));
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. %s set emotestate to %u",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.emote.emote);
|
||||
}
|
||||
@@ -830,13 +830,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (!e.action.unitFlag.type)
|
||||
{
|
||||
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->AddUnitFlag(UnitFlags(e.action.unitFlag.flag));
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. %s added flag %u to UNIT_FIELD_FLAGS",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->AddUnitFlag2(UnitFlags2(e.action.unitFlag.flag));
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. %s added flag %u to UNIT_FIELD_FLAGS_2",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
|
||||
}
|
||||
@@ -858,13 +858,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (!e.action.unitFlag.type)
|
||||
{
|
||||
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->RemoveUnitFlag(UnitFlags(e.action.unitFlag.flag));
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. %s removed flag %u to UNIT_FIELD_FLAGS",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->RemoveUnitFlag2(UnitFlags2(e.action.unitFlag.flag));
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. %s removed flag %u to UNIT_FIELD_FLAGS_2",
|
||||
(*itr)->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
|
||||
}
|
||||
@@ -1922,7 +1922,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToUnit()->SetUInt64Value(UNIT_NPC_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->SetNpcFlags(NPCFlags(e.action.unitFlag.flag));
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -1935,7 +1935,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToUnit()->SetFlag64(UNIT_NPC_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->AddNpcFlag(NPCFlags(e.action.unitFlag.flag));
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -1948,7 +1948,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToUnit()->RemoveFlag64(UNIT_NPC_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->RemoveNpcFlag(NPCFlags(e.action.unitFlag.flag));
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2132,7 +2132,25 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsUnit(*itr))
|
||||
(*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_1, e.action.setunitByte.type, e.action.setunitByte.byte1);
|
||||
{
|
||||
switch (e.action.setunitByte.type)
|
||||
{
|
||||
case 0:
|
||||
(*itr)->ToUnit()->SetStandState(UnitStandStateType(e.action.setunitByte.byte1));
|
||||
break;
|
||||
case 1:
|
||||
// pet talent points
|
||||
break;
|
||||
case 2:
|
||||
(*itr)->ToUnit()->AddVisFlags(UnitVisFlags(e.action.setunitByte.byte1));
|
||||
break;
|
||||
case 3:
|
||||
// this is totally wrong to maintain compatibility with existing scripts
|
||||
// TODO: fix with animtier overhaul
|
||||
(*itr)->ToUnit()->SetAnimTier(UnitBytes1_Flags(*(*itr)->ToUnit()->m_unitData->AnimTier | e.action.setunitByte.byte1), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2145,7 +2163,23 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsUnit(*itr))
|
||||
(*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_1, e.action.delunitByte.type, e.action.delunitByte.byte1);
|
||||
{
|
||||
switch (e.action.setunitByte.type)
|
||||
{
|
||||
case 0:
|
||||
(*itr)->ToUnit()->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
break;
|
||||
case 1:
|
||||
// pet talent points
|
||||
break;
|
||||
case 2:
|
||||
(*itr)->ToUnit()->RemoveVisFlags(UnitVisFlags(e.action.setunitByte.byte1));
|
||||
break;
|
||||
case 3:
|
||||
(*itr)->ToUnit()->SetAnimTier(UnitBytes1_Flags(*(*itr)->ToUnit()->m_unitData->AnimTier & ~e.action.setunitByte.byte1), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2183,8 +2217,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsUnit(*itr))
|
||||
(*itr)->ToUnit()->SetUInt32Value(OBJECT_DYNAMIC_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->SetDynamicFlags(e.action.unitFlag.flag);
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2196,8 +2229,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsUnit(*itr))
|
||||
(*itr)->ToUnit()->SetFlag(OBJECT_DYNAMIC_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->AddDynamicFlag(e.action.unitFlag.flag);
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2209,8 +2241,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsUnit(*itr))
|
||||
(*itr)->ToUnit()->RemoveFlag(OBJECT_DYNAMIC_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->RemoveDynamicFlag(e.action.unitFlag.flag);
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2389,7 +2420,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsGameObject(*itr))
|
||||
(*itr)->ToGameObject()->SetUInt32Value(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
|
||||
(*itr)->ToGameObject()->SetFlags(GameObjectFlags(e.action.goFlag.flag));
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2402,7 +2433,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsGameObject(*itr))
|
||||
(*itr)->ToGameObject()->SetFlag(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
|
||||
(*itr)->ToGameObject()->AddFlag(GameObjectFlags(e.action.goFlag.flag));
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2415,7 +2446,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsGameObject(*itr))
|
||||
(*itr)->ToGameObject()->RemoveFlag(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
|
||||
(*itr)->ToGameObject()->RemoveFlag(GameObjectFlags(e.action.goFlag.flag));
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user