Помощь по Community Board

kaiyana1

Путник
Пользователь
Сообщения
64
Розыгрыши
0
Репутация
0
Реакции
2
Баллы
0
Хроники
  1. Helios
  2. Grand Cursade
  3. Salvation
  4. Fafurion
  5. Shadow of the Kamael
Исходники
Присутствуют
Сборка
l2jmobius
Прошу помощи по сборке l2jmobius secret of empire.
Как можно сделать получение профессии в Community Board? (Alt+B)
На сервере есть нпс менеджер но как можно перенести эту функцию в альт б?
 
Обратите внимание, что данный пользователь заблокирован! Не совершайте с ним никаких сделок! Перейдите в его профиль, чтобы узнать причину блокировки.
Уже давали ответ по ГОД мобиуса - такая же ситуация и с Классиком (поюзайте поиск)
 
Уже давали ответ по ГОД мобиуса - такая же ситуация и с Классиком (поюзайте поиск)
обрыскал уже весь интернет, ничего не могу найти...

если есть у кого возможность, помогите с кодом..
 
Последнее редактирование модератором:
Слать пакет ShowBoard через нпс
 
и как же отправка пустой хтмл поможет в его юзабилити?)) хендлеры завязаны на нпц, человеку нужен сервис отдельно в кб без участия нпц.
ТС нужно писать отдельный скрипт под кб
Java:
package handlers.communityboard;

import org.l2jmobius.gameserver.handler.IParseBoardHandler;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;


public class Community implements IParseBoardHandler {
    private static final String[] COMMAND =
            {
                    "_bbscommand"
            };

    @Override
    public boolean parseCommunityBoardCommand(String command, PlayerInstance player) {
        return false;
    }

    @Override
    public String[] getCommunityBoardCommands() {
        return COMMAND;
    }
}

и погнал
 
Последнее редактирование:
Обратите внимание, что данный пользователь заблокирован! Не совершайте с ним никаких сделок! Перейдите в его профиль, чтобы узнать причину блокировки.
уже ответ дали же, вставить байпасы от кота в кб - делов 1 минута
 
Обратите внимание, что данный пользователь заблокирован! Не совершайте с ним никаких сделок! Перейдите в его профиль, чтобы узнать причину блокировки.
каких таких функций?
Вы пишите вставить байпассы от кота, делов 1 минута, только его байпассы юзают ид определенного нпс они к нему привязаны, если все это засунуть в кб, ничего работать не будет.
 
Вы пишите вставить байпассы от кота, делов 1 минута, только его байпассы юзают ид определенного нпс они к нему привязаны, если все это засунуть в кб, ничего работать не будет.
вот вот) а я уже подумал что тут какой то заговор и есть другой мобиус в котором создана отдельная система байпасов без привязки событии на отдельные объекты :D
 
Вы пишите вставить байпассы от кота, делов 1 минута, только его байпассы юзают ид определенного нпс они к нему привязаны, если все это засунуть в кб, ничего работать не будет.
Какая разница какой я пакет пошлю? ShowBoard или NpcHtmlMessage?
 
Обратите внимание, что данный пользователь заблокирован! Не совершайте с ним никаких сделок! Перейдите в его профиль, чтобы узнать причину блокировки.
Вы пишите вставить байпассы от кота, делов 1 минута, только его байпассы юзают ид определенного нпс они к нему привязаны, если все это засунуть в кб, ничего работать не будет.
ебеня если не знаешь механики в мобиусе не пиши, но в кб там будет прекрасно открываться и работать - это мобиус!
 
А чее не судьба рабочий кб взять у мобиуса он же есть
Код:
public class HomeBoard implements IParseBoardHandler
{
    // SQL Queries
    private static final String COUNT_FAVORITES = "SELECT COUNT(*) AS favorites FROM `bbs_favorites` WHERE `playerId`=?";
    private static final String NAVIGATION_PATH = "data/html/CommunityBoard/Custom/navigation.html";
    
    private static final String[] COMMANDS =
    {
        "_bbshome",
        "_bbstop",
    };
    
    private static final String[] CUSTOM_COMMANDS =
    {
        Config.PREMIUM_SYSTEM_ENABLED && Config.COMMUNITY_PREMIUM_SYSTEM_ENABLED ? "_bbspremium" : null,
        Config.COMMUNITYBOARD_ENABLE_MULTISELLS ? "_bbsexcmultisell" : null,
        Config.COMMUNITYBOARD_ENABLE_MULTISELLS ? "_bbsmultisell" : null,
        Config.COMMUNITYBOARD_ENABLE_MULTISELLS ? "_bbssell" : null,
        Config.COMMUNITYBOARD_ENABLE_TELEPORTS ? "_bbsteleport" : null,
        Config.COMMUNITYBOARD_ENABLE_BUFFS ? "_bbsbuff" : null,
        Config.COMMUNITYBOARD_ENABLE_HEAL ? "_bbsheal" : null,
        Config.COMMUNITYBOARD_ENABLE_DELEVEL ? "_bbsdelevel" : null
    };
    
    private static final BiPredicate<String, PlayerInstance> COMBAT_CHECK = (command, player) ->
    {
        boolean commandCheck = false;
        for (String c : CUSTOM_COMMANDS)
        {
            if ((c != null) && command.startsWith(c))
            {
                commandCheck = true;
                break;
            }
        }
        
        return commandCheck && (player.isCastingNow() || player.isInCombat() || player.isInDuel() || player.isInOlympiadMode() || player.isInsideZone(ZoneId.SIEGE) || player.isInsideZone(ZoneId.PVP));
    };
    
    private static final Predicate<PlayerInstance> KARMA_CHECK = player -> Config.COMMUNITYBOARD_KARMA_DISABLED && (player.getReputation() < 0);
    
    @Override
    public String[] getCommunityBoardCommands()
    {
        List<String> commands = new ArrayList<>();
        commands.addAll(Arrays.asList(COMMANDS));
        commands.addAll(Arrays.asList(CUSTOM_COMMANDS));
        return commands.stream().filter(Objects::nonNull).toArray(String[]::new);
    }
    
    @Override
    public boolean parseCommunityBoardCommand(String command, PlayerInstance player)
    {
        // Old custom conditions check move to here
        if (COMBAT_CHECK.test(command, player))
        {
            player.sendMessage("You can't use the Community Board right now.");
            return false;
        }
        
        if (KARMA_CHECK.test(player))
        {
            player.sendMessage("Players with Karma cannot use the Community Board.");
            return false;
        }
        
        String returnHtml = null;
        final String navigation = HtmCache.getInstance().getHtm(player, NAVIGATION_PATH);
        if (command.equals("_bbshome") || command.equals("_bbstop"))
        {
            final String customPath = Config.CUSTOM_CB_ENABLED ? "Custom/" : "";
            CommunityBoardHandler.getInstance().addBypass(player, "Home", command);
            
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/" + customPath + "home.html");
            if (!Config.CUSTOM_CB_ENABLED)
            {
                returnHtml = returnHtml.replaceAll("%fav_count%", Integer.toString(getFavoriteCount(player)));
                returnHtml = returnHtml.replaceAll("%region_count%", Integer.toString(getRegionCount(player)));
                returnHtml = returnHtml.replaceAll("%clan_count%", Integer.toString(ClanTable.getInstance().getClanCount()));
            }
        }
        else if (command.startsWith("_bbstop;"))
        {
            final String customPath = Config.CUSTOM_CB_ENABLED ? "Custom/" : "";
            final String path = command.replace("_bbstop;", "");
            if ((path.length() > 0) && path.endsWith(".html"))
            {
                returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/" + customPath + path);
            }
        }
        else if (command.startsWith("_bbsmultisell"))
        {
            final String fullBypass = command.replace("_bbsmultisell;", "");
            final String[] buypassOptions = fullBypass.split(",");
            final int multisellId = Integer.parseInt(buypassOptions[0]);
            final String page = buypassOptions[1];
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
            MultisellData.getInstance().separateAndSend(multisellId, player, null, false);
        }
        else if (command.startsWith("_bbsexcmultisell"))
        {
            final String fullBypass = command.replace("_bbsexcmultisell;", "");
            final String[] buypassOptions = fullBypass.split(",");
            final int multisellId = Integer.parseInt(buypassOptions[0]);
            final String page = buypassOptions[1];
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
            MultisellData.getInstance().separateAndSend(multisellId, player, null, true);
        }
        else if (command.startsWith("_bbssell"))
        {
            final String page = command.replace("_bbssell;", "");
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
            player.sendPacket(new BuyList(BuyListData.getInstance().getBuyList(423), player, 0));
            player.sendPacket(new ExBuySellList(player, false));
        }
        else if (command.startsWith("_bbsteleport"))
        {
            final String teleBuypass = command.replace("_bbsteleport;", "");
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < Config.COMMUNITYBOARD_TELEPORT_PRICE)
            {
                player.sendMessage("Not enough currency!");
            }
            else if (Config.COMMUNITY_AVAILABLE_TELEPORTS.get(teleBuypass) != null)
            {
                player.disableAllSkills();
                player.sendPacket(new ShowBoard());
                player.destroyItemByItemId("CB_Teleport", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_TELEPORT_PRICE, player, true);
                player.setInstanceById(0);
                player.teleToLocation(Config.COMMUNITY_AVAILABLE_TELEPORTS.get(teleBuypass), 0);
                ThreadPool.schedule(() ->
                {
                    player.enableAllSkills();
                }, 3000);
            }
        }
        else if (command.startsWith("_bbsbuff"))
        {
            final String fullBypass = command.replace("_bbsbuff;", "");
            final String[] buypassOptions = fullBypass.split(";");
            final int buffCount = buypassOptions.length - 1;
            final String page = buypassOptions[buffCount];
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < (Config.COMMUNITYBOARD_BUFF_PRICE * buffCount))
            {
                player.sendMessage("Not enough currency!");
            }
            else
            {
                player.destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE * buffCount, player, true);
                final PetInstance pet = player.getPet();
                List<Creature> targets = new ArrayList<>(4);
                targets.add(player);
                if (pet != null)
                {
                    targets.add(pet);
                }
                
