Premium system for the custom community board.

Contributed by gigilo1968.
This commit is contained in:
MobiusDev
2016-12-29 21:54:44 +00:00
parent ac16e869c8
commit 61efe4651f
8 changed files with 258 additions and 44 deletions

View File

@@ -24,6 +24,9 @@
<tr>
<td><button value="Gatekeeper" action="bypass _bbstop;gatekeeper/main.html" width=200 height=30 back="L2UI_CT1.HtmlWnd_DF_Campaign_Down" fore="L2UI_CT1.HtmlWnd_DF_Campaign"></td>
</tr>
<tr>
<td><button value="Premium" action="bypass _bbstop;premium/main.html" width=200 height=30 back="L2UI_CT1.OlympiadWnd_DF_Reward_Down" fore="L2UI_CT1.OlympiadWnd_DF_Reward"></td>
</tr>
</center>
</table>
</td>

View File

@@ -0,0 +1,136 @@
<html noscrollbar>
<body>
<table width=700>
<tr>
<td height=10></td>
</tr>
</table>
<table width=20>
<tr>
<td>
<table valign="top">
<tr>
<td height=25></td>
</tr>
<tr>
<td><button value="Home" action="bypass _bbstop;home.html" width=200 height=30 back="L2UI_CT1.HtmlWnd_DF_Area_Down" fore="L2UI_CT1.HtmlWnd_DF_Area"></td>
</tr>
<tr>
<td><button value="Buffer" action="bypass _bbstop;buffer/main.html" width=200 height=30 back="L2UI_CT1.HtmlWnd_DF_Level_Down" fore="L2UI_CT1.HtmlWnd_DF_Level"></td>
</tr>
<tr>
<td><button value="Merchant" action="bypass _bbstop;merchant/main.html" width=200 height=30 back="L2UI_CT1.OlympiadWnd_DF_BuyEquip_Down" fore="L2UI_CT1.OlympiadWnd_DF_BuyEquip"></td>
</tr>
<tr>
<td><button value="Gatekeeper" action="bypass _bbstop;gatekeeper/main.html" width=200 height=30 back="L2UI_CT1.HtmlWnd_DF_Campaign_Down" fore="L2UI_CT1.HtmlWnd_DF_Campaign"></td>
</tr>
<tr>
<td><button value="Premium" action="bypass _bbstop;premium/main.html" width=200 height=30 back="L2UI_CT1.OlympiadWnd_DF_Reward_Down" fore="L2UI_CT1.OlympiadWnd_DF_Reward"></td>
</tr>
</center>
</table>
</td>
<td>
<center>
<table border=0 cellpadding=0 cellspacing=0 width=555 height=455 background="L2UI_CT1.Windows_DF_TooltipBG">
<tr>
<td height=25></td>
</tr>
<tr>
<td height=25 align="center"><font name="hs12" color="CDB67F">Premium Manager</font></td>
</tr>
<tr>
<td>
<center><img src="L2UI.SquareGray" width=200 height=1></center>
</td>
</tr>
<tr>
<td height=20></td>
</tr>
<tr><td align="left"> <font color="CDB67F">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1. Premium benefits CAN NOT BE TRANSFERED.<br1></font></td></tr>
<tr><td align="left"> <font color="CDB67F">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2. Premium does not effect party members.<br1></font></td></tr>
<tr><td align="left"> <font color="CDB67F">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3. Premium benefits effect ALL characters in same account.</font></td></tr>
<tr>
<td height=20></td>
</tr>
<tr><td height=15 align="center"></td></tr>
<tr><td height=15 align="center"></td></tr>
<tr>
<td height=10></td>
</tr>
<tr>
<td>
<center><img src="L2UI.SquareGray" width=500 height=1></center>
</td>
</tr>
<tr>
<td height=25></td>
</tr>
<tr>
<td align="center">
<table align=center border="0" height=85 >
<!-- // example _bbspremium;1,2, (first number: day count; second number: Price -->
<tr>
<td align=center><button value="1 Day [Price 1kk]" action="bypass _bbspremium;1" width=140 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td align=center><button value="3 Day [Price 3kk]" action="bypass _bbspremium;3" width=140 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td align=center><button value="7 Day [Price 7kk]" action="bypass _bbspremium;7" width=140 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
<tr>
<td align=center><button value="15 Day [Price 15kk]" action="bypass _bbspremium;15" width=140 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td align=center><button value="20 Day [Price 20kk]" action="bypass _bbspremium;20" width=140 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td align=center><button value="30 Day [Price 30kk]" action="bypass _bbspremium;30" width=140 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
<tr>
<td height=15></td>
</tr>
</table>
<table align=center border="0">
<tr>
<td>
<center><img src="L2UI.SquareGray" width=500 height=1></center>
</td>
</tr>
<tr>
<td height=10></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<center><img src="L2UI_CH3.herotower_deco" width=256 height=32></center>
</td>
</tr>
<tr>
<td height=150 align="center">
<br>
<font name="hs12" color="CDB67F">Your premium status can be checked
<br1>
by typing following command in chat</font>
<br1>
<font name="hs12" color="00A5FF">.premium</font>
</td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width=555>
<tr>
<td height=10></td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width=555 background="L2UI_CT1.Windows_DF_TooltipBG">
<tr>
<td height=17></td>
</tr>
<tr>
<td align=center><font color=696969>LINEAGE II - COMMUNITY BOARD</font></td>
</tr>
<tr>
<td height=15></td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -118,7 +118,7 @@ public class AdminPremium implements IAdminCommandHandler
}
// TODO: Add check if account exists XD
PremiumManager.getInstance().updatePremiumData(months, accountName);
PremiumManager.getInstance().addPremiumMonths(months, accountName);
admin.sendMessage("Account " + accountName + " will now have premium status until " + new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumEndDate(accountName)) + ".");
}

