Premium system for the custom community board.
Contributed by gigilo1968.
This commit is contained in:
@@ -352,6 +352,41 @@ ShopMinRangeFromNpc = 100
|
|||||||
FreeJumpsForAll = False
|
FreeJumpsForAll = False
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Premium System (VIP)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# -Admins can manage subscriptions from main admin menu.
|
||||||
|
# -Players can use .premium to view account related info.
|
||||||
|
# -Caution: Premium rates multiply existing server rates.
|
||||||
|
|
||||||
|
# Enable premium system.
|
||||||
|
# Default: False
|
||||||
|
EnablePremiumSystem = False
|
||||||
|
|
||||||
|
# Xp rate for premium players.
|
||||||
|
PremiumRateXp = 2
|
||||||
|
|
||||||
|
# Sp rate for premium players.
|
||||||
|
PremiumRateSp = 2
|
||||||
|
|
||||||
|
# Drop chance for premium players.
|
||||||
|
PremiumRateDropChance = 1
|
||||||
|
|
||||||
|
# Drop amount for premium players.
|
||||||
|
PremiumRateDropAmount = 2
|
||||||
|
|
||||||
|
# Spoil chance for premium players.
|
||||||
|
PremiumRateSpoilChance = 1
|
||||||
|
|
||||||
|
# Spoil amount for premium players.
|
||||||
|
PremiumRateSpoilAmount = 2
|
||||||
|
|
||||||
|
# List of items affected by custom drop rate by id, used now for Adena rate too.
|
||||||
|
# Usage: itemId1,multiplier1;itemId2,multiplier2;...
|
||||||
|
PremiumRateDropChanceByItemId = 57,2;6656,1;6657,1;6658,1;6659,1;6660,1;6661,1;6662,1;8191,1;10170,1;10314,1
|
||||||
|
PremiumRateDropAmountByItemId = 57,2;6656,1;6657,1;6658,1;6659,1;6660,1;6661,1;6662,1;8191,1;10170,1;10314,1
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Custom Community Board
|
# Custom Community Board
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -396,6 +431,18 @@ CommunityKarmaDisabled = True
|
|||||||
# Default: False
|
# Default: False
|
||||||
CommunityCastAnimations = False
|
CommunityCastAnimations = False
|
||||||
|
|
||||||
|
# Enable buying premium from community board.
|
||||||
|
# EnablePremiumSystem must also be set to true.
|
||||||
|
# Default: False
|
||||||
|
CommunityPremiumSystem = False
|
||||||
|
|
||||||
|
# ItemID for buying premium in community board.
|
||||||
|
# Check data/html/CommunityBoard/Custom/premium/main.html
|
||||||
|
CommunityPremiumBuyCoinId = 57
|
||||||
|
|
||||||
|
# Amount of coins needed for each premium day bought.
|
||||||
|
CommunityPremiumPricePerDay = 1000000
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Faction System (Good vs Evil)
|
# Faction System (Good vs Evil)
|
||||||
@@ -475,41 +522,6 @@ BalanceOnlinePlayers = True
|
|||||||
BalancePlayerExceedLimit = 20
|
BalancePlayerExceedLimit = 20
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Premium System (VIP)
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# -Admins can manage subscriptions from main admin menu.
|
|
||||||
# -Players can use .premium to view account related info.
|
|
||||||
# -Caution: Premium rates multiply existing server rates.
|
|
||||||
|
|
||||||
# Enable premium system.
|
|
||||||
# Default: False
|
|
||||||
EnablePremiumSystem = False
|
|
||||||
|
|
||||||
# Xp rate for premium players.
|
|
||||||
PremiumRateXp = 2
|
|
||||||
|
|
||||||
# Sp rate for premium players.
|
|
||||||
PremiumRateSp = 2
|
|
||||||
|
|
||||||
# Drop chance for premium players.
|
|
||||||
PremiumRateDropChance = 1
|
|
||||||
|
|
||||||
# Drop amount for premium players.
|
|
||||||
PremiumRateDropAmount = 2
|
|
||||||
|
|
||||||
# Spoil chance for premium players.
|
|
||||||
PremiumRateSpoilChance = 1
|
|
||||||
|
|
||||||
# Spoil amount for premium players.
|
|
||||||
PremiumRateSpoilAmount = 2
|
|
||||||
|
|
||||||
# List of items affected by custom drop rate by id, used now for Adena rate too.
|
|
||||||
# Usage: itemId1,multiplier1;itemId2,multiplier2;...
|
|
||||||
PremiumRateDropChanceByItemId = 57,2;6656,1;6657,1;6658,1;6659,1;6660,1;6661,1;6662,1;8191,1;10170,1;10314,1
|
|
||||||
PremiumRateDropAmountByItemId = 57,2;6656,1;6657,1;6658,1;6659,1;6660,1;6661,1;6662,1;8191,1;10170,1;10314,1
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# PC Cafe (PC Bang) System
|
# PC Cafe (PC Bang) System
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
@@ -24,6 +24,9 @@
|
|||||||
<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>
|
<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>
|
||||||
|
<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>
|
</center>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
136
L2J_Mobius_Underground/dist/game/data/html/CommunityBoard/Custom/premium/main.html
vendored
Normal file
136
L2J_Mobius_Underground/dist/game/data/html/CommunityBoard/Custom/premium/main.html
vendored
Normal 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"> 1. Premium benefits CAN NOT BE TRANSFERED.<br1></font></td></tr>
|
||||||
|
<tr><td align="left"> <font color="CDB67F"> 2. Premium does not effect party members.<br1></font></td></tr>
|
||||||
|
<tr><td align="left"> <font color="CDB67F"> 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>
|
@@ -118,7 +118,7 @@ public class AdminPremium implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add check if account exists XD
|
// 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)) + ".");
|
admin.sendMessage("Account " + accountName + " will now have premium status until " + new SimpleDateFormat("dd.MM.yyyy HH:mm").format(PremiumManager.getInstance().getPremiumEndDate(accountName)) + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@ package handlers.communityboard;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
import com.l2jmobius.Config;
|
import com.l2jmobius.Config;
|
||||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
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.data.xml.impl.SkillData;
|
||||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||||
import com.l2jmobius.gameserver.handler.IParseBoardHandler;
|
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.L2Summon;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||||
@@ -54,6 +56,7 @@ public final class HomeBoard implements IParseBoardHandler
|
|||||||
"_bbsmultisell",
|
"_bbsmultisell",
|
||||||
"_bbssell",
|
"_bbssell",
|
||||||
"_bbsteleport",
|
"_bbsteleport",
|
||||||
|
"_bbspremium",
|
||||||
"_bbsbuff"
|
"_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.getInventory().destroyItemByItemId("CB_Teleport", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_TELEPORT_PRICE, activeChar, activeChar);
|
||||||
activeChar.teleToLocation(x, y, z, 0);
|
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"))
|
else if (Config.CUSTOM_CB_ENABLED && Config.COMMUNITYBOARD_ENABLE_BUFFS && command.startsWith("_bbsbuff"))
|
||||||
{
|
{
|
||||||
final String fullBypass = command.replace("_bbsbuff;", "");
|
final String fullBypass = command.replace("_bbsbuff;", "");
|
||||||
|
@@ -680,6 +680,9 @@ public final class Config
|
|||||||
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
||||||
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
||||||
public static boolean PREMIUM_SYSTEM_ENABLED;
|
public static boolean PREMIUM_SYSTEM_ENABLED;
|
||||||
|
public static boolean COMMUNITY_PREMIUM_SYSTEM_ENABLED;
|
||||||
|
public static int COMMUNITY_PREMIUM_COIN_ID;
|
||||||
|
public static int COMMUNITY_PREMIUM_PRICE_PER_DAY;
|
||||||
public static float PREMIUM_RATE_XP;
|
public static float PREMIUM_RATE_XP;
|
||||||
public static float PREMIUM_RATE_SP;
|
public static float PREMIUM_RATE_SP;
|
||||||
public static Map<Integer, Float> PREMIUM_RATE_DROP_ITEMS_ID;
|
public static Map<Integer, Float> PREMIUM_RATE_DROP_ITEMS_ID;
|
||||||
@@ -2133,6 +2136,9 @@ public final class Config
|
|||||||
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = CustomSettings.getInt("BalancePlayerExceedLimit", 20);
|
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = CustomSettings.getInt("BalancePlayerExceedLimit", 20);
|
||||||
|
|
||||||
PREMIUM_SYSTEM_ENABLED = CustomSettings.getBoolean("EnablePremiumSystem", false);
|
PREMIUM_SYSTEM_ENABLED = CustomSettings.getBoolean("EnablePremiumSystem", false);
|
||||||
|
COMMUNITY_PREMIUM_SYSTEM_ENABLED = CustomSettings.getBoolean("CommunityPremiumSystem", false);
|
||||||
|
COMMUNITY_PREMIUM_COIN_ID = CustomSettings.getInt("CommunityPremiumBuyCoinId", 57);
|
||||||
|
COMMUNITY_PREMIUM_PRICE_PER_DAY = CustomSettings.getInt("CommunityPremiumPricePerDay", 1000000);
|
||||||
PREMIUM_RATE_XP = CustomSettings.getFloat("PremiumRateXp", 2);
|
PREMIUM_RATE_XP = CustomSettings.getFloat("PremiumRateXp", 2);
|
||||||
PREMIUM_RATE_SP = CustomSettings.getFloat("PremiumRateSp", 2);
|
PREMIUM_RATE_SP = CustomSettings.getFloat("PremiumRateSp", 2);
|
||||||
PREMIUM_RATE_DROP_CHANCE = CustomSettings.getFloat("PremiumRateDropChance", 2);
|
PREMIUM_RATE_DROP_CHANCE = CustomSettings.getFloat("PremiumRateDropChance", 2);
|
||||||
|
@@ -62,7 +62,42 @@ public class PremiumManager
|
|||||||
return endDate;
|
return endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePremiumData(int months, String accountName)
|
public void addPremiumDays(int days, String accountName)
|
||||||
|
{
|
||||||
|
long remainingTime = getPremiumEndDate(accountName);
|
||||||
|
if (remainingTime > 0)
|
||||||
|
{
|
||||||
|
remainingTime -= System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||||
|
{
|
||||||
|
final Calendar endDate = Calendar.getInstance();
|
||||||
|
endDate.setTimeInMillis(System.currentTimeMillis() + remainingTime);
|
||||||
|
endDate.set(Calendar.SECOND, 0);
|
||||||
|
endDate.add(Calendar.HOUR, 24 * days);
|
||||||
|
|
||||||
|
final PreparedStatement statement = con.prepareStatement("UPDATE account_premium SET premium_service=?,enddate=? WHERE account_name=?");
|
||||||
|
statement.setInt(1, 1);
|
||||||
|
statement.setLong(2, endDate.getTimeInMillis());
|
||||||
|
statement.setString(3, accountName);
|
||||||
|
statement.execute();
|
||||||
|
statement.close();
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
||||||
|
{
|
||||||
|
if (player.getAccountNamePlayer().equalsIgnoreCase(accountName))
|
||||||
|
{
|
||||||
|
player.setPremiumStatus(getPremiumEndDate(accountName) > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPremiumMonths(int months, String accountName)
|
||||||
{
|
{
|
||||||
long remainingTime = getPremiumEndDate(accountName);
|
long remainingTime = getPremiumEndDate(accountName);
|
||||||
if (remainingTime > 0)
|
if (remainingTime > 0)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package com.l2jmobius.gameserver.network.serverpackets;
|
package com.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import com.l2jmobius.commons.network.PacketWriter;
|
import com.l2jmobius.commons.network.PacketWriter;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.network.client.OutgoingPackets;
|
import com.l2jmobius.gameserver.network.client.OutgoingPackets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,13 +25,11 @@ import com.l2jmobius.gameserver.network.client.OutgoingPackets;
|
|||||||
*/
|
*/
|
||||||
public class ExBrPremiumState implements IClientOutgoingPacket
|
public class ExBrPremiumState implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int _objId;
|
private final L2PcInstance _activeChar;
|
||||||
private final int _state;
|
|
||||||
|
|
||||||
public ExBrPremiumState(int id, int state)
|
public ExBrPremiumState(L2PcInstance activeChar)
|
||||||
{
|
{
|
||||||
_objId = id;
|
_activeChar = activeChar;
|
||||||
_state = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -38,8 +37,8 @@ public class ExBrPremiumState implements IClientOutgoingPacket
|
|||||||
{
|
{
|
||||||
OutgoingPackets.EX_BR_PREMIUM_STATE.writeId(packet);
|
OutgoingPackets.EX_BR_PREMIUM_STATE.writeId(packet);
|
||||||
|
|
||||||
packet.writeD(_objId);
|
packet.writeD(_activeChar.getObjectId());
|
||||||
packet.writeC(_state);
|
packet.writeC(_activeChar.hasPremiumStatus() ? 0x01 : 0x00);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user