This method is deprecated and no longer supported by our website. Visit myhome reward section for the new method.Hello,
Here I will give you few example of code to fix your vote rewards that use total votes from our website.
First you need to take the new link with total votes from your account section reward.
Add this link in your config file:
# Topzone:
http://l2topzone.comVotesSiteTopZoneUrl =
http://l2topzone.com/tv.php?id= YOUR SERVER ID
That link will return total votes of your server without any formatting.
Lets start with l2jfrozen auto reward:
- find AutoVoteRewardHandler.java file in your project;
- find this code:
try
{
url = new URL(PowerPakConfig.VOTES_SITE_TOPZONE_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2TopZone");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("Votes"))
{
votes = Integer.valueOf(inputLine.split(">")[3].replace("</div", ""));
break;
}
}
}
-replace it with :
try
{
url = new URL(PowerPakConfig.VOTES_SITE_TOPZONE_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2TopZone");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
votes = Integer.valueOf(inputLine);
break;
}
}
- compile your server and you are ready.
L2jacis auto reward:
You must do the same with the config add the new link with total votes.
I found the code here
[Java] Hopzone / Topzone adapted for Acis by heopas - Pastebin.com I don't know if the code you most of you use now but is just an example:
-find this code:
try
{
URLConnection con = new URL(topzoneUrl).openConnection();
con.addRequestProperty("User-Agent", "Mozilla/4.76");
isr = new InputStreamReader(con.getInputStream());
br = new BufferedReader(isr);
boolean got = false;
String line;
while ((line = br.readLine()) != null)
{
if (line.contains("<div class=\"rank\"><div class=\"votes2\">Votes:<br>") && !got)
{
got = true;
int votes = Integer.valueOf(line.split("<div class=\"rank\"><div class=\"votes2\">Votes:<br>")[1].replace("</div></div>", ""));
return votes;
}
}
br.close();
isr.close();
}
- with this code:
try
{
URLConnection con = new URL(topzoneUrl).openConnection();
con.addRequestProperty("User-Agent", "L2TopZone");
isr = new InputStreamReader(con.getInputStream());
br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null)
{
int votes = Integer.valueOf(line);
return votes;
}
br.close();
isr.close();
}
- compile and you are ready.
For any other vote rewards that do not fit with this 2 examples please post here your code and I will give you the solution.
Good luck.
Linkback: https://l2topzone.com/forum/index.php?topic=25668.0