Fixed Talking Island and Faeron Village scrolls of escape.
Dropped Batalion Zone due to lack of further development. Added Various missing syncs from L2jServer Ertheia.
This commit is contained in:
@ -26,6 +26,8 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ItemLocation;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.L2Armor;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.items.L2Weapon;
|
||||
@ -433,7 +435,7 @@ public abstract class AbstractRefinePacket extends L2GameClientPacket
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (player.isEnchanting() || player.isProcessingTransaction())
|
||||
if (player.hasRequest(EnchantItemRequest.class, EnchantItemAttributeRequest.class) || player.isProcessingTransaction())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import java.util.logging.Logger;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.L2Event;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
@ -54,7 +53,7 @@ public final class Logout extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (player.getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE))
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
@ -67,13 +66,6 @@ public final class Logout extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInsideZone(ZoneId.BATTALION) && !Config.BTZ_LOGOUT_ZONE)
|
||||
{
|
||||
player.sendMessage("You cannot logout while inside a Battalion zone.");
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow leaving if player is fighting
|
||||
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.PartyMatchRoom;
|
||||
import com.l2jserver.gameserver.model.PartyMatchRoomList;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.PartyRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExManagePartyRoomMember;
|
||||
import com.l2jserver.gameserver.network.serverpackets.JoinParty;
|
||||
@ -48,12 +49,19 @@ public final class RequestAnswerJoinParty extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance requestor = player.getActiveRequester();
|
||||
final PartyRequest request = player.getRequest(PartyRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
return;
|
||||
}
|
||||
request.setProcessing(true);
|
||||
|
||||
final L2PcInstance requestor = request.getActiveChar();
|
||||
if (requestor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Party party = requestor.getParty();
|
||||
requestor.sendPacket(new JoinParty(_response));
|
||||
|
||||
switch (_response)
|
||||
@ -138,11 +146,11 @@ public final class RequestAnswerJoinParty extends L2GameClientPacket
|
||||
|
||||
if (requestor.isInParty())
|
||||
{
|
||||
requestor.getParty().setPendingInvitation(false); // if party is null, there is no need of decreasing
|
||||
party.setPendingInvitation(false); // if party is null, there is no need of decreasing
|
||||
}
|
||||
|
||||
player.setActiveRequester(null);
|
||||
requestor.onTransactionResponse();
|
||||
request.setProcessing(false);
|
||||
player.removeRequest(request.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +47,6 @@ import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExShowCommission;
|
||||
import com.l2jserver.gameserver.util.GMAudit;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
@ -70,7 +69,6 @@ public final class RequestBypassToServer extends L2GameClientPacket
|
||||
"_olympiad?command",
|
||||
"menu_select",
|
||||
"manor_menu_select",
|
||||
"showAuction",
|
||||
"pccafe"
|
||||
};
|
||||
|
||||
@ -289,15 +287,6 @@ public final class RequestBypassToServer extends L2GameClientPacket
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcManorBypass(activeChar, lastNpc, ask, state, time), lastNpc);
|
||||
}
|
||||
}
|
||||
else if (_command.equals("showAuction"))
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.sendPacket(new ExShowCommission());
|
||||
}
|
||||
else if (_command.startsWith("pccafe"))
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
|
@ -88,7 +88,7 @@ public final class RequestCancelPostAttachment extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
if (activeChar.hasItemRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_DURING_AN_ITEM_ENHANCEMENT_OR_ATTRIBUTE_ENHANCEMENT);
|
||||
return;
|
||||
|
@ -15,6 +15,7 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
@ -36,7 +37,12 @@ public class RequestChangeAttributeCancel extends L2GameClientPacket
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.setActiveEnchantAttrItemId(0);
|
||||
final EnchantItemAttributeRequest request = player.getRequest(EnchantItemAttributeRequest.class);
|
||||
if (request == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.removeRequest(request.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@ package com.l2jserver.gameserver.network.clientpackets;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExChangeAttributeFail;
|
||||
@ -56,30 +57,39 @@ public class RequestChangeAttributeItem extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantItemAttributeRequest request = player.getRequest(EnchantItemAttributeRequest.class);
|
||||
if (request == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
request.setProcessing(true);
|
||||
|
||||
L2ItemInstance item = player.getInventory().getItemByObjectId(_itemOID);
|
||||
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveTradeList() != null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CHANGE_ATTRIBUTES_WHILE_EXCHANGING);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item.isWeapon())
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(0);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(new ExChangeAttributeItemList(player, _attributeOID));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_newAttributeID == -1)
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(0);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(new ExChangeAttributeItemList(player, _attributeOID));
|
||||
return;
|
||||
}
|
||||
@ -123,7 +133,7 @@ public class RequestChangeAttributeItem extends L2GameClientPacket
|
||||
}
|
||||
player.sendPacket(iu);
|
||||
|
||||
player.setActiveEnchantAttrItemId(0);
|
||||
player.removeRequest(request.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,6 +27,7 @@ import com.l2jserver.gameserver.data.xml.impl.EnchantItemData;
|
||||
import com.l2jserver.gameserver.enums.UserInfoType;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantResultType;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantScroll;
|
||||
@ -64,38 +65,44 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((activeChar == null) || (_objectId == 0))
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
request.setEnchantingItem(_objectId);
|
||||
request.setProcessing(true);
|
||||
|
||||
if (!activeChar.isOnline() || getClient().isDetached())
|
||||
{
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isProcessingTransaction() || activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_ENCHANT_WHILE_OPERATING_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
|
||||
L2ItemInstance scroll = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantItemId());
|
||||
L2ItemInstance support = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantSupportItemId());
|
||||
|
||||
final L2ItemInstance item = request.getEnchantingItem();
|
||||
final L2ItemInstance scroll = request.getEnchantingScroll();
|
||||
final L2ItemInstance support = request.getSupportItem();
|
||||
if ((item == null) || (scroll == null))
|
||||
{
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// template for scroll
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
|
||||
// scroll not found in list
|
||||
if (scrollTemplate == null)
|
||||
{
|
||||
return;
|
||||
@ -107,7 +114,7 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
{
|
||||
if (support.getObjectId() != _supportId)
|
||||
{
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
supportTemplate = EnchantItemData.getInstance().getSupportItem(support);
|
||||
@ -117,27 +124,26 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
if (!scrollTemplate.isValid(item, supportTemplate))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
// fast auto-enchant cheat check
|
||||
if ((activeChar.getActiveEnchantTimestamp() == 0) || ((System.currentTimeMillis() - activeChar.getActiveEnchantTimestamp()) < 2000))
|
||||
if ((request.getTimestamp() == 0) || ((System.currentTimeMillis() - request.getTimestamp()) < 2000))
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " use autoenchant program ", Config.DEFAULT_PUNISH);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
// attempting to destroy scroll
|
||||
scroll = activeChar.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, activeChar, item);
|
||||
if (scroll == null)
|
||||
if (activeChar.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, activeChar, item) == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT2);
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to enchant with a scroll he doesn't have", Config.DEFAULT_PUNISH);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
@ -145,12 +151,11 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
// attempting to destroy support if exist
|
||||
if (support != null)
|
||||
{
|
||||
support = activeChar.getInventory().destroyItem("Enchant", support.getObjectId(), 1, activeChar, item);
|
||||
if (support == null)
|
||||
if (activeChar.getInventory().destroyItem("Enchant", support.getObjectId(), 1, activeChar, item) == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT2);
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to enchant with a support item he doesn't have", Config.DEFAULT_PUNISH);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
@ -163,7 +168,7 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
if ((item.getOwnerId() != activeChar.getObjectId()) || (item.isEnchantable() == 0))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
@ -174,7 +179,7 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
case ERROR:
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
break;
|
||||
}
|
||||
@ -318,12 +323,11 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
count = 1;
|
||||
}
|
||||
|
||||
item = activeChar.getInventory().destroyItem("Enchant", item, activeChar, null);
|
||||
if (item == null)
|
||||
if (activeChar.getInventory().destroyItem("Enchant", item, activeChar, null) == null)
|
||||
{
|
||||
// unable to destroy item, cheater ?
|
||||
Util.handleIllegalPlayerAction(activeChar, "Unable to delete item on enchant failure from player " + activeChar.getName() + ", possible cheater !", Config.DEFAULT_PUNISH);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
|
||||
if (Config.LOG_ITEM_ENCHANTS)
|
||||
@ -429,6 +433,7 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
activeChar.sendPacket(new ItemList(activeChar, true));
|
||||
}
|
||||
|
||||
request.setProcessing(false);
|
||||
activeChar.broadcastUserInfo(UserInfoType.ENCHANTLEVEL);
|
||||
activeChar.sendPacket(new ExUserInfoInvenWeight(activeChar));
|
||||
activeChar.sendPacket(new ExAdenaInvenCount(activeChar));
|
||||
|
@ -20,6 +20,7 @@ package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.EnchantItemData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantScroll;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@ -51,29 +52,39 @@ public class RequestExAddEnchantScrollItem extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_enchantObjectId);
|
||||
final L2ItemInstance scroll = activeChar.getInventory().getItemByObjectId(_scrollObjectId);
|
||||
|
||||
if ((item == null) || (scroll == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
|
||||
if ((scrollTemplate == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(0));
|
||||
return;
|
||||
}
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(_scrollObjectId));
|
||||
return;
|
||||
}
|
||||
|
||||
request.setEnchantingItem(_enchantObjectId);
|
||||
request.setEnchantingScroll(_scrollObjectId);
|
||||
|
||||
final L2ItemInstance item = request.getEnchantingItem();
|
||||
final L2ItemInstance scroll = request.getEnchantingScroll();
|
||||
if ((item == null) || (scroll == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(0));
|
||||
request.setEnchantingItem(L2PcInstance.ID_NONE);
|
||||
request.setEnchantingScroll(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
if ((scrollTemplate == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(0));
|
||||
request.setEnchantingScroll(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
request.setTimestamp(System.currentTimeMillis());
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(_scrollObjectId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,7 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.network.serverpackets.EnchantResult;
|
||||
|
||||
/**
|
||||
@ -37,12 +38,14 @@ public class RequestExCancelEnchantItem extends L2GameClientPacket
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar != null)
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
activeChar.sendPacket(new EnchantResult(2, 0, 0));
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(new EnchantResult(2, 0, 0));
|
||||
activeChar.removeRequest(EnchantItemRequest.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.model.Elementals;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExAttributeEnchantResult;
|
||||
@ -54,24 +55,32 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantItemAttributeRequest request = player.getRequest(EnchantItemAttributeRequest.class);
|
||||
if (request == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
request.setProcessing(true);
|
||||
|
||||
if (_objectId == 0xFFFFFFFF)
|
||||
{
|
||||
// Player canceled enchant
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(SystemMessageId.ATTRIBUTE_ITEM_USAGE_HAS_BEEN_CANCELLED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.isOnline())
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_ADD_ELEMENTAL_POWER_WHILE_OPERATING_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -80,16 +89,16 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
{
|
||||
// Cancel trade
|
||||
player.cancelActiveTrade();
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_TRADING);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = player.getInventory().getItemByObjectId(_objectId);
|
||||
final L2ItemInstance stone = player.getInventory().getItemByObjectId(player.getActiveEnchantAttrItemId());
|
||||
final L2ItemInstance stone = request.getEnchantingStone();
|
||||
if ((item == null) || (stone == null))
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(SystemMessageId.ATTRIBUTE_ITEM_USAGE_HAS_BEEN_CANCELLED);
|
||||
return;
|
||||
}
|
||||
@ -97,7 +106,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
if (!item.isElementable())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ELEMENTAL_POWER_ENHANCER_USAGE_REQUIREMENT_IS_NOT_SUFFICIENT);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -108,14 +117,14 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
{
|
||||
if (item.getOwnerId() != player.getObjectId())
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to use enchant Exploit!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
@ -139,7 +148,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
if ((item.isWeapon() && (oldElement != null) && (oldElement.getElement() != elementToAdd) && (oldElement.getElement() != -2)) || (item.isArmor() && (item.getElemental(elementToAdd) == null) && (item.getElementals() != null) && (item.getElementals().length >= 3)))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ANOTHER_ELEMENTAL_POWER_HAS_ALREADY_BEEN_ADDED_THIS_ELEMENTAL_POWER_CANNOT_BE_ADDED);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -150,7 +159,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
{
|
||||
if (elm.getElement() == opositeElement)
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to add oposite attribute to item!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
@ -167,7 +176,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
if (powerToAdd <= 0)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ATTRIBUTE_ITEM_USAGE_HAS_BEEN_CANCELLED);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -267,7 +276,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
iu.addModifiedItem(stone);
|
||||
}
|
||||
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(new ExAttributeEnchantResult(result, item.isWeapon(), elementToAdd, elementValue, newValue, successfulAttempts, failedAttempts));
|
||||
player.sendPacket(new UserInfo(player));
|
||||
player.sendPacket(iu);
|
||||
@ -290,7 +299,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
if (powerToAdd <= 0)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ATTRIBUTE_ITEM_USAGE_HAS_BEEN_CANCELLED);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(EnchantItemAttributeRequest.class);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExRemoveEnchantSupportItemResult;
|
||||
|
||||
@ -39,21 +40,24 @@ public class RequestExRemoveEnchantSupportItem extends L2GameClientPacket
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.setActiveEnchantTimestamp(System.currentTimeMillis());
|
||||
|
||||
final L2ItemInstance supportItem = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantSupportItemId());
|
||||
|
||||
if ((supportItem == null) || (supportItem.getCount() < 1))
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.setActiveEnchantSupportItemId(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance supportItem = request.getSupportItem();
|
||||
if ((supportItem == null) || (supportItem.getCount() < 1))
|
||||
{
|
||||
request.setSupportItem(L2PcInstance.ID_NONE);
|
||||
}
|
||||
|
||||
request.setTimestamp(System.currentTimeMillis());
|
||||
activeChar.sendPacket(ExRemoveEnchantSupportItemResult.STATIC_PACKET);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.EnchantItemData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantScroll;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantSupportItem;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
@ -52,34 +53,41 @@ public class RequestExTryToPutEnchantSupportItem extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_enchantObjectId);
|
||||
final L2ItemInstance scroll = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantItemId());
|
||||
final L2ItemInstance support = activeChar.getInventory().getItemByObjectId(_supportObjectId);
|
||||
|
||||
if ((item == null) || (scroll == null) || (support == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantSupportItemId(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
final EnchantSupportItem supportTemplate = EnchantItemData.getInstance().getSupportItem(support);
|
||||
|
||||
if ((scrollTemplate == null) || (supportTemplate == null) || !scrollTemplate.isValid(item, supportTemplate))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantSupportItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.sendPacket(new ExPutEnchantSupportItemResult(0));
|
||||
return;
|
||||
}
|
||||
activeChar.setActiveEnchantSupportItemId(support.getObjectId());
|
||||
activeChar.sendPacket(new ExPutEnchantSupportItemResult(_supportObjectId));
|
||||
return;
|
||||
}
|
||||
|
||||
request.setEnchantingItem(_enchantObjectId);
|
||||
request.setSupportItem(_supportObjectId);
|
||||
|
||||
final L2ItemInstance item = request.getEnchantingItem();
|
||||
final L2ItemInstance scroll = request.getEnchantingScroll();
|
||||
final L2ItemInstance support = request.getSupportItem();
|
||||
if ((item == null) || (scroll == null) || (support == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
request.setEnchantingItem(L2PcInstance.ID_NONE);
|
||||
request.setSupportItem(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
final EnchantSupportItem supportTemplate = EnchantItemData.getInstance().getSupportItem(support);
|
||||
if ((scrollTemplate == null) || (supportTemplate == null) || !scrollTemplate.isValid(item, supportTemplate))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
request.setSupportItem(L2PcInstance.ID_NONE);
|
||||
activeChar.sendPacket(new ExPutEnchantSupportItemResult(0));
|
||||
return;
|
||||
}
|
||||
|
||||
request.setSupportItem(support.getObjectId());
|
||||
request.setTimestamp(System.currentTimeMillis());
|
||||
activeChar.sendPacket(new ExPutEnchantSupportItemResult(_supportObjectId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import java.util.logging.Level;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.EnchantItemData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantScroll;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@ -46,18 +47,21 @@ public class RequestExTryToPutEnchantTargetItem extends L2GameClientPacket
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((_objectId == 0) || (activeChar == null))
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
|
||||
final L2ItemInstance scroll = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantItemId());
|
||||
request.setEnchantingItem(_objectId);
|
||||
|
||||
final L2ItemInstance item = request.getEnchantingItem();
|
||||
final L2ItemInstance scroll = request.getEnchantingScroll();
|
||||
if ((item == null) || (scroll == null))
|
||||
{
|
||||
return;
|
||||
@ -67,7 +71,7 @@ public class RequestExTryToPutEnchantTargetItem extends L2GameClientPacket
|
||||
if ((scrollTemplate == null) || !scrollTemplate.isValid(item, null))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.DOES_NOT_FIT_STRENGTHENING_CONDITIONS_OF_THE_SCROLL);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new ExPutEnchantTargetItemResult(0));
|
||||
if (scrollTemplate == null)
|
||||
{
|
||||
@ -75,8 +79,7 @@ public class RequestExTryToPutEnchantTargetItem extends L2GameClientPacket
|
||||
}
|
||||
return;
|
||||
}
|
||||
activeChar.setIsEnchanting(true);
|
||||
activeChar.setActiveEnchantTimestamp(System.currentTimeMillis());
|
||||
request.setTimestamp(System.currentTimeMillis());
|
||||
activeChar.sendPacket(new ExPutEnchantTargetItemResult(_objectId));
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public final class RequestGetItemFromPet extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public final class RequestGiveItemToPet extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import com.l2jserver.gameserver.model.BlockList;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.PartyRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.network.serverpackets.AskJoinParty;
|
||||
@ -160,29 +161,27 @@ public final class RequestJoinParty extends L2GameClientPacket
|
||||
if (!party.isLeader(requestor))
|
||||
{
|
||||
requestor.sendPacket(SystemMessageId.ONLY_THE_LEADER_CAN_GIVE_OUT_INVITATIONS);
|
||||
return;
|
||||
}
|
||||
if (party.getMemberCount() >= 9)
|
||||
else if (party.getMemberCount() >= 9)
|
||||
{
|
||||
requestor.sendPacket(SystemMessageId.THE_PARTY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
if (party.getPendingInvitation() && !party.isInvitationRequestExpired())
|
||||
else if (party.getPendingInvitation() && !party.isInvitationRequestExpired())
|
||||
{
|
||||
requestor.sendPacket(SystemMessageId.WAITING_FOR_ANOTHER_REPLY);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target.isProcessingRequest())
|
||||
else if (!target.hasRequest(PartyRequest.class))
|
||||
{
|
||||
requestor.onTransactionRequest(target);
|
||||
// in case a leader change has happened, use party's mode
|
||||
final PartyRequest request = new PartyRequest(requestor, target);
|
||||
request.scheduleTimeout(30 * 1000);
|
||||
requestor.addRequest(request);
|
||||
target.addRequest(request);
|
||||
target.sendPacket(new AskJoinParty(requestor.getName(), party.getDistributionType()));
|
||||
party.setPendingInvitation(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
|
||||
sm.addString(target.getName());
|
||||
requestor.sendPacket(sm);
|
||||
}
|
||||
@ -194,17 +193,20 @@ public final class RequestJoinParty extends L2GameClientPacket
|
||||
*/
|
||||
private void createNewParty(L2PcInstance target, L2PcInstance requestor)
|
||||
{
|
||||
PartyDistributionType partyDistributionType = PartyDistributionType.findById(_partyDistributionTypeId);
|
||||
final PartyDistributionType partyDistributionType = PartyDistributionType.findById(_partyDistributionTypeId);
|
||||
if (partyDistributionType == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target.isProcessingRequest())
|
||||
if (!target.hasRequest(PartyRequest.class))
|
||||
{
|
||||
final PartyRequest request = new PartyRequest(requestor, target);
|
||||
request.scheduleTimeout(30 * 1000);
|
||||
requestor.addRequest(request);
|
||||
target.addRequest(request);
|
||||
target.sendPacket(new AskJoinParty(requestor.getName(), partyDistributionType));
|
||||
target.setActiveRequester(requestor);
|
||||
requestor.onTransactionRequest(target);
|
||||
|
||||
requestor.setPartyDistributionType(partyDistributionType);
|
||||
}
|
||||
else
|
||||
|
@ -93,7 +93,7 @@ public class RequestPackageSend extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to use enchant Exploit!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
|
@ -91,7 +91,7 @@ public final class RequestPostAttachment extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
if (activeChar.hasItemRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_RECEIVE_MAIL_WHILE_ENCHANTING_AN_ITEM_BESTOWING_AN_ATTRIBUTE_OR_COMBINING_JEWELS);
|
||||
return;
|
||||
|
@ -26,7 +26,6 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.instancemanager.AntiFeedManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.L2GameClient;
|
||||
import com.l2jserver.gameserver.network.L2GameClient.GameClientState;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@ -58,7 +57,7 @@ public final class RequestRestart extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (player.getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE))
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
sendPacket(RestartResponse.valueOf(false));
|
||||
return;
|
||||
@ -90,13 +89,6 @@ public final class RequestRestart extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInsideZone(ZoneId.BATTALION) && !Config.BTZ_RESTART_ZONE)
|
||||
{
|
||||
player.sendMessage("You cannot restart while inside a Battalion zone.");
|
||||
sendPacket(RestartResponse.valueOf(false));
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isBlockedFromExit())
|
||||
{
|
||||
sendPacket(RestartResponse.valueOf(false));
|
||||
|
@ -144,7 +144,7 @@ public final class RequestSendPost extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
if (activeChar.hasItemRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_SEND_MAIL_WHILE_ENCHANTING_AN_ITEM_BESTOWING_AN_ATTRIBUTE_OR_COMBINING_JEWELS);
|
||||
return;
|
||||
|
@ -109,7 +109,7 @@ public final class SendWareHouseDepositList extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to use enchant Exploit!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
|
@ -77,7 +77,7 @@ public final class TradeDone extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((trade.getOwner().getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (trade.getPartner().getActiveEnchantItemId() != L2PcInstance.ID_NONE))
|
||||
if ((trade.getOwner().hasItemRequest()) || (trade.getPartner().hasItemRequest()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -42,8 +42,6 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.items.type.ArmorType;
|
||||
import com.l2jserver.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.model.zone.type.L2BattalionZone;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExUseSharedGroupItem;
|
||||
@ -129,12 +127,6 @@ public final class UseItem extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isInsideZone(ZoneId.BATTALION) && !L2BattalionZone.checkItem(item))
|
||||
{
|
||||
getClient().getActiveChar().sendMessage("You cannot use " + item.getName() + " inside this zone.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getItem().getType2() == L2Item.TYPE2_QUEST)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS);
|
||||
|
@ -18,47 +18,131 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.adenadistribution;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2CommandChannel;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.AdenaDistributionRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.adenadistribution.ExDivideAdenaCancel;
|
||||
import com.l2jserver.gameserver.network.serverpackets.adenadistribution.ExDivideAdenaDone;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestDivideAdena extends L2GameClientPacket
|
||||
{
|
||||
private long _count;
|
||||
private int _adenaObjId;
|
||||
private long _adenaCount;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
readD();
|
||||
_count = readQ();
|
||||
_adenaObjId = readD();
|
||||
_adenaCount = readQ();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final long count = activeChar.getAdena();
|
||||
if (_count > count)
|
||||
|
||||
final AdenaDistributionRequest request = player.getRequest(AdenaDistributionRequest.class);
|
||||
|
||||
if (request == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_THERE_IS_INSUFFICIENT_ADENA);
|
||||
return;
|
||||
}
|
||||
final int membersCount = activeChar.getParty().getMemberCount();
|
||||
final long dividedCount = (long) Math.floor(_count / membersCount);
|
||||
activeChar.reduceAdena("AdenaDistribution", membersCount * dividedCount, null, false);
|
||||
for (L2PcInstance player : activeChar.getParty().getMembers())
|
||||
else if (request.getDistributor() != player)
|
||||
{
|
||||
player.addAdena("AdenaDistribution", dividedCount, null, player.getObjectId() != activeChar.getObjectId());
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
else if (request.getAdenaObjectId() != _adenaObjId)
|
||||
{
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Party party = player.getParty();
|
||||
|
||||
if (party == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_IN_AN_ALLIANCE_OR_PARTY);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2CommandChannel commandChannel = party.getCommandChannel();
|
||||
|
||||
if ((commandChannel != null) && !commandChannel.isLeader(player))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_AN_ALLIANCE_LEADER_OR_PARTY_LEADER);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
else if (!party.isLeader(player))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_A_PARTY_LEADER);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2PcInstance> targets = commandChannel != null ? commandChannel.getMembers() : party.getMembers();
|
||||
|
||||
if (player.getAdena() < targets.size())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_THERE_IS_INSUFFICIENT_ADENA);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getAdena() < request.getAdenaCount())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ADENA_IN_POSSESSION_HAS_BEEN_DECREASED_ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
else if (targets.size() < request.getPlayers().size())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_DISTRIBUTION_PARTICIPANTS_HAVE_CHANGED_ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
else if (player.getAdena() < _adenaCount)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.DISTRIBUTION_CANNOT_PROCEED_AS_THERE_IS_INSUFFICIENT_ADENA_FOR_DISTRIBUTION);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
final long memberAdenaGet = (long) Math.floor(_adenaCount / targets.size());
|
||||
if (player.reduceAdena("Adena Distribution", memberAdenaGet * targets.size(), player, false))
|
||||
{
|
||||
for (L2PcInstance target : targets)
|
||||
{
|
||||
if ((target == null))
|
||||
{
|
||||
// TODO : handle that case here + regive adena OR filter with Objects::nonNull on memberCount ?
|
||||
// those sys msg exists and bother me ADENA_WAS_NOT_DISTRIBUTED_TO_S1 / YOU_DID_NOT_RECEIVE_ADENA_DISTRIBUTION
|
||||
continue;
|
||||
}
|
||||
target.addAdena("Adena Distribution", memberAdenaGet, player, false);
|
||||
target.sendPacket(new ExDivideAdenaDone(_adenaCount, memberAdenaGet, targets.size(), player.getName()));
|
||||
target.removeRequest(AdenaDistributionRequest.class);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cancelDistribution(request);
|
||||
}
|
||||
activeChar.sendPacket(new ExDivideAdenaDone(membersCount, _count, dividedCount, activeChar.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -66,4 +150,14 @@ public class RequestDivideAdena extends L2GameClientPacket
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelDistribution(AdenaDistributionRequest request)
|
||||
{
|
||||
request.getPlayers().stream().filter(Objects::nonNull).forEach(p ->
|
||||
{
|
||||
p.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
p.sendPacket(ExDivideAdenaCancel.STATIC_PACKET);
|
||||
p.removeRequest(AdenaDistributionRequest.class);
|
||||
});
|
||||
}
|
||||
}
|
@ -18,36 +18,45 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.adenadistribution;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.AdenaDistributionRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.adenadistribution.ExDivideAdenaCancel;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestDivideAdenaCancel extends L2GameClientPacket
|
||||
{
|
||||
private int _cancel;
|
||||
private boolean _cancel;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_cancel = readC();
|
||||
_cancel = readC() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_cancel == 0)
|
||||
|
||||
if (_cancel)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
activeChar.sendPacket(new ExDivideAdenaCancel());
|
||||
final AdenaDistributionRequest request = player.getRequest(AdenaDistributionRequest.class);
|
||||
request.getPlayers().stream().filter(Objects::nonNull).forEach(p ->
|
||||
{
|
||||
p.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
p.sendPacket(ExDivideAdenaCancel.STATIC_PACKET);
|
||||
p.removeRequest(AdenaDistributionRequest.class);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,41 +18,80 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.adenadistribution;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2CommandChannel;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.AdenaDistributionRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.adenadistribution.ExDivideAdenaStart;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestDivideAdenaStart extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// Nothing to read
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (activeChar.getParty() == null)
|
||||
|
||||
final L2Party party = player.getParty();
|
||||
|
||||
if (party == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_IN_AN_ALLIANCE_OR_PARTY);
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_IN_AN_ALLIANCE_OR_PARTY);
|
||||
return;
|
||||
}
|
||||
if (activeChar.getParty().getLeaderObjectId() != activeChar.getObjectId())
|
||||
|
||||
final L2CommandChannel commandChannel = party.getCommandChannel();
|
||||
|
||||
if ((commandChannel != null) && !commandChannel.isLeader(player))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_A_PARTY_LEADER);
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_AN_ALLIANCE_LEADER_OR_PARTY_LEADER);
|
||||
return;
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_STARTED);
|
||||
activeChar.sendPacket(new ExDivideAdenaStart());
|
||||
else if (!party.isLeader(player))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_A_PARTY_LEADER);
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2PcInstance> targets = commandChannel != null ? commandChannel.getMembers() : party.getMembers();
|
||||
|
||||
if (player.getAdena() < targets.size())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_THERE_IS_INSUFFICIENT_ADENA);
|
||||
return;
|
||||
}
|
||||
|
||||
if (targets.stream().anyMatch(t -> t.hasRequest(AdenaDistributionRequest.class)))
|
||||
{
|
||||
// Handle that case ?
|
||||
return;
|
||||
}
|
||||
|
||||
final int adenaObjectId = player.getInventory().getAdenaInstance().getObjectId();
|
||||
|
||||
targets.forEach(t ->
|
||||
{
|
||||
t.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_STARTED);
|
||||
t.addRequest(new AdenaDistributionRequest(t, player, targets, adenaObjectId, player.getAdena()));
|
||||
});
|
||||
|
||||
player.sendPacket(ExDivideAdenaStart.STATIC_PACKET);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager.Auctions;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionBuyInfo;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionBuyInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A1_REQUESTCOMMISSIONBUYINFO = "[C] D0:A1 RequestCommissionBuyInfo";
|
||||
|
||||
private long _auctionID;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_auctionID = readQ();
|
||||
readD(); // Category - unused
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
Auctions auction = am.getAuctionById(_auctionID);
|
||||
if (auction != null)
|
||||
{
|
||||
if (activeChar.getObjectId() == auction.getPlayerID())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ITEM_PURCHASE_HAS_FAILED);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(new ExResponseCommissionBuyInfo(auction));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A1_REQUESTCOMMISSIONBUYINFO;
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.enums.MailType;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager.Auctions;
|
||||
import com.l2jserver.gameserver.instancemanager.MailManager;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Message;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionItemList;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionBuyItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A2_REQUESTCOMMISSIONREGISTRABLEITEMLIST = "[C] D0:A2 RequestCommissionRegistrableItemList";
|
||||
|
||||
private long _auctionID;
|
||||
private int _category;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_auctionID = readQ();
|
||||
_category = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
Auctions auction;
|
||||
if (am.getAuctionById(_auctionID) != null)
|
||||
{
|
||||
auction = am.getAuctionById(_auctionID);
|
||||
long fee = auction.getPrice();
|
||||
switch (auction.getDuration())
|
||||
{
|
||||
case 0:
|
||||
fee *= 0.005;
|
||||
break;
|
||||
case 1:
|
||||
fee *= 0.015;
|
||||
break;
|
||||
case 2:
|
||||
fee *= 0.025;
|
||||
break;
|
||||
case 3:
|
||||
fee *= 0.035;
|
||||
}
|
||||
if (fee < 10000)
|
||||
{
|
||||
fee = 1000;
|
||||
}
|
||||
long price = auction.getPrice() * auction.getCount();
|
||||
if ((player.getInventory().getItemByItemId(57) == null) || (player.getInventory().getItemByItemId(57).getCount() < price))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
player.sendPacket(new ExResponseCommissionList(player, _category, -1, -1, ""));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
return;
|
||||
}
|
||||
player.getInventory().destroyItemByItemId("BuyFromAuction", 57, price, null, null);
|
||||
player.getInventory().addItem("BuyFromAuction", auction.getItem().getId(), auction.getCount(), player, null);
|
||||
Message msg = new Message(auction.getPlayerID(), "The item you registered has been sold.", auction.getItemName() + " has been sold.", MailType.SYSTEM);
|
||||
if ((price - fee) > 0)
|
||||
{
|
||||
msg.createAttachments().addItem("BuyFromAuction", 57, (price - fee), null, null);
|
||||
}
|
||||
MailManager.getInstance().sendMessage(msg);
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_SUCCESSFULLY_PURCHASED_S2_OF_S1);
|
||||
sm.addLong(auction.getCount());
|
||||
sm.addString(auction.getItemName());
|
||||
player.sendPacket(sm);
|
||||
if (L2World.getInstance().getPlayer(auction.getPlayerID()) != null)
|
||||
{
|
||||
L2PcInstance seller = L2World.getInstance().getPlayer(auction.getPlayerID());
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_YOU_REGISTERED_HAS_BEEN_SOLD);
|
||||
seller.sendPacket(sm);
|
||||
}
|
||||
|
||||
am.deleteAuction(_auctionID);
|
||||
player.sendPacket(new ExResponseCommissionList(player, _category, -1, -1, ""));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
player.sendPacket(new ExResponseCommissionList(player, _category, -1, -1, ""));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A2_REQUESTCOMMISSIONREGISTRABLEITEMLIST;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
public final class RequestCommissionCancel extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A3_REQUESTCOMMISSIONCANCEL = "[C] D0:A3 RequestCommissionCancel";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A3_REQUESTCOMMISSIONCANCEL;
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager.Auctions;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionDelete;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionItemList;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionDelete extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_9F_REQUESTCOMMISSIONDELETE = "[C] D0:9F RequestCommissionDelete";
|
||||
|
||||
long _auctionID;
|
||||
int _category;
|
||||
int _duration;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_auctionID = readQ();
|
||||
_category = readD();
|
||||
_duration = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
am.checkForAuctionsDeletion();
|
||||
Auctions auction = am.getAuctionById(_auctionID);
|
||||
if (auction != null)
|
||||
{
|
||||
player.addItem("DeleteAuction", auction.getItem(), null, false);
|
||||
player.getAuctionInventory().destroyItemByItemId("DeleteAuction", auction.getItem().getId(), auction.getCount(), player, null);
|
||||
am.deleteAuction(_auctionID);
|
||||
player.sendPacket(SystemMessageId.CANCELLATION_OF_SALE_FOR_THE_ITEM_IS_SUCCESSFUL);
|
||||
player.sendPacket(new ExResponseCommissionDelete(true));
|
||||
player.sendPacket(new ExResponseCommissionList(player));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
player.sendPacket(new ExResponseCommissionDelete(false));
|
||||
player.sendPacket(new ExResponseCommissionList(player));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_9F_REQUESTCOMMISSIONDELETE;
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionInfo;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_9C_REQUESTCOMMISSIONINFO = "[C] D0:9C RequestCommissionInfo";
|
||||
|
||||
private int _itemOID;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemOID = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.sendPacket(new ExResponseCommissionInfo(player, _itemOID, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_9C_REQUESTCOMMISSIONINFO;
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionList extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A0_REQUESTCOMMISSIONLIST = "[C] D0:A0 RequestCommissionList";
|
||||
|
||||
private long _category;
|
||||
private int _type;
|
||||
private int _grade;
|
||||
private String _searchName;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_category = readQ();
|
||||
_type = readD();
|
||||
_grade = readD();
|
||||
_searchName = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
|
||||
if (_category == 0)
|
||||
{
|
||||
_category = 100;
|
||||
}
|
||||
else if (_category == 1)
|
||||
{
|
||||
_category = 101;
|
||||
}
|
||||
|
||||
if ((_category != 101) && (_category != 100) && ((_category % 10000) != 7297) && ((_category % 10000) != 4593) && ((_category % 10000) != 1889) && ((_category % 10000) != 9185) && ((_category % 10000) != 6481))
|
||||
{
|
||||
_category = am.getClientCategory((int) (_category / 1000));
|
||||
}
|
||||
else if ((_category != 101) && (_category != 100))
|
||||
{
|
||||
_category = am.getMainClientCategory((int) (_category / 1000));
|
||||
}
|
||||
|
||||
if (((_category > 60) && (_category < 66)) || (_category == 101))
|
||||
{
|
||||
if (am.getAuctionsSizeById(_category, _grade, _searchName) > 999)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THE_SEARCH_RESULT_EXCEEDED_THE_MAXIMUM_ALLOWED_RANGE_FOR_OUTPUT_PLEASE_SEARCH_BY_SELECTING_DETAILED_CATEGORY);
|
||||
}
|
||||
else if (am.getAuctionsSizeById(_category, _grade, _searchName) <= 0)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CURRENTLY_THERE_ARE_NO_REGISTERED_ITEMS);
|
||||
}
|
||||
}
|
||||
else if (_category == 100)
|
||||
{
|
||||
if (am.getAuctionsSizeById(_grade, _searchName) > 999)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THE_SEARCH_RESULT_EXCEEDED_THE_MAXIMUM_ALLOWED_RANGE_FOR_OUTPUT_PLEASE_SEARCH_BY_SELECTING_DETAILED_CATEGORY);
|
||||
}
|
||||
}
|
||||
|
||||
am.checkForAuctionsDeletion();
|
||||
activeChar.sendPacket(new ExResponseCommissionList(activeChar, _category, _type, _grade, _searchName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A0_REQUESTCOMMISSIONLIST;
|
||||
}
|
||||
}
|
@ -1,157 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.datatables.ItemTable;
|
||||
import com.l2jserver.gameserver.idfactory.IdFactory;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionItemList;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionRegister;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionRegister extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_9D_REQUESTCOMMISSIONREGISTER = "[C] D0:9D RequestCommissionRegister";
|
||||
|
||||
private int _itemOID;
|
||||
private String _itemName;
|
||||
private long _price;
|
||||
private long _count;
|
||||
private int _duration;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemOID = readD();
|
||||
_itemName = readS();
|
||||
_price = readQ();
|
||||
_count = readQ();
|
||||
_duration = readD();
|
||||
readQ(); // Unknown
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
long destroyPrice = _price;
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
am.checkForAuctionsDeletion();
|
||||
long timeToAdd = 0;
|
||||
switch (_duration)
|
||||
{
|
||||
case 0:
|
||||
timeToAdd = 86400000;
|
||||
destroyPrice *= 0.0001;
|
||||
break;
|
||||
case 1:
|
||||
timeToAdd = 259200000;
|
||||
destroyPrice *= 0.0003;
|
||||
break;
|
||||
case 2:
|
||||
timeToAdd = 432000000;
|
||||
destroyPrice *= 0.0005;
|
||||
break;
|
||||
case 3:
|
||||
timeToAdd = 604800000;
|
||||
destroyPrice *= 0.0007;
|
||||
}
|
||||
|
||||
if (destroyPrice < 1000)
|
||||
{
|
||||
destroyPrice = 1000;
|
||||
}
|
||||
|
||||
if ((player.getInventory().getItemByItemId(57) == null) || (player.getInventory().getItemByItemId(57).getCount() < destroyPrice))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
reloadAuction(player, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getInventory().getItemByObjectId(_itemOID) == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.REGISTRATION_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
reloadAuction(player, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getInventory().getItemByObjectId(_itemOID).isEquipped())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_THAT_IS_CURRENTLY_WORN_CANNOT_BE_REGISTERED);
|
||||
reloadAuction(player, false);
|
||||
return;
|
||||
}
|
||||
|
||||
final int itemID = player.getInventory().getItemByObjectId(_itemOID).getId();
|
||||
final L2Item item = ItemTable.getInstance().getTemplate(itemID);
|
||||
|
||||
if (((player.getAuctionInventory().getSize() >= 10) && !player.isGM()) || ((player.getAuctionInventory().getSize() >= 99999) && player.isGM()) || !item.isTradeable() || !item.isSellable())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_CANNOT_BE_REGISTERED_BECAUSE_REQUIREMENTS_ARE_NOT_MET);
|
||||
reloadAuction(player, false);
|
||||
return;
|
||||
}
|
||||
|
||||
final int category = am.getCategoryByItem(player.getInventory().getItemByObjectId(_itemOID));
|
||||
player.getInventory().destroyItemByItemId("CreateAuction", 57, destroyPrice, null, null);
|
||||
player.getInventory().transferItem("CreateAuction", _itemOID, _count, player.getAuctionInventory(), player, null);
|
||||
final long finishTime = (System.currentTimeMillis() + timeToAdd) / 1000;
|
||||
|
||||
int auctionID = IdFactory.getInstance().getNextId();
|
||||
if (player.getAuctionInventory().getItemByObjectId(_itemOID) == null)
|
||||
{
|
||||
am.createAuction(auctionID, player.getObjectId(), _itemOID, player.getAuctionInventory().getItemByItemId(itemID), _itemName, _price, _count, _duration, finishTime, category);
|
||||
}
|
||||
else
|
||||
{
|
||||
am.createAuction(auctionID, player.getObjectId(), _itemOID, player.getAuctionInventory().getItemByObjectId(_itemOID), _itemName, _price, _count, _duration, finishTime, category);
|
||||
}
|
||||
am.insertAuction(am.getAuctionById(auctionID));
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_HAS_BEEN_SUCCESSFULLY_REGISTERED);
|
||||
InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(player.getInventory().getItemByItemId(57));
|
||||
iu.addModifiedItem(player.getAuctionInventory().getItemByObjectId(_itemOID));
|
||||
player.sendPacket(iu);
|
||||
reloadAuction(player, true);
|
||||
}
|
||||
|
||||
private void reloadAuction(L2PcInstance player, boolean success)
|
||||
{
|
||||
player.sendPacket(new ExResponseCommissionRegister(success));
|
||||
player.sendPacket(new ExResponseCommissionList(player));
|
||||
player.sendPacket(new ExResponseCommissionInfo(player, 0, success));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_9D_REQUESTCOMMISSIONREGISTER;
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionRegisteredItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A3_REQUESTCOMMISSIONREGISTEREDITEM = "[C] D0:A3 RequestCommissionRegisteredItem";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
|
||||
am.checkForAuctionsDeletion();
|
||||
|
||||
player.sendPacket(new ExResponseCommissionList(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A3_REQUESTCOMMISSIONREGISTEREDITEM;
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionItemList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionRegistrableItemList extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_9B_REQUESTCOMMISSIONREGISTRABLEITEMLIST = "[C] D0:9B RequestCommissionRegistrableItemList";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_9B_REQUESTCOMMISSIONREGISTRABLEITEMLIST;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.commission.CommissionItem;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionBuyInfo;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionBuyInfo extends L2GameClientPacket
|
||||
{
|
||||
private long _commissionId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_commissionId = readQ();
|
||||
// readD(); // CommissionItemType
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getInventory().getSize(false) >= (player.getInventoryLimit() * 0.8)) || (player.getWeightPenalty() >= 3))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.IF_THE_WEIGHT_IS_80_OR_MORE_AND_THE_INVENTORY_NUMBER_IS_90_OR_MORE_PURCHASE_CANCELLATION_IS_NOT_POSSIBLE);
|
||||
player.sendPacket(ExResponseCommissionBuyInfo.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
final CommissionItem commissionItem = CommissionManager.getInstance().getCommissionItem(_commissionId);
|
||||
if (commissionItem != null)
|
||||
{
|
||||
player.sendPacket(new ExResponseCommissionBuyInfo(commissionItem));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
player.sendPacket(ExResponseCommissionBuyInfo.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionBuyItem extends L2GameClientPacket
|
||||
{
|
||||
private long _commissionId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_commissionId = readQ();
|
||||
// readD(); // CommissionItemType
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
CommissionManager.getInstance().buyItem(player, _commissionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
/**
|
||||
* This Packet doesn't seem to be doing anything.
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionCancel extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionDelete extends L2GameClientPacket
|
||||
{
|
||||
private long _commissionId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_commissionId = readQ();
|
||||
// readD(); // CommissionItemType
|
||||
// readD(); // CommissionDurationType
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
CommissionManager.getInstance().deleteItem(player, _commissionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionInfo extends L2GameClientPacket
|
||||
{
|
||||
private int _itemObjectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemObjectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance itemInstance = player.getInventory().getItemByObjectId(_itemObjectId);
|
||||
if (itemInstance != null)
|
||||
{
|
||||
player.sendPacket(player.getLastCommissionInfos().getOrDefault(itemInstance.getId(), ExResponseCommissionInfo.EMPTY));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(ExResponseCommissionInfo.EMPTY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.commission;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.commission.CommissionItemType;
|
||||
import com.l2jserver.gameserver.model.commission.CommissionTreeType;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionList extends L2GameClientPacket
|
||||
{
|
||||
private int _treeViewDepth;
|
||||
private int _itemType;
|
||||
private int _type;
|
||||
private int _grade;
|
||||
private String _query;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_treeViewDepth = readD();
|
||||
_itemType = readD();
|
||||
_type = readD();
|
||||
_grade = readD();
|
||||
_query = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
Predicate<L2Item> filter = i -> true;
|
||||
switch (_treeViewDepth)
|
||||
{
|
||||
case 1:
|
||||
final CommissionTreeType commissionTreeType = CommissionTreeType.findByClientId(_itemType);
|
||||
if (commissionTreeType != null)
|
||||
{
|
||||
filter = filter.and(i -> commissionTreeType.getCommissionItemTypes().contains(i.getCommissionItemType()));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
final CommissionItemType commissionItemType = CommissionItemType.findByClientId(_itemType);
|
||||
if (commissionItemType != null)
|
||||
{
|
||||
filter = filter.and(i -> i.getCommissionItemType() == commissionItemType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
{
|
||||
case 0: // General
|
||||
filter = filter.and(i -> true); // TODO: condition
|
||||
break;
|
||||
case 1: // Rare
|
||||
filter = filter.and(i -> true); // TODO: condition
|
||||
break;
|
||||
}
|
||||
|
||||
switch (_grade)
|
||||
{
|
||||
case 0:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.NONE);
|
||||
break;
|
||||
case 1:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.D);
|
||||
break;
|
||||
case 2:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.C);
|
||||
break;
|
||||
case 3:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.B);
|
||||
break;
|
||||
case 4:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.A);
|
||||
break;
|
||||
case 5:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.S);
|
||||
break;
|
||||
case 6:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.S80);
|
||||
break;
|
||||
case 7:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.R);
|
||||
break;
|
||||
case 8:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.R95);
|
||||
break;
|
||||
case 9:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.R99);
|
||||
break;
|
||||
}
|
||||
|
||||
filter = filter.and(i -> _query.isEmpty() || i.getName().toLowerCase().contains(_query.toLowerCase()));
|
||||
|
||||
CommissionManager.getInstance().showAuctions(player, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionRegister extends L2GameClientPacket
|
||||
{
|
||||
private int _itemObjectId;
|
||||
private long _pricePerUnit;
|
||||
private long _itemCount;
|
||||
private int _durationType; // -1 = None, 0 = 1 Day, 1 = 3 Days, 2 = 5 Days, 3 = 7 Days
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemObjectId = readD();
|
||||
readS(); // Item Name they use it for search we will use server side available names.
|
||||
_pricePerUnit = readQ();
|
||||
_itemCount = readQ();
|
||||
_durationType = readD();
|
||||
// readD(); // Unknown
|
||||
// readD(); // Unknown
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_durationType < 0) || (_durationType > 3))
|
||||
{
|
||||
_log.warning("Player " + player + " sent incorrect commission duration type: " + _durationType + ".");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
CommissionManager.getInstance().registerItem(player, _itemObjectId, _itemCount, _pricePerUnit, (byte) ((_durationType * 2) + 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionRegisteredItem extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
CommissionManager.getInstance().showPlayerAuctions(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.commission;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionItemList;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionRegistrableItemList extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExResponseCommissionItemList(Arrays.asList(player.getInventory().getAvailableItems(false, false, false))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -19,35 +19,30 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantClose extends L2GameClientPacket
|
||||
public class RequestNewEnchantClose extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F8_REQUESTNEWENCHANTCLOSE = "[C] D0:F8 RequestNewEnchantClose";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
activeChar.setFirstCompoundOID(-1);
|
||||
activeChar.setSecondCompoundOID(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F8_REQUESTNEWENCHANTCLOSE;
|
||||
|
||||
activeChar.removeRequest(CompoundRequest.class);
|
||||
}
|
||||
}
|
||||
|
@ -19,56 +19,72 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneOK;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantPushOne extends L2GameClientPacket
|
||||
public class RequestNewEnchantPushOne extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F4_REQUESTNEWENCHANTPUSHONE = "[C] D0:F4 RequestNewEnchantPushOne";
|
||||
|
||||
private int _itemId;
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
_objectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_itemId);
|
||||
if (item == null)
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
final int secondCompoundOID = activeChar.getSecondCompoundOID();
|
||||
final L2ItemInstance secondItem = activeChar.getInventory().getItemByObjectId(secondCompoundOID);
|
||||
if ((item.getItem().getBodyPart() != L2Item.SLOT_BROOCH_JEWEL) || ((secondItem != null) && ((secondItem.getObjectId() == item.getObjectId()) || (secondItem.getId() != item.getId()))) || ((item.getId() == 38931) || ((item.getId() % 10) == 4) || ((item.getId() % 10) == 9)))
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantOneFail());
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
final CompoundRequest request = new CompoundRequest(activeChar);
|
||||
if (!activeChar.addRequest(request))
|
||||
{
|
||||
activeChar.setFirstCompoundOID(_itemId);
|
||||
activeChar.sendPacket(new ExEnchantOneOK());
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F4_REQUESTNEWENCHANTPUSHONE;
|
||||
|
||||
// Make sure player owns this item.
|
||||
request.setItemOne(_objectId);
|
||||
final L2ItemInstance itemOne = request.getItemOne();
|
||||
if (itemOne == null)
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if ((itemOne.getItem().getCompoundItem() == 0) || (itemOne.getItem().getCompoundChance() == 0))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantOneOK.STATIC_PACKET);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(ExEnchantOneOK.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@ -19,56 +19,86 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoOK;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantPushTwo extends L2GameClientPacket
|
||||
public class RequestNewEnchantPushTwo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F6_REQUESTNEWENCHANTPUSHTWO = "[C] D0:F6 RequestNewEnchantPushTwo";
|
||||
|
||||
private int _itemId;
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
_objectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_itemId);
|
||||
if (item == null)
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
final int firstCompoundOID = activeChar.getFirstCompoundOID();
|
||||
final L2ItemInstance firstItem = activeChar.getInventory().getItemByObjectId(firstCompoundOID);
|
||||
if ((item.getItem().getBodyPart() != L2Item.SLOT_BROOCH_JEWEL) || ((firstItem != null) && ((firstItem.getObjectId() == item.getObjectId()) || (firstItem.getId() != item.getId()))) || ((item.getId() == 38931) || ((item.getId() % 10) == 4) || ((item.getId() % 10) == 9)))
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantTwoFail());
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
final CompoundRequest request = activeChar.getRequest(CompoundRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.setSecondCompoundOID(_itemId);
|
||||
activeChar.sendPacket(new ExEnchantTwoOK());
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F6_REQUESTNEWENCHANTPUSHTWO;
|
||||
|
||||
// Make sure player owns this item.
|
||||
request.setItemTwo(_objectId);
|
||||
final L2ItemInstance itemOne = request.getItemOne();
|
||||
final L2ItemInstance itemTwo = request.getItemTwo();
|
||||
if ((itemOne == null) || (itemTwo == null))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Lets prevent using same item twice
|
||||
if (itemOne.getObjectId() == itemTwo.getObjectId())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Combining only same items!
|
||||
if (itemOne.getItem().getId() != itemTwo.getItem().getId())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if ((itemOne.getItem().getCompoundItem() == 0) || (itemOne.getItem().getCompoundChance() == 0))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(ExEnchantTwoOK.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@ -19,38 +19,63 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneRemoveFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneRemoveOK;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantRemoveOne extends L2GameClientPacket
|
||||
public class RequestNewEnchantRemoveOne extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F5_REQUESTNEWENCHANTREMOVEONE = "[C] D0:F4 RequestNewEnchantRemoveOne";
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int _itemId;
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
_objectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
System.out.println(_C__D0_F5_REQUESTNEWENCHANTREMOVEONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F5_REQUESTNEWENCHANTREMOVEONE;
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final CompoundRequest request = activeChar.getRequest(CompoundRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantOneRemoveFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = request.getItemOne();
|
||||
if ((item == null) || (item.getObjectId() != _objectId))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantOneRemoveFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
request.setItemOne(0);
|
||||
|
||||
activeChar.sendPacket(ExEnchantOneRemoveOK.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@ -19,38 +19,63 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoRemoveFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoRemoveOK;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantRemoveTwo extends L2GameClientPacket
|
||||
public class RequestNewEnchantRemoveTwo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F7_REQUESTNEWENCHANTREMOVETWO = "[C] D0:F7 RequestNewEnchantRemoveTwo";
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int _itemId;
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
_objectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
System.out.println(_C__D0_F7_REQUESTNEWENCHANTREMOVETWO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F7_REQUESTNEWENCHANTREMOVETWO;
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final CompoundRequest request = activeChar.getRequest(CompoundRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoRemoveFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = request.getItemTwo();
|
||||
if ((item == null) || (item.getObjectId() != _objectId))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoRemoveFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
request.setItemTwo(0);
|
||||
|
||||
activeChar.sendPacket(ExEnchantTwoRemoveOK.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@ -18,89 +18,122 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExAdenaInvenCount;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExUserInfoInvenWeight;
|
||||
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantSucess;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantTry extends L2GameClientPacket
|
||||
public class RequestNewEnchantTry extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F9_REQUESTNEWENCHANTTRY = "[C] D0:F9 RequestNewEnchantTry";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance firstItem = activeChar.getInventory().getItemByObjectId(activeChar.getFirstCompoundOID());
|
||||
final L2ItemInstance secondItem = activeChar.getInventory().getItemByObjectId(activeChar.getSecondCompoundOID());
|
||||
if ((firstItem == null) || (secondItem == null))
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
int levelOfStone = 0;
|
||||
if (firstItem.getId() < 38900)
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
levelOfStone = (firstItem.getId() % 5) + 1;
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final CompoundRequest request = activeChar.getRequest(CompoundRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
request.setProcessing(true);
|
||||
|
||||
final L2ItemInstance itemOne = request.getItemOne();
|
||||
final L2ItemInstance itemTwo = request.getItemTwo();
|
||||
if ((itemOne == null) || (itemTwo == null))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantFail.STATIC_PACKET);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// Lets prevent using same item twice
|
||||
if (itemOne.getObjectId() == itemTwo.getObjectId())
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(itemOne.getItem().getId(), itemTwo.getItem().getId()));
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// Combining only same items!
|
||||
if (itemOne.getItem().getId() != itemTwo.getItem().getId())
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(itemOne.getItem().getId(), itemTwo.getItem().getId()));
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if ((itemOne.getItem().getCompoundItem() == 0) || (itemOne.getItem().getCompoundChance() == 0))
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(itemOne.getItem().getId(), itemTwo.getItem().getId()));
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
final double random = Rnd.nextDouble() * 100;
|
||||
|
||||
// Success
|
||||
if (random < itemOne.getItem().getCompoundChance())
|
||||
{
|
||||
iu.addRemovedItem(itemOne);
|
||||
iu.addRemovedItem(itemTwo);
|
||||
|
||||
if (activeChar.destroyItem("Compound-Item-One", itemOne, null, true) && activeChar.destroyItem("Compound-Item-Two", itemTwo, null, true))
|
||||
{
|
||||
final L2ItemInstance item = activeChar.addItem("Compound-Result", itemOne.getItem().getCompoundItem(), 1, null, true);
|
||||
activeChar.sendPacket(new ExEnchantSucess(item.getItem().getId()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
levelOfStone = (firstItem.getId() - 38926);
|
||||
iu.addRemovedItem(itemTwo);
|
||||
|
||||
// Upon fail we destroy the second item.
|
||||
if (activeChar.destroyItem("Compound-Item-Two-Fail", itemTwo, null, true))
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(itemOne.getItem().getId(), itemTwo.getItem().getId()));
|
||||
}
|
||||
}
|
||||
if ((levelOfStone == 0) || (levelOfStone == 5))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int percent = 0;
|
||||
switch (levelOfStone)
|
||||
{
|
||||
case 1:
|
||||
percent = Config.SECOND_LEVEL_UPGRADE_CHANCE;
|
||||
break;
|
||||
case 2:
|
||||
percent = Config.THIRD_LEVEL_UPGRADE_CHANCE;
|
||||
break;
|
||||
case 3:
|
||||
percent = Config.FOURTH_LEVEL_UPGRADE_CHANCE;
|
||||
break;
|
||||
case 4:
|
||||
percent = Config.FITH_LEVEL_UPGRADE_CHANCE;
|
||||
break;
|
||||
}
|
||||
if (Rnd.get(100) <= percent)
|
||||
{
|
||||
int newItem = firstItem.getId() + 1;
|
||||
activeChar.destroyItem("FirstCompoundItem", firstItem, null, true);
|
||||
activeChar.destroyItem("SecondCompoundItem", secondItem, null, true);
|
||||
activeChar.addItem("CompoundItem", newItem, 1, null, true);
|
||||
activeChar.sendPacket(new ExEnchantSucess(newItem));
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(firstItem.getId(), secondItem.getId()));
|
||||
activeChar.destroyItem("SecondCompoundItem", secondItem, null, true);
|
||||
}
|
||||
activeChar.setFirstCompoundOID(-1);
|
||||
activeChar.setSecondCompoundOID(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F9_REQUESTNEWENCHANTTRY;
|
||||
|
||||
activeChar.sendPacket(iu);
|
||||
activeChar.sendPacket(new ExAdenaInvenCount(activeChar));
|
||||
activeChar.sendPacket(new ExUserInfoInvenWeight(activeChar));
|
||||
activeChar.removeRequest(request.getClass());
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import java.util.Calendar;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.PrimeShopRequest;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopGroup;
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopItem;
|
||||
@ -58,13 +59,13 @@ public final class RequestBRBuyProduct extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isUsingPrimeShop())
|
||||
if (activeChar.hasItemRequest() || activeChar.hasRequest(PrimeShopRequest.class))
|
||||
{
|
||||
activeChar.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_USER_STATE));
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.setUsingPrimeShop(true);
|
||||
activeChar.addRequest(new PrimeShopRequest(activeChar));
|
||||
|
||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||
if (validatePlayer(item, _count, activeChar))
|
||||
@ -104,7 +105,7 @@ public final class RequestBRBuyProduct extends L2GameClientPacket
|
||||
activeChar.sendPacket(new ExBRGamePoint(activeChar));
|
||||
}
|
||||
|
||||
activeChar.setUsingPrimeShop(false);
|
||||
activeChar.removeRequest(PrimeShopRequest.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user