Bug fixes and improvements to Travel

This commit is contained in:
Waverunner
2013-11-07 20:21:14 -05:00
parent 0c3024e435
commit 9432de17a6
11 changed files with 73 additions and 64 deletions
@@ -23,33 +23,42 @@ package protocol.swg;
import java.nio.ByteOrder;
import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import services.travel.TravelPoint;
import engine.resources.objects.SWGObject;
public class EnterTicketPurchaseModeMessage extends SWGMessage {
public String planetName;
public String cityName;
private String planetName;
private String cityName;
private SWGObject player;
public EnterTicketPurchaseModeMessage(String planetName, String cityName) {
public EnterTicketPurchaseModeMessage(String planetName, String cityName, SWGObject player) {
this.planetName = planetName;
this.cityName = cityName;
this.player = player;
}
@Override
public void deserialize(IoBuffer data) {
// TODO Auto-generated method stub
}
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
final NGECore core = NGECore.getInstance();
TravelPoint nearestPoint = core.travelService.getNearestTravelPoint(player);
IoBuffer result = IoBuffer.allocate(20 + planetName.length() + nearestPoint.getName().length()).order(ByteOrder.LITTLE_ENDIAN);
result.putShort((short) 3);
result.putInt(0x904DAE1A);
result.put(getAsciiString(planetName));
result.put(getAsciiString(cityName + " Starport"));
result.put(getAsciiString(nearestPoint.getName()));
return result.flip();
}