m1n9 发表于 2024-11-1 09:26:00

冒险岛使gainItem()函数支持宠物



找到 AbstractPlayerInteraction.java, 打开:
把Copy codepublic void gainItem(int id, short quantity) {

和与其相关的改为Copy code      public void gainItem(int id, short quantity) {

            MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();

                        if (id >= 5000000 && id <= 5000045) {http://forum.ragezone.com/editpost.php?do=editpost&p=3773709

            try {

                Connection con = (Connection) DatabaseConnection.getConnection();

                PreparedStatement ps = (PreparedStatement) con.prepareStatement("INSERT INTO pets (name, level, closeness, fullness) VALUES (?, ?, ?, ?)");

                ps.setString(1, ii.getName(id));

                ps.setInt(2, 1);

                ps.setInt(3, 0);

                ps.setInt(4, 100);

                ps.executeUpdate();

                ResultSet rs = ps.getGeneratedKeys();

                rs.next();

                //c.getPlayer().equipChanged();

                MapleInventoryManipulator.addById(c, id, (short) quantity, c.getPlayer().getName() + " receieved pet, ID " + id + ", from a scripted PlayerInteraction. (Quantity: " + quantity + ")", null, rs.getInt(1));

                rs.close();

                ps.close();

            } catch (SQLException ex) {

                java.util.logging.Logger.getLogger(AbstractPlayerInteraction.class.getName()).log(Level.SEVERE, null, ex);

            }

      } else {

      if (quantity >= 0) {

            StringBuilder logInfo = new StringBuilder(c.getPlayer().getName());

            logInfo.append(" received ");

            logInfo.append(quantity);

            logInfo.append(" from a scripted PlayerInteraction (");

            logInfo.append(this.toString());

            logInfo.append(")");

            MapleInventoryManipulator.addById(c, id, quantity, logInfo.toString());

               

      } else {

            MapleInventoryManipulator.removeById(c, MapleItemInformationProvider.getInstance().getInventoryType(id), id, -quantity, true, false);

                  }

                }

      c.getSession().write(MaplePacketCreator.getShowItemGain(id, quantity, true));

    }



319130309 发表于 2024-11-1 09:36:59

支持!

220708541 发表于 2024-11-1 10:07:36

路过,支持一下啦

004771039 发表于 2024-11-1 12:36:34

路过,支持一下啦

524614159 发表于 2024-11-1 15:27:51

说的非常好

901422000 发表于 2024-11-1 15:41:30

看看

419512439 发表于 2024-11-1 16:56:24

过来看看

007618108 发表于 2024-11-1 17:16:30

过来看看

117390710 发表于 2024-11-1 18:28:34

挺不错

054337158 发表于 2024-11-1 19:56:39

支持一下

463518630 发表于 2024-11-1 22:20:57

好样的

365248510 发表于 2024-11-1 23:38:51

挺不错

154945508 发表于 2024-11-1 23:45:42

赞!

958753228 发表于 2024-11-1 23:52:40

很不错

525655179 发表于 2024-11-2 01:38:22

没看完~~~~~~ 先顶,好同志
页: [1] 2
查看完整版本: 冒险岛使gainItem()函数支持宠物