Search in sources :

Example 16 with World

use of net.server.world.World in project HeavenMS by ronancpl.

the class PartyOperationHandler method leaveParty.

public static void leaveParty(MapleParty party, MaplePartyCharacter partyplayer, MapleClient c) {
    World world = c.getWorldServer();
    MapleCharacter player = c.getPlayer();
    if (party != null && partyplayer != null) {
        if (partyplayer.getId() == party.getLeaderId()) {
            c.getWorldServer().removeMapPartyMembers(party.getId());
            world.updateParty(party.getId(), PartyOperation.DISBAND, partyplayer);
            if (player.getEventInstance() != null) {
                player.getEventInstance().disbandParty();
            }
        } else {
            player.getMap().removePartyMember(player);
            world.updateParty(party.getId(), PartyOperation.LEAVE, partyplayer);
            if (player.getEventInstance() != null) {
                player.getEventInstance().leftParty(player);
            }
        }
        player.setParty(null);
    }
}
Also used : MapleCharacter(client.MapleCharacter) World(net.server.world.World)

Example 17 with World

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

Example 18 with World

use of net.server.world.World in project HeavenMS by ronancpl.

the class ServerlistRequestHandler method handlePacket.

@Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
    Server server = Server.getInstance();
    for (World world : server.getWorlds()) {
        c.announce(MaplePacketCreator.getServerList(world.getId(), ServerConstants.WORLD_NAMES[world.getId()], world.getFlag(), world.getEventMessage(), world.getChannels()));
    }
    c.announce(MaplePacketCreator.getEndOfServerList());
    // too lazy to make a check lol
    c.announce(MaplePacketCreator.selectWorld(0));
    c.announce(MaplePacketCreator.sendRecommended(server.worldRecommendedList()));
}
Also used : Server(net.server.Server) World(net.server.world.World)

Aggregations

World (net.server.world.World)18 MapleCharacter (client.MapleCharacter)10 SQLException (java.sql.SQLException)5 Server (net.server.Server)4 MapleMessengerCharacter (net.server.world.MapleMessengerCharacter)4 MaplePartyCharacter (net.server.world.MaplePartyCharacter)4 Connection (java.sql.Connection)3 PreparedStatement (java.sql.PreparedStatement)3 Channel (net.server.channel.Channel)3 MapleParty (net.server.world.MapleParty)3 DatabaseConnection (tools.DatabaseConnection)3 BuddylistEntry (client.BuddylistEntry)2 ResultSet (java.sql.ResultSet)2 MapleGuild (net.server.guild.MapleGuild)2 MapleMessenger (net.server.world.MapleMessenger)2 MapleMap (server.maps.MapleMap)2 BuddyList (client.BuddyList)1 BuddyAddResult (client.BuddyList.BuddyAddResult)1 CharacterNameAndId (client.CharacterNameAndId)1 MapleFamily (client.MapleFamily)1