PDA

View Full Version : 562 herb



Phat
June 24th, 2010, 01:57
com -> rs2hd ->content -> skills -> herblore -> herblore.java


package com.rs2hd.content.skills.herblore;

import com.rs2hd.model.Player;
/*
* Author Dragonkk np Finished by phat
*/
public class Herblore {
public static void hb(Player p, int usedWith, int itemUsed) {
int[] vial = { 227 };
int[] herbs = { 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269 };
int[] UnfPot = { 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 99, 2436, 2440, 2442 };
//int UnfXP[] = { 161, 2521, 143, 214, 265, 273, 116, 294, 285 };
// Herblore Unfpots
for (int i = 0; i < herbs.length; i++) {
if (itemUsed == vial[0] && usedWith == herbs[i] || usedWith == vial[0] && itemUsed == herbs[i]) {
//p.getSkills().addXp(15, UnfXP[i]);
p.animate(363);
p.getInventory().deleteItem(vial[0], 1);
p.getInventory().deleteItem( herbs[i], 1);
p.getInventory().addItem(UnfPot[i], 1);
}
}
// End Herblore Unfpots
// Herblore Pots
int[] item2 = { 221, 235, 225, 223, 231, 221, 231, 226, 239, 245, 247, 239, 261, 267, 2481 };
int[] FinPot = { 2428, 2446, 113, 2431, 2434, 2436, 2438, 2440, 2442, 2444, 2450, 2432, 14227, 14237, 14257 };
int[] FinLVL = { 1, 5, 12, 22, 38, 45, 50, 55, 66, 72, 78, 30, 88, 89, 90 };
int FinXP[] = { 150, 225, 350, 437, 612, 700, 787, 875, 1050, 1137, 1225, 525, 1540, 1610, 1680 };
for (int i = 0; i < item2.length; i++) {
if (itemUsed == UnfPot[i] && usedWith == item2[i] || usedWith == UnfPot[i] && itemUsed == item2[i]) {
if (p.getSkills().getLevel(15) >= FinLVL[i]) {
p.getSkills().addXp(15, FinXP[i]);
p.animate(363);
p.getInventory().deleteItem( item2[i], 1);
p.getInventory().deleteItem( UnfPot[i], 1);
p.getInventory().addItem( FinPot[i], 1);
}else{
p.sm("You dont have herblore level for make this potion.");
}

}
}
// End Herblore Pots
}

public static void CH(Player p, int itemId) {

int[] grimy = {199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 2485};
int[] clean = {249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 2481};
int cleanXP[] = { 17, 26, 42, 44, 52, 61, 70, 79, 87, 96, 105, 91 };
int cleanLVL[] = { 1, 5, 11, 20, 25, 40, 48, 54, 65, 70, 75, 67 };
for(int i = 0; i < grimy.length; i++) {
if (itemId == grimy[i]) {
if (p.getSkills().getLevel(15) >= cleanLVL[i]) {
p.getInventory().deleteItem(grimy[i], 1);
p.getSkills().addXp(15, cleanXP[i]);
p.getInventory().addItem(clean[i], 1);
p.sm("You cleaned the herb!");
}else{
p.sm("You dont have the herblore level to clean this herb.");
}
}
}
}
}

com -> rs2hd -> packethandler -> itempackethandler.java

Make sure you have the import


import com.rs2hd.content.skills.herblore.Herblore;

Find

private void itemOnItem
under it should be

try {
final int interfaceIndex = packet.readShort();
@SuppressWarnings("unused") final int junk1 = packet.readLEShortA() & 0xFFFF;
@SuppressWarnings("unused") final int junk2 = packet.readLEShort() & 0xFFFF;
@SuppressWarnings("unused") final int junk3 = packet.readLEShortA() & 0xFFFF;
final int itemUsed = packet.readLEShortA() & 0xFFFF;
@SuppressWarnings("unused") final int junk4 = packet.readLEShortA() & 0xFFFF;
@SuppressWarnings("unused") final int junk5 = packet.readLEShortA() & 0xFFFF;
final int usedWith = packet.readLEShort() & 0xFFFF;
if (interfaceIndex != 149) {
return;
}
And under that put


Herblore.hb(player, usedWith, itemUsed);

Now find

private void itemSelect
and in the cases make sure/add

case 199:
case 201:
case 203:
case 205:
case 207:
case 209:
case 211:
case 213:
case 215:
case 217:
case 219:
Herblore.CH(player,itemId);
break;



This is a herb system so that cleans the dirty herbs when clicked and then when added to a vial of water it turns into an unfinished potion then add the finishing item and it makes a potion.

Credits -
90%Dragonkk np - He wrote it
10%Me - i finished it and added extreme atk extreme def and extreme str

shockys
June 24th, 2010, 02:19
Good job with this.
i'll add this is right now

Phat
June 24th, 2010, 05:23
Thanks took a little time for doing what herbs and second items = what potion but it was not bad. Totally worth it since i had no herb before.

Derranged
June 24th, 2010, 11:21
Mine thinks the "if" in this is an unreachable statment if (player.potDelay == 0) {
can you fix this?

mythzscape562
June 28th, 2010, 14:06
help i get this 1 error:
Only the registered members can see the link.
my itempackethandler:
Only the registered members can see the link.

OR:
with the old itempackethandlet settings:
Only the registered members can see the link.
i get this error:
Only the registered members can see the link.

Plz help =P

finalpk
June 28th, 2010, 18:34
isn't this already in Caelums base

davidpaceway
May 3rd, 2011, 23:02
*sigh*

Huztler
May 4th, 2011, 16:06
Nice tutorial might gonna use this. by the way is this 100% herblor or nearby?

Huztler
May 4th, 2011, 16:08
help i get this 1 error:
Only the registered members can see the link.
my itempackethandler:
Only the registered members can see the link.


try delete that "try" sentence

David
May 4th, 2011, 16:15
should be

private void itemOnItem {