                player.getServitors().values().stream().forEach(targets::add);
                
                for (int i = 0; i < buffCount; i++)
                {
                    final Skill skill = SkillData.getInstance().getSkill(Integer.parseInt(buypassOptions[i].split(",")[0]), Integer.parseInt(buypassOptions[i].split(",")[1]));
                    if (!Config.COMMUNITY_AVAILABLE_BUFFS.contains(skill.getId()))
                    {
                        continue;
                    }
                    targets.stream().filter(target -> !target.isSummon() || !skill.isSharedWithSummon()).forEach(target ->
                    {
                        skill.applyEffects(player, target);
                        if (Config.COMMUNITYBOARD_CAST_ANIMATIONS)
                        {
                            player.sendPacket(new MagicSkillUse(player, target, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()));
                            // not recommend broadcast
                            // player.broadcastPacket(new MagicSkillUse(player, target, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()));
                        }
                    });
                }
            }
            
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
        }
        else if (command.startsWith("_bbsheal"))
        {
            final String page = command.replace("_bbsheal;", "");
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < (Config.COMMUNITYBOARD_HEAL_PRICE))
            {
                player.sendMessage("Not enough currency!");
            }
            else
            {
                player.destroyItemByItemId("CB_Heal", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_HEAL_PRICE, player, true);
                player.setCurrentHp(player.getMaxHp());
                player.setCurrentMp(player.getMaxMp());
                player.setCurrentCp(player.getMaxCp());
                if (player.hasPet())
                {
                    player.getPet().setCurrentHp(player.getPet().getMaxHp());
                    player.getPet().setCurrentMp(player.getPet().getMaxMp());
                    player.getPet().setCurrentCp(player.getPet().getMaxCp());
                }
                for (Summon summon : player.getServitors().values())
                {
                    summon.setCurrentHp(summon.getMaxHp());
                    summon.setCurrentMp(summon.getMaxMp());
                    summon.setCurrentCp(summon.getMaxCp());
                }
                player.sendMessage("You used heal!");
            }
            
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
        }
        else if (command.equals("_bbsdelevel"))
        {
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < Config.COMMUNITYBOARD_DELEVEL_PRICE)
            {
                player.sendMessage("Not enough currency!");
            }
            else if (player.getLevel() == 1)
            {
                player.sendMessage("You are at minimum level!");
            }
            else
            {
                player.destroyItemByItemId("CB_Delevel", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_DELEVEL_PRICE, player, true);
                final int newLevel = player.getLevel() - 1;
                player.setExp(ExperienceData.getInstance().getExpForLevel(newLevel));
                player.getStat().setLevel((byte) newLevel);
                player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
                player.setCurrentCp(player.getMaxCp());
                if (Config.COMMUNITYBOARD_DELEVEL_REMOVE_ABILITIES)
                {
                    for (SkillLearn sk : SkillTreesData.getInstance().getAbilitySkillTree().values())
                    {
                        final Skill skill = player.getKnownSkill(sk.getSkillId());
                        if (skill != null)
                        {
                            player.removeSkill(skill);
                        }
                    }
                    player.setAbilityPointsUsed(0);
                    player.sendPacket(new ExAcquireAPSkillList(player));
                }
                player.broadcastUserInfo();
                player.checkPlayerSkills(); // Adjust skills according to new level.
                returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/delevel/complete.html");
                player.sendMessage("Your level is set to " + newLevel + "!");
            }
        }
        else if (command.startsWith("_bbspremium"))
        {
            final String fullBypass = command.replace("_bbspremium;", "");
            final String[] buypassOptions = fullBypass.split(",");
            final int premiumDays = Integer.parseInt(buypassOptions[0]);
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITY_PREMIUM_COIN_ID, -1) < (Config.COMMUNITY_PREMIUM_PRICE_PER_DAY * premiumDays))
            {
                player.sendMessage("Not enough currency!");
            }
            else
            {
                player.destroyItemByItemId("CB_Premium", Config.COMMUNITY_PREMIUM_COIN_ID, Config.COMMUNITY_PREMIUM_PRICE_PER_DAY * premiumDays, player, true);
                PremiumManager.getInstance().addPremiumTime(player.getAccountName(), premiumDays, TimeUnit.DAYS);
                player.sendMessage("Your account will now have premium status until " + new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumExpiration(player.getAccountName())) + ".");
                returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/premium/thankyou.html");
            }
        }
        
        if (returnHtml != null)
        {
            if (Config.CUSTOM_CB_ENABLED)
            {
                returnHtml = returnHtml.replace("%navigation%", navigation);
            }
            CommunityBoardHandler.separateAndSend(returnHtml, player);
        }
        return false;
    }
    
    /**
     * Gets the Favorite links for the given player.
     * @param player the player
     * @return the favorite links count
     */
    private static int getFavoriteCount(PlayerInstance player)
    {
        int count = 0;
        try (Connection con = DatabaseFactory.getConnection();
            PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
        {
            ps.setInt(1, player.getObjectId());
            try (ResultSet rs = ps.executeQuery())
            {
                if (rs.next())
                {
                    count = rs.getInt("favorites");
                }
            }
        }
        catch (Exception e)
        {
            LOG.warning(FavoriteBoard.class.getSimpleName() + ": Coudn't load favorites count for player " + player.getName());
        }
        return count;
    }
    
    /**
     * Gets the registered regions count for the given player.
     * @param player the player
     * @return the registered regions count
     */
    private static int getRegionCount(PlayerInstance player)
    {
        return 0; // TODO: Implement.
    }
}
 
  • Мне нравится
