Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2_GameServer_freya
- Index: java/com/l2jserver/gameserver/model/ItemBypass.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/ItemBypass.java (revision 0)
- +++ java/com/l2jserver/gameserver/model/ItemBypass.java (revision 0)
- @@ -0,0 +1,652 @@
- +package com.l2jserver.gameserver.model;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.sql.SQLException;
- +import java.util.Map;
- +
- +import javolution.text.TextBuilder;
- +import javolution.util.FastList;
- +import javolution.util.FastMap;
- +import com.l2jserver.Config;
- +import com.l2jserver.L2DatabaseFactory;
- +import com.l2jserver.gameserver.TradeController;
- +import com.l2jserver.gameserver.datatables.HennaTreeTable;
- +import com.l2jserver.gameserver.datatables.ItemTable;
- +import com.l2jserver.gameserver.datatables.SkillTable;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.model.entity.TvTEvent;
- +import com.l2jserver.gameserver.network.SystemMessageId;
- +import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
- +import com.l2jserver.gameserver.network.serverpackets.BuyList;
- +import com.l2jserver.gameserver.network.serverpackets.ExShowVariationCancelWindow;
- +import com.l2jserver.gameserver.network.serverpackets.ExShowVariationMakeWindow;
- +import com.l2jserver.gameserver.network.serverpackets.HennaEquipList;
- +import com.l2jserver.gameserver.network.serverpackets.HennaRemoveList;
- +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
- +import com.l2jserver.gameserver.network.serverpackets.SortedWareHouseWithdrawalList;
- +import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
- +import com.l2jserver.gameserver.network.serverpackets.WareHouseDepositList;
- +import com.l2jserver.gameserver.network.serverpackets.WareHouseWithdrawalList;
- +import com.l2jserver.gameserver.network.serverpackets.SortedWareHouseWithdrawalList.WarehouseListType;
- +import com.l2jserver.gameserver.datatables.MultiSell;
- +import com.l2jserver.gameserver.model.actor.L2Npc;
- +
- +
- +
- +/**
- + *
- + * @author BiggBoss
- + *
- + */
- +
- +public class ItemBypass {
- +
- + /* Constants */
- + private static final String _headHtml = "<html><title>AIO Item</title><body><center><br>";
- + private static final String _endHtml = "</center></body></html>";
- +
- + /* Maps, Lists and Arrays to hold the data */
- + protected static Map<String, FastMap<String, Integer[]>> _teleports = new FastMap<String, FastMap<String, Integer[]>>();
- + protected static Map<String, FastMap<String, Integer[]>> _buffs = new FastMap<String, FastMap<String, Integer[]>>();
- +
- + private static int _pagesPerTp;
- + private static int _pagesPerBuffs;
- + private static final int _coinpertp = Config.AIO_TPCOIN;
- + private static final int _coinperbuff = Config.AIO_BUFFCOIN;
- + /* Pice for teleport */
- + private static final int _tpprice = Config.AIO_PRICE_PERTP;
- + /* Price per buff */
- + private static final int _buffprice = Config.AIO_PRICE_PERBUFF;
- + private static final L2Npc target = null;
- +
- + /* Enum to diference betwen the diferent packets */
- + private enum Packet {
- + DYNAMIC,
- + FILE,
- + PREDEFINED
- + }
- + private ItemBypass() {
- +
- + }
- +
- + /**
- + * Send a packet with the html file to show
- + * @param player
- + * @param tb
- + */
- + private static void sendPacket(L2PcInstance player, String html, Packet packet) {
- + NpcHtmlMessage msg = new NpcHtmlMessage(5);
- + if(packet.equals(Packet.FILE))
- + msg.setFile(player.getHtmlPrefix(),"/data/html/AIOItem/" + html);
- + else if(packet.equals(Packet.DYNAMIC))
- + msg.setHtml(html);
- + player.sendPacket(msg);
- + }
- +
- + /**
- + * Load all necessary data to use and modify the item
- + */
- + public static void loadData() {
- + byte counter = 0;
- + System.out.println("----------------------------------------------");
- + System.out.println("Loading AIO Item data. Info:");
- + System.out.println("----------------------------------------------");
- +
- + try {
- + Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("SELECT category FROM aio_teleports");
- + ResultSet rset = statement.executeQuery();
- +
- + while(rset.next()) {
- + String tpcategory = rset.getString("category");
- +
- + Connection con2 = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement2 = con2.prepareStatement("SELECT tpname, x, y, z FROM aio_teleports WHERE category = ?");
- + statement2.setString(1, tpcategory);
- + ResultSet rset2 = statement2.executeQuery();
- + FastMap <String, Integer[]> temptp = new FastMap<String, Integer[]>();
- +
- + while(rset2.next()) {
- + String tpname = rset2.getString("tpname");
- + Integer[] coords = new Integer[3];
- + coords[0] = rset2.getInt("x");
- + coords[1] = rset2.getInt("y");
- + coords[2] = rset2.getInt("z");
- + temptp.put(tpname, coords);
- + }
- + con2.close();
- + statement2.close();
- + rset2.close();
- + _teleports.put(tpcategory, temptp);
- + }
- + con.close();
- + statement.close();
- + rset.close();
- + }
- + catch(SQLException e) {
- + counter += 1;
- + e.printStackTrace();
- + }
- + int c = 0;
- + System.out.println("Loaded " + _teleports.keySet().size() + " teleport categories for the AIO Item");
- + for(String st : _teleports.keySet()) {
- + c += _teleports.get(st).keySet().size();
- + }
- + System.out.println("Loaded " + c + " teleport spawnpoints for the AIO Item");
- +
- + try {
- + Connection con3 = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement3 = con3.prepareStatement("SELECT category FROM aio_buffs");
- + ResultSet rset3 = statement3.executeQuery();
- +
- + while(rset3.next()) {
- + String bcategory = rset3.getString("category");
- +
- + Connection con4 = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement4 = con4.prepareStatement("SELECT buff_name, buff_id, buff_lvl FROM aio_buffs WHERE category = ?");
- + statement4.setString(1, bcategory);
- + ResultSet rset4 = statement4.executeQuery();
- + FastMap<String, Integer[]> tempbuff = new FastMap<String, Integer[]>();
- +
- + while(rset4.next()) {
- + String bname = rset4.getString("buff_name");
- + Integer[] ar = new Integer[2];
- + ar[0] = rset4.getInt("buff_id");
- + ar[1] = rset4.getInt("buff_lvl");
- + tempbuff.put(bname, ar);
- + }
- + con4.close();
- + statement4.close();
- + rset4.close();
- + _buffs.put(bcategory, tempbuff);
- + }
- + con3.close();
- + statement3.close();
- + rset3.close();
- + }
- + catch(SQLException e) {
- + counter += 2;
- + e.printStackTrace();
- + }
- + int i = 0;
- + System.out.println("Loaded " + _buffs.keySet().size() + " buffs categories for the AIO Item");
- + for(String st : _buffs.keySet()) {
- + i += _buffs.get(st).keySet().size();
- + }
- + System.out.println("Loaded " + i + " buffs for the AIO Item");
- +
- + if(counter == 0)
- + System.out.println("AIO Item loaded sucesfully!");
- + else
- + switch(counter) {
- + case 1:
- + System.out.println("There was a problem loading Teleports. Check what did you enter on aio_teleports.");
- + break;
- + case 2:
- + System.out.println("There was a problem loading Buffs. Check what did you enter on aio_buffs.");
- + break;
- + default:
- + System.out.println("Something was wrong during AIO item load. Check the console.");
- + }
- + System.out.println("----------------------------------------------");
- + }
- +
- + /**
- + * Manages all bypasses for normal players
- + * @param player
- + * @param command
- + */
- + public static void onBypassFeedback(L2PcInstance player, String command) {
- +
- + //No null pointers
- + if(player == null) return;
- +
- + if(player.isInOlympiadMode()) {
- + player.sendMessage("Cannot use while in Olympiad");
- + return;
- + }
- + else if(player.getKarma() > 0) {
- + player.sendMessage("Cannot use while hava karma");
- + return;
- + }
- + else if(player.isInJail()) {
- + player.sendMessage("Cannot use while in Jail");
- + return;
- + }
- + else if(player.isDead()) return;
- + else if(TvTEvent.isPlayerParticipant(player.getObjectId())) {
- + player.sendMessage("Cannot use while in TvT");
- + return;
- + }
- + else if(player.isInCombat()) {
- + player.sendMessage("Cannot use while in combat");
- + return;
- + }
- +
- + if(player.getTarget() != player) {
- + player.sendMessage("Taget yourself to use the AIO Item");
- + return;
- + }
- +
- + long pAdena = player.getAdena();
- + String[] subCommand = command.split("_");
- + WarehouseListType itemtype = null;
- +
- + /* Warehouse */
- +
- + if(command.startsWith("warehouse"))
- + showWarehouseWindow(player);
- + else if(command.startsWith("nwidraw")) {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + player.setActiveWarehouse(player.getWarehouse());
- + if(pAdena == 0 || player.getInventory().getItemByItemId(57) == null) {
- + player.sendMessage("You dont have adena to afford the transaction");
- + return;
- + }
- + if(player.getWarehouse().getSize() == 0) {
- + player.sendPacket(new SystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
- + return;
- + }
- + else {
- + player.setIsUsingAioWh(true);
- + if (itemtype != null)
- + player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE, itemtype, (byte) 0));
- + else
- + player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE));
- +
- + }
- + }
- + else if(command.startsWith("ndeposit")) {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + player.setActiveWarehouse(player.getWarehouse());
- + if(player.getWarehouse().getSize() == player.getWareHouseLimit()) {
- + player.sendMessage("The warehouse is full");
- + return;
- + }
- + else {
- + player.setIsUsingAioWh(true);
- + player.tempInventoryDisable();
- + player.sendPacket(new WareHouseDepositList(player, WareHouseDepositList.PRIVATE));
- + }
- + }
- + else if(command.startsWith("clanwidraw")) {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + player.setActiveWarehouse(player.getClan().getWarehouse());
- + if(!player.isClanLeader() || player.getClan() == null ) {
- + player.sendMessage("You are not the clan leader");
- + return;
- + }
- + else if(player.getClan().getWarehouse().getSize() == 0) {
- + player.sendPacket(new SystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
- + return;
- + }
- + else if ((player.getClanPrivileges() & L2Clan.CP_CL_VIEW_WAREHOUSE) != L2Clan.CP_CL_VIEW_WAREHOUSE) {
- + player.sendPacket(new SystemMessage(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_CLAN_WAREHOUSE));
- + return;
- + }
- + else if(player.getClan().getLevel() == 0) {
- + player.sendMessage("Only clan with lvl 1 or avobe can use clan warehouse");
- + return;
- + }
- + else {
- + player.setIsUsingAioWh(true);
- + player.setActiveWarehouse(player.getClan().getWarehouse());
- +
- + if (itemtype != null)
- + player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN, itemtype, (byte) 0));
- + else
- + player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN));
- + }
- + }
- +
- + else if(command.startsWith("clandeposit")) {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + player.setActiveWarehouse(player.getClan().getWarehouse());
- + if(!player.isClanLeader() || player.getClan() == null ) {
- + player.sendMessage("You are not the clan leader");
- + return;
- + }
- + else {
- + player.setIsUsingAioWh(true);
- + player.setActiveWarehouse(player.getClan().getWarehouse());
- + player.tempInventoryDisable();
- + player.sendPacket(new WareHouseDepositList(player, WareHouseDepositList.CLAN));
- + }
- + }
- +
- + /* Gatekeeper */
- +
- + else if(command.startsWith("showTeleportWindow")) {
- + if(player.getPvpFlag() > 0) {
- + player.sendMessage("Cannot teleport while in pvp");
- + return;
- + }
- + else
- + showTeleportWindow(player);
- + }
- + else if(command.startsWith("tpcategory"))
- + showTeleportCategoryWindow(player, subCommand[1], 1);
- +
- + else if(command.startsWith("teleportTo")) {
- + if(player.getInventory().getItemByItemId(_coinpertp) == null) {
- + player.sendMessage("You dont have the necessary items");
- + return;
- + }
- + else if(player.getInventory().getItemByItemId(_coinpertp).getCount() < _tpprice) {
- + player.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_ITEMS));
- + return;
- + }
- +
- + int x = Integer.valueOf(subCommand[1]);
- + int y = Integer.valueOf(subCommand[2]);
- + int z = Integer.valueOf(subCommand[3]);
- +
- + player.destroyItemByItemId("AIO Teleport", _coinpertp, _tpprice, player, true);
- + player.teleToLocation(x, y, z);
- + }
- +
- + // Page navigation
- + else if(command.startsWith("Chat")) {
- + if(subCommand[1].isEmpty() || subCommand[1] == null) return;
- +
- + String file = "data/html/AIOItem/"+subCommand[1];
- + NpcHtmlMessage msg = new NpcHtmlMessage(5);
- + msg.setFile(player.getHtmlPrefix(),file);
- + player.sendPacket(msg);
- + }
- +
- + /* GM Shop */
- +
- + else if(command.startsWith("showShopWindow")) {
- + if(player.getPvpFlag() > 0 || pAdena == 0) {
- + player.sendMessage("You dont have adena!");
- + return;
- + }
- +
- + String buyHtml = "data/html/AIOItem/GMShop.htm";
- + NpcHtmlMessage msg = new NpcHtmlMessage(5);
- + msg.setFile(player.getHtmlPrefix(),buyHtml);
- + player.sendPacket(msg);
- + }
- + else if(command.startsWith("showBuyWindow")){
- + int val = Integer.valueOf(subCommand[1]);
- + showBuyWindow(player, val);
- + }
- +
- + else if(command.startsWith("showMultiSellWindow")) {
- + int multi = Integer.valueOf(subCommand[1]);
- + player.setIsUsingAioMultisell(true);
- + MultiSell.getInstance().separateAndSend(multi, player, target , false);
- + }
- +
- + /* Buffer */
- +
- + else if(command.startsWith("ShowBuffWindow"))
- + showBuffsPage(player);
- + else if(command.startsWith("showBuffCategory")){
- + showBuffsPage(player, subCommand[1], Integer.valueOf(subCommand[2]));
- + }
- + else if(command.startsWith("buffMe")) {
- + if(player.getInventory().getItemByItemId(_coinperbuff).getCount() < _buffprice) {
- + player.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_REQUIRED_ITEMS));
- + return;
- + }
- + else {
- + player.destroyItemByItemId("AIO Buffer", _coinperbuff, _buffprice, player, true);
- + SkillTable.getInstance().getInfo(_buffs.get(subCommand[1]).get(subCommand[2])[0], _buffs.get(subCommand[1]).get(subCommand[2])[1]).getEffects(player, player);
- + showBuffsPage(player, subCommand[1], 1);
- + }
- + }
- +
- + /* TvT Manager */
- +
- + else if(command.startsWith("tvtinfo")) {
- + showTvTInfoPage(player);
- + }
- + else if(command.startsWith("tvtjoin")) {
- + if(subCommand[1].equals("reg"))
- + TvTEvent.onBypass("tvt_event_participation", player);
- + else if(subCommand[1].equals("unreg"))
- + TvTEvent.onBypass("tvt_event_remove_participation", player);
- + else
- + return;
- + }
- +
- + /* Augmentation, Symbol drawer, Gold Bar Trader */
- +
- + else if(command.startsWith("augment")) {
- + player.sendPacket(new ExShowVariationMakeWindow());
- + }
- + else if(command.startsWith("unAugment")) {
- + player.sendPacket(new ExShowVariationCancelWindow());
- + }
- + else if(command.startsWith("drawSymbol")) {
- + L2HennaInstance[] tato = HennaTreeTable.getInstance().getAvailableHenna(player.getClassId());
- + player.sendPacket(new HennaEquipList(player, tato));
- + }
- + else if(command.startsWith("removeSymbol")) {
- + boolean hasHennas = false;
- +
- + for (int i = 1; i <= 3; i++)
- + {
- + L2HennaInstance henna = player.getHenna(i);
- +
- + if (henna != null)
- + hasHennas = true;
- + }
- + if (hasHennas)
- + player.sendPacket(new HennaRemoveList(player));
- + }
- + else if(command.startsWith("adenaToBars")) {
- + if(pAdena > Config.AIOADENA_PERBAR) {
- + player.destroyItemByItemId("Aio Item", 57, Config.AIOADENA_PERBAR, player, true);
- + player.addItem("Aio Item", Config.AIO_GBAR, 1, player, true);
- + }
- + else
- + player.sendMessage("Not Enough adena to complete the transaction");
- +
- + sendPacket(player, "services.htm", Packet.FILE);
- + }
- + else if(command.startsWith("barsToAdena")) {
- + if(player.getInventory().getItemByItemId(Config.AIO_GBAR) != null) {
- + if(player.getInventory().getItemByItemId(Config.AIO_GBAR).getCount() >= 1) {
- + player.destroyItemByItemId("Aio Item", Config.AIO_GBAR, 1, player, true);
- + player.addItem("Aio Item", 57, Config.AIOADENA_PERBAR, player, true);
- + }
- + }
- + else
- + player.sendMessage("Not enough " + ItemTable.getInstance().getTemplate(Config.AIO_GBAR).getName());
- +
- + sendPacket(player, "services.htm", Packet.FILE);
- + }
- + }
- +
- + private static Object getCastle() {
- + // TODO Auto-generated method stub
- + return null;
- + }
- +
- + private static int getNpcId() {
- + // TODO Auto-generated method stub
- + return 0;
- + }
- +
- + /**
- + * TvT Manager
- + * @param player
- + */
- + private static void showTvTInfoPage(L2PcInstance player) {
- + TextBuilder tb = new TextBuilder();
- + tb.append(_headHtml);
- + if(TvTEvent.isParticipating()) {
- + tb.append("TvT did not start yet!.<br1>");
- + if(!TvTEvent.isPlayerParticipant(player.getObjectId())) {
- + tb.append("Do you want to participate? Click <font color=LEVEL>Ok!</font> to<br1>");
- + tb.append("join the event!");
- + tb.append("<button value=\"Ok!\" action=\"bypass -h Aioitem_tvtjoin_reg\" width=120 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
- + }
- + else {
- + tb.append("You are alredy participating. Do you<br1>");
- + tb.append("want to unregister? Click the below button<br>");
- + tb.append("<button value=\"Unregister\" action=\"bypass -h Aioitem_tvtjoin_unreg\" width=120 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
- + }
- + }
- + else if(TvTEvent.isStarted()) {
- + tb.append("TvT alredy started. You can not join<br1>");
- + tb.append("join at this momment. But you can see the<br1>");
- + tb.append("stats:<br>");
- + for(String st : TvTEvent.getTeamNames()) {
- + tb.append("<font color=LEVEL>" + st + ":</font><br1>");
- + tb.append("- Participants: <font color=\"0000FF\">" + TvTEvent.getTeamsPlayerCounts()[0] +"</font><br1>");
- + tb.append("- Kills: <font color=\"0000FF\">" + TvTEvent.getTeamsPoints()[0] +"</font><br1>");
- + tb.append("- Deads: <font color=\"0000FF\">" + TvTEvent.getTeamsPoints()[1] +"</font><br>");
- + }
- + }
- + else {
- + tb.append("TvT is not avaliable at this moment!<br1>");
- + tb.append("Wait till it starts!");
- + }
- + tb.append(_endHtml);
- +
- + sendPacket(player, tb.toString(), Packet.DYNAMIC);
- + }
- +
- + /**
- + * Buffer
- + * @param player
- + * @param string
- + * @param val
- + */
- + private static void showBuffsPage(L2PcInstance player, String string, int val) {
- +
- + FastMap<String, Integer[]> temp = _buffs.get(string);
- + FastList<String> buff = new FastList<String>();
- + buff.addAll(_buffs.get(string).keySet());
- + _pagesPerBuffs = Math.round((buff.size() / 15));
- +
- + TextBuilder tb = new TextBuilder();
- + tb.append(_headHtml);
- + tb.append("Choose between the below buffs:<br>");
- + tb.append("<table width = 240 height = 32>");
- + for(String st : buff.subList((val * 15) - 15, getMaxRange(buff, ((val * 15) * 2) - 15))) {
- + tb.append("<tr>");
- + if(temp.get(st)[0] < 1000)
- + tb.append("<td><img src=\"icon.skill0" + temp.get(st)[0] + "\" width=32 height=32></td>");
- + else
- + tb.append("<td><img src=\"icon.skill" +temp.get(st)[0] + "\" width=32 height=32></td>");
- + tb.append("<td><button value=\"" + st + "\" action=\"bypass -h Aioitem_buffMe_" + string + "_" + st + "\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>");
- + if(temp.get(st)[0] < 1000)
- + tb.append("<td><img src=\"icon.skill0" + temp.get(st)[0] + "\" width=32 height=32></td>");
- + else
- + tb.append("<td><img src=\"icon.skill" +temp.get(st)[0] + "\" width=32 height=32></td>");
- +
- + tb.append("</tr>");
- + }
- + tb.append("</table>");
- + for(int i = 1; i<_pagesPerBuffs; i++) {
- + tb.append("<a action=\"bypass -h Aioitem_showBuffCategory_" + string + "_" + i +"\">" + i + "</a>");
- + }
- + tb.append(_endHtml);
- +
- + sendPacket(player, tb.toString(), Packet.DYNAMIC);
- + }
- + private static void showBuffsPage(L2PcInstance player) {
- + TextBuilder tb = new TextBuilder();
- + tb.append(_headHtml);
- + tb.append("Choose between the below categories:<br>");
- + for(String st : _buffs.keySet()) {
- + tb.append("<button value=\"" + st + "\" action=\"bypass -h Aioitem_showBuffCategory_" + st + "_1\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
- + }
- + tb.append(_endHtml);
- +
- + sendPacket(player, tb.toString(), Packet.DYNAMIC);
- + }
- +
- + /**
- + * Gatekeeper
- + * @param player
- + * @param string
- + * @param val
- + */
- + private static void showTeleportCategoryWindow(L2PcInstance player, String string, int val) {
- +
- + FastMap<String, Integer[]> temp = _teleports.get(string);
- + FastList<String> keys = new FastList<String>();
- + keys.addAll(_teleports.get(string).keySet());
- + _pagesPerTp = Math.round(keys.size() / 15);
- +
- + TextBuilder tb = new TextBuilder();
- + tb.append(_headHtml);
- + tb.append("Choose a teleport:<br>");
- +
- + for(String st : keys.subList((val * 15) - 15, getMaxRange(keys, ((val * 15) * 2) - 15)) ) {
- + tb.append("<button value=\"" + st + "\" action=\"bypass -h Aioitem_teleportTo_" +temp.get(st)[0] + "_" +
- + temp.get(st)[1] + "_" + temp.get(st)[2] + "\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" " +
- + "fore=\"L2UI_ct1.button_df\">");
- + }
- + for(int i = 1; i<_pagesPerTp; i++) {
- + tb.append("<a action=\"bypass -h Aioitem_tpcategory_" + string + "_" + i +"\">" + i + "</a>");
- + }
- + tb.append(_endHtml);
- +
- + sendPacket(player, tb.toString(), Packet.DYNAMIC);
- + }
- +
- + private static void showTeleportWindow(L2PcInstance player) {
- +
- + TextBuilder tb = new TextBuilder();
- + tb.append(_headHtml);
- + tb.append("Choose one of the below categories:<br>");
- +
- + for(String st : _teleports.keySet()) {
- + tb.append("<button value=\"" + st + "\" action=\"bypass -h Aioitem_tpcategory_" + st + "_1\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
- + }
- + tb.append(_endHtml);
- +
- + sendPacket(player, tb.toString(), Packet.DYNAMIC);
- + }
- +
- + /**
- + * WareHouse
- + * @param player
- + */
- + private static void showWarehouseWindow(L2PcInstance player) {
- +
- + TextBuilder tb = new TextBuilder();
- + tb.append(_headHtml);
- + tb.append("Choose between the avaliable options:<br>");
- + tb.append("<button value=\"Withdraw\" action=\"bypass -h Aioitem_nwidraw\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
- + tb.append("<button value=\"Deposit\" action=\"bypass -h Aioitem_ndeposit\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
- + tb.append("<button value=\"Clan Withdraw\" action=\"bypass -h Aioitem_clanwidraw\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
- + tb.append("<button value=\"Clan Deposit\" action=\"bypass -h Aioitem_clandeposit\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
- + tb.append(_endHtml);
- +
- + sendPacket(player, tb.toString(), Packet.DYNAMIC);
- + }
- +
- + /**
- + * GMShop
- + * @param player
- + * @param val
- + */
- + private static void showBuyWindow(L2PcInstance player, int val) {
- + player.tempInventoryDisable();
- +
- + L2TradeList list = TradeController.getInstance().getBuyList(val);
- +
- + if (list != null) {
- + player.sendPacket(new BuyList(list, player.getAdena(), 0));
- + }
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- +
- + //Give the max range each 15 units
- + private static int getMaxRange(FastList<String> list, int lastindex) {
- + if(list.size() - lastindex > 0)
- + return lastindex;
- + else
- + return list.size();
- + }
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment