Jump to content

Recommended Posts

Posted

140308071258275006.png



Index: dist/game/data/scripts.cfg
===================================================================
--- dist/game/data/scripts.cfg (revision 10413)
+++ dist/game/data/scripts.cfg (working copy)
@@ -310,6 +310,7 @@
custom/ShadowWeapons/ShadowWeapons.java
custom/NewbieCoupons/NewbieCoupons.java
custom/RaidbossInfo/RaidbossInfo.java
+custom/NpcBuffer/NpcBuffer.java
custom/NpcLocationInfo/NpcLocationInfo.java
custom/Validators/SubClassSkills.java

Index: dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java
===================================================================
--- dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java (revision 0)
+++ dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java (working copy)
@@ -0,0 +1,1970 @@
+/*
+ * Copyright (C) 2004-2014 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack is free software: you can redistribute it and/or modify
+ * it under 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.
+ *
+ * L2J DataPack 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 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 custom.NpcBuffer;
+
+import static com.l2jserver.gameserver.util.Util.formatAdena;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import com.l2jserver.Config;
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.gameserver.datatables.SkillData;
+import com.l2jserver.gameserver.instancemanager.QuestManager;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.L2Summon;
+import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
+import com.l2jserver.gameserver.model.actor.stat.PcStat;
+import com.l2jserver.gameserver.model.actor.stat.SummonStat;
+import com.l2jserver.gameserver.model.actor.status.PcStatus;
+import com.l2jserver.gameserver.model.actor.status.SummonStatus;
+import com.l2jserver.gameserver.model.effects.L2EffectType;
+import com.l2jserver.gameserver.model.entity.TvTEvent;
+import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.skills.Skill;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
+import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jserver.gameserver.network.serverpackets.SetSummonRemainTime;
+import com.l2jserver.gameserver.network.serverpackets.SetupGauge;
+
+public class NpcBuffer extends Quest
+{
+ private static final boolean DEBUG = false;
+
+ private static void print(Exception e)
+ {
+ _log.warning(">>>" + e.toString() + "<<<");
+ if (DEBUG)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static final String QUEST_LOADING_INFO = "Rin4a";
+ private static final int NPC_ID = 12;
+
+ private static final String TITLE_NAME = "Scheme Buffer";
+ private static final boolean SCRIPT_RELOAD = false;
+ private static final boolean SMART_WINDOW = true;
+ private static final boolean ENABLE_BUFF_SECTION = true;
+ private static final boolean ENABLE_SCHEME_SYSTEM = true;
+ private static final boolean ENABLE_HEAL = true;
+ private static final boolean ENABLE_HEAL_IN_COMBAT = false;
+ private static final boolean ENABLE_BUFFS = true;
+ private static final boolean ENABLE_RESIST = true;
+ private static final boolean ENABLE_SONGS = true;
+ private static final boolean ENABLE_DANCES = true;
+ private static final boolean ENABLE_CHANTS = false;
+ private static final boolean ENABLE_OTHERS = false;
+ private static final boolean ENABLE_SPECIAL = false;
+ private static final boolean ENABLE_CUBIC = false;
+ private static final boolean ENABLE_BUFF_REMOVE = true;
+ private static final boolean ENABLE_BUFF_SET = true;
+ private static final boolean BUFF_WITH_KARMA = true;
+ private static final boolean FREE_BUFFS = false;
+ private static final boolean TIME_OUT = true;
+ private static final int TIME_OUT_TIME = 3;
+ private static final int MIN_LEVEL = 1;
+ private static final int BUFF_REMOVE_PRICE = 10000;
+ private static final int HEAL_PRICE = 10000;
+ private static final int BUFF_PRICE = 1000;
+ private static final int RESIST_PRICE = 1000;
+ private static final int SONG_PRICE = 1000;
+ private static final int DANCE_PRICE = 1000;
+ private static final int CHANT_PRICE = 1000;
+ private static final int OTHERS_PRICE = 1000;
+ private static final int SPECIAL_PRICE = 1000;
+ private static final int CUBIC_PRICE = 1000;
+ private static final int BUFF_SET_PRICE = 15000;
+ private static final int SCHEME_BUFF_PRICE = 20000;
+ private static final int SCHEMES_PER_PLAYER = 4;
+ private static final int CONSUMABLE_ID = 57;
+ private static final int MAX_SCHEME_BUFFS = Config.BUFFS_MAX_AMOUNT;
+ private static final int MAX_SCHEME_DANCES = Config.DANCES_MAX_AMOUNT;
+
+ private static final String SET_FIGHTER = "Fighter";
+ private static final String SET_MAGE = "Mage";
+ private static final String SET_ALL = "All";
+ private static final String SET_NONE = "None";
+
+ private String rebuildMainHtml(QuestState st)
+ {
+ String MAIN_HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>";
+ String MESSAGE = "";
+ int td = 0;
+ String[] TRS =
+ {
+ "<tr><td height=25>",
+ "</td>",
+ "<td height=25>",
+ "</td></tr>"
+ };
+
+ final String bottonA, bottonB, bottonC;
+ if (st.getInt("Pet-On-Off") == 1)
+ {
+ bottonA = "Auto Buff Pet";
+ bottonB = "Heal My Pet";
+ bottonC = "Remove Pet Buffs";
+ MAIN_HTML_MESSAGE += "<button value=\"Player Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ else
+ {
+ bottonA = "Auto Buff";
+ bottonB = "Heal";
+ bottonC = "Remove Buffs";
+ MAIN_HTML_MESSAGE += "<button value=\"Pet Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 1 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+
+ if (ENABLE_BUFF_SECTION)
+ {
+ if (ENABLE_BUFFS)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+ if (ENABLE_RESIST)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"Resist\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_resists 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+ if (ENABLE_SONGS)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_songs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+ if (ENABLE_DANCES)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_dances 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+ if (ENABLE_CHANTS)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_chants 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+ if (ENABLE_SPECIAL)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"Special\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_special 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+ if (ENABLE_OTHERS)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"Others\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_others 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+ }
+
+ if (ENABLE_CUBIC)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_cubic 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+
+ if (MESSAGE.length() > 0)
+ {
+ MAIN_HTML_MESSAGE += "<BR1><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=444444><tr>" + "<td><font color=00FFFF>Buffs:</font></td><td align=right>...</td></tr></table>" + "<BR1><table cellspacing=0 cellpadding=0>" + MESSAGE + "</table>";
+ MESSAGE = "";
+ td = 0;
+ }
+
+ if (ENABLE_BUFF_SET)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"" + bottonA + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " castBuffSet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+
+ if (ENABLE_HEAL)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"" + bottonB + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " heal 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+
+ if (ENABLE_BUFF_REMOVE)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"" + bottonC + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " removeBuffs 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+
+ if (MESSAGE.length() > 0)
+ {
+ MAIN_HTML_MESSAGE += "<BR1><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=444444><tr>" + "<td><font color=00FFFF>Preset:</font></td><td align=right><font color=LEVEL>" + formatAdena(BUFF_SET_PRICE) + "</font> adena</td></tr></table>" + "<BR1><table cellspacing=0 cellpadding=0>" + MESSAGE + "</table>";
+ MESSAGE = "";
+ td = 0;
+ }
+
+ if (ENABLE_SCHEME_SYSTEM)
+ {
+ MAIN_HTML_MESSAGE += generateScheme(st);
+ }
+
+ if (st.getPlayer().isGM())
+ {
+ MAIN_HTML_MESSAGE += "<br><button value=\"GM Manage Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ MAIN_HTML_MESSAGE += "<br><font color=303030>" + TITLE_NAME + "</font>" + "</center></body></html>";
+ return MAIN_HTML_MESSAGE;
+ }
+
+ private String generateScheme(QuestState st)
+ {
+ List<String> schemeName = new ArrayList<>();
+ List<String> schemeId = new ArrayList<>();
+ String HTML = "";
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
+ rss.setInt(1, st.getPlayer().getObjectId());
+ ResultSet action = rss.executeQuery();
+ while (action.next())
+ {
+ schemeName.add(action.getString("scheme_name"));
+ schemeId.add(action.getString("id"));
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ HTML += "<BR1><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=444444><tr>" + "<td><font color=00FFFF>Scheme:</font></td><td align=right><font color=LEVEL>" + formatAdena(SCHEME_BUFF_PRICE) + "</font> adena</TD></TR></table>" + "<BR1><table cellspacing=0 cellpadding=0>";
+ if (schemeName.size() > 0)
+ {
+ String MESSAGE = "";
+ int td = 0;
+ String[] TRS =
+ {
+ "<tr><td>",
+ "</td>",
+ "<td>",
+ "</td></tr>"
+ };
+ for (int i = 0; i < schemeName.size(); ++i)
+ {
+ if (td > 2)
+ {
+ td = 0;
+ }
+ MESSAGE += TRS[td] + "<button value=\"" + schemeName.get(i) + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " cast " + schemeId.get(i) + " x x\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
+ td += 2;
+ }
+
+ if (MESSAGE.length() > 0)
+ {
+ HTML += "<table>" + MESSAGE + "</table>";
+ }
+ }
+
+ if (schemeName.size() < SCHEMES_PER_PLAYER)
+ {
+ HTML += "<BR1><table><tr><td><button value=\"Create\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " create_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
+ }
+ else
+ {
+ HTML += "<BR1><table width=100><tr>";
+ }
+
+ if (schemeName.size() > 0)
+ {
+ HTML += "<td><button value=\"Edit\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "<td><button value=\"Delete\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>";
+ }
+ else
+ {
+ HTML += "</tr></table>";
+ }
+ return HTML;
+ }
+
+ private String reloadPanel(QuestState st)
+ {
+ return "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" + "<font color=303030>" + TITLE_NAME + "</font><br>" + "<img src=\"L2UI.SquareGray\" width=250 height=1><br>" + "<table width=260 border=0 bgcolor=444444>" + "<tr><td><br></td></tr>" + "<tr><td align=center><font color=FFFFFF>This option can be seen by GMs only and it<br1>allow to update any changes made in the<br1>script. You can disable this option in<br1>the settings section within the Script.<br><font color=LEVEL>Do you want to update the SCRIPT?</font></font></td></tr>" + "<tr><td></td></tr></table><br>" + "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>" + "<button value=\"Yes\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " reloadscript 1 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"No\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " reloadscript 0 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "</center></body></html>";
+ }
+
+ private String getItemNameHtml(QuestState st, int itemval)
+ {
+ return "" + itemval + ";";
+ }
+
+ private int getBuffCount(String scheme)
+ {
+ int count = 0;
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement rss = con.prepareStatement("SELECT buff_class FROM npcbuffer_scheme_contents WHERE scheme_id=?");
+ rss.setString(1, scheme);
+ ResultSet action = rss.executeQuery();
+ while (action.next())
+ {
+ ++count;
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ return count;
+ }
+
+ private String getBuffType(int id)
+ {
+ String val = "none";
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement act = con.prepareStatement("SELECT buffType FROM npcbuffer_buff_list WHERE buffId=? LIMIT 1");
+ act.setInt(1, id);
+ ResultSet rs = act.executeQuery();
+ if (rs.next())
+ {
+ val = rs.getString("buffType");
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ return val;
+ }
+
+ private boolean isEnabled(int id, int level)
+ {
+ boolean val = false;
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement act = con.prepareStatement("SELECT canUse FROM npcbuffer_buff_list WHERE buffId=? AND buffLevel=? LIMIT 1");
+ act.setInt(1, id);
+ act.setInt(2, level);
+ ResultSet rs = act.executeQuery();
+ if (rs.next())
+ {
+ if ("1".equals(rs.getString("canUse")))
+ {
+ val = true;
+ }
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ return val;
+ }
+
+ private boolean isUsed(String scheme, int id, int level)
+ {
+ boolean used = false;
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement rss = con.prepareStatement("SELECT id FROM npcbuffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1");
+ rss.setString(1, scheme);
+ rss.setInt(2, id);
+ rss.setInt(3, level);
+ ResultSet action = rss.executeQuery();
+ if (action.next())
+ {
+ used = true;
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ return used;
+ }
+
+ private int getClassBuff(String id)
+ {
+ int val = 0;
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement getTipo = con.prepareStatement("SELECT buff_class FROM npcbuffer_buff_list WHERE buffId=?");
+ getTipo.setString(1, id);
+ ResultSet gt = getTipo.executeQuery();
+ if (gt.next())
+ {
+ val = gt.getInt("buff_class");
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ return val;
+ }
+
+ private String showText(QuestState st, String type, String text, boolean buttonEnabled, String buttonName, String location)
+ {
+ String MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
+ MESSAGE += "<font color=LEVEL>" + type + "</font><br>" + text + "<br>";
+ if (buttonEnabled)
+ {
+ MESSAGE += "<button value=\"" + buttonName + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect " + location + " 0 0\" width=100 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ MESSAGE += "<font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+ st.playSound("ItemSound3.sys_shortage");
+ return MESSAGE;
+ }
+
+ private String reloadConfig(QuestState st)
+ {
+ try
+ {
+ if (QuestManager.getInstance().reload(QUEST_LOADING_INFO))
+ {
+ st.getPlayer().sendMessage("The script and settings have been reloaded successfully.");
+ }
+ else
+ {
+ st.getPlayer().sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server");
+ }
+ }
+ catch (Exception e)
+ {
+ st.getPlayer().sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server");
+ print(e);
+ }
+ return rebuildMainHtml(st);
+ }
+
+ private NpcBuffer()
+ {
+ super(-1, NpcBuffer.class.getSimpleName(), "custom");
+ addStartNpc(NPC_ID);
+ addFirstTalkId(NPC_ID);
+ addTalkId(NPC_ID);
+ }
+
+ private boolean isPetBuff(QuestState st)
+ {
+ return st.getInt("Pet-On-Off") != 0;
+ }
+
+ private String createScheme()
+ {
+ return "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>You MUST seprerate new words with a dot (.)<br><br>Scheme name: <edit var=\"name\" width=100><br><br>" + "<button value=\"Create Scheme\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " create $name no_name x x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+ }
+
+ private String deleteScheme(L2PcInstance player)
+ {
+ String HTML = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Available schemes:<br><br>";
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
+ rss.setInt(1, player.getObjectId());
+ ResultSet action = rss.executeQuery();
+ while (action.next())
+ {
+ HTML += "<button value=\"" + action.getString("scheme_name") + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete_c " + action.getString("id") + " " + action.getString("scheme_name") + " x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+ return HTML;
+ }
+
+ private String editScheme(L2PcInstance player)
+ {
+ String HTML = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Select a scheme that you would like to manage:<br><br>";
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
+ rss.setInt(1, player.getObjectId());
+ ResultSet action = rss.executeQuery();
+ while (action.next())
+ {
+ String name = action.getString("scheme_name");
+ String id = action.getString("id");
+ HTML += "<button value=\"" + name + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_select " + id + " x x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+ return HTML;
+ }
+
+ private String getOptionList(String scheme)
+ {
+ int bcount = getBuffCount(scheme);
+ String HTML = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>There are <font color=LEVEL>" + bcount + "</font> buffs in current scheme!<br><br>";
+ if (bcount < (MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES))
+ {
+ HTML += "<button value=\"Add buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_1 " + scheme + " 1 x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ if (bcount > 0)
+ {
+ HTML += "<button value=\"Remove buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_2 " + scheme + " 1 x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_1 0 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+ return HTML;
+ }
+
+ private String buildHtml(String buffType)
+ {
+ String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><br>";
+
+ List<String> availableBuffs = new ArrayList<>();
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement getList = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE buffType=\"" + buffType + "\" AND canUse=1 ORDER BY Buff_Class ASC, id");
+ ResultSet rs = getList.executeQuery();
+ while (rs.next())
+ {
+ int bId = rs.getInt("buffId");
+ int bLevel = rs.getInt("buffLevel");
+ String bName = SkillData.getInstance().getSkill(bId, bLevel).getName();
+ bName = bName.replace(" ", "+");
+ availableBuffs.add(bName + "_" + bId + "_" + bLevel);
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+
+ if (availableBuffs.size() == 0)
+ {
+ HTML_MESSAGE += "No buffs are available at this moment!";
+ }
+ else
+ {
+ if (FREE_BUFFS)
+ {
+ HTML_MESSAGE += "All buffs are for <font color=LEVEL>free</font>!";
+ }
+ else
+ {
+ int price = 0;
+ switch (buffType)
+ {
+ case "buff":
+ price = BUFF_PRICE;
+ break;
+ case "resist":
+ price = RESIST_PRICE;
+ break;
+ case "song":
+ price = SONG_PRICE;
+ break;
+ case "dance":
+ price = DANCE_PRICE;
+ break;
+ case "chant":
+ price = CHANT_PRICE;
+ break;
+ case "others":
+ price = OTHERS_PRICE;
+ break;
+ case "special":
+ price = SPECIAL_PRICE;
+ break;
+ case "cubic":
+ price = CUBIC_PRICE;
+ break;
+ default:
+ if (DEBUG)
+ {
+ throw new RuntimeException();
+ }
+ }
+ HTML_MESSAGE += "All special buffs cost <font color=LEVEL>" + formatAdena(price) + "</font> adena!";
+ }
+ HTML_MESSAGE += "<BR1><table>";
+ for (String buff : availableBuffs)
+ {
+ buff = buff.replace("_", " ");
+ String[] buffSplit = buff.split(" ");
+ String name = buffSplit[0];
+ int id = Integer.parseInt(buffSplit[1]);
+ int level = Integer.parseInt(buffSplit[2]);
+ name = name.replace("+", " ");
+ HTML_MESSAGE += "<tr><td>" + getSkillIconHtml(id, level) + "</td><td><button value=\"" + name + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs " + id + " " + level + " " + buffType + "\" width=190 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
+ }
+ HTML_MESSAGE += "</table>";
+ }
+
+ HTML_MESSAGE += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+ return HTML_MESSAGE;
+ }
+
+ private String generateQuery(int case1, int case2)
+ {
+ StringBuilder qry = new StringBuilder();
+ if (ENABLE_BUFFS)
+ {
+ if (case1 < MAX_SCHEME_BUFFS)
+ {
+ qry.append(",\"buff\"");
+ }
+ }
+ if (ENABLE_RESIST)
+ {
+ if (case1 < MAX_SCHEME_BUFFS)
+ {
+ qry.append(",\"resist\"");
+ }
+ }
+ if (ENABLE_SONGS)
+ {
+ if (case2 < MAX_SCHEME_DANCES)
+ {
+ qry.append(",\"song\"");
+ }
+ }
+ if (ENABLE_DANCES)
+ {
+ if (case2 < MAX_SCHEME_DANCES)
+ {
+ qry.append(",\"dance\"");
+ }
+ }
+ if (ENABLE_CHANTS)
+ {
+ if (case1 < MAX_SCHEME_BUFFS)
+ {
+ qry.append(",\"chant\"");
+ }
+ }
+ if (ENABLE_OTHERS)
+ {
+ if (case1 < MAX_SCHEME_BUFFS)
+ {
+ qry.append(",\"others\"");
+ }
+ }
+ if (ENABLE_SPECIAL)
+ {
+ if (case1 < MAX_SCHEME_BUFFS)
+ {
+ qry.append(",\"special\"");
+ }
+ }
+ if (qry.length() > 0)
+ {
+ qry.deleteCharAt(0);
+ }
+ return qry.toString();
+ }
+
+ private String viewAllSchemeBuffs$getBuffCount(String scheme)
+ {
+ int count = 0;
+ int D_S_Count = 0;
+ int B_Count = 0;
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement rss = con.prepareStatement("SELECT buff_class FROM npcbuffer_scheme_contents WHERE scheme_id=?");
+ rss.setString(1, scheme);
+ ResultSet action = rss.executeQuery();
+ while (action.next())
+ {
+ ++count;
+ int val = action.getInt("buff_class");
+ if ((val == 1) || (val == 2))
+ {
+ ++D_S_Count;
+ }
+ else
+ {
+ ++B_Count;
+ }
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ String res = count + " " + B_Count + " " + D_S_Count;
+ return res;
+ }
+
+ private String viewAllSchemeBuffs(String scheme, String page, String action)
+ {
+ List<String> buffList = new ArrayList<>();
+ String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><br>";
+ String[] eventSplit = viewAllSchemeBuffs$getBuffCount(scheme).split(" ");
+ int TOTAL_BUFF = Integer.parseInt(eventSplit[0]);
+ int BUFF_COUNT = Integer.parseInt(eventSplit[1]);
+ int DANCE_SONG = Integer.parseInt(eventSplit[2]);
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ if (action.equals("add"))
+ {
+ HTML_MESSAGE += "You can add <font color=LEVEL>" + (MAX_SCHEME_BUFFS - BUFF_COUNT) + "</font> Buffs and <font color=LEVEL>" + (MAX_SCHEME_DANCES - DANCE_SONG) + "</font> Dances more!";
+ String QUERY = "SELECT * FROM npcbuffer_buff_list WHERE buffType IN (" + generateQuery(BUFF_COUNT, DANCE_SONG) + ") AND canUse=1 ORDER BY Buff_Class ASC, id";
+ PreparedStatement getBuffCount = con.prepareStatement(QUERY);
+ ResultSet rss = getBuffCount.executeQuery();
+ while (rss.next())
+ {
+ String name = SkillData.getInstance().getSkill(rss.getInt("buffId"), rss.getInt("buffLevel")).getName();
+ name = name.replace(" ", "+");
+ buffList.add(name + "_" + rss.getInt("buffId") + "_" + rss.getInt("buffLevel"));
+ }
+ }
+ else if (action.equals("remove"))
+ {
+ HTML_MESSAGE += "You have <font color=LEVEL>" + BUFF_COUNT + "</font> Buffs and <font color=LEVEL>" + DANCE_SONG + "</font> Dances";
+ String QUERY = "SELECT * FROM npcbuffer_scheme_contents WHERE scheme_id=? ORDER BY Buff_Class ASC, id";
+ PreparedStatement getBuffCount = con.prepareStatement(QUERY);
+ getBuffCount.setString(1, scheme);
+ ResultSet rss = getBuffCount.executeQuery();
+ while (rss.next())
+ {
+ String name = SkillData.getInstance().getSkill(rss.getInt("skill_id"), rss.getInt("skill_level")).getName();
+ name = name.replace(" ", "+");
+ buffList.add(name + "_" + rss.getInt("skill_id") + "_" + rss.getInt("skill_level"));
+ }
+ }
+ else if (DEBUG)
+ {
+ throw new RuntimeException();
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+
+ HTML_MESSAGE += "<BR1><table border=0><tr>";
+ final int buffsPerPage = 20;
+ final String width, pageName;
+ int pc = ((buffList.size() - 1) / buffsPerPage) + 1;
+ if (pc > 5)
+ {
+ width = "25";
+ pageName = "P";
+ }
+ else
+ {
+ width = "50";
+ pageName = "Page ";
+ }
+ for (int ii = 1; ii <= pc; ++ii)
+ {
+ if (ii == Integer.parseInt(page))
+ {
+ HTML_MESSAGE += "<td width=" + width + " align=center><font color=LEVEL>" + pageName + ii + "</font></td>";
+ }
+ else if (action.equals("add"))
+ {
+ HTML_MESSAGE += "<td width=" + width + ">" + "<button value=\"" + pageName + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_1 " + scheme + " " + ii + " x\" width=" + width + " height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
+ }
+ else if (action.equals("remove"))
+ {
+ HTML_MESSAGE += "<td width=" + width + ">" + "<button value=\"" + pageName + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_2 " + scheme + " " + ii + " x\" width=" + width + " height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
+ }
+ else if (DEBUG)
+ {
+ throw new RuntimeException();
+ }
+ }
+ HTML_MESSAGE += "</tr></table>";
+
+ int limit = buffsPerPage * Integer.parseInt(page);
+ int start = limit - buffsPerPage;
+ int end = Math.min(limit, buffList.size());
+ int k = 0;
+ for (int i = start; i < end; ++i)
+ {
+ String value = buffList.get(i);
+ value = value.replace("_", " ");
+ String[] extr = value.split(" ");
+ String name = extr[0];
+ name = name.replace("+", " ");
+ int id = Integer.parseInt(extr[1]);
+ int level = Integer.parseInt(extr[2]);
+ if (action.equals("add"))
+ {
+ if (!isUsed(scheme, id, level))
+ {
+ if ((k % 2) != 0)
+ {
+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
+ }
+ else
+ {
+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
+ }
+ HTML_MESSAGE += "<tr><td width=35>" + getSkillIconHtml(id, level) + "</td><td fixwidth=170>" + name + "</td><td><button value=\"Add\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " add_buff " + scheme + "_" + id + "_" + level + " " + page + " " + TOTAL_BUFF + "\" width=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</tr></table>";
+ k += 1;
+ }
+ }
+ else if (action.equals("remove"))
+ {
+ if ((k % 2) != 0)
+ {
+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
+ }
+ else
+ {
+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
+ }
+ HTML_MESSAGE += "<tr><td width=35>" + getSkillIconHtml(id, level) + "</td><td fixwidth=170>" + name + "</td><td><button value=\"Remove\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " remove_buff " + scheme + "_" + id + "_" + level + " " + page + " " + TOTAL_BUFF + "\" width=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</table>";
+ k += 1;
+ }
+ }
+ HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_select " + scheme + " x x\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+ return HTML_MESSAGE;
+ }
+
+ private String viewAllBuffTypes()
+ {
+ String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
+ HTML_MESSAGE += "<font color=LEVEL>[Buff management]</font><br>";
+ if (ENABLE_BUFFS)
+ {
+ HTML_MESSAGE += "<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list buff Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ if (ENABLE_RESIST)
+ {
+ HTML_MESSAGE += "<button value=\"Resist Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list resist Resists 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ if (ENABLE_SONGS)
+ {
+ HTML_MESSAGE += "<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list song Songs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ if (ENABLE_DANCES)
+ {
+ HTML_MESSAGE += "<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list dance Dances 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ if (ENABLE_CHANTS)
+ {
+ HTML_MESSAGE += "<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list chant Chants 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ if (ENABLE_SPECIAL)
+ {
+ HTML_MESSAGE += "<button value=\"Special Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list special Special_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ if (ENABLE_OTHERS)
+ {
+ HTML_MESSAGE += "<button value=\"Others Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list others Others_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ if (ENABLE_CUBIC)
+ {
+ HTML_MESSAGE += "<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list cubic cubic_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
+ }
+ if (ENABLE_BUFF_SET)
+ {
+ HTML_MESSAGE += "<button value=\"Buff Sets\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list set Buff_Sets 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>";
+ }
+ HTML_MESSAGE += "<button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+ return HTML_MESSAGE;
+ }
+
+ private String viewAllBuffs(String type, String typeName, String page)
+ {
+ List<String> buffList = new ArrayList<>();
+ String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
+ typeName = typeName.replace("_", " ");
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ final PreparedStatement getBuffCount;
+ if (type.equals("set"))
+ {
+ getBuffCount = con.prepareStatement("SELECT * FROM npcbuffer_buff_list WHERE buffType IN (" + generateQuery(0, 0) + ") AND canUse=1");
+ }
+ else
+ {
+ getBuffCount = con.prepareStatement("SELECT * FROM npcbuffer_buff_list WHERE buffType=?");
+ getBuffCount.setString(1, type);
+ }
+ ResultSet rss = getBuffCount.executeQuery();
+ while (rss.next())
+ {
+ String name = SkillData.getInstance().getSkill(rss.getInt("buffId"), rss.getInt("buffLevel")).getName();
+ name = name.replace(" ", "+");
+ String usable = rss.getString("canUse");
+ String forClass = rss.getString("forClass");
+ String skill_id = rss.getString("buffId");
+ String skill_level = rss.getString("buffLevel");
+ buffList.add(name + "_" + forClass + "_" + page + "_" + usable + "_" + skill_id + "_" + skill_level);
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ Collections.sort(buffList);
+
+ HTML_MESSAGE += "<font color=LEVEL>[Buff management - " + typeName + " - Page " + page + "]</font><br><table border=0><tr>";
+ final int buffsPerPage;
+ if (type.equals("set"))
+ {
+ buffsPerPage = 12;
+ }
+ else
+ {
+ buffsPerPage = 20;
+ }
+ final String width, pageName;
+ int pc = ((buffList.size() - 1) / buffsPerPage) + 1;
+ if (pc > 5)
+ {
+ width = "25";
+ pageName = "P";
+ }
+ else
+ {
+ width = "50";
+ pageName = "Page ";
+ }
+ typeName = typeName.replace(" ", "_");
+ for (int ii = 1; ii <= pc; ++ii)
+ {
+ if (ii == Integer.parseInt(page))
+ {
+ HTML_MESSAGE += "<td width=" + width + " align=center><font color=LEVEL>" + pageName + ii + "</font></td>";
+ }
+ else
+ {
+ HTML_MESSAGE += "<td width=" + width + "><button value=\"" + pageName + "" + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list " + type + " " + typeName + " " + ii + "\" width=" + width + " height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
+ }
+ }
+ HTML_MESSAGE += "</tr></table><br>";
+
+ int limit = buffsPerPage * Integer.parseInt(page);
+ int start = limit - buffsPerPage;
+ int end = Math.min(limit, buffList.size());
+ for (int i = start; i < end; ++i)
+ {
+ String value = buffList.get(i);
+ value = value.replace("_", " ");
+ String[] extr = value.split(" ");
+ String name = extr[0];
+ name = name.replace("+", " ");
+ int forClass = Integer.parseInt(extr[1]);
+ int usable = Integer.parseInt(extr[3]);
+ String skillPos = extr[4] + "_" + extr[5];
+ if ((i % 2) != 0)
+ {
+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
+ }
+ else
+ {
+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
+ }
+ if (type.equals("set"))
+ {
+ String listOrder = null;
+ if (forClass == 0)
+ {
+ listOrder = "List=\"" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_ALL + ";" + SET_NONE + ";\"";
+ }
+ else if (forClass == 1)
+ {
+ listOrder = "List=\"" + SET_MAGE + ";" + SET_FIGHTER + ";" + SET_ALL + ";" + SET_NONE + ";\"";
+ }
+ else if (forClass == 2)
+ {
+ listOrder = "List=\"" + SET_ALL + ";" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_NONE + ";\"";
+ }
+ else if (forClass == 3)
+ {
+ listOrder = "List=\"" + SET_NONE + ";" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_ALL + ";\"";
+ }
+ HTML_MESSAGE += "<tr><td fixwidth=145>" + name + "</td><td width=70><combobox var=\"newSet" + i + "\" width=70 " + listOrder + "></td>" + "<td width=50><button value=\"Update\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " changeBuffSet " + skillPos + " $newSet" + i + " " + page + "\" width=50 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
+ }
+ else
+ {
+ HTML_MESSAGE += "<tr><td fixwidth=170>" + name + "</td><td width=80>";
+ if (usable == 1)
+ {
+ HTML_MESSAGE += "<button value=\"Disable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff " + skillPos + " 0-" + page + " " + type + "\" width=80 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
+ }
+ else if (usable == 0)
+ {
+ HTML_MESSAGE += "<button value=\"Enable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff " + skillPos + " 1-" + page + " " + type + "\" width=80 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
+ }
+ }
+ HTML_MESSAGE += "</table>";
+ }
+ HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+ return HTML_MESSAGE;
+ }
+
+ private void manageSelectedBuff(String buffPosId, String canUseBuff)
+ {
+ String[] bpid = buffPosId.split("_");
+ String bId = bpid[0];
+ String bLvl = bpid[1];
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement upd = con.prepareStatement("UPDATE npcbuffer_buff_list SET canUse=? WHERE buffId=? AND buffLevel=? LIMIT 1");
+ upd.setString(1, canUseBuff);
+ upd.setString(2, bId);
+ upd.setString(3, bLvl);
+ upd.executeUpdate();
+ upd.close();
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ }
+
+ private String manageSelectedSet(String id, String newVal, String opt3)
+ {
+ String[] bpid = id.split("_");
+ String bId = bpid[0];
+ String bLvl = bpid[1];
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement upd = con.prepareStatement("UPDATE npcbuffer_buff_list SET forClass=? WHERE buffId=? AND bufflevel=?");
+ upd.setString(1, newVal);
+ upd.setString(2, bId);
+ upd.setString(3, bLvl);
+ upd.executeUpdate();
+ upd.close();
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ return viewAllBuffs("set", "Buff Sets", opt3);
+ }
+
+ private void addTimeout(QuestState st, int gaugeColor, int amount, int offset)
+ {
+ int endtime = (int) ((System.currentTimeMillis() + (amount * 1000)) / 1000);
+ st.set("blockUntilTime", String.valueOf(endtime));
+ st.getPlayer().sendPacket(new SetupGauge(gaugeColor, (amount * 1000) + offset));
+ }
+
+ private void heal(L2PcInstance player, boolean isPet)
+ {
+ L2Summon target = player.getSummon();
+ if (!isPet)
+ {
+ PcStatus pcStatus = player.getStatus();
+ PcStat pcStat = player.getStat();
+ pcStatus.setCurrentHp(pcStat.getMaxHp());
+ pcStatus.setCurrentMp(pcStat.getMaxMp());
+ pcStatus.setCurrentCp(pcStat.getMaxCp());
+ }
+ else if (target != null)
+ {
+ SummonStatus petStatus = target.getStatus();
+ SummonStat petStat = target.getStat();
+ petStatus.setCurrentHp(petStat.getMaxHp());
+ petStatus.setCurrentMp(petStat.getMaxMp());
+ if (target instanceof L2PetInstance)
+ {
+ L2PetInstance pet = (L2PetInstance) target;
+ pet.setCurrentFed(pet.getMaxFed());
+ player.sendPacket(new SetSummonRemainTime(pet.getMaxFed(), pet.getCurrentFed()));
+ }
+ else if (target instanceof L2ServitorInstance)
+ {
+ L2ServitorInstance summon = (L2ServitorInstance) target;
+ // FIXME: summon.setLifeTimeRemaining(summon.getLifeTimeRemaining() - summon.getLifeTime());
+ summon.setLifeTimeRemaining(summon.getLifeTimeRemaining() + summon.getLifeTime());
+ player.sendPacket(new SetSummonRemainTime(summon.getLifeTime(), summon.getLifeTimeRemaining()));
+ }
+ else if (DEBUG)
+ {
+ throw new RuntimeException();
+ }
+ }
+ }
+
+ @Override
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+ {
+ if (DEBUG)
+ {
+ System.out.println(getScriptName() + "#onAdvEvent('" + event + "'," + (npc == null ? "NULL" : npc.getId() + npc.getName()) + "," + (player == null ? "NULL" : player.getName()) + ")");
+ }
+ QuestState st = player.getQuestState(QUEST_LOADING_INFO);
+ String[] eventSplit = event.split(" ", 4);
+ if (eventSplit.length != 4)
+ {
+ player.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN);
+ return null;
+ }
+ String eventParam0 = eventSplit[0];
+ String eventParam1 = eventSplit[1];
+ String eventParam2 = eventSplit[2];
+ String eventParam3 = eventSplit[3];
+
+ switch (eventParam0)
+ {
+ case "reloadscript":
+ if (eventParam1.equals("1"))
+ {
+ return reloadConfig(st);
+ }
+ if (eventParam1.equals("0"))
+ {
+ return rebuildMainHtml(st);
+ }
+ if (DEBUG)
+ {
+ throw new RuntimeException();
+ }
+
+ case "redirect":
+ switch (eventParam1)
+ {
+ case "main":
+ return rebuildMainHtml(st);
+ case "manage_buffs":
+ return viewAllBuffTypes();
+ case "view_buffs":
+ return buildHtml("buff");
+ case "view_resists":
+ return buildHtml("resist");
+ case "view_songs":
+ return buildHtml("song");
+ case "view_dances":
+ return buildHtml("dance");
+ case "view_chants":
+ return buildHtml("chant");
+ case "view_others":
+ return buildHtml("others");
+ case "view_special":
+ return buildHtml("special");
+ case "view_cubic":
+ return buildHtml("cubic");
+ default:
+ if (DEBUG)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ case "buffpet":
+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
+ {
+ st.set("Pet-On-Off", eventParam1);
+ if (TIME_OUT)
+ {
+ addTimeout(st, 3, TIME_OUT_TIME / 2, 600);
+ }
+ }
+ return rebuildMainHtml(st);
+
+ case "create":
+ {
+ String param = eventParam1.replaceAll("[ !" + "\"" + "#$%&'()*+,/:;<=>?@" + "\\[" + "\\\\" + "\\]" + "\\^" + "`{|}~]", "");
+ if ((param.length() == 0) || param.equals("no_name"))
+ {
+ player.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN);
+ return showText(st, "Info", "Please, enter the scheme name!", true, "Return", "main");
+ }
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement ins = con.prepareStatement("INSERT INTO npcbuffer_scheme_list (player_id,scheme_name) VALUES (?,?)");
+ ins.setInt(1, player.getObjectId());
+ ins.setString(2, param);
+ ins.executeUpdate();
+ ins.close();
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ return rebuildMainHtml(st);
+ }
+
+ case "delete":
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement rem;
+ rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_list WHERE id=? LIMIT 1");
+ rem.setString(1, eventParam1);
+ rem.executeUpdate();
+ rem.close();
+ rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_contents WHERE scheme_id=?");
+ rem.setString(1, eventParam1);
+ rem.executeUpdate();
+ rem.close();
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ return rebuildMainHtml(st);
+
+ case "delete_c":
+ return "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Do you really want to delete '" + eventParam2 + "' scheme?<br><br>" + "<button value=\"Yes\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete " + eventParam1 + " x x\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"No\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete_1 x x x\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
+
+ case "create_1":
+ return createScheme();
+ case "edit_1":
+ return editScheme(player);
+ case "delete_1":
+ return deleteScheme(player);
+ case "manage_scheme_1":
+ return viewAllSchemeBuffs(eventParam1, eventParam2, "add");
+ case "manage_scheme_2":
+ return viewAllSchemeBuffs(eventParam1, eventParam2, "remove");
+ case "manage_scheme_select":
+ return getOptionList(eventParam1);
+
+ case "remove_buff":
+ {
+ String[] split = eventParam1.split("_");
+ String scheme = split[0];
+ String skill = split[1];
+ String level = split[2];
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1");
+ rem.setString(1, scheme);
+ rem.setString(2, skill);
+ rem.setString(3, level);
+ rem.executeUpdate();
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ int temp = Integer.parseInt(eventParam3) - 1;
+ final String HTML;
+ if (temp <= 0)
+ {
+ HTML = getOptionList(scheme);
+ }
+ else
+ {
+ HTML = viewAllSchemeBuffs(scheme, eventParam2, "remove");
+ }
+ return HTML;
+ }
+
+ case "add_buff":
+ {
+ String[] split = eventParam1.split("_");
+ String scheme = split[0];
+ String skill = split[1];
+ String level = split[2];
+ int idbuffclass = getClassBuff(skill);
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement ins = con.prepareStatement("INSERT INTO npcbuffer_scheme_contents (scheme_id,skill_id,skill_level,buff_class) VALUES (?,?,?,?)");
+ ins.setString(1, scheme);
+ ins.setString(2, skill);
+ ins.setString(3, level);
+ ins.setInt(4, idbuffclass);
+ ins.executeUpdate();
+ ins.close();
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ int temp = Integer.parseInt(eventParam3) + 1;
+ final String HTML;
+ if (temp >= (MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES))
+ {
+ HTML = getOptionList(scheme);
+ }
+ else
+ {
+ HTML = viewAllSchemeBuffs(scheme, eventParam2, "add");
+ }
+ return HTML;
+ }
+
+ case "edit_buff_list":
+ return viewAllBuffs(eventParam1, eventParam2, eventParam3);
+
+ case "changeBuffSet":
+ if (eventParam2.equals(SET_FIGHTER))
+ {
+ eventParam2 = "0";
+ }
+ else if (eventParam2.equals(SET_MAGE))
+ {
+ eventParam2 = "1";
+ }
+ else if (eventParam2.equals(SET_ALL))
+ {
+ eventParam2 = "2";
+ }
+ else if (eventParam2.equals(SET_NONE))
+ {
+ eventParam2 = "3";
+ }
+ else if (DEBUG)
+ {
+ throw new RuntimeException();
+ }
+ return manageSelectedSet(eventParam1, eventParam2, eventParam3);
+
+ case "editSelectedBuff":
+ {
+ eventParam2 = eventParam2.replace("-", " ");
+ String[] split = eventParam2.split(" ");
+ String action = split[0];
+ String page = split[1];
+ manageSelectedBuff(eventParam1, action);
+ final String typeName;
+ switch (eventParam3)
+ {
+ case "buff":
+ typeName = "Buffs";
+ break;
+ case "resist":
+ typeName = "Resists";
+ break;
+ case "song":
+ typeName = "Songs";
+ break;
+ case "dance":
+ typeName = "Dances";
+ break;
+ case "chant":
+ typeName = "Chants";
+ break;
+ case "others":
+ typeName = "Others_Buffs";
+ break;
+ case "special":
+ typeName = "Special_Buffs";
+ break;
+ case "cubic":
+ typeName = "Cubics";
+ break;
+ default:
+ throw new RuntimeException();
+ }
+ return viewAllBuffs(eventParam3, typeName, page);
+ }
+
+ case "viewSelectedConfig":
+ throw new RuntimeException();
+
+ case "changeConfig":
+ throw new RuntimeException();
+
+ case "heal":
+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
+ {
+ if (player.isInCombat() && !ENABLE_HEAL_IN_COMBAT)
+ {
+ return showText(st, "Info", "You can't use the heal function while in combat.", false, "Return", "main");
+ }
+
+ if (st.getQuestItemsCount(CONSUMABLE_ID) < HEAL_PRICE)
+ {
+ return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + HEAL_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
+ }
+ final boolean getSummonbuff = isPetBuff(st);
+ if (getSummonbuff)
+ {
+ if (player.getSummon() != null)
+ {
+ heal(player, getSummonbuff);
+ }
+ else
+ {
+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
+ }
+ }
+ else
+ {
+ heal(player, getSummonbuff);
+ }
+ st.takeItems(CONSUMABLE_ID, HEAL_PRICE);
+ if (TIME_OUT)
+ {
+ addTimeout(st, 1, TIME_OUT_TIME / 2, 600);
+ }
+ }
+ return SMART_WINDOW ? null : rebuildMainHtml(st);
+
+ case "removeBuffs":
+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
+ {
+ if (st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_REMOVE_PRICE)
+ {
+ return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + BUFF_REMOVE_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
+ }
+ final boolean getSummonbuff = isPetBuff(st);
+ if (getSummonbuff)
+ {
+ if (player.getSummon() != null)
+ {
+ player.getSummon().stopAllEffects();
+ }
+ else
+ {
+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
+ }
+ }
+ else
+ {
+ player.stopAllEffects();
+ if (player.getCubics() != null)
+ {
+ for (L2CubicInstance cubic : player.getCubics().values())
+ {
+ cubic.stopAction();
+ player.getCubics().remove(cubic);
+ }
+ }
+ }
+ st.takeItems(CONSUMABLE_ID, BUFF_REMOVE_PRICE);
+ if (TIME_OUT)
+ {
+ addTimeout(st, 2, TIME_OUT_TIME / 2, 600);
+ }
+ }
+ return SMART_WINDOW ? null : rebuildMainHtml(st);
+
+ case "cast":
+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
+ {
+ List<Integer> buffs = new ArrayList<>();
+ List<Integer> levels = new ArrayList<>();
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_contents WHERE scheme_id=? ORDER BY id");
+ rss.setString(1, eventParam1);
+ ResultSet action = rss.executeQuery();
+ while (action.next())
+ {
+ int id = Integer.parseInt(action.getString("skill_id"));
+ int level = Integer.parseInt(action.getString("skill_level"));
+ switch (getBuffType(id))
+ {
+ case "buff":
+ if (ENABLE_BUFFS)
+ {
+ if (isEnabled(id, level))
+ {
+ buffs.add(id);
+ levels.add(level);
+ }
+ }
+ break;
+ case "resist":
+ if (ENABLE_RESIST)
+ {
+ if (isEnabled(id, level))
+ {
+ buffs.add(id);
+ levels.add(level);
+ }
+ }
+ break;
+ case "song":
+ if (ENABLE_SONGS)
+ {
+ if (isEnabled(id, level))
+ {
+ buffs.add(id);
+ levels.add(level);
+ }
+ }
+ break;
+ case "dance":
+ if (ENABLE_DANCES)
+ {
+ if (isEnabled(id, level))
+ {
+ buffs.add(id);
+ levels.add(level);
+ }
+ }
+ break;
+ case "chant":
+ if (ENABLE_CHANTS)
+ {
+ if (isEnabled(id, level))
+ {
+ buffs.add(id);
+ levels.add(level);
+ }
+ }
+ break;
+ case "others":
+ if (ENABLE_OTHERS)
+ {
+ if (isEnabled(id, level))
+ {
+ buffs.add(id);
+ levels.add(level);
+ }
+ }
+ break;
+ case "special":
+ if (ENABLE_SPECIAL)
+ {
+ if (isEnabled(id, level))
+ {
+ buffs.add(id);
+ levels.add(level);
+ }
+ }
+ break;
+ default:
+ if (DEBUG)
+ {
+ throw new RuntimeException();
+ }
+ }
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+
+ if (buffs.size() == 0)
+ {
+ return viewAllSchemeBuffs(eventParam1, "1", "add");
+ }
+ if (!FREE_BUFFS)
+ {
+ if (st.getQuestItemsCount(CONSUMABLE_ID) < SCHEME_BUFF_PRICE)
+ {
+ return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + SCHEME_BUFF_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
+ }
+ }
+
+ final boolean getSummonbuff = isPetBuff(st);
+ for (int i = 0; i < buffs.size(); ++i)
+ {
+ if (!getSummonbuff)
+ {
+ npc.broadcastPacket(new MagicSkillUse(npc, player, buffs.get(i), 1, 1, 1));
+ SkillData.getInstance().getSkill(buffs.get(i), levels.get(i)).applyEffects(player, player);
+ }
+ else
+ {
+ if (player.getSummon() != null)
+ {
+ npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), buffs.get(i), 1, 1, 1));
+ SkillData.getInstance().getSkill(buffs.get(i), levels.get(i)).applyEffects(player.getSummon(), player.getSummon());
+ }
+ else
+ {
+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
+ }
+ }
+ }
+ st.takeItems(CONSUMABLE_ID, SCHEME_BUFF_PRICE);
+ if (TIME_OUT)
+ {
+ addTimeout(st, 3, TIME_OUT_TIME, 600);
+ }
+ }
+ return SMART_WINDOW ? null : rebuildMainHtml(st);
+
+ case "giveBuffs":
+ {
+ final int cost;
+ switch (eventParam3)
+ {
+ case "buff":
+ cost = BUFF_PRICE;
+ break;
+ case "resist":
+ cost = RESIST_PRICE;
+ break;
+ case "song":
+ cost = SONG_PRICE;
+ break;
+ case "dance":
+ cost = DANCE_PRICE;
+ break;
+ case "chant":
+ cost = CHANT_PRICE;
+ break;
+ case "others":
+ cost = OTHERS_PRICE;
+ break;
+ case "special":
+ cost = SPECIAL_PRICE;
+ break;
+ case "cubic":
+ cost = CUBIC_PRICE;
+ break;
+ default:
+ throw new RuntimeException();
+ }
+
+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
+ {
+ if (!FREE_BUFFS)
+ {
+ if (st.getQuestItemsCount(CONSUMABLE_ID) < cost)
+ {
+ return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + cost + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
+ }
+ }
+ Skill skill = SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2));
+ if (skill.hasEffectType(L2EffectType.SUMMON))
+ {
+ if (st.getQuestItemsCount(skill.getItemConsumeId()) < skill.getItemConsume())
+ {
+ return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + skill.getItemConsume() + " " + getItemNameHtml(st, skill.getItemConsumeId()) + "!", false, "0", "0");
+ }
+ }
+ final boolean getSummonbuff = isPetBuff(st);
+ if (!getSummonbuff)
+ {
+ if (eventParam3.equals("cubic"))
+ {
+ if (player.getCubics() != null)
+ {
+ for (L2CubicInstance cubic : player.getCubics().values())
+ {
+ cubic.stopAction();
+ player.getCubics().remove(cubic);
+ }
+ }
+ npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
+ player.useMagic(SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)), false, false);
+ }
+ else
+ {
+ npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
+ SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)).applyEffects(player, player);
+ }
+ }
+ else
+ {
+ if (eventParam3.equals("cubic"))
+ {
+ if (player.getCubics() != null)
+ {
+ for (L2CubicInstance cubic : player.getCubics().values())
+ {
+ cubic.stopAction();
+ player.getCubics().remove(cubic);
+ }
+ }
+ npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
+ player.useMagic(SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)), false, false);
+ }
+ else
+ {
+ if (player.getSummon() != null)
+ {
+ npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), Integer.parseInt(eventParam1), 1, 1, 1));
+ SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)).applyEffects(player.getSummon(), player.getSummon());
+ }
+ else
+ {
+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
+ }
+ }
+ }
+ st.takeItems(CONSUMABLE_ID, cost);
+ if (TIME_OUT)
+ {
+ addTimeout(st, 3, TIME_OUT_TIME / 10, 600);
+ }
+ }
+ return SMART_WINDOW ? null : buildHtml(eventParam3);
+ }
+
+ case "castBuffSet":
+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
+ {
+ if (!FREE_BUFFS)
+ {
+ if (st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_SET_PRICE)
+ {
+ return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + BUFF_SET_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
+ }
+ }
+ List<int[]> buff_sets = new ArrayList<>();
+ final int player_class;
+ if (player.isMageClass())
+ {
+ player_class = 1;
+ }
+ else
+ {
+ player_class = 0;
+ }
+ final boolean getSummonbuff = isPetBuff(st);
+ if (!getSummonbuff)
+ {
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement getSimilarNameCount = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC");
+ getSimilarNameCount.setInt(1, player_class);
+ getSimilarNameCount.setString(2, "2");
+ ResultSet rss = getSimilarNameCount.executeQuery();
+ while (rss.next())
+ {
+ int id = rss.getInt("buffId");
+ int lvl = rss.getInt("buffLevel");
+ buff_sets.add(new int[]
+ {
+ id,
+ lvl
+ });
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ for (int[] i : buff_sets)
+ {
+ npc.broadcastPacket(new MagicSkillUse(npc, player, i[0], 1, 1, 1));
+ SkillData.getInstance().getSkill(i[0], i[1]).applyEffects(player, player);
+ }
+ }
+ else
+ {
+ if (player.getSummon() != null)
+ {
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement getSimilarNameCount = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC");
+ getSimilarNameCount.setString(1, "0");
+ getSimilarNameCount.setString(2, "2");
+ ResultSet rss = getSimilarNameCount.executeQuery();
+ while (rss.next())
+ {
+ int id = rss.getInt("buffId");
+ int lvl = rss.getInt("buffLevel");
+ buff_sets.add(new int[]
+ {
+ id,
+ lvl
+ });
+ }
+ }
+ catch (SQLException e)
+ {
+ print(e);
+ }
+ for (int[] i : buff_sets)
+ {
+ npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), i[0], 1, 1, 1));
+ SkillData.getInstance().getSkill(i[0], i[1]).applyEffects(player.getSummon(), player.getSummon());
+ }
+ }
+ else
+ {
+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
+ }
+ }
+ st.takeItems(CONSUMABLE_ID, BUFF_SET_PRICE);
+ if (TIME_OUT)
+ {
+ addTimeout(st, 3, TIME_OUT_TIME, 600);
+ }
+ }
+ return SMART_WINDOW ? null : rebuildMainHtml(st);
+
+ }
+ return rebuildMainHtml(st);
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public String onFirstTalk(L2Npc npc, L2PcInstance player)
+ {
+ QuestState st = player.getQuestState(QUEST_LOADING_INFO);
+ if (st == null)
+ {
+ st = newQuestState(player);
+ }
+ if (player.isGM())
+ {
+ if (SCRIPT_RELOAD)
+ {
+ return reloadPanel(st);
+ }
+ return rebuildMainHtml(st);
+ }
+ else if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
+ {
+ return showText(st, "Sorry", "You have to wait a while!<br>if you wish to use my services!", false, "Return", "main");
+ }
+ if (!BUFF_WITH_KARMA && (player.getKarma() > 0))
+ {
+ return showText(st, "Info", "You have too much <font color=FF0000>karma!</font><br>Come back,<br>when you don't have any karma!", false, "Return", "main");
+ }
+ else if (OlympiadManager.getInstance().isRegistered(player))
+ {
+ return showText(st, "Info", "You can not buff while you are in <font color=FF0000>Olympiad!</font><br>Come back,<br>when you are out of the Olympiad.", false, "Return", "main");
+ }
+ else if (TvTEvent.isPlayerParticipant(player.getObjectId()))
+ {
+ return showText(st, "Info", "You can not buff while you are in <font color=\"FF0000\">TvT!</font><br>Come back,<br>when you are out of TvT!", false, "Return", "main");
+ }
+ else if (player.getLevel() < MIN_LEVEL)
+ {
+ return showText(st, "Info", "Your level is too low!<br>You have to be at least level <font color=LEVEL>" + MIN_LEVEL + "</font>,<br>to use my services!", false, "Return", "main");
+ }
+ else if (player.getPvpFlag() > 0)
+ {
+ return showText(st, "Info", "You can't buff while you are <font color=800080>flagged!</font><br>Wait some time and try again!", false, "Return", "main");
+ }
+ else if (player.isInCombat())
+ {
+ return showText(st, "Info", "You can't buff while you are attacking!<br>Stop your fight and try again!", false, "Return", "main");
+ }
+ else
+ {
+ return rebuildMainHtml(st);
+ }
+ }
+
+ @Override
+ public boolean showResult(L2PcInstance player, String res)
+ {
+ if (SMART_WINDOW)
+ {
+ if ((player != null) && (res != null) && res.startsWith("<html>"))
+ {
+ final NpcHtmlMessage npcReply = new NpcHtmlMessage();
+ npcReply.setHtml(res);
+ player.sendPacket(npcReply);
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ return false;
+ }
+ }
+ return super.showResult(player, res);
+ }
+
+ private String getSkillIconHtml(int id, int level)
+ {
+ String iconNumber = getSkillIconNumber(id, level);
+ return "<button action=\"bypass -h Quest " + QUEST_LOADING_INFO + " description " + id + " " + level + " x\" width=32 height=32 back=\"Icon.skill" + iconNumber + "\" fore=\"Icon.skill" + iconNumber + "\">";
+ }
+
+ private String getSkillIconNumber(int id, int level)
+ {
+ String formato;
+ if (id == 4)
+ {
+ formato = "0004";
+ }
+ else if ((id > 9) && (id < 100))
+ {
+ formato = "00" + id;
+ }
+ else if ((id > 99) && (id < 1000))
+ {
+ formato = "0" + id;
+ }
+ else if (id == 1517)
+ {
+ formato = "1536";
+ }
+ else if (id == 1518)
+ {
+ formato = "1537";
+ }
+ else if (id == 1547)
+ {
+ formato = "0065";
+ }
+ else if (id == 2076)
+ {
+ formato = "0195";
+ }
+ else if ((id > 4550) && (id < 4555))
+ {
+ formato = "5739";
+ }
+ else if ((id > 4698) && (id < 4701))
+ {
+ formato = "1331";
+ }
+ else if ((id > 4701) && (id < 4704))
+ {
+ formato = "1332";
+ }
+ else if (id == 6049)
+ {
+ formato = "0094";
+ }
+ else
+ {
+ formato = String.valueOf(id);
+ }
+ return formato;
+ }
+
+ static public void main(String[] args)
+ {
+ new NpcBuffer();
+ }
+}
\ No newline at end of file
Index: dist/game/data/stats/npcs/custom/custom.xml
===================================================================
--- dist/game/data/stats/npcs/custom/custom.xml (revision 10413)
+++ dist/game/data/stats/npcs/custom/custom.xml (working copy)
@@ -58,4 +58,10 @@
<height normal="22.25" />
</collision>
</npc>
+ <npc id="12" displayId="32226" name="Rin4a" usingServerSideName="true" title="NPC Buffer" usingServerSideTitle="true" type="L2NpcBuffer">
+ <collision>
+ <radius normal="11" />
+ <height normal="22.25" />
+ </collision>
+ </npc>
</list>
\ No newline at end of file
Index: dist/sql/game/scheme_npcbuffer.sql
===================================================================
--- dist/sql/game/scheme_npcbuffer.sql (revision 0)
+++ dist/sql/game/scheme_npcbuffer.sql (working copy)
@@ -0,0 +1,182 @@
+DROP TABLE IF EXISTS `npcbuffer_buff_list`;
+DROP TABLE IF EXISTS `npcbuffer_scheme_contents`;
+DROP TABLE IF EXISTS `npcbuffer_scheme_list`;
+
+CREATE TABLE `npcbuffer_buff_list` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `buff_class` int(2) DEFAULT NULL,
+ `buffType` varchar(10) DEFAULT NULL,
+ `buffId` int(5) DEFAULT '0',
+ `buffLevel` int(5) DEFAULT NULL,
+ `forClass` tinyint(1) DEFAULT NULL,
+ `canUse` tinyint(1) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) AUTO_INCREMENT=136;
+CREATE TABLE `npcbuffer_scheme_contents` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `scheme_id` int(11) DEFAULT NULL,
+ `skill_id` int(8) DEFAULT NULL,
+ `skill_level` int(4) DEFAULT NULL,
+ `buff_class` int(2) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) AUTO_INCREMENT=30;
+CREATE TABLE `npcbuffer_scheme_list` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `player_id` varchar(40) DEFAULT NULL,
+ `scheme_name` varchar(36) DEFAULT NULL,
+ `mod_accepted` tinyint(1) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) AUTO_INCREMENT=7;
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('1', '0', 'buff', '1036', '2', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('2', '0', 'buff', '1040', '3', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('3', '0', 'buff', '1043', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('4', '0', 'buff', '1044', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('5', '0', 'buff', '1045', '6', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('6', '0', 'buff', '1047', '4', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('7', '0', 'buff', '1048', '6', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('8', '0', 'buff', '1059', '3', '1', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('9', '0', 'buff', '1068', '3', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('10', '0', 'buff', '1077', '3', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('11', '0', 'buff', '1085', '3', '1', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('12', '0', 'buff', '1086', '2', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('13', '0', 'buff', '1087', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('14', '0', 'buff', '1204', '2', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('15', '0', 'buff', '1240', '3', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('16', '0', 'buff', '1242', '3', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('17', '0', 'buff', '1243', '6', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('18', '0', 'buff', '1257', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('19', '0', 'buff', '1268', '4', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('20', '0', 'buff', '1303', '2', '1', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('21', '0', 'buff', '1304', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('22', '0', 'buff', '1307', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('23', '0', 'buff', '1311', '6', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('24', '0', 'buff', '1397', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('25', '0', 'buff', '1460', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('26', '0', 'buff', '1232', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('27', '0', 'buff', '1238', '3', '3', '0');
+INSERT INTO `npcbuffer_buff_list` VALUES ('28', '0', 'special', '1323', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('29', '0', 'special', '1388', '3', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('30', '0', 'special', '1389', '3', '1', '1');
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('31', '1', 'song', '264', '1', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('32', '1', 'song', '265', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('33', '1', 'song', '266', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('34', '1', 'song', '267', '1', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('35', '1', 'song', '268', '1', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('36', '1', 'song', '269', '1', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('37', '1', 'song', '270', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('38', '1', 'song', '304', '1', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('39', '1', 'song', '305', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('40', '1', 'song', '306', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('41', '1', 'song', '308', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('42', '1', 'song', '349', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('43', '1', 'song', '363', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('44', '1', 'song', '364', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('45', '1', 'song', '529', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('46', '1', 'song', '764', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('47', '1', 'song', '914', '1', '3', '1');
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('48', '2', 'dance', '271', '1', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('49', '2', 'dance', '272', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('50', '2', 'dance', '273', '1', '1', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('51', '2', 'dance', '274', '1', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('52', '2', 'dance', '275', '1', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('53', '2', 'dance', '276', '1', '1', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('54', '2', 'dance', '277', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('55', '2', 'dance', '307', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('56', '2', 'dance', '309', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('57', '2', 'dance', '310', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('58', '2', 'dance', '311', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('59', '2', 'dance', '365', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('60', '2', 'dance', '366', '1', '3', '0');
+INSERT INTO `npcbuffer_buff_list` VALUES ('61', '2', 'dance', '530', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('62', '2', 'dance', '765', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('63', '2', 'dance', '915', '1', '3', '1');
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('64', '3', 'resist', '1461', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('65', '3', 'chant', '1002', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('66', '3', 'chant', '1006', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('67', '3', 'chant', '1007', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('68', '3', 'chant', '1009', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('69', '3', 'chant', '1251', '2', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('70', '3', 'chant', '1252', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('71', '3', 'chant', '1253', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('72', '3', 'chant', '1284', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('73', '3', 'chant', '1308', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('74', '3', 'chant', '1309', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('75', '3', 'chant', '1310', '4', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('76', '3', 'chant', '1362', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('77', '3', 'special', '1499', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('78', '3', 'special', '1500', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('79', '3', 'special', '1501', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('80', '3', 'special', '1502', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('81', '3', 'special', '1503', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('82', '3', 'special', '1504', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('83', '3', 'special', '1519', '1', '3', '1');
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('84', '4', 'others', '825', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('85', '4', 'others', '826', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('86', '4', 'others', '827', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('87', '4', 'others', '828', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('88', '4', 'others', '829', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('89', '4', 'others', '830', '1', '3', '1');
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('90', '5', 'others', '834', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('91', '5', 'others', '1442', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('92', '5', 'others', '1443', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('93', '5', 'others', '1444', '1', '3', '1');
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('94', '6', 'cubic', '67', '7', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('95', '6', 'cubic', '10', '8', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('96', '6', 'cubic', '22', '7', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('97', '6', 'cubic', '33', '8', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('98', '6', 'cubic', '278', '6', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('99', '6', 'cubic', '449', '4', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('100', '6', 'cubic', '1279', '9', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('101', '6', 'cubic', '1280', '9', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('102', '6', 'cubic', '1281', '9', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('103', '6', 'cubic', '1328', '8', '3', '0');
+INSERT INTO `npcbuffer_buff_list` VALUES ('104', '6', 'cubic', '1329', '9', '3', '0');
+INSERT INTO `npcbuffer_buff_list` VALUES ('105', '6', 'cubic', '1330', '8', '3', '0');
+INSERT INTO `npcbuffer_buff_list` VALUES ('106', '6', 'cubic', '779', '1', '3', '1');
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('107', '7', 'special', '1062', '2', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('108', '7', 'special', '1355', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('109', '7', 'special', '1356', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('110', '7', 'special', '1357', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('111', '7', 'special', '1363', '1', '0', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('112', '7', 'special', '1413', '1', '1', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('114', '7', 'special', '1457', '1', '3', '0');
+INSERT INTO `npcbuffer_buff_list` VALUES ('115', '7', 'special', '4699', '13', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('116', '7', 'special', '4700', '13', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('117', '7', 'special', '4702', '13', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('118', '7', 'special', '4703', '13', '3', '1');
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('119', '8', 'resist', '1032', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('120', '8', 'resist', '1033', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('121', '8', 'resist', '1035', '4', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('122', '8', 'resist', '1078', '6', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('123', '8', 'resist', '1182', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('124', '8', 'resist', '1189', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('125', '8', 'resist', '1191', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('126', '8', 'resist', '1259', '4', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('127', '8', 'resist', '1352', '1', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('128', '8', 'resist', '1353', '1', '2', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('129', '8', 'resist', '1354', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('130', '8', 'resist', '1392', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('131', '8', 'resist', '1393', '3', '3', '1');
+
+INSERT INTO `npcbuffer_buff_list` VALUES ('132', '8', 'overlord', '1003', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('133', '8', 'overlord', '1004', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('134', '8', 'overlord', '1005', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('135', '8', 'overlord', '1008', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('136', '8', 'overlord', '1249', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('137', '8', 'overlord', '1250', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('138', '8', 'overlord', '1260', '3', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('139', '8', 'overlord', '1261', '2', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('140', '8', 'overlord', '1282', '2', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('141', '8', 'overlord', '1364', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('142', '8', 'overlord', '1365', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('143', '8', 'overlord', '1415', '1', '3', '1');
+INSERT INTO `npcbuffer_buff_list` VALUES ('144', '8', 'overlord', '1416', '1', '3', '1');
\ No newline at end of file


Posted
 

 

I get those 2 errors.Any idea jow to fix?

 

 

 

 

----------

1. ERROR in \custom\NpcBuffer\NpcBuffer.java (at line 1676)

        if (st.getQuestItemsCount(skill.getItemConsumeId()) < skill.getItemConsu

me())

                                                                    ^^^^^^^^^^^^

^^

The method getItemConsume() is undefined for the type Skill

----------

2. ERROR in \custom\NpcBuffer\NpcBuffer.java (at line 1678)

        return showText(st, "Sorry", "You don't have the enough items:<br>You ne

ed: <font color=LEVEL>" + skill.getItemConsume() + " " + getItemNameHtml(st, ski

ll.getItemConsumeId()) + "!", false, "0", "0");

 

                                ^^^^^^^^^^^^^^

The method getItemConsume() is undefined for the type Skill

----------

2 problems (2 errors)

The method getItemConsume() is undefined for the type com.l2jserver.gameserver.m

odel.skills.Skill

The method getItemConsume() is undefined for the type com.l2jserver.gameserver.m

odel.skills.Skill

Dead code

Dead code

 

Posted (edited)

 

 
 
I get those 2 errors.Any idea jow to fix?
 
 
 
 
----------
1. ERROR in \custom\NpcBuffer\NpcBuffer.java (at line 1676)
        if (st.getQuestItemsCount(skill.getItemConsumeId()) < skill.getItemConsu
me())
                                                                    ^^^^^^^^^^^^
^^
The method getItemConsume() is undefined for the type Skill
----------
2. ERROR in \custom\NpcBuffer\NpcBuffer.java (at line 1678)
        return showText(st, "Sorry", "You don't have the enough items:<br>You ne
ed: <font color=LEVEL>" + skill.getItemConsume() + " " + getItemNameHtml(st, ski
ll.getItemConsumeId()) + "!", false, "0", "0");
 
                                ^^^^^^^^^^^^^^
The method getItemConsume() is undefined for the type Skill
----------
2 problems (2 errors)
The method getItemConsume() is undefined for the type com.l2jserver.gameserver.m
odel.skills.Skill
The method getItemConsume() is undefined for the type com.l2jserver.gameserver.m
odel.skills.Skill
Dead code
Dead code

 

 

This code is for l2j-server h5 beta.

Edited by u3games
Posted

Do you have any errors in GS console?

 

No I dont get errors.Now I have stuck in the part where admin can click on buffer and the buffs but nothing happens.Also a simple player get the answer from buffer..."Im sorry if you want to get my services you have to wait bla..bla..bla...".

Im not expert in java ang got me tired to look all those symbols dont know what they mean.

Any tips how to fix that?

 

 

This code is for l2j-server h5 beta.

 

Yes and I dont have so much knowledge.Pain in the a...    :(

Posted

Code updated:

/*
 * Copyright (C) 2004-2014 L2J DataPack
 * 
 * This file is part of L2J DataPack.
 * 
 * L2J DataPack is free software: you can redistribute it and/or modify
 * it under 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.
 * 
 * L2J DataPack 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 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 custom.NpcBuffer;

import static com.l2jserver.gameserver.util.Util.formatAdena;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
import com.l2jserver.gameserver.model.actor.stat.PcStat;
import com.l2jserver.gameserver.model.actor.stat.SummonStat;
import com.l2jserver.gameserver.model.actor.status.PcStatus;
import com.l2jserver.gameserver.model.actor.status.SummonStatus;
import com.l2jserver.gameserver.model.effects.L2EffectType;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SetSummonRemainTime;
import com.l2jserver.gameserver.network.serverpackets.SetupGauge;

public class NpcBuffer extends Quest
{
	private static final boolean DEBUG = false;
	
	private static void print(Exception e)
	{
		_log.warning(">>>" + e.toString() + "<<<");
		if (DEBUG)
		{
			e.printStackTrace();
		}
	}
	
	private static final String QUEST_LOADING_INFO = "NpcBuffer";
	private static final int NPC_ID = 12;
	
	private static final String TITLE_NAME = "Scheme Buffer";
	private static final boolean SCRIPT_RELOAD = false;
	private static final boolean SMART_WINDOW = true;
	private static final boolean ENABLE_BUFF_SECTION = true;
	private static final boolean ENABLE_SCHEME_SYSTEM = true;
	private static final boolean ENABLE_HEAL = true;
	private static final boolean ENABLE_HEAL_IN_COMBAT = false;
	private static final boolean ENABLE_BUFFS = true;
	private static final boolean ENABLE_RESIST = true;
	private static final boolean ENABLE_SONGS = true;
	private static final boolean ENABLE_DANCES = true;
	private static final boolean ENABLE_CHANTS = false;
	private static final boolean ENABLE_OTHERS = false;
	private static final boolean ENABLE_SPECIAL = false;
	private static final boolean ENABLE_CUBIC = false;
	private static final boolean ENABLE_BUFF_REMOVE = true;
	private static final boolean ENABLE_BUFF_SET = true;
	private static final boolean BUFF_WITH_KARMA = true;
	private static final boolean FREE_BUFFS = false;
	private static final boolean TIME_OUT = true;
	private static final int TIME_OUT_TIME = 3;
	private static final int MIN_LEVEL = 1;
	private static final int BUFF_REMOVE_PRICE = 10000;
	private static final int HEAL_PRICE = 10000;
	private static final int BUFF_PRICE = 1000;
	private static final int RESIST_PRICE = 1000;
	private static final int SONG_PRICE = 1000;
	private static final int DANCE_PRICE = 1000;
	private static final int CHANT_PRICE = 1000;
	private static final int OTHERS_PRICE = 1000;
	private static final int SPECIAL_PRICE = 1000;
	private static final int CUBIC_PRICE = 1000;
	private static final int BUFF_SET_PRICE = 15000;
	private static final int SCHEME_BUFF_PRICE = 20000;
	private static final int SCHEMES_PER_PLAYER = 4;
	private static final int CONSUMABLE_ID = 57;
	private static final int MAX_SCHEME_BUFFS = Config.BUFFS_MAX_AMOUNT;
	private static final int MAX_SCHEME_DANCES = Config.DANCES_MAX_AMOUNT;
	
	private static final String SET_FIGHTER = "Fighter";
	private static final String SET_MAGE = "Mage";
	private static final String SET_ALL = "All";
	private static final String SET_NONE = "None";
	
	private String rebuildMainHtml(QuestState st)
	{
		String MAIN_HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>";
		String MESSAGE = "";
		int td = 0;
		String[] TRS =
		{
			"<tr><td height=25>",
			"</td>",
			"<td height=25>",
			"</td></tr>"
		};
		
		final String bottonA, bottonB, bottonC;
		if (st.getInt("Pet-On-Off") == 1)
		{
			bottonA = "Auto Buff Pet";
			bottonB = "Heal My Pet";
			bottonC = "Remove Pet Buffs";
			MAIN_HTML_MESSAGE += "<button value=\"Player Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		else
		{
			bottonA = "Auto Buff";
			bottonB = "Heal";
			bottonC = "Remove Buffs";
			MAIN_HTML_MESSAGE += "<button value=\"Pet Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 1 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		
		if (ENABLE_BUFF_SECTION)
		{
			if (ENABLE_BUFFS)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_RESIST)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Resist\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_resists 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_SONGS)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_songs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_DANCES)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_dances 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_CHANTS)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_chants 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_SPECIAL)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Special\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_special 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_OTHERS)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Others\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_others 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
		}
		
		if (ENABLE_CUBIC)
		{
			if (td > 2)
			{
				td = 0;
			}
			MESSAGE += TRS[td] + "<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_cubic 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
			td += 2;
		}
		
		if (MESSAGE.length() > 0)
		{
			MAIN_HTML_MESSAGE += "<BR1><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=444444><tr>" + "<td><font color=00FFFF>Buffs:</font></td><td align=right>...</td></tr></table>" + "<BR1><table cellspacing=0 cellpadding=0>" + MESSAGE + "</table>";
			MESSAGE = "";
			td = 0;
		}
		
		if (ENABLE_BUFF_SET)
		{
			if (td > 2)
			{
				td = 0;
			}
			MESSAGE += TRS[td] + "<button value=\"" + bottonA + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " castBuffSet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
			td += 2;
		}
		
		if (ENABLE_HEAL)
		{
			if (td > 2)
			{
				td = 0;
			}
			MESSAGE += TRS[td] + "<button value=\"" + bottonB + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " heal 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
			td += 2;
		}
		
		if (ENABLE_BUFF_REMOVE)
		{
			if (td > 2)
			{
				td = 0;
			}
			MESSAGE += TRS[td] + "<button value=\"" + bottonC + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " removeBuffs 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
			td += 2;
		}
		
		if (MESSAGE.length() > 0)
		{
			MAIN_HTML_MESSAGE += "<BR1><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=444444><tr>" + "<td><font color=00FFFF>Preset:</font></td><td align=right><font color=LEVEL>" + formatAdena(BUFF_SET_PRICE) + "</font> adena</td></tr></table>" + "<BR1><table cellspacing=0 cellpadding=0>" + MESSAGE + "</table>";
			MESSAGE = "";
			td = 0;
		}
		
		if (ENABLE_SCHEME_SYSTEM)
		{
			MAIN_HTML_MESSAGE += generateScheme(st);
		}
		
		if (st.getPlayer().isGM())
		{
			MAIN_HTML_MESSAGE += "<br><button value=\"GM Manage Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		MAIN_HTML_MESSAGE += "<br><font color=303030>" + TITLE_NAME + "</font>" + "</center></body></html>";
		return MAIN_HTML_MESSAGE;
	}
	
	private String generateScheme(QuestState st)
	{
		List<String> schemeName = new ArrayList<>();
		List<String> schemeId = new ArrayList<>();
		String HTML = "";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
			rss.setInt(1, st.getPlayer().getObjectId());
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				schemeName.add(action.getString("scheme_name"));
				schemeId.add(action.getString("id"));
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		HTML += "<BR1><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=444444><tr>" + "<td><font color=00FFFF>Scheme:</font></td><td align=right><font color=LEVEL>" + formatAdena(SCHEME_BUFF_PRICE) + "</font> adena</TD></TR></table>" + "<BR1><table cellspacing=0 cellpadding=0>";
		if (schemeName.size() > 0)
		{
			String MESSAGE = "";
			int td = 0;
			String[] TRS =
			{
				"<tr><td>",
				"</td>",
				"<td>",
				"</td></tr>"
			};
			for (int i = 0; i < schemeName.size(); ++i)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"" + schemeName.get(i) + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " cast " + schemeId.get(i) + " x x\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			
			if (MESSAGE.length() > 0)
			{
				HTML += "<table>" + MESSAGE + "</table>";
			}
		}
		
		if (schemeName.size() < SCHEMES_PER_PLAYER)
		{
			HTML += "<BR1><table><tr><td><button value=\"Create\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " create_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
		}
		else
		{
			HTML += "<BR1><table width=100><tr>";
		}
		
		if (schemeName.size() > 0)
		{
			HTML += "<td><button value=\"Edit\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "<td><button value=\"Delete\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>";
		}
		else
		{
			HTML += "</tr></table>";
		}
		return HTML;
	}
	
	private String reloadPanel(QuestState st)
	{
		return "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" + "<font color=303030>" + TITLE_NAME + "</font><br>" + "<img src=\"L2UI.SquareGray\" width=250 height=1><br>" + "<table width=260 border=0 bgcolor=444444>" + "<tr><td><br></td></tr>" + "<tr><td align=center><font color=FFFFFF>This option can be seen by GMs only and it<br1>allow to update any changes made in the<br1>script. You can disable this option in<br1>the settings section within the Script.<br><font color=LEVEL>Do you want to update the SCRIPT?</font></font></td></tr>" + "<tr><td></td></tr></table><br>" + "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>" + "<button value=\"Yes\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " reloadscript 1 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"No\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " reloadscript 0 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "</center></body></html>";
	}
	
	private String getItemNameHtml(QuestState st, int itemval)
	{
		return "" + itemval + ";";
	}
	
	private int getBuffCount(String scheme)
	{
		int count = 0;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT buff_class FROM npcbuffer_scheme_contents WHERE scheme_id=?");
			rss.setString(1, scheme);
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				++count;
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return count;
	}
	
	private String getBuffType(int id)
	{
		String val = "none";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement act = con.prepareStatement("SELECT buffType FROM npcbuffer_buff_list WHERE buffId=? LIMIT 1");
			act.setInt(1, id);
			ResultSet rs = act.executeQuery();
			if (rs.next())
			{
				val = rs.getString("buffType");
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return val;
	}
	
	private boolean isEnabled(int id, int level)
	{
		boolean val = false;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement act = con.prepareStatement("SELECT canUse FROM npcbuffer_buff_list WHERE buffId=? AND buffLevel=? LIMIT 1");
			act.setInt(1, id);
			act.setInt(2, level);
			ResultSet rs = act.executeQuery();
			if (rs.next())
			{
				if ("1".equals(rs.getString("canUse")))
				{
					val = true;
				}
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return val;
	}
	
	private boolean isUsed(String scheme, int id, int level)
	{
		boolean used = false;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT id FROM npcbuffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1");
			rss.setString(1, scheme);
			rss.setInt(2, id);
			rss.setInt(3, level);
			ResultSet action = rss.executeQuery();
			if (action.next())
			{
				used = true;
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return used;
	}
	
	private int getClassBuff(String id)
	{
		int val = 0;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement getTipo = con.prepareStatement("SELECT buff_class FROM npcbuffer_buff_list WHERE buffId=?");
			getTipo.setString(1, id);
			ResultSet gt = getTipo.executeQuery();
			if (gt.next())
			{
				val = gt.getInt("buff_class");
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return val;
	}
	
	private String showText(QuestState st, String type, String text, boolean buttonEnabled, String buttonName, String location)
	{
		String MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
		MESSAGE += "<font color=LEVEL>" + type + "</font><br>" + text + "<br>";
		if (buttonEnabled)
		{
			MESSAGE += "<button value=\"" + buttonName + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect " + location + " 0 0\" width=100 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		MESSAGE += "<font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		st.playSound("ItemSound3.sys_shortage");
		return MESSAGE;
	}
	
	private String reloadConfig(QuestState st)
	{
		try
		{
			if (QuestManager.getInstance().reload(QUEST_LOADING_INFO))
			{
				st.getPlayer().sendMessage("The script and settings have been reloaded successfully.");
			}
			else
			{
				st.getPlayer().sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server");
			}
		}
		catch (Exception e)
		{
			st.getPlayer().sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server");
			print(e);
		}
		return rebuildMainHtml(st);
	}
	
	private NpcBuffer()
	{
		super(-1, NpcBuffer.class.getSimpleName(), "custom");
		addStartNpc(NPC_ID);
		addFirstTalkId(NPC_ID);
		addTalkId(NPC_ID);
	}
	
	private boolean isPetBuff(QuestState st)
	{
		return st.getInt("Pet-On-Off") != 0;
	}
	
	private String createScheme()
	{
		return "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>You MUST seprerate new words with a dot (.)<br><br>Scheme name: <edit var=\"name\" width=100><br><br>" + "<button value=\"Create Scheme\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " create $name no_name x x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
	}
	
	private String deleteScheme(L2PcInstance player)
	{
		String HTML = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Available schemes:<br><br>";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
			rss.setInt(1, player.getObjectId());
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				HTML += "<button value=\"" + action.getString("scheme_name") + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete_c " + action.getString("id") + " " + action.getString("scheme_name") + " x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML;
	}
	
	private String editScheme(L2PcInstance player)
	{
		String HTML = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Select a scheme that you would like to manage:<br><br>";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
			rss.setInt(1, player.getObjectId());
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				String name = action.getString("scheme_name");
				String id = action.getString("id");
				HTML += "<button value=\"" + name + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_select " + id + " x x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML;
	}
	
	private String getOptionList(String scheme)
	{
		int bcount = getBuffCount(scheme);
		String HTML = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>There are <font color=LEVEL>" + bcount + "</font> buffs in current scheme!<br><br>";
		if (bcount < (MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES))
		{
			HTML += "<button value=\"Add buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_1 " + scheme + " 1 x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (bcount > 0)
		{
			HTML += "<button value=\"Remove buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_2 " + scheme + " 1 x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_1 0 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML;
	}
	
	private String buildHtml(String buffType)
	{
		String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><br>";
		
		List<String> availableBuffs = new ArrayList<>();
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement getList = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE buffType=\"" + buffType + "\" AND canUse=1  ORDER BY Buff_Class ASC, id");
			ResultSet rs = getList.executeQuery();
			while (rs.next())
			{
				int bId = rs.getInt("buffId");
				int bLevel = rs.getInt("buffLevel");
				String bName = SkillData.getInstance().getSkill(bId, bLevel).getName();
				bName = bName.replace(" ", "+");
				availableBuffs.add(bName + "_" + bId + "_" + bLevel);
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		
		if (availableBuffs.size() == 0)
		{
			HTML_MESSAGE += "No buffs are available at this moment!";
		}
		else
		{
			if (FREE_BUFFS)
			{
				HTML_MESSAGE += "All buffs are for <font color=LEVEL>free</font>!";
			}
			else
			{
				int price = 0;
				switch (buffType)
				{
					case "buff":
						price = BUFF_PRICE;
						break;
					case "resist":
						price = RESIST_PRICE;
						break;
					case "song":
						price = SONG_PRICE;
						break;
					case "dance":
						price = DANCE_PRICE;
						break;
					case "chant":
						price = CHANT_PRICE;
						break;
					case "others":
						price = OTHERS_PRICE;
						break;
					case "special":
						price = SPECIAL_PRICE;
						break;
					case "cubic":
						price = CUBIC_PRICE;
						break;
					default:
						if (DEBUG)
						{
							throw new RuntimeException();
						}
				}
				HTML_MESSAGE += "All special buffs cost <font color=LEVEL>" + formatAdena(price) + "</font> adena!";
			}
			HTML_MESSAGE += "<BR1><table>";
			for (String buff : availableBuffs)
			{
				buff = buff.replace("_", " ");
				String[] buffSplit = buff.split(" ");
				String name = buffSplit[0];
				int id = Integer.parseInt(buffSplit[1]);
				int level = Integer.parseInt(buffSplit[2]);
				name = name.replace("+", " ");
				HTML_MESSAGE += "<tr><td>" + getSkillIconHtml(id, level) + "</td><td><button value=\"" + name + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs " + id + " " + level + " " + buffType + "\" width=190 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
			}
			HTML_MESSAGE += "</table>";
		}
		
		HTML_MESSAGE += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML_MESSAGE;
	}
	
	private String generateQuery(int case1, int case2)
	{
		StringBuilder qry = new StringBuilder();
		if (ENABLE_BUFFS)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"buff\"");
			}
		}
		if (ENABLE_RESIST)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"resist\"");
			}
		}
		if (ENABLE_SONGS)
		{
			if (case2 < MAX_SCHEME_DANCES)
			{
				qry.append(",\"song\"");
			}
		}
		if (ENABLE_DANCES)
		{
			if (case2 < MAX_SCHEME_DANCES)
			{
				qry.append(",\"dance\"");
			}
		}
		if (ENABLE_CHANTS)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"chant\"");
			}
		}
		if (ENABLE_OTHERS)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"others\"");
			}
		}
		if (ENABLE_SPECIAL)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"special\"");
			}
		}
		if (qry.length() > 0)
		{
			qry.deleteCharAt(0);
		}
		return qry.toString();
	}
	
	private String viewAllSchemeBuffs$getBuffCount(String scheme)
	{
		int count = 0;
		int D_S_Count = 0;
		int B_Count = 0;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT buff_class FROM npcbuffer_scheme_contents WHERE scheme_id=?");
			rss.setString(1, scheme);
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				++count;
				int val = action.getInt("buff_class");
				if ((val == 1) || (val == 2))
				{
					++D_S_Count;
				}
				else
				{
					++B_Count;
				}
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		String res = count + " " + B_Count + " " + D_S_Count;
		return res;
	}
	
	private String viewAllSchemeBuffs(String scheme, String page, String action)
	{
		List<String> buffList = new ArrayList<>();
		String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><br>";
		String[] eventSplit = viewAllSchemeBuffs$getBuffCount(scheme).split(" ");
		int TOTAL_BUFF = Integer.parseInt(eventSplit[0]);
		int BUFF_COUNT = Integer.parseInt(eventSplit[1]);
		int DANCE_SONG = Integer.parseInt(eventSplit[2]);
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			if (action.equals("add"))
			{
				HTML_MESSAGE += "You can add <font color=LEVEL>" + (MAX_SCHEME_BUFFS - BUFF_COUNT) + "</font> Buffs and <font color=LEVEL>" + (MAX_SCHEME_DANCES - DANCE_SONG) + "</font> Dances more!";
				String QUERY = "SELECT * FROM npcbuffer_buff_list WHERE buffType IN (" + generateQuery(BUFF_COUNT, DANCE_SONG) + ") AND canUse=1 ORDER BY Buff_Class ASC, id";
				PreparedStatement getBuffCount = con.prepareStatement(QUERY);
				ResultSet rss = getBuffCount.executeQuery();
				while (rss.next())
				{
					String name = SkillData.getInstance().getSkill(rss.getInt("buffId"), rss.getInt("buffLevel")).getName();
					name = name.replace(" ", "+");
					buffList.add(name + "_" + rss.getInt("buffId") + "_" + rss.getInt("buffLevel"));
				}
			}
			else if (action.equals("remove"))
			{
				HTML_MESSAGE += "You have <font color=LEVEL>" + BUFF_COUNT + "</font> Buffs and <font color=LEVEL>" + DANCE_SONG + "</font> Dances";
				String QUERY = "SELECT * FROM npcbuffer_scheme_contents WHERE scheme_id=? ORDER BY Buff_Class ASC, id";
				PreparedStatement getBuffCount = con.prepareStatement(QUERY);
				getBuffCount.setString(1, scheme);
				ResultSet rss = getBuffCount.executeQuery();
				while (rss.next())
				{
					String name = SkillData.getInstance().getSkill(rss.getInt("skill_id"), rss.getInt("skill_level")).getName();
					name = name.replace(" ", "+");
					buffList.add(name + "_" + rss.getInt("skill_id") + "_" + rss.getInt("skill_level"));
				}
			}
			else if (DEBUG)
			{
				throw new RuntimeException();
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		
		HTML_MESSAGE += "<BR1><table border=0><tr>";
		final int buffsPerPage = 20;
		final String width, pageName;
		int pc = ((buffList.size() - 1) / buffsPerPage) + 1;
		if (pc > 5)
		{
			width = "25";
			pageName = "P";
		}
		else
		{
			width = "50";
			pageName = "Page ";
		}
		for (int ii = 1; ii <= pc; ++ii)
		{
			if (ii == Integer.parseInt(page))
			{
				HTML_MESSAGE += "<td width=" + width + " align=center><font color=LEVEL>" + pageName + ii + "</font></td>";
			}
			else if (action.equals("add"))
			{
				HTML_MESSAGE += "<td width=" + width + ">" + "<button value=\"" + pageName + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_1 " + scheme + " " + ii + " x\" width=" + width + " height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
			}
			else if (action.equals("remove"))
			{
				HTML_MESSAGE += "<td width=" + width + ">" + "<button value=\"" + pageName + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_2 " + scheme + " " + ii + " x\" width=" + width + " height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
			}
			else if (DEBUG)
			{
				throw new RuntimeException();
			}
		}
		HTML_MESSAGE += "</tr></table>";
		
		int limit = buffsPerPage * Integer.parseInt(page);
		int start = limit - buffsPerPage;
		int end = Math.min(limit, buffList.size());
		int k = 0;
		for (int i = start; i < end; ++i)
		{
			String value = buffList.get(i);
			value = value.replace("_", " ");
			String[] extr = value.split(" ");
			String name = extr[0];
			name = name.replace("+", " ");
			int id = Integer.parseInt(extr[1]);
			int level = Integer.parseInt(extr[2]);
			if (action.equals("add"))
			{
				if (!isUsed(scheme, id, level))
				{
					if ((k % 2) != 0)
					{
						HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
					}
					else
					{
						HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
					}
					HTML_MESSAGE += "<tr><td width=35>" + getSkillIconHtml(id, level) + "</td><td fixwidth=170>" + name + "</td><td><button value=\"Add\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " add_buff " + scheme + "_" + id + "_" + level + " " + page + " " + TOTAL_BUFF + "\" width=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</tr></table>";
					k += 1;
				}
			}
			else if (action.equals("remove"))
			{
				if ((k % 2) != 0)
				{
					HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
				}
				else
				{
					HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
				}
				HTML_MESSAGE += "<tr><td width=35>" + getSkillIconHtml(id, level) + "</td><td fixwidth=170>" + name + "</td><td><button value=\"Remove\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " remove_buff " + scheme + "_" + id + "_" + level + " " + page + " " + TOTAL_BUFF + "\" width=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</table>";
				k += 1;
			}
		}
		HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_select " + scheme + " x x\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML_MESSAGE;
	}
	
	private String viewAllBuffTypes()
	{
		String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
		HTML_MESSAGE += "<font color=LEVEL>[Buff management]</font><br>";
		if (ENABLE_BUFFS)
		{
			HTML_MESSAGE += "<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list buff Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_RESIST)
		{
			HTML_MESSAGE += "<button value=\"Resist Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list resist Resists 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_SONGS)
		{
			HTML_MESSAGE += "<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list song Songs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_DANCES)
		{
			HTML_MESSAGE += "<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list dance Dances 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_CHANTS)
		{
			HTML_MESSAGE += "<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list chant Chants 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_SPECIAL)
		{
			HTML_MESSAGE += "<button value=\"Special Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list special Special_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_OTHERS)
		{
			HTML_MESSAGE += "<button value=\"Others Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list others Others_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_CUBIC)
		{
			HTML_MESSAGE += "<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list cubic cubic_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_BUFF_SET)
		{
			HTML_MESSAGE += "<button value=\"Buff Sets\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list set Buff_Sets 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>";
		}
		HTML_MESSAGE += "<button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML_MESSAGE;
	}
	
	private String viewAllBuffs(String type, String typeName, String page)
	{
		List<String> buffList = new ArrayList<>();
		String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
		typeName = typeName.replace("_", " ");
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			final PreparedStatement getBuffCount;
			if (type.equals("set"))
			{
				getBuffCount = con.prepareStatement("SELECT * FROM npcbuffer_buff_list WHERE buffType IN (" + generateQuery(0, 0) + ") AND canUse=1");
			}
			else
			{
				getBuffCount = con.prepareStatement("SELECT * FROM npcbuffer_buff_list WHERE buffType=?");
				getBuffCount.setString(1, type);
			}
			ResultSet rss = getBuffCount.executeQuery();
			while (rss.next())
			{
				String name = SkillData.getInstance().getSkill(rss.getInt("buffId"), rss.getInt("buffLevel")).getName();
				name = name.replace(" ", "+");
				String usable = rss.getString("canUse");
				String forClass = rss.getString("forClass");
				String skill_id = rss.getString("buffId");
				String skill_level = rss.getString("buffLevel");
				buffList.add(name + "_" + forClass + "_" + page + "_" + usable + "_" + skill_id + "_" + skill_level);
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		Collections.sort(buffList);
		
		HTML_MESSAGE += "<font color=LEVEL>[Buff management - " + typeName + " - Page " + page + "]</font><br><table border=0><tr>";
		final int buffsPerPage;
		if (type.equals("set"))
		{
			buffsPerPage = 12;
		}
		else
		{
			buffsPerPage = 20;
		}
		final String width, pageName;
		int pc = ((buffList.size() - 1) / buffsPerPage) + 1;
		if (pc > 5)
		{
			width = "25";
			pageName = "P";
		}
		else
		{
			width = "50";
			pageName = "Page ";
		}
		typeName = typeName.replace(" ", "_");
		for (int ii = 1; ii <= pc; ++ii)
		{
			if (ii == Integer.parseInt(page))
			{
				HTML_MESSAGE += "<td width=" + width + " align=center><font color=LEVEL>" + pageName + ii + "</font></td>";
			}
			else
			{
				HTML_MESSAGE += "<td width=" + width + "><button value=\"" + pageName + "" + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list " + type + " " + typeName + " " + ii + "\" width=" + width + " height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
			}
		}
		HTML_MESSAGE += "</tr></table><br>";
		
		int limit = buffsPerPage * Integer.parseInt(page);
		int start = limit - buffsPerPage;
		int end = Math.min(limit, buffList.size());
		for (int i = start; i < end; ++i)
		{
			String value = buffList.get(i);
			value = value.replace("_", " ");
			String[] extr = value.split(" ");
			String name = extr[0];
			name = name.replace("+", " ");
			int forClass = Integer.parseInt(extr[1]);
			int usable = Integer.parseInt(extr[3]);
			String skillPos = extr[4] + "_" + extr[5];
			if ((i % 2) != 0)
			{
				HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
			}
			else
			{
				HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
			}
			if (type.equals("set"))
			{
				String listOrder = null;
				if (forClass == 0)
				{
					listOrder = "List=\"" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_ALL + ";" + SET_NONE + ";\"";
				}
				else if (forClass == 1)
				{
					listOrder = "List=\"" + SET_MAGE + ";" + SET_FIGHTER + ";" + SET_ALL + ";" + SET_NONE + ";\"";
				}
				else if (forClass == 2)
				{
					listOrder = "List=\"" + SET_ALL + ";" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_NONE + ";\"";
				}
				else if (forClass == 3)
				{
					listOrder = "List=\"" + SET_NONE + ";" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_ALL + ";\"";
				}
				HTML_MESSAGE += "<tr><td fixwidth=145>" + name + "</td><td width=70><combobox var=\"newSet" + i + "\" width=70 " + listOrder + "></td>" + "<td width=50><button value=\"Update\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " changeBuffSet " + skillPos + " $newSet" + i + " " + page + "\" width=50 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
			}
			else
			{
				HTML_MESSAGE += "<tr><td fixwidth=170>" + name + "</td><td width=80>";
				if (usable == 1)
				{
					HTML_MESSAGE += "<button value=\"Disable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff " + skillPos + " 0-" + page + " " + type + "\" width=80 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
				}
				else if (usable == 0)
				{
					HTML_MESSAGE += "<button value=\"Enable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff " + skillPos + " 1-" + page + " " + type + "\" width=80 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
				}
			}
			HTML_MESSAGE += "</table>";
		}
		HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML_MESSAGE;
	}
	
	private void manageSelectedBuff(String buffPosId, String canUseBuff)
	{
		String[] bpid = buffPosId.split("_");
		String bId = bpid[0];
		String bLvl = bpid[1];
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement upd = con.prepareStatement("UPDATE npcbuffer_buff_list SET canUse=? WHERE buffId=? AND buffLevel=? LIMIT 1");
			upd.setString(1, canUseBuff);
			upd.setString(2, bId);
			upd.setString(3, bLvl);
			upd.executeUpdate();
			upd.close();
		}
		catch (SQLException e)
		{
			print(e);
		}
	}
	
	private String manageSelectedSet(String id, String newVal, String opt3)
	{
		String[] bpid = id.split("_");
		String bId = bpid[0];
		String bLvl = bpid[1];
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement upd = con.prepareStatement("UPDATE npcbuffer_buff_list SET forClass=? WHERE buffId=? AND bufflevel=?");
			upd.setString(1, newVal);
			upd.setString(2, bId);
			upd.setString(3, bLvl);
			upd.executeUpdate();
			upd.close();
		}
		catch (SQLException e)
		{
			print(e);
		}
		return viewAllBuffs("set", "Buff Sets", opt3);
	}
	
	private void addTimeout(QuestState st, int gaugeColor, int amount, int offset)
	{
		int endtime = (int) ((System.currentTimeMillis() + (amount * 1000)) / 1000);
		st.set("blockUntilTime", String.valueOf(endtime));
		st.getPlayer().sendPacket(new SetupGauge(gaugeColor, (amount * 1000) + offset));
	}
	
	private void heal(L2PcInstance player, boolean isPet)
	{
		L2Summon target = player.getSummon();
		if (!isPet)
		{
			PcStatus pcStatus = player.getStatus();
			PcStat pcStat = player.getStat();
			pcStatus.setCurrentHp(pcStat.getMaxHp());
			pcStatus.setCurrentMp(pcStat.getMaxMp());
			pcStatus.setCurrentCp(pcStat.getMaxCp());
		}
		else if (target != null)
		{
			SummonStatus petStatus = target.getStatus();
			SummonStat petStat = target.getStat();
			petStatus.setCurrentHp(petStat.getMaxHp());
			petStatus.setCurrentMp(petStat.getMaxMp());
			if (target instanceof L2PetInstance)
			{
				L2PetInstance pet = (L2PetInstance) target;
				pet.setCurrentFed(pet.getMaxFed());
				player.sendPacket(new SetSummonRemainTime(pet.getMaxFed(), pet.getCurrentFed()));
			}
			else if (target instanceof L2ServitorInstance)
			{
				L2ServitorInstance summon = (L2ServitorInstance) target;
				// FIXME: summon.setLifeTimeRemaining(summon.getLifeTimeRemaining() - summon.getLifeTime());
				summon.setLifeTimeRemaining(summon.getLifeTimeRemaining() + summon.getLifeTime());
				player.sendPacket(new SetSummonRemainTime(summon.getLifeTime(), summon.getLifeTimeRemaining()));
			}
			else if (DEBUG)
			{
				throw new RuntimeException();
			}
		}
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		if (DEBUG)
		{
			System.out.println(getScriptName() + "#onAdvEvent('" + event + "'," + (npc == null ? "NULL" : npc.getId() + npc.getName()) + "," + (player == null ? "NULL" : player.getName()) + ")");
		}
		QuestState st = player.getQuestState(QUEST_LOADING_INFO);
		String[] eventSplit = event.split(" ", 4);
		if (eventSplit.length != 4)
		{
			player.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN);
			return null;
		}
		String eventParam0 = eventSplit[0];
		String eventParam1 = eventSplit[1];
		String eventParam2 = eventSplit[2];
		String eventParam3 = eventSplit[3];
		
		switch (eventParam0)
		{
			case "reloadscript":
				if (eventParam1.equals("1"))
				{
					return reloadConfig(st);
				}
				if (eventParam1.equals("0"))
				{
					return rebuildMainHtml(st);
				}
				if (DEBUG)
				{
					throw new RuntimeException();
				}
				
			case "redirect":
				switch (eventParam1)
				{
					case "main":
						return rebuildMainHtml(st);
					case "manage_buffs":
						return viewAllBuffTypes();
					case "view_buffs":
						return buildHtml("buff");
					case "view_resists":
						return buildHtml("resist");
					case "view_songs":
						return buildHtml("song");
					case "view_dances":
						return buildHtml("dance");
					case "view_chants":
						return buildHtml("chant");
					case "view_others":
						return buildHtml("others");
					case "view_special":
						return buildHtml("special");
					case "view_cubic":
						return buildHtml("cubic");
					default:
						if (DEBUG)
						{
							throw new RuntimeException();
						}
				}
				
			case "buffpet":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					st.set("Pet-On-Off", eventParam1);
					if (TIME_OUT)
					{
						addTimeout(st, 3, TIME_OUT_TIME / 2, 600);
					}
				}
				return rebuildMainHtml(st);
				
			case "create":
			{
				String param = eventParam1.replaceAll("[ !" + "\"" + "#$%&'()*+,/:;<=>?@" + "\\[" + "\\\\" + "\\]" + "\\^" + "`{|}~]", "");
				if ((param.length() == 0) || param.equals("no_name"))
				{
					player.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN);
					return showText(st, "Info", "Please, enter the scheme name!", true, "Return", "main");
				}
				try (Connection con = L2DatabaseFactory.getInstance().getConnection())
				{
					PreparedStatement ins = con.prepareStatement("INSERT INTO npcbuffer_scheme_list (player_id,scheme_name) VALUES (?,?)");
					ins.setInt(1, player.getObjectId());
					ins.setString(2, param);
					ins.executeUpdate();
					ins.close();
				}
				catch (SQLException e)
				{
					print(e);
				}
				return rebuildMainHtml(st);
			}
			
			case "delete":
				try (Connection con = L2DatabaseFactory.getInstance().getConnection())
				{
					PreparedStatement rem;
					rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_list WHERE id=? LIMIT 1");
					rem.setString(1, eventParam1);
					rem.executeUpdate();
					rem.close();
					rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_contents WHERE scheme_id=?");
					rem.setString(1, eventParam1);
					rem.executeUpdate();
					rem.close();
				}
				catch (SQLException e)
				{
					print(e);
				}
				return rebuildMainHtml(st);
				
			case "delete_c":
				return "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Do you really want to delete '" + eventParam2 + "' scheme?<br><br>" + "<button value=\"Yes\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete " + eventParam1 + " x x\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"No\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete_1 x x x\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
				
			case "create_1":
				return createScheme();
			case "edit_1":
				return editScheme(player);
			case "delete_1":
				return deleteScheme(player);
			case "manage_scheme_1":
				return viewAllSchemeBuffs(eventParam1, eventParam2, "add");
			case "manage_scheme_2":
				return viewAllSchemeBuffs(eventParam1, eventParam2, "remove");
			case "manage_scheme_select":
				return getOptionList(eventParam1);
				
			case "remove_buff":
			{
				String[] split = eventParam1.split("_");
				String scheme = split[0];
				String skill = split[1];
				String level = split[2];
				try (Connection con = L2DatabaseFactory.getInstance().getConnection())
				{
					PreparedStatement rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1");
					rem.setString(1, scheme);
					rem.setString(2, skill);
					rem.setString(3, level);
					rem.executeUpdate();
				}
				catch (SQLException e)
				{
					print(e);
				}
				int temp = Integer.parseInt(eventParam3) - 1;
				final String HTML;
				if (temp <= 0)
				{
					HTML = getOptionList(scheme);
				}
				else
				{
					HTML = viewAllSchemeBuffs(scheme, eventParam2, "remove");
				}
				return HTML;
			}
			
			case "add_buff":
			{
				String[] split = eventParam1.split("_");
				String scheme = split[0];
				String skill = split[1];
				String level = split[2];
				int idbuffclass = getClassBuff(skill);
				try (Connection con = L2DatabaseFactory.getInstance().getConnection())
				{
					PreparedStatement ins = con.prepareStatement("INSERT INTO npcbuffer_scheme_contents (scheme_id,skill_id,skill_level,buff_class) VALUES (?,?,?,?)");
					ins.setString(1, scheme);
					ins.setString(2, skill);
					ins.setString(3, level);
					ins.setInt(4, idbuffclass);
					ins.executeUpdate();
					ins.close();
				}
				catch (SQLException e)
				{
					print(e);
				}
				int temp = Integer.parseInt(eventParam3) + 1;
				final String HTML;
				if (temp >= (MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES))
				{
					HTML = getOptionList(scheme);
				}
				else
				{
					HTML = viewAllSchemeBuffs(scheme, eventParam2, "add");
				}
				return HTML;
			}
			
			case "edit_buff_list":
				return viewAllBuffs(eventParam1, eventParam2, eventParam3);
				
			case "changeBuffSet":
				if (eventParam2.equals(SET_FIGHTER))
				{
					eventParam2 = "0";
				}
				else if (eventParam2.equals(SET_MAGE))
				{
					eventParam2 = "1";
				}
				else if (eventParam2.equals(SET_ALL))
				{
					eventParam2 = "2";
				}
				else if (eventParam2.equals(SET_NONE))
				{
					eventParam2 = "3";
				}
				else if (DEBUG)
				{
					throw new RuntimeException();
				}
				return manageSelectedSet(eventParam1, eventParam2, eventParam3);
				
			case "editSelectedBuff":
			{
				eventParam2 = eventParam2.replace("-", " ");
				String[] split = eventParam2.split(" ");
				String action = split[0];
				String page = split[1];
				manageSelectedBuff(eventParam1, action);
				final String typeName;
				switch (eventParam3)
				{
					case "buff":
						typeName = "Buffs";
						break;
					case "resist":
						typeName = "Resists";
						break;
					case "song":
						typeName = "Songs";
						break;
					case "dance":
						typeName = "Dances";
						break;
					case "chant":
						typeName = "Chants";
						break;
					case "others":
						typeName = "Others_Buffs";
						break;
					case "special":
						typeName = "Special_Buffs";
						break;
					case "cubic":
						typeName = "Cubics";
						break;
					default:
						throw new RuntimeException();
				}
				return viewAllBuffs(eventParam3, typeName, page);
			}
			
			case "viewSelectedConfig":
				throw new RuntimeException();
				
			case "changeConfig":
				throw new RuntimeException();
				
			case "heal":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					if (player.isInCombat() && !ENABLE_HEAL_IN_COMBAT)
					{
						return showText(st, "Info", "You can't use the heal function while in combat.", false, "Return", "main");
					}
					
					if (st.getQuestItemsCount(CONSUMABLE_ID) < HEAL_PRICE)
					{
						return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + HEAL_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
					}
					final boolean getSummonbuff = isPetBuff(st);
					if (getSummonbuff)
					{
						if (player.getSummon() != null)
						{
							heal(player, getSummonbuff);
						}
						else
						{
							return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
						}
					}
					else
					{
						heal(player, getSummonbuff);
					}
					st.takeItems(CONSUMABLE_ID, HEAL_PRICE);
					if (TIME_OUT)
					{
						addTimeout(st, 1, TIME_OUT_TIME / 2, 600);
					}
				}
				return SMART_WINDOW ? null : rebuildMainHtml(st);
				
			case "removeBuffs":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					if (st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_REMOVE_PRICE)
					{
						return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + BUFF_REMOVE_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
					}
					final boolean getSummonbuff = isPetBuff(st);
					if (getSummonbuff)
					{
						if (player.getSummon() != null)
						{
							player.getSummon().stopAllEffects();
						}
						else
						{
							return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
						}
					}
					else
					{
						player.stopAllEffects();
						if (player.getCubics() != null)
						{
							for (L2CubicInstance cubic : player.getCubics().values())
							{
								cubic.stopAction();
								player.getCubics().remove(cubic);
							}
						}
					}
					st.takeItems(CONSUMABLE_ID, BUFF_REMOVE_PRICE);
					if (TIME_OUT)
					{
						addTimeout(st, 2, TIME_OUT_TIME / 2, 600);
					}
				}
				return SMART_WINDOW ? null : rebuildMainHtml(st);
				
			case "cast":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					List<Integer> buffs = new ArrayList<>();
					List<Integer> levels = new ArrayList<>();
					try (Connection con = L2DatabaseFactory.getInstance().getConnection())
					{
						PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_contents WHERE scheme_id=? ORDER BY id");
						rss.setString(1, eventParam1);
						ResultSet action = rss.executeQuery();
						while (action.next())
						{
							int id = Integer.parseInt(action.getString("skill_id"));
							int level = Integer.parseInt(action.getString("skill_level"));
							switch (getBuffType(id))
							{
								case "buff":
									if (ENABLE_BUFFS)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "resist":
									if (ENABLE_RESIST)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "song":
									if (ENABLE_SONGS)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "dance":
									if (ENABLE_DANCES)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "chant":
									if (ENABLE_CHANTS)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "others":
									if (ENABLE_OTHERS)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "special":
									if (ENABLE_SPECIAL)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								default:
									if (DEBUG)
									{
										throw new RuntimeException();
									}
							}
						}
					}
					catch (SQLException e)
					{
						print(e);
					}
					
					if (buffs.size() == 0)
					{
						return viewAllSchemeBuffs(eventParam1, "1", "add");
					}
					if (!FREE_BUFFS)
					{
						if (st.getQuestItemsCount(CONSUMABLE_ID) < SCHEME_BUFF_PRICE)
						{
							return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + SCHEME_BUFF_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
						}
					}
					
					final boolean getSummonbuff = isPetBuff(st);
					for (int i = 0; i < buffs.size(); ++i)
					{
						if (!getSummonbuff)
						{
							npc.broadcastPacket(new MagicSkillUse(npc, player, buffs.get(i), 1, 1, 1));
							SkillData.getInstance().getSkill(buffs.get(i), levels.get(i)).applyEffects(player, player);
						}
						else
						{
							if (player.getSummon() != null)
							{
								npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), buffs.get(i), 1, 1, 1));
								SkillData.getInstance().getSkill(buffs.get(i), levels.get(i)).applyEffects(player.getSummon(), player.getSummon());
							}
							else
							{
								return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
							}
						}
					}
					st.takeItems(CONSUMABLE_ID, SCHEME_BUFF_PRICE);
					if (TIME_OUT)
					{
						addTimeout(st, 3, TIME_OUT_TIME, 600);
					}
				}
				return SMART_WINDOW ? null : rebuildMainHtml(st);
				
			case "giveBuffs":
			{
				final int cost;
				switch (eventParam3)
				{
					case "buff":
						cost = BUFF_PRICE;
						break;
					case "resist":
						cost = RESIST_PRICE;
						break;
					case "song":
						cost = SONG_PRICE;
						break;
					case "dance":
						cost = DANCE_PRICE;
						break;
					case "chant":
						cost = CHANT_PRICE;
						break;
					case "others":
						cost = OTHERS_PRICE;
						break;
					case "special":
						cost = SPECIAL_PRICE;
						break;
					case "cubic":
						cost = CUBIC_PRICE;
						break;
					default:
						throw new RuntimeException();
				}
				
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					if (!FREE_BUFFS)
					{
						if (st.getQuestItemsCount(CONSUMABLE_ID) < cost)
						{
							return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + cost + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
						}
					}
					Skill skill = SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2));
					if (skill.hasEffectType(L2EffectType.SUMMON))
					{
						if (st.getQuestItemsCount(skill.getItemConsumeId()) < skill.getItemConsumeCount())
						{
							return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + skill.getItemConsumeCount() + " " + getItemNameHtml(st, skill.getItemConsumeId()) + "!", false, "0", "0");
						}
					}
					final boolean getSummonbuff = isPetBuff(st);
					if (!getSummonbuff)
					{
						if (eventParam3.equals("cubic"))
						{
							if (player.getCubics() != null)
							{
								for (L2CubicInstance cubic : player.getCubics().values())
								{
									cubic.stopAction();
									player.getCubics().remove(cubic);
								}
							}
							npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
							player.useMagic(SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)), false, false);
						}
						else
						{
							npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
							SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)).applyEffects(player, player);
						}
					}
					else
					{
						if (eventParam3.equals("cubic"))
						{
							if (player.getCubics() != null)
							{
								for (L2CubicInstance cubic : player.getCubics().values())
								{
									cubic.stopAction();
									player.getCubics().remove(cubic);
								}
							}
							npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
							player.useMagic(SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)), false, false);
						}
						else
						{
							if (player.getSummon() != null)
							{
								npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), Integer.parseInt(eventParam1), 1, 1, 1));
								SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)).applyEffects(player.getSummon(), player.getSummon());
							}
							else
							{
								return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
							}
						}
					}
					st.takeItems(CONSUMABLE_ID, cost);
					if (TIME_OUT)
					{
						addTimeout(st, 3, TIME_OUT_TIME / 10, 600);
					}
				}
				return SMART_WINDOW ? null : buildHtml(eventParam3);
			}
			
			case "castBuffSet":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					if (!FREE_BUFFS)
					{
						if (st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_SET_PRICE)
						{
							return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + BUFF_SET_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
						}
					}
					List<int[]> buff_sets = new ArrayList<>();
					final int player_class;
					if (player.isMageClass())
					{
						player_class = 1;
					}
					else
					{
						player_class = 0;
					}
					final boolean getSummonbuff = isPetBuff(st);
					if (!getSummonbuff)
					{
						try (Connection con = L2DatabaseFactory.getInstance().getConnection())
						{
							PreparedStatement getSimilarNameCount = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC");
							getSimilarNameCount.setInt(1, player_class);
							getSimilarNameCount.setString(2, "2");
							ResultSet rss = getSimilarNameCount.executeQuery();
							while (rss.next())
							{
								int id = rss.getInt("buffId");
								int lvl = rss.getInt("buffLevel");
								buff_sets.add(new int[]
								{
									id,
									lvl
								});
							}
						}
						catch (SQLException e)
						{
							print(e);
						}
						for (int[] i : buff_sets)
						{
							npc.broadcastPacket(new MagicSkillUse(npc, player, i[0], 1, 1, 1));
							SkillData.getInstance().getSkill(i[0], i[1]).applyEffects(player, player);
						}
					}
					else
					{
						if (player.getSummon() != null)
						{
							try (Connection con = L2DatabaseFactory.getInstance().getConnection())
							{
								PreparedStatement getSimilarNameCount = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC");
								getSimilarNameCount.setString(1, "0");
								getSimilarNameCount.setString(2, "2");
								ResultSet rss = getSimilarNameCount.executeQuery();
								while (rss.next())
								{
									int id = rss.getInt("buffId");
									int lvl = rss.getInt("buffLevel");
									buff_sets.add(new int[]
									{
										id,
										lvl
									});
								}
							}
							catch (SQLException e)
							{
								print(e);
							}
							for (int[] i : buff_sets)
							{
								npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), i[0], 1, 1, 1));
								SkillData.getInstance().getSkill(i[0], i[1]).applyEffects(player.getSummon(), player.getSummon());
							}
						}
						else
						{
							return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
						}
					}
					st.takeItems(CONSUMABLE_ID, BUFF_SET_PRICE);
					if (TIME_OUT)
					{
						addTimeout(st, 3, TIME_OUT_TIME, 600);
					}
				}
				return SMART_WINDOW ? null : rebuildMainHtml(st);
				
		}
		return rebuildMainHtml(st);
	}
	
	@SuppressWarnings("unused")
	@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		QuestState st = player.getQuestState(QUEST_LOADING_INFO);
		if (st == null)
		{
			st = newQuestState(player);
		}
		if (player.isGM())
		{
			if (SCRIPT_RELOAD)
			{
				return reloadPanel(st);
			}
			return rebuildMainHtml(st);
		}
		else if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
		{
			return showText(st, "Sorry", "You have to wait a while!<br>if you wish to use my services!", false, "Return", "main");
		}
		if (!BUFF_WITH_KARMA && (player.getKarma() > 0))
		{
			return showText(st, "Info", "You have too much <font color=FF0000>karma!</font><br>Come back,<br>when you don't have any karma!", false, "Return", "main");
		}
		else if (OlympiadManager.getInstance().isRegistered(player))
		{
			return showText(st, "Info", "You can not buff while you are in <font color=FF0000>Olympiad!</font><br>Come back,<br>when you are out of the Olympiad.", false, "Return", "main");
		}
		else if (TvTEvent.isPlayerParticipant(player.getObjectId()))
		{
			return showText(st, "Info", "You can not buff while you are in <font color=\"FF0000\">TvT!</font><br>Come back,<br>when you are out of TvT!", false, "Return", "main");
		}
		else if (player.getLevel() < MIN_LEVEL)
		{
			return showText(st, "Info", "Your level is too low!<br>You have to be at least level <font color=LEVEL>" + MIN_LEVEL + "</font>,<br>to use my services!", false, "Return", "main");
		}
		else if (player.getPvpFlag() > 0)
		{
			return showText(st, "Info", "You can't buff while you are <font color=800080>flagged!</font><br>Wait some time and try again!", false, "Return", "main");
		}
		else if (player.isInCombat())
		{
			return showText(st, "Info", "You can't buff while you are attacking!<br>Stop your fight and try again!", false, "Return", "main");
		}
		else
		{
			return rebuildMainHtml(st);
		}
	}
	
	@Override
	public boolean showResult(L2PcInstance player, String res)
	{
		if (SMART_WINDOW)
		{
			if ((player != null) && (res != null) && res.startsWith("<html>"))
			{
				final NpcHtmlMessage npcReply = new NpcHtmlMessage();
				npcReply.setHtml(res);
				player.sendPacket(npcReply);
				player.sendPacket(ActionFailed.STATIC_PACKET);
				return false;
			}
		}
		return super.showResult(player, res);
	}
	
	private String getSkillIconHtml(int id, int level)
	{
		String iconNumber = getSkillIconNumber(id, level);
		return "<button action=\"bypass -h Quest " + QUEST_LOADING_INFO + " description " + id + " " + level + " x\" width=32 height=32 back=\"Icon.skill" + iconNumber + "\" fore=\"Icon.skill" + iconNumber + "\">";
	}
	
	private String getSkillIconNumber(int id, int level)
	{
		String formato;
		if (id == 4)
		{
			formato = "0004";
		}
		else if ((id > 9) && (id < 100))
		{
			formato = "00" + id;
		}
		else if ((id > 99) && (id < 1000))
		{
			formato = "0" + id;
		}
		else if (id == 1517)
		{
			formato = "1536";
		}
		else if (id == 1518)
		{
			formato = "1537";
		}
		else if (id == 1547)
		{
			formato = "0065";
		}
		else if (id == 2076)
		{
			formato = "0195";
		}
		else if ((id > 4550) && (id < 4555))
		{
			formato = "5739";
		}
		else if ((id > 4698) && (id < 4701))
		{
			formato = "1331";
		}
		else if ((id > 4701) && (id < 4704))
		{
			formato = "1332";
		}
		else if (id == 6049)
		{
			formato = "0094";
		}
		else
		{
			formato = String.valueOf(id);
		}
		return formato;
	}
	
	static public void main(String[] args)
	{
		new NpcBuffer();
	}
}
Posted

I did all what u3games proposed and I have checked again and again.I spawn buffer but the buttons doesnt work.It takes the adena but I dont get any buff.It heals me too.Custom in General properties are all true as well as EnableModifySkillDuration = True and SkillDurationList = bla...bla...bla...

Seems that my poor knowledge in coding saying that I havent enable buffs somewhere?

Any suggestion is welcomed.

Posted

I did all what u3games proposed and I have checked again and again.I spawn buffer but the buttons doesnt work.It takes the adena but I dont get any buff.It heals me too.Custom in General properties are all true as well as EnableModifySkillDuration = True and SkillDurationList = bla...bla...bla...

Seems that my poor knowledge in coding saying that I havent enable buffs somewhere?

Any suggestion is welcomed.

 

Delete this:

else if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
		{
			return showText(st, "Sorry", "You have to wait a while!<br>if you wish to use my services!", false, "Return", "main");
		}

And test ;)

Posted

Delete this:

else if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
		{
			return showText(st, "Sorry", "You have to wait a while!<br>if you wish to use my services!", false, "Return", "main");
		}

And test ;)

Nothing new...  Dammit,im new in java suppose i must study more.    ::)

Posted

Nothing new...  Dammit,im new in java suppose i must study more.    ::)

 

Open scripts.cfg and add:

custom/NpcBuffer/NpcBuffer.java

Create new file in "scripts/custom" with name: "NpcBuffer" and create new java file "NpcBuffer.java"

 

And paste this in "NpcBuffer.java"

/*
 * Copyright (C) 2004-2014 L2J DataPack
 * 
 * This file is part of L2J DataPack.
 * 
 * L2J DataPack is free software: you can redistribute it and/or modify
 * it under 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.
 * 
 * L2J DataPack 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 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 custom.NpcBuffer;

import static com.l2jserver.gameserver.util.Util.formatAdena;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
import com.l2jserver.gameserver.model.actor.stat.PcStat;
import com.l2jserver.gameserver.model.actor.stat.SummonStat;
import com.l2jserver.gameserver.model.actor.status.PcStatus;
import com.l2jserver.gameserver.model.actor.status.SummonStatus;
import com.l2jserver.gameserver.model.effects.L2EffectType;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SetSummonRemainTime;
import com.l2jserver.gameserver.network.serverpackets.SetupGauge;

public class NpcBuffer extends Quest
{
	private static final boolean DEBUG = false;
	
	private static void print(Exception e)
	{
		_log.warning(">>>" + e.toString() + "<<<");
		if (DEBUG)
		{
			e.printStackTrace();
		}
	}
	
	private static final String QUEST_LOADING_INFO = "NpcBuffer";
	private static final int NPC_ID = 12;
	
	private static final String TITLE_NAME = "Scheme Buffer";
	private static final boolean SCRIPT_RELOAD = false;
	private static final boolean SMART_WINDOW = true;
	private static final boolean ENABLE_BUFF_SECTION = true;
	private static final boolean ENABLE_SCHEME_SYSTEM = true;
	private static final boolean ENABLE_HEAL = true;
	private static final boolean ENABLE_HEAL_IN_COMBAT = false;
	private static final boolean ENABLE_BUFFS = true;
	private static final boolean ENABLE_RESIST = true;
	private static final boolean ENABLE_SONGS = true;
	private static final boolean ENABLE_DANCES = true;
	private static final boolean ENABLE_CHANTS = false;
	private static final boolean ENABLE_OTHERS = false;
	private static final boolean ENABLE_SPECIAL = false;
	private static final boolean ENABLE_CUBIC = false;
	private static final boolean ENABLE_BUFF_REMOVE = true;
	private static final boolean ENABLE_BUFF_SET = true;
	private static final boolean BUFF_WITH_KARMA = true;
	private static final boolean FREE_BUFFS = false;
	private static final boolean TIME_OUT = true;
	private static final int TIME_OUT_TIME = 3;
	private static final int MIN_LEVEL = 1;
	private static final int BUFF_REMOVE_PRICE = 10000;
	private static final int HEAL_PRICE = 10000;
	private static final int BUFF_PRICE = 1000;
	private static final int RESIST_PRICE = 1000;
	private static final int SONG_PRICE = 1000;
	private static final int DANCE_PRICE = 1000;
	private static final int CHANT_PRICE = 1000;
	private static final int OTHERS_PRICE = 1000;
	private static final int SPECIAL_PRICE = 1000;
	private static final int CUBIC_PRICE = 1000;
	private static final int BUFF_SET_PRICE = 15000;
	private static final int SCHEME_BUFF_PRICE = 20000;
	private static final int SCHEMES_PER_PLAYER = 4;
	private static final int CONSUMABLE_ID = 57;
	private static final int MAX_SCHEME_BUFFS = Config.BUFFS_MAX_AMOUNT;
	private static final int MAX_SCHEME_DANCES = Config.DANCES_MAX_AMOUNT;
	
	private static final String SET_FIGHTER = "Fighter";
	private static final String SET_MAGE = "Mage";
	private static final String SET_ALL = "All";
	private static final String SET_NONE = "None";
	
	private String rebuildMainHtml(QuestState st)
	{
		String MAIN_HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>";
		String MESSAGE = "";
		int td = 0;
		String[] TRS =
		{
			"<tr><td height=25>",
			"</td>",
			"<td height=25>",
			"</td></tr>"
		};
		
		final String bottonA, bottonB, bottonC;
		if (st.getInt("Pet-On-Off") == 1)
		{
			bottonA = "Auto Buff Pet";
			bottonB = "Heal My Pet";
			bottonC = "Remove Pet Buffs";
			MAIN_HTML_MESSAGE += "<button value=\"Player Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		else
		{
			bottonA = "Auto Buff";
			bottonB = "Heal";
			bottonC = "Remove Buffs";
			MAIN_HTML_MESSAGE += "<button value=\"Pet Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 1 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		
		if (ENABLE_BUFF_SECTION)
		{
			if (ENABLE_BUFFS)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_RESIST)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Resist\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_resists 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_SONGS)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_songs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_DANCES)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_dances 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_CHANTS)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_chants 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_SPECIAL)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Special\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_special 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			if (ENABLE_OTHERS)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"Others\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_others 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
		}
		
		if (ENABLE_CUBIC)
		{
			if (td > 2)
			{
				td = 0;
			}
			MESSAGE += TRS[td] + "<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_cubic 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
			td += 2;
		}
		
		if (MESSAGE.length() > 0)
		{
			MAIN_HTML_MESSAGE += "<BR1><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=444444><tr>" + "<td><font color=00FFFF>Buffs:</font></td><td align=right>...</td></tr></table>" + "<BR1><table cellspacing=0 cellpadding=0>" + MESSAGE + "</table>";
			MESSAGE = "";
			td = 0;
		}
		
		if (ENABLE_BUFF_SET)
		{
			if (td > 2)
			{
				td = 0;
			}
			MESSAGE += TRS[td] + "<button value=\"" + bottonA + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " castBuffSet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
			td += 2;
		}
		
		if (ENABLE_HEAL)
		{
			if (td > 2)
			{
				td = 0;
			}
			MESSAGE += TRS[td] + "<button value=\"" + bottonB + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " heal 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
			td += 2;
		}
		
		if (ENABLE_BUFF_REMOVE)
		{
			if (td > 2)
			{
				td = 0;
			}
			MESSAGE += TRS[td] + "<button value=\"" + bottonC + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " removeBuffs 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
			td += 2;
		}
		
		if (MESSAGE.length() > 0)
		{
			MAIN_HTML_MESSAGE += "<BR1><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=444444><tr>" + "<td><font color=00FFFF>Preset:</font></td><td align=right><font color=LEVEL>" + formatAdena(BUFF_SET_PRICE) + "</font> adena</td></tr></table>" + "<BR1><table cellspacing=0 cellpadding=0>" + MESSAGE + "</table>";
			MESSAGE = "";
			td = 0;
		}
		
		if (ENABLE_SCHEME_SYSTEM)
		{
			MAIN_HTML_MESSAGE += generateScheme(st);
		}
		
		if (st.getPlayer().isGM())
		{
			MAIN_HTML_MESSAGE += "<br><button value=\"GM Manage Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		MAIN_HTML_MESSAGE += "<br><font color=303030>" + TITLE_NAME + "</font>" + "</center></body></html>";
		return MAIN_HTML_MESSAGE;
	}
	
	private String generateScheme(QuestState st)
	{
		List<String> schemeName = new ArrayList<>();
		List<String> schemeId = new ArrayList<>();
		String HTML = "";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
			rss.setInt(1, st.getPlayer().getObjectId());
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				schemeName.add(action.getString("scheme_name"));
				schemeId.add(action.getString("id"));
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		HTML += "<BR1><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=444444><tr>" + "<td><font color=00FFFF>Scheme:</font></td><td align=right><font color=LEVEL>" + formatAdena(SCHEME_BUFF_PRICE) + "</font> adena</TD></TR></table>" + "<BR1><table cellspacing=0 cellpadding=0>";
		if (schemeName.size() > 0)
		{
			String MESSAGE = "";
			int td = 0;
			String[] TRS =
			{
				"<tr><td>",
				"</td>",
				"<td>",
				"</td></tr>"
			};
			for (int i = 0; i < schemeName.size(); ++i)
			{
				if (td > 2)
				{
					td = 0;
				}
				MESSAGE += TRS[td] + "<button value=\"" + schemeName.get(i) + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " cast " + schemeId.get(i) + " x x\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + TRS[td + 1];
				td += 2;
			}
			
			if (MESSAGE.length() > 0)
			{
				HTML += "<table>" + MESSAGE + "</table>";
			}
		}
		
		if (schemeName.size() < SCHEMES_PER_PLAYER)
		{
			HTML += "<BR1><table><tr><td><button value=\"Create\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " create_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
		}
		else
		{
			HTML += "<BR1><table width=100><tr>";
		}
		
		if (schemeName.size() > 0)
		{
			HTML += "<td><button value=\"Edit\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "<td><button value=\"Delete\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>";
		}
		else
		{
			HTML += "</tr></table>";
		}
		return HTML;
	}
	
	private String reloadPanel(QuestState st)
	{
		return "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" + "<font color=303030>" + TITLE_NAME + "</font><br>" + "<img src=\"L2UI.SquareGray\" width=250 height=1><br>" + "<table width=260 border=0 bgcolor=444444>" + "<tr><td><br></td></tr>" + "<tr><td align=center><font color=FFFFFF>This option can be seen by GMs only and it<br1>allow to update any changes made in the<br1>script. You can disable this option in<br1>the settings section within the Script.<br><font color=LEVEL>Do you want to update the SCRIPT?</font></font></td></tr>" + "<tr><td></td></tr></table><br>" + "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>" + "<button value=\"Yes\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " reloadscript 1 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"No\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " reloadscript 0 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "</center></body></html>";
	}
	
	private String getItemNameHtml(QuestState st, int itemval)
	{
		return "" + itemval + ";";
	}
	
	private int getBuffCount(String scheme)
	{
		int count = 0;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT buff_class FROM npcbuffer_scheme_contents WHERE scheme_id=?");
			rss.setString(1, scheme);
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				++count;
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return count;
	}
	
	private String getBuffType(int id)
	{
		String val = "none";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement act = con.prepareStatement("SELECT buffType FROM npcbuffer_buff_list WHERE buffId=? LIMIT 1");
			act.setInt(1, id);
			ResultSet rs = act.executeQuery();
			if (rs.next())
			{
				val = rs.getString("buffType");
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return val;
	}
	
	private boolean isEnabled(int id, int level)
	{
		boolean val = false;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement act = con.prepareStatement("SELECT canUse FROM npcbuffer_buff_list WHERE buffId=? AND buffLevel=? LIMIT 1");
			act.setInt(1, id);
			act.setInt(2, level);
			ResultSet rs = act.executeQuery();
			if (rs.next())
			{
				if ("1".equals(rs.getString("canUse")))
				{
					val = true;
				}
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return val;
	}
	
	private boolean isUsed(String scheme, int id, int level)
	{
		boolean used = false;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT id FROM npcbuffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1");
			rss.setString(1, scheme);
			rss.setInt(2, id);
			rss.setInt(3, level);
			ResultSet action = rss.executeQuery();
			if (action.next())
			{
				used = true;
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return used;
	}
	
	private int getClassBuff(String id)
	{
		int val = 0;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement getTipo = con.prepareStatement("SELECT buff_class FROM npcbuffer_buff_list WHERE buffId=?");
			getTipo.setString(1, id);
			ResultSet gt = getTipo.executeQuery();
			if (gt.next())
			{
				val = gt.getInt("buff_class");
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		return val;
	}
	
	private String showText(QuestState st, String type, String text, boolean buttonEnabled, String buttonName, String location)
	{
		String MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
		MESSAGE += "<font color=LEVEL>" + type + "</font><br>" + text + "<br>";
		if (buttonEnabled)
		{
			MESSAGE += "<button value=\"" + buttonName + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect " + location + " 0 0\" width=100 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		MESSAGE += "<font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		st.playSound("ItemSound3.sys_shortage");
		return MESSAGE;
	}
	
	private String reloadConfig(QuestState st)
	{
		try
		{
			if (QuestManager.getInstance().reload(QUEST_LOADING_INFO))
			{
				st.getPlayer().sendMessage("The script and settings have been reloaded successfully.");
			}
			else
			{
				st.getPlayer().sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server");
			}
		}
		catch (Exception e)
		{
			st.getPlayer().sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server");
			print(e);
		}
		return rebuildMainHtml(st);
	}
	
	private NpcBuffer()
	{
		super(-1, NpcBuffer.class.getSimpleName(), "custom");
		addStartNpc(NPC_ID);
		addFirstTalkId(NPC_ID);
		addTalkId(NPC_ID);
	}
	
	private boolean isPetBuff(QuestState st)
	{
		return st.getInt("Pet-On-Off") != 0;
	}
	
	private String createScheme()
	{
		return "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>You MUST seprerate new words with a dot (.)<br><br>Scheme name: <edit var=\"name\" width=100><br><br>" + "<button value=\"Create Scheme\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " create $name no_name x x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
	}
	
	private String deleteScheme(L2PcInstance player)
	{
		String HTML = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Available schemes:<br><br>";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
			rss.setInt(1, player.getObjectId());
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				HTML += "<button value=\"" + action.getString("scheme_name") + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete_c " + action.getString("id") + " " + action.getString("scheme_name") + " x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML;
	}
	
	private String editScheme(L2PcInstance player)
	{
		String HTML = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Select a scheme that you would like to manage:<br><br>";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
			rss.setInt(1, player.getObjectId());
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				String name = action.getString("scheme_name");
				String id = action.getString("id");
				HTML += "<button value=\"" + name + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_select " + id + " x x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML;
	}
	
	private String getOptionList(String scheme)
	{
		int bcount = getBuffCount(scheme);
		String HTML = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>There are <font color=LEVEL>" + bcount + "</font> buffs in current scheme!<br><br>";
		if (bcount < (MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES))
		{
			HTML += "<button value=\"Add buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_1 " + scheme + " 1 x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (bcount > 0)
		{
			HTML += "<button value=\"Remove buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_2 " + scheme + " 1 x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_1 0 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML;
	}
	
	private String buildHtml(String buffType)
	{
		String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><br>";
		
		List<String> availableBuffs = new ArrayList<>();
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement getList = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE buffType=\"" + buffType + "\" AND canUse=1  ORDER BY Buff_Class ASC, id");
			ResultSet rs = getList.executeQuery();
			while (rs.next())
			{
				int bId = rs.getInt("buffId");
				int bLevel = rs.getInt("buffLevel");
				String bName = SkillData.getInstance().getSkill(bId, bLevel).getName();
				bName = bName.replace(" ", "+");
				availableBuffs.add(bName + "_" + bId + "_" + bLevel);
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		
		if (availableBuffs.size() == 0)
		{
			HTML_MESSAGE += "No buffs are available at this moment!";
		}
		else
		{
			if (FREE_BUFFS)
			{
				HTML_MESSAGE += "All buffs are for <font color=LEVEL>free</font>!";
			}
			else
			{
				int price = 0;
				switch (buffType)
				{
					case "buff":
						price = BUFF_PRICE;
						break;
					case "resist":
						price = RESIST_PRICE;
						break;
					case "song":
						price = SONG_PRICE;
						break;
					case "dance":
						price = DANCE_PRICE;
						break;
					case "chant":
						price = CHANT_PRICE;
						break;
					case "others":
						price = OTHERS_PRICE;
						break;
					case "special":
						price = SPECIAL_PRICE;
						break;
					case "cubic":
						price = CUBIC_PRICE;
						break;
					default:
						if (DEBUG)
						{
							throw new RuntimeException();
						}
				}
				HTML_MESSAGE += "All special buffs cost <font color=LEVEL>" + formatAdena(price) + "</font> adena!";
			}
			HTML_MESSAGE += "<BR1><table>";
			for (String buff : availableBuffs)
			{
				buff = buff.replace("_", " ");
				String[] buffSplit = buff.split(" ");
				String name = buffSplit[0];
				int id = Integer.parseInt(buffSplit[1]);
				int level = Integer.parseInt(buffSplit[2]);
				name = name.replace("+", " ");
				HTML_MESSAGE += "<tr><td>" + getSkillIconHtml(id, level) + "</td><td><button value=\"" + name + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs " + id + " " + level + " " + buffType + "\" width=190 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
			}
			HTML_MESSAGE += "</table>";
		}
		
		HTML_MESSAGE += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML_MESSAGE;
	}
	
	private String generateQuery(int case1, int case2)
	{
		StringBuilder qry = new StringBuilder();
		if (ENABLE_BUFFS)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"buff\"");
			}
		}
		if (ENABLE_RESIST)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"resist\"");
			}
		}
		if (ENABLE_SONGS)
		{
			if (case2 < MAX_SCHEME_DANCES)
			{
				qry.append(",\"song\"");
			}
		}
		if (ENABLE_DANCES)
		{
			if (case2 < MAX_SCHEME_DANCES)
			{
				qry.append(",\"dance\"");
			}
		}
		if (ENABLE_CHANTS)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"chant\"");
			}
		}
		if (ENABLE_OTHERS)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"others\"");
			}
		}
		if (ENABLE_SPECIAL)
		{
			if (case1 < MAX_SCHEME_BUFFS)
			{
				qry.append(",\"special\"");
			}
		}
		if (qry.length() > 0)
		{
			qry.deleteCharAt(0);
		}
		return qry.toString();
	}
	
	private String viewAllSchemeBuffs$getBuffCount(String scheme)
	{
		int count = 0;
		int D_S_Count = 0;
		int B_Count = 0;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement rss = con.prepareStatement("SELECT buff_class FROM npcbuffer_scheme_contents WHERE scheme_id=?");
			rss.setString(1, scheme);
			ResultSet action = rss.executeQuery();
			while (action.next())
			{
				++count;
				int val = action.getInt("buff_class");
				if ((val == 1) || (val == 2))
				{
					++D_S_Count;
				}
				else
				{
					++B_Count;
				}
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		String res = count + " " + B_Count + " " + D_S_Count;
		return res;
	}
	
	private String viewAllSchemeBuffs(String scheme, String page, String action)
	{
		List<String> buffList = new ArrayList<>();
		String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><br>";
		String[] eventSplit = viewAllSchemeBuffs$getBuffCount(scheme).split(" ");
		int TOTAL_BUFF = Integer.parseInt(eventSplit[0]);
		int BUFF_COUNT = Integer.parseInt(eventSplit[1]);
		int DANCE_SONG = Integer.parseInt(eventSplit[2]);
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			if (action.equals("add"))
			{
				HTML_MESSAGE += "You can add <font color=LEVEL>" + (MAX_SCHEME_BUFFS - BUFF_COUNT) + "</font> Buffs and <font color=LEVEL>" + (MAX_SCHEME_DANCES - DANCE_SONG) + "</font> Dances more!";
				String QUERY = "SELECT * FROM npcbuffer_buff_list WHERE buffType IN (" + generateQuery(BUFF_COUNT, DANCE_SONG) + ") AND canUse=1 ORDER BY Buff_Class ASC, id";
				PreparedStatement getBuffCount = con.prepareStatement(QUERY);
				ResultSet rss = getBuffCount.executeQuery();
				while (rss.next())
				{
					String name = SkillData.getInstance().getSkill(rss.getInt("buffId"), rss.getInt("buffLevel")).getName();
					name = name.replace(" ", "+");
					buffList.add(name + "_" + rss.getInt("buffId") + "_" + rss.getInt("buffLevel"));
				}
			}
			else if (action.equals("remove"))
			{
				HTML_MESSAGE += "You have <font color=LEVEL>" + BUFF_COUNT + "</font> Buffs and <font color=LEVEL>" + DANCE_SONG + "</font> Dances";
				String QUERY = "SELECT * FROM npcbuffer_scheme_contents WHERE scheme_id=? ORDER BY Buff_Class ASC, id";
				PreparedStatement getBuffCount = con.prepareStatement(QUERY);
				getBuffCount.setString(1, scheme);
				ResultSet rss = getBuffCount.executeQuery();
				while (rss.next())
				{
					String name = SkillData.getInstance().getSkill(rss.getInt("skill_id"), rss.getInt("skill_level")).getName();
					name = name.replace(" ", "+");
					buffList.add(name + "_" + rss.getInt("skill_id") + "_" + rss.getInt("skill_level"));
				}
			}
			else if (DEBUG)
			{
				throw new RuntimeException();
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		
		HTML_MESSAGE += "<BR1><table border=0><tr>";
		final int buffsPerPage = 20;
		final String width, pageName;
		int pc = ((buffList.size() - 1) / buffsPerPage) + 1;
		if (pc > 5)
		{
			width = "25";
			pageName = "P";
		}
		else
		{
			width = "50";
			pageName = "Page ";
		}
		for (int ii = 1; ii <= pc; ++ii)
		{
			if (ii == Integer.parseInt(page))
			{
				HTML_MESSAGE += "<td width=" + width + " align=center><font color=LEVEL>" + pageName + ii + "</font></td>";
			}
			else if (action.equals("add"))
			{
				HTML_MESSAGE += "<td width=" + width + ">" + "<button value=\"" + pageName + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_1 " + scheme + " " + ii + " x\" width=" + width + " height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
			}
			else if (action.equals("remove"))
			{
				HTML_MESSAGE += "<td width=" + width + ">" + "<button value=\"" + pageName + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_2 " + scheme + " " + ii + " x\" width=" + width + " height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
			}
			else if (DEBUG)
			{
				throw new RuntimeException();
			}
		}
		HTML_MESSAGE += "</tr></table>";
		
		int limit = buffsPerPage * Integer.parseInt(page);
		int start = limit - buffsPerPage;
		int end = Math.min(limit, buffList.size());
		int k = 0;
		for (int i = start; i < end; ++i)
		{
			String value = buffList.get(i);
			value = value.replace("_", " ");
			String[] extr = value.split(" ");
			String name = extr[0];
			name = name.replace("+", " ");
			int id = Integer.parseInt(extr[1]);
			int level = Integer.parseInt(extr[2]);
			if (action.equals("add"))
			{
				if (!isUsed(scheme, id, level))
				{
					if ((k % 2) != 0)
					{
						HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
					}
					else
					{
						HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
					}
					HTML_MESSAGE += "<tr><td width=35>" + getSkillIconHtml(id, level) + "</td><td fixwidth=170>" + name + "</td><td><button value=\"Add\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " add_buff " + scheme + "_" + id + "_" + level + " " + page + " " + TOTAL_BUFF + "\" width=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</tr></table>";
					k += 1;
				}
			}
			else if (action.equals("remove"))
			{
				if ((k % 2) != 0)
				{
					HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
				}
				else
				{
					HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
				}
				HTML_MESSAGE += "<tr><td width=35>" + getSkillIconHtml(id, level) + "</td><td fixwidth=170>" + name + "</td><td><button value=\"Remove\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " remove_buff " + scheme + "_" + id + "_" + level + " " + page + " " + TOTAL_BUFF + "\" width=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</table>";
				k += 1;
			}
		}
		HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_select " + scheme + " x x\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML_MESSAGE;
	}
	
	private String viewAllBuffTypes()
	{
		String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
		HTML_MESSAGE += "<font color=LEVEL>[Buff management]</font><br>";
		if (ENABLE_BUFFS)
		{
			HTML_MESSAGE += "<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list buff Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_RESIST)
		{
			HTML_MESSAGE += "<button value=\"Resist Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list resist Resists 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_SONGS)
		{
			HTML_MESSAGE += "<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list song Songs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_DANCES)
		{
			HTML_MESSAGE += "<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list dance Dances 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_CHANTS)
		{
			HTML_MESSAGE += "<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list chant Chants 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_SPECIAL)
		{
			HTML_MESSAGE += "<button value=\"Special Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list special Special_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_OTHERS)
		{
			HTML_MESSAGE += "<button value=\"Others Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list others Others_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_CUBIC)
		{
			HTML_MESSAGE += "<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list cubic cubic_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">";
		}
		if (ENABLE_BUFF_SET)
		{
			HTML_MESSAGE += "<button value=\"Buff Sets\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list set Buff_Sets 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>";
		}
		HTML_MESSAGE += "<button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML_MESSAGE;
	}
	
	private String viewAllBuffs(String type, String typeName, String page)
	{
		List<String> buffList = new ArrayList<>();
		String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
		typeName = typeName.replace("_", " ");
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			final PreparedStatement getBuffCount;
			if (type.equals("set"))
			{
				getBuffCount = con.prepareStatement("SELECT * FROM npcbuffer_buff_list WHERE buffType IN (" + generateQuery(0, 0) + ") AND canUse=1");
			}
			else
			{
				getBuffCount = con.prepareStatement("SELECT * FROM npcbuffer_buff_list WHERE buffType=?");
				getBuffCount.setString(1, type);
			}
			ResultSet rss = getBuffCount.executeQuery();
			while (rss.next())
			{
				String name = SkillData.getInstance().getSkill(rss.getInt("buffId"), rss.getInt("buffLevel")).getName();
				name = name.replace(" ", "+");
				String usable = rss.getString("canUse");
				String forClass = rss.getString("forClass");
				String skill_id = rss.getString("buffId");
				String skill_level = rss.getString("buffLevel");
				buffList.add(name + "_" + forClass + "_" + page + "_" + usable + "_" + skill_id + "_" + skill_level);
			}
		}
		catch (SQLException e)
		{
			print(e);
		}
		Collections.sort(buffList);
		
		HTML_MESSAGE += "<font color=LEVEL>[Buff management - " + typeName + " - Page " + page + "]</font><br><table border=0><tr>";
		final int buffsPerPage;
		if (type.equals("set"))
		{
			buffsPerPage = 12;
		}
		else
		{
			buffsPerPage = 20;
		}
		final String width, pageName;
		int pc = ((buffList.size() - 1) / buffsPerPage) + 1;
		if (pc > 5)
		{
			width = "25";
			pageName = "P";
		}
		else
		{
			width = "50";
			pageName = "Page ";
		}
		typeName = typeName.replace(" ", "_");
		for (int ii = 1; ii <= pc; ++ii)
		{
			if (ii == Integer.parseInt(page))
			{
				HTML_MESSAGE += "<td width=" + width + " align=center><font color=LEVEL>" + pageName + ii + "</font></td>";
			}
			else
			{
				HTML_MESSAGE += "<td width=" + width + "><button value=\"" + pageName + "" + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list " + type + " " + typeName + " " + ii + "\" width=" + width + " height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
			}
		}
		HTML_MESSAGE += "</tr></table><br>";
		
		int limit = buffsPerPage * Integer.parseInt(page);
		int start = limit - buffsPerPage;
		int end = Math.min(limit, buffList.size());
		for (int i = start; i < end; ++i)
		{
			String value = buffList.get(i);
			value = value.replace("_", " ");
			String[] extr = value.split(" ");
			String name = extr[0];
			name = name.replace("+", " ");
			int forClass = Integer.parseInt(extr[1]);
			int usable = Integer.parseInt(extr[3]);
			String skillPos = extr[4] + "_" + extr[5];
			if ((i % 2) != 0)
			{
				HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
			}
			else
			{
				HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
			}
			if (type.equals("set"))
			{
				String listOrder = null;
				if (forClass == 0)
				{
					listOrder = "List=\"" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_ALL + ";" + SET_NONE + ";\"";
				}
				else if (forClass == 1)
				{
					listOrder = "List=\"" + SET_MAGE + ";" + SET_FIGHTER + ";" + SET_ALL + ";" + SET_NONE + ";\"";
				}
				else if (forClass == 2)
				{
					listOrder = "List=\"" + SET_ALL + ";" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_NONE + ";\"";
				}
				else if (forClass == 3)
				{
					listOrder = "List=\"" + SET_NONE + ";" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_ALL + ";\"";
				}
				HTML_MESSAGE += "<tr><td fixwidth=145>" + name + "</td><td width=70><combobox var=\"newSet" + i + "\" width=70 " + listOrder + "></td>" + "<td width=50><button value=\"Update\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " changeBuffSet " + skillPos + " $newSet" + i + " " + page + "\" width=50 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
			}
			else
			{
				HTML_MESSAGE += "<tr><td fixwidth=170>" + name + "</td><td width=80>";
				if (usable == 1)
				{
					HTML_MESSAGE += "<button value=\"Disable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff " + skillPos + " 0-" + page + " " + type + "\" width=80 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
				}
				else if (usable == 0)
				{
					HTML_MESSAGE += "<button value=\"Enable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff " + skillPos + " 1-" + page + " " + type + "\" width=80 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>";
				}
			}
			HTML_MESSAGE += "</table>";
		}
		HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
		return HTML_MESSAGE;
	}
	
	private void manageSelectedBuff(String buffPosId, String canUseBuff)
	{
		String[] bpid = buffPosId.split("_");
		String bId = bpid[0];
		String bLvl = bpid[1];
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement upd = con.prepareStatement("UPDATE npcbuffer_buff_list SET canUse=? WHERE buffId=? AND buffLevel=? LIMIT 1");
			upd.setString(1, canUseBuff);
			upd.setString(2, bId);
			upd.setString(3, bLvl);
			upd.executeUpdate();
			upd.close();
		}
		catch (SQLException e)
		{
			print(e);
		}
	}
	
	private String manageSelectedSet(String id, String newVal, String opt3)
	{
		String[] bpid = id.split("_");
		String bId = bpid[0];
		String bLvl = bpid[1];
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement upd = con.prepareStatement("UPDATE npcbuffer_buff_list SET forClass=? WHERE buffId=? AND bufflevel=?");
			upd.setString(1, newVal);
			upd.setString(2, bId);
			upd.setString(3, bLvl);
			upd.executeUpdate();
			upd.close();
		}
		catch (SQLException e)
		{
			print(e);
		}
		return viewAllBuffs("set", "Buff Sets", opt3);
	}
	
	private void addTimeout(QuestState st, int gaugeColor, int amount, int offset)
	{
		int endtime = (int) ((System.currentTimeMillis() + (amount * 1000)) / 1000);
		st.set("blockUntilTime", String.valueOf(endtime));
		st.getPlayer().sendPacket(new SetupGauge(gaugeColor, (amount * 1000) + offset));
	}
	
	private void heal(L2PcInstance player, boolean isPet)
	{
		L2Summon target = player.getSummon();
		if (!isPet)
		{
			PcStatus pcStatus = player.getStatus();
			PcStat pcStat = player.getStat();
			pcStatus.setCurrentHp(pcStat.getMaxHp());
			pcStatus.setCurrentMp(pcStat.getMaxMp());
			pcStatus.setCurrentCp(pcStat.getMaxCp());
		}
		else if (target != null)
		{
			SummonStatus petStatus = target.getStatus();
			SummonStat petStat = target.getStat();
			petStatus.setCurrentHp(petStat.getMaxHp());
			petStatus.setCurrentMp(petStat.getMaxMp());
			if (target instanceof L2PetInstance)
			{
				L2PetInstance pet = (L2PetInstance) target;
				pet.setCurrentFed(pet.getMaxFed());
				player.sendPacket(new SetSummonRemainTime(pet.getMaxFed(), pet.getCurrentFed()));
			}
			else if (target instanceof L2ServitorInstance)
			{
				L2ServitorInstance summon = (L2ServitorInstance) target;
				// FIXME: summon.setLifeTimeRemaining(summon.getLifeTimeRemaining() - summon.getLifeTime());
				summon.setLifeTimeRemaining(summon.getLifeTimeRemaining() + summon.getLifeTime());
				player.sendPacket(new SetSummonRemainTime(summon.getLifeTime(), summon.getLifeTimeRemaining()));
			}
			else if (DEBUG)
			{
				throw new RuntimeException();
			}
		}
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		if (DEBUG)
		{
			System.out.println(getScriptName() + "#onAdvEvent('" + event + "'," + (npc == null ? "NULL" : npc.getId() + npc.getName()) + "," + (player == null ? "NULL" : player.getName()) + ")");
		}
		QuestState st = player.getQuestState(QUEST_LOADING_INFO);
		String[] eventSplit = event.split(" ", 4);
		if (eventSplit.length != 4)
		{
			player.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN);
			return null;
		}
		String eventParam0 = eventSplit[0];
		String eventParam1 = eventSplit[1];
		String eventParam2 = eventSplit[2];
		String eventParam3 = eventSplit[3];
		
		switch (eventParam0)
		{
			case "reloadscript":
				if (eventParam1.equals("1"))
				{
					return reloadConfig(st);
				}
				if (eventParam1.equals("0"))
				{
					return rebuildMainHtml(st);
				}
				if (DEBUG)
				{
					throw new RuntimeException();
				}
				
			case "redirect":
				switch (eventParam1)
				{
					case "main":
						return rebuildMainHtml(st);
					case "manage_buffs":
						return viewAllBuffTypes();
					case "view_buffs":
						return buildHtml("buff");
					case "view_resists":
						return buildHtml("resist");
					case "view_songs":
						return buildHtml("song");
					case "view_dances":
						return buildHtml("dance");
					case "view_chants":
						return buildHtml("chant");
					case "view_others":
						return buildHtml("others");
					case "view_special":
						return buildHtml("special");
					case "view_cubic":
						return buildHtml("cubic");
					default:
						if (DEBUG)
						{
							throw new RuntimeException();
						}
				}
				
			case "buffpet":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					st.set("Pet-On-Off", eventParam1);
					if (TIME_OUT)
					{
						addTimeout(st, 3, TIME_OUT_TIME / 2, 600);
					}
				}
				return rebuildMainHtml(st);
				
			case "create":
			{
				String param = eventParam1.replaceAll("[ !" + "\"" + "#$%&'()*+,/:;<=>?@" + "\\[" + "\\\\" + "\\]" + "\\^" + "`{|}~]", "");
				if ((param.length() == 0) || param.equals("no_name"))
				{
					player.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN);
					return showText(st, "Info", "Please, enter the scheme name!", true, "Return", "main");
				}
				try (Connection con = L2DatabaseFactory.getInstance().getConnection())
				{
					PreparedStatement ins = con.prepareStatement("INSERT INTO npcbuffer_scheme_list (player_id,scheme_name) VALUES (?,?)");
					ins.setInt(1, player.getObjectId());
					ins.setString(2, param);
					ins.executeUpdate();
					ins.close();
				}
				catch (SQLException e)
				{
					print(e);
				}
				return rebuildMainHtml(st);
			}
			
			case "delete":
				try (Connection con = L2DatabaseFactory.getInstance().getConnection())
				{
					PreparedStatement rem;
					rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_list WHERE id=? LIMIT 1");
					rem.setString(1, eventParam1);
					rem.executeUpdate();
					rem.close();
					rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_contents WHERE scheme_id=?");
					rem.setString(1, eventParam1);
					rem.executeUpdate();
					rem.close();
				}
				catch (SQLException e)
				{
					print(e);
				}
				return rebuildMainHtml(st);
				
			case "delete_c":
				return "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Do you really want to delete '" + eventParam2 + "' scheme?<br><br>" + "<button value=\"Yes\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete " + eventParam1 + " x x\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<button value=\"No\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " delete_1 x x x\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
				
			case "create_1":
				return createScheme();
			case "edit_1":
				return editScheme(player);
			case "delete_1":
				return deleteScheme(player);
			case "manage_scheme_1":
				return viewAllSchemeBuffs(eventParam1, eventParam2, "add");
			case "manage_scheme_2":
				return viewAllSchemeBuffs(eventParam1, eventParam2, "remove");
			case "manage_scheme_select":
				return getOptionList(eventParam1);
				
			case "remove_buff":
			{
				String[] split = eventParam1.split("_");
				String scheme = split[0];
				String skill = split[1];
				String level = split[2];
				try (Connection con = L2DatabaseFactory.getInstance().getConnection())
				{
					PreparedStatement rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1");
					rem.setString(1, scheme);
					rem.setString(2, skill);
					rem.setString(3, level);
					rem.executeUpdate();
				}
				catch (SQLException e)
				{
					print(e);
				}
				int temp = Integer.parseInt(eventParam3) - 1;
				final String HTML;
				if (temp <= 0)
				{
					HTML = getOptionList(scheme);
				}
				else
				{
					HTML = viewAllSchemeBuffs(scheme, eventParam2, "remove");
				}
				return HTML;
			}
			
			case "add_buff":
			{
				String[] split = eventParam1.split("_");
				String scheme = split[0];
				String skill = split[1];
				String level = split[2];
				int idbuffclass = getClassBuff(skill);
				try (Connection con = L2DatabaseFactory.getInstance().getConnection())
				{
					PreparedStatement ins = con.prepareStatement("INSERT INTO npcbuffer_scheme_contents (scheme_id,skill_id,skill_level,buff_class) VALUES (?,?,?,?)");
					ins.setString(1, scheme);
					ins.setString(2, skill);
					ins.setString(3, level);
					ins.setInt(4, idbuffclass);
					ins.executeUpdate();
					ins.close();
				}
				catch (SQLException e)
				{
					print(e);
				}
				int temp = Integer.parseInt(eventParam3) + 1;
				final String HTML;
				if (temp >= (MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES))
				{
					HTML = getOptionList(scheme);
				}
				else
				{
					HTML = viewAllSchemeBuffs(scheme, eventParam2, "add");
				}
				return HTML;
			}
			
			case "edit_buff_list":
				return viewAllBuffs(eventParam1, eventParam2, eventParam3);
				
			case "changeBuffSet":
				if (eventParam2.equals(SET_FIGHTER))
				{
					eventParam2 = "0";
				}
				else if (eventParam2.equals(SET_MAGE))
				{
					eventParam2 = "1";
				}
				else if (eventParam2.equals(SET_ALL))
				{
					eventParam2 = "2";
				}
				else if (eventParam2.equals(SET_NONE))
				{
					eventParam2 = "3";
				}
				else if (DEBUG)
				{
					throw new RuntimeException();
				}
				return manageSelectedSet(eventParam1, eventParam2, eventParam3);
				
			case "editSelectedBuff":
			{
				eventParam2 = eventParam2.replace("-", " ");
				String[] split = eventParam2.split(" ");
				String action = split[0];
				String page = split[1];
				manageSelectedBuff(eventParam1, action);
				final String typeName;
				switch (eventParam3)
				{
					case "buff":
						typeName = "Buffs";
						break;
					case "resist":
						typeName = "Resists";
						break;
					case "song":
						typeName = "Songs";
						break;
					case "dance":
						typeName = "Dances";
						break;
					case "chant":
						typeName = "Chants";
						break;
					case "others":
						typeName = "Others_Buffs";
						break;
					case "special":
						typeName = "Special_Buffs";
						break;
					case "cubic":
						typeName = "Cubics";
						break;
					default:
						throw new RuntimeException();
				}
				return viewAllBuffs(eventParam3, typeName, page);
			}
			
			case "viewSelectedConfig":
				throw new RuntimeException();
				
			case "changeConfig":
				throw new RuntimeException();
				
			case "heal":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					if (player.isInCombat() && !ENABLE_HEAL_IN_COMBAT)
					{
						return showText(st, "Info", "You can't use the heal function while in combat.", false, "Return", "main");
					}
					
					if (st.getQuestItemsCount(CONSUMABLE_ID) < HEAL_PRICE)
					{
						return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + HEAL_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
					}
					final boolean getSummonbuff = isPetBuff(st);
					if (getSummonbuff)
					{
						if (player.getSummon() != null)
						{
							heal(player, getSummonbuff);
						}
						else
						{
							return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
						}
					}
					else
					{
						heal(player, getSummonbuff);
					}
					st.takeItems(CONSUMABLE_ID, HEAL_PRICE);
					if (TIME_OUT)
					{
						addTimeout(st, 1, TIME_OUT_TIME / 2, 600);
					}
				}
				return SMART_WINDOW ? null : rebuildMainHtml(st);
				
			case "removeBuffs":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					if (st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_REMOVE_PRICE)
					{
						return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + BUFF_REMOVE_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
					}
					final boolean getSummonbuff = isPetBuff(st);
					if (getSummonbuff)
					{
						if (player.getSummon() != null)
						{
							player.getSummon().stopAllEffects();
						}
						else
						{
							return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
						}
					}
					else
					{
						player.stopAllEffects();
						if (player.getCubics() != null)
						{
							for (L2CubicInstance cubic : player.getCubics().values())
							{
								cubic.stopAction();
								player.getCubics().remove(cubic);
							}
						}
					}
					st.takeItems(CONSUMABLE_ID, BUFF_REMOVE_PRICE);
					if (TIME_OUT)
					{
						addTimeout(st, 2, TIME_OUT_TIME / 2, 600);
					}
				}
				return SMART_WINDOW ? null : rebuildMainHtml(st);
				
			case "cast":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					List<Integer> buffs = new ArrayList<>();
					List<Integer> levels = new ArrayList<>();
					try (Connection con = L2DatabaseFactory.getInstance().getConnection())
					{
						PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_contents WHERE scheme_id=? ORDER BY id");
						rss.setString(1, eventParam1);
						ResultSet action = rss.executeQuery();
						while (action.next())
						{
							int id = Integer.parseInt(action.getString("skill_id"));
							int level = Integer.parseInt(action.getString("skill_level"));
							switch (getBuffType(id))
							{
								case "buff":
									if (ENABLE_BUFFS)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "resist":
									if (ENABLE_RESIST)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "song":
									if (ENABLE_SONGS)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "dance":
									if (ENABLE_DANCES)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "chant":
									if (ENABLE_CHANTS)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "others":
									if (ENABLE_OTHERS)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								case "special":
									if (ENABLE_SPECIAL)
									{
										if (isEnabled(id, level))
										{
											buffs.add(id);
											levels.add(level);
										}
									}
									break;
								default:
									if (DEBUG)
									{
										throw new RuntimeException();
									}
							}
						}
					}
					catch (SQLException e)
					{
						print(e);
					}
					
					if (buffs.size() == 0)
					{
						return viewAllSchemeBuffs(eventParam1, "1", "add");
					}
					if (!FREE_BUFFS)
					{
						if (st.getQuestItemsCount(CONSUMABLE_ID) < SCHEME_BUFF_PRICE)
						{
							return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + SCHEME_BUFF_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
						}
					}
					
					final boolean getSummonbuff = isPetBuff(st);
					for (int i = 0; i < buffs.size(); ++i)
					{
						if (!getSummonbuff)
						{
							npc.broadcastPacket(new MagicSkillUse(npc, player, buffs.get(i), 1, 1, 1));
							SkillData.getInstance().getSkill(buffs.get(i), levels.get(i)).applyEffects(player, player);
						}
						else
						{
							if (player.getSummon() != null)
							{
								npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), buffs.get(i), 1, 1, 1));
								SkillData.getInstance().getSkill(buffs.get(i), levels.get(i)).applyEffects(player.getSummon(), player.getSummon());
							}
							else
							{
								return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
							}
						}
					}
					st.takeItems(CONSUMABLE_ID, SCHEME_BUFF_PRICE);
					if (TIME_OUT)
					{
						addTimeout(st, 3, TIME_OUT_TIME, 600);
					}
				}
				return SMART_WINDOW ? null : rebuildMainHtml(st);
				
			case "giveBuffs":
			{
				final int cost;
				switch (eventParam3)
				{
					case "buff":
						cost = BUFF_PRICE;
						break;
					case "resist":
						cost = RESIST_PRICE;
						break;
					case "song":
						cost = SONG_PRICE;
						break;
					case "dance":
						cost = DANCE_PRICE;
						break;
					case "chant":
						cost = CHANT_PRICE;
						break;
					case "others":
						cost = OTHERS_PRICE;
						break;
					case "special":
						cost = SPECIAL_PRICE;
						break;
					case "cubic":
						cost = CUBIC_PRICE;
						break;
					default:
						throw new RuntimeException();
				}
				
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					if (!FREE_BUFFS)
					{
						if (st.getQuestItemsCount(CONSUMABLE_ID) < cost)
						{
							return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + cost + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
						}
					}
					Skill skill = SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2));
					if (skill.hasEffectType(L2EffectType.SUMMON))
					{
						if (st.getQuestItemsCount(skill.getItemConsumeId()) < skill.getItemConsumeCount())
						{
							return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + skill.getItemConsumeCount() + " " + getItemNameHtml(st, skill.getItemConsumeId()) + "!", false, "0", "0");
						}
					}
					final boolean getSummonbuff = isPetBuff(st);
					if (!getSummonbuff)
					{
						if (eventParam3.equals("cubic"))
						{
							if (player.getCubics() != null)
							{
								for (L2CubicInstance cubic : player.getCubics().values())
								{
									cubic.stopAction();
									player.getCubics().remove(cubic);
								}
							}
							npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
							player.useMagic(SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)), false, false);
						}
						else
						{
							npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
							SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)).applyEffects(player, player);
						}
					}
					else
					{
						if (eventParam3.equals("cubic"))
						{
							if (player.getCubics() != null)
							{
								for (L2CubicInstance cubic : player.getCubics().values())
								{
									cubic.stopAction();
									player.getCubics().remove(cubic);
								}
							}
							npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
							player.useMagic(SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)), false, false);
						}
						else
						{
							if (player.getSummon() != null)
							{
								npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), Integer.parseInt(eventParam1), 1, 1, 1));
								SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)).applyEffects(player.getSummon(), player.getSummon());
							}
							else
							{
								return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
							}
						}
					}
					st.takeItems(CONSUMABLE_ID, cost);
					if (TIME_OUT)
					{
						addTimeout(st, 3, TIME_OUT_TIME / 10, 600);
					}
				}
				return SMART_WINDOW ? null : buildHtml(eventParam3);
			}
			
			case "castBuffSet":
				if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
				{
					if (!FREE_BUFFS)
					{
						if (st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_SET_PRICE)
						{
							return showText(st, "Sorry", "You don't have the enough items:<br>You need: <font color=LEVEL>" + BUFF_SET_PRICE + " " + getItemNameHtml(st, CONSUMABLE_ID) + "!", false, "0", "0");
						}
					}
					List<int[]> buff_sets = new ArrayList<>();
					final int player_class;
					if (player.isMageClass())
					{
						player_class = 1;
					}
					else
					{
						player_class = 0;
					}
					final boolean getSummonbuff = isPetBuff(st);
					if (!getSummonbuff)
					{
						try (Connection con = L2DatabaseFactory.getInstance().getConnection())
						{
							PreparedStatement getSimilarNameCount = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC");
							getSimilarNameCount.setInt(1, player_class);
							getSimilarNameCount.setString(2, "2");
							ResultSet rss = getSimilarNameCount.executeQuery();
							while (rss.next())
							{
								int id = rss.getInt("buffId");
								int lvl = rss.getInt("buffLevel");
								buff_sets.add(new int[]
								{
									id,
									lvl
								});
							}
						}
						catch (SQLException e)
						{
							print(e);
						}
						for (int[] i : buff_sets)
						{
							npc.broadcastPacket(new MagicSkillUse(npc, player, i[0], 1, 1, 1));
							SkillData.getInstance().getSkill(i[0], i[1]).applyEffects(player, player);
						}
					}
					else
					{
						if (player.getSummon() != null)
						{
							try (Connection con = L2DatabaseFactory.getInstance().getConnection())
							{
								PreparedStatement getSimilarNameCount = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC");
								getSimilarNameCount.setString(1, "0");
								getSimilarNameCount.setString(2, "2");
								ResultSet rss = getSimilarNameCount.executeQuery();
								while (rss.next())
								{
									int id = rss.getInt("buffId");
									int lvl = rss.getInt("buffLevel");
									buff_sets.add(new int[]
									{
										id,
										lvl
									});
								}
							}
							catch (SQLException e)
							{
								print(e);
							}
							for (int[] i : buff_sets)
							{
								npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), i[0], 1, 1, 1));
								SkillData.getInstance().getSkill(i[0], i[1]).applyEffects(player.getSummon(), player.getSummon());
							}
						}
						else
						{
							return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
						}
					}
					st.takeItems(CONSUMABLE_ID, BUFF_SET_PRICE);
					if (TIME_OUT)
					{
						addTimeout(st, 3, TIME_OUT_TIME, 600);
					}
				}
				return SMART_WINDOW ? null : rebuildMainHtml(st);
				
		}
		return rebuildMainHtml(st);
	}
	
	@SuppressWarnings("unused")
	@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		QuestState st = player.getQuestState(QUEST_LOADING_INFO);
		if (st == null)
		{
			st = newQuestState(player);
		}
		if (player.isGM())
		{
			if (SCRIPT_RELOAD)
			{
				return reloadPanel(st);
			}
			return rebuildMainHtml(st);
		}
		
		if (!BUFF_WITH_KARMA && (player.getKarma() > 0))
		{
			return showText(st, "Info", "You have too much <font color=FF0000>karma!</font><br>Come back,<br>when you don't have any karma!", false, "Return", "main");
		}
		else if (OlympiadManager.getInstance().isRegistered(player))
		{
			return showText(st, "Info", "You can not buff while you are in <font color=FF0000>Olympiad!</font><br>Come back,<br>when you are out of the Olympiad.", false, "Return", "main");
		}
		else if (TvTEvent.isPlayerParticipant(player.getObjectId()))
		{
			return showText(st, "Info", "You can not buff while you are in <font color=\"FF0000\">TvT!</font><br>Come back,<br>when you are out of TvT!", false, "Return", "main");
		}
		else if (player.getLevel() < MIN_LEVEL)
		{
			return showText(st, "Info", "Your level is too low!<br>You have to be at least level <font color=LEVEL>" + MIN_LEVEL + "</font>,<br>to use my services!", false, "Return", "main");
		}
		else if (player.getPvpFlag() > 0)
		{
			return showText(st, "Info", "You can't buff while you are <font color=800080>flagged!</font><br>Wait some time and try again!", false, "Return", "main");
		}
		else if (player.isInCombat())
		{
			return showText(st, "Info", "You can't buff while you are attacking!<br>Stop your fight and try again!", false, "Return", "main");
		}
		else
		{
			return rebuildMainHtml(st);
		}
	}
	
	@Override
	public boolean showResult(L2PcInstance player, String res)
	{
		if (SMART_WINDOW)
		{
			if ((player != null) && (res != null) && res.startsWith("<html>"))
			{
				final NpcHtmlMessage npcReply = new NpcHtmlMessage();
				npcReply.setHtml(res);
				player.sendPacket(npcReply);
				player.sendPacket(ActionFailed.STATIC_PACKET);
				return false;
			}
		}
		return super.showResult(player, res);
	}
	
	private String getSkillIconHtml(int id, int level)
	{
		String iconNumber = getSkillIconNumber(id, level);
		return "<button action=\"bypass -h Quest " + QUEST_LOADING_INFO + " description " + id + " " + level + " x\" width=32 height=32 back=\"Icon.skill" + iconNumber + "\" fore=\"Icon.skill" + iconNumber + "\">";
	}
	
	private String getSkillIconNumber(int id, int level)
	{
		String formato;
		if (id == 4)
		{
			formato = "0004";
		}
		else if ((id > 9) && (id < 100))
		{
			formato = "00" + id;
		}
		else if ((id > 99) && (id < 1000))
		{
			formato = "0" + id;
		}
		else if (id == 1517)
		{
			formato = "1536";
		}
		else if (id == 1518)
		{
			formato = "1537";
		}
		else if (id == 1547)
		{
			formato = "0065";
		}
		else if (id == 2076)
		{
			formato = "0195";
		}
		else if ((id > 4550) && (id < 4555))
		{
			formato = "5739";
		}
		else if ((id > 4698) && (id < 4701))
		{
			formato = "1331";
		}
		else if ((id > 4701) && (id < 4704))
		{
			formato = "1332";
		}
		else if (id == 6049)
		{
			formato = "0094";
		}
		else
		{
			formato = String.valueOf(id);
		}
		return formato;
	}
	
	static public void main(String[] args)
	{
		new NpcBuffer();
	}
}

Create npc with ID Fuffer, change id in NpcBuffer.java

private static final int NPC_ID = 12;

And create npc xml, example:

<npc id="12" displayId="32226" name="Rin4a" usingServerSideName="true" title="NPC Buffer" usingServerSideTitle="true" type="L2NpcBuffer">
	<collision>
		<radius normal="11" />
		<height normal="22.25" />
	</collision>
</npc>

Finally, add sql:

DROP TABLE IF EXISTS `npcbuffer_buff_list`;
DROP TABLE IF EXISTS `npcbuffer_scheme_contents`;
DROP TABLE IF EXISTS `npcbuffer_scheme_list`;

CREATE TABLE `npcbuffer_buff_list` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `buff_class` int(2) DEFAULT NULL,
  `buffType` varchar(10) DEFAULT NULL,
  `buffId` int(5) DEFAULT '0',
  `buffLevel` int(5) DEFAULT NULL,
  `forClass` tinyint(1) DEFAULT NULL,
  `canUse` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) AUTO_INCREMENT=136;
CREATE TABLE `npcbuffer_scheme_contents` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `scheme_id` int(11) DEFAULT NULL,
  `skill_id` int(8) DEFAULT NULL,
  `skill_level` int(4) DEFAULT NULL,
  `buff_class` int(2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) AUTO_INCREMENT=30;
CREATE TABLE `npcbuffer_scheme_list` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `player_id` varchar(40) DEFAULT NULL,
  `scheme_name` varchar(36) DEFAULT NULL,
  `mod_accepted` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) AUTO_INCREMENT=7;

INSERT INTO `npcbuffer_buff_list` VALUES ('1', '0', 'buff', '1036', '2', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('2', '0', 'buff', '1040', '3', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('3', '0', 'buff', '1043', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('4', '0', 'buff', '1044', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('5', '0', 'buff', '1045', '6', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('6', '0', 'buff', '1047', '4', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('7', '0', 'buff', '1048', '6', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('8', '0', 'buff', '1059', '3', '1', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('9', '0', 'buff', '1068', '3', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('10', '0', 'buff', '1077', '3', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('11', '0', 'buff', '1085', '3', '1', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('12', '0', 'buff', '1086', '2', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('13', '0', 'buff', '1087', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('14', '0', 'buff', '1204', '2', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('15', '0', 'buff', '1240', '3', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('16', '0', 'buff', '1242', '3', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('17', '0', 'buff', '1243', '6', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('18', '0', 'buff', '1257', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('19', '0', 'buff', '1268', '4', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('20', '0', 'buff', '1303', '2', '1', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('21', '0', 'buff', '1304', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('22', '0', 'buff', '1307', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('23', '0', 'buff', '1311', '6', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('24', '0', 'buff', '1397', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('25', '0', 'buff', '1460', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('26', '0', 'buff', '1232', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('27', '0', 'buff', '1238', '3', '3', '0');
INSERT INTO `npcbuffer_buff_list` VALUES ('28', '0', 'special', '1323', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('29', '0', 'special', '1388', '3', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('30', '0', 'special', '1389', '3', '1', '1');

INSERT INTO `npcbuffer_buff_list` VALUES ('31', '1', 'song', '264', '1', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('32', '1', 'song', '265', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('33', '1', 'song', '266', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('34', '1', 'song', '267', '1', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('35', '1', 'song', '268', '1', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('36', '1', 'song', '269', '1', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('37', '1', 'song', '270', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('38', '1', 'song', '304', '1', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('39', '1', 'song', '305', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('40', '1', 'song', '306', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('41', '1', 'song', '308', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('42', '1', 'song', '349', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('43', '1', 'song', '363', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('44', '1', 'song', '364', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('45', '1', 'song', '529', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('46', '1', 'song', '764', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('47', '1', 'song', '914', '1', '3', '1');

INSERT INTO `npcbuffer_buff_list` VALUES ('48', '2', 'dance', '271', '1', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('49', '2', 'dance', '272', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('50', '2', 'dance', '273', '1', '1', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('51', '2', 'dance', '274', '1', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('52', '2', 'dance', '275', '1', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('53', '2', 'dance', '276', '1', '1', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('54', '2', 'dance', '277', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('55', '2', 'dance', '307', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('56', '2', 'dance', '309', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('57', '2', 'dance', '310', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('58', '2', 'dance', '311', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('59', '2', 'dance', '365', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('60', '2', 'dance', '366', '1', '3', '0');
INSERT INTO `npcbuffer_buff_list` VALUES ('61', '2', 'dance', '530', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('62', '2', 'dance', '765', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('63', '2', 'dance', '915', '1', '3', '1');

INSERT INTO `npcbuffer_buff_list` VALUES ('64', '3', 'resist', '1461', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('65', '3', 'chant', '1002', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('66', '3', 'chant', '1006', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('67', '3', 'chant', '1007', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('68', '3', 'chant', '1009', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('69', '3', 'chant', '1251', '2', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('70', '3', 'chant', '1252', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('71', '3', 'chant', '1253', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('72', '3', 'chant', '1284', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('73', '3', 'chant', '1308', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('74', '3', 'chant', '1309', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('75', '3', 'chant', '1310', '4', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('76', '3', 'chant', '1362', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('77', '3', 'special', '1499', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('78', '3', 'special', '1500', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('79', '3', 'special', '1501', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('80', '3', 'special', '1502', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('81', '3', 'special', '1503', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('82', '3', 'special', '1504', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('83', '3', 'special', '1519', '1', '3', '1');

INSERT INTO `npcbuffer_buff_list` VALUES ('84', '4', 'others', '825', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('85', '4', 'others', '826', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('86', '4', 'others', '827', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('87', '4', 'others', '828', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('88', '4', 'others', '829', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('89', '4', 'others', '830', '1', '3', '1');

INSERT INTO `npcbuffer_buff_list` VALUES ('90', '5', 'others', '834', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('91', '5', 'others', '1442', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('92', '5', 'others', '1443', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('93', '5', 'others', '1444', '1', '3', '1');

INSERT INTO `npcbuffer_buff_list` VALUES ('94', '6', 'cubic', '67', '7', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('95', '6', 'cubic', '10', '8', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('96', '6', 'cubic', '22', '7', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('97', '6', 'cubic', '33', '8', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('98', '6', 'cubic', '278', '6', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('99', '6', 'cubic', '449', '4', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('100', '6', 'cubic', '1279', '9', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('101', '6', 'cubic', '1280', '9', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('102', '6', 'cubic', '1281', '9', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('103', '6', 'cubic', '1328', '8', '3', '0');
INSERT INTO `npcbuffer_buff_list` VALUES ('104', '6', 'cubic', '1329', '9', '3', '0');
INSERT INTO `npcbuffer_buff_list` VALUES ('105', '6', 'cubic', '1330', '8', '3', '0');
INSERT INTO `npcbuffer_buff_list` VALUES ('106', '6', 'cubic', '779', '1', '3', '1');

INSERT INTO `npcbuffer_buff_list` VALUES ('107', '7', 'special', '1062', '2', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('108', '7', 'special', '1355', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('109', '7', 'special', '1356', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('110', '7', 'special', '1357', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('111', '7', 'special', '1363', '1', '0', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('112', '7', 'special', '1413', '1', '1', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('114', '7', 'special', '1457', '1', '3', '0');
INSERT INTO `npcbuffer_buff_list` VALUES ('115', '7', 'special', '4699', '13', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('116', '7', 'special', '4700', '13', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('117', '7', 'special', '4702', '13', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('118', '7', 'special', '4703', '13', '3', '1');

INSERT INTO `npcbuffer_buff_list` VALUES ('119', '8', 'resist', '1032', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('120', '8', 'resist', '1033', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('121', '8', 'resist', '1035', '4', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('122', '8', 'resist', '1078', '6', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('123', '8', 'resist', '1182', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('124', '8', 'resist', '1189', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('125', '8', 'resist', '1191', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('126', '8', 'resist', '1259', '4', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('127', '8', 'resist', '1352', '1', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('128', '8', 'resist', '1353', '1', '2', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('129', '8', 'resist', '1354', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('130', '8', 'resist', '1392', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('131', '8', 'resist', '1393', '3', '3', '1');

INSERT INTO `npcbuffer_buff_list` VALUES ('132', '8', 'overlord', '1003', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('133', '8', 'overlord', '1004', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('134', '8', 'overlord', '1005', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('135', '8', 'overlord', '1008', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('136', '8', 'overlord', '1249', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('137', '8', 'overlord', '1250', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('138', '8', 'overlord', '1260', '3', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('139', '8', 'overlord', '1261', '2', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('140', '8', 'overlord', '1282', '2', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('141', '8', 'overlord', '1364', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('142', '8', 'overlord', '1365', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('143', '8', 'overlord', '1415', '1', '3', '1');
INSERT INTO `npcbuffer_buff_list` VALUES ('144', '8', 'overlord', '1416', '1', '3', '1');
\ No newline at end of file
Posted
I did all what you've said,when you first started the post.
I followed your last post,aswell.You have wrote "Create npc with ID Fuffer, change id in NpcBuffer.java"  and  you also wrote " private static final int NPC_ID = 12"..I didnt quite understand that and I dint follow.
Anyways,thanks for the effort to make me understand.The buffer appears but she doesnt buff me..
Here few photos.When I try to buff charges me but she doesnt buff me.Heals me too.
Thanks again.
 
 
YeiQKA.png
 
 
 
 
 
Eqizah.png
 
 
 
iP7Lcy.png
 
 
 
 
 
YS8CCu.png
 
 
 
 
 
 
 
 
 
 
 
 

 

 

 

 

 

Posted

I forgot to post the error in login screen..

Here it is..

 

Blah...Blah....Blah............

ns.jdbc4.MySQLSyntaxErrorException: T
able 'l2jgs.npcbuffer_scheme_list' doesn't exist<<<
[25/10 23:14:33] >>>com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: T
able 'l2jgs.npcbuffer_scheme_list' doesn't exist<<<
[25/10 23:14:43] >>>com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: T
able 'l2jgs.npcbuffer_buff_list' doesn't exist<<<
[25/10 23:14:48] >>>com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: T
able 'l2jgs.npcbuffer_scheme_list' doesn't exist<<<
[25/10 23:14:58] >>>com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: T
Blah...Blah....Blah............

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • L2JOne — Interlude C6 Level 86, S84 grade, clan level 11 — on an Interlude C6 core. 67 systems. Desktop Control Center. Edit the server while it runs. FULL SYSTEM CATALOGUE  ·  WEBSITE  ·  TELEGRAM Most Interlude packs give you a clean core and leave the interesting part to you. This one ships with the content already written — the economy systems, the event engine, the retention loop and the admin tooling a live server actually needs after week one. Everything is configurable from open files, and most of it is editable with the server running, from a Community Board panel or from the desktop Control Center. You should not need a new build to fix a broken skill or retune a drop rate on a Saturday night. QUICK FACTS Level cap 86, S80 and S84 grades, clan level 11 — High Five progression on an Interlude core 909 High Five items — Dynasty, Vesper and Icarus gear, Forgotten Scrolls, Dolls, Agathions 67 systems delivered ready — new, rebuilt, expanded or fixed 689 XML files — items, NPCs, skills, spawns, zones and every custom system, all open 343 quests implemented 147 GM commands, each with its own access level 95 database tables with install and versioned migration scripts 22 Community Board panels with open HTML 8 event modes that schedule themselves Java, JDK 22+, MariaDB / MySQL Desktop Control Center in English, Portuguese and Spanish HIGH FIVE CONTENT ON AN INTERLUDE CORE This is the part most Interlude packs do not have. The core is Interlude C6 — the chronicle your players know, with the combat and the pace they came for — but the progression ceiling is not the Interlude one. The end game was extended with High Five content, server side and client side. Level cap 86. The full experience table up to 86, with the rate brackets to match: five independent XP, SP and currency ranges covering 1-52, 52-61, 61-76, 76-78 and 78-86, so you shape the curve at the top instead of letting it flatten. S80 and S84 grades. Two grades above S, each with its own crystal, enchant bonus and gemstone cost — so the enchant and crystallization economy keeps working at the new ceiling instead of stopping at S. Clan level 11. Clan progression continues past the Interlude cap, with Blood Oath, Blood Alliance and Blood and Sand as the upgrade materials, and the clan skills that come with those levels. 909 High Five items. Dynasty, Vesper and Icarus weapons and armour with their augments and special abilities, 112 Forgotten Scrolls, Dolls and Agathions. High Five skill set. The skill ranges that come with the higher levels and the new gear are implemented, not stubbed — including the Doll and Agathion skills. Client tables included. The item name and grp tables for all of it ship with the pack, and the Control Center reads and repacks them. You are not left to reverse-engineer the client side of a Vesper set on your own. The practical effect: an Interlude server that does not run out of content at 80. Your players keep the chronicle they wanted and still have somewhere to go after the S set. DESKTOP CONTROL CENTER Start, restart and reload configuration Memory, GC, threads and CPU in real time Live log console and content search Database browser, scheduled backup, install and migration HWID bans and IP lookup Item editor with icon preview, plus multisell, NPC, class and config editors Item cloning, ID migration, item-pack import Reads and repacks the client itemgrp / npcgrp / skillgrp Automatic backup before every save Builds incremental updates, hash-verified per file WHAT IS INSIDE NEW = not in stock Interlude  ·  REBUILT = existed, rewritten from scratch  ·  EXPANDED = original kept, features added  ·  IMPROVED = original fixed and revised ECONOMY AND ITEMS — 11 systems Offline Shop — REBUILT. Keeps selling after the client closes, restores itself on restart, expires in a number of days you set. Own name colour and visual effect, no damage in peace zones, can be restricted to VIP only. Marketplace — NEW. Persistent market inside the Community Board. Listings stay up with the player offline, delivery is automatic, the listing fee is configurable, every sale logged. Enchant System — REBUILT. Rate per level and per scroll type in an open file. You choose what happens on failure: break, keep or drop one level. In-game editing panel, log of every attempt, automatic high-enchant announce. Custom currency — NEW. Any item as the private store currency: buy, sell and package sale, including the balance the client shows. Reward capsules — NEW. Boxes that draw items by weight, built in an open file. Event, donation and boss boxes with no code. Timed items and passes — NEW. Expire in real time, not play time, and keep counting offline. Noble, VIP, Kamaloka and auto farm passes ship ready. Equipment skins — NEW. Change the look of weapon and armour without touching a single stat. Accessory sets — NEW. The armour-set concept applied to rings, earrings and necklaces, with their own bonus. Deferred delivery — NEW. Items delivered at the player's next login, so donations, vote rewards and event prizes never get lost. Redeem coupons — NEW. GM generates a code, the player redeems it once. Campaigns, downtime compensation, streamer partnerships. Price and drop control — NEW. Single price across every merchant, all-free mode for test servers, gold bar conversion, drop block by grade on death. EVENTS AND PVP — 9 systems Event engine — NEW. Open-file catalogue: which events exist, when they open, how many players they need, what the prize is. Persistent ranking, level-balanced teams, rejoin after a disconnect. 8 event modes — NEW. Team vs Team, Deathmatch, Capture the Flag, Battle Royale with its own map, Hunting Grounds, Party, Spoil and Fight Boss. Each can run at a different time. Tournament — NEW. 1v1, 3v3, 5v5 and 9v9, solo and party registration. Per-format duration, run window, class composition limit and prize. Function zones — NEW. A whole PvP area from a single file: entry fee, auto-flag, anonymous mode, forbidden items and skills, temporary noblesse, restart lock, monster waves, a boss and automatic shutdown. Rotating siege — NEW. One castle drawn per cycle instead of nine independent schedules. The winner moves to the next castle an hour before the following siege, and no castle repeats until every other one has been fought over. Classic mode still available. Castle governor — NEW. The clan holding the active castle taxes merchants, board shop, gatekeepers and marketplace server-wide, and earns a drop, XP and skill bonus. Own vault and statue, wyvern rights for the leader. Every cap set by you. Olympiad — EXPANDED. Custom period and duration, battle limit, enchant cap in the arena, separate mage and fighter buffs, minimum PvP to enter, participant limit per IP, monthly winners. Event shop — NEW. Event currency buys prizes that exist nowhere else. Editable in-game. Anti-feed and dualbox control — NEW. XP and drop blocked on repeated same-IP kills, character limit per IP, whitelist per zone and instance, participant limit per IP with optional HWID check for events. PROGRESSION AND RETENTION — 13 systems VIP System — NEW. Tiers with their own XP/SP/drop rates, rewards and real-time duration. Benefits keep working in the offline shop, activation item configurable, status panel on the board. Daily missions — NEW. Objectives by action type, automatic scheduled reset, reward per mission, progress saved per character. Includes a daily login reward. Auto Farm — NEW. The player picks the skill list, monster priority and target type (mob, raid or grand boss), and can assist the summon or the party leader. Daily quota unlocked by a pass. You decide: everyone, VIP only, or off. Auto Potion (ACP) — NEW. Separate HP / MP / CP percentage triggers, configured in-game. Removes the incentive to run third-party software. Player-to-player buff selling — NEW. The human buffer gets its job back: advertise your own buffs, set the price, sell to whoever passes. Scheme Buffer — IMPROVED. Schemes saved per account, applied from the NPC and from the board, with a cost and skill list you control. AIO character — NEW. All-in-one character with its own buffs and saved macros, duration and type set by you. Level reward — NEW. Automatic prize on reaching each level, right where most new players give up. Rates per level bracket — NEW. Five independent brackets between 1 and 86 for XP, SP and currency, plus an exclusive rate inside instances. Subclass and skill stacking — EXPANDED. Configurable cap, switching anywhere, selective stacking across subclasses with a block list. Agathion — NEW. Companion pet that follows, talks and optionally heals by percentage. Restored at login. Pet and summon persistence — IMPROVED. Pet and servitor return after a reconnect with buffs and cooldown intact. A dropped connection stops costing ten minutes of rebuffing. Chat commands — NEW. A whole layer absent from stock Interlude: .menu .farm .acp .mission .vote .sell .register .instance .leader .crystal .recipe .aiomacro CONTENT AND WORLD — 8 systems Instanced territories — NEW. Private farm area per player or party, built from the map regions. Each region has its own monster list, respawn, entry policy and a trigger-released boss. No instance sees another, and the drop rate inside is exclusive. Spot fighting is over. Kamaloka — NEW. Instanced dungeon with its own scoring, a board ranking and an entry pass as an item. Simulated players — NEW. Server-controlled characters with combat, healing and potion AI, town walking routes and template clans. Visible in /who. A freshly opened server stops looking empty. Champion mobs — EXPANDED. Own HP, attack and speed, configurable aura, multiplied XP/SP/drop, exclusive drop list, optional guaranteed enchant. Boss info and reward — NEW. Schedule and status on the board, participation reward per raid, raid points to the clan, loot protection, grand boss death announce. Original Interlude content — IMPROVED. 343 quests, 9 castles with working sieges, 44 clan halls with auction and functions, Seven Signs, Festival of Darkness, manor, fishing. Grand boss AI revised — Antharas, Baium, Frintezza, Sailren. Polymorph — NEW. Visual transformation of players and NPCs from an open file. Seasonal events — NEW. Mammon Spawn and Master of Enchanting as calendar scripts. COMMUNITY BOARD — 22 panels Player panel — NEW. Board home with server info, rules, active promotions and a shortcut to every other panel. Server shop — NEW. A merchant inside the board, prices subject to the ruling clan's tax. Rankings — NEW. PvP, PK, level, clan raid points, Kamaloka score and event ranking — six lists updated live, with automatic weekly prizes. Donation panel — NEW. Balance, product and delivery on the character, integrated with the website system. Every delivery logged. Party matching — NEW. A party noticeboard by level, class and goal. Live information panels — NEW. Boss schedules, active events, open instances and territories, governor panel, channel videos with a watch reward, vote reward. All read from the real server state. Forum, mail and friends — IMPROVED. Internal forum, character mail, friend list, favourites and a personal memo. All panel HTML is open — change the visual identity with no recompile. ADMINISTRATION — 7 systems Operations panel — NEW. The desktop Control Center described above. Visual content editors — NEW. Items with icon preview, plus multisell, NPC, class and configuration editors. Item cloning, ID migration, item pack import, automatic backup before every save. Client file editor — NEW. itemgrp / npcgrp / skillgrp read, edit and repack, with ID migration synchronized between server and client. Adding a custom item stops being a manual process across three tools. In-game editors — NEW. Balance, event engine, function zones, territories and system config edited from a board panel, applied without restart, automatic backup of every changed file. GM commands — EXPANDED. 147 commands with per-command access level: zone creation by vertices in-game, spawns saved to the database, NPC route editor with preview, event / balance / enchant panels, HWID management. Persistent configuration — NEW. What the GM changes from the panel is stored and reapplied at next boot. Update package — NEW. The build ships only what changed, hash-verified per file, ready to publish to your players. SECURITY AND PROMOTION — 6 systems Guard and HWID — NEW. Validation at startup, machine identification, window limit per machine, configurable grace mode, access log per account, ban and lookup by GM command. Discord logging — NEW. 28 channels: enchant, drop, pickup, trade, warehouse, multisell, donation, Olympiad results, grand boss deaths, player and GM logins, suspicious IP alerts, chat keyword filter. When a player complains about a missing item, the answer is in the channel. Vote reward — NEW. 8 top lists, individual reward, per-site cooldown, global vote goal with a collective prize. YouTube integration — NEW. Turns your player base into your channel audience. Full section below. Announcements and promotions — NEW. Rotating in-game announces, time-boxed promotions with a board panel. Build protection — NEW. Obfuscation plus optional class encryption with its own loader. YOUTUBE — TURN YOUR PLAYERS INTO YOUR CHANNEL AUDIENCE Most packs call "YouTube integration" a button that opens a link. This one is a closed loop between your channel and the game, and the player never leaves the client. 1. Your channel, inside the game. The server queries the YouTube Data API and rewrites its own video list — title, description and publish date. You never maintain a list by hand: publish on YouTube and the panel updates itself. Players search it and pick what to watch. 2. The video plays inside the client. No alt-tab, no browser, nobody logs out to watch. The server reads the real duration of that video from YouTube and sets the timer to that exact length — the message on screen says how long is left. The player is held away for the duration, so watching is watching, not a tab left open in the background. 3. Watch time, not clicks. This is the part that matters for a channel. A click that bounces after three seconds does nothing for you. What reaches your channel here is a completed view, because the reward only exists if the video runs to the end. 4. The reward lands automatically. Items go straight to the character with an on-screen confirmation and a chat line naming the video. The reward items are yours to configure. Every upload reaches everyone online. A new video triggers an in-game announcement with a message you write. No ad spend, no posting the link in five Discords and hoping. It becomes a habit, not a one-off spike. The daily cap resets every day, so the same players come back tomorrow. Your back catalogue keeps earning views months after publication. Abuse controls built in. One reward per video per day, a configurable daily cap across all videos, one video in progress at a time, everything stored per character in the database — relogging resets nothing. Configurable: API key, channel, how many videos to pull, whether to announce, the announcement text, the reward items and the daily reward cap. A server with 300 players online is 300 completed views on every upload. That is the difference between a channel nobody sees and a channel that grows with the server. COMBAT AND BALANCE — 6 systems Balance per class — NEW. Damage dealt and taken per class, split by attack type, edited from the board, applied without restart, automatic backup so you can roll back. Balance per skill — NEW. Power, duration and behaviour per class, without touching the original skill XML. The broken skill of the month is fixed on the spot, not in the next release. Combat caps — NEW. Hard cap on attack and cast speed, no-cooldown skill list, skill duration overridden by ID, fixed cancel time, configurable expertise penalty. Extra effects and conditions — NEW. 9 effects from later chronicles ported to Interlude, 7 new skill conditions, weapon-swap skill, skill that teaches a skill, extra targets. Servitor share — NEW. The summoner passes a percentage of their stats to the servitor. Geoengine and movement — IMPROVED. Revised pathfinding with instance support. WHAT YOU GET The distribution, compiled and licensed for your project The complete datapack — 689 XML files and the Community Board HTML, open to edit Database scripts: install plus versioned migrations Desktop Control Center (EN / PT / ES) Continuous updates through the update system Direct support during setup Optional: the L2JOne Website System — player accounts, donations with automatic in-game delivery, admin dashboard, 4 payment methods, 4 languages. Sold separately, ask if you want both. HONEST NOTES Ships compiled and licensed per project. If you need full Java sources, ask up front — do not assume it is included. Guard/HWID and the build protection are real operational controls, not a promise of absolute protection. Anyone selling you "unhackable" is selling you a story. Two systems ship disabled and are still marked in-development in the config: Fake Farming and Timed Amulets. Everything else in this list is working. The game client itself is not distributed here. The item name and grp tables for the High Five content are included, and the Control Center edits itemgrp / npcgrp / skillgrp, but assembling and hosting the client is yours. CONTACT Full system catalogue: l2jone.com/fonte Website: l2jone.com Telegram: @Williams0ff E-mail: support@l2jone.com Pricing depends on the plan and on what you want bundled — message me and I will send the options. I am open to using the forum's middleman / escrow service. I have no reputation here yet, and I think asking for it is fair. Questions in the topic are welcome — I answer them here so the next person reading finds the answer too.    Scrolls Augments New Augment Acessories    
    • ⚡ Weekend special! Upgrade your personal Google account with 5TB storage and Gemini Pro in under 60 seconds.
    • Don't cry, it's a game. If it makes you cum on your monitor, of course, enjoy it. My business has been running for years and will continue to do so. No matter what happens here, the dogs bark, the caravan moves on. Start developing game engines - post them too - after all, I create them too) Salvation:Arena (MOBA) Unreal Engine RED-TEAM REVERSECODE Аліса займається розробкою ще з часів створення денді та сеги-діти які створюють шум для мене просто діти) За ці роки роботи я бачила багато різних людей у цій сфері все що я думаю про це не плачте та насолоджуйтесь життям слава ураїне - котись на свій бразильський форум)   If you'd simply asked me in a private message on the forum to be reinstated, you'd have been unblocked without a problem. I have no enemies—it's just business. I can make any product on the market, models and effects, copyrights—complex tools—at my age, people run large companies. I'm pleased that our beloved MXC* forum will now have a lot of free products. I earn a maximum of $200-$300 a year from this industry. If that excites you, well, have fun with us.       I moderate many gaming communities, here's one of them  if I hated you, you'd be out of here in a minute, brother  so don't get carried away with your wet dreams. On the topic of free work, start doing it yourself—the forum needs good free stuff. Someone will definitely like you here and throw a flower on your grave. Besides, you're forgetting that half the forum is involved in this interface development business and for many developers, it's a good income. So, you want to make life sweeter for them all, not just for me it's actually nice that you're such a noble young man.   Besides, I usually work from behind the scenes and don't move anywhere in the market but nothing stops me from doing what others do - working from the shadows  you won't even see that I'm doing it, it's so funny.   Start doing free work. You promised to do it well and post it to communities on time. Good luck! We'll have fun, that's great!🥰   завжди приємно поспілкуватися з веселими людьми              
    • Complete development packages for Lineage 2 UI development, across all chronicles and an automated tool to update and patch Interface.u & Interface.xdat What I Offer Clean Sources: 100% clean, retail-based interface source code with zero unwanted custom modifications. Interface.u Update Tool: A standalone tool designed to patch, rebuild, and update Interface.u efficiently. Custom Modifications: Custom UI features and tailoring can be implemented upon request. Turnaround Time: Most major versions and protocols are ready for immediate delivery; other versions take up to 1 week. How It Works Let me know the specific chronicle or protocol version you are targeting. I will provide the tool, which is HWID-bound to your machine, for your setup. Once satisfied with the results, we finalize the deal. Pricing & Notes Both products are priced separately based on the target protocol and requirements. Package deals are negotiable if purchasing both. DM for inquiries, demos, and pricing quotes.    
    • Well u need to change when sm1 press exit it keeps it in game..  
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..