Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 07-23-2011, 05:23 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Two small tweaks to this.

The color is unsigned in the database so I changed the query to write it as such.

The check for the proper parameters was after all of the parsing where it should have been before it.

Code:
Index: trunk/EQEmuServer/zone/bot.cpp
===================================================================
--- trunk/EQEmuServer/zone/bot.cpp	(revision 1981)
+++ trunk/EQEmuServer/zone/bot.cpp	(working copy)
@@ -10142,13 +10142,15 @@
 	//bot armor colors
 	if(!strcasecmp(sep->arg[1], "armorcolor")) {
 		if(c->GetTarget() && c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwner() == c)) {
+
+			if(sep->arg[2][0] == '\0' || sep->arg[3][0] == '\0' || sep->arg[4][0] == '\0' || sep->arg[5][0] == '\0') {
+				c->Message(0, "Usage: #bot armorcolor [slot] [red] [green] [blue] - use #bot help armorcolor for info");
+				return;
+			}
+
 			uint32 botid = c->GetTarget()->CastToBot()->GetBotID();
 			std::string errorMessage;
 			char* Query = 0;
-			//if(sep->argnum < 6) {
-			//	c->Message(0, "Usage: #bot armorcolor [slot] [red] [green] [blue] - use #bot help armorcolor for info");
-			//	return;
-			//}
 
 			int setslot = atoi(sep->arg[2]);
 			uint8 red = atoi(sep->arg[3]);
@@ -10156,22 +10158,14 @@
 			uint8 blue = atoi(sep->arg[5]);
 			uint32 setcolor = (red << 16) | (green << 8) | blue;
 
-			if(sep->arg[2][0] == '\0' || sep->arg[3][0] == '\0' || sep->arg[4][0] == '\0' || sep->arg[5][0] == '\0') {
-				c->Message(0, "Usage: #bot armorcolor [slot] [red] [green] [blue] - use #bot help armorcolor for info");
-				return;
+			if(database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE botinventory SET color = %u WHERE slotID = %i AND botID = %u",setcolor, setslot, botid))){
+				int slotmaterial = Inventory::CalcMaterialFromSlot(setslot);
+				c->GetTarget()->CastToBot()->SendWearChange(slotmaterial);
 			}
-			else{
-				if(database.RunQuery(Query, MakeAnyLenString(&Query, "UPDATE botinventory SET color = %i WHERE slotID = %i AND botID = %u",setcolor, setslot, botid))){
-					int slotmaterial = Inventory::CalcMaterialFromSlot(setslot);
-					c->GetTarget()->CastToBot()->SendWearChange(slotmaterial);
-				}
-			}
-			
 		}
 		else {
 			c->Message(15, "You must target a bot you own to do this.");
 		}
-
 		return;
 	}
 	// Help for coloring bot armor
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 01:05 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