/*
* 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.serverpackets;
import java.util.List;
import silentium.gameserver.instancemanager.CastleManorManager.CropProcure;
import silentium.gameserver.model.L2Manor;
/**
* Format: ch cddd[ddddcdcdcd] c - id (0xFE) h - sub id (0x1D) c d - manor id d d - size [ d - crop id d - residual buy d - start buy d - buy
* price c - reward type d - seed level c - reward 1 items d - reward 1 item id c - reward 2 items d - reward 2 item id ]
*
* @author l3x
*/
public class ExShowCropInfo extends L2GameServerPacket
{
private final List<CropProcure> _crops;
private final int _manorId;
public ExShowCropInfo(int manorId, List<CropProcure> crops)
{
_manorId = manorId;
_crops = crops;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x1D);
writeC(0);
writeD(_manorId);
writeD(0);
if (_crops == null)
{
writeD(0);
return;
}
writeD(_crops.size());
for (CropProcure crop : _crops)
{
writeD(crop.getId());
writeD(crop.getAmount());
writeD(crop.getStartAmount());
writeD(crop.getPrice());
writeC(crop.getReward());
writeD(L2Manor.getInstance().getSeedLevelByCrop(crop.getId()));
writeC(1);
writeD(L2Manor.getInstance().getRewardItem(crop.getId(), 1));
writeC(1);
writeD(L2Manor.getInstance().getRewardItem(crop.getId(), 2));
}
}
}