07-30-2016, 08:44 AM
Привет.
Ребят, поправьте скрипт , что бы появилась анимация каста скиллов у нпц пж.
Или пример, остальные сам отредактирую (:.
package ai.npc.custom;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.holder.SkillHolder;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.skills.effects.Effect;
public class CustomBuffer extends Quest
{
// Npc
private static final int NPC = 100000;
// Html
private static final String HTML_PATH = "data/html/custom/buffer/";
// Buffs
private static final List<SkillHolder> DANCE = new ArrayList<>();
private static final List<SkillHolder> SONG = new ArrayList<>();
private static final List<SkillHolder> SPECIAL = new ArrayList<>();
private static final List<SkillHolder> BUFFS = new ArrayList<>();
private static final List<SkillHolder> RESIST = new ArrayList<>();
// DEBUG
private static final boolean DEBUG = false;
public CustomBuffer()
{
super(-1, CustomBuffer.class.getSimpleName(), "ai/npc/custom");
addStartNpc(NPC);
addFirstTalkId(NPC);
addTalkId(NPC);
// -------------------------------------------------------------- //
DANCE.add(new SkillHolder(271, 1));// Dance of the Warrior
DANCE.add(new SkillHolder(272, 1));// Dance of Inspiration
DANCE.add(new SkillHolder(273, 1));// Dance of Mystic
DANCE.add(new SkillHolder(274, 1));// Dance of Fire
DANCE.add(new SkillHolder(275, 1));// Dance of Fury
DANCE.add(new SkillHolder(276, 1));// Dance of Concentration
DANCE.add(new SkillHolder(277, 1));// Dance of Light
DANCE.add(new SkillHolder(307, 1));// Dance of Aqua Guard
DANCE.add(new SkillHolder(309, 1));// Dance of Earth Guard
DANCE.add(new SkillHolder(310, 1));// Dance of Vampire
DANCE.add(new SkillHolder(311, 1));// Dance of Protection
DANCE.add(new SkillHolder(365, 1));//Dance of Siren
// -------------------------------------------------------------- //
SONG.add(new SkillHolder(264, 1));// Song of Earth
SONG.add(new SkillHolder(265, 1));// Song of Life
SONG.add(new SkillHolder(266, 1));// Song of Water
SONG.add(new SkillHolder(267, 1));// Song of Warding
SONG.add(new SkillHolder(268, 1));// Song of Wind
SONG.add(new SkillHolder(269, 1));// Song of Hunter
SONG.add(new SkillHolder(270, 1));// Song of Invocation
SONG.add(new SkillHolder(304, 1));// Song of Vitality
SONG.add(new SkillHolder(305, 1));// Song of Vengeance
SONG.add(new SkillHolder(306, 1));// Song of Flame Guard
SONG.add(new SkillHolder(308, 1));// Song of Storm Guard
SONG.add(new SkillHolder(349, 1));// Song of Renewal
SONG.add(new SkillHolder(363, 1));// Song of Meditation
SONG.add(new SkillHolder(364, 1));// Song of Champion
// -------------------------------------------------------------- //
SPECIAL.add(new SkillHolder(1355, 1));// Prophecy of Water
SPECIAL.add(new SkillHolder(1356, 1));// Prophecy of Fire
SPECIAL.add(new SkillHolder(1357, 1));// Prophecy of Wind
SPECIAL.add(new SkillHolder(1363, 1));// Chant of Victory
SPECIAL.add(new SkillHolder(4699, 13));// Blessing of Queen
SPECIAL.add(new SkillHolder(4700, 13));// Gift of Queen
SPECIAL.add(new SkillHolder(4702, 13));// Blessing of Seraphim
SPECIAL.add(new SkillHolder(4703, 13));// Gift of Seraphim
SPECIAL.add(new SkillHolder(1323, 1));// Noblese Blessing
// -------------------------------------------------------------- //
BUFFS.add(new SkillHolder(1035, 4));// Mental Shield
BUFFS.add(new SkillHolder(1036, 2));// Magic Barrier
BUFFS.add(new SkillHolder(1040, 3));// Shield
BUFFS.add(new SkillHolder(1043, 1));// Holy Weapon
BUFFS.add(new SkillHolder(1044, 3));// Regeneration
BUFFS.add(new SkillHolder(1045, 6));// Blessed Body
BUFFS.add(new SkillHolder(1048, 6));// Blessed Soul
BUFFS.add(new SkillHolder(1059, 3));// Empower
BUFFS.add(new SkillHolder(1062, 2));// Berserker Spirit
BUFFS.add(new SkillHolder(1068, 3));// Might
BUFFS.add(new SkillHolder(1073, 2));// Kiss of Eva
BUFFS.add(new SkillHolder(1077, 3));// Focus
BUFFS.add(new SkillHolder(1078, 6));// Concentration
BUFFS.add(new SkillHolder(1085, 3));// Acumen
BUFFS.add(new SkillHolder(1086, 2));// Haste
BUFFS.add(new SkillHolder(1087, 3));// Agility
BUFFS.add(new SkillHolder(1203, 2));// Wind Walk
BUFFS.add(new SkillHolder(1240, 3));// Guidance
BUFFS.add(new SkillHolder(1242, 3));// Death Whisper
BUFFS.add(new SkillHolder(1243, 6));// Bless Shield
BUFFS.add(new SkillHolder(1257, 3));// Decrease Weight
BUFFS.add(new SkillHolder(1268, 4));// Vampiric Rage
BUFFS.add(new SkillHolder(1303, 1));// Wild Magic
BUFFS.add(new SkillHolder(1304, 3));// Advanced Block
// -------------------------------------------------------------- //
RESIST.add(new SkillHolder(1032, 3));// Invigor
RESIST.add(new SkillHolder(1033, 3));// Resist Poison
RESIST.add(new SkillHolder(1182, 3));// Resist Aqua
RESIST.add(new SkillHolder(1189, 3));// Resist Wind
RESIST.add(new SkillHolder(1191, 3));// Resist Fire
RESIST.add(new SkillHolder(1259, 4));// Resist Shock
RESIST.add(new SkillHolder(1352, 1));// Elemetal Protection
RESIST.add(new SkillHolder(1353, 1));// Divine Protection
RESIST.add(new SkillHolder(1354, 1));// Arcane Protection
// -------------------------------------------------------------- //
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return HTML_PATH + "index.htm";
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
StringTokenizer st = new StringTokenizer(event, " ");
event = st.nextToken();
switch (event)
{
case "cancel":
for (Effect e : player.getAllEffects())
{
e.exit();
}
break;
case "heal":
player.setCurrentHp(player.getMaxHp());
player.setCurrentCp(player.getMaxCp());
player.setCurrentMp(player.getMaxMp());
break;
case "dance":
if (st.hasMoreTokens())
{
DANCE.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, DANCE, event);
case "song":
if (st.hasMoreTokens())
{
SONG.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, SONG, event);
case "special":
if (st.hasMoreTokens())
{
SPECIAL.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, SPECIAL, event);
case "buff":
if (st.hasMoreTokens())
{
BUFFS.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, BUFFS, event);
case "resist":
if (st.hasMoreTokens())
{
RESIST.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, RESIST, event);
}
return null;
}
/**
* Generamos los html para cada lista de buff
* @param player
* @param list
* @param event
* @return
*/
private static String GenerateHtmlBuffs(L2PcInstance player, List<SkillHolder> list, String event)
{
StringBuilder sb = new StringBuilder();
sb.append("<html><body>");
sb.append("<center>");
sb.append("<br>");
sb.append("Welcome <font color=\"LEVEL\">" + player.getName() + "</font>");
sb.append("<br>");
int cont = 0;
for (SkillHolder skill : list)
{
if (skill.getSkill() == null)
{
if (DEBUG)
{
System.out.println("skill null >>" + event + "<< -- " + cont);
}
cont++;
continue;
}
sb.append("<table width=\"260\" height=\"36\">");
sb.append("<tr>");
sb.append("<td width=\"32\" height=\"32\"><img src=\"icon.skill" + getSkillIcon(skill.getSkillId()) + "\" width=\"32\" height=\"32\"></td>");
sb.append("<td align=center width=196 height=32><button value=\"" + skill.getSkill().getName() + "\" action=\"bypass -h Quest CustomBuffer " + event + " " + cont + "\" width=\"120\" height=\"30\" back=\"L2UI_CH3.bigbutton2_dow\"n fore=\"L2UI_CH3.bigbutton2\"></td>");
sb.append("<td width=\"32\" height=\"32\"><img src=\"icon.skill" + getSkillIcon(skill.getSkillId()) + "\" width=\"32\" height=\"32\"></td>");
sb.append("</tr>");
sb.append("</table>");
cont++;
}
sb.append("</center>");
sb.append("</body></html>");
return sb.toString();
}
/**
* Generamos el ID de la imagen de un skill a partir de su ID
* @param id
* @return
*/
private static String getSkillIcon(int id)
{
String formato = "";
if (id < 10)
{
formato = "000" + id;
}
else if (id < 100)
{
formato = "00" + id;
}
else if (id < 1000)
{
formato = "0" + id;
}
else if (id == 4699 || id == 4700)
{
formato = "1331";
}
else if (id == 4702 || id == 4703)
{
formato = "1332";
}
else
formato = String.valueOf(id);
return formato;
}
}
Или http://pastebin.com/ZqyVMMnm
Ребят, поправьте скрипт , что бы появилась анимация каста скиллов у нпц пж.
Или пример, остальные сам отредактирую (:.
код
package ai.npc.custom;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.holder.SkillHolder;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.skills.effects.Effect;
public class CustomBuffer extends Quest
{
// Npc
private static final int NPC = 100000;
// Html
private static final String HTML_PATH = "data/html/custom/buffer/";
// Buffs
private static final List<SkillHolder> DANCE = new ArrayList<>();
private static final List<SkillHolder> SONG = new ArrayList<>();
private static final List<SkillHolder> SPECIAL = new ArrayList<>();
private static final List<SkillHolder> BUFFS = new ArrayList<>();
private static final List<SkillHolder> RESIST = new ArrayList<>();
// DEBUG
private static final boolean DEBUG = false;
public CustomBuffer()
{
super(-1, CustomBuffer.class.getSimpleName(), "ai/npc/custom");
addStartNpc(NPC);
addFirstTalkId(NPC);
addTalkId(NPC);
// -------------------------------------------------------------- //
DANCE.add(new SkillHolder(271, 1));// Dance of the Warrior
DANCE.add(new SkillHolder(272, 1));// Dance of Inspiration
DANCE.add(new SkillHolder(273, 1));// Dance of Mystic
DANCE.add(new SkillHolder(274, 1));// Dance of Fire
DANCE.add(new SkillHolder(275, 1));// Dance of Fury
DANCE.add(new SkillHolder(276, 1));// Dance of Concentration
DANCE.add(new SkillHolder(277, 1));// Dance of Light
DANCE.add(new SkillHolder(307, 1));// Dance of Aqua Guard
DANCE.add(new SkillHolder(309, 1));// Dance of Earth Guard
DANCE.add(new SkillHolder(310, 1));// Dance of Vampire
DANCE.add(new SkillHolder(311, 1));// Dance of Protection
DANCE.add(new SkillHolder(365, 1));//Dance of Siren
// -------------------------------------------------------------- //
SONG.add(new SkillHolder(264, 1));// Song of Earth
SONG.add(new SkillHolder(265, 1));// Song of Life
SONG.add(new SkillHolder(266, 1));// Song of Water
SONG.add(new SkillHolder(267, 1));// Song of Warding
SONG.add(new SkillHolder(268, 1));// Song of Wind
SONG.add(new SkillHolder(269, 1));// Song of Hunter
SONG.add(new SkillHolder(270, 1));// Song of Invocation
SONG.add(new SkillHolder(304, 1));// Song of Vitality
SONG.add(new SkillHolder(305, 1));// Song of Vengeance
SONG.add(new SkillHolder(306, 1));// Song of Flame Guard
SONG.add(new SkillHolder(308, 1));// Song of Storm Guard
SONG.add(new SkillHolder(349, 1));// Song of Renewal
SONG.add(new SkillHolder(363, 1));// Song of Meditation
SONG.add(new SkillHolder(364, 1));// Song of Champion
// -------------------------------------------------------------- //
SPECIAL.add(new SkillHolder(1355, 1));// Prophecy of Water
SPECIAL.add(new SkillHolder(1356, 1));// Prophecy of Fire
SPECIAL.add(new SkillHolder(1357, 1));// Prophecy of Wind
SPECIAL.add(new SkillHolder(1363, 1));// Chant of Victory
SPECIAL.add(new SkillHolder(4699, 13));// Blessing of Queen
SPECIAL.add(new SkillHolder(4700, 13));// Gift of Queen
SPECIAL.add(new SkillHolder(4702, 13));// Blessing of Seraphim
SPECIAL.add(new SkillHolder(4703, 13));// Gift of Seraphim
SPECIAL.add(new SkillHolder(1323, 1));// Noblese Blessing
// -------------------------------------------------------------- //
BUFFS.add(new SkillHolder(1035, 4));// Mental Shield
BUFFS.add(new SkillHolder(1036, 2));// Magic Barrier
BUFFS.add(new SkillHolder(1040, 3));// Shield
BUFFS.add(new SkillHolder(1043, 1));// Holy Weapon
BUFFS.add(new SkillHolder(1044, 3));// Regeneration
BUFFS.add(new SkillHolder(1045, 6));// Blessed Body
BUFFS.add(new SkillHolder(1048, 6));// Blessed Soul
BUFFS.add(new SkillHolder(1059, 3));// Empower
BUFFS.add(new SkillHolder(1062, 2));// Berserker Spirit
BUFFS.add(new SkillHolder(1068, 3));// Might
BUFFS.add(new SkillHolder(1073, 2));// Kiss of Eva
BUFFS.add(new SkillHolder(1077, 3));// Focus
BUFFS.add(new SkillHolder(1078, 6));// Concentration
BUFFS.add(new SkillHolder(1085, 3));// Acumen
BUFFS.add(new SkillHolder(1086, 2));// Haste
BUFFS.add(new SkillHolder(1087, 3));// Agility
BUFFS.add(new SkillHolder(1203, 2));// Wind Walk
BUFFS.add(new SkillHolder(1240, 3));// Guidance
BUFFS.add(new SkillHolder(1242, 3));// Death Whisper
BUFFS.add(new SkillHolder(1243, 6));// Bless Shield
BUFFS.add(new SkillHolder(1257, 3));// Decrease Weight
BUFFS.add(new SkillHolder(1268, 4));// Vampiric Rage
BUFFS.add(new SkillHolder(1303, 1));// Wild Magic
BUFFS.add(new SkillHolder(1304, 3));// Advanced Block
// -------------------------------------------------------------- //
RESIST.add(new SkillHolder(1032, 3));// Invigor
RESIST.add(new SkillHolder(1033, 3));// Resist Poison
RESIST.add(new SkillHolder(1182, 3));// Resist Aqua
RESIST.add(new SkillHolder(1189, 3));// Resist Wind
RESIST.add(new SkillHolder(1191, 3));// Resist Fire
RESIST.add(new SkillHolder(1259, 4));// Resist Shock
RESIST.add(new SkillHolder(1352, 1));// Elemetal Protection
RESIST.add(new SkillHolder(1353, 1));// Divine Protection
RESIST.add(new SkillHolder(1354, 1));// Arcane Protection
// -------------------------------------------------------------- //
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return HTML_PATH + "index.htm";
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
StringTokenizer st = new StringTokenizer(event, " ");
event = st.nextToken();
switch (event)
{
case "cancel":
for (Effect e : player.getAllEffects())
{
e.exit();
}
break;
case "heal":
player.setCurrentHp(player.getMaxHp());
player.setCurrentCp(player.getMaxCp());
player.setCurrentMp(player.getMaxMp());
break;
case "dance":
if (st.hasMoreTokens())
{
DANCE.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, DANCE, event);
case "song":
if (st.hasMoreTokens())
{
SONG.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, SONG, event);
case "special":
if (st.hasMoreTokens())
{
SPECIAL.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, SPECIAL, event);
case "buff":
if (st.hasMoreTokens())
{
BUFFS.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, BUFFS, event);
case "resist":
if (st.hasMoreTokens())
{
RESIST.get(Integer.parseInt(st.nextToken())).getSkill().getEffects(player, player);
}
return GenerateHtmlBuffs(player, RESIST, event);
}
return null;
}
/**
* Generamos los html para cada lista de buff
* @param player
* @param list
* @param event
* @return
*/
private static String GenerateHtmlBuffs(L2PcInstance player, List<SkillHolder> list, String event)
{
StringBuilder sb = new StringBuilder();
sb.append("<html><body>");
sb.append("<center>");
sb.append("<br>");
sb.append("Welcome <font color=\"LEVEL\">" + player.getName() + "</font>");
sb.append("<br>");
int cont = 0;
for (SkillHolder skill : list)
{
if (skill.getSkill() == null)
{
if (DEBUG)
{
System.out.println("skill null >>" + event + "<< -- " + cont);
}
cont++;
continue;
}
sb.append("<table width=\"260\" height=\"36\">");
sb.append("<tr>");
sb.append("<td width=\"32\" height=\"32\"><img src=\"icon.skill" + getSkillIcon(skill.getSkillId()) + "\" width=\"32\" height=\"32\"></td>");
sb.append("<td align=center width=196 height=32><button value=\"" + skill.getSkill().getName() + "\" action=\"bypass -h Quest CustomBuffer " + event + " " + cont + "\" width=\"120\" height=\"30\" back=\"L2UI_CH3.bigbutton2_dow\"n fore=\"L2UI_CH3.bigbutton2\"></td>");
sb.append("<td width=\"32\" height=\"32\"><img src=\"icon.skill" + getSkillIcon(skill.getSkillId()) + "\" width=\"32\" height=\"32\"></td>");
sb.append("</tr>");
sb.append("</table>");
cont++;
}
sb.append("</center>");
sb.append("</body></html>");
return sb.toString();
}
/**
* Generamos el ID de la imagen de un skill a partir de su ID
* @param id
* @return
*/
private static String getSkillIcon(int id)
{
String formato = "";
if (id < 10)
{
formato = "000" + id;
}
else if (id < 100)
{
formato = "00" + id;
}
else if (id < 1000)
{
formato = "0" + id;
}
else if (id == 4699 || id == 4700)
{
formato = "1331";
}
else if (id == 4702 || id == 4703)
{
formato = "1332";
}
else
formato = String.valueOf(id);
return formato;
}
}
Или http://pastebin.com/ZqyVMMnm