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

Development::Bots Forum for bots.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-16-2013, 06:39 PM
zippzipp
Fire Beetle
 
Join Date: Dec 2012
Posts: 14
Default Fix for #bot create when same named PC exists

Hello all. I found that when you create a bot that has the same name as an existing player it bugs both the player and the bot out like crazy. I added a check against the character_ table in the database to make sure a player does not already exist with the target name.

Code:
Index: bot.cpp
===================================================================
--- bot.cpp	(revision 2506)
+++ bot.cpp	(working copy)
@@ -2370,6 +2370,26 @@
 				Result = true;
 
 			mysql_free_result(DatasetResult);
+
+
+
+			if(!database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT COUNT(id) FROM character_ WHERE name LIKE '%s'", this->GetCleanName()), TempErrorMessageBuffer, &DatasetResult)) {
+				*errorMessage = std::string(TempErrorMessageBuffer);
+			}
+			else {
+				uint32 ExistingNameCount = 0;
+
+				while(DataRow = mysql_fetch_row(DatasetResult)) {
+					ExistingNameCount = atoi(DataRow[0]);
+					break;
+				}
+
+				if(ExistingNameCount == 0)
+					Result = true;
+
+				mysql_free_result(DatasetResult);
+
+			}
 		}
 
 		safe_delete(Query);
Reply With Quote
 

Thread Tools
Display Modes

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 08:33 PM.


 

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