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

this line:

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

change to:

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

 

  • Thanks 1
  • 0
Posted (edited)

about l2network you wont loose much if you dont have it... i have clients that they get in one week 100 visits from this topsite while from others 700+

Edited by DenArt Designs
  • 0
Posted

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:

  • 0
Posted (edited)

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

 

Edited by melron
  • 0
Posted
2 minutes ago, melron said:

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

 

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

 

 

 

So old that you weren't inside maxcheaters yet. (2009+)

 

Instead of catch use the respondeCode for the message

  • 0
Posted (edited)
5 minutes ago, Kara` said:

 

So old that you weren't inside maxcheaters yet. (2009+)

Im from 2k7 kiddo

Edited by melron
  • Haha 1
  • 0
Posted (edited)
2 hours ago, melron said:

Im from 2k7 kiddo

Still young. But who i am to speaking with a 2017 account.

 

Edited by Kara`
  • 0
Posted (edited)
32 minutes ago, Kara` said:

But who i am to speaking with a 2017 account.

AccessDenied (the scammer), AKA 

Arrays.asList(109,97,103,110,101,116,111,51,48).forEach(val -> System.out.print(((char)val.intValue())));

:angel:

 

@Kara` malaka vrika ena topic pou eixes anoiksei ton sep tou 2012 kai exw katourithei

Edited by melron
  • 0
Posted (edited)
34 minutes ago, melron said:

AccessDenied (the scammer), AKA 


Arrays.asList(109,97,103,110,101,116,111,51,48).forEach(val -> System.out.print(((char)val.intValue())));

:angel:

 

@Kara` malaka vrika ena topic pou eixes anoiksei ton sep tou 2012 kai exw katourithei

Παλι καλα που βρισκετε του 2012 και του 2011 και οχι του 2008 που ειχα και gracia server :'(

Επισης μην μιλησω για κωδικες σου πριν 1 χρονο θα κατουρηθουμε στα γελια :keepo:

Edited by Kara`
  • 0
Posted
1 minute ago, Kara` said:

Παλι καλα που βρισκετε του 2012 και του 2011 και οχι του 2008 που ειχα και gracia server :'(

Επισης μην μιλησω για κωδικες σου πριν 1 χρονο θα κατουρηθουμε στα γελια :keepo:

eides na kritikarw kwdhka palio sou? egw eipa topic den eixe kan kwdhka mesa

  • 0
Posted
41 minutes ago, melron said:

eides na kritikarw kwdhka palio sou? egw eipa topic den eixe kan kwdhka mesa

Ξεκινα να κριτικαρεις θα πεθανεις στο κλαμα, ειδικα οταν ρωταγα τι ειναι το null

  • 0
Posted
1 minute ago, Kara` said:

Ξεκινα να κριτικαρεις θα πεθανεις στο κλαμα, ειδικα οταν ρωταγα τι ειναι το null

psisou gia topic offsection gia na ta ksethapsoume 

  • 0
Posted
28 minutes ago, melron said:

psisou gia topic offsection gia na ta ksethapsoume 

Οχι ρε μαλακα, δεν με λυπασαι, να βγαλω στη φορα κωδικες που εγραφα πριν 8-9 χρονια?

Guest
This topic is now closed to further replies.


  • Posts

    • Hello there, Im beyond confused and dont know what path to take. I want to start working on a L2 server, changing some stuff here and there and finally in the future if  im happy with the results, to launch the server, but... L2j or L2off? After all this years, is there a Interlude L2j close to off?   Ive spent some time lookin over this forum, searching what would be better and what files to take but I ain't near to a clear answer.  Most of the time everyone is trowing stones at everyone, "your filles are trash, my filles are good" and viceversa. Therefore, Im reaching out to a knowledge guy, hopefully from a neutral position to all this drama, that can pin point me in a direction.    To explain what I want for a base start is an Interlude with a classic interface (features), low rate. Mostly what this guy TravorJ is describing in his post TravorJ post , and to do some reworks on it, ex: mobs drop, rethink the augment system/interface, rethink learning skills/enchant skills, create some custom potions/buff effects, siege mechanics... Is that possible on off files? or is better to go with L2j? I also want to mention that I have little to none L2 dev experince (13-15yrs ago I had an L2j server running  for a month where I made some basics changes), but I have coding background so Im used to that and more than willing to learn.   So in conclusion, I dont want to get some free shared files without any support, that I need to wrap my head around and fix stuff for long time to make them work, stuff thats already fixed buy someone else. Instead im looking to buy something thats more updated and start working from there. Question is what and from whom? Kinda sux when you go and buy something and u dont know what the hell are you buying (need some guidance here)   Is L2j Orion a good choice? I saw that is regularly updated. Lucera2 I dont think is something that I want cuz they dont sell soruce, prefer to have control and not to be dependent on someone to much...   Big thanks in advance!   
    • L2 INSIDE - HTML DESIGN     Portfolio - protojahdesigns.com You can also join Protojah Designs Discord
    • Server / Discord Live Discord L2Fol Community . you are welcome to join on our latest updates.
    • Hi, for l2jfrozen...   I want Bless Enchat to have a limit.   Example: 7+ to +15 with Bless Enchat.   That for +16, it doesn't allow use.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock