mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9651] Correct code for quest points of interest.
Adjusting field names and type, and send data accordingly to avoid client crash not using auto-generated id. Due to the nature of the primary keys, two tables are truncated. Be sure to make backup if you have data you do now want to loose. In addition, speed up load times of data from quest_poi_points, thanks Hunuza for helping out.
This commit is contained in:
parent
6750ce9185
commit
09b873a316
8 changed files with 82 additions and 47 deletions
|
|
@ -6455,8 +6455,8 @@ void ObjectMgr::LoadQuestPOI()
|
|||
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = WorldDatabase.Query("SELECT questId, objIndex, mapId, unk1, unk2, unk3, unk4 FROM quest_poi");
|
||||
// 0 1 2 3 4 5 6 7
|
||||
QueryResult *result = WorldDatabase.Query("SELECT questId, poiId, objIndex, mapId, mapAreaId, floorId, unk3, unk4 FROM quest_poi");
|
||||
|
||||
if(!result)
|
||||
{
|
||||
|
|
@ -6476,31 +6476,16 @@ void ObjectMgr::LoadQuestPOI()
|
|||
Field *fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint32 questId = fields[0].GetUInt32();
|
||||
int32 objIndex = fields[1].GetInt32();
|
||||
uint32 mapId = fields[2].GetUInt32();
|
||||
uint32 unk1 = fields[3].GetUInt32();
|
||||
uint32 unk2 = fields[4].GetUInt32();
|
||||
uint32 unk3 = fields[5].GetUInt32();
|
||||
uint32 unk4 = fields[6].GetUInt32();
|
||||
uint32 questId = fields[0].GetUInt32();
|
||||
uint32 poiId = fields[1].GetUInt32();
|
||||
int32 objIndex = fields[2].GetInt32();
|
||||
uint32 mapId = fields[3].GetUInt32();
|
||||
uint32 mapAreaId = fields[4].GetUInt32();
|
||||
uint32 floorId = fields[5].GetUInt32();
|
||||
uint32 unk3 = fields[6].GetUInt32();
|
||||
uint32 unk4 = fields[7].GetUInt32();
|
||||
|
||||
QuestPOI POI(objIndex, mapId, unk1, unk2, unk3, unk4);
|
||||
|
||||
QueryResult *points = WorldDatabase.PQuery("SELECT x, y FROM quest_poi_points WHERE questId='%u' AND objIndex='%i'", questId, objIndex);
|
||||
|
||||
if(points)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *pointFields = points->Fetch();
|
||||
int32 x = pointFields[0].GetInt32();
|
||||
int32 y = pointFields[1].GetInt32();
|
||||
QuestPOIPoint point(x, y);
|
||||
POI.points.push_back(point);
|
||||
} while (points->NextRow());
|
||||
|
||||
delete points;
|
||||
}
|
||||
QuestPOI POI(poiId, objIndex, mapId, mapAreaId, floorId, unk3, unk4);
|
||||
|
||||
mQuestPOIMap[questId].push_back(POI);
|
||||
|
||||
|
|
@ -6509,6 +6494,35 @@ void ObjectMgr::LoadQuestPOI()
|
|||
|
||||
delete result;
|
||||
|
||||
QueryResult *points = WorldDatabase.Query("SELECT questId, poiId, x, y FROM quest_poi_points");
|
||||
|
||||
if (points)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *pointFields = points->Fetch();
|
||||
|
||||
uint32 questId = pointFields[0].GetUInt32();
|
||||
uint32 poiId = pointFields[1].GetUInt32();
|
||||
int32 x = pointFields[2].GetInt32();
|
||||
int32 y = pointFields[3].GetInt32();
|
||||
|
||||
QuestPOIVector& vect = mQuestPOIMap[questId];
|
||||
|
||||
for(QuestPOIVector::iterator itr = vect.begin(); itr != vect.end(); ++itr)
|
||||
{
|
||||
if (itr->PoiId != poiId)
|
||||
continue;
|
||||
|
||||
QuestPOIPoint point(x, y);
|
||||
itr->points.push_back(point);
|
||||
break;
|
||||
}
|
||||
} while (points->NextRow());
|
||||
|
||||
delete points;
|
||||
}
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u quest POI definitions", count);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue