mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 08:57:44 +00:00
150 lines
5 KiB
C++
150 lines
5 KiB
C++
// FFXIVTheMovie.ParserV3.9
|
|
// fake IsAnnounce table
|
|
#include <Actor/Player.h>
|
|
#include <ScriptObject.h>
|
|
#include <Service.h>
|
|
#include "Manager/TerritoryMgr.h"
|
|
#include "Manager/EventMgr.h"
|
|
#include "Territory/Territory.h"
|
|
#include <Manager/WarpMgr.h>
|
|
|
|
using namespace Sapphire;
|
|
|
|
class SubSea052 : public Sapphire::ScriptAPI::QuestScript
|
|
{
|
|
public:
|
|
SubSea052() : Sapphire::ScriptAPI::QuestScript( 66000 ){};
|
|
~SubSea052() = default;
|
|
|
|
//SEQ_0, 1 entries
|
|
//SEQ_1, 1 entries
|
|
//SEQ_255, 1 entries
|
|
|
|
//ACTOR0 = 1002627
|
|
//ENEMY0 = 118
|
|
//SEQ0ACTOR0 = 0
|
|
//SEQ2ACTOR0 = 1
|
|
|
|
static constexpr auto EVENT_ON_TALK = 0;
|
|
static constexpr auto EVENT_ON_EMOTE = 1;
|
|
static constexpr auto EVENT_ON_BNPC_KILL = 2;
|
|
static constexpr auto EVENT_ON_WITHIN_RANGE = 3;
|
|
static constexpr auto EVENT_ON_ENTER_TERRITORY = 4;
|
|
static constexpr auto EVENT_ON_EVENT_ITEM = 5;
|
|
static constexpr auto EVENT_ON_EOBJ_HIT = 6;
|
|
static constexpr auto EVENT_ON_SAY = 7;
|
|
|
|
private:
|
|
void onProgress( World::Quest& quest, Entity::Player& player, uint32_t type, uint64_t param1, uint32_t param2, uint32_t param3 )
|
|
{
|
|
switch( quest.getSeq() )
|
|
{
|
|
case 0:
|
|
{
|
|
if( type != EVENT_ON_BNPC_KILL ) Scene00000( quest, player ); // Scene00000: Normal(Talk, QuestOffer, QuestAccept, TargetCanMove), id=GURCANT
|
|
break;
|
|
}
|
|
case 1:
|
|
{
|
|
if( quest.getUI8AL() < 5 )
|
|
{
|
|
quest.setUI8AL( quest.getUI8AL() + 1 );
|
|
eventMgr().sendEventNotice( player, getId(), 0, 2, quest.getUI8AL(), 5 );
|
|
checkProgressSeq1( quest, player );
|
|
}
|
|
break;
|
|
}
|
|
case 255:
|
|
{
|
|
if( type != EVENT_ON_BNPC_KILL ) Scene00001( quest, player ); // Scene00001: Normal(Talk, QuestReward, QuestComplete, TargetCanMove), id=GURCANT
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
playerMgr().sendUrgent( player, "Sequence {} not defined.", quest.getSeq() );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public:
|
|
void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override
|
|
{
|
|
onProgress( quest, player, EVENT_ON_TALK, actorId, 0, 0 );
|
|
}
|
|
|
|
void onEmote( World::Quest& quest, uint64_t actorId, uint32_t emoteId, Sapphire::Entity::Player& player ) override
|
|
{
|
|
playerMgr().sendDebug( player, "emote: {}", emoteId );
|
|
onProgress( quest, player, EVENT_ON_EMOTE, actorId, 0, emoteId );
|
|
}
|
|
|
|
void onBNpcKill( World::Quest& quest, uint16_t nameId, uint32_t entityId, Sapphire::Entity::Player& player ) override
|
|
{
|
|
onProgress( quest, player, EVENT_ON_BNPC_KILL, static_cast< uint64_t >( nameId ), entityId, 0 );
|
|
}
|
|
|
|
void onWithinRange( World::Quest& quest, Sapphire::Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ) override
|
|
{
|
|
onProgress( quest, player, EVENT_ON_WITHIN_RANGE, static_cast< uint64_t >( param1 ), 0, 0 );
|
|
}
|
|
|
|
void onEnterTerritory( World::Quest& quest, Sapphire::Entity::Player& player, uint16_t param1, uint16_t param2 ) override
|
|
{
|
|
onProgress( quest, player, EVENT_ON_ENTER_TERRITORY, static_cast< uint64_t >( param1 ), static_cast< uint32_t >( param2 ), 0 );
|
|
}
|
|
void onEventItem( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId ) override
|
|
{
|
|
onProgress( quest, player, EVENT_ON_EVENT_ITEM, actorId, 0, 0 );
|
|
}
|
|
void onEObjHit( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId, uint32_t actionId ) override
|
|
{
|
|
onProgress( quest, player, EVENT_ON_EOBJ_HIT, actorId, actionId, 0 );
|
|
}
|
|
void onSay( World::Quest& quest, Sapphire::Entity::Player& player, uint64_t actorId, uint32_t sayId ) override
|
|
{
|
|
onProgress( quest, player, EVENT_ON_SAY, actorId, sayId, 0 );
|
|
}
|
|
|
|
private:
|
|
void checkProgressSeq0( World::Quest& quest, Entity::Player& player )
|
|
{
|
|
quest.setSeq( 1 );
|
|
}
|
|
void checkProgressSeq1( World::Quest& quest, Entity::Player& player )
|
|
{
|
|
if( quest.getUI8AL() == 5 )
|
|
{
|
|
quest.setSeq( 255 );
|
|
}
|
|
}
|
|
|
|
void Scene00000( World::Quest& quest, Entity::Player& player ) //SEQ_0: , <No Var>, <No Flag>
|
|
{
|
|
playerMgr().sendDebug( player, "SubSea052:66000 calling Scene00000: Normal(Talk, QuestOffer, QuestAccept, TargetCanMove), id=GURCANT" );
|
|
auto callback = [ & ]( World::Quest& quest, Entity::Player& player , const Event::SceneResult& result )
|
|
{
|
|
if( result.numOfResults > 0 && result.getResult( 0 ) == 1 )
|
|
{
|
|
checkProgressSeq0( quest, player );
|
|
}
|
|
};
|
|
eventMgr().playQuestScene( player, getId(), 0, HIDE_HOTBAR, callback );
|
|
}
|
|
|
|
|
|
void Scene00001( World::Quest& quest, Entity::Player& player ) //SEQ_255: , <No Var>, <No Flag>
|
|
{
|
|
playerMgr().sendDebug( player, "SubSea052:66000 calling Scene00001: Normal(Talk, QuestReward, QuestComplete, TargetCanMove), id=GURCANT" );
|
|
auto callback = [ & ]( World::Quest& quest, Entity::Player& player , const Event::SceneResult& result )
|
|
{
|
|
if( result.numOfResults > 0 && result.getResult( 0 ) == 1 )
|
|
{
|
|
player.finishQuest( getId(), result.getResult( 1 ) );
|
|
}
|
|
};
|
|
eventMgr().playQuestScene( player, getId(), 1, HIDE_HOTBAR, callback );
|
|
}
|
|
};
|
|
|
|
EXPOSE_SCRIPT( SubSea052 );
|