Jump to content

Recommended Posts

  • 4 months later...
  • 4 weeks later...
Posted

Thanks

stop mother-beep-er saying "thanks" to something that DO NOT WORKS! :)

 

 

 

and here is the fix (copy paste it) make sure u will take a backup <3

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/

package net.sf.l2j.gameserver.model;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Collection;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.GmListTable;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

/**
*
* @author eXtr3me, mod by Rizel and ErHarD
*
*/
public class AutoVoteRewardHandler
{
private int	lastVoteCount = 0;
private int	initialCheck = 30 * 1000;														
private int	delayForCheck = 300 * 1000;														
private int	votesForReward = 20;
private int	maxRewardStack = 5;

private AutoVoteRewardHandler()
{
	System.out.println("Vote Reward System activated.");
	ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck);
}

private class AutoReward implements Runnable
{
	public void run()
	{
		System.out.println("Vote Count Check.");
		if (Config.VOTE_REWARD1_ID == 0 || Config.VOTE_REWARD1_COUNT == 0 || Config.VOTE_REWARD2_ID == 0 || Config.VOTE_REWARD2_COUNT == 0)
		{
			GmListTable.broadcastMessageToGMs("The rewards aren't Identified. Please take a look.");
			return;
		}
		int newVoteCount = getVotes(Config.VOTE_HTML_PATCH);
		System.out.println("newVoteCount:"+newVoteCount);
		System.out.println("getLastVoteCount:"+getLastVoteCount());
		if (newVoteCount != 0 && getLastVoteCount() != 0 && newVoteCount >= getLastVoteCount() + votesForReward)
		{

			Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
			for (L2PcInstance player : pls)
			{
				if (player != null)
				{
					L2ItemInstance item1 = player.getInventory().getItemByItemId(Config.VOTE_REWARD1_ID);
					if (item1 == null || item1.getCount() < maxRewardStack)
					{
						player.addItem("reward", Config.VOTE_REWARD1_ID, Config.VOTE_REWARD1_COUNT, player, true);
					}
					L2ItemInstance item2 = player.getInventory().getItemByItemId(Config.VOTE_REWARD2_ID);
					if (item2 == null || item2.getCount() < maxRewardStack)
					{
						player.addItem("reward", Config.VOTE_REWARD2_ID, Config.VOTE_REWARD2_COUNT, player, true);
					}
				}
			}	
			setLastVoteCount(getLastVoteCount()+ votesForReward);
		}
		Announcements.getInstance().announceToAll("Our Current vote count is: " + newVoteCount);
		Announcements.getInstance().announceToAll("Next reward at " + (getLastVoteCount()+ votesForReward) + " votes.");
		if (getLastVoteCount() == 0)
		{
			setLastVoteCount(newVoteCount);
		}
	}
}

private int getVotes(String urlString)
{
	InputStreamReader isr = null;
	BufferedReader in = null;
	try
	{
		URL url = new URL(urlString);
		URLConnection con = url.openConnection();
		con.addRequestProperty("User-Agent", "Mozilla/4.76"); 
		isr = new InputStreamReader(con.getInputStream());
		in = new BufferedReader(isr);
		String inputLine;
		int voteCount = 0;
		while ((inputLine = in.readLine()) != null)
		{
			if (inputLine.contains("rank anonymous tooltip"))
			{
				int Sub = 12;
				switch (inputLine.length())
				{
					case 116:
						Sub = 13; 
						break;
					case 117:
						Sub = 14; 
						break;
					case 118:
						Sub = 15;
						break;
					case 119:
						Sub = 16; 
						break;
				}
				voteCount = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
				break;
			}
		}
		return voteCount;
	}
	catch (IOException e)
	{
		e.printStackTrace();
		return 0;
	}
	finally
	{
		try
		{
			in.close();
		}
		catch (IOException e)
		{

		}
		try
		{
			isr.close();
		}
		catch (IOException e)
		{

		}
	}
}

