Moved class Bot database code into class BotDatbase

This commit is contained in:
Uleat
2016-04-05 18:37:19 -04:00
parent 22b7e76537
commit e759bb6da8
13 changed files with 2899 additions and 1928 deletions
+6 -12
View File
@@ -2056,24 +2056,23 @@ bool QuestManager::botquest()
bool QuestManager::createBot(const char *name, const char *lastname, uint8 level, uint16 race, uint8 botclass, uint8 gender)
{
QuestManagerCurrentQuestVars();
std::string TempErrorMessage;
uint32 MaxBotCreate = RuleI(Bots, CreationLimit);
if (initiator && initiator->IsClient())
{
if(Bot::SpawnedBotCount(initiator->CharacterID(), &TempErrorMessage) >= MaxBotCreate)
if(Bot::SpawnedBotCount(initiator->CharacterID()) >= MaxBotCreate)
{
initiator->Message(15,"You have the maximum number of bots allowed.");
return false;
}
if(!TempErrorMessage.empty())
{
initiator->Message(13, "Database Error: %s", TempErrorMessage.c_str());
std::string test_name = name;
bool available_flag = false;
if(!botdb.QueryNameAvailablity(test_name, available_flag)) {
initiator->Message(0, "%s for '%s'", BotDatabase::fail::QueryNameAvailablity(), (char*)name);
return false;
}
if(Bot::IsBotNameAvailable((char*)name,&TempErrorMessage)) {
if (!available_flag) {
initiator->Message(0, "The name %s is already being used or is invalid. Please choose a different name.", (char*)name);
return false;
}
@@ -2093,11 +2092,6 @@ bool QuestManager::createBot(const char *name, const char *lastname, uint8 level
return false;
}
if(!TempErrorMessage.empty()) {
initiator->Message(13, "Database Error: %s", TempErrorMessage.c_str());
return false;
}
// Now that all validation is complete, we can save our newly created bot
if(!NewBot->Save())
{