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);
}
}
Aggregations