Нужна помощь с итемом

Razox

Путник
Пользователь
Сообщения
61
Розыгрыши
0
Репутация
-30
Реакции
335
Баллы
0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE list SYSTEM "item.dtd">
<list>
<etcitem id="24100" name="Buff">
<set name="reuse_delay" value="3000"/>
<set name="class" value="CONSUMABLE"/>
<set name="crystal_type" value="NONE"/>
<set name="dropable" value="false"/>
<set name="icon" value="Potion.Elements.icon_3"/>
<set name="price" value="75000"/>
<set name="stackable" value="true"/>
<set name="tradeable" value="false"/>
<set name="type" value="POTION"/>
<set name="weight" value="5"/>
<cond msgId="1508">
<not>
<player olympiad="true"/>
</not>
</cond>
</etcitem>
</list>

package handler.items;

import l2p.gameserver.handler.items.ItemHandler;
import l2p.gameserver.model.Playable;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.items.ItemInstance;
import l2p.gameserver.serverpackets.MagicSkillUse;
import l2p.gameserver.serverpackets.SystemMessage;
import l2p.gameserver.tables.SkillTable;
import l2p.gameserver.scripts.ScriptFile;

public class Cocktails extends SimpleItemHandler implements ScriptFile {

private static final int[] ITEM_IDS = new int[]{24100};

@Override
public int[] getItemIds() {
return ITEM_IDS;
}

@Override
public boolean pickupItem(Playable playable, ItemInstance item) {
return true;
}

@Override
public void onLoad() {
ItemHandler.getInstance().registerItemHandler(this);
}

@Override
public void onReload() {
}

@Override
public void onShutdown() {
}

//new buff
private static final int[] newbufwar_list = {
1501, //Improved Condition
1499, //Improved Combat
1504, //Improved Movement
1503, //Improved Shield Defense
1035, //Mental Shield
1062, //Berserker Spirit
1036, //Magic Barrier
1259, //Resist Shock
1354, //Arcane Protection
1397, //Clarity
1352, //Elemental Protection
1353, //Divine Protection
1502, //Improved Critical Attack
1390, //War Chant
1519, //Chant of Blood Awakening
1388, //Greater Might
1240, //Guidance
1542, //Counter Critical
1363, //Chant of Victory
268, //Song of Wind
264, //Song of Earth
267, //Song of Warding
266, //Song of Water
304, //Song of Vitality
305, //Song of Vengeance
349, //Song of Renewal
269, //Song of Hunter
364, //Song of Champion
274, //Dance of Fire
272, //Dance of Inspiration
271, //Dance of Warrior
275, //Dance of Fury
310, //Dance of Vampire
915, //Dance of Berserker
4699, //Blessing of Queen
4700, //Gift of Queen

};

@Override
protected boolean useItemImpl(Player player, ItemInstance item, boolean ctrl) {
int itemId = item.getItemId();

if (player.isInOlympiadMode()) {
player.sendPacket(new SystemMessage(SystemMessage.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS).addItemName(itemId));
return false;
}

if (!useItem(player, item, 1)) {
return false;
}



switch (itemId) {


//new buff
case 24100:
for (int skill : newbufwar_list) {
player.broadcastPacket(new MagicSkillUse(player, player, skill, 1, 0, 0));
player.altOnMagicUseTimer(player, SkillTable.getInstance().getInfo(skill, 1));
}
break;

}
default:
return false;
}

return true;
}
}

Не могу понять как итему присвоить свое время бафа. 1 баф 30мин второй, 19мин, денсы сонги по 1мин.
как-то все в разноброс получилось.
 
L2J HF
Skill skill = SkillData.getInstance().getSkill(ИД, ЛЕВЕЛ);
skill.applyEffects(player, player, true, false, true, ВРЕМЯ);

/**
* Applies the effects from this skill to the target.
* @param effector the caster of the skill
* @param effected the target of the effect
* @param self if {@code true} self-effects will be casted on the caster
* @param passive if {@code true} passive effects will be applied to the effector
* @param instant if {@code true} instant effects will be applied to the effected
* @param abnormalTime custom abnormal time, if equal or lesser than zero will be ignored
*/
public void applyEffects(L2Character effector, L2Character effected, boolean self, boolean passive, boolean instant, int abnormalTime)
 
Назад
Сверху Снизу