Jump to content
  • 0

Auto Vote Reward ->Network


Question

Posted (edited)

l2jfrozen ,Rev:1004, interlude .

 

So hopzone and topzone work ok, network doesnt . I tried to fix it but I cant . What I used for core are these lines

No Console errors.

Just logger that says network is offline.

First try:


	protected int getL2NetworkVotes()
	{
	       int votes = -1;
		
		try
		{
					{
							final URL obj = new URL(PowerPakConfig.VOTES_SITE_L2NETWORK_URL);
							final HttpURLConnection con = (HttpURLConnection) obj.openConnection();
							
							con.addRequestProperty("User-Agent", "L2Network");
							con.setConnectTimeout(5000);
							
							final int responseCode = con.getResponseCode();
							if (responseCode == 200)
							{
								try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())))
								{
									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)
		{
		_log.info("[NETWORK] offline!!!!!!!");
		Broadcast.toAllOnlinePlayers(new CreatureSay(2, Say2.HERO_VOICE,"[Network]", "Offline!"));
			// e.printStackTrace();
		}
		return votes;
	}

Second try:

 


	
	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)
		{
		_log.info("[NETWORK] offline!!!!!!!");
		Broadcast.toAllOnlinePlayers(new CreatureSay(2, Say2.HERO_VOICE,"[Network]", "Offline!"));
		Broadcast.toAllOnlinePlayers(new CreatureSay(0, Say2.HERO_VOICE,"[Server Site]", PowerPakConfig.SERVER_WEB_SITE));
			// 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;
	}

HTML ,powerpack

 

# Do you want enable powerpack?
PowerPakEnabled  = True


# Automatic Vote Reward System
VoteRewardSystem= True
VotesRequiredForReward = 1
VotesSystemInitialDelay= 60000
VotesSystemStepDelay= 5000
VotesRewards= 1851,20;

 

What is wrong?

Searched everywhere for many hours .. cant figure it out.

 

Edited by sotid

Recommended Posts

  • 0
Posted
7 hours ago, Kara` said:

We have discovered clone, quantum teleportation for individual atoms how to cure 70% of illnesses but sure let's use the topzone website to get the votes when they provide us API. :keepo:

 

Sure API is better and I will use it on the vote manager, plus I dont have links for api to test if its working.

 

5 hours ago, melron said:

as kara said, you should use API instead of all those crap connections...

 

@Kara` How old do you think are the above codes? :D

 

Ontopic:

try this one:


protected int getL2NetworkVotes()
{
	try
	{
		final URL obj = new URL(PowerPakConfig.VOTES_SITE_L2NETWORK_URL);
		final HttpURLConnection con = (HttpURLConnection) obj.openConnection();

		con.addRequestProperty("User-Agent", "L2Network");
		con.setConnectTimeout(5000);
		String inputLine;
		try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())))
		{
			while ((inputLine = in.readLine()) != null)
			{
				if (inputLine.contains("color:#e7ebf2"))
					return Integer.valueOf(inputLine.split(">")[2].split("<")[0].replace(",", ""));
			}
		}
	} 
	catch (Exception e)
	{
		Broadcast.toAllOnlinePlayers(new CreatureSay(2, Say2.HERO_VOICE,"[Network]", "Offline!"));
		Broadcast.toAllOnlinePlayers(new CreatureSay(0, Say2.HERO_VOICE,"[Server Site]", PowerPakConfig.SERVER_WEB_SITE));
	}
	return -1;
}

 


https://ibb.co/VgqGMNZ

 

Got an error

  • 0
Posted (edited)
7 minutes ago, sotid said:

 

Sure API is better and I will use it on the vote manager, plus I dont have links for api to test if its working.

 


https://ibb.co/VgqGMNZ

 

Got an error

paste it first in to a notepad and then copy it again from there

Edited by melron
  • 0
Posted (edited)
9 hours ago, wongerlt said:

this line:


votes = Integer.valueOf(inputLine.split(">")[2].replace("</b", ""));

change to:


votes = Integer.valueOf(inputLine.split(">")[2].replace("</b", "").replaceAll(",",""));

 

Either this or
 

votes = Integer.valueOf(inputLine.split(">")[2].split("<")[0].replace(",", ""));


this seems to work , thank you both.

You can lock it.

Edited by sotid
Guest
This topic is now closed to further replies.


  • Posts

    • Ai server development live!     
    • This is more than a server. It is an ode to Lineage 1, built with heart, modern technology, and more than 20 years of dreams.   Here, nostalgia meets innovation in a world shaped by its players, balanced for adventure, solo play, teamwork, competition, and long-term progression.   Lineage 1 Reborn brings together beloved ideas inspired by many of the great servers that came before, including Resurrection, Zelgo, KoD, Classic, Dabid, and others. Those foundations have been refined, reimagined, and expanded alongside entirely new systems and experiences designed to breathe fresh life into a timeless world.   Now nine months old, Reborn is a no-pay-to-win Lineage I server built around thoughtful evolution without losing the danger, rivalry, identity, and sense of accomplishment that made the original game unforgettable and has attracted many veteran and new players alike!   Choose between our expanded Standard world or slower Classic Style world, both connected through one community. Discover tasteful class enhancements, build-defining runes, Hard Mode endgame, advanced pets with talents and critical strikes, rotating EXP zones, more than 120 kill quests, renewed zones, original bosses, seasonal events, arenas, overhauled sieges, offline shops, extensive website integration, and countless quality-of-life improvements.   Behind the scenes, strong anti-dupe protections, item and transaction tracking, audit systems, and active administration help safeguard player progress and the economy. Most importantly, Reborn is supported by an amazing and active community. Player feedback and regular direction polls genuinely shape the server, while cheating, harassment, and excessive toxicity are actively addressed.   This is a fair, slow-paced journey among friends. Help us shape the realm, share your feedback, enjoy the adventure, and remember: passion built this world, and community will sustain it.   No pay to win. Thoughtful evolution. Community guided.   https://lineage1reborn.com/
    • Im looking to update it, could you possibly add me on discord? I need the client,  ilikebeer.
    • Very nice and passionate effort. Good luck.
    • SX.ORG is a global proxy platform offering residential, mobile and datacenter IPs for SEO, web scraping, ad verification and multi-account management. It provides flexible IP rotation, precise geo-targeting, HTTP(S)/SOCKS5 support, API access and pay-as-you-go pricing based only on the traffic you use.
  • 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..