mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-10 04:37:45 +00:00
Added onEnterTerritory for IC, also changed the way IC is called
This commit is contained in:
parent
1a1349b33c
commit
c6c2210471
11 changed files with 31 additions and 15 deletions
|
@ -19,7 +19,7 @@ extern Core::Logger g_log;
|
|||
|
||||
Core::Entity::EventObject::EventObject( uint32_t objectId, uint32_t mapLinkId,
|
||||
uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
|
||||
const std::string givenName ) :
|
||||
const std::string& givenName ) :
|
||||
Core::Entity::Actor( ObjKind::EventObj ),
|
||||
m_mapLinkId( mapLinkId ),
|
||||
m_state( initialState ),
|
||||
|
@ -88,7 +88,7 @@ void Core::Entity::EventObject::despawn( Core::Entity::PlayerPtr pTarget )
|
|||
g_log.debug( "despawn eobj: " + std::to_string( getId() ) );
|
||||
}
|
||||
|
||||
const std::string &Core::Entity::EventObject::getName() const
|
||||
const std::string& Core::Entity::EventObject::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Entity
|
|||
{
|
||||
public:
|
||||
EventObject( uint32_t objectId, uint32_t mapLinkId, uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
|
||||
const std::string givenName = "none" );
|
||||
const std::string& givenName = "none" );
|
||||
|
||||
uint32_t getMapLinkId() const;
|
||||
void setMapLinkId( uint32_t mapLinkId );
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace Core {
|
|||
SpecialShop = 0x001B,
|
||||
BahamutGuide = 0x001C,
|
||||
FcTalk = 0x001F,
|
||||
ICDirector = 0x8003,
|
||||
};
|
||||
|
||||
using SceneReturnCallback = std::function< void( Entity::Player&, uint32_t, uint16_t, uint16_t, uint16_t ) > ;
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include <common/Common.h>
|
||||
#include <common/Exd/ExdDataGenerated.h>
|
||||
|
||||
#include <boost/range/algorithm/remove_if.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
|
||||
extern Core::Data::ExdDataGenerated g_exdDataGen;
|
||||
|
||||
using namespace Core::Common;
|
||||
|
@ -51,6 +54,14 @@ std::string Core::Event::getEventName( uint32_t eventId )
|
|||
return "Aetheryte";
|
||||
return "Aethernet";
|
||||
}
|
||||
case Event::EventHandler::EventHandlerType::ICDirector:
|
||||
{
|
||||
auto contentInfo = g_exdDataGen.get< Core::Data::InstanceContent >( eventId & 0xFFFF );
|
||||
std::string name = contentInfo->name;
|
||||
|
||||
name.erase( boost::remove_if( name, boost::is_any_of( "_ '()[]" ) ), name.end() );
|
||||
return name;
|
||||
}
|
||||
|
||||
case Event::EventHandler::EventHandlerType::Warp:
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
virtual void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) { }
|
||||
virtual void onNpcKill( uint32_t npcId, Entity::Player& player ) { }
|
||||
virtual void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) { }
|
||||
virtual void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) { }
|
||||
virtual void onEnterTerritory( Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) { }
|
||||
virtual void onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) { }
|
||||
virtual void onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) { }
|
||||
virtual void onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId ) { }
|
||||
|
@ -117,7 +117,7 @@ class InstanceContentScript : public ScriptObject
|
|||
{
|
||||
public:
|
||||
explicit InstanceContentScript( uint32_t instanceContentId ) :
|
||||
ScriptObject( instanceContentId, typeid( InstanceContentScript ).hash_code() )
|
||||
ScriptObject( uint32_t{ 0x8003 } << 16 | instanceContentId, typeid( InstanceContentScript ).hash_code() )
|
||||
{ }
|
||||
|
||||
virtual void onInit( InstanceContentPtr instance ) { }
|
||||
|
|
|
@ -166,7 +166,7 @@ bool Core::Scripting::ScriptManager::onEnterTerritory( Entity::Player& player, u
|
|||
auto script = m_nativeScriptManager->getScript< EventScript >( eventId );
|
||||
if( !script )
|
||||
return false;
|
||||
script->onEnterZone( player, eventId, param1, param2 );
|
||||
script->onEnterTerritory( player, eventId, param1, param2 );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ bool Core::Scripting::ScriptManager::onZoneInit( ZonePtr pZone )
|
|||
|
||||
bool Core::Scripting::ScriptManager::onInstanceInit( InstanceContentPtr instance )
|
||||
{
|
||||
auto script = m_nativeScriptManager->getScript< InstanceContentScript >( instance->getInstanceContentId() );
|
||||
auto script = m_nativeScriptManager->getScript< InstanceContentScript >( instance->getDirectorId() );
|
||||
if( script )
|
||||
{
|
||||
script->onInit( instance );
|
||||
|
@ -349,7 +349,7 @@ bool Core::Scripting::ScriptManager::onInstanceInit( InstanceContentPtr instance
|
|||
|
||||
bool Core::Scripting::ScriptManager::onInstanceUpdate( InstanceContentPtr instance, uint32_t currTime )
|
||||
{
|
||||
auto script = m_nativeScriptManager->getScript< InstanceContentScript >( instance->getInstanceContentId() );
|
||||
auto script = m_nativeScriptManager->getScript< InstanceContentScript >( instance->getDirectorId() );
|
||||
if( script )
|
||||
{
|
||||
script->onUpdate( instance, currTime );
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
Scene00000( player );
|
||||
}
|
||||
|
||||
void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
void onEnterTerritory( Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
{
|
||||
Scene00100( player );
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Zone/InstanceContent.h>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
class TheNavel : public InstanceContentScript
|
||||
{
|
||||
public:
|
||||
|
@ -10,11 +10,11 @@ public:
|
|||
void onInit( InstanceContentPtr instance ) override
|
||||
{
|
||||
Common::FFXIVARR_POSITION3 pos = { 0, 0, -10 };
|
||||
auto exit = Entity::make_EventObject( EXIT_OBJECT, 0, 4, pos, "Entrance" );
|
||||
auto exit = Entity::make_EventObject( EXIT_OBJECT, 0, EXIT_OBJECT_STATE, pos, "Exit" );
|
||||
instance->registerEObj( exit );
|
||||
|
||||
Common::FFXIVARR_POSITION3 pos1 = { 0, 0, 24 };
|
||||
auto start = Entity::make_EventObject( START_CIRCLE, 4236868, 5, pos1, "Exit" );
|
||||
auto start = Entity::make_EventObject( START_CIRCLE, START_CIRCLE_MAPLINK, START_CIRCLE_STATE, pos1, "Entrance" );
|
||||
instance->registerEObj( start );
|
||||
}
|
||||
|
||||
|
@ -25,5 +25,9 @@ public:
|
|||
|
||||
private:
|
||||
static constexpr auto EXIT_OBJECT = 2000139;
|
||||
static constexpr auto EXIT_OBJECT_STATE = 4;
|
||||
|
||||
static constexpr auto START_CIRCLE = 2000182;
|
||||
static constexpr auto START_CIRCLE_MAPLINK = 4236868;
|
||||
static constexpr auto START_CIRCLE_STATE = 5;
|
||||
};
|
|
@ -68,7 +68,7 @@ public:
|
|||
OpeningGridania() : EventScript( 1245186 )
|
||||
{}
|
||||
|
||||
void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
void onEnterTerritory( Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
{
|
||||
if( player.getOpeningSequence() == 0 )
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ private:
|
|||
public:
|
||||
OpeningLimsa() : EventScript( 1245185 ) {}
|
||||
|
||||
void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
void onEnterTerritory( Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
{
|
||||
if( player.getOpeningSequence() == 0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -67,7 +67,7 @@ private:
|
|||
public:
|
||||
OpeningUldah() : EventScript( 1245187 ) {}
|
||||
|
||||
void onEnterZone( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
void onEnterTerritory( Entity::Player &player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
{
|
||||
if( player.getOpeningSequence() == 0 )
|
||||
Scene00000( player );
|
||||
|
|
Loading…
Add table
Reference in a new issue