Thread: [718] Bones on Altar

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 45
  1. #1 [718] Bones on Altar 
    Registered Member iMTiKo's Avatar
    Join Date
    Sep 2012
    Age
    29
    Posts
    79
    Thanks given
    13
    Thanks received
    12
    Rep Power
    12
    Hello Community of Rune-Server,
    I was working on this for my server, so i decided to release it here as well

    Credits:
    80% - Me, for the coding.
    20% - Matrix, for the base i use.

    NOTE: This uses the RuneScape experience rate.
    Also has correct graphics on object, but no sound.

    In com/rs/game/player/content/ make a class named: BonesOnAltar.java and add this in it.
    Code:
    package com.rs.game.player.content;
    
    import java.util.HashMap;
    import java.util.Map;
    
    import com.rs.game.Animation;
    import com.rs.game.Graphics;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    import com.rs.game.player.actions.Action;
    import com.rs.game.player.actions.Cooking.Cookables;
    
    @SuppressWarnings("unused")
    public class BonesOnAltar extends Action {
    	
    	public final String MESSAGE = "The gods are very pleased with your offerings.";
    	public final double MULTIPLIER = 2.5;
    	
    	public enum Bones {
    		BONES(new Item(526, 1), 5),
    		BIG_BONES(new Item(532, 1), 15),
    		BABYDRAGON_BONES(new Item(534, 1), 30),
    		WYVERN_BONES(new Item(6812, 1), 50),
    		DRAGON_BONES(new Item(536, 1), 72),
    		OURG_BONES(new Item(4834, 1), 140),
    		FROST_DRAGON_BONES(new Item(18830, 1), 180),
    		DAGANNOTH_BONES(new Item(6729, 1), 125);
    	
    		private static Map<Short, Bones> bones = new HashMap<Short, Bones>();
    	
    		public static Bones forId(short itemId) {
    			return bones.get(itemId);
    		}
    	
    		static {
    			for (Bones bone: Bones.values()) {
    				bones.put((short) bone.getBone().getId(), bone);
    			}
    		}
    	
    		private Item item;
    		private int xp;
    	
    		private Bones(Item item, int xp) {
    			this.item = item;
    			this.xp = xp;
    		}
    		
    		public Item getBone() {
    			return item;
    		}
    		
    		public int getXP() {
    			return xp;
    		}
    	}
    		
    	private Bones bone;
    	private int amount;
    	private Item item;
    	private WorldObject object;
    	private Animation USING = new Animation(896);
    	
    	public BonesOnAltar(WorldObject object, Item item, int amount) {
    		this.amount = amount;
    		this.item = item;
    		this.object = object;
    	}
    	
    	public static Bones isGood(Item item) {
    		return Bones.forId((short) item.getId());
    	}
    	
    	public boolean start(Player player) {
    		if((this.bone = Bones.forId((short) item.getId())) == null) {
    			return false;
    		}
    		player.faceObject(object);
    		return true;
    	}
    	
    	public boolean process(Player player) {
    		if (!World.getRegion(object.getRegionId()).containsObject(
    						object.getId(), object))
    			return false;
    		if (!player.getInventory().containsItem(item.getId(), 1)) {
    			return false;
    		}
    		if (!player.getInventory().containsItem(bone.getBone().getId(), 1)) {
    			return false;
    		}
    		return true;
    	}
    	
    	public int processWithDelay(Player player) {
    			player.setNextAnimation(USING);
    			player.getPackets().sendGraphics(new Graphics(624), object);
    			player.getInventory().deleteItem(item.getId(), 1);
    			player.getSkills().addXp(Skills.PRAYER, bone.getXP()*MULTIPLIER);
    			player.getPackets().sendGameMessage(MESSAGE);
    			player.getInventory().refresh();
    			return 3;
    	}
    
    	public void stop(final Player player) {
    		this.setActionDelay(player, 3);
    	}
    	
    }
    Then, in the com/rs/game/player/dialogues/ folder, create a class named PrayerD.java and add this in it.
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.WorldObject;
    import com.rs.game.player.content.BonesOnAltar;
    import com.rs.game.player.content.BonesOnAltar.Bones;
    import com.rs.game.player.content.SkillsDialogue;
    
    public class PrayerD extends Dialogue {
    
    		private Bones bones;
    		private WorldObject object;
    
    		@Override
    		public void start() {
    			this.bones = (Bones) parameters[0];
    			this.object = (WorldObject) parameters[1];
    
    			SkillsDialogue
    					.sendSkillsDialogue(
    							player,
    							SkillsDialogue.OFFER,
    							"How many would you like to offer?",
    							player.getInventory().getItems()
    									.getNumberOf(bones.getBone()),
    							new int[] { bones.getBone().getId() }, null);
    		}
    
    		@Override
    		public void run(int interfaceId, int componentId) {
    			player.getActionManager().setAction(
    					new BonesOnAltar(object, bones.getBone(), SkillsDialogue
    							.getQuantity(player)));
    		end();
    	}
    
    	@Override
    	public void finish() {
    
    	}
    
    }
    Now, open DialogueHandler.java which should be located at: com/rs/game/player/dialogues/ and declare this where all your declared dialogues are, preferably at the end of the already declared ones.
    Code:
    			handledDialogues.put("PrayerD", (Class<Dialogue>) Class.forName(PrayerD.class.getCanonicalName()));
    Now, open ObjectHandler.java which should located at: com/rs/net/decoders/handlers/ and declare this case for object 409(Prayer altar) in the HandleItemOnObject method.

    Code:
    				} else if(object.getId() == 409) {
    					Bones bone = BonesOnAltar.isGood(item);
    					if(bone != null) {
    						player.getDialogueManager().startDialogue("PrayerD", bone, object);
    						return;
    					} else {
    						player.getPackets().sendGameMessage("Nothing interesting happens.");
    						return;
    					}
    Also make sure you import these 2 in ObjectHandler.java
    Code:
    import com.rs.game.player.content.BonesOnAltar;
    import com.rs.game.player.content.BonesOnAltar.Bones;
    Now, open Burying.java which should be found at: com/rs/game/player/content/ and change the stuff in the enum with this one, to make it have same experience as bones on altar but without the xp multiplier.
    Code:
    		BONES(526, 5),
    		BIG_BONES(532, 15),
    		BABYDRAGON_BONES(534, 30),
    		WYVERN_BONES(6812, 50),
    		DRAGON_BONES(536, 72),
    		OURG_BONES(4834, 140),
    		FROST_DRAGON_BONES(18830, 180),
    		DAGANNOTH_BONES(6729, 125);
    If you use this, at least say thanks
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Sexy boi <3

    ByteValue's Avatar
    Join Date
    May 2012
    Age
    28
    Posts
    829
    Thanks given
    11
    Thanks received
    80
    Rep Power
    80
    This:

    Code:
    player.getPackets().sendGameMessage(""+MESSAGE+"");
    can be replaced by

    Code:
    player.getPackets().sendGameMessage(MESSAGE);
    But other than that, good job
    Reply With Quote  
     

  4. #3  
    Registered Member iMTiKo's Avatar
    Join Date
    Sep 2012
    Age
    29
    Posts
    79
    Thanks given
    13
    Thanks received
    12
    Rep Power
    12
    Oh, alright

    Thanks
    Reply With Quote  
     

  5. #4  
    Donator
    Carnival's Avatar
    Join Date
    May 2012
    Posts
    86
    Thanks given
    2
    Thanks received
    8
    Rep Power
    60
    Why don't any of you just make the list of bones into a int?
    Reply With Quote  
     

  6. #5  
    Registered Member iMTiKo's Avatar
    Join Date
    Sep 2012
    Age
    29
    Posts
    79
    Thanks given
    13
    Thanks received
    12
    Rep Power
    12
    Because this is an action system using delays, why would i want to make it into ints?
    Reply With Quote  
     

  7. #6  
    Donator
    Carnival's Avatar
    Join Date
    May 2012
    Posts
    86
    Thanks given
    2
    Thanks received
    8
    Rep Power
    60
    Makes the code look cleaner.
    Reply With Quote  
     

  8. #7  
    Registered Member iMTiKo's Avatar
    Join Date
    Sep 2012
    Age
    29
    Posts
    79
    Thanks given
    13
    Thanks received
    12
    Rep Power
    12
    Probably does, but won't handle all the same functions the one i made does
    Reply With Quote  
     

  9. #8  
    Registered Member blayke's Avatar
    Join Date
    Feb 2012
    Posts
    99
    Thanks given
    20
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by XRealms View Post
    Hello Community of Rune-Server,
    I was working on this for my server, so i decided to release it here as well

    Credits:
    80% - Me, for the coding.
    20% - Matrix, for the base i use.

    NOTE: This uses the RuneScape experience rate.
    Also has correct graphics on object, but no sound.

    In com/rs/game/player/content/ make a class named: BonesOnAltar.java and add this in it.
    Code:
    package com.rs.game.player.content;
    
    import java.util.HashMap;
    import java.util.Map;
    
    import com.rs.game.Animation;
    import com.rs.game.Graphics;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    import com.rs.game.player.actions.Action;
    import com.rs.game.player.actions.Cooking.Cookables;
    
    @SuppressWarnings("unused")
    public class BonesOnAltar extends Action {
    	
    	public final String MESSAGE = "The gods are very pleased with your offerings.";
    	public final double MULTIPLIER = 2.5;
    	
    	public enum Bones {
    		BONES(new Item(526, 1), 5),
    		BIG_BONES(new Item(532, 1), 15),
    		BABYDRAGON_BONES(new Item(534, 1), 30),
    		WYVERN_BONES(new Item(6812, 1), 50),
    		DRAGON_BONES(new Item(536, 1), 72),
    		OURG_BONES(new Item(4834, 1), 140),
    		FROST_DRAGON_BONES(new Item(18830, 1), 180),
    		DAGANNOTH_BONES(new Item(6729, 1), 125);
    	
    		private static Map<Short, Bones> bones = new HashMap<Short, Bones>();
    	
    		public static Bones forId(short itemId) {
    			return bones.get(itemId);
    		}
    	
    		static {
    			for (Bones bone: Bones.values()) {
    				bones.put((short) bone.getBone().getId(), bone);
    			}
    		}
    	
    		private Item item;
    		private int xp;
    	
    		private Bones(Item item, int xp) {
    			this.item = item;
    			this.xp = xp;
    		}
    		
    		public Item getBone() {
    			return item;
    		}
    		
    		public int getXP() {
    			return xp;
    		}
    	}
    		
    	private Bones bone;
    	private int amount;
    	private Item item;
    	private WorldObject object;
    	private Animation USING = new Animation(896);
    	
    	public BonesOnAltar(WorldObject object, Item item, int amount) {
    		this.amount = amount;
    		this.item = item;
    		this.object = object;
    	}
    	
    	public static Bones isGood(Item item) {
    		return Bones.forId((short) item.getId());
    	}
    	
    	public boolean start(Player player) {
    		if((this.bone = Bones.forId((short) item.getId())) == null) {
    			return false;
    		}
    		player.faceObject(object);
    		return true;
    	}
    	
    	public boolean process(Player player) {
    		if (!World.getRegion(object.getRegionId()).containsObject(
    						object.getId(), object))
    			return false;
    		if (!player.getInventory().containsItem(item.getId(), 1)) {
    			return false;
    		}
    		if (!player.getInventory().containsItem(bone.getBone().getId(), 1)) {
    			return false;
    		}
    		return true;
    	}
    	
    	public int processWithDelay(Player player) {
    			player.setNextAnimation(USING);
    			player.getPackets().sendGraphics(new Graphics(624), object);
    			player.getInventory().deleteItem(item.getId(), 1);
    			player.getSkills().addXp(Skills.PRAYER, bone.getXP()*MULTIPLIER);
    			player.getPackets().sendGameMessage(MESSAGE);
    			player.getInventory().refresh();
    			return 3;
    	}
    
    	public void stop(final Player player) {
    		this.setActionDelay(player, 3);
    	}
    	
    }
    Then, in the com/rs/game/player/dialogues/ folder, create a class named PrayerD.java and add this in it.
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.WorldObject;
    import com.rs.game.player.content.BonesOnAltar;
    import com.rs.game.player.content.BonesOnAltar.Bones;
    import com.rs.game.player.content.SkillsDialogue;
    
    public class PrayerD extends Dialogue {
    
    		private Bones bones;
    		private WorldObject object;
    
    		@Override
    		public void start() {
    			this.bones = (Bones) parameters[0];
    			this.object = (WorldObject) parameters[1];
    
    			SkillsDialogue
    					.sendSkillsDialogue(
    							player,
    							SkillsDialogue.OFFER,
    							"How many would you like to offer?",
    							player.getInventory().getItems()
    									.getNumberOf(bones.getBone()),
    							new int[] { bones.getBone().getId() }, null);
    		}
    
    		@Override
    		public void run(int interfaceId, int componentId) {
    			player.getActionManager().setAction(
    					new BonesOnAltar(object, bones.getBone(), SkillsDialogue
    							.getQuantity(player)));
    		end();
    	}
    
    	@Override
    	public void finish() {
    
    	}
    
    }
    Now, open DialogueHandler.java which should be located at: com/rs/game/player/dialogues/ and declare this where all your declared dialogues are, preferably at the end of the already declared ones.
    Code:
    			handledDialogues.put("PrayerD", (Class<Dialogue>) Class.forName(PrayerD.class.getCanonicalName()));
    Now, open ObjectHandler.java which should located at: com/rs/net/decoders/handlers/ and declare this case for object 409(Prayer altar) in the HandleItemOnObject method.

    Code:
    				} else if(object.getId() == 409) {
    					Bones bone = BonesOnAltar.isGood(item);
    					if(bone != null) {
    						player.getDialogueManager().startDialogue("PrayerD", bone, object);
    						return;
    					} else {
    						player.getPackets().sendGameMessage("Nothing interesting happens.");
    						return;
    					}
    Also make sure you import these 2 in ObjectHandler.java
    Code:
    import com.rs.game.player.content.BonesOnAltar;
    import com.rs.game.player.content.BonesOnAltar.Bones;
    Now, open Burying.java which should be found at: com/rs/game/player/content/ and change the stuff in the enum with this one, to make it have same experience as bones on altar but without the xp multiplier.
    Code:
    		BONES(526, 5),
    		BIG_BONES(532, 15),
    		BABYDRAGON_BONES(534, 30),
    		WYVERN_BONES(6812, 50),
    		DRAGON_BONES(536, 72),
    		OURG_BONES(4834, 140),
    		FROST_DRAGON_BONES(18830, 180),
    		DAGANNOTH_BONES(6729, 125);
    If you use this, at least say thanks
    very nice
    Reply With Quote  
     

  10. #9  
    Registered Member iMTiKo's Avatar
    Join Date
    Sep 2012
    Age
    29
    Posts
    79
    Thanks given
    13
    Thanks received
    12
    Rep Power
    12
    Thanks ;P
    Reply With Quote  
     

  11. #10  
    Registered Member Taylor Moon's Avatar
    Join Date
    Aug 2012
    Posts
    2,565
    Thanks given
    625
    Thanks received
    1,303
    Rep Power
    66
    Better than most of the community, good job.
    Reply With Quote  
     

Page 1 of 5 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. [pi] use X bones on altar
    By Raverz in forum Snippets
    Replies: 36
    Last Post: 12-25-2016, 12:15 AM
  2. [PI] All Bones and Bones On Altar
    By Dexter Morgan in forum Snippets
    Replies: 44
    Last Post: 04-20-2014, 05:43 AM
  3. 718/*** Bones on Altar (Works for 667)
    By Ynneh in forum Snippets
    Replies: 14
    Last Post: 11-14-2012, 12:23 PM
  4. pi bones on altar
    By Raverz in forum Help
    Replies: 15
    Last Post: 07-31-2012, 04:36 AM
  5. Using all bones on altar at once?
    By Unknown123123 in forum Help
    Replies: 4
    Last Post: 06-26-2012, 11:16 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
  •