diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 8843fb988..038bf6332 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -553,18 +553,6 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recv_data) LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%u' AND realmid = '%u'", GetAccountId(), realmID); LoginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charcount, GetAccountId(), realmID); - result = WorldDatabase.PQuery("SELECT phaseMap FROM playercreateinfo WHERE race = '%u' AND class = '%u'", race_, class_); - if(result) - { - Field* field = result->Fetch(); - uint16 mapId = field[0].GetUInt16(); - - if (mapId != 0) - CharacterDatabase.PExecute("INSERT INTO character_phase_data (`guid`, `map`) VALUES (%u, %u)", pNewChar->GetGUIDLow(), mapId); - - delete result; - } - data << (uint8)CHAR_CREATE_SUCCESS; SendPacket(&data); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 5ecd848bd..27b986026 100755 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -2721,8 +2721,8 @@ void ObjectMgr::LoadPlayerInfo() { // Load playercreate { - // 0 1 2 3 4 5 6 - QueryResult* result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation FROM playercreateinfo"); + // 0 1 2 3 4 5 6 7 8 + QueryResult* result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation, phaseMap FROM playercreateinfo"); uint32 count = 0; @@ -2751,6 +2751,7 @@ void ObjectMgr::LoadPlayerInfo() float positionY = fields[5].GetFloat(); float positionZ = fields[6].GetFloat(); float orientation = fields[7].GetFloat(); + uint16 phaseMap = fields[8].GetUInt16(); ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) @@ -2787,6 +2788,7 @@ void ObjectMgr::LoadPlayerInfo() pInfo->positionY = positionY; pInfo->positionZ = positionZ; pInfo->orientation = orientation; + pInfo->phaseMap = phaseMap; pInfo->displayId_m = rEntry->model_m; pInfo->displayId_f = rEntry->model_f; diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 42685a0a7..3459d609c 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1190,7 +1190,7 @@ void InitializeOpcodes() //OPCODE(CMSG_REQUEST_VEHICLE_SWITCH_SEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); //OPCODE(CMSG_PET_LEARN_TALENT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandlePetLearnTalent ); //OPCODE(CMSG_PET_UNLEARN_TALENTS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); - OPCODE(SMSG_PHASE_SHIFT_CHANGE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); + OPCODE(SMSG_SET_PHASE_SHIFT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); OPCODE(SMSG_ALL_ACHIEVEMENT_DATA, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //OPCODE(CMSG_FORCE_SAY_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); //OPCODE(SMSG_HEALTH_UPDATE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 85830fb0f..a77b5689f 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1184,7 +1184,7 @@ enum Opcodes CMSG_REQUEST_VEHICLE_SWITCH_SEAT = 0x147A, CMSG_PET_LEARN_TALENT = 0x147B, CMSG_PET_UNLEARN_TALENTS = 0x147C, - SMSG_PHASE_SHIFT_CHANGE = 0x70A0, // 4.3.4 15595 + SMSG_SET_PHASE_SHIFT = 0x70A0, // 4.3.4 15595 SMSG_ALL_ACHIEVEMENT_DATA = 0x58B1, // 4.3.4 15595 CMSG_FORCE_SAY_CHEAT = 0x147F, SMSG_HEALTH_UPDATE = 0x1480, diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 3b2ab883e..c2a7254a4 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -846,6 +846,9 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c } // all item positions resolved + if (info->phaseMap != 0) + CharacterDatabase.PExecute("REPLACE INTO `character_phase_data` (`guid`, `map`) VALUES (%u, %u)", guidlow, info->phaseMap); + return true; } @@ -15371,9 +15374,8 @@ void Player::SendQuestReward(Quest const* pQuest, uint32 XP, Object* questGiver) { for (QuestPhaseMapsVector::const_iterator itr = QuestPhaseVector->begin(); itr != QuestPhaseVector->end(); ++itr) { - GetSession()->SendSetPhaseShift(itr->MapId, itr->PhaseMask); - CharacterDatabase.PExecute("DELETE FROM character_phase_data` WHERE `guid` = %u", GetSession()->GetPlayer()->GetGUIDLow()); - CharacterDatabase.PExecute("INSERT INTO character_phase_data` (`guid`, `map`, `phase`) VALUES (%u, %u, %u)", GetSession()->GetPlayer()->GetGUIDLow(), itr->MapId, itr->PhaseMask); + GetSession()->SendSetPhaseShift(itr->PhaseMask, itr->MapId); + CharacterDatabase.PExecute("REPLACE INTO character_phase_data` (`guid`, `map`, `phase`) VALUES (%u, %u, %u)", GetSession()->GetPlayer()->GetGUIDLow(), itr->MapId, itr->PhaseMask); } } } diff --git a/src/game/Player.h b/src/game/Player.h index 0d531d9f5..56b1f7e0f 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -299,6 +299,7 @@ struct PlayerInfo float positionY; float positionZ; float orientation; + uint16 phaseMap; uint16 displayId_m; uint16 displayId_f; PlayerCreateInfoItems item; diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index d552f9541..16378738f 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -572,8 +572,6 @@ void WorldSession::SendNotification(int32 string_id, ...) void WorldSession::SendSetPhaseShift(uint32 phaseMask, uint16 mapId) { ObjectGuid guid = _player->GetObjectGuid(); - uint8 guidMask[] = { 2, 3, 1, 6, 4, 5, 0, 7 }; - uint8 guidBytes[] = { 1, 2, 6, 3, 0, 5 }; uint32 phaseFlags = 0; @@ -589,7 +587,7 @@ void WorldSession::SendSetPhaseShift(uint32 phaseMask, uint16 mapId) } } - WorldPacket data(SMSG_PHASE_SHIFT_CHANGE, 30); + WorldPacket data(SMSG_SET_PHASE_SHIFT, 30); data.WriteGuidMask<2, 3, 1, 6, 4, 5, 0, 7>(guid); data.WriteGuidBytes<7, 4>(guid); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7677648ec..8dbe62a35 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "0029" + #define REVISION_NR "0031" #endif // __REVISION_NR_H__