PDA

View Full Version : Custom Item Check Plugins


Kingly_Krab
06-18-2017, 09:46 PM
Included below are the following plugins:


check_hasitem(client, item_id)

Used to check if a client has a specific item.

check_hasitem_array(client, item_id_array)

Used to check if a client has any item within the specified item ID array.

check_hasequipped(client, item_id)

Used to check if a client has a specific item equipped.

check_hasequipped_array(client, item_id_array)

Used to check if a client has any item equipped within the specified item ID array.


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;