|
@@ -14,23 +14,14 @@
|
|
|
*/
|
|
|
package com.l2jserver.gameserver.model.actor.instance;
|
|
|
|
|
|
-import com.l2jserver.Config;
|
|
|
-import com.l2jserver.gameserver.cache.HtmCache;
|
|
|
-import com.l2jserver.gameserver.model.L2Clan;
|
|
|
-import com.l2jserver.gameserver.network.SystemMessageId;
|
|
|
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
|
|
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.templates.chars.L2NpcTemplate;
|
|
|
|
|
|
/**
|
|
|
* @author l3x
|
|
|
*/
|
|
|
-public class L2CastleWarehouseInstance extends L2NpcInstance
|
|
|
+public class L2CastleWarehouseInstance extends L2WarehouseInstance
|
|
|
{
|
|
|
protected static final int COND_ALL_FALSE = 0;
|
|
|
protected static final int COND_BUSY_BECAUSE_OF_SIEGE = 1;
|
|
@@ -51,171 +42,6 @@ public class L2CastleWarehouseInstance extends L2NpcInstance
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private void showRetrieveWindow(L2PcInstance player, WarehouseListType itemtype, byte sortorder)
|
|
|
- {
|
|
|
- player.sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
- player.setActiveWarehouse(player.getWarehouse());
|
|
|
-
|
|
|
- if (player.getActiveWarehouse().getSize() == 0)
|
|
|
- {
|
|
|
- player.sendPacket(new SystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (itemtype != null)
|
|
|
- player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE, itemtype, sortorder));
|
|
|
- else
|
|
|
- player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE));
|
|
|
- }
|
|
|
-
|
|
|
- private void showDepositWindow(L2PcInstance player)
|
|
|
- {
|
|
|
- player.sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
- player.setActiveWarehouse(player.getWarehouse());
|
|
|
- player.tempInventoryDisable();
|
|
|
- player.sendPacket(new WareHouseDepositList(player, WareHouseDepositList.PRIVATE));
|
|
|
- }
|
|
|
-
|
|
|
- private void showDepositWindowClan(L2PcInstance player)
|
|
|
- {
|
|
|
- player.sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
-
|
|
|
- if (player.getClan() != null)
|
|
|
- {
|
|
|
- if (player.getClan().getLevel() == 0)
|
|
|
- player.sendPacket(new SystemMessage(SystemMessageId.ONLY_LEVEL_1_CLAN_OR_HIGHER_CAN_USE_WAREHOUSE));
|
|
|
- else
|
|
|
- {
|
|
|
- if ((player.getClanPrivileges() & L2Clan.CP_CL_VIEW_WAREHOUSE) != L2Clan.CP_CL_VIEW_WAREHOUSE)
|
|
|
- player.sendPacket(new SystemMessage(SystemMessageId.ONLY_CLAN_LEADER_CAN_RETRIEVE_ITEMS_FROM_CLAN_WAREHOUSE));
|
|
|
-
|
|
|
- player.setActiveWarehouse(player.getClan().getWarehouse());
|
|
|
- player.tempInventoryDisable();
|
|
|
- WareHouseDepositList dl = new WareHouseDepositList(player, WareHouseDepositList.CLAN);
|
|
|
- player.sendPacket(dl);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void showWithdrawWindowClan(L2PcInstance player, WarehouseListType itemtype, byte sortorder)
|
|
|
- {
|
|
|
- player.sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
-
|
|
|
- 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.sendPacket(new SystemMessage(SystemMessageId.ONLY_LEVEL_1_CLAN_OR_HIGHER_CAN_USE_WAREHOUSE));
|
|
|
- else
|
|
|
- {
|
|
|
- player.setActiveWarehouse(player.getClan().getWarehouse());
|
|
|
-
|
|
|
- if (itemtype != null)
|
|
|
- player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN, itemtype, sortorder));
|
|
|
- else
|
|
|
- player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onBypassFeedback(L2PcInstance player, String command)
|
|
|
- {
|
|
|
- if (player.getActiveEnchantItem() != null)
|
|
|
- {
|
|
|
- // Retail (April 17, 2009 - Gracia CT2) - If a player has an enchant window open and attempts to access a warehouse, the enchant window stays up and the warehouse does not open.
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- String param[] = command.split("_");
|
|
|
-
|
|
|
- if (command.startsWith("WithdrawP"))
|
|
|
- {
|
|
|
- if (Config.L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE)
|
|
|
- {
|
|
|
- String htmFile = "data/html/mods/WhSortedP.htm";
|
|
|
- String htmContent = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htmFile);
|
|
|
-
|
|
|
- if (htmContent != null)
|
|
|
- {
|
|
|
- NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
|
|
|
- npcHtmlMessage.setHtml(htmContent);
|
|
|
- npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
|
|
|
- player.sendPacket(npcHtmlMessage);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _log.warning("Missing htm: " + htmFile + "!");
|
|
|
- player.sendMessage("This NPC's html is missing. Please inform the server admin.");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- showRetrieveWindow(player, null, (byte) 0);
|
|
|
- }
|
|
|
- else if (command.startsWith("WithdrawSortedP"))
|
|
|
- {
|
|
|
- if (param.length > 2)
|
|
|
- showRetrieveWindow(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2]));
|
|
|
- else if (param.length > 1)
|
|
|
- showRetrieveWindow(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z);
|
|
|
- else
|
|
|
- showRetrieveWindow(player, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
|
|
|
- }
|
|
|
- else if (command.equals("DepositP"))
|
|
|
- showDepositWindow(player);
|
|
|
- else if (command.equals("WithdrawC"))
|
|
|
- {
|
|
|
- if (Config.L2JMOD_ENABLE_WAREHOUSESORTING_CLAN)
|
|
|
- {
|
|
|
- String htmFile = "data/html/mods/WhSortedC.htm";
|
|
|
- String htmContent = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htmFile);
|
|
|
-
|
|
|
- if (htmContent != null)
|
|
|
- {
|
|
|
- NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
|
|
|
- npcHtmlMessage.setHtml(htmContent);
|
|
|
- npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
|
|
|
- player.sendPacket(npcHtmlMessage);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _log.warning("Missing htm: " + htmFile + "!");
|
|
|
- player.sendMessage("This NPC's html is missing. Please inform the server admin.");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- showWithdrawWindowClan(player, null, (byte) 0);
|
|
|
- }
|
|
|
- else if (command.startsWith("WithdrawSortedC"))
|
|
|
- {
|
|
|
- if (param.length > 2)
|
|
|
- showWithdrawWindowClan(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2]));
|
|
|
- else if (param.length > 1)
|
|
|
- showWithdrawWindowClan(player, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z);
|
|
|
- else
|
|
|
- showWithdrawWindowClan(player, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
|
|
|
- }
|
|
|
- else if (command.equals("DepositC"))
|
|
|
- showDepositWindowClan(player);
|
|
|
- else if (command.startsWith("Chat"))
|
|
|
- {
|
|
|
- int val = 0;
|
|
|
- try
|
|
|
- {
|
|
|
- val = Integer.parseInt(command.substring(5));
|
|
|
- }
|
|
|
- catch (IndexOutOfBoundsException ioobe){}
|
|
|
- catch (NumberFormatException nfe){}
|
|
|
- showChatWindow(player, val);
|
|
|
- }
|
|
|
- else
|
|
|
- super.onBypassFeedback(player, command);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void showChatWindow(L2PcInstance player, int val)
|
|
|
{
|