EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bots (https://www.eqemulator.org/forums/forumdisplay.php?f=676)
-   -   Bots DB Versioning (https://www.eqemulator.org/forums/showthread.php?t=40091)

Uleat 10-12-2015 06:22 PM

Bots DB Versioning
 
Bots now have a database versioning system!


To access this feature, you MUST have compiled binaries with the cmake 'BOTS' enabled option.


Adding/updating your database schema for bots is simple:

1) Run the eqemu_update.pl script

** It is recommended that you backup your database using one of the backup options before proceeding **

2) Select the "4) [EQEmu DB Bots Schema] Check for Bot REQUIRED database updates... (Must have bots enabled)" option

3) Select the option again if there are PENDING updates


That's all there is to it!


Notes on what will occur:

- For non-bots databases, all required schema will be applied

- For databases with existing schema:

--> The new schema will be created

--> A required conversion will be applied

--> The original tables will be renamed to <table_name>##'_old'


For administrators who run an active 'bots' server, I recommend letting this settle for a day or two so that anything I may
have missed can be addressed.

As currently implemented, bots must be updated by running the script. The methodology of the 'world' process call is not setup
to handle the 'bots' integration.

I have tested this pretty thoroughly and Akkadius tested the changes to the eqemu_update.pl script prior.


Hopefully, this will be a move in the right direction for keeping bots active and not side-lined!


================================================== ================================================== ===


Changes:

- Bot database schema now more closely reflects the Player Profile conversion schema

- Some new fields have been added to a few tables for near-future implementations

- Bot time is now the int-based UNIX_TIMESTAMP standard - matching current character fields

- Default rules have been renamed to address 'naming oddities' in contextual reference

- A few broken processes have been fixed and are working properly


================================================== ================================================== ===


Special note on restoring bots database backups: http://www.eqemulator.org/forums/sho...d.php?p=244321

jpyou127 10-12-2015 09:15 PM

You the man Uleat!

Uleat 10-12-2015 09:19 PM

If you're running a 'bots' server, please keep an eye on this thread for important fixes related to this implementation.


- Fix Bot::Save() - mislabeled column name `creation_date` correction in new bot save code (thanks rencro!)

Akkadius 10-12-2015 09:48 PM

Nice work Uleat!

Uleat 10-12-2015 09:51 PM

You're my master!

Uleat 10-13-2015 12:30 AM

The 2015_09_30_bots.sql file has been updated to exclude broken key constraints and the system has been re-enabled.


Please post if you run into any issues.

Sorry for the inconvenience!

Uleat 10-23-2015 03:54 PM

Here is the result of a 'standard' post-conversion bot tables query: http://wiki.eqemulator.org/i?Module=...Paste=TtvuBFHN

If you have custom tables, they should be updated to reflect any name changes to the 'standard' bots schema.

Uleat 10-24-2015 12:25 AM

There is a known issue being addressed with the 2015_09_30_bots.sql file.

The update script will report errors at these lines:
- #675
- #735
- #755
- #768
- #779

It was traced to the conditional check for `bot_inventories` regarding the 6th augment slot.

If you're having issues with this, please ask for a solution in this thread.

dfusion111 11-04-2015 11:22 PM

I updated to latest bot code and found there is a nasty bug with loading bots.
The HP values don't match with the rows its referencing, thus HP is always set to 75 when they are loaded/spawned
(bc it references atk and loads it into the hp field).
I was wondering why every time I spawned a bot it would have low health.
So in bots.cpp LoadBot function, change the atoi(row[27]) to atoi(row[28]) and its fixed!

Figured you guys would want to know.
Here is the whole function(fixed) so you can see what I mean.
Code:

