1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-01 08:27:46 +00:00

Implement mount unlocking

This commit is contained in:
Rushi 2022-01-16 22:48:55 +01:00
parent e0398b0dbb
commit 575fb37854
6 changed files with 46 additions and 0 deletions

View file

@ -899,6 +899,7 @@ namespace Sapphire::Common
KeyItemAction = 1,
ItemActionVFX = 852,
ItemActionVFX2 = 944,
ItemActionMount = 1322,
};
enum ActionEffectDisplayType : uint8_t

View file

@ -278,6 +278,12 @@ namespace Sapphire::Network::ActorControl
*/
SetMountSpeed = 0x39F,
/*!
* param1 = mount ID
* param2 = unlock/lock (1/0)
*/
SetMountBitmask = 0x387,
Dismount = 0x3A1, // updated 4.5
// Duty Recorder

View file

@ -51,6 +51,13 @@ void ItemAction::execute()
break;
}
case Common::ItemActionType::ItemActionMount:
{
handleMountItem();
break;
}
}
}
@ -72,4 +79,12 @@ void ItemAction::handleVFXItem()
effectPacket->addTargetEffect( effect, static_cast< uint64_t >( getSourceChara()->getId() ) );
m_pSource->sendToInRangeSet( effectPacket, true );
}
void ItemAction::handleMountItem()
{
auto player = getSourceChara()->getAsPlayer();
player->unlockMount( m_itemAction->data().Calcu0Arg[ 0 ] );
player->dropInventoryItem ( static_cast< Common::InventoryType >( m_itemSourceContainer ), m_itemSourceSlot );
}

View file

@ -27,6 +27,8 @@ namespace Sapphire::World::Action
private:
void handleVFXItem();
void handleMountItem();
private:
std::shared_ptr< Component::Excel::ExcelStruct< Component::Excel::ItemAction > > m_itemAction;

View file

@ -1158,6 +1158,22 @@ const Sapphire::Entity::Player::UnlockList& Sapphire::Entity::Player::getUnlockB
const Sapphire::Entity::Player::OrchestrionList& Sapphire::Entity::Player::getOrchestrionBitmask() const
{
return m_orchestrion;
}
void Sapphire::Entity::Player::unlockMount( uint32_t mountId )
{
auto& exdData = Common::Service< Data::ExdData >::ref();
auto mount = exdData.getRow< Component::Excel::Mount >( mountId );
Logger::debug("Order: {0}", mount->data().MountOrder);
if ( mount->data().MountOrder == -1 )
return;
m_mountGuide[ mount->data().MountOrder / 8 ] |= ( 1 << ( mount->data().MountOrder % 8 ) );
queuePacket( makeActorControlSelf( getId(), Network::ActorControl::SetMountBitmask, mount->data().MountOrder, 1 ) );
}
Sapphire::Entity::Player::MountList& Sapphire::Entity::Player::getMountGuideBitmask()
@ -1379,6 +1395,9 @@ void Sapphire::Entity::Player::setTitle( uint16_t titleId )
void Sapphire::Entity::Player::setMaxGearSets( uint8_t amount )
{
if (amount == 1)
amount = 5;
m_equippedMannequin = amount;
queuePacket( makeActorControlSelf( getId(), SetMaxGearSets, m_equippedMannequin ) );

View file

@ -464,6 +464,9 @@ namespace Sapphire::Entity
/*! return a const pointer to the orchestrion bitmask array */
const OrchestrionList& getOrchestrionBitmask() const;
/*! unlock a mount */
void unlockMount( uint32_t mountId );
/*! return a const pointer to the setMount guide bitmask array */
MountList& getMountGuideBitmask();