[Help] Shop V.144

Results 1 to 7 of 7
  1. #1
    Valued Member jamaykids is offline
    MemberRank
    Aug 2010 Join Date
    MarsLocation
    112Posts

    sad [Help] Shop V.144

    maple0002.jpg

    All Shop Already in Database

    Please Help me :'(

    PS I use source from this thread

    UPDATE !!!!

    I found the problem in src

    } else {
    ret.addItem(new MapleShopItem((short) rs.getShort("buyable"), rs.getShort("quantity"), rs.getInt("itemid"), rs.getInt("price"), (short) rs.getInt("position"), rs.getInt("reqitem"), rs.getInt("reqitemq"), rs.getByte("rank"), rs.getInt("category"), rs.getInt("minLevel"), rs.getInt("expiration"), false)); //todo potential
    I just add structure "quantity" in my db

    DROP TABLE IF EXISTS `shopitems`;
    CREATE TABLE `shopitems` (
    `shopitemid` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `shopid` int(10) unsigned NOT NULL DEFAULT '0',
    `quantity` int(11) NOT NULL DEFAULT '1',
    `itemid` int(11) NOT NULL DEFAULT '0',
    `price` int(11) NOT NULL DEFAULT '0',
    `position` int(11) NOT NULL DEFAULT '0',
    `reqitem` int(11) NOT NULL DEFAULT '0',
    `reqitemq` int(11) NOT NULL DEFAULT '0',
    `rank` tinyint(3) NOT NULL DEFAULT '0',
    `buyable` int(11) NOT NULL DEFAULT '0',
    `category` tinyint(3) NOT NULL DEFAULT '0',
    `minLevel` int(11) NOT NULL DEFAULT '0',
    `expiration` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`shopitemid`),
    KEY `shopid` (`shopid`)
    ) ENGINE=MyISAM AUTO_INCREMENT=10000 DEFAULT CHARSET=latin1;
    Thx @ngnam87 and @JessVanity


    Last edited by jamaykids; 18-01-14 at 05:21 AM. Reason: Fixed !!


  2. #2
    Account Upgraded | Title Enabled! ngnam87 is offline
    MemberRank
    Mar 2013 Join Date
    666Posts

    Re: [Help] Shop V.144

    as i fixed, your source query database, but query command was wrong, so fix it!!!

  3. #3
    Valued Member jamaykids is offline
    MemberRank
    Aug 2010 Join Date
    MarsLocation
    112Posts

    Re: [Help] Shop V.144

    Quote Originally Posted by ngnam87 View Post
    as i fixed, your source query database, but query command was wrong, so fix it!!!
    how ? please help me :'(

    - - - Updated - - -

    bump !!

  4. #4
    Account Upgraded | Title Enabled! ngnam87 is offline
    MemberRank
    Mar 2013 Join Date
    666Posts

    Re: [Help] Shop V.144

    Quote Originally Posted by jamaykids View Post
    how ? please help me :'(

    - - - Updated - - -

    bump !!
    find in source code with table name "shopitems"
    all make sure/fix that all field named match with database !

  5. #5
    Valued Member jamaykids is offline
    MemberRank
    Aug 2010 Join Date
    MarsLocation
    112Posts

    Re: [Help] Shop V.144

    Quote Originally Posted by ngnam87 View Post
    find in source code with table name "shopitems"
    all make sure/fix that all field named match with database !
    MapleShop.java

    public static MapleShop createFromDB(int id, boolean isShopId) {
    MapleShop ret = null;

    MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    try {
    Connection con = DatabaseConnection.getConnection();
    PreparedStatement ps = con.prepareStatement(isShopId ? "SELECT * FROM shops WHERE shopid = ?" : "SELECT * FROM shops WHERE npcid = ?");
    int shopId;
    ps.setInt(1, id);
    ResultSet rs = ps.executeQuery();
    if (rs.next()) {
    shopId = rs.getInt("shopid");
    ret = new MapleShop(shopId, rs.getInt("npcid"));
    rs.close();
    ps.close();
    } else {
    rs.close();
    ps.close();
    return null;
    }
    ps = con.prepareStatement("SELECT * FROM shopitems WHERE shopid = ? ORDER BY position ASC");
    ps.setInt(1, shopId);
    rs = ps.executeQuery();
    List<Integer> recharges = new ArrayList(rechargeableItems);
    while (rs.next()) {
    if (ii.itemExists(rs.getInt("itemid"))) {
    if ((GameConstants.isThrowingStar(rs.getInt("itemid"))) || (GameConstants.isBullet(rs.getInt("itemid")))) {
    MapleShopItem starItem = new MapleShopItem((short) rs.getShort("buyable"), ii.getSlotMax(rs.getInt("itemid")), rs.getInt("itemid"), rs.getInt("price"), (short) rs.getInt("position"), rs.getInt("reqitem"), rs.getInt("reqitemq"), rs.getByte("rank"), rs.getInt("category"), rs.getInt("minLevel"), rs.getInt("expiration"), false);
    ret.addItem(starItem);
    if (rechargeableItems.contains(Integer.valueOf(starItem.getItemId()))) {
    recharges.remove(Integer.valueOf(starItem.getItemId()));
    }
    } else {
    ret.addItem(new MapleShopItem((short) rs.getShort("buyable"), rs.getShort("quantity"), rs.getInt("itemid"), rs.getInt("price"), (short) rs.getInt("position"), rs.getInt("reqitem"), rs.getInt("reqitemq"), rs.getByte("rank"), rs.getInt("category"), rs.getInt("minLevel"), rs.getInt("expiration"), false)); //todo potential
    }
    }
    }
    for (Integer recharge : recharges) {
    ret.addItem(new MapleShopItem((short) 1, ii.getSlotMax(recharge.intValue()), recharge.intValue(), 0, (short) 0, 0, 0, (byte) 0, 0, 0, 0, false));
    }
    rs.close();
    ps.close();

    ps = con.prepareStatement("SELECT * FROM shopranks WHERE shopid = ? ORDER BY rank ASC");
    ps.setInt(1, shopId);
    rs = ps.executeQuery();
    while (rs.next()) {
    if (ii.itemExists(rs.getInt("itemid"))) {
    ret.ranks.add(new Pair(Integer.valueOf(rs.getInt("itemid")), rs.getString("name")));
    }
    }
    rs.close();
    ps.close();
    } catch (SQLException e) {
    System.err.println("Could not load shop");
    }
    return ret;
    }
    Dump Shop

    DROP TABLE IF EXISTS `shopitems`;
    CREATE TABLE `shopitems` (
    `shopitemid` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `shopid` int(10) unsigned NOT NULL DEFAULT '0',
    `itemid` int(11) NOT NULL DEFAULT '0',
    `price` int(11) NOT NULL DEFAULT '0',
    `position` int(11) NOT NULL DEFAULT '0',
    `reqitem` int(11) NOT NULL DEFAULT '0',
    `reqitemq` int(11) NOT NULL DEFAULT '0',
    `rank` tinyint(3) NOT NULL DEFAULT '0',
    `buyable` int(11) NOT NULL DEFAULT '0',
    `category` tinyint(3) NOT NULL DEFAULT '0',
    `minLevel` int(11) NOT NULL DEFAULT '0',
    `expiration` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`shopitemid`),
    KEY `shopid` (`shopid`)
    ) ENGINE=MyISAM AUTO_INCREMENT=10000 DEFAULT CHARSET=latin1;
    - - - Updated - - -

    dump !!

  6. #6
    Member JessVanity is offline
    MemberRank
    Jan 2014 Join Date
    61Posts

    Re: [Help] Shop V.144

    Make sure you dump the shop items for your server.

  7. #7
    Valued Member jamaykids is offline
    MemberRank
    Aug 2010 Join Date
    MarsLocation
    112Posts

    Re: [Help] Shop V.144

    ok . I fixed it



Advertisement