mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Rework of 'invsnapshot' command and implementation of automatic inventory snapshots
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
-- create inventory v1 backup
|
||||
SELECT @pre_timestamp := UNIX_TIMESTAMP(NOW());
|
||||
INSERT INTO `inventory_snapshots_v1_bak`
|
||||
(`time_index`,`charid`,`slotid`,`itemid`,`charges`,`color`,`augslot1`,`augslot2`,`augslot3`,`augslot4`,
|
||||
`augslot5`,`augslot6`,`instnodrop`,`custom_data`,`ornamenticon`,`ornamentidfile`,`ornament_hero_model`)
|
||||
SELECT
|
||||
@pre_timestamp, `charid`, `slotid`, `itemid`, `charges`, `color`, `augslot1`, `augslot2`, `augslot3`, `augslot4`,
|
||||
`augslot5`,`augslot6`,`instnodrop`,`custom_data`,`ornamenticon`,`ornamentidfile`,`ornament_hero_model`
|
||||
FROM `inventory`;
|
||||
|
||||
|
||||
-- update equipable slots in `items` table
|
||||
SELECT 'pre-transform count..',
|
||||
(SELECT COUNT(id) FROM `items` WHERE `slots` & (3 << 21)) total,
|
||||
@@ -21,15 +32,6 @@ UPDATE `inventory` SET `slotid` = 22 WHERE `slotid` = 21; -- adjust ammo slot
|
||||
UPDATE `inventory` SET `slotid` = 21 WHERE `slotid` = 9999; -- adjust powersource slot
|
||||
|
||||
|
||||
-- update `inventory_snapshots` slots
|
||||
UPDATE `inventory_snapshots` SET `slotid` = 33 WHERE `slotid` = 30; -- adjust cursor
|
||||
UPDATE `inventory_snapshots` SET `slotid` = (`slotid` + 20) WHERE `slotid` >= 331 AND `slotid` <= 340; -- adjust cursor bags
|
||||
UPDATE `inventory_snapshots` SET `slotid` = (`slotid` + 1) WHERE `slotid` >= 22 AND `slotid` <= 29; -- adjust general slots
|
||||
-- current general bags remain the same
|
||||
UPDATE `inventory_snapshots` SET `slotid` = 22 WHERE `slotid` = 21; -- adjust ammo slot
|
||||
UPDATE `inventory_snapshots` SET `slotid` = 21 WHERE `slotid` = 9999; -- adjust powersource slot
|
||||
|
||||
|
||||
-- update `character_corpse_items` slots
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = 33 WHERE `equip_slot` = 30; -- adjust cursor
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = (`equip_slot` + 20) WHERE `equip_slot` >= 331 AND `equip_slot` <= 340; -- adjust cursor bags
|
||||
@@ -42,4 +44,15 @@ UPDATE `character_corpse_items` SET `equip_slot` = 21 WHERE `equip_slot` = 9999;
|
||||
-- update `character_pet_inventory` slots
|
||||
UPDATE `character_pet_inventory` SET `slot` = 22 WHERE `slot` = 21; -- adjust ammo slot
|
||||
|
||||
UPDATE `inventory_version` SET `step` = 1 WHERE `version` = 2;
|
||||
UPDATE `inventory_versions` SET `step` = 1 WHERE `version` = 2;
|
||||
|
||||
|
||||
-- create initial inventory v2 snapshots
|
||||
SELECT @post_timestamp := UNIX_TIMESTAMP(NOW());
|
||||
INSERT INTO `inventory_snapshots`
|
||||
(`time_index`,`charid`,`slotid`,`itemid`,`charges`,`color`,`augslot1`,`augslot2`,`augslot3`,`augslot4`,
|
||||
`augslot5`,`augslot6`,`instnodrop`,`custom_data`,`ornamenticon`,`ornamentidfile`,`ornament_hero_model`)
|
||||
SELECT
|
||||
@post_timestamp, `charid`, `slotid`, `itemid`, `charges`, `color`, `augslot1`, `augslot2`, `augslot3`, `augslot4`,
|
||||
`augslot5`,`augslot6`,`instnodrop`,`custom_data`,`ornamenticon`,`ornamentidfile`,`ornament_hero_model`
|
||||
FROM `inventory`;
|
||||
|
||||
@@ -1 +1,61 @@
|
||||
ALTER TABLE `inventory_version` ADD COLUMN `bot_step` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `step`;
|
||||
DROP TABLE IF EXISTS `inventory_version`;
|
||||
DROP TABLE IF EXISTS `inventory_snapshots`;
|
||||
|
||||
|
||||
CREATE TABLE `inventory_versions` (
|
||||
`version` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`step` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`bot_step` INT(11) UNSIGNED NOT NULL DEFAULT '0'
|
||||
)
|
||||
COLLATE='latin1_swedish_ci'
|
||||
ENGINE=MyISAM;
|
||||
|
||||
INSERT INTO `inventory_versions` VALUES (2, 0, 0);
|
||||
|
||||
|
||||
CREATE TABLE `inventory_snapshots` (
|
||||
`time_index` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`charid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`slotid` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`itemid` INT(11) UNSIGNED NULL DEFAULT '0',
|
||||
`charges` SMALLINT(3) UNSIGNED NULL DEFAULT '0',
|
||||
`color` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot1` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot2` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot3` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot4` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot5` MEDIUMINT(7) UNSIGNED NULL DEFAULT '0',
|
||||
`augslot6` MEDIUMINT(7) NOT NULL DEFAULT '0',
|
||||
`instnodrop` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`custom_data` TEXT NULL,
|
||||
`ornamenticon` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ornamentidfile` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ornament_hero_model` INT(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`time_index`, `charid`, `slotid`)
|
||||
)
|
||||
COLLATE='latin1_swedish_ci'
|
||||
ENGINE=InnoDB;
|
||||
|
||||
|
||||
CREATE TABLE `inventory_snapshots_v1_bak` (
|
||||
`time_index` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`charid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`slotid` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`itemid` INT(11) UNSIGNED NULL DEFAULT '0',
|
||||
`charges` SMALLINT(3) UNSIGNED NULL DEFAULT '0',
|
||||
`color` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot1` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot2` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot3` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot4` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`augslot5` MEDIUMINT(7) UNSIGNED NULL DEFAULT '0',
|
||||
`augslot6` MEDIUMINT(7) NOT NULL DEFAULT '0',
|
||||
`instnodrop` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`custom_data` TEXT NULL,
|
||||
`ornamenticon` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ornamentidfile` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`ornament_hero_model` INT(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`time_index`, `charid`, `slotid`)
|
||||
)
|
||||
COLLATE='latin1_swedish_ci'
|
||||
ENGINE=InnoDB;
|
||||
|
||||
Reference in New Issue
Block a user