2019-02-20 17:38:03 +11:00
|
|
|
#include <Actor/Player.h>
|
|
|
|
#include <Manager/EventMgr.h>
|
|
|
|
#include <ScriptObject.h>
|
2020-03-01 01:00:57 +11:00
|
|
|
#include <Service.h>
|
2019-02-20 17:38:03 +11:00
|
|
|
|
|
|
|
// Quest Script: ManWil004_00570
|
|
|
|
// Quest Name: Close to Home
|
|
|
|
// Quest ID: 66106
|
|
|
|
// Start NPC: 1003988
|
|
|
|
// End NPC: 1001353
|
|
|
|
|
|
|
|
using namespace Sapphire;
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
class ManWil004 : public Sapphire::ScriptAPI::QuestScript
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
// Basic quest information
|
|
|
|
// Quest vars / flags used
|
|
|
|
// GetQuestBitFlag8
|
|
|
|
// GetQuestUI8AL
|
|
|
|
// GetQuestUI8BH
|
|
|
|
// GetQuestUI8BL
|
|
|
|
// GetQuestUI8CH
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
enum Sequence : uint8_t
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
|
|
|
Seq0 = 0,
|
|
|
|
Seq1 = 1,
|
|
|
|
SeqFinish = 255,
|
|
|
|
};
|
|
|
|
|
|
|
|
// Quest rewards
|
|
|
|
static constexpr auto RewardExpFactor = 100;
|
|
|
|
static constexpr auto RewardGil = 107;
|
|
|
|
|
|
|
|
// Entities found in the script data of the quest
|
|
|
|
static constexpr auto Actor0 = 1003988;
|
|
|
|
static constexpr auto Actor1 = 1002279;
|
|
|
|
static constexpr auto Actor2 = 1003908;
|
|
|
|
static constexpr auto Actor20 = 1001637;
|
|
|
|
static constexpr auto Actor3 = 1001353;
|
|
|
|
static constexpr auto Aetheryte0 = 9;
|
|
|
|
static constexpr auto BindActor0 = 6229228;
|
|
|
|
static constexpr auto Item0 = 2000388;
|
|
|
|
static constexpr auto LocAction1 = 605;
|
|
|
|
static constexpr auto LocAction2 = 1005;
|
|
|
|
static constexpr auto LocMarker01 = 4009142;
|
|
|
|
static constexpr auto LocMarker02 = 4009152;
|
|
|
|
static constexpr auto LocPosCam1 = 4105872;
|
|
|
|
static constexpr auto LocPosCam2 = 4105874;
|
|
|
|
static constexpr auto LocPosCam3 = 4009150;
|
|
|
|
static constexpr auto LocPosCam4 = 4143488;
|
|
|
|
static constexpr auto Poprange0 = 4110794;
|
|
|
|
static constexpr auto Reward0 = 1;
|
|
|
|
static constexpr auto Screenimage0 = 14;
|
|
|
|
static constexpr auto Seq0Actor0Lq = 50;
|
|
|
|
static constexpr auto Territorytype0 = 130;
|
|
|
|
|
|
|
|
public:
|
2021-11-27 00:53:57 +01:00
|
|
|
ManWil004() : Sapphire::ScriptAPI::QuestScript( 66106 )
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
~ManWil004()
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
void onTalk( World::Quest& quest, Entity::Player& player, uint64_t actorId ) override
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
if( actorId == Actor0 )
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
|
|
|
Scene00000( player );
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
else if( actorId == Actor1 )
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
|
|
|
Scene00003( player );
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
else if( actorId == Actor2 )
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
|
|
|
Scene00004( player );
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
else if( actorId == Actor3 )
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
|
|
|
Scene00008( player );
|
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
else if( actorId == Aetheryte0 )
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().eventActionStart( player, 0x050002, 0x13,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, uint32_t eventId, uint64_t additional )
|
|
|
|
{
|
2021-12-21 13:48:24 +01:00
|
|
|
eventMgr().sendEventNotice( player, 0x050002, 0, 1, 0, 0 );
|
2019-02-20 17:38:03 +11:00
|
|
|
player.registerAetheryte( 2 );
|
2022-01-15 22:48:27 +01:00
|
|
|
player.setSystemActionUnlocked( Common::UnlockEntry::Return );
|
2019-02-20 17:38:03 +11:00
|
|
|
Scene00001( player );
|
|
|
|
},
|
2021-11-27 00:53:57 +01:00
|
|
|
nullptr, getId() );
|
2019-02-20 17:38:03 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void checkQuestCompletion( Entity::Player& player, uint32_t varIdx )
|
|
|
|
{
|
|
|
|
if( varIdx == 1 )
|
|
|
|
{
|
2021-12-21 13:48:24 +01:00
|
|
|
eventMgr().sendEventNotice( player, getId(), 1, 0, 0, 0 );
|
2019-02-20 17:38:03 +11:00
|
|
|
}
|
|
|
|
else if( varIdx == 2 )
|
|
|
|
{
|
2021-12-21 13:48:24 +01:00
|
|
|
eventMgr().sendEventNotice( player, getId(), 2, 0, 0, 0 );
|
2019-02-20 17:38:03 +11:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 13:48:24 +01:00
|
|
|
eventMgr().sendEventNotice( player, getId(), 0, 0, 0, 0 );
|
2019-02-20 17:38:03 +11:00
|
|
|
}
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
auto pQuest = player.getQuest( getId() );
|
|
|
|
if( !pQuest )
|
|
|
|
return;
|
2019-02-20 17:38:03 +11:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
auto QUEST_VAR_ATTUNE = pQuest->getUI8AL();
|
|
|
|
auto QUEST_VAR_CLASS = pQuest->getUI8BH();
|
|
|
|
auto QUEST_VAR_TRADE = pQuest->getUI8BL();
|
2019-02-20 17:38:03 +11:00
|
|
|
|
|
|
|
if( QUEST_VAR_ATTUNE == 1 && QUEST_VAR_CLASS == 1 && QUEST_VAR_TRADE == 1 )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
pQuest->setSeq( SeqFinish );
|
2019-02-20 17:38:03 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00000( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 0, HIDE_HOTBAR,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
if( result.getResult( 0 ) == 1 ) // accept quest
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
|
|
|
Scene00050( player );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00001( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 1, HIDE_HOTBAR,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
|
|
|
Scene00002( player );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00002( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 2, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto pQuest = player.getQuest( getId() );
|
|
|
|
if( !pQuest )
|
|
|
|
return;
|
|
|
|
|
|
|
|
pQuest->setUI8BL( 1 );
|
2019-02-20 17:38:03 +11:00
|
|
|
checkQuestCompletion( player, 0 );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00003( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 3, HIDE_HOTBAR,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto pQuest = player.getQuest( getId() );
|
|
|
|
if( !pQuest )
|
|
|
|
return;
|
|
|
|
|
|
|
|
pQuest->setUI8AL( 1 );
|
2019-02-20 17:38:03 +11:00
|
|
|
checkQuestCompletion( player, 1 );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00004( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 4, HIDE_HOTBAR,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
if( result.getResult( 0 ) == 1 )
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
|
|
|
Scene00005( player );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00005( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 5, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto pQuest = player.getQuest( getId() );
|
|
|
|
if( !pQuest )
|
|
|
|
return;
|
|
|
|
|
|
|
|
pQuest->setUI8CH( 0 );
|
|
|
|
pQuest->setUI8BH( 1 );
|
2019-02-20 17:38:03 +11:00
|
|
|
checkQuestCompletion( player, 2 );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00006( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 6, HIDE_HOTBAR,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00007( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 7, HIDE_HOTBAR,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00008( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 8, SET_EOBJ_BASE | HIDE_HOTBAR | INVIS_EOBJ,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
if( result.getResult( 0 ) == 1 )
|
2019-02-20 17:38:03 +11:00
|
|
|
{
|
2021-12-21 01:05:08 +01:00
|
|
|
player.finishQuest( getId(), result.getResult( 1 ) );
|
2019-02-20 17:38:03 +11:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00050( Entity::Player& player )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, getId(), 50, FADE_OUT | CONDITION_CUTSCENE | HIDE_UI,
|
2019-02-20 17:38:03 +11:00
|
|
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
auto pQuest = player.getQuest( getId() );
|
|
|
|
if( !pQuest )
|
|
|
|
return;
|
2019-02-20 17:38:03 +11:00
|
|
|
// on quest accept
|
2021-11-27 00:53:57 +01:00
|
|
|
pQuest->setSeq( Seq1 );
|
|
|
|
pQuest->setUI8CH( 1 ); // receive key item
|
2019-02-20 17:38:03 +11:00
|
|
|
|
|
|
|
// teleport to real ul'dah
|
|
|
|
player.forceZoneing( 130 );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
EXPOSE_SCRIPT( ManWil004 );
|