use of net.server.world.MaplePartyCharacter 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