skyy
10-12-2015, 03:30 PM
Hello there,
i am currently trying to limit the amount of same class-bots per group for my solo server project and am having a little trouble doing so.
what i was trying was to simply not let them being invited to group when there is already the same class present:
void Bot::ProcessBotGroupInvite(Client* c, std::string botName) {
if(c) {
Bot* invitedBot = GetBotByBotClientOwnerAndBotName(c, botName);
if(invitedBot && !invitedBot->HasGroup()) {
if(!c->IsGrouped()) {
Group *g = new Group(c);
if(AddBotToGroup(invitedBot, g)) {
entity_list.AddGroup(g);
database.SetGroupLeaderName(g->GetID(), c->GetName());
g->SaveGroupLeaderAA();
database.SetGroupID(c->GetName(), g->GetID(), c->CharacterID());
database.SetGroupID(invitedBot->GetCleanName(), g->GetID(), invitedBot->GetBotID());
}
} else {
// godrage
//for (int i = 0; i < 7; ++i)
//{
// if (c->GetGroup()->members[i]->GetClass() == invitedBot->GetClass())
// {
// c->Say("It's all about diversity...");
// break;
// }
//}
AddBotToGroup(invitedBot, c->GetGroup());
database.SetGroupID(invitedBot->GetCleanName(), c->GetGroup()->GetID(), invitedBot->GetBotID());
}
}
}
}
but due to my rather limited knowledge of the source and c++ i cant seem to get it to work;
anyone able to help me out on that ? would highly appreciate it :D
i am currently trying to limit the amount of same class-bots per group for my solo server project and am having a little trouble doing so.
what i was trying was to simply not let them being invited to group when there is already the same class present:
void Bot::ProcessBotGroupInvite(Client* c, std::string botName) {
if(c) {
Bot* invitedBot = GetBotByBotClientOwnerAndBotName(c, botName);
if(invitedBot && !invitedBot->HasGroup()) {
if(!c->IsGrouped()) {
Group *g = new Group(c);
if(AddBotToGroup(invitedBot, g)) {
entity_list.AddGroup(g);
database.SetGroupLeaderName(g->GetID(), c->GetName());
g->SaveGroupLeaderAA();
database.SetGroupID(c->GetName(), g->GetID(), c->CharacterID());
database.SetGroupID(invitedBot->GetCleanName(), g->GetID(), invitedBot->GetBotID());
}
} else {
// godrage
//for (int i = 0; i < 7; ++i)
//{
// if (c->GetGroup()->members[i]->GetClass() == invitedBot->GetClass())
// {
// c->Say("It's all about diversity...");
// break;
// }
//}
AddBotToGroup(invitedBot, c->GetGroup());
database.SetGroupID(invitedBot->GetCleanName(), c->GetGroup()->GetID(), invitedBot->GetBotID());
}
}
}
}
but due to my rather limited knowledge of the source and c++ i cant seem to get it to work;
anyone able to help me out on that ? would highly appreciate it :D