[Bots] Cleanup and remove preprocessors. (#2757)

* [Bots] Cleanup and remove preprocessors.

- Removes every `#ifdef BOTS` we have and locks bots behind `Bots:AllowBots` rule.
- Bot updates are now done by default similar to regular database updates.
- Modify `CMakeLists.txt`, `.drone.yml`, and `BUILD.md` to match the removal of `EQEMU_ENABLE_BOTS`.

* Cleanup

- Add SQL for enabling bots for servers with bots.
- Add message that tells players/operators bots are disabled.

* Suggested changes.

* Bot injection stuff

* Change SQL to bot SQL.

* Tweaks

* Remove `is_bot`

* Update version.h

* Update main.cpp

* Update database.cpp

* Fix name availability crash

* Remove bots from update script

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Alex King 2023-01-20 13:35:33 -05:00 committed by GitHub
parent 1f0b2a8991
commit 3335cacac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
91 changed files with 263 additions and 1150 deletions

View File

@ -19,7 +19,7 @@ steps:
commands:
- sudo chown eqemu:eqemu /drone/src/ * -R
- sudo chown eqemu:eqemu /home/eqemu/.ccache/ * -R
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LUA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="-O0 -g -DNDEBUG" -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="-O0 -g -DNDEBUG" -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
- curl https://raw.githubusercontent.com/Akkadius/eqemu-install-v2/master/eqemu_config.json --output eqemu_config.json
- ./bin/tests
volumes:

View File

@ -40,14 +40,14 @@ Assuming it is starting in c:/projects/eqemu and the x64 dependencies were extra
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_ZLIB=ON -DEQEMU_ENABLE_BOTS=ON -DCMAKE_TOOLCHAIN_FILE="c:/projects/eqemu/vcpkg/vcpkg-export-20180828-145455/scripts/buildsystems/vcpkg.cmake" ..
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_ZLIB=ON -DCMAKE_TOOLCHAIN_FILE="c:/projects/eqemu/vcpkg/vcpkg-export-20180828-145455/scripts/buildsystems/vcpkg.cmake" ..
##### Linux
Similarly to Windows running CMake on Linux is simple it just omits the toolchain file and uses a different generator.
mkdir build
cd build
cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LOGIN=ON ..
cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON ..
### Building

View File

@ -122,7 +122,6 @@ ENDIF()
MESSAGE(STATUS "**************************************************")
#options
OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF)
OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
@ -176,10 +175,6 @@ IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
ENDIF(EQEMU_COMMANDS_LOGGING)
IF(EQEMU_ENABLE_BOTS)
ADD_DEFINITIONS(-DBOTS)
ENDIF(EQEMU_ENABLE_BOTS)
#database
IF(MySQL_FOUND AND MariaDB_FOUND)
SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:

View File

@ -395,11 +395,6 @@ bool Database::DeleteCharacter(char *character_name)
return false;
}
#ifdef BOTS
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", character_id); // note: only use of GetMobTypeById()
QueryDatabase(query);
#endif
std::string delete_type = "hard-deleted";
if (RuleB(Character, SoftDeletes)) {
delete_type = "soft-deleted";
@ -418,21 +413,26 @@ bool Database::DeleteCharacter(char *character_name)
QueryDatabase(query);
#ifdef BOTS
query = fmt::format(
SQL(
UPDATE
bot_data
SET
name = SUBSTRING(CONCAT(name, '-deleted-', UNIX_TIMESTAMP()), 1, 64)
WHERE
owner_id = '{}'
),
character_id
);
QueryDatabase(query);
LogInfo("character_name [{}] ({}) bots are being [{}]", character_name, character_id, delete_type);
#endif
if (RuleB(Bots, Enabled)) {
query = fmt::format(
SQL(
UPDATE
bot_data
SET
name = SUBSTRING(CONCAT(name, '-deleted-', UNIX_TIMESTAMP()), 1, 64)
WHERE
owner_id = '{}'
),
character_id
);
QueryDatabase(query);
LogInfo(
"[DeleteCharacter] character_name [{}] ({}) bots are being [{}]",
character_name,
character_id,
delete_type
);
}
return true;
}

View File

@ -476,6 +476,12 @@ bool Database::CheckDatabaseConversions() {
CheckDatabaseConvertPPDeblob();
CheckDatabaseConvertCorpseDeblob();
RuleManager::Instance()->LoadRules(this, "default", false);
if (!RuleB(Bots, Enabled) && DoesTableExist("bot_data")) {
LogInfo("Bot tables found but rule not enabled, enabling");
RuleManager::Instance()->SetRule("Bots:Enabled", "true", this, true, true);
}
/* Run EQEmu Server script (Checks for database updates) */
const std::string file = fmt::format("{}/eqemu_server.pl", path.GetServerPath());

View File

@ -408,9 +408,7 @@ namespace DatabaseSchema {
"bot_spell_settings",
"bot_spells_entries",
"bot_stances",
"bot_timers",
"vw_bot_character_mobs",
"vw_bot_groups"
"bot_timers"
};
}

View File

@ -528,6 +528,8 @@ void EQEmuLogSys::SilenceConsoleLogging()
log_settings[log_index].log_to_console = 0;
log_settings[log_index].is_category_enabled = 0;
}
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
}
/**

View File

@ -866,20 +866,11 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) {
return(true);
}
//factored out so I dont have to copy this crap.
#ifdef BOTS
#define GuildMemberBaseQuery \
"SELECT c.`id`, c.`name`, c.`class`, c.`level`, c.`last_login`, c.`zone_id`," \
" g.`guild_id`, g.`rank`, g.`tribute_enable`, g.`total_tribute`, g.`last_tribute`," \
" g.`banker`, g.`public_note`, g.`alt`" \
" FROM `vw_bot_character_mobs` AS c LEFT JOIN `vw_guild_members` AS g ON c.`id` = g.`char_id` AND c.`mob_type` = g.`mob_type` "
#else
#define GuildMemberBaseQuery \
"SELECT c.`id`, c.`name`, c.`class`, c.`level`, c.`last_login`, c.`zone_id`," \
" g.`guild_id`, g.`rank`, g.`tribute_enable`, g.`total_tribute`, g.`last_tribute`," \
" g.`banker`, g.`public_note`, g.`alt` " \
" FROM `character_data` AS c LEFT JOIN `guild_members` AS g ON c.`id` = g.`char_id` "
#endif
static void ProcessGuildMember(MySQLRequestRow row, CharGuildInfo &into) {
//fields from `characer_`
into.char_id = atoi(row[0]);
@ -969,13 +960,8 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) {
}
//load up the rank info for each guild.
std::string query;
#ifdef BOTS
query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.mob_type = 'C' AND c.deleted_at IS NULL", char_id);
#else
query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.deleted_at IS NULL", char_id);
#endif
auto results = m_db->QueryDatabase(query);
std::string query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.deleted_at IS NULL", char_id);
auto results = m_db->QueryDatabase(query);
if (!results.Success()) {
return false;
}

View File

@ -20,7 +20,14 @@ void PathManager::LoadPaths()
{
m_server_path = File::FindEqemuConfigPath();
std::filesystem::current_path(m_server_path);
if (!m_server_path.empty()) {
std::filesystem::current_path(m_server_path);
}
if (m_server_path.empty()) {
LogInfo("Failed to load server path");
return;
}
LogInfo("server [{}]", m_server_path);

View File

@ -585,9 +585,8 @@ RULE_INT(Range, CriticalDamage, 80, "The packet range in which critical hit mess
RULE_INT(Range, MobCloseScanDistance, 600, "Close scan distance")
RULE_CATEGORY_END()
#ifdef BOTS
RULE_CATEGORY(Bots)
RULE_BOOL(Bots, Enabled, false, "Enable of disable bot functionality, default is false")
RULE_INT(Bots, BotExpansionSettings, 16383, "Sets the expansion settings for bot use. Defaults to all expansions enabled up to TSS")
RULE_BOOL(Bots, AllowCamelCaseNames, false, "Allows the use of 'MyBot' type names")
RULE_BOOL(Bots, AllowBotEquipAnyRaceGear, false, "Allows Bots to wear Equipment even if their race is not valid")
@ -616,7 +615,6 @@ RULE_BOOL(Bots, ResurrectionSickness, true, "Use Resurrection Sickness based on
RULE_INT(Bots, OldResurrectionSicknessSpell, 757, "757 is Default Old Resurrection Sickness Spell")
RULE_INT(Bots, ResurrectionSicknessSpell, 756, "756 is Default Resurrection Sickness Spell")
RULE_CATEGORY_END()
#endif
RULE_CATEGORY(Chat)
RULE_BOOL(Chat, ServerWideOOC, true, "Enable server wide ooc-chat")

View File

@ -35,12 +35,7 @@
*/
#define CURRENT_BINARY_DATABASE_VERSION 9217
#ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9035
#else
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
#endif
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9036
#define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__

View File

@ -430,11 +430,6 @@ sub build_linux_source
$cmake_options = "";
$source_folder_post_fix = "";
if ($build_options =~ /bots/i) {
$cmake_options .= " -DEQEMU_ENABLE_BOTS=ON";
$source_folder_post_fix = "_bots";
}
$current_directory = `pwd`;
@directories = split('/', $current_directory);
foreach my $val (@directories) {
@ -565,11 +560,7 @@ sub do_installer_routines
fetch_peq_db_full();
print "[Database] Fetching and Applying Latest Database Updates...\n";
main_db_management();
# if bots
if ($build_options =~ /bots/i) {
bots_db_management();
}
bots_db_management();
remove_duplicate_rule_values();
@ -1035,8 +1026,6 @@ sub show_menu_prompt
print ">>> Windows\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_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 " [setup_loginserver] Sets up loginserver for Windows\n";
}
@ -1096,10 +1085,6 @@ sub show_menu_prompt
fetch_latest_windows_appveyor();
$dc = 1;
}
elsif ($input eq "windows_server_latest_bots") {
fetch_latest_windows_appveyor_bots();
$dc = 1;
}
elsif ($input eq "fetch_dlls") {
fetch_server_dlls();
$dc = 1;
@ -1124,10 +1109,6 @@ sub show_menu_prompt
new_server();
$dc = 1;
}
elsif ($input eq "new_server_with_bots") {
new_server("bots");
$dc = 1;
}
elsif ($input eq "setup_bots") {
setup_bots();
$dc = 1;

View File

@ -34,6 +34,7 @@
9033|2022_11_19_bot_spell_settings.sql|SHOW TABLES LIKE 'bot_spell_settings'|empty|
9034|2022_12_02_bot_spell_settings.sql|SHOW COLUMNS FROM `bot_data` LIKE 'enforce_spell_settings'|empty|
9035|2022_12_04_bot_archery.sql|SHOW COLUMNS FROM `bot_data` LIKE 'archery_setting'|empty|
9036|2023_01_19_drop_bot_views.sql|SHOW TABLES LIKE 'vw_groups'|not_empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1,6 @@
DROP VIEW vw_bot_groups;
DROP VIEW vw_bot_character_mobs;
DROP VIEW vw_groups;
DROP VIEW vw_guild_members;
DROP TABLE bot_guild_members;

View File

@ -77,26 +77,27 @@ void WorldBoot::GMSayHookCallBackProcessWorld(uint16 log_category, const char *f
bool WorldBoot::HandleCommandInput(int argc, char **argv)
{
// database version
uint32 database_version = CURRENT_BINARY_DATABASE_VERSION;
uint32 bots_database_version = CURRENT_BINARY_BOTS_DATABASE_VERSION;
if (argc >= 2) {
if (strcasecmp(argv[1], "db_version") == 0) {
std::cout << "Binary Database Version: " << database_version << " : " << bots_database_version << std::endl;
return true;
}
}
// command handler
if (argc > 1) {
LogSys.SilenceConsoleLogging();
path.LoadPaths();
WorldConfig::LoadConfig();
LoadDatabaseConnections();
RuleManager::Instance()->LoadRules(&database, "default", false);
LogSys.EnableConsoleLogging();
WorldserverCLI::CommandHandler(argc, argv);
}
// database version
uint32 database_version = CURRENT_BINARY_DATABASE_VERSION;
uint32 bots_database_version = RuleB(Bots, Enabled) ? CURRENT_BINARY_BOTS_DATABASE_VERSION : 0;
if (argc >= 2) {
if (strcasecmp(argv[1], "db_version") == 0) {
std::cout << "Binary Database Version: " << database_version << " : " << bots_database_version << std::endl;
return true;
}
}
return false;
}

View File

@ -36,9 +36,7 @@ Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
#include "zonedb.h"
#include "../common/zone_store.h"
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;
@ -1596,13 +1594,11 @@ bool Mob::CanUseAlternateAdvancementRank(AA::Rank *rank) {
return false;
}
}
#ifdef BOTS
else if (IsBot()) {
if (rank->expansion && !(CastToBot()->GetExpansionBitmask() & (1 << (rank->expansion - 1)))) {
return false;
}
}
#endif
else {
if (rank->expansion && !(RuleI(World, ExpansionSettings) & (1 << (rank->expansion - 1)))) {
return false;

View File

@ -27,9 +27,7 @@
#include "entity.h"
#include "mob.h"
#ifdef BOTS
#include "bot.h"
#endif
#include "map.h"
#include "water_map.h"
@ -818,14 +816,15 @@ type', in which case, the answer is yes.
}
}
#ifdef BOTS
// this is HIGHLY inefficient
bool HasRuleDefined = false;
bool IsBotAttackAllowed = false;
IsBotAttackAllowed = Bot::IsBotAttackAllowed(mob1, mob2, HasRuleDefined);
if(HasRuleDefined)
return IsBotAttackAllowed;
#endif //BOTS
if (RuleB(Bots, Enabled)) {
// this is HIGHLY inefficient
bool HasRuleDefined = false;
bool IsBotAttackAllowed = false;
IsBotAttackAllowed = Bot::IsBotAttackAllowed(mob1, mob2, HasRuleDefined);
if (HasRuleDefined) {
return IsBotAttackAllowed;
}
}
// we fell through, now we swap the 2 mobs and run through again once more
tempmob = mob1;
@ -905,10 +904,8 @@ bool Mob::IsBeneficialAllowed(Mob *target)
{
return false;
}
#ifdef BOTS
else if(mob2->IsBot())
return true;
#endif
}
else if(_NPC(mob1))
{

View File

@ -36,15 +36,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "mob.h"
#include "npc.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <boost/concept_check.hpp>
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;
extern WorldServer worldserver;
@ -921,11 +915,7 @@ int Mob::ACSum(bool skip_caps)
if (ac < 0)
ac = 0;
if (!skip_caps && (IsClient()
#ifdef BOTS
|| IsBot()
#endif
)) {
if (!skip_caps && (IsClient() || IsBot())) {
auto softcap = GetACSoftcap();
auto returns = GetSoftcapReturns();
int total_aclimitmod = aabonuses.CombatStability + itembonuses.CombatStability + spellbonuses.CombatStability;
@ -1455,7 +1445,6 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts, boo
hit.damage_done = 0;
}
#ifdef BOTS
if (IsBot()) {
const auto export_string = fmt::format(
"{} {}",
@ -1464,7 +1453,6 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts, boo
);
parse->EventBot(EVENT_USE_SKILL, CastToBot(), nullptr, export_string, 0);
}
#endif
}
}
@ -1820,11 +1808,9 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
}
killerMob->TrySpellOnKill(killed_level, spell);
#ifdef BOTS
} else if (killerMob->IsBot()) {
parse->EventBot(EVENT_SLAY, killerMob->CastToBot(), this, "", 0);
killerMob->TrySpellOnKill(killed_level, spell);
#endif
}
if (
@ -1910,10 +1896,8 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
exploss = 0;
} else if (killerMob->GetOwner() && killerMob->GetOwner()->IsClient()) {
exploss = 0;
#ifdef BOTS
} else if (killerMob->IsBot()) {
exploss = 0;
#endif
}
}
@ -2362,7 +2346,6 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
return false;
}
#ifdef BOTS
} else if (IsBot()) {
if (parse->EventBot(EVENT_DEATH, CastToBot(), oos, export_string, 0) != 0) {
if (GetHP() < 0) {
@ -2371,7 +2354,6 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
return false;
}
#endif
}
if (killer_mob && (killer_mob->IsClient() || killer_mob->IsBot()) && (spell != SPELL_UNKNOWN) && damage > 0) {
@ -2466,11 +2448,9 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
give_exp = give_exp->GetUltimateOwner();
#ifdef BOTS
if (!RuleB(Bots, BotGroupXP) && !ownerInGroup) {
give_exp = nullptr;
}
#endif //BOTS
}
if (give_exp && give_exp->IsTempPet() && give_exp->IsPetOwnerClient()) {
@ -2778,12 +2758,10 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
}
}
#ifdef BOTS
if (killer_mob->IsBot()) {
parse->EventBot(EVENT_NPC_SLAY, killer_mob->CastToBot(), this, "", 0);
killer_mob->TrySpellOnKill(killed_level, spell);
}
#endif
WipeHateList();
p_depop = true;
@ -2918,32 +2896,33 @@ void Mob::AddToHateList(Mob* other, int64 hate /*= 0*/, int64 damage /*= 0*/, bo
if (other->IsClient() && !on_hatelist && !IsOnFeignMemory(other))
other->CastToClient()->AddAutoXTarget(this);
#ifdef BOTS
// if other is a bot, add the bots client to the hate list
while (other->IsBot()) {
if (RuleB(Bots, Enabled)) {
while (other->IsBot()) {
auto other_ = other->CastToBot();
if (!other_ || !other_->GetBotOwner()) {
break;
}
auto owner_ = other_->GetBotOwner()->CastToClient();
if (!owner_ || owner_->IsDead() ||
!owner_->InZone()) { // added isdead and inzone checks to avoid issues in AddAutoXTarget(...) below
break;
}
if (owner_->GetFeigned()) {
AddFeignMemory(owner_);
}
else if (!hate_list.IsEntOnHateList(owner_)) {
hate_list.AddEntToHateList(owner_, 0, 0, false, true);
owner_->AddAutoXTarget(this); // this was being called on dead/out-of-zone clients
}
auto other_ = other->CastToBot();
if (!other_ || !other_->GetBotOwner()) {
break;
}
auto owner_ = other_->GetBotOwner()->CastToClient();
if (!owner_ || owner_->IsDead() || !owner_->InZone()) { // added isdead and inzone checks to avoid issues in AddAutoXTarget(...) below
break;
}
if (owner_->GetFeigned()) {
AddFeignMemory(owner_);
}
else if (!hate_list.IsEntOnHateList(owner_)) {
hate_list.AddEntToHateList(owner_, 0, 0, false, true);
owner_->AddAutoXTarget(this); // this was being called on dead/out-of-zone clients
}
break;
}
#endif //BOTS
// if other is a merc, add the merc client to the hate list
if (other->IsMerc()) {
@ -4771,12 +4750,10 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
return;
}
#ifdef BOTS
if (IsPet() && GetOwner() && GetOwner()->IsBot()) {
TryPetCriticalHit(defender, hit);
return;
}
#endif // BOTS
if (IsNPC() && !RuleB(Combat, NPCCanCrit))
return;
@ -5247,12 +5224,10 @@ void Mob::ApplyDamageTable(DamageHitInfo &hit)
#endif
// someone may want to add this to custom servers, can remove this if that's the case
if (!IsClient()
#ifdef BOTS
&& !IsBot()
#endif
)
if (!IsClient()&& !IsBot()) {
return;
}
// this was parsed, but we do see the min of 10 and the normal minus factor is 105, so makes sense
if (hit.offense < 115)
return;

View File

@ -39,14 +39,6 @@ class Zone;
#include "entity.h"
#include "mob.h"
#ifdef BOTS
#include "bot.h"
#endif
#include "../common/spdat.h"
extern EntityList entity_list;
extern Zone* zone;

View File

@ -26,9 +26,7 @@
#include "entity.h"
#include "mob.h"
#ifdef BOTS
#include "bot.h"
#endif
#include "quest_parser_collection.h"

View File

@ -16,8 +16,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef BOTS
#include "bot.h"
#include "object.h"
#include "doors.h"
@ -225,9 +223,6 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
if (!database.botdb.LoadInspectMessage(GetBotID(), _botInspectMessage) && bot_owner)
bot_owner->Message(Chat::White, "%s for '%s'", BotDatabase::fail::LoadInspectMessage(), GetCleanName());
if (!database.botdb.LoadGuildMembership(GetBotID(), _guildId, _guildRank, _guildName) && bot_owner)
bot_owner->Message(Chat::White, "%s for '%s'", BotDatabase::fail::LoadGuildMembership(), GetCleanName());
std::string error_message;
EquipBot(&error_message);
@ -6256,65 +6251,6 @@ void Bot::ProcessBotOwnerRefDelete(Mob* botOwner) {
}
}
void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) {
if(guildOfficer && botToGuild) {
if(!botToGuild->IsInAGuild()) {
if (!guild_mgr.CheckPermission(guildOfficer->GuildID(), guildOfficer->GuildRank(), GUILD_INVITE)) {
guildOfficer->Message(Chat::White, "You dont have permission to invite.");
return;
}
if (!database.botdb.SaveGuildMembership(botToGuild->GetBotID(), guildOfficer->GuildID(), GUILD_MEMBER)) {
guildOfficer->Message(Chat::White, "%s for '%s'", BotDatabase::fail::SaveGuildMembership(), botToGuild->GetCleanName());
return;
}
ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct));
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
s->guild_id = guildOfficer->GuildID();
s->old_guild_id = GUILD_NONE;
s->char_id = botToGuild->GetBotID();
worldserver.SendPacket(pack);
safe_delete(pack);
} else {
guildOfficer->Message(Chat::White, "Bot is in a guild.");
return;
}
}
}
bool Bot::ProcessGuildRemoval(Client* guildOfficer, std::string botName) {
bool Result = false;
if(guildOfficer && !botName.empty()) {
Bot* botToUnGuild = entity_list.GetBotByBotName(botName);
if(botToUnGuild) {
if (database.botdb.DeleteGuildMembership(botToUnGuild->GetBotID()))
Result = true;
} else {
uint32 ownerId = 0;
if (!database.botdb.LoadOwnerID(botName, ownerId))
guildOfficer->Message(Chat::White, "%s for '%s'", BotDatabase::fail::LoadOwnerID(), botName.c_str());
uint32 botId = 0;
if (!database.botdb.LoadBotID(ownerId, botName, botId))
guildOfficer->Message(Chat::White, "%s for '%s'", BotDatabase::fail::LoadBotID(), botName.c_str());
if (botId && database.botdb.DeleteGuildMembership(botId))
Result = true;
}
if(Result) {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GuildManageRemove, sizeof(GuildManageRemove_Struct));
GuildManageRemove_Struct* gm = (GuildManageRemove_Struct*) outapp->pBuffer;
gm->guildeqid = guildOfficer->GuildID();
strcpy(gm->member, botName.c_str());
guildOfficer->Message(Chat::White, "%s successfully removed from your guild.", botName.c_str());
entity_list.QueueClientsGuild(guildOfficer, outapp, false, gm->guildeqid);
safe_delete(outapp);
}
}
return Result;
}
int64 Bot::CalcMaxMana() {
switch(GetCasterClass()) {
case 'I':
@ -9974,5 +9910,3 @@ void Bot::SendSpellAnim(uint16 target_id, uint16 spell_id)
}
uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQ::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 };
#endif

