[Quest API] Add Group/Raid Overloads to Perl/Lua. (#2587)

# Perl
- Add `$group->IsGroupMember(name)`.
- Add `$group->IsLeader(name)`.
- Add `$raid->IsRaidMember(c)`.
- Add `$raid->IsGroupLeader(c)`.

# Lua
- Add `group:IsGroupMember(name)`.
- Add `group:IsLeader(name)`.
- Add `raid:IsGroupLeader(client)`.
- Add `raid:IsLeader(client)`.
- Add `raid:IsRaidMember(client)`.

# Notes
- Adds overloads to these methods allowing operators to get by name or reference.
This commit is contained in:
Alex King
2022-11-27 15:57:01 -05:00
committed by GitHub
parent 29247a0f45
commit d0e7e8c4c4
10 changed files with 155 additions and 54 deletions
+41 -10
View File
@@ -354,12 +354,26 @@ void Raid::UpdateRaidAAs()
SaveRaidLeaderAA();
}
bool Raid::IsGroupLeader(const char *who)
bool Raid::IsGroupLeader(const char* name)
{
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
{
if(strcmp(who, members[x].membername) == 0){
return members[x].IsGroupLeader;
if (name) {
for (const auto &m: members) {
if (!strcmp(m.membername, name)) {
return m.IsGroupLeader;
}
}
}
return false;
}
bool Raid::IsGroupLeader(Client *c)
{
if (c) {
for (const auto &m: members) {
if (m.member == c) {
return true;
}
}
}
@@ -890,12 +904,29 @@ void Raid::RemoveRaidLooter(const char* looter)
safe_delete(pack);
}
bool Raid::IsRaidMember(const char *name){
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
{
if(strcmp(name, members[x].membername) == 0)
return true;
bool Raid::IsRaidMember(const char *name)
{
if (name) {
for (const auto &m: members) {
if (!strcmp(m.membername, name)) {
return true;
}
}
}
return false;
}
bool Raid::IsRaidMember(Client* c)
{
if (c) {
for (const auto &m: members) {
if (m.member == c) {
return true;
}
}
}
return false;
}