Jump to content
  • 0

Click no npc recebe uma mensagem da HTML


Hashirama

Question

21 answers to this question

Recommended Posts


  • 0
2 horas atrás, Schuster disse:

Se estiver usando aCis, na classe NpcHtmlMessage.java, adicione o trecho abaixo no método runImpl.

		if (activeChar.isGM() && _file != null)	
			activeChar.sendMessage("HTML: " + _file);

image.png.8a5175c1dc22a7c79dbc65ebd9810c97.png

No jogo irá receber isso sempre que iniciar um dialogo com o NPC, desde que contenha uma HTML.

image.png.7c8a79625f42c3186acadff9c103299d.png

Muito bom mano, só faltou colocar a opção para habilitar/desabilitar por properties.
Show!

O que a mente do homem pode conceber e acreditar, pode ser alcançada.

 

 

Link to comment
Share on other sites

  • 0
Nattan Felipe
This post was recognized by Nattan Felipe!

Schuster was awarded the badge 'Great Support' and 100 points.

27 minutos atrás, Leonardo Alves ツ disse:

Muito bom mano, só faltou colocar a opção para habilitar/desabilitar por properties.
Show!

Não sou desenvolvedor, mas metido kkk

Fiz aqui e deu certo...

Config.java

 

 public static boolean GM_STARTUP_AUTO_LIST;
+public static boolean VIEW_HTML_DIRECTORY;

 GM_STARTUP_AUTO_LIST = gmfile.getProperty("GMStartupAutoList", true);
+VIEW_HTML_DIRECTORY = gmfile.getProperty("ViewHtmlDirectory", true);

NpcHtmlMessage.java

if (Config.VIEW_HTML_DIRECTORY && activeChar.isGM() && _file != null) {
	activeChar.sendMessage("HTML: " + _file);
}

admin.ini

ViewHtmlDirectory = True

 

  • Like 1
Link to comment
Share on other sites

  • 0
1 minuto atrás, Schuster disse:

Não sou desenvolvedor, mas metido kkk

Fiz aqui e deu certo...

Config.java

 public static boolean GM_STARTUP_AUTO_LIST;
+public static boolean VIEW_HTML_DIRECTORY;

 GM_STARTUP_AUTO_LIST = gmfile.getProperty("GMStartupAutoList", true);
+VIEW_HTML_DIRECTORY = gmfile.getProperty("ViewHtmlDirectory", true);

NpcHtmlMessage.java

if (Config.VIEW_HTML_DIRECTORY && activeChar.isGM() && _file != null) {
	activeChar.sendMessage("HTML: " + _file);
}

admin.ini

ViewHtmlDirectory = True

Boa parabéns 😄 Posta lá em java mods hehe. Valeu abraço .

O que a mente do homem pode conceber e acreditar, pode ser alcançada.

 

 

Link to comment
Share on other sites

  • 0
13 minutos atrás, L33T disse:

mais mano ta certo pow  o comando so pegar com o adm 

Sim eu sei que o código é certo e funcional.
Eu disse que seria interessante adicionar uma propriedade que permite habilitar e desabilitar sem precisar compilar de novo.
E foi o que o @Schuster fez.

O que a mente do homem pode conceber e acreditar, pode ser alcançada.

 

 

Link to comment
Share on other sites

  • 0
3 horas atrás, L33T disse:

no meu nao  pegou affs meu projeto eh acis 382

 

2 horas atrás, Hashirama disse:

No meu não pegou também! alguma solução?

Se for rus_acis 3.5  façam o seguinte teste.
Vá no diretório: net.sf.l2j.gameserver.network.serverpackets
No arquivo NpcHtmlMessage.java

Acredito que isso funcione.
Encontre a seguinte linha no método runImpl
        if (SHOW_FILE && player.isGM() && _file != null)
            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));
E mude para
        if (player.isGM() && _file != null)
            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));

Me digam se funcionou daí pois eu estou sem eclipse aqui para fazer o teste.
Caso optarem pela opção dois também poderá ser removido a variável 
 

Edited by Leonardo Alves ツ