Реакции: kick
Обратите внимание, что данный пользователь заблокирован! Не совершайте с ним никаких сделок! Перейдите в его профиль, чтобы узнать причину блокировки.
А чее не судьба рабочий кб взять у мобиуса он же есть
Код:
public class HomeBoard implements IParseBoardHandler
{
    // SQL Queries
    private static final String COUNT_FAVORITES = "SELECT COUNT(*) AS favorites FROM `bbs_favorites` WHERE `playerId`=?";
    private static final String NAVIGATION_PATH = "data/html/CommunityBoard/Custom/navigation.html";
   
    private static final String[] COMMANDS =
    {
        "_bbshome",
        "_bbstop",
    };
   
    private static final String[] CUSTOM_COMMANDS =
    {
        Config.PREMIUM_SYSTEM_ENABLED && Config.COMMUNITY_PREMIUM_SYSTEM_ENABLED ? "_bbspremium" : null,
        Config.COMMUNITYBOARD_ENABLE_MULTISELLS ? "_bbsexcmultisell" : null,
        Config.COMMUNITYBOARD_ENABLE_MULTISELLS ? "_bbsmultisell" : null,
        Config.COMMUNITYBOARD_ENABLE_MULTISELLS ? "_bbssell" : null,
        Config.COMMUNITYBOARD_ENABLE_TELEPORTS ? "_bbsteleport" : null,
        Config.COMMUNITYBOARD_ENABLE_BUFFS ? "_bbsbuff" : null,
        Config.COMMUNITYBOARD_ENABLE_HEAL ? "_bbsheal" : null,
        Config.COMMUNITYBOARD_ENABLE_DELEVEL ? "_bbsdelevel" : null
    };
   
