1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 22:17:45 +00:00
sapphire/src/servers/Scripts/common/GilShop.cpp

48 lines
1.1 KiB
C++
Raw Normal View History

#include <ScriptObject.h>
#include <Actor/Player.h>
class GilShop : public EventScript
{
public:
GilShop() : EventScript( 0x00040001 )
{}
2018-07-22 23:20:12 +10:00
constexpr static auto SCENE_FLAGS = HIDE_HOTBAR | NO_DEFAULT_CAMERA;
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
player.playScene( eventId, 0, SCENE_FLAGS, 0, 2, shopCallback );
}
private:
2018-07-22 23:20:12 +10:00
static void shopInteractionCallback( Entity::Player& player, const Event::SceneResult& result )
{
2018-07-22 23:20:12 +10:00
// item purchase
if( result.param1 == 768 )
{
// buy
if( result.param2 == 1 )
{
}
// sell
else if( result.param2 == 2 )
{
2018-07-22 23:20:12 +10:00
}
player.sendDebug( "got tradeQuantity: " + std::to_string( result.param4 ) );
player.playGilShop( result.eventId, SCENE_FLAGS, shopInteractionCallback );
2018-07-22 23:20:12 +10:00
return;
}
2018-07-22 23:20:12 +10:00
// exit
player.playScene( result.eventId, 255, SCENE_FLAGS );
}
static void shopCallback( Entity::Player& player, const Event::SceneResult& result )
{
player.playGilShop( result.eventId, SCENE_FLAGS, shopInteractionCallback );
}
};