Conversion of 2015_09_30_bots.sql fail points to perl script; Added drop bots feature to eqemu_update.pl menu

This commit is contained in:
Uleat 2015-12-11 22:39:18 -05:00
parent 80ef4c7f9f
commit 6802f2a9e8
4 changed files with 431 additions and 699 deletions

View File

@ -493,7 +493,7 @@ bool Database::CheckDatabaseConversions() {
/* Check for a new version of this script, the arg passed /* Check for a new version of this script, the arg passed
would have to be higher than the copy they have downloaded would have to be higher than the copy they have downloaded
locally and they will re fetch */ locally and they will re fetch */
system("perl eqemu_update.pl V 12"); system("perl eqemu_update.pl V 13");
/* Run Automatic Database Upgrade Script */ /* Run Automatic Database Upgrade Script */
system("perl eqemu_update.pl ran_from_world"); system("perl eqemu_update.pl ran_from_world");

View File

@ -23,7 +23,7 @@ if($Config{osname}=~/linux/i){ $OS = "Linux"; }
if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; } if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; }
#::: If current version is less than what world is reporting, then download a new one... #::: If current version is less than what world is reporting, then download a new one...
$current_version = 12; $current_version = 13;
if($ARGV[0] eq "V"){ if($ARGV[0] eq "V"){
if($ARGV[1] > $current_version){ if($ARGV[1] > $current_version){
@ -251,6 +251,7 @@ sub show_menu_prompt {
11 => \&fetch_latest_windows_binaries, 11 => \&fetch_latest_windows_binaries,
12 => \&fetch_server_dlls, 12 => \&fetch_server_dlls,
13 => \&do_windows_login_server_setup, 13 => \&do_windows_login_server_setup,
19 => \&do_bots_db_schema_drop,
20 => \&do_update_self, 20 => \&do_update_self,
0 => \&script_exit, 0 => \&script_exit,
); );
@ -327,6 +328,7 @@ return <<EO_MENU;
11) [Windows Server Build] :: Download Latest and Stable Server Build (Overwrites existing .exe's, includes .dll's) 11) [Windows Server Build] :: Download Latest and Stable Server Build (Overwrites existing .exe's, includes .dll's)
12) [Windows Server .dll's] :: Download Pre-Requisite Server .dll's 12) [Windows Server .dll's] :: Download Pre-Requisite Server .dll's
13) [Windows Server Loginserver Setup] :: Download and install Windows Loginserver 13) [Windows Server Loginserver Setup] :: Download and install Windows Loginserver
19) [EQEmu DB Drop Bots Schema] :: Remove Bots schema and return database to normal state
20) [Update the updater] Force update this script (Redownload) 20) [Update the updater] Force update this script (Redownload)
0) Exit 0) Exit
@ -995,6 +997,216 @@ sub are_file_sizes_different{
return; return;
} }
sub do_bots_db_schema_drop{
#"drop_bots.sql" is run before reverting database back to 'normal'
print "Fetching drop_bots.sql...\n";
get_remote_file("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/git/bots/drop_bots.sql", "db_update/drop_bots.sql");
print get_mysql_result_from_file("db_update/drop_bots.sql");
print "Restoring normality...\n";
print get_mysql_result("DELETE FROM `rule_values` WHERE `rule_name` LIKE 'Bots:%';");
if(get_mysql_result("SHOW TABLES LIKE 'commands'") ne "" && $db){
print get_mysql_result("DELETE FROM `commands` WHERE `command` LIKE 'bot';");
}
if(get_mysql_result("SHOW TABLES LIKE 'command_settings'") ne "" && $db){
print get_mysql_result("DELETE FROM `command_settings` WHERE `command` LIKE 'bot';");
}
if(get_mysql_result("SHOW KEYS FROM `group_id` WHERE `Key_name` LIKE 'PRIMARY'") ne "" && $db){
print get_mysql_result("ALTER TABLE `group_id` DROP PRIMARY KEY;");
}
print get_mysql_result("ALTER TABLE `group_id` ADD PRIMARY KEY (`groupid`, `charid`, `ismerc`);");
if(get_mysql_result("SHOW KEYS FROM `guild_members` WHERE `Key_name` LIKE 'PRIMARY'") ne "" && $db){
print get_mysql_result("ALTER TABLE `guild_members` DROP PRIMARY KEY;");
}
print get_mysql_result("ALTER TABLE `guild_members` ADD PRIMARY KEY (`char_id`);");
print get_mysql_result("UPDATE `spawn2` SET `enabled` = 0 WHERE `id` IN (59297,59298);");
if(get_mysql_result("SHOW COLUMNS FROM `db_version` LIKE 'bots_version'") ne "" && $db){
print get_mysql_result("UPDATE `db_version` SET `bots_version` = 0;");
}
}
sub modify_db_for_bots{
#Called after the db bots schema (2015_09_30_bots.sql) has been loaded
print "Modifying database for bots...\n";
print get_mysql_result("UPDATE `spawn2` SET `enabled` = 1 WHERE `id` IN (59297,59298);");
if(get_mysql_result("SHOW KEYS FROM `guild_members` WHERE `Key_name` LIKE 'PRIMARY'") ne "" && $db){
print get_mysql_result("ALTER TABLE `guild_members` DROP PRIMARY KEY;");
}
if(get_mysql_result("SHOW KEYS FROM `group_id` WHERE `Key_name` LIKE 'PRIMARY'") ne "" && $db){
print get_mysql_result("ALTER TABLE `group_id` DROP PRIMARY KEY;");
}
print get_mysql_result("ALTER TABLE `group_id` ADD PRIMARY KEY USING BTREE(`groupid`, `charid`, `name`, `ismerc`);");
if(get_mysql_result("SHOW TABLES LIKE 'command_settings'") ne "" && get_mysql_result("SELECT `command` FROM `command_settings` WHERE `command` LIKE 'bot'") eq "" && $db){
print get_mysql_result("INSERT INTO `command_settings` VALUES ('bot', '0', '');");
}
if(get_mysql_result("SHOW TABLES LIKE 'commands'") ne "" && get_mysql_result("SELECT `command` FROM `commands` WHERE `command` LIKE 'bot'") eq "" && $db){
print get_mysql_result("INSERT INTO `commands` VALUES ('bot', '0');");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotAAExpansion'") ne "" && $db){
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:AAExpansion' WHERE `rule_name` LIKE 'Bots:BotAAExpansion';");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:AAExpansion'") eq "" && $db){
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:AAExpansion', '8', 'The expansion through which bots will obtain AAs');");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:CreateBotCount'") ne "" && $db){
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:CreationLimit' WHERE `rule_name` LIKE 'Bots:CreateBotCount';");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:CreationLimit'") eq "" && $db){
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:CreationLimit', '150', 'Number of bots that each account can create');");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotFinishBuffing'") ne "" && $db){
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:FinishBuffing' WHERE `rule_name` LIKE 'Bots:BotFinishBuffing';");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:FinishBuffing'") eq "" && $db){
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:FinishBuffing', 'false', 'Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.');");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotGroupBuffing'") ne "" && $db){
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:GroupBuffing' WHERE `rule_name` LIKE 'Bots:BotGroupBuffing';");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:GroupBuffing'") eq "" && $db){
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:GroupBuffing', 'false', 'Bots will cast single target buffs as group buffs, default is false for single. Does not make single target buffs work for MGB.');");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotManaRegen'") ne "" && $db){
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:ManaRegen' WHERE `rule_name` LIKE 'Bots:BotManaRegen';");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:ManaRegen'") eq "" && $db){
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:ManaRegen', '3.0', 'Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.');");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotQuest'") ne "" && $db){
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:QuestableSpawnLimit' WHERE `rule_name` LIKE 'Bots:BotQuest';");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:QuestableSpawnLimit'") eq "" && $db){
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:QuestableSpawnLimit', 'false', 'Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl');");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotSpellQuest'") ne "" && $db){
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:QuestableSpells' WHERE `rule_name` LIKE 'Bots:BotSpellQuest';");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:QuestableSpells'") eq "" && $db){
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:QuestableSpells', 'false', 'Anita Thrall\\\'s (Anita_Thrall.pl) Bot Spell Scriber quests.');");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:SpawnBotCount'") ne "" && $db){
print get_mysql_result("UPDATE `rule_values` SET `rule_name` = 'Bots:SpawnLimit' WHERE `rule_name` LIKE 'Bots:SpawnBotCount';");
}
if(get_mysql_result("SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:SpawnLimit'") eq "" && $db){
print get_mysql_result("INSERT INTO `rule_values` VALUES ('1', 'Bots:SpawnLimit', '71', 'Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid');");
}
convert_existing_bot_data();
}
sub convert_existing_bot_data{
if(get_mysql_result("SHOW TABLES LIKE 'bots'") ne "" && $db){
print "Converting existing bot data...\n";
print get_mysql_result("INSERT INTO `bot_data` (`bot_id`, `owner_id`, `spells_id`, `name`, `last_name`, `zone_id`, `gender`, `race`, `class`, `level`, `creation_day`, `last_spawn`, `time_spawned`, `size`, `face`, `hair_color`, `hair_style`, `beard`, `beard_color`, `eye_color_1`, `eye_color_2`, `drakkin_heritage`, `drakkin_tattoo`, `drakkin_details`, `ac`, `atk`, `hp`, `mana`, `str`, `sta`, `cha`, `dex`, `int`, `agi`, `wis`, `fire`, `cold`, `magic`, `poison`, `disease`, `corruption`) SELECT `BotID`, `BotOwnerCharacterID`, `BotSpellsID`, `Name`, `LastName`, `LastZoneId`, `Gender`, `Race`, `Class`, `BotLevel`, UNIX_TIMESTAMP(`BotCreateDate`), UNIX_TIMESTAMP(`LastSpawnDate`), `TotalPlayTime`, `Size`, `Face`, `LuclinHairColor`, `LuclinHairStyle`, `LuclinBeard`, `LuclinBeardColor`, `LuclinEyeColor`, `LuclinEyeColor2`, `DrakkinHeritage`, `DrakkinTattoo`, `DrakkinDetails`, `AC`, `ATK`, `HP`, `Mana`, `STR`, `STA`, `CHA`, `DEX`, `_INT`, `AGI`, `WIS`, `FR`, `CR`, `MR`, `PR`, `DR`, `Corrup` FROM `bots`;");
print get_mysql_result("INSERT INTO `bot_inspect_messages` (`bot_id`, `inspect_message`) SELECT `BotID`, `BotInspectMessage` FROM `bots`;");
print get_mysql_result("RENAME TABLE `bots` TO `bots_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'botstances'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_stances` (`bot_id`, `stance_id`) SELECT bs.`BotID`, bs.`StanceID` FROM `botstances` bs INNER JOIN `bot_data` bd ON bs.`BotID` = bd.`bot_id`;");
print get_mysql_result("RENAME TABLE `botstances` TO `botstances_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'bottimers'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_timers` (`bot_id`, `timer_id`, `timer_value`) SELECT bt.`BotID`, bt.`TimerID`, bt.`Value` FROM `bottimers` bt INNER JOIN `bot_data` bd ON bt.`BotID` = bd.`bot_id`;");
print get_mysql_result("RENAME TABLE `bottimers` TO `bottimers_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'botbuffs'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_buffs` (`buffs_index`, `bot_id`, `spell_id`, `caster_level`, `duration_formula`, `tics_remaining`, `poison_counters`, `disease_counters`, `curse_counters`, `corruption_counters`, `numhits`, `melee_rune`, `magic_rune`, `persistent`) SELECT bb.`BotBuffId`, bb.`BotId`, bb.`SpellId`, bb.`CasterLevel`, bb.`DurationFormula`, bb.`TicsRemaining`, bb.`PoisonCounters`, bb.`DiseaseCounters`, bb.`CurseCounters`, bb.`CorruptionCounters`, bb.`HitCount`, bb.`MeleeRune`, bb.`MagicRune`, bb.`Persistent` FROM `botbuffs` bb INNER JOIN `bot_data` bd ON bb.`BotId` = bd.`bot_id`;");
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'dot_rune'") ne "" && $db){
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`dot_rune` = bbo.`dot_rune` WHERE bb.`bot_id` = bbo.`BotID`;");
}
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'caston_x'") ne "" && $db){
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`caston_x` = bbo.`caston_x` WHERE bb.`bot_id` = bbo.`BotID`;");
}
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'caston_y'") ne "" && $db){
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`caston_y` = bbo.`caston_y` WHERE bb.`bot_id` = bbo.`BotID`;");
}
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'caston_z'") ne "" && $db){
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`caston_z` = bbo.`caston_z` WHERE bb.`bot_id` = bbo.`BotID`;");
}
if(get_mysql_result("SHOW COLUMNS FROM `botbuffs` LIKE 'ExtraDIChance'") ne "" && $db){
print get_mysql_result("UPDATE `bot_buffs` bb INNER JOIN `botbuffs` bbo ON bb.`buffs_index` = bbo.`BotBuffId` SET bb.`extra_di_chance` = bbo.`ExtraDIChance` WHERE bb.`bot_id` = bbo.`BotID`;");
}
print get_mysql_result("RENAME TABLE `botbuffs` TO `botbuffs_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'botinventory'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_inventories` (`inventories_index`, `bot_id`, `slot_id`, `item_id`, `inst_charges`, `inst_color`, `inst_no_drop`, `augment_1`, `augment_2`, `augment_3`, `augment_4`, `augment_5`) SELECT bi.`BotInventoryID`, bi.`BotID`, bi.`SlotID`, bi.`ItemID`, bi.`charges`, bi.`color`, bi.`instnodrop`, bi.`augslot1`, bi.`augslot2`, bi.`augslot3`, bi.`augslot4`, bi.`augslot5` FROM `botinventory` bi INNER JOIN `bot_data` bd ON bi.`BotID` = bd.`bot_id`;");
if(get_mysql_result("SHOW COLUMNS FROM `botinventory` LIKE 'augslot6'") ne "" && $db){
print get_mysql_result("UPDATE `bot_inventories` bi INNER JOIN `botinventory` bio ON bi.`inventories_index` = bio.`BotInventoryID` SET bi.`augment_6` = bio.`augslot6` WHERE bi.`bot_id` = bio.`BotID`;");
}
print get_mysql_result("RENAME TABLE `botinventory` TO `botinventory_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'botpets'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_pets` (`pets_index`, `pet_id`, `bot_id`, `name`, `mana`, `hp`) SELECT bp.`BotPetsId`, bp.`PetId`, bp.`BotId`, bp.`Name`, bp.`Mana`, bp.`HitPoints` FROM `botpets` bp INNER JOIN `bot_data` bd ON bp.`BotId` = bd.`bot_id`;");
print get_mysql_result("RENAME TABLE `botpets` TO `botpets_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'botpetbuffs'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_pet_buffs` (`pet_buffs_index`, `pets_index`, `spell_id`, `caster_level`, `duration`) SELECT bpb.`BotPetBuffId`, bpb.`BotPetsId`, bpb.`SpellId`, bpb.`CasterLevel`, bpb.`Duration` FROM `botpetbuffs` bpb INNER JOIN `bot_pets` bp ON bpb.`BotPetsId` = bp.`pets_index`;");
print get_mysql_result("RENAME TABLE `botpetbuffs` TO `botpetbuffs_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'botpetinventory'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_pet_inventories` (`pet_inventories_index`, `pets_index`, `item_id`) SELECT bpi.`BotPetInventoryId`, bpi.`BotPetsId`, bpi.`ItemId` FROM `botpetinventory` bpi INNER JOIN `bot_pets` bp ON bpi.`BotPetsId` = bp.`pets_index`;");
print get_mysql_result("RENAME TABLE `botpetinventory` TO `botpetinventory_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'botgroup'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_groups` (`groups_index`, `group_leader_id`, `group_name`) SELECT bg.`BotGroupId`, bg.`BotGroupLeaderBotId`, bg.`BotGroupName` FROM `botgroup` bg INNER JOIN `bot_data` bd ON bg.`BotGroupLeaderBotId` = bd.`bot_id`;");
print get_mysql_result("RENAME TABLE `botgroup` TO `botgroup_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'botgroupmembers'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_group_members` (`group_members_index`, `groups_index`, `bot_id`) SELECT bgm.`BotGroupMemberId`, bgm.`BotGroupId`, bgm.`BotId` FROM `botgroupmembers` bgm INNER JOIN `bot_groups` bg ON bgm.`BotGroupId` = bg.`groups_index` INNER JOIN `bot_data` bd ON bgm.`BotId` = bd.`bot_id`;");
print get_mysql_result("RENAME TABLE `botgroupmembers` TO `botgroupmembers_old`;");
}
if(get_mysql_result("SHOW TABLES LIKE 'botguildmembers'") ne "" && $db){
print get_mysql_result("INSERT INTO `bot_guild_members` (`bot_id`, `guild_id`, `rank`, `tribute_enable`, `total_tribute`, `last_tribute`, `banker`, `public_note`, `alt`) SELECT bgm.`char_id`, bgm.`guild_id`, bgm.`rank`, bgm.`tribute_enable`, bgm.`total_tribute`, bgm.`last_tribute`, bgm.`banker`, bgm.`public_note`, bgm.`alt` FROM `botguildmembers` bgm INNER JOIN `guilds` g ON bgm.`guild_id` = g.`id` INNER JOIN `bot_data` bd ON bgm.`char_id` = bd.`bot_id`;");
print get_mysql_result("RENAME TABLE `botguildmembers` TO `botguildmembers_old`;");
}
}
sub get_bots_db_version{ sub get_bots_db_version{
#::: Check if bots_version column exists... #::: Check if bots_version column exists...
if(get_mysql_result("SHOW COLUMNS FROM db_version LIKE 'bots_version'") eq "" && $db){ if(get_mysql_result("SHOW COLUMNS FROM db_version LIKE 'bots_version'") eq "" && $db){
@ -1079,6 +1291,10 @@ sub run_database_check{
print "Running Update: " . $val . " - " . $file_name . "\n"; print "Running Update: " . $val . " - " . $file_name . "\n";
print get_mysql_result_from_file("db_update/$file_name"); print get_mysql_result_from_file("db_update/$file_name");
print get_mysql_result("UPDATE db_version SET version = $val WHERE version < $val"); print get_mysql_result("UPDATE db_version SET version = $val WHERE version < $val");
if($bots_db_management == 1 && $val == 9000){
modify_db_for_bots();
}
} }
$db_run_stage = 2; $db_run_stage = 2;
} }

View File

@ -1,26 +1,47 @@
-- 'drop_bots' sql script file -- 'drop_bots' sql script file
-- current as of 11/30/2015 -- current as of 12/11/2015
-- --
-- Note: This file will remove bot schema loaded by 'load_bots' sql scripts. -- Note: This file will remove bot schema loaded by 'load_bots' sql scripts.
-- There may still be remnants of bot activity in tables `guild_members` and -- There may still be remnants of bot activity in tables `guild_members` and
-- `group_id`. If these entries are causing issues, you may need to manually -- `group_id`. If these entries are causing issues, you may need to manually
-- remove them. -- remove them.
--
-- Use eqemu_update.pl to administer this script
SELECT "dropping views..."; DROP VIEW IF EXISTS `vwguildmembers`;
DROP VIEW IF EXISTS `vwgroups`;
DROP VIEW IF EXISTS `vwbotgroups`;
DROP VIEW IF EXISTS `vwbotcharactermobs`;
DROP VIEW IF EXISTS `vwGuildMembers`;
DROP VIEW IF EXISTS `vwGroups`;
DROP VIEW IF EXISTS `vwBotGroups`;
DROP VIEW IF EXISTS `vwBotCharacterMobs`;
DROP VIEW IF EXISTS `vw_guild_members`; DROP VIEW IF EXISTS `vw_guild_members`;
DROP VIEW IF EXISTS `vw_groups`; DROP VIEW IF EXISTS `vw_groups`;
DROP VIEW IF EXISTS `vw_bot_groups`; DROP VIEW IF EXISTS `vw_bot_groups`;
DROP VIEW IF EXISTS `vw_bot_character_mobs`; DROP VIEW IF EXISTS `vw_bot_character_mobs`;
SELECT "dropping functions...";
DROP FUNCTION IF EXISTS `GetMobTypeByName`; DROP FUNCTION IF EXISTS `GetMobTypeByName`;
DROP FUNCTION IF EXISTS `GetMobTypeByID`; DROP FUNCTION IF EXISTS `GetMobTypeByID`;
DROP FUNCTION IF EXISTS `GetMobType`; DROP FUNCTION IF EXISTS `GetMobType`;
DROP TABLE IF EXISTS `botguildmembers`;
DROP TABLE IF EXISTS `botgroupmembers`;
DROP TABLE IF EXISTS `botgroup`;
DROP TABLE IF EXISTS `botpetinventory`;
DROP TABLE IF EXISTS `botpetbuffs`;
DROP TABLE IF EXISTS `botpets`;
DROP TABLE IF EXISTS `botinventory`;
DROP TABLE IF EXISTS `botbuffs`;
DROP TABLE IF EXISTS `bottimers`;
DROP TABLE IF EXISTS `botstances`;
DROP TABLE IF EXISTS `bots`;
DROP TABLE IF EXISTS `botgroups`; -- this table is not a part of 'load_bots.sql'
SELECT "dropping tables...";
DROP TABLE IF EXISTS `botguildmembers_old`; DROP TABLE IF EXISTS `botguildmembers_old`;
DROP TABLE IF EXISTS `botgroupmembers_old`; DROP TABLE IF EXISTS `botgroupmembers_old`;
DROP TABLE IF EXISTS `botgroup_old`; DROP TABLE IF EXISTS `botgroup_old`;
@ -46,51 +67,7 @@ DROP TABLE IF EXISTS `bot_stances`;
DROP TABLE IF EXISTS `bot_inspect_messages`; DROP TABLE IF EXISTS `bot_inspect_messages`;
DROP TABLE IF EXISTS `bot_data`; DROP TABLE IF EXISTS `bot_data`;
DROP PROCEDURE IF EXISTS `DropBotsSchema`; DROP PROCEDURE IF EXISTS `LoadBotsSchema`;
DELIMITER $$
CREATE PROCEDURE `DropBotsSchema` ()
BEGIN
SELECT "deleting rules...";
DELETE FROM `rule_values` WHERE `rule_name` LIKE 'Bots%';
SELECT "deleting command...";
DELETE FROM `commands` WHERE `command` LIKE 'bot';
SELECT "restoring keys...";
IF (EXISTS(SELECT `CONSTRAINT_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'group_id' AND `CONSTRAINT_NAME` = 'PRIMARY')) THEN
ALTER TABLE `group_id` DROP PRIMARY KEY;
END IF;
ALTER TABLE `group_id` ADD PRIMARY KEY (`groupid`, `charid`, `ismerc`);
IF (EXISTS(SELECT `CONSTRAINT_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'guild_members' AND `CONSTRAINT_NAME` = 'PRIMARY')) THEN
ALTER TABLE `guild_members` DROP PRIMARY KEY;
END IF;
ALTER TABLE `guild_members` ADD PRIMARY KEY (`char_id`);
SELECT "de-activating spawns...";
UPDATE `spawn2` SET `enabled` = 0 WHERE `id` IN (59297,59298);
SELECT "clearing database version...";
IF (EXISTS(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'db_version' AND `COLUMN_NAME` = 'bots_version')) THEN
UPDATE `db_version`
SET `bots_version` = 0;
END IF;
END$$
DELIMITER ;
CALL `DropBotsSchema`();
SELECT "dropping procedure...";
DROP PROCEDURE IF EXISTS `DropBotsSchema`; DROP PROCEDURE IF EXISTS `DropBotsSchema`;

View File

@ -1,10 +1,15 @@
-- '2015_09_30_bots' sql script file -- '2015_09_30_bots' sql script file
-- current as of 11/30/2015 -- current as of 12/11/2015
-- --
-- Use eqemu_update.pl to administer this script -- Use eqemu_update.pl to administer this script
-- Clean-up -- Clean-up
DROP VIEW IF EXISTS `vwbotcharactermobs`;
DROP VIEW IF EXISTS `vwbotgroups`;
DROP VIEW IF EXISTS `vwgroups`;
DROP VIEW IF EXISTS `vwguildmembers`;
DROP VIEW IF EXISTS `vwBotCharacterMobs`; DROP VIEW IF EXISTS `vwBotCharacterMobs`;
DROP VIEW IF EXISTS `vwBotGroups`; DROP VIEW IF EXISTS `vwBotGroups`;
DROP VIEW IF EXISTS `vwGroups`; DROP VIEW IF EXISTS `vwGroups`;
@ -22,659 +27,193 @@ DROP FUNCTION IF EXISTS `GetMobTypeByID`;
DROP PROCEDURE IF EXISTS `LoadBotsSchema`; DROP PROCEDURE IF EXISTS `LoadBotsSchema`;
DELIMITER $$ -- Tables
CREATE TABLE `bot_data` (
`bot_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`owner_id` INT(11) UNSIGNED NOT NULL,
`spells_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`name` VARCHAR(64) NOT NULL DEFAULT '',
`last_name` VARCHAR(64) NOT NULL DEFAULT '',
`title` VARCHAR(32) NOT NULL DEFAULT '', -- Unused
`suffix` VARCHAR(32) NOT NULL DEFAULT '', -- Unused
`zone_id` SMALLINT(6) NOT NULL DEFAULT '0',
`gender` TINYINT(2) NOT NULL DEFAULT '0',
`race` SMALLINT(5) NOT NULL DEFAULT '0',
`class` TINYINT(2) NOT NULL DEFAULT '0',
`level` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0',
`deity` INT(11) UNSIGNED NOT NULL DEFAULT '0', -- Unused
`creation_day` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`last_spawn` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`time_spawned` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`size` FLOAT NOT NULL DEFAULT '0',
`face` INT(10) NOT NULL DEFAULT '1',
`hair_color` INT(10) NOT NULL DEFAULT '1',
`hair_style` INT(10) NOT NULL DEFAULT '1',
`beard` INT(10) NOT NULL DEFAULT '0',
`beard_color` INT(10) NOT NULL DEFAULT '1',
`eye_color_1` INT(10) NOT NULL DEFAULT '1',
`eye_color_2` INT(10) NOT NULL DEFAULT '1',
`drakkin_heritage` INT(10) NOT NULL DEFAULT '0',
`drakkin_tattoo` INT(10) NOT NULL DEFAULT '0',
`drakkin_details` INT(10) NOT NULL DEFAULT '0',
`ac` SMALLINT(5) NOT NULL DEFAULT '0',
`atk` MEDIUMINT(9) NOT NULL DEFAULT '0',
`hp` INTEGER NOT NULL DEFAULT '0',
`mana` INTEGER NOT NULL DEFAULT '0',
`str` MEDIUMINT(8) NOT NULL DEFAULT '75',
`sta` MEDIUMINT(8) NOT NULL DEFAULT '75',
`cha` MEDIUMINT(8) NOT NULL DEFAULT '75',
`dex` MEDIUMINT(8) NOT NULL DEFAULT '75',
`int` MEDIUMINT(8) NOT NULL DEFAULT '75',
`agi` MEDIUMINT(8) NOT NULL DEFAULT '75',
`wis` MEDIUMINT(8) NOT NULL DEFAULT '75',
`fire` SMALLINT(5) NOT NULL DEFAULT '0',
`cold` SMALLINT(5) NOT NULL DEFAULT '0',
`magic` SMALLINT(5) NOT NULL DEFAULT '0',
`poison` SMALLINT(5) NOT NULL DEFAULT '0',
`disease` SMALLINT(5) NOT NULL DEFAULT '0',
`corruption` SMALLINT(5) NOT NULL DEFAULT '0',
`show_helm` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`follow_distance` INT(11) UNSIGNED NOT NULL DEFAULT '200',
PRIMARY KEY (`bot_id`)
) ENGINE=InnoDB;
CREATE PROCEDURE `LoadBotsSchema` () CREATE TABLE `bot_inspect_messages` (
BEGIN `bot_id` INT(11) UNSIGNED NOT NULL,
-- Activate `inspect_message` VARCHAR(256) NOT NULL DEFAULT '',
UPDATE `spawn2` SET `enabled` = 1 WHERE `id` IN (59297,59298); PRIMARY KEY (`bot_id`),
INDEX `bot_id` (`bot_id`)
) ENGINE=InnoDB;
-- Alter
IF (EXISTS(SELECT `CONSTRAINT_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'guild_members' AND `CONSTRAINT_NAME` = 'PRIMARY')) THEN
ALTER TABLE `guild_members` DROP PRIMARY KEY;
END IF;
IF (EXISTS(SELECT `CONSTRAINT_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'group_id' AND `CONSTRAINT_NAME` = 'PRIMARY')) THEN
ALTER TABLE `group_id` DROP PRIMARY KEY;
END IF;
ALTER TABLE `group_id` ADD PRIMARY KEY USING BTREE(`groupid`, `charid`, `name`, `ismerc`);
--
-- From original bots.sql (for reference)
-- ALTER TABLE `group_id` ADD UNIQUE INDEX `U_group_id_1`(`name`);
-- ALTER TABLE `group_leaders` ADD UNIQUE INDEX `U_group_leaders_1`(`leadername`);
-- Commands
IF (NOT EXISTS(SELECT `command` FROM `commands` WHERE `command` LIKE 'bot')) THEN
INSERT INTO `commands` VALUES ('bot', '0');
END IF;
-- Rules
IF (EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotAAExpansion')) THEN
UPDATE `rule_values` SET `rule_name` = 'Bots:AAExpansion' WHERE `rule_name` LIKE 'Bots:BotAAExpansion';
END IF;
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:AAExpansion')) THEN
INSERT INTO `rule_values` VALUES ('1', 'Bots:AAExpansion', '8', 'The expansion through which bots will obtain AAs');
END IF;
IF (EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:CreateBotCount')) THEN
UPDATE `rule_values` SET `rule_name` = 'Bots:CreationLimit' WHERE `rule_name` LIKE 'Bots:CreateBotCount';
END IF;
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:CreationLimit')) THEN
INSERT INTO `rule_values` VALUES ('1', 'Bots:CreationLimit', '150', 'Number of bots that each account can create');
END IF;
IF (EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotFinishBuffing')) THEN CREATE TABLE `bot_stances` (
UPDATE `rule_values` SET `rule_name` = 'Bots:FinishBuffing' WHERE `rule_name` LIKE 'Bots:BotFinishBuffing'; `bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
END IF; `stance_id` TINYINT UNSIGNED NOT NULL DEFAULT '0',
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:FinishBuffing')) THEN PRIMARY KEY (`bot_id`),
INSERT INTO `rule_values` VALUES ('1', 'Bots:FinishBuffing', 'false', 'Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.'); CONSTRAINT `FK_bot_stances_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
END IF; );
IF (EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotGroupBuffing')) THEN CREATE TABLE `bot_timers` (
UPDATE `rule_values` SET `rule_name` = 'Bots:GroupBuffing' WHERE `rule_name` LIKE 'Bots:BotGroupBuffing'; `bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
END IF; `timer_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:GroupBuffing')) THEN `timer_value` INT(11) UNSIGNED NOT NULL DEFAULT '0',
INSERT INTO `rule_values` VALUES ('1', 'Bots:GroupBuffing', 'false', 'Bots will cast single target buffs as group buffs, default is false for single. Does not make single target buffs work for MGB.'); PRIMARY KEY (`bot_id`),
END IF; CONSTRAINT `FK_bot_timers_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
);
IF (EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotManaRegen')) THEN
UPDATE `rule_values` SET `rule_name` = 'Bots:ManaRegen' WHERE `rule_name` LIKE 'Bots:BotManaRegen';
END IF;
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:ManaRegen')) THEN
INSERT INTO `rule_values` VALUES ('1', 'Bots:ManaRegen', '3.0', 'Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.');
END IF;
IF (EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotQuest')) THEN
UPDATE `rule_values` SET `rule_name` = 'Bots:QuestableSpawnLimit' WHERE `rule_name` LIKE 'Bots:BotQuest';
END IF;
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:QuestableSpawnLimit')) THEN
INSERT INTO `rule_values` VALUES ('1', 'Bots:QuestableSpawnLimit', 'false', 'Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl');
END IF;
IF (EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotSpellQuest')) THEN
UPDATE `rule_values` SET `rule_name` = 'Bots:QuestableSpells' WHERE `rule_name` LIKE 'Bots:BotSpellQuest';
END IF;
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:QuestableSpells')) THEN
INSERT INTO `rule_values` VALUES ('1', 'Bots:QuestableSpells', 'false', 'Anita Thrall\'s (Anita_Thrall.pl) Bot Spell Scriber quests.');
END IF;
IF (EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:SpawnBotCount')) THEN
UPDATE `rule_values` SET `rule_name` = 'Bots:SpawnLimit' WHERE `rule_name` LIKE 'Bots:SpawnBotCount';
END IF;
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:SpawnLimit')) THEN
INSERT INTO `rule_values` VALUES ('1', 'Bots:SpawnLimit', '71', 'Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid');
END IF;
-- Tables
CREATE TABLE `bot_data` (
`bot_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`owner_id` INT(11) UNSIGNED NOT NULL,
`spells_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`name` VARCHAR(64) NOT NULL DEFAULT '',
`last_name` VARCHAR(64) NOT NULL DEFAULT '', -- Change unused (64) from (32)
`title` VARCHAR(32) NOT NULL DEFAULT '', -- Unused
`suffix` VARCHAR(32) NOT NULL DEFAULT '', -- Unused
`zone_id` SMALLINT(6) NOT NULL DEFAULT '0',
`gender` TINYINT(2) NOT NULL DEFAULT '0',
`race` SMALLINT(5) NOT NULL DEFAULT '0',
`class` TINYINT(2) NOT NULL DEFAULT '0',
`level` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0',
`deity` INT(11) UNSIGNED NOT NULL DEFAULT '0', -- Unused
`creation_day` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`last_spawn` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`time_spawned` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`size` FLOAT NOT NULL DEFAULT '0',
`face` INT(10) NOT NULL DEFAULT '1',
`hair_color` INT(10) NOT NULL DEFAULT '1',
`hair_style` INT(10) NOT NULL DEFAULT '1',
`beard` INT(10) NOT NULL DEFAULT '0',
`beard_color` INT(10) NOT NULL DEFAULT '1',
`eye_color_1` INT(10) NOT NULL DEFAULT '1',
`eye_color_2` INT(10) NOT NULL DEFAULT '1',
`drakkin_heritage` INT(10) NOT NULL DEFAULT '0',
`drakkin_tattoo` INT(10) NOT NULL DEFAULT '0',
`drakkin_details` INT(10) NOT NULL DEFAULT '0',
`ac` SMALLINT(5) NOT NULL DEFAULT '0',
`atk` MEDIUMINT(9) NOT NULL DEFAULT '0',
`hp` INTEGER NOT NULL DEFAULT '0',
`mana` INTEGER NOT NULL DEFAULT '0',
`str` MEDIUMINT(8) NOT NULL DEFAULT '75',
`sta` MEDIUMINT(8) NOT NULL DEFAULT '75',
`cha` MEDIUMINT(8) NOT NULL DEFAULT '75',
`dex` MEDIUMINT(8) NOT NULL DEFAULT '75',
`int` MEDIUMINT(8) NOT NULL DEFAULT '75',
`agi` MEDIUMINT(8) NOT NULL DEFAULT '75',
`wis` MEDIUMINT(8) NOT NULL DEFAULT '75',
`fire` SMALLINT(5) NOT NULL DEFAULT '0',
`cold` SMALLINT(5) NOT NULL DEFAULT '0',
`magic` SMALLINT(5) NOT NULL DEFAULT '0',
`poison` SMALLINT(5) NOT NULL DEFAULT '0',
`disease` SMALLINT(5) NOT NULL DEFAULT '0',
`corruption` SMALLINT(5) NOT NULL DEFAULT '0',
`show_helm` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`follow_distance` INT(11) UNSIGNED NOT NULL DEFAULT '200',
PRIMARY KEY (`bot_id`)
) ENGINE=InnoDB;
CREATE TABLE `bot_inspect_messages` (
`bot_id` INT(11) UNSIGNED NOT NULL,
`inspect_message` VARCHAR(256) NOT NULL DEFAULT '',
PRIMARY KEY (`bot_id`),
INDEX `bot_id` (`bot_id`)
) ENGINE=InnoDB;
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'bots')) THEN
INSERT INTO `bot_data` (
`bot_id`,
`owner_id`,
`spells_id`,
`name`,
`last_name`,
`zone_id`,
`gender`,
`race`,
`class`,
`level`,
`creation_day`,
`last_spawn`,
`time_spawned`,
`size`,
`face`,
`hair_color`,
`hair_style`,
`beard`,
`beard_color`,
`eye_color_1`,
`eye_color_2`,
`drakkin_heritage`,
`drakkin_tattoo`,
`drakkin_details`,
`ac`,
`atk`,
`hp`,
`mana`,
`str`,
`sta`,
`cha`,
`dex`,
`int`,
`agi`,
`wis`,
`fire`,
`cold`,
`magic`,
`poison`,
`disease`,
`corruption`
)
SELECT
`BotID`,
`BotOwnerCharacterID`,
`BotSpellsID`,
`Name`,
`LastName`,
`LastZoneId`,
`Gender`,
`Race`,
`Class`,
`BotLevel`,
UNIX_TIMESTAMP(`BotCreateDate`),
UNIX_TIMESTAMP(`LastSpawnDate`),
`TotalPlayTime`,
`Size`,
`Face`,
`LuclinHairColor`,
`LuclinHairStyle`,
`LuclinBeard`,
`LuclinBeardColor`,
`LuclinEyeColor`,
`LuclinEyeColor2`,
`DrakkinHeritage`,
`DrakkinTattoo`,
`DrakkinDetails`,
`AC`,
`ATK`,
`HP`,
`Mana`,
`STR`,
`STA`,
`CHA`,
`DEX`,
`_INT`,
`AGI`,
`WIS`,
`FR`,
`CR`,
`MR`,
`PR`,
`DR`,
`Corrup`
FROM `bots`;
INSERT INTO `bot_inspect_messages` (
`bot_id`,
`inspect_message`
)
SELECT
`BotID`,
`BotInspectMessage`
FROM `bots`;
RENAME TABLE `bots` TO `bots_old`;
END IF;
CREATE TABLE `bot_stances` (
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`stance_id` TINYINT UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`bot_id`),
CONSTRAINT `FK_bot_stances_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
);
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botstances')) THEN
INSERT INTO `bot_stances` (
`bot_id`,
`stance_id`
)
SELECT
bs.`BotID`,
bs.`StanceID`
FROM `botstances` bs
INNER JOIN `bot_data` bd
ON bs.`BotID` = bd.`bot_id`;
RENAME TABLE `botstances` TO `botstances_old`;
END IF;
CREATE TABLE `bot_timers` (
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`timer_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`timer_value` INT(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`bot_id`),
CONSTRAINT `FK_bot_timers_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
);
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'bottimers')) THEN
INSERT INTO `bot_timers` (
`bot_id`,
`timer_id`,
`timer_value`
)
SELECT
bt.`BotID`,
bt.`TimerID`,
bt.`Value`
FROM `bottimers` bt
INNER JOIN `bot_data` bd
ON bt.`BotID` = bd.`bot_id`;
RENAME TABLE `bottimers` TO `bottimers_old`;
END IF;
CREATE TABLE `bot_buffs` (
`buffs_index` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`spell_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`caster_level` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`duration_formula` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`tics_remaining` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`poison_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`disease_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`curse_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`corruption_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`numhits` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`melee_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`magic_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`dot_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0', -- Fix
`persistent` TINYINT(1) NOT NULL DEFAULT '0',
`caston_x` INT(10) NOT NULL DEFAULT '0', -- Fix
`caston_y` INT(10) NOT NULL DEFAULT '0', -- Fix
`caston_z` INT(10) NOT NULL DEFAULT '0', -- Fix
`extra_di_chance` INT(10) UNSIGNED NOT NULL DEFAULT '0', -- Fix
`instrument_mod` INT(10) NOT NULL DEFAULT '10', -- Unused
PRIMARY KEY (`buffs_index`),
KEY `FK_bot_buffs_1` (`bot_id`),
CONSTRAINT `FK_bot_buffs_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs')) THEN
INSERT INTO `bot_buffs` (
`buffs_index`,
`bot_id`,
`spell_id`,
`caster_level`,
`duration_formula`,
`tics_remaining`,
`poison_counters`,
`disease_counters`,
`curse_counters`,
`corruption_counters`,
`numhits`,
`melee_rune`,
`magic_rune`,
`persistent`
)
SELECT
bb.`BotBuffId`,
bb.`BotId`,
bb.`SpellId`,
bb.`CasterLevel`,
bb.`DurationFormula`,
bb.`TicsRemaining`,
bb.`PoisonCounters`,
bb.`DiseaseCounters`,
bb.`CurseCounters`,
bb.`CorruptionCounters`,
bb.`HitCount`,
bb.`MeleeRune`,
bb.`MagicRune`,
bb.`Persistent`
FROM `botbuffs` bb
INNER JOIN `bot_data` bd
ON bb.`BotId` = bd.`bot_id`;
IF (EXISTS(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'dot_rune')) THEN
UPDATE `bot_buffs` bb
INNER JOIN `botbuffs` bbo
ON bb.`buffs_index` = bbo.`BotBuffId`
SET bb.`dot_rune` = bbo.`dot_rune`
WHERE bb.`bot_id` = bbo.`BotID`;
END IF;
IF (EXISTS(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'caston_x')) THEN
UPDATE `bot_buffs` bb
INNER JOIN `botbuffs` bbo
ON bb.`buffs_index` = bbo.`BotBuffId`
SET bb.`caston_x` = bbo.`caston_x`
WHERE bb.`bot_id` = bbo.`BotID`;
END IF;
IF (EXISTS(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'caston_y')) THEN
UPDATE `bot_buffs` bb
INNER JOIN `botbuffs` bbo
ON bb.`buffs_index` = bbo.`BotBuffId`
SET bb.`caston_y` = bbo.`caston_y`
WHERE bb.`bot_id` = bbo.`BotID`;
END IF;
IF (EXISTS(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'caston_z')) THEN
UPDATE `bot_buffs` bb
INNER JOIN `botbuffs` bbo
ON bb.`buffs_index` = bbo.`BotBuffId`
SET bb.`caston_z` = bbo.`caston_z`
WHERE bb.`bot_id` = bbo.`BotID`;
END IF;
IF (EXISTS(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botbuffs' AND `COLUMN_NAME` = 'ExtraDIChance')) THEN
UPDATE `bot_buffs` bb
INNER JOIN `botbuffs` bbo
ON bb.`buffs_index` = bbo.`BotBuffId`
SET bb.`extra_di_chance` = bbo.`ExtraDIChance`
WHERE bb.`bot_id` = bbo.`BotID`;
END IF;
RENAME TABLE `botbuffs` TO `botbuffs_old`;
END IF;
CREATE TABLE `bot_inventories` (
`inventories_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`slot_id` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`item_id` INT(11) UNSIGNED NULL DEFAULT '0',
`inst_charges` TINYINT(3) UNSIGNED DEFAULT 0,
`inst_color` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`inst_no_drop` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
`inst_custom_data` TEXT NULL,
`ornament_icon` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`ornament_id_file` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`ornament_hero_model` INT(11) NOT NULL DEFAULT '0',
`augment_1` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_2` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_3` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_4` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_5` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_6` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`inventories_index`),
KEY `FK_bot_inventories_1` (`bot_id`),
CONSTRAINT `FK_bot_inventories_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
) ENGINE=InnoDB;
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botinventory')) THEN
INSERT INTO `bot_inventories` (
`inventories_index`,
`bot_id`,
`slot_id`,
`item_id`,
`inst_charges`,
`inst_color`,
`inst_no_drop`,
`augment_1`,
`augment_2`,
`augment_3`,
`augment_4`,
`augment_5`
)
SELECT
bi.`BotInventoryID`,
bi.`BotID`,
bi.`SlotID`,
bi.`ItemID`,
bi.`charges`,
bi.`color`,
bi.`instnodrop`,
bi.`augslot1`,
bi.`augslot2`,
bi.`augslot3`,
bi.`augslot4`,
bi.`augslot5`
FROM `botinventory` bi
INNER JOIN `bot_data` bd
ON bi.`BotID` = bd.`bot_id`;
IF (EXISTS(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botinventory' AND `COLUMN_NAME` = 'augslot6')) THEN
UPDATE `bot_inventories` bi
INNER JOIN `botinventory` bio
ON bi.`inventories_index` = bio.`BotInventoryID`
SET bi.`augment_6` = bio.`augslot6`
WHERE bi.`bot_id` = bio.`BotID`;
END IF;
RENAME TABLE `botinventory` TO `botinventory_old`;
END IF;
CREATE TABLE `bot_pets` (
`pets_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`pet_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`bot_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`name` VARCHAR(64) NULL,
`mana` INTEGER NOT NULL DEFAULT '0',
`hp` INTEGER NOT NULL DEFAULT '0',
PRIMARY KEY (`pets_index`),
KEY `FK_bot_pets_1` (`bot_id`),
CONSTRAINT `FK_bot_pets_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`),
CONSTRAINT `U_bot_pets_1` UNIQUE (`bot_id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botpets')) THEN
INSERT INTO `bot_pets` (
`pets_index`,
`pet_id`,
`bot_id`,
`name`,
`mana`,
`hp`
)
SELECT
bp.`BotPetsId`,
bp.`PetId`,
bp.`BotId`,
bp.`Name`,
bp.`Mana`,
bp.`HitPoints`
FROM `botpets` bp
INNER JOIN `bot_data` bd
ON bp.`BotId` = bd.`bot_id`;
RENAME TABLE `botpets` TO `botpets_old`;
END IF;
CREATE TABLE `bot_pet_buffs` (
`pet_buffs_index` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`pets_index` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`spell_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`caster_level` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`duration` INT(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`pet_buffs_index`),
KEY `FK_bot_pet_buffs_1` (`pets_index`),
CONSTRAINT `FK_bot_pet_buffs_1` FOREIGN KEY (`pets_index`) REFERENCES `bot_pets` (`pets_index`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botpetbuffs')) THEN
INSERT INTO `bot_pet_buffs` (
`pet_buffs_index`,
`pets_index`,
`spell_id`,
`caster_level`,
`duration`
)
SELECT
bpb.`BotPetBuffId`,
bpb.`BotPetsId`,
bpb.`SpellId`,
bpb.`CasterLevel`,
bpb.`Duration`
FROM `botpetbuffs` bpb
INNER JOIN `bot_pets` bp
ON bpb.`BotPetsId` = bp.`pets_index`;
RENAME TABLE `botpetbuffs` TO `botpetbuffs_old`;
END IF;
CREATE TABLE `bot_pet_inventories` (
`pet_inventories_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`pets_index` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`item_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`pet_inventories_index`),
KEY `FK_bot_pet_inventories_1` (`pets_index`),
CONSTRAINT `FK_bot_pet_inventories_1` FOREIGN KEY (`pets_index`) REFERENCES `bot_pets` (`pets_index`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botpetinventory')) THEN
INSERT INTO `bot_pet_inventories` (
`pet_inventories_index`,
`pets_index`,
`item_id`
)
SELECT
bpi.`BotPetInventoryId`,
bpi.`BotPetsId`,
bpi.`ItemId`
FROM `botpetinventory` bpi
INNER JOIN `bot_pets` bp
ON bpi.`BotPetsId` = bp.`pets_index`;
RENAME TABLE `botpetinventory` TO `botpetinventory_old`;
END IF;
CREATE TABLE `bot_groups` (
`groups_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`group_leader_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`group_name` VARCHAR(64) NOT NULL,
PRIMARY KEY (`groups_index`),
KEY `FK_bot_groups_1` (`group_leader_id`),
CONSTRAINT `FK_bot_groups_1` FOREIGN KEY (`group_leader_id`) REFERENCES `bot_data` (`bot_id`)
) ENGINE=InnoDB;
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botgroup')) THEN
INSERT INTO `bot_groups` (
`groups_index`,
`group_leader_id`,
`group_name`
)
SELECT
bg.`BotGroupId`,
bg.`BotGroupLeaderBotId`,
bg.`BotGroupName`
FROM `botgroup` bg
INNER JOIN `bot_data` bd
ON bg.`BotGroupLeaderBotId` = bd.`bot_id`;
RENAME TABLE `botgroup` TO `botgroup_old`;
END IF;
CREATE TABLE `bot_group_members` (
`group_members_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`groups_index` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`bot_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`group_members_index`),
KEY `FK_bot_group_members_1` (`groups_index`),
CONSTRAINT `FK_bot_group_members_1` FOREIGN KEY (`groups_index`) REFERENCES `bot_groups` (`groups_index`),
KEY `FK_bot_group_members_2` (`bot_id`),
CONSTRAINT `FK_bot_group_members_2` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
) ENGINE=InnoDB;
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botgroupmembers')) THEN
INSERT INTO `bot_group_members` (
`group_members_index`,
`groups_index`,
`bot_id`
)
SELECT
bgm.`BotGroupMemberId`,
bgm.`BotGroupId`,
bgm.`BotId`
FROM `botgroupmembers` bgm
INNER JOIN `bot_groups` bg
ON bgm.`BotGroupId` = bg.`groups_index`
INNER JOIN `bot_data` bd
ON bgm.`BotId` = bd.`bot_id`;
RENAME TABLE `botgroupmembers` TO `botgroupmembers_old`;
END IF;
CREATE TABLE `bot_guild_members` (
`bot_id` INT(11) NOT NULL DEFAULT '0',
`guild_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
`rank` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`tribute_enable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`total_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`last_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`banker` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`public_note` TEXT NULL,
`alt` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`bot_id`)
) ENGINE=InnoDB;
IF (EXISTS(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'botguildmembers')) THEN
INSERT INTO `bot_guild_members` (
`bot_id`,
`guild_id`,
`rank`,
`tribute_enable`,
`total_tribute`,
`last_tribute`,
`banker`,
`public_note`,
`alt`
)
SELECT
bgm.`char_id`,
bgm.`guild_id`,
bgm.`rank`,
bgm.`tribute_enable`,
bgm.`total_tribute`,
bgm.`last_tribute`,
bgm.`banker`,
bgm.`public_note`,
bgm.`alt`
FROM `botguildmembers` bgm
INNER JOIN `guilds` g
ON bgm.`guild_id` = g.`id`
INNER JOIN `bot_data` bd
ON bgm.`char_id` = bd.`bot_id`;
RENAME TABLE `botguildmembers` TO `botguildmembers_old`;
END IF;
END$$
DELIMITER ; CREATE TABLE `bot_buffs` (
`buffs_index` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`spell_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`caster_level` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`duration_formula` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`tics_remaining` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`poison_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`disease_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`curse_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`corruption_counters` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`numhits` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`melee_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`magic_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`dot_rune` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`persistent` TINYINT(1) NOT NULL DEFAULT '0',
`caston_x` INT(10) NOT NULL DEFAULT '0',
`caston_y` INT(10) NOT NULL DEFAULT '0',
`caston_z` INT(10) NOT NULL DEFAULT '0',
`extra_di_chance` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`instrument_mod` INT(10) NOT NULL DEFAULT '10', -- Unused
PRIMARY KEY (`buffs_index`),
KEY `FK_bot_buffs_1` (`bot_id`),
CONSTRAINT `FK_bot_buffs_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
CREATE TABLE `bot_inventories` (
`inventories_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`bot_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`slot_id` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`item_id` INT(11) UNSIGNED NULL DEFAULT '0',
`inst_charges` TINYINT(3) UNSIGNED DEFAULT 0,
`inst_color` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`inst_no_drop` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
`inst_custom_data` TEXT NULL,
`ornament_icon` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`ornament_id_file` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`ornament_hero_model` INT(11) NOT NULL DEFAULT '0',
`augment_1` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_2` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_3` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_4` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_5` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
`augment_6` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`inventories_index`),
KEY `FK_bot_inventories_1` (`bot_id`),
CONSTRAINT `FK_bot_inventories_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
) ENGINE=InnoDB;
CALL `LoadBotsSchema`(); CREATE TABLE `bot_pets` (
`pets_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`pet_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`bot_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`name` VARCHAR(64) NULL,
`mana` INTEGER NOT NULL DEFAULT '0',
`hp` INTEGER NOT NULL DEFAULT '0',
PRIMARY KEY (`pets_index`),
KEY `FK_bot_pets_1` (`bot_id`),
CONSTRAINT `FK_bot_pets_1` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`),
CONSTRAINT `U_bot_pets_1` UNIQUE (`bot_id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
DROP PROCEDURE IF EXISTS `LoadBotsSchema`; CREATE TABLE `bot_pet_buffs` (
`pet_buffs_index` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`pets_index` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`spell_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`caster_level` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`duration` INT(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`pet_buffs_index`),
KEY `FK_bot_pet_buffs_1` (`pets_index`),
CONSTRAINT `FK_bot_pet_buffs_1` FOREIGN KEY (`pets_index`) REFERENCES `bot_pets` (`pets_index`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
CREATE TABLE `bot_pet_inventories` (
`pet_inventories_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`pets_index` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`item_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`pet_inventories_index`),
KEY `FK_bot_pet_inventories_1` (`pets_index`),
CONSTRAINT `FK_bot_pet_inventories_1` FOREIGN KEY (`pets_index`) REFERENCES `bot_pets` (`pets_index`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
CREATE TABLE `bot_groups` (
`groups_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`group_leader_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`group_name` VARCHAR(64) NOT NULL,
PRIMARY KEY (`groups_index`),
KEY `FK_bot_groups_1` (`group_leader_id`),
CONSTRAINT `FK_bot_groups_1` FOREIGN KEY (`group_leader_id`) REFERENCES `bot_data` (`bot_id`)
) ENGINE=InnoDB;
CREATE TABLE `bot_group_members` (
`group_members_index` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`groups_index` INTEGER UNSIGNED NOT NULL DEFAULT '0',
`bot_id` INTEGER UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`group_members_index`),
KEY `FK_bot_group_members_1` (`groups_index`),
CONSTRAINT `FK_bot_group_members_1` FOREIGN KEY (`groups_index`) REFERENCES `bot_groups` (`groups_index`),
KEY `FK_bot_group_members_2` (`bot_id`),
CONSTRAINT `FK_bot_group_members_2` FOREIGN KEY (`bot_id`) REFERENCES `bot_data` (`bot_id`)
) ENGINE=InnoDB;
CREATE TABLE `bot_guild_members` (
`bot_id` INT(11) NOT NULL DEFAULT '0',
`guild_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
`rank` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`tribute_enable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`total_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`last_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`banker` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`public_note` TEXT NULL,
`alt` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`bot_id`)
) ENGINE=InnoDB;
-- Functions -- Functions