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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-18-2011, 08:09 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default COMMITTED: Bot dyes (and tweaks)

Hello again

Quote:
Bot Code Changes:

Added code to dye armor for bots

Added checks to shrink and setfollowdistance to ensure bot is owned by client

Added checks in slow and debuff for enchanters to help with mez priority

Added check for melee buffs so they dont get a spell related buff that was missed (intelectual superiority)
EDIT: lerxst2112 suggested something to make tints work better trying it and then will resubmit

Criimson
Reply With Quote
  #2  
Old 07-18-2011, 11:06 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Yea very happy to add changes.

Color system is now #bot armorcolor <slot> <red> <green> <blue> instead of armorcolor <number from 0 - 2.1billion> way easier

Code:
Index: bot.cpp
===================================================================
--- bot.cpp	(revision 1976)
+++ bot.cpp	(working copy)
@@ -3567,12 +3567,15 @@
 		const Item_Struct* item = 0;
 		const ItemInst* inst = 0;
 
+		uint32 spawnedbotid = 0;
+		spawnedbotid = this->GetBotID();
+
 		inst = GetBotItem(SLOT_HANDS);
 		if(inst) {
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_HANDS]	= item->Material;
-				ns->spawn.colors[MATERIAL_HANDS].color = GetEquipmentColor(MATERIAL_HANDS);
+				ns->spawn.colors[MATERIAL_HANDS].color = Bot::GetEquipmentColor(MATERIAL_HANDS);
 			}
 		}
 
@@ -3581,7 +3584,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_HEAD] = item->Material;
-				ns->spawn.colors[MATERIAL_HEAD].color = GetEquipmentColor(MATERIAL_HEAD);
+				ns->spawn.colors[MATERIAL_HEAD].color = Bot::GetEquipmentColor(MATERIAL_HEAD);
 			}
 		}
 
@@ -3590,7 +3593,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_ARMS] = item->Material;
-				ns->spawn.colors[MATERIAL_ARMS].color = GetEquipmentColor(MATERIAL_ARMS);
+				ns->spawn.colors[MATERIAL_ARMS].color = Bot::GetEquipmentColor(MATERIAL_ARMS);
 			}
 		}
 
@@ -3599,7 +3602,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_BRACER] = item->Material;
-				ns->spawn.colors[MATERIAL_BRACER].color	= GetEquipmentColor(MATERIAL_BRACER);
+				ns->spawn.colors[MATERIAL_BRACER].color	= Bot::GetEquipmentColor(MATERIAL_BRACER);
 			}
 		}
 
@@ -3608,7 +3611,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_BRACER] = item->Material;
-				ns->spawn.colors[MATERIAL_BRACER].color	= GetEquipmentColor(MATERIAL_BRACER);
+				ns->spawn.colors[MATERIAL_BRACER].color	= Bot::GetEquipmentColor(MATERIAL_BRACER);
 			}
 		}
 
@@ -3617,7 +3620,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_CHEST]	= item->Material;
-				ns->spawn.colors[MATERIAL_CHEST].color = GetEquipmentColor(MATERIAL_CHEST);
+				ns->spawn.colors[MATERIAL_CHEST].color = Bot::GetEquipmentColor(MATERIAL_CHEST);
 			}
 		}
 
@@ -3626,7 +3629,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_LEGS] = item->Material;
-				ns->spawn.colors[MATERIAL_LEGS].color = GetEquipmentColor(MATERIAL_LEGS);
+				ns->spawn.colors[MATERIAL_LEGS].color = Bot::GetEquipmentColor(MATERIAL_LEGS);
 			}
 		}
 
@@ -3635,7 +3638,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_FEET] = item->Material;
-				ns->spawn.colors[MATERIAL_FEET].color = GetEquipmentColor(MATERIAL_FEET);
+				ns->spawn.colors[MATERIAL_FEET].color = Bot::GetEquipmentColor(MATERIAL_FEET);
 			}
 		}
 		
@@ -3645,6 +3648,7 @@
 			if(item) {
 				if(strlen(item->IDFile) > 2)
 					ns->spawn.equipment[MATERIAL_PRIMARY] = atoi(&item->IDFile[2]);
+					ns->spawn.colors[MATERIAL_PRIMARY].color = Bot::GetEquipmentColor(MATERIAL_PRIMARY);
 			}
 		}
 
@@ -3654,6 +3658,7 @@
 			if(item) {
 				if(strlen(item->IDFile) > 2)
 					ns->spawn.equipment[MATERIAL_SECONDARY] = atoi(&item->IDFile[2]);
+					ns->spawn.colors[MATERIAL_SECONDARY].color = Bot::GetEquipmentColor(MATERIAL_SECONDARY);
 			}
 		}
 	}
@@ -10061,7 +10066,7 @@
 		c->Message(0, "#bot levitate - Bot levitation (must have proper class in group)");
 		c->Message(0, "#bot resist - Bot resist buffs (must have proper class in group)");
 		c->Message(0, "#bot runeme - Enchanter Bot cast Rune spell on you");
-		c->Message(0, "#bot shrink - Shaman Bot will shrink you");
+		c->Message(0, "#bot shrink - Shaman or Beastlord will shrink target");
 		c->Message(0, "#bot endureb - Bot enduring breath (must have proper class in group)");
 		c->Message(0, "#bot charm - (must have proper class in group)");
 		c->Message(0, "#bot dire charm - (must have proper class in group)");
@@ -10077,6 +10082,7 @@
 		c->Message(0, "#bot mana [<bot name or target> | all] - Displays a mana report for all your spawned bots.");
 		c->Message(0, "#bot setfollowdistance ### - sets target bots follow distance to ### (ie 30 or 250).");
 		c->Message(0, "#bot [hair|haircolor|beard|beardcolor|face|eyes|heritage|tattoo|details <value>] - Change your BOTs appearance.");
+		c->Message(0, "#bot armorcolor <slot> <value> - #bot help armorcolor for info");
 		// TODO:
 		// c->Message(0, "#bot illusion <bot/client name or target> - Enchanter Bot cast an illusion buff spell on you or your target.");
 		c->Message(0, "#bot pull [<bot name>] [target] - Bot Pulling Target NPC's");
@@ -10121,8 +10127,8 @@
 
 	// added Bot follow distance - SetFollowDistance
 	if(!strcasecmp(sep->arg[1], "setfollowdistance")) {
-		if((c->GetTarget() == NULL) || (c->GetTarget() == c) || (!c->GetTarget()->IsBot()) ) {
-			c->Message(15, "You must target a bot!");
+		if((c->GetTarget() == NULL) || (c->GetTarget() == c) || (!c->GetTarget()->IsBot()) || (c->GetTarget()->CastToBot()->GetBotOwner() != c)) {
+			c->Message(15, "You must target a bot you own!");
 		}
 		else {
 			int32 BotFollowDistance = atoi(sep->arg[2]);
@@ -10133,7 +10139,57 @@
 		return;
 	}
 
-	
+	//bot armor colors
+	if(!strcasecmp(sep->arg[1], "armorcolor")) {
+		if(c->GetTarget() && c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwner() == c)) {
+			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]);
+			uint8 green = atoi(sep->arg[4]);
+			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;
+			}
+			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
+		if(!strcasecmp(sep->arg[1], "help") && !strcasecmp(sep->arg[2], "armorcolor") ){
+		//read from db
+		char* Query = 0;
+		MYSQL_RES* DatasetResult;
+		MYSQL_ROW DataRow;
+		
+		c->Message(0, "-----------------#bot armorcolor help-----------------------------");
+		c->Message(0, "Armor:  17(Chest/Robe), 7(Arms), 9(Bracer), 12(Hands), 18(Legs), 19(Boots), 2(Helm)");
+		c->Message(0, "------------------------------------------------------------------");
+		c->Message(0, "Color: [red] [green] [blue]  (enter a number from 0-255 for each");
+		c->Message(0, "------------------------------------------------------------------");
+		c->Message(0, "Example: #bot armorcolor 17 0 255 0 - this would make the chest bright green");
+		return;
+	}
+
 	if(!strcasecmp(sep->arg[1], "augmentitem")) {
 		AugmentItem_Struct* in_augment = new AugmentItem_Struct[sizeof(AugmentItem_Struct)];
 		in_augment->container_slot = 1000;
@@ -11770,8 +11826,8 @@
 		Group *g = c->GetGroup();
 		Mob *target = c->GetTarget();
 
-		if(target == NULL || (!target->IsClient() && !target->IsBot()))
-			c->Message(15, "You must select a player or bot");
+		if(target == NULL || (!target->IsClient() && !target->IsBot()) || (c->CastToBot()->GetBotOwnerCharacterID() != c->CharacterID()))
+			c->Message(15, "You must select a player or bot you own");
 
 		else if(g) {
 			for(int i=0; i<MAX_GROUP_MEMBERS; i++){
@@ -11797,8 +11853,6 @@
 
 					if (c->GetLevel() >= 15) { 
 						Shrinker->Say("Casting Shrink...");
-						//Shrinker->CastToBot()->BotRaidSpell(345);
-						//Shrinker->CastSpell(345, id), 1);
 						Shrinker->CastToBot()->SpellOnTarget(345, target);
 					}
 					else if (c->GetLevel() <= 14) {
@@ -11810,8 +11864,6 @@
 
 					if (c->GetLevel() >= 23) {
 						Shrinker->Say("Casting Shrink...");
-						//Shrinker->CastToBot()->BotRaidSpell(345);
-						//Shrinker->CastSpell(345, id), 1);
 						Shrinker->CastToBot()->SpellOnTarget(345, target);
 					}
 					else if (c->GetLevel() <= 22) {
@@ -13742,4 +13794,31 @@
 	return needHealed;
 }
 
+uint32 Bot::GetEquipmentColor(int8 material_slot) const
+{
+	//Bot tints
+	int32 slotid = 0;
+	uint32 returncolor = 0;
+	uint32 botid = this->GetBotID();
+	
+	//Translate code slot # to DB slot #
+	slotid = Inventory::CalcSlotFromMaterial(material_slot);
+
+	//read from db
+	char* Query = 0;
+	MYSQL_RES* DatasetResult;
+	MYSQL_ROW DataRow;
+	
+	if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT color FROM botinventory WHERE BotID = %u AND SlotID = %u", botid, slotid), 0, &DatasetResult)) {
+		if(mysql_num_rows(DatasetResult) == 1) {
+			DataRow = mysql_fetch_row(DatasetResult);
+			if(DataRow)
+				returncolor = atoi(DataRow[0]);
+		}
+		mysql_free_result(DatasetResult);
+		safe_delete_array(Query);
+	}
+	return returncolor;
+}
+
 #endif
Index: bot.h
===================================================================
--- bot.h	(revision 1976)
+++ bot.h	(working copy)
@@ -217,6 +217,7 @@
 	void BotTradeAddItem(uint32 id, const ItemInst* inst, sint16 charges, uint32 equipableSlots, int16 lootSlot, std::string* errorMessage, bool addToDb = true);
 	void EquipBot(std::string* errorMessage);
 	bool CheckLoreConflict(const Item_Struct* item);
+	uint32 Bot::GetEquipmentColor(int8 material_slot) const;
 
 	// Static Class Methods
 	static void SaveBotGroup(Group* botGroup, std::string botGroupName, std::string* errorMessage);
@@ -296,7 +297,7 @@
 	static bool GroupHasPriestClass(Group* group) { return GroupHasClass(group, CLERIC | DRUID | SHAMAN); }
 
 	// "GET" Class Methods
-	uint32 GetBotID() { return _botID; }
+	uint32 GetBotID() const { return _botID; }
 	uint32 GetBotOwnerCharacterID() { return _botOwnerCharacterID; }
 	uint32 GetBotSpellID() { return npc_spells_id; }
 	Mob* GetBotOwner() { return this->_botOwner; }
Index: botspellsai.cpp
===================================================================
--- botspellsai.cpp	(revision 1976)
+++ botspellsai.cpp	(working copy)
@@ -298,6 +298,7 @@
 							break;
 						case ARCHETYPE_MELEE:
 							if(IsEffectInSpell(selectedBotSpell.SpellId, SE_IncreaseSpellHaste) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ManaPool) ||
+								IsEffectInSpell(selectedBotSpell.SpellId, SE_CastingLevel) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ManaRegen_v2) ||
 								IsEffectInSpell(selectedBotSpell.SpellId, SE_CurrentMana))
 							{
 								continue;
@@ -558,8 +559,15 @@
 						GroupHasShaman = true;
 					}
 					else if (botClass == ENCHANTER){
-						botSpell = GetBestBotSpellForMagicBasedSlow(this);
-						GroupHasEnchanter = true;
+						//Checking no adds before slow/debuff
+						Mob* addMob = GetFirstIncomingMobToMez(this, botSpell);
+
+						if(addMob){
+							break;}
+						else {
+ 						botSpell = GetBestBotSpellForMagicBasedSlow(this);
+ 						GroupHasEnchanter = true;
+						}
 					}
 					else if (botClass == BEASTLORD && GroupHasEnchanter == false && GroupHasShaman == false){
 						botSpell = GetBestBotSpellForDiseaseBasedSlow(this);
@@ -584,6 +592,13 @@
 					
 					checked_los = true;
 				}
+				//if enchanter checking if no adds
+				if (botClass == ENCHANTER){
+					Mob* addMob = GetFirstIncomingMobToMez(this, botSpell);
+ 
+					if(addMob){
+						break;}
+				}
 
 				botSpell = GetDebuffBotSpell(this, tar);
Reply With Quote
  #3  
Old 07-19-2011, 05:14 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Use this patch. I had done a rollback when working with the last patch and didnt notice I undid the shrink check. This one is correct.

Sorry about that

Code:
Index: bot.cpp
===================================================================
--- bot.cpp	(revision 1976)
+++ bot.cpp	(working copy)
@@ -3559,7 +3559,7 @@
 		ns->spawn.is_npc = 0;				// 0=no, 1=yes
 		ns->spawn.is_pet = 0;
 		ns->spawn.guildrank = 0;
-		ns->spawn.showhelm = 1;
+		ns->spawn.showhelm = 0;
 		ns->spawn.flymode = 0;
 		ns->spawn.size = 0;
 		ns->spawn.NPC = 0;					// 0=player,1=npc,2=pc corpse,3=npc corpse
@@ -3567,12 +3567,15 @@
 		const Item_Struct* item = 0;
 		const ItemInst* inst = 0;
 
+		uint32 spawnedbotid = 0;
+		spawnedbotid = this->GetBotID();
+
 		inst = GetBotItem(SLOT_HANDS);
 		if(inst) {
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_HANDS]	= item->Material;
-				ns->spawn.colors[MATERIAL_HANDS].color = GetEquipmentColor(MATERIAL_HANDS);
+				ns->spawn.colors[MATERIAL_HANDS].color = Bot::GetEquipmentColor(MATERIAL_HANDS);
 			}
 		}
 
@@ -3581,7 +3584,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_HEAD] = item->Material;
-				ns->spawn.colors[MATERIAL_HEAD].color = GetEquipmentColor(MATERIAL_HEAD);
+				ns->spawn.colors[MATERIAL_HEAD].color = Bot::GetEquipmentColor(MATERIAL_HEAD);
 			}
 		}
 
@@ -3590,7 +3593,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_ARMS] = item->Material;
-				ns->spawn.colors[MATERIAL_ARMS].color = GetEquipmentColor(MATERIAL_ARMS);
+				ns->spawn.colors[MATERIAL_ARMS].color = Bot::GetEquipmentColor(MATERIAL_ARMS);
 			}
 		}
 
@@ -3599,7 +3602,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_BRACER] = item->Material;
-				ns->spawn.colors[MATERIAL_BRACER].color	= GetEquipmentColor(MATERIAL_BRACER);
+				ns->spawn.colors[MATERIAL_BRACER].color	= Bot::GetEquipmentColor(MATERIAL_BRACER);
 			}
 		}
 
@@ -3608,7 +3611,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_BRACER] = item->Material;
-				ns->spawn.colors[MATERIAL_BRACER].color	= GetEquipmentColor(MATERIAL_BRACER);
+				ns->spawn.colors[MATERIAL_BRACER].color	= Bot::GetEquipmentColor(MATERIAL_BRACER);
 			}
 		}
 
@@ -3617,7 +3620,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_CHEST]	= item->Material;
-				ns->spawn.colors[MATERIAL_CHEST].color = GetEquipmentColor(MATERIAL_CHEST);
+				ns->spawn.colors[MATERIAL_CHEST].color = Bot::GetEquipmentColor(MATERIAL_CHEST);
 			}
 		}
 
@@ -3626,7 +3629,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_LEGS] = item->Material;
-				ns->spawn.colors[MATERIAL_LEGS].color = GetEquipmentColor(MATERIAL_LEGS);
+				ns->spawn.colors[MATERIAL_LEGS].color = Bot::GetEquipmentColor(MATERIAL_LEGS);
 			}
 		}
 
@@ -3635,7 +3638,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_FEET] = item->Material;
-				ns->spawn.colors[MATERIAL_FEET].color = GetEquipmentColor(MATERIAL_FEET);
+				ns->spawn.colors[MATERIAL_FEET].color = Bot::GetEquipmentColor(MATERIAL_FEET);
 			}
 		}
 		
@@ -3645,6 +3648,7 @@
 			if(item) {
 				if(strlen(item->IDFile) > 2)
 					ns->spawn.equipment[MATERIAL_PRIMARY] = atoi(&item->IDFile[2]);
+					ns->spawn.colors[MATERIAL_PRIMARY].color = Bot::GetEquipmentColor(MATERIAL_PRIMARY);
 			}
 		}
 
@@ -3654,6 +3658,7 @@
 			if(item) {
 				if(strlen(item->IDFile) > 2)
 					ns->spawn.equipment[MATERIAL_SECONDARY] = atoi(&item->IDFile[2]);
+					ns->spawn.colors[MATERIAL_SECONDARY].color = Bot::GetEquipmentColor(MATERIAL_SECONDARY);
 			}
 		}
 	}
@@ -10061,7 +10066,7 @@
 		c->Message(0, "#bot levitate - Bot levitation (must have proper class in group)");
 		c->Message(0, "#bot resist - Bot resist buffs (must have proper class in group)");
 		c->Message(0, "#bot runeme - Enchanter Bot cast Rune spell on you");
-		c->Message(0, "#bot shrink - Shaman Bot will shrink you");
+		c->Message(0, "#bot shrink - Shaman or Beastlord will shrink target");
 		c->Message(0, "#bot endureb - Bot enduring breath (must have proper class in group)");
 		c->Message(0, "#bot charm - (must have proper class in group)");
 		c->Message(0, "#bot dire charm - (must have proper class in group)");
@@ -10077,6 +10082,7 @@
 		c->Message(0, "#bot mana [<bot name or target> | all] - Displays a mana report for all your spawned bots.");
 		c->Message(0, "#bot setfollowdistance ### - sets target bots follow distance to ### (ie 30 or 250).");
 		c->Message(0, "#bot [hair|haircolor|beard|beardcolor|face|eyes|heritage|tattoo|details <value>] - Change your BOTs appearance.");
+		c->Message(0, "#bot armorcolor <slot> <value> - #bot help armorcolor for info");
 		// TODO:
 		// c->Message(0, "#bot illusion <bot/client name or target> - Enchanter Bot cast an illusion buff spell on you or your target.");
 		c->Message(0, "#bot pull [<bot name>] [target] - Bot Pulling Target NPC's");
@@ -10121,8 +10127,8 @@
 
 	// added Bot follow distance - SetFollowDistance
 	if(!strcasecmp(sep->arg[1], "setfollowdistance")) {
-		if((c->GetTarget() == NULL) || (c->GetTarget() == c) || (!c->GetTarget()->IsBot()) ) {
-			c->Message(15, "You must target a bot!");
+		if((c->GetTarget() == NULL) || (c->GetTarget() == c) || (!c->GetTarget()->IsBot()) || (c->GetTarget()->CastToBot()->GetBotOwner() != c)) {
+			c->Message(15, "You must target a bot you own!");
 		}
 		else {
 			int32 BotFollowDistance = atoi(sep->arg[2]);
@@ -10133,7 +10139,57 @@
 		return;
 	}
 
-	
+	//bot armor colors
+	if(!strcasecmp(sep->arg[1], "armorcolor")) {
+		if(c->GetTarget() && c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwner() == c)) {
+			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]);
+			uint8 green = atoi(sep->arg[4]);
+			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;
+			}
+			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
+		if(!strcasecmp(sep->arg[1], "help") && !strcasecmp(sep->arg[2], "armorcolor") ){
+		//read from db
+		char* Query = 0;
+		MYSQL_RES* DatasetResult;
+		MYSQL_ROW DataRow;
+		
+		c->Message(0, "-----------------#bot armorcolor help-----------------------------");
+		c->Message(0, "Armor:  17(Chest/Robe), 7(Arms), 9(Bracer), 12(Hands), 18(Legs), 19(Boots), 2(Helm)");
+		c->Message(0, "------------------------------------------------------------------");
+		c->Message(0, "Color: [red] [green] [blue]  (enter a number from 0-255 for each");
+		c->Message(0, "------------------------------------------------------------------");
+		c->Message(0, "Example: #bot armorcolor 17 0 255 0 - this would make the chest bright green");
+		return;
+	}
+
 	if(!strcasecmp(sep->arg[1], "augmentitem")) {
 		AugmentItem_Struct* in_augment = new AugmentItem_Struct[sizeof(AugmentItem_Struct)];
 		in_augment->container_slot = 1000;
@@ -11770,8 +11826,8 @@
 		Group *g = c->GetGroup();
 		Mob *target = c->GetTarget();
 
-		if(target == NULL || (!target->IsClient() && !target->IsBot()))
-			c->Message(15, "You must select a player or bot");
+		if(target == NULL || (!target->IsClient() && (c->GetTarget()->CastToBot()->GetBotOwner() != c)))
+			c->Message(15, "You must select a player or bot you own");
 
 		else if(g) {
 			for(int i=0; i<MAX_GROUP_MEMBERS; i++){
@@ -11797,8 +11853,6 @@
 
 					if (c->GetLevel() >= 15) { 
 						Shrinker->Say("Casting Shrink...");
-						//Shrinker->CastToBot()->BotRaidSpell(345);
-						//Shrinker->CastSpell(345, id), 1);
 						Shrinker->CastToBot()->SpellOnTarget(345, target);
 					}
 					else if (c->GetLevel() <= 14) {
@@ -11810,8 +11864,6 @@
 
 					if (c->GetLevel() >= 23) {
 						Shrinker->Say("Casting Shrink...");
-						//Shrinker->CastToBot()->BotRaidSpell(345);
-						//Shrinker->CastSpell(345, id), 1);
 						Shrinker->CastToBot()->SpellOnTarget(345, target);
 					}
 					else if (c->GetLevel() <= 22) {
@@ -13742,4 +13794,31 @@
 	return needHealed;
 }
 
+uint32 Bot::GetEquipmentColor(int8 material_slot) const
+{
+	//Bot tints
+	int32 slotid = 0;
+	uint32 returncolor = 0;
+	uint32 botid = this->GetBotID();
+	
+	//Translate code slot # to DB slot #
+	slotid = Inventory::CalcSlotFromMaterial(material_slot);
+
+	//read from db
+	char* Query = 0;
+	MYSQL_RES* DatasetResult;
+	MYSQL_ROW DataRow;
+	
+	if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT color FROM botinventory WHERE BotID = %u AND SlotID = %u", botid, slotid), 0, &DatasetResult)) {
+		if(mysql_num_rows(DatasetResult) == 1) {
+			DataRow = mysql_fetch_row(DatasetResult);
+			if(DataRow)
+				returncolor = atoi(DataRow[0]);
+		}
+		mysql_free_result(DatasetResult);
+		safe_delete_array(Query);
+	}
+	return returncolor;
+}
+
 #endif
Index: bot.h
===================================================================
--- bot.h	(revision 1976)
+++ bot.h	(working copy)
@@ -217,6 +217,7 @@
 	void BotTradeAddItem(uint32 id, const ItemInst* inst, sint16 charges, uint32 equipableSlots, int16 lootSlot, std::string* errorMessage, bool addToDb = true);
 	void EquipBot(std::string* errorMessage);
 	bool CheckLoreConflict(const Item_Struct* item);
+	uint32 Bot::GetEquipmentColor(int8 material_slot) const;
 
 	// Static Class Methods
 	static void SaveBotGroup(Group* botGroup, std::string botGroupName, std::string* errorMessage);
@@ -296,7 +297,7 @@
 	static bool GroupHasPriestClass(Group* group) { return GroupHasClass(group, CLERIC | DRUID | SHAMAN); }
 
 	// "GET" Class Methods
-	uint32 GetBotID() { return _botID; }
+	uint32 GetBotID() const { return _botID; }
 	uint32 GetBotOwnerCharacterID() { return _botOwnerCharacterID; }
 	uint32 GetBotSpellID() { return npc_spells_id; }
 	Mob* GetBotOwner() { return this->_botOwner; }
Index: botspellsai.cpp
===================================================================
--- botspellsai.cpp	(revision 1976)
+++ botspellsai.cpp	(working copy)
@@ -298,6 +298,7 @@
 							break;
 						case ARCHETYPE_MELEE:
 							if(IsEffectInSpell(selectedBotSpell.SpellId, SE_IncreaseSpellHaste) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ManaPool) ||
+								IsEffectInSpell(selectedBotSpell.SpellId, SE_CastingLevel) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ManaRegen_v2) ||
 								IsEffectInSpell(selectedBotSpell.SpellId, SE_CurrentMana))
 							{
 								continue;
@@ -558,8 +559,15 @@
 						GroupHasShaman = true;
 					}
 					else if (botClass == ENCHANTER){
-						botSpell = GetBestBotSpellForMagicBasedSlow(this);
-						GroupHasEnchanter = true;
+						//Checking no adds before slow/debuff
+						Mob* addMob = GetFirstIncomingMobToMez(this, botSpell);
+
+						if(addMob){
+							break;}
+						else {
+ 						botSpell = GetBestBotSpellForMagicBasedSlow(this);
+ 						GroupHasEnchanter = true;
+						}
 					}
 					else if (botClass == BEASTLORD && GroupHasEnchanter == false && GroupHasShaman == false){
 						botSpell = GetBestBotSpellForDiseaseBasedSlow(this);
@@ -584,6 +592,13 @@
 					
 					checked_los = true;
 				}
+				//if enchanter checking if no adds
+				if (botClass == ENCHANTER){
+					Mob* addMob = GetFirstIncomingMobToMez(this, botSpell);
+ 
+					if(addMob){
+						break;}
+				}
 
 				botSpell = GetDebuffBotSpell(this, tar);
Reply With Quote
  #4  
Old 07-19-2011, 09:15 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Just thought I'd share what bot dyes look like All in newb quest armor - mostly greens.



Uploaded with ImageShack.us
Reply With Quote
  #5  
Old 07-22-2011, 05:23 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

not sure what i'm doing wrong. when i copy this to a patch file and select apply patch i get an error "The chunk size did not match the number of added/removed lines!"
__________________
The Realm
Reply With Quote
  #6  
Old 07-22-2011, 06:11 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Unsure what happened.

Here is the patch:

Code:
Index: bot.cpp
===================================================================
--- bot.cpp	(revision 1976)
+++ bot.cpp	(working copy)
@@ -3559,7 +3559,7 @@
 		ns->spawn.is_npc = 0;				// 0=no, 1=yes
 		ns->spawn.is_pet = 0;
 		ns->spawn.guildrank = 0;
-		ns->spawn.showhelm = 1;
+		ns->spawn.showhelm = 1;
 		ns->spawn.flymode = 0;
 		ns->spawn.size = 0;
 		ns->spawn.NPC = 0;					// 0=player,1=npc,2=pc corpse,3=npc corpse
@@ -3567,12 +3567,15 @@
 		const Item_Struct* item = 0;
 		const ItemInst* inst = 0;
 
+		uint32 spawnedbotid = 0;
+		spawnedbotid = this->GetBotID();
+
 		inst = GetBotItem(SLOT_HANDS);
 		if(inst) {
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_HANDS]	= item->Material;
-				ns->spawn.colors[MATERIAL_HANDS].color = GetEquipmentColor(MATERIAL_HANDS);
+				ns->spawn.colors[MATERIAL_HANDS].color = Bot::GetEquipmentColor(MATERIAL_HANDS);
 			}
 		}
 
@@ -3581,7 +3584,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_HEAD] = item->Material;
-				ns->spawn.colors[MATERIAL_HEAD].color = GetEquipmentColor(MATERIAL_HEAD);
+				ns->spawn.colors[MATERIAL_HEAD].color = Bot::GetEquipmentColor(MATERIAL_HEAD);
 			}
 		}
 
@@ -3590,7 +3593,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_ARMS] = item->Material;
-				ns->spawn.colors[MATERIAL_ARMS].color = GetEquipmentColor(MATERIAL_ARMS);
+				ns->spawn.colors[MATERIAL_ARMS].color = Bot::GetEquipmentColor(MATERIAL_ARMS);
 			}
 		}
 
@@ -3599,7 +3602,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_BRACER] = item->Material;
-				ns->spawn.colors[MATERIAL_BRACER].color	= GetEquipmentColor(MATERIAL_BRACER);
+				ns->spawn.colors[MATERIAL_BRACER].color	= Bot::GetEquipmentColor(MATERIAL_BRACER);
 			}
 		}
 
@@ -3608,7 +3611,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_BRACER] = item->Material;
-				ns->spawn.colors[MATERIAL_BRACER].color	= GetEquipmentColor(MATERIAL_BRACER);
+				ns->spawn.colors[MATERIAL_BRACER].color	= Bot::GetEquipmentColor(MATERIAL_BRACER);
 			}
 		}
 
@@ -3617,7 +3620,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_CHEST]	= item->Material;
-				ns->spawn.colors[MATERIAL_CHEST].color = GetEquipmentColor(MATERIAL_CHEST);
+				ns->spawn.colors[MATERIAL_CHEST].color = Bot::GetEquipmentColor(MATERIAL_CHEST);
 			}
 		}
 
@@ -3626,7 +3629,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_LEGS] = item->Material;
-				ns->spawn.colors[MATERIAL_LEGS].color = GetEquipmentColor(MATERIAL_LEGS);
+				ns->spawn.colors[MATERIAL_LEGS].color = Bot::GetEquipmentColor(MATERIAL_LEGS);
 			}
 		}
 
@@ -3635,7 +3638,7 @@
 			item = inst->GetItem();
 			if(item) {
 				ns->spawn.equipment[MATERIAL_FEET] = item->Material;
-				ns->spawn.colors[MATERIAL_FEET].color = GetEquipmentColor(MATERIAL_FEET);
+				ns->spawn.colors[MATERIAL_FEET].color = Bot::GetEquipmentColor(MATERIAL_FEET);
 			}
 		}
 		
@@ -3645,6 +3648,7 @@
 			if(item) {
 				if(strlen(item->IDFile) > 2)
 					ns->spawn.equipment[MATERIAL_PRIMARY] = atoi(&item->IDFile[2]);
+					ns->spawn.colors[MATERIAL_PRIMARY].color = Bot::GetEquipmentColor(MATERIAL_PRIMARY);
 			}
 		}
 
@@ -3654,6 +3658,7 @@
 			if(item) {
 				if(strlen(item->IDFile) > 2)
 					ns->spawn.equipment[MATERIAL_SECONDARY] = atoi(&item->IDFile[2]);
+					ns->spawn.colors[MATERIAL_SECONDARY].color = Bot::GetEquipmentColor(MATERIAL_SECONDARY);
 			}
 		}
 	}
@@ -5338,7 +5343,7 @@
 		(!IsAttackAllowed(other)))
 	{
 		if(this->GetOwnerID())
-			entity_list.MessageClose(this, 1, 200, 10, "%s says, 'That is not a legal target master.'", this->GetCleanName());
+			entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName());
 		if(other)
 			RemoveFromHateList(other);
 		mlog(COMBAT__ATTACKS, "I am not allowed to attack %s", other->GetCleanName());
@@ -10061,7 +10066,7 @@
 		c->Message(0, "#bot levitate - Bot levitation (must have proper class in group)");
 		c->Message(0, "#bot resist - Bot resist buffs (must have proper class in group)");
 		c->Message(0, "#bot runeme - Enchanter Bot cast Rune spell on you");
-		c->Message(0, "#bot shrink - Shaman Bot will shrink you");
+		c->Message(0, "#bot shrink - Shaman or Beastlord will shrink target");
 		c->Message(0, "#bot endureb - Bot enduring breath (must have proper class in group)");
 		c->Message(0, "#bot charm - (must have proper class in group)");
 		c->Message(0, "#bot dire charm - (must have proper class in group)");
@@ -10077,6 +10082,7 @@
 		c->Message(0, "#bot mana [<bot name or target> | all] - Displays a mana report for all your spawned bots.");
 		c->Message(0, "#bot setfollowdistance ### - sets target bots follow distance to ### (ie 30 or 250).");
 		c->Message(0, "#bot [hair|haircolor|beard|beardcolor|face|eyes|heritage|tattoo|details <value>] - Change your BOTs appearance.");
+		c->Message(0, "#bot armorcolor <slot> <red> <green> <blue> - #bot help armorcolor for info");
 		// TODO:
 		// c->Message(0, "#bot illusion <bot/client name or target> - Enchanter Bot cast an illusion buff spell on you or your target.");
 		c->Message(0, "#bot pull [<bot name>] [target] - Bot Pulling Target NPC's");
@@ -10121,8 +10127,8 @@
 
 	// added Bot follow distance - SetFollowDistance
 	if(!strcasecmp(sep->arg[1], "setfollowdistance")) {
-		if((c->GetTarget() == NULL) || (c->GetTarget() == c) || (!c->GetTarget()->IsBot()) ) {
-			c->Message(15, "You must target a bot!");
+		if((c->GetTarget() == NULL) || (c->GetTarget() == c) || (!c->GetTarget()->IsBot()) || (c->GetTarget()->CastToBot()->GetBotOwner() != c)) {
+			c->Message(15, "You must target a bot you own!");
 		}
 		else {
 			int32 BotFollowDistance = atoi(sep->arg[2]);
@@ -10133,7 +10139,83 @@
 		return;
 	}
 
-	
+	//bot armor colors
+	if(!strcasecmp(sep->arg[1], "armorcolor")) {
+		if(c->GetTarget() && c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwner() == c)) {
+			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]);
+			uint8 green = atoi(sep->arg[4]);
+			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;
+			}
+			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
+		if(!strcasecmp(sep->arg[1], "help") && !strcasecmp(sep->arg[2], "armorcolor") ){
+		//read from db
+		char* Query = 0;
+		MYSQL_RES* DatasetResult;
+		MYSQL_ROW DataRow;
+		
+		c->Message(0, "-----------------#bot armorcolor help-----------------------------");
+		c->Message(0, "Armor:  17(Chest/Robe), 7(Arms), 9(Bracer), 12(Hands), 18(Legs), 19(Boots), 2(Helm)");
+		c->Message(0, "------------------------------------------------------------------");
+		c->Message(0, "Color: [red] [green] [blue]  (enter a number from 0-255 for each");
+		c->Message(0, "------------------------------------------------------------------");
+		c->Message(0, "Example: #bot armorcolor 17 0 255 0 - this would make the chest bright green");
+		return;
+	}
+
+		//Enchant Metals
+	if(!strcasecmp(sep->arg[1], "enchant")) {
+		if(c->IsGrouped()){
+			Group *g = c->GetGroup();
+			for(int i=0; i<MAX_GROUP_MEMBERS; i++){
+				if(g && g->members[i] && g->members[i]->IsBot()) {
+					uint8 casterlevel = g->members[i]->GetLevel();
+					uint8 casterclass = g->members[i]->GetClass();
+					if (casterclass == ENCHANTER){
+						if(!strcasecmp(sep->arg[2], "silver")){
+							if (casterlevel >= 7){
+								g->members[i]->Say("Enchanting your silver bar");
+								g->members[i]->CastSpell(30015, c->GetID(), SLOT_CURSOR);
+							}
+							else {g->members[i]->Say("I must be at least level 7 to enchant silver.");}
+						}
+					}
+				}
+			}
+		}
+		else {
+			c->Message(15, "You need to be grouped with an enchanter.");
+		}
+		return;
+	}
+
 	if(!strcasecmp(sep->arg[1], "augmentitem")) {
 		AugmentItem_Struct* in_augment = new AugmentItem_Struct[sizeof(AugmentItem_Struct)];
 		in_augment->container_slot = 1000;
@@ -11490,7 +11572,7 @@
 	// Remove Bot's Pet
 	if(!strcasecmp(sep->arg[1], "pet") && !strcasecmp(sep->arg[2], "remove")) {
 		if(c->GetTarget() != NULL) {
-			if (c->IsGrouped() && c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwnerCharacterID() != c->CharacterID()) &&
+			if (c->IsGrouped() && c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwner() == c) &&
 				((c->GetTarget()->GetClass() == NECROMANCER) || (c->GetTarget()->GetClass() == ENCHANTER) || (c->GetTarget()->GetClass() == DRUID))) {
 					if(c->GetTarget()->CastToBot()->IsBotCharmer()) {
 						c->GetTarget()->CastToBot()->SetBotCharmer(false);
@@ -11770,8 +11852,8 @@
 		Group *g = c->GetGroup();
 		Mob *target = c->GetTarget();
 
-		if(target == NULL || (!target->IsClient() && !target->IsBot()))
-			c->Message(15, "You must select a player or bot");
+		if(target == NULL || (!target->IsClient() && (c->GetTarget()->CastToBot()->GetBotOwner() != c)))
+			c->Message(15, "You must select a player or bot you own");
 
 		else if(g) {
 			for(int i=0; i<MAX_GROUP_MEMBERS; i++){
@@ -11797,8 +11879,6 @@
 
 					if (c->GetLevel() >= 15) { 
 						Shrinker->Say("Casting Shrink...");
-						//Shrinker->CastToBot()->BotRaidSpell(345);
-						//Shrinker->CastSpell(345, id), 1);
 						Shrinker->CastToBot()->SpellOnTarget(345, target);
 					}
 					else if (c->GetLevel() <= 14) {
@@ -11810,8 +11890,6 @@
 
 					if (c->GetLevel() >= 23) {
 						Shrinker->Say("Casting Shrink...");
-						//Shrinker->CastToBot()->BotRaidSpell(345);
-						//Shrinker->CastSpell(345, id), 1);
 						Shrinker->CastToBot()->SpellOnTarget(345, target);
 					}
 					else if (c->GetLevel() <= 22) {
@@ -13742,4 +13820,31 @@
 	return needHealed;
 }
 
+uint32 Bot::GetEquipmentColor(int8 material_slot) const
+{
+	//Bot tints
+	int32 slotid = 0;
+	uint32 returncolor = 0;
+	uint32 botid = this->GetBotID();
+	
+	//Translate code slot # to DB slot #
+	slotid = Inventory::CalcSlotFromMaterial(material_slot);
+
+	//read from db
+	char* Query = 0;
+	MYSQL_RES* DatasetResult;
+	MYSQL_ROW DataRow;
+	
+	if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT color FROM botinventory WHERE BotID = %u AND SlotID = %u", botid, slotid), 0, &DatasetResult)) {
+		if(mysql_num_rows(DatasetResult) == 1) {
+			DataRow = mysql_fetch_row(DatasetResult);
+			if(DataRow)
+				returncolor = atoi(DataRow[0]);
+		}
+		mysql_free_result(DatasetResult);
+		safe_delete_array(Query);
+	}
+	return returncolor;
+}
+
 #endif
Index: bot.h
===================================================================
--- bot.h	(revision 1976)
+++ bot.h	(working copy)
@@ -217,6 +217,7 @@
 	void BotTradeAddItem(uint32 id, const ItemInst* inst, sint16 charges, uint32 equipableSlots, int16 lootSlot, std::string* errorMessage, bool addToDb = true);
 	void EquipBot(std::string* errorMessage);
 	bool CheckLoreConflict(const Item_Struct* item);
+	uint32 Bot::GetEquipmentColor(int8 material_slot) const;
 
 	// Static Class Methods
 	static void SaveBotGroup(Group* botGroup, std::string botGroupName, std::string* errorMessage);
@@ -296,7 +297,7 @@
 	static bool GroupHasPriestClass(Group* group) { return GroupHasClass(group, CLERIC | DRUID | SHAMAN); }
 
 	// "GET" Class Methods
-	uint32 GetBotID() { return _botID; }
+	uint32 GetBotID() const { return _botID; }
 	uint32 GetBotOwnerCharacterID() { return _botOwnerCharacterID; }
 	uint32 GetBotSpellID() { return npc_spells_id; }
 	Mob* GetBotOwner() { return this->_botOwner; }
Index: botspellsai.cpp
===================================================================
--- botspellsai.cpp	(revision 1976)
+++ botspellsai.cpp	(working copy)
@@ -298,6 +298,7 @@
 							break;
 						case ARCHETYPE_MELEE:
 							if(IsEffectInSpell(selectedBotSpell.SpellId, SE_IncreaseSpellHaste) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ManaPool) ||
+								IsEffectInSpell(selectedBotSpell.SpellId, SE_CastingLevel) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ManaRegen_v2) ||
 								IsEffectInSpell(selectedBotSpell.SpellId, SE_CurrentMana))
 							{
 								continue;
@@ -558,8 +559,15 @@
 						GroupHasShaman = true;
 					}
 					else if (botClass == ENCHANTER){
-						botSpell = GetBestBotSpellForMagicBasedSlow(this);
-						GroupHasEnchanter = true;
+						//Checking no adds before slow/debuff
+						Mob* addMob = GetFirstIncomingMobToMez(this, botSpell);
+
+						if(addMob){
+							break;}
+						else {
+ 						botSpell = GetBestBotSpellForMagicBasedSlow(this);
+ 						GroupHasEnchanter = true;
+						}
 					}
 					else if (botClass == BEASTLORD && GroupHasEnchanter == false && GroupHasShaman == false){
 						botSpell = GetBestBotSpellForDiseaseBasedSlow(this);
@@ -584,6 +592,13 @@
 					
 					checked_los = true;
 				}
+				//if enchanter checking if no adds
+				if (botClass == ENCHANTER){
+					Mob* addMob = GetFirstIncomingMobToMez(this, botSpell);
+ 
+					if(addMob){
+						break;}
+				}
 
 				botSpell = GetDebuffBotSpell(this, tar);
Reply With Quote
  #7  
Old 07-22-2011, 06:13 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Oops double posted
Reply With Quote
  #8  
Old 07-22-2011, 06:18 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

It worked this time but the diff is still off. You have two of the "picklock" sections and some of the other changes are already in the source.
__________________
The Realm
Reply With Quote
  #9  
Old 07-22-2011, 06:29 PM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

Quote:
Originally Posted by Congdar View Post
It worked this time but the diff is still off. You have two of the "picklock" sections and some of the other changes are already in the source.
Yea i reposted it.

Its weird but my tortoise seemed to be reading from a cache or something
Reply With Quote
  #10  
Old 07-23-2011, 03:51 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

committed in svn 1981
__________________
The Realm
Reply With Quote
  #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
  #12  
Old 07-23-2011, 07:44 PM
Congdar
Developer
 
Join Date: Jul 2007
Location: my own little world
Posts: 751
Default

svn 1982, thanks lerxst2112.
__________________
The Realm
Reply With Quote
  #13  
Old 07-24-2011, 04:27 AM
Wolfling
Fire Beetle
 
Join Date: Sep 2010
Posts: 21
Default

I would just like to say thanks for this, always hated how my bots looked

works perfectly

Thanks Crimson for starting this, and lerxst2112/Congdar for the extra help
Reply With Quote
  #14  
Old 07-24-2011, 05:17 AM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default

My pleasure. I am glad to be able to help out with something people enjoy. Nice to hear it is appreciated.
Reply With Quote
  #15  
Old 01-25-2012, 05:00 AM
Taurinus2
Sarnak
 
Join Date: Nov 2009
Posts: 45
Default Fix

Code:
uint32 Bot::GetEquipmentColor(int8 material_slot) const
{
	//Bot tints
	int32 slotid = 0;
	uint32 returncolor = 0;
	uint32 botid = this->GetBotID();
	
	//Translate code slot # to DB slot #
	slotid = Inventory::CalcSlotFromMaterial(material_slot);

	//read from db
	char* Query = 0;
	MYSQL_RES* DatasetResult;
	MYSQL_ROW DataRow;
	
	if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT color FROM botinventory WHERE BotID = %u AND SlotID = %u", botid, slotid), 0, &DatasetResult)) {
		if(mysql_num_rows(DatasetResult) == 1) {
			DataRow = mysql_fetch_row(DatasetResult);
			if(DataRow)
				returncolor = atoul(DataRow[0]); //atoi used here is wrong
		}
		mysql_free_result(DatasetResult);
		safe_delete_array(Query);
	}
	return returncolor;
}
See code and comment for details.
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 04:48 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