mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 11:48:37 +00:00
[Bots] Add support for Bot scripting. (#2515)
* [Bots] Add support for Bot scripting. # Perl - Add support for `zone/bot.pl` and `zone/bot_v#.pl`. - Add support for `global/global_bot.pl`. - Add `$bot->SignalBot(signal_id)` to Perl. - Add `$bot->OwnerMessage(message)` to Perl. - Add `$entity_list->SignalAllBotsByOwnerCharacterID(character_id, signal_id)` to Perl. - Add `$entity_list->SignalBotByBotID(bot_id, signal_id)` to Perl. - Add `$entity_list->SignalBotByBotName(bot_name, signal_id)` to Perl. - Add `EVENT_SPELL_EFFECT_BOT` to Perl. - Add `EVENT_SPELL_EFFECT_BUFF_TIC_BOT` to Perl. # Lua - Add support for `zone/bot.lua` and `zone/bot_v#.lua`. - Add support for `global/global_bot.lua`. - Add `bot:SignalBot(signal_id)` to Lua. - Add `bot:OwnerMessage(message)` to Lua. - Add `entity_list:SignalAllBotsByOwnerCharacterID(character_id, signal_id)` to Lua. - Add `entity_list:SignalBotByBotID(bot_id, signal_id)` to Lua. - Add `entity_list:SignalBotByBotName(bot_name, signal_id)` to Lua. - Add `EVENT_SPELL_EFFECT_BOT` to Lua. - Add `EVENT_SPELL_EFFECT_BUFF_TIC_BOT` to Lua. # Supported Bot Events 1. `EVENT_CAST` 2. `EVENT_CAST_BEGIN` 3. `EVENT_CAST_ON` 4. `EVENT_COMBAT` 5. `EVENT_DEATH` 6. `EVENT_DEATH_COMPLETE` 7. `EVENT_SAY` 8. `EVENT_SIGNAL` 9. `EVENT_SLAY` 10. `EVENT_SLAY_NPC` 11. `EVENT_SPAWN` 12. `EVENT_TARGET_CHANGE` 13. `EVENT_TIMER` 14. `EVENT_USE_SKILL` # Common - Convert NPC pointers in common events to Mob pointers so bots are supported. - Convert signal IDs to `int` where it wasn't already, allowing negative signals to be sent properly. * Add EVENT_POPUP_RESPONSE. * Cleanup and fix EVENT_COMBAT/EVENT_SLAY/EVENT_NPC_SLAY. * Fix DoNPCEmote calls. * Update attack.cpp * Update event_codes.h * Update bot_command.cpp
This commit is contained in:
+56
-12
@@ -98,8 +98,16 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
}
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, addMob, botSpell.ManaCost);
|
||||
|
||||
if(castedSpell)
|
||||
BotGroupSay(this, "Attempting to mez %s.", addMob->GetCleanName());
|
||||
if (castedSpell) {
|
||||
BotGroupSay(
|
||||
this,
|
||||
fmt::format(
|
||||
"Attempting to mesmerize {} with {}.",
|
||||
addMob->GetCleanName(),
|
||||
spells[botSpell.SpellId].name
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -272,7 +280,13 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
Group *g = GetGroup();
|
||||
|
||||
if(g) {
|
||||
BotGroupSay(this, "Casting %s.", spells[botSpell.SpellId].name);
|
||||
BotGroupSay(
|
||||
this,
|
||||
fmt::format(
|
||||
"Casting {}.",
|
||||
spells[botSpell.SpellId].name
|
||||
).c_str()
|
||||
);
|
||||
|
||||
for( int i = 0; i<MAX_GROUP_MEMBERS; i++) {
|
||||
if(g->members[i] && !g->members[i]->qglobal) {
|
||||
@@ -281,10 +295,17 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(tar != this) //we don't need spam of bots healing themselves
|
||||
BotGroupSay(this, "Casting %s on %s", spells[botSpell.SpellId].name, tar->GetCleanName());
|
||||
} else {
|
||||
if (tar != this) { //we don't need spam of bots healing themselves
|
||||
BotGroupSay(
|
||||
this,
|
||||
fmt::format(
|
||||
"Casting {} on {}.",
|
||||
spells[botSpell.SpellId].name,
|
||||
tar->GetCleanName()
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
tar->SetDontHealMeBefore(Timer::GetCurrentTime() + 2000);
|
||||
}
|
||||
@@ -892,8 +913,16 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost);
|
||||
|
||||
if(castedSpell && GetClass() != BARD)
|
||||
BotGroupSay(this, "Attempting to slow %s.", tar->GetCleanName());
|
||||
if (castedSpell && GetClass() != BARD) {
|
||||
BotGroupSay(
|
||||
this,
|
||||
fmt::format(
|
||||
"Attempting to slow {} with {}.",
|
||||
tar->GetCleanName(),
|
||||
spells[botSpell.SpellId].name
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -982,7 +1011,14 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
|
||||
castedSpell = AIDoSpellCast(iter.SpellIndex, tar, iter.ManaCost);
|
||||
if (castedSpell) {
|
||||
BotGroupSay(this, "Attempting to reduce hate on %s.", tar->GetCleanName());
|
||||
BotGroupSay(
|
||||
this,
|
||||
fmt::format(
|
||||
"Attempting to reduce hate on {} with {}.",
|
||||
tar->GetCleanName(),
|
||||
spells[iter.SpellId].name
|
||||
).c_str()
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1596,8 +1632,16 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost, &TempDontHealMeBeforeTime);
|
||||
|
||||
if(castedSpell)
|
||||
Say("Casting %s on %s, please stay in range!", spells[botSpell.SpellId].name, tar->GetCleanName());
|
||||
if (castedSpell) {
|
||||
BotGroupSay(
|
||||
this,
|
||||
fmt::format(
|
||||
"Casting {} on {}, please stay in range!",
|
||||
spells[botSpell.SpellId].name,
|
||||
tar->GetCleanName()
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
return castedSpell;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user