O que a mente do homem pode conceber e acreditar, pode ser alcançada.

 

 

Link to comment
Share on other sites

  • 0
2 horas atrás, L33T disse:

 if (SHOW_FILE && player.isGM() && _file != null)
            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));

 na minha rev nao tem

Entendi, então adicione essa linha
        if (player.isGM() && _file != null)
            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));
No mesmo local onde o amigo citou ali acima.

O que a mente do homem pode conceber e acreditar, pode ser alcançada.

 

 

Link to comment
Share on other sites

  • 0
  • L2JBr ADM

Coisa boa essa modificação @Schuster, obrigado por compartilhar conosco, brother!!

Se puder depois fazer um tópico em java mods, eu agradeceria imensamente!!

  • Like 1

Você sabia que a L2JBrasil tem uma empresa de Hosting Oficial?
Conheça a L2JCenter.com

L2JBRASIL - 15 anos vendendo SS e flechas em Giran! (Trade / Adena)

Link to comment
Share on other sites

  • 0
Em 15/09/2024 at 21:51, Schuster disse:

Poderiam me enviar o NpcHtmlMessage.java de vocês?

Aqui funcionou normal, utilizo a L2J Mega, não sei qual aCis ela é.

 

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

import net.sf.l2j.gameserver.data.cache.HtmCache;
import net.sf.l2j.gameserver.enums.SayType;
import net.sf.l2j.gameserver.model.actor.Player;

public final class NpcHtmlMessage extends L2GameServerPacket
{
    // Shared "config" used by Players GMs to see file directory.
    public static boolean SHOW_FILE;
    
    private final int _objectId;
    
    private String _html;
    private String _file;
    
    private int _itemId = 0;
    private boolean _validate = true;
    
    public NpcHtmlMessage(int objectId)
    {
        _objectId = objectId;
    }
    
    @Override
    public void runImpl()
    {
        if (!_validate)
            return;
        
        final Player player = getClient().getPlayer();
        if (player == null)
            return;
        
        if (SHOW_FILE && player.isGM() && _file != null)
            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));
        
        player.clearBypass();
        for (int i = 0; i < _html.length(); i++)
        {
            int start = _html.indexOf("\"bypass ", i);
            int finish = _html.indexOf("\"", start + 1);
            if (start < 0 || finish < 0)
                break;
            
            if (_html.substring(start + 8, start + 10).equals("-h"))
                start += 11;
            else
                start += 8;
            
            i = finish;
            int finish2 = _html.indexOf("$", start);
            if (finish2 < finish && finish2 > 0)
                player.addBypass2(_html.substring(start, finish2).trim());
            else
                player.addBypass(_html.substring(start, finish).trim());
        }
    }
    
    @Override
    protected final void writeImpl()
    {
        writeC(0x0f);
        
        writeD(_objectId);
        writeS(_html);
        writeD(_itemId);
    }
    
    public void disableValidation()
    {
        _validate = false;
    }
    
    public void setItemId(int itemId)
    {
        _itemId = itemId;
    }
    
    public void setHtml(String text)
    {
        if (text.length() > 8192)
        {
            _html = "<html><body>Html was too long.</body></html>

 

 

 

 

 

 

 

 

 

 

aCis 409

 

hashirama-naruto.gif
Link to comment
Share on other sites

  • 0

 

1 hora atrás, Hashirama disse:

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

import net.sf.l2j.gameserver.data.cache.HtmCache;
import net.sf.l2j.gameserver.enums.SayType;
import net.sf.l2j.gameserver.model.actor.Player;

public final class NpcHtmlMessage extends L2GameServerPacket
{
    // Shared "config" used by Players GMs to see file directory.
    public static boolean SHOW_FILE;
    
    private final int _objectId;
    
    private String _html;
    private String _file;
    
    private int _itemId = 0;
    private boolean _validate = true;
    
    public NpcHtmlMessage(int objectId)
    {
        _objectId = objectId;
    }
    
    @Override
    public void runImpl()
    {
        if (!_validate)
            return;
        
        final Player player = getClient().getPlayer();
        if (player == null)
            return;
        
        if (SHOW_FILE && player.isGM() && _file != null)
            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));
        
        player.clearBypass();
        for (int i = 0; i < _html.length(); i++)
        {
            int start = _html.indexOf("\"bypass ", i);
            int finish = _html.indexOf("\"", start + 1);
            if (start < 0 || finish < 0)
                break;
            
            if (_html.substring(start + 8, start + 10).equals("-h"))
                start += 11;
            else
                start += 8;
            
            i = finish;
            int finish2 = _html.indexOf("$", start);
            if (finish2 < finish && finish2 > 0)
                player.addBypass2(_html.substring(start, finish2).trim());
            else
                player.addBypass(_html.substring(start, finish).trim());
        }
    }
    
    @Override
    protected final void writeImpl()
    {
        writeC(0x0f);
        
        writeD(_objectId);
        writeS(_html);
        writeD(_itemId);
    }
    
    public void disableValidation()
    {
        _validate = false;
    }
    
    public void setItemId(int itemId)
    {
        _itemId = itemId;
    }
    
    public void setHtml(String text)
    {
        if (text.length() > 8192)
        {
            _html = "<html><body>Html was too long.</body></html>

aCis 409

No seu caso tentou fazer isso, mudar essa linha:
public static boolean SHOW_FILE;

para 
public static boolean SHOW_FILE = true;

 

ou até mesmo substituir essa linha
        if (SHOW_FILE && player.isGM() && _file != null)

            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));

por essa
        if (player.isGM() && _file != null)

            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));
 

  • I love it 1

