Guest User

Untitled

a guest
Oct 21st, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.85 KB | None | 0 0
  1. package org.hyperion.rs2.model.content.misc;
  2.  
  3. import org.hyperion.rs2.model.Item;
  4. import org.hyperion.rs2.model.ItemDefinition;
  5. import org.hyperion.rs2.model.Player;
  6.  
  7. public class ItemSpawning {
  8.    
  9.     public static void spawnItem(Player player,int id, int amount){
  10.         String message = allowedMessage(id);
  11.         if(message.length() > 0 ){
  12.             player.getActionSender().sendMessage(message);
  13.             return;
  14.         }
  15.         player.getInventory().add(new Item(id,amount));
  16.     }
  17.    
  18.     public static String allowedMessage(int id){
  19.         String itemName = ItemDefinition.forId(id).getName().toLowerCase();
  20.         /**
  21.          * Donator Items. eg D claws
  22.          */
  23.         switch(id){
  24.         case 14484:
  25.         case 14485:
  26.             return "This item can only be purchased in the donator shop.";
  27.         }
  28.        
  29.         for(String forbiddenName : donatorNames){
  30.             if(itemName.contains(forbiddenName))
  31.                 return "This item can only be purchased in the donator shop.";
  32.         }
  33.         /**
  34.          * Point Items. eg Fighter Torso
  35.          */
  36.         switch(id){
  37.             case 10551:
  38.             case 10548:
  39.             case 6570:
  40.             case 10566:
  41.             case 10637:
  42.                 return "This item can only be purchased in the RecklessPk points shop.";
  43.         }
  44.         for(String forbiddenName : rlpkNames){
  45.             if(itemName.contains(forbiddenName))
  46.                 return "This item can only be purchased in the RecklessPk points shop.";
  47.         }
  48.         /**
  49.          * Forbidden Items. eg Zaniks Crate
  50.          */
  51.         switch(id){
  52.         case 0:
  53.             return "This item cannot be spawned.";
  54.         }
  55.         for(String forbiddenName : forbiddenNames){
  56.             if(itemName.contains(forbiddenName))
  57.                 return "This item cannot be spawned.";
  58.         }
  59.         return "";
  60.     }
  61.    
  62.     public static String[] donatorNames = {
  63.         "party","chaotic","h'ween","santa","primal","3rd","light","arcane"
  64.     };
  65.    
  66.     public static String[] rlpkNames = {
  67.         "void","defender","vesta","statius","morrigan","zuriel","spirit",
  68.     };
  69.     public static String[] forbiddenNames = {
  70.         "zanik","crate"
  71.     };
  72.    
  73. }
Add Comment
Please, Sign In to add comment