From 9dd623e061d2b6822c6f55e29125f384e7c9094a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefano=20Borz=C3=AC?= Date: Wed, 23 Oct 2019 07:48:46 +0200 Subject: [PATCH] feat(DB/points_of_interest): Improved points_of_interest table, close #1193 (#2348) --- .../rev_1570914351382462135.sql | 3 +++ src/server/game/Entities/Creature/Creature.h | 2 +- .../game/Entities/Creature/GossipDef.cpp | 16 +++++++------- src/server/game/Globals/ObjectMgr.cpp | 22 +++++++++---------- src/server/game/Globals/ObjectMgr.h | 14 ++++++------ 5 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1570914351382462135.sql diff --git a/data/sql/updates/pending_db_world/rev_1570914351382462135.sql b/data/sql/updates/pending_db_world/rev_1570914351382462135.sql new file mode 100644 index 000000000..e8046f893 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1570914351382462135.sql @@ -0,0 +1,3 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1570914351382462135'); + +ALTER TABLE `points_of_interest` CHANGE `Data` `Importance` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0'; diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 8061ebb5d..defcd642e 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -234,7 +234,7 @@ struct GossipMenuItemsLocale struct PointOfInterestLocale { - StringVector IconName; + StringVector Name; }; #define MAX_EQUIPMENT_ITEMS 3 diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index dfe862e5c..e00472dae 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -244,19 +244,19 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const return; } - std::string iconText = poi->icon_name; + std::string name = poi->Name; int32 locale = _session->GetSessionDbLocaleIndex(); if (locale >= 0) if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(poiId)) - ObjectMgr::GetLocaleString(localeData->IconName, locale, iconText); + ObjectMgr::GetLocaleString(localeData->Name, locale, name); WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 20); // guess size - data << uint32(poi->flags); - data << float(poi->x); - data << float(poi->y); - data << uint32(poi->icon); - data << uint32(poi->data); - data << iconText; + data << uint32(poi->Flags); + data << float(poi->PositionX); + data << float(poi->PositionY); + data << uint32(poi->Icon); + data << uint32(poi->Importance); + data << name; _session->SendPacket(&data); } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index ab05c95e5..d1ae3168a 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -374,7 +374,7 @@ void ObjectMgr::LoadPointOfInterestLocales() if (locale == LOCALE_enUS) continue; - AddLocaleString(Name, locale, data.IconName); + AddLocaleString(Name, locale, data.Name); } while (result->NextRow()); @@ -7148,7 +7148,7 @@ void ObjectMgr::LoadPointsOfInterest() uint32 count = 0; // 0 1 2 3 4 5 6 - QueryResult result = WorldDatabase.Query("SELECT ID, PositionX, PositionY, Icon, Flags, Data, Name FROM points_of_interest"); + QueryResult result = WorldDatabase.Query("SELECT ID, PositionX, PositionY, Icon, Flags, Importance, Name FROM points_of_interest"); if (!result) { @@ -7164,17 +7164,17 @@ void ObjectMgr::LoadPointsOfInterest() uint32 point_id = fields[0].GetUInt32(); PointOfInterest POI; - POI.entry = point_id; - POI.x = fields[1].GetFloat(); - POI.y = fields[2].GetFloat(); - POI.icon = fields[3].GetUInt32(); - POI.flags = fields[4].GetUInt32(); - POI.data = fields[5].GetUInt32(); - POI.icon_name = fields[6].GetString(); + POI.ID = point_id; + POI.PositionX = fields[1].GetFloat(); + POI.PositionY = fields[2].GetFloat(); + POI.Icon = fields[3].GetUInt32(); + POI.Flags = fields[4].GetUInt32(); + POI.Importance = fields[5].GetUInt32(); + POI.Name = fields[6].GetString(); - if (!Trinity::IsValidMapCoord(POI.x, POI.y)) + if (!Trinity::IsValidMapCoord(POI.PositionX, POI.PositionY)) { - sLog->outErrorDb("Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y); + sLog->outErrorDb("Table `points_of_interest` (ID: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.PositionX, POI.PositionY); continue; } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 164efb0a9..daa79b8c2 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -567,13 +567,13 @@ struct RepSpilloverTemplate struct PointOfInterest { - uint32 entry; - float x; - float y; - uint32 icon; - uint32 flags; - uint32 data; - std::string icon_name; + uint32 ID; + float PositionX; + float PositionY; + uint32 Icon; + uint32 Flags; + uint32 Importance; + std::string Name; }; struct GossipMenuItems