軒云熊 發表於 2025-11-15 16:28

已解決_關於8.15 怪物血條顯示白色問題

本帖最後由 軒云熊 於 2025-11-16 16:18 編輯

有沒有大大知道 怪物血條要怎麼改才能顯示正常 或這是把血條關閉 玩家的是正常為甚麼怪物會異常?

網路上的教學改核心 L1NpcInstance   onPerceive 都沒反應 新增 S_NPCPackHp 封包也沒用

yasioukon 發表於 2025-11-15 18:13

這篇有提到改什麼

軒云熊 發表於 2025-11-16 10:21

yasioukon 發表於 2025-11-15 18:13
這篇有提到改什麼

謝謝 yasioukon 大大幫忙   S_NPCPack.java   可以修改這樣就可以了雖然 還是有問題 不過已經可以接受了 謝謝 yasioukon 大大有需要的朋友也可以改一下試試看//                this.writeC(0xff); // HP



                this.writeC(0x00);
               
                int hpPercent = 0xff;
                if (npc.getMaxHp() > 0) {
                  hpPercent = npc.getCurrentHp() * 100 / npc.getMaxHp();
                  hpPercent = Math.min(hpPercent, 100); // 避免超過 100
                }
                this.writeC(hpPercent); // HP 血條顯示
               
                this.writeC(0x00);// LV
//                this.writeC(npc.getLevel());// LV
                this.writeS(npc.getTitle());
                this.writeC(0x00);
                this.writeC(0xff);
                this.writeC(0xff);
        }


LineageW777 發表於 2025-11-17 02:20

哇,這個封包值是怎麼知道的啊?好厲害

IQN 發表於 2026-2-3 10:33

樓主還是很不錯的。願意花時間來做分享,頂頂頂。

IQN 發表於 2026-2-3 10:37

軒云熊 發表於 2025-11-16 10:21
謝謝 yasioukon 大大幫忙   S_NPCPack.java   可以修改這樣就可以了雖然 還是有問題 不過已經可以接受 ...

你說的還是有問題,可能是你加的位置不對。代碼如下:

/**
       * 物件封包
       *
       * @param npc
       */
        public S_NPCPack(final L1NpcInstance npc,final L1PcInstance pc) {
                this.writeC(S_PUT_OBJECT);
                this.writeH(npc.getX());
                this.writeH(npc.getY());
                this.writeD(npc.getId());

                if (npc.getTempCharGfx() == 0) {
                        this.writeH(npc.getGfxId());

                } else {
                        this.writeH(npc.getTempCharGfx());
                }

                if (npc.getNpcTemplate().is_doppel() && (npc.getGfxId() != 31)) { // スライムの姿をしていなければドッペル
                        this.writeC(0x04); // 拿剑

                } else {
                        this.writeC(npc.getStatus());
                }

                this.writeC(npc.getHeading());
                this.writeC(npc.getChaLightSize());
                this.writeC(npc.getMoveSpeed());
                this.writeD((int) npc.getExp());
                this.writeH(npc.getTempLawful());
                String levelname = npc.getNameId();
                if ((pc.getLevel() - npc.getLevel() >= 5 && pc.getLevel()
                                - npc.getLevel() <= 10)
                                || (npc.getLevel() - pc.getLevel() >= 5 && npc.getLevel()
                                                - pc.getLevel() <= 10)) {
                        levelname = "\\f2" + npc.getNameId();
                } else if (npc.getLevel() - pc.getLevel() >= 30) {
                        levelname = "\\f3" + npc.getNameId();
                } else if (npc.getLevel() - pc.getLevel() >= 20) {
                        levelname = "\\fC" + npc.getNameId();
                } else if (npc.getLevel() - pc.getLevel() >= 11) {
                        levelname = "\\f:" + npc.getNameId();
                }
                writeS(levelname);
          if (!ConfigAlt.NPCid){
                     writeS(levelname);
                     }else{
                     writeS(levelname + "[" + npc.getNpcId() + "]");
                     }
          this.writeS(npc.getTitle());//白条问题修复 by IQN 20240808
                /**
               * ???? - 0:mob,item(atk pointer), 1:poisoned(), 2:invisable(), 4:pc,
               * 8:cursed(), 16:brave(), 32:??, 64:??(??), 128:invisable but name
               */
                int status = 0;
                if (npc.getPoison() != null) { // 毒状态
                        if (npc.getPoison().getEffectId() == 1) {
                                status |= STATUS_POISON;
                        }
                }
                if (npc.getNpcTemplate().is_doppel()) {
                        // PC属性だとエヴァの祝福を渡せないためWIZクエストのドッペルは例外
                        if (npc.getNpcTemplate().get_npcId() != 81069) {
                                status |= STATUS_PC;
                        }
                }
                if (npc.getNpcTemplate().get_npcId() == 90024) {
                        status |= STATUS_POISON;
                }
                this.writeC(status); // 状态

                this.writeD(0x00000000); // 0以外にするとC_27が飞ぶ
                this.writeS(null);
                this.writeS(null); // マスター名?

                this.writeC(0x00); // 物件分类

                this.writeC(0xff); // HP
                this.writeC(0x00);
                this.writeC(0x00);// LV
                // this.writeC(npc.getLevel());// LV
                this.writeC(0x00);
                this.writeC(0xff);
                this.writeC(0xff);
        }

頁: [1]
查看完整版本: 已解決_關於8.15 怪物血條顯示白色問題