From 2bbc5125a7948466b7b3c2339894488f23086b94 Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Mon, 2 May 2022 21:30:52 +0000
Subject: [PATCH] Addition of PC Cafe (PC Bang) system.
---
.../dist/db_installer/sql/game/characters.sql | 1 +
.../dist/game/config/AdminCommands.xml | 3 +
.../dist/game/config/Custom/PcCafe.ini | 42 ++++
.../dist/game/data/html/admin/main_menu.htm | 1 +
.../dist/game/data/html/admin/pccafe.htm | 60 ++++++
.../data/scripts/handlers/MasterHandler.java | 2 +
.../AdminPcCafePoints.java | 204 ++++++++++++++++++
.../java/org/l2jmobius/Config.java | 42 ++++
.../org/l2jmobius/gameserver/GameServer.java | 2 +
.../gameserver/data/xml/MultisellData.java | 24 ++-
.../instancemanager/PcCafePointsManager.java | 92 ++++++++
.../org/l2jmobius/gameserver/model/Party.java | 2 +
.../gameserver/model/actor/Attackable.java | 2 +
.../gameserver/model/actor/Player.java | 24 ++-
.../model/events/AbstractScript.java | 2 +
.../dist/db_installer/sql/game/characters.sql | 1 +
.../dist/game/config/AdminCommands.xml | 3 +
.../dist/game/config/Custom/PcCafe.ini | 42 ++++
.../dist/game/data/html/admin/main_menu.htm | 1 +
.../dist/game/data/html/admin/pccafe.htm | 60 ++++++
.../data/scripts/handlers/MasterHandler.java | 2 +
.../AdminPcCafePoints.java | 204 ++++++++++++++++++
.../java/org/l2jmobius/Config.java | 42 ++++
.../org/l2jmobius/gameserver/GameServer.java | 2 +
.../gameserver/data/xml/MultisellData.java | 25 ++-
.../instancemanager/PcCafePointsManager.java | 98 +++++++++
.../org/l2jmobius/gameserver/model/Party.java | 2 +
.../gameserver/model/actor/Attackable.java | 2 +
.../gameserver/model/actor/Player.java | 24 ++-
.../model/events/AbstractScript.java | 2 +
.../dist/db_installer/sql/game/characters.sql | 1 +
.../dist/game/config/AdminCommands.xml | 3 +
.../dist/game/config/Custom/PcCafe.ini | 42 ++++
.../dist/game/data/html/admin/main_menu.htm | 1 +
.../dist/game/data/html/admin/pccafe.htm | 60 ++++++
.../data/scripts/handlers/MasterHandler.java | 2 +
.../AdminPcCafePoints.java | 204 ++++++++++++++++++
.../java/org/l2jmobius/Config.java | 42 ++++
.../org/l2jmobius/gameserver/GameServer.java | 2 +
.../gameserver/data/xml/MultisellData.java | 25 ++-
.../instancemanager/PcCafePointsManager.java | 98 +++++++++
.../org/l2jmobius/gameserver/model/Party.java | 2 +
.../gameserver/model/actor/Attackable.java | 2 +
.../gameserver/model/actor/Player.java | 18 +-
.../model/events/AbstractScript.java | 2 +
45 files changed, 1502 insertions(+), 15 deletions(-)
create mode 100644 L2J_Mobius_CT_0_Interlude/dist/game/config/Custom/PcCafe.ini
create mode 100644 L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/pccafe.htm
create mode 100644 L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java
create mode 100644 L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java
create mode 100644 L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/PcCafe.ini
create mode 100644 L2J_Mobius_CT_2.4_Epilogue/dist/game/data/html/admin/pccafe.htm
create mode 100644 L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java
create mode 100644 L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java
create mode 100644 L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/PcCafe.ini
create mode 100644 L2J_Mobius_CT_2.6_HighFive/dist/game/data/html/admin/pccafe.htm
create mode 100644 L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java
create mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java
diff --git a/L2J_Mobius_CT_0_Interlude/dist/db_installer/sql/game/characters.sql b/L2J_Mobius_CT_0_Interlude/dist/db_installer/sql/game/characters.sql
index 6627ea59a6..57b7796bc9 100644
--- a/L2J_Mobius_CT_0_Interlude/dist/db_installer/sql/game/characters.sql
+++ b/L2J_Mobius_CT_0_Interlude/dist/db_installer/sql/game/characters.sql
@@ -56,6 +56,7 @@ CREATE TABLE IF NOT EXISTS `characters` (
`createDate` date NOT NULL DEFAULT '2015-01-01',
`language` VARCHAR(2) DEFAULT NULL,
`faction` TINYINT UNSIGNED NOT NULL DEFAULT '0',
+ `pccafe_points` int(6) NOT NULL DEFAULT '0',
`last_recom_date` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`rec_have` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`rec_left` TINYINT UNSIGNED NOT NULL DEFAULT 0,
diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/config/AdminCommands.xml b/L2J_Mobius_CT_0_Interlude/dist/game/config/AdminCommands.xml
index b7bb5908e2..795ad3e6fb 100644
--- a/L2J_Mobius_CT_0_Interlude/dist/game/config/AdminCommands.xml
+++ b/L2J_Mobius_CT_0_Interlude/dist/game/config/AdminCommands.xml
@@ -358,6 +358,9 @@
+
+
+
diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/config/Custom/PcCafe.ini b/L2J_Mobius_CT_0_Interlude/dist/game/config/Custom/PcCafe.ini
new file mode 100644
index 0000000000..6dbccdc44a
--- /dev/null
+++ b/L2J_Mobius_CT_0_Interlude/dist/game/config/Custom/PcCafe.ini
@@ -0,0 +1,42 @@
+# ---------------------------------------------------------------------------
+# PC Cafe (PC Bang) System
+# ---------------------------------------------------------------------------
+# PC CAFE POINTS ID = -100
+
+# PC Cafe Enabled.
+PcCafeEnabled = False
+
+# Allow only players with a Premium account.
+PcCafeOnlyPremium = False
+
+# Max points that player may have.
+# Limited by int limit.
+MaxPcCafePoints = 200000
+
+# PC Bang point rate.
+# Acquisition formula equals (exp * 0.0001 * AcquisitionPointsRate)
+# e.g. with 1.0 it's 10000 exp = 1 PC Bang point
+# 2.0 - 10000 exp = 2 PC Bang points
+# 0.5 - 5000 exp = 1 PC Bang point
+AcquisitionPointsRate = 1.0
+
+# Use random points rewarding.
+# If enabled points will be random from points/2 to points.
+AcquisitionPointsRandom = False
+
+# Creates a chance to aquire double points.
+DoublingAcquisitionPoints = True
+
+# Double points chance.
+# Used when DoublingAcquisitionPoints is enabled.
+# Default 1 (%)
+DoublingAcquisitionPointsChance = 1
+
+# Reward low exp kills
+# Acquire points if player gains exp and aquire formula equals 0.
+RewardLowExpKills = True
+
+# Chance for low exp kills
+# Used when RewardLowExpKills is enabled.
+# Default 50 (%)
+RewardLowExpKillsChance = 50
diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/main_menu.htm b/L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/main_menu.htm
index 778d09cec3..d38256ac9a 100644
--- a/L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/main_menu.htm
+++ b/L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/main_menu.htm
@@ -28,6 +28,7 @@
|
|
+ |
|
diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/pccafe.htm b/L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/pccafe.htm
new file mode 100644
index 0000000000..62c42ad792
--- /dev/null
+++ b/L2J_Mobius_CT_0_Interlude/dist/game/data/html/admin/pccafe.htm
@@ -0,0 +1,60 @@
+Admin PC Points Manager
+
+
+
+ |
+Admin PC Points Manager |
+ |
+
+
+
+Target info
+
+
+ Player Name: |
+ %targetName% |
+
+
+ Player Points: |
+ %points% |
+
+
+
+ Target Operations
+
+
+ Operation |
+ |
+
+
+ Value |
+ |
+
+
+
+
+ Reward More players
+
+
+ Range |
+ |
+
+
+ Value |
+ |
+
+
+
+
+
|
+
+
+ Note: If you leave 'Range' empty or set 0,it will reward all online players. |
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/MasterHandler.java
index 38ce330aeb..1ad2d39da7 100644
--- a/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/MasterHandler.java
+++ b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/MasterHandler.java
@@ -100,6 +100,7 @@ import handlers.admincommandhandlers.AdminMobGroup;
import handlers.admincommandhandlers.AdminOnline;
import handlers.admincommandhandlers.AdminPForge;
import handlers.admincommandhandlers.AdminPathNode;
+import handlers.admincommandhandlers.AdminPcCafePoints;
import handlers.admincommandhandlers.AdminPcCondOverride;
import handlers.admincommandhandlers.AdminPetition;
import handlers.admincommandhandlers.AdminPledge;
@@ -377,6 +378,7 @@ public class MasterHandler
AdminMobGroup.class,
AdminOnline.class,
AdminPathNode.class,
+ AdminPcCafePoints.class,
AdminPetition.class,
AdminPForge.class,
AdminPledge.class,
diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java
new file mode 100644
index 0000000000..8968b11abf
--- /dev/null
+++ b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java
@@ -0,0 +1,204 @@
+/*
+ * 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 .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.Collection;
+import java.util.StringTokenizer;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.cache.HtmCache;
+import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
+import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
+import org.l2jmobius.gameserver.util.BuilderUtil;
+import org.l2jmobius.gameserver.util.Util;
+
+/**
+ * Admin PC Points manage admin commands.
+ */
+public class AdminPcCafePoints implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_pccafepoints",
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, Player activeChar)
+ {
+ final StringTokenizer st = new StringTokenizer(command, " ");
+ final String actualCommand = st.nextToken();
+ if (actualCommand.equals("admin_pccafepoints"))
+ {
+ if (st.hasMoreTokens())
+ {
+ final String action = st.nextToken();
+ final Player target = getTarget(activeChar);
+ if ((target == null) || !st.hasMoreTokens())
+ {
+ return false;
+ }
+
+ int value = 0;
+ try
+ {
+ value = Integer.parseInt(st.nextToken());
+ }
+ catch (Exception e)
+ {
+ showMenuHtml(activeChar);
+ BuilderUtil.sendSysMessage(activeChar, "Invalid Value!");
+ return false;
+ }
+
+ switch (action)
+ {
+ case "set":
+ {
+ if (value > Config.PC_CAFE_MAX_POINTS)
+ {
+ showMenuHtml(activeChar);
+ BuilderUtil.sendSysMessage(activeChar, "You cannot set more than " + Config.PC_CAFE_MAX_POINTS + " PC points!");
+ return false;
+ }
+ if (value < 0)
+ {
+ value = 0;
+ }
+
+ target.setPcCafePoints(value);
+ target.sendMessage("Admin set your PC Cafe point(s) to " + value + "!");
+ BuilderUtil.sendSysMessage(activeChar, "You set " + value + " PC Cafe point(s) to player " + target.getName());
+ target.sendPacket(new ExPCCafePointInfo(value, value, 0));
+ break;
+ }
+ case "increase":
+ {
+ if (target.getPcCafePoints() == Config.PC_CAFE_MAX_POINTS)
+ {
+ showMenuHtml(activeChar);
+ activeChar.sendMessage(target.getName() + " already have max count of PC points!");
+ return false;
+ }
+
+ int pcCafeCount = Math.min(target.getPcCafePoints() + value, Config.PC_CAFE_MAX_POINTS);
+ if (pcCafeCount < 0)
+ {
+ pcCafeCount = Config.PC_CAFE_MAX_POINTS;
+ }
+ target.setPcCafePoints(pcCafeCount);
+ target.sendMessage("Admin increased your PC Cafe point(s) by " + value + "!");
+ BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of " + target.getName() + " by " + value);
+ target.sendPacket(new ExPCCafePointInfo(pcCafeCount, value, 0));
+ break;
+ }
+ case "decrease":
+ {
+ if (target.getPcCafePoints() == 0)
+ {
+ showMenuHtml(activeChar);
+ activeChar.sendMessage(target.getName() + " already have min count of PC points!");
+ return false;
+ }
+
+ final int pcCafeCount = Math.max(target.getPcCafePoints() - value, 0);
+ target.setPcCafePoints(pcCafeCount);
+ target.sendMessage("Admin decreased your PC Cafe point(s) by " + value + "!");
+ BuilderUtil.sendSysMessage(activeChar, "You decreased PC Cafe point(s) of " + target.getName() + " by " + value);
+ target.sendPacket(new ExPCCafePointInfo(target.getPcCafePoints(), -value, 0));
+ break;
+ }
+ case "rewardOnline":
+ {
+ int range = 0;
+ try
+ {
+ range = Integer.parseInt(st.nextToken());
+ }
+ catch (Exception e)
+ {
+ }
+
+ if (range <= 0)
+ {
+ final int count = increaseForAll(World.getInstance().getPlayers(), value);
+ BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all online players (" + count + ") by " + value + ".");
+ }
+ else if (range > 0)
+ {
+ final int count = increaseForAll(World.getInstance().getVisibleObjectsInRange(activeChar, Player.class, range), value);
+ BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
+ }
+ break;
+ }
+ }
+ }
+ showMenuHtml(activeChar);
+ }
+ return true;
+ }
+
+ private int increaseForAll(Collection playerList, int value)
+ {
+ int counter = 0;
+ for (Player temp : playerList)
+ {
+ if ((temp != null) && (temp.isOnlineInt() == 1))
+ {
+ if (temp.getPcCafePoints() == Integer.MAX_VALUE)
+ {
+ continue;
+ }
+
+ int pcCafeCount = Math.min(temp.getPcCafePoints() + value, Integer.MAX_VALUE);
+ if (pcCafeCount < 0)
+ {
+ pcCafeCount = Integer.MAX_VALUE;
+ }
+ temp.setPcCafePoints(pcCafeCount);
+ temp.sendMessage("Admin increased your PC Cafe point(s) by " + value + "!");
+ temp.sendPacket(new ExPCCafePointInfo(pcCafeCount, value, 0));
+ counter++;
+ }
+ }
+ return counter;
+ }
+
+ private Player getTarget(Player activeChar)
+ {
+ return ((activeChar.getTarget() != null) && (activeChar.getTarget().getActingPlayer() != null)) ? activeChar.getTarget().getActingPlayer() : activeChar;
+ }
+
+ private void showMenuHtml(Player activeChar)
+ {
+ final NpcHtmlMessage html = new NpcHtmlMessage(0, 1);
+ final Player target = getTarget(activeChar);
+ final int points = target.getPcCafePoints();
+ html.setHtml(HtmCache.getInstance().getHtm(activeChar, "data/html/admin/pccafe.htm"));
+ html.replace("%points%", Util.formatAdena(points));
+ html.replace("%targetName%", target.getName());
+ activeChar.sendPacket(html);
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java
index e4fd2477a3..faf7d89695 100644
--- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java
@@ -126,6 +126,7 @@ public class Config
private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini";
private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini";
+ private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini";
private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini";
private static final String CUSTOM_PRIVATE_STORE_RANGE_CONFIG_FILE = "./config/Custom/PrivateStoreRange.ini";
private static final String CUSTOM_PVP_ANNOUNCE_CONFIG_FILE = "./config/Custom/PvpAnnounce.ini";
@@ -1266,6 +1267,15 @@ public class Config
public static float PREMIUM_RATE_SPOIL_AMOUNT;
public static Map PREMIUM_RATE_DROP_CHANCE_BY_ID;
public static Map PREMIUM_RATE_DROP_AMOUNT_BY_ID;
+ public static boolean PC_CAFE_ENABLED;
+ public static boolean PC_CAFE_ONLY_PREMIUM;
+ public static int PC_CAFE_MAX_POINTS;
+ public static boolean PC_CAFE_ENABLE_DOUBLE_POINTS;
+ public static int PC_CAFE_DOUBLE_POINTS_CHANCE;
+ public static double PC_CAFE_POINT_RATE;
+ public static boolean PC_CAFE_RANDOM_POINT;
+ public static boolean PC_CAFE_REWARD_LOW_EXP_KILLS;
+ public static int PC_CAFE_LOW_EXP_KILLS_CHANCE;
public static boolean SELLBUFF_ENABLED;
public static int SELLBUFF_MP_MULTIPLER;
public static int SELLBUFF_PAYMENT_ID;
@@ -2774,6 +2784,38 @@ public class Config
final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE);
ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false);
+ // Load PcCafe config file (if exists)
+ final PropertiesParser pcCafeConfig = new PropertiesParser(CUSTOM_PC_CAFE_CONFIG_FILE);
+ PC_CAFE_ENABLED = pcCafeConfig.getBoolean("PcCafeEnabled", false);
+ PC_CAFE_ONLY_PREMIUM = pcCafeConfig.getBoolean("PcCafeOnlyPremium", false);
+ PC_CAFE_MAX_POINTS = pcCafeConfig.getInt("MaxPcCafePoints", 200000);
+ if (PC_CAFE_MAX_POINTS < 0)
+ {
+ PC_CAFE_MAX_POINTS = 0;
+ }
+ PC_CAFE_ENABLE_DOUBLE_POINTS = pcCafeConfig.getBoolean("DoublingAcquisitionPoints", false);
+ PC_CAFE_DOUBLE_POINTS_CHANCE = pcCafeConfig.getInt("DoublingAcquisitionPointsChance", 1);
+ if ((PC_CAFE_DOUBLE_POINTS_CHANCE < 0) || (PC_CAFE_DOUBLE_POINTS_CHANCE > 100))
+ {
+ PC_CAFE_DOUBLE_POINTS_CHANCE = 1;
+ }
+ PC_CAFE_POINT_RATE = pcCafeConfig.getDouble("AcquisitionPointsRate", 1.0);
+ PC_CAFE_RANDOM_POINT = pcCafeConfig.getBoolean("AcquisitionPointsRandom", false);
+ if (PC_CAFE_POINT_RATE < 0)
+ {
+ PC_CAFE_POINT_RATE = 1;
+ }
+ PC_CAFE_REWARD_LOW_EXP_KILLS = pcCafeConfig.getBoolean("RewardLowExpKills", true);
+ PC_CAFE_LOW_EXP_KILLS_CHANCE = pcCafeConfig.getInt("RewardLowExpKillsChance", 50);
+ if (PC_CAFE_LOW_EXP_KILLS_CHANCE < 0)
+ {
+ PC_CAFE_LOW_EXP_KILLS_CHANCE = 0;
+ }
+ if (PC_CAFE_LOW_EXP_KILLS_CHANCE > 100)
+ {
+ PC_CAFE_LOW_EXP_KILLS_CHANCE = 100;
+ }
+
// Load PremiumSystem config file (if exists)
final PropertiesParser premiumSystemConfig = new PropertiesParser(CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE);
PREMIUM_SYSTEM_ENABLED = premiumSystemConfig.getBoolean("EnablePremiumSystem", false);
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/GameServer.java
index a5ae687e11..332d7e0236 100644
--- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/GameServer.java
@@ -109,6 +109,7 @@ import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.instancemanager.MercTicketManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.PetitionManager;
import org.l2jmobius.gameserver.instancemanager.PrecautionaryRestartManager;
import org.l2jmobius.gameserver.instancemanager.PremiumManager;
@@ -245,6 +246,7 @@ public class GameServer
FishingMonstersData.getInstance();
FishingRodsData.getInstance();
HennaData.getInstance();
+ PcCafePointsManager.getInstance();
printSection("Characters");
ClassListData.getInstance();
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java
index 12ba8d32fa..f544294cec 100644
--- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java
@@ -39,6 +39,7 @@ import org.l2jmobius.gameserver.model.multisell.Ingredient;
import org.l2jmobius.gameserver.model.multisell.ListContainer;
import org.l2jmobius.gameserver.model.multisell.PreparedListContainer;
import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
import org.l2jmobius.gameserver.network.serverpackets.MultiSellList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
@@ -49,7 +50,7 @@ public class MultisellData implements IXmlReader
public static final int PAGE_SIZE = 40;
// Special IDs.
- public static final int PC_BANG_POINTS = -100;
+ public static final int PC_CAFE_POINTS = -100;
public static final int CLAN_REPUTATION = -200;
public static final int FAME = -300;
// Misc
@@ -278,6 +279,15 @@ public class MultisellData implements IXmlReader
{
switch (id)
{
+ case PC_CAFE_POINTS:
+ {
+ if (player.getPcCafePoints() < amount)
+ {
+ player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_SHORT_OF_ACCUMULATED_POINTS));
+ break;
+ }
+ return true;
+ }
case CLAN_REPUTATION:
{
if (player.getClan() == null)
@@ -314,6 +324,12 @@ public class MultisellData implements IXmlReader
{
switch (id)
{
+ case PC_CAFE_POINTS:
+ {
+ player.setPcCafePoints((player.getPcCafePoints() - (int) amount));
+ player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), (int) -amount, 0));
+ break;
+ }
case CLAN_REPUTATION:
{
player.getClan().takeReputationScore((int) amount);
@@ -337,6 +353,12 @@ public class MultisellData implements IXmlReader
{
switch (id)
{
+ case PC_CAFE_POINTS:
+ {
+ player.setPcCafePoints((int) (player.getPcCafePoints() + amount));
+ player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), (int) amount, 0));
+ break;
+ }
case CLAN_REPUTATION:
{
player.getClan().addReputationScore((int) amount);
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java
new file mode 100644
index 0000000000..e6b4361746
--- /dev/null
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java
@@ -0,0 +1,92 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.instancemanager;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.commons.util.Rnd;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
+
+public class PcCafePointsManager
+{
+ public void givePcCafePoint(Player player, double exp)
+ {
+ if (!Config.PC_CAFE_ENABLED || player.isInsideZone(ZoneId.PEACE) || player.isInsideZone(ZoneId.PVP) || player.isInsideZone(ZoneId.SIEGE) || (player.isOnlineInt() == 0) || player.isJailed())
+ {
+ return;
+ }
+
+ // PC-points only premium accounts
+ if (Config.PC_CAFE_ONLY_PREMIUM && !player.hasPremiumStatus())
+ {
+ return;
+ }
+
+ if (player.getPcCafePoints() >= Config.PC_CAFE_MAX_POINTS)
+ {
+ player.sendMessage("The maximum accumulation allowed of PC cafe points has been exceeded. You can no longer acquire PC cafe points.");
+ return;
+ }
+
+ int points = (int) (exp * 0.0001 * Config.PC_CAFE_POINT_RATE);
+ if (Config.PC_CAFE_RANDOM_POINT)
+ {
+ points = Rnd.get(points / 2, points);
+ }
+
+ if ((points == 0) && (exp > 0) && Config.PC_CAFE_REWARD_LOW_EXP_KILLS && (Rnd.get(100) < Config.PC_CAFE_LOW_EXP_KILLS_CHANCE))
+ {
+ points = 1; // minimum points
+ }
+
+ if (points <= 0)
+ {
+ return;
+ }
+
+ if (Config.PC_CAFE_ENABLE_DOUBLE_POINTS && (Rnd.get(100) < Config.PC_CAFE_DOUBLE_POINTS_CHANCE))
+ {
+ points *= 2;
+ player.sendMessage("Double points! You acquired " + points + " PC Bang Point.");
+ }
+ else
+ {
+ player.sendMessage("You have acquired " + points + " PC Cafe points.");
+ }
+ if ((player.getPcCafePoints() + points) > Config.PC_CAFE_MAX_POINTS)
+ {
+ points = Config.PC_CAFE_MAX_POINTS - player.getPcCafePoints();
+ }
+ player.setPcCafePoints(player.getPcCafePoints() + points);
+ player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), points, 0));
+ }
+
+ /**
+ * Gets the single instance of {@code PcCafePointsManager}.
+ * @return single instance of {@code PcCafePointsManager}
+ */
+ public static PcCafePointsManager getInstance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final PcCafePointsManager INSTANCE = new PcCafePointsManager();
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/Party.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/Party.java
index 77ae796bab..6e210a69d5 100644
--- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/Party.java
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/Party.java
@@ -32,6 +32,7 @@ import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.PartyMessageType;
import org.l2jmobius.gameserver.instancemanager.DuelManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
@@ -743,6 +744,7 @@ public class Party extends AbstractPlayerGroup
if (addexp > 0)
{
member.updateVitalityPoints(vitalityPoints, true, false);
+ PcCafePointsManager.getInstance().givePcCafePoint(member, addexp);
}
}
else
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Attackable.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Attackable.java
index 12c4f792d0..4cec789d4a 100644
--- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Attackable.java
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Attackable.java
@@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.model.AbsorberInfo;
import org.l2jmobius.gameserver.model.AggroInfo;
@@ -548,6 +549,7 @@ public class Attackable extends Npc
if ((addexp > 0) && useVitalityRate())
{
attacker.updateVitalityPoints(getVitalityPoints(damage), true, false);
+ PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
}
}
}
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java
index 992093d5ec..b85da91248 100644
--- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java
@@ -331,7 +331,7 @@ public class Player extends Playable
// Character Character SQL String Definitions:
private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,title_color,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,createDate,last_recom_date) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=?,faction=?,last_recom_date=?,rec_have=?,rec_left=? WHERE charId=?";
+ private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=?,faction=?,pccafe_points=?,last_recom_date=?,rec_have=?,rec_left=? WHERE charId=?";
private static final String RESTORE_CHARACTER = "SELECT * FROM characters WHERE charId=?";
// Character Subclass SQL String Definitions:
@@ -367,6 +367,8 @@ public class Player extends Playable
public static final int REQUEST_TIMEOUT = 15;
+ private int _pcCafePoints = 0;
+
private final Collection _eventListeners = ConcurrentHashMap.newKeySet();
private GameClient _client;
@@ -6565,6 +6567,7 @@ public class Player extends Playable
player.setClanCreateExpiryTime(0);
}
+ player.setPcCafePoints(rset.getInt("pccafe_points"));
player.setPowerGrade(rset.getInt("power_grade"));
player.setPledgeType(rset.getInt("subpledge"));
// player.setApprentice(rs.getInt("apprentice"));
@@ -7051,10 +7054,11 @@ public class Player extends Playable
factionId = 2;
}
ps.setInt(50, factionId);
- ps.setLong(51, getLastRecomUpdate());
- ps.setInt(52, getRecomHave());
- ps.setInt(53, getRecomLeft());
- ps.setInt(54, getObjectId());
+ ps.setInt(51, _pcCafePoints);
+ ps.setLong(52, getLastRecomUpdate());
+ ps.setInt(53, getRecomHave());
+ ps.setInt(54, getRecomLeft());
+ ps.setInt(55, getObjectId());
ps.execute();
}
catch (Exception e)
@@ -12578,6 +12582,16 @@ public class Player extends Playable
_offlineShopStart = time;
}
+ public int getPcCafePoints()
+ {
+ return _pcCafePoints;
+ }
+
+ public void setPcCafePoints(int count)
+ {
+ _pcCafePoints = count < Config.PC_CAFE_MAX_POINTS ? count : Config.PC_CAFE_MAX_POINTS;
+ }
+
/**
* Remove player from BossZones (used on char logout/exit)
*/
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/events/AbstractScript.java
index c97ce7c5a1..e73216eee0 100644
--- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/events/AbstractScript.java
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/events/AbstractScript.java
@@ -38,6 +38,7 @@ import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
@@ -2581,6 +2582,7 @@ public abstract class AbstractScript extends ManagedScript
public static void addExpAndSp(Player player, long exp, int sp)
{
player.addExpAndSp((long) player.calcStat(Stat.EXPSP_RATE, exp * Config.RATE_QUEST_REWARD_XP, null, null), (int) player.calcStat(Stat.EXPSP_RATE, sp * Config.RATE_QUEST_REWARD_SP, null, null));
+ PcCafePointsManager.getInstance().givePcCafePoint(player, (long) (exp * Config.RATE_QUEST_REWARD_XP));
}
/**
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/db_installer/sql/game/characters.sql b/L2J_Mobius_CT_2.4_Epilogue/dist/db_installer/sql/game/characters.sql
index 6627ea59a6..57b7796bc9 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/dist/db_installer/sql/game/characters.sql
+++ b/L2J_Mobius_CT_2.4_Epilogue/dist/db_installer/sql/game/characters.sql
@@ -56,6 +56,7 @@ CREATE TABLE IF NOT EXISTS `characters` (
`createDate` date NOT NULL DEFAULT '2015-01-01',
`language` VARCHAR(2) DEFAULT NULL,
`faction` TINYINT UNSIGNED NOT NULL DEFAULT '0',
+ `pccafe_points` int(6) NOT NULL DEFAULT '0',
`last_recom_date` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`rec_have` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`rec_left` TINYINT UNSIGNED NOT NULL DEFAULT 0,
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/AdminCommands.xml b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/AdminCommands.xml
index 56d9d3e280..1467b49308 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/AdminCommands.xml
+++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/AdminCommands.xml
@@ -404,6 +404,9 @@
+
+
+
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/PcCafe.ini b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/PcCafe.ini
new file mode 100644
index 0000000000..6dbccdc44a
--- /dev/null
+++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/PcCafe.ini
@@ -0,0 +1,42 @@
+# ---------------------------------------------------------------------------
+# PC Cafe (PC Bang) System
+# ---------------------------------------------------------------------------
+# PC CAFE POINTS ID = -100
+
+# PC Cafe Enabled.
+PcCafeEnabled = False
+
+# Allow only players with a Premium account.
+PcCafeOnlyPremium = False
+
+# Max points that player may have.
+# Limited by int limit.
+MaxPcCafePoints = 200000
+
+# PC Bang point rate.
+# Acquisition formula equals (exp * 0.0001 * AcquisitionPointsRate)
+# e.g. with 1.0 it's 10000 exp = 1 PC Bang point
+# 2.0 - 10000 exp = 2 PC Bang points
+# 0.5 - 5000 exp = 1 PC Bang point
+AcquisitionPointsRate = 1.0
+
+# Use random points rewarding.
+# If enabled points will be random from points/2 to points.
+AcquisitionPointsRandom = False
+
+# Creates a chance to aquire double points.
+DoublingAcquisitionPoints = True
+
+# Double points chance.
+# Used when DoublingAcquisitionPoints is enabled.
+# Default 1 (%)
+DoublingAcquisitionPointsChance = 1
+
+# Reward low exp kills
+# Acquire points if player gains exp and aquire formula equals 0.
+RewardLowExpKills = True
+
+# Chance for low exp kills
+# Used when RewardLowExpKills is enabled.
+# Default 50 (%)
+RewardLowExpKillsChance = 50
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/html/admin/main_menu.htm b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/html/admin/main_menu.htm
index 618b7d600e..963a9ff865 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/html/admin/main_menu.htm
+++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/html/admin/main_menu.htm
@@ -28,6 +28,7 @@
|
|
+ |
|
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/html/admin/pccafe.htm b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/html/admin/pccafe.htm
new file mode 100644
index 0000000000..0119592ab9
--- /dev/null
+++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/html/admin/pccafe.htm
@@ -0,0 +1,60 @@
+Admin PC Points Manager
+
+
+
+ |
+Admin PC Points Manager |
+ |
+
+
+
+Target info
+
+
+ Player Name: |
+ %targetName% |
+
+
+ Player Points: |
+ %points% |
+
+
+
+ Target Operations
+
+
+ Operation |
+ |
+
+
+ Value |
+ |
+
+
+
+
+ Reward More players
+
+
+ Range |
+ |
+
+
+ Value |
+ |
+
+
+
+
+
|
+
+
+ Note: If you leave 'Range' empty or set 0,it will reward all online players. |
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/MasterHandler.java
index 7020c3b62f..6f823eb744 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/MasterHandler.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/MasterHandler.java
@@ -103,6 +103,7 @@ import handlers.admincommandhandlers.AdminMobGroup;
import handlers.admincommandhandlers.AdminOnline;
import handlers.admincommandhandlers.AdminPForge;
import handlers.admincommandhandlers.AdminPathNode;
+import handlers.admincommandhandlers.AdminPcCafePoints;
import handlers.admincommandhandlers.AdminPcCondOverride;
import handlers.admincommandhandlers.AdminPetition;
import handlers.admincommandhandlers.AdminPledge;
@@ -397,6 +398,7 @@ public class MasterHandler
AdminMobGroup.class,
AdminOnline.class,
AdminPathNode.class,
+ AdminPcCafePoints.class,
AdminPetition.class,
AdminPForge.class,
AdminPledge.class,
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java
new file mode 100644
index 0000000000..8968b11abf
--- /dev/null
+++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java
@@ -0,0 +1,204 @@
+/*
+ * 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 .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.Collection;
+import java.util.StringTokenizer;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.cache.HtmCache;
+import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
+import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
+import org.l2jmobius.gameserver.util.BuilderUtil;
+import org.l2jmobius.gameserver.util.Util;
+
+/**
+ * Admin PC Points manage admin commands.
+ */
+public class AdminPcCafePoints implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_pccafepoints",
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, Player activeChar)
+ {
+ final StringTokenizer st = new StringTokenizer(command, " ");
+ final String actualCommand = st.nextToken();
+ if (actualCommand.equals("admin_pccafepoints"))
+ {
+ if (st.hasMoreTokens())
+ {
+ final String action = st.nextToken();
+ final Player target = getTarget(activeChar);
+ if ((target == null) || !st.hasMoreTokens())
+ {
+ return false;
+ }
+
+ int value = 0;
+ try
+ {
+ value = Integer.parseInt(st.nextToken());
+ }
+ catch (Exception e)
+ {
+ showMenuHtml(activeChar);
+ BuilderUtil.sendSysMessage(activeChar, "Invalid Value!");
+ return false;
+ }
+
+ switch (action)
+ {
+ case "set":
+ {
+ if (value > Config.PC_CAFE_MAX_POINTS)
+ {
+ showMenuHtml(activeChar);
+ BuilderUtil.sendSysMessage(activeChar, "You cannot set more than " + Config.PC_CAFE_MAX_POINTS + " PC points!");
+ return false;
+ }
+ if (value < 0)
+ {
+ value = 0;
+ }
+
+ target.setPcCafePoints(value);
+ target.sendMessage("Admin set your PC Cafe point(s) to " + value + "!");
+ BuilderUtil.sendSysMessage(activeChar, "You set " + value + " PC Cafe point(s) to player " + target.getName());
+ target.sendPacket(new ExPCCafePointInfo(value, value, 0));
+ break;
+ }
+ case "increase":
+ {
+ if (target.getPcCafePoints() == Config.PC_CAFE_MAX_POINTS)
+ {
+ showMenuHtml(activeChar);
+ activeChar.sendMessage(target.getName() + " already have max count of PC points!");
+ return false;
+ }
+
+ int pcCafeCount = Math.min(target.getPcCafePoints() + value, Config.PC_CAFE_MAX_POINTS);
+ if (pcCafeCount < 0)
+ {
+ pcCafeCount = Config.PC_CAFE_MAX_POINTS;
+ }
+ target.setPcCafePoints(pcCafeCount);
+ target.sendMessage("Admin increased your PC Cafe point(s) by " + value + "!");
+ BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of " + target.getName() + " by " + value);
+ target.sendPacket(new ExPCCafePointInfo(pcCafeCount, value, 0));
+ break;
+ }
+ case "decrease":
+ {
+ if (target.getPcCafePoints() == 0)
+ {
+ showMenuHtml(activeChar);
+ activeChar.sendMessage(target.getName() + " already have min count of PC points!");
+ return false;
+ }
+
+ final int pcCafeCount = Math.max(target.getPcCafePoints() - value, 0);
+ target.setPcCafePoints(pcCafeCount);
+ target.sendMessage("Admin decreased your PC Cafe point(s) by " + value + "!");
+ BuilderUtil.sendSysMessage(activeChar, "You decreased PC Cafe point(s) of " + target.getName() + " by " + value);
+ target.sendPacket(new ExPCCafePointInfo(target.getPcCafePoints(), -value, 0));
+ break;
+ }
+ case "rewardOnline":
+ {
+ int range = 0;
+ try
+ {
+ range = Integer.parseInt(st.nextToken());
+ }
+ catch (Exception e)
+ {
+ }
+
+ if (range <= 0)
+ {
+ final int count = increaseForAll(World.getInstance().getPlayers(), value);
+ BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all online players (" + count + ") by " + value + ".");
+ }
+ else if (range > 0)
+ {
+ final int count = increaseForAll(World.getInstance().getVisibleObjectsInRange(activeChar, Player.class, range), value);
+ BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
+ }
+ break;
+ }
+ }
+ }
+ showMenuHtml(activeChar);
+ }
+ return true;
+ }
+
+ private int increaseForAll(Collection playerList, int value)
+ {
+ int counter = 0;
+ for (Player temp : playerList)
+ {
+ if ((temp != null) && (temp.isOnlineInt() == 1))
+ {
+ if (temp.getPcCafePoints() == Integer.MAX_VALUE)
+ {
+ continue;
+ }
+
+ int pcCafeCount = Math.min(temp.getPcCafePoints() + value, Integer.MAX_VALUE);
+ if (pcCafeCount < 0)
+ {
+ pcCafeCount = Integer.MAX_VALUE;
+ }
+ temp.setPcCafePoints(pcCafeCount);
+ temp.sendMessage("Admin increased your PC Cafe point(s) by " + value + "!");
+ temp.sendPacket(new ExPCCafePointInfo(pcCafeCount, value, 0));
+ counter++;
+ }
+ }
+ return counter;
+ }
+
+ private Player getTarget(Player activeChar)
+ {
+ return ((activeChar.getTarget() != null) && (activeChar.getTarget().getActingPlayer() != null)) ? activeChar.getTarget().getActingPlayer() : activeChar;
+ }
+
+ private void showMenuHtml(Player activeChar)
+ {
+ final NpcHtmlMessage html = new NpcHtmlMessage(0, 1);
+ final Player target = getTarget(activeChar);
+ final int points = target.getPcCafePoints();
+ html.setHtml(HtmCache.getInstance().getHtm(activeChar, "data/html/admin/pccafe.htm"));
+ html.replace("%points%", Util.formatAdena(points));
+ html.replace("%targetName%", target.getName());
+ activeChar.sendPacket(html);
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java
index e559564d1a..31be01b8cd 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java
@@ -130,6 +130,7 @@ public class Config
private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini";
private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini";
+ private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini";
private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini";
private static final String CUSTOM_PRIVATE_STORE_RANGE_CONFIG_FILE = "./config/Custom/PrivateStoreRange.ini";
private static final String CUSTOM_PVP_ANNOUNCE_CONFIG_FILE = "./config/Custom/PvpAnnounce.ini";
@@ -1315,6 +1316,15 @@ public class Config
public static float PREMIUM_RATE_SPOIL_AMOUNT;
public static Map PREMIUM_RATE_DROP_CHANCE_BY_ID;
public static Map PREMIUM_RATE_DROP_AMOUNT_BY_ID;
+ public static boolean PC_CAFE_ENABLED;
+ public static boolean PC_CAFE_ONLY_PREMIUM;
+ public static int PC_CAFE_MAX_POINTS;
+ public static boolean PC_CAFE_ENABLE_DOUBLE_POINTS;
+ public static int PC_CAFE_DOUBLE_POINTS_CHANCE;
+ public static double PC_CAFE_POINT_RATE;
+ public static boolean PC_CAFE_RANDOM_POINT;
+ public static boolean PC_CAFE_REWARD_LOW_EXP_KILLS;
+ public static int PC_CAFE_LOW_EXP_KILLS_CHANCE;
public static boolean SELLBUFF_ENABLED;
public static int SELLBUFF_MP_MULTIPLER;
public static int SELLBUFF_PAYMENT_ID;
@@ -2875,6 +2885,38 @@ public class Config
final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE);
ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false);
+ // Load PcCafe config file (if exists)
+ final PropertiesParser pcCafeConfig = new PropertiesParser(CUSTOM_PC_CAFE_CONFIG_FILE);
+ PC_CAFE_ENABLED = pcCafeConfig.getBoolean("PcCafeEnabled", false);
+ PC_CAFE_ONLY_PREMIUM = pcCafeConfig.getBoolean("PcCafeOnlyPremium", false);
+ PC_CAFE_MAX_POINTS = pcCafeConfig.getInt("MaxPcCafePoints", 200000);
+ if (PC_CAFE_MAX_POINTS < 0)
+ {
+ PC_CAFE_MAX_POINTS = 0;
+ }
+ PC_CAFE_ENABLE_DOUBLE_POINTS = pcCafeConfig.getBoolean("DoublingAcquisitionPoints", false);
+ PC_CAFE_DOUBLE_POINTS_CHANCE = pcCafeConfig.getInt("DoublingAcquisitionPointsChance", 1);
+ if ((PC_CAFE_DOUBLE_POINTS_CHANCE < 0) || (PC_CAFE_DOUBLE_POINTS_CHANCE > 100))
+ {
+ PC_CAFE_DOUBLE_POINTS_CHANCE = 1;
+ }
+ PC_CAFE_POINT_RATE = pcCafeConfig.getDouble("AcquisitionPointsRate", 1.0);
+ PC_CAFE_RANDOM_POINT = pcCafeConfig.getBoolean("AcquisitionPointsRandom", false);
+ if (PC_CAFE_POINT_RATE < 0)
+ {
+ PC_CAFE_POINT_RATE = 1;
+ }
+ PC_CAFE_REWARD_LOW_EXP_KILLS = pcCafeConfig.getBoolean("RewardLowExpKills", true);
+ PC_CAFE_LOW_EXP_KILLS_CHANCE = pcCafeConfig.getInt("RewardLowExpKillsChance", 50);
+ if (PC_CAFE_LOW_EXP_KILLS_CHANCE < 0)
+ {
+ PC_CAFE_LOW_EXP_KILLS_CHANCE = 0;
+ }
+ if (PC_CAFE_LOW_EXP_KILLS_CHANCE > 100)
+ {
+ PC_CAFE_LOW_EXP_KILLS_CHANCE = 100;
+ }
+
// Load PremiumSystem config file (if exists)
final PropertiesParser premiumSystemConfig = new PropertiesParser(CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE);
PREMIUM_SYSTEM_ENABLED = premiumSystemConfig.getBoolean("EnablePremiumSystem", false);
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/GameServer.java
index 48d926937f..4d8f23d340 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/GameServer.java
@@ -119,6 +119,7 @@ import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.instancemanager.MercTicketManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.PetitionManager;
import org.l2jmobius.gameserver.instancemanager.PrecautionaryRestartManager;
import org.l2jmobius.gameserver.instancemanager.PremiumManager;
@@ -260,6 +261,7 @@ public class GameServer
FishingRodsData.getInstance();
HennaData.getInstance();
PrimeShopData.getInstance();
+ PcCafePointsManager.getInstance();
printSection("Characters");
ClassListData.getInstance();
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/MultisellData.java
index e0f39b009b..ef231016b6 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/MultisellData.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/MultisellData.java
@@ -40,6 +40,7 @@ import org.l2jmobius.gameserver.model.multisell.ListContainer;
import org.l2jmobius.gameserver.model.multisell.PreparedListContainer;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExBrExtraUserInfo;
+import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
import org.l2jmobius.gameserver.network.serverpackets.MultiSellList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
@@ -50,7 +51,7 @@ public class MultisellData implements IXmlReader
public static final int PAGE_SIZE = 40;
// Special IDs.
- public static final int PC_BANG_POINTS = -100;
+ public static final int PC_CAFE_POINTS = -100;
public static final int CLAN_REPUTATION = -200;
public static final int FAME = -300;
// Misc
@@ -279,6 +280,15 @@ public class MultisellData implements IXmlReader
{
switch (id)
{
+ case PC_CAFE_POINTS:
+ {
+ if (player.getPcCafePoints() < amount)
+ {
+ player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_SHORT_OF_ACCUMULATED_POINTS));
+ break;
+ }
+ return true;
+ }
case CLAN_REPUTATION:
{
if (player.getClan() == null)
@@ -315,6 +325,12 @@ public class MultisellData implements IXmlReader
{
switch (id)
{
+ case PC_CAFE_POINTS:
+ {
+ player.setPcCafePoints((player.getPcCafePoints() - (int) amount));
+ player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), (int) -amount, 0));
+ break;
+ }
case CLAN_REPUTATION:
{
player.getClan().takeReputationScore((int) amount);
@@ -338,6 +354,12 @@ public class MultisellData implements IXmlReader
{
switch (id)
{
+ case PC_CAFE_POINTS:
+ {
+ player.setPcCafePoints((int) (player.getPcCafePoints() + amount));
+ player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), (int) amount, 0));
+ break;
+ }
case CLAN_REPUTATION:
{
player.getClan().addReputationScore((int) amount);
@@ -384,6 +406,7 @@ public class MultisellData implements IXmlReader
{
switch (ing.getItemId())
{
+ case PC_CAFE_POINTS:
case CLAN_REPUTATION:
case FAME:
{
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java
new file mode 100644
index 0000000000..21c9fb9a56
--- /dev/null
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java
@@ -0,0 +1,98 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.instancemanager;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.commons.util.Rnd;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
+import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
+
+public class PcCafePointsManager
+{
+ public void givePcCafePoint(Player player, double exp)
+ {
+ if (!Config.PC_CAFE_ENABLED || player.isInsideZone(ZoneId.PEACE) || player.isInsideZone(ZoneId.PVP) || player.isInsideZone(ZoneId.SIEGE) || (player.isOnlineInt() == 0) || player.isJailed())
+ {
+ return;
+ }
+
+ // PC-points only premium accounts
+ if (Config.PC_CAFE_ONLY_PREMIUM && !player.hasPremiumStatus())
+ {
+ return;
+ }
+
+ if (player.getPcCafePoints() >= Config.PC_CAFE_MAX_POINTS)
+ {
+ final SystemMessage message = new SystemMessage(SystemMessageId.THE_MAXIMUM_ACCUMULATION_ALLOWED_OF_PC_CAFE_POINTS_HAS_BEEN_EXCEEDED_YOU_CAN_NO_LONGER_ACQUIRE_PC_CAFE_POINTS);
+ player.sendPacket(message);
+ return;
+ }
+
+ int points = (int) (exp * 0.0001 * Config.PC_CAFE_POINT_RATE);
+ if (Config.PC_CAFE_RANDOM_POINT)
+ {
+ points = Rnd.get(points / 2, points);
+ }
+
+ if ((points == 0) && (exp > 0) && Config.PC_CAFE_REWARD_LOW_EXP_KILLS && (Rnd.get(100) < Config.PC_CAFE_LOW_EXP_KILLS_CHANCE))
+ {
+ points = 1; // minimum points
+ }
+
+ if (points <= 0)
+ {
+ return;
+ }
+
+ SystemMessage message = null;
+ if (Config.PC_CAFE_ENABLE_DOUBLE_POINTS && (Rnd.get(100) < Config.PC_CAFE_DOUBLE_POINTS_CHANCE))
+ {
+ points *= 2;
+ message = new SystemMessage(SystemMessageId.DOUBLE_POINTS_YOU_ACQUIRED_S1_PC_BANG_POINT);
+ }
+ else
+ {
+ message = new SystemMessage(SystemMessageId.YOU_HAVE_ACQUIRED_S1_PC_CAFE_POINTS);
+ }
+ if ((player.getPcCafePoints() + points) > Config.PC_CAFE_MAX_POINTS)
+ {
+ points = Config.PC_CAFE_MAX_POINTS - player.getPcCafePoints();
+ }
+ message.addLong(points);
+ player.sendPacket(message);
+ player.setPcCafePoints(player.getPcCafePoints() + points);
+ player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), points, 0));
+ }
+
+ /**
+ * Gets the single instance of {@code PcCafePointsManager}.
+ * @return single instance of {@code PcCafePointsManager}
+ */
+ public static PcCafePointsManager getInstance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final PcCafePointsManager INSTANCE = new PcCafePointsManager();
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/Party.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/Party.java
index db50406312..2ac59999da 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/Party.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/Party.java
@@ -32,6 +32,7 @@ import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.PartyMessageType;
import org.l2jmobius.gameserver.instancemanager.DuelManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
@@ -745,6 +746,7 @@ public class Party extends AbstractPlayerGroup
if (addexp > 0)
{
member.updateVitalityPoints(vitalityPoints, true, false);
+ PcCafePointsManager.getInstance().givePcCafePoint(member, addexp);
}
}
else
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Attackable.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Attackable.java
index dd35f37ad8..f9c162561e 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Attackable.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Attackable.java
@@ -42,6 +42,7 @@ import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.model.AbsorberInfo;
import org.l2jmobius.gameserver.model.AggroInfo;
@@ -549,6 +550,7 @@ public class Attackable extends Npc
if ((addexp > 0) && useVitalityRate())
{
attacker.updateVitalityPoints(getVitalityPoints(damage), true, false);
+ PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
}
}
}
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Player.java
index 2386a50d24..f36bfc29b5 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Player.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Player.java
@@ -359,7 +359,7 @@ public class Player extends Playable
// Character Character SQL String Definitions:
private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,title_color,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,createDate,last_recom_date) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=?,faction=?,last_recom_date=?,rec_have=?,rec_left=? WHERE charId=?";
+ private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=?,faction=?,pccafe_points=?,last_recom_date=?,rec_have=?,rec_left=? WHERE charId=?";
private static final String RESTORE_CHARACTER = "SELECT * FROM characters WHERE charId=?";
// Character Teleport Bookmark:
@@ -401,6 +401,8 @@ public class Player extends Playable
public static final int REQUEST_TIMEOUT = 15;
+ private int _pcCafePoints = 0;
+
private final Collection _eventListeners = ConcurrentHashMap.newKeySet();
private GameClient _client;
@@ -6947,6 +6949,7 @@ public class Player extends Playable
player.setClanCreateExpiryTime(0);
}
+ player.setPcCafePoints(rset.getInt("pccafe_points"));
player.setPowerGrade(rset.getInt("power_grade"));
player.setPledgeType(rset.getInt("subpledge"));
// player.setApprentice(rs.getInt("apprentice"));
@@ -7508,10 +7511,11 @@ public class Player extends Playable
factionId = 2;
}
ps.setInt(50, factionId);
- ps.setLong(51, getLastRecomUpdate());
- ps.setInt(52, getRecomHave());
- ps.setInt(53, getRecomLeft());
- ps.setInt(54, getObjectId());
+ ps.setInt(51, _pcCafePoints);
+ ps.setLong(52, getLastRecomUpdate());
+ ps.setInt(53, getRecomHave());
+ ps.setInt(54, getRecomLeft());
+ ps.setInt(55, getObjectId());
ps.execute();
}
catch (Exception e)
@@ -13676,6 +13680,16 @@ public class Player extends Playable
_offlineShopStart = time;
}
+ public int getPcCafePoints()
+ {
+ return _pcCafePoints;
+ }
+
+ public void setPcCafePoints(int count)
+ {
+ _pcCafePoints = count < Config.PC_CAFE_MAX_POINTS ? count : Config.PC_CAFE_MAX_POINTS;
+ }
+
/**
* Remove player from BossZones (used on char logout/exit)
*/
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/AbstractScript.java
index 55773ae0ad..15313b2e78 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/AbstractScript.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/AbstractScript.java
@@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.MailManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Message;
@@ -2673,6 +2674,7 @@ public abstract class AbstractScript extends ManagedScript
public static void addExpAndSp(Player player, long exp, int sp)
{
player.addExpAndSp((long) player.calcStat(Stat.EXPSP_RATE, exp * Config.RATE_QUEST_REWARD_XP, null, null), (int) player.calcStat(Stat.EXPSP_RATE, sp * Config.RATE_QUEST_REWARD_SP, null, null));
+ PcCafePointsManager.getInstance().givePcCafePoint(player, (long) (exp * Config.RATE_QUEST_REWARD_XP));
}
/**
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/db_installer/sql/game/characters.sql b/L2J_Mobius_CT_2.6_HighFive/dist/db_installer/sql/game/characters.sql
index f3ab08c497..958756242d 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/db_installer/sql/game/characters.sql
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/db_installer/sql/game/characters.sql
@@ -56,6 +56,7 @@ CREATE TABLE IF NOT EXISTS `characters` (
`createDate` date NOT NULL DEFAULT '2015-01-01',
`language` VARCHAR(2) DEFAULT NULL,
`faction` TINYINT UNSIGNED NOT NULL DEFAULT '0',
+ `pccafe_points` int(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`charId`),
KEY `account_name` (`account_name`),
KEY `char_name` (`char_name`),
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/AdminCommands.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/AdminCommands.xml
index 56d9d3e280..1467b49308 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/AdminCommands.xml
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/AdminCommands.xml
@@ -404,6 +404,9 @@
+
+
+
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/PcCafe.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/PcCafe.ini
new file mode 100644
index 0000000000..6dbccdc44a
--- /dev/null
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/PcCafe.ini
@@ -0,0 +1,42 @@
+# ---------------------------------------------------------------------------
+# PC Cafe (PC Bang) System
+# ---------------------------------------------------------------------------
+# PC CAFE POINTS ID = -100
+
+# PC Cafe Enabled.
+PcCafeEnabled = False
+
+# Allow only players with a Premium account.
+PcCafeOnlyPremium = False
+
+# Max points that player may have.
+# Limited by int limit.
+MaxPcCafePoints = 200000
+
+# PC Bang point rate.
+# Acquisition formula equals (exp * 0.0001 * AcquisitionPointsRate)
+# e.g. with 1.0 it's 10000 exp = 1 PC Bang point
+# 2.0 - 10000 exp = 2 PC Bang points
+# 0.5 - 5000 exp = 1 PC Bang point
+AcquisitionPointsRate = 1.0
+
+# Use random points rewarding.
+# If enabled points will be random from points/2 to points.
+AcquisitionPointsRandom = False
+
+# Creates a chance to aquire double points.
+DoublingAcquisitionPoints = True
+
+# Double points chance.
+# Used when DoublingAcquisitionPoints is enabled.
+# Default 1 (%)
+DoublingAcquisitionPointsChance = 1
+
+# Reward low exp kills
+# Acquire points if player gains exp and aquire formula equals 0.
+RewardLowExpKills = True
+
+# Chance for low exp kills
+# Used when RewardLowExpKills is enabled.
+# Default 50 (%)
+RewardLowExpKillsChance = 50
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/html/admin/main_menu.htm b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/html/admin/main_menu.htm
index 618b7d600e..963a9ff865 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/html/admin/main_menu.htm
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/html/admin/main_menu.htm
@@ -28,6 +28,7 @@
|
|
+ |
|
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/html/admin/pccafe.htm b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/html/admin/pccafe.htm
new file mode 100644
index 0000000000..0119592ab9
--- /dev/null
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/html/admin/pccafe.htm
@@ -0,0 +1,60 @@
+Admin PC Points Manager
+
+
+
+ |
+Admin PC Points Manager |
+ |
+
+
+
+Target info
+
+
+ Player Name: |
+ %targetName% |
+
+
+ Player Points: |
+ %points% |
+
+
+
+ Target Operations
+
+
+ Operation |
+ |
+
+
+ Value |
+ |
+
+
+
+
+ Reward More players
+
+
+ Range |
+ |
+
+
+ Value |
+ |
+
+
+
+
+
|
+
+
+ Note: If you leave 'Range' empty or set 0,it will reward all online players. |
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/MasterHandler.java
index 8b53970985..4c0dd50ccf 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/MasterHandler.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/MasterHandler.java
@@ -103,6 +103,7 @@ import handlers.admincommandhandlers.AdminMobGroup;
import handlers.admincommandhandlers.AdminOnline;
import handlers.admincommandhandlers.AdminPForge;
import handlers.admincommandhandlers.AdminPathNode;
+import handlers.admincommandhandlers.AdminPcCafePoints;
import handlers.admincommandhandlers.AdminPcCondOverride;
import handlers.admincommandhandlers.AdminPetition;
import handlers.admincommandhandlers.AdminPledge;
@@ -398,6 +399,7 @@ public class MasterHandler
AdminMobGroup.class,
AdminOnline.class,
AdminPathNode.class,
+ AdminPcCafePoints.class,
AdminPetition.class,
AdminPForge.class,
AdminPledge.class,
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java
new file mode 100644
index 0000000000..8968b11abf
--- /dev/null
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminPcCafePoints.java
@@ -0,0 +1,204 @@
+/*
+ * 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 .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.Collection;
+import java.util.StringTokenizer;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.cache.HtmCache;
+import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
+import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
+import org.l2jmobius.gameserver.util.BuilderUtil;
+import org.l2jmobius.gameserver.util.Util;
+
+/**
+ * Admin PC Points manage admin commands.
+ */
+public class AdminPcCafePoints implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_pccafepoints",
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, Player activeChar)
+ {
+ final StringTokenizer st = new StringTokenizer(command, " ");
+ final String actualCommand = st.nextToken();
+ if (actualCommand.equals("admin_pccafepoints"))
+ {
+ if (st.hasMoreTokens())
+ {
+ final String action = st.nextToken();
+ final Player target = getTarget(activeChar);
+ if ((target == null) || !st.hasMoreTokens())
+ {
+ return false;
+ }
+
+ int value = 0;
+ try
+ {
+ value = Integer.parseInt(st.nextToken());
+ }
+ catch (Exception e)
+ {
+ showMenuHtml(activeChar);
+ BuilderUtil.sendSysMessage(activeChar, "Invalid Value!");
+ return false;
+ }
+
+ switch (action)
+ {
+ case "set":
+ {
+ if (value > Config.PC_CAFE_MAX_POINTS)
+ {
+ showMenuHtml(activeChar);
+ BuilderUtil.sendSysMessage(activeChar, "You cannot set more than " + Config.PC_CAFE_MAX_POINTS + " PC points!");
+ return false;
+ }
+ if (value < 0)
+ {
+ value = 0;
+ }
+
+ target.setPcCafePoints(value);
+ target.sendMessage("Admin set your PC Cafe point(s) to " + value + "!");
+ BuilderUtil.sendSysMessage(activeChar, "You set " + value + " PC Cafe point(s) to player " + target.getName());
+ target.sendPacket(new ExPCCafePointInfo(value, value, 0));
+ break;
+ }
+ case "increase":
+ {
+ if (target.getPcCafePoints() == Config.PC_CAFE_MAX_POINTS)
+ {
+ showMenuHtml(activeChar);
+ activeChar.sendMessage(target.getName() + " already have max count of PC points!");
+ return false;
+ }
+
+ int pcCafeCount = Math.min(target.getPcCafePoints() + value, Config.PC_CAFE_MAX_POINTS);
+ if (pcCafeCount < 0)
+ {
+ pcCafeCount = Config.PC_CAFE_MAX_POINTS;
+ }
+ target.setPcCafePoints(pcCafeCount);
+ target.sendMessage("Admin increased your PC Cafe point(s) by " + value + "!");
+ BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of " + target.getName() + " by " + value);
+ target.sendPacket(new ExPCCafePointInfo(pcCafeCount, value, 0));
+ break;
+ }
+ case "decrease":
+ {
+ if (target.getPcCafePoints() == 0)
+ {
+ showMenuHtml(activeChar);
+ activeChar.sendMessage(target.getName() + " already have min count of PC points!");
+ return false;
+ }
+
+ final int pcCafeCount = Math.max(target.getPcCafePoints() - value, 0);
+ target.setPcCafePoints(pcCafeCount);
+ target.sendMessage("Admin decreased your PC Cafe point(s) by " + value + "!");
+ BuilderUtil.sendSysMessage(activeChar, "You decreased PC Cafe point(s) of " + target.getName() + " by " + value);
+ target.sendPacket(new ExPCCafePointInfo(target.getPcCafePoints(), -value, 0));
+ break;
+ }
+ case "rewardOnline":
+ {
+ int range = 0;
+ try
+ {
+ range = Integer.parseInt(st.nextToken());
+ }
+ catch (Exception e)
+ {
+ }
+
+ if (range <= 0)
+ {
+ final int count = increaseForAll(World.getInstance().getPlayers(), value);
+ BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all online players (" + count + ") by " + value + ".");
+ }
+ else if (range > 0)
+ {
+ final int count = increaseForAll(World.getInstance().getVisibleObjectsInRange(activeChar, Player.class, range), value);
+ BuilderUtil.sendSysMessage(activeChar, "You increased PC Cafe point(s) of all players (" + count + ") in range " + range + " by " + value + ".");
+ }
+ break;
+ }
+ }
+ }
+ showMenuHtml(activeChar);
+ }
+ return true;
+ }
+
+ private int increaseForAll(Collection playerList, int value)
+ {
+ int counter = 0;
+ for (Player temp : playerList)
+ {
+ if ((temp != null) && (temp.isOnlineInt() == 1))
+ {
+ if (temp.getPcCafePoints() == Integer.MAX_VALUE)
+ {
+ continue;
+ }
+
+ int pcCafeCount = Math.min(temp.getPcCafePoints() + value, Integer.MAX_VALUE);
+ if (pcCafeCount < 0)
+ {
+ pcCafeCount = Integer.MAX_VALUE;
+ }
+ temp.setPcCafePoints(pcCafeCount);
+ temp.sendMessage("Admin increased your PC Cafe point(s) by " + value + "!");
+ temp.sendPacket(new ExPCCafePointInfo(pcCafeCount, value, 0));
+ counter++;
+ }
+ }
+ return counter;
+ }
+
+ private Player getTarget(Player activeChar)
+ {
+ return ((activeChar.getTarget() != null) && (activeChar.getTarget().getActingPlayer() != null)) ? activeChar.getTarget().getActingPlayer() : activeChar;
+ }
+
+ private void showMenuHtml(Player activeChar)
+ {
+ final NpcHtmlMessage html = new NpcHtmlMessage(0, 1);
+ final Player target = getTarget(activeChar);
+ final int points = target.getPcCafePoints();
+ html.setHtml(HtmCache.getInstance().getHtm(activeChar, "data/html/admin/pccafe.htm"));
+ html.replace("%points%", Util.formatAdena(points));
+ html.replace("%targetName%", target.getName());
+ activeChar.sendPacket(html);
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
index e0db25ee3b..c75c33e696 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java
@@ -130,6 +130,7 @@ public class Config
private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini";
private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini";
+ private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini";
private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini";
private static final String CUSTOM_PRIVATE_STORE_RANGE_CONFIG_FILE = "./config/Custom/PrivateStoreRange.ini";
private static final String CUSTOM_PVP_ANNOUNCE_CONFIG_FILE = "./config/Custom/PvpAnnounce.ini";
@@ -1315,6 +1316,15 @@ public class Config
public static float PREMIUM_RATE_SPOIL_AMOUNT;
public static Map PREMIUM_RATE_DROP_CHANCE_BY_ID;
public static Map PREMIUM_RATE_DROP_AMOUNT_BY_ID;
+ public static boolean PC_CAFE_ENABLED;
+ public static boolean PC_CAFE_ONLY_PREMIUM;
+ public static int PC_CAFE_MAX_POINTS;
+ public static boolean PC_CAFE_ENABLE_DOUBLE_POINTS;
+ public static int PC_CAFE_DOUBLE_POINTS_CHANCE;
+ public static double PC_CAFE_POINT_RATE;
+ public static boolean PC_CAFE_RANDOM_POINT;
+ public static boolean PC_CAFE_REWARD_LOW_EXP_KILLS;
+ public static int PC_CAFE_LOW_EXP_KILLS_CHANCE;
public static boolean SELLBUFF_ENABLED;
public static int SELLBUFF_MP_MULTIPLER;
public static int SELLBUFF_PAYMENT_ID;
@@ -2882,6 +2892,38 @@ public class Config
final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE);
ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false);
+ // Load PcCafe config file (if exists)
+ final PropertiesParser pcCafeConfig = new PropertiesParser(CUSTOM_PC_CAFE_CONFIG_FILE);
+ PC_CAFE_ENABLED = pcCafeConfig.getBoolean("PcCafeEnabled", false);
+ PC_CAFE_ONLY_PREMIUM = pcCafeConfig.getBoolean("PcCafeOnlyPremium", false);
+ PC_CAFE_MAX_POINTS = pcCafeConfig.getInt("MaxPcCafePoints", 200000);
+ if (PC_CAFE_MAX_POINTS < 0)
+ {
+ PC_CAFE_MAX_POINTS = 0;
+ }
+ PC_CAFE_ENABLE_DOUBLE_POINTS = pcCafeConfig.getBoolean("DoublingAcquisitionPoints", false);
+ PC_CAFE_DOUBLE_POINTS_CHANCE = pcCafeConfig.getInt("DoublingAcquisitionPointsChance", 1);
+ if ((PC_CAFE_DOUBLE_POINTS_CHANCE < 0) || (PC_CAFE_DOUBLE_POINTS_CHANCE > 100))
+ {
+ PC_CAFE_DOUBLE_POINTS_CHANCE = 1;
+ }
+ PC_CAFE_POINT_RATE = pcCafeConfig.getDouble("AcquisitionPointsRate", 1.0);
+ PC_CAFE_RANDOM_POINT = pcCafeConfig.getBoolean("AcquisitionPointsRandom", false);
+ if (PC_CAFE_POINT_RATE < 0)
+ {
+ PC_CAFE_POINT_RATE = 1;
+ }
+ PC_CAFE_REWARD_LOW_EXP_KILLS = pcCafeConfig.getBoolean("RewardLowExpKills", true);
+ PC_CAFE_LOW_EXP_KILLS_CHANCE = pcCafeConfig.getInt("RewardLowExpKillsChance", 50);
+ if (PC_CAFE_LOW_EXP_KILLS_CHANCE < 0)
+ {
+ PC_CAFE_LOW_EXP_KILLS_CHANCE = 0;
+ }
+ if (PC_CAFE_LOW_EXP_KILLS_CHANCE > 100)
+ {
+ PC_CAFE_LOW_EXP_KILLS_CHANCE = 100;
+ }
+
// Load PremiumSystem config file (if exists)
final PropertiesParser premiumSystemConfig = new PropertiesParser(CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE);
PREMIUM_SYSTEM_ENABLED = premiumSystemConfig.getBoolean("EnablePremiumSystem", false);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/GameServer.java
index fe2f356906..7619f34a5c 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/GameServer.java
@@ -120,6 +120,7 @@ import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.instancemanager.MercTicketManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.PetitionManager;
import org.l2jmobius.gameserver.instancemanager.PrecautionaryRestartManager;
import org.l2jmobius.gameserver.instancemanager.PremiumManager;
@@ -262,6 +263,7 @@ public class GameServer
FishingRodsData.getInstance();
HennaData.getInstance();
PrimeShopData.getInstance();
+ PcCafePointsManager.getInstance();
printSection("Characters");
ClassListData.getInstance();
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/MultisellData.java
index e0f39b009b..ef231016b6 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/MultisellData.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/MultisellData.java
@@ -40,6 +40,7 @@ import org.l2jmobius.gameserver.model.multisell.ListContainer;
import org.l2jmobius.gameserver.model.multisell.PreparedListContainer;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExBrExtraUserInfo;
+import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
import org.l2jmobius.gameserver.network.serverpackets.MultiSellList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
@@ -50,7 +51,7 @@ public class MultisellData implements IXmlReader
public static final int PAGE_SIZE = 40;
// Special IDs.
- public static final int PC_BANG_POINTS = -100;
+ public static final int PC_CAFE_POINTS = -100;
public static final int CLAN_REPUTATION = -200;
public static final int FAME = -300;
// Misc
@@ -279,6 +280,15 @@ public class MultisellData implements IXmlReader
{
switch (id)
{
+ case PC_CAFE_POINTS:
+ {
+ if (player.getPcCafePoints() < amount)
+ {
+ player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_SHORT_OF_ACCUMULATED_POINTS));
+ break;
+ }
+ return true;
+ }
case CLAN_REPUTATION:
{
if (player.getClan() == null)
@@ -315,6 +325,12 @@ public class MultisellData implements IXmlReader
{
switch (id)
{
+ case PC_CAFE_POINTS:
+ {
+ player.setPcCafePoints((player.getPcCafePoints() - (int) amount));
+ player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), (int) -amount, 0));
+ break;
+ }
case CLAN_REPUTATION:
{
player.getClan().takeReputationScore((int) amount);
@@ -338,6 +354,12 @@ public class MultisellData implements IXmlReader
{
switch (id)
{
+ case PC_CAFE_POINTS:
+ {
+ player.setPcCafePoints((int) (player.getPcCafePoints() + amount));
+ player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), (int) amount, 0));
+ break;
+ }
case CLAN_REPUTATION:
{
player.getClan().addReputationScore((int) amount);
@@ -384,6 +406,7 @@ public class MultisellData implements IXmlReader
{
switch (ing.getItemId())
{
+ case PC_CAFE_POINTS:
case CLAN_REPUTATION:
case FAME:
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java
new file mode 100644
index 0000000000..21c9fb9a56
--- /dev/null
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/PcCafePointsManager.java
@@ -0,0 +1,98 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.instancemanager;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.commons.util.Rnd;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
+import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
+
+public class PcCafePointsManager
+{
+ public void givePcCafePoint(Player player, double exp)
+ {
+ if (!Config.PC_CAFE_ENABLED || player.isInsideZone(ZoneId.PEACE) || player.isInsideZone(ZoneId.PVP) || player.isInsideZone(ZoneId.SIEGE) || (player.isOnlineInt() == 0) || player.isJailed())
+ {
+ return;
+ }
+
+ // PC-points only premium accounts
+ if (Config.PC_CAFE_ONLY_PREMIUM && !player.hasPremiumStatus())
+ {
+ return;
+ }
+
+ if (player.getPcCafePoints() >= Config.PC_CAFE_MAX_POINTS)
+ {
+ final SystemMessage message = new SystemMessage(SystemMessageId.THE_MAXIMUM_ACCUMULATION_ALLOWED_OF_PC_CAFE_POINTS_HAS_BEEN_EXCEEDED_YOU_CAN_NO_LONGER_ACQUIRE_PC_CAFE_POINTS);
+ player.sendPacket(message);
+ return;
+ }
+
+ int points = (int) (exp * 0.0001 * Config.PC_CAFE_POINT_RATE);
+ if (Config.PC_CAFE_RANDOM_POINT)
+ {
+ points = Rnd.get(points / 2, points);
+ }
+
+ if ((points == 0) && (exp > 0) && Config.PC_CAFE_REWARD_LOW_EXP_KILLS && (Rnd.get(100) < Config.PC_CAFE_LOW_EXP_KILLS_CHANCE))
+ {
+ points = 1; // minimum points
+ }
+
+ if (points <= 0)
+ {
+ return;
+ }
+
+ SystemMessage message = null;
+ if (Config.PC_CAFE_ENABLE_DOUBLE_POINTS && (Rnd.get(100) < Config.PC_CAFE_DOUBLE_POINTS_CHANCE))
+ {
+ points *= 2;
+ message = new SystemMessage(SystemMessageId.DOUBLE_POINTS_YOU_ACQUIRED_S1_PC_BANG_POINT);
+ }
+ else
+ {
+ message = new SystemMessage(SystemMessageId.YOU_HAVE_ACQUIRED_S1_PC_CAFE_POINTS);
+ }
+ if ((player.getPcCafePoints() + points) > Config.PC_CAFE_MAX_POINTS)
+ {
+ points = Config.PC_CAFE_MAX_POINTS - player.getPcCafePoints();
+ }
+ message.addLong(points);
+ player.sendPacket(message);
+ player.setPcCafePoints(player.getPcCafePoints() + points);
+ player.sendPacket(new ExPCCafePointInfo(player.getPcCafePoints(), points, 0));
+ }
+
+ /**
+ * Gets the single instance of {@code PcCafePointsManager}.
+ * @return single instance of {@code PcCafePointsManager}
+ */
+ public static PcCafePointsManager getInstance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final PcCafePointsManager INSTANCE = new PcCafePointsManager();
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/Party.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/Party.java
index e5f180c206..119121bc13 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/Party.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/Party.java
@@ -34,6 +34,7 @@ import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.enums.PartyDistributionType;
import org.l2jmobius.gameserver.enums.PartyMessageType;
import org.l2jmobius.gameserver.instancemanager.DuelManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
@@ -764,6 +765,7 @@ public class Party extends AbstractPlayerGroup
if (addexp > 0)
{
member.updateVitalityPoints(vitalityPoints, true, false);
+ PcCafePointsManager.getInstance().givePcCafePoint(member, addexp);
}
}
else
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Attackable.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Attackable.java
index dd35f37ad8..f9c162561e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Attackable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Attackable.java
@@ -42,6 +42,7 @@ import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.Team;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import org.l2jmobius.gameserver.instancemanager.EventDropManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.model.AbsorberInfo;
import org.l2jmobius.gameserver.model.AggroInfo;
@@ -549,6 +550,7 @@ public class Attackable extends Npc
if ((addexp > 0) && useVitalityRate())
{
attacker.updateVitalityPoints(getVitalityPoints(damage), true, false);
+ PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
}
}
}
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java
index 7caf21aa28..bfd3982378 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Player.java
@@ -364,7 +364,7 @@ public class Player extends Playable
// Character Character SQL String Definitions:
private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,title_color,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,createDate) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=?,faction=? WHERE charId=?";
+ private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=?,faction=?,pccafe_points=? WHERE charId=?";
private static final String RESTORE_CHARACTER = "SELECT * FROM characters WHERE charId=?";
// Character Teleport Bookmark:
@@ -401,6 +401,8 @@ public class Player extends Playable
public static final int REQUEST_TIMEOUT = 15;
+ private int _pcCafePoints = 0;
+
//@formatter:off
private static final int[][] NEVIT_HOURGLASS_BONUS =
{
@@ -6843,6 +6845,7 @@ public class Player extends Playable
player.setClanCreateExpiryTime(0);
}
+ player.setPcCafePoints(rset.getInt("pccafe_points"));
player.setPowerGrade(rset.getInt("power_grade"));
player.setPledgeType(rset.getInt("subpledge"));
// player.setApprentice(rs.getInt("apprentice"));
@@ -7394,7 +7397,8 @@ public class Player extends Playable
factionId = 2;
}
ps.setInt(50, factionId);
- ps.setInt(51, getObjectId());
+ ps.setInt(51, _pcCafePoints);
+ ps.setInt(52, getObjectId());
ps.execute();
}
catch (Exception e)
@@ -13570,6 +13574,16 @@ public class Player extends Playable
_offlineShopStart = time;
}
+ public int getPcCafePoints()
+ {
+ return _pcCafePoints;
+ }
+
+ public void setPcCafePoints(int count)
+ {
+ _pcCafePoints = count < Config.PC_CAFE_MAX_POINTS ? count : Config.PC_CAFE_MAX_POINTS;
+ }
+
/**
* Remove player from BossZones (used on char logout/exit)
*/
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/AbstractScript.java
index 55773ae0ad..15313b2e78 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/AbstractScript.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/AbstractScript.java
@@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
import org.l2jmobius.gameserver.instancemanager.FortManager;
import org.l2jmobius.gameserver.instancemanager.MailManager;
+import org.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Message;
@@ -2673,6 +2674,7 @@ public abstract class AbstractScript extends ManagedScript
public static void addExpAndSp(Player player, long exp, int sp)
{
player.addExpAndSp((long) player.calcStat(Stat.EXPSP_RATE, exp * Config.RATE_QUEST_REWARD_XP, null, null), (int) player.calcStat(Stat.EXPSP_RATE, sp * Config.RATE_QUEST_REWARD_SP, null, null));
+ PcCafePointsManager.getInstance().givePcCafePoint(player, (long) (exp * Config.RATE_QUEST_REWARD_XP));
}
/**