use of server.maps.MapleDoorObject in project HeavenMS by ronancpl.
the class DoorHandler method handlePacket.
@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
int ownerid = slea.readInt();
// specifies if backwarp or not, 1 town to target, 0 target to town
boolean mode = (slea.readByte() == 0);
for (MapleMapObject obj : c.getPlayer().getMap().getMapObjects()) {
if (obj instanceof MapleDoorObject) {
MapleDoorObject door = (MapleDoorObject) obj;
if (door.getOwnerId() == ownerid) {
door.warp(c.getPlayer(), mode);
return;
}
}
}
}
use of server.maps.MapleDoorObject in project HeavenMS by ronancpl.
the class MaplePacketCreator method partyCreated.
public static byte[] partyCreated(MaplePartyCharacter partychar) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.PARTY_OPERATION.getValue());
mplew.write(8);
mplew.writeShort(0x8b);
mplew.writeShort(1);
if (partychar.getDoors().size() > 0) {
boolean deployedPortal = false;
for (MapleDoor door : partychar.getDoors()) {
if (door.getOwnerId() == partychar.getId()) {
MapleDoorObject mdo = door.getAreaDoor();
mplew.writeInt(mdo.getTo().getId());
mplew.writeInt(mdo.getFrom().getId());
mplew.writeInt(mdo.getPosition().x);
mplew.writeInt(mdo.getPosition().y);
deployedPortal = true;
}
}
if (!deployedPortal) {
mplew.writeInt(999999999);
mplew.writeInt(999999999);
mplew.writeInt(0);
mplew.writeInt(0);
}
} else {
mplew.writeInt(999999999);
mplew.writeInt(999999999);
mplew.writeInt(0);
mplew.writeInt(0);
}
return mplew.getPacket();
}
use of server.maps.MapleDoorObject in project HeavenMS by ronancpl.
the class MaplePacketCreator method addPartyStatus.
private static void addPartyStatus(int forchannel, MapleParty party, LittleEndianWriter lew, boolean leaving) {
List<MaplePartyCharacter> partymembers = new ArrayList<>(party.getMembers());
while (partymembers.size() < 6) {
partymembers.add(new MaplePartyCharacter());
}
for (MaplePartyCharacter partychar : partymembers) {
lew.writeInt(partychar.getId());
}
for (MaplePartyCharacter partychar : partymembers) {
lew.writeAsciiString(getRightPaddedStr(partychar.getName(), '\0', 13));
}
for (MaplePartyCharacter partychar : partymembers) {
lew.writeInt(partychar.getJobId());
}
for (MaplePartyCharacter partychar : partymembers) {
lew.writeInt(partychar.getLevel());
}
for (MaplePartyCharacter partychar : partymembers) {
if (partychar.isOnline()) {
lew.writeInt(partychar.getChannel() - 1);
} else {
lew.writeInt(-2);
}
}
lew.writeInt(party.getLeader().getId());
for (MaplePartyCharacter partychar : partymembers) {
if (partychar.getChannel() == forchannel) {
lew.writeInt(partychar.getMapId());
} else {
lew.writeInt(0);
}
}
for (MaplePartyCharacter partychar : partymembers) {
if (partychar.getChannel() == forchannel && !leaving) {
if (partychar.getDoors().size() > 0) {
boolean deployedPortal = false;
for (MapleDoor door : partychar.getDoors()) {
if (door.getOwnerId() == partychar.getId()) {
MapleDoorObject mdo = door.getTownDoor();
lew.writeInt(mdo.getTown().getId());
lew.writeInt(mdo.getArea().getId());
lew.writeInt(mdo.getPosition().x);
lew.writeInt(mdo.getPosition().y);
deployedPortal = true;
}
}
if (!deployedPortal) {
lew.writeInt(999999999);
lew.writeInt(999999999);
lew.writeInt(0);
lew.writeInt(0);
}
} else {
lew.writeInt(999999999);
lew.writeInt(999999999);
lew.writeInt(0);
lew.writeInt(0);
}
} else {
lew.writeInt(999999999);
lew.writeInt(999999999);
lew.writeInt(0);
lew.writeInt(0);
}
}
}
Aggregations