Jump to content

Recommended Posts

Posted

Hello,

As you all know hopzone have a very new update with new links and most of the vote rewards doesn't work.

I made a request in mxc a USER named SweeTs gave me this code that was made by Zoey76 and Rain^!

 

so since it is working greatly. I decided to share it!

 

/*
* This is a script completely developed by Rain^ (?)
* You are not allowed to sell any copies of it.
* Since 2.0 (by Zoey76 for L2J Forums):
* Added logger instead of System.out.println()
* Moved to Datapack.
* Reworked AutoReward class.
* Reworked getVotes() method.
* Time is in minutes instead of milliseconds.
* Uses different a-beep-t for each item.
* Only rewards online players, not offline shops.
* Rewarded players count.
*/
package custom.VoteEngine;

import java.io.*;
import java.net.*;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;

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

/**
* @author Zoey76
* @version 2.0
*/
public class AutoVoteRewardHandler
{
protected static final Logger _log = Logger.getLogger(AutoVoteRewardHandler.class.getName());
//URL from your server site at HopZone.net
//Example: [url=http://l2.hopzone.net/lineage2/moreinfo/YourServer/ID.html]http://l2.hopzone.net/lineage2/moreinfo/YourServer/ID.html[/url]
private final static String _url = "http://l2.hopzone.net/lineage2/moreinfo/L2WorldPvP/74078.html";//Add your URL from HopZone here!
//Reward all online players each '_votesRequiredForReward' votes.
private final int _votesRequiredForReward = 1;//
//Initial check, time in minutes:
//Default: 1 minute
private final int initialCheck = 1;
//Delay interval, time in minutes (do not set it too low):
//Default: 10 minutes
private final int delayForCheck = 1;

//Item Id, A-beep-t.
private final static int[][] ITEMs =
{
	{ 5575, 10 }, //10 Event - Apiga(s)
	{ 57, 1000000 }, //1 million Adena
};

//Do not change
private int _lastVoteCount = 0;

private AutoVoteRewardHandler()
{
	_log.info("[AutoVoteRewardHandler]: Vote Reward System Initiated.");
	ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck * 60000, delayForCheck * 60000);
}

private class AutoReward implements Runnable
{
	public void run()
	{
		int votes = getVotes();
		int rewardedPlayers = 0;
		if (votes > -1)
		{
			if  ((getLastVoteCount() != 0) && (votes >= (getLastVoteCount() + _votesRequiredForReward)))
			{
				Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
				for (L2PcInstance player : pls)
				{
					if ((player != null) && !player.getClient().isDetached())
					{
						for (int[] reward : ITEMs)
						{
							if (player.getInventory().validateCapacityByItemId(reward[0]))
							{
								player.addItem("reward", reward[0], reward[1], player, true);
							}
						}
						rewardedPlayers++;
					}
				}
				setLastVoteCount(getLastVoteCount() + _votesRequiredForReward);
			}
			else if (getLastVoteCount() == 0)
			{
				setLastVoteCount(votes);
			}
			_log.info("[AutoVoteRewardHandler]: Server Votes: " + votes + ", Rewarded players: " + rewardedPlayers);
			Announcements.getInstance().announceToAll("Server Votes: " + votes + " | Next Reward on " + (getLastVoteCount() + _votesRequiredForReward) + " votes!");
		}
		else
		{
			_log.log(Level.WARNING, "[AutoVoteRewardHandler]: Error retreiving server votes count!");
		}
	}
}

private static int getVotes()
{
       		InputStreamReader isr = null;
	BufferedReader in = null;
	int votes = -1;
	try
	{
	URLConnection conn = new URL(_url).openConnection();
	conn.addRequestProperty("User-Agent", "Mozilla/4.76");
	isr = new InputStreamReader(conn.getInputStream());
         	in = new BufferedReader(isr);
		String inputLine;
		while (((inputLine = in.readLine()) != null) && (votes == -1))
		{
			if (inputLine.contains("Anonymous User Votes"))
			{
				try
				{
					votes = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
				}
				catch (Exception e)
				{
				}
			}
		}
		in.close();
	}
	catch (Exception e)
	{
		_log.log(Level.WARNING, "[AutoVoteRewardHandler]: " + e.getMessage(), e);
	}
	return votes;
}

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();
}