View File

@ -19,8 +19,6 @@
#ifndef BOT_H
#define BOT_H
#ifdef BOTS
#include "bot_structs.h"
#include "mob.h"
#include "client.h"
@ -146,7 +144,7 @@ public:
//abstract virtual override function implementations requird by base abstract class
bool Death(Mob* killerMob, int64 damage, uint16 spell_id, EQ::skills::SkillType attack_skill) override;
void Damage(Mob* from, int64 damage, uint16 spell_id, EQ::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1,
void Damage(Mob* from, int64 damage, uint16 spell_id, EQ::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1,
bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None) override;
bool Attack(Mob* other, int Hand = EQ::invslot::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false,
@ -372,7 +370,7 @@ public:
virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar);
bool IsImmuneToSpell(uint16 spell_id, Mob *caster) override;
virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQ::spells::CastingSlot slot);
virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQ::spells::CastingSlot slot = EQ::spells::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1,
virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQ::spells::CastingSlot slot = EQ::spells::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1,
uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 aa_id = 0);
inline int64 GetFocusEffect(focusType type, uint16 spell_id, Mob *caster = nullptr, bool from_buff_tic = false) override
{ return Mob::GetFocusEffect(type, spell_id, caster, from_buff_tic); }
@ -870,6 +868,4 @@ private:
bool IsSpellInBotList(DBbotspells_Struct* spell_list, uint16 iSpellID);
#endif // BOTS
#endif // BOT_H

View File

@ -32,8 +32,6 @@
*/
#ifdef BOTS
#include <string.h>
#include <stdlib.h>
#include <sstream>
@ -10824,5 +10822,3 @@ void bot_command_enforce_spell_list(Client* c, const Seperator *sep)
).c_str()
);
}
#endif // BOTS

View File

@ -20,8 +20,6 @@
#ifndef BOT_COMMAND_H
#define BOT_COMMAND_H
#ifdef BOTS
class Client;
class Seperator;
@ -691,5 +689,3 @@ void helper_send_usage_required_bots(Client *bot_owner, BCEnum::SpType spell_typ
bool helper_spell_check_fail(STBaseEntry* local_entry);
bool helper_spell_list_fail(Client *bot_owner, bcst_list* spell_list, BCEnum::SpType spell_type);
#endif
#endif // BOTS

View File

@ -16,8 +16,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef BOTS
#include "../common/data_verification.h"
#include "../common/global_define.h"
#include "../common/rulesys.h"
@ -169,13 +167,18 @@ bool BotDatabase::LoadBotSpellCastingChances()
/* Bot functions */
bool BotDatabase::QueryNameAvailablity(const std::string& bot_name, bool& available_flag)
{
if (bot_name.empty() || bot_name.size() > 60 || !database.CheckUsedName(bot_name))
if (bot_name.empty() || bot_name.size() > 60 || !database.CheckUsedName(bot_name)) {
return false;
}
query = fmt::format(
"SELECT `id` FROM `vw_bot_character_mobs` WHERE `name` LIKE '{}' LIMIT 1",
"SELECT b.bot_id FROM bot_data b "
"INNER JOIN character_data c ON b.`name` = c.`name` "
"WHERE b.`name` LIKE '{0}' OR c.`name` LIKE '{0}' "
"LIMIT 1",
bot_name
);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
return false;
@ -973,70 +976,6 @@ bool BotDatabase::DeleteTimers(const uint32 bot_id)
return true;
}
bool BotDatabase::LoadGuildMembership(const uint32 bot_id, uint32& guild_id, uint8& guild_rank, std::string& guild_name)
{
if (!bot_id)
return false;
query = StringFormat(
"SELECT"
" gm.`guild_id`,"
" gm.`rank`,"
" g.`name`"
" FROM `vw_guild_members` AS gm"
" JOIN `guilds` AS g"
" ON gm.`guild_id` = g.`id`"
" WHERE gm.`char_id` = '%u'"
" AND gm.`mob_type` = 'B'"
" LIMIT 1",
bot_id
);
auto results = database.QueryDatabase(query);
if (!results.Success())
return false;
if (!results.RowCount())
return true;
auto row = results.begin();
guild_id = atoi(row[0]);
guild_rank = atoi(row[1]);
guild_name = row[2];
return true;
}
bool BotDatabase::SaveGuildMembership(const uint32 bot_id, const uint32 guild_id, const uint8 guild_rank)
{
if (!bot_id || !guild_id)
return false;
if (!DeleteGuildMembership(bot_id))
return false;
query = StringFormat("INSERT INTO `bot_guild_members` SET `bot_id` = '%u', `guild_id` = '%u', `rank` = '%u'", bot_id, guild_id, guild_rank);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
DeleteGuildMembership(bot_id);
return false;
}
return true;
}
bool BotDatabase::DeleteGuildMembership(const uint32 bot_id)
{
if (!bot_id)
return false;
query = StringFormat("DELETE FROM `bot_guild_members` WHERE `bot_id` = '%u'", bot_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
return false;
return true;
}
/* Bot inventory functions */
bool BotDatabase::QueryInventoryCount(const uint32 bot_id, uint32& item_count)
{
@ -2264,7 +2203,7 @@ bool BotDatabase::QueryBotGroupExistence(const std::string& group_name)
}
query = fmt::format(
"SELECT `group_name` FROM `vw_bot_groups` WHERE `group_name` = '{}' LIMIT 1",
"SELECT `group_name` FROM `bot_groups` WHERE `group_name` = '{}' LIMIT 1",
group_name
);
@ -2604,7 +2543,11 @@ bool BotDatabase::LoadBotGroupIDForLoadBotGroup(const uint32 owner_id, const std
}
query = fmt::format(
"SELECT `groups_index`, `group_name` FROM `vw_bot_groups` WHERE `owner_id` = {}",
"SELECT groups_index, group_name FROM "
"bot_groups bg INNER JOIN bot_group_members bgm "
"ON bg.groups_index = bgm.groups_index "
"WHERE bgm.bot_id IN "
"(SELECT bot_id FROM bot_data WHERE WHERE owner_id = {})",
owner_id
);
@ -2669,8 +2612,13 @@ bool BotDatabase::LoadBotGroupsListByOwnerID(const uint32 owner_id, std::list<st
return false;
}
query = fmt::format(
"SELECT `group_name`, `group_leader_name` FROM `vw_bot_groups` WHERE `owner_id` = {}",
"SELECT group_name, group_leader_name FROM "
"bot_groups bg INNER JOIN bot_group_members bgm "
"ON bg.groups_index = bgm.groups_index "
"WHERE bgm.bot_id IN "
"(SELECT bot_id FROM bot_data WHERE WHERE owner_id = {})",
owner_id
);
@ -3180,9 +3128,6 @@ const char* BotDatabase::fail::DeleteStance() { return "Failed to delete stance"
const char* BotDatabase::fail::LoadTimers() { return "Failed to load timers"; }
const char* BotDatabase::fail::SaveTimers() { return "Failed to save timers"; }
const char* BotDatabase::fail::DeleteTimers() { return "Failed to delete timers"; }
const char* BotDatabase::fail::LoadGuildMembership() { return "Failed to load guild membership"; }
const char* BotDatabase::fail::SaveGuildMembership() { return "Failed to save guild membership"; }
const char* BotDatabase::fail::DeleteGuildMembership() { return "Failed to delete guild membership"; }
/* fail::Bot inventory functions */
const char* BotDatabase::fail::QueryInventoryCount() { return "Failed to query inventory count"; }
@ -3233,5 +3178,3 @@ const char* BotDatabase::fail::DeleteHealRotation() { return "Failed to delete h
const char* BotDatabase::fail::DeleteAllHealRotations() { return "Failed to delete all heal rotations"; }
/* fail::Bot miscellaneous functions */
#endif // BOTS

View File

@ -20,7 +20,6 @@
#ifndef BOT_DATABASE_H
#define BOT_DATABASE_H
#ifdef BOTS
#include <list>
#include <map>
@ -78,10 +77,6 @@ public:
bool SaveTimers(Bot* bot_inst);
bool DeleteTimers(const uint32 bot_id);
bool LoadGuildMembership(const uint32 bot_id, uint32& guild_id, uint8& guild_rank, std::string& guild_name);
bool SaveGuildMembership(const uint32 bot_id, const uint32 guild_id, const uint8 guild_rank);
bool DeleteGuildMembership(const uint32 bot_id);
/* Bot inventory functions */
bool QueryInventoryCount(const uint32 bot_id, uint32& item_count);
@ -215,9 +210,6 @@ public:
static const char* LoadTimers();
static const char* SaveTimers();
static const char* DeleteTimers();
static const char* LoadGuildMembership();
static const char* SaveGuildMembership();
static const char* DeleteGuildMembership();
/* fail::Bot inventory functions */
static const char* QueryInventoryCount();
@ -295,5 +287,3 @@ public:
};
#endif
#endif // BOTS

View File

@ -19,8 +19,6 @@
#ifndef BOT_STRUCTS
#define BOT_STRUCTS
#ifdef BOTS
#include "../common/types.h"
#include <sstream>
@ -105,6 +103,4 @@ struct BotSpells_Struct {
uint8 bucket_comparison;
};
#endif // BOTS
#endif // BOT_STRUCTS

View File

@ -16,8 +16,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef BOTS
#include "bot.h"
#include "../common/data_verification.h"
#include "../common/strings.h"
@ -3458,5 +3456,3 @@ bool Bot::HasBotSpellEntry(uint16 spellid) {
return false;
}
#endif

View File

@ -50,9 +50,7 @@ extern volatile bool RunLoops;
#include "petitions.h"
#include "command.h"
#include "water_map.h"
#ifdef BOTS
#include "bot_command.h"
#endif
#include "string_ids.h"
#include "guild_mgr.h"
@ -369,7 +367,6 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
SetDisplayMobInfoWindow(true);
SetDevToolsEnabled(true);
#ifdef BOTS
bot_owner_options[booDeathMarquee] = false;
bot_owner_options[booStatsUpdate] = false;
bot_owner_options[booSpawnMessageSay] = false;
@ -382,7 +379,6 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
SetBotPulling(false);
SetBotPrecombat(false);
#endif
AI_Init();
}
@ -390,9 +386,10 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
Client::~Client() {
mMovementManager->RemoveClient(this);
#ifdef BOTS
Bot::ProcessBotOwnerRefDelete(this);
#endif
if (RuleB(Bots, Enabled)) {
Bot::ProcessBotOwnerRefDelete(this);
}
if(IsInAGuild())
guild_mgr.SendGuildMemberUpdateToWorld(GetName(), GuildID(), 0, time(nullptr));
@ -1148,30 +1145,32 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
break;
}
#ifdef BOTS
if (message[0] == BOT_COMMAND_CHAR) {
if (bot_command_dispatch(this, message) == -2) {
if (parse->PlayerHasQuestSub(EVENT_BOT_COMMAND)) {
int i = parse->EventPlayer(EVENT_BOT_COMMAND, this, message, 0);
if (i == 0 && !RuleB(Chat, SuppressCommandErrors)) {
Message(Chat::Red, "Bot command '%s' not recognized.", message);
}
}
else if (parse->PlayerHasQuestSub(EVENT_SAY)) {
int i = parse->EventPlayer(EVENT_SAY, this, message, 0);
if (i == 0 && !RuleB(Chat, SuppressCommandErrors)) {
Message(Chat::Red, "Bot command '%s' not recognized.", message);
}
}
else {
if (!RuleB(Chat, SuppressCommandErrors)) {
Message(Chat::Red, "Bot command '%s' not recognized.", message);
if (RuleB(Bots, Enabled)) {
if (bot_command_dispatch(this, message) == -2) {
if (parse->PlayerHasQuestSub(EVENT_BOT_COMMAND)) {
int i = parse->EventPlayer(EVENT_BOT_COMMAND, this, message, 0);
if (i == 0 && !RuleB(Chat, SuppressCommandErrors)) {
Message(Chat::Red, "Bot command '%s' not recognized.", message);
}
}
else if (parse->PlayerHasQuestSub(EVENT_SAY)) {
int i = parse->EventPlayer(EVENT_SAY, this, message, 0);
if (i == 0 && !RuleB(Chat, SuppressCommandErrors)) {
Message(Chat::Red, "Bot command '%s' not recognized.", message);
}
}
else {
if (!RuleB(Chat, SuppressCommandErrors)) {
Message(Chat::Red, "Bot command '%s' not recognized.", message);
}
}
}
} else {
Message(Chat::Red, "Bots are disabled on this server.");
}
break;
}
#endif
if (EQ::ProfanityManager::IsCensorshipActive()) {
EQ::ProfanityManager::RedactMessage(message);
@ -1223,20 +1222,15 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
}
}
#ifdef BOTS
else if (GetTarget() && GetTarget()->IsBot() && !IsInvisible(GetTarget())) {
if (DistanceNoZ(m_Position, GetTarget()->GetPosition()) <= RuleI(Range, Say)) {
if (GetTarget()->IsEngaged()) {
parse->EventBot(EVENT_AGGRO_SAY, GetTarget()->CastToBot(), this, message, language);
} else {
parse->EventBot(EVENT_SAY, GetTarget()->CastToBot(), this, message, language);
else if (GetTarget() && GetTarget()->IsBot() && !IsInvisible(GetTarget())) {
if (DistanceNoZ(m_Position, GetTarget()->GetPosition()) <= RuleI(Range, Say)) {
if (GetTarget()->IsEngaged()) {
parse->EventBot(EVENT_AGGRO_SAY, GetTarget()->CastToBot(), this, message, language);
} else {
parse->EventBot(EVENT_SAY, GetTarget()->CastToBot(), this, message, language);
}
}
}
}
#endif
break;
}
case ChatChannel_UCSRelay:
@ -7618,13 +7612,9 @@ void Client::GarbleMessage(char *message, uint8 variance)
int delimiter_count = 0;
// Don't garble # commands
if (message[0] == COMMAND_CHAR)
if (message[0] == COMMAND_CHAR || message[0] == BOT_COMMAND_CHAR) {
return;
#ifdef BOTS
if (message[0] == BOT_COMMAND_CHAR)
return;
#endif
}
for (size_t i = 0; i < strlen(message); i++) {
// Client expects hex values inside of a text link body
@ -11612,14 +11602,12 @@ std::vector<Mob*> Client::GetApplySpellList(
l.push_back(m->GetPet());
}
#ifdef BOTS
if (allow_bots) {
const auto& sbl = entity_list.GetBotListByCharacterID(m->CharacterID());
for (const auto& b : sbl) {
l.push_back(b);
}
}
#endif
}
}
}
@ -11635,14 +11623,12 @@ std::vector<Mob*> Client::GetApplySpellList(
l.push_back(m->GetPet());
}
#ifdef BOTS
if (allow_bots) {
const auto& sbl = entity_list.GetBotListByCharacterID(m->CastToClient()->CharacterID());
for (const auto& b : sbl) {
l.push_back(b);
}
}
#endif
}
}
}
@ -11653,14 +11639,12 @@ std::vector<Mob*> Client::GetApplySpellList(
l.push_back(GetPet());
}
#ifdef BOTS
if (allow_bots) {
const auto& sbl = entity_list.GetBotListByCharacterID(CharacterID());
for (const auto& b : sbl) {
l.push_back(b);
}
}
#endif
}
return l;

View File

@ -2043,7 +2043,6 @@ private:
bool m_has_quest_compass = false;
std::vector<uint32_t> m_dynamic_zone_ids;
#ifdef BOTS
public:
enum BotOwnerOption : size_t {
@ -2082,7 +2081,6 @@ private:
bool m_bot_pulling;
bool m_bot_precombat;
#endif
bool CanTradeFVNoDropItem();
};

View File

@ -1,5 +1,3 @@
#ifdef BOTS
#include "bot.h"
#include "client.h"
@ -161,5 +159,3 @@ void Client::CampAllBots(uint8 class_id)
{
Bot::BotOrderCampAll(this, class_id);
}
#endif

View File

@ -27,9 +27,7 @@
#include "client.h"
#include "mob.h"
#ifdef BOTS
#include "bot.h"
#endif
#include "bot.h"
#include <algorithm>

View File