Bot* Bot::LoadBot(uint32 botID, std::string* errorMessage)
{
        if(botID == 0)
                return nullptr;
       
        std::string query = StringFormat(
                "SELECT"
                " `owner_id`,"
                " `spells_id`,"
                " `name`,"
                " `last_name`,"
                " `title`,"                                /*planned use[4]*/
                " `suffix`,"                        /*planned use[5]*/
                " `zone_id`,"
                " `gender`,"
                " `race`,"
                " `class`,"
                " `level`,"
                " `deity`,"                                /*planned use[11]*/
                " `creation_day`,"                /*not in-use[12]*/
                " `last_spawn`,"                /*not in-use[13]*/
                " `time_spawned`,"
                " `size`,"
                " `face`,"
                " `hair_color`,"
                " `hair_style`,"
                " `beard`,"
                " `beard_color`,"
                " `eye_color_1`,"
                " `eye_color_2`,"
                " `drakkin_heritage`,"
                " `drakkin_tattoo`,"
                " `drakkin_details`,"
                " `ac`,"                                /*not in-use[26]*/
                " `atk`," // 27 is atk not hp, bug below
                " `hp`,"  // 28 is hp
                " `mana`,"                                /*not in-use[29]*/
                " `str`,"                                /*not in-use[30]*/
                " `sta`,"                                /*not in-use[31]*/
                " `cha`,"                                /*not in-use[32]*/
                " `dex`,"                                /*not in-use[33]*/
                " `int`,"                                /*not in-use[34]*/
                " `agi`,"                                /*not in-use[35]*/
                " `wis`,"                                /*not in-use[36]*/
                " `fire`,"                                /*not in-use[37]*/
                " `cold`,"                                /*not in-use[38]*/
                " `magic`,"                                /*not in-use[39]*/
                " `poison`,"                        /*not in-use[40]*/
                " `disease`,"                        /*not in-use[41]*/
                " `corruption`,"                /*not in-use[42]*/
                " `show_helm`,"
                " `follow_distance`"
                " FROM `bot_data`"
                " WHERE `bot_id` = '%u'",
                botID
        );

        auto results = database.QueryDatabase(query);
        if(!results.Success()) {
                *errorMessage = std::string(results.ErrorMessage());
                return nullptr;
        }

        if (results.RowCount() == 0)
                return nullptr;
       
        // TODO: Consider removing resists and basic attributes from the load query above since we're using defaultNPCType values instead
        auto row = results.begin();
        NPCType defaultNPCTypeStruct = CreateDefaultNPCTypeStructForBot(std::string(row[2]), std::string(row[3]), atoi(row[10]), atoi(row[8]), atoi(row[9]), atoi(row[7]));
        NPCType tempNPCStruct = FillNPCTypeStruct(
                atoi(row[1]), //spells id
                std::string(row[2]), //name
                std::string(row[3]), //lastname
                atoi(row[10]), //level
                atoi(row[8]), //race
                atoi(row[9]), //class
                atoi(row[7]), //gender
                atof(row[15]), //size
                atoi(row[16]), //face
                atoi(row[18]), //hairstyle
                atoi(row[17]), //haircolor
                atoi(row[21]), //eyecolor
                atoi(row[22]), //eyecolor2
                atoi(row[20]), //beardcolor
                atoi(row[19]), //beard
                atoi(row[23]), //drakkinheritage
                atoi(row[24]), //drakkingtattoo
                atoi(row[25]), //drakkingdetails
                atoi(row[28]), // HP, bug this should be 28 not 27, row 27 from above is atk not hp!
                atoi(row[29]), // mana
                defaultNPCTypeStruct.MR,
                defaultNPCTypeStruct.CR,
                defaultNPCTypeStruct.DR,
                defaultNPCTypeStruct.FR,
                defaultNPCTypeStruct.PR,
                defaultNPCTypeStruct.Corrup,
                defaultNPCTypeStruct.AC,
                defaultNPCTypeStruct.STR,
                defaultNPCTypeStruct.STA,
                defaultNPCTypeStruct.DEX,
                defaultNPCTypeStruct.AGI,
                defaultNPCTypeStruct.INT,
                defaultNPCTypeStruct.WIS,
                defaultNPCTypeStruct.CHA,
                defaultNPCTypeStruct.ATK
        );

        Bot* loadedBot = new Bot(botID, atoi(row[0]), atoi(row[1]), atof(row[14]), atoi(row[6]), tempNPCStruct);
        if (loadedBot) {
                loadedBot->SetShowHelm((atoi(row[43]) > 0 ? true : false));
                loadedBot->SetFollowDistance(atoi(row[44]));
        }

        return loadedBot;
}

