Guest User

Untitled

a guest
Nov 23rd, 2017
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.50 KB | None | 0 0
  1. From 537baee4b799e342ce4130b387032a084983f0ec Mon Sep 17 00:00:00 2001
  2. From: root <japerdeflap@hotmail.com>
  3. Date: Tue, 6 Sep 2011 22:47:13 +0200
  4. Subject: [PATCH] SMART_ACTION_SET_UNIT_FIELD_BYTES_2 - SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_2 - SMART_ACTION_RESET
  5.  
  6. ---
  7. src/server/game/AI/SmartScripts/SmartScript.cpp | 39 ++++++++++++++++++++
  8. src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 3 ++
  9. src/server/game/AI/SmartScripts/SmartScriptMgr.h | 31 +++++++++++++---
  10. 3 files changed, 67 insertions(+), 6 deletions(-)
  11.  
  12. diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
  13. index 22ecdc3..9aeb658 100644
  14. --- a/src/server/game/AI/SmartScripts/SmartScript.cpp
  15. +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
  16. @@ -691,6 +691,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
  17. return;
  18.  
  19. me->DoFleeToGetAssistance();
  20. + if (e.action.flee.withEmote)
  21. + sCreatureTextMgr->SendChatString(me, sObjectMgr->GetTrinityStringForDBCLocale(LANG_FLEE), CHAT_MSG_MONSTER_EMOTE);
  22. sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow());
  23. break;
  24. }
  25. @@ -1781,9 +1783,46 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
  26. me->GetMotionMaster()->MoveJump(e.target.x, e.target.y , e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
  27. break;
  28. }
  29. +
  30. + case SMART_ACTION_RESET:
  31. + {
  32. + if (!me)
  33. + return;
  34. +
  35. + me->AI()->Reset();
  36. + sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_RESET: Creature %u Reset", me->GetGUIDLow());
  37. + return;
  38. + }
  39. +
  40. default:
  41. sLog->outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType());
  42. break;
  43. +
  44. + case SMART_ACTION_SET_UNIT_FIELD_BYTES_2:
  45. + {
  46. + ObjectList* targets = GetTargets(e, unit);
  47. + if (!targets)
  48. + return;
  49. + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
  50. + if (IsUnit(*itr))
  51. + (*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_2, 0, e.action.setunitByte.byte1);
  52. +
  53. + delete targets;
  54. + break;
  55. + }
  56. + case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_2:
  57. + {
  58. + ObjectList* targets = GetTargets(e, unit);
  59. + if (!targets)
  60. + return;
  61. +
  62. + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
  63. + if (IsUnit(*itr))
  64. + (*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_2, 0, e.action.delunitByte.byte1);
  65. +
  66. + delete targets;
  67. + break;
  68. + }
  69. }
  70. }
  71.  
  72. diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
  73. index 99c804d..f5a693c 100644
  74. --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
  75. +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
  76. @@ -775,6 +775,9 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
  77. case SMART_ACTION_ADD_DYNAMIC_FLAG:
  78. case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
  79. case SMART_ACTION_JUMP_TO_POS:
  80. + case SMART_ACTION_RESET:
  81. + case SMART_ACTION_SET_UNIT_FIELD_BYTES_2:
  82. + case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_2:
  83. break;
  84. default:
  85. 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);
  86. diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
  87. index 4ab9a73..80f8a19 100644
  88. --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
  89. +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
  90. @@ -462,8 +462,12 @@ enum SMART_ACTION
  91. SMART_ACTION_ADD_DYNAMIC_FLAG = 95, // Flags
  92. SMART_ACTION_REMOVE_DYNAMIC_FLAG = 96, // Flags
  93. SMART_ACTION_JUMP_TO_POS = 97, // speedXY, speedZ, targetX, targetY, targetZ
  94. + SMART_ACTION_RESET = 98, // No Params
  95.  
  96. - SMART_ACTION_END = 98,
  97. + SMART_ACTION_SET_UNIT_FIELD_BYTES_2 = 99, // bytes, target
  98. + SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_2 = 100, // bytes, target
  99. +
  100. + SMART_ACTION_END = 101,
  101. };
  102.  
  103. struct SmartAction
  104. @@ -852,15 +856,30 @@ struct SmartAction
  105. uint32 speedz;
  106. } jump;
  107.  
  108. - struct
  109. - {
  110. - uint32 param1;
  111. - uint32 param2;
  112. - uint32 param3;
  113. + struct
  114. + {
  115. + uint32 withEmote;
  116. + } flee;
  117. +
  118. + struct
  119. + {
  120. + uint32 param1;
  121. + uint32 param2;
  122. + uint32 param3;
  123. uint32 param4;
  124. uint32 param5;
  125. uint32 param6;
  126. } raw;
  127. +
  128. + struct
  129. + {
  130. + uint32 byte2;
  131. + } setunitByte2;
  132. +
  133. + struct
  134. + {
  135. + uint32 byte2;
  136. + } delunitByte2;
  137. };
  138. };
  139.  
  140. --
  141. 1.7.3.1.msysgit.0
Add Comment
Please, Sign In to add comment