feat(DB/points_of_interest): Improved points_of_interest table, close #1193 (#2348)

This commit is contained in:
Stefano Borzì
2019-10-23 07:48:46 +02:00
committed by Stoabrogga
parent 6cac3f881f
commit 9dd623e061
5 changed files with 30 additions and 27 deletions

View File

@@ -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';

View File

@@ -234,7 +234,7 @@ struct GossipMenuItemsLocale
struct PointOfInterestLocale
{
StringVector IconName;
StringVector Name;
};
#define MAX_EQUIPMENT_ITEMS 3

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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