View Single Post
  #1  
Old 06-18-2017, 09:46 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default Custom Item Check Plugins

Included below are the following plugins:
  1. check_hasitem(client, item_id)
    • Used to check if a client has a specific item.
  2. check_hasitem_array(client, item_id_array)
    • Used to check if a client has any item within the specified item ID array.
  3. check_hasequipped(client, item_id)
    • Used to check if a client has a specific item equipped.
  4. check_hasequipped_array(client, item_id_array)
    • Used to check if a client has any item equipped within the specified item ID array.
Code:
sub check_hasitem {
    my $client = shift;
    my $itemid = shift;
    my @slots = (0..30, 251..340, 2000..2023, 2030..2270, 2500..2501, 2531..2550, 9999);
    foreach $slot (@slots) {
        if ($client->GetItemIDAt($slot) == $itemid) {
            return 1;
        }

        for ($i = 0; $i < 5; $i++) {
            if ($client->GetAugmentIDAt($slot, $i) == $itemid) {
                return 1;
            }
        }
    }
    return 0;
}

sub check_hasitem_array {
    my $client = shift;
    my @items = @_;
    my @slots = (0..30, 251..340, 2000..2023, 2030..2270, 2500..2501, 2531..2550, 9999);
    foreach $slot (@slots) {
        if ($client->GetItemIDAt($slot) ~~ @items) {
            return 1;
        }

        for ($i = 0; $i < 5; $i++) {
            if ($client->GetAugmentIDAt($slot, $i) ~~ @items) {
                return 1;
            }
        }
    }
    return 0;
}

sub check_hasequipped {
    my $client = shift;
    my $item = shift;
    my @slots = (0..21, 9999);
    foreach my $slot (@slots) {
        if ($client->GetItemIDAt($slot) == $item) {
            return 1;
        }

        for ($i = 0; $i < 5; $i++) {
            if ($client->GetAugmentIDAt($slot, $i) == $item) {
                return 1;
            }
        }
    }
}

sub check_hasequipped_array {
    my $client = shift;
    my @items = @_;
    my @slots = (0..21, 9999);
    foreach my $slot (@slots) {
        if ($client->GetItemIDAt($slot) ~~ @items) {
            return 1;
        }

        for ($i = 0; $i < 5; $i++) {
            if ($client->GetAugmentIDAt($slot, $i) ~~ @items) {
                return 1;
            }
        }
    }
}

return 1;
Reply With Quote