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

Some more work on FC related packets and custom scripts.

This commit is contained in:
Mordred 2023-01-30 13:11:05 +01:00
parent 9da58c61aa
commit 9491b549a1
6 changed files with 171 additions and 4 deletions

View file

@ -0,0 +1,151 @@
// This is an automatically generated C++ script template
// Content needs to be added by hand to make it function
// In order for this script to be loaded, move it to the correct folder in <root>/scripts/
#include <Actor/Player.h>
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include <Service.h>
// Script: ComDefFreeCompany_00076
// Event Name: Small Talk
// Event ID: 720972
using namespace Sapphire;
class ComDefFreeCompany : public Sapphire::ScriptAPI::EventScript
{
private:
// Basic event information
// Entities found in the script data of the event
static constexpr auto FcErrGeneral = 4070;
static constexpr auto FcHierarchyMaster = 0;
static constexpr auto GrandCompanyInvalid = 0;
static constexpr auto ImmortalFlames = 3;
static constexpr auto InfoErrorFcrename = 3064;
static constexpr auto InfoErrorGil = 3021;
static constexpr auto InfoErrorSameName = 3051;
static constexpr auto InfoErrorStringEnd = 3110;
static constexpr auto InfoErrorStringStart = 3022;
static constexpr auto Maelstrom = 1;
static constexpr auto NpcOfGridania = 1002395;
static constexpr auto NpcOfLimsa = 1003247;
static constexpr auto NpcOfUldah = 1002392;
static constexpr auto OrderOfTwinAdder = 2;
public:
ComDefFreeCompany() : Sapphire::ScriptAPI::EventScript( 720972 ){};
~ComDefFreeCompany() = default;
//////////////////////////////////////////////////////////////////////
// Event Handlers
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
Scene00000( player );
}
private:
//////////////////////////////////////////////////////////////////////
// Available Scenes in this event, not necessarly all are used
//////////////////////////////////////////////////////////////////////
void Scene00000( Entity::Player& player )
{
eventMgr().playScene( player, getId(), 0, NONE, bindSceneReturn( &ComDefFreeCompany::Scene00000Return ) );
}
void Scene00000Return( Entity::Player& player, const Event::SceneResult& result )
{
}
//////////////////////////////////////////////////////////////////////
void Scene00001( Entity::Player& player )
{
eventMgr().playScene( player, getId(), 1, NONE, bindSceneReturn( &ComDefFreeCompany::Scene00001Return ) );
}
void Scene00001Return( Entity::Player& player, const Event::SceneResult& result )
{
}
//////////////////////////////////////////////////////////////////////
void Scene00002( Entity::Player& player )
{
eventMgr().playScene( player, getId(), 2, NONE, bindSceneReturn( &ComDefFreeCompany::Scene00002Return ) );
}
void Scene00002Return( Entity::Player& player, const Event::SceneResult& result )
{
}
//////////////////////////////////////////////////////////////////////
void Scene00003( Entity::Player& player )
{
eventMgr().playScene( player, getId(), 3, NONE, bindSceneReturn( &ComDefFreeCompany::Scene00003Return ) );
}
void Scene00003Return( Entity::Player& player, const Event::SceneResult& result )
{
}
//////////////////////////////////////////////////////////////////////
void Scene00004( Entity::Player& player )
{
eventMgr().playScene( player, getId(), 4, NONE, bindSceneReturn( &ComDefFreeCompany::Scene00004Return ) );
}
void Scene00004Return( Entity::Player& player, const Event::SceneResult& result )
{
}
//////////////////////////////////////////////////////////////////////
void Scene00005( Entity::Player& player )
{
eventMgr().playScene( player, getId(), 5, NONE, bindSceneReturn( &ComDefFreeCompany::Scene00005Return ) );
}
void Scene00005Return( Entity::Player& player, const Event::SceneResult& result )
{
}
//////////////////////////////////////////////////////////////////////
void Scene00006( Entity::Player& player )
{
eventMgr().playScene( player, getId(), 6, NONE, bindSceneReturn( &ComDefFreeCompany::Scene00006Return ) );
}
void Scene00006Return( Entity::Player& player, const Event::SceneResult& result )
{
}
//////////////////////////////////////////////////////////////////////
void Scene00007( Entity::Player& player )
{
eventMgr().playScene( player, getId(), 7, NONE, bindSceneReturn( &ComDefFreeCompany::Scene00007Return ) );
}
void Scene00007Return( Entity::Player& player, const Event::SceneResult& result )
{
}
//////////////////////////////////////////////////////////////////////
void Scene00008( Entity::Player& player )
{
eventMgr().playScene( player, getId(), 8, NONE, bindSceneReturn( &ComDefFreeCompany::Scene00008Return ) );
}
void Scene00008Return( Entity::Player& player, const Event::SceneResult& result )
{
}
};
EXPOSE_SCRIPT( ComDefFreeCompany );

