diff --git a/src/scripts/common/ComDefFreeCompany.cpp b/src/scripts/common/ComDefFreeCompany.cpp new file mode 100644 index 00000000..41cbc4e1 --- /dev/null +++ b/src/scripts/common/ComDefFreeCompany.cpp @@ -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 /scripts/ + +#include +#include "Manager/EventMgr.h" +#include +#include + +// 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 ); \ No newline at end of file diff --git a/src/tools/custom_talk_parser/main.cpp b/src/tools/custom_talk_parser/main.cpp index fc24e4ad..64a9c096 100644 --- a/src/tools/custom_talk_parser/main.cpp +++ b/src/tools/custom_talk_parser/main.cpp @@ -25,7 +25,7 @@ Sapphire::Data::ExdData g_exdDataGen; namespace fs = std::filesystem; using namespace Sapphire; -std::string javaPath("java " ); +std::string javaPath("C:\\java.exe " ); std::string gamePath( "F:\\Client3.3\\game\\sqpack" ); const std::string onWithinRangeStr( @@ -663,7 +663,7 @@ int main( int argc, char** argv ) outputFile1.write( §ion[ 0 ], section.size() ); outputFile1.close(); std::vector< std::string > functions; - if( false ) + if( unluac ) { std::string command = javaPath + " -jar unluac_2015_06_13.jar " + "generated/" + questInfo->getString( questInfo->data().Script ) + ".luab" + ">> " + diff --git a/src/world/Manager/EventMgr.cpp b/src/world/Manager/EventMgr.cpp index 1dbfa212..10a867ae 100644 --- a/src/world/Manager/EventMgr.cpp +++ b/src/world/Manager/EventMgr.cpp @@ -59,7 +59,7 @@ std::string EventMgr::getEventName( uint32_t eventId ) if( !customTalkInfo ) 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( '_' ); return name.substr( 0, pos ); diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index 09e6a746..1affc4b1 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -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 ) { + //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 ); } diff --git a/src/world/Script/NativeScriptApi.h b/src/world/Script/NativeScriptApi.h index 24cf3d2f..c571d3de 100644 --- a/src/world/Script/NativeScriptApi.h +++ b/src/world/Script/NativeScriptApi.h @@ -152,6 +152,12 @@ namespace Sapphire::ScriptAPI { 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: explicit EventScript( uint32_t eventId ); diff --git a/src/world/Territory/HousingZone.cpp b/src/world/Territory/HousingZone.cpp index 014b29a4..173066fc 100644 --- a/src/world/Territory/HousingZone.cpp +++ b/src/world/Territory/HousingZone.cpp @@ -366,7 +366,6 @@ void Sapphire::HousingZone::updateYardObjects( Sapphire::Common::LandIdent ident auto idx = item.first + arrayBounds.first; m_yardObjects[ idx ] = housingMgr.getYardObjectForItem( housingItem ); - Logger::debug( "Loading yard item {} {}", item.second->getId(), idx ); } }