Search in sources :

Example 11 with MapleGuild

use of net.server.guild.MapleGuild in project HeavenMS by ronancpl.

the class World method reloadGuildSummary.

public void reloadGuildSummary() {
    MapleGuild g;
    Server server = Server.getInstance();
    for (int i : gsStore.keySet()) {
        g = server.getGuild(i, getId(), null);
        if (g != null) {
            gsStore.put(i, new MapleGuildSummary(g));
        } else {
            gsStore.remove(i);
        }
    }
}
Also used : MapleGuildSummary(net.server.guild.MapleGuildSummary) Server(net.server.Server) MapleGuild(net.server.guild.MapleGuild)

Example 12 with MapleGuild

use of net.server.guild.MapleGuild in project HeavenMS by ronancpl.

the class MaplePacketCreator method charInfo.

/**
 * @param chr
 * @param isSelf
 * @return
 */
public static byte[] charInfo(MapleCharacter chr) {
    // 3D 00 0A 43 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.CHAR_INFO.getValue());
    mplew.writeInt(chr.getId());
    mplew.write(chr.getLevel());
    mplew.writeShort(chr.getJob().getId());
    mplew.writeShort(chr.getFame());
    mplew.write(chr.getMarriageRing() != null ? 1 : 0);
    String guildName = "";
    String allianceName = "";
    if (chr.getGuildId() > 0) {
        MapleGuild mg = Server.getInstance().getGuild(chr.getGuildId());
        guildName = mg.getName();
        MapleAlliance alliance = Server.getInstance().getAlliance(chr.getGuild().getAllianceId());
        if (alliance != null) {
            allianceName = alliance.getName();
        }
    }
    mplew.writeMapleAsciiString(guildName);
    // does not seems to work
    mplew.writeMapleAsciiString(allianceName);
    mplew.write(0);
    MaplePet[] pets = chr.getPets();
    Item inv = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -114);
    for (int i = 0; i < 3; i++) {
        if (pets[i] != null) {
            mplew.write(pets[i].getUniqueId());
            // petid
            mplew.writeInt(pets[i].getItemId());
            mplew.writeMapleAsciiString(pets[i].getName());
            // pet level
            mplew.write(pets[i].getLevel());
            // pet closeness
            mplew.writeShort(pets[i].getCloseness());
            // pet fullness
            mplew.write(pets[i].getFullness());
            mplew.writeShort(0);
            mplew.writeInt(inv != null ? inv.getItemId() : 0);
        }
    }
    // end of pets
    mplew.write(0);
    // mounts can potentially crash the client if the player's level is not properly checked
    Item mount;
    if (chr.getMount() != null && (mount = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18)) != null && MapleItemInformationProvider.getInstance().getEquipStats(mount.getItemId()).get("reqLevel") <= chr.getLevel()) {
        // mount
        mplew.write(chr.getMount().getId());
        // level
        mplew.writeInt(chr.getMount().getLevel());
        // exp
        mplew.writeInt(chr.getMount().getExp());
        // tiredness
        mplew.writeInt(chr.getMount().getTiredness());
    } else {
        mplew.write(0);
    }
    mplew.write(chr.getCashShop().getWishList().size());
    for (int sn : chr.getCashShop().getWishList()) {
        mplew.writeInt(sn);
    }
    mplew.writeInt(chr.getMonsterBook().getBookLevel());
    mplew.writeInt(chr.getMonsterBook().getNormalCard());
    mplew.writeInt(chr.getMonsterBook().getSpecialCard());
    mplew.writeInt(chr.getMonsterBook().getTotalCards());
    mplew.writeInt(chr.getMonsterBookCover() > 0 ? MapleItemInformationProvider.getInstance().getCardMobId(chr.getMonsterBookCover()) : 0);
    Item medal = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -49);
    if (medal != null) {
        mplew.writeInt(medal.getItemId());
    } else {
        mplew.writeInt(0);
    }
    ArrayList<Short> medalQuests = new ArrayList<>();
    List<MapleQuestStatus> completed = chr.getCompletedQuests();
    for (MapleQuestStatus q : completed) {
        if (q.getQuest().getId() >= 29000) {
            // && q.getQuest().getId() <= 29923
            medalQuests.add(q.getQuest().getId());
        }
    }
    Collections.sort(medalQuests);
    mplew.writeShort(medalQuests.size());
    for (Short s : medalQuests) {
        mplew.writeShort(s);
    }
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter) ArrayList(java.util.ArrayList) Point(java.awt.Point) MapleMapItem(server.maps.MapleMapItem) SpecialCashItem(server.CashShop.SpecialCashItem) CashItem(server.CashShop.CashItem) Item(client.inventory.Item) MaplePlayerShopItem(server.maps.MaplePlayerShopItem) MapleShopItem(server.MapleShopItem) MapleGuild(net.server.guild.MapleGuild) MapleAlliance(net.server.guild.MapleAlliance) MaplePet(client.inventory.MaplePet) MapleQuestStatus(client.MapleQuestStatus)

Aggregations

MapleGuild (net.server.guild.MapleGuild)12 Server (net.server.Server)3 MapleAlliance (net.server.guild.MapleAlliance)3 MapleCharacter (client.MapleCharacter)2 MaplePet (client.inventory.MaplePet)2 Point (java.awt.Point)2 SQLException (java.sql.SQLException)2 MapleGuildCharacter (net.server.guild.MapleGuildCharacter)2 MapleGuildSummary (net.server.guild.MapleGuildSummary)2 MaplePartyCharacter (net.server.world.MaplePartyCharacter)2 World (net.server.world.World)2 MaplePacketLittleEndianWriter (tools.data.output.MaplePacketLittleEndianWriter)2 BuddylistEntry (client.BuddylistEntry)1 CharacterNameAndId (client.CharacterNameAndId)1 MapleFamily (client.MapleFamily)1 MapleQuestStatus (client.MapleQuestStatus)1 Item (client.inventory.Item)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 ArrayList (java.util.ArrayList)1 PlayerBuffValueHolder (net.server.PlayerBuffValueHolder)1