EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Plugins & Mods (https://www.eqemulator.org/forums/forumdisplay.php?f=678)
-   -   Group Flagging. (https://www.eqemulator.org/forums/showthread.php?t=39721)

Kingly_Krab 06-01-2015 09:46 PM

Group Flagging.
 
This allows you to set and check whole groups flags. As it may not be obvious, this requires a custom file in your plugins folder.
Code:

sub CheckGroupFlag {
    my $client = plugin::val('client');
    my $flag = shift;
    if ($client->GetGroup()) {
        for ($i = 0; $i < 6; $i++) {
            if ($client->GetGroup()->GetMember($i) && !$client->GetGroup()->GetMember($i)->HasZoneFlag($flag)) {
                return 0;
            }
        }
    } else {
        if (!$client->HasZoneFlag($flag)) {
            return 0;
        }
    }
    return 1;
}

sub SetGroupFlag {
    my $client = plugin::val('client');
    my $flag = shift;
    if ($client->GetGroup()) {
        for ($i = 0; $i < 6; $i++) {
            if ($client->GetGroup()->GetMember($i) && !$client->GetGroup()->GetMember($i)->HasZoneFlag($flag)) {
                $client->GetGroup()->GetMember($i)->SetZoneFlag($flag);
            }
        }
    } else {
        if (!$client->HasZoneFlag($flag)) {
            $client->SetZoneFlag($flag);
        }
    }
}

return 1;


Kingly_Krab 06-02-2015 12:18 AM

Due to the new functionality mentioned here, you can now do this:
Code:

sub CheckGroupGlobal {
    my $client = plugin::val('client');
    my $global = shift;
    my $value = shift;
    if ($client->GetGroup()) {
        for ($i = 0; $i < 6; $i++) {
            if ($client->GetGroup()->GetMember($i) && $client->GetGroup()->GetMember($i)->GetGlobal($global) != $value) {
                return 0;
            }
        }
    } else {
        if ($client->GetGlobal($global) != $value) {
            return 0;
        }
    }
    return 1;
}

sub SetGroupGlobal {
    my $client = plugin::val('client');
    my $global = shift;
    my $value = shift;
    my $options = shift;
    my $duration = shift;
    if ($client->GetGroup()) {
        for ($i = 0; $i < 6; $i++) {
            if ($client->GetGroup()->GetMember($i) && $client->GetGroup()->GetMember($i)->GetGlobal($global) != $value) {
                $client->GetGroup()->GetMember($i)->SetGlobal($global, $value, $options, $duration);
            }
        }
    } else {
        if ($client->GetGlobal($global) != $value) {
            $client->SetGlobal($global, $value, $options, $duration);
        }
    }
}

return 1;


Kingly_Krab 07-15-2015 08:02 PM

Sorry to necro my own thread, but I'm just wondering if anyone has actually used this.

EDIT: On bot servers, you may want to edit the plugins to check if the member IsClient().

Maze_EQ 07-28-2015 09:48 AM

I've used something similar on Nagafens lair to do IP Flags and account based progression flags.

If I were to use flagging for any reason I'd adapt this.


All times are GMT -4. The time now is 08:17 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.