mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 14:07:46 +00:00
186 lines
5.5 KiB
C++
186 lines
5.5 KiB
C++
![]() |
#include "../../../ScriptObject.h"
|
||
|
|
||
|
// Quest Script: SubFst013_00040
|
||
|
// Quest Name: For Friendship
|
||
|
// Quest ID: 65576
|
||
|
// Start NPC: 1000162
|
||
|
// End NPC: 1000162
|
||
|
|
||
|
class SubFst013 : public EventScript
|
||
|
{
|
||
|
private:
|
||
|
static constexpr auto SEQ_0 = 0;
|
||
|
static constexpr auto SEQ_1 = 1;
|
||
|
static constexpr auto SEQ_2 = 2;
|
||
|
static constexpr auto SEQ_3 = 3;
|
||
|
static constexpr auto SEQ_4 = 4;
|
||
|
static constexpr auto SEQ_5 = 5;
|
||
|
static constexpr auto SEQ_FINISH = 255;
|
||
|
|
||
|
|
||
|
// Entities found in the script data of the quest
|
||
|
static constexpr auto ACTOR0 = 1000162;
|
||
|
static constexpr auto ACTOR1 = 1000161;
|
||
|
static constexpr auto FIRST_QUEST = 65575;
|
||
|
static constexpr auto SEQ_0_ACTOR0 = 0;
|
||
|
static constexpr auto SEQ_1_ACTOR1 = 1;
|
||
|
static constexpr auto SEQ_1_ACTOR1_EMOTENO = 99;
|
||
|
static constexpr auto SEQ_1_ACTOR1_EMOTEOK = 100;
|
||
|
static constexpr auto SEQ_2_ACTOR0 = 2;
|
||
|
static constexpr auto SEQ_3_ACTOR1 = 3;
|
||
|
static constexpr auto SEQ_3_ACTOR1_EMOTENO = 97;
|
||
|
static constexpr auto SEQ_3_ACTOR1_EMOTEOK = 98;
|
||
|
static constexpr auto SEQ_4_ACTOR0 = 4;
|
||
|
static constexpr auto SEQ_5_ACTOR1 = 5;
|
||
|
static constexpr auto SEQ_5_ACTOR1_EMOTENO = 95;
|
||
|
static constexpr auto SEQ_5_ACTOR1_EMOTEOK = 96;
|
||
|
static constexpr auto SEQ_6_ACTOR0 = 6;
|
||
|
|
||
|
void Scene00000( Entity::Player& player )
|
||
|
{
|
||
|
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||
|
{
|
||
|
if( param2 == 1 )
|
||
|
{
|
||
|
player.updateQuest( getId(), SEQ_1 );
|
||
|
}
|
||
|
};
|
||
|
|
||
|
player.eventPlay( getId(), 0, NONE, callback );
|
||
|
}
|
||
|
|
||
|
void Scene00001( Entity::Player& player )
|
||
|
{
|
||
|
player.eventPlay( getId(), 2, NONE );
|
||
|
}
|
||
|
|
||
|
void Scene00002( Entity::Player& player )
|
||
|
{
|
||
|
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||
|
{
|
||
|
player.updateQuest( getId(), SEQ_3 );
|
||
|
};
|
||
|
|
||
|
player.eventPlay( getId(), 2, NONE, callback );
|
||
|
}
|
||
|
|
||
|
void Scene00003( Entity::Player& player )
|
||
|
{
|
||
|
player.eventPlay( getId(), 3, NONE );
|
||
|
}
|
||
|
|
||
|
void Scene00004( Entity::Player& player )
|
||
|
{
|
||
|
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||
|
{
|
||
|
player.updateQuest( getId(), SEQ_5 );
|
||
|
};
|
||
|
|
||
|
player.eventPlay( getId(), 4, NONE, callback );
|
||
|
}
|
||
|
|
||
|
void Scene00005( Entity::Player& player )
|
||
|
{
|
||
|
player.eventPlay( getId(), 5, NONE );
|
||
|
}
|
||
|
|
||
|
void Scene00006( Entity::Player& player )
|
||
|
{
|
||
|
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||
|
{
|
||
|
if( param2 == 1 ) // finish quest
|
||
|
{
|
||
|
if( player.giveQuestRewards( getId(), 0 ) )
|
||
|
player.finishQuest( getId() );
|
||
|
}
|
||
|
};
|
||
|
|
||
|
player.eventPlay( getId(), 6, NONE, callback );
|
||
|
}
|
||
|
|
||
|
void Scene00095( Entity::Player& player )
|
||
|
{
|
||
|
player.eventPlay( getId(), 95, NONE );
|
||
|
}
|
||
|
|
||
|
void Scene00096( Entity::Player& player )
|
||
|
{
|
||
|
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||
|
{
|
||
|
player.updateQuest( getId(), SEQ_FINISH );
|
||
|
player.sendQuestMessage( getId(), 4, 2, 0, 0 );
|
||
|
};
|
||
|
|
||
|
player.eventPlay( getId(), 96, NONE, callback );
|
||
|
}
|
||
|
|
||
|
void Scene00097( Entity::Player& player )
|
||
|
{
|
||
|
player.eventPlay( getId(), 97, NONE );
|
||
|
}
|
||
|
|
||
|
void Scene00098( Entity::Player& player )
|
||
|
{
|
||
|
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||
|
{
|
||
|
player.updateQuest( getId(), SEQ_4 );
|
||
|
player.sendQuestMessage( getId(), 2, 2, 0, 0 );
|
||
|
};
|
||
|
|
||
|
player.eventPlay( getId(), 98, NONE, callback );
|
||
|
}
|
||
|
|
||
|
void Scene00099( Entity::Player& player )
|
||
|
{
|
||
|
player.eventPlay( getId(), 99, NONE );
|
||
|
}
|
||
|
|
||
|
void Scene00100( Entity::Player& player )
|
||
|
{
|
||
|
auto callback = [&]( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2, uint16_t param3 )
|
||
|
{
|
||
|
player.updateQuest( getId(), SEQ_2 );
|
||
|
player.sendQuestMessage( getId(), 0, 2, 0, 0 );
|
||
|
};
|
||
|
|
||
|
player.eventPlay( getId(), 100, NONE, callback );
|
||
|
}
|
||
|
|
||
|
|
||
|
public:
|
||
|
SubFst013() : EventScript( "SubFst013", 65576 ) {}
|
||
|
|
||
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||
|
{
|
||
|
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||
|
|
||
|
if( !player.hasQuest( getId() ) )
|
||
|
{
|
||
|
Scene00000( player );
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if( actor == ACTOR1 ) // talking to Aunillie while on quest
|
||
|
Scene00003( player );
|
||
|
else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_2 )
|
||
|
Scene00002( player );
|
||
|
else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_4 )
|
||
|
Scene00004( player );
|
||
|
else if( actor == ACTOR0 && player.getQuestSeq( getId() ) == SEQ_FINISH )
|
||
|
Scene00006( player );
|
||
|
}
|
||
|
|
||
|
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
||
|
{
|
||
|
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||
|
|
||
|
if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 )
|
||
|
Scene00100( player );
|
||
|
else if( actor == ACTOR1 && emoteId == 18 && player.getQuestSeq( getId() ) == SEQ_3 )
|
||
|
Scene00098( player );
|
||
|
else if( actor == ACTOR1 && emoteId == 11 && player.getQuestSeq( getId() ) == SEQ_5 )
|
||
|
Scene00096( player );
|
||
|
}
|
||
|
};
|
||
|
|
||
|
EXPORT_SCRIPTOBJECT( SubFst013 )
|