Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Diferente Efecto Mana Potion en PvP

Iniciado por Swarlog, Ago 19, 2022, 01:05 AM

Tema anterior - Siguiente tema

Swarlog

    Index: data/scripts/handlers/itemhandlers/ManaPotion.java
    ===================================================================
    --- data/scripts/handlers/itemhandlers/ManaPotion.java  (revision 408)
    +++ data/scripts/handlers/itemhandlers/ManaPotion.java  (working copy)
    @@ -3,7 +3,7 @@
      * the terms of the GNU General Public License as published by the Free Software
      * Foundation, either version 3 of the License, or (at your option) any later
      * version.
    - *
    + *
      * This program is distributed in the hope that it will be useful, but WITHOUT
      * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    @@ -8,10 +8,11 @@
      * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
      * details.
    - *
    + *
      * You should have received a copy of the GNU General Public License along with
      * this program. If not, see <http://www.gnu.org/licenses/>.
      */
    +
     package handlers.itemhandlers;
     
     import com.l2jserver.Config;
    @@ -17,6 +18,9 @@
     import com.l2jserver.Config;
     import com.l2jserver.gameserver.model.L2ItemInstance;
     import com.l2jserver.gameserver.model.actor.L2Playable;
    +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
    +import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
    +import com.l2jserver.gameserver.model.entity.TvTEvent;
     import com.l2jserver.gameserver.network.SystemMessageId;
     import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
     
    @@ -23,7 +27,7 @@
     public class ManaPotion extends ItemSkills
     {
        /**
    -    *
    +    *
         * @see com.l2jserver.gameserver.handler.IItemHandler#useItem(com.l2jserver.gameserver.model.actor.L2Playable, com.l2jserver.gameserver.model.L2ItemInstance, boolean)
         */
        @Override
    @@ -29,6 +33,14 @@
        @Override
        public void useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
        {
    +       L2PcInstance activeChar = (L2PcInstance) playable;
    +       boolean isPet = playable instanceof L2PetInstance;
    +       if (isPet)
    +           activeChar = ((L2PetInstance) playable).getOwner();
    +       else if (playable instanceof L2PcInstance)
    +           activeChar = (L2PcInstance) playable;
    +       else
    +           return;
            if (!Config.L2JMOD_ENABLE_MANA_POTIONS_SUPPORT)
            {
                playable.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOTHING_HAPPENED));
    @@ -34,6 +46,19 @@
                playable.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOTHING_HAPPENED));
                return;
            }
    +       else if (activeChar.isInOlympiadMode() || !TvTEvent.onScrollUse(playable.getObjectId()))
    +       {
    +           return;
    +       }
    +       else if (item.getItemId() == 728 && item.getCount() > 0)
    +       {
    +           if (playable.getPvpFlag() < 1)
    +           {
    +               double aux = playable.getCurrentMp();
    +               playable.setCurrentMp(playable.getCurrentMp() + 800);
    +               playable.sendMessage((playable.getCurrentMp() - aux) + "Mana Bonus restored[Not Flaged]");
    +           }
    +       }
            super.useItem(playable, item, forceUse);
        }
    -}
    \ No newline at end of file
    +}