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?