Go Back   EQEmulator Home > EQEmulator Forums > Support > Spell Support

Spell Support Broken Spells? Want them Fixed? Request it here.

Reply
 
Thread Tools Display Modes
  #1  
Old 10-06-2015, 06:18 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,604
Default

Expansion of plugin::check_hasitem to have array capability (checks for at least one of the items in the array) as well as the ability to check if someone has a certain item or any item in an array of items equipped:
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;

Last edited by Kingly_Krab; 10-06-2015 at 06:25 PM..
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 01:23 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3