L2SkillSignet.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. /**
  16. * @author Forsaiken
  17. */
  18. package com.l2jserver.gameserver.skills.l2skills;
  19. import com.l2jserver.gameserver.datatables.NpcTable;
  20. import com.l2jserver.gameserver.idfactory.IdFactory;
  21. import com.l2jserver.gameserver.model.L2Object;
  22. import com.l2jserver.gameserver.model.L2Skill;
  23. import com.l2jserver.gameserver.model.actor.L2Character;
  24. import com.l2jserver.gameserver.model.actor.instance.L2EffectPointInstance;
  25. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  26. import com.l2jserver.gameserver.templates.StatsSet;
  27. import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
  28. import com.l2jserver.gameserver.templates.skills.L2TargetType;
  29. import com.l2jserver.gameserver.util.Point3D;
  30. public final class L2SkillSignet extends L2Skill
  31. {
  32. private int _effectNpcId;
  33. public int effectId;
  34. public L2SkillSignet(StatsSet set)
  35. {
  36. super(set);
  37. _effectNpcId = set.getInteger("effectNpcId", -1);
  38. effectId = set.getInteger("effectId", -1);
  39. }
  40. @Override
  41. public void useSkill(L2Character caster, L2Object[] targets)
  42. {
  43. if (caster.isAlikeDead())
  44. return;
  45. L2NpcTemplate template = NpcTable.getInstance().getTemplate(_effectNpcId);
  46. L2EffectPointInstance effectPoint = new L2EffectPointInstance(IdFactory.getInstance().getNextId(), template, caster);
  47. effectPoint.setCurrentHp(effectPoint.getMaxHp());
  48. effectPoint.setCurrentMp(effectPoint.getMaxMp());
  49. //L2World.getInstance().storeObject(effectPoint);
  50. int x = caster.getX();
  51. int y = caster.getY();
  52. int z = caster.getZ();
  53. if (caster instanceof L2PcInstance && getTargetType() == L2TargetType.TARGET_GROUND)
  54. {
  55. Point3D wordPosition = ((L2PcInstance)caster).getCurrentSkillWorldPosition();
  56. if (wordPosition != null)
  57. {
  58. x = wordPosition.getX();
  59. y = wordPosition.getY();
  60. z = wordPosition.getZ();
  61. }
  62. }
  63. getEffects(caster, effectPoint);
  64. effectPoint.setIsInvul(true);
  65. effectPoint.spawnMe(x, y, z);
  66. }
  67. }