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

View File

@ -8522,7 +8522,7 @@ void command_summonburriedplayercorpse(Client *c, const Seperator *sep)
return;
}
Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(t->CharacterID(), t->GetZoneID(), zone->GetInstanceID(), t->GetX(), t->GetY(), t->GetZ(), t->GetHeading());
Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(t->CharacterID(), t->GetZoneID(), zone->GetInstanceID(), t->GetPosition());
if(!PlayerCorpse)
c->Message(0, "Your target doesn't have any burried corpses.");

View File

@ -1740,7 +1740,7 @@ bool QuestManager::summonburriedplayercorpse(uint32 char_id, const xyz_heading&
if(char_id <= 0)
return false;
Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(char_id, zone->GetZoneID(), zone->GetInstanceID(), position.m_X, position.m_Y, position.m_Z, position.m_Heading);
Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(char_id, zone->GetZoneID(), zone->GetInstanceID(), position);
if(!PlayerCorpse)
return false;

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) {

View File

@ -297,7 +297,7 @@ public:
uint32 GetCharacterCorpseItemCount(uint32 corpse_id);
bool LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs);
Corpse* LoadCharacterCorpse(uint32 player_corpse_id);
Corpse* SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading);
Corpse* SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, const xyz_heading& position);
void MarkCorpseAsRezzed(uint32 dbid);
bool GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes);
bool BuryCharacterCorpse(uint32 dbid);