mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
item handin collection & fix quest abandon
This commit is contained in:
parent
4946d18583
commit
e0d6c1024e
5 changed files with 55 additions and 11 deletions
|
@ -269,6 +269,10 @@ enum ClientTriggerType
|
||||||
AchievementComp = 0x203,
|
AchievementComp = 0x203,
|
||||||
AchievementCatChat = 0x206,
|
AchievementCatChat = 0x206,
|
||||||
|
|
||||||
|
QuestJournalUpdateQuestVisibility = 0x2BE,
|
||||||
|
QuestJournalClosed = 0x2BF,
|
||||||
|
|
||||||
|
AbandonQuest = 0x320,
|
||||||
|
|
||||||
DirectorInitFinish = 0x321,
|
DirectorInitFinish = 0x321,
|
||||||
|
|
||||||
|
|
|
@ -36,29 +36,24 @@ private:
|
||||||
static constexpr auto Seq1Actor0Npctradeok = 100;
|
static constexpr auto Seq1Actor0Npctradeok = 100;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SubFst029() :
|
SubFst029() : EventScript( 65708 )
|
||||||
EventScript( 65708 )
|
{};
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
~SubFst029()
|
~SubFst029()
|
||||||
{
|
{};
|
||||||
};
|
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||||
{
|
{
|
||||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||||
|
|
||||||
//NOT SAFE - CRASH
|
if( actor == SubFst029::Actor0 && !player.hasQuest( getId() ) )
|
||||||
|
|
||||||
/*if( actor == SubFst029::Actor0 && !player.hasQuest( getId() ) )
|
|
||||||
{
|
{
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
}
|
}
|
||||||
if( actor == SubFst029::Actor0 && player.getQuestSeq ( getId() ) == 255 )
|
if( actor == SubFst029::Actor0 && player.getQuestSeq ( getId() ) == 255 )
|
||||||
{
|
{
|
||||||
Scene00001( player );
|
Scene00001( player );
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -80,7 +75,7 @@ private:
|
||||||
player.playScene( getId(), 1, HIDE_HOTBAR,
|
player.playScene( getId(), 1, HIDE_HOTBAR,
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
if( result.param2 == 1 )
|
if( result.param2 == 1 && player.collectHandInItems( { Ritem0 } ) )
|
||||||
{
|
{
|
||||||
Scene00100( player );
|
Scene00100( player );
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,6 +360,13 @@ public:
|
||||||
/*! return the current amount of crystals of type */
|
/*! return the current amount of crystals of type */
|
||||||
uint32_t getCrystal( uint8_t type ) const;
|
uint32_t getCrystal( uint8_t type ) const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Collect real item handins from container
|
||||||
|
* @param itemIds a vector of each catalog id to collect
|
||||||
|
* @return true if all items were handed in
|
||||||
|
*/
|
||||||
|
bool collectHandInItems( std::vector< uint32_t > itemIds );
|
||||||
|
|
||||||
// Class / Job / Exp
|
// Class / Job / Exp
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/*! returns the level of the currently active class / job */
|
/*! returns the level of the currently active class / job */
|
||||||
|
|
|
@ -781,3 +781,37 @@ uint8_t Core::Entity::Player::getFreeSlotsInBags()
|
||||||
}
|
}
|
||||||
return slots;
|
return slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Core::Entity::Player::collectHandInItems( std::vector< uint32_t > itemIds )
|
||||||
|
{
|
||||||
|
// todo: figure out how the game gets the required stack count
|
||||||
|
auto& container = m_storageMap[HandIn];
|
||||||
|
|
||||||
|
std::vector< uint8_t > foundItems;
|
||||||
|
|
||||||
|
auto itemMap = container->getItemMap();
|
||||||
|
|
||||||
|
for( auto& item : itemMap )
|
||||||
|
{
|
||||||
|
for( auto needle : itemIds )
|
||||||
|
{
|
||||||
|
if( item.second->getId() == needle )
|
||||||
|
{
|
||||||
|
foundItems.push_back( item.first );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// couldn't find all the items required
|
||||||
|
if( foundItems.size() != itemIds.size() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// remove items
|
||||||
|
for( auto item : foundItems )
|
||||||
|
{
|
||||||
|
container->removeItem( item );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -256,6 +256,10 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
||||||
player.exitInstance();
|
player.exitInstance();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ClientTriggerType::AbandonQuest:
|
||||||
|
{
|
||||||
|
player.removeQuest( static_cast< uint16_t >( param1 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue