diff --git a/src/api/PlayerMinimal.cpp b/src/api/PlayerMinimal.cpp index 92487416..f11dab46 100644 --- a/src/api/PlayerMinimal.cpp +++ b/src/api/PlayerMinimal.cpp @@ -209,7 +209,6 @@ void PlayerMinimal::saveAsNew() uint32_t equipModel[10]; memset( equipModel, 0, 40 ); - memcpy( modelEquip.data(), equipModel, modelEquip.size() ); uint32_t startZone; float x, y, z, o; @@ -257,49 +256,6 @@ void PlayerMinimal::saveAsNew() 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 auto stmtClass = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_INS ); stmtClass->setUInt64( 1, m_characterId ); @@ -347,7 +303,7 @@ void PlayerMinimal::saveAsNew() /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// SETUP EQUIPMENT / STARTING GEAR auto classJobInfo = g_exdData.getRow< Component::Excel::ClassJob >( m_class ); - uint32_t weaponId = classJobInfo->data().InitWeapon[0]; + uint32_t weaponId = classJobInfo->data().InitWeapon[ 0 ]; uint64_t uniqueId = getNextUId64(); uint8_t race = customize[ CharaLook::Race ]; @@ -369,6 +325,19 @@ void PlayerMinimal::saveAsNew() legs = raceInfo->data().Leg[ 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( body, bodyUid ); insertDbGlobalItem( hands, handsUid ); @@ -399,6 +368,53 @@ void PlayerMinimal::saveAsNew() std::to_string( 0 ) + ", " + 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 diff --git a/src/common/Common.h b/src/common/Common.h index 9a47b41e..888f0123 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -1022,16 +1022,16 @@ namespace Sapphire::Common enum PlayerStateFlag : uint8_t { - HideUILockChar = 0, // as the name suggests, hides the ui and logs the char... - InCombat = 1, // in Combat, locks gearchange/return/teleport - Casting = 2, - InNpcEvent = 7, // when talking to an npc, locks ui giving "occupied" message + HideUILockChar = 16, // as the name suggests, hides the ui and logs the char... + InCombat = 17, // in Combat, locks gearchange/return/teleport + Casting = 18, + 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, - BetweenAreas = 33, - WatchingCutscene = 46, // this is actually just a dummy, this id is different + BoundByDuty = 26, + BetweenAreas = 37, + WatchingCutscene = 51, // this is actually just a dummy, this id is different }; diff --git a/src/common/Database/ZoneDbConnection.cpp b/src/common/Database/ZoneDbConnection.cpp index 982c59c8..8cf5b8fe 100644 --- a/src/common/Database/ZoneDbConnection.cpp +++ b/src/common/Database/ZoneDbConnection.cpp @@ -64,8 +64,8 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements() "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, Mounts, Orchestrion, UPDATE_DATE ) " - "VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW() );", + "Aetheryte, GMRank, Mounts, Orchestrion, ModelMainWeapon, UPDATE_DATE ) " + "VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW() );", CONNECTION_SYNC ); prepareStatement( CHARA_UP_NAME, "UPDATE charainfo SET Name = ? WHERE CharacterId = ?;", CONNECTION_ASYNC ); diff --git a/src/world/WorldServer.cpp b/src/world/WorldServer.cpp index 064473c4..b7a9d310 100644 --- a/src/world/WorldServer.cpp +++ b/src/world/WorldServer.cpp @@ -145,6 +145,9 @@ void Sapphire::World::WorldServer::run( int32_t argc, char* argv[] ) } 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 > >(); Sapphire::Db::DbLoader loader; loader.addDb( *pDb, m_config.global.database );