@ -70,10 +70,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "client.h"
#include "../common/repositories/account_repository.h"
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;
extern Zone* zone;
@ -1536,11 +1533,11 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
LFG = false;
}
#ifdef BOTS
database.botdb.LoadOwnerOptions(this);
// TODO: mod below function for loading spawned botgroups
Bot::LoadAndSpawnAllZonedBots(this);
#endif
if (RuleB(Bots, Enabled)) {
database.botdb.LoadOwnerOptions(this);
// TODO: mod below function for loading spawned botgroups
Bot::LoadAndSpawnAllZonedBots(this);
}
m_inv.SetGMInventory((bool)m_pp.gm); // set to current gm state for calc
CalcBonuses();
@ -3998,13 +3995,14 @@ void Client::Handle_OP_BuffRemoveRequest(const EQApplicationPacket *app)
{
m = entity_list.GetMobID(brrs->EntityID);
}
#ifdef BOTS
else {
Mob* bot_test = entity_list.GetMob(brrs->EntityID);
if (bot_test && bot_test->IsBot() && bot_test->GetOwner() == this)
m = bot_test;
if (RuleB(Bots, Enabled)) {
Mob *bot_test = entity_list.GetMob(brrs->EntityID);
if (bot_test && bot_test->IsBot() && bot_test->GetOwner() == this) {
m = bot_test;
}
}
}
#endif
if (!m)
return;
@ -4037,15 +4035,10 @@ void Client::Handle_OP_Bug(const EQApplicationPacket *app)
void Client::Handle_OP_Camp(const EQApplicationPacket *app)
{
#ifdef BOTS
// This block is necessary to clean up any bot objects owned by a Client
Bot::BotOrderCampAll(this);
// Evidently, this is bad under certain conditions and causes crashes...
// Group and Raid code really needs to be overhauled to account for non-client types (mercs and bots)
//auto group = GetGroup();
//if (group && group->GroupCount() < 2)
// group->DisbandGroup();
#endif
if (RuleB(Bots, Enabled)) {
Bot::BotOrderCampAll(this);
}
if (IsLFP())
worldserver.StopLFP(CharacterID());
@ -6797,9 +6790,8 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app)
if (!group)
return;
#ifdef BOTS
// this block is necessary to allow more control over controlling how bots are zoned or camped.
if (Bot::GroupHasBot(group)) {
if (RuleB(Bots, Enabled) && Bot::GroupHasBot(group)) {
if (group->IsLeader(this)) {
if ((GetTarget() == 0 || GetTarget() == this) || (group->GroupCount() < 3)) {
Bot::ProcessBotGroupDisband(this, std::string());
@ -6820,9 +6812,10 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app)
}
group = GetGroup();
if (!group) //We must recheck this here.. incase the final bot disbanded the party..otherwise we crash
if (!group) {
return;
#endif
}
Mob* memberToDisband = GetTarget();
if (!memberToDisband)
@ -7012,11 +7005,9 @@ void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app)
}
}
}
#ifdef BOTS
else if (Invitee->IsBot()) {
Bot::ProcessBotGroupInvite(this, std::string(Invitee->GetName()));
}
#endif
}
else
{
@ -7725,13 +7716,6 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app)
return;
}
}
#ifdef BOTS
else if (invitee->IsBot()) {
// The guild system is too tightly coupled with the character_data table so we have to avoid using much of the system
Bot::ProcessGuildInvite(this, invitee->CastToBot());
return;
}
#endif
}
}
@ -8098,10 +8082,6 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app)
else if (!worldserver.Connected())
Message(Chat::Red, "Error: World server disconnected");
else {
#ifdef BOTS
if (Bot::ProcessGuildRemoval(this, gc->othername))
return;
#endif
uint32 char_id;
Client* client = entity_list.GetClientByName(gc->othername);
@ -8454,9 +8434,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app)
else { ProcessInspectRequest(tmp->CastToClient(), this); }
}
#ifdef BOTS
if (tmp != 0 && tmp->IsBot()) { Bot::ProcessBotInspectionRequest(tmp->CastToBot(), this); }
#endif
return;
}
@ -11199,10 +11177,8 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app)
if (t) {
if (t->IsNPC()) {
parse->EventNPC(EVENT_POPUP_RESPONSE, t->CastToNPC(), this, export_string, 0);
#ifdef BOTS
} else if (t->IsBot()) {
parse->EventBot(EVENT_POPUP_RESPONSE, t->CastToBot(), this, export_string, 0);
#endif
}
}
}
@ -13984,9 +13960,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app)
}
if (GetGM() || RuleB(Spells, AlwaysSendTargetsBuffs) || nt == this || inspect_buffs || (nt->IsClient() && !nt->CastToClient()->GetPVP()) ||
(nt->IsPet() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP()) ||
#ifdef BOTS
(nt->IsBot() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP()) || // TODO: bot pets
#endif
(nt->IsMerc() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP()))
{
nt->SendBuffsToClient(this);
@ -14421,11 +14395,9 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
FinishTrade(with->CastToNPC());
}
}
#ifdef BOTS
// TODO: Log Bot trades
else if (with->IsBot())
with->CastToBot()->FinishTrade(this, Bot::BotTradeClientNormal);
#endif
trade->Reset();
}
@ -14677,11 +14649,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app)
if (tradee && tradee->IsClient()) {
tradee->CastToClient()->QueuePacket(app);
}
#ifndef BOTS
else if (tradee && tradee->IsNPC()) {
#else
else if (tradee && (tradee->IsNPC() || tradee->IsBot())) {
#endif
if (!tradee->IsEngaged()) {
trade->Start(msg->to_mob_id);
EQApplicationPacket *outapp = new EQApplicationPacket(OP_TradeRequestAck, sizeof(TradeRequest_Struct));

View File

@ -101,11 +101,7 @@ int command_init(void)
command_add("ban", "[Character Name] [Reason] - Ban by character name", AccountStatus::GMLeadAdmin, command_ban) ||
command_add("bind", "Sets your targets bind spot to their current location", AccountStatus::GMMgmt, command_bind) ||
command_add("bugs", "[Close|Delete|Review|Search|View] - Handles player bug reports", AccountStatus::QuestTroupe, command_bugs) ||
#ifdef BOTS
command_add("bot", "Type \"#bot help\" or \"^help\" to the see the list of available commands for bots.", AccountStatus::Player, command_bot) ||
#endif
command_add("camerashake", "[Duration (Milliseconds)] [Intensity (1-10)] - Shakes the camera on everyone's screen globally.", AccountStatus::QuestTroupe, command_camerashake) ||
command_add("castspell", "[Spell ID] [Instant (0 = False, 1 = True, Default is 1 if Unused)] - Cast a spell", AccountStatus::Guide, command_castspell) ||
command_add("chat", "[Channel ID] [Message] - Send a channel message to all zones", AccountStatus::GMMgmt, command_chat) ||
@ -902,35 +898,37 @@ void command_apply_shared_memory(Client *c, const Seperator *sep) {
worldserver.SendPacket(&pack);
}
// All new code added to command.cpp should be BEFORE this comment line. Do no append code to this file below the BOTS code block.
#ifdef BOTS
#include "bot_command.h"
// Function delegate to support the command interface for Bots with the client.
void command_bot(Client *c, const Seperator *sep)
{
std::string bot_message = sep->msg;
if (bot_message.compare("#bot") == 0) {
bot_message[0] = BOT_COMMAND_CHAR;
}
else {
bot_message = bot_message.substr(bot_message.find_first_not_of("#bot"));
bot_message[0] = BOT_COMMAND_CHAR;
}
if (bot_command_dispatch(c, bot_message.c_str()) == -2) {
if (parse->PlayerHasQuestSub(EVENT_BOT_COMMAND)) {
int i = parse->EventPlayer(EVENT_BOT_COMMAND, c, bot_message, 0);
if (i == 0 && !RuleB(Chat, SuppressCommandErrors)) {
c->Message(Chat::Red, "Bot command '%s' not recognized.", bot_message.c_str());
}
if (RuleB(Bots, Enabled)) {
std::string bot_message = sep->msg;
if (bot_message.compare("#bot") == 0) {
bot_message[0] = BOT_COMMAND_CHAR;
}
else {
if (!RuleB(Chat, SuppressCommandErrors))
c->Message(Chat::Red, "Bot command '%s' not recognized.", bot_message.c_str());
bot_message = bot_message.substr(bot_message.find_first_not_of("#bot"));
bot_message[0] = BOT_COMMAND_CHAR;
}
if (bot_command_dispatch(c, bot_message.c_str()) == -2) {
if (parse->PlayerHasQuestSub(EVENT_BOT_COMMAND)) {
int i = parse->EventPlayer(EVENT_BOT_COMMAND, c, bot_message, 0);
if (i == 0 && !RuleB(Chat, SuppressCommandErrors)) {
c->Message(Chat::Red, "Bot command '%s' not recognized.", bot_message.c_str());
}
}
else {
if (!RuleB(Chat, SuppressCommandErrors)) {
c->Message(Chat::Red, "Bot command '%s' not recognized.", bot_message.c_str());
}
}
}
} else {
c->Message(Chat::Red, "Bots are disabled on this server.");
}
}
#endif
#include "gm_commands/acceptrules.cpp"
#include "gm_commands/advnpcspawn.cpp"

View File

@ -326,9 +326,7 @@ void command_zsky(Client *c, const Seperator *sep);
void command_zstats(Client *c, const Seperator *sep);
void command_zunderworld(Client *c, const Seperator *sep);
#ifdef BOTS
#include "bot.h"
void command_bot(Client*c, const Seperator *sep);
#endif
#endif

View File

@ -44,9 +44,7 @@ Child of the Mob class.
#include "mob.h"
#include "raids.h"
#ifdef BOTS
#include "bot.h"
#endif
#include "quest_parser_collection.h"
#include "string_ids.h"

View File

@ -52,9 +52,7 @@ void perl_register_object();
void perl_register_doors();
void perl_register_expedition();
void perl_register_expedition_lock_messages();
#ifdef BOTS
void perl_register_bot();
#endif // BOTS
#endif // EMBPERL_XS_CLASSES
#endif // EMBPERL_XS
@ -181,11 +179,8 @@ PerlembParser::PerlembParser() : perl(nullptr)
global_npc_quest_status_ = questUnloaded;
player_quest_status_ = questUnloaded;
global_player_quest_status_ = questUnloaded;
#ifdef BOTS
bot_quest_status_ = questUnloaded;
global_bot_quest_status_ = questUnloaded;
#endif
}
PerlembParser::~PerlembParser()
@ -219,11 +214,8 @@ void PerlembParser::ReloadQuests()
global_npc_quest_status_ = questUnloaded;
player_quest_status_ = questUnloaded;
global_player_quest_status_ = questUnloaded;
#ifdef BOTS
bot_quest_status_ = questUnloaded;
global_bot_quest_status_ = questUnloaded;
#endif
item_quest_status_.clear();
spell_quest_status_.clear();
@ -921,10 +913,7 @@ int PerlembParser::SendCommands(
std::string qi = (std::string) "$" + (std::string) pkgprefix + (std::string) "::questitem";
std::string sp = (std::string) "$" + (std::string) pkgprefix + (std::string) "::spell";
std::string enl = (std::string) "$" + (std::string) pkgprefix + (std::string) "::entity_list";
#ifdef BOTS
std::string bot = (std::string) "$" + (std::string) pkgprefix + (std::string) "::bot";
#endif
if (clear_vars_.find(cl) != clear_vars_.end()) {
auto e = fmt::format("{} = undef;", cl);
@ -951,12 +940,10 @@ int PerlembParser::SendCommands(
perl->eval(e.c_str());
}
#ifdef BOTS
if (clear_vars_.find(bot) != clear_vars_.end()) {
auto e = fmt::format("{} = undef;", bot);
perl->eval(e.c_str());
}
#endif
}
std::string buf;
@ -980,14 +967,12 @@ int PerlembParser::SendCommands(
sv_setref_pv(npc, "NPC", curn);
}
#ifdef BOTS
if (!other->IsClient() && other->IsBot()) {
Bot *curb = quest_manager.GetBot();
buf = fmt::format("{}::bot", pkgprefix);
SV *bot = get_sv(buf.c_str(), true);
sv_setref_pv(bot, "Bot", curb);
}
#endif
//only export QuestItem if it's an item quest
if (item_inst) {
@ -1021,20 +1006,14 @@ int PerlembParser::SendCommands(
std::string qi = (std::string) "$" + (std::string) pkgprefix + (std::string) "::questitem";
std::string sp = (std::string) "$" + (std::string) pkgprefix + (std::string) "::spell";
std::string enl = (std::string) "$" + (std::string) pkgprefix + (std::string) "::entity_list";
#ifdef BOTS
std::string bot = (std::string) "$" + (std::string) pkgprefix + (std::string) "::bot";
#endif
clear_vars_[cl] = 1;
clear_vars_[np] = 1;
clear_vars_[qi] = 1;
clear_vars_[sp] = 1;
clear_vars_[enl] = 1;
#ifdef BOTS
clear_vars_[bot] = 1;
#endif
}
#endif
@ -1099,9 +1078,7 @@ void PerlembParser::MapFunctions()
perl_register_doors();
perl_register_expedition();
perl_register_expedition_lock_messages();
#ifdef BOTS
perl_register_bot();
#endif // BOTS
#endif // EMBPERL_XS_CLASSES
}
@ -1394,12 +1371,10 @@ void PerlembParser::ExportMobVariables(
ExportVar(package_name.c_str(), "status", mob->CastToClient()->Admin());
}
#ifdef BOTS
if (mob && mob->IsBot()) {
ExportVar(package_name.c_str(), "bot_id", mob->CastToBot()->GetBotID());
ExportVar(package_name.c_str(), "bot_owner_char_id", mob->CastToBot()->GetBotOwnerCharacterID());
}
#endif
if (
!isPlayerQuest &&
@ -1553,11 +1528,9 @@ void PerlembParser::ExportEventVariables(
}
auto unique_id = npcmob->GetNPCTypeID();
#ifdef BOTS
if (npcmob->IsBot()) {
unique_id = npcmob->CastToBot()->GetBotID();
}
#endif
ExportVar(package_name.c_str(), "copper", GetVar(fmt::format("copper.{}", unique_id)).c_str());
ExportVar(package_name.c_str(), "silver", GetVar(fmt::format("silver.{}", unique_id)).c_str());
@ -1833,17 +1806,8 @@ void PerlembParser::ExportEventVariables(
if (killed)
{
ExportVar(package_name.c_str(), "killed_entity_id", killed->GetID());
if (killed->IsNPC()) {
ExportVar(package_name.c_str(), "killed_bot_id", 0);
ExportVar(package_name.c_str(), "killed_npc_id", killed->GetNPCTypeID());
#ifdef BOTS
} else if (killed->IsBot()) {
ExportVar(package_name.c_str(), "killed_bot_id", killed->CastToBot()->GetBotID());
ExportVar(package_name.c_str(), "killed_npc_id", 0);
#endif
}
ExportVar(package_name.c_str(), "killed_bot_id", killed->IsBot() ? killed->CastToBot()->GetBotID() : 0);
ExportVar(package_name.c_str(), "killed_npc_id", killed->IsNPC() ? killed->GetNPCTypeID() : 0);
ExportVar(package_name.c_str(), "killed_x", killed->GetX());
ExportVar(package_name.c_str(), "killed_y", killed->GetY());
ExportVar(package_name.c_str(), "killed_z", killed->GetZ());
@ -1864,17 +1828,8 @@ void PerlembParser::ExportEventVariables(
case EVENT_SPAWN_ZONE: {
ExportVar(package_name.c_str(), "spawned_entity_id", mob->GetID());
if (mob->IsNPC()) {
ExportVar(package_name.c_str(), "spawned_bot_id", 0);
ExportVar(package_name.c_str(), "spawned_npc_id", mob->GetNPCTypeID());
#ifdef BOTS
} else if (mob->IsBot()) {
ExportVar(package_name.c_str(), "spawned_bot_id", mob->CastToBot()->GetBotID());
ExportVar(package_name.c_str(), "spawned_npc_id", 0);
#endif
}
ExportVar(package_name.c_str(), "spawned_bot_id", mob->IsBot() ? mob->CastToBot()->GetBotID() : 0);
ExportVar(package_name.c_str(), "spawned_npc_id", mob->IsNPC() ? mob->GetNPCTypeID() : 0);
break;
}
@ -2043,32 +1998,15 @@ void PerlembParser::ExportEventVariables(
case EVENT_DESPAWN: {
ExportVar(package_name.c_str(), "despawned_entity_id", npcmob->GetID());
if (npcmob->IsNPC()) {
ExportVar(package_name.c_str(), "despawned_bot_id", 0);
ExportVar(package_name.c_str(), "despawned_npc_id", npcmob->GetNPCTypeID());
#ifdef BOTS
} else if (npcmob->IsBot()) {
ExportVar(package_name.c_str(), "despawned_bot_id", npcmob->CastToBot()->GetBotID());
ExportVar(package_name.c_str(), "despawned_npc_id", 0);
#endif
}
ExportVar(package_name.c_str(), "despawned_bot_id", npcmob->IsBot() ? npcmob->CastToBot()->GetBotID() : 0);
ExportVar(package_name.c_str(), "despawned_npc_id", npcmob->IsNPC() ? npcmob->GetNPCTypeID() : 0);
break;
}
case EVENT_DESPAWN_ZONE: {
ExportVar(package_name.c_str(), "despawned_entity_id", mob->GetID());
if (mob->IsNPC()) {
ExportVar(package_name.c_str(), "despawned_bot_id", 0);
ExportVar(package_name.c_str(), "despawned_npc_id", mob->GetNPCTypeID());
#ifdef BOTS
} else if (mob->IsBot()) {
ExportVar(package_name.c_str(), "despawned_bot_id", mob->CastToBot()->GetBotID());
ExportVar(package_name.c_str(), "despawned_npc_id", 0);
#endif
}
ExportVar(package_name.c_str(), "despawned_bot_id", mob->IsBot() ? mob->CastToBot()->GetBotID() : 0);
ExportVar(package_name.c_str(), "despawned_npc_id", mob->IsNPC() ? mob->GetNPCTypeID() : 0);
break;
}
@ -2088,7 +2026,6 @@ void PerlembParser::ExportEventVariables(
}
}
#ifdef BOTS
void PerlembParser::LoadBotScript(std::string filename)
{
if (!perl) {
@ -2204,6 +2141,5 @@ int PerlembParser::EventGlobalBot(
) {
return EventCommon(evt, 0, data.c_str(), bot, nullptr, nullptr, mob, extra_data, true, extra_pointers);
}
#endif
#endif

View File

@ -36,7 +36,7 @@ namespace EQ
class ItemInstance;
}
typedef enum
typedef enum
{
questUnloaded,
questLoaded,
@ -47,7 +47,7 @@ class PerlembParser : public QuestInterface {
public:
PerlembParser();
~PerlembParser();
virtual int EventNPC(
QuestEventID evt,
NPC* npc,
@ -96,8 +96,6 @@ public:
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
#ifdef BOTS
virtual int EventBot(
QuestEventID evt,
Bot *bot,
@ -114,7 +112,6 @@ public:
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
#endif
virtual bool HasQuestSub(uint32 npcid, QuestEventID evt);
virtual bool HasGlobalQuestSub(QuestEventID evt);
@ -122,11 +119,8 @@ public:
virtual bool GlobalPlayerHasQuestSub(QuestEventID evt);
virtual bool SpellHasQuestSub(uint32 spell_id, QuestEventID evt);
virtual bool ItemHasQuestSub(EQ::ItemInstance *itm, QuestEventID evt);
#ifdef BOTS
virtual bool BotHasQuestSub(QuestEventID evt);
virtual bool GlobalBotHasQuestSub(QuestEventID evt);
#endif
virtual void LoadNPCScript(std::string filename, int npc_id);
virtual void LoadGlobalNPCScript(std::string filename);
@ -134,11 +128,8 @@ public:
virtual void LoadGlobalPlayerScript(std::string filename);
virtual void LoadItemScript(std::string filename, EQ::ItemInstance *item);
virtual void LoadSpellScript(std::string filename, uint32 spell_id);
#ifdef BOTS
virtual void LoadBotScript(std::string filename);
virtual void LoadGlobalBotScript(std::string filename);
#endif
virtual void AddVar(std::string name, std::string val);
virtual std::string GetVar(std::string name);
@ -147,7 +138,7 @@ public:
private:
Embperl *perl;
void ExportHash(const char *pkgprefix, const char *hashname, std::map<std::string, std::string> &vals);
void ExportVar(const char *pkgprefix, const char *varname, const char *value);
void ExportVar(const char *pkgprefix, const char *varname, int32 value);
@ -163,7 +154,7 @@ private:
Mob* npcmob,
EQ::ItemInstance* item_inst,
const SPDat_Spell_Struct* spell,
Mob* mob,
Mob* mob,
uint32 extradata,
bool global,
std::vector<std::any> *extra_pointers
@ -185,7 +176,7 @@ private:
bool &isBotQuest,
bool &isGlobalBotQuest,
bool &isGlobalNPC,
bool &isItemQuest,
bool &isItemQuest,
bool &isSpellQuest,
QuestEventID event,
Mob* npcmob,
@ -199,12 +190,12 @@ private:
bool &isBotQuest,
bool &isGlobalBotQuest,
bool &isGlobalNPC,
bool &isItemQuest,
bool &isItemQuest,
bool &isSpellQuest,
std::string &package_name,
QuestEventID event,
uint32 objid,
const char * data,
const char * data,
Mob* npcmob,
EQ::ItemInstance* item_inst,
bool global
@ -216,7 +207,7 @@ private:
bool isBotQuest,
bool isGlobalBotQuest,
bool isGlobalNPC,
bool isItemQuest,
bool isItemQuest,
bool isSpellQuest,
std::string &package_name,
Mob *npcmob,
@ -229,7 +220,7 @@ private:
bool isBotQuest,
bool isGlobalBotQuest,
bool isGlobalNPC,
bool isItemQuest,
bool isItemQuest,
bool isSpellQuest,
std::string &package_name,
Mob *mob,
@ -241,25 +232,22 @@ private:
std::string &package_name,
QuestEventID event,
uint32 objid,
const char* data,
const char* data,
Mob* npcmob,
EQ::ItemInstance* item_inst,
Mob* mob,
uint32 extradata,
std::vector<std::any> *extra_pointers
);
std::map<uint32, PerlQuestStatus> npc_quest_status_;
PerlQuestStatus global_npc_quest_status_;
PerlQuestStatus player_quest_status_;
PerlQuestStatus global_player_quest_status_;
std::map<uint32, PerlQuestStatus> item_quest_status_;
std::map<uint32, PerlQuestStatus> spell_quest_status_;
#ifdef BOTS
PerlQuestStatus bot_quest_status_;
PerlQuestStatus global_bot_quest_status_;
#endif
std::map<std::string, std::string> vars_;
SV *_empty_sv;

View File

@ -1073,8 +1073,6 @@ void Perl__npcfeature(char* feature, int value)
quest_manager.npcfeature(feature, value);
}
#ifdef BOTS
int Perl__createbotcount()
{
return quest_manager.createbotcount();
@ -1105,8 +1103,6 @@ bool Perl__createBot(const char* firstname, const char* lastname, int level, int
return quest_manager.createBot(firstname, lastname, level, race_id, class_id, gender_id);
}
#endif //BOTS
void Perl__taskselector(perl::array task_ids)
{
if (task_ids.size() > MAXCHOOSERENTRIES)
@ -3991,14 +3987,12 @@ void perl_register_quest()
auto package = perl.new_package("quest");
#ifdef BOTS
package.add("botquest", &Perl__botquest);
package.add("spawnbotcount", (int(*)())&Perl__spawnbotcount);
package.add("spawnbotcount", (int(*)(uint8))&Perl__spawnbotcount);
package.add("createbotcount", (int(*)())&Perl__createbotcount);
package.add("createbotcount", (int(*)(uint8))&Perl__createbotcount);
package.add("createBot", &Perl__createBot);
#endif //BOTS
package.add("AssignGroupToInstance", &Perl__AssignGroupToInstance);
package.add("AssignRaidToInstance", &Perl__AssignRaidToInstance);

View File

@ -16,7 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef EMBPERL
#ifdef EMBPERL
#include "../common/global_define.h"
#include "../common/eqemu_logsys.h"
@ -24,20 +24,18 @@
#include "embperl.h"
#include "masterentity.h"
#include "command.h"
#ifdef BOTS
#include "bot_command.h"
#endif
const char *getItemName(unsigned itemid)
{
const char *getItemName(unsigned itemid)
{
const EQ::ItemData* item = nullptr;
item = database.GetItem(itemid);
item = database.GetItem(itemid);
if (item)
return item->Name;
else
return nullptr;
}
if (item)
return item->Name;
else
return nullptr;
}
const char* Perl__qc_getItemName(unsigned itemid)
{
@ -46,13 +44,13 @@ const char* Perl__qc_getItemName(unsigned itemid)
#ifdef EMBPERL_IO_CAPTURE
XS(XS_EQEmuIO_PRINT); /* prototype to pass -Wmissing-prototypes */
XS(XS_EQEmuIO_PRINT)
{
dXSARGS;
XS(XS_EQEmuIO_PRINT); /* prototype to pass -Wmissing-prototypes */
XS(XS_EQEmuIO_PRINT)
{
dXSARGS;
if (items < 2)
return;
// Perl_croak(aTHX_ "Usage: EQEmuIO::PRINT(@strings)");
// Perl_croak(aTHX_ "Usage: EQEmuIO::PRINT(@strings)");
int r;
for (r = 1; r < items; r++) {

View File

@ -52,9 +52,7 @@
#define strcasecmp _stricmp
#endif
#ifdef BOTS
#include "bot.h"
#endif
extern Zone *zone;
extern volatile bool is_zone_loaded;
@ -278,29 +276,15 @@ const Encounter* Entity::CastToEncounter() const
return static_cast<const Encounter *>(this);
}
#ifdef BOTS
Bot *Entity::CastToBot()
{
#ifdef _EQDEBUG
if (!IsBot()) {
std::cout << "CastToBot error" << std::endl;
return 0;
}
#endif
return static_cast<Bot *>(this);
}
const Bot *Entity::CastToBot() const
{
#ifdef _EQDEBUG
if (!IsBot()) {
std::cout << "CastToBot error" << std::endl;
return 0;
}
#endif
return static_cast<const Bot *>(this);
}
#endif
EntityList::EntityList()
:
@ -554,11 +538,9 @@ void EntityList::MobProcess()
if(mob->IsMerc()) {
entity_list.RemoveMerc(id);
}
#ifdef BOTS
else if(mob->IsBot()) {
entity_list.RemoveBot(id);
}
#endif
else if(mob->IsNPC()) {
entity_list.RemoveNPC(id);
}
@ -1869,7 +1851,6 @@ Client *EntityList::GetClientByLSID(uint32 iLSID)
return nullptr;
}
#ifdef BOTS
Bot* EntityList::GetRandomBot(const glm::vec3& location, float distance, Bot* exclude_bot)
{
auto is_whole_zone = false;
@ -1900,7 +1881,6 @@ Bot* EntityList::GetRandomBot(const glm::vec3& location, float distance, Bot* ex
return bots_in_range[zone->random.Int(0, bots_in_range.size() - 1)];
}
#endif
Client *EntityList::GetRandomClient(const glm::vec3& location, float distance, Client *exclude_client)
{
@ -3145,13 +3125,8 @@ void EntityList::RemoveEntity(uint16 id)
return;
else if (entity_list.RemoveMerc(id))
return;
#ifdef BOTS
// This block of code is necessary to clean up bot objects
else if (entity_list.RemoveBot(id))
return;
#endif //BOTS
else
entity_list.RemoveObject(id);
}
@ -5186,7 +5161,6 @@ void EntityList::GetClientList(std::list<Client *> &c_list)
}
}
#ifdef BOTS
void EntityList::GetBotList(std::list<Bot *> &b_list)
{
b_list.clear();
@ -5277,7 +5251,6 @@ void EntityList::SignalBotByBotName(std::string bot_name, int signal_id)
b->Signal(signal_id);
}
}
#endif
void EntityList::GetCorpseList(std::list<Corpse *> &c_list)
{

View File

@ -57,10 +57,7 @@ struct QGlobal;
struct UseAA_Struct;
struct Who_All_Struct;
#ifdef BOTS
class Bot;
class BotRaids;
#endif
extern EntityList entity_list;
@ -118,10 +115,8 @@ public:
virtual const char* GetName() { return ""; }
bool CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z, float trg_x, float trg_y, float trg_z, float perwalk=1);
#ifdef BOTS
Bot* CastToBot();
const Bot* CastToBot() const;
#endif
protected:
friend class EntityList;
@ -191,10 +186,7 @@ public:
Client *GetClientByLSID(uint32 iLSID);
Client *GetClient(uint32 ip, uint16 port);
#ifdef BOTS
Bot* GetRandomBot(const glm::vec3& location = glm::vec3(0.f), float distance = 0, Bot* exclude_bot = nullptr);
#endif
Client* GetRandomClient(const glm::vec3& location = glm::vec3(0.f), float distance = 0, Client* exclude_client = nullptr);
NPC* GetRandomNPC(const glm::vec3& location = glm::vec3(0.f), float distance = 0, NPC* exclude_npc = nullptr);
Mob* GetRandomMob(const glm::vec3& location = glm::vec3(0.f), float distance = 0, Mob* exclude_mob = nullptr);
@ -548,7 +540,6 @@ public:
inline const std::unordered_map<uint16, NPC *> &GetNPCList() { return npc_list; }
inline const std::unordered_map<uint16, Merc *> &GetMercList() { return merc_list; }
inline const std::unordered_map<uint16, Client *> &GetClientList() { return client_list; }
#ifdef BOTS
inline const std::list<Bot *> &GetBotList() { return bot_list; }
std::vector<Bot *> GetBotListByCharacterID(uint32 character_id, uint8 class_id = NO_CLASS);
std::vector<Bot *> GetBotListByClientName(std::string client_name, uint8 class_id = NO_CLASS);
@ -556,7 +547,6 @@ public:
void SignalAllBotsByOwnerName(std::string owner_name, int signal_id);
void SignalBotByBotID(uint32 bot_id, int signal_id);
void SignalBotByBotName(std::string bot_name, int signal_id);
#endif
inline const std::unordered_map<uint16, Corpse *> &GetCorpseList() { return corpse_list; }
inline const std::unordered_map<uint16, Object *> &GetObjectList() { return object_list; }
inline const std::unordered_map<uint16, Doors *> &GetDoorsList() { return door_list; }
@ -621,8 +611,7 @@ private:
Timer raid_timer;
Timer trap_timer;
// Please Do Not Declare Any EntityList Class Members After This Comment
#ifdef BOTS
public:
void AddBot(Bot* new_bot, bool send_spawn_packet = true, bool dont_queue = false);
bool RemoveBot(uint16 entityID);
@ -641,7 +630,6 @@ private:
void GetBotList(std::list<Bot*> &b_list);
private:
std::list<Bot*> bot_list;
#endif
};
class BulkZoneSpawnPacket {

View File

@ -33,9 +33,7 @@
#include "string_ids.h"
#include "../common/data_verification.h"
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;
@ -785,17 +783,14 @@ void Client::SetEXP(uint64 set_exp, uint64 set_aaxp, bool isrezzexp) {
else
MessageString(Chat::Experience, LOSE_LEVEL, ConvertArray(check_level, val1));
#ifdef BOTS
uint8 myoldlevel = GetLevel();
#endif
SetLevel(check_level);
#ifdef BOTS
if(RuleB(Bots, BotLevelsWithOwner))
if (RuleB(Bots, Enabled) && RuleB(Bots, BotLevelsWithOwner)) {
// hack way of doing this..but, least invasive... (same criteria as gain level for sendlvlapp)
Bot::LevelBotWithClient(this, GetLevel(), (myoldlevel==check_level-1));
#endif
Bot::LevelBotWithClient(this, GetLevel(), (myoldlevel == check_level - 1));
}
}
//If were at max level then stop gaining experience if we make it to the cap

View File

@ -2,9 +2,7 @@
#include "../../common/http/httplib.h"
#include "../../common/content/world_content_service.h"
#ifdef BOTS
#include "../bot.h"
#endif
void command_gearup(Client *c, const Seperator *sep)
{
@ -12,10 +10,8 @@ void command_gearup(Client *c, const Seperator *sep)
if (
c->GetTarget() &&
(
(c->GetTarget()->IsClient() && c->GetGM())
#ifdef BOTS
|| c->GetTarget()->IsBot()
#endif
(c->GetTarget()->IsClient() && c->GetGM()) ||
c->GetTarget()->IsBot()
)
) {
t = c->GetTarget();
@ -119,19 +115,15 @@ void command_gearup(Client *c, const Seperator *sep)
bool has_item = false;
if (t->IsClient()) {
has_item = t->CastToClient()->GetInv().HasItem(item_id, 1, invWhereWorn) != INVALID_INDEX;
#ifdef BOTS
} else if (t->IsBot()) {
has_item = t->CastToBot()->HasBotItem(item_id);
#endif
}
bool can_wear_item = false;
if (t->IsClient()) {
can_wear_item = !t->CastToClient()->CheckLoreConflict(item) && !has_item;
#ifdef BOTS
} else if (t->IsBot()) {
can_wear_item = !t->CastToBot()->CheckLoreConflict(item) && !has_item;
#endif
}
if (!can_wear_item) {
@ -142,10 +134,8 @@ void command_gearup(Client *c, const Seperator *sep)
can_wear_item &&
t->CanClassEquipItem(item_id) &&
(
t->CanRaceEquipItem(item_id)
#ifdef BOTS
|| (t->IsBot() && !t->CanRaceEquipItem(item_id) && RuleB(Bots, AllowBotEquipAnyRaceGear))
#endif
t->CanRaceEquipItem(item_id) ||
(t->IsBot() && !t->CanRaceEquipItem(item_id) && RuleB(Bots, AllowBotEquipAnyRaceGear))
)
) {
equipped.insert(slot_id);
@ -156,10 +146,8 @@ void command_gearup(Client *c, const Seperator *sep)
0, 0, 0, 0, 0, 0, 0, 0,
slot_id
);
#ifdef BOTS
} else if (t->IsBot()) {
t->CastToBot()->AddBotItem(slot_id, item_id);
#endif
}
items_equipped++;

View File

@ -13,7 +13,7 @@ void command_level(Client *c, const Seperator *sep)
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
auto level = static_cast<uint8>(std::stoul(sep->arg[1]));
auto max_level = static_cast<uint8>(RuleI(Character, MaxLevel));
@ -41,11 +41,8 @@ void command_level(Client *c, const Seperator *sep)
if (target->IsClient()) {
target->CastToClient()->SendLevelAppearance();
#ifdef BOTS
if (RuleB(Bots, BotLevelsWithOwner)) {
if (RuleB(Bots, Enabled) && RuleB(Bots, BotLevelsWithOwner)) {
Bot::LevelBotWithClient(target->CastToClient(), level, true);
}
#endif
}
}
}

View File

@ -53,12 +53,10 @@ void command_zone(Client *c, const Seperator *sep)
return;
}
#ifdef BOTS
// This block is necessary to clean up any bot objects owned by a Client
if (zone_id != c->GetZoneID()) {
if (RuleB(Bots, Enabled) && zone_id != c->GetZoneID()) {
Bot::ProcessClientZoneChange(c);
}
#endif
// fetch zone data
auto zd = GetZoneVersionWithFallback(zone_id, 0);

View File

@ -343,9 +343,9 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte
safe_delete(outapp);
#ifdef BOTS
Bot::UpdateGroupCastingRoles(this);
#endif
if (RuleB(Bots, Enabled)) {
Bot::UpdateGroupCastingRoles(this);
}
return true;
}
@ -524,9 +524,9 @@ bool Group::UpdatePlayer(Mob* update){
if (update->IsClient() && !mentoree && mentoree_name.length() && !mentoree_name.compare(update->GetName()))
mentoree = update->CastToClient();
#ifdef BOTS
Bot::UpdateGroupCastingRoles(this);
#endif
if (RuleB(Bots, Enabled)) {
Bot::UpdateGroupCastingRoles(this);
}
return updateSuccess;
}
@ -561,9 +561,9 @@ void Group::MemberZoned(Mob* removemob) {
if (removemob->IsClient() && removemob == mentoree)
mentoree = nullptr;
#ifdef BOTS
Bot::UpdateGroupCastingRoles(this);
#endif
if (RuleB(Bots, Enabled)) {
Bot::UpdateGroupCastingRoles(this);
}
}
void Group::SendGroupJoinOOZ(Mob* NewMember) {
@ -782,9 +782,9 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender)
ClearAllNPCMarks();
}
#ifdef BOTS
Bot::UpdateGroupCastingRoles(this);
#endif
if (RuleB(Bots, Enabled)) {
Bot::UpdateGroupCastingRoles(this);
}
return true;
}
@ -895,9 +895,9 @@ uint32 Group::GetTotalGroupDamage(Mob* other) {
}
void Group::DisbandGroup(bool joinraid) {
#ifdef BOTS
Bot::UpdateGroupCastingRoles(this, true);
#endif
if (RuleB(Bots, Enabled)) {
Bot::UpdateGroupCastingRoles(this, true);
}
auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate_Struct));
@ -990,7 +990,6 @@ void Group::GetClientList(std::list<Client*>& client_list, bool clear_list)
}
}
#ifdef BOTS
void Group::GetBotList(std::list<Bot*>& bot_list, bool clear_list)
{
if (clear_list)
@ -1001,7 +1000,6 @@ void Group::GetBotList(std::list<Bot*>& bot_list, bool clear_list)
bot_list.push_back(bot_iter->CastToBot());
}
}
#endif
bool Group::Process() {
if(disbandcheck && !GroupCount())

View File

@ -62,9 +62,7 @@ public:
void DisbandGroup(bool joinraid = false);
void GetMemberList(std::list<Mob*>& member_list, bool clear_list = true);
void GetClientList(std::list<Client*>& client_list, bool clear_list = true);
#ifdef BOTS
void GetBotList(std::list<Bot*>& bot_list, bool clear_list = true);
#endif
bool IsGroupMember(Mob* c);
bool IsGroupMember(const char* name);
bool Process();

View File

@ -383,19 +383,10 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center, Mob *skip, bool skip_mezzed
int64 current_hate = cur->stored_hate_amount;
#ifdef BOTS
if (cur->entity_on_hatelist->IsClient() || cur->entity_on_hatelist->IsBot()){
if (cur->entity_on_hatelist->IsClient() && cur->entity_on_hatelist->CastToClient()->IsSitting()){
aggro_mod += RuleI(Aggro, SittingAggroMod);
}
#else
if (cur->entity_on_hatelist->IsClient()){
if (cur->entity_on_hatelist->CastToClient()->IsSitting()){
aggro_mod += RuleI(Aggro, SittingAggroMod);
}
#endif
if (center){
if (center->GetTarget() == cur->entity_on_hatelist)
@ -445,14 +436,12 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center, Mob *skip, bool skip_mezzed
if (top_client_type_in_range != nullptr && top_hate != nullptr) {
bool isTopClientType = top_hate->IsClient();
#ifdef BOTS
if (!isTopClientType) {
if (top_hate->IsBot()) {
isTopClientType = true;
top_client_type_in_range = top_hate;
}
}
#endif //BOTS
if (!isTopClientType) {
if (top_hate->IsMerc()) {
@ -850,7 +839,6 @@ void HateList::RemoveStaleEntries(int time_ms, float dist)
}
}
#ifdef BOTS
Bot* HateList::GetRandomBotOnHateList(bool skip_mezzed)
{
int count = list.size();
@ -899,7 +887,6 @@ Bot* HateList::GetRandomBotOnHateList(bool skip_mezzed)
return nullptr;
}
#endif
Client* HateList::GetRandomClientOnHateList(bool skip_mezzed)
{

View File

@ -49,9 +49,7 @@ public:
Mob *GetEscapingEntOnHateList(); // returns first eligble entity
Mob *GetEscapingEntOnHateList(Mob *center, float range = 0.0f, bool first = false);
#ifdef BOTS
Bot* GetRandomBotOnHateList(bool skip_mezzed = false);
#endif
Client *GetRandomClientOnHateList(bool skip_mezzed = false);
NPC *GetRandomNPCOnHateList(bool skip_mezzed = false);

View File

@ -16,8 +16,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef BOTS
#include "bot.h"
#define SAFE_HP_RATIO_CLOTH 95.0f
@ -960,5 +958,3 @@ bool IsHealRotationTargetMobType(Mob* target_mob)
return true;
}
#endif // BOTS

View File

@ -20,8 +20,6 @@
#ifndef HEAL_ROTATION_H
#define HEAL_ROTATION_H
#ifdef BOTS
#include "mob.h"
#define CASTING_CYCLE_MINIMUM_INTERVAL 1000
@ -161,5 +159,3 @@ bool IsHealRotationMemberClass(uint8 class_id);
bool IsHealRotationTargetMobType(Mob* target_mob);
#endif
#endif // BOTS

View File

@ -25,9 +25,7 @@
#include "zonedb.h"
#include "../common/zone_store.h"
#ifdef BOTS
#include "bot.h"
#endif
extern WorldServer worldserver;
@ -4567,7 +4565,6 @@ const int EQ::InventoryProfile::GetItemStatValue(uint32 item_id, std::string ide
return stat;
}
#ifdef BOTS
// Returns a slot's item ID (returns INVALID_ID if not found)
int32 Bot::GetItemIDAt(int16 slot_id) {
if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
@ -4635,5 +4632,3 @@ int32 Bot::GetAugmentIDAt(int16 slot_id, uint8 augslot) {
// None found
return INVALID_ID;
}
#endif

View File

@ -1,4 +1,3 @@
#ifdef BOTS
#ifdef LUA_EQEMU
#include "lua.hpp"
@ -474,4 +473,3 @@ luabind::scope lua_register_bot() {
}
#endif
#endif

View File

@ -1,4 +1,3 @@
#ifdef BOTS
#ifndef EQEMU_LUA_BOT_H
#define EQEMU_LUA_BOT_H
#ifdef LUA_EQEMU
@ -122,4 +121,3 @@ public:
#endif
#endif
#endif

View File

@ -2703,12 +2703,10 @@ void Lua_Client::ApplySpell(int spell_id, int duration, bool allow_pets) {
self->ApplySpell(spell_id, duration, ApplySpellType::Solo, allow_pets);
}
#ifdef BOTS
void Lua_Client::ApplySpell(int spell_id, int duration, bool allow_pets, bool allow_bots) {
Lua_Safe_Call_Void();
self->ApplySpell(spell_id, duration, ApplySpellType::Solo, allow_pets, true, allow_bots);
}
#endif
void Lua_Client::ApplySpellGroup(int spell_id) {
Lua_Safe_Call_Void();
@ -2725,12 +2723,10 @@ void Lua_Client::ApplySpellGroup(int spell_id, int duration, bool allow_pets) {
self->ApplySpell(spell_id, duration, ApplySpellType::Group, allow_pets);
}
#ifdef BOTS
void Lua_Client::ApplySpellGroup(int spell_id, int duration, bool allow_pets, bool allow_bots) {
Lua_Safe_Call_Void();
self->ApplySpell(spell_id, duration, ApplySpellType::Group, allow_pets, true, allow_bots);
}
#endif
void Lua_Client::ApplySpellRaid(int spell_id) {
Lua_Safe_Call_Void();
@ -2752,12 +2748,10 @@ void Lua_Client::ApplySpellRaid(int spell_id, int duration, bool allow_pets, boo
self->ApplySpell(spell_id, duration, ApplySpellType::Raid, allow_pets, is_raid_group_only);
}
#ifdef BOTS
void Lua_Client::ApplySpellRaid(int spell_id, int duration, bool allow_pets, bool is_raid_group_only, bool allow_bots) {
Lua_Safe_Call_Void();
self->ApplySpell(spell_id, duration, ApplySpellType::Raid, allow_pets, is_raid_group_only, allow_bots);
}
#endif
void Lua_Client::SetSpellDuration(int spell_id) {
Lua_Safe_Call_Void();
@ -2774,12 +2768,10 @@ void Lua_Client::SetSpellDuration(int spell_id, int duration, bool allow_pets) {
self->SetSpellDuration(spell_id, duration, ApplySpellType::Solo, allow_pets);
}
#ifdef BOTS
void Lua_Client::SetSpellDuration(int spell_id, int duration, bool allow_pets, bool allow_bots) {
Lua_Safe_Call_Void();
self->SetSpellDuration(spell_id, duration, ApplySpellType::Solo, allow_pets, true, allow_bots);
}
#endif
void Lua_Client::SetSpellDurationGroup(int spell_id) {
Lua_Safe_Call_Void();
@ -2796,12 +2788,10 @@ void Lua_Client::SetSpellDurationGroup(int spell_id, int duration, bool allow_pe
self->SetSpellDuration(spell_id, duration, ApplySpellType::Group, allow_pets);
}
#ifdef BOTS
void Lua_Client::SetSpellDurationGroup(int spell_id, int duration, bool allow_pets, bool allow_bots) {
Lua_Safe_Call_Void();
self->SetSpellDuration(spell_id, duration, ApplySpellType::Group, allow_pets, true, allow_bots);
}
#endif
void Lua_Client::SetSpellDurationRaid(int spell_id) {
Lua_Safe_Call_Void();
@ -2823,12 +2813,10 @@ void Lua_Client::SetSpellDurationRaid(int spell_id, int duration, bool allow_pet
self->SetSpellDuration(spell_id, duration, ApplySpellType::Raid, allow_pets, is_raid_group_only);
}
#ifdef BOTS
void Lua_Client::SetSpellDurationRaid(int spell_id, int duration, bool allow_pets, bool is_raid_group_only, bool allow_bots) {
Lua_Safe_Call_Void();
self->SetSpellDuration(spell_id, duration, ApplySpellType::Group, allow_pets, is_raid_group_only, allow_bots);
}
#endif
void Lua_Client::UpdateAdmin() {
Lua_Safe_Call_Void();
@ -2942,8 +2930,6 @@ void Lua_Client::SendPath(Lua_Mob target)
self->SendPath(target);
}
#ifdef BOTS
int Lua_Client::GetBotRequiredLevel()
{
Lua_Safe_Call_Int();
@ -3028,8 +3014,6 @@ void Lua_Client::CampAllBots(uint8 class_id)
self->CampAllBots(class_id);
}
#endif
luabind::scope lua_register_client() {
return luabind::class_<Lua_Client, Lua_Mob>("Client")
.def(luabind::constructor<>())
@ -3061,22 +3045,16 @@ luabind::scope lua_register_client() {
.def("ApplySpell", (void(Lua_Client::*)(int))&Lua_Client::ApplySpell)
.def("ApplySpell", (void(Lua_Client::*)(int,int))&Lua_Client::ApplySpell)
.def("ApplySpell", (void(Lua_Client::*)(int,int,bool))&Lua_Client::ApplySpell)
#ifdef BOTS
.def("ApplySpell", (void(Lua_Client::*)(int,int,bool,bool))&Lua_Client::ApplySpell)
#endif
.def("ApplySpellGroup", (void(Lua_Client::*)(int))&Lua_Client::ApplySpellGroup)
.def("ApplySpellGroup", (void(Lua_Client::*)(int,int))&Lua_Client::ApplySpellGroup)
.def("ApplySpellGroup", (void(Lua_Client::*)(int,int,bool))&Lua_Client::ApplySpellGroup)
#ifdef BOTS
.def("ApplySpellGroup", (void(Lua_Client::*)(int,int,bool,bool))&Lua_Client::ApplySpellGroup)
#endif
.def("ApplySpellRaid", (void(Lua_Client::*)(int))&Lua_Client::ApplySpellRaid)
.def("ApplySpellRaid", (void(Lua_Client::*)(int,int))&Lua_Client::ApplySpellRaid)
.def("ApplySpellRaid", (void(Lua_Client::*)(int,int,bool))&Lua_Client::ApplySpellRaid)
.def("ApplySpellRaid", (void(Lua_Client::*)(int,int,bool,bool))&Lua_Client::ApplySpellRaid)
#ifdef BOTS
.def("ApplySpellRaid", (void(Lua_Client::*)(int,int,bool,bool,bool))&Lua_Client::ApplySpellRaid)
#endif
.def("AssignTask", (void(Lua_Client::*)(int))&Lua_Client::AssignTask)
.def("AssignTask", (void(Lua_Client::*)(int,int))&Lua_Client::AssignTask)
.def("AssignTask", (void(Lua_Client::*)(int,int,bool))&Lua_Client::AssignTask)
@ -3088,10 +3066,8 @@ luabind::scope lua_register_client() {
.def("CalcEXP", (uint64(Lua_Client::*)(uint8))&Lua_Client::CalcEXP)
.def("CalcEXP", (uint64(Lua_Client::*)(uint8,bool))&Lua_Client::CalcEXP)
.def("CalcPriceMod", (float(Lua_Client::*)(Lua_Mob,bool))&Lua_Client::CalcPriceMod)
#ifdef BOTS
.def("CampAllBots", (void(Lua_Client::*)(void))&Lua_Client::CampAllBots)
.def("CampAllBots", (void(Lua_Client::*)(uint8))&Lua_Client::CampAllBots)
#endif
.def("CanEnterZone", (bool(Lua_Client::*)(std::string))&Lua_Client::CanEnterZone)
.def("CanEnterZone", (bool(Lua_Client::*)(std::string,int16))&Lua_Client::CanEnterZone)
.def("CanHaveSkill", (bool(Lua_Client::*)(int))&Lua_Client::CanHaveSkill)
@ -3181,18 +3157,12 @@ luabind::scope lua_register_client() {
.def("GetBindZ", (float(Lua_Client::*)(void))&Lua_Client::GetBindZ)
.def("GetBindZoneID", (uint32(Lua_Client::*)(int))&Lua_Client::GetBindZoneID)
.def("GetBindZoneID", (uint32(Lua_Client::*)(void))&Lua_Client::GetBindZoneID)
#ifdef BOTS
.def("GetBotCreationLimit", (uint32(Lua_Client::*)(void))&Lua_Client::GetBotCreationLimit)
.def("GetBotCreationLimit", (uint32(Lua_Client::*)(uint8))&Lua_Client::GetBotCreationLimit)
.def("GetBotRequiredLevel", (int(Lua_Client::*)(void))&Lua_Client::GetBotRequiredLevel)
.def("GetBotRequiredLevel", (int(Lua_Client::*)(uint8))&Lua_Client::GetBotRequiredLevel)
.def("GetBotSpawnLimit", (int(Lua_Client::*)(void))&Lua_Client::GetBotSpawnLimit)
.def("GetBotSpawnLimit", (int(Lua_Client::*)(uint8))&Lua_Client::GetBotSpawnLimit)
#endif
.def("GetCarriedMoney", (uint64(Lua_Client::*)(void))&Lua_Client::GetCarriedMoney)
.def("GetCarriedPlatinum", (uint32(Lua_Client::*)(void))&Lua_Client::GetCarriedPlatinum)
.def("GetCharacterFactionLevel", (int(Lua_Client::*)(int))&Lua_Client::GetCharacterFactionLevel)
@ -3448,18 +3418,12 @@ luabind::scope lua_register_client() {
.def("SetBindPoint", (void(Lua_Client::*)(int,int,float,float,float))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(int,int,float,float,float,float))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(void))&Lua_Client::SetBindPoint)
#ifdef BOTS
.def("SetBotCreationLimit", (void(Lua_Client::*)(uint32))&Lua_Client::SetBotCreationLimit)
.def("SetBotCreationLimit", (void(Lua_Client::*)(uint32,uint8))&Lua_Client::SetBotCreationLimit)
.def("SetBotRequiredLevel", (void(Lua_Client::*)(int))&Lua_Client::SetBotRequiredLevel)
.def("SetBotRequiredLevel", (void(Lua_Client::*)(int,uint8))&Lua_Client::SetBotRequiredLevel)
.def("SetBotSpawnLimit", (void(Lua_Client::*)(int))&Lua_Client::SetBotSpawnLimit)
.def("SetBotSpawnLimit", (void(Lua_Client::*)(int,uint8))&Lua_Client::SetBotSpawnLimit)
#endif
.def("SetClientMaxLevel", (void(Lua_Client::*)(int))&Lua_Client::SetClientMaxLevel)
.def("SetConsumption", (void(Lua_Client::*)(int, int))&Lua_Client::SetConsumption)
.def("SetDeity", (void(Lua_Client::*)(int))&Lua_Client::SetDeity)
@ -3495,22 +3459,16 @@ luabind::scope lua_register_client() {
.def("SetSpellDuration", (void(Lua_Client::*)(int))&Lua_Client::SetSpellDuration)
.def("SetSpellDuration", (void(Lua_Client::*)(int,int))&Lua_Client::SetSpellDuration)
.def("SetSpellDuration", (void(Lua_Client::*)(int,int,bool))&Lua_Client::SetSpellDuration)
#ifdef BOTS
.def("SetSpellDuration", (void(Lua_Client::*)(int,int,bool,bool))&Lua_Client::SetSpellDuration)
#endif
.def("SetSpellDurationGroup", (void(Lua_Client::*)(int))&Lua_Client::SetSpellDurationGroup)
.def("SetSpellDurationGroup", (void(Lua_Client::*)(int,int))&Lua_Client::SetSpellDurationGroup)
.def("SetSpellDurationGroup", (void(Lua_Client::*)(int,int,bool))&Lua_Client::SetSpellDurationGroup)
#ifdef BOTS
.def("SetSpellDurationGroup", (void(Lua_Client::*)(int,int,bool,bool))&Lua_Client::SetSpellDurationGroup)
#endif
.def("SetSpellDurationRaid", (void(Lua_Client::*)(int))&Lua_Client::SetSpellDurationRaid)
.def("SetSpellDurationRaid", (void(Lua_Client::*)(int,int))&Lua_Client::SetSpellDurationRaid)
.def("SetSpellDurationRaid", (void(Lua_Client::*)(int,int,bool))&Lua_Client::SetSpellDurationRaid)
.def("SetSpellDurationRaid", (void(Lua_Client::*)(int,int,bool,bool))&Lua_Client::SetSpellDurationRaid)
#ifdef BOTS
.def("SetSpellDurationRaid", (void(Lua_Client::*)(int,int,bool,bool,bool))&Lua_Client::SetSpellDurationRaid)
#endif
.def("SetStartZone", (void(Lua_Client::*)(int))&Lua_Client::SetStartZone)
.def("SetStartZone", (void(Lua_Client::*)(int,float))&Lua_Client::SetStartZone)
.def("SetStartZone", (void(Lua_Client::*)(int,float,float))&Lua_Client::SetStartZone)

View File

@ -466,46 +466,34 @@ public:
void ApplySpell(int spell_id);
void ApplySpell(int spell_id, int duration);
void ApplySpell(int spell_id, int duration, bool allow_pets);
#ifdef BOTS
void ApplySpell(int spell_id, int duration, bool allow_pets, bool allow_bots);
#endif
void ApplySpellGroup(int spell_id);
void ApplySpellGroup(int spell_id, int duration);
void ApplySpellGroup(int spell_id, int duration, bool allow_pets);
#ifdef BOTS
void ApplySpellGroup(int spell_id, int duration, bool allow_pets, bool allow_bots);
#endif
void ApplySpellRaid(int spell_id);
void ApplySpellRaid(int spell_id, int duration);
void ApplySpellRaid(int spell_id, int duration, bool allow_pets);
void ApplySpellRaid(int spell_id, int duration, bool allow_pets, bool is_raid_group_only);
#ifdef BOTS
void ApplySpellRaid(int spell_id, int duration, bool allow_pets, bool is_raid_group_only, bool allow_bots);
#endif
void SetSpellDuration(int spell_id);
void SetSpellDuration(int spell_id, int duration);
void SetSpellDuration(int spell_id, int duration, bool allow_pets);
#ifdef BOTS
void SetSpellDuration(int spell_id, int duration, bool allow_pets, bool allow_bots);
#endif
void SetSpellDurationGroup(int spell_id);
void SetSpellDurationGroup(int spell_id, int duration);
void SetSpellDurationGroup(int spell_id, int duration, bool allow_pets);
#ifdef BOTS
void SetSpellDurationGroup(int spell_id, int duration, bool allow_pets, bool allow_bots);
#endif
void SetSpellDurationRaid(int spell_id);
void SetSpellDurationRaid(int spell_id, int duration);
void SetSpellDurationRaid(int spell_id, int duration, bool allow_pets);
void SetSpellDurationRaid(int spell_id, int duration, bool allow_pets, bool is_raid_group_only);
#ifdef BOTS
void SetSpellDurationRaid(int spell_id, int duration, bool allow_pets, bool is_raid_group_only, bool allow_bots);
#endif
int GetEnvironmentDamageModifier();
@ -524,8 +512,6 @@ public:
bool SendGMCommand(std::string message);
bool SendGMCommand(std::string message, bool ignore_status);
#ifdef BOTS
int GetBotRequiredLevel();
int GetBotRequiredLevel(uint8 class_id);
uint32 GetBotCreationLimit();
@ -541,8 +527,6 @@ public:
void CampAllBots();
void CampAllBots(uint8 class_id);
#endif
void DialogueWindow(std::string markdown);
Lua_Expedition CreateExpedition(luabind::object expedition_info);

View File

@ -12,9 +12,7 @@
#include "lua_object.h"
#include "lua_door.h"
#ifdef BOTS
#include "lua_bot.h"
#endif
bool Lua_Entity::IsClient() {
Lua_Safe_Call_Bool();
@ -122,22 +120,18 @@ Lua_Door Lua_Entity::CastToDoor() {
return Lua_Door(m);
}
#ifdef BOTS
Lua_Bot Lua_Entity::CastToBot() {
void *d = GetLuaPtrData();
Bot *b = reinterpret_cast<Bot*>(d);
return Lua_Bot(b);
}
#endif
luabind::scope lua_register_entity() {
return luabind::class_<Lua_Entity>("Entity")
.def(luabind::constructor<>())
.property("null", &Lua_Entity::Null)
.property("valid", &Lua_Entity::Valid)
#ifdef BOTS
.def("CastToBot", &Lua_Entity::CastToBot)
#endif
.def("CastToClient", &Lua_Entity::CastToClient)
.def("CastToCorpse", &Lua_Entity::CastToCorpse)
.def("CastToDoor", &Lua_Entity::CastToDoor)

View File

@ -6,9 +6,7 @@
class Entity;
class Lua_Client;
#ifdef BOTS
class Lua_Bot;
#endif
class Lua_NPC;
class Lua_Mob;
struct Lua_HateList;
@ -57,10 +55,8 @@ public:
Lua_Corpse CastToCorpse();
Lua_Object CastToObject();
Lua_Door CastToDoor();
#ifdef BOTS
Lua_Bot CastToBot();
#endif
};
#endif
#endif
#endif

View File

@ -17,9 +17,7 @@
#include "lua_raid.h"
#include "lua_spawn.h"
#ifdef BOTS
#include "lua_bot.h"
#endif
struct Lua_Mob_List {
std::vector<Lua_Mob> entries;
@ -33,11 +31,9 @@ struct Lua_Client_List {
std::vector<Lua_Client> entries;
};
#ifdef BOTS
struct Lua_Bot_List {
std::vector<Lua_Bot> entries;
};
#endif
struct Lua_Corpse_List {
std::vector<Lua_Corpse> entries;
@ -374,7 +370,6 @@ Lua_Client_List Lua_EntityList::GetClientList() {
return ret;
}
#ifdef BOTS
Lua_Bot Lua_EntityList::GetBotByID(uint32 bot_id) {
Lua_Safe_Call_Class(Lua_Bot);
return Lua_Bot(self->GetBotByBotID(bot_id));
@ -484,7 +479,6 @@ void Lua_EntityList::SignalBotByBotName(std::string bot_name, int signal_id) {
Lua_Safe_Call_Void();
self->SignalBotByBotName(bot_name, signal_id);
}
#endif
Lua_Client_List Lua_EntityList::GetShuffledClientList() {
Lua_Safe_Call_Class(Lua_Client_List);
@ -628,7 +622,6 @@ void Lua_EntityList::Marquee(uint32 type, uint32 priority, uint32 fade_in, uint3
self->Marquee(type, priority, fade_in, fade_out, duration, message);
}
#ifdef BOTS
Lua_Bot Lua_EntityList::GetRandomBot() {
Lua_Safe_Call_Class(Lua_Bot);
return self->GetRandomBot();
@ -643,7 +636,6 @@ Lua_Bot Lua_EntityList::GetRandomBot(float x, float y, float z, float distance,
Lua_Safe_Call_Class(Lua_Bot);
return self->GetRandomBot(glm::vec3(x, y, z), distance, exclude_bot);
}
#endif
luabind::scope lua_register_entity_list() {
return luabind::class_<Lua_EntityList>("EntityList")
@ -660,7 +652,6 @@ luabind::scope lua_register_entity_list() {
.def("Fighting", (bool(Lua_EntityList::*)(Lua_Mob))&Lua_EntityList::Fighting)
.def("FilteredMessageClose", &Lua_EntityList::FilteredMessageClose)
.def("FindDoor", (Lua_Door(Lua_EntityList::*)(uint32))&Lua_EntityList::FindDoor)
#ifdef BOTS
.def("GetBotByID", (Lua_Bot(Lua_EntityList::*)(uint32))&Lua_EntityList::GetBotByID)
.def("GetBotByName", (Lua_Bot(Lua_EntityList::*)(std::string))&Lua_EntityList::GetBotByName)
.def("GetBotList", (Lua_Bot_List(Lua_EntityList::*)(void))&Lua_EntityList::GetBotList)
@ -670,7 +661,6 @@ luabind::scope lua_register_entity_list() {
.def("GetBotListByCharacterID", (Lua_Bot_List(Lua_EntityList::*)(uint32,uint8))&Lua_EntityList::GetBotListByCharacterID)
.def("GetBotListByClientName", (Lua_Bot_List(Lua_EntityList::*)(std::string))&Lua_EntityList::GetBotListByClientName)
.def("GetBotListByClientName", (Lua_Bot_List(Lua_EntityList::*)(std::string,uint8))&Lua_EntityList::GetBotListByClientName)
#endif
.def("GetClientByAccID", (Lua_Client(Lua_EntityList::*)(uint32))&Lua_EntityList::GetClientByAccID)
.def("GetClientByCharID", (Lua_Client(Lua_EntityList::*)(uint32))&Lua_EntityList::GetClientByCharID)
.def("GetClientByID", (Lua_Client(Lua_EntityList::*)(int))&Lua_EntityList::GetClientByID)
@ -703,11 +693,9 @@ luabind::scope lua_register_entity_list() {
.def("GetObjectList", (Lua_Object_List(Lua_EntityList::*)(void))&Lua_EntityList::GetObjectList)
.def("GetRaidByClient", (Lua_Raid(Lua_EntityList::*)(Lua_Client))&Lua_EntityList::GetRaidByClient)
.def("GetRaidByID", (Lua_Raid(Lua_EntityList::*)(int))&Lua_EntityList::GetRaidByID)
#ifdef BOTS
.def("GetRandomBot", (Lua_Bot(Lua_EntityList::*)(void))&Lua_EntityList::GetRandomBot)
.def("GetRandomBot", (Lua_Bot(Lua_EntityList::*)(float,float,float,float))&Lua_EntityList::GetRandomBot)
.def("GetRandomBot", (Lua_Bot(Lua_EntityList::*)(float,float,float,float,Lua_Bot))&Lua_EntityList::GetRandomBot)
#endif
.def("GetRandomClient", (Lua_Client(Lua_EntityList::*)(void))&Lua_EntityList::GetRandomClient)
.def("GetRandomClient", (Lua_Client(Lua_EntityList::*)(float,float,float,float))&Lua_EntityList::GetRandomClient)
.def("GetRandomClient", (Lua_Client(Lua_EntityList::*)(float,float,float,float,Lua_Client))&Lua_EntityList::GetRandomClient)
@ -737,15 +725,11 @@ luabind::scope lua_register_entity_list() {
.def("RemoveFromTargets", (void(Lua_EntityList::*)(Lua_Mob, bool))&Lua_EntityList::RemoveFromTargets)
.def("RemoveNumbers", (std::string(Lua_EntityList::*)(const char*))&Lua_EntityList::RemoveNumbers)
.def("ReplaceWithTarget", (void(Lua_EntityList::*)(Lua_Mob, Lua_Mob))&Lua_EntityList::ReplaceWithTarget)
#ifdef BOTS
.def("SignalAllBotsByOwnerCharacterID", (void(Lua_EntityList::*)(uint32, int))&Lua_EntityList::SignalAllBotsByOwnerCharacterID)
.def("SignalAllBotsByOwnerName", (void(Lua_EntityList::*)(std::string, int))&Lua_EntityList::SignalAllBotsByOwnerName)
#endif
.def("SignalAllClients", (void(Lua_EntityList::*)(int))&Lua_EntityList::SignalAllClients)
#ifdef BOTS
.def("SignalBotByBotID", (void(Lua_EntityList::*)(uint32, int))&Lua_EntityList::SignalBotByBotID)
.def("SignalBotByBotName", (void(Lua_EntityList::*)(std::string, int))&Lua_EntityList::SignalBotByBotName)
#endif
.def("SignalMobsByNPCID", (void(Lua_EntityList::*)(uint32, int))&Lua_EntityList::SignalMobsByNPCID);
}
@ -759,12 +743,10 @@ luabind::scope lua_register_client_list() {
.def_readwrite("entries", &Lua_Client_List::entries, luabind::return_stl_iterator);
}
#ifdef BOTS
luabind::scope lua_register_bot_list() {
return luabind::class_<Lua_Bot_List>("BotList")
.def_readwrite("entries", &Lua_Bot_List::entries, luabind::return_stl_iterator);
}
#endif
luabind::scope lua_register_npc_list() {
return luabind::class_<Lua_NPC_List>("NPCList")

View File

@ -7,9 +7,7 @@
class EntityList;
class Lua_Mob;
class Lua_Client;
#ifdef BOTS
class Lua_Bot;
#endif
class Lua_NPC;
class Lua_Door;
class Lua_Corpse;
@ -19,9 +17,7 @@ class Lua_Raid;
class Lua_Spawn;
struct Lua_Mob_List;
struct Lua_Client_List;
#ifdef BOTS
struct Lua_Bot_List;
#endif
struct Lua_NPC_List;
struct Lua_Corpse_List;
struct Lua_Object_List;
@ -40,10 +36,7 @@ luabind::scope lua_register_corpse_list();
luabind::scope lua_register_object_list();
luabind::scope lua_register_door_list();
luabind::scope lua_register_spawn_list();
#ifdef BOTS
luabind::scope lua_register_bot_list();
#endif
class Lua_EntityList : public Lua_Ptr<EntityList>
{
@ -130,7 +123,6 @@ public:
Lua_Spawn_List GetSpawnList();
void SignalAllClients(int signal_id);
void ChannelMessage(Lua_Mob from, int channel_num, int language, const char *message);
#ifdef BOTS
Lua_Bot GetBotByID(uint32 bot_id);
Lua_Bot GetBotByName(std::string bot_name);
Lua_Client GetBotOwnerByBotEntityID(uint32 entity_id);
@ -147,7 +139,6 @@ public:
void SignalAllBotsByOwnerName(std::string owner_name, int signal_id);
void SignalBotByBotID(uint32 bot_id, int signal_id);
void SignalBotByBotName(std::string bot_name, int signal_id);
#endif
};
#endif

View File

@ -7,10 +7,7 @@
class Group;
class Lua_Mob;
class Lua_Client;
#ifdef BOTS
class Lua_Bot;
#endif
namespace luabind {
struct scope;

View File

@ -5,10 +5,8 @@
#include "client.h"
#include "npc.h"
#ifdef BOTS
#include "bot.h"
#include "lua_bot.h"
#endif
#include "lua_item.h"
#include "lua_iteminst.h"
#include "lua_mob.h"
@ -1359,10 +1357,8 @@ void Lua_Mob::Signal(int signal_id) {
self->CastToClient()->Signal(signal_id);
} else if (self->IsNPC()) {
self->CastToNPC()->SignalNPC(signal_id);
#ifdef BOTS
} else if (self->IsBot()) {
self->CastToBot()->Signal(signal_id);
#endif
}
}
@ -2390,12 +2386,10 @@ void Lua_Mob::RemoveAllNimbusEffects() {
self->RemoveAllNimbusEffects();
}
#ifdef BOTS
Lua_Bot Lua_Mob::GetHateRandomBot() {
Lua_Safe_Call_Class(Lua_Bot);
return Lua_Bot(self->GetHateRandomBot());
}
#endif
Lua_Client Lua_Mob::GetHateRandomClient() {
Lua_Safe_Call_Class(Lua_Client);
@ -2716,10 +2710,8 @@ void Lua_Mob::SendPayload(int payload_id) {
self->CastToClient()->SendPayload(payload_id);
} else if (self->IsNPC()) {
self->CastToNPC()->SendPayload(payload_id);
#ifdef BOTS
} else if (self->IsBot()) {
self->CastToBot()->SendPayload(payload_id);
#endif
}
}
@ -2730,10 +2722,8 @@ void Lua_Mob::SendPayload(int payload_id, std::string payload_value) {
self->CastToClient()->SendPayload(payload_id, payload_value);
} else if (self->IsNPC()) {
self->CastToNPC()->SendPayload(payload_id, payload_value);
#ifdef BOTS
} else if (self->IsBot()) {
self->CastToBot()->SendPayload(payload_id, payload_value);
#endif
}
}
@ -2767,7 +2757,6 @@ uint32 Lua_Mob::BuffCount(bool is_beneficial, bool is_detrimental) {
return self->BuffCount(is_beneficial, is_detrimental);
}
#ifdef BOTS
void Lua_Mob::DamageAreaBots(int64 damage) {
Lua_Safe_Call_Void();
self->DamageArea(damage, 0, EntityFilterType::Bots);
@ -2833,7 +2822,6 @@ Lua_HateList Lua_Mob::GetHateListBots(uint32 distance) {
return ret;
}
#endif
luabind::scope lua_register_mob() {
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
@ -2929,12 +2917,10 @@ luabind::scope lua_register_mob() {
.def("DamageArea", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageArea)
.def("DamageAreaPercentage", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageAreaPercentage)
.def("DamageAreaPercentage", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageAreaPercentage)
#ifdef BOTS
.def("DamageAreaBots", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageAreaBots)
.def("DamageAreaBots", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageAreaBots)
.def("DamageAreaBotsPercentage", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageAreaBotsPercentage)
.def("DamageAreaBotsPercentage", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageAreaBotsPercentage)
#endif
.def("DamageAreaClients", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageAreaClients)
.def("DamageAreaClients", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageAreaClients)
.def("DamageAreaClientsPercentage", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageAreaClientsPercentage)
@ -2945,12 +2931,10 @@ luabind::scope lua_register_mob() {
.def("DamageAreaNPCsPercentage", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageAreaNPCsPercentage)
.def("DamageHateList", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageHateList)
.def("DamageHateList", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageHateList)
#ifdef BOTS
.def("DamageHateListBots", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageHateListBots)
.def("DamageHateListBots", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageHateListBots)
.def("DamageHateListBotsPercentage", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageHateListBots)
.def("DamageHateListBotsPercentage", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageHateListBots)
#endif
.def("DamageHateListClients", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageHateListClients)
.def("DamageHateListClients", (void(Lua_Mob::*)(int64,uint32))&Lua_Mob::DamageHateListClients)
.def("DamageHateListClientsPercentage", (void(Lua_Mob::*)(int64))&Lua_Mob::DamageHateListClientsPercentage)
@ -3064,10 +3048,8 @@ luabind::scope lua_register_mob() {
.def("GetHateClosest", &Lua_Mob::GetHateClosest)
.def("GetHateDamageTop", (Lua_Mob(Lua_Mob::*)(Lua_Mob))&Lua_Mob::GetHateDamageTop)
.def("GetHateList", &Lua_Mob::GetHateList)
#ifdef BOTS
.def("GetHateListBots", (Lua_HateList(Lua_Mob::*)(void))&Lua_Mob::GetHateListBots)
.def("GetHateListBots", (Lua_HateList(Lua_Mob::*)(uint32))&Lua_Mob::GetHateListBots)
#endif
.def("GetHateListClients", (Lua_HateList(Lua_Mob::*)(void))&Lua_Mob::GetHateListClients)
.def("GetHateListClients", (Lua_HateList(Lua_Mob::*)(uint32))&Lua_Mob::GetHateListClients)
.def("GetHateListNPCs", (Lua_HateList(Lua_Mob::*)(void))&Lua_Mob::GetHateListNPCs)
@ -3075,9 +3057,7 @@ luabind::scope lua_register_mob() {
.def("GetHateListByDistance", (Lua_HateList(Lua_Mob::*)(void))&Lua_Mob::GetHateListByDistance)
.def("GetHateListByDistance", (Lua_HateList(Lua_Mob::*)(uint32))&Lua_Mob::GetHateListByDistance)
.def("GetHateRandom", (Lua_Mob(Lua_Mob::*)(void))&Lua_Mob::GetHateRandom)
#ifdef BOTS
.def("GetHateRandomBot", (Lua_Bot(Lua_Mob::*)(void))&Lua_Mob::GetHateRandomBot)
#endif
.def("GetHateRandomClient", (Lua_Client(Lua_Mob::*)(void))&Lua_Mob::GetHateRandomClient)
.def("GetHateRandomNPC", (Lua_NPC(Lua_Mob::*)(void))&Lua_Mob::GetHateRandomNPC)
.def("GetHateTop", (Lua_Mob(Lua_Mob::*)(void))&Lua_Mob::GetHateTop)

View File

@ -9,9 +9,7 @@ struct Lua_HateList;
class Lua_Item;
class Lua_ItemInst;
class Lua_StatBonuses;
#ifdef BOTS
class Lua_Bot;
#endif
class Lua_NPC;
class Lua_Client;
@ -213,10 +211,8 @@ public:
uint16 GetOwnerID();
Lua_Mob GetUltimateOwner();
Lua_HateList GetHateList();
#ifdef BOTS
Lua_HateList GetHateListBots();
Lua_HateList GetHateListBots(uint32 distance);
#endif
Lua_HateList GetHateListClients();
Lua_HateList GetHateListClients(uint32 distance);
Lua_HateList GetHateListNPCs();
@ -227,9 +223,7 @@ public:
Lua_Mob GetHateTop();
Lua_Mob GetHateDamageTop(Lua_Mob other);
Lua_Mob GetHateRandom();
#ifdef BOTS
Lua_Bot GetHateRandomBot();
#endif
Lua_Client GetHateRandomClient();
Lua_NPC GetHateRandomNPC();
Lua_Mob GetHateClosest();
@ -488,12 +482,10 @@ public:
void DamageArea(int64 damage, uint32 distance);
void DamageAreaPercentage(int64 damage);
void DamageAreaPercentage(int64 damage, uint32 distance);
#ifdef BOTS
void DamageAreaBots(int64 damage);
void DamageAreaBots(int64 damage, uint32 distance);
void DamageAreaBotsPercentage(int64 damage);
void DamageAreaBotsPercentage(int64 damage, uint32 distance);
#endif
void DamageAreaClients(int64 damage);
void DamageAreaClients(int64 damage, uint32 distance);
void DamageAreaClientsPercentage(int64 damage);
@ -506,12 +498,10 @@ public:
void DamageHateList(int64 damage, uint32 distance);
void DamageHateListPercentage(int64 damage);
void DamageHateListPercentage(int64 damage, uint32 distance);
#ifdef BOTS
void DamageHateListBots(int64 damage);
void DamageHateListBots(int64 damage, uint32 distance);
void DamageHateListBotsPercentage(int64 damage);
void DamageHateListBotsPercentage(int64 damage, uint32 distance);
#endif
void DamageHateListClients(int64 damage);
void DamageHateListClients(int64 damage, uint32 distance);
void DamageHateListClientsPercentage(int64 damage);

View File

@ -41,9 +41,7 @@
#include "lua_stat_bonuses.h"
#include "../common/path_manager.h"
#ifdef BOTS
#include "lua_bot.h"
#endif
const char *LuaEvents[_LargestEventID] = {
"event_say",
@ -179,10 +177,7 @@ LuaParser::LuaParser() {
ItemArgumentDispatch[i] = handle_item_null;
SpellArgumentDispatch[i] = handle_spell_null;
EncounterArgumentDispatch[i] = handle_encounter_null;
#ifdef BOTS
BotArgumentDispatch[i] = handle_bot_null;
#endif
}
NPCArgumentDispatch[EVENT_SAY] = handle_npc_event_say;
@ -298,7 +293,6 @@ LuaParser::LuaParser() {
EncounterArgumentDispatch[EVENT_ENCOUNTER_LOAD] = handle_encounter_load;
EncounterArgumentDispatch[EVENT_ENCOUNTER_UNLOAD] = handle_encounter_unload;
#ifdef BOTS
BotArgumentDispatch[EVENT_CAST] = handle_bot_cast;
BotArgumentDispatch[EVENT_CAST_BEGIN] = handle_bot_cast;
BotArgumentDispatch[EVENT_CAST_ON] = handle_bot_cast;
@ -1188,9 +1182,7 @@ void LuaParser::MapFunctions(lua_State *L) {
lua_register_special_abilities(),
lua_register_npc(),
lua_register_client(),
#ifdef BOTS
lua_register_bot(),
#endif
lua_register_inventory(),
lua_register_inventory_where(),
lua_register_iteminst(),
@ -1202,9 +1194,7 @@ void LuaParser::MapFunctions(lua_State *L) {
lua_register_entity_list(),
lua_register_mob_list(),
lua_register_client_list(),
#ifdef BOTS
lua_register_bot_list(),
#endif
lua_register_npc_list(),
lua_register_corpse_list(),
lua_register_object_list(),
@ -1507,7 +1497,6 @@ int64 LuaParser::CalcSpellEffectValue_formula(Mob *self, uint32 formula, int64 b
return retval;
}
#ifdef BOTS
int LuaParser::EventBot(
QuestEventID evt,
Bot *bot,
@ -1687,6 +1676,3 @@ void LuaParser::LoadBotScript(std::string filename) {
void LuaParser::LoadGlobalBotScript(std::string filename) {
LoadScript(filename, "global_bot");
}
#endif
#endif

View File

@ -91,8 +91,6 @@ public:
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
#ifdef BOTS
virtual int EventBot(
QuestEventID evt,
Bot *bot,
@ -109,7 +107,6 @@ public:
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
#endif
virtual bool HasQuestSub(uint32 npc_id, QuestEventID evt);
virtual bool HasGlobalQuestSub(QuestEventID evt);
@ -119,11 +116,8 @@ public:
virtual bool ItemHasQuestSub(EQ::ItemInstance *itm, QuestEventID evt);
virtual bool EncounterHasQuestSub(std::string encounter_name, QuestEventID evt);
virtual bool HasEncounterSub(const std::string& package_name, QuestEventID evt);
#ifdef BOTS
virtual bool BotHasQuestSub(QuestEventID evt);
virtual bool GlobalBotHasQuestSub(QuestEventID evt);
#endif
virtual void LoadNPCScript(std::string filename, int npc_id);
virtual void LoadGlobalNPCScript(std::string filename);
@ -132,11 +126,8 @@ public:
virtual void LoadItemScript(std::string filename, EQ::ItemInstance *item);
virtual void LoadSpellScript(std::string filename, uint32 spell_id);
virtual void LoadEncounterScript(std::string filename, std::string encounter_name);
#ifdef BOTS
virtual void LoadBotScript(std::string filename);
virtual void LoadGlobalBotScript(std::string filename);
#endif
virtual void AddVar(std::string name, std::string val);
virtual std::string GetVar(std::string name);
@ -178,8 +169,6 @@ public:
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
#ifdef BOTS
virtual int DispatchEventBot(
QuestEventID evt,
Bot *bot,
@ -188,7 +177,6 @@ public:
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
#endif
static LuaParser* Instance() {
static LuaParser inst;
@ -263,8 +251,6 @@ private:
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
#ifdef BOTS
int _EventBot(
std::string package_name,
QuestEventID evt,
@ -275,7 +261,6 @@ private:
std::vector<std::any> *extra_pointers,
luabind::adl::object *l_func = nullptr
);
#endif
void LoadScript(std::string filename, std::string package_name);
void MapFunctions(lua_State *L);
@ -291,11 +276,7 @@ private:
ItemArgumentHandler ItemArgumentDispatch[_LargestEventID];
SpellArgumentHandler SpellArgumentDispatch[_LargestEventID];
EncounterArgumentHandler EncounterArgumentDispatch[_LargestEventID];
#ifdef BOTS
BotArgumentHandler BotArgumentDispatch[_LargestEventID];
#endif
};
#endif

View File

@ -1666,7 +1666,6 @@ void handle_player_augment_remove(
// Bot
#ifdef BOTS
void handle_bot_null(
QuestInterface *parse,
lua_State* L,
@ -1953,5 +1952,3 @@ void handle_bot_use_skill(
}
#endif
#endif

View File

@ -7,10 +7,7 @@ typedef void(*PlayerArgumentHandler)(QuestInterface*, lua_State*, Client*, std::
typedef void(*ItemArgumentHandler)(QuestInterface*, lua_State*, Client*, EQ::ItemInstance*, Mob*, std::string, uint32, std::vector<std::any>*);
typedef void(*SpellArgumentHandler)(QuestInterface*, lua_State*, Mob*, Client*, uint32, std::string, uint32, std::vector<std::any>*);
typedef void(*EncounterArgumentHandler)(QuestInterface*, lua_State*, Encounter* encounter, std::string, uint32, std::vector<std::any>*);
#ifdef BOTS
typedef void(*BotArgumentHandler)(QuestInterface*, lua_State*, Bot*, Mob*, std::string, uint32, std::vector<std::any>*);
#endif
// NPC
void handle_npc_event_say(
@ -828,7 +825,6 @@ void handle_encounter_null(
);
// Bot
#ifdef BOTS
void handle_bot_null(
QuestInterface *parse,
lua_State* L,
@ -959,7 +955,5 @@ void handle_bot_payload(
std::vector<std::any> *extra_pointers
);
#endif
#endif
#endif

View File

@ -45,9 +45,7 @@
#include "zone.h"
#include "queryserv.h"
#include "command.h"
#ifdef BOTS
#include "bot_command.h"
#endif
#include "zonedb.h"
#include "../common/zone_store.h"
#include "titles.h"
@ -394,10 +392,9 @@ int main(int argc, char** argv) {
EQ::SayLinkEngine::LoadCachedSaylinks();
#ifdef BOTS
LogInfo("Loading bot commands");
int botretval = bot_command_init();
if (botretval<0)
if (botretval < 0)
LogError("Bot command loading failed");
else
LogInfo("[{}] bot commands loaded", botretval);
@ -405,7 +402,6 @@ int main(int argc, char** argv) {
LogInfo("Loading bot spell casting chances");
if (!database.botdb.LoadBotSpellCastingChances())
LogError("Bot spell casting chances loading failed");
#endif
/**
* NPC Scale Manager
@ -604,9 +600,7 @@ int main(int argc, char** argv) {
safe_delete(task_manager);
safe_delete(npc_scale_manager);
command_deinit();
#ifdef BOTS
bot_command_deinit();
#endif
safe_delete(parse);
LogInfo("Proper zone shutdown complete.");
LogSys.CloseFileLogs();

View File

@ -13,7 +13,4 @@
#include "beacon.h"
#include "horse.h"
#ifdef BOTS
#include "bot.h"
#endif

View File

@ -33,9 +33,7 @@
#include <sstream>
#include <algorithm>
#ifdef BOTS
#include "bot.h"
#endif
extern EntityList entity_list;
@ -509,9 +507,7 @@ Mob::Mob(
queue_wearchange_slot = -1;
#ifdef BOTS
m_manual_follow = false;
#endif
mob_close_scan_timer.Trigger();
@ -564,9 +560,7 @@ Mob::~Mob()
close_mobs.clear();
#ifdef BOTS
LeaveHealRotationTargetPool();
#endif
}
uint32 Mob::GetAppearanceValue(EmuAppearance iAppearance) {
@ -768,11 +762,7 @@ int Mob::_GetWalkSpeed() const {
return(0);
//runspeed cap.
#ifdef BOTS
if (IsClient() || IsBot())
#else
if(IsClient())
#endif
{
if(speed_mod > runspeedcap)
speed_mod = runspeedcap;
@ -831,11 +821,7 @@ int Mob::_GetRunSpeed() const {
if (!has_horse && movemod != 0)
{
#ifdef BOTS
if (IsClient() || IsBot())
#else
if (IsClient())
#endif
{
speed_mod += (speed_mod * movemod / 100);
} else {
@ -864,11 +850,7 @@ int Mob::_GetRunSpeed() const {
return(0);
}
//runspeed cap.
#ifdef BOTS
if (IsClient() || IsBot())
#else
if(IsClient())
#endif
{
if(speed_mod > runspeedcap)
speed_mod = runspeedcap;
@ -1520,8 +1502,7 @@ void Mob::SendHPUpdate(bool force_update_all)
}
}
#ifdef BOTS
if (GetOwner() && GetOwner()->IsBot() && GetOwner()->CastToBot()->GetBotOwner() && GetOwner()->CastToBot()->GetBotOwner()->IsClient()) {
if (RuleB(Bots, Enabled) && GetOwner() && GetOwner()->IsBot() && GetOwner()->CastToBot()->GetBotOwner() && GetOwner()->CastToBot()->GetBotOwner()->IsClient()) {
auto bot_owner = GetOwner()->CastToBot()->GetBotOwner()->CastToClient();
if (bot_owner) {
bot_owner->QueuePacket(&hp_packet, false);
@ -1537,7 +1518,6 @@ void Mob::SendHPUpdate(bool force_update_all)
}
}
}
#endif
if (GetPet() && GetPet()->IsClient()) {
GetPet()->CastToClient()->QueuePacket(&hp_packet, false);
@ -1642,11 +1622,7 @@ void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) {
spu->delta_y = FloatToEQ13(m_Delta.y);
spu->delta_z = FloatToEQ13(m_Delta.z);
spu->heading = FloatToEQ12(m_Position.w);
#ifdef BOTS
if (IsClient() || IsBot())
#else
if (IsClient())
#endif
spu->animation = animation;
else
spu->animation = pRunAnimSpeed;//animation;
@ -4265,11 +4241,9 @@ void Mob::SetTarget(Mob *mob)
DisplayInfo(mob);
}
#ifdef BOTS
CastToClient()->SetBotPrecombat(false); // Any change in target will nullify this flag (target == mob checked above)
} else if (IsBot()) {
parse->EventBot(EVENT_TARGET_CHANGE, CastToBot(), mob, "", 0);
#endif
}
if (IsPet() && GetOwner() && GetOwner()->IsClient()) {
@ -6787,7 +6761,6 @@ void Mob::SetFeigned(bool in_feigned) {
feigned = in_feigned;
}
#ifdef BOTS
bool Mob::JoinHealRotationTargetPool(std::shared_ptr<HealRotation>* heal_rotation)
{
if (IsHealRotationTarget())
@ -6851,7 +6824,6 @@ float Mob::HealRotationExtendedHealFrequency()
return m_target_of_heal_rotation->ExtendedHealFrequency(this);
}
#endif
bool Mob::CanOpenDoors() const
{
@ -6891,10 +6863,8 @@ std::string Mob::GetBucketKey() {
return fmt::format("character-{}", CastToClient()->CharacterID());
} else if (IsNPC()) {
return fmt::format("npc-{}", GetNPCTypeID());
#ifdef BOTS
} else if (IsBot()) {
return fmt::format("bot-{}", CastToBot()->GetBotID());
#endif
}
return std::string();
}

View File

@ -36,9 +36,7 @@
#include <vector>
#include <memory>
#ifdef BOTS
#include "heal_rotation.h"
#endif
char* strn0cpy(char* dest, const char* source, uint32 size);
@ -725,9 +723,7 @@ public:
Mob* GetHateRandom() { return hate_list.GetRandomEntOnHateList();}
Client* GetHateRandomClient() { return hate_list.GetRandomClientOnHateList(); }
NPC* GetHateRandomNPC() { return hate_list.GetRandomNPCOnHateList(); }
#ifdef BOTS
Bot* GetHateRandomBot() { return hate_list.GetRandomBotOnHateList(); }
#endif
Mob* GetHateMost() { return hate_list.GetEntWithMostHateOnList();}
Mob* GetHateClosest() { return hate_list.GetClosestEntOnHateList(this); }
bool IsEngaged() { return(!hate_list.IsHateListEmpty()); }
@ -1437,7 +1433,6 @@ public:
int DispatchZoneControllerEvent(QuestEventID evt, Mob* init, const std::string& data, uint32 extra, std::vector<std::any>* pointers);
#ifdef BOTS
// Bots HealRotation methods
bool IsHealRotationTarget() { return (m_target_of_heal_rotation.use_count() && m_target_of_heal_rotation.get()); }
bool JoinHealRotationTargetPool(std::shared_ptr<HealRotation>* heal_rotation);
@ -1454,7 +1449,6 @@ public:
// not Bots HealRotation methods
void SetManualFollow(bool flag) { m_manual_follow = flag; }
bool GetManualFollow() const { return m_manual_follow; }
#endif
protected:
void CommonDamage(Mob* other, int64 &damage, const uint16 spell_id, const EQ::skills::SkillType attack_skill, bool &avoidable, const int8 buffslot, const bool iBuffTic, eSpecialAttacks specal = eSpecialAttacks::None);
@ -1597,10 +1591,7 @@ protected:
virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = EQ::invslot::slotPrimary, Mob *on = nullptr);
virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0); // hand = MainCharm?
uint16 GetWeaponSpeedbyHand(uint16 hand);
#ifdef BOTS
virtual
#endif
int GetBaseSkillDamage(EQ::skills::SkillType skill, Mob *target = nullptr);
virtual int GetBaseSkillDamage(EQ::skills::SkillType skill, Mob *target = nullptr);
virtual int64 GetFocusEffect(focusType type, uint16 spell_id, Mob *caster = nullptr, bool from_buff_tic = false);
virtual EQ::InventoryProfile& GetInv() { return m_inv; }
void CalculateNewFearpoint();
@ -1872,13 +1863,8 @@ protected:
private:
Mob* target;
EQ::InventoryProfile m_inv;
#ifdef BOTS
std::shared_ptr<HealRotation> m_target_of_heal_rotation;
bool m_manual_follow;
#endif
};
#endif

View File

@ -32,9 +32,7 @@
#include "fastmath.h"
#include "../common/data_verification.h"
#ifdef BOTS
#include "bot.h"
#endif
#include <glm/gtx/projection.hpp>
#include <algorithm>
@ -1119,14 +1117,12 @@ void Mob::AI_Process() {
return;
}
#ifdef BOTS
if (IsPet() && GetOwner() && GetOwner()->IsBot() && target == GetOwner())
{
// this blocks all pet attacks against owner..bot pet test (copied above check)
RemoveFromHateList(this);
return;
}
#endif //BOTS
if (DivineAura())
return;
@ -1934,11 +1930,9 @@ void Mob::AI_Event_Engaged(Mob *attacker, bool yell_for_help)
}
}
#ifdef BOTS
if (IsBot()) {
parse->EventBot(EVENT_COMBAT, CastToBot(), attacker, "1", 0);
}
#endif
}
// Note: Hate list may not be actually clear until after this function call completes
@ -1974,10 +1968,8 @@ void Mob::AI_Event_NoLongerEngaged() {
CastToNPC()->SetCombatEvent(false);
}
}
#ifdef BOTS
} else if (IsBot()) {
parse->EventBot(EVENT_COMBAT, CastToBot(), nullptr, "0", 0);
#endif
}
}

View File

@ -30,9 +30,7 @@
#include "zonedb.h"
#include "../common/zone_store.h"
#ifdef BOTS
#include "bot.h"
#endif
/**
* Stores internal representation of mob texture by material slot
@ -435,7 +433,6 @@ void Mob::SendWearChange(uint8 material_slot, Client *one_client)
wear_change->elite_material = IsEliteMaterialItem(material_slot);
wear_change->hero_forge_model = static_cast<uint32>(GetHerosForgeModel(material_slot));
#ifdef BOTS
if (IsBot()) {
auto item_inst = CastToBot()->GetBotItem(EQ::InventoryProfile::CalcSlotFromMaterial(material_slot));
if (item_inst)
@ -446,9 +443,6 @@ void Mob::SendWearChange(uint8 material_slot, Client *one_client)
else {
wear_change->color.Color = GetEquipmentColor(material_slot);
}
#else
wear_change->color.Color = GetEquipmentColor(material_slot);
#endif
wear_change->wear_slot_id = material_slot;

View File

@ -43,9 +43,7 @@
#include "water_map.h"
#include "npc_scale_manager.h"
#ifdef BOTS
#include "bot.h"
#endif
#include <cctype>
#include <stdio.h>
@ -320,11 +318,9 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
if (!EQ::ValueWithin(npc_type_data->npc_spells_id, EQ::constants::BotSpellIDs::Warrior, EQ::constants::BotSpellIDs::Berserker)) {
AI_Init();
AI_Start();
#ifdef BOTS
} else {
CastToBot()->AI_Bot_Init();
CastToBot()->AI_Bot_Start();
#endif
}
d_melee_texture1 = npc_type_data->d_melee_texture1;
@ -1120,11 +1116,9 @@ void NPC::Depop(bool start_spawn_timer) {
if (IsNPC()) {
parse->EventNPC(EVENT_DESPAWN, this, nullptr, "", 0);
DispatchZoneControllerEvent(EVENT_DESPAWN_ZONE, this, "", 0, nullptr);
#ifdef BOTS
} else if (IsBot()) {
parse->EventBot(EVENT_DESPAWN, CastToBot(), nullptr, "", 0);
DispatchZoneControllerEvent(EVENT_DESPAWN_ZONE, this, "", 0, nullptr);
#endif
}
p_depop = true;

View File

@ -1,4 +1,3 @@
#ifdef BOTS
#include "../common/features.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
@ -470,5 +469,3 @@ void perl_register_bot()
}
#endif //EMBPERL_XS_CLASSES
#endif //BOTS

View File

@ -2601,12 +2601,10 @@ void Perl_Client_ApplySpell(Client* self, int spell_id, int duration, bool allow
self->ApplySpell(spell_id, duration, ApplySpellType::Solo, allow_pets);
}
#ifdef BOTS
void Perl_Client_ApplySpell(Client* self, int spell_id, int duration, bool allow_pets, bool allow_bots)
{
self->ApplySpell(spell_id, duration, ApplySpellType::Solo, allow_pets, true, allow_bots);
}
#endif
void Perl_Client_ApplySpellGroup(Client* self, int spell_id)
{
@ -2623,12 +2621,10 @@ void Perl_Client_ApplySpellGroup(Client* self, int spell_id, int duration, bool
self->ApplySpell(spell_id, duration, ApplySpellType::Group, allow_pets);
}
#ifdef BOTS
void Perl_Client_ApplySpellGroup(Client* self, int spell_id, int duration, bool allow_pets, bool allow_bots)
{
self->ApplySpell(spell_id, duration, ApplySpellType::Group, allow_pets, true, allow_bots);
}
#endif
void Perl_Client_ApplySpellRaid(Client* self, int spell_id)
{
@ -2650,12 +2646,10 @@ void Perl_Client_ApplySpellRaid(Client* self, int spell_id, int duration, bool a
self->ApplySpell(spell_id, duration, ApplySpellType::Raid, allow_pets, is_raid_group_only);
}
#ifdef BOTS
void Perl_Client_ApplySpellRaid(Client* self, int spell_id, int duration, bool allow_pets, bool is_raid_group_only, bool allow_bots)
{
self->ApplySpell(spell_id, duration, ApplySpellType::Raid, allow_pets, is_raid_group_only, allow_bots);
}
#endif
void Perl_Client_SetSpellDuration(Client* self, int spell_id)
{
@ -2672,12 +2666,10 @@ void Perl_Client_SetSpellDuration(Client* self, int spell_id, int duration, bool
self->SetSpellDuration(spell_id, duration, ApplySpellType::Solo, allow_pets);
}
#ifdef BOTS
void Perl_Client_SetSpellDuration(Client* self, int spell_id, int duration, bool allow_pets, bool allow_bots)
{
self->SetSpellDuration(spell_id, duration, ApplySpellType::Solo, allow_pets, true, allow_bots);
}
#endif
void Perl_Client_SetSpellDurationGroup(Client* self, int spell_id)
{
@ -2694,12 +2686,10 @@ void Perl_Client_SetSpellDurationGroup(Client* self, int spell_id, int duration,
self->SetSpellDuration(spell_id, duration, ApplySpellType::Group, allow_pets);
}
#ifdef BOTS
void Perl_Client_SetSpellDurationGroup(Client* self, int spell_id, int duration, bool allow_pets, bool allow_bots)
{
self->SetSpellDuration(spell_id, duration, ApplySpellType::Group, allow_pets, true, allow_bots);
}
#endif
void Perl_Client_SetSpellDurationRaid(Client* self, int spell_id)
{
@ -2721,12 +2711,10 @@ void Perl_Client_SetSpellDurationRaid(Client* self, int spell_id, int duration,
self->SetSpellDuration(spell_id, duration, ApplySpellType::Raid, allow_pets, is_raid_group_only);
}
#ifdef BOTS
void Perl_Client_SetSpellDurationRaid(Client* self, int spell_id, int duration, bool allow_pets, bool is_raid_group_only, bool allow_bots)
{
self->SetSpellDuration(spell_id, duration, ApplySpellType::Raid, allow_pets, is_raid_group_only, allow_bots);
}
#endif
perl::array Perl_Client_GetPEQZoneFlags(Client* self)
{
@ -2814,8 +2802,6 @@ void Perl_Client_SendPath(Client* self, Mob* target)
self->SendPath(target);
}
#ifdef BOTS
int Perl_Client_GetBotRequiredLevel(Client* self)
{
return self->GetBotRequiredLevel();
@ -2886,8 +2872,6 @@ void Perl_Client_CampAllBots(Client* self, uint8 class_id)
self->CampAllBots(class_id);
}
#endif
void perl_register_client()
{
perl::interpreter perl(PERL_GET_THX);
@ -2922,22 +2906,16 @@ void perl_register_client()
package.add("ApplySpell", (void(*)(Client*, int))&Perl_Client_ApplySpell);
package.add("ApplySpell", (void(*)(Client*, int, int))&Perl_Client_ApplySpell);
package.add("ApplySpell", (void(*)(Client*, int, int, bool))&Perl_Client_ApplySpell);
#ifdef BOTS
package.add("ApplySpell", (void(*)(Client*, int, int, bool, bool))&Perl_Client_ApplySpell);
#endif
package.add("ApplySpellGroup", (void(*)(Client*, int))&Perl_Client_ApplySpellGroup);
package.add("ApplySpellGroup", (void(*)(Client*, int, int))&Perl_Client_ApplySpellGroup);
package.add("ApplySpellGroup", (void(*)(Client*, int, int, bool))&Perl_Client_ApplySpellGroup);
#ifdef BOTS
package.add("ApplySpellGroup", (void(*)(Client*, int, int, bool, bool))&Perl_Client_ApplySpellGroup);
#endif
package.add("ApplySpellRaid", (void(*)(Client*, int))&Perl_Client_ApplySpellRaid);
package.add("ApplySpellRaid", (void(*)(Client*, int, int))&Perl_Client_ApplySpellRaid);
package.add("ApplySpellRaid", (void(*)(Client*, int, int, bool))&Perl_Client_ApplySpellRaid);
package.add("ApplySpellRaid", (void(*)(Client*, int, int, bool, bool))&Perl_Client_ApplySpellRaid);
#ifdef BOTS
package.add("ApplySpellRaid", (void(*)(Client*, int, int, bool, bool, bool))&Perl_Client_ApplySpellRaid);
#endif
package.add("AssignTask", (void(*)(Client*, int))&Perl_Client_AssignTask);
package.add("AssignTask", (void(*)(Client*, int, int))&Perl_Client_AssignTask);
package.add("AssignTask", (void(*)(Client*, int, int, bool))&Perl_Client_AssignTask);
@ -2949,10 +2927,8 @@ void perl_register_client()
package.add("CalcPriceMod", (float(*)(Client*))&Perl_Client_CalcPriceMod);
package.add("CalcPriceMod", (float(*)(Client*, Mob*))&Perl_Client_CalcPriceMod);
package.add("CalcPriceMod", (float(*)(Client*, Mob*, bool))&Perl_Client_CalcPriceMod);
#ifdef BOTS
package.add("CampAllBots", (void(*)(Client*))&Perl_Client_CampAllBots);
package.add("CampAllBots", (void(*)(Client*, uint8))&Perl_Client_CampAllBots);
#endif
package.add("CanEnterZone", (bool(*)(Client*, std::string))&Perl_Client_CanEnterZone);
package.add("CanEnterZone", (bool(*)(Client*, std::string, int16))&Perl_Client_CanEnterZone);
package.add("CanHaveSkill", &Perl_Client_CanHaveSkill);
@ -3037,18 +3013,12 @@ void perl_register_client()
package.add("GetBindZ", (float(*)(Client*, int))&Perl_Client_GetBindZ);
package.add("GetBindZoneID", (uint32_t(*)(Client*))&Perl_Client_GetBindZoneID);
package.add("GetBindZoneID", (uint32_t(*)(Client*, int))&Perl_Client_GetBindZoneID);
#ifdef BOTS
package.add("GetBotCreationLimit", (uint32(*)(Client*))&Perl_Client_GetBotCreationLimit);
package.add("GetBotCreationLimit", (uint32(*)(Client*, uint8))&Perl_Client_GetBotCreationLimit);
package.add("GetBotRequiredLevel", (int(*)(Client*))&Perl_Client_GetBotRequiredLevel);
package.add("GetBotRequiredLevel", (int(*)(Client*, uint8))&Perl_Client_GetBotRequiredLevel);
package.add("GetBotSpawnLimit", (int(*)(Client*))&Perl_Client_GetBotSpawnLimit);
package.add("GetBotSpawnLimit", (int(*)(Client*, uint8))&Perl_Client_GetBotSpawnLimit);
#endif
package.add("GetCarriedMoney", &Perl_Client_GetCarriedMoney);
package.add("GetCarriedPlatinum", &Perl_Client_GetCarriedPlatinum);
package.add("GetCharacterFactionLevel", &Perl_Client_GetCharacterFactionLevel);
@ -3306,18 +3276,12 @@ void perl_register_client()
package.add("SetBindPoint", (void(*)(Client*, int, int, float, float))&Perl_Client_SetBindPoint);
package.add("SetBindPoint", (void(*)(Client*, int, int, float, float, float))&Perl_Client_SetBindPoint);
package.add("SetBindPoint", (void(*)(Client*, int, int, float, float, float, float))&Perl_Client_SetBindPoint);
#ifdef BOTS
package.add("SetBotCreationLimit", (void(*)(Client*, uint32))&Perl_Client_SetBotCreationLimit);
package.add("SetBotCreationLimit", (void(*)(Client*, uint32, uint8))&Perl_Client_SetBotCreationLimit);
package.add("SetBotRequiredLevel", (void(*)(Client*, int))&Perl_Client_SetBotRequiredLevel);
package.add("SetBotRequiredLevel", (void(*)(Client*, int, uint8))&Perl_Client_SetBotRequiredLevel);
package.add("SetBotSpawnLimit", (void(*)(Client*, int))&Perl_Client_SetBotSpawnLimit);
package.add("SetBotSpawnLimit", (void(*)(Client*, int, uint8))&Perl_Client_SetBotSpawnLimit);
#endif
package.add("SetClientMaxLevel", &Perl_Client_SetClientMaxLevel);
package.add("SetConsumption", &Perl_Client_SetConsumption);
package.add("SetCustomItemData", &Perl_Client_SetCustomItemData);
@ -3355,22 +3319,16 @@ void perl_register_client()
package.add("SetSpellDuration", (void(*)(Client*, int))&Perl_Client_SetSpellDuration);
package.add("SetSpellDuration", (void(*)(Client*, int, int))&Perl_Client_SetSpellDuration);
package.add("SetSpellDuration", (void(*)(Client*, int, int, bool))&Perl_Client_SetSpellDuration);
#ifdef BOTS
package.add("SetSpellDuration", (void(*)(Client*, int, int, bool, bool))&Perl_Client_SetSpellDuration);
#endif
package.add("SetSpellDurationGroup", (void(*)(Client*, int))&Perl_Client_SetSpellDurationGroup);
package.add("SetSpellDurationGroup", (void(*)(Client*, int, int))&Perl_Client_SetSpellDurationGroup);
package.add("SetSpellDurationGroup", (void(*)(Client*, int, int, bool))&Perl_Client_SetSpellDurationGroup);
#ifdef BOTS
package.add("SetSpellDurationGroup", (void(*)(Client*, int, int, bool, bool))&Perl_Client_SetSpellDurationGroup);
#endif
package.add("SetSpellDurationRaid", (void(*)(Client*, int))&Perl_Client_SetSpellDurationRaid);
package.add("SetSpellDurationRaid", (void(*)(Client*, int, int))&Perl_Client_SetSpellDurationRaid);
package.add("SetSpellDurationRaid", (void(*)(Client*, int, int, bool))&Perl_Client_SetSpellDurationRaid);
package.add("SetSpellDurationRaid", (void(*)(Client*, int, int, bool, bool))&Perl_Client_SetSpellDurationRaid);
#ifdef BOTS
package.add("SetSpellDurationRaid", (void(*)(Client*, int, int, bool, bool, bool))&Perl_Client_SetSpellDurationRaid);
#endif
package.add("SetStartZone", (void(*)(Client*, uint32))&Perl_Client_SetStartZone);
package.add("SetStartZone", (void(*)(Client*, uint32, float, float, float))&Perl_Client_SetStartZone);
package.add("SetStartZone", (void(*)(Client*, uint32, float, float, float, float))&Perl_Client_SetStartZone);

View File

@ -395,7 +395,6 @@ perl::array Perl_EntityList_GetClientList(EntityList* self) // @categories Accou
return result;
}
#ifdef BOTS
Bot* Perl_EntityList_GetBotByID(EntityList* self, uint32_t bot_id) // @categories Script Utility, Bot
{
return self->GetBotByBotID(bot_id);
@ -490,7 +489,6 @@ void Perl_EntityList_SignalBotByBotName(EntityList* self, std::string bot_name,
{
entity_list.SignalBotByBotName(bot_name, signal_id);
}
#endif
perl::array Perl_EntityList_GetNPCList(EntityList* self) // @categories Script Utility
{
@ -598,7 +596,6 @@ void Perl_EntityList_Marquee(EntityList* self, uint32 type, uint32 priority, uin
self->Marquee(type, priority, fade_in, fade_out, duration, message);
}
#ifdef BOTS
Bot* Perl_EntityList_GetRandomBot(EntityList* self) // @categories Bots, Script Utility
{
return self->GetRandomBot();
@ -613,7 +610,6 @@ Bot* Perl_EntityList_GetRandomBot(EntityList* self, float x, float y, float z, f
{
return self->GetRandomBot(glm::vec3(x, y, z), distance, exclude_bot);
}
#endif
void perl_register_entitylist()
{
@ -629,7 +625,6 @@ void perl_register_entitylist()
package.add("DoubleAggro", &Perl_EntityList_DoubleAggro);
package.add("Fighting", &Perl_EntityList_Fighting);
package.add("FindDoor", &Perl_EntityList_FindDoor);
#ifdef BOTS
package.add("GetBotByID", &Perl_EntityList_GetBotByID);
package.add("GetBotByName", &Perl_EntityList_GetBotByName);
package.add("GetBotList", &Perl_EntityList_GetBotList);
@ -639,7 +634,6 @@ void perl_register_entitylist()
package.add("GetBotListByCharacterID", (perl::array(*)(EntityList*, uint32, uint8))&Perl_EntityList_GetBotListByCharacterID);
package.add("GetBotListByClientName", (perl::array(*)(EntityList*, std::string))&Perl_EntityList_GetBotListByClientName);
package.add("GetBotListByClientName", (perl::array(*)(EntityList*, std::string, uint8))&Perl_EntityList_GetBotListByClientName);
#endif
package.add("GetClientByAccID", &Perl_EntityList_GetClientByAccID);
package.add("GetClientByCharID", &Perl_EntityList_GetClientByCharID);
package.add("GetClientByID", &Perl_EntityList_GetClientByID);
@ -672,11 +666,9 @@ void perl_register_entitylist()
package.add("GetObjectList", &Perl_EntityList_GetObjectList);
package.add("GetRaidByClient", &Perl_EntityList_GetRaidByClient);
package.add("GetRaidByID", &Perl_EntityList_GetRaidByID);
#ifdef BOTS
package.add("GetRandomBot", (Bot*(*)(EntityList*))&Perl_EntityList_GetRandomBot);
package.add("GetRandomBot", (Bot*(*)(EntityList*, float, float, float, float))&Perl_EntityList_GetRandomBot);
package.add("GetRandomBot", (Bot*(*)(EntityList*, float, float, float, float, Bot*))&Perl_EntityList_GetRandomBot);
#endif
package.add("GetRandomClient", (Client*(*)(EntityList*))&Perl_EntityList_GetRandomClient);
package.add("GetRandomClient", (Client*(*)(EntityList*, float, float, float, float))&Perl_EntityList_GetRandomClient);
package.add("GetRandomClient", (Client*(*)(EntityList*, float, float, float, float, Client*))&Perl_EntityList_GetRandomClient);
@ -719,15 +711,11 @@ void perl_register_entitylist()
package.add("RemoveObject", &Perl_EntityList_RemoveObject);
package.add("RemoveTrap", &Perl_EntityList_RemoveTrap);
package.add("ReplaceWithTarget", &Perl_EntityList_ReplaceWithTarget);
#ifdef BOTS
package.add("SignalAllBotsByOwnerCharacterID", &Perl_EntityList_SignalAllBotsByOwnerCharacterID);
package.add("SignalAllBotsByOwnerName", &Perl_EntityList_SignalAllBotsByOwnerName);
#endif
package.add("SignalAllClients", &Perl_EntityList_SignalAllClients);
#ifdef BOTS
package.add("SignalBotByBotID", &Perl_EntityList_SignalBotByBotID);
package.add("SignalBotByBotName", &Perl_EntityList_SignalBotByBotName);
#endif
package.add("SignalMobsByNPCID", &Perl_EntityList_SignalMobsByNPCID);
}

View File

@ -8,9 +8,7 @@
#include "mob.h"
#include "client.h"
#include "dialogue_window.h"
#ifdef BOTS
#include "bot.h"
#endif
bool Perl_Mob_IsClient(Mob* self) // @categories Script Utility
{
@ -2713,7 +2711,6 @@ uint32 Perl_Mob_BuffCount(Mob* self, bool is_beneficial, bool is_detrimental) //
return self->BuffCount(is_beneficial, is_detrimental);
}
#ifdef BOTS
void Perl_Mob_DamageAreaBots(Mob* self, int64 damage) // @categories Hate and Aggro
{
self->DamageArea(damage, 0, EntityFilterType::Bots);
@ -2788,7 +2785,6 @@ Bot* Perl_Mob_GetHateRandomBot(Mob* self) // @categories Hate and Aggro
{
return self->GetHateRandomBot();
}
#endif
void perl_register_mob()
{
@ -2840,9 +2836,7 @@ void perl_register_mob()
package.add("CastSpell", (void(*)(Mob*, uint16, uint16, int, int))&Perl_Mob_CastSpell);
package.add("CastSpell", (void(*)(Mob*, uint16, uint16, int, int, int))&Perl_Mob_CastSpell);
package.add("CastSpell", (void(*)(Mob*, uint16, uint16, int, int, int, int16))&Perl_Mob_CastSpell);
#ifdef BOTS
package.add("CastToBot", &Perl_Mob_CastToBot);
#endif
package.add("CastToClient", &Perl_Mob_CastToClient);
package.add("CastToCorpse", &Perl_Mob_CastToCorpse);
package.add("CastToMob", &Perl_Mob_CastToMob);
@ -2871,12 +2865,10 @@ void perl_register_mob()
package.add("Damage", (void(*)(Mob*, Mob*, int64, uint16_t, int, bool, int8_t, bool))&Perl_Mob_Damage);
package.add("DamageArea", (void(*)(Mob*, int64))&Perl_Mob_DamageArea);
package.add("DamageArea", (void(*)(Mob*, int64, uint32))&Perl_Mob_DamageArea);
#ifdef BOTS
package.add("DamageAreaBots", (void(*)(Mob*, int64))&Perl_Mob_DamageAreaBots);
package.add("DamageAreaBots", (void(*)(Mob*, int64, uint32))&Perl_Mob_DamageAreaBots);
package.add("DamageAreaBotsPercentage", (void(*)(Mob*, int64))&Perl_Mob_DamageAreaBotsPercentage);
package.add("DamageAreaBotsPercentage", (void(*)(Mob*, int64, uint32))&Perl_Mob_DamageAreaBotsPercentage);
#endif
package.add("DamageAreaClients", (void(*)(Mob*, int64))&Perl_Mob_DamageAreaClients);
package.add("DamageAreaClients", (void(*)(Mob*, int64, uint32))&Perl_Mob_DamageAreaClients);
package.add("DamageAreaClientsPercentage", (void(*)(Mob*, int64))&Perl_Mob_DamageAreaClientsPercentage);
@ -2889,12 +2881,10 @@ void perl_register_mob()
package.add("DamageAreaPercentage", (void(*)(Mob*, int64, uint32))&Perl_Mob_DamageAreaPercentage);
package.add("DamageHateList", (void(*)(Mob*, int64))&Perl_Mob_DamageHateList);
package.add("DamageHateList", (void(*)(Mob*, int64, uint32))&Perl_Mob_DamageHateList);
#ifdef BOTS
package.add("DamageHateListBots", (void(*)(Mob*, int64))&Perl_Mob_DamageHateListBots);
package.add("DamageHateListBots", (void(*)(Mob*, int64, uint32))&Perl_Mob_DamageHateListBots);
package.add("DamageHateListBotsPercentage", (void(*)(Mob*, int64))&Perl_Mob_DamageHateListBotsPercentage);
package.add("DamageHateListBotsPercentage", (void(*)(Mob*, int64, uint32))&Perl_Mob_DamageHateListBotsPercentage);
#endif
package.add("DamageHateListClients", (void(*)(Mob*, int64))&Perl_Mob_DamageHateListClients);
package.add("DamageHateListClients", (void(*)(Mob*, int64, uint32))&Perl_Mob_DamageHateListClients);
package.add("DamageHateListClientsPercentage", (void(*)(Mob*, int64))&Perl_Mob_DamageHateListClientsPercentage);
@ -3012,10 +3002,8 @@ void perl_register_mob()
package.add("GetHateClosest", &Perl_Mob_GetHateClosest);
package.add("GetHateDamageTop", &Perl_Mob_GetHateDamageTop);
package.add("GetHateList", &Perl_Mob_GetHateList);
#ifdef BOTS
package.add("GetHateListBots", (perl::array(*)(Mob*))&Perl_Mob_GetHateListBots);
package.add("GetHateListBots", (perl::array(*)(Mob*, uint32))&Perl_Mob_GetHateListBots);
#endif
package.add("GetHateListClients", (perl::array(*)(Mob*))&Perl_Mob_GetHateListClients);
package.add("GetHateListClients", (perl::array(*)(Mob*, uint32))&Perl_Mob_GetHateListClients);
package.add("GetHateListNPCs", (perl::array(*)(Mob*))&Perl_Mob_GetHateListNPCs);
@ -3023,9 +3011,7 @@ void perl_register_mob()
package.add("GetHateListByDistance", (perl::array(*)(Mob*))&Perl_Mob_GetHateListByDistance);
package.add("GetHateListByDistance", (perl::array(*)(Mob*, uint32))&Perl_Mob_GetHateListByDistance);
package.add("GetHateRandom", &Perl_Mob_GetHateRandom);
#ifdef BOTS
package.add("GetHateRandomBot", &Perl_Mob_GetHateRandomBot);
#endif
package.add("GetHateRandomClient", &Perl_Mob_GetHateRandomClient);
package.add("GetHateRandomNPC", &Perl_Mob_GetHateRandomNPC);
package.add("GetHateTop", &Perl_Mob_GetHateTop);

View File

@ -31,9 +31,7 @@
#include <string>
#ifdef BOTS
#include "bot.h"
#endif
#ifndef WIN32
#include <stdlib.h>
@ -198,10 +196,8 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
act_power = CastToClient()->GetFocusEffect(focusPetPower, spell_id);//Client only
act_power = CastToClient()->mod_pet_power(act_power, spell_id);
}
#ifdef BOTS
else if (IsBot())
act_power = CastToBot()->GetFocusEffect(focusPetPower, spell_id);
#endif
}
else if (petpower > 0)
act_power = petpower;
@ -231,11 +227,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
memcpy(npc_type, base, sizeof(NPCType));
// If pet power is set to -1 in the DB, use stat scaling
if ((IsClient()
#ifdef BOTS
|| IsBot()
#endif
) && record.petpower == -1)
if ((IsClient() || IsBot()) && record.petpower == -1)
{
float scale_power = (float)act_power / 100.0f;
if(scale_power > 0)

View File

@ -47,8 +47,6 @@ public:
std::vector<std::any> *extra_pointers) { return 0; }
virtual int EventEncounter(QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers) { return 0; }
#ifdef BOTS
virtual int EventBot(
QuestEventID evt,
Bot *bot,
@ -70,7 +68,6 @@ public:
) {
return 0;
}
#endif
virtual bool HasQuestSub(uint32 npcid, QuestEventID evt) { return false; }
virtual bool HasGlobalQuestSub(QuestEventID evt) { return false; }
@ -80,11 +77,8 @@ public:
virtual bool ItemHasQuestSub(EQ::ItemInstance *itm, QuestEventID evt) { return false; }
virtual bool EncounterHasQuestSub(std::string encounter_name, QuestEventID evt) { return false; }
virtual bool HasEncounterSub(const std::string& package_name, QuestEventID evt) { return false; }
#ifdef BOTS
virtual bool BotHasQuestSub(QuestEventID evt) { return false; }
virtual bool GlobalBotHasQuestSub(QuestEventID evt) { return false; }
#endif
virtual void LoadNPCScript(std::string filename, int npc_id) { }
virtual void LoadGlobalNPCScript(std::string filename) { }
@ -93,11 +87,8 @@ public:
virtual void LoadItemScript(std::string filename, EQ::ItemInstance *item) { }
virtual void LoadSpellScript(std::string filename, uint32 spell_id) { }
virtual void LoadEncounterScript(std::string filename, std::string encounter_name) { }
#ifdef BOTS
virtual void LoadBotScript(std::string filename) { }
virtual void LoadGlobalBotScript(std::string filename) { }
#endif
virtual int DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers) { return 0; }
@ -107,8 +98,6 @@ public:
std::vector<std::any> *extra_pointers) { return 0; }
virtual int DispatchEventSpell(QuestEventID evt, Mob* mob, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers) { return 0; }
#ifdef BOTS
virtual int DispatchEventBot(
QuestEventID evt,
Bot *bot,
@ -119,7 +108,6 @@ public:
) {
return 0;
}
#endif
virtual void AddVar(std::string name, std::string val) { }
virtual std::string GetVar(std::string name) { return std::string(); }

View File

@ -37,11 +37,8 @@ QuestParserCollection::QuestParserCollection() {
_player_quest_status = QuestUnloaded;
_global_player_quest_status = QuestUnloaded;
_global_npc_quest_status = QuestUnloaded;
#ifdef BOTS
_bot_quest_status = QuestUnloaded;
_global_bot_quest_status = QuestUnloaded;
#endif
}
QuestParserCollection::~QuestParserCollection() {
@ -85,11 +82,8 @@ void QuestParserCollection::ReloadQuests(bool reset_timers) {
_player_quest_status = QuestUnloaded;
_global_player_quest_status = QuestUnloaded;
_global_npc_quest_status = QuestUnloaded;
#ifdef BOTS
_bot_quest_status = QuestUnloaded;
_global_bot_quest_status = QuestUnloaded;
#endif
_spell_quest_status.clear();
_item_quest_status.clear();
@ -1085,7 +1079,6 @@ void QuestParserCollection::LoadPerlEventExportSettings(PerlEventExportSettings
LogInfo("Loaded [{}] Perl Event Export Settings", settings.size());
}
#ifdef BOTS
int QuestParserCollection::DispatchEventBot(
QuestEventID evt,
Bot *bot,
@ -1312,4 +1305,3 @@ QuestInterface *QuestParserCollection::GetQIByGlobalBotQuest(std::string &filena
return nullptr;
}
#endif

View File

@ -71,10 +71,7 @@ public:
bool PlayerHasQuestSub(QuestEventID evt, bool check_encounters = false);
bool SpellHasQuestSub(uint32 spell_id, QuestEventID evt, bool check_encounters = false);
bool ItemHasQuestSub(EQ::ItemInstance *itm, QuestEventID evt, bool check_encounters = false);
#ifdef BOTS
bool BotHasQuestSub(QuestEventID evt);
#endif
int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers = nullptr);
@ -87,7 +84,6 @@ public:
int EventEncounter(QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers = nullptr);
#ifdef BOTS
int EventBot(
QuestEventID evt,
Bot *bot,
@ -96,7 +92,6 @@ public:
uint32 extra_data,
std::vector<std::any> *extra_pointers = nullptr
);
#endif
void GetErrors(std::list<std::string> &quest_errors);
@ -131,18 +126,13 @@ private:
bool SpellHasEncounterSub(uint32 spell_id, QuestEventID evt);
bool ItemHasEncounterSub(EQ::ItemInstance* item, QuestEventID evt);
bool HasEncounterSub(QuestEventID evt, const std::string& package_name);
#ifdef BOTS
bool BotHasQuestSubLocal(QuestEventID evt);
bool BotHasQuestSubGlobal(QuestEventID evt);
#endif
int EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<std::any> *extra_pointers);
int EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<std::any> *extra_pointers);
int EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector<std::any> *extra_pointers);
int EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector<std::any> *extra_pointers);
#ifdef BOTS
int EventBotLocal(
QuestEventID evt,
Bot *bot,
@ -159,7 +149,6 @@ private:
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
#endif
QuestInterface *GetQIByNPCQuest(uint32 npcid, std::string &filename);
QuestInterface *GetQIByGlobalNPCQuest(std::string &filename);
@ -168,11 +157,8 @@ private:
QuestInterface *GetQIBySpellQuest(uint32 spell_id, std::string &filename);
QuestInterface *GetQIByItemQuest(std::string item_script, std::string &filename);
QuestInterface *GetQIByEncounterQuest(std::string encounter_name, std::string &filename);
#ifdef BOTS
QuestInterface *GetQIByBotQuest(std::string &filename);
QuestInterface *GetQIByGlobalBotQuest(std::string &filename);
#endif
int DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers);
@ -182,8 +168,6 @@ private:
std::vector<std::any> *extra_pointers);
int DispatchEventSpell(QuestEventID evt, Mob* mob, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers);
#ifdef BOTS
int DispatchEventBot(
QuestEventID evt,
Bot *bot,
@ -192,7 +176,6 @@ private:
uint32 extra_data,
std::vector<std::any> *extra_pointers
);
#endif
std::map<uint32, QuestInterface*> _interfaces;
std::map<uint32, std::string> _extensions;
@ -204,13 +187,8 @@ private:
uint32 _global_npc_quest_status;
uint32 _player_quest_status;
uint32 _global_player_quest_status;
#ifdef BOTS
uint32 _bot_quest_status;
uint32 _global_bot_quest_status;
#endif
std::map<uint32, uint32> _spell_quest_status;
std::map<uint32, uint32> _item_quest_status;
std::map<std::string, uint32> _encounter_quest_status;

View File

@ -45,9 +45,7 @@
#include <limits.h>
#include <list>
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;
extern Zone* zone;
@ -98,11 +96,9 @@ void QuestManager::Process() {
//this is inheriently unsafe if we ever make it so more than npc/client start timers
parse->EventPlayer(EVENT_TIMER, cur->mob->CastToClient(), cur->name, 0);
}
#ifdef BOTS
else if (cur->mob->IsBot()) {
parse->EventBot(EVENT_TIMER, cur->mob->CastToBot(), nullptr, cur->name, 0);
}
#endif
//we MUST reset our iterator since the quest could have removed/added any
//number of timers... worst case we have to check a bunch of timers twice
@ -2237,8 +2233,6 @@ void QuestManager::popup(const char *title, const char *text, uint32 popupid, ui
initiator->SendPopupToClient(title, text, popupid, buttons, Duration);
}
#ifdef BOTS
int QuestManager::createbotcount(uint8 class_id) {
QuestManagerCurrentQuestVars();
if (initiator) {
@ -2444,8 +2438,6 @@ bool QuestManager::createBot(const char *name, const char *lastname, uint8 level
return false;
}
#endif //BOTS
void QuestManager::taskselector(const std::vector<int>& tasks, bool ignore_cooldown) {
QuestManagerCurrentQuestVars();
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && task_manager)
@ -3466,7 +3458,6 @@ NPC *QuestManager::GetNPC() const {
return nullptr;
}
#ifdef BOTS
Bot *QuestManager::GetBot() const {
if (!quests_running_.empty()) {
running_quest e = quests_running_.top();
@ -3475,7 +3466,6 @@ Bot *QuestManager::GetBot() const {
return nullptr;
}
#endif
Mob *QuestManager::GetOwner() const {
if(!quests_running_.empty()) {

View File

@ -348,10 +348,7 @@ public:
bool DoAugmentSlotsMatch(uint32 item_one, uint32 item_two);
int8 DoesAugmentFit(EQ::ItemInstance* inst, uint32 augment_id);
#ifdef BOTS
Bot *GetBot() const;
#endif
Client *GetInitiator() const;
NPC *GetNPC() const;
Mob *GetOwner() const;
@ -361,12 +358,10 @@ public:
std::string GetEncounter() const;
inline bool ProximitySayInUse() { return HaveProximitySays; }
#ifdef BOTS
int createbotcount(uint8 class_id = NO_CLASS);
int spawnbotcount(uint8 class_id = NO_CLASS);
bool botquest();
bool createBot(const char *name, const char *lastname, uint8 level, uint16 race, uint8 botclass, uint8 gender);
#endif
private:

View File

@ -4156,12 +4156,10 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
if (parse->EventSpell(EVENT_SPELL_FADE, this, nullptr, buffs[slot].spellid, export_string, 0) != 0) {
return;
}
#ifdef BOTS
} else if (IsBot()) {
if (parse->EventSpell(EVENT_SPELL_FADE, this, nullptr, buffs[slot].spellid, export_string, 0) != 0) {
return;
}
#endif
}
for (int i=0; i < EFFECT_COUNT; i++)
@ -4541,9 +4539,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
}
if((IsClient() && !CastToClient()->GetPVP()) ||
(IsPet() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()) ||
#ifdef BOTS
(IsBot() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()) ||
#endif
(IsMerc() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()))
{
EQApplicationPacket *outapp = MakeBuffsPacket();
@ -6792,11 +6788,9 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, uint16 spell_id)
bool bDepleted = false;
int buff_max = GetMaxTotalSlots();
#ifdef BOTS
std::string buff_name;
size_t buff_counter = 0;
bool buff_update = false;
#endif
//Spell specific procs [Type 7,10,11]
if (IsValidSpell(spell_id)) {
@ -6804,11 +6798,9 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, uint16 spell_id)
if (buffs[d].spellid == spell_id && buffs[d].hit_number > 0 &&
spells[buffs[d].spellid].hit_number_type == static_cast<int>(type)) {
#ifdef BOTS
buff_name = spells[buffs[d].spellid].name;
buff_counter = (buffs[d].hit_number - 1);
buff_update = true;
#endif
if (--buffs[d].hit_number == 0) {
CastOnNumHitFade(buffs[d].spellid);
@ -6822,12 +6814,9 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, uint16 spell_id)
} else if (type == NumHit::MatchingSpells) {
if (buff_slot >= 0) {
if (--buffs[buff_slot].hit_number == 0) {
#ifdef BOTS
buff_name = spells[buffs[buff_slot].spellid].name;
buff_counter = (buffs[buff_slot].hit_number - 1);
buff_update = true;
#endif
CastOnNumHitFade(buffs[buff_slot].spellid);
if (!TryFadeEffect(buff_slot))
@ -6842,11 +6831,9 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, uint16 spell_id)
if (IsValidSpell(buffs[d].spellid) && buffs[d].hit_number > 0 &&
spells[buffs[d].spellid].hit_number_type == static_cast<int>(type)) {
#ifdef BOTS
buff_name = spells[buffs[d].spellid].name;
buff_counter = (buffs[d].hit_number - 1);
buff_update = true;
#endif
if (--buffs[d].hit_number == 0) {
CastOnNumHitFade(buffs[d].spellid);
@ -6859,7 +6846,6 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, uint16 spell_id)
}
}
#ifdef BOTS
if (IsBot() && buff_update) {
auto bot_owner = entity_list.GetBotOwnerByBotEntityID(GetID());
if (bot_owner && bot_owner->GetBotOption(Client::booBuffCounter)) {
@ -6879,7 +6865,6 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, uint16 spell_id)
);
}
}
#endif
}
//for some stupid reason SK procs return theirs one base off...

View File

@ -97,9 +97,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "../common/packet_dump_file.h"
#endif
#ifdef BOTS
#include "bot.h"
#endif
#include "mob_movement_manager.h"
#include "client.h"
@ -256,10 +254,8 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
}
} else if (IsNPC()) {
parse->EventNPC(EVENT_CAST_BEGIN, CastToNPC(), nullptr, export_string, 0);
#ifdef BOTS
} else if (IsBot()) {
parse->EventBot(EVENT_CAST_BEGIN, CastToBot(), nullptr, export_string, 0);
#endif
}
//To prevent NPC ghosting when spells are cast from scripts
@ -1409,7 +1405,6 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
channelchance -= attacked_count * 2;
channelchance += channelchance * channelbonuses / 100.0f;
}
#ifdef BOTS
else if(IsBot()) {
float channelbonuses = 0.0f;
@ -1423,7 +1418,6 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
channelchance -= attacked_count * 2;
channelchance += channelchance * channelbonuses / 100.0f;
}
#endif //BOTS
else {
// NPCs are just hard to interrupt, otherwise they get pwned
channelchance = 85;
@ -1667,10 +1661,8 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
parse->EventPlayer(EVENT_CAST, CastToClient(), export_string, 0);
} else if (IsNPC()) {
parse->EventNPC(EVENT_CAST, CastToNPC(), nullptr, export_string, 0);
#ifdef BOTS
} else if (IsBot()) {
parse->EventBot(EVENT_CAST, CastToBot(), nullptr, export_string, 0);
#endif
}
if(bard_song_mode)
@ -2103,7 +2095,6 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
}
}
}
#ifdef BOTS
else if(IsBot())
{
if(IsGrouped())
@ -2116,7 +2107,6 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
group_id_caster = (GetRaid()->GetGroup(GetOwner()->CastToClient()) == 0xFFFF) ? 0 : (GetRaid()->GetGroup(GetOwner()->CastToClient()) + 1);
}
}
#endif //BOTS
if(spell_target->IsClient())
{
@ -2151,7 +2141,6 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
}
}
}
#ifdef BOTS
else if(spell_target->IsBot())
{
if(spell_target->IsGrouped())
@ -2164,7 +2153,6 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
group_id_target = (spell_target->GetRaid()->GetGroup(spell_target->GetOwner()->CastToClient()) == 0xFFFF) ? 0 : (spell_target->GetRaid()->GetGroup(spell_target->GetOwner()->CastToClient()) + 1);
}
}
#endif //BOTS
if(group_id_caster == 0 || group_id_target == 0)
{
@ -2429,7 +2417,6 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
case SingleTarget:
{
#ifdef BOTS
if(IsBot()) {
bool StopLogic = false;
if(!CastToBot()->DoFinishedSpellSingleTarget(spell_id, spell_target, slot, StopLogic))
@ -2437,7 +2424,6 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
if(StopLogic)
break;
}
#endif //BOTS
if(spell_target == nullptr) {
LogSpells("Spell [{}]: Targeted spell, but we have no target", spell_id);
@ -2498,7 +2484,6 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
case GroupSpell:
{
#ifdef BOTS
if(IsBot()) {
bool StopLogic = false;
if(!CastToBot()->DoFinishedSpellGroupTarget(spell_id, spell_target, slot, StopLogic))
@ -2506,7 +2491,6 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
if(StopLogic)
break;
}
#endif //BOTS
// We hold off turning MBG off so we can still use it to calc the mana cost
if(spells[spell_id].can_mgb && HasMGB())
@ -3445,9 +3429,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
if((IsClient() && !CastToClient()->GetPVP()) ||
(IsPet() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()) ||
#ifdef BOTS
(IsBot() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()) ||
#endif
(IsMerc() && GetOwner() && GetOwner()->IsClient() && !GetOwner()->CastToClient()->GetPVP()))
{
EQApplicationPacket *outapp = MakeBuffsPacket();
@ -3687,10 +3669,8 @@ bool Mob::SpellOnTarget(
parse->EventNPC(EVENT_CAST_ON, spelltar->CastToNPC(), this, export_string, 0);
} else if (spelltar->IsClient()) {
parse->EventPlayer(EVENT_CAST_ON, spelltar->CastToClient(), export_string, 0);
#ifdef BOTS
} else if (spelltar->IsBot()) {
parse->EventBot(EVENT_CAST_ON, spelltar->CastToBot(), this, export_string, 0);
#endif
}
mod_spell_cast(spell_id, spelltar, reflect_effectiveness, use_resist_adjust, resist_adjust, isproc);

View File

@ -45,9 +45,7 @@
#include <stdlib.h>
#include <boost/concept_check.hpp>
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;
extern WorldServer worldserver;

View File

@ -1330,7 +1330,6 @@ void NPC::RestoreGuardSpotCharm()
/******************
* Bot-specific overloads to make them play nice with the new movement system
*/
#ifdef BOTS
#include "bot.h"
void Bot::WalkTo(float x, float y, float z)
@ -1348,4 +1347,3 @@ void Bot::RunTo(float x, float y, float z)
Mob::RunTo(x, y, z);
}
#endif

View File

@ -12,9 +12,7 @@
#include "event_codes.h"
#include "../common/repositories/doors_repository.h"
#ifdef BOTS
#include "bot_database.h"
#endif
#define WOLF 42
@ -633,10 +631,8 @@ public:
/* Things which really dont belong here... */
int16 CommandRequirement(const char* commandname);
#ifdef BOTS
// bot database add-on to eliminate the need for a second database connection
BotDatabase botdb;
#endif
protected:
void ZDBInitVars();

View File

@ -28,9 +28,7 @@
#include "worldserver.h"
#include "zone.h"
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;
extern WorldServer worldserver;
@ -43,10 +41,9 @@ extern Zone* zone;
void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
#ifdef BOTS
// This block is necessary to clean up any bot objects owned by a Client
Bot::ProcessClientZoneChange(this);
#endif
if (RuleB(Bots, Enabled)) {
Bot::ProcessClientZoneChange(this);
}
bZoning = true;
if (app->size != sizeof(ZoneChange_Struct)) {