Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a/aCis_datapack/data/xml/bufferSkills.xml
- +++ b/aCis_datapack/data/xml/bufferSkills.xml
- @@ -37,7 +37,7 @@
- <buff id="1397" desc="Decreases MP consumption rate."/><!-- Clarity -->
- <buff id="1413" desc="Increases mage abilities."/><!-- Magnus' Chant -->
- </category>
- - <category type="Dances">
- + <category type="Other">
- <buff id="271" desc="Increases P. Atk."/><!-- Dance of the Warrior -->
- <buff id="272" desc="Increases Accuracy."/><!-- Dance of Inspiration -->
- <buff id="273" desc="Increases M. Atk."/><!-- Dance of the Mystic -->
- @@ -50,8 +50,6 @@
- <buff id="310" desc="Restores HP by inflicted damage."/><!-- Dance of the Vampire -->
- <buff id="311" desc="Increases resistance to terrain damage."/><!-- Dance of Protection -->
- <buff id="365" desc="Increases rate of magic crit. damage."/><!-- Siren's Dance -->
- - </category>
- - <category type="Songs">
- <buff id="264" desc="Increases P. Def."/><!-- Song of Earth -->
- <buff id="265" desc="Increases HP regeneration."/><!-- Song of Life -->
- <buff id="266" desc="Increases Evasion."/><!-- Song of Water -->
- diff --git a/aCis_datapack/data/xml/npcs/50000-50999.xml b/aCis_datapack/data/xml/npcs/50000-50999.xml
- index cfcc992..3adcd84 100644
- --- a/aCis_datapack/data/xml/npcs/50000-50999.xml
- +++ b/aCis_datapack/data/xml/npcs/50000-50999.xml
- @@ -82,7 +82,7 @@
- <set name="height" val="18"/>
- <set name="rHand" val="0"/>
- <set name="lHand" val="0"/>
- - <set name="type" val="SchemeBuffer"/>
- + <set name="type" val="PlayerBuffer"/>
- <set name="exp" val="0"/>
- <set name="sp" val="0"/>
- <set name="hp" val="2444.46819"/>
- diff --git a/aCis_gameserver/config/npcs.properties b/aCis_gameserver/config/npcs.properties
- index c05f8a9..e99f647 100644
- --- a/aCis_gameserver/config/npcs.properties
- +++ b/aCis_gameserver/config/npcs.properties
- @@ -201,4 +201,31 @@
- MinNPCAnimation = 20
- MaxNPCAnimation = 40
- MinMonsterAnimation = 10
- -MaxMonsterAnimation = 40
- \ No newline at end of file
- +MaxMonsterAnimation = 40
- +
- + #=============================================================
- +# Buffer
- +#=============================================================
- +
- +# Maximum number of available schemes per player.
- +BufferMaxSchemesPerChar = 4
- +
- +# Maximum number of buffs per scheme.
- +BufferMaxSkillsPerScheme = 24
- +
- +# Static cost of buffs ; override skills price if different of -1.
- +BufferStaticCostPerBuff = -1
- +
- +# Fighter Set List
- +FighterSkillList = 1204;1045;1068;1040;1035;1086;1242;1268;1036;1240;1077;1087;271;272;274;275;310;264;266;267;268;269;270;304;305;349;364;1388;1363;4699;1393;1392;1352;1353;1354;306;1259;1182;1189;1191
- +# Mage Set List
- +MageSkillList = 1204;1048;1045;1040;1035;1085;1303;1243;1304;1036;1087;1059;1078;1062;273;365;1393;1392;1352;1353;1354;307;309;306;308;1259;1182;1191;1033;1391;1363;264;266;267;268;270;304;349;4703;276
- +
- +# Buffer List, skillId, skillevel, buffPrice,type.
- +BufferBuffs = 264,1,0,Songs;265,1,0,Songs;266,1,0,Songs;267,1,0,Songs;268,1,0,Songs;269,1,0,Songs;270,1,0,Songs;304,1,0,Songs;305,1,0,Songs;306,1,0,Songs;308,1,0,Songs;349,1,0,Songs;363,1,0,Songs;364,1,0,Songs;271,1,0,Dances;272,1,0,Dances;273,1,0,Dances;274,1,0,Dances;275,1,0,Dances;276,1,0,Dances;277,1,0,Dances;309,1,0,Dances;310,1,0,Dances;311,1,0,Dances;307,1,0,Dances;365,1,0,Dances;1002,1,0,Warcryer;1006,1,0,Warcryer;1007,1,0,Warcryer;1009,1,0,Warcryer;1308,1,0,Warcryer;1309,1,0,Warcryer;1310,1,0,Warcryer;1362,1,0,Warcryer;1390,1,0,Warcryer;1391,1,0,Warcryer;1413,1,0,Warcryer;1416,1,0,Overlord;1003,1,0,Overlord;1004,1,0,Overlord;1005,1,0,Overlord;1008,1,0,Overlord;1249,1,0,Overlord;1364,1,0,Overlord;1365,1,0,Overlord;1032,1,0,Prophet;1033,1,0,Prophet;1035,1,0,Prophet;1036,1,0,Prophet;1040,1,0,Prophet;1043,1,0,Prophet;1044,1,0,Prophet;1045,1,0,Prophet;1048,1,0,Prophet;1059,1,0,Shillen_Elder;1062,1,0,Prophet;1068,1,0,Prophet;1073,1,0,Elder;1077,1,0,Shillen_Elder;1078,1,0,Shillen_Elder;1085,1,0,Prophet;1086,1,0,Prophet;1087,1,0,Elder;1182,1,0,Elder;1189,1,0,Shillen_Elder;1191,1,0,Prophet;1204,1,0,Prophet;1242,1,0,Shillen_Elder;1243,1,0,Prophet;1259,1,0,Elder;1268,1,0,Shillen_Elder;1303,1,0,Shillen_Elder;1304,1,0,Elder;1352,1,0,Elder;1353,1,0,Elder;1354,1,0,Elder;1388,1,0,Shillen_Elder;1389,1,0,Shillen_Elder;1392,1,0,Prophet;1393,1,0,Elder;1397,1,0,Elder;1355,1,0,Elder;4699,1,0,Elder;4700,1,0,Elder;4702,1,0,Elder;4703,1,0,Elder;1356,1,0,Prophet;1357,1,0,Shillen_Elder;1363,1,0,Warcryer;1414,1,0,Overlord
- +
- +RestrictUseBufferOnPvPFlag = true
- +RestrictUseBufferInCombat = true
- +
- +VoteBuffItemId = 57
- +VoteBuffItemCount = 15
- \ No newline at end of file
- diff --git a/aCis_gameserver/java/net/sf/l2j/Config.java b/aCis_gameserver/java/net/sf/l2j/Config.java
- index 65daaa6..ae3938c 100644
- --- a/aCis_gameserver/java/net/sf/l2j/Config.java
- +++ b/aCis_gameserver/java/net/sf/l2j/Config.java
- @@ -16,6 +16,7 @@
- import net.sf.l2j.commons.math.MathUtil;
- import net.sf.l2j.gameserver.enums.GeoType;
- +import net.sf.l2j.gameserver.model.holder.BuffSkillHolder;
- import net.sf.l2j.gameserver.model.holder.IntIntHolder;
- /**
- @@ -326,6 +327,26 @@
- public static int MIN_MONSTER_ANIMATION;
- public static int MAX_MONSTER_ANIMATION;
- + /** Buffer */
- + public static String PFIGHTER_SET;
- + public static int[] PFIGHTER_SET_LIST;
- + public static String PMAGE_SET;
- + public static int[] PMAGE_SET_LIST;
- + public static int PBUFFER_MAX_SCHEMES;
- + public static int PBUFFER_MAX_SKILLS;
- + public static int PBUFFER_STATIC_BUFF_COST;
- + public static String PBUFFER_BUFFS;
- + public static Map<Integer, BuffSkillHolder> PBUFFER_BUFFLIST;
- +
- + public static List<Integer> PFIGHTER_SKILL_LIST;
- + public static List<Integer> PMAGE_SKILL_LIST;
- +
- + public static boolean PRESTRICT_USE_BUFFER_ON_PVPFLAG;
- + public static boolean PRESTRICT_USE_BUFFER_IN_COMBAT;
- +
- + public static int PVOTE_BUFF_ITEM_ID;
- + public static int PVOTE_BUFF_ITEM_COUNT;
- +
- // --------------------------------------------------
- // Players
- // --------------------------------------------------
- @@ -949,6 +970,45 @@
- MAX_NPC_ANIMATION = npcs.getProperty("MaxNPCAnimation", 40);
- MIN_MONSTER_ANIMATION = npcs.getProperty("MinMonsterAnimation", 10);
- MAX_MONSTER_ANIMATION = npcs.getProperty("MaxMonsterAnimation", 40);
- +
- + PBUFFER_MAX_SCHEMES = npcs.getProperty("BufferMaxSchemesPerChar", 4);
- + PBUFFER_MAX_SKILLS = npcs.getProperty("BufferMaxSkillsPerScheme", 24);
- + PBUFFER_STATIC_BUFF_COST = npcs.getProperty("BufferStaticCostPerBuff", -1);
- + PBUFFER_BUFFS = npcs.getProperty("BufferBuffs");
- +
- + PFIGHTER_SET = npcs.getProperty("FighterSet", "2375,3500,3501,3502,4422,4423,4424,4425,6648,6649,6650");
- + PMAGE_SET = npcs.getProperty("MageSet", "2375,3500,3501,3502,4422,4423,4424,4425,6648,6649,6650");
- +
- + String[] FighterList = PFIGHTER_SET.split(",");
- + PFIGHTER_SET_LIST = new int[FighterList.length];
- + for (int i = 0; i < FighterList.length; i++)
- + PFIGHTER_SET_LIST[i] = Integer.parseInt(FighterList[i]);
- +
- + String[] MageList = PMAGE_SET.split(",");
- + PMAGE_SET_LIST = new int[MageList.length];
- + for (int i = 0; i < MageList.length; i++)
- + PMAGE_SET_LIST[i] = Integer.parseInt(MageList[i]);
- +
- + PBUFFER_BUFFLIST = new HashMap<>();
- + for (String skillInfo : PBUFFER_BUFFS.split(";"))
- + {
- + final String[] infos = skillInfo.split(",");
- + PBUFFER_BUFFLIST.put(Integer.valueOf(infos[0]), new BuffSkillHolder(Integer.valueOf(infos[0]), Integer.valueOf(infos[1]), Integer.valueOf(infos[2]), infos[3], skillInfo));
- + }
- +
- + PRESTRICT_USE_BUFFER_ON_PVPFLAG = npcs.getProperty("RestrictUseBufferOnPvPFlag", true);
- + PRESTRICT_USE_BUFFER_IN_COMBAT = npcs.getProperty("RestrictUseBufferInCombat", true);
- +
- + PVOTE_BUFF_ITEM_ID = npcs.getProperty("VoteBuffItemId", 57);
- + PVOTE_BUFF_ITEM_COUNT = npcs.getProperty("VoteBuffItemCount", 1);
- +
- + PFIGHTER_SKILL_LIST = new ArrayList<>();
- + for (String skill_id : npcs.getProperty("FighterSkillList", "").split(";"))
- + PFIGHTER_SKILL_LIST.add(Integer.parseInt(skill_id));
- +
- + PMAGE_SKILL_LIST = new ArrayList<>();
- + for (String skill_id : npcs.getProperty("MageSkillList", "").split(";"))
- + PMAGE_SKILL_LIST.add(Integer.parseInt(skill_id));
- }
- /**
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/PlayerBuffer.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/PlayerBuffer.java
- new file mode 100644
- index 0000000..284f86a
- --- /dev/null
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/PlayerBuffer.java
- @@ -0,0 +1,524 @@
- +package net.sf.l2j.gameserver.model.actor.instance;
- +
- +import java.util.ArrayList;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.StringTokenizer;
- +
- +import net.sf.l2j.commons.lang.StringUtil;
- +import net.sf.l2j.commons.math.MathUtil;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.SkillTable;
- +import net.sf.l2j.gameserver.data.manager.BufferManager;
- +import net.sf.l2j.gameserver.model.actor.Creature;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.Summon;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.network.serverpackets.ItemList;
- +import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.skills.L2Skill;
- +
- +/**
- + * @author Baggos
- + */
- +public class PlayerBuffer extends Folk
- +{
- + private static final int PAGE_LIMIT = 6;
- +
- + public PlayerBuffer(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + private void showMainWindow(Player activeChar)
- + {
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile(getHtmlPath(getNpcId(), 0));
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + html.replace("%name%", activeChar.getName());
- + html.replace("%buffcount%", "You have " + activeChar.getBuffCount() + "/" + activeChar.getMaxBuffCount() + " buffs.");
- +
- + activeChar.sendPacket(html);
- + }
- +
- + @Override
- + public void onBypassFeedback(Player player, String command)
- + {
- + if (player.getPvpFlag() > 0 && Config.PRESTRICT_USE_BUFFER_ON_PVPFLAG)
- + {
- + player.sendMessage("You can't use buffer when you are pvp flagged.");
- + return;
- + }
- +
- + if (player.isInCombat() && Config.PRESTRICT_USE_BUFFER_IN_COMBAT)
- + {
- + player.sendMessage("You can't use buffer when you are in combat.");
- + return;
- + }
- +
- + if (player.isDead())
- + return;
- +
- + StringTokenizer st = new StringTokenizer(command, " ");
- + String actualCommand = st.nextToken();
- +
- + if (actualCommand.startsWith("bufflist"))
- + {
- + autoBuffFunction(player, st.nextToken());
- + }
- + else if (actualCommand.startsWith("restore"))
- + {
- + String noble = st.nextToken();
- + player.getStatus().setMaxCpHpMp();
- +
- + if (noble.equals("true"))
- + {
- + SkillTable.getInstance().getInfo(1323, 1).getEffects(player, player);
- + player.broadcastPacket(new MagicSkillUse(this, player, 1323, 1, 850, 0));
- + }
- +
- + final Summon summon = player.getSummon();
- + if (summon != null)
- + summon.getStatus().setMaxHpMp();
- +
- + showMainWindow(player);
- + }
- + else if (actualCommand.startsWith("cancellation"))
- + {
- + L2Skill buff;
- + buff = SkillTable.getInstance().getInfo(1056, 1);
- + buff.getEffects(this, player);
- + player.stopAllEffectsExceptThoseThatLastThroughDeath();
- + player.broadcastPacket(new MagicSkillUse(this, player, 1056, 1, 850, 0));
- + player.stopAllEffects();
- +
- + final Summon summon = player.getSummon();
- + if (summon != null)
- + summon.stopAllEffects();
- +
- + showMainWindow(player);
- + }
- + else if (actualCommand.startsWith("openlist"))
- + {
- + String category = st.nextToken();
- + String htmfile = st.nextToken();
- +
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- +
- + if (category.startsWith("null"))
- + {
- + html.setFile("data/html/mods/buffer/" + htmfile + ".htm");
- +
- + // First Page
- + if (htmfile.equals("index"))
- + {
- + html.replace("%name%", player.getName());
- + html.replace("%buffcount%", "You have " + player.getBuffCount() + "/" + player.getMaxBuffCount() + " buffs.");
- + }
- + }
- + else
- + html.setFile("data/html/mods/buffer/" + category + "/" + htmfile + ".htm");
- +
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + player.sendPacket(html);
- + }
- +
- + else if (actualCommand.startsWith("dobuff"))
- + {
- + int buffid = Integer.valueOf(st.nextToken());
- + int bufflevel = Integer.valueOf(st.nextToken());
- + String category = st.nextToken();
- + String windowhtml = st.nextToken();
- + String votebuff = null;
- +
- + if (st.hasMoreTokens())
- + votebuff = st.nextToken();
- +
- + if (windowhtml.equals("malaria"))
- + {
- + if (player.getInventory().getItemCount(Config.PVOTE_BUFF_ITEM_ID, 0) >= 1)
- + {
- + player.getInventory().destroyItemByItemId("VoteCoins", Config.PVOTE_BUFF_ITEM_ID, 1, player, null);
- + player.getInventory().updateDatabase();
- + player.sendPacket(new ItemList(player, true));
- + player.sendMessage(1 + " Vote eye destroyed.");
- + }
- + else
- + {
- + player.sendMessage("You dont have enough (" + 1 + ") vote item for buff.");
- + return;
- + }
- + }
- +
- + if (votebuff != null)
- + {
- + if (player.getInventory().getItemCount(Config.PVOTE_BUFF_ITEM_ID, 0) >= Config.PVOTE_BUFF_ITEM_COUNT)
- + {
- + player.getInventory().destroyItemByItemId("VoteCoins", Config.PVOTE_BUFF_ITEM_ID, Config.PVOTE_BUFF_ITEM_COUNT, player, null);
- + player.getInventory().updateDatabase();
- + player.sendPacket(new ItemList(player, true));
- + player.sendMessage(Config.PVOTE_BUFF_ITEM_COUNT + " vote stone destroyed.");
- + }
- + else
- + {
- + player.sendMessage("You dont have enough (" + Config.PVOTE_BUFF_ITEM_COUNT + ") vote item for buff.");
- + return;
- + }
- + }
- +
- + Creature target = player;
- + if (category.startsWith("pet"))
- + {
- + if (player.getSummon() == null)
- + {
- + player.sendMessage("Incorrect Pet");
- + showMainWindow(player);
- + return;
- + }
- + target = player.getSummon();
- + }
- +
- + MagicSkillUse mgc = new MagicSkillUse(this, target, buffid, bufflevel, 1150, 0);
- + player.sendPacket(mgc);
- + player.broadcastPacket(mgc);
- + SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, target);
- +
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile("data/html/mods/buffer/" + category + "/" + windowhtml + ".htm");
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + html.replace("%name%", player.getName());
- + player.sendPacket(html);
- + }
- + else if (actualCommand.startsWith("getbuff"))
- + {
- + int buffid = Integer.valueOf(st.nextToken());
- + int bufflevel = Integer.valueOf(st.nextToken());
- + if (buffid != 0)
- + {
- + SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);
- + broadcastPacket(new MagicSkillUse(this, player, buffid, bufflevel, 450, 0));
- + showMainWindow(player);
- + }
- + }
- + else if (actualCommand.startsWith("support"))
- + {
- + showGiveBuffsWindow(player);
- + }
- + else if (actualCommand.startsWith("givebuffs"))
- + {
- + final String schemeName = st.nextToken();
- + final int cost = Integer.parseInt(st.nextToken());
- +
- + Creature target = null;
- + if (st.hasMoreTokens())
- + {
- + final String targetType = st.nextToken();
- + if (targetType != null && targetType.equalsIgnoreCase("pet"))
- + target = player.getSummon();
- + }
- + else
- + target = player;
- +
- + if (target == null)
- + player.sendMessage("You don't have a pet.");
- + else if (cost == 0 || player.reduceAdena("NPC Buffer", cost, this, true))
- + BufferManager.getInstance().applySchemeEffects(this, target, player.getObjectId(), schemeName);
- + }
- + else if (actualCommand.startsWith("editschemes"))
- + {
- + showEditSchemeWindow(player, st.nextToken(), st.nextToken(), Integer.parseInt(st.nextToken()));
- + }
- + else if (actualCommand.startsWith("skill"))
- + {
- + final String groupType = st.nextToken();
- + final String schemeName = st.nextToken();
- +
- + final int skillId = Integer.parseInt(st.nextToken());
- + final int page = Integer.parseInt(st.nextToken());
- +
- + final List<Integer> skills = BufferManager.getInstance().getScheme(player.getObjectId(), schemeName);
- +
- + if (actualCommand.startsWith("skillselect") && !schemeName.equalsIgnoreCase("none"))
- + {
- + if (skills.size() < player.getMaxBuffCount())
- + skills.add(skillId);
- + else
- + player.sendMessage("This scheme has reached the maximum amount of buffs.");
- + }
- + else if (actualCommand.startsWith("skillunselect"))
- + skills.remove(Integer.valueOf(skillId));
- +
- + showEditSchemeWindow(player, groupType, schemeName, page);
- + }
- + else if (actualCommand.startsWith("createscheme"))
- + {
- + try
- + {
- + final String schemeName = st.nextToken();
- + if (schemeName.length() > 14)
- + {
- + player.sendMessage("Scheme's name must contain up to 14 chars. Spaces are trimmed.");
- + return;
- + }
- +
- + final Map<String, ArrayList<Integer>> schemes = BufferManager.getInstance().getPlayerSchemes(player.getObjectId());
- + if (schemes != null)
- + {
- + if (schemes.size() == Config.PBUFFER_MAX_SCHEMES)
- + {
- + player.sendMessage("Maximum schemes amount is already reached.");
- + return;
- + }
- +
- + if (schemes.containsKey(schemeName))
- + {
- + player.sendMessage("The scheme name already exists.");
- + return;
- + }
- + }
- +
- + BufferManager.getInstance().setScheme(player.getObjectId(), schemeName.trim(), new ArrayList<>());
- + showGiveBuffsWindow(player);
- + }
- + catch (Exception e)
- + {
- + player.sendMessage("Scheme's name must contain up to 14 chars. Spaces are trimmed.");
- + }
- + }
- + else if (actualCommand.startsWith("deletescheme"))
- + {
- + try
- + {
- + final String schemeName = st.nextToken();
- + final Map<String, ArrayList<Integer>> schemes = BufferManager.getInstance().getPlayerSchemes(player.getObjectId());
- +
- + if (schemes != null && schemes.containsKey(schemeName))
- + schemes.remove(schemeName);
- + }
- + catch (Exception e)
- + {
- + player.sendMessage("This scheme name is invalid.");
- + }
- + showGiveBuffsWindow(player);
- + }
- +
- + super.onBypassFeedback(player, command);
- + }
- +
- + @Override
- + public String getHtmlPath(int npcId, int val)
- + {
- + String filename = "";
- + if (val == 0)
- + filename = "" + npcId;
- + else
- + filename = npcId + "-" + val;
- +
- + return "data/html/mods/buffer/" + filename + ".htm";
- + }
- +
- + /**
- + * Send an html packet to the {@link Player} set a parameter with Give Buffs menu info for player and pet, depending on targetType parameter {player, pet}.
- + * @param player : The {@link Player} to make checks on.
- + */
- + private void showGiveBuffsWindow(Player player)
- + {
- + final StringBuilder sb = new StringBuilder(200);
- +
- + final Map<String, ArrayList<Integer>> schemes = BufferManager.getInstance().getPlayerSchemes(player.getObjectId());
- + if (schemes == null || schemes.isEmpty())
- + sb.append("<font color=\"LEVEL\">You haven't defined any scheme.</font>");
- + else
- + {
- + for (Map.Entry<String, ArrayList<Integer>> scheme : schemes.entrySet())
- + {
- + final int cost = getFee(scheme.getValue());
- + StringUtil.append(sb, "<font color=\"LEVEL\">", scheme.getKey(), " [", scheme.getValue().size(), " / ", player.getMaxBuffCount(), "]", ((cost > 0) ? " - cost: " + StringUtil.formatNumber(cost) : ""), "</font><br1>");
- + StringUtil.append(sb, "<a action=\"bypass npc_%objectId%_givebuffs ", scheme.getKey(), " ", cost, "\">Use on Me</a> | ");
- + StringUtil.append(sb, "<a action=\"bypass npc_%objectId%_givebuffs ", scheme.getKey(), " ", cost, " pet\">Use on Pet</a> | ");
- + StringUtil.append(sb, "<a action=\"bypass npc_%objectId%_editschemes Buffs ", scheme.getKey(), " 1\">Edit</a> | ");
- + StringUtil.append(sb, "<a action=\"bypass npc_%objectId%_deletescheme ", scheme.getKey(), "\">Delete</a><br>");
- + }
- + }
- +
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile(getHtmlPath(getNpcId(), 1));
- + html.replace("%schemes%", sb.toString());
- + html.replace("%max_schemes%", Config.PBUFFER_MAX_SCHEMES);
- + html.replace("%objectId%", getObjectId());
- + player.sendPacket(html);
- + }
- +
- + /**
- + * Send an html packet to the {@link Player} set as parameter with Edit Scheme Menu info. This allows the {@link Player} to edit each created scheme (add/delete skills)
- + * @param player : The {@link Player} to make checks on.
- + * @param groupType : The group of skills to select.
- + * @param schemeName : The scheme to make check.
- + * @param page : The current checked page.
- + */
- + private void showEditSchemeWindow(Player player, String groupType, String schemeName, int page)
- + {
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- + final List<Integer> schemeSkills = BufferManager.getInstance().getScheme(player.getObjectId(), schemeName);
- +
- + html.setFile(getHtmlPath(getNpcId(), 2));
- + html.replace("%schemename%", schemeName);
- + html.replace("%count%", schemeSkills.size() + " / " + player.getMaxBuffCount());
- + html.replace("%typesframe%", getTypesFrame(groupType, schemeName));
- + html.replace("%skilllistframe%", getGroupSkillList(player, groupType, schemeName, page));
- + html.replace("%objectId%", getObjectId());
- + player.sendPacket(html);
- + }
- +
- + /**
- + * @param player : The {@link Player} to make checks on.
- + * @param groupType : The group of skills to select.
- + * @param schemeName : The scheme to make check.
- + * @param page : The current checked page.
- + * @return A {@link String} representing skills available for selection for a given groupType.
- + */
- + private String getGroupSkillList(Player player, String groupType, String schemeName, int page)
- + {
- + // Retrieve the entire skills list based on group type.
- + List<Integer> skills = BufferManager.getInstance().getSkillsIdsByType(groupType);
- + if (skills.isEmpty())
- + return "That group doesn't contain any skills.";
- +
- + // Calculate page number.
- + final int max = MathUtil.countPagesNumber(skills.size(), PAGE_LIMIT);
- + if (page > max)
- + page = max;
- +
- + // Cut skills list up to page number.
- + skills = skills.subList((page - 1) * PAGE_LIMIT, Math.min(page * PAGE_LIMIT, skills.size()));
- +
- + final List<Integer> schemeSkills = BufferManager.getInstance().getScheme(player.getObjectId(), schemeName);
- + final StringBuilder sb = new StringBuilder(skills.size() * 150);
- +
- + int row = 0;
- + for (int skillId : skills)
- + {
- + final String icon = (skillId < 100) ? "icon.skill00" + skillId : (skillId < 1000) ? "icon.skill0" + skillId : "icon.skill" + skillId;
- +
- + sb.append(((row % 2) == 0 ? "<table width=\"280\" bgcolor=\"000000\"><tr>" : "<table width=\"280\"><tr>"));
- +
- + if (schemeSkills.contains(skillId))
- + StringUtil.append(sb, "<td height=40 width=40><img src=\"", icon, "\" width=32 height=32></td><td width=190>", SkillTable.getInstance().getInfo(skillId, 1).getName(), "<br1><font color=\"B09878\">", BufferManager.getInstance().getAvailableBuff(skillId).getDescription(), "</font></td><td><button action=\"bypass npc_%objectId%_skillunselect ", groupType, " ", schemeName, " ", skillId, " ", page, "\" width=32 height=32 back=\"L2UI_CH3.mapbutton_zoomout2\" fore=\"L2UI_CH3.mapbutton_zoomout1\"></td>");
- + else
- + StringUtil.append(sb, "<td height=40 width=40><img src=\"", icon, "\" width=32 height=32></td><td width=190>", SkillTable.getInstance().getInfo(skillId, 1).getName(), "<br1><font color=\"B09878\">", BufferManager.getInstance().getAvailableBuff(skillId).getDescription(), "</font></td><td><button action=\"bypass npc_%objectId%_skillselect ", groupType, " ", schemeName, " ", skillId, " ", page, "\" width=32 height=32 back=\"L2UI_CH3.mapbutton_zoomin2\" fore=\"L2UI_CH3.mapbutton_zoomin1\"></td>");
- +
- + sb.append("</tr></table><img src=\"L2UI.SquareGray\" width=277 height=1>");
- + row++;
- + }
- +
- + for (int i = PAGE_LIMIT; i > row; i--)
- + StringUtil.append(sb, "<img height=41>");
- +
- + // Build page footer.
- + sb.append("<br><img src=\"L2UI.SquareGray\" width=277 height=1><table width=\"100%\" bgcolor=000000><tr>");
- +
- + if (page > 1)
- + StringUtil.append(sb, "<td align=left width=70><a action=\"bypass npc_" + getObjectId() + "_editschemes ", groupType, " ", schemeName, " ", page - 1, "\">Previous</a></td>");
- + else
- + StringUtil.append(sb, "<td align=left width=70>Previous</td>");
- +
- + StringUtil.append(sb, "<td align=center width=100>Page ", page, "</td>");
- +
- + if (page < max)
- + StringUtil.append(sb, "<td align=right width=70><a action=\"bypass npc_" + getObjectId() + "_editschemes ", groupType, " ", schemeName, " ", page + 1, "\">Next</a></td>");
- + else
- + StringUtil.append(sb, "<td align=right width=70>Next</td>");
- +
- + sb.append("</tr></table><img src=\"L2UI.SquareGray\" width=277 height=1>");
- +
- + return sb.toString();
- + }
- +
- + /**
- + * @param groupType : The group of skills to select.
- + * @param schemeName : The scheme to make check.
- + * @return A {@link String} representing all groupTypes available. The group currently on selection isn't linkable.
- + */
- + private static String getTypesFrame(String groupType, String schemeName)
- + {
- + final StringBuilder sb = new StringBuilder(500);
- + sb.append("<table>");
- +
- + int count = 0;
- + for (String type : BufferManager.getInstance().getSkillTypes())
- + {
- + if (count == 0)
- + sb.append("<tr>");
- +
- + if (groupType.equalsIgnoreCase(type))
- + StringUtil.append(sb, "<td width=65>", type, "</td>");
- + else
- + StringUtil.append(sb, "<td width=65><a action=\"bypass npc_%objectId%_editschemes ", type, " ", schemeName, " 1\">", type, "</a></td>");
- +
- + count++;
- + if (count == 4)
- + {
- + sb.append("</tr>");
- + count = 0;
- + }
- + }
- +
- + if (!sb.toString().endsWith("</tr>"))
- + sb.append("</tr>");
- +
- + sb.append("</table>");
- +
- + return sb.toString();
- + }
- +
- + /**
- + * @param list : A {@link List} of skill ids.
- + * @return a global fee for all skills contained in the {@link List}.
- + */
- + private static int getFee(ArrayList<Integer> list)
- + {
- + if (Config.PBUFFER_STATIC_BUFF_COST > 0)
- + return list.size() * Config.PBUFFER_STATIC_BUFF_COST;
- +
- + int fee = 0;
- + for (int sk : list)
- + fee += BufferManager.getInstance().getAvailableBuff(sk).getPrice();
- +
- + return fee;
- + }
- +
- + private void autoBuffFunction(Player player, String bufflist)
- + {
- + ArrayList<L2Skill> skills_to_buff = new ArrayList<>();
- + List<Integer> list = null;
- +
- + if (bufflist.equalsIgnoreCase("fighter"))
- + list = Config.PFIGHTER_SKILL_LIST;
- + else if (bufflist.equalsIgnoreCase("mage"))
- + list = Config.PMAGE_SKILL_LIST;
- +
- + if (list != null)
- + {
- + for (int skillId : list)
- + {
- + L2Skill skill = SkillTable.getInstance().getInfo(skillId, SkillTable.getInstance().getMaxLevel(skillId));
- + if (skill != null)
- + skills_to_buff.add(skill);
- + }
- +
- + for (L2Skill sk : skills_to_buff)
- + sk.getEffects(player, player);
- +
- + player.updateEffectIcons();
- +
- + list = null;
- + }
- +
- + skills_to_buff.clear();
- +
- + showMainWindow(player);
- + }
- +
- +}
- \ No newline at end of file
Add Comment
Please, Sign In to add comment