mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-07 11:17:46 +00:00
somewhat working gilshops
This commit is contained in:
parent
18a1ab79d6
commit
9ab7d5c68a
6 changed files with 39 additions and 14 deletions
|
@ -65,6 +65,8 @@ struct FFXIVIpcEventHandlerReturn : FFXIVIpcBasePacket< ReturnEventHandler >
|
||||||
/* 0008 */ uint16_t param2;
|
/* 0008 */ uint16_t param2;
|
||||||
/* 000A */ char pad_000A[2];
|
/* 000A */ char pad_000A[2];
|
||||||
/* 000C */ uint16_t param3;
|
/* 000C */ uint16_t param3;
|
||||||
|
/* 000E */ char pad_000E[2];
|
||||||
|
/* 0010 */ uint16_t tradeQuantity;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFXIVIpcEnterTerritoryHandler : FFXIVIpcBasePacket< EnterTeriEventHandler >
|
struct FFXIVIpcEnterTerritoryHandler : FFXIVIpcBasePacket< EnterTeriEventHandler >
|
||||||
|
|
|
@ -7,13 +7,33 @@ public:
|
||||||
GilShop() : EventScript( 0x00041 )
|
GilShop() : EventScript( 0x00041 )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
constexpr static auto SCENE_FLAGS = HIDE_HOTBAR | NO_DEFAULT_CAMERA;
|
||||||
|
|
||||||
|
static void shopInteractionCallback( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
// item purchase
|
||||||
|
if( result.param1 == 768 )
|
||||||
|
{
|
||||||
|
//player.playGilShop( result.eventId, HIDE_HOTBAR | NO_DEFAULT_CAMERA, shopInteractionCallback );
|
||||||
|
|
||||||
|
player.sendDebug("got tradeQuantity: " + std::to_string( result.tradeQuantity ) );
|
||||||
|
player.playScene( result.eventId, 10, SCENE_FLAGS, 0, 0, shopInteractionCallback );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// exit
|
||||||
|
player.playScene( result.eventId, 255, SCENE_FLAGS );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void shopCallback( Entity::Player& player, const Event::SceneResult& result )
|
||||||
|
{
|
||||||
|
//player.playGilShop( result.eventId, HIDE_HOTBAR | NO_DEFAULT_CAMERA, shopInteractionCallback );
|
||||||
|
|
||||||
|
player.playScene( result.eventId, 10, SCENE_FLAGS, 0, 0, shopInteractionCallback );
|
||||||
|
}
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto callback = [actorId]( Entity::Player& player, const Event::SceneResult& result )
|
player.playScene( eventId, 0, SCENE_FLAGS, 0, 2, shopCallback );
|
||||||
{
|
|
||||||
player.playGilShop( actorId, result.eventId, HIDE_HOTBAR | NO_DEFAULT_CAMERA );
|
|
||||||
};
|
|
||||||
|
|
||||||
player.playScene( eventId, 0, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 2, callback );
|
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -58,7 +58,8 @@ public:
|
||||||
/*! play a subevent */
|
/*! play a subevent */
|
||||||
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 );
|
void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 );
|
||||||
|
|
||||||
void playGilShop( uint64_t actorId, uint32_t eventId, uint32_t flags );
|
void playGilShop( uint32_t eventId, uint32_t flags,
|
||||||
|
Event::EventHandler::SceneReturnCallback eventCallback );
|
||||||
|
|
||||||
void directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3, uint32_t eventParam4, uint32_t eventParam5 = 0 );
|
void directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3, uint32_t eventParam4, uint32_t eventParam5 = 0 );
|
||||||
|
|
||||||
|
|
|
@ -133,20 +133,19 @@ void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene,
|
||||||
playScene( eventId, scene, flags, eventParam2, eventParam3, 0, eventCallback );
|
playScene( eventId, scene, flags, eventParam2, eventParam3, 0, eventCallback );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::playGilShop( uint64_t actorId, uint32_t eventId, uint32_t flags )
|
void Core::Entity::Player::playGilShop( uint32_t eventId, uint32_t flags,
|
||||||
|
Event::EventHandler::SceneReturnCallback eventCallback )
|
||||||
{
|
{
|
||||||
auto pEvent = getEvent( eventId );
|
auto pEvent = bootstrapSceneEvent( eventId, flags );
|
||||||
if( !pEvent )
|
if( !pEvent )
|
||||||
{
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
|
||||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
pEvent->setEventReturnCallback( eventCallback );
|
||||||
|
|
||||||
auto openGilShopPacket = makeZonePacket< Server::FFXIVIpcEventOpenGilShop >( getId() );
|
auto openGilShopPacket = makeZonePacket< Server::FFXIVIpcEventOpenGilShop >( getId() );
|
||||||
openGilShopPacket->data().eventId = eventId;
|
openGilShopPacket->data().eventId = eventId;
|
||||||
openGilShopPacket->data().sceneFlags = flags;
|
openGilShopPacket->data().sceneFlags = flags;
|
||||||
openGilShopPacket->data().actorId = actorId;
|
openGilShopPacket->data().actorId = getId();
|
||||||
|
|
||||||
openGilShopPacket->data().scene = 10;
|
openGilShopPacket->data().scene = 10;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace Core {
|
||||||
uint16_t param1;
|
uint16_t param1;
|
||||||
uint16_t param2;
|
uint16_t param2;
|
||||||
uint16_t param3;
|
uint16_t param3;
|
||||||
|
uint16_t tradeQuantity;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EventHandler
|
class EventHandler
|
||||||
|
|
|
@ -203,6 +203,7 @@ void Core::Network::GameConnection::eventHandlerReturn( const Packets::FFXIVARR_
|
||||||
const auto& param1 = packet.data().param1;
|
const auto& param1 = packet.data().param1;
|
||||||
const auto& param2 = packet.data().param2;
|
const auto& param2 = packet.data().param2;
|
||||||
const auto& param3 = packet.data().param3;
|
const auto& param3 = packet.data().param3;
|
||||||
|
const auto& tradeQuantity = packet.data().tradeQuantity;
|
||||||
|
|
||||||
std::string eventName = Event::getEventName( eventId );
|
std::string eventName = Event::getEventName( eventId );
|
||||||
|
|
||||||
|
@ -228,6 +229,7 @@ void Core::Network::GameConnection::eventHandlerReturn( const Packets::FFXIVARR_
|
||||||
result.param1 = param1;
|
result.param1 = param1;
|
||||||
result.param2 = param2;
|
result.param2 = param2;
|
||||||
result.param3 = param3;
|
result.param3 = param3;
|
||||||
|
result.tradeQuantity = tradeQuantity;
|
||||||
eventCallback( player, result );
|
eventCallback( player, result );
|
||||||
}
|
}
|
||||||
// we might have a scene chain callback instead so check for that too
|
// we might have a scene chain callback instead so check for that too
|
||||||
|
|
Loading…
Add table
Reference in a new issue