查看: 2414|回复: 1

續發布的TMS113 關於PNPC的修復法

  • TA的每日心情

    2018-8-4 16:33
  • 签到天数: 2 天

    [LV.1]初来乍到

    新人上路

    枫币
    85
    威望
    8
    贡献
    13
    在线时间
    1 小时
    注册时间
    2018-8-3
    QQ
    发表于 2018-8-3 19:52:36 | 显示全部楼层 |阅读模式
    找到MapleMapFactory.java

    try
                                    {
                                            Connection con = DatabaseConnection.getConnection();
                                            PreparedStatement ps = con.prepareStatement("SELECT * FROM spawns WHERE mid = ?");
                                            ps.setInt(1, omapid);
                                            ResultSet rs = ps.executeQuery();
                                            while (rs.next()) {
                                                    int id = rs.getInt("idd");
                                                    int f = rs.getInt("f");
                                                    boolean hide = false;
                                                    String type = rs.getString("type");
                                                    int _fh = rs.getInt("fh");
                                                    int cy = rs.getInt("cy");
                                                    int rx0 = rs.getInt("rx0");
                                                    int rx1 = rs.getInt("rx1");
                                                    int x = rs.getInt("x");
                                                    int y = rs.getInt("y");
                                                    int mobTime = rs.getInt("mobtime");

                                                    AbstractLoadedMapleLife myLife = loadLife(id, f, hide, _fh, cy, rx0, rx1, x, y, type);

                                                    if(type.equals("n"))
                                                    {
                                                            map.addMapObject(myLife);
                                                    }
                                            }
                                    } catch(SQLException e) {
                                    }
                                    


    改成

    try
    {
                        PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM spawns WHERE mid = ?");
                        ps.setInt(1, omapid);
                        ResultSet rs = ps.executeQuery();
                        while (rs.next()) {
                            int sqlid = rs.getInt("idd");
                            int sqlf = rs.getInt("f");
                            boolean sqlhide = false;
                            String sqltype = rs.getString("type");
                            int sqlfh = rs.getInt("fh");
                            int sqlcy = rs.getInt("cy");
                            int sqlrx0 = rs.getInt("rx0");
                            int sqlrx1 = rs.getInt("rx1");
                            int sqlx = rs.getInt("x");
                            int sqly = rs.getInt("y");
                            int sqlmobTime = rs.getInt("mobtime");
                            AbstractLoadedMapleLife sqlmyLife = loadLife(sqlid, sqlf, sqlhide, sqlfh, sqlcy, sqlrx0, sqlrx1, sqlx, sqly, sqltype);
                            switch (sqltype) {
                                case "n":
                                    map.addMapObject(sqlmyLife);
                                    break;
                                case "m":
                                    MapleMonster monster = (MapleMonster) sqlmyLife;
                                    map.addMonsterSpawn(monster, sqlmobTime, (byte) -1, null);
                                    break;
                            }
                        }
                    } catch (SQLException e){
                                    }

    沒意外的話這樣子加上去之後也能把固定spawn怪物的功能寫到command裡面

    因為原來的問題應該是開server的時候抓不到sql
  • TA的每日心情
    无聊
    2023-12-29 18:08
  • 签到天数: 83 天

    [LV.6]常住居民II

    版主

    枫币
    4273
    威望
    8
    贡献
    63
    在线时间
    536 小时
    注册时间
    2019-3-1
    发表于 2019-3-2 01:53:58 | 显示全部楼层
    我是這篇文的作者
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    枫叶物语即使倒闭也绝对不会变质
    Copyright © 2001-2013 Discuz Team. Powered by Discuz! X3.5 |网站地图 | 本站已运行: