mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-03 23:03:51 +00:00
Fixed BOTS auto-convert code and load/drop scripts. Added a sql for fixing an existing database that was auto-converted incorrectly (located in ../bots/deprecated)
This commit is contained in:
parent
6028dbb4e5
commit
2267881d52
@ -1,5 +1,9 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 10/16/2014 ==
|
||||
Uleat: Fixed the auto-conversion view naming error and renamed the views in the script files. Added a fix sql for databases that auto-converted.
|
||||
Fix SQL: ../sql/git/bots/deprecated/2014_10_16_Lower_Case_View_Fix.sql
|
||||
|
||||
== 10/15/2014 ==
|
||||
Uleat: Cleaned up load/drop bots sqls, added '../utils/sql/git/bots/deprecated' and '../deprecated/load_bots_old.sql' (use this file on pre-player blob conversion databases.)
|
||||
Notes: I modifed the behavior of both load and drop bots to fail on the first operation if their modifications have been performed already.
|
||||
|
||||
@ -1921,7 +1921,7 @@ bool Database::CheckDatabaseConversions() {
|
||||
int runbotsconvert = 0;
|
||||
|
||||
/* Check For Legacy Bot References */
|
||||
rquery = StringFormat("SHOW CREATE VIEW `vwbotcharactermobs`");
|
||||
rquery = StringFormat("SHOW CREATE VIEW `vwBotCharacterMobs`");
|
||||
results = QueryDatabase(rquery);
|
||||
if (results.RowCount() == 1){
|
||||
auto row = results.begin();
|
||||
@ -1948,12 +1948,12 @@ bool Database::CheckDatabaseConversions() {
|
||||
printf("Running bot views/function database conversion... \n");
|
||||
|
||||
/* Update view `vwbotcharactermobs` */
|
||||
rquery = StringFormat("DROP VIEW `vwbotcharactermobs`;");
|
||||
rquery = StringFormat("DROP VIEW `vwBotCharacterMobs`;");
|
||||
results = QueryDatabase(rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwbotcharactermobs`", rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwBotCharacterMobs`", rquery);
|
||||
|
||||
rquery = StringFormat(
|
||||
"CREATE VIEW `vwbotcharactermobs` AS\n"
|
||||
"CREATE VIEW `vwBotCharacterMobs` AS\n"
|
||||
"SELECT _utf8'C' AS mobtype,\n" // Natedog: '_utf8'
|
||||
"c.`id`,\n"
|
||||
"c.`name`,\n"
|
||||
@ -1973,7 +1973,7 @@ bool Database::CheckDatabaseConversions() {
|
||||
"FROM bots AS b;"
|
||||
);
|
||||
results = QueryDatabase(rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Create View `vwbotcharactermobs`", rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Create View `vwBotCharacterMobs`", rquery);
|
||||
|
||||
|
||||
/* Update function `GetMobType` */
|
||||
@ -2002,12 +2002,12 @@ bool Database::CheckDatabaseConversions() {
|
||||
|
||||
|
||||
/* Update view `vwgroups` */
|
||||
rquery = StringFormat("DROP VIEW IF EXISTS `vwgroups`;");
|
||||
rquery = StringFormat("DROP VIEW IF EXISTS `vwGroups`;");
|
||||
results = QueryDatabase(rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwgroups`", rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwGroups`", rquery);
|
||||
|
||||
rquery = StringFormat(
|
||||
"CREATE VIEW `vwgroups` AS\n"
|
||||
"CREATE VIEW `vwGroups` AS\n"
|
||||
"SELECT g.`groupid` AS groupid,\n"
|
||||
"GetMobType(g.`name`) AS mobtype,\n"
|
||||
"g.`name` AS name,\n"
|
||||
@ -2018,16 +2018,16 @@ bool Database::CheckDatabaseConversions() {
|
||||
"LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;"
|
||||
);
|
||||
results = QueryDatabase(rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Create View `vwgroups`", rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Create View `vwGroups`", rquery);
|
||||
|
||||
|
||||
/* Update view `vwbotgroups` */
|
||||
rquery = StringFormat("DROP VIEW IF EXISTS `vwbotgroups`;");
|
||||
rquery = StringFormat("DROP VIEW IF EXISTS `vwBotGroups`;");
|
||||
results = QueryDatabase(rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwbotgroups`", rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwBotGroups`", rquery);
|
||||
|
||||
rquery = StringFormat(
|
||||
"CREATE VIEW `vwbotgroups` AS\n"
|
||||
"CREATE VIEW `vwBotGroups` AS\n"
|
||||
"SELECT g.`BotGroupId`,\n"
|
||||
"g.`BotGroupName`,\n"
|
||||
"g.`BotGroupLeaderBotId`,\n"
|
||||
@ -2040,16 +2040,16 @@ bool Database::CheckDatabaseConversions() {
|
||||
"ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;"
|
||||
);
|
||||
results = QueryDatabase(rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Create View `vwbotgroups`", rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Create View `vwBotGroups`", rquery);
|
||||
|
||||
|
||||
/* Update view `vwguildmembers` */
|
||||
rquery = StringFormat("DROP VIEW IF EXISTS `vwguildmembers`;");
|
||||
rquery = StringFormat("DROP VIEW IF EXISTS `vwGuildMembers`;");
|
||||
results = QueryDatabase(rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwguildmembers`", rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Drop View `vwGuildMembers`", rquery);
|
||||
|
||||
rquery = StringFormat(
|
||||
"CREATE VIEW `vwguildmembers` AS\n"
|
||||
"CREATE VIEW `vwGuildMembers` AS\n"
|
||||
"SELECT 'C' AS mobtype,\n"
|
||||
"cm.`char_id`,\n"
|
||||
"cm.`guild_id`,\n"
|
||||
@ -2075,7 +2075,7 @@ bool Database::CheckDatabaseConversions() {
|
||||
"FROM `botguildmembers` AS bm;"
|
||||
);
|
||||
results = QueryDatabase(rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Create View `vwguildmembers`", rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "Create View `vwGuildMembers`", rquery);
|
||||
}
|
||||
|
||||
if (runbotsconvert == 1){
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
-- A fix for the auto-conversion view renaming issue
|
||||
|
||||
|
||||
DROP VIEW IF EXISTS `vwbotcharactermobs`;
|
||||
DROP VIEW IF EXISTS `vwbotgroups`;
|
||||
DROP VIEW IF EXISTS `vwgroups`;
|
||||
DROP VIEW IF EXISTS `vwguildmembers`;
|
||||
|
||||
|
||||
CREATE VIEW `vwBotCharacterMobs` AS
|
||||
SELECT _utf8'C' AS mobtype,
|
||||
c.`id`,
|
||||
c.`name`,
|
||||
c.`class`,
|
||||
c.`level`,
|
||||
c.`last_login`,
|
||||
c.`zone_id`
|
||||
FROM `character_data` AS c
|
||||
UNION ALL
|
||||
SELECT _utf8'B' AS mobtype,
|
||||
b.`BotID` AS id,
|
||||
b.`Name` AS name,
|
||||
b.`Class` AS class,
|
||||
b.`BotLevel` AS level,
|
||||
0 AS timelaston,
|
||||
0 AS zoneid
|
||||
FROM bots AS b;
|
||||
|
||||
CREATE VIEW `vwGroups` AS
|
||||
SELECT g.`groupid` AS groupid,
|
||||
GetMobType(g.`name`) AS mobtype,
|
||||
g.`name` AS name,
|
||||
g.`charid` AS mobid,
|
||||
IFNULL(c.`level`, b.`BotLevel`) AS level
|
||||
FROM `group_id` AS g
|
||||
LEFT JOIN `character_data` AS c ON g.`name` = c.`name`
|
||||
LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;
|
||||
|
||||
CREATE VIEW `vwBotGroups` AS
|
||||
SELECT g.`BotGroupId`,
|
||||
g.`BotGroupName`,
|
||||
g.`BotGroupLeaderBotId`,
|
||||
b.`Name` AS BotGroupLeaderName,
|
||||
b.`BotOwnerCharacterId`,
|
||||
c.`name` AS BotOwnerCharacterName
|
||||
FROM `botgroup` AS g
|
||||
JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID`
|
||||
JOIN `character_data` AS c ON b.`BotOwnerCharacterID` = c.`id`
|
||||
ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;
|
||||
|
||||
CREATE VIEW `vwGuildMembers` AS
|
||||
SELECT 'C' AS mobtype,
|
||||
cm.`char_id`,
|
||||
cm.`guild_id`,
|
||||
cm.`rank`,
|
||||
cm.`tribute_enable`,
|
||||
cm.`total_tribute`,
|
||||
cm.`last_tribute`,
|
||||
cm.`banker`,
|
||||
cm.`public_note`,
|
||||
cm.`alt`
|
||||
FROM `guild_members` AS cm
|
||||
UNION ALL
|
||||
SELECT 'B' AS mobtype,
|
||||
bm.`char_id`,
|
||||
bm.`guild_id`,
|
||||
bm.`rank`,
|
||||
bm.`tribute_enable`,
|
||||
bm.`total_tribute`,
|
||||
bm.`last_tribute`,
|
||||
bm.`banker`,
|
||||
bm.`public_note`,
|
||||
bm.`alt`
|
||||
FROM `botguildmembers` AS bm;
|
||||
@ -213,7 +213,7 @@ END//
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
CREATE VIEW `vwbotcharactermobs` AS
|
||||
CREATE VIEW `vwBotCharacterMobs` AS
|
||||
SELECT _utf8'C' AS mobtype,
|
||||
c.`id`,
|
||||
c.`name`,
|
||||
@ -232,7 +232,7 @@ b.`BotLevel` AS level,
|
||||
0 AS zoneid
|
||||
FROM bots AS b;
|
||||
|
||||
CREATE VIEW `vwgroups` AS
|
||||
CREATE VIEW `vwGroups` AS
|
||||
SELECT g.`groupid` AS groupid,
|
||||
GetMobType(g.`name`) AS mobtype,
|
||||
g.`name` AS name,
|
||||
@ -242,7 +242,7 @@ FROM `group_id` AS g
|
||||
LEFT JOIN `character_` AS c ON g.`name` = c.`name`
|
||||
LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;
|
||||
|
||||
CREATE VIEW `vwbotgroups` AS
|
||||
CREATE VIEW `vwBotGroups` AS
|
||||
SELECT g.`BotGroupId`,
|
||||
g.`BotGroupName`,
|
||||
g.`BotGroupLeaderBotId`,
|
||||
@ -254,7 +254,7 @@ JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID`
|
||||
JOIN `character_` AS c ON b.`BotOwnerCharacterID` = c.`id`
|
||||
ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;
|
||||
|
||||
CREATE VIEW `vwguildmembers` AS
|
||||
CREATE VIEW `vwGuildMembers` AS
|
||||
SELECT 'C' AS mobtype,
|
||||
cm.`char_id`,
|
||||
cm.`guild_id`,
|
||||
|
||||
@ -15,10 +15,10 @@ 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`;
|
||||
DROP VIEW IF EXISTS `vwBotCharacterMobs`;
|
||||
DROP VIEW IF EXISTS `vwBotGroups`;
|
||||
DROP VIEW IF EXISTS `vwGroups`;
|
||||
DROP VIEW IF EXISTS `vwGuildMembers`;
|
||||
|
||||
DROP FUNCTION IF EXISTS `GetMobType`;
|
||||
|
||||
|
||||
@ -213,7 +213,7 @@ END\\
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
CREATE VIEW `vwbotcharactermobs` AS
|
||||
CREATE VIEW `vwBotCharacterMobs` AS
|
||||
SELECT _utf8'C' AS mobtype,
|
||||
c.`id`,
|
||||
c.`name`,
|
||||
@ -232,7 +232,7 @@ b.`BotLevel` AS level,
|
||||
0 AS zoneid
|
||||
FROM bots AS b;
|
||||
|
||||
CREATE VIEW `vwgroups` AS
|
||||
CREATE VIEW `vwGroups` AS
|
||||
SELECT g.`groupid` AS groupid,
|
||||
GetMobType(g.`name`) AS mobtype,
|
||||
g.`name` AS name,
|
||||
@ -242,7 +242,7 @@ FROM `group_id` AS g
|
||||
LEFT JOIN `character_data` AS c ON g.`name` = c.`name`
|
||||
LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;
|
||||
|
||||
CREATE VIEW `vwbotgroups` AS
|
||||
CREATE VIEW `vwBotGroups` AS
|
||||
SELECT g.`BotGroupId`,
|
||||
g.`BotGroupName`,
|
||||
g.`BotGroupLeaderBotId`,
|
||||
@ -254,7 +254,7 @@ JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID`
|
||||
JOIN `character_data` AS c ON b.`BotOwnerCharacterID` = c.`id`
|
||||
ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;
|
||||
|
||||
CREATE VIEW `vwguildmembers` AS
|
||||
CREATE VIEW `vwGuildMembers` AS
|
||||
SELECT 'C' AS mobtype,
|
||||
cm.`char_id`,
|
||||
cm.`guild_id`,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user