1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00
sapphire/src/servers/Scripts/common/CmnDefInnBed.cpp

58 lines
1.5 KiB
C++
Raw Normal View History

2018-03-07 08:14:42 +01:00
#include <Script/NativeScriptApi.h>
#include "../ScriptObject.h"
#include <Actor/Player.h>
class CmnDefInnBed : public EventScript
{
public:
CmnDefInnBed() : EventScript( 720916 )
2018-03-20 23:56:06 +11:00
{}
2018-03-07 08:14:42 +01:00
// menu
void Scene00000( Entity::Player& player )
{
2018-03-20 22:33:51 +11:00
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
2018-03-07 08:14:42 +01:00
{
if( result.param2 > 0 )
Scene00001( player, result.param2 );
2018-03-07 08:14:42 +01:00
};
2018-03-20 22:33:51 +11:00
player.playScene( getId(), 0, 0x2000, 0, 1, callback );
2018-03-07 08:14:42 +01:00
}
// lay down
void Scene00001( Entity::Player& player, uint16_t param )
{
2018-03-20 22:33:51 +11:00
auto callback = [this]( Entity::Player& player, const Event::SceneResult& result )
2018-03-07 08:14:42 +01:00
{
Scene00002( player, result.param2 );
2018-03-07 08:14:42 +01:00
};
2018-03-20 22:33:51 +11:00
player.playScene( getId(), 1, 0xF32E48F8, 0, 1, param, callback );
2018-03-07 08:14:42 +01:00
}
// logout
void Scene00002( Entity::Player& player, uint16_t param )
{
2018-03-20 22:33:51 +11:00
player.playScene( getId(), 2, 0xF32E48F8, 0, 1, param, nullptr );
2018-03-07 08:14:42 +01:00
}
// wake up
void Scene00100( Entity::Player& player )
{
auto callback = []( Entity::Player& player, const Event::SceneResult& result )
2018-03-20 22:33:51 +11:00
{ };
2018-03-07 08:14:42 +01:00
2018-03-20 22:33:51 +11:00
player.playScene( getId(), 100, 0x800, 0, 0, callback );
2018-03-07 08:14:42 +01:00
}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
2018-03-20 22:33:51 +11:00
void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
2018-03-07 08:14:42 +01:00
{
Scene00100( player );
}
};