找回密码
 立即注册

QQ登录

只需一步,快速开始

Close
查看: 88|回复: 1

[L2JAcis] 游戏内GM显示HTML位置的脚本

[复制链接]
  • 打卡总天数:246
  • 打卡总奖励:1973
发表于 2026-6-26 08:24:53 | 显示全部楼层 |阅读模式
游戏内GM显示HTML位置的脚本【acis】
  • 不得商业✓仅供单机 ✓备份下载
  • 提取码: 隐藏内容
  • 支援版本:初章-芙蕾雅通用 
  • 资源评分:9分
  • 资源大小:1KB
  • 更新时间:2026-06-26
L2Fater.CN - 天堂2开源中文社区 - 温馨提示:
作者:Schuster 脚本适用于L2JAcis类源码,其他章节可参考修改使用(部分开源默认自带此功能)
详情介绍

  1. package net.sf.l2j.gameserver.network.serverpackets;

  2. import net.sf.l2j.Config;
  3. import net.sf.l2j.gameserver.cache.HtmCache;
  4. import net.sf.l2j.gameserver.model.actor.Player;
  5. import net.sf.l2j.gameserver.network.clientpackets.Say2;

  6. /**
  7. * the HTML parser in the client knowns these standard and non-standard tags and attributes VOLUMN UNKNOWN UL U TT TR TITLE TEXTCODE TEXTAREA TD TABLE SUP SUB STRIKE SPIN SELECT RIGHT PRE P OPTION OL MULTIEDIT LI LEFT INPUT IMG I HTML H7 H6 H5 H4 H3 H2 H1 FONT EXTEND EDIT COMMENT COMBOBOX CENTER
  8. * BUTTON BR BODY BAR ADDRESS A SEL LIST VAR FORE READONL ROWS VALIGN FIXWIDTH BORDERCOLORLI BORDERCOLORDA BORDERCOLOR BORDER BGCOLOR BACKGROUND ALIGN VALU READONLY MULTIPLE SELECTED TYP TYPE MAXLENGTH CHECKED SRC Y X QUERYDELAY NOSCROLLBAR IMGSRC B FG SIZE FACE COLOR DEFFON DEFFIXEDFONT WIDTH VALUE
  9. * TOOLTIP NAME MIN MAX HEIGHT DISABLED ALIGN MSG LINK HREF ACTION
  10. */
  11. public final class NpcHtmlMessage extends L2GameServerPacket
  12. {
  13.     private final int _npcObjId;
  14.     private String _html;
  15.     private int _itemId = 0;
  16.     private boolean _validate = true;
  17.     private String _file;
  18.    
  19.     public NpcHtmlMessage(int npcObjId)
  20.     {
  21.         _npcObjId = npcObjId;
  22.     }
  23.    
  24.     @Override
  25.     public void runImpl()
  26.     {
  27.         if (!_validate)
  28.             return;
  29.         
  30.         Player activeChar = getClient().getActiveChar();
  31.         if (activeChar == null)
  32.             return;
  33.         
  34.         if (Config.SHOW_FILE_GM && activeChar.isGM() && _file != null)
  35.         {
  36.         //  activeChar.sendPacket(new CreatureSay(Say2.ALL, "", "HTML", _file));
  37.             activeChar.sendPacket(new CreatureSay(0, Say2.ALL, "", "HTML: " + _file));
  38.         }
  39.         
  40.         activeChar.clearBypass();
  41.         for (int i = 0; i < _html.length(); i++)
  42.         {
  43.             int start = _html.indexOf(""bypass ", i);
  44.             int finish = _html.indexOf(""", start + 1);
  45.             if (start < 0 || finish < 0)
  46.                 break;
  47.             
  48.             if (_html.substring(start + 8, start + 10).equals("-h"))
  49.                 start += 11;
  50.             else
  51.                 start += 8;
  52.             
  53.             i = finish;
  54.             int finish2 = _html.indexOf("$", start);
  55.             if (finish2 < finish && finish2 > 0)
  56.                 activeChar.addBypass2(_html.substring(start, finish2).trim());
  57.             else
  58.                 activeChar.addBypass(_html.substring(start, finish).trim());
  59.         }
  60.     }
  61.    
  62.     @Override
  63.     protected final void writeImpl()
  64.     {
  65.         writeC(0x0f);
  66.         
  67.         writeD(_npcObjId);
  68.         writeS(_html);
  69.         writeD(_itemId);
  70.     }
  71.    
  72.     public void disableValidation()
  73.     {
  74.         _validate = false;
  75.     }
  76.    
  77.     public void setItemId(int itemId)
  78.     {
  79.         _itemId = itemId;
  80.     }
  81.    
  82.     public void setHtml(String text)
  83.     {
  84.         if (text.length() > 9000)
  85.         {
  86.             _html = "<html><body>Html was too long.</body></html>";
  87.             _log.warning("NpcHtmlMessage: html is too long");
  88.             return;
  89.         }
  90.         _html = text;
  91.     }
  92.    
  93.     public void setFile(String filename)
  94.     {
  95.         if (Config.SHOW_FILE_GM)
  96.         {
  97.             _file = filename;
  98.             
  99.             final int index = _file.indexOf("html/");
  100.             if (index != -1)
  101.                 _file = _file.substring(index + 5, _file.length());
  102.         }
  103.         setHtml(HtmCache.getInstance().getHtmForce(filename));
  104.     }
  105.    
  106.     public void basicReplace(String pattern, String value)
  107.     {
  108.         _html = _html.replaceAll(pattern, value);
  109.     }
  110.    
  111.     public void replace(String pattern, String value)
  112.     {
  113.         _html = _html.replaceAll(pattern, value.replaceAll("\\$", "\\\\\\$"));
  114.     }
  115.    
  116.     public void replace(String pattern, int value)
  117.     {
  118.         _html = _html.replaceAll(pattern, Integer.toString(value));
  119.     }
  120.    
  121.     public void replace(String pattern, long value)
  122.     {
  123.         _html = _html.replaceAll(pattern, Long.toString(value));
  124.     }
  125.    
  126.     public void replace(String pattern, double value)
  127.     {
  128.         _html = _html.replaceAll(pattern, Double.toString(value));
  129.     }
  130.     public String getContent()
  131.     {
  132.         return _html;
  133.     }

  134.     public String getHtml()
  135.     {
  136.         return _html;
  137.     }
  138. }
复制代码



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
回复

使用道具 举报

  • 打卡总天数:40
  • 打卡总奖励:105
发表于 2026-6-28 15:44:21 | 显示全部楼层
非常实用的脚本              
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表