public static final void ClearPot(final LittleEndianAccessor slea, final MapleClient c) { final int index = slea.readInt() - 1; if (index < 0 || index >= c.getPlayer().getImps().length || c.getPlayer().getImps()[index] == null) { c.getSession().write(CWvsContext.enableActions()); return; } c.getSession() .write( CWvsContext.updateImp( c.getPlayer().getImps()[index], ImpFlag.REMOVED.getValue(), index, false)); c.getPlayer().getImps()[index] = null; }
public static final void RewardPot(final LittleEndianAccessor slea, final MapleClient c) { final int index = slea.readInt() - 1; if (index < 0 || index >= c.getPlayer().getImps().length || c.getPlayer().getImps()[index] == null || c.getPlayer().getImps()[index].getLevel() < (MapleItemInformationProvider.getInstance() .getPot(c.getPlayer().getImps()[index].getItemId()) .right - 1)) { c.getSession().write(CWvsContext.enableActions()); return; } final int itemid = GameConstants.getRewardPot( c.getPlayer().getImps()[index].getItemId(), c.getPlayer().getImps()[index].getCloseness()); if (itemid <= 0 || !MapleInventoryManipulator.checkSpace(c, itemid, (short) 1, "")) { c.getPlayer().dropMessage(1, "Please make some space."); c.getSession().write(CWvsContext.enableActions()); return; } MapleInventoryManipulator.addById( c, itemid, (short) 1, "Item Pot from " + c.getPlayer().getImps()[index].getItemId() + " on " + FileoutputUtil.CurrentReadable_Date()); c.getSession() .write( CWvsContext.updateImp( c.getPlayer().getImps()[index], ImpFlag.REMOVED.getValue(), index, false)); c.getPlayer().getImps()[index] = null; }