diff --git a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/boxaccess.sql b/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/boxaccess.sql deleted file mode 100644 index 22af5ea5ec..0000000000 --- a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/boxaccess.sql +++ /dev/null @@ -1,7 +0,0 @@ --- --- Table structure for table `boxaccess` --- -CREATE TABLE IF NOT EXISTS boxaccess ( - spawn decimal(11,0) default NULL, - charname varchar(32) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/boxes.sql b/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/boxes.sql deleted file mode 100644 index 7bcb2d3cc2..0000000000 --- a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/boxes.sql +++ /dev/null @@ -1,14 +0,0 @@ --- --- Table structure for table `boxes` --- -CREATE TABLE IF NOT EXISTS boxes ( - id int(11) NOT NULL auto_increment, - spawn decimal(11,0) default NULL, - npcid decimal(11,0) default NULL, - drawer varchar(32) default NULL, - itemid decimal(11,0) default NULL, - name varchar(32) default '', - count decimal(11,0) default NULL, - enchant decimal(2,0) default NULL, - PRIMARY KEY (id) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml b/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml index a34f523c75..556fd3894a 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_C6_Interlude/dist/game/config/AdminCommands.xml @@ -189,7 +189,6 @@ - diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java index 104b1ecafa..5d3f2f6a2b 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java @@ -40,8 +40,6 @@ import org.l2jmobius.gameserver.model.DropData; import org.l2jmobius.gameserver.model.Skill; import org.l2jmobius.gameserver.model.StatsSet; import org.l2jmobius.gameserver.model.StoreTradeList; -import org.l2jmobius.gameserver.model.WorldObject; -import org.l2jmobius.gameserver.model.actor.instance.BoxInstance; import org.l2jmobius.gameserver.model.actor.instance.NpcInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; @@ -495,48 +493,6 @@ public class AdminEditNpc implements IAdminCommandHandler BuilderUtil.sendSysMessage(activeChar, "Usage: //del_drop "); } } - else if (command.startsWith("admin_box_access")) - { - final WorldObject target = activeChar.getTarget(); - final String[] players = command.split(" "); - - if (target instanceof BoxInstance) - { - final BoxInstance box = (BoxInstance) target; - - if (players.length > 1) - { - boolean access = true; - for (int i = 1; i < players.length; i++) - { - if (players[i].equals("no")) - { - access = false; - continue; - } - box.grantAccess(players[i], access); - } - } - else - { - try - { - String msg = "Access:"; - - for (Object p : box.getAccess()) - { - msg += " " + p; - } - - activeChar.sendMessage(msg); - } - catch (Exception e) - { - LOGGER.info("box_access: " + e); - } - } - } - } return true; } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/BoxInstance.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/BoxInstance.java deleted file mode 100644 index 798777f90c..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/BoxInstance.java +++ /dev/null @@ -1,430 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.actor.instance; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.l2jmobius.commons.database.DatabaseFactory; -import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; -import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; - -/** - * This class implements a Box instance which is used like a warehouse but
- * without limits on item numbers. It can be thought of a box with six drawers.
- * Depositing and withdrawing is done through a HTML dialog to circumvent the
- * package size limit of the warehouse dialog.
- *
- * Access to a box has to be set by an admin and uses the players' names for
- * easier handling (s. admin command admin_box_access).
- *
- * To spawn an BoxInstance change the type in npc to Box.
- * example: update npc set type='Box' where id=1042;
- * It uses two tables: boxes and boxaccess. Create these with:
- * - CREATE TABLE boxes (
- id int(11) NOT NULL auto_increment,
- spawn decimal(11,0) default NULL,
- npcid decimal(11,0) default NULL,
- drawer varchar(32) default NULL,
- itemid decimal(11,0) default NULL,
- name varchar(32) default '',
- count decimal(11,0) default NULL,
- enchant decimal(2,0) default NULL,
- PRIMARY KEY (id)
- ) TYPE=MyISAM;
- CREATE TABLE boxaccess (
- spawn decimal(11,0) default NULL,
- charname varchar(32) default NULL
- ) TYPE=MyISAM;
- */ -public class BoxInstance extends NpcInstance -{ - - private class BoxItem implements Comparable - { - public int itemid; - public int id; - public int count; - public String name; - - public BoxItem(int itemid, int count, String name, int id) - { - this.itemid = itemid; - this.count = count; - this.name = name; - this.id = id; - } - - @Override - public int compareTo(Object o) - { - final int r = name.compareToIgnoreCase(((BoxItem) o).name); - if (r != 0) - { - return r; - } - - if (id < ((BoxItem) o).id) - { - return -1; - } - - return 1; - } - } - - private static final int MAX_ITEMS_PER_PAGE = 25; - private static final String INSERT_GRANT = "INSERT INTO boxaccess (charname,spawn) VALUES(?,?)"; - private static final String DELETE_GRANT = "DELETE FROM boxaccess WHERE charname=? AND spawn=?"; - private static final String LIST_GRANT = "SELECT charname FROM boxaccess WHERE spawn=?"; - private static final String VARIABLE_PREFIX = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - - public BoxInstance(int objectId, NpcTemplate template) - { - super(objectId, template); - } - - @Override - public void onBypassFeedback(PlayerInstance player, String command) - { - final String playerName = player.getName(); - final boolean access = hasAccess(playerName); - - if (command.startsWith("Withdraw")) - { - if (access) - { - showWithdrawWindow(player, command.substring(9)); - } - } - else if (command.startsWith("Deposit")) - { - if (access) - { - showDepositWindow(player, command.substring(8)); - } - } - else if (command.startsWith("InBox")) - { - if (access) - { - putInBox(player, command.substring(6)); - } - } - else if (command.startsWith("OutBox")) - { - if (access) - { - takeOutBox(player, command.substring(7)); - } - } - else - { - super.onBypassFeedback(player, command); - } - } - - @Override - public boolean hasRandomAnimation() - { - return false; - } - - @Override - public String getHtmlPath(int npcId, int val) - { - String pom = ""; - if (val == 0) - { - pom = "" + npcId; - } - else - { - pom = npcId + "-" + val; - } - return "data/html/custom/" + pom + ".htm"; - } - - public boolean hasAccess(String player) - { - boolean result = false; - try (Connection con = DatabaseFactory.getConnection()) - { - final PreparedStatement st = con.prepareStatement("SELECT spawn, charname FROM boxaccess WHERE charname=? AND spawn=?"); - st.setString(1, player); - st.setInt(2, getSpawn().getId()); - final ResultSet rs = st.executeQuery(); - - if (rs.next()) - { - result = true; - } - - rs.close(); - st.close(); - } - catch (Exception e) - { - LOGGER.info("hasAccess failed: " + e); - } - return result; - } - - public List getAccess() - { - final List acl = new ArrayList<>(); - try (Connection con = DatabaseFactory.getConnection()) - { - final PreparedStatement st = con.prepareStatement(LIST_GRANT); - st.setInt(1, getSpawn().getId()); - final ResultSet rs = st.executeQuery(); - - while (rs.next()) - { - acl.add(rs.getString("charname")); - } - rs.close(); - st.close(); - } - catch (Exception e) - { - LOGGER.info("getAccess failed: " + e); - } - return acl; - } - - public void grantAccess(String player, boolean what) - { - try (Connection con = DatabaseFactory.getConnection()) - { - String query; - if (what) - { - query = INSERT_GRANT; - } - else - { - query = DELETE_GRANT; - } - - final PreparedStatement st = con.prepareStatement(query); - st.setString(1, player); - st.setInt(2, getSpawn().getId()); - st.execute(); - st.close(); - } - catch (Exception e) - { - } - } - - private void showWithdrawWindow(PlayerInstance player, String command) - { - String drawername = "trash"; - - if (command == null) - { - return; - } - - final String[] cmd = command.split(" "); - int startPos = 0; - - if (cmd != null) - { - drawername = cmd[0]; - if (cmd.length > 1) - { - startPos = Integer.parseInt(cmd[1]); - } - } - - final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); - int nitems = 0; - final Set items = getItems(drawername); - - if (startPos >= items.size()) - { - startPos = 0; - } - - String button = "