[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
@@ -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)