1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-03 17:27:47 +00:00

Fixed stateFlags, opening cutscene and starting gear display

This commit is contained in:
Mordred 2021-11-28 23:56:36 +01:00
parent 4e776bd5f9
commit f4b5afe6dc
4 changed files with 74 additions and 55 deletions

View file

@ -209,7 +209,6 @@ void PlayerMinimal::saveAsNew()
uint32_t equipModel[10]; uint32_t equipModel[10];
memset( equipModel, 0, 40 ); memset( equipModel, 0, 40 );
memcpy( modelEquip.data(), equipModel, modelEquip.size() );
uint32_t startZone; uint32_t startZone;
float x, y, z, o; float x, y, z, o;
@ -257,49 +256,6 @@ void PlayerMinimal::saveAsNew()
break; break;
} }
// "(AccountId, CharacterId, EntityId, Name, Hp, Mp, "
// "Customize, Voice, IsNewGame, TerritoryType, PosX, PosY, PosZ, PosR, ModelEquip, "
// "IsNewAdventurer, GuardianDeity, Birthday, BirthMonth, Class, Status, FirstClass, "
// "HomePoint, StartTown, Discovery, HowTo, QuestCompleteFlags, Unlocks, QuestTracking, "
// "Aetheryte, GMRank, UPDATE_DATE )
auto stmt = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_INS );
stmt->set( 1, m_accountId );
stmt->set( 2, m_characterId );
stmt->set( 3, m_id );
stmt->setString( 4, std::string( m_name ) );
stmt->setInt( 5, 100 );
stmt->setInt( 6, 100 );
stmt->setBinary( 7, customize );
stmt->setInt( 8, m_voice );
stmt->setInt( 9, 1 );
stmt->setInt( 10, startZone );
stmt->setDouble( 11, x );
stmt->setDouble( 12, y );
stmt->setDouble( 13, z );
stmt->setDouble( 14, o );
stmt->setBinary( 15, modelEquip );
stmt->setInt( 16, 1 );
stmt->setInt( 17, m_guardianDeity );
stmt->setInt( 18, m_birthDay );
stmt->setInt( 19, m_birthMonth );
stmt->setInt( 20, m_class );
stmt->setInt( 21, 1 );
stmt->setInt( 22, m_class );
stmt->setInt( 23, homePoint );
stmt->setInt( 24, startTown );
stmt->setBinary( 25, discovery );
stmt->setBinary( 26, howTo );
stmt->setBinary( 27, questComplete );
stmt->setBinary( 28, unlocks );
stmt->setBinary( 29, questTracking8 );
stmt->setBinary( 30, aetherytes );
stmt->setInt( 31, m_gmRank );
stmt->setBinary( 32, mountGuide );
stmt->setBinary( 33, orchestrion );
g_charaDb.directExecute( stmt );
// CharacterId, ClassIdx, Exp, Lvl // CharacterId, ClassIdx, Exp, Lvl
auto stmtClass = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_INS ); auto stmtClass = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_INS );
stmtClass->setUInt64( 1, m_characterId ); stmtClass->setUInt64( 1, m_characterId );
@ -369,6 +325,19 @@ void PlayerMinimal::saveAsNew()
legs = raceInfo->data().Leg[ gender ]; legs = raceInfo->data().Leg[ gender ];
feet = raceInfo->data().Foot[ gender ]; feet = raceInfo->data().Foot[ gender ];
auto mainWeaponInfo = g_exdData.getRow< Component::Excel::Item >( weaponId );
auto bodyInfo = g_exdData.getRow< Component::Excel::Item >( body );
auto handsInfo = g_exdData.getRow< Component::Excel::Item >( hands );
auto legsInfo = g_exdData.getRow< Component::Excel::Item >( legs );
auto feetInfo = g_exdData.getRow< Component::Excel::Item >( feet );
uint64_t modelMainWeapon = mainWeaponInfo->data().ModelId;
equipModel[ GearModelSlot::ModelBody ] = static_cast< uint32_t >( bodyInfo->data().ModelId );
equipModel[ GearModelSlot::ModelHands ] = static_cast< uint32_t >( handsInfo->data().ModelId );
equipModel[ GearModelSlot::ModelLegs ] = static_cast< uint32_t >( legsInfo->data().ModelId );
equipModel[ GearModelSlot::ModelFeet ] = static_cast< uint32_t >( feetInfo->data().ModelId );
insertDbGlobalItem( weaponId, uniqueId ); insertDbGlobalItem( weaponId, uniqueId );
insertDbGlobalItem( body, bodyUid ); insertDbGlobalItem( body, bodyUid );
insertDbGlobalItem( hands, handsUid ); insertDbGlobalItem( hands, handsUid );
@ -399,6 +368,53 @@ void PlayerMinimal::saveAsNew()
std::to_string( 0 ) + ", " + std::to_string( 0 ) + ", " +
std::to_string( 0 ) + ", NOW());" ); std::to_string( 0 ) + ", NOW());" );
// "(AccountId, CharacterId, EntityId, Name, Hp, Mp, "
// "Customize, Voice, IsNewGame, TerritoryType, PosX, PosY, PosZ, PosR, ModelEquip, "
// "IsNewAdventurer, GuardianDeity, Birthday, BirthMonth, Class, Status, FirstClass, "
// "HomePoint, StartTown, Discovery, HowTo, QuestCompleteFlags, Unlocks, QuestTracking, "
// "Aetheryte, GMRank, UPDATE_DATE )
memcpy( modelEquip.data(), equipModel, modelEquip.size() );
auto stmt = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_INS );
stmt->set( 1, m_accountId );
stmt->set( 2, m_characterId );
stmt->set( 3, m_id );
stmt->setString( 4, std::string( m_name ) );
stmt->setInt( 5, 100 );
stmt->setInt( 6, 100 );
stmt->setBinary( 7, customize );
stmt->setInt( 8, m_voice );
stmt->setInt( 9, 1 );
stmt->setInt( 10, startZone );
stmt->setDouble( 11, x );
stmt->setDouble( 12, y );
stmt->setDouble( 13, z );
stmt->setDouble( 14, o );
stmt->setBinary( 15, modelEquip );
stmt->setInt( 16, 1 );
stmt->setInt( 17, m_guardianDeity );
stmt->setInt( 18, m_birthDay );
stmt->setInt( 19, m_birthMonth );
stmt->setInt( 20, m_class );
stmt->setInt( 21, 1 );
stmt->setInt( 22, m_class );
stmt->setInt( 23, homePoint );
stmt->setInt( 24, startTown );
stmt->setBinary( 25, discovery );
stmt->setBinary( 26, howTo );
stmt->setBinary( 27, questComplete );
stmt->setBinary( 28, unlocks );
stmt->setBinary( 29, questTracking8 );
stmt->setBinary( 30, aetherytes );
stmt->setInt( 31, m_gmRank );
stmt->setBinary( 32, mountGuide );
stmt->setBinary( 33, orchestrion );
stmt->set( 34, modelMainWeapon );
g_charaDb.directExecute( stmt );
} }
void PlayerMinimal::insertDbGlobalItem( uint32_t itemId, uint64_t uniqueId ) const void PlayerMinimal::insertDbGlobalItem( uint32_t itemId, uint64_t uniqueId ) const