private void setLastVoteCount(int voteCount)
{
	lastVoteCount = voteCount;
}

private int getLastVoteCount()
{
	return lastVoteCount;
}

public static AutoVoteRewardHandler getInstance()
{
	return SingletonHolder._instance;
}

@SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
	protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler();
}
}

  • 2 months later...
Posted

stop mother-beep-er saying "thanks" to something that DO NOT WORKS! :)

 

 

 

and here is the fix (copy paste it) make sure u will take a backup <3

/* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/

package net.sf.l2j.gameserver.model;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Collection;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.GmListTable;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

/**
*
* @author eXtr3me, mod by Rizel and ErHarD
*
*/
public class AutoVoteRewardHandler
{
private int	lastVoteCount = 0;
private int	initialCheck = 30 * 1000;														
private int	delayForCheck = 300 * 1000;														
private int	votesForReward = 20;
private int	maxRewardStack = 5;

private AutoVoteRewardHandler()
{
	System.out.println("Vote Reward System activated.");
	ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck);
}

private class AutoReward implements Runnable
{
	public void run()
	{
		System.out.println("Vote Count Check.");
		if (Config.VOTE_REWARD1_ID == 0 || Config.VOTE_REWARD1_COUNT == 0 || Config.VOTE_REWARD2_ID == 0 || Config.VOTE_REWARD2_COUNT == 0)
		{
			GmListTable.broadcastMessageToGMs("The rewards aren't Identified. Please take a look.");
			return;
		}
		int newVoteCount = getVotes(Config.VOTE_HTML_PATCH);
		System.out.println("newVoteCount:"+newVoteCount);
		System.out.println("getLastVoteCount:"+getLastVoteCount());
		if (newVoteCount != 0 && getLastVoteCount() != 0 && newVoteCount >= getLastVoteCount() + votesForReward)
		{

			Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
			for (L2PcInstance player : pls)
			{
				if (player != null)
				{
					L2ItemInstance item1 = player.getInventory().getItemByItemId(Config.VOTE_REWARD1_ID);
					if (item1 == null || item1.getCount() < maxRewardStack)
					{
						player.addItem("reward", Config.VOTE_REWARD1_ID, Config.VOTE_REWARD1_COUNT, player, true);
					}
					L2ItemInstance item2 = player.getInventory().getItemByItemId(Config.VOTE_REWARD2_ID);
					if (item2 == null || item2.getCount() < maxRewardStack)
					{
						player.addItem("reward", Config.VOTE_REWARD2_ID, Config.VOTE_REWARD2_COUNT, player, true);
					}
				}
			}	
			setLastVoteCount(getLastVoteCount()+ votesForReward);
		}
		Announcements.getInstance().announceToAll("Our Current vote count is: " + newVoteCount);
		Announcements.getInstance().announceToAll("Next reward at " + (getLastVoteCount()+ votesForReward) + " votes.");
		if (getLastVoteCount() == 0)
		{
			setLastVoteCount(newVoteCount);
		}
	}
}

private int getVotes(String urlString)
{
	InputStreamReader isr = null;
	BufferedReader in = null;
	try
	{
		URL url = new URL(urlString);
		URLConnection con = url.openConnection();
		con.addRequestProperty("User-Agent", "Mozilla/4.76"); 
		isr = new InputStreamReader(con.getInputStream());
		in = new BufferedReader(isr);
		String inputLine;
		int voteCount = 0;
		while ((inputLine = in.readLine()) != null)
		{
			if (inputLine.contains("rank anonymous tooltip"))
			{
				int Sub = 12;
				switch (inputLine.length())
				{
					case 116:
						Sub = 13; 
						break;
					case 117:
						Sub = 14; 
						break;
					case 118:
						Sub = 15;
						break;
					case 119:
						Sub = 16; 
						break;
				}
				voteCount = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
				break;
			}
		}
		return voteCount;
	}
	catch (IOException e)
	{
		e.printStackTrace();
		return 0;
	}
	finally
	{
		try
		{
			in.close();
		}
		catch (IOException e)
		{

		}
		try
		{
			isr.close();
		}
		catch (IOException e)
		{

		}
	}
}

