mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 08:57:44 +00:00
Merge pull request #404 from Squall5668/SoulCrystals
ClassJob changes when changing Soul Crystals
This commit is contained in:
commit
d5d66ea524
4 changed files with 41 additions and 8 deletions
|
@ -1000,8 +1000,8 @@ struct FFXIVIpcPlayerClassInfo :
|
||||||
uint16_t classId;
|
uint16_t classId;
|
||||||
uint8_t unknown;
|
uint8_t unknown;
|
||||||
uint8_t isSpecialist;
|
uint8_t isSpecialist;
|
||||||
uint16_t level; // Locks actions, equipment, prob more
|
uint16_t syncedLevel; // Locks actions, equipment, prob more. Player's current level (synced).
|
||||||
uint16_t level1; // Locks roles, prob more
|
uint16_t classLevel; // Locks roles, prob more. Player's actual unsynced level.
|
||||||
uint32_t roleActions[10];
|
uint32_t roleActions[10];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -746,7 +746,8 @@ void Core::Entity::Player::setClassJob( Common::ClassJob classJob )
|
||||||
|
|
||||||
auto classInfoPacket = makeZonePacket< FFXIVIpcPlayerClassInfo >( getId() );
|
auto classInfoPacket = makeZonePacket< FFXIVIpcPlayerClassInfo >( getId() );
|
||||||
classInfoPacket->data().classId = static_cast< uint8_t >( getClass() );
|
classInfoPacket->data().classId = static_cast< uint8_t >( getClass() );
|
||||||
classInfoPacket->data().level = getLevel();
|
classInfoPacket->data().classLevel = getLevel();
|
||||||
|
classInfoPacket->data().syncedLevel = getLevel();
|
||||||
queuePacket( classInfoPacket );
|
queuePacket( classInfoPacket );
|
||||||
|
|
||||||
sendToInRangeSet( makeActorControl142( getId(), ClassJobChange, 0x04 ), true );
|
sendToInRangeSet( makeActorControl142( getId(), ClassJobChange, 0x04 ), true );
|
||||||
|
@ -1550,8 +1551,8 @@ void Core::Entity::Player::sendZonePackets()
|
||||||
auto classInfoPacket = makeZonePacket< FFXIVIpcPlayerClassInfo >( getId() );
|
auto classInfoPacket = makeZonePacket< FFXIVIpcPlayerClassInfo >( getId() );
|
||||||
classInfoPacket->data().classId = static_cast< uint8_t >( getClass() );
|
classInfoPacket->data().classId = static_cast< uint8_t >( getClass() );
|
||||||
classInfoPacket->data().unknown = 1;
|
classInfoPacket->data().unknown = 1;
|
||||||
classInfoPacket->data().level = getLevel();
|
classInfoPacket->data().syncedLevel = getLevel();
|
||||||
classInfoPacket->data().level1 = getLevel();
|
classInfoPacket->data().classLevel = getLevel();
|
||||||
queuePacket( classInfoPacket );
|
queuePacket( classInfoPacket );
|
||||||
|
|
||||||
m_itemLevel = calculateEquippedGearItemLevel();
|
m_itemLevel = calculateEquippedGearItemLevel();
|
||||||
|
@ -1733,4 +1734,3 @@ bool Core::Entity::Player::isOnEnterEventDone() const
|
||||||
{
|
{
|
||||||
return m_onEnterEventDone;
|
return m_onEnterEventDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -326,6 +326,12 @@ public:
|
||||||
/*! equip a weapon, possibly forcing a job change */
|
/*! equip a weapon, possibly forcing a job change */
|
||||||
void equipWeapon( ItemPtr pItem, bool updateClass );
|
void equipWeapon( ItemPtr pItem, bool updateClass );
|
||||||
|
|
||||||
|
/*! equip a soul crystal, possibly forcing a job change*/
|
||||||
|
void equipSoulCrystal( ItemPtr pItem, bool updateClass );
|
||||||
|
|
||||||
|
/*! unequip a soul crystal, returning to the base class*/
|
||||||
|
void unequipSoulCrystal( ItemPtr pItem );
|
||||||
|
|
||||||
/*! get player ilvl */
|
/*! get player ilvl */
|
||||||
uint16_t getItemLevel() const;
|
uint16_t getItemLevel() const;
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,20 @@ void Core::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Core::Entity::Player::equipSoulCrystal( ItemPtr pItem, bool updateJob )
|
||||||
|
{
|
||||||
|
auto exdData = g_fw.get< Core::Data::ExdDataGenerated >();
|
||||||
|
if ( !exdData )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto itemInfo = exdData->get< Core::Data::Item >( pItem->getId() );
|
||||||
|
auto itemClassJob = itemInfo->classJobUse;
|
||||||
|
auto newClassJob = static_cast< ClassJob >( itemClassJob );
|
||||||
|
|
||||||
|
if ( isClassJobUnlocked( newClassJob ) && updateJob )
|
||||||
|
setClassJob( newClassJob );
|
||||||
|
}
|
||||||
|
|
||||||
// equip an item
|
// equip an item
|
||||||
void Core::Entity::Player::equipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem, bool sendUpdate )
|
void Core::Entity::Player::equipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem, bool sendUpdate )
|
||||||
{
|
{
|
||||||
|
@ -169,8 +183,7 @@ void Core::Entity::Player::updateModels( GearSetSlot equipSlotId, const Core::It
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SoulCrystal:
|
case SoulCrystal:
|
||||||
// TODO: add Job change on equipping crystal
|
equipSoulCrystal( pItem, updateClass );
|
||||||
// change job
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Waist:
|
case Waist:
|
||||||
|
@ -228,6 +241,20 @@ void Core::Entity::Player::unequipItem( Common::GearSetSlot equipSlotId, ItemPtr
|
||||||
|
|
||||||
m_itemLevel = calculateEquippedGearItemLevel();
|
m_itemLevel = calculateEquippedGearItemLevel();
|
||||||
sendItemLevel();
|
sendItemLevel();
|
||||||
|
|
||||||
|
if ( equipSlotId == SoulCrystal )
|
||||||
|
unequipSoulCrystal( pItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Entity::Player::unequipSoulCrystal( ItemPtr pItem )
|
||||||
|
{
|
||||||
|
auto exdData = g_fw.get< Core::Data::ExdDataGenerated >();
|
||||||
|
if ( !exdData )
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto currentClassJob = exdData->get< Core::Data::ClassJob >( static_cast< uint32_t >( getClass() ) );
|
||||||
|
auto parentClass = static_cast< ClassJob >( currentClassJob->classJobParent );
|
||||||
|
setClassJob( parentClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: these next functions are so similar that they could likely be simplified
|
// TODO: these next functions are so similar that they could likely be simplified
|
||||||
|
|
Loading…
Add table
Reference in a new issue