View file

@ -1022,16 +1022,16 @@ namespace Sapphire::Common
enum PlayerStateFlag : uint8_t enum PlayerStateFlag : uint8_t
{ {
HideUILockChar = 0, // as the name suggests, hides the ui and logs the char... HideUILockChar = 16, // as the name suggests, hides the ui and logs the char...
InCombat = 1, // in Combat, locks gearchange/return/teleport InCombat = 17, // in Combat, locks gearchange/return/teleport
Casting = 2, Casting = 18,
InNpcEvent = 7, // when talking to an npc, locks ui giving "occupied" message InNpcEvent = 23, // when talking to an npc, locks ui giving "occupied" message
InNpcEvent1 = 10, // Sent together with InNpcEvent, when waiting for input? just a guess... // InNpcEvent1 = 10, // Sent together with InNpcEvent, when waiting for input? just a guess...
BoundByDuty = 22, BoundByDuty = 26,
BetweenAreas = 33, BetweenAreas = 37,
WatchingCutscene = 46, // this is actually just a dummy, this id is different WatchingCutscene = 51, // this is actually just a dummy, this id is different
}; };

View file

@ -64,8 +64,8 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
"Customize, Voice, IsNewGame, TerritoryType, PosX, PosY, PosZ, PosR, ModelEquip, " "Customize, Voice, IsNewGame, TerritoryType, PosX, PosY, PosZ, PosR, ModelEquip, "
"IsNewAdventurer, GuardianDeity, Birthday, BirthMonth, Class, Status, FirstClass, " "IsNewAdventurer, GuardianDeity, Birthday, BirthMonth, Class, Status, FirstClass, "
"HomePoint, StartTown, Discovery, HowTo, QuestCompleteFlags, Unlocks, QuestTracking, " "HomePoint, StartTown, Discovery, HowTo, QuestCompleteFlags, Unlocks, QuestTracking, "
"Aetheryte, GMRank, Mounts, Orchestrion, UPDATE_DATE ) " "Aetheryte, GMRank, Mounts, Orchestrion, ModelMainWeapon, UPDATE_DATE ) "
"VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW() );", "VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW() );",
CONNECTION_SYNC ); CONNECTION_SYNC );
prepareStatement( CHARA_UP_NAME, "UPDATE charainfo SET Name = ? WHERE CharacterId = ?;", CONNECTION_ASYNC ); prepareStatement( CHARA_UP_NAME, "UPDATE charainfo SET Name = ? WHERE CharacterId = ?;", CONNECTION_ASYNC );

View file

@ -145,6 +145,9 @@ void Sapphire::World::WorldServer::run( int32_t argc, char* argv[] )
} }
Common::Service< Data::ExdData >::set( pExdData ); Common::Service< Data::ExdData >::set( pExdData );
// auto aetherInfo = pExdData->getRow< Component::Excel::ClassJob >( 2 );
// auto aetherInfo1 = pExdData->getRow< Component::Excel::ClassJob >( 3 );
auto pDb = std::make_shared< Db::DbWorkerPool< Db::ZoneDbConnection > >(); auto pDb = std::make_shared< Db::DbWorkerPool< Db::ZoneDbConnection > >();
Sapphire::Db::DbLoader loader; Sapphire::Db::DbLoader loader;
loader.addDb( *pDb, m_config.global.database ); loader.addDb( *pDb, m_config.global.database );