Помогите закрыть/скрыть доску объявлений jts2018

blowcito

Единомышленник
Участник
Сообщения
57
Розыгрыши
0
Репутация
20
Реакции
11
Баллы
113
Хроники
  1. Chaotic Throne: High Five
Исходники
Присутствуют
Сборка
jts2018
Здравствуйте, мне нужна небольшая помощь. когда я нажимаю на обход и выполняю, например:
player.sendPacket(new ShowBoard());
мне удается закрыть/скрыть доску сообщества, но потом ее невозможно использовать снова, она заблокирована навсегда.
Я просто хочу, чтобы она скрывалась каждый раз, когда я использую player.sendPacket(newShowBoard());

Кто-нибудь может помочь мне с этим?

Java:
package org.mmocore.gameserver.network.lineage.serverpackets;

import org.mmocore.gameserver.configuration.config.community.CBasicConfig;
import org.mmocore.gameserver.data.htm.HtmCache;
import org.mmocore.gameserver.network.lineage.components.GameServerPacket;
import org.mmocore.gameserver.object.Player;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ShowBoard extends GameServerPacket {
    private static final String[] DIRECT_BYPASS = {"bypass _bbshome", "bypass _bbsgetfav", "bypass _bbsloc", "bypass _bbsclan", "bypass _bbsmemo", "bypass _maillist_0_1_0_", "bypass _friendlist_0_"};
    private String html;
    private String fav;
    public static int _showboard = 0x01; //добавьте «static», иначе он не будет работать

    private ShowBoard(final String id, final String html, final String fav) {
        this.html = id + '\u0008';
        if (html != null) {
            this.html += html;
        }
        this.fav = fav;
    }

    private ShowBoard(final String id, final List<String> arg, final String fav) {
        html = id + '\u0008';
        for (final String a : arg) {
            html += a + " \u0008";
        }
    }

    public static void separateAndSend(String html, final Player player) {
        html = html.replace("\t", "");
        final String pathFileCommunity = CBasicConfig.BBS_PATH + "/";
        final Pattern p = Pattern.compile("\\%include\\(([^\\)]+)\\)\\%");
        final Matcher m = p.matcher(html);
        while (m.find()) {
            html = html.replace(m.group(0), HtmCache.getInstance().getHtml(pathFileCommunity + m.group(1), player));
        }
        String fav = "";
        if (player.getSessionVar("add_fav") != null) {
            fav = "bypass _bbsaddfav_List";
        }

        player.getBypassStorage().parseHtml(html, true);

        if (html.length() < 8180) {
            player.sendPacket(new ShowBoard("101", html, fav));
            player.sendPacket(new ShowBoard("102", "", fav));
            player.sendPacket(new ShowBoard("103", "", fav));
        } else if (html.length() < 8180 * 2) {
            player.sendPacket(new ShowBoard("101", html.substring(0, 8180), fav));
            player.sendPacket(new ShowBoard("102", html.substring(8180, html.length()), fav));
            player.sendPacket(new ShowBoard("103", "", fav));
        } else if (html.length() < 8180 * 3) {
            player.sendPacket(new ShowBoard("101", html.substring(0, 8180), fav));
            player.sendPacket(new ShowBoard("102", html.substring(8180, 8180 * 2), fav));
            player.sendPacket(new ShowBoard("103", html.substring(8180 * 2, html.length()), fav));
        } else {
            throw new IllegalArgumentException("Html is too long!");
        }
    }

    public static void separateAndSend(final String html, final List<String> arg, final Player player) {
        String fav = "";
        if (player.getSessionVar("add_fav") != null) {
            fav = "bypass _bbsaddfav_List";
        }

        player.getBypassStorage().parseHtml(html, true);

        if (html.length() < 8180) {
            player.sendPacket(new ShowBoard("1001", html, fav));
            player.sendPacket(new ShowBoard("1002", arg, fav));
        } else {
            throw new IllegalArgumentException("Html is too long!");
        }
    }
    
    public ShowBoard()
    {
        _showboard = 0x00;
        fav = "";
        html = "";
    }

    @Override
    protected final void writeData() {
        writeC(_showboard); //c4 1 to show community 00 to hide
        for (final String bbsBypass : DIRECT_BYPASS) {
            writeS(bbsBypass);
        }
        writeS(fav);
        writeS(html);
    }
}

