use of server.maps.MapleMapObject in project HeavenMS by ronancpl.
the class PartySearchStartHandler method handlePacket.
@Override
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
if (!ServerConstants.USE_PARTY_SEARCH) {
return;
}
int min = slea.readInt();
int max = slea.readInt();
// members
slea.readInt();
int jobs = slea.readInt();
MapleParty party = c.getPlayer().getParty();
if (party == null)
return;
MapleCharacter chr = c.getPlayer();
MapleMap map = chr.getMap();
World world = c.getWorldServer();
Collection<MapleMapObject> mapobjs = map.getPlayers();
for (MapleMapObject mapobj : mapobjs) {
if (party.getMembers().size() > 5) {
break;
}
if (mapobj instanceof MapleCharacter) {
MapleCharacter tchar = (MapleCharacter) mapobj;
int charlvl = tchar.getLevel();
if (charlvl >= min && charlvl <= max && isValidJob(tchar.getJob(), jobs)) {
if (tchar.getParty() == null) {
MaplePartyCharacter partyplayer = new MaplePartyCharacter(tchar);
tchar.getMap().addPartyMember(tchar);
world.updateParty(party.getId(), PartyOperation.JOIN, partyplayer);
tchar.receivePartyMemberHP();
tchar.updatePartyMemberHP();
}
}
}
}
}
Aggregations