Thread: [Elvarg] Prayer Skill help

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22
  1. #11  
    Registered Member
    Andys1814's Avatar
    Join Date
    Feb 2013
    Posts
    974
    Thanks given
    688
    Thanks received
    455
    Rep Power
    727
    Quote Originally Posted by Bosnia View Post
    I got rid of that code but it still doesn't want to do anything, I got it to perform the animation when i tried to rewrite it but it would give any exp or ecven bury the bone, heres an example
    https://i.gyazo.com/a1954c93531af265...565635caa3.gif
    debug and check if the bone enum constant is null
    Reply With Quote  
     

  2. #12  
    Extreme Donator


    Join Date
    Nov 2011
    Posts
    311
    Thanks given
    15
    Thanks received
    94
    Rep Power
    361
    Are you loading the map at the start of the server?
    I test implemented your exact code, and I have it working.

    Elvarg.java
    serviceLoader.execute(() -> BoneBurying.declare());
    Reply With Quote  
     

  3. #13  
    Registered Member
    Join Date
    Dec 2011
    Posts
    248
    Thanks given
    16
    Thanks received
    3
    Rep Power
    16
    Quote Originally Posted by Leviticus View Post
    Are you loading the map at the start of the server?
    I test implemented your exact code, and I have it working.

    Elvarg.java
    serviceLoader.execute(() -> BoneBurying.declare());
    can you expand on this? im sorry
    Just a noob wanting to learn
    Reply With Quote  
     

  4. #14  
    Extreme Donator


    Join Date
    Nov 2011
    Posts
    311
    Thanks given
    15
    Thanks received
    94
    Rep Power
    361
    Quote Originally Posted by Bosnia View Post
    can you expand on this? im sorry
    Go to Elvarg.java in your files and add that line of code to the other ones similar, What this does is load the bones into the map on server start.
    Reply With Quote  
     

  5. #15  
    Registered Member
    Join Date
    Dec 2011
    Posts
    248
    Thanks given
    16
    Thanks received
    3
    Rep Power
    16
    Quote Originally Posted by Leviticus View Post
    Go to Elvarg.java in your files and add that line of code to the other ones similar, What this does is load the bones into the map on server start.
    Okay, I had to import the file(sorry im shit lol)
    https://gyazo.com/cdc175b3ced4d5ed7a65d32ca96b7c77
    this is the issue now.. but I have a delay on it and delete code also
    Just a noob wanting to learn
    Reply With Quote  
     

  6. #16  
    Extreme Donator


    Join Date
    Nov 2011
    Posts
    311
    Thanks given
    15
    Thanks received
    94
    Rep Power
    361
    Quote Originally Posted by Bosnia View Post
    Okay, I had to import the file(sorry im shit lol)
    https://gyazo.com/cdc175b3ced4d5ed7a65d32ca96b7c77
    this is the issue now.. but I have a delay on it and delete code also
    Now what you need to do is, go back into your boneburying class and look for the bury method and inside this if statement.

    if (player.getClickDelay().elapsed(2000)); {
    player.performAnimation(new Animation(827));
    player.getInventory().delete(slot, 1, true);
    player.getSkillManager().addExperience(Skill.PRAYE R, (int) bones.experience);
    player.getPacketSender().sendMessage("You bury the " + new Item(id).getId() + ".");
    }

    under player.getPacketSender().sendMessage("You bury the " + new Item(id).getId() + ".");

    add

    player.getClickDelay().reset();

    What this does is resets the delay. So now it will work properly
    Reply With Quote  
     

  7. #17  
    Registered Member
    Join Date
    Dec 2011
    Posts
    248
    Thanks given
    16
    Thanks received
    3
    Rep Power
    16
    Quote Originally Posted by Leviticus View Post
    Now what you need to do is, go back into your boneburying class and look for the bury method and inside this if statement.

    if (player.getClickDelay().elapsed(2000)); {
    player.performAnimation(new Animation(827));
    player.getInventory().delete(slot, 1, true);
    player.getSkillManager().addExperience(Skill.PRAYE R, (int) bones.experience);
    player.getPacketSender().sendMessage("You bury the " + new Item(id).getId() + ".");
    }

    under player.getPacketSender().sendMessage("You bury the " + new Item(id).getId() + ".");

    add

    player.getClickDelay().reset();

    What this does is resets the delay. So now it will work properly
    Can you send me your class its still not deleting the bone or giving the delay i need
    Just a noob wanting to learn
    Reply With Quote  
     

  8. #18  
    Registered Member
    Join Date
    Jan 2016
    Posts
    106
    Thanks given
    16
    Thanks received
    14
    Rep Power
    69
    to get it to delete the bone change...

    if (player.getClickDelay().elapsed(2000)); {
    player.performAnimation(new Animation(827));
    player.getInventory().delete(slot, 1, true);
    player.getSkillManager().addExperience(Skill.PRAYE R, (int) bones.experience);
    player.getPacketSender().sendMessage("You bury the " + new Item(id).getId() + ".");
    }

    player.getInventory().delete(slot, 1, true);

    to

    player.getInventory().delete(id, 1, true);


    and for the click delay just delete the
    ';'
    from
    if (player.getClickDelay().elapsed(2000)); {

    so it looks like
    if (player.getClickDelay().elapsed(2000)) {
    Reply With Quote  
     

  9. #19  
    Registered Member SinfulPS's Avatar
    Join Date
    Dec 2011
    Posts
    410
    Thanks given
    8
    Thanks received
    18
    Rep Power
    54
    Quote Originally Posted by Bosnia View Post
    I got rid of that code but it still doesn't want to do anything, I got it to perform the animation when i tried to rewrite it but it would give any exp or ecven bury the bone, heres an example
    https://i.gyazo.com/a1954c93531af265...565635caa3.gif
    Code:
    package com.sinfulps.rs2.content.skill.prayer;
    
    import java.util.HashMap;
    import java.util.Map;
    
    import com.sinfulps.core.task.Task;
    import com.sinfulps.core.task.TaskQueue;
    import com.sinfulps.core.task.Task.BreakType;
    import com.sinfulps.core.task.Task.StackType;
    import com.sinfulps.core.task.impl.TaskIdentifier;
    import com.sinfulps.rs2.content.achievements.AchievementHandler;
    import com.sinfulps.rs2.content.achievements.AchievementList;
    import com.sinfulps.rs2.entity.item.Item;
    import com.sinfulps.rs2.entity.player.Player;
    import com.sinfulps.rs2.entity.player.net.out.impl.SendMessage;
    import com.sinfulps.rs2.entity.player.net.out.impl.SendSound;
    
    public class BoneBurying {
    	
    	public static enum Bones {
    		NORMAL_BONES(526, 4.5D),
    		WOLF_BONES(2859, 4.5D),
    		BAT_BONES(530, 4.5D),
    		BIG_BONES(532, 18.0D),
    		BABYDRAGON_BONES(534, 30.0D),
    		DRAGON_BONES(536, 72.0D),
    		DAGG_BONES(6729, 75.0D),
    		OURG_BONES(4834, 100.0D),
    		LONG_BONE(10976, 100.0D),
    		SKELETAL_WYVERN_BONES(6812, 95.0D),
    		LAVA_DRAGON_BONES(11943, 85.0D);
    
    		private int id;
    		private double experience;
    		private static Map<Integer, Bones> bones = new HashMap<Integer, Bones>();
    
    		public static final void declare() {
    			for (Bones b : values())
    				bones.put(Integer.valueOf(b.getId()), b);
    		}
    
    		public static Bones forId(int id) {
    			return bones.get(Integer.valueOf(id));
    		}
    
    		private Bones(int id, double experience) {
    			this.id = id;
    			this.experience = experience;
    		}
    
    		public int getId() {
    			return id;
    		}
    	}
    
    	public static final String USING_ON_ALTAR_KEY = "boneonaltarkey";
    
    	public static final int BURYING_ANIMATION = 827;
    
    	public static boolean bury(Player player, int id, int slot) {
    		Bones bones = Bones.forId(id);
    
    		if (bones == null) {
    			return false;
    		}
    
    		if (player.getSkill().locked()) {
    			return true;
    		}
    
    		player.getSkill().lock(4);
    		player.getCombat().reset();
    		player.getUpdateFlags().sendAnimation(827, 0);
    		player.prayerPoints ++;
    		player.getClient().queueOutgoingPacket(new SendMessage("You bury the " + Item.getDefinition(bones.id).getName() + ". You now have " + player.prayerPoints + " Prayer points."));
    		player.getInventory().clear(slot);
    		player.getSkill().addExperience(5, bones.experience);
    		AchievementHandler.activateAchievement(player, AchievementList.BURY_150_BONES, 1);
    		AchievementHandler.activateAchievement(player, AchievementList.BURY_1000_BONES, 1);
    
    		return true;
    	}
    
    	public static void finishOnAltar(Player player, int amount) {
    		if (player.getAttributes().get("boneonaltarkey") == null) {
    			return;
    		}
    
    		int item = player.getAttributes().getInt("boneonaltarkey");
    
    		Bones bones = Bones.forId(item);
    
    		if (bones == null) {
    			return;
    		}
    
    		int invAmount = player.getInventory().getItemAmount(item);
    
    		if (invAmount == 0)
    			return;
    		if (invAmount < amount) {
    			amount = invAmount;
    		}
    
    		player.getSkill().lock(2);
    		
    		player.getClient().queueOutgoingPacket(new SendMessage("You sacrifice the " + Item.getDefinition(bones.id).getName() + " at the altar."));
    
    		player.getUpdateFlags().sendAnimation(645, 5);
    		player.getInventory().remove(new Item(item, amount));
    		player.getSkill().addExperience(5, (bones.experience * 2.0D) * amount);
    		AchievementHandler.activateAchievement(player, AchievementList.BURY_150_BONES, 1);
    		AchievementHandler.activateAchievement(player, AchievementList.BURY_1000_BONES, 1);
    
    	}
    
    	public static boolean useBonesOnAltar(Player p, int item, int object) {
    		if (object == 2640 || object == 409) {
    			Bones bones = Bones.forId(item);
    
    			if (bones == null) {
    				return false;
    			}
    			
    			TaskQueue.queue(new Task(p, 3, true, StackType.NEVER_STACK, BreakType.ON_MOVE, TaskIdentifier.BONES_ON_ALTER) {
    				@Override
    				public void execute() {
    					if (!p.getInventory().hasItemId(item)) {
    						stop();
    						return;
    					}
    					
    					if (p.getSkill().locked()) {
    						return;
    					}
    					
    					p.getSkill().lock(2);
    					
    					p.getClient().queueOutgoingPacket(new SendSound(442, 1, 0));
    					p.prayerPoints ++;
    					p.getClient().queueOutgoingPacket(new SendMessage("You sacrifice the " + Item.getDefinition(bones.id).getName() + " at the altar. You now have " + p.prayerPoints + " Prayer points."));
    					
    					p.getUpdateFlags().sendAnimation(645, 5);
    					p.getInventory().remove(item);
    					p.getSkill().addExperience(5, bones.experience * 2.0);
    				}
    
    				@Override
    				public void onStop() {
    				}
    			});
    
    
    			return true;
    		}
    
    		return false;
    	}
    }

    try something along my lines mate




    Xbox Live - mynameisntjef
    Skype = alexrogershere
    Reply With Quote  
     

  10. #20  
    Registered Member
    Join Date
    Apr 2017
    Posts
    301
    Thanks given
    34
    Thanks received
    59
    Rep Power
    65
    Just use the one I released.
    Reply With Quote  
     

Page 2 of 3 FirstFirst 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. 420 prayer id help?
    By ike izzle in forum Help
    Replies: 0
    Last Post: 05-31-2009, 09:19 PM
  2. prayer interface help
    By harmy in forum Help
    Replies: 0
    Last Post: 03-27-2009, 12:43 PM
  3. prayer book help!
    By noi172 in forum Help
    Replies: 0
    Last Post: 02-28-2009, 05:40 PM
  4. Prayer Emote Help
    By Galkon in forum Models
    Replies: 21
    Last Post: 03-21-2008, 07:10 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •