Donate Scrolls

Deversant

Знаменитый
Участник
Сообщения
19
Розыгрыши
0
Репутация
4
Реакции
6
Баллы
1 285
Хроники
  1. Interlude
Исходники
Присутствуют
Сборка
ACIS 38x
Java:
package ru.la2betdream.gameserver.handler.itemhandlers;

import ru.la2betdream.gameserver.data.SkillTable;
import ru.la2betdream.gameserver.handler.IItemHandler;
import ru.la2betdream.gameserver.model.actor.Playable;
import ru.la2betdream.gameserver.model.actor.Player;
import ru.la2betdream.gameserver.model.item.instance.ItemInstance;
import ru.la2betdream.gameserver.network.SystemMessageId;
import ru.la2betdream.gameserver.network.serverpackets.MagicSkillUse;

import java.util.logging.Logger;

public class DonateScrolls implements IItemHandler {

    private final static Logger LOGGER = Logger.getLogger(DonateScrolls.class.getName());

    //итем ид, скилл ид, скилл лвл, ид анимации, продолжительность анимации
    private static int[][] ITEMS= {
            {11469, 11510, 1, 7038, 1},
            {11470, 11510, 2, 7038, 1},
            {11471, 11510, 3, 7038, 1},
            {11472, 11510, 4, 7038, 1},
            {11473, 11510, 5, 7038, 1},

            {11474, 11515, 1, 7038, 1},
            {11475, 11515, 2, 7038, 1},
            {11476, 11515, 3, 7038, 1},
            {11477, 11515, 4, 7038, 1},
            {11478, 11515, 5, 7038, 1},

            {11479, 11520, 1, 7038, 1},
            {11480, 11520, 2, 7038, 1},
            {11481, 11520, 3, 7038, 1},
            {11482, 11520, 4, 7038, 1},
            {11483, 11520, 5, 7038, 1},

            {11484, 11525, 1, 7038, 1},
            {11485, 11525, 2, 7038, 1},
            {11486, 11525, 3, 7038, 1},
            {11487, 11525, 4, 7038, 1},
            {11488, 11525, 5, 7038, 1},

            {11489, 11530, 1, 7038, 1},
            {11490, 11530, 2, 7038, 1},
            {11491, 11530, 3, 7038, 1},
            {11492, 11530, 4, 7038, 1},
            {11493, 11530, 5, 7038, 1},

            {11494, 11535, 1, 7038, 1},
            {11495, 11535, 2, 7038, 1},
            {11496, 11535, 3, 7038, 1},
            {11497, 11535, 4, 7038, 1},
            {11498, 11535, 5, 7038, 1},

            {11499, 11540, 1, 7038, 1},
            {11500, 11540, 2, 7038, 1},
            {11501, 11540, 3, 7038, 1},
            {11502, 11540, 4, 7038, 1},
            {11503, 11540, 5, 7038, 1},
    };

    public DonateScrolls()
    {
        LOGGER.info("Загружаем скрипт: " + DonateScrolls.class.getName());
    }

    @Override
    public void useItem(Playable playable, ItemInstance itemInstance, boolean b)
    {
        Player player = (Player) playable;
        if (player == null)
            return;
        if (player.isAllSkillsDisabled())
        {
            player.sendMessage("");
            return;
        }

        if (player.isInOlympiadMode())
        {
            player.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
            player.sendMessage("");
            return;
        }

        int[] arr = new int[4];
        for (int[] i : ITEMS)
        {
            if (itemInstance.getItemId() == i[0])
                arr = i;
        }
        if (arr[0] == 0)
            return;
        player.stopSkillEffects(arr[1]);
        SkillTable.getInstance().getInfo(arr[1], arr[2]).getEffects(player, player);
        player.broadcastPacket(new MagicSkillUse(player, player, arr[3], 1, arr[4], 0));
    }
}

XML:
============== XML Item ============================================

    <item id="11469" type="EtcItem" name="MIGHT1">
        <set name="default_action" val="capsule" />
        <set name="material" val="PAPER" />
        <set name="weight" val="100" />
        <set name="is_stackable" val="true" />
        <set name="is_oly_restricted" val="true" />
        <set name="handler" val="DonateScrolls" />
        <!-- <set name="item_skill" val="11510-1" /> -->
    </item>
    
============= XML SKILL =============================================

    <skill id="11510" levels="5" name="MIGHT">
        <set name="magicLvl" val="60" />
        <table name="#power"> 1.04 1.08 1.12 1.16 1.2 </table>
        <set name="target" val="ONE" />
        <set name="skillType" val="BUFF" />
        <set name="isMagic" val="true" />
        <set name="operateType" val="ACTIVE" />
        <set name="castRange" val="400" />
        <set name="effectRange" val="900" />
        <for>
            <effect name="Buff" time="600" count="1" val="0">
            <mul order="0x30" stat="pAtk" val="#power"/>
            </effect>
        </for>
    </skill>

======================================================================
 
Назад
Сверху Снизу