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;
}
}
}