mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-29 23:57:46 +00:00
Merge branch 'develop' of https://github.com/SapphireMordred/Sapphire into develop
This commit is contained in:
commit
9bf6e6386b
10 changed files with 144 additions and 78 deletions
|
@ -110,16 +110,30 @@ enum GearSetSlot :
|
|||
Waist = 5,
|
||||
Legs = 6,
|
||||
Feet = 7,
|
||||
Neck = 8,
|
||||
Ear = 9,
|
||||
Ear = 8,
|
||||
Neck = 9,
|
||||
Wrist = 10,
|
||||
Ring1 = 11,
|
||||
Ring2 = 12,
|
||||
SoulCrystal = 13,
|
||||
};
|
||||
|
||||
enum EquipSlotCategory :
|
||||
uint8_t
|
||||
enum GearModelSlot : int8_t
|
||||
{
|
||||
ModelInvalid = -1,
|
||||
ModelHead = 0,
|
||||
ModelBody = 1,
|
||||
ModelHands = 2,
|
||||
ModelLegs = 3,
|
||||
ModelFeet = 4,
|
||||
ModelEar = 5,
|
||||
ModelNeck = 6,
|
||||
ModelWrist = 7,
|
||||
ModelRing1 = 8,
|
||||
ModelRing2 = 9
|
||||
};
|
||||
|
||||
enum EquipSlotCategory : uint8_t
|
||||
{
|
||||
Unequippable = 0,
|
||||
|
||||
|
|
|
@ -358,21 +358,17 @@ void PlayerMinimal::saveAsNew()
|
|||
|
||||
g_charaDb.execute( "INSERT INTO charaitemgearset (storageId, CharacterId, "
|
||||
"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 ) + ", " +
|
||||
"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 ) + ", " +
|
||||
std::to_string( bodyUid ) + ", " +
|
||||
std::to_string( handsUid ) + ", " +
|
||||
|
|
|
@ -777,16 +777,11 @@ void Core::Entity::Player::sendModel()
|
|||
sendToInRangeSet( boost::make_shared< ModelEquipPacket >( *getAsPlayer() ), true );
|
||||
}
|
||||
|
||||
uint32_t Core::Entity::Player::getModelForSlot( Common::GearSetSlot slot )
|
||||
uint32_t Core::Entity::Player::getModelForSlot( Common::GearModelSlot slot )
|
||||
{
|
||||
return m_modelEquip[ slot ];
|
||||
}
|
||||
|
||||
void Core::Entity::Player::setModelForSlot( Common::GearSetSlot slot, uint32_t val )
|
||||
{
|
||||
m_modelEquip[ slot ] = val;
|
||||
}
|
||||
|
||||
uint64_t Core::Entity::Player::getModelMainWeapon() const
|
||||
{
|
||||
return m_modelMainWeapon;
|
||||
|
|
|
@ -345,10 +345,7 @@ public:
|
|||
const uint32_t* getModelArray() const;
|
||||
|
||||
/*! return the equipment model in a specified equipment slot */
|
||||
uint32_t getModelForSlot( Common::GearSetSlot slot );
|
||||
|
||||
/*! set the equipment model in a specified equipment slot */
|
||||
void setModelForSlot( Common::GearSetSlot slot, uint32_t val );
|
||||
uint32_t getModelForSlot( Common::GearModelSlot slot );
|
||||
|
||||
/*! add amount to the currency of type */
|
||||
void addCurrency( Common::CurrencyType type, uint32_t amount );
|
||||
|
@ -359,6 +356,10 @@ public:
|
|||
/*! return the current amount of crystals of type */
|
||||
uint32_t getCrystal( uint8_t type ) const;
|
||||
|
||||
void updateModels( Common::GearSetSlot equipSlotId, const Core::ItemPtr& pItem );
|
||||
|
||||
Common::GearModelSlot equipSlotToModelSlot( Common::GearSetSlot slot );
|
||||
|
||||
/*!
|
||||
* Collect real item handins from container
|
||||
* @param itemIds a vector of each catalog id to collect
|
||||
|
@ -963,7 +964,7 @@ private:
|
|||
|
||||
uint16_t m_classArray[25];
|
||||
uint32_t m_expArray[25];
|
||||
uint8_t m_aetheryte[16];
|
||||
uint8_t m_aetheryte[17];
|
||||
uint8_t m_unlocks[64];
|
||||
uint8_t m_orchestrion[40];
|
||||
|
||||
|
|
|
@ -140,32 +140,7 @@ void Core::Entity::Player::equipItem( Common::GearSetSlot equipSlotId, ItemPtr p
|
|||
|
||||
//g_framework.getLogger().debug( "Equipping into slot " + std::to_string( equipSlotId ) );
|
||||
|
||||
uint64_t model = pItem->getModelId1();
|
||||
uint64_t model2 = pItem->getModelId2();
|
||||
|
||||
switch( equipSlotId )
|
||||
{
|
||||
case Common::GearSetSlot::MainHand:
|
||||
m_modelMainWeapon = model;
|
||||
m_modelSubWeapon = model2;
|
||||
// TODO: add job change upon changing weapon if needed
|
||||
// equipWeapon( pItem );
|
||||
break;
|
||||
|
||||
case Common::GearSetSlot::OffHand:
|
||||
m_modelSubWeapon = model;
|
||||
break;
|
||||
|
||||
case Common::GearSetSlot::SoulCrystal:
|
||||
// TODO: add Job change on equipping crystal
|
||||
// change job
|
||||
break;
|
||||
|
||||
default: // any other slot
|
||||
m_modelEquip[ static_cast< uint8_t >( equipSlotId ) ] = static_cast< uint32_t >( model );
|
||||
break;
|
||||
|
||||
}
|
||||
updateModels( equipSlotId, pItem );
|
||||
|
||||
if( sendUpdate )
|
||||
{
|
||||
|
@ -175,9 +150,80 @@ void Core::Entity::Player::equipItem( Common::GearSetSlot equipSlotId, ItemPtr p
|
|||
}
|
||||
}
|
||||
|
||||
void Core::Entity::Player::updateModels( GearSetSlot equipSlotId, const Core::ItemPtr& pItem )
|
||||
{
|
||||
uint64_t model = pItem->getModelId1();
|
||||
uint64_t model2 = pItem->getModelId2();
|
||||
|
||||
switch( equipSlotId )
|
||||
{
|
||||
case MainHand:
|
||||
m_modelMainWeapon = model;
|
||||
m_modelSubWeapon = model2;
|
||||
// TODO: add job change upon changing weapon if needed
|
||||
// equipWeapon( pItem );
|
||||
break;
|
||||
|
||||
case OffHand:
|
||||
m_modelSubWeapon = model;
|
||||
break;
|
||||
|
||||
case SoulCrystal:
|
||||
// TODO: add Job change on equipping crystal
|
||||
// change job
|
||||
break;
|
||||
|
||||
case Waist:
|
||||
break;
|
||||
|
||||
default: // any other slot
|
||||
auto modelSlot = equipSlotToModelSlot( equipSlotId );
|
||||
if( modelSlot == GearModelSlot::ModelInvalid )
|
||||
break;
|
||||
m_modelEquip[ static_cast< uint8_t >( modelSlot ) ] = static_cast< uint32_t >( model );
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Core::Common::GearModelSlot Core::Entity::Player::equipSlotToModelSlot( Common::GearSetSlot slot )
|
||||
{
|
||||
switch( slot )
|
||||
{
|
||||
case MainHand:
|
||||
case OffHand:
|
||||
case Waist:
|
||||
case SoulCrystal:
|
||||
default:
|
||||
return GearModelSlot::ModelInvalid;
|
||||
case Head:
|
||||
return GearModelSlot::ModelHead;
|
||||
case Body:
|
||||
return GearModelSlot::ModelBody;
|
||||
case Hands:
|
||||
return GearModelSlot::ModelHands;
|
||||
case Legs:
|
||||
return GearModelSlot::ModelLegs;
|
||||
case Feet:
|
||||
return GearModelSlot::ModelFeet;
|
||||
case Neck:
|
||||
return GearModelSlot::ModelNeck;
|
||||
case Ear:
|
||||
return GearModelSlot::ModelEar;
|
||||
case Wrist:
|
||||
return GearModelSlot::ModelWrist;
|
||||
case Ring1:
|
||||
return GearModelSlot::ModelRing1;
|
||||
case Ring2:
|
||||
return GearModelSlot::ModelRing2;
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Entity::Player::unequipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem )
|
||||
{
|
||||
m_modelEquip[ static_cast< uint8_t >( equipSlotId ) ] = 0;
|
||||
auto modelSlot = equipSlotToModelSlot( equipSlotId );
|
||||
if( modelSlot != GearModelSlot::ModelInvalid )
|
||||
m_modelEquip[ static_cast< uint8_t >( modelSlot ) ] = 0;
|
||||
sendModel();
|
||||
|
||||
m_itemLevel = calculateEquippedGearItemLevel();
|
||||
|
|
|
@ -136,7 +136,6 @@ bool Core::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
|||
m_homePoint = res->getUInt8( "Homepoint" );
|
||||
|
||||
// Additional data
|
||||
|
||||
m_contentId = res->getUInt64( "ContentId" );
|
||||
m_voice = res->getUInt8( "Voice" );
|
||||
m_startTown = res->getUInt8( "StartTown" );
|
||||
|
@ -333,6 +332,9 @@ void Core::Entity::Player::updateSql()
|
|||
"EquippedMannequin 44, ConfigFlags 45, QuestCompleteFlags 46, OpeningSequence 47, "
|
||||
"QuestTracking 48, GrandCompany 49, GrandCompanyRank 50, Discovery 51, GMRank 52, Unlocks 53, "
|
||||
"CFPenaltyUntil 54, Pose 55"*/
|
||||
|
||||
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_UP );
|
||||
|
||||
stmt->setInt( 1, getHp() );
|
||||
|
@ -605,7 +607,7 @@ bool Core::Entity::Player::loadInventory()
|
|||
{
|
||||
uint16_t storageId = res->getUInt16( 1 );
|
||||
|
||||
for( uint32_t i = 1; i <= 14; i++ )
|
||||
for( uint32_t i = 1; i <= 13; i++ )
|
||||
{
|
||||
uint64_t uItemId = res->getUInt64( i + 1 );
|
||||
if( uItemId == 0 )
|
||||
|
|
|
@ -263,16 +263,6 @@ void Core::DebugCommandHandler::set( char* data, Entity::Player& player, boost::
|
|||
player.setEorzeaTimeOffset( timestamp );
|
||||
player.sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) );
|
||||
}
|
||||
else if( subCommand == "model" )
|
||||
{
|
||||
uint32_t slot;
|
||||
uint32_t val;
|
||||
sscanf( params.c_str(), "%d %d", &slot, &val );
|
||||
|
||||
player.setModelForSlot( static_cast< Common::GearSetSlot >( slot ), val );
|
||||
player.sendModel();
|
||||
player.sendDebug( "Model updated" );
|
||||
}
|
||||
else if( subCommand == "mount" )
|
||||
{
|
||||
int32_t id;
|
||||
|
|
|
@ -49,8 +49,17 @@ private:
|
|||
m_data.secWeaponModel = pTarget->getModelSubWeapon();
|
||||
|
||||
memcpy( m_data.look, pTarget->getLookArray(), sizeof( m_data.look ) );
|
||||
for( auto i = 2; i < Common::GearSetSlot::SoulCrystal; ++i )
|
||||
m_data.models[ i - 2 ] = pTarget->getModelForSlot( static_cast< Common::GearSetSlot >( i ) );
|
||||
|
||||
m_data.models[ Common::GearModelSlot::ModelHead ] = player.getModelForSlot( Common::GearModelSlot::ModelHead );
|
||||
m_data.models[ Common::GearModelSlot::ModelBody ] = player.getModelForSlot( Common::GearModelSlot::ModelBody );
|
||||
m_data.models[ Common::GearModelSlot::ModelHands ] = player.getModelForSlot( Common::GearModelSlot::ModelHands );
|
||||
m_data.models[ Common::GearModelSlot::ModelLegs ] = player.getModelForSlot( Common::GearModelSlot::ModelLegs );
|
||||
m_data.models[ Common::GearModelSlot::ModelFeet ] = player.getModelForSlot( Common::GearModelSlot::ModelFeet );
|
||||
m_data.models[ Common::GearModelSlot::ModelNeck ] = player.getModelForSlot( Common::GearModelSlot::ModelNeck );
|
||||
m_data.models[ Common::GearModelSlot::ModelEar ] = player.getModelForSlot( Common::GearModelSlot::ModelEar );
|
||||
m_data.models[ Common::GearModelSlot::ModelRing1 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing1 );
|
||||
m_data.models[ Common::GearModelSlot::ModelRing2 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing2 );
|
||||
m_data.models[ Common::GearModelSlot::ModelWrist ] = player.getModelForSlot( Common::GearModelSlot::ModelWrist );
|
||||
|
||||
// todo: main/sub/other stuff too
|
||||
|
||||
|
|
|
@ -28,11 +28,16 @@ private:
|
|||
{
|
||||
m_data.mainWeapon = player.getModelMainWeapon();
|
||||
m_data.offWeapon = player.getModelSubWeapon();
|
||||
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 );
|
||||
m_data.models[ Common::GearModelSlot::ModelHead ] = player.getModelForSlot( Common::GearModelSlot::ModelHead );
|
||||
m_data.models[ Common::GearModelSlot::ModelBody ] = player.getModelForSlot( Common::GearModelSlot::ModelBody );
|
||||
m_data.models[ Common::GearModelSlot::ModelHands ] = player.getModelForSlot( Common::GearModelSlot::ModelHands );
|
||||
m_data.models[ Common::GearModelSlot::ModelLegs ] = player.getModelForSlot( Common::GearModelSlot::ModelLegs );
|
||||
m_data.models[ Common::GearModelSlot::ModelFeet ] = player.getModelForSlot( Common::GearModelSlot::ModelFeet );
|
||||
m_data.models[ Common::GearModelSlot::ModelNeck ] = player.getModelForSlot( Common::GearModelSlot::ModelNeck );
|
||||
m_data.models[ Common::GearModelSlot::ModelEar ] = player.getModelForSlot( Common::GearModelSlot::ModelEar );
|
||||
m_data.models[ Common::GearModelSlot::ModelRing1 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing1 );
|
||||
m_data.models[ Common::GearModelSlot::ModelRing2 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing2 );
|
||||
m_data.models[ Common::GearModelSlot::ModelWrist ] = player.getModelForSlot( Common::GearModelSlot::ModelWrist );
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -51,8 +51,16 @@ private:
|
|||
m_data.mainWeaponModel = item->getModelId1();
|
||||
m_data.secWeaponModel = player.getModelSubWeapon();
|
||||
|
||||
for( auto i = 2; i < Common::GearSetSlot::SoulCrystal; ++i )
|
||||
m_data.models[ i - 2 ] = player.getModelForSlot( static_cast< Common::GearSetSlot >( i ) );
|
||||
m_data.models[ Common::GearModelSlot::ModelHead ] = player.getModelForSlot( Common::GearModelSlot::ModelHead );
|
||||
m_data.models[ Common::GearModelSlot::ModelBody ] = player.getModelForSlot( Common::GearModelSlot::ModelBody );
|
||||
m_data.models[ Common::GearModelSlot::ModelHands ] = player.getModelForSlot( Common::GearModelSlot::ModelHands );
|
||||
m_data.models[ Common::GearModelSlot::ModelLegs ] = player.getModelForSlot( Common::GearModelSlot::ModelLegs );
|
||||
m_data.models[ Common::GearModelSlot::ModelFeet ] = player.getModelForSlot( Common::GearModelSlot::ModelFeet );
|
||||
m_data.models[ Common::GearModelSlot::ModelNeck ] = player.getModelForSlot( Common::GearModelSlot::ModelNeck );
|
||||
m_data.models[ Common::GearModelSlot::ModelEar ] = player.getModelForSlot( Common::GearModelSlot::ModelEar );
|
||||
m_data.models[ Common::GearModelSlot::ModelRing1 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing1 );
|
||||
m_data.models[ Common::GearModelSlot::ModelRing2 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing2 );
|
||||
m_data.models[ Common::GearModelSlot::ModelWrist ] = player.getModelForSlot( Common::GearModelSlot::ModelWrist );
|
||||
|
||||
strcpy( m_data.name, player.getName().c_str() );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue