diff --git a/L2J_Mobius_01.0_Ertheia/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_01.0_Ertheia/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_01.0_Ertheia/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/Config.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/Config.java index 43d5bb19e2..fa22c257cf 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/Config.java @@ -144,7 +144,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1304,41 +1303,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3520,78 +3484,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/GameServer.java index 8779566eea..ee20e00803 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/GameServer.java @@ -146,7 +146,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -372,8 +371,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_02.5_Underground/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_02.5_Underground/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_02.5_Underground/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/Config.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/Config.java index 1c69312384..63a7997567 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/Config.java @@ -145,7 +145,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1315,41 +1314,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3544,78 +3508,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/GameServer.java index 34af1ca9f7..12f9df126b 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/GameServer.java @@ -150,7 +150,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -380,8 +379,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_03.0_Helios/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_03.0_Helios/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_03.0_Helios/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/Config.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/Config.java index e95c564e69..dd85afebe7 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/Config.java @@ -145,7 +145,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1328,41 +1327,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3566,78 +3530,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/GameServer.java index 34af1ca9f7..12f9df126b 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/GameServer.java @@ -150,7 +150,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -380,8 +379,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_04.0_GrandCrusade/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_04.0_GrandCrusade/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/Config.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/Config.java index bde7419abc..3dc175d1a1 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/Config.java @@ -145,7 +145,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1315,41 +1314,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3540,78 +3504,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/GameServer.java index 8ced197530..01bfa63e43 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/GameServer.java @@ -150,7 +150,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -380,8 +379,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_05.0_Salvation/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_05.0_Salvation/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_05.0_Salvation/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/Config.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/Config.java index df77f2990c..0eb62a2c59 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/Config.java @@ -146,7 +146,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1314,41 +1313,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3549,78 +3513,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/GameServer.java index 60aafee877..f7b04ef277 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/GameServer.java @@ -152,7 +152,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -384,8 +383,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_05.5_EtinasFate/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_05.5_EtinasFate/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/Config.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/Config.java index 3b2620f209..7cae02c17f 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/Config.java @@ -146,7 +146,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1321,41 +1320,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3561,78 +3525,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/GameServer.java index 60aafee877..f7b04ef277 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/GameServer.java @@ -152,7 +152,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -384,8 +383,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_06.0_Fafurion/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_06.0_Fafurion/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/Config.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/Config.java index 9602239e3d..71cc5909c3 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/Config.java @@ -146,7 +146,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1343,41 +1342,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3604,78 +3568,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/GameServer.java index 6213ad8953..b5b5d3370c 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/GameServer.java @@ -153,7 +153,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -386,8 +385,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_07.0_PreludeOfWar/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_07.0_PreludeOfWar/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/Config.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/Config.java index b27acb609d..bfcbe4b2eb 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/Config.java @@ -146,7 +146,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1351,41 +1350,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3620,78 +3584,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/GameServer.java index 332bf0e828..7e1b608e3b 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/GameServer.java @@ -156,7 +156,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -392,8 +391,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_08.2_Homunculus/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_08.2_Homunculus/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/Config.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/Config.java index 8235e92647..62eeb6b70d 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/Config.java @@ -145,7 +145,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1342,41 +1341,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3591,78 +3555,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/GameServer.java index 10356ab3d0..c28ce0ca5d 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/GameServer.java @@ -156,7 +156,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -392,8 +391,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java index cc535db5cb..330d29fd3c 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java @@ -145,7 +145,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1344,41 +1343,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3595,78 +3559,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/GameServer.java index 8c570caf91..1cf219560f 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/GameServer.java @@ -157,7 +157,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -394,8 +393,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_10.1_MasterClass/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_10.1_MasterClass/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_10.1_MasterClass/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/Config.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/Config.java index 20328fb63b..e818375534 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/Config.java @@ -145,7 +145,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1344,41 +1343,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3595,78 +3559,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/GameServer.java index 90abc2e3c1..1b17a02ea9 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/GameServer.java @@ -159,7 +159,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -398,8 +397,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_10.2_MasterClass/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_10.2_MasterClass/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/Config.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/Config.java index 20328fb63b..e818375534 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/Config.java @@ -145,7 +145,6 @@ public class Config private static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1344,41 +1343,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3595,78 +3559,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/GameServer.java index 90abc2e3c1..1b17a02ea9 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/GameServer.java @@ -159,7 +159,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -398,8 +397,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True 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 48a23825e8..403642d19c 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 @@ -141,7 +141,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WAREHOUSE_SORTING_CONFIG_FILE = "./config/Custom/WarehouseSorting.ini"; private static final String CUSTOM_WEDDING_CONFIG_FILE = "./config/Custom/Wedding.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; @@ -1321,41 +1320,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3079,78 +3043,6 @@ public class Config WEDDING_FORMALWEAR = weddingConfig.getBoolean("WeddingFormalWear", true); WEDDING_DIVORCE_COSTS = weddingConfig.getInt("WeddingDivorceCosts", 20); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", 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 70e68d8406..48d926937f 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 @@ -145,7 +145,6 @@ import org.l2jmobius.gameserver.model.partymatching.PartyMatchRoomList; import org.l2jmobius.gameserver.model.partymatching.PartyMatchWaitingList; import org.l2jmobius.gameserver.model.sevensigns.SevenSigns; import org.l2jmobius.gameserver.model.sevensigns.SevenSignsFestival; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -363,7 +362,6 @@ public class GameServer FourSepulchersManager.getInstance().init(); DimensionalRiftManager.getInstance(); RaidBossSpawnManager.getInstance(); - VoteSystem.initialize(); printSection("Siege"); SiegeManager.getInstance().getSieges(); diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True 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 a8efba5ab0..39c5ee9c33 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 @@ -141,7 +141,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WAREHOUSE_SORTING_CONFIG_FILE = "./config/Custom/WarehouseSorting.ini"; private static final String CUSTOM_WEDDING_CONFIG_FILE = "./config/Custom/Wedding.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; @@ -1321,41 +1320,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3086,78 +3050,6 @@ public class Config WEDDING_FORMALWEAR = weddingConfig.getBoolean("WeddingFormalWear", true); WEDDING_DIVORCE_COSTS = weddingConfig.getInt("WeddingDivorceCosts", 20); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", 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 f8b43b0748..fe2f356906 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 @@ -146,7 +146,6 @@ import org.l2jmobius.gameserver.model.partymatching.PartyMatchRoomList; import org.l2jmobius.gameserver.model.partymatching.PartyMatchWaitingList; import org.l2jmobius.gameserver.model.sevensigns.SevenSigns; import org.l2jmobius.gameserver.model.sevensigns.SevenSignsFestival; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -365,7 +364,6 @@ public class GameServer FourSepulchersManager.getInstance().init(); DimensionalRiftManager.getInstance(); RaidBossSpawnManager.getInstance(); - VoteSystem.initialize(); printSection("Siege"); SiegeManager.getInstance().getSieges(); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java index 46d1be44dc..472b6cdd81 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java @@ -147,7 +147,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1270,41 +1269,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3467,78 +3431,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/GameServer.java index c4cf79fccb..25f1ebfb12 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/GameServer.java @@ -149,7 +149,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -380,8 +379,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java index 697d87a3fc..00987915e1 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java @@ -147,7 +147,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1274,41 +1273,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3473,78 +3437,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/GameServer.java index c4cf79fccb..25f1ebfb12 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/GameServer.java @@ -149,7 +149,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -380,8 +379,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java index 697d87a3fc..00987915e1 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java @@ -147,7 +147,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1274,41 +1273,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3473,78 +3437,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/GameServer.java index 11b19998d0..1ba0bfb4cc 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/GameServer.java @@ -150,7 +150,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -382,8 +381,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java index 697d87a3fc..00987915e1 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java @@ -147,7 +147,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1274,41 +1273,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3473,78 +3437,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/GameServer.java index ff983950d7..988420e899 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/GameServer.java @@ -151,7 +151,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -384,8 +383,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java index 5628323961..0f8abb909f 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java @@ -147,7 +147,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1279,41 +1278,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3482,78 +3446,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/GameServer.java index e5ee6c6947..0a1269de21 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/GameServer.java @@ -152,7 +152,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -386,8 +385,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java index 03da33645a..30dd966a0d 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java @@ -147,7 +147,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1285,41 +1284,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3494,78 +3458,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/GameServer.java index 17a123cf13..470ad8e02b 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/GameServer.java @@ -155,7 +155,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -392,8 +391,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java index 841cf6c555..7215234b80 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java @@ -147,7 +147,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1278,41 +1277,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3470,78 +3434,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/GameServer.java index 245fecd774..f2bf6006c9 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/GameServer.java @@ -147,7 +147,6 @@ import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -375,8 +374,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java index 640198eb5d..bac0eb67f5 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java @@ -149,7 +149,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1306,41 +1305,6 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; public static boolean ENABLE_GUI; public static boolean DARK_THEME; @@ -3540,78 +3504,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java index cb3d884cfc..abed6ed15b 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java @@ -162,7 +162,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -406,8 +405,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java index 23b021c246..c23c2b65c0 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java @@ -149,7 +149,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1307,41 +1306,7 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; + public static String SUBJUGATION_TOPIC_HEADER; public static String SUBJUGATION_TOPIC_BODY; @@ -3546,78 +3511,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/GameServer.java index d4dd118f1d..d42e352b01 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/GameServer.java @@ -167,7 +167,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -416,8 +415,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/Config.java index 23b021c246..c23c2b65c0 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/Config.java @@ -149,7 +149,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1307,41 +1306,7 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; + public static String SUBJUGATION_TOPIC_HEADER; public static String SUBJUGATION_TOPIC_BODY; @@ -3546,78 +3511,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/GameServer.java index d4dd118f1d..d42e352b01 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/GameServer.java @@ -167,7 +167,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -416,8 +415,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/Custom/VoteReward.ini deleted file mode 100644 index 7320bfd16a..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/Custom/VoteReward.ini +++ /dev/null @@ -1,95 +0,0 @@ -# Vote reward for L2network.eu -AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) -NetworkServerLink = -# Votes for next reward needed. -NetworkVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -NetworkRewardCheckTime = 5 -# Reward(s). -NetworkReward = 3481,5; -# Network reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -NetworkDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowNetworkGameServerReport = False - -# Vote reward for Topzone.com -AllowTopzoneVoteReward = False -# Vote reward server link. -TopzoneServerLink = -# Votes for next reward needed. -TopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -TopzoneRewardCheckTime = 5 -# Reward(s). -TopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -TopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowTopzoneGameServerReport = False - -# Vote reward for Hopzone.net -AllowHopzoneVoteReward = False -# Vote reward server link. -HopzoneServerLink = -# Votes for next reward needed. -HopzoneVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -HopzoneRewardCheckTime = 5 -# Reward(s). -HopzoneReward = 3481,5; -# Hopzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -HopzoneDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowHopzoneGameServerReport = False - -# Vote reward for L2top.co -AllowL2topVoteReward = False -# Vote reward server link. -L2topServerLink = -# Votes for next reward needed. -L2topVotesDifference = 4 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2topRewardCheckTime = 5 -# Reward(s). -L2topReward = 3481,5; -# L2top reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2topDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2topGameServerReport = False - -# Vote reward for L2JBrasil. -AllowL2JBrasilVoteReward = False -# Vote reward server link. -# Example: https://top.l2jbrasil.com/index.php?a=stats&u=l2monkey -L2JBrasilServerLink = -# Votes for next reward needed. -L2JBrasilVotesDifference = 1 -# Minutes between rewards. -# Eg. You put 5 it checks every 5 minutes for reward. -L2JBrasilRewardCheckTime = 1 -# Reward(s). -L2JBrasilReward = 30002,5; -# Topzone reward max dual boxes reward. -# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. -L2JBrasilDualboxesAllowed = 1 -# Game server console report. -# If set to true, game server console will get a report of -# current vote count, votes needed for next reward and votes needed for first page. -AllowL2JBrasilGameServerReport = True diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java index b8d238baec..c3f9333af2 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java @@ -149,7 +149,6 @@ public class Config private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini"; private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini"; private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini"; - private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini"; private static final String CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE = "./config/Custom/WalkerBotProtection.ini"; // -------------------------------------------------- @@ -1307,41 +1306,7 @@ public class Config public static long SELLBUFF_MIN_PRICE; public static long SELLBUFF_MAX_PRICE; public static int SELLBUFF_MAX_BUFFS; - public static boolean ALLOW_NETWORK_VOTE_REWARD; - public static String NETWORK_SERVER_LINK; - public static int NETWORK_VOTES_DIFFERENCE; - public static int NETWORK_REWARD_CHECK_TIME; - public static Map NETWORK_REWARD = new HashMap<>(); - public static int NETWORK_DUALBOXES_ALLOWED; - public static boolean ALLOW_NETWORK_GAME_SERVER_REPORT; - public static boolean ALLOW_TOPZONE_VOTE_REWARD; - public static String TOPZONE_SERVER_LINK; - public static int TOPZONE_VOTES_DIFFERENCE; - public static int TOPZONE_REWARD_CHECK_TIME; - public static Map TOPZONE_REWARD = new HashMap<>(); - public static int TOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_HOPZONE_VOTE_REWARD; - public static String HOPZONE_SERVER_LINK; - public static int HOPZONE_VOTES_DIFFERENCE; - public static int HOPZONE_REWARD_CHECK_TIME; - public static Map HOPZONE_REWARD = new HashMap<>(); - public static int HOPZONE_DUALBOXES_ALLOWED; - public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; - public static boolean ALLOW_L2TOP_VOTE_REWARD; - public static String L2TOP_SERVER_LINK; - public static int L2TOP_VOTES_DIFFERENCE; - public static int L2TOP_REWARD_CHECK_TIME; - public static Map L2TOP_REWARD = new HashMap<>(); - public static int L2TOP_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT; - public static boolean ALLOW_L2JBRASIL_VOTE_REWARD; - public static String L2JBRASIL_SERVER_LINK; - public static int L2JBRASIL_VOTES_DIFFERENCE; - public static int L2JBRASIL_REWARD_CHECK_TIME; - public static Map L2JBRASIL_REWARD = new HashMap<>(); - public static int L2JBRASIL_DUALBOXES_ALLOWED; - public static boolean ALLOW_L2JBRASIL_GAME_SERVER_REPORT; + public static String SUBJUGATION_TOPIC_HEADER; public static String SUBJUGATION_TOPIC_BODY; @@ -3546,78 +3511,6 @@ public class Config CUSTOM_STARTING_LOC_Y = startingLocationConfig.getInt("CustomStartingLocY", 186527); CUSTOM_STARTING_LOC_Z = startingLocationConfig.getInt("CustomStartingLocZ", -3625); - // Load VoteReward config file (if exists) - final PropertiesParser voteRewardConfig = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); - // L2network.eu - ALLOW_NETWORK_VOTE_REWARD = voteRewardConfig.getBoolean("AllowNetworkVoteReward", false); - NETWORK_SERVER_LINK = voteRewardConfig.getString("NetworkServerLink", ""); - NETWORK_VOTES_DIFFERENCE = voteRewardConfig.getInt("NetworkVotesDifference", 5); - NETWORK_REWARD_CHECK_TIME = voteRewardConfig.getInt("NetworkRewardCheckTime", 5); - final String networkSmallRewardValue = voteRewardConfig.getString("NetworkReward", "57,100000000;"); - final String[] networkSmallRewardSplit1 = networkSmallRewardValue.split(";"); - for (String i : networkSmallRewardSplit1) - { - final String[] networkSmallRewardSplit2 = i.split(","); - NETWORK_REWARD.put(Integer.parseInt(networkSmallRewardSplit2[0]), Integer.parseInt(networkSmallRewardSplit2[1])); - } - NETWORK_DUALBOXES_ALLOWED = voteRewardConfig.getInt("NetworkDualboxesAllowed", 1); - ALLOW_NETWORK_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowNetworkGameServerReport", false); - // Topzone.com - ALLOW_TOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowTopzoneVoteReward", false); - TOPZONE_SERVER_LINK = voteRewardConfig.getString("TopzoneServerLink", ""); - TOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("TopzoneVotesDifference", 5); - TOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("TopzoneRewardCheckTime", 5); - final String topzoneSmallRewardValue = voteRewardConfig.getString("TopzoneReward", "57,100000000;"); - final String[] topzoneSmallRewardSplit1 = topzoneSmallRewardValue.split(";"); - for (String i : topzoneSmallRewardSplit1) - { - final String[] topzoneSmallRewardSplit2 = i.split(","); - TOPZONE_REWARD.put(Integer.parseInt(topzoneSmallRewardSplit2[0]), Integer.parseInt(topzoneSmallRewardSplit2[1])); - } - TOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("TopzoneDualboxesAllowed", 1); - ALLOW_TOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowTopzoneGameServerReport", false); - // Hopzone.net - ALLOW_HOPZONE_VOTE_REWARD = voteRewardConfig.getBoolean("AllowHopzoneVoteReward", false); - HOPZONE_SERVER_LINK = voteRewardConfig.getString("HopzoneServerLink", ""); - HOPZONE_VOTES_DIFFERENCE = voteRewardConfig.getInt("HopzoneVotesDifference", 5); - HOPZONE_REWARD_CHECK_TIME = voteRewardConfig.getInt("HopzoneRewardCheckTime", 5); - final String hopzoneSmallRewardValue = voteRewardConfig.getString("HopzoneReward", "57,100000000;"); - final String[] hopzoneSmallRewardSplit1 = hopzoneSmallRewardValue.split(";"); - for (String i : hopzoneSmallRewardSplit1) - { - final String[] hopzoneSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(hopzoneSmallRewardSplit2[0]), Integer.parseInt(hopzoneSmallRewardSplit2[1])); - } - HOPZONE_DUALBOXES_ALLOWED = voteRewardConfig.getInt("HopzoneDualboxesAllowed", 1); - ALLOW_HOPZONE_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowHopzoneGameServerReport", false); - // L2top.co - ALLOW_L2TOP_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2topVoteReward", false); - L2TOP_SERVER_LINK = voteRewardConfig.getString("L2topServerLink", ""); - L2TOP_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2topVotesDifference", 5); - L2TOP_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2topRewardCheckTime", 5); - final String l2topSmallRewardValue = voteRewardConfig.getString("L2topReward", "57,100000000;"); - final String[] l2topSmallRewardsplit1 = l2topSmallRewardValue.split(";"); - for (String i : l2topSmallRewardsplit1) - { - final String[] l2topSmallRewardSplit2 = i.split(","); - L2TOP_REWARD.put(Integer.parseInt(l2topSmallRewardSplit2[0]), Integer.parseInt(l2topSmallRewardSplit2[1])); - } - L2TOP_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2topDualboxesAllowed", 1); - ALLOW_L2TOP_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2topGameServerReport", false); - ALLOW_L2JBRASIL_VOTE_REWARD = voteRewardConfig.getBoolean("AllowL2JBrasilVoteReward", false); - L2JBRASIL_SERVER_LINK = voteRewardConfig.getString("L2JBrasilServerLink", ""); - L2JBRASIL_VOTES_DIFFERENCE = voteRewardConfig.getInt("L2JBrasilVotesDifference", 5); - L2JBRASIL_REWARD_CHECK_TIME = voteRewardConfig.getInt("L2JBrasilRewardCheckTime", 5); - String l2jbrasilSmallRewardValue = voteRewardConfig.getString("L2JBrasilReward", "57,100000000;"); - String[] l2jbrasilSmallRewardSplit1 = l2jbrasilSmallRewardValue.split(";"); - for (String i : l2jbrasilSmallRewardSplit1) - { - String[] l2jbrasilSmallRewardSplit2 = i.split(","); - HOPZONE_REWARD.put(Integer.parseInt(l2jbrasilSmallRewardSplit2[0]), Integer.parseInt(l2jbrasilSmallRewardSplit2[1])); - } - L2JBRASIL_DUALBOXES_ALLOWED = voteRewardConfig.getInt("L2JBrasilDualboxesAllowed", 1); - ALLOW_L2JBRASIL_GAME_SERVER_REPORT = voteRewardConfig.getBoolean("AllowL2JBrasilGameServerReport", false); - // Load WalkerBotProtection config file (if exists) final PropertiesParser walkerBotProtectionConfig = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); L2WALKER_PROTECTION = walkerBotProtectionConfig.getBoolean("L2WalkerProtection", false); diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/GameServer.java index d4dd118f1d..d42e352b01 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/GameServer.java @@ -167,7 +167,6 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.olympiad.Hero; import org.l2jmobius.gameserver.model.olympiad.Olympiad; import org.l2jmobius.gameserver.model.vip.VipManager; -import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -416,8 +415,6 @@ public class GameServer SpawnData.getInstance().init(); DBSpawnManager.getInstance(); - VoteSystem.initialize(); - printSection("Siege"); SiegeManager.getInstance().getSieges(); CastleManager.getInstance().activateInstances(); diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java deleted file mode 100644 index ffa296d5f1..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Hopzone extends VoteSystem -{ - public Hopzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class L2jbrasil extends VoteSystem -{ - public L2jbrasil(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - URLConnection con = new URL(Config.L2JBRASIL_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("Entradas(Total):")[2].replace("
. - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author andrei - */ -public class L2top extends VoteSystem -{ - public L2top(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.L2TOP_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.matches("\\s+\\d+")) - { - return Integer.valueOf(line.replace("", "").replaceAll("\t", "")); - } - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "L2top.co"; - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/votereward/Network.java deleted file mode 100644 index b3b2301b79..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Network extends VoteSystem -{ - public Network(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "Mozilla/5.0"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - if (line.contains("
")[2].replace(". - */ -package org.l2jmobius.gameserver.model.votereward; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.Map; - -import org.l2jmobius.Config; - -/** - * @author Anarchy - */ -public class Topzone extends VoteSystem -{ - public Topzone(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - super(votesDiff, allowReport, boxes, rewards, checkMins); - } - - @Override - public void run() - { - reward(); - } - - @Override - public int getVotes() - { - InputStreamReader isr = null; - BufferedReader br = null; - - try - { - final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection(); - con.addRequestProperty("User-Agent", "L2TopZone"); - isr = new InputStreamReader(con.getInputStream()); - br = new BufferedReader(isr); - - String line; - while ((line = br.readLine()) != null) - { - return Integer.parseInt(line.split("fa-thumbs-up\">")[1].split("")[0]); - } - - br.close(); - isr.close(); - } - catch (Exception e) - { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); - } - - return -1; - } - - @Override - public String getSiteName() - { - return "Topzone.com"; - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java deleted file mode 100644 index fc78af6ba7..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.model.votereward; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.threads.ThreadPool; -import org.l2jmobius.gameserver.enums.ChatType; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; -import org.l2jmobius.gameserver.util.Broadcast; - -/** - * @author Anarchy - */ -public abstract class VoteSystem implements Runnable -{ - protected static final Logger LOGGER = Logger.getLogger(VoteSystem.class.getName()); - - private static List voteSystems = new ArrayList<>(); - - private final int votesDiff; - private final boolean allowReport; - private final int boxes; - private final Map rewards; - private int lastVotes = 0; - private final Map playerIps = new HashMap<>(); - - public static void initialize() - { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_VOTE_REWARD || Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - LOGGER.info("VoteSystem: Initialized."); - if (Config.ALLOW_NETWORK_VOTE_REWARD) - { - voteSystems.add(new Network(Config.NETWORK_VOTES_DIFFERENCE, Config.ALLOW_NETWORK_GAME_SERVER_REPORT, Config.NETWORK_DUALBOXES_ALLOWED, Config.NETWORK_REWARD, Config.NETWORK_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2network.eu votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2network.eu votes disabled."); - } - if (Config.ALLOW_TOPZONE_VOTE_REWARD) - { - voteSystems.add(new Topzone(Config.TOPZONE_VOTES_DIFFERENCE, Config.ALLOW_TOPZONE_GAME_SERVER_REPORT, Config.TOPZONE_DUALBOXES_ALLOWED, Config.TOPZONE_REWARD, Config.TOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Topzone.com votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Topzone.com votes disabled."); - } - if (Config.ALLOW_HOPZONE_VOTE_REWARD) - { - voteSystems.add(new Hopzone(Config.HOPZONE_VOTES_DIFFERENCE, Config.ALLOW_HOPZONE_GAME_SERVER_REPORT, Config.HOPZONE_DUALBOXES_ALLOWED, Config.HOPZONE_REWARD, Config.HOPZONE_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: Hopzone.net votes enabled."); - } - else - { - LOGGER.info("VoteSystem: Hopzone.net votes disabled."); - } - if (Config.ALLOW_L2TOP_VOTE_REWARD) - { - voteSystems.add(new L2top(Config.L2TOP_VOTES_DIFFERENCE, Config.ALLOW_L2TOP_GAME_SERVER_REPORT, Config.L2TOP_DUALBOXES_ALLOWED, Config.L2TOP_REWARD, Config.L2TOP_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2top.co votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2top.co votes disabled."); - } - if (Config.ALLOW_L2JBRASIL_VOTE_REWARD) - { - voteSystems.add(new L2jbrasil(Config.L2JBRASIL_VOTES_DIFFERENCE, Config.ALLOW_L2JBRASIL_GAME_SERVER_REPORT, Config.L2JBRASIL_DUALBOXES_ALLOWED, Config.L2JBRASIL_REWARD, Config.L2JBRASIL_REWARD_CHECK_TIME)); - LOGGER.info("VoteSystem: L2JBrasil votes enabled."); - } - else - { - LOGGER.info("VoteSystem: L2JBrasil votes disabled."); - } - } - else - { - LOGGER.info("VoteSystem: Disabled."); - } - } - - public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map rewards, int checkMins) - { - this.votesDiff = votesDiff; - this.allowReport = allowReport; - this.boxes = boxes; - this.rewards = rewards; - ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60); - } - - protected void reward() - { - final int currentVotes = getVotes(); - if (currentVotes == -1) - { - LOGGER.info("VoteSystem: There was a problem on getting server votes."); - return; - } - - if (lastVotes == 0) - { - lastVotes = currentVotes; - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - return; - } - - if (currentVotes >= (lastVotes + votesDiff)) - { - final Collection pls = World.getInstance().getPlayers(); - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((currentVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Everyone has been rewarded."); - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + votesDiff + " vote(s) for next reward."); - for (Player p : pls) - { - if ((p.getClient() == null) || p.getClient().isDetached()) - { - continue; - } - - boolean canReward = false; - final String pIp = p.getClient().getConnectionAddress().getHostAddress(); - if (playerIps.containsKey(pIp)) - { - final int count = playerIps.get(pIp); - if (count < boxes) - { - playerIps.remove(pIp); - playerIps.put(pIp, count + 1); - canReward = true; - } - } - else - { - canReward = true; - playerIps.put(pIp, 1); - } - if (canReward) - { - for (Entry entry : rewards.entrySet()) - { - p.addItem("Vote reward.", entry.getKey(), entry.getValue(), p, true); - } - } - else - { - p.sendMessage("Already " + boxes + " character(s) of your ip have been rewarded, so this character won't be rewarded."); - } - } - playerIps.clear(); - - lastVotes = currentVotes; - } - else - { - if (allowReport) - { - LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes); - LOGGER.info("VoteSystem: Votes needed for next reward: " + ((lastVotes + votesDiff) - currentVotes)); - } - announce(getSiteName() + ": Current vote count is " + currentVotes + "."); - announce(getSiteName() + ": We need " + ((lastVotes + votesDiff) - currentVotes) + " vote(s) for reward."); - } - } - - private void announce(String msg) - { - Broadcast.toAllOnlinePlayers(new CreatureSay(null, ChatType.CRITICAL_ANNOUNCE, "", msg)); - } - - public abstract int getVotes(); - - public abstract String getSiteName(); -} \ No newline at end of file