aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rw-r--r--src/server/game/Maps/Map.cpp52
1 files changed, 33 insertions, 19 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index b96fb726d50..bd844ac6329 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -18,6 +18,7 @@
#include "Map.h"
#include "Battleground.h"
#include "CellImpl.h"
+#include "CharacterPackets.h"
#include "Conversation.h"
#include "DatabaseEnv.h"
#include "DisableMgr.h"
@@ -4777,16 +4778,26 @@ time_t Map::GetLinkedRespawnTime(ObjectGuid guid) const
void Map::LoadCorpseData()
{
+ CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES);
+ stmt->setUInt32(0, GetId());
+ stmt->setUInt32(1, GetInstanceId());
+
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+ // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, guid FROM corpse WHERE mapId = ? AND instanceId = ?
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ if (!result)
+ return;
+
std::unordered_map<ObjectGuid::LowType, std::unordered_set<uint32>> phases;
+ std::unordered_map<ObjectGuid::LowType, std::vector<UF::ChrCustomizationChoice>> customizations;
- CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSE_PHASES);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSE_PHASES);
stmt->setUInt32(0, GetId());
stmt->setUInt32(1, GetInstanceId());
// 0 1
// SELECT OwnerGuid, PhaseId FROM corpse_phases cp LEFT JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ? AND c.instanceId = ?
- PreparedQueryResult phaseResult = CharacterDatabase.Query(stmt);
- if (phaseResult)
+ if (PreparedQueryResult phaseResult = CharacterDatabase.Query(stmt))
{
do
{
@@ -4799,15 +4810,23 @@ void Map::LoadCorpseData()
} while (phaseResult->NextRow());
}
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES);
- stmt->setUInt32(0, GetId());
- stmt->setUInt32(1, GetInstanceId());
+ // 0 1 2
+ // SELECT cc.ownerGuid, cc.chrCustomizationOptionID, cc.chrCustomizationChoiceID FROM corpse_customizations cc LEFT JOIN corpse c ON cc.ownerGuid = c.guid WHERE c.mapId = ? AND c.instanceId = ?
+ if (PreparedQueryResult customizationResult = CharacterDatabase.Query(stmt))
+ {
+ do
+ {
+ Field* fields = customizationResult->Fetch();
+ ObjectGuid::LowType guid = fields[0].GetUInt64();
+ std::vector<UF::ChrCustomizationChoice>& customizationsForCorpse = customizations[guid];
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
- // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, guid FROM corpse WHERE mapId = ? AND instanceId = ?
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
- if (!result)
- return;
+ customizationsForCorpse.emplace_back();
+ UF::ChrCustomizationChoice& choice = customizationsForCorpse.back();
+ choice.ChrCustomizationOptionID = fields[1].GetUInt32();
+ choice.ChrCustomizationChoiceID = fields[2].GetUInt32();
+
+ } while (customizationResult->NextRow());
+ }
do
{
@@ -4830,6 +4849,8 @@ void Map::LoadCorpseData()
for (uint32 phaseId : phases[guid])
PhasingHandler::AddPhase(corpse, phaseId, false);
+ corpse->SetCustomizations(Trinity::Containers::MakeIteratorPair(customizations[guid].begin(), customizations[guid].end()));
+
AddCorpse(corpse);
} while (result->NextRow());
@@ -4907,19 +4928,12 @@ Corpse* Map::ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia /*=
bones->SetDisplayId(corpse->m_corpseData->DisplayID);
bones->SetRace(corpse->m_corpseData->RaceID);
bones->SetSex(corpse->m_corpseData->Sex);
- bones->SetSkin(corpse->m_corpseData->SkinID);
- bones->SetFace(corpse->m_corpseData->FaceID);
- bones->SetHairStyle(corpse->m_corpseData->HairStyleID);
- bones->SetHairColor(corpse->m_corpseData->HairColorID);
- bones->SetFacialHairStyle(corpse->m_corpseData->FacialHairStyleID);
+ bones->SetCustomizations(Trinity::Containers::MakeIteratorPair(corpse->m_corpseData->Customizations.begin(), corpse->m_corpseData->Customizations.end()));
bones->SetFlags(corpse->m_corpseData->Flags | CORPSE_FLAG_BONES);
bones->SetFactionTemplate(corpse->m_corpseData->FactionTemplate);
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
bones->SetItem(i, corpse->m_corpseData->Items[i]);
- for (uint32 i = 0; i < PLAYER_CUSTOM_DISPLAY_SIZE; ++i)
- bones->SetCustomDisplayOption(i, corpse->m_corpseData->CustomDisplayOption[i]);
-
bones->SetCellCoord(corpse->GetCellCoord());
bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());