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);
}
}
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();
}
}
}
}
}
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()));
}
Aggregations