Activation of bot_spells_entries table

This commit is contained in:
Uleat 2017-02-15 19:04:36 -05:00
parent 4ec3fda59d
commit 8177f7d9bb
4 changed files with 37 additions and 2 deletions

View File

@ -32,7 +32,7 @@
#define CURRENT_BINARY_DATABASE_VERSION 9105
#ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9008
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9009
#else
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
#endif

View File

@ -7,6 +7,7 @@
9006|2016_04_12_bots_inventory_window.sql|SELECT `bot_command` FROM `bot_command_settings` WHERE `bot_command` LIKE 'inventorywindow'|empty|
9007|2016_06_23_bots_camel_case_name_rule.sql|SELECT * FROM `rule_values` WHERE `rule_name` LIKE 'Bots:AllowCamelCaseNames'|empty|
9008|2016_06_28_bots_inventory_charges_update.sql|SELECT * FROM `information_schema`.`COLUMNS` isc WHERE isc.`TABLE_SCHEMA` = DATABASE() AND isc.`TABLE_NAME` = 'bot_inventories' AND isc.`COLUMN_NAME` = 'inst_charges' AND isc.`DATA_TYPE` = 'tinyint'|not_empty|
9009|2017_02_15_bots_bot_spells_entries.sql|SELECT `id` FROM `npc_spells_entries` WHERE `npc_spells_id` >= 701 AND `npc_spells_id` <= 712|not_empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1,29 @@
-- Delete any existing `bots_spells_entries` table
DROP TABLE IF EXISTS `bots_spells_entries`;
-- Create new bot spells entries table (new table does not have spells_id_spellid constraint)
CREATE TABLE `bot_spells_entries` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`npc_spells_id` INT(11) NOT NULL DEFAULT '0',
`spellid` SMALLINT(5) NOT NULL DEFAULT '0',
`type` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`minlevel` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`maxlevel` TINYINT(3) UNSIGNED NOT NULL DEFAULT '255',
`manacost` SMALLINT(5) NOT NULL DEFAULT '-1',
`recast_delay` INT(11) NOT NULL DEFAULT '-1',
`priority` SMALLINT(5) NOT NULL DEFAULT '0',
`resist_adjust` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`)
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1
;
-- Copy bots spells into new table
INSERT INTO `bot_spells_entries` (`npc_spells_id`, `spellid`, `type`, `minlevel`, `maxlevel`, `manacost`, `recast_delay`, `priority`, `resist_adjust`)
SELECT `npc_spells_id`, `spellid`, `type`, `minlevel`, `maxlevel`, `manacost`, `recast_delay`, `priority`, `resist_adjust`
FROM `npc_spells_entries` WHERE `npc_spells_id` >= '701' AND `npc_spells_id` <= '712';
-- Delete bot spells from old table
DELETE FROM `npc_spells_entries` WHERE `npc_spells_id` >= '701' AND `npc_spells_id` <= '712';

View File

@ -2608,8 +2608,13 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) {
query = StringFormat("SELECT spellid, type, minlevel, maxlevel, "
"manacost, recast_delay, priority, resist_adjust "
#ifdef BOTS
"FROM %s "
"WHERE npc_spells_id=%d ORDER BY minlevel", (iDBSpellsID >= 701 && iDBSpellsID <= 712 ? "bot_spells_entries" : "npc_spells_entries"), iDBSpellsID);
#else
"FROM npc_spells_entries "
"WHERE npc_spells_id=%d ORDER BY minlevel", iDBSpellsID);
"WHERE npc_spells_id=%d ORDER BY minlevel", iDBSpellsID);
#endif
results = QueryDatabase(query);
if (!results.Success())