View Single Post
  #4  
Old 12-08-2011, 01:31 AM
lockjaws
Fire Beetle
 
Join Date: Jun 2008
Location: UK
Posts: 13
Default

I'm not a expert but for a server build with bots you require

Views:

vwbotcharactermobs
vwbotgroups
vwgroups
vwguildmembers

Functions:

GetMobType
GetMobTypeById
GetMobTypeByName

These also break guild lists in guild management, Possibily other things too.

so check views and function underneath tables in your databse.
if you are having issues with bots and such, copy and paste the missing ones
and run them as a query.
Code:
-- ----------------------------
-- View structure for `vwbotcharactermobs`
-- ----------------------------
DROP VIEW IF EXISTS `vwbotcharactermobs`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vwbotcharactermobs` AS select 'C' AS `mobtype`,`c`.`id` AS `id`,`c`.`name` AS `name`,`c`.`class` AS `class`,`c`.`level` AS `level`,`c`.`timelaston` AS `timelaston`,`c`.`zoneid` AS `zoneid` from `character_` `c` union all select '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` `b`;

-- ----------------------------
-- View structure for `vwbotgroups`
-- ----------------------------
DROP VIEW IF EXISTS `vwbotgroups`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vwbotgroups` AS select `g`.`BotGroupId` AS `BotGroupId`,`g`.`BotGroupName` AS `BotGroupName`,`g`.`BotGroupLeaderBotId` AS `BotGroupLeaderBotId`,`b`.`Name` AS `BotGroupLeaderName`,`b`.`BotOwnerCharacterID` AS `BotOwnerCharacterId`,`c`.`name` AS `BotOwnerCharacterName` from ((`botgroup` `g` join `bots` `b` on((`g`.`BotGroupLeaderBotId` = `b`.`BotID`))) join `character_` `c` on((`b`.`BotOwnerCharacterID` = `c`.`id`))) order by `b`.`BotOwnerCharacterID`,`g`.`BotGroupName`;

-- ----------------------------
-- View structure for `vwgroups`
-- ----------------------------
DROP VIEW IF EXISTS `vwgroups`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vwgroups` AS select `g`.`groupid` AS `groupid`,`GetMobTypeByName`(`g`.`name`) AS `mobtype`,`g`.`name` AS `name`,`g`.`charid` AS `mobid`,ifnull(`c`.`level`,`b`.`BotLevel`) AS `level` from ((`group_id` `g` left join `character_` `c` on((`g`.`name` = `c`.`name`))) left join `bots` `b` on((`g`.`name` = `b`.`Name`)));

-- ----------------------------
-- View structure for `vwguildmembers`
-- ----------------------------
DROP VIEW IF EXISTS `vwguildmembers`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vwguildmembers` AS select 'C' AS `mobtype`,`cm`.`char_id` AS `char_id`,`cm`.`guild_id` AS `guild_id`,`cm`.`rank` AS `rank`,`cm`.`tribute_enable` AS `tribute_enable`,`cm`.`total_tribute` AS `total_tribute`,`cm`.`last_tribute` AS `last_tribute`,`cm`.`banker` AS `banker`,`cm`.`public_note` AS `public_note`,`cm`.`alt` AS `alt` from `guild_members` `cm` union all select 'B' AS `mobtype`,`bm`.`char_id` AS `char_id`,`bm`.`guild_id` AS `guild_id`,`bm`.`rank` AS `rank`,`bm`.`tribute_enable` AS `tribute_enable`,`bm`.`total_tribute` AS `total_tribute`,`bm`.`last_tribute` AS `last_tribute`,`bm`.`banker` AS `banker`,`bm`.`public_note` AS `public_note`,0 AS `alt` from `botguildmembers` `bm`;
and this for functions

Code:
-- ----------------------------
-- Function structure for `GetMobType`
-- ----------------------------
DROP FUNCTION IF EXISTS `GetMobType`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `GetMobType`(mobname VARCHAR(64)) RETURNS char(1) CHARSET latin1
BEGIN
    DECLARE Result CHAR(1);

    SET Result = NULL;

    IF (select count(*) from character_ where name = mobname) > 0 THEN
      SET Result = 'C';
    ELSEIF (select count(*) from bots where Name = mobname) > 0 THEN
      SET Result = 'B';
    END IF;

    RETURN Result;
END;;
DELIMITER ;

-- ----------------------------
-- Function structure for `GetMobTypeById`
-- ----------------------------
DROP FUNCTION IF EXISTS `GetMobTypeById`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `GetMobTypeById`(mobid INTEGER UNSIGNED) RETURNS char(1) CHARSET latin1
BEGIN
    DECLARE Result CHAR(1);

    SET Result = NULL;

    IF (select id from character_ where id = mobid) > 0 THEN
      SET Result = 'C';
    ELSEIF (select BotID from bots where BotID = mobid) > 0 THEN
      SET Result = 'B';
    END IF;

    RETURN Result;
END;;
DELIMITER ;

-- ----------------------------
-- Function structure for `GetMobTypeByName`
-- ----------------------------
DROP FUNCTION IF EXISTS `GetMobTypeByName`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `GetMobTypeByName`(mobname VARCHAR(64)) RETURNS char(1) CHARSET latin1
BEGIN
    DECLARE Result CHAR(1);

    SET Result = NULL;

    IF (select id from character_ where name = mobname) > 0 THEN
      SET Result = 'C';
    ELSEIF (select BotID from bots where Name = mobname) > 0 THEN
      SET Result = 'B';
    END IF;

    RETURN Result;
END;;
DELIMITER ;
Reply With Quote