public static void main(String[] args)
{
	//System.out.println("Server votes: " + getVotes());//Just a test.
	AutoVoteRewardHandler.getInstance();
}
}

 

here you got TESTED IN L2jSexyReaper(based on L2jServer)

Results : Working 100% no bugs.

 

enjoy best regards

LordOfDarkness.

 

PS: 2if you need to adopt this code to your server please contact me I will do my best to help you!

 

Well, if you want original credits, so here you go.

Originally it was made by Rain, then modified(?) by Zoey and it was for Freya.

Hazzard (aCis forum member) adapted it for aCis, and then another aCis member Fire, fixed code to fit with current Hopzone. That's the story :)

Posted

HOPZONE IS CHANGED NOW , you need to rework your code ;)

 

If you can adopt it to configs also do it! i am trying to work it out and if i success i will reshare it!

 

EDIT: it seems that the code is good  [sorry for my english]

try to remake it for configs too I am trying to do it i hope i will success
Posted

* This is a script completely developed by Rain^ (?)

??

 

i didnt say imade it i put all the credits in the post.

Hello,

As you all know hopzone have a very new update with new links and most of the vote rewards doesn't work.

I made a request in mxc a USER named SweeTs gave me this code that was made by Zoey76 and Rain^!

 

so since it is working greatly. I decided to share it!

 

Posted

Well, if you want original credits, so here you go.

Originally it was made by Rain, then modified(?) by Zoey and it was for Freya.

Hazzard (aCis forum member) adapted it for aCis, and then another aCis's member Fire, fixed the code to fit with current Hopzone. That's the story :)

  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...
Posted

Hello,

As you all know hopzone have a very new update with new links and most of the vote rewards doesn't work.

I made a request in mxc a USER named SweeTs gave me this code that was made by Zoey76 and Rain^!

 

so since it is working greatly. I decided to share it!

 

/*
* This is a script completely developed by Rain^ (?)
* You are not allowed to sell any copies of it.
* Since 2.0 (by Zoey76 for L2J Forums):
* Added logger instead of System.out.println()
* Moved to Datapack.
* Reworked AutoReward class.
* Reworked getVotes() method.
* Time is in minutes instead of milliseconds.
* Uses different a-beep-t for each item.
* Only rewards online players, not offline shops.
* Rewarded players count.
*/
package custom.VoteEngine;

import java.io.*;
import java.net.*;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;

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

/**
* @author Zoey76
* @version 2.0
*/
public class AutoVoteRewardHandler
{
protected static final Logger _log = Logger.getLogger(AutoVoteRewardHandler.class.getName());
//URL from your server site at HopZone.net
//Example: [url=http://l2.hopzone.net/lineage2/moreinfo/YourServer/ID.html]http://l2.hopzone.net/lineage2/moreinfo/YourServer/ID.html[/url]
private final static String _url = "http://l2.hopzone.net/lineage2/moreinfo/L2WorldPvP/74078.html";//Add your URL from HopZone here!
//Reward all online players each '_votesRequiredForReward' votes.
private final int _votesRequiredForReward = 1;//
//Initial check, time in minutes:
//Default: 1 minute
private final int initialCheck = 1;
//Delay interval, time in minutes (do not set it too low):
//Default: 10 minutes
private final int delayForCheck = 1;

//Item Id, A-beep-t.
private final static int[][] ITEMs =
{
	{ 5575, 10 }, //10 Event - Apiga(s)
	{ 57, 1000000 }, //1 million Adena
};

//Do not change
private int _lastVoteCount = 0;

private AutoVoteRewardHandler()
{
	_log.info("[AutoVoteRewardHandler]: Vote Reward System Initiated.");
	ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck * 60000, delayForCheck * 60000);
}

