mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 11:43:18 -04:00
Core/SAI: Implement new action to set movement speed
(cherry picked from commit 5dd6d31c01)
# Conflicts:
# src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
# src/server/game/AI/SmartScripts/SmartScriptMgr.h
This commit is contained in:
@@ -2304,6 +2304,18 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_MOVEMENT_SPEED:
|
||||
{
|
||||
uint32 speedInteger = e.action.movementSpeed.speedInteger;
|
||||
uint32 speedFraction = e.action.movementSpeed.speedFraction;
|
||||
float speed = float(speedInteger) + float(speedFraction) / std::pow(10, std::floor(std::log10(float(speedFraction ? speedFraction : 1)) + 1));
|
||||
|
||||
for (WorldObject* target : targets)
|
||||
if (IsCreature(target))
|
||||
me->SetSpeed(UnitMoveType(e.action.movementSpeed.movementType), speed);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user