Hope
June 7th, 2011, 18:25
Updated some conventions. Thanks David.
Alright so this is just something I put together really fast.
Note: I did this for fun and not for any profit whatsoever. Please don't flame my work, seeing as I'm learning.
Note: I didn't use the regular teleport method so that people can change the teleport graphics for the fairy teleport instead of using the ancients teleport or default one.
Put this in actionbuttonpackethandler.java
case 624: //Fairy rings
if (buttonId == 21) { //1st Plus
if (player.firstColumn >= 15) {
player.firstColumn = 15;
} else {
player.firstColumn++;
}
} else if (buttonId == 22) { //1st Subtract
if (player.firstColumn <= 0) {
player.firstColumn = 0;
} else {
player.firstColumn--;
}
} else if (buttonId == 23) { //2nd Plus
if (player.secondColumn >= 15) {
player.secondColumn = 15;
} else {
player.secondColumn++;
}
} else if (buttonId == 24) { //2nd Subtract
if (player.secondColumn <= 0) {
player.secondColumn = 0;
} else {
player.secondColumn--;
}
} else if (buttonId == 25) { //3rd Plus
if (player.thirdColumn >= 15) {
player.thirdColumn = 15;
} else {
player.thirdColumn++;
}
} else if (buttonId == 26) { //3rd Subtract
if (player.thirdColumn <= 0) {
player.thirdColumn = 0;
} else {
player.thirdColumn--;
}
} else if (buttonId == 69) { //Confirm
FairyRing.ringTele(player, player.firstColumn, player.secondColumn, player.thirdColumn);
}
break;
Make a new file in content, Name it FairyRing and put this into it
/**
*
* @author 'RuneUnited
*/
public final class FairyRing {
public static void ringTele (Player p , int firstColumn, int secondColumn, int thirdColumn) {
if(p.frozen > 0) {
p.getActionSender().sendMessage("You cannot use the fairyring when frozen!");
p.getWalkingQueue().reset();
return;
}
if(p.isTeleBlocked) {
p.sm("You cannot use the fairyring when teleblocked!");
return;
}
/**
* START OF SEQUENCES
*/
if (p.firstColumn == 1 && p.secondColumn == 1 && p.thirdColumn == 1) { //First,Second,Third stand for each number in the interface.
p.getActionSender().sendCloseInterface();
p.resetAttack();
fairyTeleport(p, 2671 ,2593, 0, 0);
} else {
p.sm("That is not a teleport option!");
return;
}
}
private static void fairyTeleport (final Player p, int x, int y, final int height, int distance) {
p.getActionSender().removeTab1();
if(p.SafeZone()) {
p.Attacking = false;
if (distance > 0) {
int type = Misc.random(1);
int offset = Misc.random(distance); //If you don't want offset, just take the distance thing out.
if (type == 1) {
x += -offset;
} else {
x += offset;
}
type = Misc.random(1);
offset = Misc.random(distance);
if (type == 1) {
y += -offset;
} else {
y += offset;
}
}
final int endX = x;
final int endY = y;
p.getWalkingQueue().reset();
p.animate(8939, 0); //Place whatever fairy teleport emote & gfx you want
p.graphics(1681, 0);
World.getWorld().registerEvent(new Event(1800) {
public void execute() {
p.tele(endX, endY, height);
p.animate(8941, 0);//Place whatever fairy teleport emote & gfx you want
p.graphics(1681, 0);
p.getActionSender().sendCloseChatboxInterface();
p.getActionSender().removeTab();
p.getActionSender().sendCloseInterface();
this.stop();
}
});
}
}
public static void refresh(Player player) {
player.FirstColumn = 0;
player.SecondColumn = 0;
player.ThirdColumn = 0;
}
}
In actionsender.java above
if(player.starter == 0) {
Add..
FairyRing.refresh(player);
In player.java add
public int firstColumn = 0, secondColumn = 0, thirdColumn = 0;
Oh, and don't forget to add the imports to actionbutton and actionsender:
import com.rs2hd.content.FairyRing;
How it works:
-This works with interface 624 (Fairy Ring Interface)
- Simple send the interface by using an object or a command to get the interface open.
How to edit more number teleport sequences:
In FairyRing.java find where it says START OF SEQUENCES which I added in the file
-Where it says First column, second, third. They stand for each of the numbers on the interface. So as you see on my example, if a player puts 1, 1, 1 on the interface then it will teleport them to that location i have set. Just simply copy the expression for any other places you want.
Edit the fairy emote and gfx teleport near the bottom under private static void fairyTeleport.
-Any Questions, just drop them by.
Alright so this is just something I put together really fast.
Note: I did this for fun and not for any profit whatsoever. Please don't flame my work, seeing as I'm learning.
Note: I didn't use the regular teleport method so that people can change the teleport graphics for the fairy teleport instead of using the ancients teleport or default one.
Put this in actionbuttonpackethandler.java
case 624: //Fairy rings
if (buttonId == 21) { //1st Plus
if (player.firstColumn >= 15) {
player.firstColumn = 15;
} else {
player.firstColumn++;
}
} else if (buttonId == 22) { //1st Subtract
if (player.firstColumn <= 0) {
player.firstColumn = 0;
} else {
player.firstColumn--;
}
} else if (buttonId == 23) { //2nd Plus
if (player.secondColumn >= 15) {
player.secondColumn = 15;
} else {
player.secondColumn++;
}
} else if (buttonId == 24) { //2nd Subtract
if (player.secondColumn <= 0) {
player.secondColumn = 0;
} else {
player.secondColumn--;
}
} else if (buttonId == 25) { //3rd Plus
if (player.thirdColumn >= 15) {
player.thirdColumn = 15;
} else {
player.thirdColumn++;
}
} else if (buttonId == 26) { //3rd Subtract
if (player.thirdColumn <= 0) {
player.thirdColumn = 0;
} else {
player.thirdColumn--;
}
} else if (buttonId == 69) { //Confirm
FairyRing.ringTele(player, player.firstColumn, player.secondColumn, player.thirdColumn);
}
break;
Make a new file in content, Name it FairyRing and put this into it
/**
*
* @author 'RuneUnited
*/
public final class FairyRing {
public static void ringTele (Player p , int firstColumn, int secondColumn, int thirdColumn) {
if(p.frozen > 0) {
p.getActionSender().sendMessage("You cannot use the fairyring when frozen!");
p.getWalkingQueue().reset();
return;
}
if(p.isTeleBlocked) {
p.sm("You cannot use the fairyring when teleblocked!");
return;
}
/**
* START OF SEQUENCES
*/
if (p.firstColumn == 1 && p.secondColumn == 1 && p.thirdColumn == 1) { //First,Second,Third stand for each number in the interface.
p.getActionSender().sendCloseInterface();
p.resetAttack();
fairyTeleport(p, 2671 ,2593, 0, 0);
} else {
p.sm("That is not a teleport option!");
return;
}
}
private static void fairyTeleport (final Player p, int x, int y, final int height, int distance) {
p.getActionSender().removeTab1();
if(p.SafeZone()) {
p.Attacking = false;
if (distance > 0) {
int type = Misc.random(1);
int offset = Misc.random(distance); //If you don't want offset, just take the distance thing out.
if (type == 1) {
x += -offset;
} else {
x += offset;
}
type = Misc.random(1);
offset = Misc.random(distance);
if (type == 1) {
y += -offset;
} else {
y += offset;
}
}
final int endX = x;
final int endY = y;
p.getWalkingQueue().reset();
p.animate(8939, 0); //Place whatever fairy teleport emote & gfx you want
p.graphics(1681, 0);
World.getWorld().registerEvent(new Event(1800) {
public void execute() {
p.tele(endX, endY, height);
p.animate(8941, 0);//Place whatever fairy teleport emote & gfx you want
p.graphics(1681, 0);
p.getActionSender().sendCloseChatboxInterface();
p.getActionSender().removeTab();
p.getActionSender().sendCloseInterface();
this.stop();
}
});
}
}
public static void refresh(Player player) {
player.FirstColumn = 0;
player.SecondColumn = 0;
player.ThirdColumn = 0;
}
}
In actionsender.java above
if(player.starter == 0) {
Add..
FairyRing.refresh(player);
In player.java add
public int firstColumn = 0, secondColumn = 0, thirdColumn = 0;
Oh, and don't forget to add the imports to actionbutton and actionsender:
import com.rs2hd.content.FairyRing;
How it works:
-This works with interface 624 (Fairy Ring Interface)
- Simple send the interface by using an object or a command to get the interface open.
How to edit more number teleport sequences:
In FairyRing.java find where it says START OF SEQUENCES which I added in the file
-Where it says First column, second, third. They stand for each of the numbers on the interface. So as you see on my example, if a player puts 1, 1, 1 on the interface then it will teleport them to that location i have set. Just simply copy the expression for any other places you want.
Edit the fairy emote and gfx teleport near the bottom under private static void fairyTeleport.
-Any Questions, just drop them by.