1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00

extremely broken gilshop implementation

This commit is contained in:
NotAdam 2018-07-22 22:11:03 +10:00
parent 6d7df2fd1b
commit e3539fda75
5 changed files with 56 additions and 0 deletions

View file

@ -1093,6 +1093,17 @@ struct FFXIVIpcEventFinish : FFXIVIpcBasePacket<EventFinish>
/* 000C */ uint32_t padding1;
};
struct FFXIVIpcEventOpenGilShop : FFXIVIpcBasePacket<EventOpenGilShop>
{
uint64_t actorId;
uint32_t eventId;
uint16_t scene;
uint16_t padding;
uint32_t sceneFlags;
uint32_t unknown_wtf[0x101];
};
/**
* Structural representation of the packet sent by the server

View file

@ -0,0 +1,19 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
class GilShop : public EventScript
{
public:
GilShop() : EventScript( 0x00041 )
{}
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto callback = [actorId]( Entity::Player& player, const Event::SceneResult& result )
{
player.playGilShop( actorId, result.eventId, HIDE_HOTBAR | NO_DEFAULT_CAMERA );
};
player.playScene( eventId, 0, HIDE_HOTBAR | NO_DEFAULT_CAMERA, 0, 2, callback );
}
};

View file

@ -58,6 +58,8 @@ public:
/*! play a subevent */
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 directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3, uint32_t eventParam4, uint32_t eventParam5 = 0 );
/*! play a subevent */

View file

@ -133,6 +133,26 @@ void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene,
playScene( eventId, scene, flags, eventParam2, eventParam3, 0, eventCallback );
}
void Core::Entity::Player::playGilShop( uint64_t actorId, uint32_t eventId, uint32_t flags )
{
auto pEvent = getEvent( eventId );
if( !pEvent )
{
auto pLog = g_fw.get< Logger >();
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
return;
}
auto openGilShopPacket = makeZonePacket< Server::FFXIVIpcEventOpenGilShop >( getId() );
openGilShopPacket->data().eventId = eventId;
openGilShopPacket->data().sceneFlags = flags;
openGilShopPacket->data().actorId = actorId;
openGilShopPacket->data().scene = 10;
queuePacket( openGilShopPacket );
}
Core::Event::EventHandlerPtr Core::Entity::Player::bootstrapSceneEvent( uint32_t eventId, uint32_t flags )
{
if( flags & 0x02 )

View file

@ -182,6 +182,10 @@ bool Core::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t actorI
if( !aetherInfo->isAetheryte )
scriptId = EVENTSCRIPT_AETHERNET_ID;
}
else if( eventType == Event::EventHandler::EventHandlerType::Shop )
{
scriptId = 0x00041;
}
auto script = m_nativeScriptMgr->getScript< EventScript >( scriptId );
if( !script )