Other than that, I am enjoying the bot updates, I like how they keep their buffs now instead of wasting the mana every time they get spawned :)

Uleat 11-05-2015 12:29 AM

Good catch!!

Sorry about that..not quite sure how that happened.


Fixed in master branch.

Sublin 11-06-2015 06:35 PM

Quote:

Originally Posted by Uleat (Post 244664)
There is a known issue being addressed with the 2015_09_30_bots.sql file.

The update script will report errors at these lines:
- #675
- #735
- #755
- #768
- #779

It was traced to the conditional check for `bot_inventories` regarding the 6th augment slot.

If you're having issues with this, please ask for a solution in this thread.

I'm running into these errors and a couple more when running the update in the script for bots.

Code:

Running Update: 9000 - 2015_09_30_bots.sql
ERROR 1728 (HY000) at line 18: Cannot load from mysql.proc. The table is probably corrupted
ERROR 1728 (HY000) at line 19: Cannot load from mysql.proc. The table is probably corrupted
ERROR 1728 (HY000) at line 20: Cannot load from mysql.proc. The table is probably corrupted
ERROR 1728 (HY000) at line 22: Cannot load from mysql.proc. The table is probably corrupted
ERROR 1728 (HY000) at line 27: Cannot load from mysql.proc. The table is probably corrupted
ERROR 1728 (HY000) at line 675: Cannot load from mysql.proc. The table is probably corrupted
ERROR 1728 (HY000) at line 677: Cannot load from mysql.proc. The table is probably corrupted
ERROR 1728 (HY000) at line 684: Cannot load from mysql.proc. The table is probably corrupted
ERROR 1728 (HY000) at line 700: Cannot load from mysql.proc. The table is probably corrupted
ERROR 1146 (42S02) at line 735: Table 'peq.bot_data' doesn't exist
ERROR 1146 (42S02) at line 755: Table 'peq.bot_groups' doesn't exist
ERROR 1146 (42S02) at line 768: Table 'peq.bot_data' doesn't exist
ERROR 1146 (42S02) at line 779: Table 'peq.bot_guild_members' doesn't exist
Missing DB Update 9000 '2015_09_30_bots.sql'
 [URL] :: https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/git/bots/required/2015_09_30_bots.sql
        [Saved] :: db_update/2015_09_30_bots.sql


Uleat 11-06-2015 07:23 PM

Can you verify that: 'DROP FUNCTION IF EXISTS `GetMobType`;'

is the line 18 that is failing?


EDIT: Couple of mentions of corruption and one of the dev's link this: http://webcheatsheet.com/sql/Fix_Can..._corrupted.php


You will also need to set your `db_version`.`bots_version` value back to '0' so that the updater will run - or..

run the update script manually and ensure that your above mentioned field is set to '9000'

Sublin 11-06-2015 09:47 PM

Quote:

Originally Posted by Uleat (Post 244894)
Can you verify that: 'DROP FUNCTION IF EXISTS `GetMobType`;'

is the line 18 that is failing?


EDIT: Couple of mentions of corruption and one of the dev's link this: http://webcheatsheet.com/sql/Fix_Can..._corrupted.php


You will also need to set your `db_version`.`bots_version` value back to '0' so that the updater will run - or..

run the update script manually and ensure that your above mentioned field is set to '9000'

The link fixed it, reran the update script and worked like a charm. Thanks!

Uleat 11-06-2015 09:54 PM

Glad you got it working!

Uleat 11-30-2015 07:30 PM

I updated the 2015_09_30_bots.sql script file in hopes that we can alleviate those special case failures.


EDIT: If you happen to use this updated script, please let me know if it is working properly.


All times are GMT -4. The time now is 06:48 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.