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:
Lopfest
2018-01-30 11:31:52 +01:00
committed by jackpoz
parent 9f057d7082
commit 443a425c4c
3 changed files with 36 additions and 1 deletions

View File

@@ -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;