Premium account manager from latest projects.
Custom community board from latest projects. Fixed existing hexid replacement issue.
This commit is contained in:
@@ -174,6 +174,7 @@ import handlers.chathandlers.ChatShout;
|
||||
import handlers.chathandlers.ChatTrade;
|
||||
import handlers.chathandlers.ChatWhisper;
|
||||
import handlers.communityboard.ClanBoard;
|
||||
import handlers.communityboard.DropSearchBoard;
|
||||
import handlers.communityboard.FavoriteBoard;
|
||||
import handlers.communityboard.FriendsBoard;
|
||||
import handlers.communityboard.HomeBoard;
|
||||
@@ -459,6 +460,7 @@ public class MasterHandler
|
||||
{
|
||||
// Community Board
|
||||
ClanBoard.class,
|
||||
DropSearchBoard.class,
|
||||
FavoriteBoard.class,
|
||||
FriendsBoard.class,
|
||||
HomeBoard.class,
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package handlers.admincommandhandlers;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.cache.HtmCache;
|
||||
@@ -118,15 +119,21 @@ public class AdminPremium implements IAdminCommandHandler
|
||||
}
|
||||
|
||||
// TODO: Add check if account exists XD
|
||||
PremiumManager.getInstance().updatePremiumData(months, accountName);
|
||||
admin.sendMessage("Account " + accountName + " will now have premium status until " + String.valueOf(new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumEndDate(accountName))) + ".");
|
||||
PremiumManager.getInstance().addPremiumTime(accountName, months * 30, TimeUnit.DAYS);
|
||||
admin.sendMessage("Account " + accountName + " will now have premium status until " + new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumExpiration(accountName)) + ".");
|
||||
}
|
||||
|
||||
private void viewPremiumInfo(L2PcInstance admin, String accountName)
|
||||
{
|
||||
if (PremiumManager.getInstance().getPremiumEndDate(accountName) > 0)
|
||||
if (!Config.PREMIUM_SYSTEM_ENABLED)
|
||||
{
|
||||
admin.sendMessage("Account " + accountName + " has premium status until " + String.valueOf(new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumEndDate(accountName))) + ".");
|
||||
admin.sendMessage("Premium system is disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (PremiumManager.getInstance().getPremiumExpiration(accountName) > 0)
|
||||
{
|
||||
admin.sendMessage("Account " + accountName + " has premium status until " + new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumExpiration(accountName)) + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -136,7 +143,13 @@ public class AdminPremium implements IAdminCommandHandler
|
||||
|
||||
private void removePremium(L2PcInstance admin, String accountName)
|
||||
{
|
||||
if (PremiumManager.getInstance().getPremiumEndDate(accountName) > 0)
|
||||
if (!Config.PREMIUM_SYSTEM_ENABLED)
|
||||
{
|
||||
admin.sendMessage("Premium system is disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (PremiumManager.getInstance().getPremiumExpiration(accountName) > 0)
|
||||
{
|
||||
PremiumManager.getInstance().removePremiumStatus(accountName);
|
||||
admin.sendMessage("Account " + accountName + " has no longer premium status.");
|
||||
|
331
L2J_Mobius_HighFive/dist/game/data/scripts/handlers/communityboard/DropSearchBoard.java
vendored
Normal file
331
L2J_Mobius_HighFive/dist/game/data/scripts/handlers/communityboard/DropSearchBoard.java
vendored
Normal file
@@ -0,0 +1,331 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.communityboard;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import com.l2jmobius.gameserver.cache.HtmCache;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.datatables.SpawnTable;
|
||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jmobius.gameserver.handler.IParseBoardHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Spawn;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.drops.DropListScope;
|
||||
import com.l2jmobius.gameserver.model.drops.GeneralDropItem;
|
||||
import com.l2jmobius.gameserver.model.drops.GroupedGeneralDropItem;
|
||||
import com.l2jmobius.gameserver.model.drops.IDropItem;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
|
||||
/**
|
||||
* @author yksdtc
|
||||
*/
|
||||
public class DropSearchBoard implements IParseBoardHandler
|
||||
{
|
||||
private static final String NAVIGATION_PATH = "data/html/CommunityBoard/Custom/navigation.html";
|
||||
private static final String[] COMMAND =
|
||||
{
|
||||
"_bbs_search_item",
|
||||
"_bbs_search_drop",
|
||||
"_bbs_npc_trace"
|
||||
};
|
||||
|
||||
class DropHolder
|
||||
{
|
||||
int itemId;
|
||||
int npcId;
|
||||
byte npcLevel;
|
||||
long basemin;
|
||||
long basemax;
|
||||
double baseGroupChance;
|
||||
double basechance;
|
||||
boolean isSweep;
|
||||
|
||||
public DropHolder(L2NpcTemplate npc, GeneralDropItem item, double groupChance, boolean isSweep)
|
||||
{
|
||||
itemId = item.getItemId();
|
||||
npcId = npc.getId();
|
||||
npcLevel = npc.getLevel();
|
||||
basemin = item.getMin();
|
||||
basemax = item.getMax();
|
||||
baseGroupChance = groupChance;
|
||||
basechance = item.getChance();
|
||||
this.isSweep = isSweep;
|
||||
}
|
||||
|
||||
/**
|
||||
* only for debug'/;
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "DropHolder [itemId=" + itemId + ", npcId=" + npcId + ", npcLevel=" + npcLevel + ", basemin=" + basemin + ", basemax=" + basemax + ", baseGroupChance=" + baseGroupChance + ", basechance=" + basechance + ", isSweep=" + isSweep + "]";
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<Integer, List<DropHolder>> DROP_INDEX_CACHE = new HashMap<>();
|
||||
|
||||
// nonsupport items
|
||||
private final Set<Integer> BLOCK_ID = new HashSet<>();
|
||||
{
|
||||
BLOCK_ID.add(Inventory.ADENA_ID);
|
||||
}
|
||||
|
||||
public DropSearchBoard()
|
||||
{
|
||||
buildDropIndex();
|
||||
}
|
||||
|
||||
private void buildDropIndex()
|
||||
{
|
||||
NpcData.getInstance().getTemplates(npc -> npc.getDropLists() != null).forEach(npcTemplate ->
|
||||
{
|
||||
for (Entry<DropListScope, List<IDropItem>> entry : npcTemplate.getDropLists().entrySet())
|
||||
{
|
||||
entry.getValue().forEach(idrop ->
|
||||
{
|
||||
if (idrop instanceof GroupedGeneralDropItem)
|
||||
{
|
||||
GroupedGeneralDropItem ggd = (GroupedGeneralDropItem) idrop;
|
||||
ggd.getItems().stream().forEach(gd -> addToDropList(npcTemplate, gd, ggd.getChance(), entry.getKey() == DropListScope.CORPSE));
|
||||
}
|
||||
else
|
||||
{
|
||||
GeneralDropItem gd = (GeneralDropItem) idrop;
|
||||
addToDropList(npcTemplate, gd, 100.0, entry.getKey() == DropListScope.CORPSE);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
DROP_INDEX_CACHE.values().stream().forEach(l -> l.sort((d1, d2) -> Byte.valueOf(d1.npcLevel).compareTo(Byte.valueOf(d2.npcLevel))));
|
||||
}
|
||||
|
||||
private void addToDropList(L2NpcTemplate npcTemplate, GeneralDropItem gd, double groupChance, boolean isSweep)
|
||||
{
|
||||
if (BLOCK_ID.contains(gd.getItemId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<DropHolder> dropList = DROP_INDEX_CACHE.get(gd.getItemId());
|
||||
if (dropList == null)
|
||||
{
|
||||
dropList = new ArrayList<>();
|
||||
DROP_INDEX_CACHE.put(gd.getItemId(), dropList);
|
||||
}
|
||||
|
||||
dropList.add(new DropHolder(npcTemplate, gd, groupChance, isSweep));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean parseCommunityBoardCommand(String command, L2PcInstance player)
|
||||
{
|
||||
final String navigation = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), NAVIGATION_PATH);
|
||||
String[] params = command.split(" ");
|
||||
String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/CommunityBoard/Custom/dropsearch/main.html");
|
||||
switch (params[0])
|
||||
{
|
||||
case "_bbs_search_item":
|
||||
{
|
||||
String itemName = buildItemName(params);
|
||||
String result = buildItemSearchResult(itemName);
|
||||
html = html.replace("%searchResult%", result);
|
||||
break;
|
||||
}
|
||||
case "_bbs_search_drop":
|
||||
{
|
||||
final DecimalFormat chanceFormat = new DecimalFormat("0.00##");
|
||||
int itemId = Integer.parseInt(params[1]);
|
||||
int page = Integer.parseInt(params[2]);
|
||||
List<DropHolder> list = DROP_INDEX_CACHE.get(itemId);
|
||||
int pages = list.size() / 14;
|
||||
if (pages == 0)
|
||||
{
|
||||
pages++;
|
||||
}
|
||||
|
||||
int start = (page - 1) * 14;
|
||||
int end = Math.min(list.size() - 1, start + 14);
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int index = start; index <= end; index++)
|
||||
{
|
||||
DropHolder dropHolder = list.get(index);
|
||||
builder.append("<tr>");
|
||||
builder.append("<td width=30>").append(dropHolder.npcLevel).append("</td>");
|
||||
builder.append("<td width=170>").append("<a action=\"bypass _bbs_npc_trace " + dropHolder.npcId + "\">").append("&@").append(dropHolder.npcId).append(";").append("</a>").append("</td>");
|
||||
builder.append("<td width=80 align=CENTER>").append(dropHolder.basemin).append("-").append(dropHolder.basemax).append("</td>");
|
||||
builder.append("<td width=50 align=CENTER>").append(chanceFormat.format((dropHolder.basechance * dropHolder.baseGroupChance) / 100)).append("%").append("</td>");
|
||||
builder.append("<td width=50 align=CENTER>").append(dropHolder.isSweep ? "Sweep" : "Drop").append("</td>");
|
||||
builder.append("</tr>");
|
||||
}
|
||||
|
||||
html = html.replace("%searchResult%", builder.toString());
|
||||
builder.setLength(0);
|
||||
|
||||
builder.append("<tr>");
|
||||
for (page = 1; page <= pages; page++)
|
||||
{
|
||||
builder.append("<td>").append("<a action=\"bypass -h _bbs_search_drop " + itemId + " " + page + " $order $level\">").append(page).append("</a>").append("</td>");
|
||||
}
|
||||
builder.append("</tr>");
|
||||
html = html.replace("%pages%", builder.toString());
|
||||
break;
|
||||
}
|
||||
case "_bbs_npc_trace":
|
||||
{
|
||||
int npcId = Integer.parseInt(params[1]);
|
||||
L2Spawn spawn = SpawnTable.getInstance().findAny(npcId);
|
||||
if (spawn == null)
|
||||
{
|
||||
player.sendMessage("cant find any spawn maybe boss or instance mob");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getRadar().addMarker(spawn.getX(), spawn.getY(), spawn.getZ());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (html != null)
|
||||
{
|
||||
html = html.replace("%navigation%", navigation);
|
||||
CommunityBoardHandler.separateAndSend(html, player);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemName
|
||||
* @return
|
||||
*/
|
||||
private String buildItemSearchResult(String itemName)
|
||||
{
|
||||
int limit = 0;
|
||||
Set<Integer> existInDropData = DROP_INDEX_CACHE.keySet();
|
||||
List<L2Item> items = new ArrayList<>();
|
||||
for (L2Item item : ItemTable.getInstance().getAllItems())
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!existInDropData.contains(item.getId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.getName().toLowerCase().contains(itemName.toLowerCase()))
|
||||
{
|
||||
items.add(item);
|
||||
limit++;
|
||||
}
|
||||
|
||||
if (limit == 14)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (items.isEmpty())
|
||||
{
|
||||
return "<tr><td width=100 align=CENTER>No Match</td></tr>";
|
||||
}
|
||||
|
||||
int line = 0;
|
||||
|
||||
StringBuilder builder = new StringBuilder(items.size() * 28);
|
||||
int i = 0;
|
||||
for (L2Item item : items)
|
||||
{
|
||||
i++;
|
||||
if (i == 1)
|
||||
{
|
||||
line++;
|
||||
builder.append("<tr>");
|
||||
}
|
||||
|
||||
String icon = item.getIcon();
|
||||
if (icon == null)
|
||||
{
|
||||
icon = "icon.etc_question_mark_i00";
|
||||
}
|
||||
|
||||
builder.append("<td>");
|
||||
builder.append("<button value=\".\" action=\"bypass _bbs_search_drop " + item.getId() + " 1 $order $level\" width=32 height=32 back=\"" + icon + "\" fore=\"" + icon + "\">");
|
||||
builder.append("</td>");
|
||||
builder.append("<td width=200>");
|
||||
builder.append("&#").append(item.getId()).append(";");
|
||||
builder.append("</td>");
|
||||
|
||||
if (i == 2)
|
||||
{
|
||||
builder.append("</tr>");
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i % 2) == 1)
|
||||
{
|
||||
builder.append("</tr>");
|
||||
}
|
||||
|
||||
if (line < 7)
|
||||
{
|
||||
for (i = 0; i < (7 - line); i++)
|
||||
{
|
||||
builder.append("<tr><td height=36></td></tr>");
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
private String buildItemName(String[] params)
|
||||
{
|
||||
StringJoiner joiner = new StringJoiner(" ");
|
||||
for (int i = 1; i < params.length; i++)
|
||||
{
|
||||
joiner.add(params[i]);
|
||||
}
|
||||
return joiner.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getCommunityBoardCommands()
|
||||
{
|
||||
return COMMAND;
|
||||
}
|
||||
}
|
@@ -19,6 +19,14 @@ package handlers.communityboard;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -29,10 +37,15 @@ import com.l2jmobius.gameserver.data.xml.impl.MultisellData;
|
||||
import com.l2jmobius.gameserver.datatables.SkillData;
|
||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jmobius.gameserver.handler.IParseBoardHandler;
|
||||
import com.l2jmobius.gameserver.instancemanager.PremiumManager;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.BuyList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExBuySellList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ShowBoard;
|
||||
|
||||
/**
|
||||
@@ -43,50 +56,80 @@ public final 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",
|
||||
"_bbsmultisell",
|
||||
"_bbssell",
|
||||
"_bbsteleport",
|
||||
"_bbsbuff"
|
||||
};
|
||||
|
||||
private static final String[] CUSTOM_COMMANDS =
|
||||
{
|
||||
Config.PREMIUM_SYSTEM_ENABLED && Config.COMMUNITY_PREMIUM_SYSTEM_ENABLED ? "_bbspremium" : 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
|
||||
};
|
||||
|
||||
public static final BiPredicate<String, L2PcInstance> COMBAT_CHECK = (command, activeChar) ->
|
||||
{
|
||||
boolean commandCheck = false;
|
||||
for (String c : CUSTOM_COMMANDS)
|
||||
{
|
||||
if ((c != null) && command.startsWith(c))
|
||||
{
|
||||
commandCheck = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return commandCheck && (activeChar.isInCombat() || activeChar.isInDuel() || activeChar.isInOlympiadMode() || activeChar.isInsideZone(ZoneId.SIEGE) || activeChar.isInsideZone(ZoneId.PVP));
|
||||
};
|
||||
|
||||
public static final Predicate<L2PcInstance> KARMA_CHECK = player -> Config.COMMUNITYBOARD_KARMA_DISABLED && (player.getKarma() > 0);
|
||||
|
||||
@Override
|
||||
public String[] getCommunityBoardCommands()
|
||||
{
|
||||
return COMMANDS;
|
||||
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, L2PcInstance activeChar)
|
||||
{
|
||||
if (Config.CUSTOM_CB_ENABLED)
|
||||
// Old custom conditions check move to here
|
||||
if (COMBAT_CHECK.test(command, activeChar))
|
||||
{
|
||||
if (Config.COMMUNITYBOARD_COMBAT_DISABLED && (activeChar.isInCombat() || activeChar.isInDuel() || activeChar.isInOlympiadMode() || activeChar.isInsideZone(ZoneId.SIEGE) || activeChar.isInsideZone(ZoneId.PVP)))
|
||||
{
|
||||
activeChar.sendMessage("You can't use the Community Board right now.");
|
||||
return false;
|
||||
}
|
||||
if (Config.COMMUNITYBOARD_KARMA_DISABLED && (activeChar.getKarma() > 0))
|
||||
{
|
||||
activeChar.sendMessage("Players with Karma cannot use the Community Board.");
|
||||
return false;
|
||||
}
|
||||
activeChar.sendMessage("You can't use the Community Board right now.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (KARMA_CHECK.test(activeChar))
|
||||
{
|
||||
activeChar.sendMessage("Players with Karma cannot use the Community Board.");
|
||||
return false;
|
||||
}
|
||||
|
||||
String returnHtml = null;
|
||||
final String navigation = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), NAVIGATION_PATH);
|
||||
if (command.equals("_bbshome") || command.equals("_bbstop"))
|
||||
{
|
||||
final String customPath = Config.CUSTOM_CB_ENABLED ? "Custom/" : "";
|
||||
CommunityBoardHandler.getInstance().addBypass(activeChar, "Home", command);
|
||||
|
||||
String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + customPath + "home.html");
|
||||
html = html.replaceAll("%fav_count%", Integer.toString(getFavoriteCount(activeChar)));
|
||||
html = html.replaceAll("%region_count%", Integer.toString(getRegionCount(activeChar)));
|
||||
html = html.replaceAll("%clan_count%", Integer.toString(ClanTable.getInstance().getClanCount()));
|
||||
CommunityBoardHandler.separateAndSend(html, activeChar);
|
||||
returnHtml = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + customPath + "home.html");
|
||||
if (!Config.CUSTOM_CB_ENABLED)
|
||||
{
|
||||
returnHtml = returnHtml.replaceAll("%fav_count%", Integer.toString(getFavoriteCount(activeChar)));
|
||||
returnHtml = returnHtml.replaceAll("%region_count%", Integer.toString(getRegionCount(activeChar)));
|
||||
returnHtml = returnHtml.replaceAll("%clan_count%", Integer.toString(ClanTable.getInstance().getClanCount()));
|
||||
}
|
||||
}
|
||||
else if (command.startsWith("_bbstop;"))
|
||||
{
|
||||
@@ -94,31 +137,26 @@ public final class HomeBoard implements IParseBoardHandler
|
||||
final String path = command.replace("_bbstop;", "");
|
||||
if ((path.length() > 0) && path.endsWith(".html"))
|
||||
{
|
||||
final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + customPath + path);
|
||||
CommunityBoardHandler.separateAndSend(html, activeChar);
|
||||
returnHtml = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + customPath + path);
|
||||
}
|
||||
}
|
||||
else if (Config.CUSTOM_CB_ENABLED && Config.COMMUNITYBOARD_ENABLE_MULTISELLS && command.startsWith("_bbsmultisell"))
|
||||
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];
|
||||
final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html");
|
||||
CommunityBoardHandler.separateAndSend(html, activeChar);
|
||||
returnHtml = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html");
|
||||
MultisellData.getInstance().separateAndSend(multisellId, activeChar, null, false);
|
||||
return true;
|
||||
}
|
||||
else if (Config.CUSTOM_CB_ENABLED && Config.COMMUNITYBOARD_ENABLE_MULTISELLS && command.startsWith("_bbssell"))
|
||||
else if (command.startsWith("_bbssell"))
|
||||
{
|
||||
final String page = command.replace("_bbssell;", "");
|
||||
final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html");
|
||||
CommunityBoardHandler.separateAndSend(html, activeChar);
|
||||
returnHtml = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html");
|
||||
activeChar.sendPacket(new BuyList(BuyListData.getInstance().getBuyList(423), activeChar.getAdena(), 0));
|
||||
activeChar.sendPacket(new ExBuySellList(activeChar, false));
|
||||
return true;
|
||||
}
|
||||
else if (Config.CUSTOM_CB_ENABLED && Config.COMMUNITYBOARD_ENABLE_TELEPORTS && command.startsWith("_bbsteleport"))
|
||||
else if (command.startsWith("_bbsteleport"))
|
||||
{
|
||||
final String fullBypass = command.replace("_bbsteleport;", "");
|
||||
final String[] buypassOptions = fullBypass.split(",");
|
||||
@@ -128,30 +166,103 @@ public final class HomeBoard implements IParseBoardHandler
|
||||
if (activeChar.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < Config.COMMUNITYBOARD_TELEPORT_PRICE)
|
||||
{
|
||||
activeChar.sendMessage("Not enough currency!");
|
||||
return false;
|
||||
}
|
||||
activeChar.sendPacket(new ShowBoard());
|
||||
activeChar.getInventory().destroyItemByItemId("CB_Teleport", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_TELEPORT_PRICE, activeChar, activeChar);
|
||||
activeChar.teleToLocation(x, y, z, 0);
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(new ShowBoard());
|
||||
activeChar.destroyItemByItemId("CB_Teleport", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_TELEPORT_PRICE, activeChar, true);
|
||||
activeChar.teleToLocation(x, y, z, 0);
|
||||
}
|
||||
}
|
||||
else if (Config.CUSTOM_CB_ENABLED && Config.COMMUNITYBOARD_ENABLE_BUFFS && command.startsWith("_bbsbuff"))
|
||||
else if (command.startsWith("_bbsbuff"))
|
||||
{
|
||||
final String fullBypass = command.replace("_bbsbuff;", "");
|
||||
final String[] buypassOptions = fullBypass.split(",");
|
||||
final int buffId = Integer.parseInt(buypassOptions[0]);
|
||||
final int buffLevel = Integer.parseInt(buypassOptions[1]);
|
||||
final String page = buypassOptions[2];
|
||||
if (activeChar.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < Config.COMMUNITYBOARD_BUFF_PRICE)
|
||||
final String[] buypassOptions = fullBypass.split(";");
|
||||
final int buffCount = buypassOptions.length - 1;
|
||||
final String page = buypassOptions[buffCount];
|
||||
if (activeChar.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < (Config.COMMUNITYBOARD_BUFF_PRICE * buffCount))
|
||||
{
|
||||
activeChar.sendMessage("Not enough currency!");
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.getInventory().destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE, activeChar, activeChar);
|
||||
SkillData.getInstance().getSkill(buffId, buffLevel).applyEffects(activeChar, activeChar);
|
||||
activeChar.destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE * buffCount, activeChar, true);
|
||||
final L2Summon pet = activeChar.getSummon();
|
||||
List<L2Character> targets = new ArrayList<>(4);
|
||||
targets.add(activeChar);
|
||||
if (pet != null)
|
||||
{
|
||||
targets.add(pet);
|
||||
}
|
||||
|
||||
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]));
|
||||
|
||||
targets.stream().filter(target -> !target.isSummon()).forEach(target ->
|
||||
{
|
||||
skill.applyEffects(activeChar, target);
|
||||
if (Config.COMMUNITYBOARD_CAST_ANIMATIONS)
|
||||
{
|
||||
activeChar.sendPacket(new MagicSkillUse(activeChar, target, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()));
|
||||
// not recommend broadcast
|
||||
// activeChar.broadcastPacket(new MagicSkillUse(activeChar, target, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html");
|
||||
CommunityBoardHandler.separateAndSend(html, activeChar);
|
||||
|
||||
returnHtml = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html");
|
||||
}
|
||||
else if (command.startsWith("_bbsheal"))
|
||||
{
|
||||
final String page = command.replace("_bbsheal;", "");
|
||||
if (activeChar.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < (Config.COMMUNITYBOARD_HEAL_PRICE))
|
||||
{
|
||||
activeChar.sendMessage("Not enough currency!");
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.destroyItemByItemId("CB_Heal", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_HEAL_PRICE, activeChar, true);
|
||||
activeChar.setCurrentHp(activeChar.getMaxHp());
|
||||
activeChar.setCurrentMp(activeChar.getMaxMp());
|
||||
activeChar.setCurrentCp(activeChar.getMaxCp());
|
||||
if (activeChar.hasSummon())
|
||||
{
|
||||
activeChar.getSummon().setCurrentHp(activeChar.getSummon().getMaxHp());
|
||||
activeChar.getSummon().setCurrentMp(activeChar.getSummon().getMaxMp());
|
||||
activeChar.getSummon().setCurrentCp(activeChar.getSummon().getMaxCp());
|
||||
}
|
||||
activeChar.sendMessage("You used heal!");
|
||||
}
|
||||
|
||||
returnHtml = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html");
|
||||
}
|
||||
else if (command.startsWith("_bbspremium"))
|
||||
{
|
||||
final String fullBypass = command.replace("_bbspremium;", "");
|
||||
final String[] buypassOptions = fullBypass.split(",");
|
||||
final int premiumDays = Integer.parseInt(buypassOptions[0]);
|
||||
if (activeChar.getInventory().getInventoryItemCount(Config.COMMUNITY_PREMIUM_COIN_ID, -1) < (Config.COMMUNITY_PREMIUM_PRICE_PER_DAY * premiumDays))
|
||||
{
|
||||
activeChar.sendMessage("Not enough currency!");
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.destroyItemByItemId("CB_Premium", Config.COMMUNITY_PREMIUM_COIN_ID, Config.COMMUNITY_PREMIUM_PRICE_PER_DAY * premiumDays, activeChar, true);
|
||||
PremiumManager.getInstance().addPremiumTime(activeChar.getAccountName(), premiumDays, TimeUnit.DAYS);
|
||||
activeChar.sendMessage("Your account will now have premium status until " + new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumExpiration(activeChar.getAccountName())) + ".");
|
||||
returnHtml = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/premium/thankyou.html");
|
||||
}
|
||||
}
|
||||
|
||||
if (returnHtml != null)
|
||||
{
|
||||
if (Config.CUSTOM_CB_ENABLED)
|
||||
{
|
||||
returnHtml = returnHtml.replace("%navigation%", navigation);
|
||||
}
|
||||
CommunityBoardHandler.separateAndSend(returnHtml, activeChar);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ public class Premium implements IVoicedCommandHandler
|
||||
if (command.startsWith("premium") && Config.PREMIUM_SYSTEM_ENABLED)
|
||||
{
|
||||
final SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm");
|
||||
final long endDate = PremiumManager.getInstance().getPremiumEndDate(activeChar.getAccountName());
|
||||
final long endDate = PremiumManager.getInstance().getPremiumExpiration(activeChar.getAccountName());
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage(5);
|
||||
final StringBuilder html = new StringBuilder();
|
||||
if (endDate == 0)
|
||||
|
Reference in New Issue
Block a user