Add support for sorting vendor itemlists

--HG--
branch : trunk
This commit is contained in:
click
2010-05-01 08:10:14 +02:00
parent ea2d4d9536
commit 3a61667492
5 changed files with 13 additions and 5 deletions
@@ -0,0 +1,2 @@
ALTER TABLE `game_event_npc_vendor` ADD `slot` SMALLINT(6) NOT NULL DEFAULT '0' AFTER `guid`;
ALTER TABLE `game_event_npc_vendor` ADD INDEX (`slot`);
+2
View File
@@ -0,0 +1,2 @@
ALTER TABLE `npc_vendor` ADD `slot` SMALLINT(6) NOT NULL DEFAULT '0' AFTER `entry`;
ALTER TABLE `npc_vendor` ADD INDEX (`slot`);
+6 -2
View File
@@ -2093,11 +2093,13 @@ DROP TABLE IF EXISTS `game_event_npc_vendor`;
CREATE TABLE `game_event_npc_vendor` ( CREATE TABLE `game_event_npc_vendor` (
`event` mediumint(8) unsigned NOT NULL DEFAULT '0', `event` mediumint(8) unsigned NOT NULL DEFAULT '0',
`guid` mediumint(8) unsigned NOT NULL DEFAULT '0', `guid` mediumint(8) unsigned NOT NULL DEFAULT '0',
`slot` smallint(6) unsigned NOT NULL DEFAULT '0',
`item` mediumint(8) NOT NULL DEFAULT '0', `item` mediumint(8) NOT NULL DEFAULT '0',
`maxcount` mediumint(8) unsigned NOT NULL DEFAULT '0', `maxcount` mediumint(8) unsigned NOT NULL DEFAULT '0',
`incrtime` mediumint(8) unsigned NOT NULL DEFAULT '0', `incrtime` mediumint(8) unsigned NOT NULL DEFAULT '0',
`ExtendedCost` mediumint(8) unsigned NOT NULL DEFAULT '0', `ExtendedCost` mediumint(8) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`guid`,`item`) PRIMARY KEY (`guid`,`item`),
INDEX (`slot`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@@ -3687,11 +3689,13 @@ DROP TABLE IF EXISTS `npc_vendor`;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `npc_vendor` ( CREATE TABLE `npc_vendor` (
`entry` mediumint(8) unsigned NOT NULL DEFAULT '0', `entry` mediumint(8) unsigned NOT NULL DEFAULT '0',
`slot` smallint(6) unsigned NOT NULL DEFAULT '0',
`item` mediumint(8) unsigned NOT NULL DEFAULT '0', `item` mediumint(8) unsigned NOT NULL DEFAULT '0',
`maxcount` tinyint(3) unsigned NOT NULL DEFAULT '0', `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '0',
`incrtime` int(10) unsigned NOT NULL DEFAULT '0', `incrtime` int(10) unsigned NOT NULL DEFAULT '0',
`ExtendedCost` mediumint(8) unsigned NOT NULL DEFAULT '0', `ExtendedCost` mediumint(8) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`entry`,`item`,`extendedCost`) PRIMARY KEY (`entry`,`item`,`extendedCost`),
INDEX (`slot`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Npc System'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Npc System';
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
+1 -1
View File
@@ -823,7 +823,7 @@ void GameEventMgr::LoadFromDB()
sLog.outString("Loading Game Event Vendor Additions Data..."); sLog.outString("Loading Game Event Vendor Additions Data...");
// 0 1 2 3 4 5 // 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT event, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor"); result = WorldDatabase.Query("SELECT event, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor ORDER BY guid, slot ASC");
count = 0; count = 0;
if (!result) if (!result)
+2 -2
View File
@@ -8252,7 +8252,7 @@ void ObjectMgr::LoadTrainerSpell()
int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors) int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors)
{ {
// find all items from the reference vendor // find all items from the reference vendor
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT item, maxcount, incrtime, ExtendedCost FROM npc_vendor WHERE entry='%d'", item); QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT item, maxcount, incrtime, ExtendedCost FROM npc_vendor WHERE entry='%d' ORDER BY slot ASC", item);
if (!result) if (!result)
{ {
barGoLink bar(1); barGoLink bar(1);
@@ -8303,7 +8303,7 @@ void ObjectMgr::LoadVendors()
std::set<uint32> skip_vendors; std::set<uint32> skip_vendors;
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor"); QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor ORDER BY entry, slot ASC");
if (!result) if (!result)
{ {
barGoLink bar(1); barGoLink bar(1);