1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00

Implements class change on weapon swap.

This commit is contained in:
Squall Leonhart 2018-10-17 23:25:41 +03:00
parent a7fc43a2d5
commit 30c80450e2

View file

@ -122,16 +122,12 @@ void Core::Entity::Player::equipWeapon( ItemPtr pItem )
auto itemInfo = exdData->get< Core::Data::Item >( pItem->getId() ); auto itemInfo = exdData->get< Core::Data::Item >( pItem->getId() );
auto itemClassJob = itemInfo->classJobUse; auto itemClassJob = itemInfo->classJobUse;
auto classJobInfo = exdData->get< Core::Data::ClassJob >( (uint32_t)getClass() );
auto currentClass = getClass(); auto currentParentClass = static_cast< ClassJob >(classJobInfo->classJobParent);
auto newClassJob = static_cast< ClassJob >( itemClassJob ); auto newClassJob = static_cast< ClassJob >( itemClassJob );
if( isClassJobUnlocked( newClassJob ) ) if( ( isClassJobUnlocked( newClassJob ) ) && ( currentParentClass != newClassJob ) )
return; setClassJob( newClassJob );
// todo: check if soul crystal is equipped and use job instead
setClassJob( newClassJob );
} }
// equip an item // equip an item
@ -160,8 +156,7 @@ void Core::Entity::Player::updateModels( GearSetSlot equipSlotId, const Core::It
case MainHand: case MainHand:
m_modelMainWeapon = model; m_modelMainWeapon = model;
m_modelSubWeapon = model2; m_modelSubWeapon = model2;
// TODO: add job change upon changing weapon if needed equipWeapon( pItem );
// equipWeapon( pItem );
break; break;
case OffHand: case OffHand: