mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
Reworked BotDatabase into a functional add-on for ZoneDatabase
This commit is contained in:
parent
2e9cf7dbd7
commit
ee49ad3ce9
@ -1,5 +1,10 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 6/24/2019 ==
|
||||
Uleat: Reworked BotDatabase into a functional add-on for ZoneDatabase
|
||||
- Eliminated the database connection associated with class BotDatabase
|
||||
- All behaviors remain the same with the exception of the calling object
|
||||
-- To invoke a BotDatabase function, use database.botdb.<f> rather than botdb.<f>
|
||||
|
||||
== 3/1/2019 ==
|
||||
Noudess: Major faction conversion to use client data.
|
||||
|
||||
88
zone/bot.cpp
88
zone/bot.cpp
@ -158,7 +158,7 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
||||
SetRangerAutoWeaponSelect(false);
|
||||
|
||||
bool stance_flag = false;
|
||||
if (!botdb.LoadStance(this, stance_flag) && bot_owner)
|
||||
if (!database.botdb.LoadStance(this, stance_flag) && bot_owner)
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::LoadStance(), GetCleanName());
|
||||
if (!stance_flag && bot_owner)
|
||||
bot_owner->Message(13, "Could not locate stance for '%s'", GetCleanName());
|
||||
@ -177,10 +177,10 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
||||
strcpy(this->name, this->GetCleanName());
|
||||
|
||||
memset(&_botInspectMessage, 0, sizeof(InspectMessage_Struct));
|
||||
if (!botdb.LoadInspectMessage(GetBotID(), _botInspectMessage) && bot_owner)
|
||||
if (!database.botdb.LoadInspectMessage(GetBotID(), _botInspectMessage) && bot_owner)
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::LoadInspectMessage(), GetCleanName());
|
||||
|
||||
if (!botdb.LoadGuildMembership(GetBotID(), _guildId, _guildRank, _guildName) && bot_owner)
|
||||
if (!database.botdb.LoadGuildMembership(GetBotID(), _guildId, _guildRank, _guildName) && bot_owner)
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::LoadGuildMembership(), GetCleanName());
|
||||
|
||||
std::string error_message;
|
||||
@ -205,12 +205,12 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
||||
|
||||
GenerateBaseStats();
|
||||
|
||||
if (!botdb.LoadTimers(this) && bot_owner)
|
||||
if (!database.botdb.LoadTimers(this) && bot_owner)
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::LoadTimers(), GetCleanName());
|
||||
|
||||
LoadAAs();
|
||||
|
||||
if (!botdb.LoadBuffs(this) && bot_owner)
|
||||
if (!database.botdb.LoadBuffs(this) && bot_owner)
|
||||
bot_owner->Message(13, "&s for '%s'", BotDatabase::fail::LoadBuffs(), GetCleanName());
|
||||
|
||||
CalcBotStats(false);
|
||||
@ -1700,25 +1700,25 @@ bool Bot::Save()
|
||||
|
||||
if(!GetBotID()) { // New bot record
|
||||
uint32 bot_id = 0;
|
||||
if (!botdb.SaveNewBot(this, bot_id) || !bot_id) {
|
||||
if (!database.botdb.SaveNewBot(this, bot_id) || !bot_id) {
|
||||
bot_owner->Message(13, "%s '%s'", BotDatabase::fail::SaveNewBot(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
SetBotID(bot_id);
|
||||
}
|
||||
else { // Update existing bot record
|
||||
if (!botdb.SaveBot(this)) {
|
||||
if (!database.botdb.SaveBot(this)) {
|
||||
bot_owner->Message(13, "%s '%s'", BotDatabase::fail::SaveBot(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// All of these continue to process if any fail
|
||||
if (!botdb.SaveBuffs(this))
|
||||
if (!database.botdb.SaveBuffs(this))
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::SaveBuffs(), GetCleanName());
|
||||
if (!botdb.SaveTimers(this))
|
||||
if (!database.botdb.SaveTimers(this))
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::SaveTimers(), GetCleanName());
|
||||
if (!botdb.SaveStance(this))
|
||||
if (!database.botdb.SaveStance(this))
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::SaveStance(), GetCleanName());
|
||||
|
||||
if (!SavePet())
|
||||
@ -1733,20 +1733,20 @@ bool Bot::DeleteBot()
|
||||
if (!bot_owner)
|
||||
return false;
|
||||
|
||||
if (!botdb.DeleteHealRotation(GetBotID())) {
|
||||
if (!database.botdb.DeleteHealRotation(GetBotID())) {
|
||||
bot_owner->Message(13, "%s", BotDatabase::fail::DeleteHealRotation());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string query = StringFormat("DELETE FROM `bot_heal_rotation_members` WHERE `bot_id` = '%u'", GetBotID());
|
||||
auto results = botdb.QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
bot_owner->Message(13, "Failed to delete heal rotation member '%s'", GetCleanName());
|
||||
return false;
|
||||
}
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_heal_rotation_targets` WHERE `target_name` LIKE '%s'", GetCleanName());
|
||||
results = botdb.QueryDatabase(query);
|
||||
results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
bot_owner->Message(13, "Failed to delete heal rotation target '%s'", GetCleanName());
|
||||
return false;
|
||||
@ -1762,32 +1762,32 @@ bool Bot::DeleteBot()
|
||||
|
||||
std::string error_message;
|
||||
|
||||
if (!botdb.RemoveMemberFromBotGroup(GetBotID())) {
|
||||
if (!database.botdb.RemoveMemberFromBotGroup(GetBotID())) {
|
||||
bot_owner->Message(13, "%s - '%s'", BotDatabase::fail::RemoveMemberFromBotGroup(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!botdb.DeleteItems(GetBotID())) {
|
||||
if (!database.botdb.DeleteItems(GetBotID())) {
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteItems(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!botdb.DeleteTimers(GetBotID())) {
|
||||
if (!database.botdb.DeleteTimers(GetBotID())) {
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteTimers(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!botdb.DeleteBuffs(GetBotID())) {
|
||||
if (!database.botdb.DeleteBuffs(GetBotID())) {
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteBuffs(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!botdb.DeleteStance(GetBotID())) {
|
||||
if (!database.botdb.DeleteStance(GetBotID())) {
|
||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteStance(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!botdb.DeleteBot(GetBotID())) {
|
||||
if (!database.botdb.DeleteBot(GetBotID())) {
|
||||
bot_owner->Message(13, "%s '%s'", BotDatabase::fail::DeleteBot(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
@ -1831,7 +1831,7 @@ bool Bot::LoadPet()
|
||||
std::string error_message;
|
||||
|
||||
uint32 pet_index = 0;
|
||||
if (!botdb.LoadPetIndex(GetBotID(), pet_index)) {
|
||||
if (!database.botdb.LoadPetIndex(GetBotID(), pet_index)) {
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetIndex(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
@ -1839,7 +1839,7 @@ bool Bot::LoadPet()
|
||||
return true;
|
||||
|
||||
uint32 saved_pet_spell_id = 0;
|
||||
if (!botdb.LoadPetSpellID(GetBotID(), saved_pet_spell_id)) {
|
||||
if (!database.botdb.LoadPetSpellID(GetBotID(), saved_pet_spell_id)) {
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetSpellID(), GetCleanName());
|
||||
}
|
||||
if (!IsValidSpell(saved_pet_spell_id)) {
|
||||
@ -1853,7 +1853,7 @@ bool Bot::LoadPet()
|
||||
uint32 pet_hp = 0;
|
||||
uint32 pet_spell_id = 0;
|
||||
|
||||
if (!botdb.LoadPetStats(GetBotID(), pet_name, pet_mana, pet_hp, pet_spell_id)) {
|
||||
if (!database.botdb.LoadPetStats(GetBotID(), pet_name, pet_mana, pet_hp, pet_spell_id)) {
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetStats(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
@ -1868,12 +1868,12 @@ bool Bot::LoadPet()
|
||||
|
||||
SpellBuff_Struct pet_buffs[PET_BUFF_COUNT];
|
||||
memset(pet_buffs, 0, (sizeof(SpellBuff_Struct) * PET_BUFF_COUNT));
|
||||
if (!botdb.LoadPetBuffs(GetBotID(), pet_buffs))
|
||||
if (!database.botdb.LoadPetBuffs(GetBotID(), pet_buffs))
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetBuffs(), GetCleanName());
|
||||
|
||||
uint32 pet_items[EQEmu::invslot::EQUIPMENT_COUNT];
|
||||
memset(pet_items, 0, (sizeof(uint32) * EQEmu::invslot::EQUIPMENT_COUNT));
|
||||
if (!botdb.LoadPetItems(GetBotID(), pet_items))
|
||||
if (!database.botdb.LoadPetItems(GetBotID(), pet_items))
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetItems(), GetCleanName());
|
||||
|
||||
pet_inst->SetPetState(pet_buffs, pet_items);
|
||||
@ -1912,14 +1912,14 @@ bool Bot::SavePet()
|
||||
|
||||
std::string error_message;
|
||||
|
||||
if (!botdb.SavePetStats(GetBotID(), pet_name_str, pet_inst->GetMana(), pet_inst->GetHP(), pet_inst->GetPetSpellID())) {
|
||||
if (!database.botdb.SavePetStats(GetBotID(), pet_name_str, pet_inst->GetMana(), pet_inst->GetHP(), pet_inst->GetPetSpellID())) {
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::SavePetStats(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!botdb.SavePetBuffs(GetBotID(), pet_buffs))
|
||||
if (!database.botdb.SavePetBuffs(GetBotID(), pet_buffs))
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::SavePetBuffs(), GetCleanName());
|
||||
if (!botdb.SavePetItems(GetBotID(), pet_items))
|
||||
if (!database.botdb.SavePetItems(GetBotID(), pet_items))
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::SavePetItems(), GetCleanName());
|
||||
|
||||
return true;
|
||||
@ -1933,15 +1933,15 @@ bool Bot::DeletePet()
|
||||
|
||||
std::string error_message;
|
||||
|
||||
if (!botdb.DeletePetItems(GetBotID())) {
|
||||
if (!database.botdb.DeletePetItems(GetBotID())) {
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::DeletePetItems(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
if (!botdb.DeletePetBuffs(GetBotID())) {
|
||||
if (!database.botdb.DeletePetBuffs(GetBotID())) {
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::DeletePetBuffs(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
if (!botdb.DeletePetStats(GetBotID())) {
|
||||
if (!database.botdb.DeletePetStats(GetBotID())) {
|
||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::DeletePetStats(), GetCleanName());
|
||||
return false;
|
||||
}
|
||||
@ -3301,7 +3301,7 @@ void Bot::RemoveBotItemBySlot(uint32 slotID, std::string *errorMessage)
|
||||
if(!GetBotID())
|
||||
return;
|
||||
|
||||
if(!botdb.DeleteItemBySlot(GetBotID(), slotID))
|
||||
if(!database.botdb.DeleteItemBySlot(GetBotID(), slotID))
|
||||
*errorMessage = BotDatabase::fail::DeleteItemBySlot();
|
||||
|
||||
m_inv.DeleteItem(slotID);
|
||||
@ -3314,7 +3314,7 @@ void Bot::GetBotItems(EQEmu::InventoryProfile &inv, std::string* errorMessage)
|
||||
if(!GetBotID())
|
||||
return;
|
||||
|
||||
if (!botdb.LoadItems(GetBotID(), inv)) {
|
||||
if (!database.botdb.LoadItems(GetBotID(), inv)) {
|
||||
*errorMessage = BotDatabase::fail::LoadItems();
|
||||
return;
|
||||
}
|
||||
@ -3329,7 +3329,7 @@ uint32 Bot::GetBotItemBySlot(uint32 slotID)
|
||||
if(!GetBotID())
|
||||
return item_id;
|
||||
|
||||
if (!botdb.LoadItemBySlot(GetBotID(), slotID, item_id)) {
|
||||
if (!database.botdb.LoadItemBySlot(GetBotID(), slotID, item_id)) {
|
||||
if (GetBotOwner() && GetBotOwner()->IsClient())
|
||||
GetBotOwner()->CastToClient()->Message(13, "%s", BotDatabase::fail::LoadItemBySlot());
|
||||
}
|
||||
@ -3418,7 +3418,7 @@ Bot* Bot::LoadBot(uint32 botID)
|
||||
if (!botID)
|
||||
return loaded_bot;
|
||||
|
||||
if (!botdb.LoadBot(botID, loaded_bot)) // TODO: Consider update to message handler
|
||||
if (!database.botdb.LoadBot(botID, loaded_bot)) // TODO: Consider update to message handler
|
||||
return loaded_bot;
|
||||
|
||||
return loaded_bot;
|
||||
@ -3433,7 +3433,7 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) {
|
||||
uint32 TempGroupId = g->GetID();
|
||||
std::list<uint32> ActiveBots;
|
||||
// Modified LoadGroupedBotsByGroupID to require a CharacterID
|
||||
if (!botdb.LoadGroupedBotsByGroupID(botOwner->CharacterID(), TempGroupId, ActiveBots)) {
|
||||
if (!database.botdb.LoadGroupedBotsByGroupID(botOwner->CharacterID(), TempGroupId, ActiveBots)) {
|
||||
botOwner->Message(13, "%s", BotDatabase::fail::LoadGroupedBotsByGroupID());
|
||||
return;
|
||||
}
|
||||
@ -3714,7 +3714,7 @@ void Bot::BotTradeSwapItem(Client* client, int16 lootSlot, const EQEmu::ItemInst
|
||||
void Bot::BotTradeAddItem(uint32 id, const EQEmu::ItemInstance* inst, int16 charges, uint32 equipableSlots, uint16 lootSlot, std::string* errorMessage, bool addToDb)
|
||||
{
|
||||
if(addToDb) {
|
||||
if (!botdb.SaveItemBySlot(this, lootSlot, inst)) {
|
||||
if (!database.botdb.SaveItemBySlot(this, lootSlot, inst)) {
|
||||
*errorMessage = BotDatabase::fail::SaveItemBySlot();
|
||||
return;
|
||||
}
|
||||
@ -4129,7 +4129,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
|
||||
// // TODO: add logging
|
||||
//}
|
||||
|
||||
if (!botdb.DeleteItemBySlot(GetBotID(), return_iterator.fromBotSlot))
|
||||
if (!database.botdb.DeleteItemBySlot(GetBotID(), return_iterator.fromBotSlot))
|
||||
client->Message(CC_Red, "%s (slot: %i, name: '%s')", BotDatabase::fail::DeleteItemBySlot(), return_iterator.fromBotSlot, (return_instance ? return_instance->GetItem()->Name : "nullptr"));
|
||||
|
||||
BotRemoveEquipItem(return_iterator.fromBotSlot);
|
||||
@ -4144,7 +4144,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
|
||||
for (auto& trade_iterator : client_trade) {
|
||||
// TODO: code for stackables
|
||||
|
||||
if (!botdb.SaveItemBySlot(this, trade_iterator.toBotSlot, trade_iterator.tradeItemInstance))
|
||||
if (!database.botdb.SaveItemBySlot(this, trade_iterator.toBotSlot, trade_iterator.tradeItemInstance))
|
||||
client->Message(CC_Red, "%s (slot: %i, name: '%s')", BotDatabase::fail::SaveItemBySlot(), trade_iterator.toBotSlot, (trade_iterator.tradeItemInstance ? trade_iterator.tradeItemInstance->GetItem()->Name : "nullptr"));
|
||||
|
||||
m_inv.PutItem(trade_iterator.toBotSlot, *trade_iterator.tradeItemInstance);
|
||||
@ -5944,7 +5944,7 @@ void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!botdb.SaveGuildMembership(botToGuild->GetBotID(), guildOfficer->GuildID(), GUILD_MEMBER)) {
|
||||
if (!database.botdb.SaveGuildMembership(botToGuild->GetBotID(), guildOfficer->GuildID(), GUILD_MEMBER)) {
|
||||
guildOfficer->Message(13, "%s for '%s'", BotDatabase::fail::SaveGuildMembership(), botToGuild->GetCleanName());
|
||||
return;
|
||||
}
|
||||
@ -5969,16 +5969,16 @@ bool Bot::ProcessGuildRemoval(Client* guildOfficer, std::string botName) {
|
||||
if(guildOfficer && !botName.empty()) {
|
||||
Bot* botToUnGuild = entity_list.GetBotByBotName(botName);
|
||||
if(botToUnGuild) {
|
||||
if (botdb.SaveGuildMembership(botToUnGuild->GetBotID(), 0, 0))
|
||||
if (database.botdb.SaveGuildMembership(botToUnGuild->GetBotID(), 0, 0))
|
||||
Result = true;
|
||||
} else {
|
||||
uint32 ownerId = 0;
|
||||
if (!botdb.LoadOwnerID(botName, ownerId))
|
||||
if (!database.botdb.LoadOwnerID(botName, ownerId))
|
||||
guildOfficer->Message(13, "%s for '%s'", BotDatabase::fail::LoadOwnerID(), botName.c_str());
|
||||
uint32 botId = 0;
|
||||
if (!botdb.LoadBotID(ownerId, botName, botId))
|
||||
if (!database.botdb.LoadBotID(ownerId, botName, botId))
|
||||
guildOfficer->Message(13, "%s for '%s'", BotDatabase::fail::LoadBotID(), botName.c_str());
|
||||
if (botId && botdb.SaveGuildMembership(botId, 0, 0))
|
||||
if (botId && database.botdb.SaveGuildMembership(botId, 0, 0))
|
||||
Result = true;
|
||||
}
|
||||
|
||||
@ -9068,7 +9068,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag)
|
||||
if (all_flag)
|
||||
save_slot = -2;
|
||||
|
||||
if (!botdb.SaveEquipmentColor(GetBotID(), save_slot, rgb)) {
|
||||
if (!database.botdb.SaveEquipmentColor(GetBotID(), save_slot, rgb)) {
|
||||
if (GetBotOwner() && GetBotOwner()->IsClient())
|
||||
GetBotOwner()->CastToClient()->Message(13, "%s", BotDatabase::fail::SaveEquipmentColor());
|
||||
return false;
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
#include "groups.h"
|
||||
#include "corpse.h"
|
||||
#include "zonedb.h"
|
||||
#include "bot_database.h"
|
||||
#include "string_ids.h"
|
||||
#include "../common/misc_functions.h"
|
||||
#include "../common/global_define.h"
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
#include "bot_command.h"
|
||||
#include "bot_database.h"
|
||||
#include "zonedb.h"
|
||||
#include "guild_mgr.h"
|
||||
#include "map.h"
|
||||
#include "doors.h"
|
||||
@ -1422,7 +1422,7 @@ int bot_command_init(void)
|
||||
}
|
||||
|
||||
std::map<std::string, std::pair<uint8, std::vector<std::string>>> bot_command_settings;
|
||||
botdb.LoadBotCommandSettings(bot_command_settings);
|
||||
database.botdb.LoadBotCommandSettings(bot_command_settings);
|
||||
|
||||
auto working_bcl = bot_command_list;
|
||||
for (auto working_bcl_iter : working_bcl) {
|
||||
@ -1868,11 +1868,11 @@ namespace MyBots
|
||||
std::string group_name = name;
|
||||
|
||||
uint32 botgroup_id = 0;
|
||||
if (!botdb.LoadBotGroupIDForLoadBotGroup(bot_owner->CharacterID(), group_name, botgroup_id) || !botgroup_id)
|
||||
if (!database.botdb.LoadBotGroupIDForLoadBotGroup(bot_owner->CharacterID(), group_name, botgroup_id) || !botgroup_id)
|
||||
return;
|
||||
|
||||
std::map<uint32, std::list<uint32>> botgroup_list;
|
||||
if (!botdb.LoadBotGroup(group_name, botgroup_list) || botgroup_list.find(botgroup_id) == botgroup_list.end() || !botgroup_list[botgroup_id].size())
|
||||
if (!database.botdb.LoadBotGroup(group_name, botgroup_list) || botgroup_list.find(botgroup_id) == botgroup_list.end() || !botgroup_list[botgroup_id].size())
|
||||
return;
|
||||
|
||||
std::list<Bot*> selectable_bot_list;
|
||||
@ -3456,7 +3456,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
|
||||
else
|
||||
c->SetBotOptionDeathMarquee(!c->GetBotOptionDeathMarquee());
|
||||
|
||||
botdb.SaveOwnerOptionDeathMarquee(c->CharacterID(), c->GetBotOptionDeathMarquee());
|
||||
database.botdb.SaveOwnerOptionDeathMarquee(c->CharacterID(), c->GetBotOptionDeathMarquee());
|
||||
c->Message(m_action, "Bot 'death marquee' is now %s.", (c->GetBotOptionDeathMarquee() == true ? "enabled" : "disabled"));
|
||||
}
|
||||
else if (!owner_option.compare("statsupdate")) {
|
||||
@ -3467,7 +3467,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
|
||||
else
|
||||
c->SetBotOptionStatsUpdate(!c->GetBotOptionStatsUpdate());
|
||||
|
||||
botdb.SaveOwnerOptionStatsUpdate(c->CharacterID(), c->GetBotOptionStatsUpdate());
|
||||
database.botdb.SaveOwnerOptionStatsUpdate(c->CharacterID(), c->GetBotOptionStatsUpdate());
|
||||
c->Message(m_action, "Bot 'stats update' is now %s.", (c->GetBotOptionStatsUpdate() == true ? "enabled" : "disabled"));
|
||||
}
|
||||
else {
|
||||
@ -4240,7 +4240,7 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
|
||||
std::string error_message;
|
||||
|
||||
bool available_flag = false;
|
||||
if (!botdb.QueryNameAvailablity(bot_name, available_flag)) {
|
||||
if (!database.botdb.QueryNameAvailablity(bot_name, available_flag)) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::QueryNameAvailablity());
|
||||
return;
|
||||
}
|
||||
@ -4252,7 +4252,7 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
|
||||
uint32 max_bot_count = RuleI(Bots, CreationLimit);
|
||||
|
||||
uint32 bot_count = 0;
|
||||
if (!botdb.QueryBotCount(c->CharacterID(), bot_count)) {
|
||||
if (!database.botdb.QueryBotCount(c->CharacterID(), bot_count)) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::QueryBotCount());
|
||||
return;
|
||||
}
|
||||
@ -4262,18 +4262,18 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint32 clone_id = 0;
|
||||
if (!botdb.CreateCloneBot(c->CharacterID(), my_bot->GetBotID(), bot_name, clone_id) || !clone_id) {
|
||||
if (!database.botdb.CreateCloneBot(c->CharacterID(), my_bot->GetBotID(), bot_name, clone_id) || !clone_id) {
|
||||
c->Message(m_fail, "%s '%s'", BotDatabase::fail::CreateCloneBot(), bot_name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
int clone_stance = EQEmu::constants::stancePassive;
|
||||
if (!botdb.LoadStance(my_bot->GetBotID(), clone_stance))
|
||||
if (!database.botdb.LoadStance(my_bot->GetBotID(), clone_stance))
|
||||
c->Message(m_fail, "%s for bot '%s'", BotDatabase::fail::LoadStance(), my_bot->GetCleanName());
|
||||
if (!botdb.SaveStance(clone_id, clone_stance))
|
||||
if (!database.botdb.SaveStance(clone_id, clone_stance))
|
||||
c->Message(m_fail, "%s for clone '%s'", BotDatabase::fail::SaveStance(), bot_name.c_str());
|
||||
|
||||
if (!botdb.CreateCloneBotInventory(c->CharacterID(), my_bot->GetBotID(), clone_id))
|
||||
if (!database.botdb.CreateCloneBotInventory(c->CharacterID(), my_bot->GetBotID(), clone_id))
|
||||
c->Message(m_fail, "%s for clone '%s'", BotDatabase::fail::CreateCloneBotInventory(), bot_name.c_str());
|
||||
|
||||
c->Message(m_action, "Bot '%s' was successfully cloned to bot '%s'", my_bot->GetCleanName(), bot_name.c_str());
|
||||
@ -4521,11 +4521,11 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
|
||||
|
||||
if (ab_type == ActionableBots::ABT_All) {
|
||||
if (dye_all) {
|
||||
if (!botdb.SaveAllArmorColors(c->CharacterID(), rgb_value))
|
||||
if (!database.botdb.SaveAllArmorColors(c->CharacterID(), rgb_value))
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllArmorColors());
|
||||
}
|
||||
else {
|
||||
if (!botdb.SaveAllArmorColorBySlot(c->CharacterID(), slot_id, rgb_value))
|
||||
if (!database.botdb.SaveAllArmorColorBySlot(c->CharacterID(), slot_id, rgb_value))
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllArmorColorBySlot());
|
||||
}
|
||||
}
|
||||
@ -4674,7 +4674,7 @@ void bot_subcommand_bot_follow_distance(Client *c, const Seperator *sep)
|
||||
continue;
|
||||
|
||||
bot_iter->SetFollowDistance(bfd);
|
||||
if (ab_type != ActionableBots::ABT_All && !botdb.SaveFollowDistance(c->CharacterID(), bot_iter->GetBotID(), bfd)) {
|
||||
if (ab_type != ActionableBots::ABT_All && !database.botdb.SaveFollowDistance(c->CharacterID(), bot_iter->GetBotID(), bfd)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::SaveFollowDistance(), bot_iter->GetCleanName());
|
||||
return;
|
||||
}
|
||||
@ -4683,7 +4683,7 @@ void bot_subcommand_bot_follow_distance(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (ab_type == ActionableBots::ABT_All) {
|
||||
if (!botdb.SaveAllFollowDistances(c->CharacterID(), bfd)) {
|
||||
if (!database.botdb.SaveAllFollowDistances(c->CharacterID(), bfd)) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllFollowDistances());
|
||||
return;
|
||||
}
|
||||
@ -4852,7 +4852,7 @@ void bot_subcommand_bot_inspect_message(Client *c, const Seperator *sep)
|
||||
if (set_flag)
|
||||
memcpy(bot_message_struct, client_message_struct, sizeof(InspectMessage_Struct));
|
||||
|
||||
if (ab_type != ActionableBots::ABT_All && !botdb.SaveInspectMessage(bot_iter->GetBotID(), *bot_message_struct)) {
|
||||
if (ab_type != ActionableBots::ABT_All && !database.botdb.SaveInspectMessage(bot_iter->GetBotID(), *bot_message_struct)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::SaveInspectMessage(), bot_iter->GetCleanName());
|
||||
return;
|
||||
}
|
||||
@ -4866,7 +4866,7 @@ void bot_subcommand_bot_inspect_message(Client *c, const Seperator *sep)
|
||||
if (set_flag)
|
||||
memcpy(&bot_message_struct, client_message_struct, sizeof(InspectMessage_Struct));
|
||||
|
||||
if (!botdb.SaveAllInspectMessages(c->CharacterID(), bot_message_struct)) {
|
||||
if (!database.botdb.SaveAllInspectMessages(c->CharacterID(), bot_message_struct)) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllInspectMessages());
|
||||
return;
|
||||
}
|
||||
@ -4922,7 +4922,7 @@ void bot_subcommand_bot_list(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
std::list<BotsAvailableList> bots_list;
|
||||
if (!botdb.LoadBotsList(c->CharacterID(), bots_list)) {
|
||||
if (!database.botdb.LoadBotsList(c->CharacterID(), bots_list)) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::LoadBotsList());
|
||||
return;
|
||||
}
|
||||
@ -5079,7 +5079,7 @@ void bot_subcommand_bot_spawn(Client *c, const Seperator *sep)
|
||||
|
||||
if (RuleB(Bots, QuestableSpawnLimit) && !c->GetGM()) {
|
||||
int allowed_bot_count = 0;
|
||||
if (!botdb.LoadQuestableSpawnCount(c->CharacterID(), allowed_bot_count)) {
|
||||
if (!database.botdb.LoadQuestableSpawnCount(c->CharacterID(), allowed_bot_count)) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::LoadQuestableSpawnCount());
|
||||
return;
|
||||
}
|
||||
@ -5100,7 +5100,7 @@ void bot_subcommand_bot_spawn(Client *c, const Seperator *sep)
|
||||
std::string bot_name = sep->arg[1];
|
||||
|
||||
uint32 bot_id = 0;
|
||||
if (!botdb.LoadBotID(c->CharacterID(), bot_name, bot_id)) {
|
||||
if (!database.botdb.LoadBotID(c->CharacterID(), bot_name, bot_id)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotID(), bot_name.c_str());
|
||||
return;
|
||||
}
|
||||
@ -5273,7 +5273,7 @@ void bot_subcommand_bot_stop_melee_level(Client *c, const Seperator *sep)
|
||||
// [reset] falls through with initialization value
|
||||
|
||||
my_bot->SetStopMeleeLevel(sml);
|
||||
if (!botdb.SaveStopMeleeLevel(c->CharacterID(), my_bot->GetBotID(), sml))
|
||||
if (!database.botdb.SaveStopMeleeLevel(c->CharacterID(), my_bot->GetBotID(), sml))
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::SaveStopMeleeLevel(), my_bot->GetCleanName());
|
||||
|
||||
c->Message(m_action, "Successfully set stop melee level for %s to %u", my_bot->GetCleanName(), sml);
|
||||
@ -5442,7 +5442,7 @@ void bot_subcommand_bot_toggle_helm(Client *c, const Seperator *sep)
|
||||
bot_iter->SetShowHelm(helm_state);
|
||||
|
||||
if (ab_type != ActionableBots::ABT_All) {
|
||||
if (!botdb.SaveHelmAppearance(c->CharacterID(), bot_iter->GetBotID(), bot_iter->GetShowHelm())) {
|
||||
if (!database.botdb.SaveHelmAppearance(c->CharacterID(), bot_iter->GetBotID(), bot_iter->GetShowHelm())) {
|
||||
c->Message(m_unknown, "%s for '%s'", bot_iter->GetCleanName());
|
||||
return;
|
||||
}
|
||||
@ -5464,11 +5464,11 @@ void bot_subcommand_bot_toggle_helm(Client *c, const Seperator *sep)
|
||||
if (ab_type == ActionableBots::ABT_All) {
|
||||
std::string query;
|
||||
if (toggle_helm) {
|
||||
if (!botdb.ToggleAllHelmAppearances(c->CharacterID()))
|
||||
if (!database.botdb.ToggleAllHelmAppearances(c->CharacterID()))
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::ToggleAllHelmAppearances());
|
||||
}
|
||||
else {
|
||||
if (!botdb.SaveAllHelmAppearances(c->CharacterID(), helm_state))
|
||||
if (!database.botdb.SaveAllHelmAppearances(c->CharacterID(), helm_state))
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllHelmAppearances());
|
||||
}
|
||||
|
||||
@ -5627,7 +5627,7 @@ void bot_subcommand_botgroup_add_member(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint32 botgroup_id = 0;
|
||||
if (!botdb.LoadBotGroupIDByMemberID(new_member->GetBotID(), botgroup_id)) {
|
||||
if (!database.botdb.LoadBotGroupIDByMemberID(new_member->GetBotID(), botgroup_id)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDByMemberID(), new_member->GetCleanName());
|
||||
return;
|
||||
}
|
||||
@ -5657,7 +5657,7 @@ void bot_subcommand_botgroup_add_member(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
botgroup_id = 0;
|
||||
if (!botdb.LoadBotGroupIDByLeaderID(botgroup_leader->GetBotID(), botgroup_id)) {
|
||||
if (!database.botdb.LoadBotGroupIDByLeaderID(botgroup_leader->GetBotID(), botgroup_id)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDByLeaderID(), botgroup_leader->GetCleanName());
|
||||
return;
|
||||
}
|
||||
@ -5673,14 +5673,14 @@ void bot_subcommand_botgroup_add_member(Client *c, const Seperator *sep)
|
||||
|
||||
database.SetGroupID(new_member->GetName(), group_inst->GetID(), new_member->GetBotID());
|
||||
|
||||
if (!botdb.AddMemberToBotGroup(botgroup_leader->GetBotID(), new_member->GetBotID())) {
|
||||
if (!database.botdb.AddMemberToBotGroup(botgroup_leader->GetBotID(), new_member->GetBotID())) {
|
||||
c->Message(m_fail, "%s - %s->%s", BotDatabase::fail::AddMemberToBotGroup(), new_member->GetCleanName(), botgroup_leader->GetCleanName());
|
||||
Bot::RemoveBotFromGroup(new_member, botgroup_leader->GetGroup());
|
||||
return;
|
||||
}
|
||||
|
||||
std::string botgroup_name;
|
||||
if (!botdb.LoadBotGroupNameByLeaderID(botgroup_leader->GetBotID(), botgroup_name))
|
||||
if (!database.botdb.LoadBotGroupNameByLeaderID(botgroup_leader->GetBotID(), botgroup_name))
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::LoadBotGroupNameByLeaderID());
|
||||
|
||||
c->Message(m_action, "Successfully added %s to bot-group %s", new_member->GetCleanName(), botgroup_name.c_str());
|
||||
@ -5702,7 +5702,7 @@ void bot_subcommand_botgroup_create(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
bool extant_flag = false;
|
||||
if (!botdb.QueryBotGroupExistence(botgroup_name_arg, extant_flag)) {
|
||||
if (!database.botdb.QueryBotGroupExistence(botgroup_name_arg, extant_flag)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::QueryBotGroupExistence(), botgroup_name_arg.c_str());
|
||||
return;
|
||||
}
|
||||
@ -5732,7 +5732,7 @@ void bot_subcommand_botgroup_create(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint32 botgroup_id = 0;
|
||||
if (!botdb.LoadBotGroupIDByLeaderID(botgroup_leader->GetBotID(), botgroup_id)) {
|
||||
if (!database.botdb.LoadBotGroupIDByLeaderID(botgroup_leader->GetBotID(), botgroup_id)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDByLeaderID(), botgroup_leader->GetCleanName());
|
||||
return;
|
||||
}
|
||||
@ -5742,7 +5742,7 @@ void bot_subcommand_botgroup_create(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
botgroup_id = 0;
|
||||
if (!botdb.LoadBotGroupIDByMemberID(botgroup_leader->GetBotID(), botgroup_id)) {
|
||||
if (!database.botdb.LoadBotGroupIDByMemberID(botgroup_leader->GetBotID(), botgroup_id)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDByMemberID(), botgroup_leader->GetCleanName());
|
||||
return;
|
||||
}
|
||||
@ -5757,7 +5757,7 @@ void bot_subcommand_botgroup_create(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!botdb.CreateBotGroup(botgroup_name_arg, botgroup_leader->GetBotID())) {
|
||||
if (!database.botdb.CreateBotGroup(botgroup_name_arg, botgroup_leader->GetBotID())) {
|
||||
c->Message(m_fail, "%s '%s'", BotDatabase::fail::CreateBotGroup(), botgroup_name_arg.c_str());
|
||||
safe_delete(group_inst);
|
||||
return;
|
||||
@ -5787,7 +5787,7 @@ void bot_subcommand_botgroup_delete(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint32 botgroup_id = 0;
|
||||
if (!botdb.LoadBotGroupIDForLoadBotGroup(c->CharacterID(), botgroup_name_arg, botgroup_id)) {
|
||||
if (!database.botdb.LoadBotGroupIDForLoadBotGroup(c->CharacterID(), botgroup_name_arg, botgroup_id)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDForLoadBotGroup(), botgroup_name_arg.c_str());
|
||||
return;
|
||||
}
|
||||
@ -5797,7 +5797,7 @@ void bot_subcommand_botgroup_delete(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint32 leader_id = 0;
|
||||
if (!botdb.LoadLeaderIDByBotGroupID(botgroup_id, leader_id)) {
|
||||
if (!database.botdb.LoadLeaderIDByBotGroupID(botgroup_id, leader_id)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadLeaderIDByBotGroupID(), botgroup_name_arg.c_str());
|
||||
return;
|
||||
}
|
||||
@ -5811,7 +5811,7 @@ void bot_subcommand_botgroup_delete(Client *c, const Seperator *sep)
|
||||
MyBots::PopulateSBL_BySpawnedBots(c, sbl);
|
||||
|
||||
std::map<uint32, std::list<uint32>> member_list;
|
||||
if (!botdb.LoadBotGroup(botgroup_name_arg, member_list)) {
|
||||
if (!database.botdb.LoadBotGroup(botgroup_name_arg, member_list)) {
|
||||
c->Message(m_fail, "%s '%s'", BotDatabase::fail::LoadBotGroup(), botgroup_name_arg.c_str());
|
||||
return;
|
||||
}
|
||||
@ -5835,7 +5835,7 @@ void bot_subcommand_botgroup_delete(Client *c, const Seperator *sep)
|
||||
Bot::RemoveBotFromGroup(group_member, group_member->GetGroup());
|
||||
}
|
||||
|
||||
if (!botdb.DeleteBotGroup(leader_id)) {
|
||||
if (!database.botdb.DeleteBotGroup(leader_id)) {
|
||||
c->Message(m_fail, "%s '%s'", BotDatabase::fail::DeleteBotGroup(), botgroup_name_arg.c_str());
|
||||
return;
|
||||
}
|
||||
@ -5853,7 +5853,7 @@ void bot_subcommand_botgroup_list(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
std::list<std::pair<std::string, std::string>> botgroups_list;
|
||||
if (!botdb.LoadBotGroupsListByOwnerID(c->CharacterID(), botgroups_list)) {
|
||||
if (!database.botdb.LoadBotGroupsListByOwnerID(c->CharacterID(), botgroups_list)) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::LoadBotGroupsListByOwnerID());
|
||||
return;
|
||||
}
|
||||
@ -5885,7 +5885,7 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
bool extant_flag = false;
|
||||
if (!botdb.QueryBotGroupExistence(botgroup_name_arg, extant_flag)) {
|
||||
if (!database.botdb.QueryBotGroupExistence(botgroup_name_arg, extant_flag)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::QueryBotGroupExistence(), botgroup_name_arg.c_str());
|
||||
return;
|
||||
}
|
||||
@ -5915,13 +5915,13 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint32 botgroup_id = 0;
|
||||
if (!botdb.LoadBotGroupIDForLoadBotGroup(c->CharacterID(), botgroup_name_arg, botgroup_id) || !botgroup_id) {
|
||||
if (!database.botdb.LoadBotGroupIDForLoadBotGroup(c->CharacterID(), botgroup_name_arg, botgroup_id) || !botgroup_id) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDForLoadBotGroup(), botgroup_name_arg.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<uint32, std::list<uint32>> member_list;
|
||||
if (!botdb.LoadBotGroup(botgroup_name_arg, member_list)) {
|
||||
if (!database.botdb.LoadBotGroup(botgroup_name_arg, member_list)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroup(), botgroup_name_arg.c_str());
|
||||
return;
|
||||
}
|
||||
@ -5934,7 +5934,7 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
|
||||
|
||||
if (RuleB(Bots, QuestableSpawnLimit)) {
|
||||
int allowed_bot_count = 0;
|
||||
if (!botdb.LoadQuestableSpawnCount(c->CharacterID(), allowed_bot_count)) {
|
||||
if (!database.botdb.LoadQuestableSpawnCount(c->CharacterID(), allowed_bot_count)) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::LoadQuestableSpawnCount());
|
||||
return;
|
||||
}
|
||||
@ -5957,7 +5957,7 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint32 leader_id = 0;
|
||||
if (!botdb.LoadLeaderIDByBotGroupName(botgroup_name_arg, leader_id)) {
|
||||
if (!database.botdb.LoadLeaderIDByBotGroupName(botgroup_name_arg, leader_id)) {
|
||||
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadLeaderIDByBotGroupName(), botgroup_name_arg.c_str());
|
||||
return;
|
||||
}
|
||||
@ -6042,7 +6042,7 @@ void bot_subcommand_botgroup_remove_member(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!botdb.RemoveMemberFromBotGroup(group_member->GetBotID())) {
|
||||
if (!database.botdb.RemoveMemberFromBotGroup(group_member->GetBotID())) {
|
||||
c->Message(m_fail, "%s - '%s'", BotDatabase::fail::RemoveMemberFromBotGroup(), group_member->GetCleanName());
|
||||
return;
|
||||
}
|
||||
@ -6664,7 +6664,7 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
|
||||
bool member_fail = false;
|
||||
bool target_fail = false;
|
||||
|
||||
if (!botdb.LoadHealRotation(creator_member, member_list, target_list, load_flag, member_fail, target_fail))
|
||||
if (!database.botdb.LoadHealRotation(creator_member, member_list, target_list, load_flag, member_fail, target_fail))
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::LoadHealRotation());
|
||||
|
||||
if (!load_flag) {
|
||||
@ -6737,7 +6737,7 @@ void bot_subcommand_heal_rotation_delete(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (all_flag) {
|
||||
if (botdb.DeleteAllHealRotations(c->CharacterID()))
|
||||
if (database.botdb.DeleteAllHealRotations(c->CharacterID()))
|
||||
c->Message(m_action, "Succeeded in deleting all heal rotations");
|
||||
else
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::DeleteAllHealRotations());
|
||||
@ -6760,7 +6760,7 @@ void bot_subcommand_heal_rotation_delete(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!botdb.DeleteHealRotation(current_member->GetBotID())) {
|
||||
if (!database.botdb.DeleteHealRotation(current_member->GetBotID())) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::DeleteHealRotation());
|
||||
return;
|
||||
}
|
||||
@ -7047,7 +7047,7 @@ void bot_subcommand_heal_rotation_save(Client *c, const Seperator *sep)
|
||||
|
||||
bool member_fail = false;
|
||||
bool target_fail = false;
|
||||
if (!botdb.SaveHealRotation(current_member, member_fail, target_fail)) {
|
||||
if (!database.botdb.SaveHealRotation(current_member, member_fail, target_fail)) {
|
||||
c->Message(m_fail, "%s", BotDatabase::fail::SaveHealRotation());
|
||||
return;
|
||||
}
|
||||
@ -7264,7 +7264,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint32 database_count = 0;
|
||||
if (!botdb.QueryInventoryCount(my_bot->GetBotID(), database_count))
|
||||
if (!database.botdb.QueryInventoryCount(my_bot->GetBotID(), database_count))
|
||||
c->Message(m_unknown, "%s", BotDatabase::fail::QueryInventoryCount());
|
||||
|
||||
if (inventory_count != database_count)
|
||||
@ -7684,7 +7684,7 @@ uint32 helper_bot_create(Client *bot_owner, std::string bot_name, uint8 bot_clas
|
||||
}
|
||||
|
||||
bool available_flag = false;
|
||||
if (!botdb.QueryNameAvailablity(bot_name, available_flag)) {
|
||||
if (!database.botdb.QueryNameAvailablity(bot_name, available_flag)) {
|
||||
bot_owner->Message(m_fail, "%s for '%s'", BotDatabase::fail::QueryNameAvailablity(), bot_name.c_str());
|
||||
return bot_id;
|
||||
}
|
||||
@ -7726,7 +7726,7 @@ uint32 helper_bot_create(Client *bot_owner, std::string bot_name, uint8 bot_clas
|
||||
uint32 max_bot_count = RuleI(Bots, CreationLimit);
|
||||
|
||||
uint32 bot_count = 0;
|
||||
if (!botdb.QueryBotCount(bot_owner->CharacterID(), bot_count)) {
|
||||
if (!database.botdb.QueryBotCount(bot_owner->CharacterID(), bot_count)) {
|
||||
bot_owner->Message(m_fail, "%s", BotDatabase::fail::QueryBotCount());
|
||||
return bot_id;
|
||||
}
|
||||
|
||||
@ -23,48 +23,17 @@
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
#include "bot_database.h"
|
||||
#include "zonedb.h"
|
||||
#include "bot.h"
|
||||
#include "client.h"
|
||||
|
||||
|
||||
BotDatabase botdb;
|
||||
|
||||
|
||||
BotDatabase::BotDatabase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BotDatabase::BotDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port)
|
||||
{
|
||||
Connect(host, user, passwd, database, port);
|
||||
}
|
||||
|
||||
BotDatabase::~BotDatabase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool BotDatabase::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port) {
|
||||
uint32 errnum = 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
|
||||
Log(Logs::General, Logs::Error, "Failed to connect to bot database: Error: %s", errbuf);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Status, "Using bot database '%s' at %s:%d", database, host, port);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool BotDatabase::LoadBotCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &bot_command_settings)
|
||||
{
|
||||
bot_command_settings.clear();
|
||||
|
||||
query = "SELECT `bot_command`, `access`, `aliases` FROM `bot_command_settings`";
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -109,7 +78,7 @@ bool BotDatabase::LoadBotSpellCastingChances()
|
||||
"FROM"
|
||||
" `bot_spell_casting_chances`";
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success() || !results.RowCount())
|
||||
return false;
|
||||
|
||||
@ -147,7 +116,7 @@ bool BotDatabase::QueryNameAvailablity(const std::string& bot_name, bool& availa
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `id` FROM `vw_bot_character_mobs` WHERE `name` LIKE '%s' LIMIT 1", bot_name.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (results.RowCount())
|
||||
@ -164,7 +133,7 @@ bool BotDatabase::QueryBotCount(const uint32 owner_id, uint32& bot_count)
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT COUNT(`bot_id`) FROM `bot_data` WHERE `owner_id` = '%i'", owner_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -200,7 +169,7 @@ bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableLis
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `bot_id`, `name`, `class`, `level`, `race`, `gender` FROM `bot_data` WHERE `owner_id` = '%u'", owner_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -235,7 +204,7 @@ bool BotDatabase::LoadOwnerID(const std::string& bot_name, uint32& owner_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `owner_id` FROM `bot_data` WHERE `name` = '%s' LIMIT 1", bot_name.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -253,7 +222,7 @@ bool BotDatabase::LoadOwnerID(const uint32 bot_id, uint32& owner_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `owner_id` FROM `bot_data` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -274,7 +243,7 @@ bool BotDatabase::LoadBotID(const uint32 owner_id, const std::string& bot_name,
|
||||
"SELECT `bot_id` FROM `bot_data` WHERE `owner_id` = '%u' AND `name` = '%s' LIMIT 1",
|
||||
owner_id, bot_name.c_str()
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -345,7 +314,7 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
|
||||
bot_id
|
||||
);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -546,7 +515,7 @@ bool BotDatabase::SaveNewBot(Bot* bot_inst, uint32& bot_id)
|
||||
BOT_FOLLOW_DISTANCE_DEFAULT,
|
||||
(IsCasterClass(bot_inst->GetClass()) ? (uint8)RuleI(Bots, CasterStopMeleeLevel) : 255)
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -649,7 +618,7 @@ bool BotDatabase::SaveBot(Bot* bot_inst)
|
||||
bot_inst->GetStopMeleeLevel(),
|
||||
bot_inst->GetBotID()
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -662,7 +631,7 @@ bool BotDatabase::DeleteBot(const uint32 bot_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_data` WHERE `bot_id` = '%u'", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -698,7 +667,7 @@ bool BotDatabase::LoadBuffs(Bot* bot_inst)
|
||||
" WHERE `bot_id` = '%u'",
|
||||
bot_inst->GetBotID()
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -817,7 +786,7 @@ bool BotDatabase::SaveBuffs(Bot* bot_inst)
|
||||
bot_buffs[buff_index].caston_z,
|
||||
bot_buffs[buff_index].ExtraDIChance
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteBuffs(bot_inst->GetBotID());
|
||||
return false;
|
||||
@ -833,7 +802,7 @@ bool BotDatabase::DeleteBuffs(const uint32 bot_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_buffs` WHERE `bot_id` = '%u'", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -846,7 +815,7 @@ bool BotDatabase::LoadStance(const uint32 bot_id, int& bot_stance)
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `stance_id` FROM `bot_stances` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -866,7 +835,7 @@ bool BotDatabase::LoadStance(Bot* bot_inst, bool& stance_flag)
|
||||
bot_inst->SetDefaultBotStance();
|
||||
|
||||
query = StringFormat("SELECT `stance_id` FROM `bot_stances` WHERE `bot_id` = '%u' LIMIT 1", bot_inst->GetBotID());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -888,7 +857,7 @@ bool BotDatabase::SaveStance(const uint32 bot_id, const int bot_stance)
|
||||
return false;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_stances` (`bot_id`, `stance_id`) VALUES ('%u', '%u')", bot_id, bot_stance);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteStance(bot_id);
|
||||
return false;
|
||||
@ -906,7 +875,7 @@ bool BotDatabase::SaveStance(Bot* bot_inst)
|
||||
return false;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_stances` (`bot_id`, `stance_id`) VALUES ('%u', '%u')", bot_inst->GetBotID(), bot_inst->GetBotStance());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteStance(bot_inst->GetBotID());
|
||||
return false;
|
||||
@ -921,7 +890,7 @@ bool BotDatabase::DeleteStance(const uint32 bot_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_stances` WHERE `bot_id` = '%u'", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -952,7 +921,7 @@ bool BotDatabase::LoadTimers(Bot* bot_inst)
|
||||
bot_inst->GetClass(),
|
||||
bot_inst->GetLevel()
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -994,7 +963,7 @@ bool BotDatabase::SaveTimers(Bot* bot_inst)
|
||||
continue;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_timers` (`bot_id`, `timer_id`, `timer_value`) VALUES ('%u', '%u', '%u')", bot_inst->GetBotID(), (timer_index + 1), bot_timers[timer_index]);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteTimers(bot_inst->GetBotID());
|
||||
return false;
|
||||
@ -1010,7 +979,7 @@ bool BotDatabase::DeleteTimers(const uint32 bot_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_timers` WHERE `bot_id` = '%u'", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1035,7 +1004,7 @@ bool BotDatabase::LoadGuildMembership(const uint32 bot_id, uint32& guild_id, uin
|
||||
" LIMIT 1",
|
||||
bot_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1058,7 +1027,7 @@ bool BotDatabase::SaveGuildMembership(const uint32 bot_id, const uint32 guild_id
|
||||
return false;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_guild_members` SET `bot_id` = '%u', `guild_id` = '%u', `rank` = '%u'", bot_id, guild_id, guild_rank);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteGuildMembership(bot_id);
|
||||
return false;
|
||||
@ -1073,7 +1042,7 @@ bool BotDatabase::DeleteGuildMembership(const uint32 bot_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_guild_members` WHERE `bot_id` = '%u'", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1088,7 +1057,7 @@ bool BotDatabase::QueryInventoryCount(const uint32 bot_id, uint32& item_count)
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT COUNT(`inventories_index`) FROM `bot_inventories` WHERE `bot_id` = '%u'", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1127,7 +1096,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& invent
|
||||
" ORDER BY `slot_id`",
|
||||
bot_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1224,7 +1193,7 @@ bool BotDatabase::DeleteItems(const uint32 bot_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_inventories` WHERE `bot_id` = '%u'", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1242,7 +1211,7 @@ bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `item_id` FROM `bot_inventories` WHERE `bot_id` = '%i' AND `slot_id` = '%i' LIMIT 1", bot_id, slot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1329,7 +1298,7 @@ bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEm
|
||||
(unsigned long)augment_id[4],
|
||||
(unsigned long)augment_id[5]
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteItemBySlot(bot_inst->GetBotID(), slot_id);
|
||||
return false;
|
||||
@ -1344,7 +1313,7 @@ bool BotDatabase::DeleteItemBySlot(const uint32 bot_id, const uint32 slot_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_inventories` WHERE `bot_id` = '%u' AND `slot_id` = '%u'", bot_id, slot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1361,7 +1330,7 @@ bool BotDatabase::LoadEquipmentColor(const uint32 bot_id, const uint8 material_s
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `inst_color` FROM `bot_inventories` WHERE `bot_id` = '%u' AND `slot_id` = '%u' LIMIT 1", bot_id, slot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1397,7 +1366,7 @@ bool BotDatabase::SaveEquipmentColor(const uint32 bot_id, const int16 slot_id, c
|
||||
bot_id,
|
||||
where_clause.c_str()
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1412,7 +1381,7 @@ bool BotDatabase::LoadPetIndex(const uint32 bot_id, uint32& pet_index)
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `pets_index` FROM `bot_pets` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1430,7 +1399,7 @@ bool BotDatabase::LoadPetSpellID(const uint32 bot_id, uint32& pet_spell_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `spell_id` FROM `bot_pets` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1454,7 +1423,7 @@ bool BotDatabase::LoadPetStats(const uint32 bot_id, std::string& pet_name, uint3
|
||||
return true;
|
||||
|
||||
query = StringFormat("SELECT `spell_id`, `name`, `mana`, `hp` FROM `bot_pets` WHERE `pets_index` = '%u' LIMIT 1", saved_pet_index);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1502,7 +1471,7 @@ bool BotDatabase::SavePetStats(const uint32 bot_id, const std::string& pet_name,
|
||||
pet_mana,
|
||||
pet_hp
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeletePetStats(bot_id);
|
||||
return false;
|
||||
@ -1523,7 +1492,7 @@ bool BotDatabase::DeletePetStats(const uint32 bot_id)
|
||||
return true;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_pets` WHERE `pets_index` = '%u'", saved_pet_index);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1542,7 +1511,7 @@ bool BotDatabase::LoadPetBuffs(const uint32 bot_id, SpellBuff_Struct* pet_buffs)
|
||||
return true;
|
||||
|
||||
query = StringFormat("SELECT `spell_id`, `caster_level`, `duration` FROM `bot_pet_buffs` WHERE `pets_index` = '%u'", saved_pet_index);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1608,7 +1577,7 @@ bool BotDatabase::SavePetBuffs(const uint32 bot_id, const SpellBuff_Struct* pet_
|
||||
pet_buffs[buff_index].level,
|
||||
pet_buffs[buff_index].duration
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeletePetBuffs(bot_id);
|
||||
return false;
|
||||
@ -1630,7 +1599,7 @@ bool BotDatabase::DeletePetBuffs(const uint32 bot_id)
|
||||
return true;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_pet_buffs` WHERE `pets_index` = '%u'", saved_pet_index);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1649,7 +1618,7 @@ bool BotDatabase::LoadPetItems(const uint32 bot_id, uint32* pet_items)
|
||||
return true;
|
||||
|
||||
query = StringFormat("SELECT `item_id` FROM `bot_pet_inventories` WHERE `pets_index` = '%u'", saved_pet_index);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1685,7 +1654,7 @@ bool BotDatabase::SavePetItems(const uint32 bot_id, const uint32* pet_items, boo
|
||||
continue;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_pet_inventories` (`pets_index`, `item_id`) VALUES ('%u', '%u')", saved_pet_index, pet_items[item_index]);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeletePetItems(bot_id);
|
||||
return false;
|
||||
@ -1707,7 +1676,7 @@ bool BotDatabase::DeletePetItems(const uint32 bot_id)
|
||||
return true;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_pet_inventories` WHERE `pets_index` = '%u'", saved_pet_index);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1722,7 +1691,7 @@ bool BotDatabase::LoadInspectMessage(const uint32 bot_id, InspectMessage_Struct&
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `inspect_message` FROM `bot_inspect_messages` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -1755,7 +1724,7 @@ bool BotDatabase::SaveInspectMessage(const uint32 bot_id, const InspectMessage_S
|
||||
return true;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_inspect_messages` (`bot_id`, `inspect_message`) VALUES ('%u', '%s')", bot_id, bot_message.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteInspectMessage(bot_id);
|
||||
return false;
|
||||
@ -1770,7 +1739,7 @@ bool BotDatabase::DeleteInspectMessage(const uint32 bot_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_inspect_messages` WHERE `bot_id` = '%u'", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1792,7 +1761,7 @@ bool BotDatabase::SaveAllInspectMessages(const uint32 owner_id, const InspectMes
|
||||
return true;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_inspect_messages` (`bot_id`, `inspect_message`) SELECT `bot_id`, '%s' inspect_message FROM `bot_data` WHERE `owner_id` = '%u'", bot_message.c_str(), owner_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteAllInspectMessages(owner_id);
|
||||
return false;
|
||||
@ -1807,7 +1776,7 @@ bool BotDatabase::DeleteAllInspectMessages(const uint32 owner_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_inspect_messages` WHERE `bot_id` IN (SELECT `bot_id` FROM `bot_data` WHERE `owner_id` = '%u')", owner_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1832,7 +1801,7 @@ bool BotDatabase::SaveAllArmorColorBySlot(const uint32 owner_id, const int16 slo
|
||||
EQEmu::invslot::slotHead, EQEmu::invslot::slotChest, EQEmu::invslot::slotArms, EQEmu::invslot::slotWrist1, EQEmu::invslot::slotWrist2, EQEmu::invslot::slotHands, EQEmu::invslot::slotLegs, EQEmu::invslot::slotFeet,
|
||||
slot_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1855,7 +1824,7 @@ bool BotDatabase::SaveAllArmorColors(const uint32 owner_id, const uint32 rgb_val
|
||||
rgb_value,
|
||||
EQEmu::invslot::slotHead, EQEmu::invslot::slotChest, EQEmu::invslot::slotArms, EQEmu::invslot::slotWrist1, EQEmu::invslot::slotWrist2, EQEmu::invslot::slotHands, EQEmu::invslot::slotLegs, EQEmu::invslot::slotFeet
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1876,7 +1845,7 @@ bool BotDatabase::SaveHelmAppearance(const uint32 owner_id, const uint32 bot_id,
|
||||
owner_id,
|
||||
bot_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1895,7 +1864,7 @@ bool BotDatabase::SaveAllHelmAppearances(const uint32 owner_id, const bool show_
|
||||
(show_flag ? 1 : 0),
|
||||
owner_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1915,7 +1884,7 @@ bool BotDatabase::ToggleHelmAppearance(const uint32 owner_id, const uint32 bot_i
|
||||
owner_id,
|
||||
bot_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1933,7 +1902,7 @@ bool BotDatabase::ToggleAllHelmAppearances(const uint32 owner_id)
|
||||
" WHERE `owner_id` = '%u'",
|
||||
owner_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1954,7 +1923,7 @@ bool BotDatabase::SaveFollowDistance(const uint32 owner_id, const uint32 bot_id,
|
||||
owner_id,
|
||||
bot_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -1973,7 +1942,7 @@ bool BotDatabase::SaveAllFollowDistances(const uint32 owner_id, const uint32 fol
|
||||
follow_distance,
|
||||
owner_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -2091,7 +2060,7 @@ bool BotDatabase::CreateCloneBot(const uint32 owner_id, const uint32 bot_id, con
|
||||
owner_id,
|
||||
bot_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -2152,7 +2121,7 @@ bool BotDatabase::CreateCloneBotInventory(const uint32 owner_id, const uint32 bo
|
||||
owner_id,
|
||||
bot_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteItems(clone_id);
|
||||
return false;
|
||||
@ -2175,7 +2144,7 @@ bool BotDatabase::SaveStopMeleeLevel(const uint32 owner_id, const uint32 bot_id,
|
||||
owner_id,
|
||||
bot_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -2192,12 +2161,12 @@ bool BotDatabase::LoadOwnerOptions(Client *owner)
|
||||
" WHERE `owner_id` = '%u'",
|
||||
owner->CharacterID()
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount()) {
|
||||
query = StringFormat("REPLACE INTO `bot_owner_options` (`owner_id`) VALUES ('%u')", owner->CharacterID());
|
||||
results = QueryDatabase(query);
|
||||
results = database.QueryDatabase(query);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -2221,7 +2190,7 @@ bool BotDatabase::SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool
|
||||
(flag == true ? 1 : 0),
|
||||
owner_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -2240,7 +2209,7 @@ bool BotDatabase::SaveOwnerOptionStatsUpdate(const uint32 owner_id, const bool f
|
||||
(flag == true ? 1 : 0),
|
||||
owner_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -2255,7 +2224,7 @@ bool BotDatabase::QueryBotGroupExistence(const std::string& group_name, bool& ex
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `group_name` FROM `vw_bot_groups` WHERE `group_name` LIKE '%s' LIMIT 1", group_name.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2272,7 +2241,7 @@ bool BotDatabase::LoadBotGroupIDByBotGroupName(const std::string& group_name, ui
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `groups_index` FROM `bot_groups` WHERE `group_name` = '%s' LIMIT 1", group_name.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2290,7 +2259,7 @@ bool BotDatabase::LoadBotGroupIDByLeaderID(const uint32 leader_id, uint32& botgr
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `groups_index` FROM `bot_groups` WHERE `group_leader_id` = '%u' LIMIT 1", leader_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2308,7 +2277,7 @@ bool BotDatabase::LoadBotGroupIDByMemberID(const uint32 member_id, uint32& botgr
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `groups_index` FROM `bot_group_members` WHERE `bot_id` = '%u' LIMIT 1", member_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2326,7 +2295,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupName(const std::string& group_name, uint
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `group_leader_id` FROM `bot_groups` WHERE `group_name` = '%s' LIMIT 1", group_name.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2344,7 +2313,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupID(const uint32 group_id, uint32& leader
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `group_leader_id` FROM `bot_groups` WHERE `groups_index` = '%u' LIMIT 1", group_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2362,7 +2331,7 @@ bool BotDatabase::LoadBotGroupNameByBotGroupID(const uint32 group_id, std::strin
|
||||
false;
|
||||
|
||||
query = StringFormat("SELECT `group_name` FROM `bot_groups` WHERE `groups_index` = '%u' LIMIT 1", group_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2380,7 +2349,7 @@ bool BotDatabase::LoadBotGroupNameByLeaderID(const uint32 leader_id, std::string
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `group_name` FROM `bot_groups` WHERE `group_leader_id` = '%u' LIMIT 1", leader_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2404,7 +2373,7 @@ bool BotDatabase::CreateBotGroup(const std::string& group_name, const uint32 lea
|
||||
return true;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_groups` (`group_leader_id`, `group_name`) VALUES ('%u', '%s')", leader_id, group_name.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
DeleteBotGroup(leader_id);
|
||||
return false;
|
||||
@ -2417,7 +2386,7 @@ bool BotDatabase::CreateBotGroup(const std::string& group_name, const uint32 lea
|
||||
}
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_group_members` (`groups_index`, `bot_id`) VALUES ('%u', '%u')", botgroup_id, leader_id);
|
||||
results = QueryDatabase(query);
|
||||
results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
RemoveMemberFromBotGroup(leader_id);
|
||||
return false;
|
||||
@ -2438,12 +2407,12 @@ bool BotDatabase::DeleteBotGroup(const uint32 leader_id)
|
||||
return true;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_group_members` WHERE `groups_index` = '%u'", botgroup_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_groups` WHERE `groups_index` = '%u'", botgroup_id);
|
||||
results = QueryDatabase(query);
|
||||
results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -2462,7 +2431,7 @@ bool BotDatabase::AddMemberToBotGroup(const uint32 leader_id, const uint32 membe
|
||||
return true;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_group_members` (`groups_index`, `bot_id`) VALUES ('%u', '%u')", botgroup_id, member_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
RemoveMemberFromBotGroup(member_id);
|
||||
return false;
|
||||
@ -2483,7 +2452,7 @@ bool BotDatabase::RemoveMemberFromBotGroup(const uint32 member_id)
|
||||
return DeleteBotGroup(member_id);
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_group_members` WHERE `bot_id` = '%u'", member_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -2496,7 +2465,7 @@ bool BotDatabase::LoadBotGroupIDForLoadBotGroup(const uint32 owner_id, const std
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `groups_index`, `group_name` FROM `vw_bot_groups` WHERE `owner_id` = '%u'", owner_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2524,7 +2493,7 @@ bool BotDatabase::LoadBotGroup(const std::string& group_name, std::map<uint32, s
|
||||
return true;
|
||||
|
||||
query = StringFormat("SELECT `bot_id` FROM `bot_group_members` WHERE `groups_index` = '%u' LIMIT 6", botgroup_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2542,7 +2511,7 @@ bool BotDatabase::LoadBotGroupsListByOwnerID(const uint32 owner_id, std::list<st
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `group_name`, `group_leader_name` FROM `vw_bot_groups` WHERE `owner_id` = '%u'", owner_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2575,7 +2544,7 @@ bool BotDatabase::LoadGroupedBotsByGroupID(const uint32 owner_id, const uint32 g
|
||||
owner_id
|
||||
);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2595,7 +2564,7 @@ bool BotDatabase::LoadHealRotationIDByBotID(const uint32 bot_id, uint32& hr_inde
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `heal_rotation_index` FROM `bot_heal_rotations` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2642,7 +2611,7 @@ bool BotDatabase::LoadHealRotation(Bot* hr_member, std::list<uint32>& member_lis
|
||||
" LIMIT 1",
|
||||
hr_index
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2681,7 +2650,7 @@ bool BotDatabase::LoadHealRotationMembers(const uint32 hr_index, std::list<uint3
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `bot_id` FROM `bot_heal_rotation_members` WHERE `heal_rotation_index` = '%u'", hr_index);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2701,7 +2670,7 @@ bool BotDatabase::LoadHealRotationTargets(const uint32 hr_index, std::list<std::
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `target_name` FROM `bot_heal_rotation_targets` WHERE `heal_rotation_index` = '%u'", hr_index);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount())
|
||||
@ -2777,7 +2746,7 @@ bool BotDatabase::SaveHealRotation(Bot* hr_member, bool& member_fail, bool& targ
|
||||
((*hr_member->MemberOfHealRotation())->ArmorTypeCriticalHPRatio(ARMOR_TYPE_CHAIN)),
|
||||
((*hr_member->MemberOfHealRotation())->ArmorTypeCriticalHPRatio(ARMOR_TYPE_PLATE))
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -2792,7 +2761,7 @@ bool BotDatabase::SaveHealRotation(Bot* hr_member, bool& member_fail, bool& targ
|
||||
continue;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_heal_rotation_members` (`heal_rotation_index`, `bot_id`) VALUES ('%u', '%u')", hr_index, member_iter->GetBotID());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
member_fail = true;
|
||||
break;
|
||||
@ -2806,7 +2775,7 @@ bool BotDatabase::SaveHealRotation(Bot* hr_member, bool& member_fail, bool& targ
|
||||
continue;
|
||||
|
||||
query = StringFormat("INSERT INTO `bot_heal_rotation_targets` (`heal_rotation_index`, `target_name`) VALUES ('%u', '%s')", hr_index, target_iter->GetCleanName());
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
target_fail = true;
|
||||
break;
|
||||
@ -2828,17 +2797,17 @@ bool BotDatabase::DeleteHealRotation(const uint32 creator_id)
|
||||
return true;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_heal_rotation_targets` WHERE `heal_rotation_index` = '%u'", hr_index);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_heal_rotation_members` WHERE `heal_rotation_index` = '%u'", hr_index);
|
||||
results = QueryDatabase(query);
|
||||
results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
query = StringFormat("DELETE FROM `bot_heal_rotations` WHERE `heal_rotation_index` = '%u'", hr_index);
|
||||
results = QueryDatabase(query);
|
||||
results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
@ -2851,7 +2820,7 @@ bool BotDatabase::DeleteAllHealRotations(const uint32 owner_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat("SELECT `bot_id` FROM `bot_heal_rotations` WHERE `bot_id` IN (SELECT `bot_id` FROM `bot_data` WHERE `owner_id` = '%u')", owner_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
|
||||
@ -22,17 +22,15 @@
|
||||
|
||||
#ifdef BOTS
|
||||
|
||||
#include "../common/dbcore.h"
|
||||
#include "../common/eq_packet_structs.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class Bot;
|
||||
struct BotsAvailableList;
|
||||
class Client;
|
||||
struct BotsAvailableList;
|
||||
struct InspectMessage_Struct;
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
@ -41,15 +39,9 @@ namespace EQEmu
|
||||
}
|
||||
|
||||
|
||||
class BotDatabase : public DBcore
|
||||
class BotDatabase
|
||||
{
|
||||
public:
|
||||
BotDatabase();
|
||||
BotDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
|
||||
virtual ~BotDatabase();
|
||||
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
|
||||
|
||||
bool LoadBotCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &bot_command_settings);
|
||||
bool LoadBotSpellCastingChances();
|
||||
|
||||
@ -297,8 +289,6 @@ public:
|
||||
std::string query;
|
||||
};
|
||||
|
||||
extern BotDatabase botdb;
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOTS
|
||||
|
||||
@ -2668,7 +2668,7 @@ uint8 Bot::GetChanceToCastBySpellType(uint32 spellType)
|
||||
type_index |= pD;
|
||||
}
|
||||
|
||||
return botdb.GetSpellCastingChance(spell_type_index, class_index, stance_index, type_index);
|
||||
return database.botdb.GetSpellCastingChance(spell_type_index, class_index, stance_index, type_index);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1528,7 +1528,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
botdb.LoadOwnerOptions(this);
|
||||
database.botdb.LoadOwnerOptions(this);
|
||||
// TODO: mod below function for loading spawned botgroups
|
||||
Bot::LoadAndSpawnAllZonedBots(this);
|
||||
#endif
|
||||
|
||||
18
zone/net.cpp
18
zone/net.cpp
@ -52,7 +52,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "command.h"
|
||||
#ifdef BOTS
|
||||
#include "bot_command.h"
|
||||
#include "bot_database.h"
|
||||
#endif
|
||||
#include "zone_config.h"
|
||||
#include "titles.h"
|
||||
@ -235,18 +234,6 @@ int main(int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
if (!botdb.Connect(
|
||||
Config->DatabaseHost.c_str(),
|
||||
Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(),
|
||||
Config->DatabaseDB.c_str(),
|
||||
Config->DatabasePort)) {
|
||||
Log(Logs::General, Logs::Error, "Cannot continue without a bots database connection.");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Register Log System and Settings */
|
||||
LogSys.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess);
|
||||
database.LoadLogSettings(LogSys.log_settings);
|
||||
@ -393,7 +380,7 @@ int main(int argc, char** argv) {
|
||||
Log(Logs::General, Logs::Zone_Server, "%d bot commands loaded", botretval);
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading bot spell casting chances");
|
||||
if (!botdb.LoadBotSpellCastingChances())
|
||||
if (!database.botdb.LoadBotSpellCastingChances())
|
||||
Log(Logs::General, Logs::Error, "Bot spell casting chances loading FAILED");
|
||||
#endif
|
||||
|
||||
@ -544,9 +531,6 @@ int main(int argc, char** argv) {
|
||||
if (InterserverTimer.Check()) {
|
||||
InterserverTimer.Start();
|
||||
database.ping();
|
||||
#ifdef BOTS
|
||||
botdb.ping();
|
||||
#endif
|
||||
entity_list.UpdateWho();
|
||||
}
|
||||
};
|
||||
|
||||
@ -2181,7 +2181,7 @@ bool QuestManager::createBot(const char *name, const char *lastname, uint8 level
|
||||
|
||||
std::string test_name = name;
|
||||
bool available_flag = false;
|
||||
if(!botdb.QueryNameAvailablity(test_name, available_flag)) {
|
||||
if(!database.botdb.QueryNameAvailablity(test_name, available_flag)) {
|
||||
initiator->Message(0, "%s for '%s'", BotDatabase::fail::QueryNameAvailablity(), (char*)name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -11,6 +11,10 @@
|
||||
#include "aa_ability.h"
|
||||
#include "event_codes.h"
|
||||
|
||||
#ifdef BOTS
|
||||
#include "bot_database.h"
|
||||
#endif
|
||||
|
||||
class Client;
|
||||
class Corpse;
|
||||
class Merc;
|
||||
@ -535,6 +539,11 @@ public:
|
||||
/* Things which really dont belong here... */
|
||||
int16 CommandRequirement(const char* commandname);
|
||||
|
||||
#ifdef BOTS
|
||||
// bot database add-on to eliminate the need for a second database connection
|
||||
BotDatabase botdb;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void ZDBInitVars();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user