Script and server code query updates for bots_updater

This commit is contained in:
Uleat 2015-10-09 21:34:31 -04:00
parent bcf2a5c852
commit ecd695ff9b
14 changed files with 1722 additions and 803 deletions

View File

@ -348,11 +348,11 @@ bool Database::DeleteCharacter(char *name) {
query = StringFormat("DELETE FROM `character_inspect_messages` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", charid); QueryDatabase(query);
query = StringFormat("DELETE FROM `character_alt_currency` WHERE `char_id` = '%d'", charid); QueryDatabase(query);
#ifdef BOTS
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", charid);
#else
#ifdef BOTS
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", charid); // note: only use of GetMobTypeById()
#else
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d'", charid);
#endif
#endif
QueryDatabase(query);
return true;

View File

@ -209,7 +209,6 @@ public:
/* Database Conversions 'database_conversions.cpp' */
bool CheckDatabaseConversions();
bool CheckDatabaseConvertBotsPostPPDeblob();
bool CheckDatabaseConvertCorpseDeblob();
bool CheckDatabaseConvertPPDeblob();

View File

@ -470,7 +470,6 @@ static inline void loadbar(unsigned int x, unsigned int n, unsigned int w = 50)
bool Database::CheckDatabaseConversions() {
CheckDatabaseConvertPPDeblob();
CheckDatabaseConvertBotsPostPPDeblob();
CheckDatabaseConvertCorpseDeblob();
/* Fetch Automatic Upgrade Script */
@ -1491,163 +1490,6 @@ bool Database::CheckDatabaseConvertPPDeblob(){
return true;
}
bool Database::CheckDatabaseConvertBotsPostPPDeblob(){
#ifdef BOTS
int runbotsconvert = 0;
/* Check For Legacy Bot References */
std::string rquery = StringFormat("SHOW CREATE VIEW `vwBotCharacterMobs`");
auto results = QueryDatabase(rquery);
if (results.RowCount() == 1){
auto row = results.begin();
std::string table_check = row[1];
if (table_check.find("character_data") == -1){
runbotsconvert = 1;
printf("\n\n::: Legacy Bot Views and Function Detected... \n");
printf("----------------------------------------------------------\n\n");
printf(" Database currently has bot view/function linkage to obselete \n");
printf(" table references and will now be converted...\n\n");
printf(" It is recommended that you backup your database \n");
printf(" before continuing the automatic conversion process...\n\n");
printf("----------------------------------------------------------\n\n");
std::cout << "Press ENTER to continue....." << std::endl << std::endl;
std::cin.ignore(1);
}
}
if (runbotsconvert == 1){
printf("Running bot views/function database conversion... \n");
/* Update view `vwbotcharactermobs` */
rquery = StringFormat("DROP VIEW `vwBotCharacterMobs`;");
results = QueryDatabase(rquery);
rquery = StringFormat(
"CREATE VIEW `vwBotCharacterMobs` AS\n"
"SELECT _utf8'C' AS mobtype,\n" // Natedog: '_utf8'
"c.`id`,\n"
"c.`name`,\n"
"c.`class`,\n"
"c.`level`,\n"
"c.`last_login`,\n"
"c.`zone_id`\n"
"FROM `character_data` AS c\n"
"UNION ALL\n"
"SELECT _utf8'B' AS mobtype,\n" // Natedog: '_utf8'
"b.`BotID` AS id,\n"
"b.`Name` AS name,\n"
"b.`Class` AS class,\n"
"b.`BotLevel` AS level,\n"
"0 AS timelaston,\n"
"0 AS zoneid\n"
"FROM bots AS b;"
);
results = QueryDatabase(rquery);
/* Update function `GetMobType` */
rquery = StringFormat("DROP FUNCTION IF EXISTS `GetMobType`;");
results = QueryDatabase(rquery);
rquery = StringFormat(
"CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1)\n"
"BEGIN\n"
" DECLARE Result CHAR(1);\n"
"\n"
" SET Result = NULL;\n"
"\n"
" IF (SELECT COUNT(*) FROM `character_data` WHERE `name` = mobname) > 0 THEN\n"
" SET Result = 'C';\n"
" ELSEIF (SELECT COUNT(*) FROM `bots` WHERE `Name` = mobname) > 0 THEN\n"
" SET Result = 'B';\n"
" END IF;\n "
"\n"
" RETURN Result;\n"
"END"
);
results = QueryDatabase(rquery);
/* Update view `vwgroups` */
rquery = StringFormat("DROP VIEW IF EXISTS `vwGroups`;");
results = QueryDatabase(rquery);
rquery = StringFormat(
"CREATE VIEW `vwGroups` AS\n"
"SELECT g.`groupid` AS groupid,\n"
"GetMobType(g.`name`) AS mobtype,\n"
"g.`name` AS name,\n"
"g.`charid` AS mobid,\n"
"IFNULL(c.`level`, b.`BotLevel`) AS level\n"
"FROM `group_id` AS g\n"
"LEFT JOIN `character_data` AS c ON g.`name` = c.`name`\n"
"LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;"
);
results = QueryDatabase(rquery);
/* Update view `vwbotgroups` */
rquery = StringFormat("DROP VIEW IF EXISTS `vwBotGroups`;");
results = QueryDatabase(rquery);
rquery = StringFormat(
"CREATE VIEW `vwBotGroups` AS\n"
"SELECT g.`BotGroupId`,\n"
"g.`BotGroupName`,\n"
"g.`BotGroupLeaderBotId`,\n"
"b.`Name` AS BotGroupLeaderName,\n"
"b.`BotOwnerCharacterId`,\n"
"c.`name` AS BotOwnerCharacterName\n"
"FROM `botgroup` AS g\n"
"JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID`\n"
"JOIN `character_data` AS c ON b.`BotOwnerCharacterID` = c.`id`\n"
"ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;"
);
results = QueryDatabase(rquery);
/* Update view `vwguildmembers` */
rquery = StringFormat("DROP VIEW IF EXISTS `vwGuildMembers`;");
results = QueryDatabase(rquery);
rquery = StringFormat(
"CREATE VIEW `vwGuildMembers` AS\n"
"SELECT 'C' AS mobtype,\n"
"cm.`char_id`,\n"
"cm.`guild_id`,\n"
"cm.`rank`,\n"
"cm.`tribute_enable`,\n"
"cm.`total_tribute`,\n"
"cm.`last_tribute`,\n"
"cm.`banker`,\n"
"cm.`public_note`,\n"
"cm.`alt`\n"
"FROM `guild_members` AS cm\n"
"UNION ALL\n"
"SELECT 'B' AS mobtype,\n"
"bm.`char_id`,\n"
"bm.`guild_id`,\n"
"bm.`rank`,\n"
"bm.`tribute_enable`,\n"
"bm.`total_tribute`,\n"
"bm.`last_tribute`,\n"
"bm.`banker`,\n"
"bm.`public_note`,\n"
"bm.`alt`\n"
"FROM `botguildmembers` AS bm;"
);
results = QueryDatabase(rquery);
}
if (runbotsconvert == 1){
printf("\n\nBot views/function conversion complete, continuing world bootup...\n");
}
#endif
return true;
}
bool Database::CheckDatabaseConvertCorpseDeblob(){
Convert::DBPlayerCorpse_Struct_temp* dbpc;
Convert::classic_db_temp::DBPlayerCorpse_Struct_temp* dbpc_c;

View File

@ -867,16 +867,16 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) {
//factored out so I dont have to copy this crap.
#ifdef BOTS
#define GuildMemberBaseQuery \
"SELECT c.id,c.name,c.class,c.level,c.last_login,c.zone_id," \
" g.guild_id,g.rank,g.tribute_enable,g.total_tribute,g.last_tribute," \
" g.banker,g.public_note,g.alt" \
" FROM vwBotCharacterMobs AS c LEFT JOIN vwGuildMembers AS g ON c.id=g.char_id AND c.mobtype = g.mobtype "
"SELECT c.`id`, c.`name`, c.`class`, c.`level`, c.`last_login`, c.`zone_id`," \
" g.`guild_id`, g.`rank`, g.`tribute_enable`, g.`total_tribute`, g.`last_tribute`," \
" g.`banker`, g.`public_note`, g.`alt`" \
" FROM `vw_bot_character_mobs` AS c LEFT JOIN `vw_guild_members` AS g ON c.`id` = g.`char_id` AND c.`mob_type` = g.`mob_type` "
#else
#define GuildMemberBaseQuery \
"SELECT c.id,c.name,c.class,c.level,c.last_login,c.zone_id," \
" g.guild_id,g.rank,g.tribute_enable,g.total_tribute,g.last_tribute," \
" g.banker,g.public_note,g.alt " \
" FROM `character_data` AS c LEFT JOIN guild_members AS g ON c.id=g.char_id "
"SELECT c.`id`, c.`name`, c.`class`, c.`level`, c.`last_login`, c.`zone_id`," \
" g.`guild_id`, g.`rank`, g.`tribute_enable`, g.`total_tribute`, g.`last_tribute`," \
" g.`banker`, g.`public_note`, g.`alt` " \
" FROM `character_data` AS c LEFT JOIN `guild_members` AS g ON c.`id` = g.`char_id` "
#endif
static void ProcessGuildMember(MySQLRequestRow row, CharGuildInfo &into) {
//fields from `characer_`

View File

@ -502,16 +502,16 @@ RULE_CATEGORY_END()
#ifdef BOTS
RULE_CATEGORY(Bots)
RULE_REAL(Bots, BotManaRegen, 2.0) // Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.
RULE_BOOL(Bots, BotFinishBuffing, false) // Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.
RULE_INT(Bots, CreateBotCount, 150) // Number of bots that each account can create
RULE_INT(Bots, SpawnBotCount, 71) // Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid
RULE_BOOL(Bots, BotQuest, false) // Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl
RULE_BOOL(Bots, BotGroupBuffing, false) // Bots will cast single target buffs as group buffs, default is false for single. Does not make single target buffs work for MGB.
RULE_BOOL(Bots, BotSpellQuest, false) // Anita Thrall's (Anita_Thrall.pl) Bot Spell Scriber quests.
RULE_INT(Bots, BotAAExpansion, 8) // Bots get AAs through this expansion
RULE_INT(Bots, AAExpansion, 8) // Bots get AAs through this expansion
RULE_INT(Bots, CreationLimit, 150) // Number of bots that each account can create
RULE_BOOL(Bots, FinishBuffing, false) // Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.
RULE_BOOL(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.
RULE_REAL(Bots, ManaRegen, 2.0) // Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.
RULE_BOOL(Bots, QuestableSpawnLimit, false) // Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl
RULE_BOOL(Bots, QuestableSpells, false) // Anita Thrall's (Anita_Thrall.pl) Bot Spell Scriber quests.
RULE_INT(Bots, SpawnLimit, 71) // Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid
RULE_BOOL(Bots, BotGroupXP, false) // Determines whether client gets xp for bots outside their group.
RULE_BOOL(Bots, BotBardUseOutOfCombatSongs, true) // Determines whether bard bots use additional out of combat songs.
RULE_BOOL(Bots, BotBardUseOutOfCombatSongs, true) // Determines whether bard bots use additional out of combat songs (optional script)
RULE_BOOL(Bots, BotLevelsWithOwner, false) // Auto-updates spawned bots as owner levels/de-levels (false is original behavior)
RULE_BOOL(Bots, BotCharacterLevelEnabled, false) // Enables required level to spawn bots
RULE_INT(Bots, BotCharacterLevel, 0) // 0 as default (if level > this value you can spawn bots if BotCharacterLevelEnabled is true)

View File

@ -2007,24 +2007,21 @@ void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const Insp
auto results = QueryDatabase(query);
}
void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) {
std::string query = StringFormat("SELECT BotInspectMessage FROM bots WHERE BotID = %i", botid);
#ifdef BOTS
void SharedDatabase::GetBotInspectMessage(uint32 bot_id, InspectMessage_Struct* message)
{
std::string query = StringFormat("SELECT `inspect_message` FROM `bot_inspect_messages` WHERE `bot_id` = %i LIMIT 1", bot_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
return;
auto row = results.begin();
memset(message, '\0', sizeof(InspectMessage_Struct));
for (auto row = results.begin(); row != results.end(); ++row) {
memcpy(message, row[0], sizeof(InspectMessage_Struct));
}
if (results.RowCount() != 1)
return;
auto row = results.begin();
memcpy(message, row[0], sizeof(InspectMessage_Struct));
}
void SharedDatabase::SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message) {
std::string msg = EscapeString(message->text);
std::string query = StringFormat("UPDATE bots SET BotInspectMessage = '%s' WHERE BotID = %i", msg.c_str(), botid);
QueryDatabase(query);
void SharedDatabase::SetBotInspectMessage(uint32 bot_id, const InspectMessage_Struct* message)
{
std::string query = StringFormat("REPLACE INTO `bot_inspect_messages` (bot_id, inspect_message) VALUES (%u, '%s')", bot_id, EscapeString(message->text).c_str());
auto results = QueryDatabase(query);
}
#endif

View File

@ -51,8 +51,6 @@ class SharedDatabase : public Database
int32 DeleteStalePlayerCorpses();
void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message);
void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message);
void GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message);
void SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message);
bool GetCommandSettings(std::map<std::string, uint8> &commands);
uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID);
@ -128,6 +126,11 @@ class SharedDatabase : public Database
void LoadBaseData(void *data, int max_level);
const BaseDataStruct* GetBaseData(int lvl, int cl);
#ifdef BOTS
void GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message);
void SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message);
#endif
protected:
std::unique_ptr<EQEmu::MemoryMappedFile> skill_caps_mmf;

