1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 05:57:45 +00:00

Cleaner way to add gearsets

This commit is contained in:
Lucy 2023-02-12 23:11:26 +01:00
parent ae94aac979
commit 7524e39304
6 changed files with 21 additions and 7 deletions

View file

@ -100,7 +100,7 @@ private:
{
player.finishQuest( getId() );
player.setLevelForClass( 1, Sapphire::Common::ClassJob::Archer );
player.setMaxGearSets( player.getMaxGearSets() + 1 );
player.addGearSet();
}
}
};

View file

@ -101,7 +101,7 @@ private:
//TODO:Unlock gathering log? Maybe?
player.finishQuest( getId() );
player.setLevelForClass( 1, Sapphire::Common::ClassJob::Botanist );
player.setMaxGearSets( player.getMaxGearSets() + 1 );
player.addGearSet();
}
}
};

View file

@ -100,7 +100,7 @@ private:
//TODO:Unlock gathering log?
player.finishQuest( getId() );
player.setLevelForClass( 1, Sapphire::Common::ClassJob::Miner );
player.setMaxGearSets( player.getMaxGearSets() + 1 );
player.addGearSet();
}
}
};

View file

@ -214,7 +214,7 @@ private:
{
//TODO: Unlock Skill
player.finishQuest( getId() );
player.setMaxGearSets( player.getMaxGearSets() + 1 );
player.addGearSet();
}
};

View file

@ -1227,14 +1227,25 @@ void Player::setAchievementData( const Player::AchievementData& achievementData
void Player::setMaxGearSets( uint8_t amount )
{
if( amount == 1 )
amount = 5;
m_equippedMannequin = amount;
queuePacket( makeActorControlSelf( getId(), SetMaxGearSets, m_equippedMannequin ) );
}
void Player::addGearSet()
{
uint8_t amount = 1;
if( getMaxGearSets() == 0 )
{
// unlock 5 gearsets the first time
amount = 5;
setRewardFlag( UnlockEntry::GearSets );
}
setMaxGearSets( getMaxGearSets() + amount );
}
uint8_t Player::getMaxGearSets() const
{
return m_equippedMannequin;

View file

@ -387,6 +387,9 @@ namespace Sapphire::Entity
/*! set number of gear sets */
void setMaxGearSets( uint8_t amount );
/*! add a gear set */
void addGearSet();
/*! get number of gear sets */
uint8_t getMaxGearSets() const;