Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- Index: java/net/sf/l2j/gameserver/model/actor/instance/PlayerBuffer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/PlayerBuffer.java (nonexistent)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/PlayerBuffer.java (working copy)
- @@ -0,0 +1,667 @@
- +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.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.BufferTable;
- +import net.sf.l2j.gameserver.data.SkillTable;
- +import net.sf.l2j.gameserver.model.L2Skill;
- +import net.sf.l2j.gameserver.model.actor.Creature;
- +import net.sf.l2j.gameserver.model.actor.Npc;
- +import net.sf.l2j.gameserver.model.actor.Summon;
- +import net.sf.l2j.gameserver.model.actor.ai.CtrlIntention;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- +import net.sf.l2j.gameserver.network.serverpackets.ItemList;
- +import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
- +import net.sf.l2j.gameserver.network.serverpackets.MoveToPawn;
- +import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
- +
- +/**
- + * @author Baggos
- + */
- +public final class PlayerBuffer extends Npc
- +{
- + public PlayerBuffer(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void onAction(Player player)
- + {
- + if (this != player.getTarget())
- + {
- + player.setTarget(this);
- + player.sendPacket(new MyTargetSelected(getObjectId(), 0));
- + player.sendPacket(new ValidateLocation(this));
- + }
- + else
- + {
- + if (!canInteract(player))
- + player.getAI().setIntention(CtrlIntention.INTERACT, this);
- + else
- + {
- + // Rotate the player to face the instance
- + player.sendPacket(new MoveToPawn(player, this, Npc.INTERACTION_DISTANCE));
- +
- + if (hasRandomAnimation())
- + onRandomAnimation(Rnd.get(8));
- +
- + showMainWindow(player);
- +
- + // Send ActionFailed to the player in order to avoid he stucks
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + }
- + }
- +
- + private void showMainWindow(Player activeChar)
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile("data/html/mods/buffer/index.htm");
- + 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.equalsIgnoreCase("bufflist"))
- + {
- + autoBuffFunction(player, st.nextToken());
- + }
- + else if (actualCommand.equalsIgnoreCase("restore"))
- + {
- + String noble = st.nextToken();
- + player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
- + player.setCurrentCp(player.getMaxCp());
- +
- + 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.getPet();
- + if (summon != null)
- + summon.setCurrentHpMp(summon.getMaxHp(), summon.getMaxMp());
- +
- + showMainWindow(player);
- + }
- + else if (actualCommand.equalsIgnoreCase("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.getPet();
- + if (summon != null)
- + summon.stopAllEffects();
- +
- + showMainWindow(player);
- + }
- + else if (actualCommand.equalsIgnoreCase("openlist"))
- + {
- + String category = st.nextToken();
- + String htmfile = st.nextToken();
- +
- + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- +
- + if (category.equalsIgnoreCase("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.equalsIgnoreCase("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().getInventoryItemCount(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().getInventoryItemCount(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.equalsIgnoreCase("pet"))
- + {
- + if (player.getPet() == null)
- + {
- + player.sendMessage("Incorrect Pet");
- + showMainWindow(player);
- + return;
- + }
- + target = player.getPet();
- + }
- +
- + 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.equalsIgnoreCase("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, st.nextToken());
- + }
- + else if (actualCommand.startsWith("givebuffs"))
- + {
- + final String targetType = st.nextToken();
- + final String schemeName = st.nextToken();
- + final int cost = Integer.parseInt(st.nextToken());
- +
- + final Creature target = (targetType.equalsIgnoreCase("pet")) ? player.getPet() : player;
- + if (target == null)
- + player.sendMessage("You don't have a pet.");
- + else if (cost == 0 || player.reduceAdena("NPC Buffer", cost, this, true))
- + {
- + for (int skillId : BufferTable.getInstance().getScheme(player.getObjectId(), schemeName))
- + SkillTable.getInstance().getInfo(skillId, SkillTable.getInstance().getMaxLevel(skillId)).getEffects(this, target);
- + }
- + showGiveBuffsWindow(player, targetType);
- + }
- + else if (actualCommand.startsWith("editschemes"))
- + {
- + if (st.countTokens() == 2)
- + showEditSchemeWindow(player, st.nextToken(), st.nextToken());
- + else
- + player.sendMessage("Something wrong with your scheme. Please contact with Admin");
- + }
- + else if (actualCommand.startsWith("skill"))
- + {
- + final String groupType = st.nextToken();
- + final String schemeName = st.nextToken();
- +
- + final int skillId = Integer.parseInt(st.nextToken());
- +
- + final List<Integer> skills = BufferTable.getInstance().getScheme(player.getObjectId(), schemeName);
- +
- + if (actualCommand.startsWith("skillselect") && !schemeName.equalsIgnoreCase("none"))
- + {
- + if (skills.size() < Config.PBUFFER_MAX_SKILLS)
- + 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);
- + }
- + else if (actualCommand.startsWith("manageschemes"))
- + {
- + showManageSchemeWindow(player);
- + }
- + 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.");
- + showManageSchemeWindow(player);
- + return;
- + }
- +
- + final Map<String, ArrayList<Integer>> schemes = BufferTable.getInstance().getPlayerSchemes(player.getObjectId());
- + if (schemes != null)
- + {
- + if (schemes.size() == Config.PBUFFER_MAX_SCHEMES)
- + {
- + player.sendMessage("Maximum schemes amount is already reached.");
- + showManageSchemeWindow(player);
- + return;
- + }
- +
- + if (schemes.containsKey(schemeName))
- + {
- + player.sendMessage("The scheme name already exists.");
- + showManageSchemeWindow(player);
- + return;
- + }
- + }
- +
- + BufferTable.getInstance().setScheme(player.getObjectId(), schemeName.trim(), new ArrayList<Integer>());
- + showManageSchemeWindow(player);
- + }
- + catch (Exception e)
- + {
- + player.sendMessage("Scheme's name must contain up to 14 chars. Spaces are trimmed.");
- + showManageSchemeWindow(player);
- + }
- + }
- + else if (actualCommand.startsWith("deletescheme"))
- + {
- + try
- + {
- + final String schemeName = st.nextToken();
- + final Map<String, ArrayList<Integer>> schemes = BufferTable.getInstance().getPlayerSchemes(player.getObjectId());
- +
- + if (schemes != null && schemes.containsKey(schemeName))
- + schemes.remove(schemeName);
- + }
- + catch (Exception e)
- + {
- + player.sendMessage("This scheme name is invalid.");
- + }
- + showManageSchemeWindow(player);
- + }
- + else if (actualCommand.startsWith("clearscheme"))
- + {
- + try
- + {
- + final String schemeName = st.nextToken();
- + final Map<String, ArrayList<Integer>> schemes = BufferTable.getInstance().getPlayerSchemes(player.getObjectId());
- +
- + if (schemes != null && schemes.containsKey(schemeName))
- + schemes.get(schemeName).clear();
- + }
- + catch (Exception e)
- + {
- + player.sendMessage("This scheme name is invalid.");
- + }
- + showManageSchemeWindow(player);
- + }
- + else
- + super.onBypassFeedback(player, command);
- + }
- +
- + /**
- + * Sends an html packet to player with Give Buffs menu info for player and pet, depending on targetType parameter {player, pet}
- + * @param player : The player to make checks on.
- + * @param targetType : a String used to define if the player or his pet must be used as target.
- + */
- + private void showGiveBuffsWindow(Player player, String targetType)
- + {
- + final StringBuilder sb = new StringBuilder(200);
- +
- + final Map<String, ArrayList<Integer>> schemes = BufferTable.getInstance().getPlayerSchemes(player.getObjectId());
- + if (schemes == null || schemes.isEmpty())
- + sb.append("<font color=\"LEVEL\">You haven't defined any scheme, please go to 'Manage my schemes' and create at least one valid scheme.</font>");
- + else
- + {
- + for (Map.Entry<String, ArrayList<Integer>> scheme : schemes.entrySet())
- + {
- + final int cost = getFee(scheme.getValue());
- + StringUtil.append(sb, "<font color=\"LEVEL\"><a action=\"bypass -h npc_%objectId%_givebuffs ", targetType, " ", scheme.getKey(), " ", cost, "\">", scheme.getKey(), " (", scheme.getValue().size(), " skill(s))</a>", ((cost > 0) ? " - Adena cost: " + cost : ""), "</font><br1>");
- + }
- + }
- +
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile("data/html/mods/buffer/schememanager/index-1.htm");
- + html.replace("%schemes%", sb.toString());
- + html.replace("%targettype%", (targetType.equalsIgnoreCase("pet") ? " <a action=\"bypass -h npc_%objectId%_support player\">yourself</a> | your pet" : "yourself | <a action=\"bypass -h npc_%objectId%_support pet\">your pet</a>"));
- + html.replace("%objectId%", getObjectId());
- + player.sendPacket(html);
- + }
- +
- + /**
- + * Sends an html packet to player with Manage scheme menu info. This allows player to create/delete/clear schemes
- + * @param player : The player to make checks on.
- + */
- + private void showManageSchemeWindow(Player player)
- + {
- + final StringBuilder sb = new StringBuilder(200);
- +
- + final Map<String, ArrayList<Integer>> schemes = BufferTable.getInstance().getPlayerSchemes(player.getObjectId());
- + if (schemes == null || schemes.isEmpty())
- + sb.append("<font color=\"LEVEL\">You haven't created any scheme.</font>");
- + else
- + {
- + sb.append("<table>");
- + for (Map.Entry<String, ArrayList<Integer>> scheme : schemes.entrySet())
- + StringUtil.append(sb, "<tr><td width=140>", scheme.getKey(), " (", scheme.getValue().size(), " skill(s))</td><td width=60><button value=\"Clear\" action=\"bypass -h npc_%objectId%_clearscheme ", scheme.getKey(), "\" width=55 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td width=60><button value=\"Drop\" action=\"bypass -h npc_%objectId%_deletescheme ", scheme.getKey(), "\" width=55 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
- +
- + sb.append("</table>");
- + }
- +
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile("data/html/mods/buffer/schememanager/index-2.htm");
- + html.replace("%schemes%", sb.toString());
- + html.replace("%max_schemes%", Config.PBUFFER_MAX_SCHEMES);
- + html.replace("%objectId%", getObjectId());
- + player.sendPacket(html);
- + }
- +
- + /**
- + * This sends an html packet to player with Edit Scheme Menu info. This allows player to edit each created scheme (add/delete skills)
- + * @param player : The player to make checks on.
- + * @param groupType : The group of skills to select.
- + * @param schemeName : The scheme to make check.
- + */
- + private void showEditSchemeWindow(Player player, String groupType, String schemeName)
- + {
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- +
- + if (schemeName.equalsIgnoreCase("none"))
- + html.setFile("data/html/mods/buffer/schememanager/index-3.htm");
- + else
- + {
- + if (groupType.equalsIgnoreCase("none"))
- + html.setFile("data/html/mods/buffer/schememanager/index-4.htm");
- + else
- + {
- + html.setFile("data/html/mods/buffer/schememanager/index-5.htm");
- + html.replace("%skilllistframe%", getGroupSkillList(player, groupType, schemeName));
- + }
- + html.replace("%schemename%", schemeName);
- + html.replace("%myschemeframe%", getPlayerSchemeSkillList(player, groupType, schemeName));
- + html.replace("%typesframe%", getTypesFrame(groupType, schemeName));
- + }
- + html.replace("%schemes%", getPlayerSchemes(player, schemeName));
- + html.replace("%objectId%", getObjectId());
- + player.sendPacket(html);
- + }
- +
- + /**
- + * @param player : The player to make checks on.
- + * @param schemeName : The name to don't link (previously clicked).
- + * @return a String listing player's schemes. The scheme currently on selection isn't linkable.
- + */
- + private static String getPlayerSchemes(Player player, String schemeName)
- + {
- + final Map<String, ArrayList<Integer>> schemes = BufferTable.getInstance().getPlayerSchemes(player.getObjectId());
- + if (schemes == null || schemes.isEmpty())
- + return "Please create at least one scheme.";
- +
- + final StringBuilder sb = new StringBuilder(200);
- + sb.append("<table>");
- +
- + for (Map.Entry<String, ArrayList<Integer>> scheme : schemes.entrySet())
- + {
- + if (schemeName.equalsIgnoreCase(scheme.getKey()))
- + StringUtil.append(sb, "<tr><td width=200>", scheme.getKey(), " (<font color=\"LEVEL\">", scheme.getValue().size(), "</font> / ", Config.PBUFFER_MAX_SKILLS, " skill(s))</td></tr>");
- + else
- + StringUtil.append(sb, "<tr><td width=200><a action=\"bypass -h npc_%objectId%_editschemes none ", scheme.getKey(), "\">", scheme.getKey(), " (", scheme.getValue().size(), " / ", Config.PBUFFER_MAX_SKILLS, " skill(s))</a></td></tr>");
- + }
- +
- + sb.append("</table>");
- +
- + return sb.toString();
- + }
- +
- + /**
- + * @param player : The player to make checks on.
- + * @param groupType : The group of skills to select.
- + * @param schemeName : The scheme to make check.
- + * @return a String representing skills available to selection for a given groupType.
- + */
- + private static String getGroupSkillList(Player player, String groupType, String schemeName)
- + {
- + final List<Integer> skills = new ArrayList<>();
- + for (int skillId : BufferTable.getSkillsIdsByType(groupType))
- + {
- + if (BufferTable.getInstance().getSchemeContainsSkill(player.getObjectId(), schemeName, skillId))
- + continue;
- +
- + skills.add(skillId);
- + }
- +
- + if (skills.isEmpty())
- + return "That group doesn't contain any skills.";
- +
- + final StringBuilder sb = new StringBuilder(500);
- +
- + sb.append("<table>");
- + int count = 0;
- + for (int skillId : skills)
- + {
- + if (BufferTable.getInstance().getSchemeContainsSkill(player.getObjectId(), schemeName, skillId))
- + continue;
- +
- + if (count == 0)
- + sb.append("<tr>");
- +
- + if (skillId < 100)
- + sb.append("<td width=180><font color=\"949490\"><a action=\"bypass -h npc_%objectId%_skillselect " + groupType + " " + schemeName + " " + skillId + "\">" + SkillTable.getInstance().getInfo(skillId, 1).getName() + "</a></font></td>");
- + else if (skillId < 1000)
- + sb.append("<td width=180><font color=\"949490\"><a action=\"bypass -h npc_%objectId%_skillselect " + groupType + " " + schemeName + " " + skillId + "\">" + SkillTable.getInstance().getInfo(skillId, 1).getName() + "</a></font></td>");
- + else
- + sb.append("<td width=180><font color=\"949490\"><a action=\"bypass -h npc_%objectId%_skillselect " + groupType + " " + schemeName + " " + skillId + "\">" + SkillTable.getInstance().getInfo(skillId, 1).getName() + "</a></font></td>");
- +
- + count++;
- + if (count == 2)
- + {
- + sb.append("</tr><tr><td></td></tr>");
- + count = 0;
- + }
- + }
- +
- + if (!sb.toString().endsWith("</tr>"))
- + sb.append("</tr>");
- +
- + sb.append("</table>");
- +
- + return sb.toString();
- + }
- +
- + /**
- + * @param player : The player to make checks on.
- + * @param groupType : The group of skills to select.
- + * @param schemeName : The scheme to make check.
- + * @return a String representing a given scheme's content.
- + */
- + private static String getPlayerSchemeSkillList(Player player, String groupType, String schemeName)
- + {
- + final List<Integer> skills = BufferTable.getInstance().getScheme(player.getObjectId(), schemeName);
- + if (skills.isEmpty())
- + return "That scheme is empty.";
- +
- + final StringBuilder sb = new StringBuilder(500);
- + sb.append("<table>");
- + int count = 0;
- +
- + for (int sk : skills)
- + {
- + if (count == 0)
- + sb.append("<tr>");
- +
- + if (sk < 100)
- + sb.append("<td width=180><font color=\"6e6e6a\"><a action=\"bypass -h npc_%objectId%_skillunselect " + groupType + " " + schemeName + " " + sk + "\">" + SkillTable.getInstance().getInfo(sk, 1).getName() + "</a></font></td>");
- + else if (sk < 1000)
- + sb.append("<td width=180><font color=\"6e6e6a\"><a action=\"bypass -h npc_%objectId%_skillunselect " + groupType + " " + schemeName + " " + sk + "\">" + SkillTable.getInstance().getInfo(sk, 1).getName() + "</a></font></td>");
- + else
- + sb.append("<td width=180><font color=\"6e6e6a\"><a action=\"bypass -h npc_%objectId%_skillunselect " + groupType + " " + schemeName + " " + sk + "\">" + SkillTable.getInstance().getInfo(sk, 1).getName() + "</a></font></td>");
- +
- + count++;
- + if (count == 2)
- + {
- + sb.append("</tr><tr><td></td></tr>");
- + count = 0;
- + }
- + }
- +
- + if (!sb.toString().endsWith("<tr>"))
- + sb.append("<tr>");
- +
- + sb.append("</table>");
- +
- + return sb.toString();
- + }
- +
- + /**
- + * @param groupType : The group of skills to select.
- + * @param schemeName : The scheme to make check.
- + * @return a string representing all groupTypes availables. 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 s : BufferTable.getSkillTypes())
- + {
- + if (count == 0)
- + sb.append("<tr>");
- +
- + if (groupType.equalsIgnoreCase(s))
- + StringUtil.append(sb, "<td width=65>", s, "</td>");
- + else
- + StringUtil.append(sb, "<td width=65><a action=\"bypass -h npc_%objectId%_editschemes ", s, " ", schemeName, "\">", s, "</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 list of skill ids.
- + * @return a global fee for all skills contained in 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)
- + {
- + if (Config.PBUFFER_BUFFLIST.get(sk) == null)
- + continue;
- +
- + fee += Config.PBUFFER_BUFFLIST.get(sk).getValue();
- + }
- +
- + 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
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 4)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -774,6 +774,26 @@
- public static boolean DIVINE_SP_BOOK_NEEDED;
- public static boolean ALT_GAME_SUBCLASS_WITHOUT_QUESTS;
- + /** 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;
- +
- /** Buffs */
- public static boolean STORE_SKILL_COOLTIME;
- public static int BUFFS_MAX_AMOUNT;
- @@ -2103,6 +2123,45 @@
- DIVINE_SP_BOOK_NEEDED = players.getProperty("DivineInspirationSpBookNeeded", true);
- ALT_GAME_SUBCLASS_WITHOUT_QUESTS = players.getProperty("AltSubClassWithoutQuests", false);
- + PBUFFER_MAX_SCHEMES = players.getProperty("BufferMaxSchemesPerChar", 4);
- + PBUFFER_MAX_SKILLS = players.getProperty("BufferMaxSkillsPerScheme", 24);
- + PBUFFER_STATIC_BUFF_COST = players.getProperty("BufferStaticCostPerBuff", -1);
- + PBUFFER_BUFFS = players.getProperty("BufferBuffs");
- +
- + PFIGHTER_SET = players.getProperty("FighterSet", "2375,3500,3501,3502,4422,4423,4424,4425,6648,6649,6650");
- + PMAGE_SET = players.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]), infos[2], skillInfo));
- + }
- +
- + PRESTRICT_USE_BUFFER_ON_PVPFLAG = players.getProperty("RestrictUseBufferOnPvPFlag", true);
- + PRESTRICT_USE_BUFFER_IN_COMBAT = players.getProperty("RestrictUseBufferInCombat", true);
- +
- + PVOTE_BUFF_ITEM_ID = players.getProperty("VoteBuffItemId", 57);
- + PVOTE_BUFF_ITEM_COUNT = players.getProperty("VoteBuffItemCount", 1);
- +
- + PFIGHTER_SKILL_LIST = new ArrayList<>();
- + for (String skill_id : players.getProperty("FighterSkillList", "").split(";"))
- + PFIGHTER_SKILL_LIST.add(Integer.parseInt(skill_id));
- +
- + PMAGE_SKILL_LIST = new ArrayList<>();
- + for (String skill_id : players.getProperty("MageSkillList", "").split(";"))
- + PMAGE_SKILL_LIST.add(Integer.parseInt(skill_id));
- +
- BUFFS_MAX_AMOUNT = players.getProperty("MaxBuffsAmount", 20);
- STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);
- Index: config/players.properties
- ===================================================================
- --- config/players.properties (revision 4)
- +++ config/players.properties (working copy)
- @@ -241,6 +241,33 @@
- AltSubClassWithoutQuests = True
- #=============================================================
- +# 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,buffPrice,type.
- +BufferBuffs = 264,0,Songs;265,0,Songs;266,0,Songs;267,0,Songs;268,0,Songs;269,0,Songs;270,0,Songs;304,0,Songs;305,0,Songs;306,0,Songs;308,0,Songs;349,0,Songs;363,0,Songs;364,0,Songs;271,0,Dances;272,0,Dances;273,0,Dances;274,0,Dances;275,0,Dances;276,0,Dances;277,0,Dances;309,0,Dances;310,0,Dances;311,0,Dances;307,0,Dances;365,0,Dances;1002,0,Warcryer;1006,0,Warcryer;1007,0,Warcryer;1009,0,Warcryer;1308,0,Warcryer;1309,0,Warcryer;1310,0,Warcryer;1362,0,Warcryer;1390,0,Warcryer;1391,0,Warcryer;1413,0,Warcryer;1416,0,Overlord;1003,0,Overlord;1004,0,Overlord;1005,0,Overlord;1008,0,Overlord;1249,0,Overlord;1364,0,Overlord;1365,0,Overlord;1032,0,Prophet;1033,0,Prophet;1035,0,Prophet;1036,0,Prophet;1040,0,Prophet;1043,0,Prophet;1044,0,Prophet;1045,0,Prophet;1048,0,Prophet;1059,0,Shillen_Elder;1062,0,Prophet;1068,0,Prophet;1073,0,Elder;1077,0,Shillen_Elder;1078,0,Shillen_Elder;1085,0,Prophet;1086,0,Prophet;1087,0,Elder;1182,0,Elder;1189,0,Shillen_Elder;1191,0,Prophet;1204,0,Prophet;1242,0,Shillen_Elder;1243,0,Prophet;1259,0,Elder;1268,0,Shillen_Elder;1303,0,Shillen_Elder;1304,0,Elder;1352,0,Elder;1353,0,Elder;1354,0,Elder;1388,0,Shillen_Elder;1389,0,Shillen_Elder;1392,0,Prophet;1393,0,Elder;1397,0,Elder;1355,0,Elder;4699,0,Elder;4700,0,Elder;4702,0,Elder;4703,0,Elder;1356,0,Prophet;1357,0,Shillen_Elder;1363,0,Warcryer;1414,0,Overlord
- +
- +RestrictUseBufferOnPvPFlag = true
- +RestrictUseBufferInCombat = true
- +
- +VoteBuffItemId = 57
- +VoteBuffItemCount = 15
- +
- +#=============================================================
- # Buffs config
- #=============================================================
- #P aCis_datapack
- Index: data/xml/buffer_skills.xml
- ===================================================================
- --- data/xml/buffer_skills.xml (revision 4)
- +++ data/xml/buffer_skills.xml (working copy)
- @@ -25,18 +25,12 @@
- <buff id="1352" price="0" desc="Increases resistance to atures." /> <!-- Elemental Protection -->
- <buff id="1353" price="0" desc="Increases resistance to dark attack." /> <!-- Divine Protection -->
- <buff id="1354" price="0" desc="Increases resistance to de-buff attack." /> <!-- Arcane Protection -->
- - <buff id="1355" price="0" desc="Increases mage abilities." /> <!-- Prophecy of Water -->
- - <buff id="1356" price="0" desc="Increases fighter abilities." /> <!-- Prophecy of Fire -->
- - <buff id="1357" price="0" desc="Increases dagger abilities." /> <!-- Prophecy of Wind -->
- - <buff id="1363" price="0" desc="Increases combat abilities." /> <!-- Chant of Victory -->
- <buff id="1388" price="0" desc="Increases P. Atk." /> <!-- Greater Might -->
- <buff id="1389" price="0" desc="Increases P. Def." /> <!-- Greater Shield -->
- - <buff id="1390" price="0" desc="Increases P. Atk." /> <!-- War Chant -->
- - <buff id="1391" price="0" desc="Increases P. Def." /> <!-- Earth Chant -->
- - <buff id="1397" price="0" desc="Decreases MP consumption rate." /> <!-- Clarity -->
- + <buff id="1363" price="0" desc="Increases fighter abilities." /> <!-- Victory Chant -->
- <buff id="1413" price="0" desc="Increases mage abilities." /> <!-- Magnus' Chant -->
- </category>
- - <category type="Dances">
- + <category type="Other">
- <buff id="271" price="0" desc="Increases P. Atk." /> <!-- Dance of the Warrior -->
- <buff id="272" price="0" desc="Increases Accuracy." /> <!-- Dance of Inspiration -->
- <buff id="273" price="0" desc="Increases M. Atk." /> <!-- Dance of the Mystic -->
- @@ -49,8 +43,6 @@
- <buff id="310" price="0" desc="Restores HP by inflicted damage." /> <!-- Dance of the Vampire -->
- <buff id="311" price="0" desc="Increases resistance to terrain damage." /> <!-- Dance of Protection -->
- <buff id="365" price="0" desc="Increases rate of magic crit. damage." /> <!-- Siren's Dance -->
- - </category>
- - <category type="Songs">
- <buff id="264" price="0" desc="Increases P. Def." /> <!-- Song of Earth -->
- <buff id="265" price="0" desc="Increases HP regeneration." /> <!-- Song of Life -->
- <buff id="266" price="0" desc="Increases Evasion." /> <!-- Song of Water -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement