Addition of L2top.co vote reward.
Contributed by andrei.
This commit is contained in:
parent
87a8181f8f
commit
382101d033
@ -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
|
||||
|
@ -1281,6 +1281,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1288,6 +1288,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1301,6 +1301,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1288,6 +1288,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1283,6 +1283,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1283,6 +1283,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1305,6 +1305,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1306,6 +1306,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1341,6 +1341,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem
|
||||
@Override
|
||||
public String getSiteName()
|
||||
{
|
||||
return "Hopzone";
|
||||
return "Hopzone.net";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -76,6 +76,6 @@ public class Network extends VoteSystem
|
||||
@Override
|
||||
public String getSiteName()
|
||||
{
|
||||
return "Network";
|
||||
return "L2network.eu";
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,6 @@ public class Topzone extends VoteSystem
|
||||
@Override
|
||||
public String getSiteName()
|
||||
{
|
||||
return "Topzone";
|
||||
return "Topzone.com";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1342,6 +1342,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -76,6 +76,6 @@ public class Hopzone extends VoteSystem
|
||||
@Override
|
||||
public String getSiteName()
|
||||
{
|
||||
return "Hopzone";
|
||||
return "Hopzone.net";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -76,6 +76,6 @@ public class Network extends VoteSystem
|
||||
@Override
|
||||
public String getSiteName()
|
||||
{
|
||||
return "Network";
|
||||
return "L2network.eu";
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,6 @@ public class Topzone extends VoteSystem
|
||||
@Override
|
||||
public String getSiteName()
|
||||
{
|
||||
return "Topzone";
|
||||
return "Topzone.com";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1221,6 +1221,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1225,6 +1225,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1225,6 +1225,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1225,6 +1225,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Integer, Integer> 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+</li>"))
|
||||
{
|
||||
return Integer.valueOf(line.replace("</li>", "").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";
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1230,6 +1230,13 @@ public class Config
|
||||
public static Map<Integer, Integer> 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<Integer, Integer> 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.<br>
|
||||
@ -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);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user