View file

@ -25,7 +25,7 @@ Sapphire::Data::ExdData g_exdDataGen;
namespace fs = std::filesystem; namespace fs = std::filesystem;
using namespace Sapphire; using namespace Sapphire;
std::string javaPath("java " ); std::string javaPath("C:\\java.exe " );
std::string gamePath( "F:\\Client3.3\\game\\sqpack" ); std::string gamePath( "F:\\Client3.3\\game\\sqpack" );
const std::string onWithinRangeStr( const std::string onWithinRangeStr(
@ -663,7 +663,7 @@ int main( int argc, char** argv )
outputFile1.write( &section[ 0 ], section.size() ); outputFile1.write( &section[ 0 ], section.size() );
outputFile1.close(); outputFile1.close();
std::vector< std::string > functions; std::vector< std::string > functions;
if( false ) if( unluac )
{ {
std::string command = std::string command =
javaPath + " -jar unluac_2015_06_13.jar " + "generated/" + questInfo->getString( questInfo->data().Script ) + ".luab" + ">> " + javaPath + " -jar unluac_2015_06_13.jar " + "generated/" + questInfo->getString( questInfo->data().Script ) + ".luab" + ">> " +

View file

@ -59,7 +59,7 @@ std::string EventMgr::getEventName( uint32_t eventId )
if( !customTalkInfo ) if( !customTalkInfo )
return unknown + "CustomTalk"; return unknown + "CustomTalk";
std::string name = customTalkInfo->getString( customTalkInfo->data().Text.Name ); std::string name = customTalkInfo->getString( customTalkInfo->data().Script );
std::size_t pos = name.find_first_of( '_' ); std::size_t pos = name.find_first_of( '_' );
return name.substr( 0, pos ); return name.substr( 0, pos );

View file

@ -702,6 +702,17 @@ void Sapphire::Network::GameConnection::marketBoardRequestItemListings( const Pa
void Sapphire::Network::GameConnection::getFcStatus( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player ) void Sapphire::Network::GameConnection::getFcStatus( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
{ {
//Todo implement proper FC handling
auto& server = Common::Service< World::WorldServer >::ref();
auto fcResultPacket = makeZonePacket< FFXIVIpcGetFcStatusResult >( player.getId() );
fcResultPacket->data().FreeCompanyID = 0;
fcResultPacket->data().AuthorityList = 0;
fcResultPacket->data().HierarchyType = 0;
fcResultPacket->data().GrandCompanyID = 0;
fcResultPacket->data().FcRank = 0;
fcResultPacket->data().CrestID = 0;
fcResultPacket->data().CharaFcParam = 1;
server.queueForPlayer( player.getCharacterId(), fcResultPacket );
} }

View file

@ -152,6 +152,12 @@ namespace Sapphire::ScriptAPI
{ {
return std::bind( f, static_cast< Obj* >( this ), std::placeholders::_1 ); return std::bind( f, static_cast< Obj* >( this ), std::placeholders::_1 );
} }
template< typename Ret, class Obj >
inline std::function< void( Entity::Player& player, const Event::SceneResult& result ) >
bindSceneReturn( Ret ( Obj::*f )( Entity::Player& player, const Event::SceneResult& result ) )
{
return std::bind( f, static_cast< Obj* >( this ), std::placeholders::_1, std::placeholders::_2 );
}
public: public:
explicit EventScript( uint32_t eventId ); explicit EventScript( uint32_t eventId );

View file

@ -366,7 +366,6 @@ void Sapphire::HousingZone::updateYardObjects( Sapphire::Common::LandIdent ident
auto idx = item.first + arrayBounds.first; auto idx = item.first + arrayBounds.first;
m_yardObjects[ idx ] = housingMgr.getYardObjectForItem( housingItem ); m_yardObjects[ idx ] = housingMgr.getYardObjectForItem( housingItem );
Logger::debug( "Loading yard item {} {}", item.second->getId(), idx );
} }
} }