My vote system was working correctly,but today it doesnt? any help? thanks
/*
* 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 com.l2jfrozen.gameserver.handler;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.apache.log4j.Logger;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.Announcements;
import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.util.CloseUtil;
import com.l2jfrozen.util.database.L2DatabaseFactory;
public class VoteHandler
{
protected static final Logger LOGGER = Logger.getLogger(VoteHandler.class);
public VoteHandler()
{
}
protected static int getTopZoneVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(Config.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"))
{
String votesLine = inputLine;
votes = Integer.valueOf(votesLine.split(">")[2].replace("</div", ""));
break;
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
return votes;
}
public static void tzvote(final L2PcInstance player)
{
long LastTZVote = 0L;
long voteDelay = 43200000L;
final int actualvotes;
actualvotes = getTopZoneVotes();
class tzvotetask implements Runnable
{
private final L2PcInstance p;
public tzvotetask(L2PcInstance player)
{
p = player;
}
@Override
public void run()
{
if (actualvotes < getTopZoneVotes())
{
p.setIsVoting(false);
VoteHandler.updateLastTZVote(p);
p.sendPacket(new ExShowScreenMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.", 6000));
p.sendMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.");
player.getInventory().addItem("TZreward", 7570, 10, player, null);
}
else
{
p.setIsVoting(false);
p.sendPacket(new ExShowScreenMessage("You didn't vote. Try Again Later", 6000));
p.sendMessage("You didn't vote. Try Again Later.");
}
}
}
PreparedStatement statement = null;
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
statement = con.prepareStatement("SELECT LastTZVote FROM characters WHERE obj_Id=?");
statement.setInt(1, player.getObjectId());
ResultSet rset = statement.executeQuery();
while (rset.next())
{
LastTZVote = rset.getLong("LastTZVote");
}
rset.close();
rset = null;
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
if ((LastTZVote + voteDelay) < System.currentTimeMillis())
{
for (L2PcInstance actualchar : L2World.getInstance().getAllPlayers())
{
if (actualchar.isVoting())
{
player.sendPacket(new ExShowScreenMessage(actualchar.getName()+", is voting now. Please wait for a while.", 6000));
player.sendMessage(actualchar.getName()+", is voting now. Please wait for a while.");
return;
}
}
player.setIsVoting(true);
player.sendPacket(new ExShowScreenMessage("You have 40 Seconds to vote on Topzone.", 6000));
player.sendMessage("You have 40 Seconds to vote on Topzone.");
ThreadPoolManager.getInstance().scheduleGeneral(new tzvotetask(player), 40 * 880);
}
else
{
player.sendPacket(new ExShowScreenMessage("You can vote only once every 12 hours.", 6000));
player.sendMessage("You can vote only once every 12 hours.");
}
}
public static void updateLastTZVote(L2PcInstance player)
{
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
PreparedStatement statement = con.prepareStatement("UPDATE characters SET LastTZVote=? WHERE obj_Id=?");
statement.setLong(1, System.currentTimeMillis());
statement.setInt(2, player.getObjectId());
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
}
protected static int getHopZoneVotes()
{
int votes = -1;
try
{
final WebClient webClient = new WebClient(BrowserVersion.CHROME);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setPrintContentOnFailingStatusCode(false);
webClient.setJavaScriptEngine(new JavaScriptEngine(webClient));
final HtmlPage page = webClient.getPage(Config.VOTES_SITE_HOPZONE_URL);
String fullPage = page.asXml();
int constrainA = fullPage.indexOf("rank anonymous tooltip") + 24;
String voteSection = fullPage.substring(constrainA);
int constrainB = voteSection.indexOf("span") - 2;
voteSection = voteSection.substring(0, constrainB).trim();
votes = Integer.parseInt(voteSection);
page.cleanUp();
webClient.getJavaScriptEngine().shutdown();
webClient.closeAllWindows();
}
catch (IOException e)
{
System.out.println("[VoteRewardManager]: Problem occured while getting Hopzone votes. Error Trace: " + e.getMessage());
}
return votes;
}
public static void HZvote(final L2PcInstance player)
{
long LastHZVote = 0L;
long voteDelay = 43200000L;
final int actualvotes;
actualvotes = getHopZoneVotes();
class hpvotetask implements Runnable
{
private final L2PcInstance p;
public hpvotetask(L2PcInstance player)
{
p = player;
}
@Override
public void run()
{
if (actualvotes < getHopZoneVotes())
{
p.setIsVoting(false);
VoteHandler.updateLastHZVote(p);
p.sendPacket(new ExShowScreenMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.", 6000));
p.sendMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.");
player.getInventory().addItem("TZreward", 7570, 10, player, null);
}
else
{
p.setIsVoting(false);
p.sendPacket(new ExShowScreenMessage("You didn't vote. Try Again Later", 6000));
p.sendMessage("You didn't vote. Try Again Later.");
}
}
}
PreparedStatement statement = null;
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
statement = con.prepareStatement("SELECT LastHZVote FROM characters WHERE obj_Id=?");
statement.setInt(1, player.getObjectId());
ResultSet rset = statement.executeQuery();
while (rset.next())
{
LastHZVote = rset.getLong("LastHZVote");
}
rset.close();
rset = null;
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
if ((LastHZVote + voteDelay) < System.currentTimeMillis())
{
for (L2PcInstance actualchar : L2World.getInstance().getAllPlayers())
{
if (actualchar.isVoting())
{
player.sendPacket(new ExShowScreenMessage(actualchar.getName()+", is voting now. Please wait for a while.", 6000));
player.sendMessage(actualchar.getName()+", is voting now. Please wait for a while.");
return;
}
}
player.setIsVoting(true);
player.sendPacket(new ExShowScreenMessage("You have 40 Seconds to vote on Hopzone.", 6000));
player.sendMessage("You have 40 Seconds to vote on Hopzone.");
ThreadPoolManager.getInstance().scheduleGeneral(new hpvotetask(player), 40 * 880);
}
else
{
player.sendPacket(new ExShowScreenMessage("You can vote only once every 12 hours.", 6000));
player.sendMessage("You can vote only once every 12 hours");
}
}
public static void updateLastHZVote(L2PcInstance player)
{
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
PreparedStatement statement = con.prepareStatement("UPDATE characters SET LastHZVote=? WHERE obj_Id=?");
statement.setLong(1, System.currentTimeMillis());
statement.setInt(2, player.getObjectId());
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
}
protected static int getL2NetworkVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(Config.VOTES_SITE_L2NETWORK_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2Network");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("color:#e7ebf2"))
{
votes = Integer.valueOf(inputLine.split(">")[2].replace("</b", ""));
break;
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
return votes;
}
public static void NZvote(final L2PcInstance player)
{
long LastNZVote = 0L;
long voteDelay = 43200000L;
final int actualvotes;
actualvotes = getL2NetworkVotes();
class nzvotetask implements Runnable
{
private final L2PcInstance p;
public nzvotetask(L2PcInstance player)
{
p = player;
}
@Override
public void run()
{
if (actualvotes < getL2NetworkVotes())
{
p.setIsVoting(false);
VoteHandler.updateLastNZVote(p);
p.sendPacket(new ExShowScreenMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.", 6000));
p.sendMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.");
player.getInventory().addItem("NZreward", 7570, 10, player, null);
}
else
{
p.setIsVoting(false);
p.sendPacket(new ExShowScreenMessage("You didn't vote. Try Again Later", 6000));
p.sendMessage("You didn't vote. Try Again Later.");
}
}
}
PreparedStatement statement = null;
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
statement = con.prepareStatement("SELECT LastNZVote FROM characters WHERE obj_Id=?");
statement.setInt(1, player.getObjectId());
ResultSet rset = statement.executeQuery();
while (rset.next())
{
LastNZVote = rset.getLong("LastNZVote");
}
rset.close();
rset = null;
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
if ((LastNZVote + voteDelay) < System.currentTimeMillis())
{
for (L2PcInstance actualchar : L2World.getInstance().getAllPlayers())
{
if (actualchar.isVoting())
{
player.sendPacket(new ExShowScreenMessage(actualchar.getName()+", is voting now. Please wait for a while.", 6000));
player.sendMessage(actualchar.getName()+", is voting now. Please wait for a while.");
return;
}
}
player.setIsVoting(true);
player.setIsVoting(true);
player.sendPacket(new ExShowScreenMessage("You have 40 Seconds to vote on Network.", 6000));
player.sendMessage("You have 40 Seconds to vote on Network.");
ThreadPoolManager.getInstance().scheduleGeneral(new nzvotetask(player), 40 * 880);
}
else
{
player.sendPacket(new ExShowScreenMessage("You can vote only once every 12 hours.", 6000));
player.sendMessage("You can vote only once every 12 hours.");
}
}
public static void updateLastNZVote(L2PcInstance player)
{
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
PreparedStatement statement = con.prepareStatement("UPDATE characters SET LastNZVote=? WHERE obj_Id=?");
statement.setLong(1, System.currentTimeMillis());
statement.setInt(2, player.getObjectId());
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
}
}
autovoterewardhandler
package com.l2jfrozen.gameserver.handler;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.Announcements;
import com.l2jfrozen.gameserver.powerpak.PowerPakConfig;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
public class AutoVoteRewardHandler
{
protected static final Logger LOGGER = Logger.getLogger(AutoVoteRewardHandler.class);
private int _l2networkVotesCount = 0;
private int hopzoneVotesCount = 0;
private int topzoneVotesCount = 0;
protected List<String> already_rewarded;
protected static boolean l2network = false;
protected static boolean topzone = false;
protected static boolean hopzone = false;
private AutoVoteRewardHandler()
{
LOGGER.info("Vote Reward System Initiated.");
if (hopzone)
{
int hopzone_votes = getHopZoneVotes();
if (hopzone_votes == -1)
{
hopzone_votes = 0;
}
setHopZoneVoteCount(hopzone_votes);
}
if (l2network)
{
int l2network_votes = getL2NetworkVotes();
if (l2network_votes == -1)
{
l2network_votes = 0;
}
setL2NetworkVoteCount(l2network_votes);
}
if (topzone)
{
int topzone_votes = getTopZoneVotes();
if (topzone_votes == -1)
{
topzone_votes = 0;
}
setTopZoneVoteCount(topzone_votes);
}
ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), 1000 * 60 * PowerPakConfig.VOTES_SYSYEM_INITIAL_DELAY, 1000 * 60 * PowerPakConfig.VOTES_SYSYEM_STEP_DELAY);
}
protected class AutoReward implements Runnable
{
@Override
public void run()
{
final int minutes = (PowerPakConfig.VOTES_SYSYEM_STEP_DELAY / 1000) / 60;
if (hopzone)
{
final int hopzone_votes = getHopZoneVotes();
if (hopzone_votes != -1)
{
LOGGER.info("Server on HopZone have: " + hopzone_votes +" Votes!");
Announcements.getInstance().gameAnnounceToAll("[Vote System] L2Server Votes on Hopzone " + hopzone_votes);
if (hopzone_votes != 0 && hopzone_votes >= getHopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD)
{
already_rewarded = new ArrayList<>();
final Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
Announcements.getInstance().gameAnnounceToAll("[Vote System] Great Work! Check your inventory for Reward!!");
// L2ItemInstance item;
for (final L2PcInstance player : pls)
{
if (player != null && !player.isInOfflineMode() && player.isOnline() == 1)
{
if (player._active_boxes <= 1 || (player._active_boxes > 1 && checkSingleBox(player)))
{
final Set<Integer> items = PowerPakConfig.VOTES_REWARDS_LIST.keySet();
for (final Integer i : items)
{
// item = player.getInventory().getItemByItemId(i);
// TODO: check on maxstack for item
player.addItem("reward", i, PowerPakConfig.VOTES_REWARDS_LIST.get(i), player, true);
}
}
}
}
setHopZoneVoteCount(hopzone_votes);
}
Announcements.getInstance().gameAnnounceToAll("[Vote System] Next Reward in " + minutes + " minutes at " + (getHopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) + " votes");
Announcements.getInstance().gameAnnounceToAll("[Vote System] " + PowerPakConfig.SERVER_WEB_SITE);
}
}
if (topzone && hopzone && PowerPakConfig.VOTES_SYSYEM_STEP_DELAY > 0)
try
{
Thread.sleep(PowerPakConfig.VOTES_SYSYEM_STEP_DELAY / 2);
}
catch (final InterruptedException e)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
}
if (topzone)
{
final int topzone_votes = getTopZoneVotes();
if (topzone_votes != -1)
{
LOGGER.info("Server on TopZone have: " + topzone_votes +" Votes!");
Announcements.getInstance().gameAnnounceToAll("[Vote System] L2Server Votes on Topzone " + topzone_votes);
if (topzone_votes != 0 && topzone_votes >= getTopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD)
{
already_rewarded = new ArrayList<>();
final Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
Announcements.getInstance().gameAnnounceToAll("[Vote System] Great Work! Check your inventory for Reward!!");
// L2ItemInstance item;
for (final L2PcInstance player : pls)
{
if (player != null && !player.isInOfflineMode() && player.isOnline() == 1)
{
if (player._active_boxes <= 1 || (player._active_boxes > 1 && checkSingleBox(player)))
{
final Set<Integer> items = PowerPakConfig.VOTES_REWARDS_LIST.keySet();
for (final Integer i : items)
{
// item = player.getInventory().getItemByItemId(i);
// TODO: check on maxstack for item
player.addItem("reward", i, PowerPakConfig.VOTES_REWARDS_LIST.get(i), player, true);
}
}
}
}
setTopZoneVoteCount(topzone_votes);
}
Announcements.getInstance().gameAnnounceToAll("[Vote System] Next Reward in " + minutes + " minutes at " + (getTopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) + " votes");
Announcements.getInstance().gameAnnounceToAll("[Vote System] " + PowerPakConfig.SERVER_WEB_SITE);
}
}
if (topzone && hopzone && l2network && PowerPakConfig.VOTES_SYSYEM_STEP_DELAY > 0)
{
try
{
Thread.sleep(PowerPakConfig.VOTES_SYSYEM_STEP_DELAY / 2);
}
catch (final InterruptedException e)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
}
}
if (l2network)
{
final int l2network_votes = getL2NetworkVotes();
if (l2network_votes != -1)
{
LOGGER.info("Server on L2NetWork have: " + l2network_votes +" Votes!");
Announcements.getInstance().gameAnnounceToAll("[Vote System] L2Server Votes on L2Network " + l2network_votes);
if (l2network_votes != 0 && l2network_votes >= getL2NetworkVoteCount() + PowerPakConfig.VOTES_FOR_REWARD)
{
already_rewarded = new ArrayList<>();
final Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
Announcements.getInstance().gameAnnounceToAll("[Vote System] Great Work! Check your inventory for Reward!!");
// L2ItemInstance item;
for (final L2PcInstance player : pls)
{
if (player != null && !player.isInOfflineMode() && player.isOnline() == 1)
{
if (player._active_boxes <= 1 || (player._active_boxes > 1 && checkSingleBox(player)))
{
final Set<Integer> items = PowerPakConfig.VOTES_REWARDS_LIST.keySet();
for (final Integer i : items)
{
// item = player.getInventory().getItemByItemId(i);
// TODO: check on maxstack for item
player.addItem("reward", i, PowerPakConfig.VOTES_REWARDS_LIST.get(i), player, true);
}
}
}
}
setL2NetworkVoteCount(l2network_votes);
}
Announcements.getInstance().gameAnnounceToAll("[Vote System] Next Reward in " + minutes + " minutes at " + (getL2NetworkVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) + " votes");
Announcements.getInstance().gameAnnounceToAll("[Vote System] " + PowerPakConfig.SERVER_WEB_SITE);
}
}
}
}
protected boolean checkSingleBox(final L2PcInstance player)
{
if (player.getClient() != null && player.getClient().getConnection() != null && !player.getClient().getConnection().isClosed() && !player.isInOfflineMode())
{
final String playerip = player.getClient().getConnection().getInetAddress().getHostAddress();
if (already_rewarded.contains(playerip))
return false;
already_rewarded.add(playerip);
return true;
}
return false;
}
protected int getHopZoneVotes()
{
int votes;
votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
String inputLine;
url = new URL(PowerPakConfig.VOTES_SITE_HOPZONE_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "Mozilla/4.76");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
while ((inputLine = in.readLine()) != null)
{
if (!inputLine.contains("rank anonymous tooltip"))
continue;
votes = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
break;
}
}
catch (final Exception e)
{
LOGGER.warn("[AutoVoteReward] Server HOPZONE is offline or something is wrong in link");
Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] HOPZONE is offline. We will check reward as it will be online again");
}
finally
{
if (in != null)
try
{
in.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (isr != null)
try
{
isr.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (is != null)
try
{
is.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
}
return votes;
}
protected int getTopZoneVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
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;
}
}
catch (final Exception e)
{
LOGGER.warn("[AutoVoteReward] Server TOPZONE is offline or something is wrong in link");
// Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] TOPZONE is offline. We will check reward as it will be online again");
// e.printStackTrace();
}
finally
{
if (in != null)
try
{
in.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (isr != null)
try
{
isr.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (is != null)
try
{
is.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
}
return votes;
}
protected int getL2NetworkVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(PowerPakConfig.VOTES_SITE_L2NETWORK_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2Network");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("color:#e7ebf2"))
{
votes = Integer.valueOf(inputLine.split(">")[2].replace("</b", ""));
break;
}
}
}
catch (final Exception e)
{
LOGGER.warn("[AutoVoteReward] Server L2NETWORK is offline or something is wrong in link");
// e.printStackTrace();
}
finally
{
if (in != null)
try
{
in.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (isr != null)
try
{
isr.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (is != null)
try
{
is.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
}
return votes;
}
protected void setHopZoneVoteCount(final int voteCount)
{
hopzoneVotesCount = voteCount;
}
protected int getHopZoneVoteCount()
{
return hopzoneVotesCount;
}
protected void setTopZoneVoteCount(final int voteCount)
{
topzoneVotesCount = voteCount;
}
protected int getTopZoneVoteCount()
{
return topzoneVotesCount;
}
protected void setL2NetworkVoteCount(final int voteCount)
{
_l2networkVotesCount = voteCount;
}
protected int getL2NetworkVoteCount()
{
return _l2networkVotesCount;
}
public static AutoVoteRewardHandler getInstance()
{
Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);
if (PowerPakConfig.VOTES_SITE_HOPZONE_URL != null && !PowerPakConfig.VOTES_SITE_HOPZONE_URL.equals(""))
{
hopzone = true;
}
if (PowerPakConfig.VOTES_SITE_TOPZONE_URL != null && !PowerPakConfig.VOTES_SITE_TOPZONE_URL.equals(""))
{
topzone = true;
}
if (PowerPakConfig.VOTES_SITE_L2NETWORK_URL != null && !PowerPakConfig.VOTES_SITE_L2NETWORK_URL.equals(""))
{
l2network = true;
}
if (topzone || hopzone || l2network)
return SingletonHolder._instance;
return null;
}
@SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler();
}
}
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
I would like to know about the Acis base of the data pack I use. The server source and server file could not find that information. I respectfully ask for the help of masters.🥲
Artificial Intelligence for all Chronicles. Developed in L2 HighFive branch since 2023 but it can be adapted to any project including Fand-C, aCis, Frozen, Scripts even compiled
projects such as Lucera with some aditional cost.
Features:
1. Grouped of templates to create your own BOT (including skill, items, appearance, sex e.t.c.)
2. Bot can participate in Olympiad (+ any event with extra cost base on your event engine)
3. Bot walk nearby NPC to receive buff, receive equipment and teleport to any other area
4. Bot will accept party & clan invitation and follow party leader to wherever he go including teleport
6. Bot will trade player back dropped items from PK or fallen Raid Bosses after they visit a peace zone
7. Bot will open store and sell configurable item in configurable prices to players.
8. Bot will attack and cast spells in a realistic way. All classes are used including buffers, summoners, bishops e.t.c.
9. Buffer and bishops will cast buff to party members when player has no available or overriden buffs.
10. Bot will enchant their equipent and re-purchase upon failure. Their weapon will also switched between hero weapon and retail weapon when they need to.
11. Bot can move in complex map system and find monsters or players but they can also follow routes for specific paths using configurable XML if you want to.
Preview of some features:
Olympiad
Trade
Store
PvP
Example of a single configurable template in XML:
https://pastebin.com/RXZVGCfA
Price:
270 Euro (Compiled) - 450 Euro (Source)
Contact Me
Discord: https://discord.gg/gKAsAhJNuq
MaxCheaters: https://maxcheaters.com/profile/243647-out-of-time/
Gmail: l2outoftime@gmail.com
RCS Message: +30 698 740 8501
Good day!
Due to the increasing number of questions, "Do you provide services for the client?" - I decided to answer with a separate topic.
I provide services for editing/modifying the client and individual files, namely:
1. Transfer/Creation/Editing locations, geodata.
2. All kinds of work with NPCs, including transfer, animation, adding effects to them and logos.
3. Actually, Transfer/Creation/Edit any EFFECTS, including Abnormal Effects.
4. Any work with weapons, armor, accessories and everything related to it.
5. Create or edit textures, including dynamic textures.
6. Creating a Lobby Screen, Lobby Char Selection (character selection window) and Lobby Char Creation (character creation window).
What I don't do:
1. Coding in any form (except for CB).
I started publishing my work recently, here - YouTube
And here - RuTube
If required, I respect confidentiality.
Any other questions? Welcome to Telegram or PM.
Question
Saruman
My vote system was working correctly,but today it doesnt? any help? thanks
autovoterewardhandler
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.