[Quest API] Add Client Spell Methods to Perl/Lua. (#2550)

* [Quest API] Add Client Spell Methods to Perl/Lua.

# Perl
- Add `$client->ApplySpell(spell_id)`.
- Add `$client->ApplySpell(spell_id, duration)`.
- Add `$client->ApplySpell(spell_id, duration, allow_pets)`.
- Add `$client->ApplySpell(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `$client->ApplySpell(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `$client->ApplySpellGroup(spell_id)`.
- Add `$client->ApplySpellGroup(spell_id, duration)`.
- Add `$client->ApplySpellGroup(spell_id, duration, allow_pets)`.
- Add `$client->ApplySpellGroup(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `$client->ApplySpellGroup(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `$client->ApplySpellRaid(spell_id)`.
- Add `$client->ApplySpellRaid(spell_id, duration)`.
- Add `$client->ApplySpellRaid(spell_id, duration, allow_pets)`.
- Add `$client->ApplySpellRaid(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `$client->ApplySpellRaid(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `$client->SetSpellDuration(spell_id)`.
- Add `$client->SetSpellDuration(spell_id, duration)`.
- Add `$client->SetSpellDuration(spell_id, duration, allow_pets)`.
- Add `$client->SetSpellDuration(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `$client->SetSpellDuration(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `$client->SetSpellDurationGroup(spell_id)`.
- Add `$client->SetSpellDurationGroup(spell_id, duration)`.
- Add `$client->SetSpellDurationGroup(spell_id, duration, allow_pets)`.
- Add `$client->SetSpellDurationGroup(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `$client->SetSpellDurationGroup(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `$client->SetSpellDurationRaid(spell_id)`.
- Add `$client->SetSpellDurationRaid(spell_id, duration)`.
- Add `$client->SetSpellDurationRaid(spell_id, duration, allow_pets)`.
- Add `$client->SetSpellDurationRaid(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `$client->SetSpellDurationRaid(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.

# Lua
- Add `client:ApplySpell(spell_id)`.
- Add `client:ApplySpell(spell_id, duration)`.
- Add `client:ApplySpell(spell_id, duration, allow_pets)`.
- Add `client:ApplySpell(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `client:ApplySpell(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `client:ApplySpellGroup(spell_id)`.
- Add `client:ApplySpellGroup(spell_id, duration)`.
- Add `client:ApplySpellGroup(spell_id, duration, allow_pets)`.
- Add `client:ApplySpellGroup(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `client:ApplySpellGroup(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `client:ApplySpellRaid(spell_id)`.
- Add `client:ApplySpellRaid(spell_id, duration)`.
- Add `client:ApplySpellRaid(spell_id, duration, allow_pets)`.
- Add `client:ApplySpellRaid(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `client:ApplySpellRaid(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `client:SetSpellDuration(spell_id)`.
- Add `client:SetSpellDuration(spell_id, duration)`.
- Add `client:SetSpellDuration(spell_id, duration, allow_pets)`.
- Add `client:SetSpellDuration(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `client:SetSpellDuration(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `client:SetSpellDurationGroup(spell_id)`.
- Add `client:SetSpellDurationGroup(spell_id, duration)`.
- Add `client:SetSpellDurationGroup(spell_id, duration, allow_pets)`.
- Add `client:SetSpellDurationGroup(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `client:SetSpellDurationGroup(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.
- Add `client:SetSpellDurationRaid(spell_id)`.
- Add `client:SetSpellDurationRaid(spell_id, duration)`.
- Add `client:SetSpellDurationRaid(spell_id, duration, allow_pets)`.
- Add `client:SetSpellDurationRaid(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `client:SetSpellDurationRaid(spell_id, duration, allow_pets, is_raid_group_only, allow_bots)`.

# Notes
- Allows operators extremely easy shorthands to cast on entire groups and raid groups and optionally include their bots and pets.
- Default functionality for Raid is that it only casts on your group, set `is_raid_group_only` to `false` to cast on the entire Raid.

* Cleanup.

* Remove Raid parameter from Solo/Group methods.
This commit is contained in:
Kinglykrab
2022-11-22 09:11:36 -05:00
committed by GitHub
parent 37af643b61
commit 0c56586f3b
16 changed files with 1018 additions and 289 deletions
+105
View File
@@ -11810,3 +11810,108 @@ void Client::AddAAPoints(uint32 points)
bool Client::SendGMCommand(std::string message, bool ignore_status) {
return command_dispatch(this, message, ignore_status) >= 0 ? true : false;
}
std::vector<Mob*> Client::GetApplySpellList(
ApplySpellType apply_type,
bool allow_pets,
bool is_raid_group_only,
bool allow_bots
) {
std::vector<Mob*> l;
if (apply_type == ApplySpellType::Raid && IsRaidGrouped()) {
auto* r = GetRaid();
auto group_id = r->GetGroup(this);
if (r && EQ::ValueWithin(group_id, 0, (MAX_RAID_GROUPS - 1))) {
for (auto i = 0; i < MAX_RAID_MEMBERS; i++) {
auto* m = r->members[i].member;
if (m && m->IsClient() && (!is_raid_group_only || r->GetGroup(m) == group_id)) {
l.push_back(m);
if (allow_pets && m->HasPet()) {
l.push_back(m->GetPet());
}
#ifdef BOTS
if (allow_bots) {
const auto& sbl = entity_list.GetBotListByCharacterID(m->CharacterID());
for (const auto& b : sbl) {
l.push_back(b);
}
}
#endif
}
}
}
} else if (apply_type == ApplySpellType::Group && IsGrouped()) {
auto* g = GetGroup();
if (g) {
for (auto i = 0; i < MAX_GROUP_MEMBERS; i++) {
auto* m = g->members[i];
if (m && m->IsClient()) {
l.push_back(m->CastToClient());
if (allow_pets && m->HasPet()) {
l.push_back(m->GetPet());
}
#ifdef BOTS
if (allow_bots) {
const auto& sbl = entity_list.GetBotListByCharacterID(m->CastToClient()->CharacterID());
for (const auto& b : sbl) {
l.push_back(b);
}
}
#endif
}
}
}
} else {
l.push_back(this);
if (allow_pets && HasPet()) {
l.push_back(GetPet());
}
#ifdef BOTS
if (allow_bots) {
const auto& sbl = entity_list.GetBotListByCharacterID(CharacterID());
for (const auto& b : sbl) {
l.push_back(b);
}
}
#endif
}
return l;
}
void Client::ApplySpell(
int spell_id,
int duration,
ApplySpellType apply_type,
bool allow_pets,
bool is_raid_group_only,
bool allow_bots
) {
const auto& l = GetApplySpellList(apply_type, allow_pets, is_raid_group_only, allow_bots);
for (const auto& m : l) {
m->ApplySpellBuff(spell_id, duration);
}
}
void Client::SetSpellDuration(
int spell_id,
int duration,
ApplySpellType apply_type,
bool allow_pets,
bool is_raid_group_only,
bool allow_bots
) {
const auto& l = GetApplySpellList(apply_type, allow_pets, is_raid_group_only, allow_bots);
for (const auto& m : l) {
m->SetBuffDuration(spell_id, duration);
}
}