Search in sources :

Example 16 with MaplePartyCharacter

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);
        }
    }
}
Also used : MapleDoorObject(server.maps.MapleDoorObject) ArrayList(java.util.ArrayList) MaplePartyCharacter(net.server.world.MaplePartyCharacter) MapleDoor(server.maps.MapleDoor)

Aggregations

MaplePartyCharacter (net.server.world.MaplePartyCharacter)16 MapleCharacter (client.MapleCharacter)6 Point (java.awt.Point)6 MapleParty (net.server.world.MapleParty)6 ArrayList (java.util.ArrayList)4 LinkedList (java.util.LinkedList)4 World (net.server.world.World)4 MapleMap (server.maps.MapleMap)4 Pair (tools.Pair)4 SQLException (java.sql.SQLException)3 MapleDoor (server.maps.MapleDoor)3 Item (client.inventory.Item)2 MaplePet (client.inventory.MaplePet)2 Server (net.server.Server)2 MapleGuild (net.server.guild.MapleGuild)2 MapleGuildCharacter (net.server.guild.MapleGuildCharacter)2 MapleMapFactory (server.maps.MapleMapFactory)2 MapleMapItem (server.maps.MapleMapItem)2 BuddylistEntry (client.BuddylistEntry)1 CharacterNameAndId (client.CharacterNameAndId)1