Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 08-19-2014, 03:15 PM
Leetsauce
Hill Giant
 
Join Date: Apr 2010
Posts: 169
Default Check_hasitem, keys, and powersources

Context: I use keys on my server instead of qglobal "flags", and I generally make it an item or augment that the character can wear.

So I ran into an issue today where check_hasitem was crashing zones (due to checking corpses) and happened to stumble upon an issue with the check_hasitem.pl plugin that did NOT check the powersource slot. Simple fix was to take the powersource off, put it in your inventory, and the check worked successfully. So, it led me here:


#Check main inventory and cursor
for($slot1=0; $slot1<=9999; $slot1++) {
$itemid1=$client->GetItemIDAt($slot1);
for($i=0; $i<5; $i++) {
$augid1=$client->GetAugmentIDAt($slot1, $i);
if($augid1==$itmchk) {
return 1;
}
}

Changing the second variable:$slot1<=30(inventory slots minus the power source slot) to $slot1<=9999(9999 is the slot #peekinv tells you the power source is found) fixed the issue, and forced the routine to check the power source slot. I only had to alter it in this section alone for my intended purpose, but I figured I would share just in case someone runs into the same issue. I suck at perl, so this one took me a minute or two to solve and wish to pass on what I've learned.

Thanks!
Reply With Quote
  #2  
Old 08-19-2014, 03:32 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,595
Default

The issue with changing it from 30 to 9999 is the fact you're checking EVERY slot in between 0 and 9999 which has all bag slots, inventory slots, bank slots, bank bag slots, etc. Really, you'd want to do like they do it in the source where it increments to a certain point and is reassigned to the Powersource Slot ID. Code below.
Code:
#Check main inventory and cursor
for($slot1 = 0; $slot1 <= 31; $slot1++) {
    if ($slot1 == 31) {
        $slot1 = 9999;
    }
    $itemid1 = $client->GetItemIDAt($slot1);
    for($i = 0; $i < 5; $i++) {
        $augid1 = $client->GetAugmentIDAt($slot1, $i);
        if($augid1 == $itmchk) {
            return 1;
        }
    }
}
Reply With Quote
  #3  
Old 08-19-2014, 03:52 PM
Leetsauce
Hill Giant
 
Join Date: Apr 2010
Posts: 169
Default

Awwww, snap. Thanks for cleaning that up for me.
Reply With Quote
  #4  
Old 08-19-2014, 03:58 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,595
Default

You're welcome.
Reply With Quote
Reply


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 09:50 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3