mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-28 20:27:46 +00:00
Better fix for abandon quest.
This commit is contained in:
parent
7545ad0934
commit
df9fb7ebf4
4 changed files with 12 additions and 19 deletions
|
@ -183,7 +183,7 @@ namespace Sapphire::Entity
|
||||||
void unfinishQuest( uint16_t questId );
|
void unfinishQuest( uint16_t questId );
|
||||||
|
|
||||||
/*! remove a given quest */
|
/*! remove a given quest */
|
||||||
void removeQuest( uint16_t questId, bool abandoned );
|
void removeQuest( uint16_t questId );
|
||||||
|
|
||||||
/*! add a quest to the completed quests mask */
|
/*! add a quest to the completed quests mask */
|
||||||
void updateQuestsCompleted( uint32_t questId );
|
void updateQuestsCompleted( uint32_t questId );
|
||||||
|
|
|
@ -15,14 +15,19 @@ using namespace Sapphire::Network::Packets::Server;
|
||||||
|
|
||||||
void Sapphire::Entity::Player::finishQuest( uint16_t questId )
|
void Sapphire::Entity::Player::finishQuest( uint16_t questId )
|
||||||
{
|
{
|
||||||
|
|
||||||
int8_t idx = getQuestIndex( questId );
|
int8_t idx = getQuestIndex( questId );
|
||||||
|
|
||||||
removeQuest( questId, false );
|
removeQuest( questId );
|
||||||
|
|
||||||
|
auto questFinishPacket = makeZonePacket< FFXIVIpcQuestFinish >( getId() );
|
||||||
|
questFinishPacket->data().questId = questId;
|
||||||
|
questFinishPacket->data().flag1 = 1;
|
||||||
|
questFinishPacket->data().flag2 = 1;
|
||||||
|
queuePacket( questFinishPacket );
|
||||||
|
|
||||||
updateQuestsCompleted( questId );
|
updateQuestsCompleted( questId );
|
||||||
|
|
||||||
sendQuestTracker();
|
sendQuestTracker();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::unfinishQuest( uint16_t questId )
|
void Sapphire::Entity::Player::unfinishQuest( uint16_t questId )
|
||||||
|
@ -31,29 +36,18 @@ void Sapphire::Entity::Player::unfinishQuest( uint16_t questId )
|
||||||
sendQuestInfo();
|
sendQuestInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::removeQuest( uint16_t questId, bool abandoned )
|
void Sapphire::Entity::Player::removeQuest( uint16_t questId )
|
||||||
{
|
{
|
||||||
|
|
||||||
int8_t idx = getQuestIndex( questId );
|
int8_t idx = getQuestIndex( questId );
|
||||||
|
|
||||||
if( ( idx != -1 ) && ( m_activeQuests[ idx ] != nullptr ) )
|
if( ( idx != -1 ) && ( m_activeQuests[ idx ] != nullptr ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto questUpdatePacket = makeZonePacket< FFXIVIpcQuestUpdate >( getId() );
|
auto questUpdatePacket = makeZonePacket< FFXIVIpcQuestUpdate >( getId() );
|
||||||
questUpdatePacket->data().slot = static_cast< uint8_t >( idx );
|
questUpdatePacket->data().slot = static_cast< uint8_t >( idx );
|
||||||
questUpdatePacket->data().questInfo.c.questId = 0;
|
questUpdatePacket->data().questInfo.c.questId = 0;
|
||||||
questUpdatePacket->data().questInfo.c.sequence = 0xFF;
|
questUpdatePacket->data().questInfo.c.sequence = 0xFF;
|
||||||
queuePacket( questUpdatePacket );
|
queuePacket( questUpdatePacket );
|
||||||
|
|
||||||
if( !abandoned )
|
|
||||||
{
|
|
||||||
auto questFinishPacket = makeZonePacket< FFXIVIpcQuestFinish >( getId() );
|
|
||||||
questFinishPacket->data().questId = questId;
|
|
||||||
questFinishPacket->data().flag1 = 1;
|
|
||||||
questFinishPacket->data().flag2 = 1;
|
|
||||||
queuePacket( questFinishPacket );
|
|
||||||
}
|
|
||||||
|
|
||||||
for( int32_t ii = 0; ii < 5; ii++ )
|
for( int32_t ii = 0; ii < 5; ii++ )
|
||||||
{
|
{
|
||||||
if( m_questTracking[ ii ] == idx )
|
if( m_questTracking[ ii ] == idx )
|
||||||
|
@ -70,7 +64,6 @@ void Sapphire::Entity::Player::removeQuest( uint16_t questId, bool abandoned )
|
||||||
}
|
}
|
||||||
|
|
||||||
sendQuestTracker();
|
sendQuestTracker();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::hasQuest( uint32_t questId )
|
bool Sapphire::Entity::Player::hasQuest( uint32_t questId )
|
||||||
|
|
|
@ -308,7 +308,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
|
||||||
}
|
}
|
||||||
case ClientTriggerType::AbandonQuest:
|
case ClientTriggerType::AbandonQuest:
|
||||||
{
|
{
|
||||||
player.removeQuest( static_cast< uint16_t >( param1 ), true );
|
player.removeQuest( static_cast< uint16_t >( param1 ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ClientTriggerType::RequestHousingBuildPreset:
|
case ClientTriggerType::RequestHousingBuildPreset:
|
||||||
|
|
|
@ -379,7 +379,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
|
||||||
}
|
}
|
||||||
case GmCommand::QuestCancel:
|
case GmCommand::QuestCancel:
|
||||||
{
|
{
|
||||||
targetPlayer->removeQuest( static_cast< uint16_t >( param1 ), true );
|
targetPlayer->removeQuest( static_cast< uint16_t >( param1 ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GmCommand::QuestComplete:
|
case GmCommand::QuestComplete:
|
||||||
|
|
Loading…
Add table
Reference in a new issue