[Cleanup] Bot RaidGroupSay (#4653)

This commit is contained in:
nytmyr 2025-02-07 13:06:31 -06:00 committed by GitHub
parent 41009aa19b
commit 60ba76b39c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 38 additions and 90 deletions

View File

@ -626,14 +626,14 @@ void Bot::ChangeBotRangedWeapons(bool isRanged) {
BotAddEquipItem(EQ::invslot::slotPrimary, GetBotItemBySlot(EQ::invslot::slotPrimary));
BotAddEquipItem(EQ::invslot::slotSecondary, GetBotItemBySlot(EQ::invslot::slotSecondary));
SetAttackTimer();
RaidGroupSay(this, "My blade is ready");
RaidGroupSay("My blade is ready");
} else {
BotRemoveEquipItem(EQ::invslot::slotPrimary);
BotRemoveEquipItem(EQ::invslot::slotSecondary);
BotAddEquipItem(EQ::invslot::slotAmmo, GetBotItemBySlot(EQ::invslot::slotAmmo));
BotAddEquipItem(EQ::invslot::slotSecondary, GetBotItemBySlot(EQ::invslot::slotRange));
SetAttackTimer();
RaidGroupSay(this, "My blades are sheathed");
RaidGroupSay("My blades are sheathed");
}
}
@ -1937,7 +1937,7 @@ bool Bot::BotRangedAttack(Mob* other, bool can_double_attack) {
if (!ammo || ammo_item->GetCharges() < 1) {
if (!GetCombatRoundForAlerts()) {
SetCombatRoundForAlerts();
RaidGroupSay(this, "I do not have any ammo!");
RaidGroupSay("I do not have any ammo!");
}
}
return false;
@ -2965,11 +2965,11 @@ bool Bot::TryEvade(Mob* tar) {
}
if (zone->random.Int(0, 260) < (int)GetSkill(EQ::skills::SkillHide)) {
RaidGroupSay(this, "I have momentarily ducked away from the main combat.");
RaidGroupSay("I have momentarily ducked away from the main combat.");
RogueEvade(tar);
}
else {
RaidGroupSay(this, "My attempts at ducking clear of combat fail.");
RaidGroupSay("My attempts at ducking clear of combat fail.");
}
//SendAppearancePacket(AT_Invis, Invisibility::Visible);
@ -3008,11 +3008,11 @@ bool Bot::TryEvade(Mob* tar) {
if (zone->random.Real(0, 160) > totalfeign) {
//SendAppearancePacket(AT_Anim, ANIM_DEATH);
RaidGroupSay(this, "I have fallen to the ground.");
RaidGroupSay("I have fallen to the ground.");
SetFeigned(false);
}
else {
RaidGroupSay(this, "I have successfully feigned my death.");
RaidGroupSay("I have successfully feigned my death.");
SetFeigned(true);
//SendAppearancePacket(AT_Anim, ANIM_DEATH);
}
@ -3543,7 +3543,6 @@ void Bot::BotPullerProcess(Client* bot_owner, Raid* raid) {
raid->RaidSay(msg.c_str(), GetCleanName(), 0, 100);
} else {
RaidGroupSay(
this,
fmt::format(
"Pulling {}.",
pull_target->GetCleanName()
@ -5318,7 +5317,6 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
if (IsTaunting() && target->IsNPC() && taunt_time) {
if (GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) {
RaidGroupSay(
this,
fmt::format(
"Taunting {}.",
target->GetCleanName()
@ -6254,7 +6252,6 @@ bool Bot::DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, EQ::spel
if (isMainGroupMGB && (GetClass() != Class::Bard)) {
RaidGroupSay(
this,
fmt::format(
"Casting {} as a Mass Group Buff.",
spells[spell_id].name
@ -7905,10 +7902,10 @@ void Bot::SetDefaultBotStance() {
_botStance = GetClass() == Class::Warrior ? Stance::Aggressive : Stance::Balanced;
}
void Bot::RaidGroupSay(Mob* speaker, const char* msg, ...) {
void Bot::RaidGroupSay(const char* msg, ...) {
if (
speaker->CastToBot()->GetTempSpellType() != UINT16_MAX &&
!speaker->CastToBot()->GetSpellTypeAnnounceCast(speaker->CastToBot()->GetTempSpellType())
GetTempSpellType() != UINT16_MAX &&
!GetSpellTypeAnnounceCast(GetTempSpellType())
) {
return;
}
@ -7919,57 +7916,32 @@ void Bot::RaidGroupSay(Mob* speaker, const char* msg, ...) {
vsnprintf(buf, 1000, msg, ap);
va_end(ap);
if (speaker->IsRaidGrouped()) {
Raid* r = speaker->CastToBot()->GetStoredRaid();
if (IsRaidGrouped()) {
Raid* r = GetStoredRaid() ? GetStoredRaid() : GetRaid();
if (r) {
for (const auto& m : r->members) {
if (m.member && !m.is_bot) {
m.member->FilteredMessageString(
speaker,
Chat::PetResponse,
FilterSocials,
GENERIC_SAY,
speaker->GetCleanName(),
buf
);
if (m.member && m.member->IsClient()) {
m.member->FilteredMessageString(this,Chat::PetResponse,FilterSocials,GENERIC_SAY,GetCleanName(),buf);
}
}
}
}
else if (speaker->HasGroup()) {
Group* g = speaker->GetGroup();
if (g) {
for (auto& m : g->members) {
if (m && !m->IsBot()) {
m->FilteredMessageString(
speaker,
Chat::PetResponse,
FilterSocials,
GENERIC_SAY,
speaker->GetCleanName(),
buf
);
else if (HasGroup()) {
for (auto& m : GetGroup()->members) {
if (m && m->IsClient()) {
m->FilteredMessageString(this,Chat::PetResponse,FilterSocials,GENERIC_SAY,GetCleanName(),buf);
}
}
}
}
else {
speaker->GetOwner()->FilteredMessageString(
speaker,
Chat::PetResponse,
FilterSocials,
GENERIC_SAY,
speaker->GetCleanName(),
buf
);
else if (GetOwner()) {
GetOwner()->FilteredMessageString(this,Chat::PetResponse,FilterSocials,GENERIC_SAY,GetCleanName(),buf);
}
}
bool Bot::UseDiscipline(uint32 spell_id, uint32 target) {
if (!IsValidSpell(spell_id)) {
RaidGroupSay(this, "Not a valid spell.");
RaidGroupSay("Not a valid spell.");
return false;
}
@ -9398,7 +9370,6 @@ void Bot::DoItemClick(const EQ::ItemData *item, uint16 slot_id)
SetIsUsingItemClick(true);
RaidGroupSay(
this,
fmt::format(
"Attempting to cast [{}] on {}.",
spells[item->Click.Effect].name,
@ -11312,7 +11283,6 @@ bool Bot::AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank) {
if (IsCasting()) {
RaidGroupSay(
this,
fmt::format(
"Interrupting {}. I have been commanded to try to cast an AA - {} on {}.",
CastingSpellID() ? spells[CastingSpellID()].name : "my spell",
@ -11326,7 +11296,6 @@ bool Bot::AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank) {
if (CastSpell(spell_id, tar->GetID())) {
RaidGroupSay(
this,
fmt::format(
"Casting an AA - {} on {}.",
GetSpellName(spell_id),
@ -11429,7 +11398,6 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool is_disc) {
if (IsCasting()) {
RaidGroupSay(
this,
fmt::format(
"Interrupting {}. I have been commanded to try to cast {} on {}.",
CastingSpellID() ? spells[CastingSpellID()].name : "my spell",
@ -11445,7 +11413,6 @@ bool Bot::AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool is_disc) {
}
RaidGroupSay(
this,
fmt::format(
"Casting {} on {}.",
GetSpellName(spell_id),

View File

@ -778,7 +778,7 @@ public:
// Static Bot Group Methods
static bool AddBotToGroup(Bot* bot, Group* group);
static bool RemoveBotFromGroup(Bot* bot, Group* group);
static void RaidGroupSay(Mob *speaker, const char *msg, ...);
void RaidGroupSay(const char *msg, ...);
// "GET" Class Methods
uint32 GetBotID() const { return _botID; }

View File

@ -1133,7 +1133,7 @@ void bot_command_spawn(Client *c, const Seperator *sep)
}
if (!silent_tell && c->GetBotOption(Client::booSpawnMessageSay)) {
Bot::RaidGroupSay(my_bot, bot_spawn_message[message_index].c_str());
my_bot->RaidGroupSay(bot_spawn_message[message_index].c_str());
}
else if (!silent_tell && c->GetBotOption(Client::booSpawnMessageTell)) {
my_bot->OwnerMessage(bot_spawn_message[message_index]);

View File

@ -502,7 +502,6 @@ void bot_command_cast(Client* c, const Seperator* sep)
if (IsBotSpellTypeDetrimental(spell_type) && !bot_iter->IsAttackAllowed(new_tar)) {
bot_iter->RaidGroupSay(
bot_iter,
fmt::format(
"I cannot attack [{}].",
new_tar->GetCleanName()

View File

@ -171,8 +171,7 @@ void bot_command_depart(Client* c, const Seperator* sep)
}
}
Bot::RaidGroupSay(
bot_iter,
bot_iter->RaidGroupSay(
fmt::format(
"I can port you to {}.",
Saylink::Silent(
@ -207,8 +206,7 @@ void bot_command_depart(Client* c, const Seperator* sep)
}
if (bot_iter->IsCommandedSpell() && bot_iter->IsCasting()) {
Bot::RaidGroupSay(
bot_iter,
bot_iter->RaidGroupSay(
fmt::format(
"Interrupting {}. I have been commanded to try to cast a [{}] spell, {} on {}.",
bot_iter->CastingSpellID() ? spells[bot_iter->CastingSpellID()].name : "my spell",
@ -229,8 +227,7 @@ void bot_command_depart(Client* c, const Seperator* sep)
bot_iter->SetCastedSpellType(BotSpellTypes::Teleport);
}
Bot::RaidGroupSay(
bot_iter,
bot_iter->RaidGroupSay(
fmt::format(
"Casting {} [{}] on {}.",
GetSpellName(itr->SpellId),

View File

@ -47,8 +47,7 @@ void bot_command_guard(Client *c, const Seperator *sep)
}
if (sbl.size() == 1) {
Bot::RaidGroupSay(
sbl.front(),
sbl.front()->RaidGroupSay(
fmt::format(
"{}uarding this position.",
clear ? "No longer g" : "G"

View File

@ -47,8 +47,7 @@ void bot_command_hold(Client *c, const Seperator *sep)
}
if (sbl.size() == 1) {
Bot::RaidGroupSay(
sbl.front(),
sbl.front()->RaidGroupSay(
fmt::format(
"{}olding my attacks.",
clear ? "No longer h" : "H"

View File

@ -74,7 +74,7 @@ void bot_command_pet_remove(Client *c, const Seperator *sep)
if (bot_iter->IsBotCharmer()) {
bot_iter->SetBotCharmer(false);
if (sbl.size() == 1)
Bot::RaidGroupSay(bot_iter, "Using a summoned pet");
bot_iter->RaidGroupSay("Using a summoned pet");
++summoned_pet;
continue;
}
@ -86,7 +86,7 @@ void bot_command_pet_remove(Client *c, const Seperator *sep)
}
bot_iter->SetBotCharmer(true);
if (sbl.size() == 1)
Bot::RaidGroupSay(bot_iter, "Available for Charming");
bot_iter->RaidGroupSay("Available for Charming");
++charmed_pet;
}

View File

@ -24,7 +24,7 @@ void bot_command_pick_lock(Client *c, const Seperator *sep)
Bot* my_bot = sbl.front();
my_bot->InterruptSpell();
Bot::RaidGroupSay(my_bot, "Attempting to pick the lock.");
my_bot->RaidGroupSay("Attempting to pick the lock.");
std::list<Doors*> door_list;
entity_list.GetDoorsList(door_list);
@ -51,7 +51,7 @@ void bot_command_pick_lock(Client *c, const Seperator *sep)
++open_count;
}
else {
Bot::RaidGroupSay(my_bot, "I am not skilled enough for this lock.");
my_bot->RaidGroupSay("I am not skilled enough for this lock.");
}
}
c->Message(Chat::White, "%i door%s attempted - %i door%s successful", door_count, ((door_count != 1) ? ("s") : ("")), open_count, ((open_count != 1) ? ("s") : ("")));

View File

@ -130,8 +130,7 @@ void bot_command_taunt(Client* c, const Seperator* sep)
bot_iter->SetTaunting(taunt_state);
Bot::RaidGroupSay(
bot_iter,
bot_iter->RaidGroupSay(
fmt::format(
"I am {} taunting.",
bot_iter->IsTaunting() ? "now" : "no longer"
@ -154,8 +153,7 @@ void bot_command_taunt(Client* c, const Seperator* sep)
bot_iter->GetPet()->CastToNPC()->SetTaunting(taunt_state);
Bot::RaidGroupSay(
bot_iter,
bot_iter->RaidGroupSay(
fmt::format(
"My Pet is {} taunting.",
bot_iter->GetPet()->CastToNPC()->IsTaunting() ? "now" : "no longer"

View File

@ -67,6 +67,6 @@ void bot_command_track(Client *c, const Seperator *sep)
}
my_bot->InterruptSpell();
Bot::RaidGroupSay(my_bot, tracking_msg.c_str());
my_bot->RaidGroupSay(tracking_msg.c_str());
entity_list.ShowSpawnWindow(c, (c->GetLevel() * base_distance), track_named);
}

View File

@ -229,7 +229,6 @@ bool Bot::AICastSpell(Mob* tar, uint8 chance, uint16 spell_type, uint16 sub_targ
if (IsCommandedSpell() && IsCasting()) {
RaidGroupSay(
this,
fmt::format(
"Interrupting {}. I have been commanded to try to cast a [{}] spell, {} on {}.",
CastingSpellID() ? spells[CastingSpellID()].name : "my spell",
@ -255,7 +254,6 @@ bool Bot::AICastSpell(Mob* tar, uint8 chance, uint16 spell_type, uint16 sub_targ
}
RaidGroupSay(
this,
fmt::format(
"Casting {} [{}] on {}.",
GetSpellName(s.SpellId),
@ -302,7 +300,6 @@ bool Bot::BotCastMez(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spel
}
RaidGroupSay(
this,
fmt::format(
"Casting {} [{}] on {}.",
GetSpellName(s.SpellId),
@ -343,7 +340,6 @@ bool Bot::BotCastCure(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spe
}
RaidGroupSay(
this,
fmt::format(
"Curing the group with {}.",
GetSpellName(bot_spell.SpellId)
@ -356,7 +352,6 @@ bool Bot::BotCastCure(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spe
}
RaidGroupSay(
this,
fmt::format(
"Curing {} with {}.",
(tar == this ? "myself" : tar->GetCleanName()),
@ -410,7 +405,6 @@ bool Bot::BotCastPet(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spel
SetCastedSpellType(spell_type);
RaidGroupSay(
this,
fmt::format(
"Summoning a pet [{}].",
GetSpellName(bot_spell.SpellId)
@ -466,7 +460,6 @@ bool Bot::BotCastNuke(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spe
SetCastedSpellType(spell_type);
RaidGroupSay(
this,
fmt::format(
"Casting {} [{}] on {}.",
GetSpellName(s.SpellId),
@ -484,7 +477,6 @@ bool Bot::BotCastNuke(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spe
SetCastedSpellType(spell_type);
RaidGroupSay(
this,
fmt::format(
"Casting {} [{}] on {}.",
GetSpellName(bot_spell.SpellId),
@ -518,7 +510,6 @@ bool Bot::BotCastHeal(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spe
}
RaidGroupSay(
this,
fmt::format(
"Healing the group with {} [{}].",
GetSpellName(bot_spell.SpellId),
@ -535,7 +526,6 @@ bool Bot::BotCastHeal(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spe
}
RaidGroupSay(
this,
fmt::format(
"Healing {} with {} [{}].",
(tar == this ? "myself" : tar->GetCleanName()),
@ -888,7 +878,6 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
if (castedSpell) {
RaidGroupSay(
this,
fmt::format(
"Casting {} on {}, please stay in range!",
spells[botSpell.SpellId].name,

View File

@ -661,7 +661,7 @@ void Lua_Bot::DeleteBot() {
void Lua_Bot::RaidGroupSay(const char* message) {
Lua_Safe_Call_Void();
self->RaidGroupSay(self, message);
self->RaidGroupSay(message);
}
luabind::scope lua_register_bot() {

View File

@ -617,7 +617,7 @@ void Perl_Bot_DeleteBot(Bot* self) // @categories Script Utility
void Perl_Bot_RaidGroupSay(Bot* self, const char* message) // @categories Script Utility
{
self->RaidGroupSay(self, message);
self->RaidGroupSay(message);
}
void perl_register_bot()

View File

@ -734,7 +734,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) {
if (!bot_piercer || bot_piercer->ItemType != EQ::item::ItemType1HPiercing) {
if (!bot->GetCombatRoundForAlerts()) {
bot->SetCombatRoundForAlerts();
bot->RaidGroupSay(this, "I can't backstab with this weapon!");
bot->RaidGroupSay("I can't backstab with this weapon!");
}
return;
}