Search in sources :

Example 11 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method getShowMesoGain.

/**
 * Gets a packet telling the client to show a meso gain.
 *
 * @param gain How many mesos gained.
 * @param inChat Show in the chat window?
 * @return The meso gain packet.
 */
public static byte[] getShowMesoGain(int gain, boolean inChat) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.SHOW_STATUS_INFO.getValue());
    if (!inChat) {
        mplew.write(0);
        // v83
        mplew.writeShort(1);
    } else {
        mplew.write(5);
    }
    mplew.writeInt(gain);
    mplew.writeShort(0);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 12 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method applyMonsterStatus.

public static byte[] applyMonsterStatus(final int oid, final MonsterStatusEffect mse, final List<Integer> reflection) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.APPLY_MONSTER_STATUS.getValue());
    mplew.writeInt(oid);
    mplew.writeLong(0);
    writeIntMask(mplew, mse.getStati());
    for (Map.Entry<MonsterStatus, Integer> stat : mse.getStati().entrySet()) {
        mplew.writeShort(stat.getValue());
        if (mse.isMonsterSkill()) {
            mplew.writeShort(mse.getMobSkill().getSkillId());
            mplew.writeShort(mse.getMobSkill().getSkillLevel());
        } else {
            mplew.writeInt(mse.getSkill().getId());
        }
        // might actually be the buffTime but it's not displayed anywhere
        mplew.writeShort(-1);
    }
    // size
    int size = mse.getStati().size();
    if (reflection != null) {
        for (Integer ref : reflection) {
            mplew.writeInt(ref);
        }
        if (reflection.size() > 0) {
            // This gives 2 buffs per reflection but it's really one buff
            size /= 2;
        }
    }
    // size
    mplew.write(size);
    mplew.writeInt(0);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter) MonsterStatus(client.status.MonsterStatus) MapleMap(server.maps.MapleMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) Point(java.awt.Point)

Example 13 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method spawnMist.

public static byte[] spawnMist(int oid, int ownerCid, int skill, int level, MapleMist mist) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.SPAWN_MIST.getValue());
    mplew.writeInt(oid);
    // mob mist = 0, player poison = 1, smokescreen = 2, unknown = 3, recovery = 4
    mplew.writeInt(mist.isMobMist() ? 0 : mist.isPoisonMist() ? 1 : mist.isRecoveryMist() ? 4 : 2);
    mplew.writeInt(ownerCid);
    mplew.writeInt(skill);
    mplew.write(level);
    // Skill delay
    mplew.writeShort(mist.getSkillDelay());
    mplew.writeInt(mist.getBox().x);
    mplew.writeInt(mist.getBox().y);
    mplew.writeInt(mist.getBox().x + mist.getBox().width);
    mplew.writeInt(mist.getBox().y + mist.getBox().height);
    mplew.writeInt(0);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 14 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method removeSummon.

/**
 * Gets a packet to remove a special map object.
 *
 * @param summon
 * @param animated Animated removal?
 * @return The packet removing the object.
 */
public static byte[] removeSummon(MapleSummon summon, boolean animated) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(11);
    mplew.writeShort(SendOpcode.REMOVE_SPECIAL_MAPOBJECT.getValue());
    mplew.writeInt(summon.getOwner().getId());
    mplew.writeInt(summon.getObjectId());
    // ?
    mplew.write(animated ? 4 : 1);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 15 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method getMatchCardNewVisitor.

public static byte[] getMatchCardNewVisitor(MapleCharacter c, int slot) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.PLAYER_INTERACTION.getValue());
    mplew.write(PlayerInteractionHandler.Action.VISIT.getCode());
    mplew.write(slot);
    addCharLook(mplew, c, false);
    mplew.writeMapleAsciiString(c.getName());
    mplew.writeInt(1);
    mplew.writeInt(c.getMiniGamePoints("wins", false));
    mplew.writeInt(c.getMiniGamePoints("ties", false));
    mplew.writeInt(c.getMiniGamePoints("losses", false));
    mplew.writeInt(2000);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Aggregations

MaplePacketLittleEndianWriter (tools.data.output.MaplePacketLittleEndianWriter)431 Point (java.awt.Point)44 MaplePlayerShopItem (server.maps.MaplePlayerShopItem)15 Item (client.inventory.Item)11 SpecialCashItem (server.CashShop.SpecialCashItem)11 MapleShopItem (server.MapleShopItem)11 MapleMapItem (server.maps.MapleMapItem)11 CashItem (server.CashShop.CashItem)10 MapleCharacter (client.MapleCharacter)8 MapleBuffStat (client.MapleBuffStat)4 MaplePet (client.inventory.MaplePet)3 MTSItemInfo (server.MTSItemInfo)3 MapleDisease (client.MapleDisease)2 SQLException (java.sql.SQLException)2 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 Channel (net.server.channel.Channel)2 MapleGuild (net.server.guild.MapleGuild)2 MapleMonster (server.life.MapleMonster)2 BuddylistEntry (client.BuddylistEntry)1