mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 11:07:45 +00:00
Only commit changes for this PR
This commit is contained in:
parent
1ef0585bba
commit
b559debd61
5 changed files with 47 additions and 18 deletions
|
@ -1344,7 +1344,10 @@ namespace Sapphire::Network::Packets::Server
|
|||
uint32_t catalogId;
|
||||
uint32_t someActorId;
|
||||
int32_t targetStorageId;
|
||||
uint32_t padding3[3];
|
||||
uint16_t targetSlotId;
|
||||
uint16_t padding3;
|
||||
uint32_t targetStackSize;
|
||||
uint32_t targetCatalogId;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -54,6 +54,13 @@ void ItemAction::execute()
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
case Common::ItemActionType::ItemActionOrchestrion:
|
||||
{
|
||||
handleOrchestrionItem();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,6 +76,13 @@ void ItemAction::handleMountItem()
|
|||
player->dropInventoryItem ( static_cast< Common::InventoryType >( m_itemSourceContainer ), m_itemSourceSlot, false );
|
||||
}
|
||||
|
||||
void ItemAction::handleOrchestrionItem()
|
||||
{
|
||||
auto player = getSourceChara()->getAsPlayer();
|
||||
player->learnSong( m_itemAction->data[ 0 ], m_itemAction->data[ 1 ] );
|
||||
player->dropInventoryItem ( static_cast< Common::InventoryType >( m_itemSourceContainer ), m_itemSourceSlot, false );
|
||||
}
|
||||
|
||||
void ItemAction::handleVFXItem()
|
||||
{
|
||||
Common::EffectEntry effect{};
|
||||
|
|
|
@ -29,6 +29,8 @@ namespace Sapphire::World::Action
|
|||
|
||||
void handleMountItem();
|
||||
|
||||
void handleOrchestrionItem();
|
||||
|
||||
private:
|
||||
Sapphire::Data::ItemActionPtr m_itemAction;
|
||||
|
||||
|
|
|
@ -348,6 +348,9 @@ namespace Sapphire::Entity
|
|||
/*! send player ilvl */
|
||||
void sendItemLevel();
|
||||
|
||||
/*! set player ilvl */
|
||||
void setItemLevel();
|
||||
|
||||
/*! get the current main hand model */
|
||||
uint64_t getModelMainWeapon() const;
|
||||
|
||||
|
@ -946,12 +949,14 @@ namespace Sapphire::Entity
|
|||
|
||||
InvSlotPair getFreeBagSlot();
|
||||
|
||||
InvSlotPair getFreeContainerSlot( uint32_t containerId );
|
||||
|
||||
ItemPtr addItem( uint32_t catalogId, uint32_t quantity = 1, bool isHq = false, bool silent = false, bool canMerge = true, bool sendLootMessage = false );
|
||||
ItemPtr addItem( ItemPtr itemToAdd, bool silent = false, bool canMerge = true, bool sendLootMessage = false );
|
||||
|
||||
void moveItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot, bool sendUpdate = true );
|
||||
|
||||
void swapItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot );
|
||||
void swapItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot, bool sendUpdate = true );
|
||||
|
||||
void discardItem( uint16_t fromInventoryId, uint8_t fromSlotId );
|
||||
|
||||
|
@ -964,8 +969,6 @@ namespace Sapphire::Entity
|
|||
|
||||
bool updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem );
|
||||
|
||||
bool updateGearContainer( uint8_t slotId, ItemPtr pItem );
|
||||
|
||||
/*! calculate and return player ilvl based off equipped gear */
|
||||
uint16_t calculateEquippedGearItemLevel();
|
||||
|
||||
|
|
|
@ -110,6 +110,11 @@ void Sapphire::Entity::Player::sendItemLevel()
|
|||
queuePacket( makeActorControl( getId(), SetItemLevel, getItemLevel(), 0 ) );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::setItemLevel()
|
||||
{
|
||||
m_itemLevel = calculateEquippedGearItemLevel();
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
||||
{
|
||||
auto& exdData = Common::Service< Sapphire::Data::ExdDataGenerated >::ref();
|
||||
|
@ -459,6 +464,17 @@ Sapphire::Entity::Player::InvSlotPairVec Sapphire::Entity::Player::getSlotsOfIte
|
|||
return outVec;
|
||||
}
|
||||
|
||||
Sapphire::Entity::Player::InvSlotPair Sapphire::Entity::Player::getFreeContainerSlot( uint32_t containerId )
|
||||
{
|
||||
auto freeSlot = static_cast < int8_t >( m_storageMap[ containerId ]->getFreeSlot() );
|
||||
|
||||
if( freeSlot != -1 )
|
||||
return std::make_pair( containerId, freeSlot );
|
||||
|
||||
// no room in inventory
|
||||
return std::make_pair( 0, -1 );
|
||||
}
|
||||
|
||||
Sapphire::Entity::Player::InvSlotPair Sapphire::Entity::Player::getFreeBagSlot()
|
||||
{
|
||||
for( auto i : { Bag0, Bag1, Bag2, Bag3 } )
|
||||
|
@ -742,20 +758,11 @@ Sapphire::Entity::Player::moveItem( uint16_t fromInventoryId, uint8_t fromSlotId
|
|||
if( static_cast< InventoryType >( fromInventoryId ) == GearSet0 )
|
||||
unequipItem( static_cast< GearSetSlot >( fromSlotId ), tmpItem, sendUpdate );
|
||||
|
||||
if( static_cast< InventoryType >( toInventoryId ) == GearSet0 ||
|
||||
static_cast< InventoryType >( fromInventoryId ) == GearSet0 )
|
||||
if( ( static_cast< InventoryType >( toInventoryId ) == GearSet0 ||
|
||||
static_cast< InventoryType >( fromInventoryId ) == GearSet0 ) && sendUpdate )
|
||||
sendStatusEffectUpdate(); // send if any equip is changed
|
||||
}
|
||||
|
||||
bool Sapphire::Entity::Player::updateGearContainer( uint8_t slotId, ItemPtr pItem )
|
||||
{
|
||||
m_storageMap[ GearSet0 ]->setItem( slotId, pItem );
|
||||
|
||||
writeInventory( GearSet0 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Sapphire::Entity::Player::updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem )
|
||||
{
|
||||
auto containerType = World::Manager::ItemMgr::getContainerType( storageId );
|
||||
|
@ -863,7 +870,7 @@ void Sapphire::Entity::Player::mergeItem( uint16_t fromInventoryId, uint8_t from
|
|||
}
|
||||
|
||||
void Sapphire::Entity::Player::swapItem( uint16_t fromInventoryId, uint8_t fromSlotId,
|
||||
uint16_t toInventoryId, uint8_t toSlot )
|
||||
uint16_t toInventoryId, uint8_t toSlot, bool sendUpdate )
|
||||
{
|
||||
auto fromItem = m_storageMap[ fromInventoryId ]->getItem( fromSlotId );
|
||||
auto toItem = m_storageMap[ toInventoryId ]->getItem( toSlot );
|
||||
|
@ -891,8 +898,8 @@ void Sapphire::Entity::Player::swapItem( uint16_t fromInventoryId, uint8_t fromS
|
|||
updateContainer( toInventoryId, toSlot, fromItem );
|
||||
updateContainer( fromInventoryId, fromSlotId, toItem );
|
||||
|
||||
if( static_cast< InventoryType >( toInventoryId ) == GearSet0 ||
|
||||
static_cast< InventoryType >( fromInventoryId ) == GearSet0 )
|
||||
if( ( static_cast< InventoryType >( toInventoryId ) == GearSet0 ||
|
||||
static_cast< InventoryType >( fromInventoryId ) == GearSet0 ) && sendUpdate )
|
||||
sendStatusEffectUpdate(); // send if any equip is changed
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue