/*
* 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 silentium.gameserver.network.clientpackets;
import silentium.gameserver.RecipeController;
import silentium.gameserver.model.L2World;
import silentium.gameserver.model.actor.instance.L2PcInstance;
import silentium.gameserver.network.SystemMessageId;
import silentium.gameserver.utils.Util;
/**
* @author Administrator
*/
public final class RequestRecipeShopMakeItem extends L2GameClientPacket
{
private int _id;
private int _recipeId;
private int _unknow;
@Override
protected void readImpl()
{
_id = readD();
_recipeId = readD();
_unknow = readD();
}
@Override
protected void runImpl()
{
if (!getClient().getFloodProtectors().getManufacture().tryPerformAction("shopMake"))
return;
final L2PcInstance activeChar = getClient().getActiveChar();
if (activeChar == null)
return;
final L2PcInstance manufacturer = L2World.getInstance().getPlayer(_id);
if (manufacturer == null)
return;
if (activeChar.getPrivateStoreType() != 0)
return;
if (manufacturer.getPrivateStoreType() != L2PcInstance.STORE_PRIVATE_MANUFACTURE)
return;
if (activeChar.isInCraftMode() || manufacturer.isInCraftMode())
return;
if (manufacturer.isInDuel() || activeChar.isInDuel())
{
activeChar.sendPacket(SystemMessageId.CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT);
return;
}
if (Util.checkIfInRange(150, activeChar, manufacturer, true))
RecipeController.getInstance().requestManufactureItem(manufacturer, _recipeId, activeChar);
}
}