1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-10 04:37:45 +00:00

EquipSlot -> GearSetSlot

This commit is contained in:
NotAdam 2018-08-25 22:56:46 +10:00
parent 2859e3731b
commit 7f448494ed
12 changed files with 44 additions and 44 deletions

View file

@ -44,7 +44,7 @@ namespace Common {
French = 8
};
enum EquipSlot : uint8_t
enum GearSetSlot : uint8_t
{
MainHand = 0,
OffHand = 1,
@ -64,7 +64,7 @@ namespace Common {
enum EquipSlotCategory : uint8_t
{
Unequippbale = 0,
Unequippable = 0,
// main slots

View file

@ -45,7 +45,7 @@ private:
auto item = player.addItem( itemId, 1, false, true );
if( item )
player.equipItem( Common::EquipSlot::Ring2, item, true );
player.equipItem( Common::GearSetSlot::Ring2, item, true );
player.setOpeningSequence( 1 );
Scene00001( player );

View file

@ -60,7 +60,7 @@ private:
auto item = player.addItem( itemId, 1, false, true );
if( item )
player.equipItem( Common::EquipSlot::Ring2, item, true );
player.equipItem( Common::GearSetSlot::Ring2, item, true );
player.setOpeningSequence( 1 );
Scene00001( player );

View file

@ -46,7 +46,7 @@ private:
auto item = player.addItem( itemId, 1, false, true );
if( item )
player.equipItem( Common::EquipSlot::Ring2, item, true );
player.equipItem( Common::GearSetSlot::Ring2, item, true );
player.setOpeningSequence( 1 );
Scene00001( player );

View file

@ -353,15 +353,15 @@ namespace Core {
insertDbGlobalItem( 15133, ringUid );
g_charaDb.execute( "INSERT INTO charaitemgearset (storageId, CharacterId, "
"container_" + std::to_string( EquipSlot::MainHand ) + ", "
"container_" + std::to_string( EquipSlot::Body ) + ", "
"container_" + std::to_string( EquipSlot::Hands ) + ", "
"container_" + std::to_string( EquipSlot::Legs ) + ", "
"container_" + std::to_string( EquipSlot::Feet ) + ", "
"container_" + std::to_string( EquipSlot::Neck ) + ", "
"container_" + std::to_string( EquipSlot::Ear ) + ", "
"container_" + std::to_string( EquipSlot::Wrist ) + ", "
"container_" + std::to_string( EquipSlot::Ring1 ) + ", "
"container_" + std::to_string( GearSetSlot::MainHand ) + ", "
"container_" + std::to_string( GearSetSlot::Body ) + ", "
"container_" + std::to_string( GearSetSlot::Hands ) + ", "
"container_" + std::to_string( GearSetSlot::Legs ) + ", "
"container_" + std::to_string( GearSetSlot::Feet ) + ", "
"container_" + std::to_string( GearSetSlot::Neck ) + ", "
"container_" + std::to_string( GearSetSlot::Ear ) + ", "
"container_" + std::to_string( GearSetSlot::Wrist ) + ", "
"container_" + std::to_string( GearSetSlot::Ring1 ) + ", "
"UPDATE_DATE ) "
"VALUES ( " + std::to_string( InventoryType::GearSet0 ) + ", " + std::to_string( m_id ) + ", " +
std::to_string( uniqueId ) + ", " +

View file

@ -774,12 +774,12 @@ void Core::Entity::Player::sendModel()
sendToInRangeSet( boost::make_shared< ModelEquipPacket >( *getAsPlayer() ), true );
}
uint32_t Core::Entity::Player::getModelForSlot( Common::EquipSlot slot )
uint32_t Core::Entity::Player::getModelForSlot( Common::GearSetSlot slot )
{
return m_modelEquip[slot];
}
void Core::Entity::Player::setModelForSlot( Common::EquipSlot slot, uint32_t val )
void Core::Entity::Player::setModelForSlot( Common::GearSetSlot slot, uint32_t val )
{
m_modelEquip[slot] = val;
}
@ -1028,7 +1028,7 @@ void Core::Entity::Player::update( int64_t currTime )
{
if( m_targetId && m_currentStance == Entity::Chara::Stance::Active && isAutoattackOn() )
{
auto mainWeap = getItemAt( Common::GearSet0, Common::EquipSlot::MainHand );
auto mainWeap = getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand );
// @TODO i dislike this, iterating over all in range actors when you already know the id of the actor you need...
for( auto actor : m_inRangeActor )
@ -1411,7 +1411,7 @@ uint32_t Core::Entity::Player::getPersistentEmote() const
void Core::Entity::Player::autoAttack( CharaPtr pTarget )
{
auto mainWeap = getItemAt( Common::GearSet0, Common::EquipSlot::MainHand );
auto mainWeap = getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand );
pTarget->onActionHostile( *this );
//uint64_t tick = Util::getTimeMs();

View file

@ -223,9 +223,9 @@ public:
// Inventory / Item / Currency
//////////////////////////////////////////////////////////////////////////////////////////////////////
/*! equip an item to a specified slot */
void equipItem( Common::EquipSlot equipSlotId, ItemPtr pItem, bool sendModel );
void equipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem, bool sendModel );
/*! remove an item from an equipment slot */
void unequipItem( Common::EquipSlot equipSlotId, ItemPtr pItem );
void unequipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem );
/*! equip a weapon, possibly forcing a job change */
void equipWeapon( ItemPtr pItem );
/*! get player ilvl */
@ -241,9 +241,9 @@ public:
/*! return a const pointer to the model array */
const uint32_t* getModelArray() const;
/*! return the equipment model in a specified equipment slot */
uint32_t getModelForSlot( Common::EquipSlot slot );
uint32_t getModelForSlot( Common::GearSetSlot slot );
/*! set the equipment model in a specified equipment slot */
void setModelForSlot( Common::EquipSlot slot, uint32_t val );
void setModelForSlot( Common::GearSetSlot slot, uint32_t val );
/*! add amount to the currency of type */
void addCurrency( Common::CurrencyType type, uint32_t amount );
/*! remove amount from the currency of type */

View file

@ -171,7 +171,7 @@ void Core::Entity::Player::equipWeapon( ItemPtr pItem )
}
// equip an item
void Core::Entity::Player::equipItem( Common::EquipSlot equipSlotId, ItemPtr pItem, bool sendUpdate )
void Core::Entity::Player::equipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem, bool sendUpdate )
{
//g_framework.getLogger().debug( "Equipping into slot " + std::to_string( equipSlotId ) );
@ -181,18 +181,18 @@ void Core::Entity::Player::equipItem( Common::EquipSlot equipSlotId, ItemPtr pIt
switch( equipSlotId )
{
case Common::EquipSlot::MainHand:
case Common::GearSetSlot::MainHand:
m_modelMainWeapon = model;
m_modelSubWeapon = model2;
// TODO: add job change upon changing weapon if needed
// equipWeapon( pItem );
break;
case Common::EquipSlot::OffHand:
case Common::GearSetSlot::OffHand:
m_modelSubWeapon = model;
break;
case Common::EquipSlot::SoulCrystal:
case Common::GearSetSlot::SoulCrystal:
// TODO: add Job change on equipping crystal
// change job
break;
@ -211,7 +211,7 @@ void Core::Entity::Player::equipItem( Common::EquipSlot equipSlotId, ItemPtr pIt
}
}
void Core::Entity::Player::unequipItem( Common::EquipSlot equipSlotId, ItemPtr pItem )
void Core::Entity::Player::unequipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem )
{
m_modelEquip[static_cast< uint8_t >( equipSlotId )] = 0;
sendModel();
@ -611,10 +611,10 @@ void Core::Entity::Player::moveItem( uint16_t fromInventoryId, uint8_t fromSlotI
writeInventory( static_cast< InventoryType >( fromInventoryId ) );
if( static_cast< InventoryType >( toInventoryId ) == GearSet0 )
equipItem( static_cast< EquipSlot >( toSlot ), tmpItem, true );
equipItem( static_cast< GearSetSlot >( toSlot ), tmpItem, true );
if( static_cast< InventoryType >( fromInventoryId ) == GearSet0 )
unequipItem( static_cast< EquipSlot >( fromSlotId ), tmpItem );
unequipItem( static_cast< GearSetSlot >( fromSlotId ), tmpItem );
}
@ -638,9 +638,9 @@ bool Core::Entity::Player::updateContainer( uint16_t storageId, uint8_t slotId,
case GearSet:
{
if( pItem )
equipItem( static_cast< EquipSlot >( slotId ), pItem, true );
equipItem( static_cast< GearSetSlot >( slotId ), pItem, true );
else
unequipItem( static_cast< EquipSlot >( slotId ), pItem );
unequipItem( static_cast< GearSetSlot >( slotId ), pItem );
writeInventory( static_cast< InventoryType >( storageId ) );
break;

View file

@ -617,7 +617,7 @@ bool Core::Entity::Player::loadInventory()
continue;
m_storageMap[storageId]->getItemMap()[i - 1] = pItem;
equipItem( static_cast< EquipSlot >( i - 1 ), pItem, false );
equipItem( static_cast< GearSetSlot >( i - 1 ), pItem, false );
}
}

View file

@ -267,7 +267,7 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost:
uint32_t val;
sscanf( params.c_str(), "%d %d", &slot, &val );
player.setModelForSlot( static_cast< Common::EquipSlot >( slot ), val );
player.setModelForSlot( static_cast< Common::GearSetSlot >( slot ), val );
player.sendModel();
player.sendDebug( "Model updated" );
}

View file

@ -28,11 +28,11 @@ private:
{
m_data.mainWeapon = player.getModelMainWeapon();
m_data.offWeapon = player.getModelSubWeapon();
m_data.models[0] = player.getModelForSlot( Common::EquipSlot::Head );
m_data.models[1] = player.getModelForSlot( Common::EquipSlot::Body );
m_data.models[2] = player.getModelForSlot( Common::EquipSlot::Hands );
m_data.models[3] = player.getModelForSlot( Common::EquipSlot::Legs );
m_data.models[4] = player.getModelForSlot( Common::EquipSlot::Feet );
m_data.models[0] = player.getModelForSlot( Common::GearSetSlot::Head );
m_data.models[1] = player.getModelForSlot( Common::GearSetSlot::Body );
m_data.models[2] = player.getModelForSlot( Common::GearSetSlot::Hands );
m_data.models[3] = player.getModelForSlot( Common::GearSetSlot::Legs );
m_data.models[4] = player.getModelForSlot( Common::GearSetSlot::Feet );
};
};

View file

@ -49,16 +49,16 @@ namespace Server {
memcpy( m_data.look, player.getLookArray(), 26 );
auto item = player.getItemAt( Common::GearSet0, Common::EquipSlot::MainHand );
auto item = player.getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand );
if( item )
m_data.mainWeaponModel = item->getModelId1();
m_data.secWeaponModel = player.getModelSubWeapon();
m_data.models[0] = player.getModelForSlot( Common::EquipSlot::Head );
m_data.models[1] = player.getModelForSlot( Common::EquipSlot::Body );
m_data.models[2] = player.getModelForSlot( Common::EquipSlot::Hands );
m_data.models[3] = player.getModelForSlot( Common::EquipSlot::Legs );
m_data.models[4] = player.getModelForSlot( Common::EquipSlot::Feet );
m_data.models[0] = player.getModelForSlot( Common::GearSetSlot::Head );
m_data.models[1] = player.getModelForSlot( Common::GearSetSlot::Body );
m_data.models[2] = player.getModelForSlot( Common::GearSetSlot::Hands );
m_data.models[3] = player.getModelForSlot( Common::GearSetSlot::Legs );
m_data.models[4] = player.getModelForSlot( Common::GearSetSlot::Feet );
strcpy( m_data.name, player.getName().c_str() );
m_data.pos.x = player.getPos().x;