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

Development::Bots Forum for bots.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 09:35 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3