Jump to content

Recommended Posts

Posted (edited)

Here is a individual vote manager (L2JHellas) elfocrash author. Htmls style mine.
Its for frozen.
 

Updated 24/11

Hopzone, Topzone working fine.

Dupe exploit fixed. (Need test)

 

http://imgur.com/B7pkSBJ

http://imgur.com/B7pkSBJ

 
create a new package Extensions.Vote
inside 2 files

/*
 * 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 Extensions.Vote;

public class VoteConfig
{
	public VoteConfig()
	{
	}
}

 
 

/*
 * 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 Extensions.Vote;

import java.io.BufferedReader;
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 java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

import Extensions.Vote.Tasks.MonthlyResetTask;
import Extensions.Vote.Tasks.TriesResetTask;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.util.database.L2DatabaseFactory;

public class VoteManager
{
	protected static final Logger _log = Logger.getLogger(VoteManager.class.getName());

	private static boolean hasVotedHop;
	private static boolean hasVotedTop;

	public VoteManager()
	{
	}

	public static void load()
	{
		_log.log(Level.INFO, "VoteManager: initialized.");
		TriesResetTask.getInstance();
		MonthlyResetTask.getInstance();
	}

    public static int getHopZoneVotes()
    {
            InputStreamReader isr = null;
            BufferedReader br = null;
           
            try
            {
                    URLConnection con = new URL(Config.VOTE_LINK_HOPZONE).openConnection();
                    con.addRequestProperty("User-Agent", "Mozilla/4.76");
                    isr = new InputStreamReader(con.getInputStream());
                    br = new BufferedReader(isr);
                   
                    String line;
                    while ((line = br.readLine()) != null)
                    {
                            if (line.contains("<li><span class=\"rank anonymous tooltip\" title"))
                            {
                                    int votes = Integer.valueOf(line.split(">")[2].replace("</span", ""));
                                    return votes;
                            }
                    }
                   
                    br.close();
                    isr.close();
            }
            catch (Exception e)
    		{
    			if (Config.DEVELOPER)
    			{
    				e.printStackTrace();
    			}
    		}
           
            return -1;
    }

    			protected static int getTopZoneVotes()
    			{
	               InputStreamReader isr = null;
	               BufferedReader br = null;
	              
	               try
	               {
	                       URLConnection con = new URL(Config.VOTE_LINK_TOPZONE).openConnection();
	                       con.addRequestProperty("User-Agent", "L2TopZone");
	                       isr = new InputStreamReader(con.getInputStream());
	                       br = new BufferedReader(isr);
	                      
	                       String line;
	                       while ((line = br.readLine()) != null)
	                       {
	                               if (line.contains("</span></small>"))
	                               {
	                                       int votes = Integer.valueOf(line.split(">")[9].replace("</span", ""));
	                                       return votes;
	                               }
	                       }
	                      
	                       br.close();
	                       isr.close();
	               }
	               catch (Exception e)
		       		{
		       			if (Config.DEVELOPER)
		       			{
		       				e.printStackTrace();
		       			}
		       		}
	              
	               return -1;
	       }

	public static String hopCd(L2PcInstance player)
	{
		long hopCdMs = 0;
		long voteDelay = 43200000L;
		PreparedStatement statement = null;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			statement = con.prepareStatement("SELECT lastVoteHopzone FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());

			ResultSet rset = statement.executeQuery();

			while (rset.next())
			{
				hopCdMs = rset.getLong("lastVoteHopzone");
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
		 
		SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");

		Date resultdate = new Date(hopCdMs + voteDelay);
		return sdf.format(resultdate);
	}

	public static String topCd(L2PcInstance player)
	{
		long topCdMs = 0;
		long voteDelay = 43200000L;
		PreparedStatement statement = null;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			statement = con.prepareStatement("SELECT lastVoteTopzone FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());

			ResultSet rset = statement.executeQuery();

			while (rset.next())
			{
				topCdMs = rset.getLong("lastVoteTopzone");
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
		 
		SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");

		Date resultdate = new Date(topCdMs + voteDelay);
		return sdf.format(resultdate);
	}

	public static String whosVoting()
	{
		for (L2PcInstance voter : L2World.getInstance().getAllPlayers())
		{
			if (voter.isVoting())
			{
				return voter.getName();
			}
		}
		return "None";
	}

	public static void hopvote(final L2PcInstance player)
	{
		long lastVoteHopzone = 0L;
		long voteDelay = 43200000L;
		final int firstvoteshop;

		firstvoteshop = getHopZoneVotes();

		class hopvotetask implements Runnable
		{
			private final L2PcInstance p;

			public hopvotetask(L2PcInstance player)
			{
				p = player;
			}

			@Override
			public void run()
			{
				if (firstvoteshop < getHopZoneVotes())
				{
					p.setIsVoting(false);
					p.setIsImobilised(false);
					VoteManager.setHasVotedHop(player);
					p.sendMessage("Thank you for voting for us!");
					VoteManager.updateLastVoteHopzone(p);
					VoteManager.updateVotes(p);
				}
				else
				{
					p.setIsVoting(false);
					p.setIsImobilised(false);
					p.sendMessage("You did not vote.Please try again.");
					VoteManager.setTries(player, VoteManager.getTries(p) - 1);
				}
			}

		}

		PreparedStatement statement = null;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			statement = con.prepareStatement("SELECT lastVoteHopzone FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());

			ResultSet rset = statement.executeQuery();

			while (rset.next())
			{
				lastVoteHopzone = rset.getLong("lastVoteHopzone");
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }

		if (getTries(player) <= 0)
		{
			player.sendMessage("Due to your multiple failures in voting you lost your chance to vote today");
		}
		else if (((lastVoteHopzone + voteDelay) < System.currentTimeMillis()) && (getTries(player) > 0))
		{
			for (L2PcInstance j : L2World.getInstance().getAllPlayers())
			{
				if (j.isVoting())
				{
					player.sendMessage("Someone is already voting.Wait for your turn please!");
					return;
				}
			}

			player.setIsVoting(true);
			player.setIsImobilised(true);
			player.sendMessage("Go fast on the site and vote on the hopzone banner!");
			player.sendMessage("You have " + Config.SECS_TO_VOTE + " seconds.Hurry!");
			ThreadPoolManager.getInstance().scheduleGeneral(new hopvotetask(player), Config.SECS_TO_VOTE * 1000);
		}
		else if ((getTries(player) <= 0) && ((lastVoteHopzone + voteDelay) < System.currentTimeMillis()))
		{
			for (L2PcInstance j : L2World.getInstance().getAllPlayers())
			{
				if (j.isVoting())
				{
					player.sendMessage("Someone is already voting.Wait for your turn please!");
					return;
				}
			}

			player.setIsVoting(true);
			player.setIsImobilised(true);
			player.sendMessage("Go fast on the site and vote on the hopzone banner!");
			player.sendMessage("You have " + Config.SECS_TO_VOTE + " seconds.Hurry!");
			ThreadPoolManager.getInstance().scheduleGeneral(new hopvotetask(player), Config.SECS_TO_VOTE * 1000);

		}
		else
		{
			player.sendMessage("12 hours have to pass till you are able to vote again.");
		}

	}

	public static void topvote(final L2PcInstance player)
	{
		long lastVoteTopzone = 0L;
		long voteDelay = 43200000L;
		final int firstvotestop;

		firstvotestop = getTopZoneVotes();

		class topvotetask implements Runnable
		{
			private final L2PcInstance p;

			public topvotetask(L2PcInstance player)
			{
				p = player;
			}

			@Override
			public void run()
			{
				if (firstvotestop < getTopZoneVotes())
				{
					p.setIsVoting(false);
					p.setIsImobilised(false);
					VoteManager.setHasVotedTop(p);
					p.sendMessage("Thank you for voting for us!");
					VoteManager.updateLastVoteTopzone(p);
					VoteManager.updateVotes(p);
				}
				else
				{
					p.setIsVoting(false);
					p.setIsImobilised(false);
					p.sendMessage("You did not vote.Please try again.");
					VoteManager.setTries(p, VoteManager.getTries(p) - 1);
				}
			}

		}

		PreparedStatement statement = null;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			statement = con.prepareStatement("SELECT lastVoteTopzone FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());

			ResultSet rset = statement.executeQuery();

			while (rset.next())
			{
				lastVoteTopzone = rset.getLong("lastVoteTopzone");
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }

		if (getTries(player) <= 0)
		{
			player.sendMessage("Due to your multiple failures in voting you lost your chance to vote today");
		}
		else if ((getTries(player) <= 0) && ((lastVoteTopzone + voteDelay) < System.currentTimeMillis()))
		{
			for (L2PcInstance j : L2World.getInstance().getAllPlayers())
			{
				if (j.isVoting())
				{
					player.sendMessage("Someone is already voting.Wait for your turn please!");
					return;
				}
			}
			player.setIsVoting(true);
			player.setIsImobilised(true);
			player.sendMessage("Go fast on the site and vote on the topzone banner!");
			player.sendMessage((new StringBuilder()).append("You have ").append(Config.SECS_TO_VOTE).append(" seconds.Hurry!").toString());
			ThreadPoolManager.getInstance().scheduleGeneral(new topvotetask(player), Config.SECS_TO_VOTE * 1000);
		}
		else if (((lastVoteTopzone + voteDelay) < System.currentTimeMillis()) && (getTries(player) > 0))
		{
			for (L2PcInstance j : L2World.getInstance().getAllPlayers())
			{
				if (j.isVoting())
				{
					player.sendMessage("Someone is already voting.Wait for your turn please!");
					return;
				}
			}
			player.setIsVoting(true);
			player.setIsImobilised(true);
			player.sendMessage("Go fast on the site and vote on the topzone banner!");
			player.sendMessage((new StringBuilder()).append("You have ").append(Config.SECS_TO_VOTE).append(" seconds.Hurry!").toString());
			ThreadPoolManager.getInstance().scheduleGeneral(new topvotetask(player), Config.SECS_TO_VOTE * 1000);
		}
		else
		{
			player.sendMessage("12 hours have to pass till you are able to vote again.");
		}

	}

	public static void hasVotedHop(L2PcInstance player)
	{
		int hasVotedHop = -1;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT hasVotedHop FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());

			ResultSet rset = statement.executeQuery();

			while (rset.next())
			{
				hasVotedHop = rset.getInt("hasVotedHop");
			}

			if (hasVotedHop == 1)
			{
				setHasVotedHop(true);
			}
			else if (hasVotedHop == 0)
			{
				setHasVotedHop(false);
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	public static void hasVotedTop(L2PcInstance player)
	{
		int hasVotedTop = -1;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT hasVotedTop FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());

			ResultSet rset = statement.executeQuery();

			while (rset.next())
			{
				hasVotedTop = rset.getInt("hasVotedTop");
			}

			if (hasVotedTop == 1)
			{
				setHasVotedTop(true);
			}
			else if (hasVotedTop == 0)
			{
				setHasVotedTop(false);
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	public static void updateVotes(L2PcInstance activeChar)
	{
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET monthVotes=?, totalVotes=? WHERE obj_Id=?");

			statement.setInt(1, getMonthVotes(activeChar) + 1);
			statement.setInt(2, getTotalVotes(activeChar) + 1);
			statement.setInt(3, activeChar.getObjectId());
			statement.execute();
			statement.close();
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	public static void setHasVotedHop(L2PcInstance activeChar)
	{
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedHop=? WHERE obj_Id=?");

			statement.setInt(1, 1);
			statement.setInt(2, activeChar.getObjectId());
			statement.execute();
			statement.close();
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	public static void setHasVotedTop(L2PcInstance activeChar)
	{
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedTop=? WHERE obj_Id=?");

			statement.setInt(1, 1);
			statement.setInt(2, activeChar.getObjectId());
			statement.execute();
			statement.close();
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	public static void setHasNotVotedHop(L2PcInstance activeChar)
	{
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedHop=? WHERE obj_Id=?");

			statement.setInt(1, 0);
			statement.setInt(2, activeChar.getObjectId());
			statement.execute();
			statement.close();
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	public static void setHasNotVotedTop(L2PcInstance activeChar)
	{
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedTop=? WHERE obj_Id=?");

			statement.setInt(1, 0);
			statement.setInt(2, activeChar.getObjectId());
			statement.execute();
			statement.close();
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	public static int getTries(L2PcInstance player)
	{
		int tries = -1;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT tries FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());
			for (ResultSet rset = statement.executeQuery(); rset.next();)
			{
				tries = rset.getInt("tries");
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
		return tries;
	}

	public static void setTries(L2PcInstance player, int tries)
	{
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET tries=? WHERE obj_Id=?");

			statement.setInt(1, tries);
			statement.setInt(2, player.getObjectId());
			statement.execute();
			statement.close();
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	public static int getMonthVotes(L2PcInstance player)
	{
		int monthVotes = -1;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT monthVotes FROM characters WHERE obj_Id=?");

			statement.setInt(1, player.getObjectId());
			for (ResultSet rset = statement.executeQuery(); rset.next();)
			{
				monthVotes = rset.getInt("monthVotes");
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
		return monthVotes;
	}

	public static int getTotalVotes(L2PcInstance player)
	{
		int totalVotes = -1;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT totalVotes FROM characters WHERE obj_Id=?");

			statement.setInt(1, player.getObjectId());
			for (ResultSet rset = statement.executeQuery(); rset.next();)
			{
				totalVotes = rset.getInt("totalVotes");
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
		return totalVotes;
	}

	public static int getBigTotalVotes(L2PcInstance player)
	{
		int bigTotalVotes = -1;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT SUM(totalVotes) FROM characters");

			for (ResultSet rset = statement.executeQuery(); rset.next();)
			{
				bigTotalVotes = rset.getInt("SUM(totalVotes)");
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
		return bigTotalVotes;
	}

	public static int getBigMonthVotes(L2PcInstance player)
	{
		int bigMonthVotes = -1;
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT SUM(monthVotes) FROM characters");

			for (ResultSet rset = statement.executeQuery(); rset.next();)
			{
				bigMonthVotes = rset.getInt("SUM(monthVotes)");
			}
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
		return bigMonthVotes;
	}

	public static void updateLastVoteHopzone(L2PcInstance player)
	{
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET lastVoteHopzone=? WHERE obj_Id=?");
			statement.setLong(1, System.currentTimeMillis());
			statement.setInt(2, player.getObjectId());
			statement.execute();
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	public static void updateLastVoteTopzone(L2PcInstance player)
	{
		Connection con = null;
		try
		{
		con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET lastVoteTopzone=? WHERE obj_Id=?");
			statement.setLong(1, System.currentTimeMillis());
			statement.setInt(2, player.getObjectId());
			statement.execute();
		}
		 catch (Exception e)
		 {
		 _log.warning(" ");
		 }
		 finally
		 {
		 try
		 {
		 if (con != null)
		 con.close();
		 }
		 catch (SQLException e)
		 {
		 _log.warning("Failed to close database connection!");
		 }
		 }
	}

	// Getters and Setters
	public static boolean hasVotedHop()
	{
		return hasVotedHop;
	}

	public static void setHasVotedHop(boolean hasVotedHop)
	{
		VoteManager.hasVotedHop = hasVotedHop;
	}

	public static boolean hasVotedTop()
	{
		return hasVotedTop;
	}

	public static void setHasVotedTop(boolean hasVotedTop)
	{
		VoteManager.hasVotedTop = hasVotedTop;
	}
}

 

create a new package Extensions.Vote.Tasks
inside 2 files

/*
 * 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 Extensions.Vote.Tasks;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.util.database.L2DatabaseFactory;

public class MonthlyResetTask
{
	protected static final Logger _log = Logger.getLogger(MonthlyResetTask.class.getName());

	public MonthlyResetTask()
	{
	}

	public static void getInstance()
	{
		ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
		{
			@Override
			public void run()
			{
				Connection con = null;
				try
				{
				con = L2DatabaseFactory.getInstance().getConnection();
					PreparedStatement statement = con.prepareStatement("UPDATE characters SET monthVotes=?");

					statement.setInt(1, 0);
					statement.execute();
					statement.close();
				}
				 catch (Exception e)
				 {
				 _log.warning(" ");
				 }
				 finally
				 {
				 try
				 {
				 if (con != null)
				 con.close();
				 }
				 catch (SQLException e)
				 {
				 _log.warning("Failed to close database connection!");
				 }
				 }
			}
		}, getValidationTime());
	}

	private static long getValidationTime()
	{
		Calendar cld = Calendar.getInstance();
		cld.set(5, 1);
		long time = cld.getTimeInMillis();
		if ((System.currentTimeMillis() - time) <= 0L)
		{
			long delay = cld.getTimeInMillis() - System.currentTimeMillis();
			return delay;
		}
		return 0L;
	}
}
/*
 * 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 Extensions.Vote.Tasks;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.util.database.L2DatabaseFactory;

public class TriesResetTask
{
	protected static final Logger _log = Logger.getLogger(TriesResetTask.class.getName());

	public TriesResetTask()
	{
	}

	public static void getInstance()
	{
		ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
		{
			@Override
			public void run()
			{
				Connection con = null;
				try
				{
				con = L2DatabaseFactory.getInstance().getConnection();
					PreparedStatement statement = con.prepareStatement("UPDATE characters SET tries=?");

					statement.setInt(1, 3);
					statement.execute();
					statement.close();
				}
				 catch (Exception e)
				 {
				 _log.warning(" ");
				 }
				 finally
				 {
				 try
				 {
				 if (con != null)
				 con.close();
				 }
				 catch (SQLException e)
				 {
				 _log.warning("Failed to close database connection!");
				 }
				 }
			}
		}, getValidationTime());
	}

	private static long getValidationTime()
	{
		Calendar cld = Calendar.getInstance();
		cld.set(11, 12);
		cld.set(12, 1);
		long time = cld.getTimeInMillis();
		if ((System.currentTimeMillis() - time) <= 0L)
		{
			long delay = cld.getTimeInMillis() - System.currentTimeMillis();
			return delay;
		}
		return 0L;
	}
}

now create a new file in instance L2VoteManagerInstance.java

/*
 * 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.model.actor.instance;

import javolution.text.TextBuilder;

import Extensions.Vote.VoteManager;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.ai.CtrlIntention;
import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;

public class L2VoteManagerInstance extends L2NpcInstance
{
public L2VoteManagerInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}

@Override
public void onBypassFeedback(final L2PcInstance player, String command)
{
if (player == null)
return;

if (command.startsWith("votehopzone"))
VoteManager.hopvote(player);

if (command.startsWith("votetopzone"))
VoteManager.topvote(player);

if (command.startsWith("rewards"))
showRewardsHtml(player);

if (command.startsWith("reward1"))
{
player.getInventory().addItem("reward", Config.VOTE_REWARD_ID1, Config.VOTE_REWARD_AMOUNT1, player, null);
player.sendMessage("Good choice!");
player.getInventory().updateDatabase(); // update database
VoteManager.setHasNotVotedHop(player);
VoteManager.setHasNotVotedTop(player);
VoteManager.setTries(player, VoteManager.getTries(player) + 1);
}
if (command.startsWith("reward2"))
{
player.getInventory().addItem("reward", Config.VOTE_REWARD_ID2, Config.VOTE_REWARD_AMOUNT2, player, null);
player.sendMessage("Good choice!");
player.getInventory().updateDatabase(); // update database
VoteManager.setHasNotVotedHop(player);
VoteManager.setHasNotVotedTop(player);
VoteManager.setTries(player, VoteManager.getTries(player) + 1);
}
if (command.startsWith("reward3"))
{
player.getInventory().addItem("reward", Config.VOTE_REWARD_ID3, Config.VOTE_REWARD_AMOUNT3, player, null);
player.sendMessage("Good choice!");
player.getInventory().updateDatabase(); // update database
VoteManager.setHasNotVotedHop(player);
VoteManager.setHasNotVotedTop(player);
VoteManager.setTries(player, VoteManager.getTries(player) + 1);
}
if (command.startsWith("reward4"))
{
player.getInventory().addItem("reward", Config.VOTE_REWARD_ID4, Config.VOTE_REWARD_AMOUNT4, player, null);
player.sendMessage("Good choice!");
player.getInventory().updateDatabase(); // update database
VoteManager.setHasNotVotedHop(player);
VoteManager.setHasNotVotedTop(player);
VoteManager.setTries(player, VoteManager.getTries(player) + 1);
}
}

@Override
public void onAction(L2PcInstance player)
{
if (this != player.getTarget())
{
player.setTarget(this);

player.sendPacket(new MyTargetSelected(getObjectId(), 0));

player.sendPacket(new ValidateLocation(this));
}
else if (!canInteract(player))
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
}
else
{
showHtmlWindow(player);
}
}

public void showHtmlWindow(L2PcInstance activeChar)
{
VoteManager.hasVotedHop(activeChar);
VoteManager.hasVotedTop(activeChar);

NpcHtmlMessage nhm = new NpcHtmlMessage(5);
TextBuilder tb = new TextBuilder("");

tb.append("<html><head><title>Lineage II Null - Vote Manager</title></head><body>");
tb.append("<center><img src=\"l2ui_ch3.herotower_deco\" width=256 height=32>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("<table bgcolor=000000 width=300 height=40>");
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"666666\">Welcome " + activeChar.getName() +" in Lineage II</font><font color=\"FF9900\"> -Null-</font><font color=\"666666\"> Server</font></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("<br>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("</center>");
tb.append("<center>");
tb.append("<table bgcolor=000000 width=300 height=12>");
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"666666\">Who's voting now:</font><font color=\"FF5555\"> " + VoteManager.whosVoting() +"</font></td>");
tb.append("</tr>");
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"666666\">Tries left:</font><font color=\"FF5555\"> " + VoteManager.getTries(activeChar) + "</font></td>");
tb.append("</tr>");
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"666666\">Your votes:</font><font color=\"FF5555\"> " + VoteManager.getTotalVotes(activeChar) +"</font></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("</center>");
if (!VoteManager.hasVotedHop() || !VoteManager.hasVotedTop())
{
tb.append("<center>");
tb.append("<table width=\"250\" cellpadding=\"5\">");
tb.append("<tr>");
tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><button action=\"bypass -h npc_" + getObjectId() + "_votehopzone\" width=256 height=64 back=\"VoteNpc.hopzone\" fore=\"VoteNpc.hopzone2\"></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("<table width=\"250\" cellpadding=\"5\">");
tb.append("<tr>");
tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><button action=\"bypass -h npc_" + getObjectId() + "_votetopzone\" width=256 height=64 back=\"VoteNpc.topzone\" fore=\"VoteNpc.topzone2\"></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("</center>");
}
if (VoteManager.hasVotedHop() && VoteManager.hasVotedTop())
{
tb.append("<br>");
tb.append("<center>");
tb.append("<img src=\"L2UI.SquareGray\" width=200 height=1>");
tb.append("<table border=0 bgcolor=000000 width=200 height=10>");
tb.append("<tr><td width=\"45\" valign=\"top\" align=\"center\"><a action=\"bypass -h npc_" + getObjectId() + "_rewards\"><font color=\"FF0000\">Show me the rewards</font></a></td></tr>");
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=200 height=1>");
tb.append("</center>");
tb.append("<br>");
}
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("<table border=0 bgcolor=000000 width=300 height=10>");
if (!VoteManager.hasVotedHop())
{
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"FF9900\">Hopzone:</font><font color=\"FF0000\"> Not Voted</font></td>");
}
if (VoteManager.hasVotedHop())
{
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"FF9900\">Hopzone:</font><font color=\"5EA82E\"> Voted</font></td>");
}
if (!VoteManager.hasVotedTop())
{
tb.append("<td width=\"1\" align=\"center\"><font color=\"505050\">|</font></td>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"FF9900\">Topzone:</font><font color=\"FF0000\"> Not Voted</font></td>");
tb.append("</tr>");
}
if (VoteManager.hasVotedTop())
{
tb.append("<td width=\"1\" align=\"center\"><font color=\"505050\">|</font></td>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"FF9900\">Topzone:</font><font color=\"5EA82E\"> Voted</font></td>");
tb.append("</tr>");
}
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("</center>");
tb.append("<br>");
tb.append("<center>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("<table border=0 bgcolor=000000 width=300 height=20>");
tb.append("<tr>");
tb.append("<td align=\"center\" width=\"300\"><font color=\"666666\">Vote for us :</font><font color=\"FF5555\"> www.L2Null.eu</font></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("</center>");
tb.append("</body></html>");

nhm.setHtml(tb.toString());
activeChar.sendPacket(nhm);
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}


public void showRewardsHtml(L2PcInstance player)
{
TextBuilder tb = new TextBuilder();
NpcHtmlMessage html = new NpcHtmlMessage(1);

tb.append("<html><head><title>Lineage II Null - Vote Manager</title></head><body>");
tb.append("<center><img src=\"l2ui_ch3.herotower_deco\" width=256 height=32>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("<table bgcolor=000000 width=300 height=40>");
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"666666\">Welcome " + player.getName() +" in Lineage II</font><font color=\"FF9900\"> -Null-</font></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("<br>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("</center>");
tb.append("<center>");
tb.append("<table bgcolor=000000 width=300 height=12>");
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"666666\">Who's voting now:</font><font color=\"FF5555\"> " + VoteManager.whosVoting() +"</font></td>");
tb.append("</tr>");
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"666666\">Tries left:</font><font color=\"FF5555\"> " + VoteManager.getTries(player) + "</font></td>");
tb.append("</tr>");
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"666666\">Your votes:</font><font color=\"FF5555\"> " + VoteManager.getTotalVotes(player) +"</font></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("</center>");
tb.append("<br>");
tb.append("<center>");
tb.append("<img src=\"L2UI.SquareGray\" width=200 height=1>");
tb.append("<table border=0 bgcolor=000000 width=200 height=10>");
tb.append("<tr><td width=\"200\" align=\"center\"><font color=\"FF0000\"><a action=\"bypass -h npc_" + getObjectId() + "_reward1\">"+ Config.VOTE_REWARD_AMOUNT1 +" "+ ItemTable.getInstance().getTemplate(Config.VOTE_REWARD_ID1).getName() +"</font></a></td></tr>");
tb.append("<tr><td width=\"200\" align=\"center\"><font color=\"FF0000\"><a action=\"bypass -h npc_" + getObjectId() + "_reward2\">"+ Config.VOTE_REWARD_AMOUNT2 +" "+ ItemTable.getInstance().getTemplate(Config.VOTE_REWARD_ID2).getName() +"</font></a></td></tr>");
tb.append("<tr><td width=\"200\" align=\"center\"><font color=\"FF0000\"><a action=\"bypass -h npc_" + getObjectId() + "_reward3\">"+ Config.VOTE_REWARD_AMOUNT3 +" "+ ItemTable.getInstance().getTemplate(Config.VOTE_REWARD_ID3).getName() +"</font></a></td></tr>");
if (VoteManager.getTotalVotes(player) >= Config.EXTRA_REW_VOTE_AM)
{
tb.append("<tr><td width=\"200\" align=\"center\"><font color=\"FF0000\"><a action=\"bypass -h npc_" + getObjectId() + "_reward4\">"+ Config.VOTE_REWARD_AMOUNT4 +" "+ ItemTable.getInstance().getTemplate(Config.VOTE_REWARD_ID4).getName() +"</font></a></td></tr>");
}
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=200 height=1>");
tb.append("</center>");
tb.append("<br>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("<table border=0 bgcolor=000000 width=300 height=10>");
if (!VoteManager.hasVotedHop())
{
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"FF9900\">Hopzone:</font><font color=\"FF0000\"> Not Voted</font></td>");
}
if (VoteManager.hasVotedHop())
{
tb.append("<tr>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"FF9900\">Hopzone:</font><font color=\"5EA82E\"> Voted</font></td>");
}
if (!VoteManager.hasVotedTop())
{
tb.append("<td width=\"1\" align=\"center\"><font color=\"505050\">|</font></td>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"FF9900\">Topzone:</font><font color=\"FF0000\"> Not Voted</font></td>");
tb.append("</tr>");
}
if (VoteManager.hasVotedTop())
{
tb.append("<td width=\"1\" align=\"center\"><font color=\"505050\">|</font></td>");
tb.append("<td width=\"300\" align=\"center\"><font color=\"FF9900\">Topzone:</font><font color=\"5EA82E\"> Voted</font></td>");
tb.append("</tr>");
}
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("</center>");
tb.append("<br>");
tb.append("<center>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("<table border=0 bgcolor=000000 width=300 height=20>");
tb.append("<tr>");
tb.append("<td align=\"center\" width=\"300\"><font color=\"666666\">Vote for us :</font><font color=\"FF5555\"> www.L2Null.eu</font></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
tb.append("</center>");
tb.append("</body></html>");

html.setHtml(tb.toString());
player.sendPacket(html);
player.sendPacket(ActionFailed.STATIC_PACKET);
}
}

 


in L2PcInstance.java
find this

private static final String RESTORE_CHARACTER = 

in the same line after 

aio,aio_end,

add 

lastVoteHopzone, lastVoteTopzone, hasVotedHop, hasVotedTop, monthVotes, totalVotes, tries

find

private long _lastTeleportAction = 0;

add

	private boolean _isVoting = false;
	
	public final boolean isVoting()
	{
		return _isVoting;
	}
	
	public final void setIsVoting(boolean value)
	{
		_isVoting = value;
	}
 private boolean hasVotedTop,hasVotedHop;
public boolean hasVotedBoth()

   {
       return hasVotedHop && hasVotedTop;
   }
   public void setHop(boolean target)
   {
       hasVotedHop=target;
   }
   public void setTop(boolean target)
   {
       hasVotedTop=target;
   }

private void loadVotes()
   {
       int flag=0;
       try (Connection con = L2DatabaseFactory.getInstance().getConnection())
       {
           PreparedStatement statement = con.prepareStatement("SELECT hasVotedTop FROM characters WHERE obj_Id=?");
           statement.setInt(1, getObjectId());
           ResultSet rset = statement.executeQuery();
           while (rset.next())
           {
               flag = rset.getInt("hasVotedTop");
           }
           if (flag == 1)
           {
               setTop(true);
           }
           else
           {
               setTop(false);
           }
       }
       catch (Exception e)
       {
           _log.log(Level.WARNING, "VoteManager: could not select hasVotedHop from characters " + e);
           if (Config.DEVELOPER)
           {
               e.printStackTrace();
           }
       }
       flag=0;
       try (Connection con = L2DatabaseFactory.getInstance().getConnection())
       {
           PreparedStatement statement = con.prepareStatement("SELECT hasVotedHop FROM characters WHERE obj_Id=?");
           statement.setInt(1, getObjectId());
           ResultSet rset = statement.executeQuery();
           while (rset.next())
           {
               flag = rset.getInt("hasVotedHop");
           }
           if (flag == 1)
           {
               setHop(true);
           }
           else
           {
               setHop(false);
           }
       }
       catch (Exception e)
       {
           _log.log(Level.WARNING, "VoteManager: could not select hasVotedHop from characters " + e);
           if (Config.DEVELOPER)
           {
               e.printStackTrace();
           }
       }
   }

 
find this line in PcInstance and add +

	public void onPlayerEnter()
	{
		startWarnUserTakeBreak();
              + loadVotes();

now in GameServer.java

+VoteManager.load();

Configs.java

        public static int HERO_CUSTOM_DAY;
+	public static String VOTE_LINK_HOPZONE;
+	public static String VOTE_LINK_TOPZONE;
+	public static int VOTE_REWARD_ID1;
+	public static int VOTE_REWARD_ID2;
+	public static int VOTE_REWARD_ID3;
+	public static int VOTE_REWARD_ID4;
+	public static int VOTE_REWARD_AMOUNT1;
+	public static int VOTE_REWARD_AMOUNT2;
+	public static int VOTE_REWARD_AMOUNT3;
+	public static int VOTE_REWARD_AMOUNT4;
+	public static int SECS_TO_VOTE;
+	public static int EXTRA_REW_VOTE_AM;

        HERO_CUSTOM_DAY = Integer.parseInt(L2JFrozenSettings.getProperty("HeroCustomDay", "0"));
+VOTE_LINK_HOPZONE = L2JFrozenSettings.getProperty("HopzoneUrl", "null");
+VOTE_LINK_TOPZONE = L2JFrozenSettings.getProperty("TopzoneUrl", "null");
+VOTE_REWARD_ID1 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardId1", "300"));
+VOTE_REWARD_ID2 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardId2", "300"));
+VOTE_REWARD_ID3 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardId3", "300"));
+VOTE_REWARD_ID4 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardId4", "300"));
+VOTE_REWARD_AMOUNT1 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardAmount1", "300"));
+VOTE_REWARD_AMOUNT2 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardAmount2", "300"));
+VOTE_REWARD_AMOUNT3 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardAmount3", "300"));
+VOTE_REWARD_AMOUNT4 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardAmount4", "300"));
+SECS_TO_VOTE = Integer.parseInt(L2JFrozenSettings.getProperty("SecondsToVote", "20"));
+EXTRA_REW_VOTE_AM = Integer.parseInt(L2JFrozenSettings.getProperty("ExtraRewVoteAm", "20"));
# ------------------------------
# Vote System Ingame  -
# ------------------------------
HopzoneUrl = 
TopzoneUrl = 

# The characters will have a choice between 3 rewards.Set id for them
VoteRewardId1 = 6392
VoteRewardId2 = 6393
VoteRewardId3 = 4357

# Set the amount of each reward.
VoteRewardAmount1 = 1
VoteRewardAmount2 = 1
VoteRewardAmount3 = 30

# Set the seconds that the character has
# until he votes in the site's banners
SecondsToVote = 45

# Amount of votes a character must collect
# in order to get the 4th vote reward
ExtraRewVoteAm = 20

# Info of the extra reward item
VoteRewardId4 = 6673
VoteRewardAmount4 = 1

now in sql.
Find the table Characters and do Design table (left click)
now add 

lastVoteHopzone	bigint	20	0	-1	0	-1	0	0		0					0	0
lastVoteTopzone	bigint	20	0	-1	0	-1	0	0		0					0	0
hasVotedHop	int	10	0	-1	0	-1	0	0	0	0					0	0
hasVotedTop	int	10	0	-1	0	-1	0	0	0	0					0	0
monthVotes	int	10	0	-1	0	-1	0	0	0	0					0	0
totalVotes	int	10	0	-1	0	-1	0	0	0	0					0	0
tries	int	10	0	-1	0	-1	0	0	3	0					0	0

Create a new npc and change the type in L2VoteManager.
dont forget to download the systextures
http://www.4shared.com/rar/cigkuBLOba/VoteNpc.html?

Edited by te0x
Posted (edited)

Nc, keep sharing dude. :)

thanks :)

 

this one is phx vulnerable...if someone wants to fix it you can see our latest commit in l2jhellas...

i didn't knew it ;D

anyway i updated it :) but for sure it needs a second check i have not tested it ;p

https://www.assembla.com/code/l2hellas/subversion/commit/458

Edited by te0x
  • 5 weeks later...
  • 2 weeks later...
Posted

Dude , he said add 2 new files what names should i add on them? nice moderators.

nice one is you, not moderators, if you don't understand how to do work like this, please don't try to do something other with lineage

Posted

nice one is you, not moderators, if you don't understand how to do work like this, please don't try to do something other with lineage

go pay for a dev to fix you something and dont make posts like you know everything.

 

Dude , he said add 2 new files what names should i add on them? nice moderators.

you have to get use to him hes trolling alot but i agree that he could help instead

 

 

I cant understand  how can i install it , what he means with this : add 2 files? Can someone explain?

start with that http://www.maxcheaters.com/topic/48038-starting-with-l2j/

Posted (edited)

Yay.. for example

public class MonthlyResetTask

That's a name. Also, you asked 'what you mean by add' :troll:

Edited by SweeTs

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • Lineage2 Freya High Five @ Reshade with fog and rain etc @ Gracia final epilogue atmosphere   this reshade will eat lots of GPU power 50% or more of an RTX 3060 so be carefull depending on what effects are activated and their settings will eat even more GPU recomended 60hz monitor settings and via nvidia panel in Lineage2 game profile vsync settings to on effects are set up till film deck and the rest are not used but still working again this can eat alot of GPU Don't overheat GPU this is for freya high five but might work on others too copy in the  System  folder the folder  reshade-shaders  and the files  d3d9.dll  ReShade.ini  ReShadePreset.ini  ReShade.log  CccDddCcc.ini insert opens the menu and delete is on and of some settings need  ctrl + left click  to be changed   making another profile will reset the not activated effects to their default values so just copy the profile  CccDddCcc  and rename if needed also something needs to be closed from settings in game menu, the blur at distance and advanced shaders but keeping the advanced water effects all reflections   for those that don't like the h5 look of the sky and the red fog and rain and ambien red at night on all maps well if we want the cool gracia final epilogue back then we need to do this rename the  Maps  folder to Mapsretail or whatever copy the  Maps  folder from gracia final epilogue to h5 also we need the  L2_Skies.utx  from gracia final epilogue  Textures  folder to be replaced and also we need to do the same to the files  timeenv0.int  timeenv1.int  timeenv2.int  timeenv3.int  found in  system  folder   another setting that will probably be needed but not really tested out is to open file  option.ini  from  system  folder and add cachesize like this   [FirstRun] FirstRun=2   [Engine.GameEngine] CacheSizeMegs=512   also maybe is good to change those to 4.000000   [ClippingRange] Terrain=4.000000 Actor=4.000000 StaticMesh=4.000000 StaticMeshLod=4.000000 Pawn=4.000000       sorry bad english   https://mega.nz/file/aRNXxDrQ#mbxrNERBtW0XEEezK6w8-86oZWuX1k6NgtR6RZWKRVM   the compression on the video is kinda bad but meh    
    • Thanks, tho if possible let's lock the topic. I decided to finish up myself as I only created this to save up my time, but seems that while waiting for prop dev. finished myself.
    • Plus he have Discord where using Celestine, Nightwolf and others names to ensure that he is legit, what a looser, that's why mxc have bad reputation, coming here is like 50/50 get scammed.
    • Greetings, MaxCheaters community! We are the development team behind projects like AdenLand, Classic GvE, TinyEssence, PvPEssence, and several others. Over the years of managing high-traffic servers, we’ve built our own ecosystem of tools for datapack and client editing, simply because standard software often failed to meet our production needs or was too slow. Today, we are opening access to these professional solutions for our colleagues in the dev scene. You can explore our suite of editors and utilities here: 👉 https://la2.tools/ Why choose our tools? Battle-Tested: This software is used daily to maintain and update our own live projects. Efficiency: Designed to automate routine tasks that usually take hours or even days. Stability: Built to handle complex client/server structures where generic tools often crash. We are ready to provide consultations on integrating these tools into your development workflow to make your process faster and more secure.  
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..