[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
91 changed files with 263 additions and 1150 deletions
-20
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);