Advertisement
NatedogServer

collect_quest

Nov 12th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 5.08 KB | None | 0 0
  1. #QUEST part...         
  2.  
  3. if (plugin::check_hascount($client, 160002, 20)) {  #Checking to see if we have 20 stack of item 160,002 anywhere in current inventory
  4.                
  5.                 plugin::collect_quest($client, 160002, 20);
  6.                 $client->Message(335, "Removing 20 of 160002 from your inventory");
  7.             } else {
  8.                 $client->Message(335, "You do not have the required amount in a correct stack size!");
  9.             }
  10.  
  11.  
  12. #PLUGIN PART...
  13.  
  14. #checks to see if player has item
  15. #useage plugin::check_hasitem($client, itemid);
  16. sub check_slot {
  17.     my $client = shift;
  18.     my $itmchk = shift;
  19.     my $slot1;
  20.     my $itemid1;
  21.     my $augid1;
  22.     my $i;
  23.     my $body_count = $client->GetCorpseCount();
  24.     my $body_id;
  25.  
  26. #Check main inventory and cursor
  27.     for($slot1=0; $slot1<=30; $slot1++) {
  28.         $itemid1=$client->GetItemIDAt($slot1);
  29.       for($i=0; $i<5; $i++) {
  30.          $augid1=$client->GetAugmentIDAt($slot1, $i);
  31.          if($augid1==$itmchk) {
  32.             return $slot1;
  33.          }
  34.       }
  35.         if($itemid1==$itmchk) {
  36.             return $slot1;
  37.         }
  38.     }
  39. #Check main inventory's and cursor's containers
  40.     for($slot1=251; $slot1<=340; $slot1++) {
  41.         $itemid1=$client->GetItemIDAt($slot1);
  42.       for($i=0; $i<5; $i++) {
  43.          $augid1=$client->GetAugmentIDAt($slot1, $i);
  44.          if($augid1==$itmchk) {
  45.             return $slot1;
  46.          }
  47.       }
  48.         if($itemid1==$itmchk) {
  49.             return $slot1;
  50.         }
  51.     }
  52. #Check bank slots
  53.     for($slot1=2000; $slot1<=2023; $slot1++) {
  54.         $itemid1=$client->GetItemIDAt($slot1);
  55.       for($i=0; $i<5; $i++) {
  56.          $augid1=$client->GetAugmentIDAt($slot1, $i);
  57.          if($augid1==$itmchk) {
  58.             return $slot1;
  59.          }
  60.       }
  61.         if($itemid1==$itmchk) {
  62.             return $slot1;
  63.         }
  64.     }
  65. #Check bank's containers
  66.     for($slot1=2030; $slot1<=2270; $slot1++) {
  67.         $itemid1=$client->GetItemIDAt($slot1);
  68.       for($i=0; $i<5; $i++) {
  69.          $augid1=$client->GetAugmentIDAt($slot1, $i);
  70.          if($augid1==$itmchk) {
  71.             return $slot1;
  72.          }
  73.       }
  74.         if($itemid1==$itmchk) {
  75.             return $slot1;
  76.         }
  77.     }
  78. #Check shared bank
  79.     for($slot1=2500; $slot1<=2501; $slot1++) {
  80.         $itemid1=$client->GetItemIDAt($slot1);
  81.       for($i=0; $i<5; $i++) {
  82.          $augid1=$client->GetAugmentIDAt($slot1, $i);
  83.          if($augid1==$itmchk) {
  84.             return $slot1;
  85.          }
  86.       }
  87.         if($itemid1==$itmchk) {
  88.             return $slot1;
  89.         }
  90.     }
  91. #Check shared bank's containers
  92.     for($slot1=2531; $slot1<=2550; $slot1++) {
  93.         $itemid1=$client->GetItemIDAt($slot1);
  94.       for($i=0; $i<5; $i++) {
  95.          $augid1=$client->GetAugmentIDAt($slot1, $i);
  96.          if($augid1==$itmchk) {
  97.             return $slot1;
  98.          }
  99.       }
  100.         if($itemid1==$itmchk) {
  101.             return $slot1;
  102.         }
  103.     }
  104. #Check corpses
  105. #  if ($body_count > 0) {
  106. #    for ($i=1; $i<=$body_count; $i++) {
  107. #      $body_id = $client->GetCorpseID($i);
  108. #      for ($slot1=0; $slot1<=30; $slot1++) {
  109. #        $itemid1 = $client->GetCorpseItemAt($body_id, $slot1);
  110. #        if ($itemid1 == $itmchk) {
  111. #          return $slot1;
  112. #        }
  113. #      }
  114. #      for ($slot1=251; $slot1<=340; $slot1++) {
  115. #        $itemid1 = $client->GetCorpseItemAt($body_id, $slot1);
  116. #        if ($itemid1 == $itmchk) {
  117. #          return $slot1;
  118. #        }
  119. #      }
  120. #    }
  121. #  }
  122.   return 0;
  123. }
  124.  
  125. #plugin::check_hascount($client, itemid, amountcheck)
  126. sub check_hascount {
  127.     my $client = shift;
  128.     my $itmchk = shift;
  129.     my $COUNT = shift;
  130.     my $slot1;
  131.     my $itemid1;
  132.     my $i;
  133.  
  134. #Check main inventory  (IGNORE CURSOR)
  135.     for($slot1=0; $slot1<=29; $slot1++) {
  136.         $itemid1=$client->GetItemIDAt($slot1);
  137.         if($itemid1==$itmchk) {
  138.             if($client->GetItemAt($slot1)->GetCharges() >= $COUNT) {
  139.                 return $slot1;
  140.             }
  141.         }
  142.     }
  143. #Check main inventory's bags  (IGNORE CURSOR BAGS)
  144.     for($slot1=251; $slot1<=330; $slot1++) {
  145.         $itemid1=$client->GetItemIDAt($slot1);
  146.         if($itemid1==$itmchk) {
  147.            if($client->GetItemAt($slot1)->GetCharges() >= $COUNT) {
  148.                 return $slot1;
  149.             }
  150.         }
  151.     }
  152.   return 0;
  153. }
  154.  
  155. #plugin::collect_quest($client, itemid, amountcheck)
  156. sub collect_quest {
  157.     my $client = shift;
  158.     my $itmchk = shift;
  159.     my $COUNT = shift;
  160.     my $slot1;
  161.     my $itemid1;
  162.     my $i;
  163.  
  164. #Check main inventory  (IGNORE CURSOR) -- Cursor bugs the fuck out
  165.     for($slot1=0; $slot1<=29; $slot1++) {
  166.         $itemid1=$client->GetItemIDAt($slot1);
  167.         if($itemid1==$itmchk) {
  168.             if($client->GetItemAt($slot1)->GetCharges() >= $COUNT) {
  169.                 $client->DeleteItemInInventory($slot1, $COUNT, 1);
  170.                 return;
  171.             }
  172.         }
  173.     }
  174. #Check main inventory's bags  (IGNORE CURSOR BAGS) -- Cursor bugs the fuck out
  175.     for($slot1=251; $slot1<=330; $slot1++) {
  176.         $itemid1=$client->GetItemIDAt($slot1);
  177.         if($itemid1==$itmchk) {
  178.            if($client->GetItemAt($slot1)->GetCharges() >= $COUNT) {
  179.                 $client->DeleteItemInInventory($slot1, $COUNT, 1);
  180.                 return;
  181.             }
  182.         }
  183.     }
  184.   return 0;
  185. }
  186.  
  187.  
  188.  
  189. 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement