SummonBuriedCharacterCorpses converted to xyz_heading

This commit is contained in:
Arthur Ice
2014-12-02 12:04:21 -08:00
parent efc4ba0e27
commit dd5265dc02
4 changed files with 24 additions and 22 deletions
+21 -19
View File
@@ -3771,37 +3771,39 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct
return true;
}
Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) {
Corpse* NewCorpse = 0;
std::string query = StringFormat(
"SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 1 ORDER BY `time_of_death` LIMIT 1",
char_id
);
Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, const xyz_heading& position) {
Corpse* corpse = nullptr;
std::string query = StringFormat("SELECT `id`, `charname`, `time_of_death`, `is_rezzed` "
"FROM `character_corpses` "
"WHERE `charid` = '%u' AND `is_buried` = 1 "
"ORDER BY `time_of_death` LIMIT 1",
char_id);
auto results = QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) {
NewCorpse = Corpse::LoadFromDBData(
corpse = Corpse::LoadFromDBData(
atoll(row[0]), // uint32 in_dbid
char_id, // uint32 in_charid
row[1], // char* in_charname
dest_x, // float in_x
dest_y, // float in_y
dest_z, // float in_z
dest_heading, // float in_heading
position.m_X, // float in_x
position.m_Y, // float in_y
position.m_Z, // float in_z
position.m_Heading, // float in_heading
row[2], // char* time_of_death
atoi(row[3]) == 1, // bool rezzed
false // bool was_at_graveyard
);
if (NewCorpse) {
entity_list.AddCorpse(NewCorpse);
NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS));
NewCorpse->Spawn();
if (!UnburyCharacterCorpse(NewCorpse->GetDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading))
LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id);
}
if (!corpse)
continue;
entity_list.AddCorpse(corpse);
corpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS));
corpse->Spawn();
if (!UnburyCharacterCorpse(corpse->GetDBID(), dest_zone_id, dest_instance_id, position.m_X, position.m_Y, position.m_Z, position.m_Heading))
LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id);
}
return NewCorpse;
return corpse;
}
bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) {