Search in sources :

Example 1 with PlayerStorage

use of net.server.PlayerStorage in project HeavenMS by ronancpl.

the class World method updateBuddies.

private void updateBuddies(int characterId, int channel, int[] buddies, boolean offline) {
    PlayerStorage playerStorage = getPlayerStorage();
    for (int buddy : buddies) {
        MapleCharacter chr = playerStorage.getCharacterById(buddy);
        if (chr != null) {
            BuddylistEntry ble = chr.getBuddylist().get(characterId);
            if (ble != null && ble.isVisible()) {
                int mcChannel;
                if (offline) {
                    ble.setChannel((byte) -1);
                    mcChannel = -1;
                } else {
                    ble.setChannel(channel);
                    mcChannel = (byte) (channel - 1);
                }
                chr.getBuddylist().put(ble);
                chr.getClient().announce(MaplePacketCreator.updateBuddyChannel(ble.getCharacterId(), mcChannel));
            }
        }
    }
}
Also used : MapleCharacter(client.MapleCharacter) BuddylistEntry(client.BuddylistEntry) PlayerStorage(net.server.PlayerStorage)

Example 2 with PlayerStorage

use of net.server.PlayerStorage in project HeavenMS by ronancpl.

the class Channel method multiBuddyFind.

public int[] multiBuddyFind(int charIdFrom, int[] characterIds) {
    List<Integer> ret = new ArrayList<>(characterIds.length);
    PlayerStorage playerStorage = getPlayerStorage();
    for (int characterId : characterIds) {
        MapleCharacter chr = playerStorage.getCharacterById(characterId);
        if (chr != null) {
            if (chr.getBuddylist().containsVisible(charIdFrom)) {
                ret.add(characterId);
            }
        }
    }
    int[] retArr = new int[ret.size()];
    int pos = 0;
    for (Integer i : ret) {
        retArr[pos++] = i.intValue();
    }
    return retArr;
}
Also used : MapleCharacter(client.MapleCharacter) ArrayList(java.util.ArrayList) PlayerStorage(net.server.PlayerStorage)

Aggregations

MapleCharacter (client.MapleCharacter)2 PlayerStorage (net.server.PlayerStorage)2 BuddylistEntry (client.BuddylistEntry)1 ArrayList (java.util.ArrayList)1