查看: 3360|回复: 1

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

[复制链接]

新人上路

枫币
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

版主

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

本版积分规则

Archiver|手机版|小黑屋|枫叶物语冒险岛单机 | 本站已运行:

枫叶物语可能会倒闭,但是绝对不会变质。

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖QQ客服返回顶部