Skip to content

Commit

Permalink
[14050] Add Slot field to npc_vendor and npc_vendor_template and use …
Browse files Browse the repository at this point in the history
…it to determine order of items in vendor window.
  • Loading branch information
Nytanath authored and killerwife committed Feb 25, 2022
1 parent 825cd86 commit 7fdb1ea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion sql/base/mangos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) DEFAULT NULL,
`creature_ai_version` varchar(120) DEFAULT NULL,
`cache_id` int(10) DEFAULT '0',
`required_14049_01_mangos_unitflags2` bit(1) DEFAULT NULL
`required_14050_01_mangos_npc_vendor` bit(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Used DB version notes';

--
Expand Down Expand Up @@ -5682,6 +5682,7 @@ CREATE TABLE `npc_vendor` (
`item` mediumint(8) unsigned NOT NULL DEFAULT '0',
`maxcount` tinyint(3) unsigned NOT NULL DEFAULT '0',
`incrtime` int(10) unsigned NOT NULL DEFAULT '0',
`slot` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
`ExtendedCost` mediumint(8) unsigned NOT NULL DEFAULT '0',
`condition_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`entry`,`item`,`ExtendedCost`)
Expand All @@ -5706,6 +5707,7 @@ CREATE TABLE `npc_vendor_template` (
`item` mediumint(8) unsigned NOT NULL DEFAULT '0',
`maxcount` tinyint(3) unsigned NOT NULL DEFAULT '0',
`incrtime` int(10) unsigned NOT NULL DEFAULT '0',
`slot` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
`ExtendedCost` mediumint(8) unsigned NOT NULL DEFAULT '0',
`condition_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`entry`,`item`,`ExtendedCost`)
Expand Down
4 changes: 4 additions & 0 deletions sql/updates/mangos/14050_01_mangos_npc_vendor.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE db_version CHANGE COLUMN required_14049_01_mangos_unitflags2 required_14050_01_mangos_npc_vendor bit;

ALTER TABLE `npc_vendor` ADD COLUMN `slot` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `incrtime`;
ALTER TABLE `npc_vendor_template` ADD COLUMN `slot` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `incrtime`;
2 changes: 1 addition & 1 deletion src/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9573,7 +9573,7 @@ void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates)

std::set<uint32> skip_vendors;

QueryResult* result = WorldDatabase.PQuery("SELECT entry, item, maxcount, incrtime, ExtendedCost, condition_id FROM %s", tableName);
QueryResult* result = WorldDatabase.PQuery("SELECT entry, item, maxcount, incrtime, ExtendedCost, condition_id FROM %s ORDER BY slot", tableName);
if (!result)
{
BarGoLink bar(1);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#define REVISION_DB_REALMD "required_14039_01_realmd_anticheat"
#define REVISION_DB_LOGS "required_14039_01_logs_anticheat"
#define REVISION_DB_CHARACTERS "required_14044_01_characters_extend_state"
#define REVISION_DB_MANGOS "required_14049_01_mangos_unitflags2"
#define REVISION_DB_MANGOS "required_14050_01_mangos_npc_vendor"
#endif // __REVISION_SQL_H__

0 comments on commit 7fdb1ea

Please sign in to comment.