mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 08:57:44 +00:00
changed player.setQuestBitFlag functions to allow unsetting the bit
This commit is contained in:
parent
3dcb7c3629
commit
ca5db2cae3
1 changed files with 27 additions and 21 deletions
|
@ -767,9 +767,10 @@ void Core::Entity::Player::setQuestBitFlag8( uint16_t questId, uint8_t index, bo
|
||||||
{
|
{
|
||||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||||
|
|
||||||
uint8_t flag = val ? 1 : 0;
|
if( val )
|
||||||
|
pNewQuest->a.BitFlag8 |= ( 1 << index );
|
||||||
pNewQuest->a.BitFlag8 |= ( val << index );
|
else
|
||||||
|
pNewQuest->a.BitFlag8 &= ~( 1 << index );
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
}
|
}
|
||||||
|
@ -783,9 +784,10 @@ void Core::Entity::Player::setQuestBitFlag16( uint16_t questId, uint8_t index, b
|
||||||
{
|
{
|
||||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||||
|
|
||||||
uint8_t flag = val ? 1 : 0;
|
if( val )
|
||||||
|
pNewQuest->a.BitFlag16 |= ( 1 << index );
|
||||||
pNewQuest->a.BitFlag16 |= ( val << index );
|
else
|
||||||
|
pNewQuest->a.BitFlag16 &= ~( 1 << index );
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
}
|
}
|
||||||
|
@ -799,13 +801,15 @@ void Core::Entity::Player::setQuestBitFlag24( uint16_t questId, uint8_t index, b
|
||||||
{
|
{
|
||||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||||
|
|
||||||
uint8_t flag = val ? 1 : 0;
|
if( val )
|
||||||
|
pNewQuest->a.BitFlag24 |= ( 1 << index );
|
||||||
pNewQuest->a.BitFlag24 |= ( val << index );
|
else
|
||||||
|
pNewQuest->a.BitFlag24 &= ~( 1 << index );
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t index, bool val )
|
void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t index, bool val )
|
||||||
{
|
{
|
||||||
int8_t idx = getQuestIndex( questId );
|
int8_t idx = getQuestIndex( questId );
|
||||||
|
@ -814,9 +818,10 @@ void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t index, b
|
||||||
{
|
{
|
||||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||||
|
|
||||||
uint8_t flag = val ? 1 : 0;
|
if( val )
|
||||||
|
pNewQuest->a.BitFlag32 |= ( 1 << index );
|
||||||
pNewQuest->a.BitFlag32 |= ( val << index );
|
else
|
||||||
|
pNewQuest->a.BitFlag32 &= ~( 1 << index );
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
}
|
}
|
||||||
|
@ -830,9 +835,10 @@ void Core::Entity::Player::setQuestBitFlag40( uint16_t questId, uint8_t index, b
|
||||||
{
|
{
|
||||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||||
|
|
||||||
uint8_t flag = val ? 1 : 0;
|
if( val )
|
||||||
|
pNewQuest->a.BitFlag40 |= ( 1 << index );
|
||||||
pNewQuest->a.BitFlag40 |= ( val << index );
|
else
|
||||||
|
pNewQuest->a.BitFlag40 &= ~( 1 << index );
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
}
|
}
|
||||||
|
@ -846,16 +852,16 @@ void Core::Entity::Player::setQuestBitFlag48( uint16_t questId, uint8_t index, b
|
||||||
{
|
{
|
||||||
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[idx];
|
||||||
|
|
||||||
uint8_t flag = val ? 1 : 0;
|
if( val )
|
||||||
|
pNewQuest->a.BitFlag48 |= ( 1 << index );
|
||||||
pNewQuest->a.BitFlag48 |= ( val << index );
|
else
|
||||||
|
pNewQuest->a.BitFlag48 &= ~( 1 << index );
|
||||||
|
|
||||||
updateQuest( questId, pNewQuest->c.sequence );
|
updateQuest( questId, pNewQuest->c.sequence );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t Core::Entity::Player::getQuestSeq( uint16_t questId )
|
uint8_t Core::Entity::Player::getQuestSeq( uint16_t questId )
|
||||||
{
|
{
|
||||||
int8_t idx = getQuestIndex( questId );
|
int8_t idx = getQuestIndex( questId );
|
||||||
|
@ -1027,7 +1033,7 @@ bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optional
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||||
uint32_t playerLevel = getLevel();
|
uint32_t playerLevel = getLevel();
|
||||||
auto questInfo = pExdData->get< Core::Data::Quest >( questId );
|
auto questInfo = pExdData->get< Core::Data::Quest >( questId );
|
||||||
|
|
||||||
|
|
||||||
if( !questInfo )
|
if( !questInfo )
|
||||||
return false;
|
return false;
|
||||||
|
@ -1062,7 +1068,7 @@ bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optional
|
||||||
auto itemId = questInfo->itemReward1.at( optionalChoice );
|
auto itemId = questInfo->itemReward1.at( optionalChoice );
|
||||||
addItem( -1, itemId, questInfo->itemCountReward1.at( optionalChoice ) );
|
addItem( -1, itemId, questInfo->itemCountReward1.at( optionalChoice ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( gilReward > 0 )
|
if( gilReward > 0 )
|
||||||
addCurrency( 1, gilReward );
|
addCurrency( 1, gilReward );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue