Jump to content
pkedu

[667] How to make xp lamps work!

Recommended Posts

Hello fellow runelocus community, i wil be showing you how to make xp lamps work, because before i clicked on an xp lamp and it done nothing and it did not even dissapear. So lets begin shall we?


Go to your source folder then go to src\com\rs\net\decoders\handlers
Then click InventoryOptionsHandler now put this code anywhere


[CODE]if (itemId == 23740) {// huge prayer lamp
player.getSkills().addXp(5, 14000000);
player.getInventory().deleteItem(23740, 1);
return;
}[/CODE]
for what ever id you want replace 23740 with your item id and where it says player.getSkills().addXp(5, 14000000); the 5 is the level id and 14000000 is the amount of xp that will be gained after clicking the xp lamp. here are the skill id's

[CODE]ATTACK = 0
DEFENCE = 1
STRENGTH = 2
HITPOINTS = 3
RANGE = 4
PRAYER = 5
MAGIC = 6
COOKING = 7
WOODCUTTING = 8
FLETCHING = 9
FISHING = 10
FIREMAKING = 11
CRAFTING = 12
SMITHING = 13
MINING = 14
HERBLORE = 15
AGILITY = 16
THIEVING = 17
SLAYER = 18
FARMING = 19
RUNECRAFTING = 20
HUNTER = 21
CONSTRUCTION = 22
SUMMONING = 23
DUNGEONEERING = 24[/CODE]

once your done just save compile and there you go :D have fun coding and merry christmas!

p.s. you can rep or thank if you want! i dont really care about that jazz anyways! :) Edited by pkedu

Share this post


Link to post
Share on other sites
Add an interface so a player can choice which skill?

Share this post


Link to post
Share on other sites
No no no no.


[code]package com.enso.game.player.content.handlers;

import com.enso.game.player.Player;

/**
*
* [MENTION=52317]auth[/MENTION]or Fuzen Seth
*/
public class XPLamp {

public static int LAMP_INTER = 1139, LAMP = 2528;

public static boolean sendLamp(Player player) {
if(!player.getInventory().containsItem(LAMP, 1)) {
return false;
}
player.getInterfaceManager().sendInterface(LAMP_INTER);
return true;
}

public static boolean handleButtons(Player player, int buttonId) {
if(buttonId - 30 < 0 || buttonId - 30 > 24) {
return false;
}
int skillPicked = buttonId - 30;
player.getTemporaryAttributtes().put("xpLampSkill", new Integer(skillPicked));
return true;
}

public static void appendExperience(Player player) {
if(player.getTemporaryAttributtes().get("xpLampSkill") == null || !(player.getTemporaryAttributtes().get("xpLampSkill") instanceof Integer)) {
return;
}
player.getInventory().deleteItem(LAMP, 1);
player.getInventory().refresh();
final double experience = calculateXp(player, (Integer) player.getTemporaryAttributtes().get("xpLampSkill"));
player.getSkills().addXp((Integer) player.getTemporaryAttributtes().get("xpLampSkill"), experience);
player.closeInterfaces();
player.getDialogueManager().startDialogue("SimpleMessage", "Your wish has been granted.");
}

public static double calculateXp(Player player, int skillId) {
int x = player.getSkills().getLevel(skillId);
double il = 663.796486 + 14.4355241 * Math.pow(x + 5.8695973 * x, 2);
double negativeType = Math.pow(0.119998437 * x, 3)
+ Math.pow(0.00142607098 * x, 4);
double xp = il - negativeType + (3 * 9);
return xp;
}

}
[/code]

Share this post


Link to post
Share on other sites
not evryones folders r the same so maybe just ell them w hat to search in search bar

Share this post


Link to post
Share on other sites
[quote name='Fuzen Seth']No no no no.


[code]package com.enso.game.player.content.handlers;

import com.enso.game.player.Player;

/**
*
* [MENTION=52317]auth[/MENTION]or Fuzen Seth
*/
public class XPLamp {

public static int LAMP_INTER = 1139, LAMP = 2528;

public static boolean sendLamp(Player player) {
if(!player.getInventory().containsItem(LAMP, 1)) {
return false;
}
player.getInterfaceManager().sendInterface(LAMP_INTER);
return true;
}

public static boolean handleButtons(Player player, int buttonId) {
if(buttonId - 30 < 0 || buttonId - 30 > 24) {
return false;
}
int skillPicked = buttonId - 30;
player.getTemporaryAttributtes().put("xpLampSkill", new Integer(skillPicked));
return true;
}

public static void appendExperience(Player player) {
if(player.getTemporaryAttributtes().get("xpLampSkill") == null || !(player.getTemporaryAttributtes().get("xpLampSkill") instanceof Integer)) {
return;
}
player.getInventory().deleteItem(LAMP, 1);
player.getInventory().refresh();
final double experience = calculateXp(player, (Integer) player.getTemporaryAttributtes().get("xpLampSkill"));
player.getSkills().addXp((Integer) player.getTemporaryAttributtes().get("xpLampSkill"), experience);
player.closeInterfaces();
player.getDialogueManager().startDialogue("SimpleMessage", "Your wish has been granted.");
}

public static double calculateXp(Player player, int skillId) {
int x = player.getSkills().getLevel(skillId);
double il = 663.796486 + 14.4355241 * Math.pow(x + 5.8695973 * x, 2);
double negativeType = Math.pow(0.119998437 * x, 3)
+ Math.pow(0.00142607098 * x, 4);
double xp = il - negativeType + (3 * 9);
return xp;
}

}
[/code][/QUOTE]
Theres no way to start this code when the player clicks on the lamp...

Share this post


Link to post
Share on other sites

×