public static void onReward(LittleEndianAccessor slea, MapleClient c) throws SQLException {
//        System.err.println("onReward");
        int id = slea.readInt();
        int type = slea.readInt();
        int itemId = slea.readInt();
        slea.readInt(); //might be item quantity
        slea.readInt(); //no idea
        slea.readLong(); //no idea
        slea.readInt(); //no idea
        int mp = slea.readInt();
        int meso = slea.readInt();
        int exp = slea.readInt();
        slea.readInt(); //no idea
        slea.readInt(); //no idea
        slea.readMapleAsciiString(); //no idea
        slea.readMapleAsciiString(); //no idea
        slea.readMapleAsciiString(); //no idea
        byte mode = slea.readByte();
        if (mode == 2) { //Decline
            c.getPlayer().deleteReward(id);
            c.getSession().write(CWvsContext.enableActions());
            return;
        } else if (mode == 1) { //Accept
            if (type < 0 || type > 5) {
                System.out.println("[Hacking Attempt] " + c.getPlayer().getName() + " has tried to receive reward with unavailable type.");
                c.getSession().write(CWvsContext.enableActions());
                return;
            }
            MapleReward reward = c.getPlayer().getReward(id);
            if (reward == null) {
                c.getSession().write(Reward.receiveReward(id, (byte) 0x15, 0));
                c.getSession().write(CWvsContext.enableActions());
                return;
            }
            if (reward.getType() != type || reward.getItem() != itemId
                    || reward.getMaplePoints() != mp || reward.getMeso() != meso
                    || reward.getExp() != exp) {
                System.out.println("[Hacking Attempt] " + c.getPlayer().getName() + " has tried to exploit the reward receive.");
                c.getSession().write(CWvsContext.enableActions());
                return;
            }
            byte msg = 0x15;
            int quantity = 0;
            switch (type) {
                case 1:
                    if (MapleInventoryManipulator.checkSpace(c, itemId, 1, "")) {
                        c.getPlayer().gainItem(itemId, 1);
                        c.getPlayer().deleteReward(id);
                        quantity = 1;
                        msg = 0x0C;
                    } else {
                        msg = 0x16;
                    }
                    break;
                case 3:
                    if (c.getPlayer().getCSPoints(2) + mp >= 0) {
                        c.getPlayer().modifyCSPoints(2, mp, false);
                        c.getPlayer().deleteReward(id);
                        quantity = mp;
                        msg = 0x0B;
                    } else {
                        msg = 0x14;
                    }
                    break;
                case 4:
                    if (c.getPlayer().getMeso() + meso < Integer.MAX_VALUE
                            && c.getPlayer().getMeso() + meso > 0) {
                        c.getPlayer().gainMeso(meso, true, true);
                        c.getPlayer().deleteReward(id);
                        quantity = meso;
                        msg = 0x0E;
                    } else {
                        msg = 0x17;
                    }
                    break;
                case 5:
                    int maxlevel = GameConstants.isKOC(c.getPlayer().getJob()) ? 120 : 200;
                    if (c.getPlayer().getLevel() < maxlevel) {
                        c.getPlayer().gainExp(exp, true, true, true);
                        c.getPlayer().deleteReward(id);
                        quantity = exp;
                        msg = 0x0F;
                    } else {
                        msg = 0x18;
                    }
                    break;
                default:
                    System.out.println("New reward type found: " + type);
                    break;
            }
            c.getSession().write(Reward.receiveReward(id, msg, quantity));
        }
        if (mode < 0 || mode > 2) {
            System.out.println("New reward mode found: " + mode);
        }
    }