Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.83 KB | None | 0 0
  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.network.serverpackets;
  16.  
  17. import net.sf.l2j.gameserver.model.L2Character;
  18.  
  19. /**
  20.  * sample 0000: 5a d8 a8 10 48 d8 a8 10 48 10 04 00 00 01 00 00 Z...H...H....... 0010: 00 f0 1a 00 00 68 28 00 00 .....h(.. format dddddd dddh (h)
  21.  * @version $Revision: 1.4.2.1.2.4 $ $Date: 2005/03/27 15:29:39 $
  22.  */
  23. public class MagicSkillUse extends L2GameServerPacket
  24. {
  25.     private static final String _S__5A_MAGICSKILLUSER = "[S] 5A MagicSkillUse";
  26.     private final int _targetId;
  27.     private int _skillId;
  28.     private final int _skillLevel;
  29.     private final int _hitTime;
  30.     private final int _reuseDelay;
  31.     private final int _chaId, _x, _y, _z;
  32.     private final boolean _crit;
  33.  
  34.     public MagicSkillUse(L2Character cha, L2Character target, int skillId, int skillLevel, int hitTime, int reuseDelay)
  35.     {
  36.         this(cha, target, skillId, skillLevel, hitTime, reuseDelay, false);
  37.     }
  38.  
  39.     public MagicSkillUse(L2Character cha, L2Character target, int skillId, int skillLevel, int hitTime, int reuseDelay, boolean crit)
  40.     {
  41.         _chaId = cha.getObjectId();
  42.         _targetId = target.getObjectId();
  43.  
  44.         // Fake death client fix
  45.         if (skillId == 60)
  46.         {
  47.             _skillId = 8;
  48.         }
  49.         else
  50.         {
  51.             _skillId = skillId;
  52.         }
  53.  
  54.         _skillLevel = skillLevel;
  55.         _hitTime = hitTime;
  56.         _reuseDelay = reuseDelay;
  57.         _x = cha.getX();
  58.         _y = cha.getY();
  59.         _z = cha.getZ();
  60.         _crit = crit;
  61.     }
  62.  
  63.     public MagicSkillUse(L2Character cha, int skillId, int skillLevel, int hitTime, int reuseDelay)
  64.     {
  65.         _chaId = cha.getObjectId();
  66.         _targetId = _chaId;
  67.         _skillId = skillId;
  68.         _skillLevel = skillLevel;
  69.         _hitTime = hitTime;
  70.         _reuseDelay = reuseDelay;
  71.         _x = cha.getX();
  72.         _y = cha.getY();
  73.         _z = cha.getZ();
  74.         _crit = false;
  75.     }
  76.  
  77.     @Override
  78.     protected final void writeImpl()
  79.     {
  80.         writeC(0x48);
  81.         writeD(_chaId);
  82.         writeD(_targetId);
  83.         writeD(_skillId);
  84.         writeD(_skillLevel);
  85.         writeD(_hitTime);
  86.         writeD(_reuseDelay);
  87.         writeD(_x);
  88.         writeD(_y);
  89.         writeD(_z);
  90.  
  91.         // Critical Attack Sound & Animation
  92.         writeD(_crit ? 0x01 : 0x00);
  93.     }
  94.  
  95.     /*
  96.      * (non-Javadoc)
  97.      * @see net.sf.l2j.gameserver.serverpackets.L2GameServerPacket#getType()
  98.      */
  99.     @Override
  100.     public String getType()
  101.     {
  102.         return _S__5A_MAGICSKILLUSER;
  103.     }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement