This is what u are adding
Code:
package server.model.transport;
import server.event.CycleEvent;
import server.event.CycleEventContainer;
import server.event.CycleEventHandler;
import server.model.players.Client;
import server.world.Location;
public class GnomeGlider {
public static boolean flightButtons(Client player, int button) {
for (GliderRoute route : GliderRoute.values()) {
if (button == route.buttonId) {
handleFlight(player, route);
return true;
}
}
return false;
}
public static void handleFlight(final Client player, final GliderRoute route) {
player.getPA().showInterface(802);
int flight = getConfig(player.getX(), route);
if (flight < 1) {
player.sendMessage("You can't fly there from here.");
return;
}
if (flight == 20) {
player.sendMessage("You can't fly to the same place you are at.");
return;
}
if (flight == 25) {
player.sendMessage("You can't fly to that place yet.");
return;
}
player.getPA().sendConfig(133, flight);
CycleEventHandler.getInstance().addEvent(player, new CycleEvent() {
@Override
public void execute(CycleEventContainer e) {
player.getPA().movePlayer(route.to);
e.stop();
}
@Override
public void stop() {
}
}, 3);
CycleEventHandler.getInstance().addEvent(player, new CycleEvent() {
@Override
public void execute(CycleEventContainer e) {
player.getPlayerAssistant().closeAllWindows();
player.getPA().sendConfig(153, -1);
e.stop();
}
@Override
public void stop() {
}
}, 4);
}
public enum GliderRoute {
SINDARPOS(3058, new Location(2848, 3497), 0),
TA_QUIR_PRIW(3057, new Location(2465, 3501, 3), 1),
LEMANTO_ANDRA(3059, new Location(3321, 3427), 2),
KAR_HEWO(3060, new Location(3278, 3212), 3),
GANDIUS(3056, new Location(2894, 2729), 4),
LEMANTOLLY_UNDRI(48054, new Location(2544, 2970), 5);
int buttonId;
Location to;
int move;
GliderRoute(int buttonId, Location to, int move) {
this.buttonId = buttonId;
this.to = to;
this.move = move;
}
}
public static int[] configs = {2847, 2464, 3318, 3283, 2894, 2547};
private static int getConfig(int x, final GliderRoute route) {
int startPoint = 0, endPoint = route.move;
for (int c = 0; c < configs.length; c++) {
if (configs[c] == x) {
startPoint = c;
break;
}
}
if (startPoint == endPoint) {
return 20; // returns "cant fly to same place" error
}
switch (startPoint) {
case 0 : // Sin
if (endPoint == 1) {
return 2;
}
break;
case 1 : // Ta
if (endPoint == 0) {
return 1;
} else if (endPoint == 2) {
return 3;
} else if (endPoint == 3) {
return 4;
} else if (endPoint == 4) {
return 7;
} else if (endPoint == 5) {
return 25;// return 10;
}
break;
case 3 : // Kar
if (endPoint == 1) {
return 5;
}
break;
case 4 : // Gan
if (endPoint == 1) {
return 6;
}
break;
case 5 : // Lem und
if (endPoint == 1) {
return 11;
}
break;
}
return 0;
}
}
add this to PlayerAssistant
Code:
public void sendConfig(int id, int state) {
if (state < 128) {
if(c.getOutStream() != null && c != null) {
c.getOutStream().createFrame(36);
c.getOutStream().writeWordBigEndian(id);
c.getOutStream().writeByte(state);
c.flushOutStream();
} else {
if(c.getOutStream() != null && c != null) {
c.getOutStream().createFrame(87);
c.getOutStream().writeWordBigEndian_dup(id);
c.getOutStream().writeDWord_v1(state);
c.flushOutStream();
}
}
}
}
and this
Code:
public void movePlayer(Location location) {
movePlayer(location.x, location.y, location.z);
}
replace this in Location
Code:
public int x;
public int y;
public int z;
in ClickingButtons add this on top of processPacket before the switch
Code:
if (GnomeGlider.flightButtons(c, actionButtonId)) {
return;
}
add this to secondClickNpc in ActionHandler
Code:
case 3809:
case 3811:
c.getPA().showInterface(802);
break;