微信扫一扫 分享朋友圈

已有 351 人浏览分享

[服務器疑問] 如何添加怪物的Patrol新屬性

[複製鏈接]

初窺門道

Rank: 2

219

威望

710

金錢

338

A幣
主題
32
帖子
64
精華
1
綜合社群主題發文量
0
電玩社群主題發文量
0
娛樂社群主題發文量
0
技術社群主題發文量
32
閱讀權限
20
註冊時間
2021-11-15
  • TA的每日心情
    奮鬥
    2024-1-28 13:17
  • 簽到天數: 1 天

    連續簽到: 1 天

    [LV.1]初來乍到

    chenhui540 發表於  2024-1-11 12:51:15 | 顯示全部樓層 | 閱讀模式
    本帖最後由 chenhui540 於 2024-1-28 13:13 編輯

    0.png 1.png 2.png 3.png 4.png 5.png 6.png


    搜索:

                final MapleData banishData = monsterInfoData.getChildByPath("ban");
                if (banishData != null) {
                    stats.setBanishInfo(new BanishInfo(
                            MapleDataTool.getString("banMsg", banishData),
                            MapleDataTool.getInt("banMap/0/field", banishData, -1),
                            MapleDataTool.getString("banMap/0/portal", banishData, "sp")));
                }

    替換:

                final MapleData banishData = monsterInfoData.getChildByPath("ban");
                if (banishData != null) {
                    for (MapleData d : banishData.getChildByPath("banMap").getChildren()) {
                        MapleData banMsgData = banishData.getChildByPath("banMsg");
                        stats.addBanishInfo(new BanishInfo(
                        banMsgData == null ? null : MapleDataTool.getString(banMsgData), // banMap 節點中可能沒有 banMsg 導致空值 (9441003)
                        MapleDataTool.getInt("field", d, -1),
                        MapleDataTool.getString("portal", d, "sp")));
                    }
                }

                final MapleData patrol = monsterInfoData.getChildByPath("patrol");
                if (patrol != null) {
                    stats.setPatrol(true);
                    stats.setPatrolRange(MapleDataTool.getInt("range", patrol, 0));
                    stats.setPatrolDetectX(MapleDataTool.getInt("detectX", patrol, 0));
                    stats.setPatrolSenseX(MapleDataTool.getInt("senseX", patrol, 0));
                }

    搜索:

        private BanishInfo banish;

    替換:

        private List<BanishInfo> banish = new ArrayList<>();
        private boolean patrol;
        private int patrolRange, patrolDetectX, patrolSenseX;


    搜索:

        public BanishInfo getBanishInfo() {
            return banish;
        }

        public void setBanishInfo(BanishInfo banish) {
            this.banish = banish;
        }


    替換:

        public List<BanishInfo> getBanishInfo() {
            return banish;
        }

        public void addBanishInfo(BanishInfo banish) {
            this.banish.add(banish);
        }

        public void setPatrol(boolean patrol) {
            this.patrol = patrol;
        }

        public boolean isPatrol() {
            return patrol;
        }

        public void setPatrolRange(int patrolRange) {
            this.patrolRange = patrolRange;
        }

        public int getPatrolRange() {
            return patrolRange;
        }

        public void setPatrolDetectX(int patrolDetectX) {
            this.patrolDetectX = patrolDetectX;
        }

        public int getPatrolDetectX() {
            return patrolDetectX;
        }

        public void setPatrolSenseX(int patrolSenseX) {
            this.patrolSenseX = patrolSenseX;
        }

        public int getPatrolSenseX() {
            return patrolSenseX;
        }

    搜索:

        public static int pcrate = ServerConstants.PCRoomPercent;


    替換:


        public static int pcrate = ServerConstants.PCRoomPercent;
        private int patrolScopeX1;
        private int patrolScopeX2;


    搜索:

        public final boolean dropsDisabled() {
            return dropsDisabled;
        }

    替換:

        public final boolean dropsDisabled() {
            return dropsDisabled;
        }

        public int getPatrolScopeX1() {
            return patrolScopeX1;
        }

        public void setPatrolScopeX1(int patrolScopeX1) {
            this.patrolScopeX1 = patrolScopeX1;
        }

        public int getPatrolScopeX2() {
            return patrolScopeX2;
        }

        public void setPatrolScopeX2(int patrolScopeX2) {
            this.patrolScopeX2 = patrolScopeX2;
        }


    搜索:

        public final void spawnMonster(final MapleMonster monster, final int spawnType, final boolean overwrite) {
            monster.setMap(this);
            checkRemoveAfter(monster);

            spawnAndAddRangedMapObject(monster, new DelayedPacketCreation() {

                public final void sendPackets(MapleClient c) {
                    c.getSession().write(MobPacket.spawnMonster(monster, monster.getStats().getSummonType() <= 1 || monster.getStats().getSummonType() == 27 || overwrite ? spawnType : monster.getStats().getSummonType(), 0));
                }
            });
            updateMonsterController(monster);

            spawnedMonstersOnMap.incrementAndGet();
        }


    替換:

        public final void spawnMonster(final MapleMonster monster, final int spawnType, final boolean overwrite) {
            if (monster.getMap() == null && monster.getStats().isPatrol()) {
                monster.setPatrolScopeX1(monster.getPosition().x);
                monster.setPatrolScopeX2(monster.getPosition().x + monster.getStats().getPatrolRange());
            }
            monster.setMap(this);
            checkRemoveAfter(monster);

            spawnAndAddRangedMapObject(monster, new DelayedPacketCreation() {

                public final void sendPackets(MapleClient c) {
                    c.getSession().write(MobPacket.spawnMonster(monster, monster.getStats().getSummonType() <= 1 || monster.getStats().getSummonType() == 27 || overwrite ? spawnType : monster.getStats().getSummonType(), 0));
                }
            });
            updateMonsterController(monster);

            spawnedMonstersOnMap.incrementAndGet();
        }


    搜索:

            if (type != -2 && type != -3 && type != -4) { // Not map damage
                monsteridfrom = slea.readInt();
                oid = slea.readInt();
                attacker = chr.getMap().getMonsterByOid(oid);
                direction = slea.readByte(); // Knock direction

                if (attacker == null || attacker.getId() != monsteridfrom || attacker.getLinkCID() > 0 || attacker.isFake() || attacker.getStats().isFriendly()) {
                    return;
                }


    替換:


            if (type != -2 && type != -3 && type != -4) { // Not map damage
                monsteridfrom = slea.readInt();
                oid = slea.readInt();
                attacker = chr.getMap().getMonsterByOid(oid);
                direction = slea.readByte(); // Knock direction

                if (attacker == null || attacker.getId() != monsteridfrom || attacker.getLinkCID() > 0 || attacker.isFake() || attacker.getStats().isFriendly()) {
                    return;
                }
                if (attacker.getId() == 9400809 || attacker.getId() == 9300507) {
                    List<BanishInfo> infos = attacker.getStats().getBanishInfo();
                    BanishInfo info = infos.get(Randomizer.nextInt(infos.size()));
                    if (info != null) {
                        chr.changeMapBanish(info.getMap(), info.getPortal(), info.getMsg());
                    }
                }

    頁首添加:

    import server.life.BanishInfo;


    搜索:

                case 129: // Banish
                    if (monster != null && monster.getMap().getSquadByMap() == null) { //not pb/vonleon map
                        if (monster.getEventInstance() != null && monster.getEventInstance().getName().indexOf("BossQuest") != -1) {
                            break;
                        }
                        final BanishInfo info = monster.getStats().getBanishInfo();
                        if (info != null) {
                            if (lt != null && rb != null && skill && player != null) {
                                for (MapleCharacter chr : getPlayersInRange(monster, player)) {
                                    if (!chr.hasBlockedInventory()) {
                                        chr.changeMapBanish(info.getMap(), info.getPortal(), info.getMsg());
                                    }
                                }
                            } else if (player != null && !player.hasBlockedInventory()) {
                                player.changeMapBanish(info.getMap(), info.getPortal(), info.getMsg());
                            }
                        }
                    }
                    break;

    替換:

                case 129: // Banish
                    List<BanishInfo> infos = monster.getStats().getBanishInfo();
                    if (monster != null && monster.getMap().getSquadByMap() == null) { //not pb/vonleon map
                        if (monster.getEventInstance() != null && monster.getEventInstance().getName().indexOf("BossQuest") != -1) {
                            break;
                        }
                        BanishInfo info = infos.get(Randomizer.nextInt(infos.size()));
                        if (info != null) {
                            if (lt != null && rb != null && skill && player != null) {
                                for (MapleCharacter chr : getPlayersInRange(monster, player)) {
                                    if (!chr.hasBlockedInventory()) {
                                        chr.changeMapBanish(info.getMap(), info.getPortal(), info.getMsg());
                                    }
                                }
                            } else if (player != null && !player.hasBlockedInventory()) {
                                player.changeMapBanish(info.getMap(), info.getPortal(), info.getMsg());
                            }
                        }
                    }
                    break;

    頁首添加:

    import server.Randomizer;

    搜索:

        public static byte[] spawnMonster(MapleMonster life, int spawnType, int link) {
            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.SPAWN_MONSTER.getValue());
            mplew.writeInt(life.getObjectId());
            mplew.write(1); // 1 = Control normal, 5 = Control none
            mplew.writeInt(life.getId());
            addMonsterStatus(mplew, life);
            mplew.writePos(life.getTruePosition());
            mplew.write(life.getStance());
            mplew.writeShort(0); // FH
            mplew.writeShort(life.getFh()); // Origin FH
            mplew.write(spawnType);
            if (spawnType == -3 || spawnType >= 0) {
                mplew.writeInt(link);
            }
            mplew.write(life.getCarnivalTeam());
            mplew.writeInt(0);
            mplew.writeInt(0);
            mplew.write(-1);

            return mplew.getPacket();
        }

    替換:


        public static byte[] spawnMonster(MapleMonster life, int spawnType, int link) {
            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.SPAWN_MONSTER.getValue());
            mplew.writeInt(life.getObjectId());
            mplew.write(1); // 1 = Control normal, 5 = Control none
            mplew.writeInt(life.getId());
            addMonsterStatus(mplew, life);
            mplew.writePos(life.getTruePosition());
            mplew.write(life.getStance());
            mplew.writeShort(0); // FH
            mplew.writeShort(life.getFh()); // Origin FH
            mplew.write(spawnType);
            if (spawnType == -3 || spawnType >= 0) {
                mplew.writeInt(link);
            }
            mplew.write(life.getCarnivalTeam());

            if (life.getStats().isPatrol()) {
                mplew.writeInt(life.getPatrolScopeX1());
                mplew.writeInt(life.getPatrolScopeX2());
                mplew.writeInt(life.getStats().getPatrolDetectX());
                mplew.writeInt(life.getStats().getPatrolSenseX());
            }
            mplew.writeInt(0);
            mplew.writeInt(0);
            mplew.write(-1);

            return mplew.getPacket();
        }



    添加內容後,成功刷出怪物,此方法也可以用於幻影出生動畫內容。





    共收到 0 A幣
    打賞榜
    暫無
    暫無
    暫無
    暫無
    ----
    暫無
    ----
    暫無
    ----
    暫無
    ----
    您需要登錄後才可以回帖 登錄 | 註冊會員

    本版積分規則

    64

    發文

    710

    金錢

    338

    A幣

    ----------榮譽勳章----------

    熱門推薦
    圖文推薦
    • 聯繫我們

    小黑屋|AICL社群娛樂集團

    GMT+8, 2024-4-28 13:31 , 網路刷新 0.096026 秒 .

    歡迎來到 AICL網路社群

    版權AICL社群所有 2011-2021.

    Total:123 Today:213 Online:322