diff --git a/L2J_Mobius_Underground/dist/game/config/Custom.ini b/L2J_Mobius_Underground/dist/game/config/Custom.ini
index a3113060c0..503f83ba9c 100644
--- a/L2J_Mobius_Underground/dist/game/config/Custom.ini
+++ b/L2J_Mobius_Underground/dist/game/config/Custom.ini
@@ -352,6 +352,41 @@ ShopMinRangeFromNpc = 100
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
# ---------------------------------------------------------------------------
@@ -396,6 +431,18 @@ CommunityKarmaDisabled = True
# Default: 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)
@@ -475,41 +522,6 @@ BalanceOnlinePlayers = True
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
# ---------------------------------------------------------------------------
diff --git a/L2J_Mobius_Underground/dist/game/data/html/CommunityBoard/Custom/home.html b/L2J_Mobius_Underground/dist/game/data/html/CommunityBoard/Custom/home.html
index 1e5d7a6b69..7e0fab8c44 100644
--- a/L2J_Mobius_Underground/dist/game/data/html/CommunityBoard/Custom/home.html
+++ b/L2J_Mobius_Underground/dist/game/data/html/CommunityBoard/Custom/home.html
@@ -24,6 +24,9 @@
|
+
+ |
+
diff --git a/L2J_Mobius_Underground/dist/game/data/html/CommunityBoard/Custom/premium/main.html b/L2J_Mobius_Underground/dist/game/data/html/CommunityBoard/Custom/premium/main.html
new file mode 100644
index 0000000000..84c72ad750
--- /dev/null
+++ b/L2J_Mobius_Underground/dist/game/data/html/CommunityBoard/Custom/premium/main.html
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+
+
+ |
+
+
+ Premium Manager |
+
+
+
+
+ |
+
+
+ |
+
+ 1. Premium benefits CAN NOT BE TRANSFERED. |
+ 2. Premium does not effect party members. |
+ 3. Premium benefits effect ALL characters in same account. |
+
+ |
+
+ |
+ |
+
+ |
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+ |
+ |
+ |
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+ Your premium status can be checked
+
+ by typing following command in chat
+
+ .premium
+ |
+
+
+
+
+
+ |
+
+
+ LINEAGE II - COMMUNITY BOARD |
+
+
+ |
+
+
+
+ |
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminPremium.java b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminPremium.java
index 036c291a2c..e2457ea600 100644
--- a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminPremium.java
+++ b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminPremium.java
@@ -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)) + ".");
}
diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
index fc26273d29..d2e0a1ba5d 100644
--- a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
+++ b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
@@ -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;", "");
diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/Config.java b/L2J_Mobius_Underground/java/com/l2jmobius/Config.java
index f80503a72b..f0bafcaa7c 100644
--- a/L2J_Mobius_Underground/java/com/l2jmobius/Config.java
+++ b/L2J_Mobius_Underground/java/com/l2jmobius/Config.java
@@ -680,6 +680,9 @@ public final class Config
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
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_SP;
public static Map PREMIUM_RATE_DROP_ITEMS_ID;
@@ -2133,6 +2136,9 @@ public final class Config
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = CustomSettings.getInt("BalancePlayerExceedLimit", 20);
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_SP = CustomSettings.getFloat("PremiumRateSp", 2);
PREMIUM_RATE_DROP_CHANCE = CustomSettings.getFloat("PremiumRateDropChance", 2);
diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
index 85572d9345..d283464384 100644
--- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
+++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
@@ -62,7 +62,42 @@ public class PremiumManager
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);
if (remainingTime > 0)
diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/network/serverpackets/ExBrPremiumState.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/network/serverpackets/ExBrPremiumState.java
index d9b66e74e8..d727fd688e 100644
--- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/network/serverpackets/ExBrPremiumState.java
+++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/network/serverpackets/ExBrPremiumState.java
@@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.commons.network.PacketWriter;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.client.OutgoingPackets;
/**
@@ -24,13 +25,11 @@ import com.l2jmobius.gameserver.network.client.OutgoingPackets;
*/
public class ExBrPremiumState implements IClientOutgoingPacket
{
- private final int _objId;
- private final int _state;
+ private final L2PcInstance _activeChar;
- public ExBrPremiumState(int id, int state)
+ public ExBrPremiumState(L2PcInstance activeChar)
{
- _objId = id;
- _state = state;
+ _activeChar = activeChar;
}
@Override
@@ -38,8 +37,8 @@ public class ExBrPremiumState implements IClientOutgoingPacket
{
OutgoingPackets.EX_BR_PREMIUM_STATE.writeId(packet);
- packet.writeD(_objId);
- packet.writeC(_state);
+ packet.writeD(_activeChar.getObjectId());
+ packet.writeC(_activeChar.hasPremiumStatus() ? 0x01 : 0x00);
return true;
}
}