GMViewSkillInfo.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package net.sf.l2j.gameserver.serverpackets;
  16. import net.sf.l2j.gameserver.model.L2Skill;
  17. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  18. public class GMViewSkillInfo extends L2GameServerPacket
  19. {
  20. private static final String _S__91_GMViewSkillInfo = "[S] 97 GMViewSkillInfo";
  21. private L2PcInstance _activeChar;
  22. private L2Skill[] _skills;
  23. public GMViewSkillInfo (L2PcInstance cha)
  24. {
  25. _activeChar = cha;
  26. _skills = _activeChar.getAllSkills();
  27. if (_skills.length == 0)
  28. _skills = new L2Skill[0];
  29. }
  30. @Override
  31. protected final void writeImpl()
  32. {
  33. writeC(0x97);
  34. writeS(_activeChar.getName());
  35. writeD(_skills.length);
  36. for (int i = 0; i < _skills.length; i++)
  37. {
  38. L2Skill skill = _skills[i];
  39. writeD(skill.isPassive() ? 1 : 0);
  40. writeD(skill.getLevel());
  41. writeD(skill.getId());
  42. writeC(0x00); //c5
  43. }
  44. }
  45. /* (non-Javadoc)
  46. * @see net.sf.l2j.gameserver.serverpackets.ServerBasePacket#getType()
  47. */
  48. @Override
  49. public String getType()
  50. {
  51. return _S__91_GMViewSkillInfo;
  52. }
  53. }