private class AutoReward implements Runnable
{
	public void run()
	{
		int votes = getVotes();
		int rewardedPlayers = 0;
		if (votes > -1)
		{
			if  ((getLastVoteCount() != 0) && (votes >= (getLastVoteCount() + _votesRequiredForReward)))
			{
				Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
				for (L2PcInstance player : pls)
				{
					if ((player != null) && !player.getClient().isDetached())
					{
						for (int[] reward : ITEMs)
						{
							if (player.getInventory().validateCapacityByItemId(reward[0]))
							{
								player.addItem("reward", reward[0], reward[1], player, true);
							}
						}
						rewardedPlayers++;
					}
				}
				setLastVoteCount(getLastVoteCount() + _votesRequiredForReward);
			}
			else if (getLastVoteCount() == 0)
			{
				setLastVoteCount(votes);
			}
			_log.info("[AutoVoteRewardHandler]: Server Votes: " + votes + ", Rewarded players: " + rewardedPlayers);
			Announcements.getInstance().announceToAll("Server Votes: " + votes + " | Next Reward on " + (getLastVoteCount() + _votesRequiredForReward) + " votes!");
		}
		else
		{
			_log.log(Level.WARNING, "[AutoVoteRewardHandler]: Error retreiving server votes count!");
		}
	}
}

private static int getVotes()
{
       		InputStreamReader isr = null;
	BufferedReader in = null;
	int votes = -1;
	try
	{
	URLConnection conn = new URL(_url).openConnection();
	conn.addRequestProperty("User-Agent", "Mozilla/4.76");
	isr = new InputStreamReader(conn.getInputStream());
         	in = new BufferedReader(isr);
		String inputLine;
		while (((inputLine = in.readLine()) != null) && (votes == -1))
		{
			if (inputLine.contains("Anonymous User Votes"))
			{
				try
				{
					votes = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
				}
				catch (Exception e)
				{
				}
			}
		}
		in.close();
	}
	catch (Exception e)
	{
		_log.log(Level.WARNING, "[AutoVoteRewardHandler]: " + e.getMessage(), e);
	}
	return votes;
}

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();
}

public static void main(String[] args)
{
	//System.out.println("Server votes: " + getVotes());//Just a test.
	AutoVoteRewardHandler.getInstance();
}
}

 

here you got TESTED IN L2jSexyReaper(based on L2jServer)

Results : Working 100% no bugs.

 

enjoy best regards

LordOfDarkness.

 

PS: 2if you need to adopt this code to your server please contact me I will do my best to help you!

@LordOfDarkness other version, from same code:

credits to me, Zoey76 and Rain^, (of course, LordOfDarkness for share it)

 

/*
* This is a script completely developed by Rain^ (?)
* You are not allowed to sell any copies of it.
*
* Since 2.0 (by Zoey76 for L2J Forums):
* Added logger instead of System.out.println()
* Moved to Datapack.
* Reworked AutoReward class.
* Reworked getVotes() method.
* Time is in minutes instead of milliseconds.
* Uses different a-beep-t for each item.
* Only rewards online players, not offline shops.
* Rewarded players count.
*
* Since 3.0 (by KsrZ for L2JServer):
* Multi-Reward same time, if needed ((votes - getLastVoteCount() / _votesRequiredForReward) * ITEMs)
* log player name's
* 1 reward per ip
* 
*/
package custom.VoteEngine;

import java.io.*;
import java.net.*;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.l2jserver.gameserver.Announcements;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;

/**
* @author KsrZ
* @version 3.0
*/
public class AutoVoteRewardHandler
{
protected static final Logger _log = Logger.getLogger(AutoVoteRewardHandler.class.getName());

//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
// Settings

private final static String _url = "http://l2.hopzone.net/lineage2/details/91037/L2-Orbis";//Add your URL from HopZone here!
private final int _votesRequiredForReward = 1; //Votes Requiered for next check

//Initial check
private final int initialCheck = 1; //initial Time to check

//Delay interval:
private final int delayForCheck = 15; //Delay for next check

//Reward:
//{ItemID, COUNT},
private final static int[][] ITEMs =
	{
		{ 4033, 1 }, // Blue Paper
		{ 57, 300000 }, // Adena
	};

//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------
//System --> Don't touch anything from here.

private int _lastVoteCount = 0;
private List<String> already_rewarded;

private AutoVoteRewardHandler()
{
	_log.info("    |>===================================================================<|");
	_log.info("    |>         [Auto Vote Reward]: Vote Reward System Initiated.         <|");
	_log.info("    |>===================================================================<|");
	ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck * 60000, delayForCheck * 60000);
}

