PDA

View Full Version : (317-377) Stall stealing my way



Shaun
July 4th, 2010, 11:23
Make what you want with it...

I used custom GFX but you get the point.

// Shaun: stall stealing
public void stealStall(int itemAdd, int amountAdd, int multXP, int req, int gfx, String SM) {
if (actionTimer == 0) {
if (playerLevel[17] >= req) {
sendMessage("You attempt to steal from the stall...");
int chance = 3;
if (playerLevel[17] >= 12) chance = server.random.nextInt((int)(playerLevel[17]/4))+1;
if (server.random.nextInt(chance) == 1) {
sendMessage("...and you spring the trap!");
gfx100(76);
setAnimation(3170);
hitDiff = server.random.nextInt(10);
updateRequired = true;
hitUpdateRequired = true;
}else{
if (gfx > 0) gfx100(gfx);
addItem(itemAdd, amountAdd);
setAnimation(881);
sendMessage(SM);
addSkillXP((multXP*playerLevel[17]), 17);
actionTimer = 8;
}
}else{
sendMessage("You need " + req + "+ theiving to steal from this stall!");
}
actionTimer = 8;
}
}
// end stall stealing
As an example of how to use it:

case 4874: // crafting stall
stealStall(995, 25000, 100, 0, 0, "...and steal some money.");
break;
If you don't have random declared in the server class, you can change them to misc.random or just add it.
add the import
import java.util.Random; then the actual random object:
public static Random random = new Random(System.currentTimeMillis()); // personally think this is a better random system then misc.random(a.k.a Math.random) in the server class of course.

owner michael shabo
July 21st, 2010, 21:22
nice gj.

Q Epoch ++
July 22nd, 2010, 02:10
this c/p and y do u have a gfx for this?

-V.
July 27th, 2010, 19:21
So every time you thieve you get electrocuted... GJ apart from that, lolol.

Perfection
July 27th, 2010, 19:30
Post a picture of this please.

owner blade
July 27th, 2010, 19:33
mweh, its basic. You should add stall replacing with empty stalls and then make em come back in a few secs, its not hard

Trey
July 27th, 2010, 19:34
Make what you want with it...

I used custom GFX but you get the point.

// Shaun: stall stealing
public void stealStall(int itemAdd, int amountAdd, int multXP, int req, int gfx, String SM) {
if (actionTimer == 0) {
if (playerLevel[17] >= req) {
sendMessage("You attempt to steal from the stall...");
int chance = 3;
if (playerLevel[17] >= 12) chance = server.random.nextInt((int)(playerLevel[17]/4))+1;
if (server.random.nextInt(chance) == 1) {
sendMessage("...and you spring the trap!");
gfx100(76);
setAnimation(3170);
hitDiff = server.random.nextInt(10);
updateRequired = true;
hitUpdateRequired = true;
}else{
if (gfx > 0) gfx100(gfx);
addItem(itemAdd, amountAdd);
setAnimation(881);
sendMessage(SM);
addSkillXP((multXP*playerLevel[17]), 17);
actionTimer = 8;
}
}else{
sendMessage("You need " + req + "+ theiving to steal from this stall!");
}
actionTimer = 8;
}
}
// end stall stealing
As an example of how to use it:

case 4874: // crafting stall
stealStall(995, 25000, 100, 0, 0, "...and steal some money.");
break;
If you don't have random declared in the server class, you can change them to misc.random or just add it.
add the import
import java.util.Random; then the actual random object:
public static Random random = new Random(System.currentTimeMillis()); // personally think this is a better random system then misc.random(a.k.a Math.random) in the server class of course.

No point in passing the current system time as a seed to Random in the constructor, the default constructor uses the system time already.