Separating movespeed change and adding delay
This commit is contained in:
parent
62818defa4
commit
99d1072f20
@ -4,6 +4,8 @@
|
|||||||
#include "Unit.h"
|
#include "Unit.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
|
#include "EventProcessor.h"
|
||||||
|
#include "World.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -45,6 +47,22 @@ namespace
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SwiftTravelEvent : public BasicEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SwiftTravelEvent(Player* player, uint8 form) : _player(player), _form(form) {}
|
||||||
|
bool Execute(uint64, uint32) override
|
||||||
|
{
|
||||||
|
if (_player && _player->IsInWorld())
|
||||||
|
if (_form == FORM_TRAVEL)
|
||||||
|
_player->SetSpeed(MOVE_RUN, 2.0f, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
Player* _player;
|
||||||
|
uint8 _form;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class SwiftTravelForm_WorldScript : public WorldScript
|
class SwiftTravelForm_WorldScript : public WorldScript
|
||||||
@ -83,8 +101,7 @@ public:
|
|||||||
if (!RequirementsMet(player))
|
if (!RequirementsMet(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (form == FORM_TRAVEL)
|
player->m_Events.AddEvent(new SwiftTravelEvent(player, form), player->m_Events.CalculateTime(500));
|
||||||
player->SetSpeed(MOVE_RUN, 2.0f, true);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user