    private static final BiPredicate<String, PlayerInstance> COMBAT_CHECK = (command, player) ->
    {
        boolean commandCheck = false;
        for (String c : CUSTOM_COMMANDS)
        {
            if ((c != null) && command.startsWith(c))
            {
                commandCheck = true;
                break;
            }
        }
       
        return commandCheck && (player.isCastingNow() || player.isInCombat() || player.isInDuel() || player.isInOlympiadMode() || player.isInsideZone(ZoneId.SIEGE) || player.isInsideZone(ZoneId.PVP));
    };
   
    private static final Predicate<PlayerInstance> KARMA_CHECK = player -> Config.COMMUNITYBOARD_KARMA_DISABLED && (player.getReputation() < 0);
   
    @Override
    public String[] getCommunityBoardCommands()
    {
        List<String> commands = new ArrayList<>();
        commands.addAll(Arrays.asList(COMMANDS));
        commands.addAll(Arrays.asList(CUSTOM_COMMANDS));
        return commands.stream().filter(Objects::nonNull).toArray(String[]::new);
    }
   
    @Override
    public boolean parseCommunityBoardCommand(String command, PlayerInstance player)
    {
        // Old custom conditions check move to here
        if (COMBAT_CHECK.test(command, player))
        {
            player.sendMessage("You can't use the Community Board right now.");
            return false;
        }
       
        if (KARMA_CHECK.test(player))
        {
            player.sendMessage("Players with Karma cannot use the Community Board.");
            return false;
        }
       
        String returnHtml = null;
        final String navigation = HtmCache.getInstance().getHtm(player, NAVIGATION_PATH);
        if (command.equals("_bbshome") || command.equals("_bbstop"))
        {
            final String customPath = Config.CUSTOM_CB_ENABLED ? "Custom/" : "";
            CommunityBoardHandler.getInstance().addBypass(player, "Home", command);
           
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/" + customPath + "home.html");
            if (!Config.CUSTOM_CB_ENABLED)
            {
                returnHtml = returnHtml.replaceAll("%fav_count%", Integer.toString(getFavoriteCount(player)));
                returnHtml = returnHtml.replaceAll("%region_count%", Integer.toString(getRegionCount(player)));
                returnHtml = returnHtml.replaceAll("%clan_count%", Integer.toString(ClanTable.getInstance().getClanCount()));
            }
        }
        else if (command.startsWith("_bbstop;"))
        {
            final String customPath = Config.CUSTOM_CB_ENABLED ? "Custom/" : "";
            final String path = command.replace("_bbstop;", "");
            if ((path.length() > 0) && path.endsWith(".html"))
            {
                returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/" + customPath + path);
            }
        }
        else if (command.startsWith("_bbsmultisell"))
        {
            final String fullBypass = command.replace("_bbsmultisell;", "");
            final String[] buypassOptions = fullBypass.split(",");
            final int multisellId = Integer.parseInt(buypassOptions[0]);
            final String page = buypassOptions[1];
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
            MultisellData.getInstance().separateAndSend(multisellId, player, null, false);
        }
        else if (command.startsWith("_bbsexcmultisell"))
        {
            final String fullBypass = command.replace("_bbsexcmultisell;", "");
            final String[] buypassOptions = fullBypass.split(",");
            final int multisellId = Integer.parseInt(buypassOptions[0]);
            final String page = buypassOptions[1];
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
            MultisellData.getInstance().separateAndSend(multisellId, player, null, true);
        }
        else if (command.startsWith("_bbssell"))
        {
            final String page = command.replace("_bbssell;", "");
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
            player.sendPacket(new BuyList(BuyListData.getInstance().getBuyList(423), player, 0));
            player.sendPacket(new ExBuySellList(player, false));
        }
        else if (command.startsWith("_bbsteleport"))
        {
            final String teleBuypass = command.replace("_bbsteleport;", "");
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < Config.COMMUNITYBOARD_TELEPORT_PRICE)
            {
                player.sendMessage("Not enough currency!");
            }
            else if (Config.COMMUNITY_AVAILABLE_TELEPORTS.get(teleBuypass) != null)
            {
                player.disableAllSkills();
                player.sendPacket(new ShowBoard());
                player.destroyItemByItemId("CB_Teleport", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_TELEPORT_PRICE, player, true);
                player.setInstanceById(0);
                player.teleToLocation(Config.COMMUNITY_AVAILABLE_TELEPORTS.get(teleBuypass), 0);
                ThreadPool.schedule(() ->
                {
                    player.enableAllSkills();
                }, 3000);
            }
        }
        else if (command.startsWith("_bbsbuff"))
        {
            final String fullBypass = command.replace("_bbsbuff;", "");
            final String[] buypassOptions = fullBypass.split(";");
            final int buffCount = buypassOptions.length - 1;
            final String page = buypassOptions[buffCount];
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < (Config.COMMUNITYBOARD_BUFF_PRICE * buffCount))
            {
                player.sendMessage("Not enough currency!");
            }
            else
            {
                player.destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE * buffCount, player, true);
                final PetInstance pet = player.getPet();
                List<Creature> targets = new ArrayList<>(4);
                targets.add(player);
                if (pet != null)
                {
                    targets.add(pet);
                }
               
                player.getServitors().values().stream().forEach(targets::add);
               
                for (int i = 0; i < buffCount; i++)
                {
                    final Skill skill = SkillData.getInstance().getSkill(Integer.parseInt(buypassOptions[i].split(",")[0]), Integer.parseInt(buypassOptions[i].split(",")[1]));
                    if (!Config.COMMUNITY_AVAILABLE_BUFFS.contains(skill.getId()))
                    {
                        continue;
                    }
                    targets.stream().filter(target -> !target.isSummon() || !skill.isSharedWithSummon()).forEach(target ->
                    {
                        skill.applyEffects(player, target);
                        if (Config.COMMUNITYBOARD_CAST_ANIMATIONS)
                        {
                            player.sendPacket(new MagicSkillUse(player, target, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()));
                            // not recommend broadcast
                            // player.broadcastPacket(new MagicSkillUse(player, target, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()));
                        }
                    });
                }
            }
           
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
        }
        else if (command.startsWith("_bbsheal"))
        {
            final String page = command.replace("_bbsheal;", "");
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < (Config.COMMUNITYBOARD_HEAL_PRICE))
            {
                player.sendMessage("Not enough currency!");
            }
            else
            {
                player.destroyItemByItemId("CB_Heal", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_HEAL_PRICE, player, true);
                player.setCurrentHp(player.getMaxHp());
                player.setCurrentMp(player.getMaxMp());
                player.setCurrentCp(player.getMaxCp());
                if (player.hasPet())
                {
                    player.getPet().setCurrentHp(player.getPet().getMaxHp());
                    player.getPet().setCurrentMp(player.getPet().getMaxMp());
                    player.getPet().setCurrentCp(player.getPet().getMaxCp());
                }
                for (Summon summon : player.getServitors().values())
                {
                    summon.setCurrentHp(summon.getMaxHp());
                    summon.setCurrentMp(summon.getMaxMp());
                    summon.setCurrentCp(summon.getMaxCp());
                }
                player.sendMessage("You used heal!");
            }
           
            returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/" + page + ".html");
        }
        else if (command.equals("_bbsdelevel"))
        {
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < Config.COMMUNITYBOARD_DELEVEL_PRICE)
            {
                player.sendMessage("Not enough currency!");
            }
            else if (player.getLevel() == 1)
            {
                player.sendMessage("You are at minimum level!");
            }
            else
            {
                player.destroyItemByItemId("CB_Delevel", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_DELEVEL_PRICE, player, true);
                final int newLevel = player.getLevel() - 1;
                player.setExp(ExperienceData.getInstance().getExpForLevel(newLevel));
                player.getStat().setLevel((byte) newLevel);
                player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
                player.setCurrentCp(player.getMaxCp());
                if (Config.COMMUNITYBOARD_DELEVEL_REMOVE_ABILITIES)
                {
                    for (SkillLearn sk : SkillTreesData.getInstance().getAbilitySkillTree().values())
                    {
                        final Skill skill = player.getKnownSkill(sk.getSkillId());
                        if (skill != null)
                        {
                            player.removeSkill(skill);
                        }
                    }
                    player.setAbilityPointsUsed(0);
                    player.sendPacket(new ExAcquireAPSkillList(player));
                }
                player.broadcastUserInfo();
                player.checkPlayerSkills(); // Adjust skills according to new level.
                returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/delevel/complete.html");
                player.sendMessage("Your level is set to " + newLevel + "!");
            }
        }
        else if (command.startsWith("_bbspremium"))
        {
            final String fullBypass = command.replace("_bbspremium;", "");
            final String[] buypassOptions = fullBypass.split(",");
            final int premiumDays = Integer.parseInt(buypassOptions[0]);
            if (player.getInventory().getInventoryItemCount(Config.COMMUNITY_PREMIUM_COIN_ID, -1) < (Config.COMMUNITY_PREMIUM_PRICE_PER_DAY * premiumDays))
            {
                player.sendMessage("Not enough currency!");
            }
            else
            {
                player.destroyItemByItemId("CB_Premium", Config.COMMUNITY_PREMIUM_COIN_ID, Config.COMMUNITY_PREMIUM_PRICE_PER_DAY * premiumDays, player, true);
                PremiumManager.getInstance().addPremiumTime(player.getAccountName(), premiumDays, TimeUnit.DAYS);
                player.sendMessage("Your account will now have premium status until " + new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumExpiration(player.getAccountName())) + ".");
                returnHtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/premium/thankyou.html");
            }
        }
       
        if (returnHtml != null)
        {
            if (Config.CUSTOM_CB_ENABLED)
            {
                returnHtml = returnHtml.replace("%navigation%", navigation);
            }
            CommunityBoardHandler.separateAndSend(returnHtml, player);
        }
        return false;
    }
   
    /**
     * Gets the Favorite links for the given player.
     * @param player the player
     * @return the favorite links count
     */
    private static int getFavoriteCount(PlayerInstance player)
    {
        int count = 0;
        try (Connection con = DatabaseFactory.getConnection();
            PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
        {
            ps.setInt(1, player.getObjectId());
            try (ResultSet rs = ps.executeQuery())
            {
                if (rs.next())
                {
                    count = rs.getInt("favorites");
                }
            }
        }
        catch (Exception e)
        {
            LOG.warning(FavoriteBoard.class.getSimpleName() + ": Coudn't load favorites count for player " + player.getName());
        }
        return count;
    }
   
    /**
     * Gets the registered regions count for the given player.
     * @param player the player
     * @return the registered regions count
     */
    private static int getRegionCount(PlayerInstance player)
    {
        return 0; // TODO: Implement.
    }
}
не тупи тут нет реализации перерождения класса
 
Обратите внимание, что данный пользователь заблокирован! Не совершайте с ним никаких сделок! Перейдите в его профиль, чтобы узнать причину блокировки.
какая разница есть он нету его можно все это випилит или запилит я не вижу проблему с этим
[А по щам?] ? если дописывать код то надо в 10 -15 классах добавлять его, если можно сделать в 1 клик нахера городить огороды?
 
Обратите внимание, что данный пользователь заблокирован! Не совершайте с ним никаких сделок! Перейдите в его профиль, чтобы узнать причину блокировки.
голова то есть если есть уже готовый рабочий скрипт на перерождение зачем выдумывать велосипед?
 
Назад
Сверху Снизу