Hey Rune-Server!
This is my first snippet, I was messing around with Berky-Scape 508 source.
I aimed to re-emulate RuneScape 2008/2009 (Pre RS2HD).
So when I googled around, 508 didin't have a lot of snippets/tutorials, and if it did, it had anti-leeches in it or were in the source already;
Now to the snippet!
Open up your Player.java and declare these ints;
Code:
public int WoolSpinTimer = 0;
public int FlaxSpinTimer = 0;
That wraps up the base timers for Wool&Flax, we will use this later on.
Let's move on to ActionButtons.java
Add this anywhere It'd fit, for me it fit below quests;
Code:
case 459:
switch(buttonId) {
case 17:
if(Engine.playerItems.HasItemAmount(p, 1779, 1) && p.skillLvl[12] > 9) {
p.FlaxSpinTimer = 7;
}
else if (p.skillLvl[12] < 9) {
p.frames.sendMessage(p, "You need level 10 Crafting to spin flax!");
}
else {
p.frames.sendMessage(p, "You need to have flax in order to spin flax.");
}
break;
case 19: // Ball of wool (Wool)
if(Engine.playerItems.HasItemAmount(p, 1737, 1)) {
p.WoolSpinTimer = 7;
}
else {
p.frames.sendMessage(p, "You need to have wool in order to spin wool.");
}
break;
case 23:
p.frames.sendMessage(p, "ID:23"); // Magic amulet string (magic roots)
break;
case 27:
p.frames.sendMessage(p, "ID:27"); // C'bow String (Sinew)
break;
case 31:
p.frames.sendMessage(p, "ID:31"); // C'bow String (Tree Roots)
break;
case 35:
p.frames.sendMessage(p, "ID:35"); // Rope (Yak Hair)
break;
}
break;
This checks for Crafting level and items before spinning.
Additionaly, I put button IDs for those who want to continiue.
Now, add this to your ObjectOption1.java;
Code:
case 36970: // Spinning Wheel
p.frames.showInterface(p,459);
break;
To make this all work, you'll need to add this under your 'public void process()';
Code:
if (WoolSpinTimer == 7) {
WoolSpinTimer--;
stopMovement(this);
requestAnim(894, 0);
frames.removeShownInterface(this);
}
if (WoolSpinTimer < 7 && WoolSpinTimer > 1) {
WoolSpinTimer--;
}
if (WoolSpinTimer == 1 && Engine.playerItems.haveItem(this, 1737, 1)) {
WoolSpinTimer--;
Engine.playerItems.deleteItem(this, 1737, 1);
Engine.playerItems.addItem(this, 1759, 1);
addSkillXP(2, 12);
frames.sendMessage(this, "You spin the balls of wool.");
}
else {
WoolSpinTimer--;
}
if (FlaxSpinTimer == 7) {
FlaxSpinTimer--;
stopMovement(this);
requestAnim(894, 0);
frames.removeShownInterface(this);
}
if (FlaxSpinTimer < 7 && FlaxSpinTimer > 1) {
FlaxSpinTimer--;
}
if (FlaxSpinTimer == 1 && Engine.playerItems.haveItem(this, 1779, 1)) {
FlaxSpinTimer--;
Engine.playerItems.deleteItem(this, 1779, 1);
Engine.playerItems.addItem(this, 1777, 1);
addSkillXP(15, 12);
frames.sendMessage(this, "You spin the flax and get bow string.");
}
else {
FlaxSpinTimer--;
}
Yes, I'm aware this has possible duplication,
Now, I'm going off to sleep (Getting 2 AM here by time I posted this.)