L2SkillAppearance.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 com.l2jserver.gameserver.skills.l2skills;
  16. import java.util.logging.Level;
  17. import com.l2jserver.gameserver.model.L2Object;
  18. import com.l2jserver.gameserver.model.L2Skill;
  19. import com.l2jserver.gameserver.model.StatsSet;
  20. import com.l2jserver.gameserver.model.actor.L2Character;
  21. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  22. public class L2SkillAppearance extends L2Skill
  23. {
  24. private final int _faceId;
  25. private final int _hairColorId;
  26. private final int _hairStyleId;
  27. public L2SkillAppearance(StatsSet set)
  28. {
  29. super(set);
  30. _faceId = set.getInteger("faceId", -1);
  31. _hairColorId = set.getInteger("hairColorId", -1);
  32. _hairStyleId = set.getInteger("hairStyleId", -1);
  33. }
  34. @Override
  35. public void useSkill(L2Character caster, L2Object[] targets)
  36. {
  37. try
  38. {
  39. for (L2Object target : targets)
  40. {
  41. if (target instanceof L2PcInstance)
  42. {
  43. L2PcInstance targetPlayer = (L2PcInstance)target;
  44. if (_faceId >= 0)
  45. targetPlayer.getAppearance().setFace(_faceId);
  46. if (_hairColorId >= 0)
  47. targetPlayer.getAppearance().setHairColor(_hairColorId);
  48. if (_hairStyleId >= 0)
  49. targetPlayer.getAppearance().setHairStyle(_hairStyleId);
  50. targetPlayer.broadcastUserInfo();
  51. }
  52. }
  53. }
  54. catch (Exception e)
  55. {
  56. _log.log(Level.SEVERE, "", e);
  57. }
  58. }
  59. }