Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bots

Development::Bots Forum for bots.

Reply
 
Thread Tools Display Modes
  #1  
Old 10-12-2015, 06:22 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default 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
__________________
Uleat of Bertoxxulous

Compilin' Dirty

Last edited by Uleat; 10-13-2015 at 05:42 PM..
Reply With Quote
  #2  
Old 10-12-2015, 09:15 PM
jpyou127's Avatar
jpyou127
Discordant
 
Join Date: Nov 2005
Posts: 270
Default

You the man Uleat!
Reply With Quote
  #3  
Old 10-12-2015, 09:19 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

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!)
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #4  
Old 10-12-2015, 09:48 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,071
Default

Nice work Uleat!
Reply With Quote
  #5  
Old 10-12-2015, 09:51 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

You're my master!
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #6  
Old 10-13-2015, 12:30 AM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

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 of Bertoxxulous

Compilin' Dirty

Last edited by Uleat; 10-13-2015 at 02:03 PM..
Reply With Quote
  #7  
Old 10-23-2015, 03:54 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

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 of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #8  
Old 10-24-2015, 12:25 AM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

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.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #9  
Old 11-04-2015, 11:22 PM
dfusion111
Fire Beetle
 
Join Date: Jun 2010
Posts: 15
Default

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
Reply With Quote
  #10  
Old 11-05-2015, 12:29 AM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Good catch!!

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


Fixed in master branch.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #11  
Old 11-06-2015, 06:35 PM
Sublin
Fire Beetle
 
Join Date: Aug 2010
Posts: 11
Default

Quote:
Originally Posted by Uleat View Post
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
Reply With Quote
  #12  
Old 11-06-2015, 07:23 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

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'
__________________
Uleat of Bertoxxulous

Compilin' Dirty

Last edited by Uleat; 11-06-2015 at 08:28 PM..
Reply With Quote
  #13  
Old 11-06-2015, 09:47 PM
Sublin
Fire Beetle
 
Join Date: Aug 2010
Posts: 11
Default

Quote:
Originally Posted by Uleat View Post
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!
Reply With Quote
  #14  
Old 11-06-2015, 09:54 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Glad you got it working!
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #15  
Old 11-30-2015, 07:30 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

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.
__________________
Uleat of Bertoxxulous

Compilin' Dirty

Last edited by Uleat; 12-01-2015 at 10:13 PM..
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:18 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3