· 9 years ago · Oct 14, 2016, 04:04 AM
1Index: dist/game/data/scripts.cfg
2===================================================================
3--- dist/game/data/scripts.cfg (revision 10413)
4+++ dist/game/data/scripts.cfg (working copy)
5@@ -310,6 +310,7 @@
6 custom/ShadowWeapons/ShadowWeapons.java
7 custom/NewbieCoupons/NewbieCoupons.java
8 custom/RaidbossInfo/RaidbossInfo.java
9+custom/NpcBuffer/NpcBuffer.java
10 custom/NpcLocationInfo/NpcLocationInfo.java
11 custom/Validators/SubClassSkills.java
12
13Index: dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java
14===================================================================
15--- dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java (revision 0)
16+++ dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java (working copy)
17@@ -0,0 +1,1970 @@
18+/*
19+ * Copyright (C) 2004-2014 L2J DataPack
20+ *
21+ * This file is part of L2J DataPack.
22+ *
23+ * L2J DataPack is free software: you can redistribute it and/or modify
24+ * it under the terms of the GNU General Public License as published by
25+ * the Free Software Foundation, either version 3 of the License, or
26+ * (at your option) any later version.
27+ *
28+ * L2J DataPack is distributed in the hope that it will be useful,
29+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
30+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31+ * General Public License for more details.
32+ *
33+ * You should have received a copy of the GNU General Public License
34+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
35+ */
36+package custom.NpcBuffer;
37+
38+import static com.l2jserver.gameserver.util.Util.formatAdena;
39+
40+import java.sql.Connection;
41+import java.sql.PreparedStatement;
42+import java.sql.ResultSet;
43+import java.sql.SQLException;
44+import java.util.ArrayList;
45+import java.util.Collections;
46+import java.util.List;
47+
48+import com.l2jserver.Config;
49+import com.l2jserver.L2DatabaseFactory;
50+import com.l2jserver.gameserver.datatables.SkillData;
51+import com.l2jserver.gameserver.instancemanager.QuestManager;
52+import com.l2jserver.gameserver.model.actor.L2Npc;
53+import com.l2jserver.gameserver.model.actor.L2Summon;
54+import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
55+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
56+import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
57+import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
58+import com.l2jserver.gameserver.model.actor.stat.PcStat;
59+import com.l2jserver.gameserver.model.actor.stat.SummonStat;
60+import com.l2jserver.gameserver.model.actor.status.PcStatus;
61+import com.l2jserver.gameserver.model.actor.status.SummonStatus;
62+import com.l2jserver.gameserver.model.effects.L2EffectType;
63+import com.l2jserver.gameserver.model.entity.TvTEvent;
64+import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
65+import com.l2jserver.gameserver.model.quest.Quest;
66+import com.l2jserver.gameserver.model.quest.QuestState;
67+import com.l2jserver.gameserver.model.skills.Skill;
68+import com.l2jserver.gameserver.network.SystemMessageId;
69+import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
70+import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
71+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
72+import com.l2jserver.gameserver.network.serverpackets.SetSummonRemainTime;
73+import com.l2jserver.gameserver.network.serverpackets.SetupGauge;
74+
75+public class NpcBuffer extends Quest
76+{
77+ private static final boolean DEBUG = false;
78+
79+ private static void print(Exception e)
80+ {
81+ _log.warning(">>>" + e.toString() + "<<<");
82+ if (DEBUG)
83+ {
84+ e.printStackTrace();
85+ }
86+ }
87+
88+ private static final String QUEST_LOADING_INFO = "Rin4a";
89+ private static final int NPC_ID = 12;
90+
91+ private static final String TITLE_NAME = "Scheme Buffer";
92+ private static final boolean SCRIPT_RELOAD = false;
93+ private static final boolean SMART_WINDOW = true;
94+ private static final boolean ENABLE_BUFF_SECTION = true;
95+ private static final boolean ENABLE_SCHEME_SYSTEM = true;
96+ private static final boolean ENABLE_HEAL = true;
97+ private static final boolean ENABLE_HEAL_IN_COMBAT = false;
98+ private static final boolean ENABLE_BUFFS = true;
99+ private static final boolean ENABLE_RESIST = true;
100+ private static final boolean ENABLE_SONGS = true;
101+ private static final boolean ENABLE_DANCES = true;
102+ private static final boolean ENABLE_CHANTS = false;
103+ private static final boolean ENABLE_OTHERS = false;
104+ private static final boolean ENABLE_SPECIAL = false;
105+ private static final boolean ENABLE_CUBIC = false;
106+ private static final boolean ENABLE_BUFF_REMOVE = true;
107+ private static final boolean ENABLE_BUFF_SET = true;
108+ private static final boolean BUFF_WITH_KARMA = true;
109+ private static final boolean FREE_BUFFS = false;
110+ private static final boolean TIME_OUT = true;
111+ private static final int TIME_OUT_TIME = 3;
112+ private static final int MIN_LEVEL = 1;
113+ private static final int BUFF_REMOVE_PRICE = 10000;
114+ private static final int HEAL_PRICE = 10000;
115+ private static final int BUFF_PRICE = 1000;
116+ private static final int RESIST_PRICE = 1000;
117+ private static final int SONG_PRICE = 1000;
118+ private static final int DANCE_PRICE = 1000;
119+ private static final int CHANT_PRICE = 1000;
120+ private static final int OTHERS_PRICE = 1000;
121+ private static final int SPECIAL_PRICE = 1000;
122+ private static final int CUBIC_PRICE = 1000;
123+ private static final int BUFF_SET_PRICE = 15000;
124+ private static final int SCHEME_BUFF_PRICE = 20000;
125+ private static final int SCHEMES_PER_PLAYER = 4;
126+ private static final int CONSUMABLE_ID = 57;
127+ private static final int MAX_SCHEME_BUFFS = Config.BUFFS_MAX_AMOUNT;
128+ private static final int MAX_SCHEME_DANCES = Config.DANCES_MAX_AMOUNT;
129+
130+ private static final String SET_FIGHTER = "Fighter";
131+ private static final String SET_MAGE = "Mage";
132+ private static final String SET_ALL = "All";
133+ private static final String SET_NONE = "None";
134+
135+ private String rebuildMainHtml(QuestState st)
136+ {
137+ String MAIN_HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>";
138+ String MESSAGE = "";
139+ int td = 0;
140+ String[] TRS =
141+ {
142+ "<tr><td height=25>",
143+ "</td>",
144+ "<td height=25>",
145+ "</td></tr>"
146+ };
147+
148+ final String bottonA, bottonB, bottonC;
149+ if (st.getInt("Pet-On-Off") == 1)
150+ {
151+ bottonA = "Auto Buff Pet";
152+ bottonB = "Heal My Pet";
153+ bottonC = "Remove Pet Buffs";
154+ 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\">";
155+ }
156+ else
157+ {
158+ bottonA = "Auto Buff";
159+ bottonB = "Heal";
160+ bottonC = "Remove Buffs";
161+ 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\">";
162+ }
163+
164+ if (ENABLE_BUFF_SECTION)
165+ {
166+ if (ENABLE_BUFFS)
167+ {
168+ if (td > 2)
169+ {
170+ td = 0;
171+ }
172+ 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];
173+ td += 2;
174+ }
175+ if (ENABLE_RESIST)
176+ {
177+ if (td > 2)
178+ {
179+ td = 0;
180+ }
181+ 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];
182+ td += 2;
183+ }
184+ if (ENABLE_SONGS)
185+ {
186+ if (td > 2)
187+ {
188+ td = 0;
189+ }
190+ 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];
191+ td += 2;
192+ }
193+ if (ENABLE_DANCES)
194+ {
195+ if (td > 2)
196+ {
197+ td = 0;
198+ }
199+ 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];
200+ td += 2;
201+ }
202+ if (ENABLE_CHANTS)
203+ {
204+ if (td > 2)
205+ {
206+ td = 0;
207+ }
208+ 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];
209+ td += 2;
210+ }
211+ if (ENABLE_SPECIAL)
212+ {
213+ if (td > 2)
214+ {
215+ td = 0;
216+ }
217+ 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];
218+ td += 2;
219+ }
220+ if (ENABLE_OTHERS)
221+ {
222+ if (td > 2)
223+ {
224+ td = 0;
225+ }
226+ 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];
227+ td += 2;
228+ }
229+ }
230+
231+ if (ENABLE_CUBIC)
232+ {
233+ if (td > 2)
234+ {
235+ td = 0;
236+ }
237+ 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];
238+ td += 2;
239+ }
240+
241+ if (MESSAGE.length() > 0)
242+ {
243+ 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>";
244+ MESSAGE = "";
245+ td = 0;
246+ }
247+
248+ if (ENABLE_BUFF_SET)
249+ {
250+ if (td > 2)
251+ {
252+ td = 0;
253+ }
254+ 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];
255+ td += 2;
256+ }
257+
258+ if (ENABLE_HEAL)
259+ {
260+ if (td > 2)
261+ {
262+ td = 0;
263+ }
264+ 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];
265+ td += 2;
266+ }
267+
268+ if (ENABLE_BUFF_REMOVE)
269+ {
270+ if (td > 2)
271+ {
272+ td = 0;
273+ }
274+ 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];
275+ td += 2;
276+ }
277+
278+ if (MESSAGE.length() > 0)
279+ {
280+ 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>";
281+ MESSAGE = "";
282+ td = 0;
283+ }
284+
285+ if (ENABLE_SCHEME_SYSTEM)
286+ {
287+ MAIN_HTML_MESSAGE += generateScheme(st);
288+ }
289+
290+ if (st.getPlayer().isGM())
291+ {
292+ 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\">";
293+ }
294+ MAIN_HTML_MESSAGE += "<br><font color=303030>" + TITLE_NAME + "</font>" + "</center></body></html>";
295+ return MAIN_HTML_MESSAGE;
296+ }
297+
298+ private String generateScheme(QuestState st)
299+ {
300+ List<String> schemeName = new ArrayList<>();
301+ List<String> schemeId = new ArrayList<>();
302+ String HTML = "";
303+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
304+ {
305+ PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
306+ rss.setInt(1, st.getPlayer().getObjectId());
307+ ResultSet action = rss.executeQuery();
308+ while (action.next())
309+ {
310+ schemeName.add(action.getString("scheme_name"));
311+ schemeId.add(action.getString("id"));
312+ }
313+ }
314+ catch (SQLException e)
315+ {
316+ print(e);
317+ }
318+ 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>";
319+ if (schemeName.size() > 0)
320+ {
321+ String MESSAGE = "";
322+ int td = 0;
323+ String[] TRS =
324+ {
325+ "<tr><td>",
326+ "</td>",
327+ "<td>",
328+ "</td></tr>"
329+ };
330+ for (int i = 0; i < schemeName.size(); ++i)
331+ {
332+ if (td > 2)
333+ {
334+ td = 0;
335+ }
336+ 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];
337+ td += 2;
338+ }
339+
340+ if (MESSAGE.length() > 0)
341+ {
342+ HTML += "<table>" + MESSAGE + "</table>";
343+ }
344+ }
345+
346+ if (schemeName.size() < SCHEMES_PER_PLAYER)
347+ {
348+ 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>";
349+ }
350+ else
351+ {
352+ HTML += "<BR1><table width=100><tr>";
353+ }
354+
355+ if (schemeName.size() > 0)
356+ {
357+ 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>";
358+ }
359+ else
360+ {
361+ HTML += "</tr></table>";
362+ }
363+ return HTML;
364+ }
365+
366+ private String reloadPanel(QuestState st)
367+ {
368+ 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>";
369+ }
370+
371+ private String getItemNameHtml(QuestState st, int itemval)
372+ {
373+ return "&#" + itemval + ";";
374+ }
375+
376+ private int getBuffCount(String scheme)
377+ {
378+ int count = 0;
379+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
380+ {
381+ PreparedStatement rss = con.prepareStatement("SELECT buff_class FROM npcbuffer_scheme_contents WHERE scheme_id=?");
382+ rss.setString(1, scheme);
383+ ResultSet action = rss.executeQuery();
384+ while (action.next())
385+ {
386+ ++count;
387+ }
388+ }
389+ catch (SQLException e)
390+ {
391+ print(e);
392+ }
393+ return count;
394+ }
395+
396+ private String getBuffType(int id)
397+ {
398+ String val = "none";
399+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
400+ {
401+ PreparedStatement act = con.prepareStatement("SELECT buffType FROM npcbuffer_buff_list WHERE buffId=? LIMIT 1");
402+ act.setInt(1, id);
403+ ResultSet rs = act.executeQuery();
404+ if (rs.next())
405+ {
406+ val = rs.getString("buffType");
407+ }
408+ }
409+ catch (SQLException e)
410+ {
411+ print(e);
412+ }
413+ return val;
414+ }
415+
416+ private boolean isEnabled(int id, int level)
417+ {
418+ boolean val = false;
419+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
420+ {
421+ PreparedStatement act = con.prepareStatement("SELECT canUse FROM npcbuffer_buff_list WHERE buffId=? AND buffLevel=? LIMIT 1");
422+ act.setInt(1, id);
423+ act.setInt(2, level);
424+ ResultSet rs = act.executeQuery();
425+ if (rs.next())
426+ {
427+ if ("1".equals(rs.getString("canUse")))
428+ {
429+ val = true;
430+ }
431+ }
432+ }
433+ catch (SQLException e)
434+ {
435+ print(e);
436+ }
437+ return val;
438+ }
439+
440+ private boolean isUsed(String scheme, int id, int level)
441+ {
442+ boolean used = false;
443+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
444+ {
445+ PreparedStatement rss = con.prepareStatement("SELECT id FROM npcbuffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1");
446+ rss.setString(1, scheme);
447+ rss.setInt(2, id);
448+ rss.setInt(3, level);
449+ ResultSet action = rss.executeQuery();
450+ if (action.next())
451+ {
452+ used = true;
453+ }
454+ }
455+ catch (SQLException e)
456+ {
457+ print(e);
458+ }
459+ return used;
460+ }
461+
462+ private int getClassBuff(String id)
463+ {
464+ int val = 0;
465+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
466+ {
467+ PreparedStatement getTipo = con.prepareStatement("SELECT buff_class FROM npcbuffer_buff_list WHERE buffId=?");
468+ getTipo.setString(1, id);
469+ ResultSet gt = getTipo.executeQuery();
470+ if (gt.next())
471+ {
472+ val = gt.getInt("buff_class");
473+ }
474+ }
475+ catch (SQLException e)
476+ {
477+ print(e);
478+ }
479+ return val;
480+ }
481+
482+ private String showText(QuestState st, String type, String text, boolean buttonEnabled, String buttonName, String location)
483+ {
484+ String MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
485+ MESSAGE += "<font color=LEVEL>" + type + "</font><br>" + text + "<br>";
486+ if (buttonEnabled)
487+ {
488+ 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\">";
489+ }
490+ MESSAGE += "<font color=303030>" + TITLE_NAME + "</font></center></body></html>";
491+ st.playSound("ItemSound3.sys_shortage");
492+ return MESSAGE;
493+ }
494+
495+ private String reloadConfig(QuestState st)
496+ {
497+ try
498+ {
499+ if (QuestManager.getInstance().reload(QUEST_LOADING_INFO))
500+ {
501+ st.getPlayer().sendMessage("The script and settings have been reloaded successfully.");
502+ }
503+ else
504+ {
505+ st.getPlayer().sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server");
506+ }
507+ }
508+ catch (Exception e)
509+ {
510+ st.getPlayer().sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server");
511+ print(e);
512+ }
513+ return rebuildMainHtml(st);
514+ }
515+
516+ private NpcBuffer()
517+ {
518+ super(-1, NpcBuffer.class.getSimpleName(), "custom");
519+ addStartNpc(NPC_ID);
520+ addFirstTalkId(NPC_ID);
521+ addTalkId(NPC_ID);
522+ }
523+
524+ private boolean isPetBuff(QuestState st)
525+ {
526+ return st.getInt("Pet-On-Off") != 0;
527+ }
528+
529+ private String createScheme()
530+ {
531+ 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>";
532+ }
533+
534+ private String deleteScheme(L2PcInstance player)
535+ {
536+ 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>";
537+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
538+ {
539+ PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
540+ rss.setInt(1, player.getObjectId());
541+ ResultSet action = rss.executeQuery();
542+ while (action.next())
543+ {
544+ 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\">";
545+ }
546+ }
547+ catch (SQLException e)
548+ {
549+ print(e);
550+ }
551+ 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>";
552+ return HTML;
553+ }
554+
555+ private String editScheme(L2PcInstance player)
556+ {
557+ 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>";
558+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
559+ {
560+ PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_list WHERE player_id=?");
561+ rss.setInt(1, player.getObjectId());
562+ ResultSet action = rss.executeQuery();
563+ while (action.next())
564+ {
565+ String name = action.getString("scheme_name");
566+ String id = action.getString("id");
567+ 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\">";
568+ }
569+ }
570+ catch (SQLException e)
571+ {
572+ print(e);
573+ }
574+ 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>";
575+ return HTML;
576+ }
577+
578+ private String getOptionList(String scheme)
579+ {
580+ int bcount = getBuffCount(scheme);
581+ 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>";
582+ if (bcount < (MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES))
583+ {
584+ 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\">";
585+ }
586+ if (bcount > 0)
587+ {
588+ 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\">";
589+ }
590+ 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>";
591+ return HTML;
592+ }
593+
594+ private String buildHtml(String buffType)
595+ {
596+ String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><br>";
597+
598+ List<String> availableBuffs = new ArrayList<>();
599+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
600+ {
601+ PreparedStatement getList = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE buffType=\"" + buffType + "\" AND canUse=1 ORDER BY Buff_Class ASC, id");
602+ ResultSet rs = getList.executeQuery();
603+ while (rs.next())
604+ {
605+ int bId = rs.getInt("buffId");
606+ int bLevel = rs.getInt("buffLevel");
607+ String bName = SkillData.getInstance().getSkill(bId, bLevel).getName();
608+ bName = bName.replace(" ", "+");
609+ availableBuffs.add(bName + "_" + bId + "_" + bLevel);
610+ }
611+ }
612+ catch (SQLException e)
613+ {
614+ print(e);
615+ }
616+
617+ if (availableBuffs.size() == 0)
618+ {
619+ HTML_MESSAGE += "No buffs are available at this moment!";
620+ }
621+ else
622+ {
623+ if (FREE_BUFFS)
624+ {
625+ HTML_MESSAGE += "All buffs are for <font color=LEVEL>free</font>!";
626+ }
627+ else
628+ {
629+ int price = 0;
630+ switch (buffType)
631+ {
632+ case "buff":
633+ price = BUFF_PRICE;
634+ break;
635+ case "resist":
636+ price = RESIST_PRICE;
637+ break;
638+ case "song":
639+ price = SONG_PRICE;
640+ break;
641+ case "dance":
642+ price = DANCE_PRICE;
643+ break;
644+ case "chant":
645+ price = CHANT_PRICE;
646+ break;
647+ case "others":
648+ price = OTHERS_PRICE;
649+ break;
650+ case "special":
651+ price = SPECIAL_PRICE;
652+ break;
653+ case "cubic":
654+ price = CUBIC_PRICE;
655+ break;
656+ default:
657+ if (DEBUG)
658+ {
659+ throw new RuntimeException();
660+ }
661+ }
662+ HTML_MESSAGE += "All special buffs cost <font color=LEVEL>" + formatAdena(price) + "</font> adena!";
663+ }
664+ HTML_MESSAGE += "<BR1><table>";
665+ for (String buff : availableBuffs)
666+ {
667+ buff = buff.replace("_", " ");
668+ String[] buffSplit = buff.split(" ");
669+ String name = buffSplit[0];
670+ int id = Integer.parseInt(buffSplit[1]);
671+ int level = Integer.parseInt(buffSplit[2]);
672+ name = name.replace("+", " ");
673+ 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>";
674+ }
675+ HTML_MESSAGE += "</table>";
676+ }
677+
678+ 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>";
679+ return HTML_MESSAGE;
680+ }
681+
682+ private String generateQuery(int case1, int case2)
683+ {
684+ StringBuilder qry = new StringBuilder();
685+ if (ENABLE_BUFFS)
686+ {
687+ if (case1 < MAX_SCHEME_BUFFS)
688+ {
689+ qry.append(",\"buff\"");
690+ }
691+ }
692+ if (ENABLE_RESIST)
693+ {
694+ if (case1 < MAX_SCHEME_BUFFS)
695+ {
696+ qry.append(",\"resist\"");
697+ }
698+ }
699+ if (ENABLE_SONGS)
700+ {
701+ if (case2 < MAX_SCHEME_DANCES)
702+ {
703+ qry.append(",\"song\"");
704+ }
705+ }
706+ if (ENABLE_DANCES)
707+ {
708+ if (case2 < MAX_SCHEME_DANCES)
709+ {
710+ qry.append(",\"dance\"");
711+ }
712+ }
713+ if (ENABLE_CHANTS)
714+ {
715+ if (case1 < MAX_SCHEME_BUFFS)
716+ {
717+ qry.append(",\"chant\"");
718+ }
719+ }
720+ if (ENABLE_OTHERS)
721+ {
722+ if (case1 < MAX_SCHEME_BUFFS)
723+ {
724+ qry.append(",\"others\"");
725+ }
726+ }
727+ if (ENABLE_SPECIAL)
728+ {
729+ if (case1 < MAX_SCHEME_BUFFS)
730+ {
731+ qry.append(",\"special\"");
732+ }
733+ }
734+ if (qry.length() > 0)
735+ {
736+ qry.deleteCharAt(0);
737+ }
738+ return qry.toString();
739+ }
740+
741+ private String viewAllSchemeBuffs$getBuffCount(String scheme)
742+ {
743+ int count = 0;
744+ int D_S_Count = 0;
745+ int B_Count = 0;
746+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
747+ {
748+ PreparedStatement rss = con.prepareStatement("SELECT buff_class FROM npcbuffer_scheme_contents WHERE scheme_id=?");
749+ rss.setString(1, scheme);
750+ ResultSet action = rss.executeQuery();
751+ while (action.next())
752+ {
753+ ++count;
754+ int val = action.getInt("buff_class");
755+ if ((val == 1) || (val == 2))
756+ {
757+ ++D_S_Count;
758+ }
759+ else
760+ {
761+ ++B_Count;
762+ }
763+ }
764+ }
765+ catch (SQLException e)
766+ {
767+ print(e);
768+ }
769+ String res = count + " " + B_Count + " " + D_S_Count;
770+ return res;
771+ }
772+
773+ private String viewAllSchemeBuffs(String scheme, String page, String action)
774+ {
775+ List<String> buffList = new ArrayList<>();
776+ String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><br>";
777+ String[] eventSplit = viewAllSchemeBuffs$getBuffCount(scheme).split(" ");
778+ int TOTAL_BUFF = Integer.parseInt(eventSplit[0]);
779+ int BUFF_COUNT = Integer.parseInt(eventSplit[1]);
780+ int DANCE_SONG = Integer.parseInt(eventSplit[2]);
781+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
782+ {
783+ if (action.equals("add"))
784+ {
785+ 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!";
786+ String QUERY = "SELECT * FROM npcbuffer_buff_list WHERE buffType IN (" + generateQuery(BUFF_COUNT, DANCE_SONG) + ") AND canUse=1 ORDER BY Buff_Class ASC, id";
787+ PreparedStatement getBuffCount = con.prepareStatement(QUERY);
788+ ResultSet rss = getBuffCount.executeQuery();
789+ while (rss.next())
790+ {
791+ String name = SkillData.getInstance().getSkill(rss.getInt("buffId"), rss.getInt("buffLevel")).getName();
792+ name = name.replace(" ", "+");
793+ buffList.add(name + "_" + rss.getInt("buffId") + "_" + rss.getInt("buffLevel"));
794+ }
795+ }
796+ else if (action.equals("remove"))
797+ {
798+ HTML_MESSAGE += "You have <font color=LEVEL>" + BUFF_COUNT + "</font> Buffs and <font color=LEVEL>" + DANCE_SONG + "</font> Dances";
799+ String QUERY = "SELECT * FROM npcbuffer_scheme_contents WHERE scheme_id=? ORDER BY Buff_Class ASC, id";
800+ PreparedStatement getBuffCount = con.prepareStatement(QUERY);
801+ getBuffCount.setString(1, scheme);
802+ ResultSet rss = getBuffCount.executeQuery();
803+ while (rss.next())
804+ {
805+ String name = SkillData.getInstance().getSkill(rss.getInt("skill_id"), rss.getInt("skill_level")).getName();
806+ name = name.replace(" ", "+");
807+ buffList.add(name + "_" + rss.getInt("skill_id") + "_" + rss.getInt("skill_level"));
808+ }
809+ }
810+ else if (DEBUG)
811+ {
812+ throw new RuntimeException();
813+ }
814+ }
815+ catch (SQLException e)
816+ {
817+ print(e);
818+ }
819+
820+ HTML_MESSAGE += "<BR1><table border=0><tr>";
821+ final int buffsPerPage = 20;
822+ final String width, pageName;
823+ int pc = ((buffList.size() - 1) / buffsPerPage) + 1;
824+ if (pc > 5)
825+ {
826+ width = "25";
827+ pageName = "P";
828+ }
829+ else
830+ {
831+ width = "50";
832+ pageName = "Page ";
833+ }
834+ for (int ii = 1; ii <= pc; ++ii)
835+ {
836+ if (ii == Integer.parseInt(page))
837+ {
838+ HTML_MESSAGE += "<td width=" + width + " align=center><font color=LEVEL>" + pageName + ii + "</font></td>";
839+ }
840+ else if (action.equals("add"))
841+ {
842+ 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>";
843+ }
844+ else if (action.equals("remove"))
845+ {
846+ 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>";
847+ }
848+ else if (DEBUG)
849+ {
850+ throw new RuntimeException();
851+ }
852+ }
853+ HTML_MESSAGE += "</tr></table>";
854+
855+ int limit = buffsPerPage * Integer.parseInt(page);
856+ int start = limit - buffsPerPage;
857+ int end = Math.min(limit, buffList.size());
858+ int k = 0;
859+ for (int i = start; i < end; ++i)
860+ {
861+ String value = buffList.get(i);
862+ value = value.replace("_", " ");
863+ String[] extr = value.split(" ");
864+ String name = extr[0];
865+ name = name.replace("+", " ");
866+ int id = Integer.parseInt(extr[1]);
867+ int level = Integer.parseInt(extr[2]);
868+ if (action.equals("add"))
869+ {
870+ if (!isUsed(scheme, id, level))
871+ {
872+ if ((k % 2) != 0)
873+ {
874+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
875+ }
876+ else
877+ {
878+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
879+ }
880+ 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>";
881+ k += 1;
882+ }
883+ }
884+ else if (action.equals("remove"))
885+ {
886+ if ((k % 2) != 0)
887+ {
888+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
889+ }
890+ else
891+ {
892+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
893+ }
894+ 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>";
895+ k += 1;
896+ }
897+ }
898+ 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>";
899+ return HTML_MESSAGE;
900+ }
901+
902+ private String viewAllBuffTypes()
903+ {
904+ String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
905+ HTML_MESSAGE += "<font color=LEVEL>[Buff management]</font><br>";
906+ if (ENABLE_BUFFS)
907+ {
908+ 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\">";
909+ }
910+ if (ENABLE_RESIST)
911+ {
912+ 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\">";
913+ }
914+ if (ENABLE_SONGS)
915+ {
916+ 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\">";
917+ }
918+ if (ENABLE_DANCES)
919+ {
920+ 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\">";
921+ }
922+ if (ENABLE_CHANTS)
923+ {
924+ 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\">";
925+ }
926+ if (ENABLE_SPECIAL)
927+ {
928+ 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\">";
929+ }
930+ if (ENABLE_OTHERS)
931+ {
932+ 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\">";
933+ }
934+ if (ENABLE_CUBIC)
935+ {
936+ 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\">";
937+ }
938+ if (ENABLE_BUFF_SET)
939+ {
940+ 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>";
941+ }
942+ 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>";
943+ return HTML_MESSAGE;
944+ }
945+
946+ private String viewAllBuffs(String type, String typeName, String page)
947+ {
948+ List<String> buffList = new ArrayList<>();
949+ String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>";
950+ typeName = typeName.replace("_", " ");
951+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
952+ {
953+ final PreparedStatement getBuffCount;
954+ if (type.equals("set"))
955+ {
956+ getBuffCount = con.prepareStatement("SELECT * FROM npcbuffer_buff_list WHERE buffType IN (" + generateQuery(0, 0) + ") AND canUse=1");
957+ }
958+ else
959+ {
960+ getBuffCount = con.prepareStatement("SELECT * FROM npcbuffer_buff_list WHERE buffType=?");
961+ getBuffCount.setString(1, type);
962+ }
963+ ResultSet rss = getBuffCount.executeQuery();
964+ while (rss.next())
965+ {
966+ String name = SkillData.getInstance().getSkill(rss.getInt("buffId"), rss.getInt("buffLevel")).getName();
967+ name = name.replace(" ", "+");
968+ String usable = rss.getString("canUse");
969+ String forClass = rss.getString("forClass");
970+ String skill_id = rss.getString("buffId");
971+ String skill_level = rss.getString("buffLevel");
972+ buffList.add(name + "_" + forClass + "_" + page + "_" + usable + "_" + skill_id + "_" + skill_level);
973+ }
974+ }
975+ catch (SQLException e)
976+ {
977+ print(e);
978+ }
979+ Collections.sort(buffList);
980+
981+ HTML_MESSAGE += "<font color=LEVEL>[Buff management - " + typeName + " - Page " + page + "]</font><br><table border=0><tr>";
982+ final int buffsPerPage;
983+ if (type.equals("set"))
984+ {
985+ buffsPerPage = 12;
986+ }
987+ else
988+ {
989+ buffsPerPage = 20;
990+ }
991+ final String width, pageName;
992+ int pc = ((buffList.size() - 1) / buffsPerPage) + 1;
993+ if (pc > 5)
994+ {
995+ width = "25";
996+ pageName = "P";
997+ }
998+ else
999+ {
1000+ width = "50";
1001+ pageName = "Page ";
1002+ }
1003+ typeName = typeName.replace(" ", "_");
1004+ for (int ii = 1; ii <= pc; ++ii)
1005+ {
1006+ if (ii == Integer.parseInt(page))
1007+ {
1008+ HTML_MESSAGE += "<td width=" + width + " align=center><font color=LEVEL>" + pageName + ii + "</font></td>";
1009+ }
1010+ else
1011+ {
1012+ 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>";
1013+ }
1014+ }
1015+ HTML_MESSAGE += "</tr></table><br>";
1016+
1017+ int limit = buffsPerPage * Integer.parseInt(page);
1018+ int start = limit - buffsPerPage;
1019+ int end = Math.min(limit, buffList.size());
1020+ for (int i = start; i < end; ++i)
1021+ {
1022+ String value = buffList.get(i);
1023+ value = value.replace("_", " ");
1024+ String[] extr = value.split(" ");
1025+ String name = extr[0];
1026+ name = name.replace("+", " ");
1027+ int forClass = Integer.parseInt(extr[1]);
1028+ int usable = Integer.parseInt(extr[3]);
1029+ String skillPos = extr[4] + "_" + extr[5];
1030+ if ((i % 2) != 0)
1031+ {
1032+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
1033+ }
1034+ else
1035+ {
1036+ HTML_MESSAGE += "<BR1><table border=0 bgcolor=292929>";
1037+ }
1038+ if (type.equals("set"))
1039+ {
1040+ String listOrder = null;
1041+ if (forClass == 0)
1042+ {
1043+ listOrder = "List=\"" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_ALL + ";" + SET_NONE + ";\"";
1044+ }
1045+ else if (forClass == 1)
1046+ {
1047+ listOrder = "List=\"" + SET_MAGE + ";" + SET_FIGHTER + ";" + SET_ALL + ";" + SET_NONE + ";\"";
1048+ }
1049+ else if (forClass == 2)
1050+ {
1051+ listOrder = "List=\"" + SET_ALL + ";" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_NONE + ";\"";
1052+ }
1053+ else if (forClass == 3)
1054+ {
1055+ listOrder = "List=\"" + SET_NONE + ";" + SET_FIGHTER + ";" + SET_MAGE + ";" + SET_ALL + ";\"";
1056+ }
1057+ 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>";
1058+ }
1059+ else
1060+ {
1061+ HTML_MESSAGE += "<tr><td fixwidth=170>" + name + "</td><td width=80>";
1062+ if (usable == 1)
1063+ {
1064+ 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>";
1065+ }
1066+ else if (usable == 0)
1067+ {
1068+ 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>";
1069+ }
1070+ }
1071+ HTML_MESSAGE += "</table>";
1072+ }
1073+ 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>";
1074+ return HTML_MESSAGE;
1075+ }
1076+
1077+ private void manageSelectedBuff(String buffPosId, String canUseBuff)
1078+ {
1079+ String[] bpid = buffPosId.split("_");
1080+ String bId = bpid[0];
1081+ String bLvl = bpid[1];
1082+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
1083+ {
1084+ PreparedStatement upd = con.prepareStatement("UPDATE npcbuffer_buff_list SET canUse=? WHERE buffId=? AND buffLevel=? LIMIT 1");
1085+ upd.setString(1, canUseBuff);
1086+ upd.setString(2, bId);
1087+ upd.setString(3, bLvl);
1088+ upd.executeUpdate();
1089+ upd.close();
1090+ }
1091+ catch (SQLException e)
1092+ {
1093+ print(e);
1094+ }
1095+ }
1096+
1097+ private String manageSelectedSet(String id, String newVal, String opt3)
1098+ {
1099+ String[] bpid = id.split("_");
1100+ String bId = bpid[0];
1101+ String bLvl = bpid[1];
1102+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
1103+ {
1104+ PreparedStatement upd = con.prepareStatement("UPDATE npcbuffer_buff_list SET forClass=? WHERE buffId=? AND bufflevel=?");
1105+ upd.setString(1, newVal);
1106+ upd.setString(2, bId);
1107+ upd.setString(3, bLvl);
1108+ upd.executeUpdate();
1109+ upd.close();
1110+ }
1111+ catch (SQLException e)
1112+ {
1113+ print(e);
1114+ }
1115+ return viewAllBuffs("set", "Buff Sets", opt3);
1116+ }
1117+
1118+ private void addTimeout(QuestState st, int gaugeColor, int amount, int offset)
1119+ {
1120+ int endtime = (int) ((System.currentTimeMillis() + (amount * 1000)) / 1000);
1121+ st.set("blockUntilTime", String.valueOf(endtime));
1122+ st.getPlayer().sendPacket(new SetupGauge(gaugeColor, (amount * 1000) + offset));
1123+ }
1124+
1125+ private void heal(L2PcInstance player, boolean isPet)
1126+ {
1127+ L2Summon target = player.getSummon();
1128+ if (!isPet)
1129+ {
1130+ PcStatus pcStatus = player.getStatus();
1131+ PcStat pcStat = player.getStat();
1132+ pcStatus.setCurrentHp(pcStat.getMaxHp());
1133+ pcStatus.setCurrentMp(pcStat.getMaxMp());
1134+ pcStatus.setCurrentCp(pcStat.getMaxCp());
1135+ }
1136+ else if (target != null)
1137+ {
1138+ SummonStatus petStatus = target.getStatus();
1139+ SummonStat petStat = target.getStat();
1140+ petStatus.setCurrentHp(petStat.getMaxHp());
1141+ petStatus.setCurrentMp(petStat.getMaxMp());
1142+ if (target instanceof L2PetInstance)
1143+ {
1144+ L2PetInstance pet = (L2PetInstance) target;
1145+ pet.setCurrentFed(pet.getMaxFed());
1146+ player.sendPacket(new SetSummonRemainTime(pet.getMaxFed(), pet.getCurrentFed()));
1147+ }
1148+ else if (target instanceof L2ServitorInstance)
1149+ {
1150+ L2ServitorInstance summon = (L2ServitorInstance) target;
1151+ // FIXME: summon.setLifeTimeRemaining(summon.getLifeTimeRemaining() - summon.getLifeTime());
1152+ summon.setLifeTimeRemaining(summon.getLifeTimeRemaining() + summon.getLifeTime());
1153+ player.sendPacket(new SetSummonRemainTime(summon.getLifeTime(), summon.getLifeTimeRemaining()));
1154+ }
1155+ else if (DEBUG)
1156+ {
1157+ throw new RuntimeException();
1158+ }
1159+ }
1160+ }
1161+
1162+ @Override
1163+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
1164+ {
1165+ if (DEBUG)
1166+ {
1167+ System.out.println(getScriptName() + "#onAdvEvent('" + event + "'," + (npc == null ? "NULL" : npc.getId() + npc.getName()) + "," + (player == null ? "NULL" : player.getName()) + ")");
1168+ }
1169+ QuestState st = player.getQuestState(QUEST_LOADING_INFO);
1170+ String[] eventSplit = event.split(" ", 4);
1171+ if (eventSplit.length != 4)
1172+ {
1173+ player.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN);
1174+ return null;
1175+ }
1176+ String eventParam0 = eventSplit[0];
1177+ String eventParam1 = eventSplit[1];
1178+ String eventParam2 = eventSplit[2];
1179+ String eventParam3 = eventSplit[3];
1180+
1181+ switch (eventParam0)
1182+ {
1183+ case "reloadscript":
1184+ if (eventParam1.equals("1"))
1185+ {
1186+ return reloadConfig(st);
1187+ }
1188+ if (eventParam1.equals("0"))
1189+ {
1190+ return rebuildMainHtml(st);
1191+ }
1192+ if (DEBUG)
1193+ {
1194+ throw new RuntimeException();
1195+ }
1196+
1197+ case "redirect":
1198+ switch (eventParam1)
1199+ {
1200+ case "main":
1201+ return rebuildMainHtml(st);
1202+ case "manage_buffs":
1203+ return viewAllBuffTypes();
1204+ case "view_buffs":
1205+ return buildHtml("buff");
1206+ case "view_resists":
1207+ return buildHtml("resist");
1208+ case "view_songs":
1209+ return buildHtml("song");
1210+ case "view_dances":
1211+ return buildHtml("dance");
1212+ case "view_chants":
1213+ return buildHtml("chant");
1214+ case "view_others":
1215+ return buildHtml("others");
1216+ case "view_special":
1217+ return buildHtml("special");
1218+ case "view_cubic":
1219+ return buildHtml("cubic");
1220+ default:
1221+ if (DEBUG)
1222+ {
1223+ throw new RuntimeException();
1224+ }
1225+ }
1226+
1227+ case "buffpet":
1228+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
1229+ {
1230+ st.set("Pet-On-Off", eventParam1);
1231+ if (TIME_OUT)
1232+ {
1233+ addTimeout(st, 3, TIME_OUT_TIME / 2, 600);
1234+ }
1235+ }
1236+ return rebuildMainHtml(st);
1237+
1238+ case "create":
1239+ {
1240+ String param = eventParam1.replaceAll("[ !" + "\"" + "#$%&'()*+,/:;<=>?@" + "\\[" + "\\\\" + "\\]" + "\\^" + "`{|}~]", "");
1241+ if ((param.length() == 0) || param.equals("no_name"))
1242+ {
1243+ player.sendPacket(SystemMessageId.INCORRECT_NAME_TRY_AGAIN);
1244+ return showText(st, "Info", "Please, enter the scheme name!", true, "Return", "main");
1245+ }
1246+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
1247+ {
1248+ PreparedStatement ins = con.prepareStatement("INSERT INTO npcbuffer_scheme_list (player_id,scheme_name) VALUES (?,?)");
1249+ ins.setInt(1, player.getObjectId());
1250+ ins.setString(2, param);
1251+ ins.executeUpdate();
1252+ ins.close();
1253+ }
1254+ catch (SQLException e)
1255+ {
1256+ print(e);
1257+ }
1258+ return rebuildMainHtml(st);
1259+ }
1260+
1261+ case "delete":
1262+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
1263+ {
1264+ PreparedStatement rem;
1265+ rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_list WHERE id=? LIMIT 1");
1266+ rem.setString(1, eventParam1);
1267+ rem.executeUpdate();
1268+ rem.close();
1269+ rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_contents WHERE scheme_id=?");
1270+ rem.setString(1, eventParam1);
1271+ rem.executeUpdate();
1272+ rem.close();
1273+ }
1274+ catch (SQLException e)
1275+ {
1276+ print(e);
1277+ }
1278+ return rebuildMainHtml(st);
1279+
1280+ case "delete_c":
1281+ 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>";
1282+
1283+ case "create_1":
1284+ return createScheme();
1285+ case "edit_1":
1286+ return editScheme(player);
1287+ case "delete_1":
1288+ return deleteScheme(player);
1289+ case "manage_scheme_1":
1290+ return viewAllSchemeBuffs(eventParam1, eventParam2, "add");
1291+ case "manage_scheme_2":
1292+ return viewAllSchemeBuffs(eventParam1, eventParam2, "remove");
1293+ case "manage_scheme_select":
1294+ return getOptionList(eventParam1);
1295+
1296+ case "remove_buff":
1297+ {
1298+ String[] split = eventParam1.split("_");
1299+ String scheme = split[0];
1300+ String skill = split[1];
1301+ String level = split[2];
1302+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
1303+ {
1304+ PreparedStatement rem = con.prepareStatement("DELETE FROM npcbuffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1");
1305+ rem.setString(1, scheme);
1306+ rem.setString(2, skill);
1307+ rem.setString(3, level);
1308+ rem.executeUpdate();
1309+ }
1310+ catch (SQLException e)
1311+ {
1312+ print(e);
1313+ }
1314+ int temp = Integer.parseInt(eventParam3) - 1;
1315+ final String HTML;
1316+ if (temp <= 0)
1317+ {
1318+ HTML = getOptionList(scheme);
1319+ }
1320+ else
1321+ {
1322+ HTML = viewAllSchemeBuffs(scheme, eventParam2, "remove");
1323+ }
1324+ return HTML;
1325+ }
1326+
1327+ case "add_buff":
1328+ {
1329+ String[] split = eventParam1.split("_");
1330+ String scheme = split[0];
1331+ String skill = split[1];
1332+ String level = split[2];
1333+ int idbuffclass = getClassBuff(skill);
1334+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
1335+ {
1336+ PreparedStatement ins = con.prepareStatement("INSERT INTO npcbuffer_scheme_contents (scheme_id,skill_id,skill_level,buff_class) VALUES (?,?,?,?)");
1337+ ins.setString(1, scheme);
1338+ ins.setString(2, skill);
1339+ ins.setString(3, level);
1340+ ins.setInt(4, idbuffclass);
1341+ ins.executeUpdate();
1342+ ins.close();
1343+ }
1344+ catch (SQLException e)
1345+ {
1346+ print(e);
1347+ }
1348+ int temp = Integer.parseInt(eventParam3) + 1;
1349+ final String HTML;
1350+ if (temp >= (MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES))
1351+ {
1352+ HTML = getOptionList(scheme);
1353+ }
1354+ else
1355+ {
1356+ HTML = viewAllSchemeBuffs(scheme, eventParam2, "add");
1357+ }
1358+ return HTML;
1359+ }
1360+
1361+ case "edit_buff_list":
1362+ return viewAllBuffs(eventParam1, eventParam2, eventParam3);
1363+
1364+ case "changeBuffSet":
1365+ if (eventParam2.equals(SET_FIGHTER))
1366+ {
1367+ eventParam2 = "0";
1368+ }
1369+ else if (eventParam2.equals(SET_MAGE))
1370+ {
1371+ eventParam2 = "1";
1372+ }
1373+ else if (eventParam2.equals(SET_ALL))
1374+ {
1375+ eventParam2 = "2";
1376+ }
1377+ else if (eventParam2.equals(SET_NONE))
1378+ {
1379+ eventParam2 = "3";
1380+ }
1381+ else if (DEBUG)
1382+ {
1383+ throw new RuntimeException();
1384+ }
1385+ return manageSelectedSet(eventParam1, eventParam2, eventParam3);
1386+
1387+ case "editSelectedBuff":
1388+ {
1389+ eventParam2 = eventParam2.replace("-", " ");
1390+ String[] split = eventParam2.split(" ");
1391+ String action = split[0];
1392+ String page = split[1];
1393+ manageSelectedBuff(eventParam1, action);
1394+ final String typeName;
1395+ switch (eventParam3)
1396+ {
1397+ case "buff":
1398+ typeName = "Buffs";
1399+ break;
1400+ case "resist":
1401+ typeName = "Resists";
1402+ break;
1403+ case "song":
1404+ typeName = "Songs";
1405+ break;
1406+ case "dance":
1407+ typeName = "Dances";
1408+ break;
1409+ case "chant":
1410+ typeName = "Chants";
1411+ break;
1412+ case "others":
1413+ typeName = "Others_Buffs";
1414+ break;
1415+ case "special":
1416+ typeName = "Special_Buffs";
1417+ break;
1418+ case "cubic":
1419+ typeName = "Cubics";
1420+ break;
1421+ default:
1422+ throw new RuntimeException();
1423+ }
1424+ return viewAllBuffs(eventParam3, typeName, page);
1425+ }
1426+
1427+ case "viewSelectedConfig":
1428+ throw new RuntimeException();
1429+
1430+ case "changeConfig":
1431+ throw new RuntimeException();
1432+
1433+ case "heal":
1434+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
1435+ {
1436+ if (player.isInCombat() && !ENABLE_HEAL_IN_COMBAT)
1437+ {
1438+ return showText(st, "Info", "You can't use the heal function while in combat.", false, "Return", "main");
1439+ }
1440+
1441+ if (st.getQuestItemsCount(CONSUMABLE_ID) < HEAL_PRICE)
1442+ {
1443+ 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");
1444+ }
1445+ final boolean getSummonbuff = isPetBuff(st);
1446+ if (getSummonbuff)
1447+ {
1448+ if (player.getSummon() != null)
1449+ {
1450+ heal(player, getSummonbuff);
1451+ }
1452+ else
1453+ {
1454+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
1455+ }
1456+ }
1457+ else
1458+ {
1459+ heal(player, getSummonbuff);
1460+ }
1461+ st.takeItems(CONSUMABLE_ID, HEAL_PRICE);
1462+ if (TIME_OUT)
1463+ {
1464+ addTimeout(st, 1, TIME_OUT_TIME / 2, 600);
1465+ }
1466+ }
1467+ return SMART_WINDOW ? null : rebuildMainHtml(st);
1468+
1469+ case "removeBuffs":
1470+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
1471+ {
1472+ if (st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_REMOVE_PRICE)
1473+ {
1474+ 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");
1475+ }
1476+ final boolean getSummonbuff = isPetBuff(st);
1477+ if (getSummonbuff)
1478+ {
1479+ if (player.getSummon() != null)
1480+ {
1481+ player.getSummon().stopAllEffects();
1482+ }
1483+ else
1484+ {
1485+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
1486+ }
1487+ }
1488+ else
1489+ {
1490+ player.stopAllEffects();
1491+ if (player.getCubics() != null)
1492+ {
1493+ for (L2CubicInstance cubic : player.getCubics().values())
1494+ {
1495+ cubic.stopAction();
1496+ player.getCubics().remove(cubic);
1497+ }
1498+ }
1499+ }
1500+ st.takeItems(CONSUMABLE_ID, BUFF_REMOVE_PRICE);
1501+ if (TIME_OUT)
1502+ {
1503+ addTimeout(st, 2, TIME_OUT_TIME / 2, 600);
1504+ }
1505+ }
1506+ return SMART_WINDOW ? null : rebuildMainHtml(st);
1507+
1508+ case "cast":
1509+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
1510+ {
1511+ List<Integer> buffs = new ArrayList<>();
1512+ List<Integer> levels = new ArrayList<>();
1513+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
1514+ {
1515+ PreparedStatement rss = con.prepareStatement("SELECT * FROM npcbuffer_scheme_contents WHERE scheme_id=? ORDER BY id");
1516+ rss.setString(1, eventParam1);
1517+ ResultSet action = rss.executeQuery();
1518+ while (action.next())
1519+ {
1520+ int id = Integer.parseInt(action.getString("skill_id"));
1521+ int level = Integer.parseInt(action.getString("skill_level"));
1522+ switch (getBuffType(id))
1523+ {
1524+ case "buff":
1525+ if (ENABLE_BUFFS)
1526+ {
1527+ if (isEnabled(id, level))
1528+ {
1529+ buffs.add(id);
1530+ levels.add(level);
1531+ }
1532+ }
1533+ break;
1534+ case "resist":
1535+ if (ENABLE_RESIST)
1536+ {
1537+ if (isEnabled(id, level))
1538+ {
1539+ buffs.add(id);
1540+ levels.add(level);
1541+ }
1542+ }
1543+ break;
1544+ case "song":
1545+ if (ENABLE_SONGS)
1546+ {
1547+ if (isEnabled(id, level))
1548+ {
1549+ buffs.add(id);
1550+ levels.add(level);
1551+ }
1552+ }
1553+ break;
1554+ case "dance":
1555+ if (ENABLE_DANCES)
1556+ {
1557+ if (isEnabled(id, level))
1558+ {
1559+ buffs.add(id);
1560+ levels.add(level);
1561+ }
1562+ }
1563+ break;
1564+ case "chant":
1565+ if (ENABLE_CHANTS)
1566+ {
1567+ if (isEnabled(id, level))
1568+ {
1569+ buffs.add(id);
1570+ levels.add(level);
1571+ }
1572+ }
1573+ break;
1574+ case "others":
1575+ if (ENABLE_OTHERS)
1576+ {
1577+ if (isEnabled(id, level))
1578+ {
1579+ buffs.add(id);
1580+ levels.add(level);
1581+ }
1582+ }
1583+ break;
1584+ case "special":
1585+ if (ENABLE_SPECIAL)
1586+ {
1587+ if (isEnabled(id, level))
1588+ {
1589+ buffs.add(id);
1590+ levels.add(level);
1591+ }
1592+ }
1593+ break;
1594+ default:
1595+ if (DEBUG)
1596+ {
1597+ throw new RuntimeException();
1598+ }
1599+ }
1600+ }
1601+ }
1602+ catch (SQLException e)
1603+ {
1604+ print(e);
1605+ }
1606+
1607+ if (buffs.size() == 0)
1608+ {
1609+ return viewAllSchemeBuffs(eventParam1, "1", "add");
1610+ }
1611+ if (!FREE_BUFFS)
1612+ {
1613+ if (st.getQuestItemsCount(CONSUMABLE_ID) < SCHEME_BUFF_PRICE)
1614+ {
1615+ 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");
1616+ }
1617+ }
1618+
1619+ final boolean getSummonbuff = isPetBuff(st);
1620+ for (int i = 0; i < buffs.size(); ++i)
1621+ {
1622+ if (!getSummonbuff)
1623+ {
1624+ npc.broadcastPacket(new MagicSkillUse(npc, player, buffs.get(i), 1, 1, 1));
1625+ SkillData.getInstance().getSkill(buffs.get(i), levels.get(i)).applyEffects(player, player);
1626+ }
1627+ else
1628+ {
1629+ if (player.getSummon() != null)
1630+ {
1631+ npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), buffs.get(i), 1, 1, 1));
1632+ SkillData.getInstance().getSkill(buffs.get(i), levels.get(i)).applyEffects(player.getSummon(), player.getSummon());
1633+ }
1634+ else
1635+ {
1636+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
1637+ }
1638+ }
1639+ }
1640+ st.takeItems(CONSUMABLE_ID, SCHEME_BUFF_PRICE);
1641+ if (TIME_OUT)
1642+ {
1643+ addTimeout(st, 3, TIME_OUT_TIME, 600);
1644+ }
1645+ }
1646+ return SMART_WINDOW ? null : rebuildMainHtml(st);
1647+
1648+ case "giveBuffs":
1649+ {
1650+ final int cost;
1651+ switch (eventParam3)
1652+ {
1653+ case "buff":
1654+ cost = BUFF_PRICE;
1655+ break;
1656+ case "resist":
1657+ cost = RESIST_PRICE;
1658+ break;
1659+ case "song":
1660+ cost = SONG_PRICE;
1661+ break;
1662+ case "dance":
1663+ cost = DANCE_PRICE;
1664+ break;
1665+ case "chant":
1666+ cost = CHANT_PRICE;
1667+ break;
1668+ case "others":
1669+ cost = OTHERS_PRICE;
1670+ break;
1671+ case "special":
1672+ cost = SPECIAL_PRICE;
1673+ break;
1674+ case "cubic":
1675+ cost = CUBIC_PRICE;
1676+ break;
1677+ default:
1678+ throw new RuntimeException();
1679+ }
1680+
1681+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
1682+ {
1683+ if (!FREE_BUFFS)
1684+ {
1685+ if (st.getQuestItemsCount(CONSUMABLE_ID) < cost)
1686+ {
1687+ 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");
1688+ }
1689+ }
1690+ Skill skill = SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2));
1691+ if (skill.hasEffectType(L2EffectType.SUMMON))
1692+ {
1693+ if (st.getQuestItemsCount(skill.getItemConsumeId()) < skill.getItemConsume())
1694+ {
1695+ 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");
1696+ }
1697+ }
1698+ final boolean getSummonbuff = isPetBuff(st);
1699+ if (!getSummonbuff)
1700+ {
1701+ if (eventParam3.equals("cubic"))
1702+ {
1703+ if (player.getCubics() != null)
1704+ {
1705+ for (L2CubicInstance cubic : player.getCubics().values())
1706+ {
1707+ cubic.stopAction();
1708+ player.getCubics().remove(cubic);
1709+ }
1710+ }
1711+ npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
1712+ player.useMagic(SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)), false, false);
1713+ }
1714+ else
1715+ {
1716+ npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
1717+ SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)).applyEffects(player, player);
1718+ }
1719+ }
1720+ else
1721+ {
1722+ if (eventParam3.equals("cubic"))
1723+ {
1724+ if (player.getCubics() != null)
1725+ {
1726+ for (L2CubicInstance cubic : player.getCubics().values())
1727+ {
1728+ cubic.stopAction();
1729+ player.getCubics().remove(cubic);
1730+ }
1731+ }
1732+ npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1, 1));
1733+ player.useMagic(SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)), false, false);
1734+ }
1735+ else
1736+ {
1737+ if (player.getSummon() != null)
1738+ {
1739+ npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), Integer.parseInt(eventParam1), 1, 1, 1));
1740+ SkillData.getInstance().getSkill(Integer.parseInt(eventParam1), Integer.parseInt(eventParam2)).applyEffects(player.getSummon(), player.getSummon());
1741+ }
1742+ else
1743+ {
1744+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
1745+ }
1746+ }
1747+ }
1748+ st.takeItems(CONSUMABLE_ID, cost);
1749+ if (TIME_OUT)
1750+ {
1751+ addTimeout(st, 3, TIME_OUT_TIME / 10, 600);
1752+ }
1753+ }
1754+ return SMART_WINDOW ? null : buildHtml(eventParam3);
1755+ }
1756+
1757+ case "castBuffSet":
1758+ if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
1759+ {
1760+ if (!FREE_BUFFS)
1761+ {
1762+ if (st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_SET_PRICE)
1763+ {
1764+ 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");
1765+ }
1766+ }
1767+ List<int[]> buff_sets = new ArrayList<>();
1768+ final int player_class;
1769+ if (player.isMageClass())
1770+ {
1771+ player_class = 1;
1772+ }
1773+ else
1774+ {
1775+ player_class = 0;
1776+ }
1777+ final boolean getSummonbuff = isPetBuff(st);
1778+ if (!getSummonbuff)
1779+ {
1780+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
1781+ {
1782+ PreparedStatement getSimilarNameCount = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC");
1783+ getSimilarNameCount.setInt(1, player_class);
1784+ getSimilarNameCount.setString(2, "2");
1785+ ResultSet rss = getSimilarNameCount.executeQuery();
1786+ while (rss.next())
1787+ {
1788+ int id = rss.getInt("buffId");
1789+ int lvl = rss.getInt("buffLevel");
1790+ buff_sets.add(new int[]
1791+ {
1792+ id,
1793+ lvl
1794+ });
1795+ }
1796+ }
1797+ catch (SQLException e)
1798+ {
1799+ print(e);
1800+ }
1801+ for (int[] i : buff_sets)
1802+ {
1803+ npc.broadcastPacket(new MagicSkillUse(npc, player, i[0], 1, 1, 1));
1804+ SkillData.getInstance().getSkill(i[0], i[1]).applyEffects(player, player);
1805+ }
1806+ }
1807+ else
1808+ {
1809+ if (player.getSummon() != null)
1810+ {
1811+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
1812+ {
1813+ PreparedStatement getSimilarNameCount = con.prepareStatement("SELECT buffId,buffLevel FROM npcbuffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC");
1814+ getSimilarNameCount.setString(1, "0");
1815+ getSimilarNameCount.setString(2, "2");
1816+ ResultSet rss = getSimilarNameCount.executeQuery();
1817+ while (rss.next())
1818+ {
1819+ int id = rss.getInt("buffId");
1820+ int lvl = rss.getInt("buffLevel");
1821+ buff_sets.add(new int[]
1822+ {
1823+ id,
1824+ lvl
1825+ });
1826+ }
1827+ }
1828+ catch (SQLException e)
1829+ {
1830+ print(e);
1831+ }
1832+ for (int[] i : buff_sets)
1833+ {
1834+ npc.broadcastPacket(new MagicSkillUse(npc, player.getSummon(), i[0], 1, 1, 1));
1835+ SkillData.getInstance().getSkill(i[0], i[1]).applyEffects(player.getSummon(), player.getSummon());
1836+ }
1837+ }
1838+ else
1839+ {
1840+ return showText(st, "Info", "You can't use the Pet's options.<br>Summon your pet first!", false, "Return", "main");
1841+ }
1842+ }
1843+ st.takeItems(CONSUMABLE_ID, BUFF_SET_PRICE);
1844+ if (TIME_OUT)
1845+ {
1846+ addTimeout(st, 3, TIME_OUT_TIME, 600);
1847+ }
1848+ }
1849+ return SMART_WINDOW ? null : rebuildMainHtml(st);
1850+
1851+ }
1852+ return rebuildMainHtml(st);
1853+ }
1854+
1855+ @SuppressWarnings("unused")
1856+ @Override
1857+ public String onFirstTalk(L2Npc npc, L2PcInstance player)
1858+ {
1859+ QuestState st = player.getQuestState(QUEST_LOADING_INFO);
1860+ if (st == null)
1861+ {
1862+ st = newQuestState(player);
1863+ }
1864+ if (player.isGM())
1865+ {
1866+ if (SCRIPT_RELOAD)
1867+ {
1868+ return reloadPanel(st);
1869+ }
1870+ return rebuildMainHtml(st);
1871+ }
1872+ else if ((int) (System.currentTimeMillis() / 1000) > st.getInt("blockUntilTime"))
1873+ {
1874+ return showText(st, "Sorry", "You have to wait a while!<br>if you wish to use my services!", false, "Return", "main");
1875+ }
1876+ if (!BUFF_WITH_KARMA && (player.getKarma() > 0))
1877+ {
1878+ 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");
1879+ }
1880+ else if (OlympiadManager.getInstance().isRegistered(player))
1881+ {
1882+ 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");
1883+ }
1884+ else if (TvTEvent.isPlayerParticipant(player.getObjectId()))
1885+ {
1886+ 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");
1887+ }
1888+ else if (player.getLevel() < MIN_LEVEL)
1889+ {
1890+ 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");
1891+ }
1892+ else if (player.getPvpFlag() > 0)
1893+ {
1894+ 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");
1895+ }
1896+ else if (player.isInCombat())
1897+ {
1898+ return showText(st, "Info", "You can't buff while you are attacking!<br>Stop your fight and try again!", false, "Return", "main");
1899+ }
1900+ else
1901+ {
1902+ return rebuildMainHtml(st);
1903+ }
1904+ }
1905+
1906+ @Override
1907+ public boolean showResult(L2PcInstance player, String res)
1908+ {
1909+ if (SMART_WINDOW)
1910+ {
1911+ if ((player != null) && (res != null) && res.startsWith("<html>"))
1912+ {
1913+ final NpcHtmlMessage npcReply = new NpcHtmlMessage();
1914+ npcReply.setHtml(res);
1915+ player.sendPacket(npcReply);
1916+ player.sendPacket(ActionFailed.STATIC_PACKET);
1917+ return false;
1918+ }
1919+ }
1920+ return super.showResult(player, res);
1921+ }
1922+
1923+ private String getSkillIconHtml(int id, int level)
1924+ {
1925+ String iconNumber = getSkillIconNumber(id, level);
1926+ 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 + "\">";
1927+ }
1928+
1929+ private String getSkillIconNumber(int id, int level)
1930+ {
1931+ String formato;
1932+ if (id == 4)
1933+ {
1934+ formato = "0004";
1935+ }
1936+ else if ((id > 9) && (id < 100))
1937+ {
1938+ formato = "00" + id;
1939+ }
1940+ else if ((id > 99) && (id < 1000))
1941+ {
1942+ formato = "0" + id;
1943+ }
1944+ else if (id == 1517)
1945+ {
1946+ formato = "1536";
1947+ }
1948+ else if (id == 1518)
1949+ {
1950+ formato = "1537";
1951+ }
1952+ else if (id == 1547)
1953+ {
1954+ formato = "0065";
1955+ }
1956+ else if (id == 2076)
1957+ {
1958+ formato = "0195";
1959+ }
1960+ else if ((id > 4550) && (id < 4555))
1961+ {
1962+ formato = "5739";
1963+ }
1964+ else if ((id > 4698) && (id < 4701))
1965+ {
1966+ formato = "1331";
1967+ }
1968+ else if ((id > 4701) && (id < 4704))
1969+ {
1970+ formato = "1332";
1971+ }
1972+ else if (id == 6049)
1973+ {
1974+ formato = "0094";
1975+ }
1976+ else
1977+ {
1978+ formato = String.valueOf(id);
1979+ }
1980+ return formato;
1981+ }
1982+
1983+ static public void main(String[] args)
1984+ {
1985+ new NpcBuffer();
1986+ }
1987+}
1988\ No newline at end of file
1989Index: dist/game/data/stats/npcs/custom/custom.xml
1990===================================================================
1991--- dist/game/data/stats/npcs/custom/custom.xml (revision 10413)
1992+++ dist/game/data/stats/npcs/custom/custom.xml (working copy)
1993@@ -58,4 +58,10 @@
1994 <height normal="22.25" />
1995 </collision>
1996 </npc>
1997+ <npc id="12" displayId="32226" name="Rin4a" usingServerSideName="true" title="NPC Buffer" usingServerSideTitle="true" type="L2NpcBuffer">
1998+ <collision>
1999+ <radius normal="11" />
2000+ <height normal="22.25" />
2001+ </collision>
2002+ </npc>
2003 </list>
2004\ No newline at end of file
2005Index: dist/sql/game/scheme_npcbuffer.sql
2006===================================================================
2007--- dist/sql/game/scheme_npcbuffer.sql (revision 0)
2008+++ dist/sql/game/scheme_npcbuffer.sql (working copy)
2009@@ -0,0 +1,182 @@
2010+DROP TABLE IF EXISTS `npcbuffer_buff_list`;
2011+DROP TABLE IF EXISTS `npcbuffer_scheme_contents`;
2012+DROP TABLE IF EXISTS `npcbuffer_scheme_list`;
2013+
2014+CREATE TABLE `npcbuffer_buff_list` (
2015+ `id` int(11) NOT NULL AUTO_INCREMENT,
2016+ `buff_class` int(2) DEFAULT NULL,
2017+ `buffType` varchar(10) DEFAULT NULL,
2018+ `buffId` int(5) DEFAULT '0',
2019+ `buffLevel` int(5) DEFAULT NULL,
2020+ `forClass` tinyint(1) DEFAULT NULL,
2021+ `canUse` tinyint(1) DEFAULT NULL,
2022+ PRIMARY KEY (`id`)
2023+) AUTO_INCREMENT=136;
2024+CREATE TABLE `npcbuffer_scheme_contents` (
2025+ `id` int(11) NOT NULL AUTO_INCREMENT,
2026+ `scheme_id` int(11) DEFAULT NULL,
2027+ `skill_id` int(8) DEFAULT NULL,
2028+ `skill_level` int(4) DEFAULT NULL,
2029+ `buff_class` int(2) DEFAULT NULL,
2030+ PRIMARY KEY (`id`)
2031+) AUTO_INCREMENT=30;
2032+CREATE TABLE `npcbuffer_scheme_list` (
2033+ `id` int(11) NOT NULL AUTO_INCREMENT,
2034+ `player_id` varchar(40) DEFAULT NULL,
2035+ `scheme_name` varchar(36) DEFAULT NULL,
2036+ `mod_accepted` tinyint(1) DEFAULT NULL,
2037+ PRIMARY KEY (`id`)
2038+) AUTO_INCREMENT=7;
2039+
2040+INSERT INTO `npcbuffer_buff_list` VALUES ('1', '0', 'buff', '1036', '2', '2', '1');
2041+INSERT INTO `npcbuffer_buff_list` VALUES ('2', '0', 'buff', '1040', '3', '2', '1');
2042+INSERT INTO `npcbuffer_buff_list` VALUES ('3', '0', 'buff', '1043', '1', '3', '1');
2043+INSERT INTO `npcbuffer_buff_list` VALUES ('4', '0', 'buff', '1044', '3', '3', '1');
2044+INSERT INTO `npcbuffer_buff_list` VALUES ('5', '0', 'buff', '1045', '6', '2', '1');
2045+INSERT INTO `npcbuffer_buff_list` VALUES ('6', '0', 'buff', '1047', '4', '3', '1');
2046+INSERT INTO `npcbuffer_buff_list` VALUES ('7', '0', 'buff', '1048', '6', '2', '1');
2047+INSERT INTO `npcbuffer_buff_list` VALUES ('8', '0', 'buff', '1059', '3', '1', '1');
2048+INSERT INTO `npcbuffer_buff_list` VALUES ('9', '0', 'buff', '1068', '3', '0', '1');
2049+INSERT INTO `npcbuffer_buff_list` VALUES ('10', '0', 'buff', '1077', '3', '0', '1');
2050+INSERT INTO `npcbuffer_buff_list` VALUES ('11', '0', 'buff', '1085', '3', '1', '1');
2051+INSERT INTO `npcbuffer_buff_list` VALUES ('12', '0', 'buff', '1086', '2', '0', '1');
2052+INSERT INTO `npcbuffer_buff_list` VALUES ('13', '0', 'buff', '1087', '3', '3', '1');
2053+INSERT INTO `npcbuffer_buff_list` VALUES ('14', '0', 'buff', '1204', '2', '2', '1');
2054+INSERT INTO `npcbuffer_buff_list` VALUES ('15', '0', 'buff', '1240', '3', '0', '1');
2055+INSERT INTO `npcbuffer_buff_list` VALUES ('16', '0', 'buff', '1242', '3', '0', '1');
2056+INSERT INTO `npcbuffer_buff_list` VALUES ('17', '0', 'buff', '1243', '6', '3', '1');
2057+INSERT INTO `npcbuffer_buff_list` VALUES ('18', '0', 'buff', '1257', '3', '3', '1');
2058+INSERT INTO `npcbuffer_buff_list` VALUES ('19', '0', 'buff', '1268', '4', '3', '1');
2059+INSERT INTO `npcbuffer_buff_list` VALUES ('20', '0', 'buff', '1303', '2', '1', '1');
2060+INSERT INTO `npcbuffer_buff_list` VALUES ('21', '0', 'buff', '1304', '3', '3', '1');
2061+INSERT INTO `npcbuffer_buff_list` VALUES ('22', '0', 'buff', '1307', '3', '3', '1');
2062+INSERT INTO `npcbuffer_buff_list` VALUES ('23', '0', 'buff', '1311', '6', '3', '1');
2063+INSERT INTO `npcbuffer_buff_list` VALUES ('24', '0', 'buff', '1397', '3', '3', '1');
2064+INSERT INTO `npcbuffer_buff_list` VALUES ('25', '0', 'buff', '1460', '1', '3', '1');
2065+INSERT INTO `npcbuffer_buff_list` VALUES ('26', '0', 'buff', '1232', '3', '3', '1');
2066+INSERT INTO `npcbuffer_buff_list` VALUES ('27', '0', 'buff', '1238', '3', '3', '0');
2067+INSERT INTO `npcbuffer_buff_list` VALUES ('28', '0', 'special', '1323', '1', '3', '1');
2068+INSERT INTO `npcbuffer_buff_list` VALUES ('29', '0', 'special', '1388', '3', '0', '1');
2069+INSERT INTO `npcbuffer_buff_list` VALUES ('30', '0', 'special', '1389', '3', '1', '1');
2070+
2071+INSERT INTO `npcbuffer_buff_list` VALUES ('31', '1', 'song', '264', '1', '2', '1');
2072+INSERT INTO `npcbuffer_buff_list` VALUES ('32', '1', 'song', '265', '1', '3', '1');
2073+INSERT INTO `npcbuffer_buff_list` VALUES ('33', '1', 'song', '266', '1', '3', '1');
2074+INSERT INTO `npcbuffer_buff_list` VALUES ('34', '1', 'song', '267', '1', '2', '1');
2075+INSERT INTO `npcbuffer_buff_list` VALUES ('35', '1', 'song', '268', '1', '2', '1');
2076+INSERT INTO `npcbuffer_buff_list` VALUES ('36', '1', 'song', '269', '1', '0', '1');
2077+INSERT INTO `npcbuffer_buff_list` VALUES ('37', '1', 'song', '270', '1', '3', '1');
2078+INSERT INTO `npcbuffer_buff_list` VALUES ('38', '1', 'song', '304', '1', '2', '1');
2079+INSERT INTO `npcbuffer_buff_list` VALUES ('39', '1', 'song', '305', '1', '3', '1');
2080+INSERT INTO `npcbuffer_buff_list` VALUES ('40', '1', 'song', '306', '1', '3', '1');
2081+INSERT INTO `npcbuffer_buff_list` VALUES ('41', '1', 'song', '308', '1', '3', '1');
2082+INSERT INTO `npcbuffer_buff_list` VALUES ('42', '1', 'song', '349', '1', '3', '1');
2083+INSERT INTO `npcbuffer_buff_list` VALUES ('43', '1', 'song', '363', '1', '3', '1');
2084+INSERT INTO `npcbuffer_buff_list` VALUES ('44', '1', 'song', '364', '1', '3', '1');
2085+INSERT INTO `npcbuffer_buff_list` VALUES ('45', '1', 'song', '529', '1', '3', '1');
2086+INSERT INTO `npcbuffer_buff_list` VALUES ('46', '1', 'song', '764', '1', '3', '1');
2087+INSERT INTO `npcbuffer_buff_list` VALUES ('47', '1', 'song', '914', '1', '3', '1');
2088+
2089+INSERT INTO `npcbuffer_buff_list` VALUES ('48', '2', 'dance', '271', '1', '0', '1');
2090+INSERT INTO `npcbuffer_buff_list` VALUES ('49', '2', 'dance', '272', '1', '3', '1');
2091+INSERT INTO `npcbuffer_buff_list` VALUES ('50', '2', 'dance', '273', '1', '1', '1');
2092+INSERT INTO `npcbuffer_buff_list` VALUES ('51', '2', 'dance', '274', '1', '0', '1');
2093+INSERT INTO `npcbuffer_buff_list` VALUES ('52', '2', 'dance', '275', '1', '0', '1');
2094+INSERT INTO `npcbuffer_buff_list` VALUES ('53', '2', 'dance', '276', '1', '1', '1');
2095+INSERT INTO `npcbuffer_buff_list` VALUES ('54', '2', 'dance', '277', '1', '3', '1');
2096+INSERT INTO `npcbuffer_buff_list` VALUES ('55', '2', 'dance', '307', '1', '3', '1');
2097+INSERT INTO `npcbuffer_buff_list` VALUES ('56', '2', 'dance', '309', '1', '3', '1');
2098+INSERT INTO `npcbuffer_buff_list` VALUES ('57', '2', 'dance', '310', '1', '3', '1');
2099+INSERT INTO `npcbuffer_buff_list` VALUES ('58', '2', 'dance', '311', '1', '3', '1');
2100+INSERT INTO `npcbuffer_buff_list` VALUES ('59', '2', 'dance', '365', '1', '3', '1');
2101+INSERT INTO `npcbuffer_buff_list` VALUES ('60', '2', 'dance', '366', '1', '3', '0');
2102+INSERT INTO `npcbuffer_buff_list` VALUES ('61', '2', 'dance', '530', '1', '3', '1');
2103+INSERT INTO `npcbuffer_buff_list` VALUES ('62', '2', 'dance', '765', '1', '3', '1');
2104+INSERT INTO `npcbuffer_buff_list` VALUES ('63', '2', 'dance', '915', '1', '3', '1');
2105+
2106+INSERT INTO `npcbuffer_buff_list` VALUES ('64', '3', 'resist', '1461', '1', '3', '1');
2107+INSERT INTO `npcbuffer_buff_list` VALUES ('65', '3', 'chant', '1002', '3', '3', '1');
2108+INSERT INTO `npcbuffer_buff_list` VALUES ('66', '3', 'chant', '1006', '3', '3', '1');
2109+INSERT INTO `npcbuffer_buff_list` VALUES ('67', '3', 'chant', '1007', '3', '3', '1');
2110+INSERT INTO `npcbuffer_buff_list` VALUES ('68', '3', 'chant', '1009', '3', '3', '1');
2111+INSERT INTO `npcbuffer_buff_list` VALUES ('69', '3', 'chant', '1251', '2', '3', '1');
2112+INSERT INTO `npcbuffer_buff_list` VALUES ('70', '3', 'chant', '1252', '3', '3', '1');
2113+INSERT INTO `npcbuffer_buff_list` VALUES ('71', '3', 'chant', '1253', '3', '3', '1');
2114+INSERT INTO `npcbuffer_buff_list` VALUES ('72', '3', 'chant', '1284', '3', '3', '1');
2115+INSERT INTO `npcbuffer_buff_list` VALUES ('73', '3', 'chant', '1308', '3', '3', '1');
2116+INSERT INTO `npcbuffer_buff_list` VALUES ('74', '3', 'chant', '1309', '3', '3', '1');
2117+INSERT INTO `npcbuffer_buff_list` VALUES ('75', '3', 'chant', '1310', '4', '3', '1');
2118+INSERT INTO `npcbuffer_buff_list` VALUES ('76', '3', 'chant', '1362', '1', '3', '1');
2119+INSERT INTO `npcbuffer_buff_list` VALUES ('77', '3', 'special', '1499', '1', '3', '1');
2120+INSERT INTO `npcbuffer_buff_list` VALUES ('78', '3', 'special', '1500', '1', '3', '1');
2121+INSERT INTO `npcbuffer_buff_list` VALUES ('79', '3', 'special', '1501', '1', '3', '1');
2122+INSERT INTO `npcbuffer_buff_list` VALUES ('80', '3', 'special', '1502', '1', '3', '1');
2123+INSERT INTO `npcbuffer_buff_list` VALUES ('81', '3', 'special', '1503', '1', '3', '1');
2124+INSERT INTO `npcbuffer_buff_list` VALUES ('82', '3', 'special', '1504', '1', '3', '1');
2125+INSERT INTO `npcbuffer_buff_list` VALUES ('83', '3', 'special', '1519', '1', '3', '1');
2126+
2127+INSERT INTO `npcbuffer_buff_list` VALUES ('84', '4', 'others', '825', '1', '3', '1');
2128+INSERT INTO `npcbuffer_buff_list` VALUES ('85', '4', 'others', '826', '1', '3', '1');
2129+INSERT INTO `npcbuffer_buff_list` VALUES ('86', '4', 'others', '827', '1', '3', '1');
2130+INSERT INTO `npcbuffer_buff_list` VALUES ('87', '4', 'others', '828', '1', '3', '1');
2131+INSERT INTO `npcbuffer_buff_list` VALUES ('88', '4', 'others', '829', '1', '3', '1');
2132+INSERT INTO `npcbuffer_buff_list` VALUES ('89', '4', 'others', '830', '1', '3', '1');
2133+
2134+INSERT INTO `npcbuffer_buff_list` VALUES ('90', '5', 'others', '834', '1', '3', '1');
2135+INSERT INTO `npcbuffer_buff_list` VALUES ('91', '5', 'others', '1442', '1', '3', '1');
2136+INSERT INTO `npcbuffer_buff_list` VALUES ('92', '5', 'others', '1443', '1', '3', '1');
2137+INSERT INTO `npcbuffer_buff_list` VALUES ('93', '5', 'others', '1444', '1', '3', '1');
2138+
2139+INSERT INTO `npcbuffer_buff_list` VALUES ('94', '6', 'cubic', '67', '7', '3', '1');
2140+INSERT INTO `npcbuffer_buff_list` VALUES ('95', '6', 'cubic', '10', '8', '3', '1');
2141+INSERT INTO `npcbuffer_buff_list` VALUES ('96', '6', 'cubic', '22', '7', '3', '1');
2142+INSERT INTO `npcbuffer_buff_list` VALUES ('97', '6', 'cubic', '33', '8', '3', '1');
2143+INSERT INTO `npcbuffer_buff_list` VALUES ('98', '6', 'cubic', '278', '6', '3', '1');
2144+INSERT INTO `npcbuffer_buff_list` VALUES ('99', '6', 'cubic', '449', '4', '3', '1');
2145+INSERT INTO `npcbuffer_buff_list` VALUES ('100', '6', 'cubic', '1279', '9', '3', '1');
2146+INSERT INTO `npcbuffer_buff_list` VALUES ('101', '6', 'cubic', '1280', '9', '3', '1');
2147+INSERT INTO `npcbuffer_buff_list` VALUES ('102', '6', 'cubic', '1281', '9', '3', '1');
2148+INSERT INTO `npcbuffer_buff_list` VALUES ('103', '6', 'cubic', '1328', '8', '3', '0');
2149+INSERT INTO `npcbuffer_buff_list` VALUES ('104', '6', 'cubic', '1329', '9', '3', '0');
2150+INSERT INTO `npcbuffer_buff_list` VALUES ('105', '6', 'cubic', '1330', '8', '3', '0');
2151+INSERT INTO `npcbuffer_buff_list` VALUES ('106', '6', 'cubic', '779', '1', '3', '1');
2152+
2153+INSERT INTO `npcbuffer_buff_list` VALUES ('107', '7', 'special', '1062', '2', '2', '1');
2154+INSERT INTO `npcbuffer_buff_list` VALUES ('108', '7', 'special', '1355', '1', '3', '1');
2155+INSERT INTO `npcbuffer_buff_list` VALUES ('109', '7', 'special', '1356', '1', '3', '1');
2156+INSERT INTO `npcbuffer_buff_list` VALUES ('110', '7', 'special', '1357', '1', '3', '1');
2157+INSERT INTO `npcbuffer_buff_list` VALUES ('111', '7', 'special', '1363', '1', '0', '1');
2158+INSERT INTO `npcbuffer_buff_list` VALUES ('112', '7', 'special', '1413', '1', '1', '1');
2159+INSERT INTO `npcbuffer_buff_list` VALUES ('114', '7', 'special', '1457', '1', '3', '0');
2160+INSERT INTO `npcbuffer_buff_list` VALUES ('115', '7', 'special', '4699', '13', '3', '1');
2161+INSERT INTO `npcbuffer_buff_list` VALUES ('116', '7', 'special', '4700', '13', '3', '1');
2162+INSERT INTO `npcbuffer_buff_list` VALUES ('117', '7', 'special', '4702', '13', '3', '1');
2163+INSERT INTO `npcbuffer_buff_list` VALUES ('118', '7', 'special', '4703', '13', '3', '1');
2164+
2165+INSERT INTO `npcbuffer_buff_list` VALUES ('119', '8', 'resist', '1032', '3', '3', '1');
2166+INSERT INTO `npcbuffer_buff_list` VALUES ('120', '8', 'resist', '1033', '3', '3', '1');
2167+INSERT INTO `npcbuffer_buff_list` VALUES ('121', '8', 'resist', '1035', '4', '2', '1');
2168+INSERT INTO `npcbuffer_buff_list` VALUES ('122', '8', 'resist', '1078', '6', '3', '1');
2169+INSERT INTO `npcbuffer_buff_list` VALUES ('123', '8', 'resist', '1182', '3', '3', '1');
2170+INSERT INTO `npcbuffer_buff_list` VALUES ('124', '8', 'resist', '1189', '3', '3', '1');
2171+INSERT INTO `npcbuffer_buff_list` VALUES ('125', '8', 'resist', '1191', '3', '3', '1');
2172+INSERT INTO `npcbuffer_buff_list` VALUES ('126', '8', 'resist', '1259', '4', '3', '1');
2173+INSERT INTO `npcbuffer_buff_list` VALUES ('127', '8', 'resist', '1352', '1', '2', '1');
2174+INSERT INTO `npcbuffer_buff_list` VALUES ('128', '8', 'resist', '1353', '1', '2', '1');
2175+INSERT INTO `npcbuffer_buff_list` VALUES ('129', '8', 'resist', '1354', '1', '3', '1');
2176+INSERT INTO `npcbuffer_buff_list` VALUES ('130', '8', 'resist', '1392', '3', '3', '1');
2177+INSERT INTO `npcbuffer_buff_list` VALUES ('131', '8', 'resist', '1393', '3', '3', '1');
2178+
2179+INSERT INTO `npcbuffer_buff_list` VALUES ('132', '8', 'overlord', '1003', '3', '3', '1');
2180+INSERT INTO `npcbuffer_buff_list` VALUES ('133', '8', 'overlord', '1004', '3', '3', '1');
2181+INSERT INTO `npcbuffer_buff_list` VALUES ('134', '8', 'overlord', '1005', '3', '3', '1');
2182+INSERT INTO `npcbuffer_buff_list` VALUES ('135', '8', 'overlord', '1008', '3', '3', '1');
2183+INSERT INTO `npcbuffer_buff_list` VALUES ('136', '8', 'overlord', '1249', '3', '3', '1');
2184+INSERT INTO `npcbuffer_buff_list` VALUES ('137', '8', 'overlord', '1250', '3', '3', '1');
2185+INSERT INTO `npcbuffer_buff_list` VALUES ('138', '8', 'overlord', '1260', '3', '3', '1');
2186+INSERT INTO `npcbuffer_buff_list` VALUES ('139', '8', 'overlord', '1261', '2', '3', '1');
2187+INSERT INTO `npcbuffer_buff_list` VALUES ('140', '8', 'overlord', '1282', '2', '3', '1');
2188+INSERT INTO `npcbuffer_buff_list` VALUES ('141', '8', 'overlord', '1364', '1', '3', '1');
2189+INSERT INTO `npcbuffer_buff_list` VALUES ('142', '8', 'overlord', '1365', '1', '3', '1');
2190+INSERT INTO `npcbuffer_buff_list` VALUES ('143', '8', 'overlord', '1415', '1', '3', '1');
2191+INSERT INTO `npcbuffer_buff_list` VALUES ('144', '8', 'overlord', '1416', '1', '3', '1');
2192\ No newline at end of file