Search in sources :

Example 21 with MapleMapObject

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();
                }
            }
        }
    }
}
Also used : MapleMap(server.maps.MapleMap) MapleCharacter(client.MapleCharacter) MapleParty(net.server.world.MapleParty) MapleMapObject(server.maps.MapleMapObject) World(net.server.world.World) MaplePartyCharacter(net.server.world.MaplePartyCharacter)

Aggregations

MapleMapObject (server.maps.MapleMapObject)21 MapleCharacter (client.MapleCharacter)15 MapleMonster (server.life.MapleMonster)9 Point (java.awt.Point)8 MapleMap (server.maps.MapleMap)6 Item (client.inventory.Item)5 ArrayList (java.util.ArrayList)5 MapleMapItem (server.maps.MapleMapItem)5 Skill (client.Skill)3 MapleInventoryType (client.inventory.MapleInventoryType)3 MonsterStatusEffect (client.status.MonsterStatusEffect)3 Rectangle (java.awt.Rectangle)3 MapleItemInformationProvider (server.MapleItemInformationProvider)3 MapleNPC (server.life.MapleNPC)3 SpawnPoint (server.life.SpawnPoint)3 MapleInventory (client.inventory.MapleInventory)2 IOException (java.io.IOException)2 UnknownHostException (java.net.UnknownHostException)2 SQLException (java.sql.SQLException)2 MaplePortal (server.MaplePortal)2