Code:
package org.hyperion.rs2.content;
import org.hyperion.rs2.model.Player;
import org.hyperion.rs2.net.PacketBuilder;
import org.hyperion.rs2.net.Packet.Type;
/**
* Skill guides class. handles the ingame skill guides.
* @author Fire cape
*/
public class SkillGuides {
/**
* Sends the skill interface.
* @param player calls the player class.
* @param id skill interface id.
*/
public static void sendSkillInterface(Player player, int id[]) {
PacketBuilder bldr = new PacketBuilder(53, Type.VARIABLE_SHORT);
bldr.putShort(8847);
bldr.putShort(id.length);
for (int i = 0; i < id.length; i++) {
bldr.put((byte) 1);
if(id[i] > 0) {
bldr.putLEShortA(id[i]+1);
} else {
bldr.putLEShortA(0);
}
}
player.write(bldr.toPacket());
}
private static int item[] = new int[31];
public static void skillsInterface(Player player, String skill,
int item1ItemId, int item1lvl, String item1lvldef,
int item2ItemId, int item2lvl, String item2lvldef,
int item3ItemId, int item3lvl, String item3lvldef,
int item4ItemId, int item4lvl, String item4lvldef,
int item5ItemId, int item5lvl, String item5lvldef,
int item6ItemId, int item6lvl, String item6lvldef,
int item7ItemId, int item7lvl, String item7lvldef,
int item8ItemId, int item8lvl, String item8lvldef) {
player.getActionSender().sendString(8716, "@[email protected]"+skill);
for(int i = 0;i<31;i++) {
item[i] = 0;
}
item[0] = item1ItemId;
item[1] = item2ItemId;
item[2] = item3ItemId;
item[3] = item4ItemId;
item[4] = item5ItemId;
item[5] = item6ItemId;
item[6] = item7ItemId;
item[7] = item8ItemId;
if(item1lvl > 0)
player.getActionSender().sendString(8720,""+item1lvl);
player.getActionSender().sendString(8760,""+item1lvldef);
if(item2lvl > 0)
player.getActionSender().sendString(8721,""+item2lvl);
player.getActionSender().sendString(8761, ""+item2lvldef);
if(item3lvl > 0)
player.getActionSender().sendString(8722,""+item3lvl);
player.getActionSender().sendString(8762,""+item3lvldef);
if(item4lvl > 0)
player.getActionSender().sendString(8723,""+item4lvl);
player.getActionSender().sendString(8763, ""+item4lvldef);
if(item5lvl > 0)
player.getActionSender().sendString(8724,""+item5lvl);
player.getActionSender().sendString(8764, ""+item5lvldef);
if(item6lvl > 0)
player.getActionSender().sendString(8725,""+item6lvl);
player.getActionSender().sendString(8765,""+item6lvldef);
if(item7lvl > 0)
player.getActionSender().sendString(8726,""+item7lvl);
player.getActionSender().sendString(8766, ""+item7lvldef);
if(item8lvl > 0)
player.getActionSender().sendString(8727,""+item8lvl);
player.getActionSender().sendString(8767, ""+item8lvldef);
player.getActionSender().sendString(8849,"");
player.getActionSender().sendString(8846,"Attack");
player.getActionSender().sendString(8823,"Strength");
player.getActionSender().sendString(8824,"Defence");
player.getActionSender().sendString(8827,"Hitpoints");
player.getActionSender().sendString(8837,"Ranged");
player.getActionSender().sendString(8840,"Magic");
player.getActionSender().sendString(8843,"Prayer");
player.getActionSender().sendString(8859,"RuneCraf");
player.getActionSender().sendString(8862,"Agility");
player.getActionSender().sendString(8865,"Herblore");
player.getActionSender().sendString(15303,"Thieving");
player.getActionSender().sendString(15306,"Crafting");
player.getActionSender().sendString(15309,"Slayer");
sendSkillInterface(player, item);
player.getActionSender().showInterface(8714);
}
public static void atkInterface(Player player) {
skillsInterface(player, "Attack",
1291, 1, "Bronze",
1293, 1, "Iron",
1295, 5, "Steel",
1297, 10, "Black",
1299, 20, "Mithril",
1301, 30, "Adamant",
1303, 40, "Rune",
1305, 60, "Dragon");
}
public static void strInterface(Player player) {
skillsInterface(player, "Strength",
3196, 5, "Black halberd",
3198, 10, "Mithril halberd",
3200, 15, "Adamant halberd",
3202, 20, "Rune halberd",
3204, 30, "Dragon halberd",
4153, 50, "Granite maul",
6528, 60, "Tzhaar-Ket-Om",
4718, 70, "Dharok's greataxe");
}
public static void defInterface(Player player) {
skillsInterface(player, "Defence",
1139, 1, "Bronze",
1137, 1, "Iron",
1141, 5, "Steel",
1151, 10, "Black",
1143, 20, "Mithril",
1145, 30, "Adamant",
1147, 40, "Rune",
1149, 60, "Dragon");
}
public static void rangeInterface(Player player) {
skillsInterface(player, "Ranged",
1129, 1, "Plain Leather",
1131, 1, "Hard leather",
1133, 20, "Studded leather",
1135, 40, "Green d'hide leather",
2499, 50, "Blue d'hide leather",
2501, 60, "Red d'hide leather",
2503, 70, "Black d'hide leather",
4736, 70, "Karils");
}
public static void prayInterface(Player player) {
skillsInterface(player, "Prayer",
526, 1, "Bones",
532, 1, "Big bones",
534, 1, "Baby dragon bones",
536, 1, "Dragon bones",
6729, 1, "Dagannoth bones",
4812, 1, "Zogre bones",
4830, 1, "Fayrg bones",
4832, 1, "Raurg bones");
}
public static void hpInterface(Player player) {
skillsInterface(player, "Hitpoints",
0, 0, "",
0, 0, "",
0, 0, "",
0, 0, "",
0, 0, "",
0, 0, "",
0, 0, "",
0, 0, "");
}
public static void mageInterface(Player player) {
skillsInterface(player, "Magic",
579, 1, "Wizard",
4089, 40, "Mystic",
7400, 40, "Enchant",
3385, 40, "Splitbark",
6918, 50, "Infinity",
2412, 60, "God capes and staffs",
6914, 70, "Mage's book and Master Wand",
4708, 70, "Ahrims");
}
public static void rcInterface(Player player) {
skillsInterface(player, "Runecrafting",
6422, 1, "Air runes",
6436, 2, "Mind runes",
6438, 20, "Body runes",
6430, 35, "Chaos runes",
561, 44, "Nature runes",
6434, 54, "Law runes",
6432, 65, "Death runes",
565, 77, "Blood runes");
}
public static void agilityInterface(Player player) {
skillsInterface(player, "Agility",
2150, 1, "Gnome stronghold agility course",
2996, 1, "Low-level agility arena",
2996, 20, "Medium-level agility arena",
2996, 40, "High-level agility arena",
1365, 35, "Barberian outpost agility course",
4024, 48, "Ape attol agility course",
964, 52, "Wilderness agility course",
4170, 60, "Werewolf agility course");
}
public static void herbloreInterface(Player player) {
skillsInterface(player, "Agility",
221, 3, "Attack Potion",
235, 5, "Anti-poison Potion",
225, 12, "Strength Potion",
223, 22, "Restore Potion",
1975, 22, "Energy Potion",
239, 30, "Defence Potion",
1526, 38, "Prayer Potion",
221, 45, "Super Attack Potion");
}
public static void thievingInterface(Player player) {
skillsInterface(player, "Thieving",
3241, 1, "Man",
3243, 10, "Farmer",
3245, 25, "Warrior",
3249, 40, "Guard",
3251, 53, "Knights of ardogne",
3255, 70, "Paladin",
3257, 75, "Gnome",
3259, 80, "Hero");
}
public static void craftingInterface(Player player) {
skillsInterface(player, "Crafting",
1059, 1, "Leather",
1777, 10, "Flax into bow string",
1097, 20, "Hard leather",
1065, 57, "Green dragonhide leather",
2487, 66, "Blue dragonhide leather",
2489, 73, "Red dragonhide leather",
2491, 79, "Black dragonhide leather",
6585, 90, "Onyx amulet");
}
public static void slayerInterface(Player player) {
skillsInterface(player, "Slayer",
4133, 1, "Crawling hand",
4134, 10, "Cave crawler",
4140, 45, "Infernal Mage",
4144, 60, "Aberrant Spectre",
4145, 65, "Dust devil",
4147, 75, "Gargoyle",
4148, 80, "Nechryael",
4149, 85, "Abyssal demon");
}
public static void fletchingInterface(Player player) {
skillsInterface(player, "Fletching",
50, 5, "Normal bows",
54, 20, "Oak bows",
60, 35, "Willow bows",
64, 50, "Maple bows",
68, 65, "Yew bows",
892, 75, "Rune arrow",
72, 80, "Magic shortbow",
70, 85, "Magic longbow");
}
public static void miningInterface(Player player) {
skillsInterface(player, "Mining",
436, 1, "Tin & Cooper",
440, 15, "Iron",
442, 30, "Silver",
453, 30, "Coal",
444, 40, "Gold",
447, 55, "Mithril",
449, 70, "Adamant",
451, 85, "Rune");
}
public static void smithingInterface(Player player) {
skillsInterface(player, "Smithing",
2349, 1, "Bronze",
2351, 15, "Iron",
2355, 20, "Silver",
2353, 30, "Steel",
2357, 40, "Gold",
2359, 50, "Mithril",
2361, 70, "Adamant",
2363, 85, "Rune");
}
public static void fishingInterface(Player player) {
skillsInterface(player, "Fishing",
317, 1, "Shrimps",
335, 20, "Trouts",
359, 35, "Tunas",
377, 40, "Lobsters",
371, 50, "Swordfishes",
383, 76, "Sharks",
395, 79, "Sea Turtles",
389, 81, "Manta rays");
}
public static void cookingInterface(Player player) {
skillsInterface(player, "Cooking",
315, 1, "Shrimps",
333, 20, "Trouts",
361, 30, "Tunas",
379, 40, "Lobsters",
373, 50, "Swordfishes",
385, 76, "Sharks",
397, 79, "Sea Turtles",
391, 81, "Manta rays");
}
public static void woodcuttingInterface(Player player) {
skillsInterface(player, "Woodcutting",
1511, 1, "Normal tree",
1521, 15, "Oak tree",
1519, 30, "Willow tree",
6333, 35, "Teak tree",
1517, 45, "Maple tree",
6332, 50, "Mahogany tree",
1515, 60, "Yews tree",
1513, 75, "Magic tree");
}
public static void firemakingInterface(Player player) {
skillsInterface(player, "Firemaking",
1511, 1, "Tree logs",
1521, 15, "Oak logs",
1519, 30, "Willow logs",
6333, 35, "Teak logs",
1517, 45, "Maple logs",
4544, 49, "Bullseye lantern",
6332, 50, "Mahogany logs",
1515, 60, "Yew logs");
}
public static void farmingInterface(Player player) {
skillsInterface(player, "Farming",
5291, 1, "Guam seed",
5292, 15, "Marrentill seed",
5293, 20, "Tarromin seed",
5295, 30, "Ranarr seed",
5298, 40, "Avanote seed",
5300, 60, "Snapdragon seed",
5302, 72, "Lantadyme seed",
5304, 90, "Torsol seed");
}
}
ActionButtonPacketHandler: