Jump to content

[9651] [fix]improved quest POI's code + make use of actual data


Auntie Mangos

Recommended Posts

  • Replies 85
  • Created
  • Last Reply

Top Posters In This Topic

XTZGZoReX insisted on this ..... it's the same thing eater use the value from db or use index++ but i think it's convenient this way for db ppl for when i will not provide data for upcoming quests since no one appreciated i headed out the data on a plate and started complaining why isn't the plate silver since is not every day you get hours of memory editing and parsing data for noting my bad for trying to bring something cool to mangos :)
Link to comment
Share on other sites

  • 40 years later...

What bug does the patch fix? What features does the patch add?

implements 3.3 Quest Tracking Feature full working

For which repository revision was the patch created?

9384

Who has been writing this patch? Please include either forum user names or email addresses.

I ported it to mangos and removed hex witch is not cool iff you ask me took actual data and guidiance from my friend zack(tudi)

I will provide full db (Pkt logged) data over at udb forums , or here iff i get get permision from one of the team members or mods

Udb link : here

Author: Blizzy <[email protected]>  2010-03-02 05:48:04
Committer: Blizzy <[email protected]>  2010-03-02 05:48:04
Parent: 6f01ad7465e5005472d5ea59f04d8b9b2a9049f9 ([9499] Add replacement spells for GO type 10 that may have dummy spellId in _template)
Child:  0000000000000000000000000000000000000000 (Local uncommitted changes, not checked in to index)
Branch: master
Follows: v0.16-dev1
Precedes: 

   Improved quest POI's code now with db support Quest Tracking Feature is full working

---------------------------- src/game/ObjectMgr.cpp ----------------------------
index b1540da..aae9230 100644
@@ -6482,8 +6482,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, areaId, floorId, unk3, unk4 FROM quest_poi");

    if(!result)
    {
@@ -6504,16 +6504,17 @@ void ObjectMgr::LoadQuestPOI()
        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 poiId    = fields[1].GetUInt32();
+        int32 objIndex  = fields[2].GetInt32();
+        uint32 mapId    = fields[3].GetUInt32();
+        uint32 areaId   = 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);
+        QuestPOI POI(poiId, objIndex, mapId, areaId, floorId, unk3, unk4);

-        QueryResult *points = WorldDatabase.PQuery("SELECT x, y FROM quest_poi_points WHERE questId='%u' AND objIndex='%i'", questId, objIndex);
+        QueryResult *points = WorldDatabase.PQuery("SELECT x, y FROM quest_poi_points WHERE questId='%u' AND poiId='%i'", questId, poiId);

        if(points)
        {

----------------------------- src/game/ObjectMgr.h -----------------------------
index 4442f56..a1a47ae 100644
@@ -260,16 +260,17 @@ struct QuestPOIPoint

struct QuestPOI
{
+    uint32 PoiId;
    int32 ObjectiveIndex;
    uint32 MapId;
-    uint32 Unk1;
-    uint32 Unk2;
+    uint32 AreaId;
+    uint32 FloorId;
    uint32 Unk3;
    uint32 Unk4;
    std::vector<QuestPOIPoint> points;

-    QuestPOI() : ObjectiveIndex(0), MapId(0), Unk1(0), Unk2(0), Unk3(0), Unk4(0) {}
-    QuestPOI(int32 objIndex, uint32 mapId, uint32 unk1, uint32 unk2, uint32 unk3, uint32 unk4) : ObjectiveIndex(objIndex), MapId(mapId), Unk1(unk1), Unk2(unk2), Unk3(unk3), Unk4(unk4) {}
+    QuestPOI() : PoiId(0), ObjectiveIndex(0), MapId(0), AreaId(0), FloorId(0), Unk3(0), Unk4(0) {}
+    QuestPOI(uint32 poiId, int32 objIndex, uint32 mapId, uint32 areaId, uint32 floorId, uint32 unk3, uint32 unk4) : PoiId(poiId), ObjectiveIndex(objIndex), MapId(mapId), AreaId(areaId), FloorId(floorId), Unk3(unk3), Unk4(unk4) {}
};

typedef std::vector<QuestPOI> QuestPOIVector;

-------------------------- src/game/QueryHandler.cpp --------------------------
index 41d934a..bcdc955 100644
@@ -485,7 +485,7 @@ void WorldSession::HandleQueryQuestsCompleted( WorldPacket & /*recv_data */)
    SendPacket(&data);
}

-void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data)
+void WorldSession::HandleQuestPOIQuery( WorldPacket & recv_data )
{
    uint32 count;
    recv_data >> count;                                     // quest count, max=25
@@ -520,16 +520,15 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data)
                data << uint32(questId);                    // quest ID
                data << uint32(POI->size());                // POI count

-                int index = 0;
                for(QuestPOIVector::const_iterator itr = POI->begin(); itr != POI->end(); ++itr)
                {
-                    data << uint32(index);                  // POI index
-                    data << int32(itr->ObjectiveIndex);     // objective index
-                    data << uint32(itr->MapId);             // mapid
-                    data << uint32(itr->Unk1);              // unknown
-                    data << uint32(itr->Unk2);              // unknown
-                    data << uint32(itr->Unk3);              // unknown
-                    data << uint32(itr->Unk4);              // unknown
+                    data << uint32(itr->PoiId);             // POI index
+                    data << int32(itr->ObjectiveIndex);     // Objective index
+                    data << uint32(itr->MapId);             // Mapid
+                    data << uint32(itr->AreaId);            // WorldMapArea index
+                    data << uint32(itr->FloorId);           // Floorid
+                    data << uint32(itr->Unk3);              // Unknown
+                    data << uint32(itr->Unk4);              // Unknown
                    data << uint32(itr->points.size());     // POI points count

                    for(std::vector<QuestPOIPoint>::const_iterator itr2 = itr->points.begin(); itr2 != itr->points.end(); ++itr2)
@@ -537,7 +536,6 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data)
                        data << int32(itr2->x);             // POI point x
                        data << int32(itr2->y);             // POI point y
                    }
-                    ++index;
                }
            }
            else
@@ -553,7 +551,6 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data)
        }
    }

-    data.hexlike();
    SendPacket(&data);
}

--
-- Table structure for table `quest_poi`
--

DROP TABLE IF EXISTS `quest_poi`;
CREATE TABLE IF NOT EXISTS `quest_poi` (
 `questId` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `poiId` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `objIndex` int(11) NOT NULL DEFAULT '0',
 `mapId` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `areaId` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `floorId` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `unk3` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `unk4` int(11) UNSIGNED NOT NULL DEFAULT '0',
 KEY `questId` (`poiId`,`questId`),
 KEY `poiId` (`poiId`,`questId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Table structure for table `quest_poi_points`
--

DROP TABLE IF EXISTS `quest_poi_points`;
CREATE TABLE IF NOT EXISTS `quest_poi_points` (
 `questId` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `poiId` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `x` int(11) NOT NULL DEFAULT '0',
 `y` int(11) NOT NULL DEFAULT '0',
 KEY `questId` (`poiId`,`questId`),
 KEY `poiId` (`poiId`,`questId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Update for existing tables
--

ALTER TABLE `quest_poi` CHANGE `questid` `questId` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0' ;
ALTER TABLE `quest_poi` ADD `poiId` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `questId` ;
ALTER TABLE `quest_poi` CHANGE `unk1` `areaId` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0' ;
ALTER TABLE `quest_poi` CHANGE `unk2` `florId` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0' ;
ALTER TABLE `quest_poi_points` CHANGE `objIndex` `poiId` INT( 11 ) NOT NULL DEFAULT '0' ;
ALTER TABLE `quest_poi` DROP PRIMARY KEY ,
ADD INDEX `questId` ( `poiId` , `questId` ),
ADD INDEX `poiId` ( `poiId` , `questId` );  
ALTER TABLE `quest_poi_points` DROP INDEX `idx`,
ADD INDEX `questId` ( `poiId` , `questId` ),
ADD INDEX `poiId` ( `poiId` , `questId` );

Link to comment
Share on other sites

Take a look at your own data :)

Just as example, for one quest you have quest_poi data like

('9349', '0', '4', '530', '465', '0', '0', '1');
('9349', '2', '-1', '530', '465', '0', '0', '1');

0 and 2, right? This is the index, as we have in:

                for(QuestPOIVector::const_iterator itr = POI->begin(); itr != POI->end(); ++itr)
               {
                   data << uint32(index);                  // POI index
                   data << int32(itr->ObjectiveIndex);     // objective index

You need to use the value from database, instead of incrementing the index, like in current code.

entry_POI is also a name i don't really like that much, as it indicate it's a unique value it can only exist one of (like for example creature entry). I would suggest you rename this to just id or similar, that indicate the value is not unique for the table, but a identifier for the poi row.

I also note that you have renamed from objIndex to objective. This is not ok in my opinion. By reading, it is not possible to even guess what the value is. If a rename is really needed, use objectiveIndex. This is after all the index of quest objectives (at least we must assume it is, since it will match real data fairly well).

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use