Goodjob, im sure someone will find a use for this![]()
|
|
I decided to release this because no delta has good crafting.
It can b used for other server like BattleScape, Project Insanity(Most of them already has it),
Dodians, Devolutions and others..
Things you will need to complete this tutorial
Knowledge: Copy/paste/Replace
Difficult: 2/10
Class Modified: client.java , clickingmost.java
Class Created: Crafting.java
Before doing anything Backup all your files in case of 100 errors
First step:
Open up you client.java and find
You Should See something like this:Code:public void deleteItem(int id, int slot, int amount) {
Replace it with theese :Code:public void deleteItem(int id, int amount) { deleteItem(id, GetItemSlot(id), amount); } public void deleteItem(int id, int slot, int amount) { if ((slot > -1) && (slot < playerItems.length)) { if ((playerItems[slot] - 1) == id) { if (playerItemsN[slot] > amount) { playerItemsN[slot] -= amount; } else { playerItemsN[slot] = 0; playerItems[slot] = 0; } resetItems(3214); } } else { } }
Theese method deletes item correctly.Code:public void deleteItem(int id, int amount) { deleteItem(id, GetItemSlot(id), amount); } public boolean deleteItem(int Id, int Slot, int Amount) { if (server.playerHandler.players[playerId] == null || disconnected || in == null || out == null) return false; if (Id < 0 || Amount < 0) return false; if (CurrentFrame != 5292 && CurrentFrame != 3824) { if (Id == 556 && playerEquipment[playerWeapon] == 1381) return true; else if (Id == 555 && playerEquipment[playerWeapon] == 1383) return true; else if (Id == 557 && playerEquipment[playerWeapon] == 1385) return true; else if (Id == 554 && (playerEquipment[playerWeapon] == 1387 || playerEquipment[playerWeapon] == 3053)) return true; else if (Id == 555 && playerEquipment[playerWeapon] == 6563) return true; else if (Id == 557 && (playerEquipment[playerWeapon] == 6563 || playerEquipment[playerWeapon] == 3053)) return true; } if ((playerItems[Slot] == Id + 1) && (!Item.itemStackable[Id] && !Item.itemIsNote[Id])) { if (Amount == 1) { playerItems[Slot] = 0; playerItemsN[Slot] = 0; resetItems(3214); return true; } else { for (int i = 0; i < 28; i++) { if (playerItems[i] == Id+1 && Amount != 0) { Amount--; playerItems[i] = 0; playerItemsN[i] = 0; resetItems(3214); } } if (Amount == 0) return true; } } if ((playerItems[Slot] == Id + 1) && (Item.itemStackable[Id] || Item.itemIsNote[Id])) { if (playerItemsN[Slot] > Amount) { playerItemsN[Slot] -= Amount; resetItems(3214); return true; } else { playerItemsN[Slot] = 0; playerItems[Slot] = 0; resetItems(3214); return true; } } return false; }
Step 2:
Import theese to you client.java
[/CODE]
private Crafting crafting = new Crafting(this);
public Crafting getCrafting() {
return crafting;
}
[/CODE]
Now Search for:
and underCode:case 53:
add this :Code:if (!playerHasItem(itemUsed) || !playerHasItem(useWith)) { break; } int otherItem = playerItems[usedWithSlot] - 1;
Now search for :Code:if (itemUsed == 1733 || useWith == 1733) { getCrafting().handleLeather(itemUsed, useWith); }
and underCode:case 185:
add theese:Code:server.clickingMost.clicking(playerId); switch (actionButtonId) {
Now Open clickingMost.javaCode:case 34185: case 34184: case 34183: case 34182: case 34189: case 34188: case 34187: case 34186: case 34193: case 34192: case 34191: case 34190: if (craftingLeather) { getCrafting().handleCraftingClick(actionButtonId); } break;
and search for following cases
And remove it with everything it contains.Code:case 34185: case 34184: case 34183: case 34182: case 34189: case 34188: case 34187: case 34186: case 34193: case 34192: case 34191: case 34190:
Now close and save clickingMost.java
Now create a new Class Called Crafting.java
and insert this code inside:
Now close and save Crafting.javaCode:public class Crafting { private client c; public Crafting(client c) { this.c = c; } public int hideType = 0, makeId = 0, amount = 0, craftType = 0, exp = 0, index = 0; public void resetCrafting() { hideType = 0; makeId = 0; amount = 0; c.craftingLeather = false; craftType = 0; } public void handleChisel(int id1, int id2) { if (id1 == 1755) cutGem(id2); else cutGem(id1); } public int[][] gems = {{1623,1727,1,50},{1621,1729,27,68},{1619,1725,34,85},{1617,1731,43,108},{1631,1712,55,138},{6571,6585,67,168}}; public void cutGem(int id) { for (int j = 0; j < gems.length; j++) { if (gems[j][0] == id) { if (c.playerLevel[c.playerCrafting] >= gems[j][2]) { c.deleteItem(id, c.GetItemSlot(id),1); c.addItem(gems[j][1], 1); c.closeAll(); c.addSkillXP(gems[j][3] * 40, c.playerCrafting); break; } } } } public void handleCraftingClick(int clickId) { for (int j = 0; j < buttons.length; j++) { if (buttons[j][0] == clickId) { craftType = buttons[j][1]; amount = buttons[j][2]; checkRequirements(); break; } } } public void checkRequirements() { for (int j = 0; j < expsAndLevels.length; j++) { if (expsAndLevels[j][0] == hideType) { if (c.playerLevel[c.playerCrafting] >= expsAndLevels[j][1]) { if (c.playerHasItem(hideType, 1)) { c.closeAll(); exp = expsAndLevels[j][2]; index = j; craftHides(hideType); } } else { c.closeAll(); c.sM("You need a crafting level of " + expsAndLevels[j][1] + " to craft this."); } } } } public void craftHides(int id) { for (int j = 0; j < amount; j++) { if (!c.playerHasItem(id,craftType)) break; c.deleteItem(id, c.GetItemSlot(id), craftType); if (getItemToAdd() <= 0) break; c.addItem(getItemToAdd(), 1); c.closeAll(); c.addSkillXP(exp * 50, c.playerCrafting); } resetCrafting(); } public int getItemToAdd() { if (craftType == 1) { return vambs[index]; } else if (craftType == 2) { return chaps[index]; } else if (craftType == 3) { return bodys[index]; } return -1; } public int[] vambs = {1065,2487,2489,2491}; public int[] chaps = {1099,2493,2495,2497}; public int[] bodys = {1135,2499,2501,2503}; public void handleLeather(int item1, int item2) { if (item1 == 1733) { openLeather(item2); } else { openLeather(item1); } } public int[][] buttons = {{34185,1,1},{34184,1,5},{34183,1,10},{34182,1,27},{34189,2,1},{34188,2,5},{34187,2,10},{34186,2,27},{34193,3,1},{34192,3,5},{34191,3,10},{34190,3,27}}; public int[][] expsAndLevels = {{1745,62,57},{2505,66,70},{2507,73,78},{2509,79,86}}; public void openLeather(int item) { if (item == 1745) { c.sendFrame164(8880); //green dhide c.sendFrame126("What would you like to make?", 8879); c.sendFrame246(8884, 250, 1099); // middle c.sendFrame246(8883, 250, 1065); // left picture c.sendFrame246(8885, 250, 1135); // right pic c.sendFrame126("Vambs", 8889); c.sendFrame126("Chaps", 8893); c.sendFrame126("Body", 8897); hideType = item; } else if (item == 2505) { c.sendFrame164(8880); //blue c.sendFrame126("What would you like to make?", 8879); c.sendFrame246(8884, 250, 2493); // middle c.sendFrame246(8883, 250, 2487); // left picture c.sendFrame246(8885, 250, 2499); // right pic c.sendFrame126("Vambs", 8889); c.sendFrame126("Chaps", 8893); c.sendFrame126("Body", 8897); hideType = item; } else if (item == 2507) { c.sendFrame164(8880); c.sendFrame126("What would you like to make?", 8879); c.sendFrame246(8884, 250, 2495); // middle c.sendFrame246(8883, 250, 2489); // left picture c.sendFrame246(8885, 250, 2501); // right pic c.sendFrame126("Vambs", 8889); c.sendFrame126("Chaps", 8893); c.sendFrame126("Body", 8897); hideType = item; } else if (item == 2509) { c.sendFrame164(8880); c.sendFrame126("What would you like to make?", 8879); c.sendFrame246(8884, 250, 2497); // middle c.sendFrame246(8883, 250, 2491); // left picture c.sendFrame246(8885, 250, 2503); // right pic c.sendFrame126("Vambs", 8889); c.sendFrame126("Chaps", 8893); c.sendFrame126("Body", 8897); hideType = item; } c.craftingLeather = true; } }
and now youre done.
Hope you liked this and use it.
If you got any errors please post it.
Here i will help you.
Credits:
65% Sanity
35% BeerShake(Me)
We need more delta tutorials honestly, I'm making a RS 2006 remake off Delta.

Sorry, I don't have many experiences with RSPS coding, I got the following errors:
client.java19:class, interface, or enum expected
private Crafting crafting = new Crafting(this);
^
client.java20:class, interface, or enum expected
public Crafting getCrafting() {
^
client.java22:class, interface, or enum expected
}
^
You said 'import them', so I copied the code under the 'import' codes, which you can find on the top of client.java
I got 100'S Errors xD
got lots of errors
client.java:8929: error: deleteItem(int,int) is already defined in client
public void deleteItem(int id, int amount) {
^
client.java:8939: error: cannot find symbol
if (CurrentFrame != 5292 && CurrentFrame != 3824)
^
symbol: variable CurrentFrame
location: class client
client.java:8939: error: cannot find symbol
if (CurrentFrame != 5292 && CurrentFrame != 3824)
^
symbol: variable CurrentFrame
location: class client
client.java:15694: error: cannot find symbol
if (craftingLeather) {
^
symbol: variable craftingLeather
location: class client
client.java:17035: error: bad operand types for binary operator '&&'
&& (System.currentTimeMillis() - lastAction >= 1
500)) {
^
first type: Crafting
second type: boolean
client.java:17231: error: incompatible types
crafting = false;
^
required: Crafting
found: boolean
client.java:18752: error: incompatible types
crafting = true;
^
required: Crafting
found: boolean
client.java:18852: error: incompatible types
crafting = true;
^
required: Crafting
found: boolean
Crafting.java:14: error: cannot find symbol
c.craftingLeather = false;
^
symbol: variable craftingLeather
location: variable c of type client
Crafting.java:154: error: cannot find symbol
c.craftingLeather = true;
^
symbol: variable craftingLeather
location: variable c of type client
10 errors
Finished!
Press any key to continue . . .

If you actually READ the errors... you might be able to fix all of them already..
Ill give you a hint
already defined means you already have the method.
As you probably replaced with your old crafting, you might wanna compare the variables.
@ DeuX
doesn't mean squat. Show the first
| « Adding Pkerboss [ Different way ] | [All Bases]How to Setup Server Without Portforwarding [Working][Video] » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |
| Tags for this Thread |