как объяснялось выше, срабатывает только один раз, после чего сообщество нельзя открыть даже нажатием клавиш ALT+B.
 
Код:
package org.mmocore.gameserver.network.lineage.serverpackets;

import org.mmocore.gameserver.configuration.config.community.CBasicConfig;
import org.mmocore.gameserver.data.htm.HtmCache;
import org.mmocore.gameserver.network.lineage.components.GameServerPacket;
import org.mmocore.gameserver.object.Player;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ShowBoard extends GameServerPacket {
    private static final String[] DIRECT_BYPASS = {"bypass _bbshome", "bypass _bbsgetfav", "bypass _bbsloc", "bypass _bbsclan", "bypass _bbsmemo", "bypass _maillist_0_1_0_", "bypass _friendlist_0_"};
    private String html;
    private String fav;
    private boolean _showboard;

    private ShowBoard(final String id, final String html, final String fav) {
        _showboard = true;
        this.html = id + '\u0008';
        if (html != null) {
            this.html += html;
        }
        this.fav = fav;
    }

    private ShowBoard(final String id, final List<String> arg, final String fav) {
        _showboard = true;
        html = id + '\u0008';
        for (final String a : arg) {
            html += a + " \u0008";
        }
    }

    public static void separateAndSend(String html, final Player player) {
        _showboard = true;
        html = html.replace("\t", "");
        final String pathFileCommunity = CBasicConfig.BBS_PATH + "/";
        final Pattern p = Pattern.compile("\\%include\\(([^\\)]+)\\)\\%");
        final Matcher m = p.matcher(html);
        while (m.find()) {
            html = html.replace(m.group(0), HtmCache.getInstance().getHtml(pathFileCommunity + m.group(1), player));
        }
        String fav = "";
        if (player.getSessionVar("add_fav") != null) {
            fav = "bypass _bbsaddfav_List";
        }

        player.getBypassStorage().parseHtml(html, true);

        if (html.length() < 8180) {
            player.sendPacket(new ShowBoard("101", html, fav));
            player.sendPacket(new ShowBoard("102", "", fav));
            player.sendPacket(new ShowBoard("103", "", fav));
        } else if (html.length() < 8180 * 2) {
            player.sendPacket(new ShowBoard("101", html.substring(0, 8180), fav));
            player.sendPacket(new ShowBoard("102", html.substring(8180, html.length()), fav));
            player.sendPacket(new ShowBoard("103", "", fav));
        } else if (html.length() < 8180 * 3) {
            player.sendPacket(new ShowBoard("101", html.substring(0, 8180), fav));
            player.sendPacket(new ShowBoard("102", html.substring(8180, 8180 * 2), fav));
            player.sendPacket(new ShowBoard("103", html.substring(8180 * 2, html.length()), fav));
        } else {
            throw new IllegalArgumentException("Html is too long!");
        }
    }

    public static void separateAndSend(final String html, final List<String> arg, final Player player) {
        _showboard = true; 
        String fav = "";
        if (player.getSessionVar("add_fav") != null) {
            fav = "bypass _bbsaddfav_List";
        }

        player.getBypassStorage().parseHtml(html, true);

        if (html.length() < 8180) {
            player.sendPacket(new ShowBoard("1001", html, fav));
            player.sendPacket(new ShowBoard("1002", arg, fav));
        } else {
            throw new IllegalArgumentException("Html is too long!");
        }
    }
    
    public ShowBoard()
    {
        _showboard = false;
        fav = "";
        html = "";
    }

    @Override
    protected final void writeData() {
          if (_showboard)
        {
            writeC(0x01);
            for (final String bbsBypass : DIRECT_BYPASS) {
                writeS(bbsBypass);
            }
            writeS(fav);
            writeS(html);
        }
        else
        {
            writeC(0x00);
        }
    }
}
 
Код:
package org.mmocore.gameserver.network.lineage.serverpackets;

import org.mmocore.gameserver.configuration.config.community.CBasicConfig;
import org.mmocore.gameserver.data.htm.HtmCache;
import org.mmocore.gameserver.network.lineage.components.GameServerPacket;
import org.mmocore.gameserver.object.Player;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ShowBoard extends GameServerPacket {
    private static final String[] DIRECT_BYPASS = {"bypass _bbshome", "bypass _bbsgetfav", "bypass _bbsloc", "bypass _bbsclan", "bypass _bbsmemo", "bypass _maillist_0_1_0_", "bypass _friendlist_0_"};
    private String html;
    private String fav;
    private boolean _showboard;

    private ShowBoard(final String id, final String html, final String fav) {
        _showboard = true;
        this.html = id + '\u0008';
        if (html != null) {
            this.html += html;
        }
        this.fav = fav;
    }

    private ShowBoard(final String id, final List<String> arg, final String fav) {
        _showboard = true;
        html = id + '\u0008';
        for (final String a : arg) {
            html += a + " \u0008";
        }
    }

    public static void separateAndSend(String html, final Player player) {
        _showboard = true;
        html = html.replace("\t", "");
        final String pathFileCommunity = CBasicConfig.BBS_PATH + "/";
        final Pattern p = Pattern.compile("\\%include\\(([^\\)]+)\\)\\%");
        final Matcher m = p.matcher(html);
        while (m.find()) {
            html = html.replace(m.group(0), HtmCache.getInstance().getHtml(pathFileCommunity + m.group(1), player));
        }
        String fav = "";
        if (player.getSessionVar("add_fav") != null) {
            fav = "bypass _bbsaddfav_List";
        }

        player.getBypassStorage().parseHtml(html, true);

        if (html.length() < 8180) {
            player.sendPacket(new ShowBoard("101", html, fav));
            player.sendPacket(new ShowBoard("102", "", fav));
            player.sendPacket(new ShowBoard("103", "", fav));
        } else if (html.length() < 8180 * 2) {
            player.sendPacket(new ShowBoard("101", html.substring(0, 8180), fav));
            player.sendPacket(new ShowBoard("102", html.substring(8180, html.length()), fav));
            player.sendPacket(new ShowBoard("103", "", fav));
        } else if (html.length() < 8180 * 3) {
            player.sendPacket(new ShowBoard("101", html.substring(0, 8180), fav));
            player.sendPacket(new ShowBoard("102", html.substring(8180, 8180 * 2), fav));
            player.sendPacket(new ShowBoard("103", html.substring(8180 * 2, html.length()), fav));
        } else {
            throw new IllegalArgumentException("Html is too long!");
        }
    }

    public static void separateAndSend(final String html, final List<String> arg, final Player player) {
        _showboard = true;
        String fav = "";
        if (player.getSessionVar("add_fav") != null) {
            fav = "bypass _bbsaddfav_List";
        }

        player.getBypassStorage().parseHtml(html, true);

        if (html.length() < 8180) {
            player.sendPacket(new ShowBoard("1001", html, fav));
            player.sendPacket(new ShowBoard("1002", arg, fav));
        } else {
            throw new IllegalArgumentException("Html is too long!");
        }
    }
   
    public ShowBoard()
    {
        _showboard = false;
        fav = "";
        html = "";
    }

    @Override
    protected final void writeData() {
          if (_showboard)
        {
            writeC(0x01);
            for (final String bbsBypass : DIRECT_BYPASS) {
                writeS(bbsBypass);
            }
            writeS(fav);
            writeS(html);
        }
        else
        {
            writeC(0x00);
        }
    }
}

Привет, лорд, спасибо за ответ... Я попытался добавить код, но получил ошибку: Cannot make a static reference to the non-static field _showboard
screen: 1717052914598.png
 
Возвращаясь к ответу, я применил ваш патч, изменив private static boolean _showboard; компиляция и когда я пытаюсь ничего не происходит, он работает, как будто патч не существует.
То есть я выполняю player.sendPacket(new ShowBoard()); и его как будто нет, он не модифицируется.

Я подумал, может быть, это должно быть public static boolean _showboard; ?

Большое спасибо за помощь, которую вы мне оказали.
 
Возвращаясь к ответу, я применил ваш патч, изменив private static boolean _showboard; компиляция и когда я пытаюсь ничего не происходит, он работает, как будто патч не существует.
То есть я выполняю player.sendPacket(new ShowBoard()); и его как будто нет, он не модифицируется.

Я подумал, может быть, это должно быть public static boolean _showboard; ?

Большое спасибо за помощь, которую вы мне оказали.
в идеале выноси из пакетка separateAndSend в хендлеры комьюнити в AbstractCommunityBoard и все будет отлично работать, там всеравно методы как раз статики
 

Похожие темы

Назад
Сверху Снизу