Custom Community Board support.

This commit is contained in:
mobius 2015-01-04 13:34:52 +00:00
parent da39f39543
commit 4628368579
5 changed files with 48 additions and 3 deletions

View File

@ -578,3 +578,12 @@ ShopMinRangeFromNpc = 100
# Enable Sayune for players that are not Awakened (4rth class)
# Default: False
FreeJumpsForAll = False
# ---------------------------------------------------------------------------
# Custom Community Board
# ---------------------------------------------------------------------------
# Enable Custom Community Board
# Default: False
CustomCommunityBoard = True

View File

@ -0,0 +1,12 @@
<html>
<body>
<center>
<br>
<br>
<br1> <!-- add code after this comment -->
<img src="l2ui.bbs_lineage2" width="128" height="16" ><br>
<button action="bypass _bbsmultisell;2010" value="Shop Test" width=200 height=31 back="L2UI_CT1.OlympiadWnd_DF_Reward_Down" fore="L2UI_CT1.OlympiadWnd_DF_Reward"><br>
<button action="bypass _bbstop;test.html" value="Page Test" width=200 height=31 back="L2UI_CT1.OlympiadWnd_DF_Watch_Down" fore="L2UI_CT1.OlympiadWnd_DF_Watch"><br>
</center>
</body>
</html>

View File

@ -0,0 +1,11 @@
<html>
<body>
<center>
<br>
<br>
<br1> <!-- add code after this comment -->
<img src="l2ui.bbs_lineage2" width="128" height="16" ><br>
<button action="bypass _bbsmultisell;2010" value="Shop Test" width=200 height=31 back="L2UI_CT1.OlympiadWnd_DF_Reward_Down" fore="L2UI_CT1.OlympiadWnd_DF_Reward"><br>
</center>
</body>
</html>

View File

@ -22,9 +22,11 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.ClanTable;
import com.l2jserver.gameserver.datatables.MultisellData;
import com.l2jserver.gameserver.handler.CommunityBoardHandler;
import com.l2jserver.gameserver.handler.IParseBoardHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@ -41,7 +43,8 @@ public final class HomeBoard implements IParseBoardHandler
private static final String[] COMMANDS =
{
"_bbshome",
"_bbstop"
"_bbstop",
"_bbsmultisell"
};
@Override
@ -53,11 +56,12 @@ public final class HomeBoard implements IParseBoardHandler
@Override
public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar)
{
final String customPath = Config.CUSTOM_CB_ENABLED ? "Custom/" : "";
if (command.equals("_bbshome") || command.equals("_bbstop"))
{
CommunityBoardHandler.getInstance().addBypass(activeChar, "Home", command);
String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/home.html");
String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + customPath + "home.html");
html = html.replaceAll("%fav_count%", String.valueOf(getFavoriteCount(activeChar)));
html = html.replaceAll("%region_count%", String.valueOf(getRegionCount(activeChar)));
html = html.replaceAll("%clan_count%", String.valueOf(getClansCount()));
@ -68,10 +72,16 @@ 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/" + path);
final String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + customPath + path);
CommunityBoardHandler.separateAndSend(html, activeChar);
}
}
else if (command.startsWith("_bbsmultisell") && Config.CUSTOM_CB_ENABLED)
{
final int multisell = Integer.valueOf(command.replace("_bbsmultisell;", ""));
MultisellData.getInstance().separateAndSend(multisell, activeChar, null, false);
return false;
}
return true;
}

View File

@ -817,6 +817,7 @@ public final class Config
public static int SHOP_MIN_RANGE_FROM_NPC;
public static int SHOP_MIN_RANGE_FROM_PLAYER;
public static boolean FREE_JUMPS_FOR_ALL;
public static boolean CUSTOM_CB_ENABLED;
// --------------------------------------------------
// NPC Settings
@ -2606,6 +2607,8 @@ public final class Config
FREE_JUMPS_FOR_ALL = CustomSettings.getBoolean("FreeJumpsForAll", false);
CUSTOM_CB_ENABLED = CustomSettings.getBoolean("CustomCommunityBoard", false);
// Load PvP L2Properties file (if exists)
final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE);