View Single Post
  #5  
Old 09-23-2019, 04:51 AM
prestanneth
Fire Beetle
 
Join Date: Jul 2015
Posts: 25
Default

a few weeks late but just for info, its entirely possible with just the issues already mentioned ( gear level mostly). This depends on server and how its' being used.
I.E on my kids playground i have the ^botshare command implemented for the exact reasons above, re-gearing & recreating a "set" is irritating.
This wouldn't stand up in an public server due to several incomplete issues but is fine for me.

this snippet checks zone ( is missing a world check! ), to see if bots already spawned / in use, and if not swaps it to current char who called command.
Code:
^botshare botname

	std::string bot_name = sep->arg[1];
+	std::list<Bot*> bot_list;  // own bots
+		for (std::list<Bot*>::iterator botListItr = bot_list.begin(); botListItr != bot_list.end(); ++botListItr) {
+			Bot* tempBot = *botListItr;
+			if (tempBot->Spawned())
+			{
+				c->Message(m_action, "bot '%s' is spawned", tempBot->GetCleanName());
+			}
+		}
+
+	Bot* botCheckNotOnline = entity_list.GetBotByBotName(bot_name);//bots in zone?
+	if (!botCheckNotOnline) {
+		if (!botdb.BotShare(c->CharacterID(), bot_name)) {
+			c->Message(m_fail, "%s for '%s'", BotDatabase::fail::BotShare(), bot_name.c_str());
+			return;
+		}
+		else {
+			c->Message(m_action, "You are now the owner of bot '%s'", bot_name.c_str());
+		}
where the botdb.BotShare call is doing the swapping via sql qry.
Code:
+	query = StringFormat("update bot_data bd inner join character_data cd on bd.owner_id = cd.id inner join character_data cx on cx.id = '%u' SET owner_id = '%u' where bd.`name` = '%s' and cx.account_id = cd.account_id", owner_id, owner_id, bot_name.c_str());
+
+	auto results = QueryDatabase(query);
added a nodrop check to the fv check area. ( stops them sharing no drop items if you want to be harsh )

Code:
	if(( itm->NoDrop == 0) && (RuleI(World, FVNoDropFlag) != 1 || RuleI(World, FVNoDropFlag) != 2) || c->Admin() < RuleI(Character, MinStatusForNoDropExemptions))
+	{
+		c->Message(m_unknown,  "Item is marked as NO DROP and will not be removed");
+		return;
+	}
side note , i added the "byaccount" flag to ^botlist a few weeks back, mostly cause i use it for the above so i can remember their names for sharing.

KentaiVZ
Reply With Quote