From 382101d033b0ec83653c2b6c4246902bd72799cd Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 8 Jan 2020 12:08:35 +0000 Subject: [PATCH] Addition of L2top.co vote reward. Contributed by andrei. --- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 2 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 2 +- .../gameserver/model/votereward/Topzone.java | 2 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 2 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 2 +- .../gameserver/model/votereward/Topzone.java | 2 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- .../dist/game/config/Custom/VoteReward.ini | 31 +++++-- .../java/org/l2jmobius/Config.java | 26 +++++- .../gameserver/model/votereward/Hopzone.java | 4 +- .../gameserver/model/votereward/L2top.java | 81 +++++++++++++++++++ .../gameserver/model/votereward/Network.java | 4 +- .../gameserver/model/votereward/Topzone.java | 4 +- .../model/votereward/VoteSystem.java | 23 ++++-- 119 files changed, 2595 insertions(+), 334 deletions(-) create mode 100644 L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/L2top.java create mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/L2top.java diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_1.0_Ertheia/dist/game/config/Custom/VoteReward.ini index 1120f544bd..383595806f 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/config/Custom/VoteReward.ini +++ b/L2J_Mobius_1.0_Ertheia/dist/game/config/Custom/VoteReward.ini @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java index 1f49ce4c3f..3a4b61abd5 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java @@ -1281,7 +1281,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3432,6 +3439,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3445,6 +3453,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3458,6 +3467,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3471,6 +3481,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java index 2a44162855..ffa296d5f1 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Network.java index 04b3c8b65b..b3b2301b79 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Network.java @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + return "Topzone.com"; } } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java index 1baddbeefd..e421080e1c 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else diff --git a/L2J_Mobius_2.5_Underground/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_2.5_Underground/dist/game/config/Custom/VoteReward.ini index 1120f544bd..383595806f 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/config/Custom/VoteReward.ini +++ b/L2J_Mobius_2.5_Underground/dist/game/config/Custom/VoteReward.ini @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java index c188bb9c96..9f2bf9dbba 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java @@ -1288,7 +1288,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3449,6 +3456,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3462,6 +3470,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3475,6 +3484,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3488,6 +3498,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java index 2a44162855..ffa296d5f1 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Network.java index 04b3c8b65b..b3b2301b79 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Network.java @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + return "Topzone.com"; } } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java index 1baddbeefd..e421080e1c 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else diff --git a/L2J_Mobius_3.0_Helios/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_3.0_Helios/dist/game/config/Custom/VoteReward.ini index 1120f544bd..383595806f 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/config/Custom/VoteReward.ini +++ b/L2J_Mobius_3.0_Helios/dist/game/config/Custom/VoteReward.ini @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java index a7f29be24f..1b7b185382 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java @@ -1301,7 +1301,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3473,6 +3480,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3486,6 +3494,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3499,6 +3508,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3512,6 +3522,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java index 2a44162855..ffa296d5f1 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Network.java index 04b3c8b65b..b3b2301b79 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Network.java @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + return "Topzone.com"; } } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java index 1baddbeefd..e421080e1c 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Custom/VoteReward.ini index 1120f544bd..383595806f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Custom/VoteReward.ini +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Custom/VoteReward.ini @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java index 8032c626c2..185859b3ff 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java @@ -1288,7 +1288,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3447,6 +3454,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3460,6 +3468,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3473,6 +3482,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3486,6 +3496,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java index 2a44162855..ffa296d5f1 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Network.java index 04b3c8b65b..b3b2301b79 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Network.java @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + return "Topzone.com"; } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java index 1baddbeefd..e421080e1c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else diff --git a/L2J_Mobius_5.0_Salvation/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_5.0_Salvation/dist/game/config/Custom/VoteReward.ini index 1120f544bd..383595806f 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/config/Custom/VoteReward.ini +++ b/L2J_Mobius_5.0_Salvation/dist/game/config/Custom/VoteReward.ini @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java index 596ae5d174..c777bbd6e8 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java @@ -1283,7 +1283,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3449,6 +3456,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3462,6 +3470,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3475,6 +3484,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3488,6 +3498,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java index 2a44162855..ffa296d5f1 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Network.java index 04b3c8b65b..b3b2301b79 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Network.java @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + return "Topzone.com"; } } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java index 1baddbeefd..e421080e1c 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_5.5_EtinasFate/dist/game/config/Custom/VoteReward.ini index 1120f544bd..383595806f 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/config/Custom/VoteReward.ini +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/config/Custom/VoteReward.ini @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java index 596ae5d174..c777bbd6e8 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java @@ -1283,7 +1283,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3449,6 +3456,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3462,6 +3470,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3475,6 +3484,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3488,6 +3498,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java index 2a44162855..ffa296d5f1 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Network.java index 04b3c8b65b..b3b2301b79 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Network.java @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + return "Topzone.com"; } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java index 1baddbeefd..e421080e1c 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_6.0_Fafurion/dist/game/config/Custom/VoteReward.ini index 1120f544bd..383595806f 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/config/Custom/VoteReward.ini +++ b/L2J_Mobius_6.0_Fafurion/dist/game/config/Custom/VoteReward.ini @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java index 8423b53d58..ca6ba918a3 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java @@ -1305,7 +1305,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3492,6 +3499,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3505,6 +3513,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3518,6 +3527,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3531,6 +3541,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java index 2a44162855..ffa296d5f1 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Network.java index 04b3c8b65b..b3b2301b79 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Network.java @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + return "Topzone.com"; } } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java index 1baddbeefd..e421080e1c 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/Custom/VoteReward.ini index 1120f544bd..383595806f 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/Custom/VoteReward.ini +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/Custom/VoteReward.ini @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java index 89e7e1f0cf..2d9b8940a5 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java @@ -1306,7 +1306,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3494,6 +3501,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3507,6 +3515,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3520,6 +3529,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3533,6 +3543,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java index 2a44162855..ffa296d5f1 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Hopzone.java @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Network.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Network.java index 04b3c8b65b..b3b2301b79 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Network.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Network.java @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + return "Topzone.com"; } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java index 1baddbeefd..e421080e1c 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/votereward/VoteSystem.java @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else 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 index 1120f544bd..383595806f 100644 --- 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 @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 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 7b8f14d2e2..17db6a4c2a 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 @@ -1341,7 +1341,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in config file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (config file) for configuring your server. @@ -3296,6 +3303,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3309,6 +3317,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3322,6 +3331,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3335,6 +3345,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); 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 index 50234e9b45..ffa296d5f1 100644 --- 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 @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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 index 9317355b2b..b3b2301b79 100644 --- 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 @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index 7c22efa2b3..9726bf7ac1 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + 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 index 1baddbeefd..e421080e1c 100644 --- 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 @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else 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 index 1120f544bd..383595806f 100644 --- 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 @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 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 864abbca0a..0343b75c29 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 @@ -1342,7 +1342,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in config file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (config file) for configuring your server. @@ -3303,6 +3310,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3316,6 +3324,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3329,6 +3338,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3342,6 +3352,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); 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 index 50234e9b45..ffa296d5f1 100644 --- 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 @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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 index 9317355b2b..b3b2301b79 100644 --- 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 @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index 7c22efa2b3..9726bf7ac1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + 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 index 1baddbeefd..e421080e1c 100644 --- 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 @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else 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 index 1120f544bd..383595806f 100644 --- 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 @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 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 97b2ab5ec6..21e551fddd 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 @@ -1221,7 +1221,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3311,6 +3318,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3324,6 +3332,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3337,6 +3346,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3350,6 +3360,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); 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 index 2a44162855..ffa296d5f1 100644 --- 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 @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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 index 04b3c8b65b..b3b2301b79 100644 --- 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 @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + 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 index 1baddbeefd..e421080e1c 100644 --- 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 @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else 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 index 1120f544bd..383595806f 100644 --- 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 @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 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 9cc7e24ae0..537caec6c8 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 @@ -1225,7 +1225,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3318,6 +3325,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3331,6 +3339,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3344,6 +3353,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3357,6 +3367,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); 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 index 2a44162855..ffa296d5f1 100644 --- 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 @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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 index 04b3c8b65b..b3b2301b79 100644 --- 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 @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + 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 index 1baddbeefd..e421080e1c 100644 --- 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 @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else 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 index 1120f544bd..383595806f 100644 --- 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 @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 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 9cc7e24ae0..537caec6c8 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 @@ -1225,7 +1225,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3318,6 +3325,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3331,6 +3339,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3344,6 +3353,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3357,6 +3367,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); 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 index 2a44162855..ffa296d5f1 100644 --- 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 @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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 index 04b3c8b65b..b3b2301b79 100644 --- 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 @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + 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 index 1baddbeefd..e421080e1c 100644 --- 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 @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else 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 index 1120f544bd..383595806f 100644 --- 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 @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 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 9cc7e24ae0..537caec6c8 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 @@ -1225,7 +1225,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3318,6 +3325,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3331,6 +3339,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3344,6 +3353,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3357,6 +3367,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); 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 index 2a44162855..ffa296d5f1 100644 --- 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 @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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 index 04b3c8b65b..b3b2301b79 100644 --- 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 @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + 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 index 1baddbeefd..e421080e1c 100644 --- 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 @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else 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 index 1120f544bd..383595806f 100644 --- 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 @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 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 c10f41b710..e5a9b39ef5 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 @@ -1230,7 +1230,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3326,6 +3333,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3339,6 +3347,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3352,6 +3361,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3365,6 +3375,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); 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 index 2a44162855..ffa296d5f1 100644 --- 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 @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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 index 04b3c8b65b..b3b2301b79 100644 --- 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 @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + 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 index 1baddbeefd..e421080e1c 100644 --- 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 @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else 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 index 1120f544bd..383595806f 100644 --- 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 @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 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 e3b77db06d..9b019f2bb9 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 @@ -1229,7 +1229,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3324,6 +3331,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3337,6 +3345,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3350,6 +3359,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3363,6 +3373,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); 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 index 2a44162855..ffa296d5f1 100644 --- 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 @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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 index 04b3c8b65b..b3b2301b79 100644 --- 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 @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + 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 index 1baddbeefd..e421080e1c 100644 --- 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 @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else diff --git a/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/VoteReward.ini b/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/VoteReward.ini index 1120f544bd..383595806f 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/VoteReward.ini +++ b/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/VoteReward.ini @@ -1,6 +1,6 @@ -# Vote reward for Network. +# Vote reward for L2network.eu AllowNetworkVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. (IMPORTANT!!!! Always add / at the end of the link) NetworkServerLink = # Votes for next reward needed. NetworkVotesDifference = 4 @@ -17,7 +17,7 @@ NetworkDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowNetworkGameServerReport = False -# Vote reward for Topzone. +# Vote reward for Topzone.com AllowTopzoneVoteReward = False # Vote reward server link. TopzoneServerLink = @@ -36,9 +36,9 @@ TopzoneDualboxesAllowed = 1 # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = False -# Vote reward for Hopzone. +# Vote reward for Hopzone.net AllowHopzoneVoteReward = False -# Vote reward server link. (IMPORTANT!!!! Always add .html at the end of the link) +# Vote reward server link. HopzoneServerLink = # Votes for next reward needed. HopzoneVotesDifference = 4 @@ -47,10 +47,29 @@ HopzoneVotesDifference = 4 HopzoneRewardCheckTime = 5 # Reward(s). HopzoneReward = 3481,5; -# Topzone reward max dual boxes reward. +# 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 diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java index ab8e173d46..fbdda9f835 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java @@ -1232,7 +1232,14 @@ public class Config 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; + /** * This class initializes all global variables for configuration.
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server. @@ -3330,6 +3337,7 @@ public class Config // Load VoteReward config file (if exists) final PropertiesParser VoteReward = new PropertiesParser(CUSTOM_VOTE_REWARD_CONFIG_FILE); + // L2network.eu ALLOW_NETWORK_VOTE_REWARD = VoteReward.getBoolean("AllowNetworkVoteReward", false); NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", ""); NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5); @@ -3343,6 +3351,7 @@ public class Config } NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1); ALLOW_NETWORK_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowNetworkGameServerReport", false); + // Topzone.com ALLOW_TOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowTopzoneVoteReward", false); TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", ""); TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5); @@ -3356,6 +3365,7 @@ public class Config } TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1); ALLOW_TOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowTopzoneGameServerReport", false); + // Hopzone.net ALLOW_HOPZONE_VOTE_REWARD = VoteReward.getBoolean("AllowHopzoneVoteReward", false); HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", ""); HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5); @@ -3369,6 +3379,20 @@ public class Config } HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1); ALLOW_HOPZONE_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowHopzoneGameServerReport", false); + // L2top.co + ALLOW_L2TOP_VOTE_REWARD = VoteReward.getBoolean("AllowL2topVoteReward", false); + L2TOP_SERVER_LINK = VoteReward.getString("L2topServerLink", ""); + L2TOP_VOTES_DIFFERENCE = VoteReward.getInt("L2topVotesDifference", 5); + L2TOP_REWARD_CHECK_TIME = VoteReward.getInt("L2topRewardCheckTime", 5); + final String L2TOP_SMALL_REWARD_VALUE = VoteReward.getString("L2topReward", "57,100000000;"); + final String[] l2top_small_reward_splitted_1 = L2TOP_SMALL_REWARD_VALUE.split(";"); + for (String i : l2top_small_reward_splitted_1) + { + final String[] l2top_small_reward_splitted_2 = i.split(","); + L2TOP_REWARD.put(Integer.parseInt(l2top_small_reward_splitted_2[0]), Integer.parseInt(l2top_small_reward_splitted_2[1])); + } + L2TOP_DUALBOXES_ALLOWED = VoteReward.getInt("L2topDualboxesAllowed", 1); + ALLOW_L2TOP_GAME_SERVER_REPORT = VoteReward.getBoolean("AllowL2topGameServerReport", false); // Load WalkerBotProtection config file (if exists) final PropertiesParser WalkerBotProtection = new PropertiesParser(CUSTOM_WALKER_BOT_PROTECTION_CONFIG_FILE); 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 index 2a44162855..ffa296d5f1 100644 --- 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 @@ -67,7 +67,7 @@ public class Hopzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem @Override public String getSiteName() { - return "Hopzone"; + return "Hopzone.net"; } } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/L2top.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/L2top.java new file mode 100644 index 0000000000..3fce5190fc --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/L2top.java @@ -0,0 +1,81 @@ +/* + * 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 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 index 04b3c8b65b..b3b2301b79 100644 --- 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 @@ -67,7 +67,7 @@ public class Network extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -76,6 +76,6 @@ public class Network extends VoteSystem @Override public String getSiteName() { - return "Network"; + return "L2network.eu"; } } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Topzone.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Topzone.java index a80333aa13..9726bf7ac1 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Topzone.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/votereward/Topzone.java @@ -64,7 +64,7 @@ public class Topzone extends VoteSystem } catch (Exception e) { - LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + ". " + e); + LOGGER.warning("VoteSystem: Error while getting server vote count from " + getSiteName() + "."); } return -1; @@ -73,6 +73,6 @@ public class Topzone extends VoteSystem @Override public String getSiteName() { - return "Topzone"; + 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 index 1baddbeefd..e421080e1c 100644 --- 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 @@ -50,35 +50,44 @@ public abstract class VoteSystem implements Runnable public static void initialize() { - if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD) + if (Config.ALLOW_NETWORK_VOTE_REWARD || Config.ALLOW_TOPZONE_VOTE_REWARD || Config.ALLOW_HOPZONE_VOTE_REWARD || Config.ALLOW_L2TOP_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: Network votes enabled."); + LOGGER.info("VoteSystem: L2network.eu votes enabled."); } else { - LOGGER.info("VoteSystem: Network votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Topzone.com votes enabled."); } else { - LOGGER.info("VoteSystem: Topzone votes disabled."); + 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 votes enabled."); + LOGGER.info("VoteSystem: Hopzone.net votes enabled."); } else { - LOGGER.info("VoteSystem: Hopzone votes disabled."); + 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."); } } else