Purpose: To make a working genie lamp item and random event that will give you the genie lamp item.
Difficulty: 1/10
Assumed Knowledge: Finding, copying and pasting
Server Base: CheezScape, but should work on all
Credits: 100% me
All of the code that needs to be modified is in client.java
Step 1: Making the random event
Find:
Code:
public boolean process(){
Underneath it add:
Code:
int rand = (int)(10000 * Math.random()) + 1;
if(rand == 5000){
sendMessage("A weird man hands you a lamp.");
sendMessage("'Take this lamp and use it well' he says.");
sendMessage("The weird man disappears.");
addItem(2528,1);
}
Step 2: Adding the item
Find your item use 2 code, it might be near:
Code:
public boolean CheckForSkillUse2(int ItemID, int ItemSlot) {
or:
which should be under:
Code:
switch(packetType){
Before:
Add:
Code:
case 2528: //Genie lamp
sendMessage("You rub the lamp. A genie flies out of it.");
sendMessage("'Good evening. How may I help you?' he says.");
showInterface(2808);
break;
Step 3: Adding the interface action button
Underneath:
Code:
public class client extends Player implements Runnable {
Add:
Code:
private int genieSelect = 0;
Find:
Code:
case 185: //clicking most buttons
Underneath:
Code:
switch(actionButtonId) {
Add:
Code:
case 10252:
genieSelect = 0;
sendMessage("You select Attack");
break;
case 10253:
genieSelect = 2;
sendMessage("You select Strength");
break;
case 10254:
genieSelect = 4;
sendMessage("You select Ranged");
break;
case 10255:
genieSelect = 6;
sendMessage("You select Magic");
break;
case 11000:
genieSelect = 1;
sendMessage("You select Defence");
break;
case 11001:
genieSelect = 3;
sendMessage("You select Hitpoints");
break;
case 11002:
genieSelect = 5;
sendMessage("You select Prayer");
break;
case 11003:
genieSelect = 16;
sendMessage("You select Agility");
break;
case 11004:
genieSelect = 15;
sendMessage("You select Herblore");
break;
case 11005:
genieSelect = 17;
sendMessage("You select Thieving");
break;
case 11006:
genieSelect = 12;
sendMessage("You select Crafting");
break;
case 11007:
genieSelect = 20;
sendMessage("You select Runecrafting");
break;
case 47002:
genieSelect = 18;
sendMessage("You select Slayer");
break;
case 54090:
genieSelect = 19;
sendMessage("You select Farming");
break;
case 11008:
genieSelect = 14;
sendMessage("You select Mining");
break;
case 11009:
genieSelect = 13;
sendMessage("You select Smithing");
break;
case 11010:
genieSelect = 10;
sendMessage("You select Fishing");
break;
case 11011:
genieSelect = 7;
sendMessage("You select Cooking");
break;
case 11012:
genieSelect = 11;
sendMessage("You select Firemaking");
break;
case 11013:
genieSelect = 8;
sendMessage("You select Woodcutting");
break;
case 11014:
genieSelect = 9;
sendMessage("You select Fletching");
break;
case 11015:
if(playerHasItemAmount(2528,1) == true){
addSkillXP((int)(Math.random()*1500)+1500,genieSelect);
deleteItem(2528, getItemSlot(2528), 1);
sendMessage("The genie flies back inside the lamp.");
sendMessage("The lamp mysteriously vanishes");
RemoveAllWindows();
}
break;
Customization:
To edit the XP gained changed this line: addSkillXP((int)(Math.random()*1500)+1500,genieSel ect);
To edit the chance of getting a lamp, change this line: int rand = (int)(10000 * Math.random()) + 1;
If you have any bugs or problems, please post here and I will do my best to help. The code has been tested and should work on most, if not, all private servers.