mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 06:27:45 +00:00
extremely broken gilshop implementation
This commit is contained in:
parent
6d7df2fd1b
commit
e3539fda75
5 changed files with 56 additions and 0 deletions
|
@ -1093,6 +1093,17 @@ struct FFXIVIpcEventFinish : FFXIVIpcBasePacket<EventFinish>
|
||||||
/* 000C */ uint32_t padding1;
|
/* 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
|
* Structural representation of the packet sent by the server
|
||||||
|
|
19
src/servers/Scripts/common/GilShop.cpp
Normal file
19
src/servers/Scripts/common/GilShop.cpp
Normal 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 );
|
||||||
|
}
|
||||||
|
};
|
|
@ -58,6 +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 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 );
|
||||||
|
|
||||||
/*! play a subevent */
|
/*! play a subevent */
|
||||||
|
|
|
@ -133,6 +133,26 @@ 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 )
|
||||||
|
{
|
||||||
|
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 )
|
Core::Event::EventHandlerPtr Core::Entity::Player::bootstrapSceneEvent( uint32_t eventId, uint32_t flags )
|
||||||
{
|
{
|
||||||
if( flags & 0x02 )
|
if( flags & 0x02 )
|
||||||
|
|
|
@ -182,6 +182,10 @@ bool Core::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t actorI
|
||||||
if( !aetherInfo->isAetheryte )
|
if( !aetherInfo->isAetheryte )
|
||||||
scriptId = EVENTSCRIPT_AETHERNET_ID;
|
scriptId = EVENTSCRIPT_AETHERNET_ID;
|
||||||
}
|
}
|
||||||
|
else if( eventType == Event::EventHandler::EventHandlerType::Shop )
|
||||||
|
{
|
||||||
|
scriptId = 0x00041;
|
||||||
|
}
|
||||||
|
|
||||||
auto script = m_nativeScriptMgr->getScript< EventScript >( scriptId );
|
auto script = m_nativeScriptMgr->getScript< EventScript >( scriptId );
|
||||||
if( !script )
|
if( !script )
|
||||||
|
|
Loading…
Add table
Reference in a new issue