UnitedScape
June 22nd, 2010, 05:53
Godsword Making
Purpose: Item on Item Godsword Making
Difficulty: 2/10
Files Edited: If you don't have an Item on Item java file:
PacketManager.java
ItemOnItem.java
If you do have and Item On Item java file:
ItemOnItem.java
Step 1A:
Adding an ItemOnItem.java file
If you already have one skip to Step 1B
This is a little ItemOnItem.java file I got from a Fletching Tutorial (I think) The author is in the code:
package palidino76.rs2.io.packets;
import palidino76.rs2.players.Player;
import palidino76.rs2.players.items.PlayerItems;
/**
*
* @author Encouragin <ZLyricale@live.nl>
*/
public class ItemOnItem implements Packet {
/**
* Handles item on item packet.
* @param Player p The player which the packet will be created for.
* @param packetId the packet id which is activated (Which handles this class)
* @param packetSize the amount of bytes being received for the packet.
*/
public void handlePacket(Player player, int packetId, int packetSize) {
if (player == null)
return;
/**
* These are the correct stream methods
* for item on item packet.
*/
int usedWith = player.stream.readSignedWordBigEndian();
int itemUsed = player.stream.readSignedWordA();
PlayerItems pi = new PlayerItems();
//Add your Item on Item Here:
System.out.println("Used with: "+usedWith+" itemUsed: "+itemUsed);
}
}
Now go to PacketManager.java and add this:
public ItemOnItem itemOnItem = new ItemOnItem();
and in the same file search for:
Case 59:
and add this under it:
case 40:
itemOnItem.handlePacket(p, packetId, packetSize);
break;
Save and Compile.
Step 1B:
Go to your ItemOnItem.java and add this:
Code:
//Start of Godsword Making
if(itemUsed == 11710 && usedWith == 11712 || itemUsed == 11712 && usedWith == 11710) {
pi.deleteItem(player, 11710, pi.getItemSlot(player, 11710), 1);
pi.deleteItem(player, 11712, pi.getItemSlot(player, 11712), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11686, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together.");
}
if(itemUsed == 11710 && usedWith == 11714 || itemUsed == 11714 && usedWith == 11710) {
pi.deleteItem(player, 11710, pi.getItemSlot(player, 11710), 1);
pi.deleteItem(player, 11714, pi.getItemSlot(player, 11714), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11688, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together.");
}
if(itemUsed == 11714 && usedWith == 11686 || itemUsed == 11686 && usedWith == 11714) {
pi.deleteItem(player, 11714, pi.getItemSlot(player, 11714), 1);
pi.deleteItem(player, 11686, pi.getItemSlot(player, 11686), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11690, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together...");
player.frames.sendMessage(player, "...and get a whole Godsword Blade!");
}
if(itemUsed == 11712 && usedWith == 11688 || itemUsed == 11688 && usedWith == 11712) {
pi.deleteItem(player, 11712, pi.getItemSlot(player, 11712), 1);
pi.deleteItem(player, 11688, pi.getItemSlot(player, 11688), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11690, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together...");
player.frames.sendMessage(player, "...and get a whole Godsword Blade!");
}
if(itemUsed == 11710 && usedWith == 11692 || itemUsed == 11692 && usedWith == 11710) {
pi.deleteItem(player, 11710, pi.getItemSlot(player, 11710), 1);
pi.deleteItem(player, 11692, pi.getItemSlot(player, 11692), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11690, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together...");
player.frames.sendMessage(player, "...and get a whole Godsword Blade!");
}
if(itemUsed == 11714 && usedWith == 11712 || itemUsed == 11712 && usedWith == 11714) {
pi.deleteItem(player, 11714, pi.getItemSlot(player, 11714), 1);
pi.deleteItem(player, 11712, pi.getItemSlot(player, 11712), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11692, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together.");
}
if(itemUsed == 11702 && usedWith == 11690 || itemUsed == 11690 && usedWith == 11702) {
pi.deleteItem(player, 11702, pi.getItemSlot(player, 11702), 1);
pi.deleteItem(player, 11690, pi.getItemSlot(player, 11690), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11694, 1);
player.frames.sendMessage(player, "You attach the Godsword Blade and Hilt together...");
player.frames.sendMessage(player, "...and get an Armadyl Godsword!");
}
if(itemUsed == 11704 && usedWith == 11690 || itemUsed == 11690 && usedWith == 11704) {
pi.deleteItem(player, 11704, pi.getItemSlot(player, 11704), 1);
pi.deleteItem(player, 11690, pi.getItemSlot(player, 11690), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11696, 1);
player.frames.sendMessage(player, "You attach the Godsword Blade and Hilt together...");
player.frames.sendMessage(player, "...and get a Bandos Godsword!");
}
if(itemUsed == 11706 && usedWith == 11690 || itemUsed == 11690 && usedWith == 11706) {
pi.deleteItem(player, 11706, pi.getItemSlot(player, 11706), 1);
pi.deleteItem(player, 11690, pi.getItemSlot(player, 11690), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11698, 1);
player.frames.sendMessage(player, "You attach the Godsword Blade and Hilt together...");
player.frames.sendMessage(player, "...and get a Saradomin Godsword!");
}
if(itemUsed == 11708 && usedWith == 11690 || itemUsed == 11690 && usedWith == 11708) {
pi.deleteItem(player, 11708, pi.getItemSlot(player, 11708), 1);
pi.deleteItem(player, 11690, pi.getItemSlot(player, 11690), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11700, 1);
player.frames.sendMessage(player, "You attach the Godsword Blade and Hilt together...");
player.frames.sendMessage(player, "...and get a Zamorak Godsword!");
}
//End of Godsword Making
Step 2:
Save and Compile and Enjoy!
Purpose: Item on Item Godsword Making
Difficulty: 2/10
Files Edited: If you don't have an Item on Item java file:
PacketManager.java
ItemOnItem.java
If you do have and Item On Item java file:
ItemOnItem.java
Step 1A:
Adding an ItemOnItem.java file
If you already have one skip to Step 1B
This is a little ItemOnItem.java file I got from a Fletching Tutorial (I think) The author is in the code:
package palidino76.rs2.io.packets;
import palidino76.rs2.players.Player;
import palidino76.rs2.players.items.PlayerItems;
/**
*
* @author Encouragin <ZLyricale@live.nl>
*/
public class ItemOnItem implements Packet {
/**
* Handles item on item packet.
* @param Player p The player which the packet will be created for.
* @param packetId the packet id which is activated (Which handles this class)
* @param packetSize the amount of bytes being received for the packet.
*/
public void handlePacket(Player player, int packetId, int packetSize) {
if (player == null)
return;
/**
* These are the correct stream methods
* for item on item packet.
*/
int usedWith = player.stream.readSignedWordBigEndian();
int itemUsed = player.stream.readSignedWordA();
PlayerItems pi = new PlayerItems();
//Add your Item on Item Here:
System.out.println("Used with: "+usedWith+" itemUsed: "+itemUsed);
}
}
Now go to PacketManager.java and add this:
public ItemOnItem itemOnItem = new ItemOnItem();
and in the same file search for:
Case 59:
and add this under it:
case 40:
itemOnItem.handlePacket(p, packetId, packetSize);
break;
Save and Compile.
Step 1B:
Go to your ItemOnItem.java and add this:
Code:
//Start of Godsword Making
if(itemUsed == 11710 && usedWith == 11712 || itemUsed == 11712 && usedWith == 11710) {
pi.deleteItem(player, 11710, pi.getItemSlot(player, 11710), 1);
pi.deleteItem(player, 11712, pi.getItemSlot(player, 11712), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11686, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together.");
}
if(itemUsed == 11710 && usedWith == 11714 || itemUsed == 11714 && usedWith == 11710) {
pi.deleteItem(player, 11710, pi.getItemSlot(player, 11710), 1);
pi.deleteItem(player, 11714, pi.getItemSlot(player, 11714), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11688, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together.");
}
if(itemUsed == 11714 && usedWith == 11686 || itemUsed == 11686 && usedWith == 11714) {
pi.deleteItem(player, 11714, pi.getItemSlot(player, 11714), 1);
pi.deleteItem(player, 11686, pi.getItemSlot(player, 11686), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11690, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together...");
player.frames.sendMessage(player, "...and get a whole Godsword Blade!");
}
if(itemUsed == 11712 && usedWith == 11688 || itemUsed == 11688 && usedWith == 11712) {
pi.deleteItem(player, 11712, pi.getItemSlot(player, 11712), 1);
pi.deleteItem(player, 11688, pi.getItemSlot(player, 11688), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11690, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together...");
player.frames.sendMessage(player, "...and get a whole Godsword Blade!");
}
if(itemUsed == 11710 && usedWith == 11692 || itemUsed == 11692 && usedWith == 11710) {
pi.deleteItem(player, 11710, pi.getItemSlot(player, 11710), 1);
pi.deleteItem(player, 11692, pi.getItemSlot(player, 11692), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11690, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together...");
player.frames.sendMessage(player, "...and get a whole Godsword Blade!");
}
if(itemUsed == 11714 && usedWith == 11712 || itemUsed == 11712 && usedWith == 11714) {
pi.deleteItem(player, 11714, pi.getItemSlot(player, 11714), 1);
pi.deleteItem(player, 11712, pi.getItemSlot(player, 11712), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11692, 1);
player.frames.sendMessage(player, "You attach the Godsword Shards together.");
}
if(itemUsed == 11702 && usedWith == 11690 || itemUsed == 11690 && usedWith == 11702) {
pi.deleteItem(player, 11702, pi.getItemSlot(player, 11702), 1);
pi.deleteItem(player, 11690, pi.getItemSlot(player, 11690), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11694, 1);
player.frames.sendMessage(player, "You attach the Godsword Blade and Hilt together...");
player.frames.sendMessage(player, "...and get an Armadyl Godsword!");
}
if(itemUsed == 11704 && usedWith == 11690 || itemUsed == 11690 && usedWith == 11704) {
pi.deleteItem(player, 11704, pi.getItemSlot(player, 11704), 1);
pi.deleteItem(player, 11690, pi.getItemSlot(player, 11690), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11696, 1);
player.frames.sendMessage(player, "You attach the Godsword Blade and Hilt together...");
player.frames.sendMessage(player, "...and get a Bandos Godsword!");
}
if(itemUsed == 11706 && usedWith == 11690 || itemUsed == 11690 && usedWith == 11706) {
pi.deleteItem(player, 11706, pi.getItemSlot(player, 11706), 1);
pi.deleteItem(player, 11690, pi.getItemSlot(player, 11690), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11698, 1);
player.frames.sendMessage(player, "You attach the Godsword Blade and Hilt together...");
player.frames.sendMessage(player, "...and get a Saradomin Godsword!");
}
if(itemUsed == 11708 && usedWith == 11690 || itemUsed == 11690 && usedWith == 11708) {
pi.deleteItem(player, 11708, pi.getItemSlot(player, 11708), 1);
pi.deleteItem(player, 11690, pi.getItemSlot(player, 11690), 1);
player.addSkillXP(100, 12);
pi.addItem(player, 11700, 1);
player.frames.sendMessage(player, "You attach the Godsword Blade and Hilt together...");
player.frames.sendMessage(player, "...and get a Zamorak Godsword!");
}
//End of Godsword Making
Step 2:
Save and Compile and Enjoy!