Search in sources :

Example 1 with SkillEntry

use of client.MapleCharacter.SkillEntry in project HeavenMS by ronancpl.

the class MaplePacketCreator method addSkillInfo.

private static void addSkillInfo(final MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
    // start of skills
    mplew.write(0);
    Map<Skill, MapleCharacter.SkillEntry> skills = chr.getSkills();
    int skillsSize = skills.size();
    // We don't want to include any hidden skill in this, so subtract them from the size list and ignore them.
    for (Iterator<Entry<Skill, SkillEntry>> it = skills.entrySet().iterator(); it.hasNext(); ) {
        Entry<Skill, MapleCharacter.SkillEntry> skill = it.next();
        if (GameConstants.isHiddenSkills(skill.getKey().getId())) {
            skillsSize--;
        }
    }
    mplew.writeShort(skillsSize);
    for (Iterator<Entry<Skill, SkillEntry>> it = skills.entrySet().iterator(); it.hasNext(); ) {
        Entry<Skill, MapleCharacter.SkillEntry> skill = it.next();
        if (GameConstants.isHiddenSkills(skill.getKey().getId())) {
            continue;
        }
        mplew.writeInt(skill.getKey().getId());
        mplew.writeInt(skill.getValue().skillevel);
        addExpirationTime(mplew, skill.getValue().expiration);
        if (skill.getKey().isFourthJob()) {
            mplew.writeInt(skill.getValue().masterlevel);
        }
    }
    mplew.writeShort(chr.getAllCooldowns().size());
    for (PlayerCoolDownValueHolder cooling : chr.getAllCooldowns()) {
        mplew.writeInt(cooling.skillId);
        int timeLeft = (int) (cooling.length + cooling.startTime - System.currentTimeMillis());
        mplew.writeShort(timeLeft / 1000);
    }
}
Also used : SkillEntry(client.MapleCharacter.SkillEntry) Skill(client.Skill) MobSkill(server.life.MobSkill) SkillEntry(client.MapleCharacter.SkillEntry) SummonAttackEntry(net.server.channel.handlers.SummonDamageHandler.SummonAttackEntry) Entry(java.util.Map.Entry) MapleFamilyEntry(client.MapleFamilyEntry) BuddylistEntry(client.BuddylistEntry) PlayerCoolDownValueHolder(net.server.PlayerCoolDownValueHolder) Point(java.awt.Point)

Aggregations

BuddylistEntry (client.BuddylistEntry)1 SkillEntry (client.MapleCharacter.SkillEntry)1 MapleFamilyEntry (client.MapleFamilyEntry)1 Skill (client.Skill)1 Point (java.awt.Point)1 Entry (java.util.Map.Entry)1 PlayerCoolDownValueHolder (net.server.PlayerCoolDownValueHolder)1 SummonAttackEntry (net.server.channel.handlers.SummonDamageHandler.SummonAttackEntry)1 MobSkill (server.life.MobSkill)1