From 445f967ed6318482d66944feb00a2acdd2ff5201 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sun, 9 Apr 2023 12:00:12 -0400 Subject: [PATCH] [Quest API] Add ApplySpellRaid() and SetSpellDurationRaid() to Bots in Perl/Lua (#3274) # Perl - Add `$bot->ApplySpellRaid(spell_id)`. - Add `$bot->ApplySpellRaid(spell_id, duration)`. - Add `$bot->ApplySpellRaid(spell_id, duration, allow_pets)`. - Add `$bot->ApplySpellRaid(spell_id, duration, allow_pets, is_raid_group_only)`. - Add `$bot->SetSpellDuration(spell_id)`. - Add `$bot->SetSpellDuration(spell_id, duration)`. - Add `$bot->SetSpellDuration(spell_id, duration, allow_pets)`. - Add `$bot->SetSpellDuration(spell_id, duration, allow_pets, is_raid_group_only)`. # Lua - Add `bot:ApplySpellRaid(spell_id)`. - Add `bot:ApplySpellRaid(spell_id, duration)`. - Add `bot:ApplySpellRaid(spell_id, duration, allow_pets)`. - Add `bot:ApplySpellRaid(spell_id, duration, allow_pets, is_raid_group_only)`. - Add `bot:SetSpellDuration(spell_id)`. - Add `bot:SetSpellDuration(spell_id, duration)`. - Add `bot:SetSpellDuration(spell_id, duration, allow_pets)`. - Add `bot:SetSpellDuration(spell_id, duration, allow_pets, is_raid_group_only)`. # Notes - These methods weren't added initially as we did not support bots in raid groups until recently. --- zone/lua_bot.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ zone/lua_bot.h | 5 +++++ 2 files changed, 53 insertions(+) diff --git a/zone/lua_bot.cpp b/zone/lua_bot.cpp index a5955d207..6ebf88836 100644 --- a/zone/lua_bot.cpp +++ b/zone/lua_bot.cpp @@ -175,6 +175,26 @@ void Lua_Bot::ApplySpellGroup(int spell_id, int duration, bool allow_pets) { self->ApplySpell(spell_id, duration, ApplySpellType::Group, allow_pets); } +void Lua_Bot::ApplySpellRaid(int spell_id) { + Lua_Safe_Call_Void(); + self->ApplySpell(spell_id, 0, ApplySpellType::Raid); +} + +void Lua_Bot::ApplySpellRaid(int spell_id, int duration) { + Lua_Safe_Call_Void(); + self->ApplySpell(spell_id, duration, ApplySpellType::Raid, true, true); +} + +void Lua_Bot::ApplySpellRaid(int spell_id, int duration, bool allow_pets) { + Lua_Safe_Call_Void(); + self->ApplySpell(spell_id, duration, ApplySpellType::Raid, allow_pets, true); +} + +void Lua_Bot::ApplySpellRaid(int spell_id, int duration, bool allow_pets, bool is_raid_group_only) { + Lua_Safe_Call_Void(); + self->ApplySpell(spell_id, duration, ApplySpellType::Raid, allow_pets, is_raid_group_only); +} + void Lua_Bot::SetSpellDuration(int spell_id) { Lua_Safe_Call_Void(); self->SetSpellDuration(spell_id); @@ -205,6 +225,26 @@ void Lua_Bot::SetSpellDurationGroup(int spell_id, int duration, bool allow_pets) self->SetSpellDuration(spell_id, duration, ApplySpellType::Group, allow_pets); } +void Lua_Bot::SetSpellDurationRaid(int spell_id) { + Lua_Safe_Call_Void(); + self->SetSpellDuration(spell_id, 0, ApplySpellType::Raid); +} + +void Lua_Bot::SetSpellDurationRaid(int spell_id, int duration) { + Lua_Safe_Call_Void(); + self->SetSpellDuration(spell_id, duration, ApplySpellType::Raid); +} + +void Lua_Bot::SetSpellDurationRaid(int spell_id, int duration, bool allow_pets) { + Lua_Safe_Call_Void(); + self->SetSpellDuration(spell_id, duration, ApplySpellType::Raid, allow_pets); +} + +void Lua_Bot::SetSpellDurationRaid(int spell_id, int duration, bool allow_pets, bool is_raid_group_only) { + Lua_Safe_Call_Void(); + self->SetSpellDuration(spell_id, duration, ApplySpellType::Raid, allow_pets, is_raid_group_only); +} + int Lua_Bot::CountAugmentEquippedByID(uint32 item_id) { Lua_Safe_Call_Int(); return self->GetInv().CountAugmentEquippedByID(item_id); @@ -473,6 +513,10 @@ luabind::scope lua_register_bot() { .def("ApplySpellGroup", (void(Lua_Bot::*)(int))&Lua_Bot::ApplySpellGroup) .def("ApplySpellGroup", (void(Lua_Bot::*)(int,int))&Lua_Bot::ApplySpellGroup) .def("ApplySpellGroup", (void(Lua_Bot::*)(int,int,bool))&Lua_Bot::ApplySpellGroup) + .def("ApplySpellRaid", (void(Lua_Bot::*)(int))&Lua_Bot::ApplySpellRaid) + .def("ApplySpellRaid", (void(Lua_Bot::*)(int,int))&Lua_Bot::ApplySpellRaid) + .def("ApplySpellRaid", (void(Lua_Bot::*)(int,int,bool))&Lua_Bot::ApplySpellRaid) + .def("ApplySpellRaid", (void(Lua_Bot::*)(int,int,bool,bool))&Lua_Bot::ApplySpellRaid) .def("Camp", (void(Lua_Bot::*)(void))&Lua_Bot::Camp) .def("Camp", (void(Lua_Bot::*)(bool))&Lua_Bot::Camp) .def("CountBotItem", (uint32(Lua_Bot::*)(uint32))&Lua_Bot::CountBotItem) @@ -528,6 +572,10 @@ luabind::scope lua_register_bot() { .def("SetSpellDurationGroup", (void(Lua_Bot::*)(int))&Lua_Bot::SetSpellDurationGroup) .def("SetSpellDurationGroup", (void(Lua_Bot::*)(int,int))&Lua_Bot::SetSpellDurationGroup) .def("SetSpellDurationGroup", (void(Lua_Bot::*)(int,int,bool))&Lua_Bot::SetSpellDurationGroup) + .def("SetSpellDurationRaid", (void(Lua_Bot::*)(int))&Lua_Bot::SetSpellDurationRaid) + .def("SetSpellDurationRaid", (void(Lua_Bot::*)(int,int))&Lua_Bot::SetSpellDurationRaid) + .def("SetSpellDurationRaid", (void(Lua_Bot::*)(int,int,bool))&Lua_Bot::SetSpellDurationRaid) + .def("SetSpellDurationRaid", (void(Lua_Bot::*)(int,int,bool,bool))&Lua_Bot::SetSpellDurationRaid) .def("SendPayload", (void(Lua_Bot::*)(int))&Lua_Bot::SendPayload) .def("SendPayload", (void(Lua_Bot::*)(int,std::string))&Lua_Bot::SendPayload) .def("Signal", (void(Lua_Bot::*)(int))&Lua_Bot::Signal) diff --git a/zone/lua_bot.h b/zone/lua_bot.h index 041745091..908ee5d86 100644 --- a/zone/lua_bot.h +++ b/zone/lua_bot.h @@ -74,6 +74,11 @@ public: void ApplySpellGroup(int spell_id, int duration); void ApplySpellGroup(int spell_id, int duration, bool allow_pets); + 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); + void SetSpellDuration(int spell_id); void SetSpellDuration(int spell_id, int duration); void SetSpellDuration(int spell_id, int duration, bool allow_pets);