mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-24 13:47:46 +00:00
fix db storage for classjobs, improve switching between classes
This commit is contained in:
parent
78ddbb3672
commit
e68b302f42
6 changed files with 28 additions and 53 deletions
|
@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS `characlass` (
|
||||||
`ClassIdx` int(3) DEFAULT '0',
|
`ClassIdx` int(3) DEFAULT '0',
|
||||||
`Exp` int(10) DEFAULT '0',
|
`Exp` int(10) DEFAULT '0',
|
||||||
`Lvl` int(5) DEFAULT '0',
|
`Lvl` int(5) DEFAULT '0',
|
||||||
PRIMARY KEY (`CharacterId`)
|
INDEX `CharacterId` (`CharacterId`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- Dumping data for table sapphire.characlass: 0 rows
|
-- Dumping data for table sapphire.characlass: 0 rows
|
||||||
|
|
|
@ -49,3 +49,5 @@ ALTER TABLE `charainfo` CHANGE `Minions` `Minions` BINARY(37) NULL DEFAULT NULL;
|
||||||
ALTER TABLE `charainfo` CHANGE `QuestCompleteFlags` `QuestCompleteFlags` VARBINARY(396) NULL DEFAULT NULL;
|
ALTER TABLE `charainfo` CHANGE `QuestCompleteFlags` `QuestCompleteFlags` VARBINARY(396) NULL DEFAULT NULL;
|
||||||
ALTER TABLE `charainfo` ADD COLUMN `EquipDisplayFlags` INT(3) NULL DEFAULT '0' AFTER `GMRank`;
|
ALTER TABLE `charainfo` ADD COLUMN `EquipDisplayFlags` INT(3) NULL DEFAULT '0' AFTER `GMRank`;
|
||||||
ALTER TABLE `charainfo` ADD COLUMN `Pose` INT(3) NULL DEFAULT '0' AFTER `EquipDisplayFlags`;
|
ALTER TABLE `charainfo` ADD COLUMN `Pose` INT(3) NULL DEFAULT '0' AFTER `EquipDisplayFlags`;
|
||||||
|
|
||||||
|
ALTER TABLE `characlass` DROP PRIMARY KEY, ADD INDEX `CharacterId` (`CharacterId`);
|
|
@ -704,6 +704,12 @@ uint8_t Core::Entity::Player::getLevelForClass( Common::ClassJob pClass ) const
|
||||||
return static_cast< uint8_t >( m_classArray[classJobIndex] );
|
return static_cast< uint8_t >( m_classArray[classJobIndex] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Core::Entity::Player::isClassJobUnlocked( Common::ClassJob classJob ) const
|
||||||
|
{
|
||||||
|
// todo: need to properly check if a job is unlocked, at the moment we just check the class array which will return true for every job if the base class is unlocked
|
||||||
|
return getLevelForClass( classJob ) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t Core::Entity::Player::getExp() const
|
uint32_t Core::Entity::Player::getExp() const
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||||
|
|
|
@ -257,6 +257,8 @@ public:
|
||||||
uint8_t getLevel() const override;
|
uint8_t getLevel() const override;
|
||||||
/*! returns the level of the provided class / job */
|
/*! returns the level of the provided class / job */
|
||||||
uint8_t getLevelForClass( Common::ClassJob pClass ) const;
|
uint8_t getLevelForClass( Common::ClassJob pClass ) const;
|
||||||
|
/*! returns if the classjob is unlocked */
|
||||||
|
bool isClassJobUnlocked( Common::ClassJob classJob ) const;
|
||||||
/*! returns the exp of the currently active class / job */
|
/*! returns the exp of the currently active class / job */
|
||||||
uint32_t getExp() const;
|
uint32_t getExp() const;
|
||||||
/*! sets the exp of the currently active class / job */
|
/*! sets the exp of the currently active class / job */
|
||||||
|
|
|
@ -115,59 +115,24 @@ void Core::Entity::Player::sendItemLevel()
|
||||||
queuePacket( boost::make_shared< ActorControlPacket142 >( getId(), SetItemLevel, getItemLevel(), 0 ) );
|
queuePacket( boost::make_shared< ActorControlPacket142 >( getId(), SetItemLevel, getItemLevel(), 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This has to be redone and simplified
|
|
||||||
void Core::Entity::Player::equipWeapon( ItemPtr pItem )
|
void Core::Entity::Player::equipWeapon( ItemPtr pItem )
|
||||||
{
|
{
|
||||||
ClassJob currentClass = static_cast< ClassJob >( getClass() );
|
auto exdData = g_fw.get< Core::Data::ExdDataGenerated >();
|
||||||
|
if( !exdData )
|
||||||
|
return;
|
||||||
|
|
||||||
switch( pItem->getCategory() )
|
auto itemInfo = exdData->get< Core::Data::Item >( pItem->getId() );
|
||||||
{
|
auto itemClassJob = itemInfo->classJobUse;
|
||||||
case ItemUICategory::PugilistsArm:
|
|
||||||
if( currentClass != ClassJob::Pugilist &&
|
auto currentClass = getClass();
|
||||||
currentClass != ClassJob::Monk )
|
auto newClassJob = static_cast< ClassJob >( itemClassJob );
|
||||||
setClassJob( ClassJob::Pugilist );
|
|
||||||
break;
|
if( isClassJobUnlocked( newClassJob ) )
|
||||||
case ItemUICategory::GladiatorsArm:
|
return;
|
||||||
if( currentClass != ClassJob::Gladiator &&
|
|
||||||
currentClass != ClassJob::Paladin )
|
// todo: check if soul crystal is equipped and use job instead
|
||||||
setClassJob( ClassJob::Gladiator );
|
|
||||||
break;
|
setClassJob( newClassJob );
|
||||||
case ItemUICategory::MaraudersArm:
|
|
||||||
if( currentClass != ClassJob::Marauder &&
|
|
||||||
currentClass != ClassJob::Warrior )
|
|
||||||
setClassJob( ClassJob::Marauder );
|
|
||||||
break;
|
|
||||||
case ItemUICategory::ArchersArm:
|
|
||||||
if( currentClass != ClassJob::Archer &&
|
|
||||||
currentClass != ClassJob::Bard )
|
|
||||||
setClassJob( ClassJob::Archer );
|
|
||||||
break;
|
|
||||||
case ItemUICategory::LancersArm:
|
|
||||||
if( currentClass != ClassJob::Lancer &&
|
|
||||||
currentClass != ClassJob::Dragoon )
|
|
||||||
setClassJob( ClassJob::Lancer );
|
|
||||||
break;
|
|
||||||
case ItemUICategory::OnehandedThaumaturgesArm:
|
|
||||||
case ItemUICategory::TwohandedThaumaturgesArm:
|
|
||||||
if( currentClass != ClassJob::Thaumaturge &&
|
|
||||||
currentClass != ClassJob::Blackmage )
|
|
||||||
setClassJob( ClassJob::Thaumaturge );
|
|
||||||
break;
|
|
||||||
case ItemUICategory::OnehandedConjurersArm:
|
|
||||||
case ItemUICategory::TwohandedConjurersArm:
|
|
||||||
if( currentClass != ClassJob::Conjurer &&
|
|
||||||
currentClass != ClassJob::Whitemage )
|
|
||||||
setClassJob( ClassJob::Conjurer );
|
|
||||||
break;
|
|
||||||
case ItemUICategory::ArcanistsGrimoire:
|
|
||||||
if( currentClass != ClassJob::Arcanist &&
|
|
||||||
currentClass != ClassJob::Summoner &&
|
|
||||||
currentClass != ClassJob::Scholar )
|
|
||||||
setClassJob( ClassJob::Arcanist );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// equip an item
|
// equip an item
|
||||||
|
|
|
@ -113,7 +113,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto inRange = player.getInRangeActors();
|
auto inRange = player.getInRangeActors();
|
||||||
for( auto actor : inRange )
|
for( auto& actor : inRange )
|
||||||
{
|
{
|
||||||
if( actor->getId() == param3 )
|
if( actor->getId() == param3 )
|
||||||
targetActor = actor;
|
targetActor = actor;
|
||||||
|
|
Loading…
Add table
Reference in a new issue