This commit is contained in:
Akkadius 2015-12-15 12:59:46 -06:00
commit 24ea7e03f1
19 changed files with 692 additions and 706 deletions

View File

@ -1,6 +1,12 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 12/07/2016 ==
== 12/14/2015 ==
Kinglykrab: Added IsBlind() and IsFeared() functionality to Perl and Lua.
- Note: Both methods are Mob methods and may be used on NPCs or PCs.
Natedog: Added Discipline functions, UpdateInstanceTimer function, and UnmemSpellBySpellID to lua and perl
-Examples: http://wiki.eqemulator.org/i?M=Pastebin&Paste=BJ0ygmNM
== 12/07/2015 ==
Uleat: Command aliases are no longer handled through the command_add() function.
- To add a command alias, edit the database table `command_settings` - here, you will find three columns: `command`, `access` and `aliases`
- Adding command aliases require that the command contain an entry in `command_settings`.`command`

View File

@ -493,7 +493,7 @@ bool Database::CheckDatabaseConversions() {
/* Check for a new version of this script, the arg passed
would have to be higher than the copy they have downloaded
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 */
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 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[1] > $current_version){
@ -251,6 +251,7 @@ sub show_menu_prompt {
11 => \&fetch_latest_windows_binaries,
12 => \&fetch_server_dlls,
13 => \&do_windows_login_server_setup,
19 => \&do_bots_db_schema_drop,
20 => \&do_update_self,
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)
12) [Windows Server .dll's] :: Download Pre-Requisite Server .dll's
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)
0) Exit
@ -995,6 +997,216 @@ sub are_file_sizes_different{
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{
#::: Check if bots_version column exists...
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 get_mysql_result_from_file("db_update/$file_name");
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;
}

View File

@ -1,26 +1,47 @@
-- '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.
-- 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
-- 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_groups`;
DROP VIEW IF EXISTS `vw_bot_groups`;
DROP VIEW IF EXISTS `vw_bot_character_mobs`;
SELECT "dropping functions...";
DROP FUNCTION IF EXISTS `GetMobTypeByName`;
DROP FUNCTION IF EXISTS `GetMobTypeByID`;
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 `botgroupmembers_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_data`;
DROP PROCEDURE IF EXISTS `DropBotsSchema`;
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 `LoadBotsSchema`;
DROP PROCEDURE IF EXISTS `DropBotsSchema`;

View File

@ -1,10 +1,15 @@
-- '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
-- 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 `vwBotGroups`;
DROP VIEW IF EXISTS `vwGroups`;
@ -22,659 +27,193 @@ DROP FUNCTION IF EXISTS `GetMobTypeByID`;
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` ()
BEGIN
-- Activate
UPDATE `spawn2` SET `enabled` = 1 WHERE `id` IN (59297,59298);
-- 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;
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 `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotFinishBuffing')) THEN
UPDATE `rule_values` SET `rule_name` = 'Bots:FinishBuffing' WHERE `rule_name` LIKE 'Bots:BotFinishBuffing';
END IF;
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:FinishBuffing')) THEN
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.');
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 `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:BotGroupBuffing')) THEN
UPDATE `rule_values` SET `rule_name` = 'Bots:GroupBuffing' WHERE `rule_name` LIKE 'Bots:BotGroupBuffing';
END IF;
IF (NOT EXISTS(SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Bots:GroupBuffing')) THEN
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.');
END IF;
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$$
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`)
);
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

View File

@ -712,6 +712,7 @@ public:
// use this one instead
void MemSpell(uint16 spell_id, int slot, bool update_client = true);
void UnmemSpell(int slot, bool update_client = true);
void UnmemSpellBySpellID(int32 spell_id);
void UnmemSpellAll(bool update_client = true);
void ScribeSpell(uint16 spell_id, int slot, bool update_client = true);
void UnscribeSpell(int slot, bool update_client = true);
@ -925,6 +926,8 @@ public:
void ResetTrade();
void DropInst(const ItemInst* inst);
bool TrainDiscipline(uint32 itemid);
void TrainDiscBySpellID(int32 spell_id);
int GetDiscSlotBySpellID(int32 spellid);
void SendDisciplineUpdate();
void SendDisciplineTimer(uint32 timer_id, uint32 duration);
bool UseDiscipline(uint32 spell_id, uint32 target);

View File

@ -23,12 +23,12 @@
1. At the bottom of command.h you must add a prototype for it.
2. Add the function in this file.
3. In the command_init function you must add a call to command_add
for your function. If you want an alias for your command, add
a second call to command_add with the description and access args
set to nullptr and 0 respectively since they aren't used when adding
an alias. The function pointers being equal is makes it an alias.
The access level you set with command_add is only a default if
the command isn't listed in the commands db table.
for your function.
Notes: If you want an alias for your command, add an entry to the
`command_settings` table in your database. The access level you
set with command_add is the default setting if the command isn't
listed in the `command_settings` db table.
*/
@ -84,6 +84,7 @@ void command_bestz(Client *c, const Seperator *message);
void command_pf(Client *c, const Seperator *message);
std::map<std::string, CommandRecord *> commandlist;
std::map<std::string, std::string> commandaliases;
//All allocated CommandRecords get put in here so they get deleted on shutdown
LinkedList<CommandRecord *> cleanup_commandlist;
@ -418,6 +419,8 @@ int command_init(void)
return -1;
}
commandaliases.clear();
std::map<std::string, std::pair<uint8, std::vector<std::string>>> command_settings;
database.GetCommandSettings(command_settings);
for (std::map<std::string, CommandRecord *>::iterator iter_cl = commandlist.begin(); iter_cl != commandlist.end(); ++iter_cl) {
@ -442,6 +445,9 @@ int command_init(void)
}
commandlist[*iter_aka] = iter_cl->second;
commandaliases[*iter_aka] = iter_cl->first;
Log.Out(Logs::General, Logs::Commands, "command_init(): - Alias '%s' added to command '%s'.", iter_aka->c_str(), commandaliases[*iter_aka].c_str());
}
}
@ -461,6 +467,7 @@ int command_init(void)
void command_deinit(void)
{
commandlist.clear();
commandaliases.clear();
command_dispatch = command_notavail;
commandcount = 0;

View File

@ -571,6 +571,33 @@ bool Client::TrainDiscipline(uint32 itemid) {
return(false);
}
void Client::TrainDiscBySpellID(int32 spell_id)
{
int i;
for(i = 0; i < MAX_PP_DISCIPLINES; i++) {
if(m_pp.disciplines.values[i] == 0) {
m_pp.disciplines.values[i] = spell_id;
database.SaveCharacterDisc(this->CharacterID(), i, spell_id);
SendDisciplineUpdate();
Message(15, "You have learned a new combat ability!");
return;
}
}
}
int Client::GetDiscSlotBySpellID(int32 spellid)
{
int i;
for(i = 0; i < MAX_PP_DISCIPLINES; i++)
{
if(m_pp.disciplines.values[i] == spellid)
return i;
}
return -1;
}
void Client::SendDisciplineUpdate() {
EQApplicationPacket app(OP_DisciplineUpdate, sizeof(Disciplines_Struct));
Disciplines_Struct *d = (Disciplines_Struct*)app.pBuffer;

View File

@ -2906,6 +2906,19 @@ XS(XS__DestroyInstance) {
XSRETURN_EMPTY;
}
XS(XS__UpdateInstanceTimer);
XS(XS__UpdateInstanceTimer) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: UpdateInstanceTimer(instance_id, new_duration)");
uint16 instance_id = (uint16)SvUV(ST(0));
uint32 new_duration = (uint32)SvUV(ST(1));
quest_manager.UpdateInstanceTimer(instance_id, new_duration);
XSRETURN_EMPTY;
}
XS(XS__GetInstanceID);
XS(XS__GetInstanceID) {
dXSARGS;
@ -3636,6 +3649,7 @@ EXTERN_C XS(boot_quest)
newXS(strcpy(buf, "ChooseRandom"), XS__ChooseRandom, file);
newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file);
newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file);
newXS(strcpy(buf, "UpdateInstanceTimer"), XS__UpdateInstanceTimer, file);
newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file);
newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file);
newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file);

View File

@ -530,6 +530,11 @@ void Lua_Client::UnmemSpell(int slot, bool update_client) {
self->UnmemSpell(slot, update_client);
}
void Lua_Client::UnmemSpellBySpellID(int32 spell_id) {
Lua_Safe_Call_Void();
self->UnmemSpellBySpellID(spell_id);
}
void Lua_Client::UnmemSpellAll() {
Lua_Safe_Call_Void();
self->UnmemSpellAll();
@ -575,6 +580,16 @@ void Lua_Client::TrainDisc(int itemid) {
self->TrainDiscipline(itemid);
}
void Lua_Client::TrainDiscBySpellID(int32 spell_id) {
Lua_Safe_Call_Void();
self->TrainDiscBySpellID(spell_id);
}
int Lua_Client::GetDiscSlotBySpellID(int32 spell_id) {
Lua_Safe_Call_Int();
return self->GetDiscSlotBySpellID(spell_id);
}
void Lua_Client::UntrainDisc(int slot) {
Lua_Safe_Call_Void();
self->UntrainDisc(slot);
@ -1426,6 +1441,7 @@ luabind::scope lua_register_client() {
.def("MemSpell", (void(Lua_Client::*)(int,int,bool))&Lua_Client::MemSpell)
.def("UnmemSpell", (void(Lua_Client::*)(int))&Lua_Client::UnmemSpell)
.def("UnmemSpell", (void(Lua_Client::*)(int,bool))&Lua_Client::UnmemSpell)
.def("UnmemSpellBySpellID", (void(Lua_Client::*)(int32))&Lua_Client::UnmemSpellBySpellID)
.def("UnmemSpellAll", (void(Lua_Client::*)(void))&Lua_Client::UnmemSpellAll)
.def("UnmemSpellAll", (void(Lua_Client::*)(bool))&Lua_Client::UnmemSpellAll)
.def("ScribeSpell", (void(Lua_Client::*)(int,int))&Lua_Client::ScribeSpell)
@ -1435,6 +1451,8 @@ luabind::scope lua_register_client() {
.def("UnscribeSpellAll", (void(Lua_Client::*)(void))&Lua_Client::UnscribeSpellAll)
.def("UnscribeSpellAll", (void(Lua_Client::*)(bool))&Lua_Client::UnscribeSpellAll)
.def("TrainDisc", (void(Lua_Client::*)(int))&Lua_Client::TrainDisc)
.def("TrainDiscBySpellID", (void(Lua_Client::*)(int32))&Lua_Client::TrainDiscBySpellID)
.def("GetDiscSlotBySpellID", (int(Lua_Client::*)(int32))&Lua_Client::GetDiscSlotBySpellID)
.def("UntrainDisc", (void(Lua_Client::*)(int))&Lua_Client::UntrainDisc)
.def("UntrainDisc", (void(Lua_Client::*)(int,bool))&Lua_Client::UntrainDisc)
.def("UntrainDiscAll", (void(Lua_Client::*)(void))&Lua_Client::UntrainDiscAll)

View File

@ -131,6 +131,7 @@ public:
void MemSpell(int spell_id, int slot, bool update_client);
void UnmemSpell(int slot);
void UnmemSpell(int slot, bool update_client);
void UnmemSpellBySpellID(int32 spell_id);
void UnmemSpellAll();
void UnmemSpellAll(bool update_client);
void ScribeSpell(int spell_id, int slot);
@ -140,6 +141,8 @@ public:
void UnscribeSpellAll();
void UnscribeSpellAll(bool update_client);
void TrainDisc(int itemid);
void TrainDiscBySpellID(int32 spell_id);
int GetDiscSlotBySpellID(int32 spell_id);
void UntrainDisc(int slot);
void UntrainDisc(int slot, bool update_client);
void UntrainDiscAll();

View File

@ -804,6 +804,10 @@ void lua_destroy_instance(uint32 instance_id) {
quest_manager.DestroyInstance(instance_id);
}
void lua_update_instance_timer(uint16 instance_id, uint32 new_duration) {
quest_manager.UpdateInstanceTimer(instance_id, new_duration);
}
int lua_get_instance_id(const char *zone, uint32 version) {
return quest_manager.GetInstanceID(zone, version);
}
@ -1576,6 +1580,7 @@ luabind::scope lua_register_general() {
luabind::def("get_guild_name_by_id", &lua_get_guild_name_by_id),
luabind::def("create_instance", &lua_create_instance),
luabind::def("destroy_instance", &lua_destroy_instance),
luabind::def("update_instance_timer", &lua_update_instance_timer),
luabind::def("get_instance_id", &lua_get_instance_id),
luabind::def("get_characters_in_instance", &lua_get_characters_in_instance),
luabind::def("assign_to_instance", &lua_assign_to_instance),

View File

@ -1871,6 +1871,16 @@ void Lua_Mob::SetPseudoRoot(bool in) {
self->SetPseudoRoot(in);
}
bool Lua_Mob::IsFeared() {
Lua_Safe_Call_Bool();
return self->IsFeared();
}
bool Lua_Mob::IsBlind() {
Lua_Safe_Call_Bool();
return self->IsBlind();
}
luabind::scope lua_register_mob() {
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
.def(luabind::constructor<>())
@ -2156,6 +2166,8 @@ luabind::scope lua_register_mob() {
.def("WearChange", (void(Lua_Mob::*)(int,int,uint32))&Lua_Mob::WearChange)
.def("DoKnockback", (void(Lua_Mob::*)(Lua_Mob,uint32,uint32))&Lua_Mob::DoKnockback)
.def("RemoveNimbusEffect", (void(Lua_Mob::*)(int))&Lua_Mob::RemoveNimbusEffect)
.def("IsFeared", (bool(Lua_Mob::*)(void))&Lua_Mob::IsFeared)
.def("IsBlind", (bool(Lua_Mob::*)(void))&Lua_Mob::IsBlind)
.def("IsRunning", (bool(Lua_Mob::*)(void))&Lua_Mob::IsRunning)
.def("SetRunning", (void(Lua_Mob::*)(bool))&Lua_Mob::SetRunning)
.def("SetBodyType", (void(Lua_Mob::*)(int,bool))&Lua_Mob::SetBodyType)

View File

@ -40,6 +40,8 @@ public:
void SetLevel(int level, bool command);
void SendWearChange(int material_slot);
bool IsMoving();
bool IsFeared();
bool IsBlind();
void GotoBind();
void Gate();
bool Attack(Lua_Mob other);

View File

@ -2445,6 +2445,30 @@ XS(XS_Client_UnmemSpell)
XSRETURN_EMPTY;
}
XS(XS_Client_UnmemSpellBySpellID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_UnmemSpellBySpellID)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Client::UnmemSpellBySpellID(THIS, spell_id)");
{
Client * THIS;
int32 spell_id = (int32)SvIV(ST(1));
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Client *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Client");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->UnmemSpellBySpellID(spell_id);
}
XSRETURN_EMPTY;
}
XS(XS_Client_UnmemSpellAll); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_UnmemSpellAll)
{
@ -2568,6 +2592,57 @@ XS(XS_Client_UnscribeSpellAll)
XSRETURN_EMPTY;
}
XS(XS_Client_TrainDiscBySpellID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_TrainDiscBySpellID)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Client::TrainDiscBySpellID(THIS, spell_id)");
{
Client * THIS;
int32 spell_id = (int32)SvIV(ST(1));
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Client *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Client");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->TrainDiscBySpellID(spell_id);
}
XSRETURN_EMPTY;
}
XS(XS_Client_GetDiscSlotBySpellID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_GetDiscSlotBySpellID)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Client::GetDiscSlotBySpellID(THIS, spell_id)");
{
Client * THIS;
int RETVAL;
int32 spell_id = (int32)SvIV(ST(1));
dXSTARG;
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Client *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Client");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetDiscSlotBySpellID(spell_id);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
XS(XS_Client_UntrainDisc); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_UntrainDisc)
{
@ -6443,10 +6518,13 @@ XS(boot_Client)
newXSproto(strcpy(buf, "ResetAA"), XS_Client_ResetAA, file, "$");
newXSproto(strcpy(buf, "MemSpell"), XS_Client_MemSpell, file, "$$$;$");
newXSproto(strcpy(buf, "UnmemSpell"), XS_Client_UnmemSpell, file, "$$;$");
newXSproto(strcpy(buf, "UnmemSpellBySpellID"), XS_Client_UnmemSpellBySpellID, file, "$$");
newXSproto(strcpy(buf, "UnmemSpellAll"), XS_Client_UnmemSpellAll, file, "$;$");
newXSproto(strcpy(buf, "ScribeSpell"), XS_Client_ScribeSpell, file, "$$$;$");
newXSproto(strcpy(buf, "UnscribeSpell"), XS_Client_UnscribeSpell, file, "$$;$");
newXSproto(strcpy(buf, "UnscribeSpellAll"), XS_Client_UnscribeSpellAll, file, "$;$");
newXSproto(strcpy(buf, "TrainDiscBySpellID"), XS_Client_TrainDiscBySpellID, file, "$$");
newXSproto(strcpy(buf, "GetDiscSlotBySpellID"), XS_Client_GetDiscSlotBySpellID, file, "$$");
newXSproto(strcpy(buf, "UntrainDisc"), XS_Client_UntrainDisc, file, "$$;$");
newXSproto(strcpy(buf, "UntrainDiscAll"), XS_Client_UntrainDiscAll, file, "$;$");
newXSproto(strcpy(buf, "IsSitting"), XS_Client_IsSitting, file, "$");

View File

@ -8440,6 +8440,56 @@ XS(XS_Mob_CanClassEquipItem)
XSRETURN(1);
}
XS(XS_Mob_IsFeared);
XS(XS_Mob_IsFeared) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::IsFeared(THIS)");
{
Mob* THIS;
bool RETVAL;
if (sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob*, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsFeared();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Mob_IsBlind);
XS(XS_Mob_IsBlind) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::IsBlind(THIS)");
{
Mob* THIS;
bool RETVAL;
if (sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob*, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsBlind();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
@ -8751,6 +8801,8 @@ XS(boot_Mob)
newXSproto(strcpy(buf, "ClearSpecialAbilities"), XS_Mob_ClearSpecialAbilities, file, "$");
newXSproto(strcpy(buf, "ProcessSpecialAbilities"), XS_Mob_ProcessSpecialAbilities, file, "$$");
newXSproto(strcpy(buf, "CanClassEquipItem"), XS_Mob_CanClassEquipItem, file, "$$");
newXSproto(strcpy(buf, "IsFeared"), XS_Mob_IsFeared, file, "$");
newXSproto(strcpy(buf, "IsBlind"), XS_Mob_IsBlind, file, "$");
XSRETURN_YES;
}

View File

@ -2582,6 +2582,22 @@ void QuestManager::DestroyInstance(uint16 instance_id)
database.DeleteInstance(instance_id);
}
void QuestManager::UpdateInstanceTimer(uint16 instance_id, uint32 new_duration)
{
std::string query = StringFormat("UPDATE instance_list SET duration = %lu, start_time = UNIX_TIMESTAMP() WHERE id = %lu",
(unsigned long)new_duration, (unsigned long)instance_id);
auto results = database.QueryDatabase(query);
if (results.Success()) {
auto pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer;
ut->instance_id = instance_id;
ut->new_duration = new_duration;
worldserver.SendPacket(pack);
safe_delete(pack);
}
}
uint16 QuestManager::GetInstanceID(const char *zone, int16 version)
{
QuestManagerCurrentQuestVars();

View File

@ -217,6 +217,7 @@ public:
void MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity = 0);
uint32 MerchantCountItem(uint32 NPCid, uint32 itemid);
uint16 CreateInstance(const char *zone, int16 version, uint32 duration);
void UpdateInstanceTimer(uint16 instance_id, uint32 new_duration);
void DestroyInstance(uint16 instance_id);
uint16 GetInstanceID(const char *zone, int16 version);
void AssignToInstance(uint16 instance_id);

View File

@ -4910,6 +4910,16 @@ void Client::UnmemSpell(int slot, bool update_client)
}
}
void Client::UnmemSpellBySpellID(int32 spell_id)
{
for(int i = 0; i < MAX_PP_MEMSPELL; i++) {
if(m_pp.mem_spells[i] == spell_id) {
UnmemSpell(i, true);
break;
}
}
}
void Client::UnmemSpellAll(bool update_client)
{
int i;