1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00

Fix armory.

This commit is contained in:
collett 2020-05-12 00:18:45 +09:00
parent 6cb0a7eed2
commit 37fbb35c0a
4 changed files with 56 additions and 54 deletions

View file

@ -159,44 +159,46 @@ namespace Sapphire::Common
ModelRing2 = 9
};
enum EquipSlotCategory : uint8_t
enum class EquipSlotCategory : uint8_t
{
Unequippable = 0,
// main slots
CharaMainHand = 1,
CharaOffHand = 2,
CharaHead = 3,
CharaBody = 4,
CharaHands = 5,
CharaWaist = 6,
CharaLegs = 7,
CharaFeet = 8,
CharaEars = 9,
CharaNeck = 10,
CharaWrist = 11,
CharaRing = 12,
CharaSoulCrystal = 17,
// specials
CharaMainHand = 0,
CharaOffHand = 1,
CharaHead = 2,
CharaBody = 3,
CharaHands = 4,
CharaWaist = 5,
CharaLegs = 6,
CharaFeet = 7,
CharaEars = 8,
CharaNeck = 9,
CharaWrist = 10,
CharaRing = 11,
CharaSoulCrystal = 12,
/* following slots not seem to exist any more.
when multi-slot gear is moved into equipment slot, normal slot listed above is used.
client will move any incompatible gears into armory but no InventoryModifiyHandler is sent.
server need to move those silently in order to sync with client.
*/
/*! Cannot equip gear to offhand slot */
MainTwoHandedWeapon = 13,
//MainTwoHandedWeapon = 13,
/*! Can be equipped in either main or offhand slot */
MainOrOffHand = 14, // unused
//MainOrOffHand = 14, // unused
/*! Cannot equip gear to head */
BodyDisallowHead = 15,
//BodyDisallowHead = 15,
/*! Cannot equip gear to hands, legs and feet slots */
BodyDisallowHandsLegsFeet = 16,
//BodyDisallowHandsLegsFeet = 16,
/*! Cannot equip gear to feet slot */
LegsDisallowFeet = 18,
//LegsDisallowFeet = 18,
/*! Cannot equp gear to head, hands, legs, feet slots */
BodyDisallowAll = 19,
//BodyDisallowAll = 19,
/*! Cannot equip gear to hands slot */
BodyDisallowHands = 20,
//BodyDisallowHands = 20,
/*! Cannot equip gear to legs & feet slots */
BodyDisallowLegsFeet = 21,
//BodyDisallowLegsFeet = 21,
};
enum InventoryType : uint16_t
@ -226,8 +228,8 @@ namespace Sapphire::Common
ArmoryWaist = 3204,
ArmoryLegs = 3205,
ArmoryFeet = 3206,
ArmoryNeck = 3207,
ArmoryEar = 3208,
ArmoryEar = 3207,
ArmoryNeck = 3208,
ArmoryWrist = 3209,
ArmoryRing = 3300,

View file

@ -548,7 +548,7 @@ Sapphire::ItemPtr Sapphire::Entity::Player::addItem( ItemPtr itemToAdd, bool sil
// add the related armoury bag to the applicable bags and try and fill a free slot there before falling back to regular inventory
if( itemInfo->isEquippable && getEquipDisplayFlags() & StoreNewItemsInArmouryChest )
{
auto bag = World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( itemInfo->equipSlotCategory );
auto bag = World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( static_cast< Common::EquipSlotCategory >( itemInfo->equipSlotCategory ) );
bags.insert( bags.begin(), bag );
}
@ -802,7 +802,7 @@ void Sapphire::Entity::Player::swapItem( uint16_t fromInventoryId, uint8_t fromS
&& !World::Manager::ItemMgr::isArmory( fromInventoryId ) )
{
updateContainer( fromInventoryId, fromSlotId, nullptr );
fromInventoryId = World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( toSlot );
fromInventoryId = World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( static_cast< Common::EquipSlotCategory >( toSlot ) );
fromSlotId = static_cast < uint8_t >( m_storageMap[ fromInventoryId ]->getFreeSlot() );
}

View file

@ -27,56 +27,56 @@ bool Sapphire::World::Manager::ItemMgr::isArmory( uint16_t containerId )
}
uint16_t Sapphire::World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( uint8_t slotId )
uint16_t Sapphire::World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( Common::EquipSlotCategory slot )
{
switch( slotId )
switch( slot )
{
case Common::CharaHead:
case Common::EquipSlotCategory::CharaHead:
return Common::ArmoryHead;
case Common::CharaBody:
case Common::BodyDisallowHead:
case Common::BodyDisallowHandsLegsFeet:
case Common::BodyDisallowAll:
case Common::BodyDisallowHands:
case Common::BodyDisallowLegsFeet:
case Common::EquipSlotCategory::CharaBody:
//case Common::EquipSlotCategory::BodyDisallowHead:
//case Common::EquipSlotCategory::BodyDisallowHandsLegsFeet:
//case Common::EquipSlotCategory::BodyDisallowAll:
//case Common::EquipSlotCategory::BodyDisallowHands:
//case Common::EquipSlotCategory::BodyDisallowLegsFeet:
return Common::ArmoryBody;
case Common::CharaEars:
case Common::EquipSlotCategory::CharaEars:
return Common::ArmoryEar;
case Common::CharaFeet:
case Common::EquipSlotCategory::CharaFeet:
return Common::ArmoryFeet;
case Common::CharaHands:
case Common::EquipSlotCategory::CharaHands:
return Common::ArmoryHand;
case Common::CharaLegs:
case Common::LegsDisallowFeet:
case Common::EquipSlotCategory::CharaLegs:
//case Common::EquipSlotCategory::LegsDisallowFeet:
return Common::ArmoryLegs;
case Common::CharaMainHand:
case Common::MainTwoHandedWeapon:
case Common::MainOrOffHand:
case Common::EquipSlotCategory::CharaMainHand:
//case Common::EquipSlotCategory::MainTwoHandedWeapon:
//case Common::EquipSlotCategory::MainOrOffHand:
return Common::ArmoryMain;
case Common::CharaOffHand:
case Common::EquipSlotCategory::CharaOffHand:
return Common::ArmoryOff;
case Common::CharaRing:
case Common::EquipSlotCategory::CharaRing:
return Common::ArmoryRing;
case Common::CharaWaist:
case Common::EquipSlotCategory::CharaWaist:
return Common::ArmoryWaist;
case Common::CharaWrist:
case Common::EquipSlotCategory::CharaWrist:
return Common::ArmoryWrist;
case Common::CharaNeck:
case Common::EquipSlotCategory::CharaNeck:
return Common::ArmoryNeck;
case Common::CharaSoulCrystal:
case Common::EquipSlotCategory::CharaSoulCrystal:
return Common::ArmorySoulCrystal;
default:

View file

@ -20,7 +20,7 @@ namespace Sapphire::World::Manager
static bool isOneHandedWeapon( Common::ItemUICategory weaponCategory );
static bool isArmory( uint16_t containerId );
static bool isEquipment( uint16_t containerId );
static uint16_t getCharaEquipSlotCategoryToArmoryId( uint8_t slotId );
static uint16_t getCharaEquipSlotCategoryToArmoryId( Common::EquipSlotCategory slot );
static Common::ContainerType getContainerType( uint32_t containerId );
};