private class AutoReward implements Runnable
{
	public void run()
	{
		String Player_Rewared = null;
		int votes = getVotes();
		int rewardedPlayers = 0;
		int VGV = (votes - getLastVoteCount()) / _votesRequiredForReward;
		if (votes > -1)
		{
			if  ((getLastVoteCount() != 0) && (votes >= (getLastVoteCount() + _votesRequiredForReward)))
			{

				already_rewarded = new ArrayList<String>();
				L2PcInstance[] pls = L2World.getInstance().getAllPlayers().getValues(new L2PcInstance[0]);

				for (L2PcInstance player : pls)
				{
					if ((player != null) && !player.getClient().isDetached())
					{

						for (int[] reward : ITEMs)
						{
							if(checkSingleBox(player))
							{
								if (player.getInventory().validateCapacityByItemId(reward[0]))
								{

									player.addItem("reward", reward[0], reward[1]*VGV, player, true);

									if(Player_Rewared == null)
										Player_Rewared = " " + player.getName();
									else if(Player_Rewared != null && !Player_Rewared.contains(player.getName()))
									Player_Rewared = Player_Rewared + " | " + player.getName();
								}
							}
						}
						rewardedPlayers++;

					}
				}
				setLastVoteCount((int)(votes - ((votes - getLastVoteCount()) - (VGV * _votesRequiredForReward))));
			}
			else if (getLastVoteCount() == 0 || votes < getLastVoteCount())
			{
				setLastVoteCount(votes);
			}

			if (VGV == votes / _votesRequiredForReward && Player_Rewared == null) 
			{
				VGV= 0;
				Player_Rewared = " ";
			}
			else if (Player_Rewared == null)
				Player_Rewared = " ";

			_log.info("   >------------------> Vote Reward Edited By KsrZ >---------------------------->");
			_log.info("   >| Server Votes: " + votes );
			_log.info("   >| Checking votes evry " + delayForCheck + " minutes.");
			_log.info("   >| " + rewardedPlayers + " rewarded, players: ");
			_log.info("     (" + Player_Rewared + ")");
			_log.info("   >| Reward X" + VGV + " times.");
			_log.info("   <----------------------------------------------------------------------------<");
			Announcements.getInstance().announceToAll("[HopZone Votes]: " + votes + ".");
			Announcements.getInstance().announceToAll("[HopZone]: Next Reward on " + (getLastVoteCount() + _votesRequiredForReward) + " votes!");
		}
		else
		{
			_log.log(Level.WARNING, "[Auto Vote Reward]: Error retreiving server votes count!");
		}
	}
}

private static int getVotes()
{
       		InputStreamReader isr = null;
	BufferedReader in = null;
	int votes = -1;
	try
	{
	URLConnection conn = new URL(_url).openConnection();
	conn.addRequestProperty("User-Agent", "Mozilla/4.76");
	isr = new InputStreamReader(conn.getInputStream());
         	in = new BufferedReader(isr);
		String inputLine;
		while (((inputLine = in.readLine()) != null) && (votes == -1))
		{
			if (inputLine.contains("Anonymous User Votes"))
			{
				try
				{
					votes = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
				}
				catch (Exception e)
				{
				}
			}
		}
		in.close();
	}
	catch (Exception e)
	{
		_log.log(Level.WARNING, "[Auto Vote Reward]: " + e.getMessage(), e);
	}
	return votes;
}

