From 30c80450e23c62f56ec940f4ed174a753d1684db Mon Sep 17 00:00:00 2001 From: Squall Leonhart <43782392+Squall5668@users.noreply.github.com> Date: Wed, 17 Oct 2018 23:25:41 +0300 Subject: [PATCH] Implements class change on weapon swap. --- .../sapphire_zone/Actor/PlayerInventory.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp index a40ce99f..e8c51b73 100644 --- a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp @@ -122,16 +122,12 @@ void Core::Entity::Player::equipWeapon( ItemPtr pItem ) auto itemInfo = exdData->get< Core::Data::Item >( pItem->getId() ); auto itemClassJob = itemInfo->classJobUse; - - auto currentClass = getClass(); + auto classJobInfo = exdData->get< Core::Data::ClassJob >( (uint32_t)getClass() ); + auto currentParentClass = static_cast< ClassJob >(classJobInfo->classJobParent); auto newClassJob = static_cast< ClassJob >( itemClassJob ); - if( isClassJobUnlocked( newClassJob ) ) - return; - - // todo: check if soul crystal is equipped and use job instead - - setClassJob( newClassJob ); + if( ( isClassJobUnlocked( newClassJob ) ) && ( currentParentClass != newClassJob ) ) + setClassJob( newClassJob ); } // equip an item @@ -160,8 +156,7 @@ void Core::Entity::Player::updateModels( GearSetSlot equipSlotId, const Core::It case MainHand: m_modelMainWeapon = model; m_modelSubWeapon = model2; - // TODO: add job change upon changing weapon if needed - // equipWeapon( pItem ); + equipWeapon( pItem ); break; case OffHand: