mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Merge branch 'master' into feature/eqemu-api-data-service-netstats-ws
This commit is contained in:
commit
1e90e64178
@ -1,5 +1,10 @@
|
|||||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
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 ==
|
== 3/1/2019 ==
|
||||||
Noudess: Major faction conversion to use client data.
|
Noudess: Major faction conversion to use client data.
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#define CURRENT_BINARY_DATABASE_VERSION 9139
|
#define CURRENT_BINARY_DATABASE_VERSION 9139
|
||||||
|
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9023
|
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9024
|
||||||
#else
|
#else
|
||||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -812,7 +812,8 @@ sub show_menu_prompt {
|
|||||||
print ">>> Windows\n";
|
print ">>> Windows\n";
|
||||||
print " [windows_server_download] Updates server via latest 'stable' code\n";
|
print " [windows_server_download] Updates server via latest 'stable' code\n";
|
||||||
print " [windows_server_latest] Updates server via latest commit 'unstable'\n";
|
print " [windows_server_latest] Updates server via latest commit 'unstable'\n";
|
||||||
print " [windows_server_download_bots] Updates server (bots) from latest 'stable'\n";
|
print " [windows_server_download_bots] Updates server (bots) via latest 'stable'\n";
|
||||||
|
print " [windows_server_latest_bots] Updates server (bots) via latest commit 'unstable'\n";
|
||||||
print " [fetch_dlls] Grabs dll's needed to run windows binaries\n";
|
print " [fetch_dlls] Grabs dll's needed to run windows binaries\n";
|
||||||
print " [setup_loginserver] Sets up loginserver for Windows\n";
|
print " [setup_loginserver] Sets up loginserver for Windows\n";
|
||||||
}
|
}
|
||||||
@ -876,6 +877,10 @@ sub show_menu_prompt {
|
|||||||
fetch_latest_windows_binaries_bots();
|
fetch_latest_windows_binaries_bots();
|
||||||
$dc = 1;
|
$dc = 1;
|
||||||
}
|
}
|
||||||
|
elsif ($input eq "windows_server_latest_bots") {
|
||||||
|
fetch_latest_windows_appveyor_bots();
|
||||||
|
$dc = 1;
|
||||||
|
}
|
||||||
elsif ($input eq "fetch_dlls") {
|
elsif ($input eq "fetch_dlls") {
|
||||||
fetch_server_dlls();
|
fetch_server_dlls();
|
||||||
$dc = 1;
|
$dc = 1;
|
||||||
@ -1400,14 +1405,37 @@ sub fetch_latest_windows_binaries {
|
|||||||
rmtree('updates_staged');
|
rmtree('updates_staged');
|
||||||
}
|
}
|
||||||
|
|
||||||
sub fetch_latest_windows_binaries_bots {
|
sub fetch_latest_windows_appveyor_bots {
|
||||||
print "[Update] Fetching Latest Windows Binaries (unstable) with Bots...\n";
|
print "[Update] Fetching Latest Windows Binaries with Bots (unstable) from Appveyor... \n";
|
||||||
get_remote_file("https://ci.appveyor.com/api/projects/KimLS/server/artifacts/eqemu-x86-bots.zip", "updates_staged/eqemu-x86-bots.zip", 1);
|
get_remote_file("https://ci.appveyor.com/api/projects/KimLS/server/artifacts/eqemu-x86-bots.zip", "updates_staged/eqemu-x86-bots.zip", 1);
|
||||||
#::: old repository kept for reference until no issues reported
|
|
||||||
#::: get_remote_file($install_repository_request_url . "master_windows_build_bots.zip", "updates_staged/master_windows_build_bots.zip", 1);
|
print "[Update] Fetched Latest Windows Binaries (unstable) from Appveyor... \n";
|
||||||
|
print "[Update] Extracting... --- \n";
|
||||||
|
unzip('updates_staged/eqemu-x86-bots.zip', 'updates_staged/binaries/');
|
||||||
|
my @files;
|
||||||
|
my $start_dir = "updates_staged/binaries";
|
||||||
|
find(
|
||||||
|
sub { push @files, $File::Find::name unless -d; },
|
||||||
|
$start_dir
|
||||||
|
);
|
||||||
|
for my $file (@files) {
|
||||||
|
$destination_file = $file;
|
||||||
|
$destination_file =~ s/updates_staged\/binaries\///g;
|
||||||
|
print "[Update] Installing :: " . $destination_file . "\n";
|
||||||
|
copy_file($file, $destination_file);
|
||||||
|
}
|
||||||
|
print "[Update] Done\n";
|
||||||
|
|
||||||
|
rmtree('updates_staged');
|
||||||
|
}
|
||||||
|
|
||||||
|
sub fetch_latest_windows_binaries_bots {
|
||||||
|
print "[Update] Fetching Latest Windows Binaries with Bots...\n";
|
||||||
|
get_remote_file($install_repository_request_url . "master_windows_build_bots.zip", "updates_staged/master_windows_build_bots.zip", 1);
|
||||||
|
|
||||||
print "[Update] Fetched Latest Windows Binaries with Bots...\n";
|
print "[Update] Fetched Latest Windows Binaries with Bots...\n";
|
||||||
print "[Update] Extracting...\n";
|
print "[Update] Extracting...\n";
|
||||||
unzip('updates_staged/eqemu-x86-bots.zip', 'updates_staged/binaries/');
|
unzip('updates_staged/master_windows_build_bots.zip', 'updates_staged/binaries/');
|
||||||
my @files;
|
my @files;
|
||||||
my $start_dir = "updates_staged/binaries";
|
my $start_dir = "updates_staged/binaries";
|
||||||
find(
|
find(
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
9021|2018_10_09_bots_owner_options.sql|SHOW TABLES LIKE 'bot_owner_options'|empty|
|
9021|2018_10_09_bots_owner_options.sql|SHOW TABLES LIKE 'bot_owner_options'|empty|
|
||||||
9022|2019_02_07_bots_stance_type_update.sql|SELECT * FROM `bot_spell_casting_chances` WHERE `spell_type_index` = '255' AND `class_id` = '255' AND `stance_index` = '0'|not_empty|
|
9022|2019_02_07_bots_stance_type_update.sql|SELECT * FROM `bot_spell_casting_chances` WHERE `spell_type_index` = '255' AND `class_id` = '255' AND `stance_index` = '0'|not_empty|
|
||||||
9023|2019_06_22_bots_owner_option_stats_update.sql|SHOW COLUMNS FROM `bot_owner_options` LIKE 'stats_update'|empty|
|
9023|2019_06_22_bots_owner_option_stats_update.sql|SHOW COLUMNS FROM `bot_owner_options` LIKE 'stats_update'|empty|
|
||||||
|
9024|2019_06_27_bots_pet_get_lost.sql|SELECT `bot_command` FROM `bot_command_settings` WHERE `bot_command` LIKE 'petgetlost'|empty|
|
||||||
|
|
||||||
# Upgrade conditions:
|
# Upgrade conditions:
|
||||||
# This won't be needed after this system is implemented, but it is used database that are not
|
# This won't be needed after this system is implemented, but it is used database that are not
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
INSERT INTO `bot_command_settings`(`bot_command`, `access`, `aliases`) VALUES ('petgetlost', '0', 'pgl');
|
||||||
88
zone/bot.cpp
88
zone/bot.cpp
@ -158,7 +158,7 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
|||||||
SetRangerAutoWeaponSelect(false);
|
SetRangerAutoWeaponSelect(false);
|
||||||
|
|
||||||
bool stance_flag = 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());
|
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::LoadStance(), GetCleanName());
|
||||||
if (!stance_flag && bot_owner)
|
if (!stance_flag && bot_owner)
|
||||||
bot_owner->Message(13, "Could not locate stance for '%s'", GetCleanName());
|
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());
|
strcpy(this->name, this->GetCleanName());
|
||||||
|
|
||||||
memset(&_botInspectMessage, 0, sizeof(InspectMessage_Struct));
|
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());
|
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());
|
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::LoadGuildMembership(), GetCleanName());
|
||||||
|
|
||||||
std::string error_message;
|
std::string error_message;
|
||||||
@ -205,12 +205,12 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
|||||||
|
|
||||||
GenerateBaseStats();
|
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());
|
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::LoadTimers(), GetCleanName());
|
||||||
|
|
||||||
LoadAAs();
|
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());
|
bot_owner->Message(13, "&s for '%s'", BotDatabase::fail::LoadBuffs(), GetCleanName());
|
||||||
|
|
||||||
CalcBotStats(false);
|
CalcBotStats(false);
|
||||||
@ -1700,25 +1700,25 @@ bool Bot::Save()
|
|||||||
|
|
||||||
if(!GetBotID()) { // New bot record
|
if(!GetBotID()) { // New bot record
|
||||||
uint32 bot_id = 0;
|
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());
|
bot_owner->Message(13, "%s '%s'", BotDatabase::fail::SaveNewBot(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SetBotID(bot_id);
|
SetBotID(bot_id);
|
||||||
}
|
}
|
||||||
else { // Update existing bot record
|
else { // Update existing bot record
|
||||||
if (!botdb.SaveBot(this)) {
|
if (!database.botdb.SaveBot(this)) {
|
||||||
bot_owner->Message(13, "%s '%s'", BotDatabase::fail::SaveBot(), GetCleanName());
|
bot_owner->Message(13, "%s '%s'", BotDatabase::fail::SaveBot(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// All of these continue to process if any fail
|
// 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());
|
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());
|
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());
|
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::SaveStance(), GetCleanName());
|
||||||
|
|
||||||
if (!SavePet())
|
if (!SavePet())
|
||||||
@ -1733,20 +1733,20 @@ bool Bot::DeleteBot()
|
|||||||
if (!bot_owner)
|
if (!bot_owner)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!botdb.DeleteHealRotation(GetBotID())) {
|
if (!database.botdb.DeleteHealRotation(GetBotID())) {
|
||||||
bot_owner->Message(13, "%s", BotDatabase::fail::DeleteHealRotation());
|
bot_owner->Message(13, "%s", BotDatabase::fail::DeleteHealRotation());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string query = StringFormat("DELETE FROM `bot_heal_rotation_members` WHERE `bot_id` = '%u'", GetBotID());
|
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()) {
|
if (!results.Success()) {
|
||||||
bot_owner->Message(13, "Failed to delete heal rotation member '%s'", GetCleanName());
|
bot_owner->Message(13, "Failed to delete heal rotation member '%s'", GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_heal_rotation_targets` WHERE `target_name` LIKE '%s'", GetCleanName());
|
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()) {
|
if (!results.Success()) {
|
||||||
bot_owner->Message(13, "Failed to delete heal rotation target '%s'", GetCleanName());
|
bot_owner->Message(13, "Failed to delete heal rotation target '%s'", GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
@ -1762,32 +1762,32 @@ bool Bot::DeleteBot()
|
|||||||
|
|
||||||
std::string error_message;
|
std::string error_message;
|
||||||
|
|
||||||
if (!botdb.RemoveMemberFromBotGroup(GetBotID())) {
|
if (!database.botdb.RemoveMemberFromBotGroup(GetBotID())) {
|
||||||
bot_owner->Message(13, "%s - '%s'", BotDatabase::fail::RemoveMemberFromBotGroup(), GetCleanName());
|
bot_owner->Message(13, "%s - '%s'", BotDatabase::fail::RemoveMemberFromBotGroup(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!botdb.DeleteItems(GetBotID())) {
|
if (!database.botdb.DeleteItems(GetBotID())) {
|
||||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteItems(), GetCleanName());
|
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteItems(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!botdb.DeleteTimers(GetBotID())) {
|
if (!database.botdb.DeleteTimers(GetBotID())) {
|
||||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteTimers(), GetCleanName());
|
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteTimers(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!botdb.DeleteBuffs(GetBotID())) {
|
if (!database.botdb.DeleteBuffs(GetBotID())) {
|
||||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteBuffs(), GetCleanName());
|
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteBuffs(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!botdb.DeleteStance(GetBotID())) {
|
if (!database.botdb.DeleteStance(GetBotID())) {
|
||||||
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteStance(), GetCleanName());
|
bot_owner->Message(13, "%s for '%s'", BotDatabase::fail::DeleteStance(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!botdb.DeleteBot(GetBotID())) {
|
if (!database.botdb.DeleteBot(GetBotID())) {
|
||||||
bot_owner->Message(13, "%s '%s'", BotDatabase::fail::DeleteBot(), GetCleanName());
|
bot_owner->Message(13, "%s '%s'", BotDatabase::fail::DeleteBot(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1831,7 +1831,7 @@ bool Bot::LoadPet()
|
|||||||
std::string error_message;
|
std::string error_message;
|
||||||
|
|
||||||
uint32 pet_index = 0;
|
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());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetIndex(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1839,7 +1839,7 @@ bool Bot::LoadPet()
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
uint32 saved_pet_spell_id = 0;
|
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());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetSpellID(), GetCleanName());
|
||||||
}
|
}
|
||||||
if (!IsValidSpell(saved_pet_spell_id)) {
|
if (!IsValidSpell(saved_pet_spell_id)) {
|
||||||
@ -1853,7 +1853,7 @@ bool Bot::LoadPet()
|
|||||||
uint32 pet_hp = 0;
|
uint32 pet_hp = 0;
|
||||||
uint32 pet_spell_id = 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());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetStats(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1868,12 +1868,12 @@ bool Bot::LoadPet()
|
|||||||
|
|
||||||
SpellBuff_Struct pet_buffs[PET_BUFF_COUNT];
|
SpellBuff_Struct pet_buffs[PET_BUFF_COUNT];
|
||||||
memset(pet_buffs, 0, (sizeof(SpellBuff_Struct) * 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());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetBuffs(), GetCleanName());
|
||||||
|
|
||||||
uint32 pet_items[EQEmu::invslot::EQUIPMENT_COUNT];
|
uint32 pet_items[EQEmu::invslot::EQUIPMENT_COUNT];
|
||||||
memset(pet_items, 0, (sizeof(uint32) * 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());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetItems(), GetCleanName());
|
||||||
|
|
||||||
pet_inst->SetPetState(pet_buffs, pet_items);
|
pet_inst->SetPetState(pet_buffs, pet_items);
|
||||||
@ -1912,14 +1912,14 @@ bool Bot::SavePet()
|
|||||||
|
|
||||||
std::string error_message;
|
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());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::SavePetStats(), GetCleanName());
|
||||||
return false;
|
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());
|
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());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::SavePetItems(), GetCleanName());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1933,15 +1933,15 @@ bool Bot::DeletePet()
|
|||||||
|
|
||||||
std::string error_message;
|
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());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::DeletePetItems(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!botdb.DeletePetBuffs(GetBotID())) {
|
if (!database.botdb.DeletePetBuffs(GetBotID())) {
|
||||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::DeletePetBuffs(), GetCleanName());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::DeletePetBuffs(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!botdb.DeletePetStats(GetBotID())) {
|
if (!database.botdb.DeletePetStats(GetBotID())) {
|
||||||
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::DeletePetStats(), GetCleanName());
|
bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::DeletePetStats(), GetCleanName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3301,7 +3301,7 @@ void Bot::RemoveBotItemBySlot(uint32 slotID, std::string *errorMessage)
|
|||||||
if(!GetBotID())
|
if(!GetBotID())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!botdb.DeleteItemBySlot(GetBotID(), slotID))
|
if(!database.botdb.DeleteItemBySlot(GetBotID(), slotID))
|
||||||
*errorMessage = BotDatabase::fail::DeleteItemBySlot();
|
*errorMessage = BotDatabase::fail::DeleteItemBySlot();
|
||||||
|
|
||||||
m_inv.DeleteItem(slotID);
|
m_inv.DeleteItem(slotID);
|
||||||
@ -3314,7 +3314,7 @@ void Bot::GetBotItems(EQEmu::InventoryProfile &inv, std::string* errorMessage)
|
|||||||
if(!GetBotID())
|
if(!GetBotID())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!botdb.LoadItems(GetBotID(), inv)) {
|
if (!database.botdb.LoadItems(GetBotID(), inv)) {
|
||||||
*errorMessage = BotDatabase::fail::LoadItems();
|
*errorMessage = BotDatabase::fail::LoadItems();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3329,7 +3329,7 @@ uint32 Bot::GetBotItemBySlot(uint32 slotID)
|
|||||||
if(!GetBotID())
|
if(!GetBotID())
|
||||||
return item_id;
|
return item_id;
|
||||||
|
|
||||||
if (!botdb.LoadItemBySlot(GetBotID(), slotID, item_id)) {
|
if (!database.botdb.LoadItemBySlot(GetBotID(), slotID, item_id)) {
|
||||||
if (GetBotOwner() && GetBotOwner()->IsClient())
|
if (GetBotOwner() && GetBotOwner()->IsClient())
|
||||||
GetBotOwner()->CastToClient()->Message(13, "%s", BotDatabase::fail::LoadItemBySlot());
|
GetBotOwner()->CastToClient()->Message(13, "%s", BotDatabase::fail::LoadItemBySlot());
|
||||||
}
|
}
|
||||||
@ -3418,7 +3418,7 @@ Bot* Bot::LoadBot(uint32 botID)
|
|||||||
if (!botID)
|
if (!botID)
|
||||||
return loaded_bot;
|
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;
|
||||||
|
|
||||||
return loaded_bot;
|
return loaded_bot;
|
||||||
@ -3433,7 +3433,7 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) {
|
|||||||
uint32 TempGroupId = g->GetID();
|
uint32 TempGroupId = g->GetID();
|
||||||
std::list<uint32> ActiveBots;
|
std::list<uint32> ActiveBots;
|
||||||
// Modified LoadGroupedBotsByGroupID to require a CharacterID
|
// 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());
|
botOwner->Message(13, "%s", BotDatabase::fail::LoadGroupedBotsByGroupID());
|
||||||
return;
|
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)
|
void Bot::BotTradeAddItem(uint32 id, const EQEmu::ItemInstance* inst, int16 charges, uint32 equipableSlots, uint16 lootSlot, std::string* errorMessage, bool addToDb)
|
||||||
{
|
{
|
||||||
if(addToDb) {
|
if(addToDb) {
|
||||||
if (!botdb.SaveItemBySlot(this, lootSlot, inst)) {
|
if (!database.botdb.SaveItemBySlot(this, lootSlot, inst)) {
|
||||||
*errorMessage = BotDatabase::fail::SaveItemBySlot();
|
*errorMessage = BotDatabase::fail::SaveItemBySlot();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4129,7 +4129,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
|
|||||||
// // TODO: add logging
|
// // 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"));
|
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);
|
BotRemoveEquipItem(return_iterator.fromBotSlot);
|
||||||
@ -4144,7 +4144,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
|
|||||||
for (auto& trade_iterator : client_trade) {
|
for (auto& trade_iterator : client_trade) {
|
||||||
// TODO: code for stackables
|
// 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"));
|
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);
|
m_inv.PutItem(trade_iterator.toBotSlot, *trade_iterator.tradeItemInstance);
|
||||||
@ -5944,7 +5944,7 @@ void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) {
|
|||||||
return;
|
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());
|
guildOfficer->Message(13, "%s for '%s'", BotDatabase::fail::SaveGuildMembership(), botToGuild->GetCleanName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5969,16 +5969,16 @@ bool Bot::ProcessGuildRemoval(Client* guildOfficer, std::string botName) {
|
|||||||
if(guildOfficer && !botName.empty()) {
|
if(guildOfficer && !botName.empty()) {
|
||||||
Bot* botToUnGuild = entity_list.GetBotByBotName(botName);
|
Bot* botToUnGuild = entity_list.GetBotByBotName(botName);
|
||||||
if(botToUnGuild) {
|
if(botToUnGuild) {
|
||||||
if (botdb.SaveGuildMembership(botToUnGuild->GetBotID(), 0, 0))
|
if (database.botdb.SaveGuildMembership(botToUnGuild->GetBotID(), 0, 0))
|
||||||
Result = true;
|
Result = true;
|
||||||
} else {
|
} else {
|
||||||
uint32 ownerId = 0;
|
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());
|
guildOfficer->Message(13, "%s for '%s'", BotDatabase::fail::LoadOwnerID(), botName.c_str());
|
||||||
uint32 botId = 0;
|
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());
|
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;
|
Result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9068,7 +9068,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag)
|
|||||||
if (all_flag)
|
if (all_flag)
|
||||||
save_slot = -2;
|
save_slot = -2;
|
||||||
|
|
||||||
if (!botdb.SaveEquipmentColor(GetBotID(), save_slot, rgb)) {
|
if (!database.botdb.SaveEquipmentColor(GetBotID(), save_slot, rgb)) {
|
||||||
if (GetBotOwner() && GetBotOwner()->IsClient())
|
if (GetBotOwner() && GetBotOwner()->IsClient())
|
||||||
GetBotOwner()->CastToClient()->Message(13, "%s", BotDatabase::fail::SaveEquipmentColor());
|
GetBotOwner()->CastToClient()->Message(13, "%s", BotDatabase::fail::SaveEquipmentColor());
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -29,7 +29,6 @@
|
|||||||
#include "groups.h"
|
#include "groups.h"
|
||||||
#include "corpse.h"
|
#include "corpse.h"
|
||||||
#include "zonedb.h"
|
#include "zonedb.h"
|
||||||
#include "bot_database.h"
|
|
||||||
#include "string_ids.h"
|
#include "string_ids.h"
|
||||||
#include "../common/misc_functions.h"
|
#include "../common/misc_functions.h"
|
||||||
#include "../common/global_define.h"
|
#include "../common/global_define.h"
|
||||||
|
|||||||
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "bot_command.h"
|
#include "bot_command.h"
|
||||||
#include "bot_database.h"
|
#include "zonedb.h"
|
||||||
#include "guild_mgr.h"
|
#include "guild_mgr.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "doors.h"
|
#include "doors.h"
|
||||||
@ -1401,7 +1401,8 @@ int bot_command_init(void)
|
|||||||
bot_command_add("movementspeed", "Orders a bot to cast a movement speed enhancement spell", 0, bot_command_movement_speed) ||
|
bot_command_add("movementspeed", "Orders a bot to cast a movement speed enhancement spell", 0, bot_command_movement_speed) ||
|
||||||
bot_command_add("owneroption", "Sets options available to bot owners", 0, bot_command_owner_option) ||
|
bot_command_add("owneroption", "Sets options available to bot owners", 0, bot_command_owner_option) ||
|
||||||
bot_command_add("pet", "Lists the available bot pet [subcommands]", 0, bot_command_pet) ||
|
bot_command_add("pet", "Lists the available bot pet [subcommands]", 0, bot_command_pet) ||
|
||||||
bot_command_add("petremove", "Orders a bot to remove its pet", 0, bot_subcommand_pet_remove) ||
|
bot_command_add("petgetlost", "Orders a bot to remove its summoned pet", 0, bot_subcommand_pet_get_lost) ||
|
||||||
|
bot_command_add("petremove", "Orders a bot to remove its charmed pet", 0, bot_subcommand_pet_remove) ||
|
||||||
bot_command_add("petsettype", "Orders a Magician bot to use a specified pet type", 0, bot_subcommand_pet_set_type) ||
|
bot_command_add("petsettype", "Orders a Magician bot to use a specified pet type", 0, bot_subcommand_pet_set_type) ||
|
||||||
bot_command_add("picklock", "Orders a capable bot to pick the lock of the closest door", 0, bot_command_pick_lock) ||
|
bot_command_add("picklock", "Orders a capable bot to pick the lock of the closest door", 0, bot_command_pick_lock) ||
|
||||||
bot_command_add("portal", "Orders a Wizard bot to open a magical doorway to a specified destination", 0, bot_subcommand_portal) ||
|
bot_command_add("portal", "Orders a Wizard bot to open a magical doorway to a specified destination", 0, bot_subcommand_portal) ||
|
||||||
@ -1422,7 +1423,7 @@ int bot_command_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, std::pair<uint8, std::vector<std::string>>> bot_command_settings;
|
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;
|
auto working_bcl = bot_command_list;
|
||||||
for (auto working_bcl_iter : working_bcl) {
|
for (auto working_bcl_iter : working_bcl) {
|
||||||
@ -1868,11 +1869,11 @@ namespace MyBots
|
|||||||
std::string group_name = name;
|
std::string group_name = name;
|
||||||
|
|
||||||
uint32 botgroup_id = 0;
|
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;
|
return;
|
||||||
|
|
||||||
std::map<uint32, std::list<uint32>> botgroup_list;
|
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;
|
return;
|
||||||
|
|
||||||
std::list<Bot*> selectable_bot_list;
|
std::list<Bot*> selectable_bot_list;
|
||||||
@ -3456,7 +3457,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
|
|||||||
else
|
else
|
||||||
c->SetBotOptionDeathMarquee(!c->GetBotOptionDeathMarquee());
|
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"));
|
c->Message(m_action, "Bot 'death marquee' is now %s.", (c->GetBotOptionDeathMarquee() == true ? "enabled" : "disabled"));
|
||||||
}
|
}
|
||||||
else if (!owner_option.compare("statsupdate")) {
|
else if (!owner_option.compare("statsupdate")) {
|
||||||
@ -3467,7 +3468,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
|
|||||||
else
|
else
|
||||||
c->SetBotOptionStatsUpdate(!c->GetBotOptionStatsUpdate());
|
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"));
|
c->Message(m_action, "Bot 'stats update' is now %s.", (c->GetBotOptionStatsUpdate() == true ? "enabled" : "disabled"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -3479,12 +3480,13 @@ void bot_command_pet(Client *c, const Seperator *sep)
|
|||||||
{
|
{
|
||||||
/* VS2012 code - begin */
|
/* VS2012 code - begin */
|
||||||
std::list<const char*> subcommand_list;
|
std::list<const char*> subcommand_list;
|
||||||
|
subcommand_list.push_back("petgetlost");
|
||||||
subcommand_list.push_back("petremove");
|
subcommand_list.push_back("petremove");
|
||||||
subcommand_list.push_back("petsettype");
|
subcommand_list.push_back("petsettype");
|
||||||
/* VS2012 code - end */
|
/* VS2012 code - end */
|
||||||
|
|
||||||
/* VS2013 code
|
/* VS2013 code
|
||||||
const std::list<const char*> subcommand_list = { "petremove", "petsettype" };
|
const std::list<const char*> subcommand_list = { "petgetlost", "petremove", "petsettype" };
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (helper_command_alias_fail(c, "bot_command_pet", sep->arg[0], "pet"))
|
if (helper_command_alias_fail(c, "bot_command_pet", sep->arg[0], "pet"))
|
||||||
@ -4240,7 +4242,7 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
|
|||||||
std::string error_message;
|
std::string error_message;
|
||||||
|
|
||||||
bool available_flag = false;
|
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());
|
c->Message(m_fail, "%s", BotDatabase::fail::QueryNameAvailablity());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4252,7 +4254,7 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
|
|||||||
uint32 max_bot_count = RuleI(Bots, CreationLimit);
|
uint32 max_bot_count = RuleI(Bots, CreationLimit);
|
||||||
|
|
||||||
uint32 bot_count = 0;
|
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());
|
c->Message(m_fail, "%s", BotDatabase::fail::QueryBotCount());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4262,18 +4264,18 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 clone_id = 0;
|
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());
|
c->Message(m_fail, "%s '%s'", BotDatabase::fail::CreateCloneBot(), bot_name.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clone_stance = EQEmu::constants::stancePassive;
|
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());
|
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());
|
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_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());
|
c->Message(m_action, "Bot '%s' was successfully cloned to bot '%s'", my_bot->GetCleanName(), bot_name.c_str());
|
||||||
@ -4521,11 +4523,11 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
if (ab_type == ActionableBots::ABT_All) {
|
if (ab_type == ActionableBots::ABT_All) {
|
||||||
if (dye_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());
|
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllArmorColors());
|
||||||
}
|
}
|
||||||
else {
|
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());
|
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllArmorColorBySlot());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4674,7 +4676,7 @@ void bot_subcommand_bot_follow_distance(Client *c, const Seperator *sep)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
bot_iter->SetFollowDistance(bfd);
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::SaveFollowDistance(), bot_iter->GetCleanName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4683,7 +4685,7 @@ void bot_subcommand_bot_follow_distance(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ab_type == ActionableBots::ABT_All) {
|
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());
|
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllFollowDistances());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4852,7 +4854,7 @@ void bot_subcommand_bot_inspect_message(Client *c, const Seperator *sep)
|
|||||||
if (set_flag)
|
if (set_flag)
|
||||||
memcpy(bot_message_struct, client_message_struct, sizeof(InspectMessage_Struct));
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::SaveInspectMessage(), bot_iter->GetCleanName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4866,7 +4868,7 @@ void bot_subcommand_bot_inspect_message(Client *c, const Seperator *sep)
|
|||||||
if (set_flag)
|
if (set_flag)
|
||||||
memcpy(&bot_message_struct, client_message_struct, sizeof(InspectMessage_Struct));
|
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());
|
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllInspectMessages());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4922,7 +4924,7 @@ void bot_subcommand_bot_list(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::list<BotsAvailableList> bots_list;
|
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());
|
c->Message(m_fail, "%s", BotDatabase::fail::LoadBotsList());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5079,7 +5081,7 @@ void bot_subcommand_bot_spawn(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
if (RuleB(Bots, QuestableSpawnLimit) && !c->GetGM()) {
|
if (RuleB(Bots, QuestableSpawnLimit) && !c->GetGM()) {
|
||||||
int allowed_bot_count = 0;
|
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());
|
c->Message(m_fail, "%s", BotDatabase::fail::LoadQuestableSpawnCount());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5100,7 +5102,7 @@ void bot_subcommand_bot_spawn(Client *c, const Seperator *sep)
|
|||||||
std::string bot_name = sep->arg[1];
|
std::string bot_name = sep->arg[1];
|
||||||
|
|
||||||
uint32 bot_id = 0;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotID(), bot_name.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5273,7 +5275,7 @@ void bot_subcommand_bot_stop_melee_level(Client *c, const Seperator *sep)
|
|||||||
// [reset] falls through with initialization value
|
// [reset] falls through with initialization value
|
||||||
|
|
||||||
my_bot->SetStopMeleeLevel(sml);
|
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_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);
|
c->Message(m_action, "Successfully set stop melee level for %s to %u", my_bot->GetCleanName(), sml);
|
||||||
@ -5442,7 +5444,7 @@ void bot_subcommand_bot_toggle_helm(Client *c, const Seperator *sep)
|
|||||||
bot_iter->SetShowHelm(helm_state);
|
bot_iter->SetShowHelm(helm_state);
|
||||||
|
|
||||||
if (ab_type != ActionableBots::ABT_All) {
|
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());
|
c->Message(m_unknown, "%s for '%s'", bot_iter->GetCleanName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5464,11 +5466,11 @@ void bot_subcommand_bot_toggle_helm(Client *c, const Seperator *sep)
|
|||||||
if (ab_type == ActionableBots::ABT_All) {
|
if (ab_type == ActionableBots::ABT_All) {
|
||||||
std::string query;
|
std::string query;
|
||||||
if (toggle_helm) {
|
if (toggle_helm) {
|
||||||
if (!botdb.ToggleAllHelmAppearances(c->CharacterID()))
|
if (!database.botdb.ToggleAllHelmAppearances(c->CharacterID()))
|
||||||
c->Message(m_fail, "%s", BotDatabase::fail::ToggleAllHelmAppearances());
|
c->Message(m_fail, "%s", BotDatabase::fail::ToggleAllHelmAppearances());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!botdb.SaveAllHelmAppearances(c->CharacterID(), helm_state))
|
if (!database.botdb.SaveAllHelmAppearances(c->CharacterID(), helm_state))
|
||||||
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllHelmAppearances());
|
c->Message(m_fail, "%s", BotDatabase::fail::SaveAllHelmAppearances());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5627,7 +5629,7 @@ void bot_subcommand_botgroup_add_member(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 botgroup_id = 0;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDByMemberID(), new_member->GetCleanName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5657,7 +5659,7 @@ void bot_subcommand_botgroup_add_member(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
botgroup_id = 0;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDByLeaderID(), botgroup_leader->GetCleanName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5673,14 +5675,14 @@ void bot_subcommand_botgroup_add_member(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
database.SetGroupID(new_member->GetName(), group_inst->GetID(), new_member->GetBotID());
|
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());
|
c->Message(m_fail, "%s - %s->%s", BotDatabase::fail::AddMemberToBotGroup(), new_member->GetCleanName(), botgroup_leader->GetCleanName());
|
||||||
Bot::RemoveBotFromGroup(new_member, botgroup_leader->GetGroup());
|
Bot::RemoveBotFromGroup(new_member, botgroup_leader->GetGroup());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string botgroup_name;
|
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_fail, "%s", BotDatabase::fail::LoadBotGroupNameByLeaderID());
|
||||||
|
|
||||||
c->Message(m_action, "Successfully added %s to bot-group %s", new_member->GetCleanName(), botgroup_name.c_str());
|
c->Message(m_action, "Successfully added %s to bot-group %s", new_member->GetCleanName(), botgroup_name.c_str());
|
||||||
@ -5702,7 +5704,7 @@ void bot_subcommand_botgroup_create(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool extant_flag = false;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::QueryBotGroupExistence(), botgroup_name_arg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5732,7 +5734,7 @@ void bot_subcommand_botgroup_create(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 botgroup_id = 0;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDByLeaderID(), botgroup_leader->GetCleanName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5742,7 +5744,7 @@ void bot_subcommand_botgroup_create(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
botgroup_id = 0;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDByMemberID(), botgroup_leader->GetCleanName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5757,7 +5759,7 @@ void bot_subcommand_botgroup_create(Client *c, const Seperator *sep)
|
|||||||
return;
|
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());
|
c->Message(m_fail, "%s '%s'", BotDatabase::fail::CreateBotGroup(), botgroup_name_arg.c_str());
|
||||||
safe_delete(group_inst);
|
safe_delete(group_inst);
|
||||||
return;
|
return;
|
||||||
@ -5787,7 +5789,7 @@ void bot_subcommand_botgroup_delete(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 botgroup_id = 0;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDForLoadBotGroup(), botgroup_name_arg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5797,7 +5799,7 @@ void bot_subcommand_botgroup_delete(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 leader_id = 0;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadLeaderIDByBotGroupID(), botgroup_name_arg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5811,7 +5813,7 @@ void bot_subcommand_botgroup_delete(Client *c, const Seperator *sep)
|
|||||||
MyBots::PopulateSBL_BySpawnedBots(c, sbl);
|
MyBots::PopulateSBL_BySpawnedBots(c, sbl);
|
||||||
|
|
||||||
std::map<uint32, std::list<uint32>> member_list;
|
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());
|
c->Message(m_fail, "%s '%s'", BotDatabase::fail::LoadBotGroup(), botgroup_name_arg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5835,7 +5837,7 @@ void bot_subcommand_botgroup_delete(Client *c, const Seperator *sep)
|
|||||||
Bot::RemoveBotFromGroup(group_member, group_member->GetGroup());
|
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());
|
c->Message(m_fail, "%s '%s'", BotDatabase::fail::DeleteBotGroup(), botgroup_name_arg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5853,7 +5855,7 @@ void bot_subcommand_botgroup_list(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::pair<std::string, std::string>> botgroups_list;
|
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());
|
c->Message(m_fail, "%s", BotDatabase::fail::LoadBotGroupsListByOwnerID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5885,7 +5887,7 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool extant_flag = false;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::QueryBotGroupExistence(), botgroup_name_arg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5915,13 +5917,13 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 botgroup_id = 0;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroupIDForLoadBotGroup(), botgroup_name_arg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<uint32, std::list<uint32>> member_list;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadBotGroup(), botgroup_name_arg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5934,7 +5936,7 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
if (RuleB(Bots, QuestableSpawnLimit)) {
|
if (RuleB(Bots, QuestableSpawnLimit)) {
|
||||||
int allowed_bot_count = 0;
|
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());
|
c->Message(m_fail, "%s", BotDatabase::fail::LoadQuestableSpawnCount());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5957,7 +5959,7 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 leader_id = 0;
|
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());
|
c->Message(m_fail, "%s for '%s'", BotDatabase::fail::LoadLeaderIDByBotGroupName(), botgroup_name_arg.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -6042,7 +6044,7 @@ void bot_subcommand_botgroup_remove_member(Client *c, const Seperator *sep)
|
|||||||
return;
|
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());
|
c->Message(m_fail, "%s - '%s'", BotDatabase::fail::RemoveMemberFromBotGroup(), group_member->GetCleanName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -6664,7 +6666,7 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
|
|||||||
bool member_fail = false;
|
bool member_fail = false;
|
||||||
bool target_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());
|
c->Message(m_fail, "%s", BotDatabase::fail::LoadHealRotation());
|
||||||
|
|
||||||
if (!load_flag) {
|
if (!load_flag) {
|
||||||
@ -6737,7 +6739,7 @@ void bot_subcommand_heal_rotation_delete(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (all_flag) {
|
if (all_flag) {
|
||||||
if (botdb.DeleteAllHealRotations(c->CharacterID()))
|
if (database.botdb.DeleteAllHealRotations(c->CharacterID()))
|
||||||
c->Message(m_action, "Succeeded in deleting all heal rotations");
|
c->Message(m_action, "Succeeded in deleting all heal rotations");
|
||||||
else
|
else
|
||||||
c->Message(m_fail, "%s", BotDatabase::fail::DeleteAllHealRotations());
|
c->Message(m_fail, "%s", BotDatabase::fail::DeleteAllHealRotations());
|
||||||
@ -6760,7 +6762,7 @@ void bot_subcommand_heal_rotation_delete(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!botdb.DeleteHealRotation(current_member->GetBotID())) {
|
if (!database.botdb.DeleteHealRotation(current_member->GetBotID())) {
|
||||||
c->Message(m_fail, "%s", BotDatabase::fail::DeleteHealRotation());
|
c->Message(m_fail, "%s", BotDatabase::fail::DeleteHealRotation());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -7047,7 +7049,7 @@ void bot_subcommand_heal_rotation_save(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
bool member_fail = false;
|
bool member_fail = false;
|
||||||
bool target_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());
|
c->Message(m_fail, "%s", BotDatabase::fail::SaveHealRotation());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -7264,7 +7266,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 database_count = 0;
|
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());
|
c->Message(m_unknown, "%s", BotDatabase::fail::QueryInventoryCount());
|
||||||
|
|
||||||
if (inventory_count != database_count)
|
if (inventory_count != database_count)
|
||||||
@ -7433,6 +7435,37 @@ void bot_subcommand_inventory_window(Client *c, const Seperator *sep)
|
|||||||
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
|
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bot_subcommand_pet_get_lost(Client *c, const Seperator *sep)
|
||||||
|
{
|
||||||
|
if (helper_command_alias_fail(c, "bot_subcommand_pet_get_lost", sep->arg[0], "petgetlost"))
|
||||||
|
return;
|
||||||
|
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||||
|
c->Message(m_usage, "usage: %s ([actionable: target | byname | ownergroup | botgroup | targetgroup | namesgroup | healrotation | spawned] ([actionable_name]))", sep->arg[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int ab_mask = ActionableBots::ABM_NoFilter;
|
||||||
|
|
||||||
|
std::list<Bot*> sbl;
|
||||||
|
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int summoned_pet = 0;
|
||||||
|
for (auto bot_iter : sbl) {
|
||||||
|
if (!bot_iter->GetPet() || bot_iter->GetPet()->IsCharmed())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bot_iter->GetPet()->Say_StringID(PET_GETLOST_STRING);
|
||||||
|
bot_iter->GetPet()->Depop(false);
|
||||||
|
bot_iter->SetPetID(0);
|
||||||
|
database.botdb.DeletePetItems(bot_iter->GetBotID());
|
||||||
|
database.botdb.DeletePetBuffs(bot_iter->GetBotID());
|
||||||
|
database.botdb.DeletePetStats(bot_iter->GetBotID());
|
||||||
|
++summoned_pet;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->Message(m_action, "%i of your bots released their summoned pet%s", summoned_pet, (summoned_pet == 1) ? "" : "s");
|
||||||
|
}
|
||||||
|
|
||||||
void bot_subcommand_pet_remove(Client *c, const Seperator *sep)
|
void bot_subcommand_pet_remove(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
if (helper_command_alias_fail(c, "bot_subcommand_pet_remove", sep->arg[0], "petremove"))
|
if (helper_command_alias_fail(c, "bot_subcommand_pet_remove", sep->arg[0], "petremove"))
|
||||||
@ -7684,7 +7717,7 @@ uint32 helper_bot_create(Client *bot_owner, std::string bot_name, uint8 bot_clas
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool available_flag = false;
|
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());
|
bot_owner->Message(m_fail, "%s for '%s'", BotDatabase::fail::QueryNameAvailablity(), bot_name.c_str());
|
||||||
return bot_id;
|
return bot_id;
|
||||||
}
|
}
|
||||||
@ -7726,7 +7759,7 @@ uint32 helper_bot_create(Client *bot_owner, std::string bot_name, uint8 bot_clas
|
|||||||
uint32 max_bot_count = RuleI(Bots, CreationLimit);
|
uint32 max_bot_count = RuleI(Bots, CreationLimit);
|
||||||
|
|
||||||
uint32 bot_count = 0;
|
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());
|
bot_owner->Message(m_fail, "%s", BotDatabase::fail::QueryBotCount());
|
||||||
return bot_id;
|
return bot_id;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -652,6 +652,7 @@ void bot_subcommand_inventory_give(Client *c, const Seperator *sep);
|
|||||||
void bot_subcommand_inventory_list(Client *c, const Seperator *sep);
|
void bot_subcommand_inventory_list(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_inventory_remove(Client *c, const Seperator *sep);
|
void bot_subcommand_inventory_remove(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_inventory_window(Client *c, const Seperator *sep);
|
void bot_subcommand_inventory_window(Client *c, const Seperator *sep);
|
||||||
|
void bot_subcommand_pet_get_lost(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_pet_remove(Client *c, const Seperator *sep);
|
void bot_subcommand_pet_remove(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_pet_set_type(Client *c, const Seperator *sep);
|
void bot_subcommand_pet_set_type(Client *c, const Seperator *sep);
|
||||||
void bot_subcommand_portal(Client *c, const Seperator *sep);
|
void bot_subcommand_portal(Client *c, const Seperator *sep);
|
||||||
|
|||||||
@ -23,48 +23,17 @@
|
|||||||
#include "../common/string_util.h"
|
#include "../common/string_util.h"
|
||||||
#include "../common/eqemu_logsys.h"
|
#include "../common/eqemu_logsys.h"
|
||||||
|
|
||||||
#include "bot_database.h"
|
#include "zonedb.h"
|
||||||
#include "bot.h"
|
#include "bot.h"
|
||||||
#include "client.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)
|
bool BotDatabase::LoadBotCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &bot_command_settings)
|
||||||
{
|
{
|
||||||
bot_command_settings.clear();
|
bot_command_settings.clear();
|
||||||
|
|
||||||
query = "SELECT `bot_command`, `access`, `aliases` FROM `bot_command_settings`";
|
query = "SELECT `bot_command`, `access`, `aliases` FROM `bot_command_settings`";
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -109,7 +78,7 @@ bool BotDatabase::LoadBotSpellCastingChances()
|
|||||||
"FROM"
|
"FROM"
|
||||||
" `bot_spell_casting_chances`";
|
" `bot_spell_casting_chances`";
|
||||||
|
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success() || !results.RowCount())
|
if (!results.Success() || !results.RowCount())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -147,7 +116,7 @@ bool BotDatabase::QueryNameAvailablity(const std::string& bot_name, bool& availa
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `id` FROM `vw_bot_character_mobs` WHERE `name` LIKE '%s' LIMIT 1", bot_name.c_str());
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (results.RowCount())
|
if (results.RowCount())
|
||||||
@ -164,7 +133,7 @@ bool BotDatabase::QueryBotCount(const uint32 owner_id, uint32& bot_count)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT COUNT(`bot_id`) FROM `bot_data` WHERE `owner_id` = '%i'", owner_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -200,7 +169,7 @@ bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableLis
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `bot_id`, `name`, `class`, `level`, `race`, `gender` FROM `bot_data` WHERE `owner_id` = '%u'", owner_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -235,7 +204,7 @@ bool BotDatabase::LoadOwnerID(const std::string& bot_name, uint32& owner_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `owner_id` FROM `bot_data` WHERE `name` = '%s' LIMIT 1", bot_name.c_str());
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -253,7 +222,7 @@ bool BotDatabase::LoadOwnerID(const uint32 bot_id, uint32& owner_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `owner_id` FROM `bot_data` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
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",
|
"SELECT `bot_id` FROM `bot_data` WHERE `owner_id` = '%u' AND `name` = '%s' LIMIT 1",
|
||||||
owner_id, bot_name.c_str()
|
owner_id, bot_name.c_str()
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -345,7 +314,7 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
|
|||||||
bot_id
|
bot_id
|
||||||
);
|
);
|
||||||
|
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -546,7 +515,7 @@ bool BotDatabase::SaveNewBot(Bot* bot_inst, uint32& bot_id)
|
|||||||
BOT_FOLLOW_DISTANCE_DEFAULT,
|
BOT_FOLLOW_DISTANCE_DEFAULT,
|
||||||
(IsCasterClass(bot_inst->GetClass()) ? (uint8)RuleI(Bots, CasterStopMeleeLevel) : 255)
|
(IsCasterClass(bot_inst->GetClass()) ? (uint8)RuleI(Bots, CasterStopMeleeLevel) : 255)
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -649,7 +618,7 @@ bool BotDatabase::SaveBot(Bot* bot_inst)
|
|||||||
bot_inst->GetStopMeleeLevel(),
|
bot_inst->GetStopMeleeLevel(),
|
||||||
bot_inst->GetBotID()
|
bot_inst->GetBotID()
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -662,7 +631,7 @@ bool BotDatabase::DeleteBot(const uint32 bot_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_data` WHERE `bot_id` = '%u'", bot_id);
|
query = StringFormat("DELETE FROM `bot_data` WHERE `bot_id` = '%u'", bot_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -698,7 +667,7 @@ bool BotDatabase::LoadBuffs(Bot* bot_inst)
|
|||||||
" WHERE `bot_id` = '%u'",
|
" WHERE `bot_id` = '%u'",
|
||||||
bot_inst->GetBotID()
|
bot_inst->GetBotID()
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -817,7 +786,7 @@ bool BotDatabase::SaveBuffs(Bot* bot_inst)
|
|||||||
bot_buffs[buff_index].caston_z,
|
bot_buffs[buff_index].caston_z,
|
||||||
bot_buffs[buff_index].ExtraDIChance
|
bot_buffs[buff_index].ExtraDIChance
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
DeleteBuffs(bot_inst->GetBotID());
|
DeleteBuffs(bot_inst->GetBotID());
|
||||||
return false;
|
return false;
|
||||||
@ -833,7 +802,7 @@ bool BotDatabase::DeleteBuffs(const uint32 bot_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_buffs` WHERE `bot_id` = '%u'", bot_id);
|
query = StringFormat("DELETE FROM `bot_buffs` WHERE `bot_id` = '%u'", bot_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -846,7 +815,7 @@ bool BotDatabase::LoadStance(const uint32 bot_id, int& bot_stance)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `stance_id` FROM `bot_stances` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -866,7 +835,7 @@ bool BotDatabase::LoadStance(Bot* bot_inst, bool& stance_flag)
|
|||||||
bot_inst->SetDefaultBotStance();
|
bot_inst->SetDefaultBotStance();
|
||||||
|
|
||||||
query = StringFormat("SELECT `stance_id` FROM `bot_stances` WHERE `bot_id` = '%u' LIMIT 1", bot_inst->GetBotID());
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -888,7 +857,7 @@ bool BotDatabase::SaveStance(const uint32 bot_id, const int bot_stance)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO `bot_stances` (`bot_id`, `stance_id`) VALUES ('%u', '%u')", bot_id, bot_stance);
|
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()) {
|
if (!results.Success()) {
|
||||||
DeleteStance(bot_id);
|
DeleteStance(bot_id);
|
||||||
return false;
|
return false;
|
||||||
@ -906,7 +875,7 @@ bool BotDatabase::SaveStance(Bot* bot_inst)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO `bot_stances` (`bot_id`, `stance_id`) VALUES ('%u', '%u')", bot_inst->GetBotID(), bot_inst->GetBotStance());
|
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()) {
|
if (!results.Success()) {
|
||||||
DeleteStance(bot_inst->GetBotID());
|
DeleteStance(bot_inst->GetBotID());
|
||||||
return false;
|
return false;
|
||||||
@ -921,7 +890,7 @@ bool BotDatabase::DeleteStance(const uint32 bot_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_stances` WHERE `bot_id` = '%u'", bot_id);
|
query = StringFormat("DELETE FROM `bot_stances` WHERE `bot_id` = '%u'", bot_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -952,7 +921,7 @@ bool BotDatabase::LoadTimers(Bot* bot_inst)
|
|||||||
bot_inst->GetClass(),
|
bot_inst->GetClass(),
|
||||||
bot_inst->GetLevel()
|
bot_inst->GetLevel()
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -994,7 +963,7 @@ bool BotDatabase::SaveTimers(Bot* bot_inst)
|
|||||||
continue;
|
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]);
|
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()) {
|
if (!results.Success()) {
|
||||||
DeleteTimers(bot_inst->GetBotID());
|
DeleteTimers(bot_inst->GetBotID());
|
||||||
return false;
|
return false;
|
||||||
@ -1010,7 +979,7 @@ bool BotDatabase::DeleteTimers(const uint32 bot_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_timers` WHERE `bot_id` = '%u'", bot_id);
|
query = StringFormat("DELETE FROM `bot_timers` WHERE `bot_id` = '%u'", bot_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1035,7 +1004,7 @@ bool BotDatabase::LoadGuildMembership(const uint32 bot_id, uint32& guild_id, uin
|
|||||||
" LIMIT 1",
|
" LIMIT 1",
|
||||||
bot_id
|
bot_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -1058,7 +1027,7 @@ bool BotDatabase::SaveGuildMembership(const uint32 bot_id, const uint32 guild_id
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO `bot_guild_members` SET `bot_id` = '%u', `guild_id` = '%u', `rank` = '%u'", bot_id, guild_id, guild_rank);
|
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()) {
|
if (!results.Success()) {
|
||||||
DeleteGuildMembership(bot_id);
|
DeleteGuildMembership(bot_id);
|
||||||
return false;
|
return false;
|
||||||
@ -1073,7 +1042,7 @@ bool BotDatabase::DeleteGuildMembership(const uint32 bot_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_guild_members` WHERE `bot_id` = '%u'", bot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1088,7 +1057,7 @@ bool BotDatabase::QueryInventoryCount(const uint32 bot_id, uint32& item_count)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT COUNT(`inventories_index`) FROM `bot_inventories` WHERE `bot_id` = '%u'", bot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -1127,7 +1096,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& invent
|
|||||||
" ORDER BY `slot_id`",
|
" ORDER BY `slot_id`",
|
||||||
bot_id
|
bot_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -1224,7 +1193,7 @@ bool BotDatabase::DeleteItems(const uint32 bot_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_inventories` WHERE `bot_id` = '%u'", bot_id);
|
query = StringFormat("DELETE FROM `bot_inventories` WHERE `bot_id` = '%u'", bot_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1242,7 +1211,7 @@ bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `item_id` FROM `bot_inventories` WHERE `bot_id` = '%i' AND `slot_id` = '%i' LIMIT 1", bot_id, slot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
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[4],
|
||||||
(unsigned long)augment_id[5]
|
(unsigned long)augment_id[5]
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
DeleteItemBySlot(bot_inst->GetBotID(), slot_id);
|
DeleteItemBySlot(bot_inst->GetBotID(), slot_id);
|
||||||
return false;
|
return false;
|
||||||
@ -1344,7 +1313,7 @@ bool BotDatabase::DeleteItemBySlot(const uint32 bot_id, const uint32 slot_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_inventories` WHERE `bot_id` = '%u' AND `slot_id` = '%u'", bot_id, slot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1361,7 +1330,7 @@ bool BotDatabase::LoadEquipmentColor(const uint32 bot_id, const uint8 material_s
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `inst_color` FROM `bot_inventories` WHERE `bot_id` = '%u' AND `slot_id` = '%u' LIMIT 1", bot_id, slot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -1397,7 +1366,7 @@ bool BotDatabase::SaveEquipmentColor(const uint32 bot_id, const int16 slot_id, c
|
|||||||
bot_id,
|
bot_id,
|
||||||
where_clause.c_str()
|
where_clause.c_str()
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1412,7 +1381,7 @@ bool BotDatabase::LoadPetIndex(const uint32 bot_id, uint32& pet_index)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `pets_index` FROM `bot_pets` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -1430,7 +1399,7 @@ bool BotDatabase::LoadPetSpellID(const uint32 bot_id, uint32& pet_spell_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `spell_id` FROM `bot_pets` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -1454,7 +1423,7 @@ bool BotDatabase::LoadPetStats(const uint32 bot_id, std::string& pet_name, uint3
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("SELECT `spell_id`, `name`, `mana`, `hp` FROM `bot_pets` WHERE `pets_index` = '%u' LIMIT 1", saved_pet_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -1502,7 +1471,7 @@ bool BotDatabase::SavePetStats(const uint32 bot_id, const std::string& pet_name,
|
|||||||
pet_mana,
|
pet_mana,
|
||||||
pet_hp
|
pet_hp
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
DeletePetStats(bot_id);
|
DeletePetStats(bot_id);
|
||||||
return false;
|
return false;
|
||||||
@ -1523,7 +1492,7 @@ bool BotDatabase::DeletePetStats(const uint32 bot_id)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_pets` WHERE `pets_index` = '%u'", saved_pet_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1542,7 +1511,7 @@ bool BotDatabase::LoadPetBuffs(const uint32 bot_id, SpellBuff_Struct* pet_buffs)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("SELECT `spell_id`, `caster_level`, `duration` FROM `bot_pet_buffs` WHERE `pets_index` = '%u'", saved_pet_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
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].level,
|
||||||
pet_buffs[buff_index].duration
|
pet_buffs[buff_index].duration
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
DeletePetBuffs(bot_id);
|
DeletePetBuffs(bot_id);
|
||||||
return false;
|
return false;
|
||||||
@ -1630,7 +1599,7 @@ bool BotDatabase::DeletePetBuffs(const uint32 bot_id)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_pet_buffs` WHERE `pets_index` = '%u'", saved_pet_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1649,7 +1618,7 @@ bool BotDatabase::LoadPetItems(const uint32 bot_id, uint32* pet_items)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("SELECT `item_id` FROM `bot_pet_inventories` WHERE `pets_index` = '%u'", saved_pet_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -1685,7 +1654,7 @@ bool BotDatabase::SavePetItems(const uint32 bot_id, const uint32* pet_items, boo
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO `bot_pet_inventories` (`pets_index`, `item_id`) VALUES ('%u', '%u')", saved_pet_index, pet_items[item_index]);
|
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()) {
|
if (!results.Success()) {
|
||||||
DeletePetItems(bot_id);
|
DeletePetItems(bot_id);
|
||||||
return false;
|
return false;
|
||||||
@ -1707,7 +1676,7 @@ bool BotDatabase::DeletePetItems(const uint32 bot_id)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_pet_inventories` WHERE `pets_index` = '%u'", saved_pet_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1722,7 +1691,7 @@ bool BotDatabase::LoadInspectMessage(const uint32 bot_id, InspectMessage_Struct&
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `inspect_message` FROM `bot_inspect_messages` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -1755,7 +1724,7 @@ bool BotDatabase::SaveInspectMessage(const uint32 bot_id, const InspectMessage_S
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO `bot_inspect_messages` (`bot_id`, `inspect_message`) VALUES ('%u', '%s')", bot_id, bot_message.c_str());
|
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()) {
|
if (!results.Success()) {
|
||||||
DeleteInspectMessage(bot_id);
|
DeleteInspectMessage(bot_id);
|
||||||
return false;
|
return false;
|
||||||
@ -1770,7 +1739,7 @@ bool BotDatabase::DeleteInspectMessage(const uint32 bot_id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_inspect_messages` WHERE `bot_id` = '%u'", bot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1792,7 +1761,7 @@ bool BotDatabase::SaveAllInspectMessages(const uint32 owner_id, const InspectMes
|
|||||||
return true;
|
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);
|
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()) {
|
if (!results.Success()) {
|
||||||
DeleteAllInspectMessages(owner_id);
|
DeleteAllInspectMessages(owner_id);
|
||||||
return false;
|
return false;
|
||||||
@ -1807,7 +1776,7 @@ bool BotDatabase::DeleteAllInspectMessages(const uint32 owner_id)
|
|||||||
return false;
|
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);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
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,
|
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
|
slot_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1855,7 +1824,7 @@ bool BotDatabase::SaveAllArmorColors(const uint32 owner_id, const uint32 rgb_val
|
|||||||
rgb_value,
|
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
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1876,7 +1845,7 @@ bool BotDatabase::SaveHelmAppearance(const uint32 owner_id, const uint32 bot_id,
|
|||||||
owner_id,
|
owner_id,
|
||||||
bot_id
|
bot_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1895,7 +1864,7 @@ bool BotDatabase::SaveAllHelmAppearances(const uint32 owner_id, const bool show_
|
|||||||
(show_flag ? 1 : 0),
|
(show_flag ? 1 : 0),
|
||||||
owner_id
|
owner_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1915,7 +1884,7 @@ bool BotDatabase::ToggleHelmAppearance(const uint32 owner_id, const uint32 bot_i
|
|||||||
owner_id,
|
owner_id,
|
||||||
bot_id
|
bot_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1933,7 +1902,7 @@ bool BotDatabase::ToggleAllHelmAppearances(const uint32 owner_id)
|
|||||||
" WHERE `owner_id` = '%u'",
|
" WHERE `owner_id` = '%u'",
|
||||||
owner_id
|
owner_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1954,7 +1923,7 @@ bool BotDatabase::SaveFollowDistance(const uint32 owner_id, const uint32 bot_id,
|
|||||||
owner_id,
|
owner_id,
|
||||||
bot_id
|
bot_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1973,7 +1942,7 @@ bool BotDatabase::SaveAllFollowDistances(const uint32 owner_id, const uint32 fol
|
|||||||
follow_distance,
|
follow_distance,
|
||||||
owner_id
|
owner_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2091,7 +2060,7 @@ bool BotDatabase::CreateCloneBot(const uint32 owner_id, const uint32 bot_id, con
|
|||||||
owner_id,
|
owner_id,
|
||||||
bot_id
|
bot_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2152,7 +2121,7 @@ bool BotDatabase::CreateCloneBotInventory(const uint32 owner_id, const uint32 bo
|
|||||||
owner_id,
|
owner_id,
|
||||||
bot_id
|
bot_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
DeleteItems(clone_id);
|
DeleteItems(clone_id);
|
||||||
return false;
|
return false;
|
||||||
@ -2175,7 +2144,7 @@ bool BotDatabase::SaveStopMeleeLevel(const uint32 owner_id, const uint32 bot_id,
|
|||||||
owner_id,
|
owner_id,
|
||||||
bot_id
|
bot_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2192,12 +2161,12 @@ bool BotDatabase::LoadOwnerOptions(Client *owner)
|
|||||||
" WHERE `owner_id` = '%u'",
|
" WHERE `owner_id` = '%u'",
|
||||||
owner->CharacterID()
|
owner->CharacterID()
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount()) {
|
if (!results.RowCount()) {
|
||||||
query = StringFormat("REPLACE INTO `bot_owner_options` (`owner_id`) VALUES ('%u')", owner->CharacterID());
|
query = StringFormat("REPLACE INTO `bot_owner_options` (`owner_id`) VALUES ('%u')", owner->CharacterID());
|
||||||
results = QueryDatabase(query);
|
results = database.QueryDatabase(query);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2221,7 +2190,7 @@ bool BotDatabase::SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool
|
|||||||
(flag == true ? 1 : 0),
|
(flag == true ? 1 : 0),
|
||||||
owner_id
|
owner_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2240,7 +2209,7 @@ bool BotDatabase::SaveOwnerOptionStatsUpdate(const uint32 owner_id, const bool f
|
|||||||
(flag == true ? 1 : 0),
|
(flag == true ? 1 : 0),
|
||||||
owner_id
|
owner_id
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2255,7 +2224,7 @@ bool BotDatabase::QueryBotGroupExistence(const std::string& group_name, bool& ex
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `group_name` FROM `vw_bot_groups` WHERE `group_name` LIKE '%s' LIMIT 1", group_name.c_str());
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2272,7 +2241,7 @@ bool BotDatabase::LoadBotGroupIDByBotGroupName(const std::string& group_name, ui
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `groups_index` FROM `bot_groups` WHERE `group_name` = '%s' LIMIT 1", group_name.c_str());
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2290,7 +2259,7 @@ bool BotDatabase::LoadBotGroupIDByLeaderID(const uint32 leader_id, uint32& botgr
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `groups_index` FROM `bot_groups` WHERE `group_leader_id` = '%u' LIMIT 1", leader_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2308,7 +2277,7 @@ bool BotDatabase::LoadBotGroupIDByMemberID(const uint32 member_id, uint32& botgr
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `groups_index` FROM `bot_group_members` WHERE `bot_id` = '%u' LIMIT 1", member_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2326,7 +2295,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupName(const std::string& group_name, uint
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `group_leader_id` FROM `bot_groups` WHERE `group_name` = '%s' LIMIT 1", group_name.c_str());
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2344,7 +2313,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupID(const uint32 group_id, uint32& leader
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `group_leader_id` FROM `bot_groups` WHERE `groups_index` = '%u' LIMIT 1", group_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2362,7 +2331,7 @@ bool BotDatabase::LoadBotGroupNameByBotGroupID(const uint32 group_id, std::strin
|
|||||||
false;
|
false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `group_name` FROM `bot_groups` WHERE `groups_index` = '%u' LIMIT 1", group_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2380,7 +2349,7 @@ bool BotDatabase::LoadBotGroupNameByLeaderID(const uint32 leader_id, std::string
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `group_name` FROM `bot_groups` WHERE `group_leader_id` = '%u' LIMIT 1", leader_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2404,7 +2373,7 @@ bool BotDatabase::CreateBotGroup(const std::string& group_name, const uint32 lea
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO `bot_groups` (`group_leader_id`, `group_name`) VALUES ('%u', '%s')", leader_id, group_name.c_str());
|
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()) {
|
if (!results.Success()) {
|
||||||
DeleteBotGroup(leader_id);
|
DeleteBotGroup(leader_id);
|
||||||
return false;
|
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);
|
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()) {
|
if (!results.Success()) {
|
||||||
RemoveMemberFromBotGroup(leader_id);
|
RemoveMemberFromBotGroup(leader_id);
|
||||||
return false;
|
return false;
|
||||||
@ -2438,12 +2407,12 @@ bool BotDatabase::DeleteBotGroup(const uint32 leader_id)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_group_members` WHERE `groups_index` = '%u'", botgroup_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_groups` WHERE `groups_index` = '%u'", botgroup_id);
|
query = StringFormat("DELETE FROM `bot_groups` WHERE `groups_index` = '%u'", botgroup_id);
|
||||||
results = QueryDatabase(query);
|
results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2462,7 +2431,7 @@ bool BotDatabase::AddMemberToBotGroup(const uint32 leader_id, const uint32 membe
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO `bot_group_members` (`groups_index`, `bot_id`) VALUES ('%u', '%u')", botgroup_id, member_id);
|
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()) {
|
if (!results.Success()) {
|
||||||
RemoveMemberFromBotGroup(member_id);
|
RemoveMemberFromBotGroup(member_id);
|
||||||
return false;
|
return false;
|
||||||
@ -2483,7 +2452,7 @@ bool BotDatabase::RemoveMemberFromBotGroup(const uint32 member_id)
|
|||||||
return DeleteBotGroup(member_id);
|
return DeleteBotGroup(member_id);
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_group_members` WHERE `bot_id` = '%u'", 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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2496,7 +2465,7 @@ bool BotDatabase::LoadBotGroupIDForLoadBotGroup(const uint32 owner_id, const std
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `groups_index`, `group_name` FROM `vw_bot_groups` WHERE `owner_id` = '%u'", owner_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2524,7 +2493,7 @@ bool BotDatabase::LoadBotGroup(const std::string& group_name, std::map<uint32, s
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("SELECT `bot_id` FROM `bot_group_members` WHERE `groups_index` = '%u' LIMIT 6", botgroup_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2542,7 +2511,7 @@ bool BotDatabase::LoadBotGroupsListByOwnerID(const uint32 owner_id, std::list<st
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `group_name`, `group_leader_name` FROM `vw_bot_groups` WHERE `owner_id` = '%u'", owner_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2575,7 +2544,7 @@ bool BotDatabase::LoadGroupedBotsByGroupID(const uint32 owner_id, const uint32 g
|
|||||||
owner_id
|
owner_id
|
||||||
);
|
);
|
||||||
|
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2595,7 +2564,7 @@ bool BotDatabase::LoadHealRotationIDByBotID(const uint32 bot_id, uint32& hr_inde
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `heal_rotation_index` FROM `bot_heal_rotations` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2642,7 +2611,7 @@ bool BotDatabase::LoadHealRotation(Bot* hr_member, std::list<uint32>& member_lis
|
|||||||
" LIMIT 1",
|
" LIMIT 1",
|
||||||
hr_index
|
hr_index
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2681,7 +2650,7 @@ bool BotDatabase::LoadHealRotationMembers(const uint32 hr_index, std::list<uint3
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `bot_id` FROM `bot_heal_rotation_members` WHERE `heal_rotation_index` = '%u'", hr_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
if (!results.RowCount())
|
||||||
@ -2701,7 +2670,7 @@ bool BotDatabase::LoadHealRotationTargets(const uint32 hr_index, std::list<std::
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("SELECT `target_name` FROM `bot_heal_rotation_targets` WHERE `heal_rotation_index` = '%u'", hr_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
if (!results.RowCount())
|
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_CHAIN)),
|
||||||
((*hr_member->MemberOfHealRotation())->ArmorTypeCriticalHPRatio(ARMOR_TYPE_PLATE))
|
((*hr_member->MemberOfHealRotation())->ArmorTypeCriticalHPRatio(ARMOR_TYPE_PLATE))
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2792,7 +2761,7 @@ bool BotDatabase::SaveHealRotation(Bot* hr_member, bool& member_fail, bool& targ
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO `bot_heal_rotation_members` (`heal_rotation_index`, `bot_id`) VALUES ('%u', '%u')", hr_index, member_iter->GetBotID());
|
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()) {
|
if (!results.Success()) {
|
||||||
member_fail = true;
|
member_fail = true;
|
||||||
break;
|
break;
|
||||||
@ -2806,7 +2775,7 @@ bool BotDatabase::SaveHealRotation(Bot* hr_member, bool& member_fail, bool& targ
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO `bot_heal_rotation_targets` (`heal_rotation_index`, `target_name`) VALUES ('%u', '%s')", hr_index, target_iter->GetCleanName());
|
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()) {
|
if (!results.Success()) {
|
||||||
target_fail = true;
|
target_fail = true;
|
||||||
break;
|
break;
|
||||||
@ -2828,17 +2797,17 @@ bool BotDatabase::DeleteHealRotation(const uint32 creator_id)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_heal_rotation_targets` WHERE `heal_rotation_index` = '%u'", hr_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_heal_rotation_members` WHERE `heal_rotation_index` = '%u'", hr_index);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
query = StringFormat("DELETE FROM `bot_heal_rotations` WHERE `heal_rotation_index` = '%u'", hr_index);
|
query = StringFormat("DELETE FROM `bot_heal_rotations` WHERE `heal_rotation_index` = '%u'", hr_index);
|
||||||
results = QueryDatabase(query);
|
results = database.QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2851,7 +2820,7 @@ bool BotDatabase::DeleteAllHealRotations(const uint32 owner_id)
|
|||||||
return false;
|
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);
|
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())
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@ -22,17 +22,15 @@
|
|||||||
|
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
|
|
||||||
#include "../common/dbcore.h"
|
|
||||||
#include "../common/eq_packet_structs.h"
|
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
class Bot;
|
class Bot;
|
||||||
struct BotsAvailableList;
|
|
||||||
class Client;
|
class Client;
|
||||||
|
struct BotsAvailableList;
|
||||||
|
struct InspectMessage_Struct;
|
||||||
|
|
||||||
namespace EQEmu
|
namespace EQEmu
|
||||||
{
|
{
|
||||||
@ -41,15 +39,9 @@ namespace EQEmu
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class BotDatabase : public DBcore
|
class BotDatabase
|
||||||
{
|
{
|
||||||
public:
|
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 LoadBotCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &bot_command_settings);
|
||||||
bool LoadBotSpellCastingChances();
|
bool LoadBotSpellCastingChances();
|
||||||
|
|
||||||
@ -297,8 +289,6 @@ public:
|
|||||||
std::string query;
|
std::string query;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern BotDatabase botdb;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // BOTS
|
#endif // BOTS
|
||||||
|
|||||||
@ -2668,7 +2668,7 @@ uint8 Bot::GetChanceToCastBySpellType(uint32 spellType)
|
|||||||
type_index |= pD;
|
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
|
#endif
|
||||||
|
|||||||
@ -1528,7 +1528,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
botdb.LoadOwnerOptions(this);
|
database.botdb.LoadOwnerOptions(this);
|
||||||
// TODO: mod below function for loading spawned botgroups
|
// TODO: mod below function for loading spawned botgroups
|
||||||
Bot::LoadAndSpawnAllZonedBots(this);
|
Bot::LoadAndSpawnAllZonedBots(this);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
18
zone/net.cpp
18
zone/net.cpp
@ -54,7 +54,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "command.h"
|
#include "command.h"
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
#include "bot_command.h"
|
#include "bot_command.h"
|
||||||
#include "bot_database.h"
|
|
||||||
#endif
|
#endif
|
||||||
#include "zone_config.h"
|
#include "zone_config.h"
|
||||||
#include "titles.h"
|
#include "titles.h"
|
||||||
@ -238,18 +237,6 @@ int main(int argc, char** argv) {
|
|||||||
return 1;
|
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 */
|
/* Register Log System and Settings */
|
||||||
LogSys.SetGMSayHandler(&Zone::GMSayHookCallBackProcess);
|
LogSys.SetGMSayHandler(&Zone::GMSayHookCallBackProcess);
|
||||||
database.LoadLogSettings(LogSys.log_settings);
|
database.LoadLogSettings(LogSys.log_settings);
|
||||||
@ -396,7 +383,7 @@ int main(int argc, char** argv) {
|
|||||||
Log(Logs::General, Logs::Zone_Server, "%d bot commands loaded", botretval);
|
Log(Logs::General, Logs::Zone_Server, "%d bot commands loaded", botretval);
|
||||||
|
|
||||||
Log(Logs::General, Logs::Zone_Server, "Loading bot spell casting chances");
|
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");
|
Log(Logs::General, Logs::Error, "Bot spell casting chances loading FAILED");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -572,9 +559,6 @@ int main(int argc, char** argv) {
|
|||||||
if (InterserverTimer.Check()) {
|
if (InterserverTimer.Check()) {
|
||||||
InterserverTimer.Start();
|
InterserverTimer.Start();
|
||||||
database.ping();
|
database.ping();
|
||||||
#ifdef BOTS
|
|
||||||
botdb.ping();
|
|
||||||
#endif
|
|
||||||
entity_list.UpdateWho();
|
entity_list.UpdateWho();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2181,7 +2181,7 @@ bool QuestManager::createBot(const char *name, const char *lastname, uint8 level
|
|||||||
|
|
||||||
std::string test_name = name;
|
std::string test_name = name;
|
||||||
bool available_flag = false;
|
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);
|
initiator->Message(0, "%s for '%s'", BotDatabase::fail::QueryNameAvailablity(), (char*)name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,10 @@
|
|||||||
#include "aa_ability.h"
|
#include "aa_ability.h"
|
||||||
#include "event_codes.h"
|
#include "event_codes.h"
|
||||||
|
|
||||||
|
#ifdef BOTS
|
||||||
|
#include "bot_database.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
class Corpse;
|
class Corpse;
|
||||||
class Merc;
|
class Merc;
|
||||||
@ -549,6 +553,11 @@ public:
|
|||||||
/* Things which really dont belong here... */
|
/* Things which really dont belong here... */
|
||||||
int16 CommandRequirement(const char* commandname);
|
int16 CommandRequirement(const char* commandname);
|
||||||
|
|
||||||
|
#ifdef BOTS
|
||||||
|
// bot database add-on to eliminate the need for a second database connection
|
||||||
|
BotDatabase botdb;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ZDBInitVars();
|
void ZDBInitVars();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user