private boolean checkSingleBox(L2PcInstance player){
                
                if(player.getClient()!=null && player.getClient().getConnection()!=null && !player.getClient().getConnection().isClosed()){
                        
                        String playerip = player.getClient().getConnection().getInetAddress().getHostAddress();
                        
                        if(already_rewarded.contains(playerip))
                                return false;
                        already_rewarded.add(playerip);
                        return true;
                }
                
                return false;
    }


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();
}

public static void main(String[] args)
{
	AutoVoteRewardHandler.getInstance();
}
}

File from MediaFire: http://www.mediafire.com/?k2o1k7xtiqqyz3z

  • 4 weeks later...
  • 2 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • Posts

    • In my opinion, L2 is dead because the people who make servers didn’t adapt to today’s reality. People are getting older, life moves faster, there are more responsibilities, and less free time. And I’m not even talking about newcomers—how can you expect someone new to this game to learn by Googling every drop location or quest requirement? These things should’ve been integrated into the game, made accessible with just a few clicks through the interface. Instead, so much time was wasted trying to recreate retail-like features that no one asked for. Everyone hates autofarm, but why? Because admins never found a smart way to implement it. You could have made it available only in specific zones, with reduced drops, working like Adrenaline, or auto-teleporting to farm for a limited time per day—just enough to help people with limited time stay relevant in-game. There should also be zones with better drops, where active farming actually matters. Other features feel pointless—like the Life Stone system. Spamming LS to get a skill? Instead, you could create a system where you level up the skill with low chances per level, something that feels progressive and fair. Crafting should be simpler too. Right-click a recipe, and the required materials should show up right there. As for sieges, why not create daily clan war events at peak hours—one for Europeans, one for Latinos? You could spawn crystals inside or outside castles that give points and trigger PvP. Add a boss during the event that gives even more points, and let the top clan in the ranking take the castle. I could go on forever, but what’s the point? The community died because the people who had the knowledge to improve the game just took the easy way out, copying the same server formula over and over until no one could enjoy playing it anymore.
    • It's not because I'm an admin that he treated me differently. I actually gave him several clients from my side without him even knowing they came from me, and most of them had no issues. I was also waiting 3–4 weeks at times for things I bought from AvE, even when I was in a rush. He still delivered in the end. That said, I'm not defending him blindly. I'm just saying it's unlikely he’d risk scamming someone over 60–100€, especially knowing how quickly word spreads here.
    • For exact same reason - there were accusation that I scammed. When was it? 2016? But in that time, admins actually didn't listen. I got banned, then unbaned (when I prooved I've refunded) but I was trash talking to mods. When few months later same shit happened, Grisom (?) old global mod, banned me anyway. You can read somewhere on forum how I was shitting on him for doing that (from other account because original account was banned) - which was banned too. He is not here anymore I think. Back in the days I was well know for not carring that much if I was talking to mod or admin, I didn't hold my tongue. Now You know. Just like You know - if I delay, I deliver or refund. I'm not a scammer, even if my old time haterz love to repeat themselfs like mantra. I don't care.
    • Okay I respect that but why is your other account banned?   I don't think this happened just because you delayed somebodys work even in 2012
    • Do You understand the fact, I won't scam anyone? Can You grasp such idea?  Second of all, if a random restaurant on Google Maps has 599 positive reviews and few negative ones with 4,8* score, do You ask Google to block it's profile and burn the place down? No? Then why the fuck You are crying about my random delays? If someone can't get a CUSTOM DESIGN on time, I refund. I'm not 16  y.o. anymore. I don't make living out of this L2 bullshit. Never did. Since 2012 I've made shit tons of projects. How many delays did I have? 12? 15? Out of hundrets of projects. Calm Your tits please. If I would actually take 4k euro and NOT deliver and NOT refund - admins can ban me. So don't compare me to Simple. And just so You know, Celestine sent me customers, so it's not like I've worked with him on his account all the time. That's another thing You won't understand. I won't waste anymore time on You and any other cunt who never was my customer but is bitching just because he has nothing better to do in his life. You don't like my work? Hove along, I don't give a shit. 
  • Topics

×
×
  • Create New...