private void setLastVoteCount(int voteCount)
{
	lastVoteCount = voteCount;
}

private int getLastVoteCount()
{
	return lastVoteCount;
}

public static AutoVoteRewardHandler getInstance()
{
	return SingletonHolder._instance;
}

@SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
	protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler();
}
}

 

Is this the "Official Fix ?" or is it this same code, fixed?

Working nowaways?

Any idea if it may work on L2jServer G3 ? (ct2.3)

Tnx.

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

    • [Share]korean protocol 606 new lobby collection   kr 606 new lobby assassin     kr 606 new lobby bartz       kr 606 new lobby basic       Instructions: Place the files into the 'Video' folder within your game client. (Remember to create backups of your files before replacing them.)   Supported game protocols: 110,140,152,166,196,228,235,245,272,286,306,311,338,362,388,390,393,395,413,414,415,417,418,419,422, 424,425,426,430,437,438,439,444,446,447,449,450,458,459,460,462,464,465,470,474,480,481,482,487, 493,495,502,507,509,511,513,516,520   Download link > https://drive.usercontent.google.com/download?id=1hZy-CcerRDy49gC0VWN_1jxPyHAcd0SU&export <  7zip compression; password  RED-TEAM-REVERSECODE             
    • GRAND OPENING TODAY! 30/10/2026, FRIDAY, 20:00 +3 GMT 
    • Hey everyone! Just a quick update from the WARFRONT team. After months of development, testing and plenty of changes based on player feedback, we're finally opening tomorrow, 30 October at 18:00 UTC. For anyone who hasn't heard about the project, WARFRONT is a heavily customised Interlude GvE server focused on Angels vs Demons faction PvP. The main difference is our battlefield system. Instead of fighting endlessly over random kills, factions capture Outposts, unlock the Main Outpost and eventually push into enemy territory to destroy the opposing Headquarters. We've also spent a considerable amount of time working on class balance, progression, faction balancing and giving traditionally overlooked classes a useful role in PvP. Some of the main features: Level 80 start with free B Grade equipment Rotating faction battlefields with objectives 31 rebalanced classes Daily faction siege Grand Boss faction events Chaos, TvT, CTF, Deathmatch and King of the Hill Gear Battle XP and character progression Free and Premium Battle Pass Custom faction balancing and mercenary system We had 110 participants during Closed Beta and made numerous improvements following their feedback. If you enjoy Interlude faction PvP, feel free to give us a try. Grand Opening: Friday, 30 October 2026 at 18:00 UTC Website: https://l2warfront.com/ See you tomorrow!
    • OPEN BETA STARTS ON FRIDAY, OCTOBER 30, AT 18:00 EASTERN EUROPEAN TIME - don't forget to join!
    • 🤝 Team and agency packs available: Bulk discounts across ChatGPT Plus, Claude Pro, and YouTube Premium subscriptions.     FINAL CALL: Google is Shutting This Down After October 2026! Google will NEVER bring back this window of opportunity again. Once this month ends, this massive backdoor upgrade is gone permanently!  BUY 2, GET 1 FREE IS STILL LIVE! Stock up now for yourself, your family, your business, and your friends! Think about it: Every single person you know uses a Gmail account, and everyone is running out of storage. Don't let your loved ones get trapped paying $20–$30 every single month when you can set them up with 5TB Cloud Storage + Gemini Advanced (12–18 Months) right now for only $15! Why Buy Bulk Activations Today? Instant Gift Value: Perfect lifetime-style gift for clients, family, or team members. 100% Private & Safe: Activates on personal Gmails—zero passwords or logins required. Global Access: Works worldwide with zero VPN hassles. Instant Automated Delivery: Receive your activation links in seconds 24/7! ‍ Time is running out fast—secure your extra free licenses before the October deadline hits! Order Your Bundle Now on the Website
  • 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..