diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 766c70345..8f8d6a4e1 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -63,7 +63,7 @@ void Corpse::SendLootReqErrorPacket(Client* client, uint8 response) { safe_delete(outapp); } -Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard) +Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, const xyz_heading& position, std::string time_of_death, bool rezzed, bool was_at_graveyard) { uint32 item_count = database.GetCharacterCorpseItemCount(in_dbid); char *buffer = new char[sizeof(PlayerCorpse_Struct) + (item_count * sizeof(player_lootitem::ServerLootItem_Struct))]; @@ -90,10 +90,10 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_ pcs->silver, // uint32 in_silver pcs->gold, // uint32 in_gold pcs->plat, // uint32 in_plat - in_x, // float in_x - in_y, // float in_y - in_z, // float in_z - in_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 pcs->size, // float in_size pcs->gender, // uint8 in_gender pcs->race, // uint16 in_race diff --git a/zone/corpse.h b/zone/corpse.h index f365dd041..ba2dfbecc 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -30,18 +30,18 @@ class Corpse : public Mob { public: static void SendEndLootErrorPacket(Client* client); - static void SendLootReqErrorPacket(Client* client, uint8 response = 2); - + static void SendLootReqErrorPacket(Client* client, uint8 response = 2); + Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000); Corpse(Client* client, int32 in_rezexp); Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false); ~Corpse(); - static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard); + static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, const xyz_heading& position, std::string time_of_death, bool rezzed, bool was_at_graveyard); //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; } - virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, + virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; } virtual bool HasRaid() { return false; } virtual bool HasGroup() { return false; } @@ -119,7 +119,7 @@ protected: std::list MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot); private: - bool is_player_corpse; + bool is_player_corpse; bool is_corpse_changed; bool is_locked; int32 player_kill_item; @@ -137,7 +137,7 @@ private: bool can_rez; bool become_npc; int allowed_looters[MAX_LOOTERS]; // People allowed to loot the corpse, character id - Timer corpse_decay_timer; + Timer corpse_decay_timer; Timer corpse_res_timer; Timer corpse_delay_timer; Timer corpse_graveyard_timer; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7b8cb2d6d..239608473 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3785,10 +3785,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z atoll(row[0]), // uint32 in_dbid char_id, // uint32 in_charid row[1], // char* in_charname - position.m_X, // float in_x - position.m_Y, // float in_y - position.m_Z, // float in_z - position.m_Heading, // float in_heading + position, row[2], // char* time_of_death atoi(row[3]) == 1, // bool rezzed false // bool was_at_graveyard @@ -3827,10 +3824,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id atoll(row[0]), char_id, row[1], - position.m_X, - position.m_Y, - position.m_Z, - position.m_Heading, + position, row[2], atoi(row[3]) == 1, false); @@ -3868,14 +3862,12 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { ); auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { + auto position = xyz_heading(atof(row[3]), atof(row[4]), atof(row[5]), atof(row[6])); NewCorpse = Corpse::LoadFromDBData( atoll(row[0]), // id uint32 in_dbid atoll(row[1]), // charid uint32 in_charid row[2], // char_name - atof(row[3]), // x float in_x - atof(row[4]), // y float in_y - atof(row[5]), // z float in_z - atof(row[6]), // heading float in_heading + position, row[7], // time_of_death char* time_of_death atoi(row[8]) == 1, // is_rezzed bool rezzed atoi(row[9]) // was_at_graveyard bool was_at_graveyard @@ -3896,26 +3888,13 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - // std::cout << row[0] << std::endl; - // std::cout << row[1] << std::endl; - // std::cout << row[2] << std::endl; - // std::cout << row[3] << std::endl; - // std::cout << row[4] << std::endl; - // std::cout << row[5] << std::endl; - // std::cout << row[6] << std::endl; - // std::cout << row[7] << std::endl; - // std::cout << row[8] << std::endl; - // std::cout << row[9] << std::endl; - + auto position = xyz_heading(atof(row[3]), atof(row[4]), atof(row[5]), atof(row[6])); entity_list.AddCorpse( Corpse::LoadFromDBData( atoll(row[0]), // id uint32 in_dbid atoll(row[1]), // charid uint32 in_charid row[2], // char_name - atof(row[3]), // x float in_x - atof(row[4]), // y float in_y - atof(row[5]), // z float in_z - atof(row[6]), // heading float in_heading + position, row[7], // time_of_death char* time_of_death atoi(row[8]) == 1, // is_rezzed bool rezzed atoi(row[9]))