O que a mente do homem pode conceber e acreditar, pode ser alcançada.

 

 

Link to comment
Share on other sites

  • 0
1 hora atrás, Hashirama disse:

aCis 409

Na aCis 409, já existe a implementação, mas não tem config, teria que ser true fixo no código fonte para funcionar.

Então, basta alterar conforme abaixo.

-public static boolean SHOW_FILE;
+public static boolean SHOW_FILE = true;


Olha, como eu disse anteriormente, não tem config, então fiz algumas alterações que aqui deu certo também.
 

Config.java

public static boolean GM_STARTUP_AUTO_LIST;
+public static boolean SHOW_FILE;

GM_STARTUP_AUTO_LIST = players.getProperty("GMStartupAutoList", true);
+SHOW_FILE = players.getProperty("ShowFile", true);

NpcHtmlMessage.java

import net.sf.l2j.gameserver.model.actor.Player;
+import net.sf.l2j.Config;

-public static boolean SHOW_FILE;

-if (SHOW_FILE && player.isGM() && _file != null)
-player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));

+if (Config.SHOW_FILE && player.isGM() && _file != null)
+player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));

AdminAdmin.java

-case "html":
-NpcHtmlMessage.SHOW_FILE = !NpcHtmlMessage.SHOW_FILE;
-break;

gameserver\config\players.properties

+ShowFile = true

 

14 minutos atrás, Leonardo Alves ツ disse:

No seu caso tentou fazer isso, mudar essa linha:
public static boolean SHOW_FILE;

para 
public static boolean SHOW_FILE = true;

ou até mesmo substituir essa linha
        if (SHOW_FILE && player.isGM() && _file != null)

            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));

por essa
        if (player.isGM() && _file != null)

            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));
 

Isso mesmo @Leonardo Alves ツ, apenas mudar para "public static boolean SHOW_FILE = true" resolve, estava vendo isso ao mesmo tempo aqui e até fiz a criação de config via properties.

Edited by Schuster
Link to comment
Share on other sites

  • 0
29 minutos atrás, Leonardo Alves ツ disse:

No seu caso tentou fazer isso, mudar essa linha:
public static boolean SHOW_FILE;

para 
public static boolean SHOW_FILE = true;

ou até mesmo substituir essa linha
        if (SHOW_FILE && player.isGM() && _file != null)

            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));

por essa
        if (player.isGM() && _file != null)

            player.sendPacket(new CreatureSay(SayType.ALL, "HTML", _file));
 

Deu certo!! passei para "public static boolean SHOW_FILE = true;" vlw manos

hashirama-naruto.gif
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.