Cheat Engine

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Cheat Engine

The Underground Site of Cheat Engine


    [Release] Fix for Traitor's MTS

    avatar
    Admin
    Admin


    Posts : 43
    Join date : 2009-05-18

    [Release] Fix for Traitor's MTS Empty [Release] Fix for Traitor''s MTS

    Post  Admin Mon May 18, 2009 11:55 am

    This fixes the display of pages and prices.

    Open EnterMTSHandler.java and add
    Code:
        public MaplePacket getMTS(int tab, int type, int page) {
            List<MTSItemInfo> items = new ArrayList<MTSItemInfo>();
            Connection con = DatabaseConnection.getConnection();
            PreparedStatement ps;
            ResultSet rs;
            int pages = 0;
            try {
                if (type != 0) {
                    ps = con.prepareStatement("SELECT * FROM mts_items WHERE tab = ? AND type = ? AND transfer = 0 ORDER BY id DESC LIMIT ?, 16");
                } else {
                    ps = con.prepareStatement("SELECT * FROM mts_items WHERE tab = ? AND transfer = 0 ORDER BY id DESC LIMIT ?, 16");
                }
                ps.setInt(1, tab);
                if (type != 0) {
                    ps.setInt(2, type);
                    ps.setInt(3, page * 16);
                } else {
                    ps.setInt(2, page * 16);
                }
                rs = ps.executeQuery();
                while (rs.next()) {
                    if (rs.getInt("type") != 1) {
                        Item i = new Item(rs.getInt("itemid"), (byte) 0, (short) rs.getInt("quantity"));
                        i.setOwner(rs.getString("owner"));
                        items.add(new MTSItemInfo((IItem) i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
                    } else {
                        Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1);
                        equip.setOwner(rs.getString("owner"));
                        equip.setQuantity((short) 1);
                        equip.setAcc((short) rs.getInt("acc"));
                        equip.setAvoid((short) rs.getInt("avoid"));
                        equip.setDex((short) rs.getInt("dex"));
                        equip.setHands((short) rs.getInt("hands"));
                        equip.setHp((short) rs.getInt("hp"));
                        equip.setInt((short) rs.getInt("int"));
                        equip.setJump((short) rs.getInt("jump"));
                        equip.setLuk((short) rs.getInt("luk"));
                        equip.setMatk((short) rs.getInt("matk"));
                        equip.setMdef((short) rs.getInt("mdef"));
                        equip.setMp((short) rs.getInt("mp"));
                        equip.setSpeed((short) rs.getInt("speed"));
                        equip.setStr((short) rs.getInt("str"));
                        equip.setWatk((short) rs.getInt("watk"));
                        equip.setWdef((short) rs.getInt("wdef"));
                        equip.setUpgradeSlots((byte) rs.getInt("upgradeslots"));
                        equip.setLocked((byte) rs.getInt("locked"));
                        equip.setLevel((byte) rs.getInt("level"));
                        items.add(new MTSItemInfo((IItem) equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
                    }
                }
                rs.close();
                ps.close();

                if (type != 0) {
                    ps = con.prepareStatement("SELECT COUNT(*) FROM mts_items WHERE tab = ? AND type = ? AND transfer = 0");
                } else {
                    ps = con.prepareStatement("SELECT COUNT(*) FROM mts_items WHERE tab = ? AND transfer = 0");
                }
                ps.setInt(1, tab);
                if (type != 0) {
                    ps.setInt(2, type);
                }
                rs = ps.executeQuery();
                if (rs.next()) {
                    pages = rs.getInt(1) / 16;
                    if (rs.getInt(1) % 16 > 0) {
                        pages += 1;
                    }
                }
                rs.close();
                ps.close();
            } catch (SQLException e) {
                log.error("Err6: " + e);
            }
            return MaplePacketCreator.sendMTS(items, tab, type, page, pages);
        }
    Add
    Code:
                c.getSession().write(getMTS(c.getPlayer().getCurrentTab(), c.getPlayer().getCurrentType(), c.getPlayer().getCurrentPage()));
    under
    Code:
                c.getSession().write(MaplePacketCreator.NotYetSoldInv(getNotYetSold(c.getPlayer().getId())));
    Open MaplePacketCreator.java and change
    Code:
            mplew.writeInt(pages * 10);
    to
    Code:
            mplew.writeInt((pages + 1) * 10);

      Current date/time is Thu Mar 28, 2024 11:51 am