View File

@ -1,4 +1,4 @@
9000|2015_09_30_bots.sql|SHOW TABLES LIKE 'bot%'|empty|
9000|2015_09_30_bots.sql|SHOW TABLES LIKE 'bot_data'|empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1,88 @@
-- 'drop_bots (pre-update script)' sql script file
-- current as of 10/09/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.
SELECT "dropping views...";
DROP VIEW IF EXISTS `vwGuildMembers`;
DROP VIEW IF EXISTS `vwGroups`;
DROP VIEW IF EXISTS `vwBotGroups`;
DROP VIEW IF EXISTS `vwBotCharacterMobs`;
SELECT "dropping functions...";
DROP FUNCTION IF EXISTS `GetMobTypeByName`;
DROP FUNCTION IF EXISTS `GetMobTypeByID`;
DROP FUNCTION IF EXISTS `GetMobType`;
SELECT "dropping tables...";
DROP TABLE IF EXISTS `botguildmembers`;
DROP TABLE IF EXISTS `botgroupmembers`;
DROP TABLE IF EXISTS `botgroup`;
DROP TABLE IF EXISTS `botgroups`; -- this table is not a part of 'load_bots.sql'
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 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 ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'group_id' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
-- IF ((SHOW KEYS IN `group_id` WHERE `Key_name` LIKE 'PRIMARY') != '') THEN
ALTER TABLE `group_id` DROP PRIMARY KEY;
END IF;
ALTER TABLE `group_id` ADD PRIMARY KEY (`groupid`, `charid`, `ismerc`);
IF ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'guild_members' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
-- IF ((SHOW KEYS IN `guild_members` WHERE `Key_name` LIKE '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 ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'db_version' AND `COLUMN_NAME` = 'bots_version') > 0) THEN
-- IF ((SHOW COLUMNS FROM `db_version` LIKE 'bots_version') != '') THEN
UPDATE `db_version`
SET `bots_version` = 0;
END IF;
END$$
DELIMITER ;
CALL `DropBotsSchema`();
SELECT "dropping procedure...";
DROP PROCEDURE IF EXISTS `DropBotsSchema`;
-- End of File

View File

@ -1,41 +1,100 @@
-- 'drop_bots' sql script file
-- current as of 10/15/2014
-- current as of 10/09/2015
--
-- Note: This file will revert all changes made by either 'load_bots' sql file.
-- 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.
--
-- If this script fails due to a 'SQL Error (1068): Multiple primary key defined'
-- error, run this query: ALTER TABLE `guild_members` DROP PRIMARY KEY;
-- and it should remove the key so this script will process in its entirety.
ALTER TABLE `guild_members` ADD PRIMARY KEY (`char_id`);
ALTER TABLE `group_id` DROP PRIMARY KEY, ADD PRIMARY KEY (`groupid`, `charid`, `ismerc`);
SELECT "dropping views...";
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`;
UPDATE `spawn2` SET `enabled` = 0 WHERE `id` IN (59297,59298);
DELETE FROM `commands` WHERE `command` = 'bot';
DELETE FROM `rule_values` WHERE `rule_name` LIKE 'Bots%';
DROP VIEW IF EXISTS `vwBotCharacterMobs`;
DROP VIEW IF EXISTS `vwBotGroups`;
DROP VIEW IF EXISTS `vwGroups`;
DROP VIEW IF EXISTS `vwGuildMembers`;
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`;
-- this table is not a part of 'load_bots.sql'
DROP TABLE IF EXISTS `botgroups`;
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`;
SELECT "dropping tables...";
DROP TABLE IF EXISTS `botguildmembers_old`;
DROP TABLE IF EXISTS `botgroupmembers_old`;
DROP TABLE IF EXISTS `botgroup_old`;
DROP TABLE IF EXISTS `botpetinventory_old`;
DROP TABLE IF EXISTS `botpetbuffs_old`;
DROP TABLE IF EXISTS `botpets_old`;
DROP TABLE IF EXISTS `botinventory_old`;
DROP TABLE IF EXISTS `botbuffs_old`;
DROP TABLE IF EXISTS `bottimers_old`;
DROP TABLE IF EXISTS `botstances_old`;
DROP TABLE IF EXISTS `bots_old`;
DROP TABLE IF EXISTS `bot_guild_members`;
DROP TABLE IF EXISTS `bot_group_members`;
DROP TABLE IF EXISTS `bot_groups`;
DROP TABLE IF EXISTS `bot_pet_inventories`;
DROP TABLE IF EXISTS `bot_pet_buffs`;
DROP TABLE IF EXISTS `bot_pets`;
DROP TABLE IF EXISTS `bot_inventories`;
DROP TABLE IF EXISTS `bot_buffs`;
DROP TABLE IF EXISTS `bot_timers`;
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 ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'group_id' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
-- IF ((SHOW KEYS IN `group_id` WHERE `Key_name` LIKE 'PRIMARY') != '') THEN
ALTER TABLE `group_id` DROP PRIMARY KEY;
END IF;
ALTER TABLE `group_id` ADD PRIMARY KEY (`groupid`, `charid`, `ismerc`);
IF ((SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'guild_members' AND `CONSTRAINT_NAME` = 'PRIMARY') > 0) THEN
-- IF ((SHOW KEYS IN `guild_members` WHERE `Key_name` LIKE '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 ((SELECT COUNT(*) FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = DATABASE() AND `TABLE_NAME` = 'db_version' AND `COLUMN_NAME` = 'bots_version') > 0) THEN
-- IF ((SHOW COLUMNS FROM `db_version` LIKE 'bots_version') != '') THEN
UPDATE `db_version`
SET `bots_version` = 0;
END IF;
END$$
DELIMITER ;
CALL `DropBotsSchema`();
SELECT "dropping procedure...";
DROP PROCEDURE IF EXISTS `DropBotsSchema`;
-- End of File

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -883,7 +883,7 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
int32 hasMana = GetMana();
// Allow bots to cast buff spells even if they are out of mana
if(RuleB(Bots, BotFinishBuffing)) {
if(RuleB(Bots, FinishBuffing)) {
if(manaCost > hasMana) {
// Let's have the bots complete the buff time process
if(AIspells[i].type & SpellType_Buff) {

View File

@ -2041,23 +2041,23 @@ void QuestManager::popup(const char *title, const char *text, uint32 popupid, ui
#ifdef BOTS
int QuestManager::createbotcount() {
return RuleI(Bots, CreateBotCount);
return RuleI(Bots, CreationLimit);
}
int QuestManager::spawnbotcount() {
return RuleI(Bots, SpawnBotCount);
return RuleI(Bots, SpawnLimit);
}
bool QuestManager::botquest()
{
return RuleB(Bots, BotQuest);
return RuleB(Bots, QuestableSpawnLimit);
}
bool QuestManager::createBot(const char *name, const char *lastname, uint8 level, uint16 race, uint8 botclass, uint8 gender)
{
QuestManagerCurrentQuestVars();
std::string TempErrorMessage;
uint32 MaxBotCreate = RuleI(Bots, CreateBotCount);
uint32 MaxBotCreate = RuleI(Bots, CreationLimit);
if (initiator && initiator->IsClient())
{