L2SkillSignet.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.util.Point3D;
  29. public final class L2SkillSignet extends L2Skill
  30. {
  31. private int _effectNpcId;
  32. public int effectId;
  33. public L2SkillSignet(StatsSet set)
  34. {
  35. super(set);
  36. _effectNpcId = set.getInteger("effectNpcId", -1);
  37. effectId = set.getInteger("effectId", -1);
  38. }
  39. @Override
  40. public void useSkill(L2Character caster, L2Object[] targets)
  41. {
  42. if (caster.isAlikeDead())
  43. return;
  44. L2NpcTemplate template = NpcTable.getInstance().getTemplate(_effectNpcId);
  45. L2EffectPointInstance effectPoint = new L2EffectPointInstance(IdFactory.getInstance().getNextId(), template, caster);
  46. effectPoint.setCurrentHp(effectPoint.getMaxHp());
  47. effectPoint.setCurrentMp(effectPoint.getMaxMp());
  48. //L2World.getInstance().storeObject(effectPoint);
  49. int x = caster.getX();
  50. int y = caster.getY();
  51. int z = caster.getZ();
  52. if (caster instanceof L2PcInstance && getTargetType() == L2Skill.SkillTargetType.TARGET_GROUND)
  53. {
  54. Point3D wordPosition = ((L2PcInstance)caster).getCurrentSkillWorldPosition();
  55. if (wordPosition != null)
  56. {
  57. x = wordPosition.getX();
  58. y = wordPosition.getY();
  59. z = wordPosition.getZ();
  60. }
  61. }
  62. getEffects(caster, effectPoint);
  63. effectPoint.setIsInvul(true);
  64. effectPoint.spawnMe(x, y, z);
  65. }
  66. }