Thread: Effigies

Results 1 to 7 of 7
  1. #1 Effigies 
    Registered Member
    Join Date
    Oct 2014
    Posts
    91
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.player.Skills;
    import com.rs.game.player.content.AncientEffigies;
    import com.rs.utils.Utils;
    
    /**
     * Ancient effifies dialogue handling.
     * 
     * @author Raghav/Own4g3 <[email protected]>
     * 
     */
    public class AncientEffigiesD extends Dialogue {
    
    	int itemId;
    	int skill1; // this might needs to be saved
    	int skill2;
    
    	@Override
    	public void start() {
    		itemId = (Integer) parameters[0];
    		sendDialogue( new String[] {
    				"As you inspect the ancient effigy, you begin to feel a",
    				"strange sensation of the relic searching your mind,",
    				"drawing on your knowledge." });
    		int random = Utils.getRandom(7);
    		skill1 = AncientEffigies.SKILL_1[random];
    		skill2 = AncientEffigies.SKILL_2[random];
    	}
    
    	@Override
    	public void run(int interfaceId, int componentId) {
    		System.out.println("this is the componentId: " +componentId);
    		System.out.println("this is the stage: " +stage);
    		if (stage == -1) {
    			sendDialogue(
    					new String[] {
    							"Images from your experiences of "
    									+ AncientEffigies.getMessage(skill1),
    							"fill your mind." });
    			stage = 0;
    		} else if (stage == 0) {
    			player.getTemporaryAttributtes().put("skill1", skill1);
    			player.getTemporaryAttributtes().put("skill2", skill2);
    			sendOptionsDialogue("Which images do you wish to focus on?", Skills.SKILL_NAME[skill1], Skills.SKILL_NAME[skill2]);
    			stage = 1;
    		} else if (stage == 1 && componentId == 11) {
    			if (player.getSkills().getLevel(
    					(Integer) player.getTemporaryAttributtes().get("skill1")) < AncientEffigies
    					.getRequiredLevel(itemId)) {
    				sendDialogue(
    						
    						new String[] {
    								"The images in your mind fade; the ancient effigy seems",
    								"to desire knowledge of experiences you have not yet",
    								"had." });
    				player.getPackets()
    						.sendGameMessage(
    								"You require at lest level"
    										+ AncientEffigies
    												.getRequiredLevel(itemId)
    										+ Skills.SKILL_NAME[(Integer) player
    												.getTemporaryAttributtes().get(
    														"skill1")]
    										+ " to investigate the ancient effigy further.");
    			} else {
    				player.getTemporaryAttributtes().put("skill", skill1);
    				sendDialogue( new String[] {
    						"As you focus on your memories, you can almost hear a",
    						"voice in the back of your mind whispering to you..." });
    				stage = 2;
    			}
    		} else if (stage == 1 && componentId == 3) {
    			if (player.getSkills().getLevel(
    					(Integer) player.getTemporaryAttributtes().get("skill2")) < AncientEffigies
    					.getRequiredLevel(itemId)) {
    				sendDialogue(
    						
    						new String[] {
    								"The images in your mind fade; the ancient effigy seems",
    								"to desire knowledge of experiences you have not yet",
    								"had." });
    				player.getPackets()
    						.sendGameMessage(
    								"You require at lest level"
    										+ AncientEffigies
    												.getRequiredLevel(itemId)
    										+ " "
    										+ Skills.SKILL_NAME[(Integer) player
    												.getTemporaryAttributtes().get(
    														"skill1")]
    										+ " to investigate the ancient effigy further.");
    			} else {
    				player.getTemporaryAttributtes().put("skill", skill2);
    				sendDialogue( new String[] {
    						"As you focus on your memories, you can almost hear a",
    						"voice in the back of your mind whispering to you..." });
    				stage = 2;
    			}
    		} else if (stage == 2) {
    			// player.getSkills().addXp((Integer)
    			// player.getTemporaryAttributtes().get("skill"),
    			// AncientEffigies.getExp(itemId));
    			player.getPackets().sendGameMessage(
    					"You have a camel gained "
    							+ AncientEffigies.getExp(itemId)
    							+ " "
    							+ Skills.SKILL_NAME[(Integer) player
    									.getTemporaryAttributtes().get("skill")]
    							+ " experience!");
    			AncientEffigies.effigyInvestigation(player, itemId);
    			sendDialogue( new String[] {
    					"The ancient effigy glows briefly; it seems changed",
    					"somehow and no longer responds to the same memories",
    					"as before." });
    			stage = 3;
    		} else if (stage == 3) {
    			sendDialogue( new String[] {
    					"A sudden bolt of inspiration flashes through your mind,",
    					"revealing new insight into your experiences!" });
    			stage = -2;
    		} else {
    			end();
    		}
    	}
    
    	@Override
    	public void finish() {
    
    	}
    
    }
    Code:
    package com.rs.game.player.content;
    
    import com.rs.game.player.Inventory;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    
    /**
     * Handles ancient effigies non-dialogue related stuff.
     * 
     * @author Raghav/Own4g3 <[email protected]>
     * 
     */
    public class AncientEffigies {
    
    	/**
    	 * First skill to be nourished.
    	 */
    	public static int[] SKILL_1 = { Skills.AGILITY, Skills.CONSTRUCTION,
    			Skills.COOKING, Skills.FISHING, Skills.FLETCHING, Skills.HERBLORE,
    			Skills.MINING, Skills.SUMMONING };
    
    	/**
    	 * Second skill to be nourished.
    	 */
    	public static int[] SKILL_2 = { Skills.CRAFTING, Skills.THIEVING,
    			Skills.FIREMAKING, Skills.FARMING, Skills.WOODCUTTING,
    			Skills.HUNTER, Skills.SMITHING, Skills.RUNECRAFTING };
    
    	/**
    	 * Ancient effigies' item ids.
    	 */
    	public static final int STARVED_ANCIENT_EFFIGY = 18778,
    			NOURISHED_ANCIENT_EFFIGY = 18779, SATED_ANCIENT_EFFIGY = 18780,
    			GORGED_ANCIENT_EFFIGY = 18781, DRAGONKIN_LAMP = 18782;
    
    	/**
    	 * Getting the required level for each effigy.
    	 * 
    	 * @param id
    	 *            The effigy's item id.
    	 * @return Required level.
    	 */
    	public static int getRequiredLevel(int id) {
    		switch (id) {
    		case STARVED_ANCIENT_EFFIGY:
    			return 91;
    		case NOURISHED_ANCIENT_EFFIGY:
    			return 93;
    		case SATED_ANCIENT_EFFIGY:
    			return 95;
    		case GORGED_ANCIENT_EFFIGY:
    			return 97;
    		}
    		return -1;
    	}
    
    	/**
    	 * Getting the message.
    	 * 
    	 * @param skill
    	 *            The skill
    	 * @return message
    	 */
    	public static String getMessage(int skill) {
    		switch (skill) {
    		case Skills.AGILITY:
    			return "deftness and precision";
    		case Skills.CONSTRUCTION:
    			return "buildings and security";
    		case Skills.COOKING:
    			return "fire and preparation";
    		case Skills.FISHING:
    			return "life and cultivation";
    		case Skills.FLETCHING:
    			return "lumber and woodworking";
    		case Skills.HERBLORE:
    			return "flora and fuana";
    		case Skills.MINING:
    			return "metalwork and minerals";
    		case Skills.SUMMONING:
    			return "binding essence and spirits";
    		}
    		return null;
    	}
    
    	/**
    	 * Getting the experience amount.
    	 * 
    	 * @param itemId
    	 *            The effigy's item id.
    	 * @return The amount of experience.
    	 */
    	public static int getExp(int itemId) {
    		switch (itemId) {
    		case STARVED_ANCIENT_EFFIGY:
    			return 15000;
    		case NOURISHED_ANCIENT_EFFIGY:
    			return 20000;
    		case SATED_ANCIENT_EFFIGY:
    			return 25000;
    		case GORGED_ANCIENT_EFFIGY:
    			return 30000;
    		}
    		return -1;
    	}
    
    	/**
    	 * Investigation of an effigy.
    	 * 
    	 * @param player
    	 *            The player who is doing investigation.
    	 * @param id
    	 *            The effigy item id.
    	 */
    	public static void effigyInvestigation(Player player, int id) {
    		Inventory inv = player.getInventory();
    		inv.deleteItem(id, 1);
    		if (inv.containsOneItem(STARVED_ANCIENT_EFFIGY))
    			inv.addItem(NOURISHED_ANCIENT_EFFIGY, 1);
    		else if (inv.containsOneItem(NOURISHED_ANCIENT_EFFIGY))
    			inv.addItem(SATED_ANCIENT_EFFIGY, 1);
    		else if (inv.containsOneItem(SATED_ANCIENT_EFFIGY))
    			inv.addItem(GORGED_ANCIENT_EFFIGY, 1);
    		else if (inv.containsOneItem(GORGED_ANCIENT_EFFIGY))
    			inv.addItem(DRAGONKIN_LAMP, 1);
    	}
    }
    When activated the starved effigy is just being deleted and it's not adding the nourished ancient effigy any idea why?
    Reply With Quote  
     

  2. #2  
    Registered Member Sjonsen's Avatar
    Join Date
    May 2012
    Posts
    321
    Thanks given
    15
    Thanks received
    44
    Rep Power
    20
    Quote Originally Posted by Jon73 View Post
    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.player.Skills;
    import com.rs.game.player.content.AncientEffigies;
    import com.rs.utils.Utils;
    
    /**
     * Ancient effifies dialogue handling.
     * 
     * @author Raghav/Own4g3 <[email protected]>
     * 
     */
    public class AncientEffigiesD extends Dialogue {
    
    	int itemId;
    	int skill1; // this might needs to be saved
    	int skill2;
    
    	@Override
    	public void start() {
    		itemId = (Integer) parameters[0];
    		sendDialogue( new String[] {
    				"As you inspect the ancient effigy, you begin to feel a",
    				"strange sensation of the relic searching your mind,",
    				"drawing on your knowledge." });
    		int random = Utils.getRandom(7);
    		skill1 = AncientEffigies.SKILL_1[random];
    		skill2 = AncientEffigies.SKILL_2[random];
    	}
    
    	@Override
    	public void run(int interfaceId, int componentId) {
    		System.out.println("this is the componentId: " +componentId);
    		System.out.println("this is the stage: " +stage);
    		if (stage == -1) {
    			sendDialogue(
    					new String[] {
    							"Images from your experiences of "
    									+ AncientEffigies.getMessage(skill1),
    							"fill your mind." });
    			stage = 0;
    		} else if (stage == 0) {
    			player.getTemporaryAttributtes().put("skill1", skill1);
    			player.getTemporaryAttributtes().put("skill2", skill2);
    			sendOptionsDialogue("Which images do you wish to focus on?", Skills.SKILL_NAME[skill1], Skills.SKILL_NAME[skill2]);
    			stage = 1;
    		} else if (stage == 1 && componentId == 11) {
    			if (player.getSkills().getLevel(
    					(Integer) player.getTemporaryAttributtes().get("skill1")) < AncientEffigies
    					.getRequiredLevel(itemId)) {
    				sendDialogue(
    						
    						new String[] {
    								"The images in your mind fade; the ancient effigy seems",
    								"to desire knowledge of experiences you have not yet",
    								"had." });
    				player.getPackets()
    						.sendGameMessage(
    								"You require at lest level"
    										+ AncientEffigies
    												.getRequiredLevel(itemId)
    										+ Skills.SKILL_NAME[(Integer) player
    												.getTemporaryAttributtes().get(
    														"skill1")]
    										+ " to investigate the ancient effigy further.");
    			} else {
    				player.getTemporaryAttributtes().put("skill", skill1);
    				sendDialogue( new String[] {
    						"As you focus on your memories, you can almost hear a",
    						"voice in the back of your mind whispering to you..." });
    				stage = 2;
    			}
    		} else if (stage == 1 && componentId == 3) {
    			if (player.getSkills().getLevel(
    					(Integer) player.getTemporaryAttributtes().get("skill2")) < AncientEffigies
    					.getRequiredLevel(itemId)) {
    				sendDialogue(
    						
    						new String[] {
    								"The images in your mind fade; the ancient effigy seems",
    								"to desire knowledge of experiences you have not yet",
    								"had." });
    				player.getPackets()
    						.sendGameMessage(
    								"You require at lest level"
    										+ AncientEffigies
    												.getRequiredLevel(itemId)
    										+ " "
    										+ Skills.SKILL_NAME[(Integer) player
    												.getTemporaryAttributtes().get(
    														"skill1")]
    										+ " to investigate the ancient effigy further.");
    			} else {
    				player.getTemporaryAttributtes().put("skill", skill2);
    				sendDialogue( new String[] {
    						"As you focus on your memories, you can almost hear a",
    						"voice in the back of your mind whispering to you..." });
    				stage = 2;
    			}
    		} else if (stage == 2) {
    			// player.getSkills().addXp((Integer)
    			// player.getTemporaryAttributtes().get("skill"),
    			// AncientEffigies.getExp(itemId));
    			player.getPackets().sendGameMessage(
    					"You have a camel gained "
    							+ AncientEffigies.getExp(itemId)
    							+ " "
    							+ Skills.SKILL_NAME[(Integer) player
    									.getTemporaryAttributtes().get("skill")]
    							+ " experience!");
    			AncientEffigies.effigyInvestigation(player, itemId);
    			sendDialogue( new String[] {
    					"The ancient effigy glows briefly; it seems changed",
    					"somehow and no longer responds to the same memories",
    					"as before." });
    			stage = 3;
    		} else if (stage == 3) {
    			sendDialogue( new String[] {
    					"A sudden bolt of inspiration flashes through your mind,",
    					"revealing new insight into your experiences!" });
    			stage = -2;
    		} else {
    			end();
    		}
    	}
    
    	@Override
    	public void finish() {
    
    	}
    
    }
    Code:
    package com.rs.game.player.content;
    
    import com.rs.game.player.Inventory;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    
    /**
     * Handles ancient effigies non-dialogue related stuff.
     * 
     * @author Raghav/Own4g3 <[email protected]>
     * 
     */
    public class AncientEffigies {
    
    	/**
    	 * First skill to be nourished.
    	 */
    	public static int[] SKILL_1 = { Skills.AGILITY, Skills.CONSTRUCTION,
    			Skills.COOKING, Skills.FISHING, Skills.FLETCHING, Skills.HERBLORE,
    			Skills.MINING, Skills.SUMMONING };
    
    	/**
    	 * Second skill to be nourished.
    	 */
    	public static int[] SKILL_2 = { Skills.CRAFTING, Skills.THIEVING,
    			Skills.FIREMAKING, Skills.FARMING, Skills.WOODCUTTING,
    			Skills.HUNTER, Skills.SMITHING, Skills.RUNECRAFTING };
    
    	/**
    	 * Ancient effigies' item ids.
    	 */
    	public static final int STARVED_ANCIENT_EFFIGY = 18778,
    			NOURISHED_ANCIENT_EFFIGY = 18779, SATED_ANCIENT_EFFIGY = 18780,
    			GORGED_ANCIENT_EFFIGY = 18781, DRAGONKIN_LAMP = 18782;
    
    	/**
    	 * Getting the required level for each effigy.
    	 * 
    	 * @param id
    	 *            The effigy's item id.
    	 * @return Required level.
    	 */
    	public static int getRequiredLevel(int id) {
    		switch (id) {
    		case STARVED_ANCIENT_EFFIGY:
    			return 91;
    		case NOURISHED_ANCIENT_EFFIGY:
    			return 93;
    		case SATED_ANCIENT_EFFIGY:
    			return 95;
    		case GORGED_ANCIENT_EFFIGY:
    			return 97;
    		}
    		return -1;
    	}
    
    	/**
    	 * Getting the message.
    	 * 
    	 * @param skill
    	 *            The skill
    	 * @return message
    	 */
    	public static String getMessage(int skill) {
    		switch (skill) {
    		case Skills.AGILITY:
    			return "deftness and precision";
    		case Skills.CONSTRUCTION:
    			return "buildings and security";
    		case Skills.COOKING:
    			return "fire and preparation";
    		case Skills.FISHING:
    			return "life and cultivation";
    		case Skills.FLETCHING:
    			return "lumber and woodworking";
    		case Skills.HERBLORE:
    			return "flora and fuana";
    		case Skills.MINING:
    			return "metalwork and minerals";
    		case Skills.SUMMONING:
    			return "binding essence and spirits";
    		}
    		return null;
    	}
    
    	/**
    	 * Getting the experience amount.
    	 * 
    	 * @param itemId
    	 *            The effigy's item id.
    	 * @return The amount of experience.
    	 */
    	public static int getExp(int itemId) {
    		switch (itemId) {
    		case STARVED_ANCIENT_EFFIGY:
    			return 15000;
    		case NOURISHED_ANCIENT_EFFIGY:
    			return 20000;
    		case SATED_ANCIENT_EFFIGY:
    			return 25000;
    		case GORGED_ANCIENT_EFFIGY:
    			return 30000;
    		}
    		return -1;
    	}
    
    	/**
    	 * Investigation of an effigy.
    	 * 
    	 * @param player
    	 *            The player who is doing investigation.
    	 * @param id
    	 *            The effigy item id.
    	 */
    	public static void effigyInvestigation(Player player, int id) {
    		Inventory inv = player.getInventory();
    		inv.deleteItem(id, 1);
    		if (inv.containsOneItem(STARVED_ANCIENT_EFFIGY))
    			inv.addItem(NOURISHED_ANCIENT_EFFIGY, 1);
    		else if (inv.containsOneItem(NOURISHED_ANCIENT_EFFIGY))
    			inv.addItem(SATED_ANCIENT_EFFIGY, 1);
    		else if (inv.containsOneItem(SATED_ANCIENT_EFFIGY))
    			inv.addItem(GORGED_ANCIENT_EFFIGY, 1);
    		else if (inv.containsOneItem(GORGED_ANCIENT_EFFIGY))
    			inv.addItem(DRAGONKIN_LAMP, 1);
    	}
    }
    When activated the starved effigy is just being deleted and it's not adding the nourished ancient effigy any idea why?
    Code:
    package com.rs.game.player.content;
    
    import com.rs.game.player.Inventory;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    
    /**
     * Handles ancient effigies non-dialogue related stuff.
     * 
     * @author Raghav/Own4g3 <[email protected]>
     * 
     */
    public class AncientEffigies {
    
    	/**
    	 * First skill to be nourished.
    	 */
    	public static int[] SKILL_1 = { Skills.AGILITY, Skills.CONSTRUCTION,
    			Skills.COOKING, Skills.FISHING, Skills.FLETCHING, Skills.HERBLORE,
    			Skills.MINING, Skills.SUMMONING };
    
    	/**
    	 * Second skill to be nourished.
    	 */
    	public static int[] SKILL_2 = { Skills.CRAFTING, Skills.THIEVING,
    			Skills.FIREMAKING, Skills.FARMING, Skills.WOODCUTTING,
    			Skills.HUNTER, Skills.SMITHING, Skills.RUNECRAFTING };
    
    	/**
    	 * Ancient effigies' item ids.
    	 */
    	public static final int STARVED_ANCIENT_EFFIGY = 18778,
    			NOURISHED_ANCIENT_EFFIGY = 18779, SATED_ANCIENT_EFFIGY = 18780,
    			GORGED_ANCIENT_EFFIGY = 18781, DRAGONKIN_LAMP = 18782;
    
    	/**
    	 * Getting the required level for each effigy.
    	 * 
    	 * @param id
    	 *            The effigy's item id.
    	 * @return Required level.
    	 */
    	public static int getRequiredLevel(int id) {
    		switch (id) {
    		case STARVED_ANCIENT_EFFIGY:
    			return 91;
    		case NOURISHED_ANCIENT_EFFIGY:
    			return 93;
    		case SATED_ANCIENT_EFFIGY:
    			return 95;
    		case GORGED_ANCIENT_EFFIGY:
    			return 97;
    		}
    		return -1;
    	}
    
    	/**
    	 * Getting the message.
    	 * 
    	 * @param skill
    	 *            The skill
    	 * @return message
    	 */
    	public static String getMessage(int skill) {
    		switch (skill) {
    		case Skills.AGILITY:
    			return "deftness and precision";
    		case Skills.CONSTRUCTION:
    			return "buildings and security";
    		case Skills.COOKING:
    			return "fire and preparation";
    		case Skills.FISHING:
    			return "life and cultivation";
    		case Skills.FLETCHING:
    			return "lumber and woodworking";
    		case Skills.HERBLORE:
    			return "flora and fuana";
    		case Skills.MINING:
    			return "metalwork and minerals";
    		case Skills.SUMMONING:
    			return "binding essence and spirits";
    		}
    		return null;
    	}
    
    	/**
    	 * Getting the experience amount.
    	 * 
    	 * @param itemId
    	 *            The effigy's item id.
    	 * @return The amount of experience.
    	 */
    	public static int getExp(int itemId) {
    		switch (itemId) {
    		case STARVED_ANCIENT_EFFIGY:
    			return 15000;
    		case NOURISHED_ANCIENT_EFFIGY:
    			return 20000;
    		case SATED_ANCIENT_EFFIGY:
    			return 25000;
    		case GORGED_ANCIENT_EFFIGY:
    			return 30000;
    		}
    		return -1;
    	}
    
    	/**
    	 * Investigation of an effigy.
    	 * 
    	 * @param player
    	 *            The player who is doing investigation.
    	 * @param id
    	 *            The effigy item id.
    	 */
    	public static void effigyInvestigation(Player player, int id) {
    		Inventory inv = player.getInventory();
    		inv.deleteItem(id, 1);
    		if (inv.containsOneItem(STARVED_ANCIENT_EFFIGY))
    			inv.addItem(NOURISHED_ANCIENT_EFFIGY, 1);
                            return;
    		else if (inv.containsOneItem(NOURISHED_ANCIENT_EFFIGY))
    			inv.addItem(SATED_ANCIENT_EFFIGY, 1);
                            return;
    		else if (inv.containsOneItem(SATED_ANCIENT_EFFIGY))
    			inv.addItem(GORGED_ANCIENT_EFFIGY, 1);
                            return;
    		else if (inv.containsOneItem(GORGED_ANCIENT_EFFIGY))
    			inv.addItem(DRAGONKIN_LAMP, 1);
                            return;
    	}
    }
    Try that.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2014
    Posts
    91
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Sjonsen View Post
    Code:
    package com.rs.game.player.content;
    
    import com.rs.game.player.Inventory;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    
    /**
     * Handles ancient effigies non-dialogue related stuff.
     * 
     * @author Raghav/Own4g3 <[email protected]>
     * 
     */
    public class AncientEffigies {
    
    	/**
    	 * First skill to be nourished.
    	 */
    	public static int[] SKILL_1 = { Skills.AGILITY, Skills.CONSTRUCTION,
    			Skills.COOKING, Skills.FISHING, Skills.FLETCHING, Skills.HERBLORE,
    			Skills.MINING, Skills.SUMMONING };
    
    	/**
    	 * Second skill to be nourished.
    	 */
    	public static int[] SKILL_2 = { Skills.CRAFTING, Skills.THIEVING,
    			Skills.FIREMAKING, Skills.FARMING, Skills.WOODCUTTING,
    			Skills.HUNTER, Skills.SMITHING, Skills.RUNECRAFTING };
    
    	/**
    	 * Ancient effigies' item ids.
    	 */
    	public static final int STARVED_ANCIENT_EFFIGY = 18778,
    			NOURISHED_ANCIENT_EFFIGY = 18779, SATED_ANCIENT_EFFIGY = 18780,
    			GORGED_ANCIENT_EFFIGY = 18781, DRAGONKIN_LAMP = 18782;
    
    	/**
    	 * Getting the required level for each effigy.
    	 * 
    	 * @param id
    	 *            The effigy's item id.
    	 * @return Required level.
    	 */
    	public static int getRequiredLevel(int id) {
    		switch (id) {
    		case STARVED_ANCIENT_EFFIGY:
    			return 91;
    		case NOURISHED_ANCIENT_EFFIGY:
    			return 93;
    		case SATED_ANCIENT_EFFIGY:
    			return 95;
    		case GORGED_ANCIENT_EFFIGY:
    			return 97;
    		}
    		return -1;
    	}
    
    	/**
    	 * Getting the message.
    	 * 
    	 * @param skill
    	 *            The skill
    	 * @return message
    	 */
    	public static String getMessage(int skill) {
    		switch (skill) {
    		case Skills.AGILITY:
    			return "deftness and precision";
    		case Skills.CONSTRUCTION:
    			return "buildings and security";
    		case Skills.COOKING:
    			return "fire and preparation";
    		case Skills.FISHING:
    			return "life and cultivation";
    		case Skills.FLETCHING:
    			return "lumber and woodworking";
    		case Skills.HERBLORE:
    			return "flora and fuana";
    		case Skills.MINING:
    			return "metalwork and minerals";
    		case Skills.SUMMONING:
    			return "binding essence and spirits";
    		}
    		return null;
    	}
    
    	/**
    	 * Getting the experience amount.
    	 * 
    	 * @param itemId
    	 *            The effigy's item id.
    	 * @return The amount of experience.
    	 */
    	public static int getExp(int itemId) {
    		switch (itemId) {
    		case STARVED_ANCIENT_EFFIGY:
    			return 15000;
    		case NOURISHED_ANCIENT_EFFIGY:
    			return 20000;
    		case SATED_ANCIENT_EFFIGY:
    			return 25000;
    		case GORGED_ANCIENT_EFFIGY:
    			return 30000;
    		}
    		return -1;
    	}
    
    	/**
    	 * Investigation of an effigy.
    	 * 
    	 * @param player
    	 *            The player who is doing investigation.
    	 * @param id
    	 *            The effigy item id.
    	 */
    	public static void effigyInvestigation(Player player, int id) {
    		Inventory inv = player.getInventory();
    		inv.deleteItem(id, 1);
    		if (inv.containsOneItem(STARVED_ANCIENT_EFFIGY))
    			inv.addItem(NOURISHED_ANCIENT_EFFIGY, 1);
                            return;
    		else if (inv.containsOneItem(NOURISHED_ANCIENT_EFFIGY))
    			inv.addItem(SATED_ANCIENT_EFFIGY, 1);
                            return;
    		else if (inv.containsOneItem(SATED_ANCIENT_EFFIGY))
    			inv.addItem(GORGED_ANCIENT_EFFIGY, 1);
                            return;
    		else if (inv.containsOneItem(GORGED_ANCIENT_EFFIGY))
    			inv.addItem(DRAGONKIN_LAMP, 1);
                            return;
    	}
    }
    Try that.
    Still does just deletes the effigy and doesn't add the nourished one.
    Reply With Quote  
     

  4. #4  
    Registered Member Sjonsen's Avatar
    Join Date
    May 2012
    Posts
    321
    Thanks given
    15
    Thanks received
    44
    Rep Power
    20
    Quote Originally Posted by Jon73 View Post
    Still does just deletes the effigy and doesn't add the nourished one.
    I remember this happening to me too so I rewrote it, just take my method:

    Code:
    public static void effigyInvestigation(Player player, int id) {
    		Inventory inv = player.getInventory();
    		switch(id){
    		case STARVED_ANCIENT_EFFIGY:
    			inv.deleteItem(id, 1);
    			inv.addItem(NOURISHED_ANCIENT_EFFIGY, 1);
    			player.setNextAnimation(new Animation(14177));
    			player.setNextGraphics(new Graphics(2692));
    			break;
    		case NOURISHED_ANCIENT_EFFIGY:
    			inv.deleteItem(id, 1);
    			inv.addItem(SATED_ANCIENT_EFFIGY, 1);
    			player.setNextAnimation(new Animation(14177));
    			player.setNextGraphics(new Graphics(2692));
    			break;
    		case SATED_ANCIENT_EFFIGY:
    			inv.deleteItem(id, 1);
    			inv.addItem(GORGED_ANCIENT_EFFIGY, 1);
    			player.setNextAnimation(new Animation(14177));
    			player.setNextGraphics(new Graphics(2692));
    			break;
    		case GORGED_ANCIENT_EFFIGY:
    			inv.deleteItem(id, 1);
    			inv.addItem(DRAGONKIN_LAMP, 1);
    			player.setNextAnimation(new Animation(14177));
    			player.setNextGraphics(new Graphics(2692));
    			break;
    		default:
    			player.closeInterfaces();
    			break;
    		}
    	}
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Oct 2014
    Posts
    91
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Sjonsen View Post
    I remember this happening to me too so I rewrote it, just take my method:

    Code:
    public static void effigyInvestigation(Player player, int id) {
    		Inventory inv = player.getInventory();
    		switch(id){
    		case STARVED_ANCIENT_EFFIGY:
    			inv.deleteItem(id, 1);
    			inv.addItem(NOURISHED_ANCIENT_EFFIGY, 1);
    			player.setNextAnimation(new Animation(14177));
    			player.setNextGraphics(new Graphics(2692));
    			break;
    		case NOURISHED_ANCIENT_EFFIGY:
    			inv.deleteItem(id, 1);
    			inv.addItem(SATED_ANCIENT_EFFIGY, 1);
    			player.setNextAnimation(new Animation(14177));
    			player.setNextGraphics(new Graphics(2692));
    			break;
    		case SATED_ANCIENT_EFFIGY:
    			inv.deleteItem(id, 1);
    			inv.addItem(GORGED_ANCIENT_EFFIGY, 1);
    			player.setNextAnimation(new Animation(14177));
    			player.setNextGraphics(new Graphics(2692));
    			break;
    		case GORGED_ANCIENT_EFFIGY:
    			inv.deleteItem(id, 1);
    			inv.addItem(DRAGONKIN_LAMP, 1);
    			player.setNextAnimation(new Animation(14177));
    			player.setNextGraphics(new Graphics(2692));
    			break;
    		default:
    			player.closeInterfaces();
    			break;
    		}
    	}
    Thanks for this, not sure why the second option isn't work though, the first one works fine.

    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.game.player.Skills;
    import com.rs.game.player.content.AncientEffigies;
    import com.rs.utils.Utils;
    
    /**
     * Ancient effifies dialogue handling.
     * 
     * @author Raghav/Own4g3 <[email protected]>
     * 
     */
    public class AncientEffigiesD extends Dialogue {
    
    	int itemId;
    	int skill1; // this might needs to be saved
    	int skill2;
    
    	@Override
    	public void start() {
    		itemId = (Integer) parameters[0];
    		sendDialogue( new String[] {
    				"As you inspect the ancient effigy, you begin to feel a",
    				"strange sensation of the relic searching your mind,",
    				"drawing on your knowledge." });
    		int random = Utils.getRandom(7);
    		skill1 = AncientEffigies.SKILL_1[random];
    		skill2 = AncientEffigies.SKILL_2[random];
    	}
    
    	@Override
    	public void run(int interfaceId, int componentId) {
    		System.out.println("this is the componentId: " +componentId);
    		System.out.println("this is the stage: " +stage);
    		if (stage == -1) {
    			sendDialogue(
    					new String[] {
    							"Images from your experiences of "
    									+ AncientEffigies.getMessage(skill1),
    							"fill your mind." });
    			stage = 0;
    		} else if (stage == 0) {
    			player.getTemporaryAttributtes().put("skill1", skill1);
    			player.getTemporaryAttributtes().put("skill2", skill2);
    			sendOptionsDialogue("Which images do you wish to focus on?", Skills.SKILL_NAME[skill1], Skills.SKILL_NAME[skill2]);
    			stage = 1;
    		} else if (stage == 1 && componentId == 11) {
    			if (player.getSkills().getLevel(
    					(Integer) player.getTemporaryAttributtes().get("skill1")) < AncientEffigies
    					.getRequiredLevel(itemId)) {
    				sendDialogue(
    						
    						new String[] {
    								"The images in your mind fade; the ancient effigy seems",
    								"to desire knowledge of experiences you have not yet",
    								"had." });
    				player.getPackets()
    						.sendGameMessage(
    								"You require at lest level"
    										+ AncientEffigies
    												.getRequiredLevel(itemId)
    										+ Skills.SKILL_NAME[(Integer) player
    												.getTemporaryAttributtes().get(
    														"skill1")]
    										+ " to investigate the ancient effigy further.");
    			} else {
    				player.getTemporaryAttributtes().put("skill", skill1);
    				sendDialogue( new String[] {
    						"As you focus on your memories, you can almost hear a",
    						"voice in the back of your mind whispering to you..." });
    				stage = 2;
    			}
    			
    		} if (stage == 1 && componentId == 13) {
    			if (player.getSkills().getLevel(
    					(Integer) player.getTemporaryAttributtes().get("skill2")) < AncientEffigies
    					.getRequiredLevel(itemId)) {
    				sendDialogue(
    						
    						new String[] {
    								"The images in your mind fade; the ancient effigy seems",
    								"to desire knowledge of experiences you have not yet",
    								"had." });
    				player.getPackets()
    						.sendGameMessage(
    								"You require at lest level"
    										+ AncientEffigies
    												.getRequiredLevel(itemId)
    										+ " "
    										+ Skills.SKILL_NAME[(Integer) player
    												.getTemporaryAttributtes().get(
    														"skill1")]
    										+ " to investigate the ancient effigy further.");
    			} else {
    				player.getTemporaryAttributtes().put("skill", skill2);
    				sendDialogue( new String[] {
    						"As you focus on your memories, you can almost hear a",
    						"voice in the back of your mind whispering to you..." });
    				stage = 2;
    			}
    		} else if (stage == 2) {
    			// player.getSkills().addXp((Integer)
    			// player.getTemporaryAttributtes().get("skill"),
    			// AncientEffigies.getExp(itemId));
    			player.getPackets().sendGameMessage(
    					"You have gained "
    							+ AncientEffigies.getExp(itemId)
    							+ " "
    							+ Skills.SKILL_NAME[(Integer) player
    									.getTemporaryAttributtes().get("skill")]
    							+ " experience!");
    			AncientEffigies.effigyInvestigation(player, itemId);
    			sendDialogue( new String[] {
    					"The ancient effigy glows briefly; it seems changed",
    					"somehow and no longer responds to the same memories",
    					"as before." });
    			stage = 3;
    		} else if (stage == 3) {
    			sendDialogue( new String[] {
    					"A sudden bolt of inspiration flashes through your mind,",
    					"revealing new insight into your experiences!" });
    			stage = -2;
    		} else {
    			end();
    		}
    	}
    
    	@Override
    	public void finish() {
    
    	}
    
    }
    Reply With Quote  
     

  6. #6  
    Registered Member Sjonsen's Avatar
    Join Date
    May 2012
    Posts
    321
    Thanks given
    15
    Thanks received
    44
    Rep Power
    20
    Not going to spoonfeed you everything, you're posting so many threads '-'
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Oct 2014
    Posts
    91
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Sjonsen View Post
    Not going to spoonfeed you everything, you're posting so many threads '-'
    i've made it do this
    Code:
    System.out.println("this is the componentId: " +componentId);
    		System.out.println("this is the stage: " +stage);
    it printed out that the component id is 13 and the stage is 1

    but when i do this
    Code:
    if (stage == 1 && componentId == 13) {
    			if (player.getSkills().getLevel(
    					(Integer) player.getTemporaryAttributtes().get("skill2")) < AncientEffigies
    					.getRequiredLevel(itemId)) {
    				sendDialogue(
    						
    						new String[] {
    								"The images in your mind fade; the ancient effigy seems",
    								"to desire knowledge of experiences you have not yet",
    								"had." });
    				player.getPackets()
    						.sendGameMessage(
    								"You require at lest level"
    										+ AncientEffigies
    												.getRequiredLevel(itemId)
    										+ " "
    										+ Skills.SKILL_NAME[(Integer) player
    												.getTemporaryAttributtes().get(
    														"skill1")]
    										+ " to investigate the ancient effigy further.");
    			} else {
    				player.getTemporaryAttributtes().put("skill", skill2);
    				sendDialogue( new String[] {
    						"As you focus on your memories, you can almost hear a",
    						"voice in the back of your mind whispering to you..." });
    				stage = 2;
    			}
    		} else if (stage == 2) {
    			// player.getSkills().addXp((Integer)
    			// player.getTemporaryAttributtes().get("skill"),
    			// AncientEffigies.getExp(itemId));
    			player.getPackets().sendGameMessage(
    					"You have gained "
    							+ AncientEffigies.getExp(itemId)
    							+ " "
    							+ Skills.SKILL_NAME[(Integer) player
    									.getTemporaryAttributtes().get("skill")]
    							+ " experience!");
    			AncientEffigies.effigyInvestigation(player, itemId);
    			sendDialogue( new String[] {
    					"The ancient effigy glows briefly; it seems changed",
    					"somehow and no longer responds to the same memories",
    					"as before." });
    			stage = 3;
    		}
    it doesn't do anything
    Reply With Quote  
     


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. Ancient Effigy Animation
    By .alycia in forum Help
    Replies: 4
    Last Post: 10-10-2013, 11:25 PM
  2. [REQ]Ancient effigies Emotes, gfx..
    By Own4g3 in forum Requests
    Replies: 4
    Last Post: 02-22-2012, 05:49 PM
  3. Ancient Effigies..
    By Shakedy in forum Show-off
    Replies: 14
    Last Post: 12-17-2011, 11:20 AM
  4. #Rune-Force - Ancient Effigies
    By .alycia in forum Show-off
    Replies: 33
    Last Post: 12-07-2011, 01:53 PM
  5. Ancient effigies
    By Jason in forum Models
    Replies: 8
    Last Post: 11-06-2010, 11:32 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
  •