View File

@@ -19,6 +19,7 @@ package handlers.communityboard;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import com.l2jmobius.Config;
import com.l2jmobius.commons.database.DatabaseFactory;
@@ -29,6 +30,7 @@ import com.l2jmobius.gameserver.data.xml.impl.MultisellData;
import com.l2jmobius.gameserver.data.xml.impl.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.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
@@ -54,6 +56,7 @@ public final class HomeBoard implements IParseBoardHandler
"_bbsmultisell",
"_bbssell",
"_bbsteleport",
"_bbspremium",
"_bbsbuff"
};
@@ -136,6 +139,26 @@ public final class HomeBoard implements IParseBoardHandler
activeChar.getInventory().destroyItemByItemId("CB_Teleport", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_TELEPORT_PRICE, activeChar, activeChar);
activeChar.teleToLocation(x, y, z, 0);
}
else if (command.startsWith("_bbspremium"))
{
if (Config.PREMIUM_SYSTEM_ENABLED && Config.COMMUNITY_PREMIUM_SYSTEM_ENABLED)
{
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) < (premiumDays * Config.COMMUNITY_PREMIUM_PRICE_PER_DAY))
{
activeChar.sendMessage("Not enough currency!");
}
else
{
activeChar.getInventory().destroyItemByItemId("CB_Premium", Config.COMMUNITY_PREMIUM_COIN_ID, premiumDays * Config.COMMUNITY_PREMIUM_PRICE_PER_DAY, activeChar, activeChar);
PremiumManager.getInstance().addPremiumDays(premiumDays, activeChar.getAccountName());
activeChar.sendMessage("Your account will now have premium status until " + new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumEndDate(activeChar.getAccountName())) + ".");
CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/premium/main.html"), activeChar); // TODO: Thank you html.
}
}
}
else if (Config.CUSTOM_CB_ENABLED && Config.COMMUNITYBOARD_ENABLE_BUFFS && command.startsWith("_bbsbuff"))
{
final String fullBypass = command.replace("_bbsbuff;", "");