I am currently looking for a way to get bots to spawn if the accountID matches instead of the characterID and came to a bit of a pit regarding my meager knowledge of the source.
What i tried was looking into bots.cpp:
1) at the spawn command I disabled the check for owned bot:
Code:
if(!strcasecmp(sep->arg[1], "spawn") ) {
if (RuleB(Bots, BotCharacterLevelEnabled)) {
if (c->GetLevel() < RuleI(Bots, BotCharacterLevel)) {
c->Message(0, "You are only level %d, you must be level %d to spawn a bot!", c->GetLevel(), RuleI(Bots, BotCharacterLevel));
return;
}
}
uint32 botId = GetBotIDByBotName(std::string(sep->arg[2]));
int xy = c->AccountID();
int yz = GetBotOwnerCharacterID(botId, &TempErrorMessage);
int yzz = database.GetAccountIDByChar(yz);
if (xy != yzz)//(GetBotOwnerCharacterID(botId, &TempErrorMessage) != c->CharacterID()) godrage
{
c->Message(0, "You can't spawn a bot that you don't own.");
}
2) disabling the same check at the Bot::Spawn
Code:
void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
if(GetBotID() > 0 && _botOwnerCharacterID > 0 && botCharacterOwner )//&& botCharacterOwner->CharacterID() == _botOwnerCharacterID)
3) redoing the casttoclient to the actual client
Code:
if(this->Save())
botCharacterOwner->CastToClient()->Message(0, "%s saved.", this->GetCleanName());
//this->GetBotOwner()->CastToClient()->Message(0, "%s saved.", this->GetCleanName());
else
botCharacterOwner->CastToClient()->Message(13, "%s save failed!", this->GetCleanName());
//this->GetBotOwner()->CastToClient()->Message(13, "%s save failed!", this->GetCleanName());
4) now the bot spawns and immediately despawns and I am stuck as to where the despawn is triggered
can anyone see this endeavour as totally fruitless ?
The main idea for my solo server project is to not have to create bots for every character you create over and over again.
thanks in advance!