mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-06-07 16:47:44 +00:00
Scripts/Quests
changes to avoid Travis warnings
This commit is contained in:
parent
332ac9e976
commit
7cf848afa1
1 changed files with 92 additions and 108 deletions
|
@ -12,146 +12,130 @@ using namespace Sapphire;
|
||||||
// Start NPC: 1003601
|
// Start NPC: 1003601
|
||||||
// End NPC: 1000972
|
// End NPC: 1000972
|
||||||
|
|
||||||
class SubSea012 : public EventScript
|
class SubSea012 :
|
||||||
|
public Sapphire::ScriptAPI::EventScript
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Basic quest information
|
|
||||||
// Quest vars / flags used
|
|
||||||
// GetQuestUI8AL
|
|
||||||
// GetQuestUI8BH
|
|
||||||
|
|
||||||
// Steps in this quest ( 0 is before accepting,
|
// Basic quest information
|
||||||
// 1 is first, 255 means ready for turning it in
|
// Quest vars / flags used
|
||||||
enum Sequence : uint8_t
|
// GetQuestUI8AL
|
||||||
{
|
// GetQuestUI8BH
|
||||||
Seq0 = 0,
|
|
||||||
Seq1 = 1,
|
|
||||||
Seq2 = 2,
|
|
||||||
SeqFinish = 255,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Quest rewards
|
enum Sequence :
|
||||||
static constexpr auto RewardExpFactor = 100;
|
uint8_t
|
||||||
static constexpr auto RewardItem[] = { 0, 0, 0, 0, 0, 0 };
|
{
|
||||||
static constexpr auto RewardItemCount[] = { 0, 0, 0, 0, 0, 0 };
|
Seq0 = 0,
|
||||||
static constexpr auto RewardItemOptional[] = { 2999, 3010, 5823, 0, 0 };
|
Seq1 = 1,
|
||||||
static constexpr auto RewardItemOptionalCount[] = { 1, 1, 3, 0, 0 };
|
Seq2 = 2,
|
||||||
|
SeqFinish = 255,
|
||||||
|
};
|
||||||
|
|
||||||
// Entities found in the script data of the quest
|
// Quest rewards
|
||||||
static constexpr auto Actor0 = 1003601;
|
static constexpr auto RewardExpFactor = 100;
|
||||||
static constexpr auto Actor1 = 1001024;
|
// Entities found in the script data of the quest
|
||||||
static constexpr auto Actor2 = 1000972;
|
static constexpr auto Actor0 = 1003601;
|
||||||
static constexpr auto Enemy0 = 324;
|
static constexpr auto Actor1 = 1001024;
|
||||||
static constexpr auto Item0 = 2000454;
|
static constexpr auto Actor2 = 1000972;
|
||||||
|
static constexpr auto Enemy0 = 563;
|
||||||
|
static constexpr auto Item0 = 2000454;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SubSea012() : EventScript( 65658 ){};
|
SubSea012() :
|
||||||
~SubSea012(){};
|
Sapphire::ScriptAPI::EventScript(65658)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
~SubSea012()
|
||||||
// Event Handlers
|
{
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
};
|
||||||
{
|
|
||||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
void onTalk(uint32_t eventId, Entity::Player& player, uint64_t actorId) override
|
||||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
{
|
||||||
if( actor == Actor0 )
|
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||||
|
auto actor = pEventMgr->mapEventActorToRealActor(static_cast<uint32_t>(actorId));
|
||||||
|
|
||||||
|
if (actor == Actor0)
|
||||||
{
|
{
|
||||||
Scene00000( player );
|
Scene00000(player);
|
||||||
}
|
}
|
||||||
else if( actor == Actor1 )
|
else if (actor == Actor1)
|
||||||
{
|
{
|
||||||
Scene00003( player );
|
Scene00002(player);
|
||||||
}
|
}
|
||||||
else if( actor == Actor2 )
|
else if (actor == Actor2)
|
||||||
{
|
{
|
||||||
Scene00004( player );
|
Scene00003(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMobKill( Entity::Player& player, uint64_t npcId )
|
void onBNpcKill(uint32_t npcId, Entity::Player& player) override
|
||||||
{
|
{
|
||||||
if( npcId != Enemy0 )
|
if (npcId != Enemy0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto currentKC = player.getQuestUI8AL( getId() ) + 1;
|
auto currentKC = player.getQuestUI8AL(getId()) + 1;
|
||||||
|
player.setQuestUI8BH(getId(), currentKC);
|
||||||
if( currentKC >= 4 )
|
player.setQuestUI8AL(getId(), currentKC);
|
||||||
player.updateQuest( getId(), SeqFinish );
|
if (currentKC >= 4)
|
||||||
|
player.updateQuest(getId(), SeqFinish);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.setQuestUI8AL( getId(), currentKC );
|
player.sendQuestMessage(getId(), 1, 2, currentKC, 4);
|
||||||
player.sendQuestMessage( getId(), 0, 2, currentKC, 4 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//////////////////////////////////////////////////////////////////////
|
|
||||||
// Available Scenes in this quest, not necessarly all are used
|
void Scene00000(Entity::Player& player)
|
||||||
void checkQuestCompletion( Entity::Player& player )
|
|
||||||
{
|
{
|
||||||
auto currentCC = player.getQuestUI8BH( getId() );
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
||||||
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
||||||
player.sendQuestMessage( getId(), X, Y, currentCC + 1, Z );
|
|
||||||
|
|
||||||
if( currentCC + 1 >= Z )
|
|
||||||
{
|
{
|
||||||
player.updateQuest( getId(), SeqFinish );
|
if (result.param2 == 1)
|
||||||
player.setQuestUI8BH( getId(), currentCC + 1 );
|
player.updateQuest(getId(), 1);
|
||||||
player.setQuestUI8AL( getId(), currentCC + 1 );
|
});
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
void Scene00001(Entity::Player& player)
|
||||||
|
{
|
||||||
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
||||||
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
||||||
{
|
{
|
||||||
player.setQuestUI8BH( getId(), currentCC + 1 );
|
});
|
||||||
player.setQuestUI8AL( getId(), currentCC + 1 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene00000( Entity::Player& player )
|
void Scene00002(Entity::Player& player)
|
||||||
{
|
{
|
||||||
player.playScene( getId(), 0, HIDE_HOTBAR,
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
||||||
{
|
{
|
||||||
if( result.param2 == 1 )
|
player.updateQuest(getId(), 2);
|
||||||
player.updateQuest( getId(), 1 );
|
});
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene00001( Entity::Player& player )
|
void Scene00003(Entity::Player& player)
|
||||||
{
|
{
|
||||||
player.playScene( getId(), 1, HIDE_HOTBAR,
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
||||||
{
|
{
|
||||||
} );
|
if (result.param2 == 1)
|
||||||
|
Scene00004(player);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene00002( Entity::Player& player )
|
void Scene00004(Entity::Player& player)
|
||||||
{
|
{
|
||||||
player.playScene( getId(), 2, HIDE_HOTBAR,
|
player.playScene(getId(), 0, HIDE_HOTBAR,
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[&](Entity::Player& player, const Event::SceneResult& result)
|
||||||
{
|
{
|
||||||
} );
|
if (result.param2 == 1)
|
||||||
|
if (player.giveQuestRewards(getId(), 0))
|
||||||
|
{
|
||||||
|
player.finishQuest(getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene00003( Entity::Player& player )
|
};
|
||||||
{
|
|
||||||
player.playScene( getId(), 3, HIDE_HOTBAR,
|
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
||||||
{
|
|
||||||
if( result.param2 == 1 )
|
|
||||||
player.updateQuest( getId(), 2 );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene00004( Entity::Player& player )
|
|
||||||
{
|
|
||||||
player.playScene( getId(), 4, HIDE_HOTBAR,
|
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
|
||||||
{
|
|
||||||
if( result.param2 == 1 )
|
|
||||||
if( player.giveQuestRewards( getId(), 0 ) )
|
|
||||||
player.finishQuest( getId() );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
Loading…
Add table
Reference in a new issue