mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
gilshops now work using the proper packet
This commit is contained in:
parent
b8871519fe
commit
5ac4573bd3
3 changed files with 25 additions and 13 deletions
|
@ -4,20 +4,36 @@
|
||||||
class GilShop : public EventScript
|
class GilShop : public EventScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GilShop() : EventScript( 0x00041 )
|
GilShop() : EventScript( 0x00040001 )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
constexpr static auto SCENE_FLAGS = HIDE_HOTBAR | NO_DEFAULT_CAMERA;
|
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:
|
||||||
static void shopInteractionCallback( Entity::Player& player, const Event::SceneResult& result )
|
static void shopInteractionCallback( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
// item purchase
|
// item purchase
|
||||||
if( result.param1 == 768 )
|
if( result.param1 == 768 )
|
||||||
{
|
{
|
||||||
//player.playGilShop( result.eventId, HIDE_HOTBAR | NO_DEFAULT_CAMERA, shopInteractionCallback );
|
// buy
|
||||||
|
if( result.param2 == 1 )
|
||||||
|
{
|
||||||
|
|
||||||
player.sendDebug("got tradeQuantity: " + std::to_string( result.param4 ) );
|
}
|
||||||
player.playScene( result.eventId, 10, SCENE_FLAGS, 0, 0, shopInteractionCallback );
|
|
||||||
|
// sell
|
||||||
|
else if( result.param2 == 2 )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendDebug( "got tradeQuantity: " + std::to_string( result.param4 ) );
|
||||||
|
player.playGilShop( result.eventId, SCENE_FLAGS, shopInteractionCallback );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,13 +43,6 @@ public:
|
||||||
|
|
||||||
static void shopCallback( Entity::Player& player, const Event::SceneResult& result )
|
static void shopCallback( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
//player.playGilShop( result.eventId, HIDE_HOTBAR | NO_DEFAULT_CAMERA, shopInteractionCallback );
|
player.playGilShop( result.eventId, SCENE_FLAGS, shopInteractionCallback );
|
||||||
|
|
||||||
player.playScene( result.eventId, 10, SCENE_FLAGS, 0, 0, shopInteractionCallback );
|
|
||||||
}
|
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
|
||||||
{
|
|
||||||
player.playScene( eventId, 0, SCENE_FLAGS, 0, 2, shopCallback );
|
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -140,7 +140,9 @@ void Core::Entity::Player::playGilShop( uint32_t eventId, uint32_t flags,
|
||||||
if( !pEvent )
|
if( !pEvent )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
pEvent->setPlayedScene( true );
|
||||||
pEvent->setEventReturnCallback( eventCallback );
|
pEvent->setEventReturnCallback( eventCallback );
|
||||||
|
pEvent->setSceneChainCallback( nullptr );
|
||||||
|
|
||||||
auto openGilShopPacket = makeZonePacket< Server::FFXIVIpcEventOpenGilShop >( getId() );
|
auto openGilShopPacket = makeZonePacket< Server::FFXIVIpcEventOpenGilShop >( getId() );
|
||||||
openGilShopPacket->data().eventId = eventId;
|
openGilShopPacket->data().eventId = eventId;
|
||||||
|
|
|
@ -174,6 +174,7 @@ bool Core::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t actorI
|
||||||
uint16_t eventType = eventId >> 16;
|
uint16_t eventType = eventId >> 16;
|
||||||
uint32_t scriptId = eventId;
|
uint32_t scriptId = eventId;
|
||||||
|
|
||||||
|
// todo: replace this shit with something more flexible allowing for handlers for an entire type without a bunch of if statements
|
||||||
// aethernet/aetherytes need to be handled separately
|
// aethernet/aetherytes need to be handled separately
|
||||||
if( eventType == Event::EventHandler::EventHandlerType::Aetheryte )
|
if( eventType == Event::EventHandler::EventHandlerType::Aetheryte )
|
||||||
{
|
{
|
||||||
|
@ -184,7 +185,7 @@ bool Core::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t actorI
|
||||||
}
|
}
|
||||||
else if( eventType == Event::EventHandler::EventHandlerType::Shop )
|
else if( eventType == Event::EventHandler::EventHandlerType::Shop )
|
||||||
{
|
{
|
||||||
scriptId = 0x00041;
|
scriptId = 0x00040001;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto script = m_nativeScriptMgr->getScript< EventScript >( scriptId );
|
auto script = m_nativeScriptMgr->getScript< EventScript >( scriptId );
|
||||||
|
|
Loading…
Add table
Reference in a new issue