Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 537baee4b799e342ce4130b387032a084983f0ec Mon Sep 17 00:00:00 2001
- From: root <japerdeflap@hotmail.com>
- Date: Tue, 6 Sep 2011 22:47:13 +0200
- Subject: [PATCH] SMART_ACTION_SET_UNIT_FIELD_BYTES_2 - SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_2 - SMART_ACTION_RESET
- ---
- src/server/game/AI/SmartScripts/SmartScript.cpp | 39 ++++++++++++++++++++
- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 3 ++
- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 31 +++++++++++++---
- 3 files changed, 67 insertions(+), 6 deletions(-)
- diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
- index 22ecdc3..9aeb658 100644
- --- a/src/server/game/AI/SmartScripts/SmartScript.cpp
- +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
- @@ -691,6 +691,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
- return;
- me->DoFleeToGetAssistance();
- + if (e.action.flee.withEmote)
- + sCreatureTextMgr->SendChatString(me, sObjectMgr->GetTrinityStringForDBCLocale(LANG_FLEE), CHAT_MSG_MONSTER_EMOTE);
- sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow());
- break;
- }
- @@ -1781,9 +1783,46 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
- me->GetMotionMaster()->MoveJump(e.target.x, e.target.y , e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
- break;
- }
- +
- + case SMART_ACTION_RESET:
- + {
- + if (!me)
- + return;
- +
- + me->AI()->Reset();
- + sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_RESET: Creature %u Reset", me->GetGUIDLow());
- + return;
- + }
- +
- default:
- sLog->outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType());
- break;
- +
- + case SMART_ACTION_SET_UNIT_FIELD_BYTES_2:
- + {
- + ObjectList* targets = GetTargets(e, unit);
- + if (!targets)
- + return;
- + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
- + if (IsUnit(*itr))
- + (*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_2, 0, e.action.setunitByte.byte1);
- +
- + delete targets;
- + break;
- + }
- + case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_2:
- + {
- + 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_2, 0, e.action.delunitByte.byte1);
- +
- + delete targets;
- + break;
- + }
- }
- }
- diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
- index 99c804d..f5a693c 100644
- --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
- +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
- @@ -775,6 +775,9 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
- case SMART_ACTION_ADD_DYNAMIC_FLAG:
- case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
- case SMART_ACTION_JUMP_TO_POS:
- + case SMART_ACTION_RESET:
- + case SMART_ACTION_SET_UNIT_FIELD_BYTES_2:
- + case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_2:
- 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);
- diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
- index 4ab9a73..80f8a19 100644
- --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
- +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
- @@ -462,8 +462,12 @@ enum SMART_ACTION
- SMART_ACTION_ADD_DYNAMIC_FLAG = 95, // Flags
- SMART_ACTION_REMOVE_DYNAMIC_FLAG = 96, // Flags
- SMART_ACTION_JUMP_TO_POS = 97, // speedXY, speedZ, targetX, targetY, targetZ
- + SMART_ACTION_RESET = 98, // No Params
- - SMART_ACTION_END = 98,
- + SMART_ACTION_SET_UNIT_FIELD_BYTES_2 = 99, // bytes, target
- + SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_2 = 100, // bytes, target
- +
- + SMART_ACTION_END = 101,
- };
- struct SmartAction
- @@ -852,15 +856,30 @@ struct SmartAction
- uint32 speedz;
- } jump;
- - struct
- - {
- - uint32 param1;
- - uint32 param2;
- - uint32 param3;
- + struct
- + {
- + uint32 withEmote;
- + } flee;
- +
- + struct
- + {
- + uint32 param1;
- + uint32 param2;
- + uint32 param3;
- uint32 param4;
- uint32 param5;
- uint32 param6;
- } raw;
- +
- + struct
- + {
- + uint32 byte2;
- + } setunitByte2;
- +
- + struct
- + {
- + uint32 byte2;
- + } delunitByte2;
- };
- };
- --
- 1.7.3.1.msysgit.0
Add Comment
Please, Sign In to add comment