From 4243ce8582fbb93ab4e21daaf127564852286039 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 16:02:12 -0800 Subject: [PATCH] SaveCharacterCorpse converted to xyz_heading --- zone/corpse.cpp | 2 +- zone/zonedb.cpp | 112 +++++++++++------------------------------------- zone/zonedb.h | 2 +- 3 files changed, 27 insertions(+), 89 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 8b8cfef14..c75725179 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -590,7 +590,7 @@ bool Corpse::Save() { /* Create New Corpse*/ if (corpse_db_id == 0) { - corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading); + corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position); } /* Update Corpse Data */ else{ diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index a49ea0b98..7859301dd 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3469,94 +3469,32 @@ void ZoneDatabase::MarkCorpseAsRezzed(uint32 db_id) { auto results = QueryDatabase(query); } -uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading) { +uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, const xyz_heading& position) { /* Dump Basic Corpse Data */ - std::string query = StringFormat("INSERT INTO `character_corpses` SET \n" - "`charname` = '%s',\n" - "`zone_id` = %u,\n" - "`instance_id` = %u,\n" - "`charid` = %d,\n" - "`x` = %1.1f,\n" - "`y` = %1.1f,\n" - "`z` = %1.1f,\n" - "`heading` = %1.1f,\n" - "`time_of_death` = NOW(),\n" - "`is_buried` = 0," - "`is_locked` = %d,\n" - "`exp` = %u,\n" - "`size` = %f,\n" - "`level` = %u,\n" - "`race` = %u,\n" - "`gender` = %u,\n" - "`class` = %u,\n" - "`deity` = %u,\n" - "`texture` = %u,\n" - "`helm_texture` = %u,\n" - "`copper` = %u,\n" - "`silver` = %u,\n" - "`gold` = %u,\n" - "`platinum` = %u,\n" - "`hair_color` = %u,\n" - "`beard_color` = %u,\n" - "`eye_color_1` = %u,\n" - "`eye_color_2` = %u,\n" - "`hair_style` = %u,\n" - "`face` = %u,\n" - "`beard` = %u,\n" - "`drakkin_heritage` = %u,\n" - "`drakkin_tattoo` = %u,\n" - "`drakkin_details` = %u,\n" - "`wc_1` = %u,\n" - "`wc_2` = %u,\n" - "`wc_3` = %u,\n" - "`wc_4` = %u,\n" - "`wc_5` = %u,\n" - "`wc_6` = %u,\n" - "`wc_7` = %u,\n" - "`wc_8` = %u,\n" - "`wc_9` = %u \n", - EscapeString(charname).c_str(), - zoneid, - instanceid, - charid, - x, - y, - z, - heading, - dbpc->locked, - dbpc->exp, - dbpc->size, - dbpc->level, - dbpc->race, - dbpc->gender, - dbpc->class_, - dbpc->deity, - dbpc->texture, - dbpc->helmtexture, - dbpc->copper, - dbpc->silver, - dbpc->gold, - dbpc->plat, - dbpc->haircolor, - dbpc->beardcolor, - dbpc->eyecolor1, - dbpc->eyecolor2, - dbpc->hairstyle, - dbpc->face, - dbpc->beard, - dbpc->drakkin_heritage, - dbpc->drakkin_tattoo, - dbpc->drakkin_details, - dbpc->item_tint[0].color, - dbpc->item_tint[1].color, - dbpc->item_tint[2].color, - dbpc->item_tint[3].color, - dbpc->item_tint[4].color, - dbpc->item_tint[5].color, - dbpc->item_tint[6].color, - dbpc->item_tint[7].color, - dbpc->item_tint[8].color - ); + std::string query = StringFormat("INSERT INTO `character_corpses` " + "SET `charname` = '%s', `zone_id` = %u, `instance_id` = %u, `charid` = %d," + "`x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f," + "`time_of_death` = NOW(), `is_buried` = 0, `is_locked` = %d," + "`exp` = %u, `size` = %f, `level` = %u, `race` = %u, `gender` = %u," + "`class` = %u, `deity` = %u, `texture` = %u, `helm_texture` = %u," + "`copper` = %u, `silver` = %u,`gold` = %u,`platinum` = %u," + "`hair_color` = %u, `beard_color` = %u, `eye_color_1` = %u," + "`eye_color_2` = %u, `hair_style` = %u, `face` = %u," + "`beard` = %u, `drakkin_heritage` = %u, `drakkin_tattoo` = %u," + "`drakkin_details` = %u, `wc_1` = %u, `wc_2` = %u," + "`wc_3` = %u, `wc_4` = %u, `wc_5` = %u, `wc_6` = %u," + "`wc_7` = %u,`wc_8` = %u,`wc_9` = %u", + EscapeString(charname).c_str(), zoneid, instanceid, charid, + position.m_X, position.m_Y, position.m_Z, position.m_Heading, + dbpc->locked, dbpc->exp, dbpc->size, dbpc->level, dbpc->race, + dbpc->gender, dbpc->class_, dbpc->deity, dbpc->texture, + dbpc->helmtexture, dbpc->copper, dbpc->silver, dbpc->gold, + dbpc->plat, dbpc->haircolor, dbpc->beardcolor, dbpc->eyecolor1, + dbpc->eyecolor2, dbpc->hairstyle, dbpc->face, dbpc->beard, + dbpc->drakkin_heritage, dbpc->drakkin_tattoo, dbpc->drakkin_details, + dbpc->item_tint[0].color, dbpc->item_tint[1].color, dbpc->item_tint[2].color, + dbpc->item_tint[3].color, dbpc->item_tint[4].color, dbpc->item_tint[5].color, + dbpc->item_tint[6].color, dbpc->item_tint[7].color, dbpc->item_tint[8].color); auto results = QueryDatabase(query); uint32 last_insert_id = results.LastInsertedID(); diff --git a/zone/zonedb.h b/zone/zonedb.h index 53fd89584..a50c5d189 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -313,7 +313,7 @@ public: uint32 SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zoneid, uint16 instanceid, const xyz_heading& position); uint32 CreateGraveyardRecord(uint32 graveyard_zoneid, const xyz_heading& position); uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id); - uint32 SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading); + uint32 SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, const xyz_heading& position); uint32 UpdateCharacterCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool rezzed = false); uint32 GetFirstCorpseID(uint32 char_id); uint32 GetCharacterCorpseCount(uint32 char_id);