Guest User

Burying.java

a guest
Jul 5th, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.95 KB | None | 0 0
  1. package com.rs.game.player.actions;
  2.  
  3. import com.rs.cache.loaders.ItemDefinitions;
  4. import com.rs.game.Animation;
  5. import com.rs.game.item.Item;
  6. import com.rs.game.player.Player;
  7. import com.rs.game.player.Skills;
  8. import com.rs.game.tasks.WorldTask;
  9. import com.rs.game.tasks.WorldTasksManager;
  10. import java.util.HashMap;
  11. import java.util.Map;
  12.  
  13. public class Burying {
  14.  
  15.     public enum Bones {
  16.            
  17.         NORMAL(526, 4.5),
  18.                 NORMAL2(2530, 4.5),
  19.         WOLF(2859, 4.5),
  20.         BURNT(528, 4.5),
  21.         MONKEY(3183, 5),
  22.         BAT(530, 5.3),
  23.         BIG(532, 15),
  24.         JOGRE(3125, 15),
  25.         ZOGRE(4812, 22.5),
  26.         SHAIKAHAN(3123, 25),
  27.         BABY_DRAGON(534, 30),
  28.         WYVERN(6812, 50),
  29.         DRAGON(536, 72),
  30.         FAYRG(4830, 84),
  31.         RAURG(4832, 96),
  32.         DAGANNOTH(6729, 125),
  33.         OURG(4834, 140),
  34.         OURG_GRAARDOR(14793, 140),
  35.         FROST_DRAGON(18830, 180),
  36.         ANCIENT(15410, 200),
  37.                
  38.                 SKELETAL_MONKEY(3187, 3),
  39.                 SMALL_ZOMBIE_MONKEY(3185, 5),
  40.         LARGE_ZOMBIE_MONKEY(3186, 5),
  41.                 SMALL_NINJA_MONKEY(3179, 16),
  42.         MEDIUM_NINJA_MONKEY(3180, 18),
  43.         GORILLA(3181, 18),
  44.         BEARDED_GORILLA(3182, 20),
  45.                
  46.                 NORMAL_DUNGEONEERING(17670, 4.5),
  47.                 BAT_DUNGEONEERING(17672, 5.3),
  48.                 BIG_DUNGEONEERING(17674, 15),
  49.                 DRAGON_DUNGEONEERING(17676, 72),
  50.                 FROST_DRAGON_DUNGEONEERING(18832, 180);
  51.  
  52.         private final int id;
  53.         private final double experience;
  54.  
  55.         private static final Map<Integer, Bones> bones = new HashMap<Integer, Bones>();
  56.  
  57.         static {
  58.             for (Bones bone : Bones.values()) {
  59.                 bones.put(bone.getId(), bone);
  60.             }
  61.         }
  62.  
  63.         public static Bones forId(int id) {
  64.             return bones.get(id);
  65.         }
  66.  
  67.         private Bones(int id, double experience) {
  68.             this.id = id;
  69.             this.experience = experience;
  70.         }
  71.  
  72.         public int getId() {
  73.             return id;
  74.         }
  75.  
  76.         public double getExperience() {
  77.             return experience;
  78.         }
  79.  
  80.         public static final Animation BURY_ANIMATION = new Animation(827);
  81.  
  82.         public static void bury(final Player player, int inventorySlot) {
  83.             final Item item = player.getInventory().getItem(inventorySlot);
  84.             if (item == null || Bones.forId(item.getId()) == null)
  85.                 return;
  86.             final Bones bone = Bones.forId(item.getId());
  87.             final ItemDefinitions itemDef = new ItemDefinitions(item.getId());
  88.                         player.stopAll();
  89.             player.lock(2);
  90.             player.getPackets().sendSound(2738, 0, 1);
  91.             player.setNextAnimation(BURY_ANIMATION);
  92.             player.getPackets().sendGameMessage("You dig a hole in the ground...");
  93.             WorldTasksManager.schedule(new WorldTask() {
  94.                 @Override
  95.                 public void run() {
  96.                     player.getPackets().sendGameMessage("You bury the bones.");
  97.                     player.getInventory().getItems().remove(inventorySlot, item);
  98.                                         player.getInventory().refresh(inventorySlot);
  99.                     double xp = bone.getExperience();
  100.                     player.getSkills().addXp(Skills.PRAYER, xp);
  101.                     stop();
  102.                 }
  103.             });
  104.         }
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment