Jump to content

Recommended Posts

Posted

 

If I create an npc with type = "L2VoteManager"> I can not summon the npc
Does anyone know why?

 

 

If you give us more details about what project you have and revision then we will help you.

Posted

There is only 2 options..

Java side is not exist (if you dont put the code in instance will not work)

And if you didnt replace .jar file

Posted

There is only 2 options..

Java side is not exist (if you dont put the code in instance will not work)

And if you didnt replace .jar file

 

Maybe he have new aCis and name it L2VoteManagerInstance.java inside source...

Posted

Maybe he have new aCis and name it L2VoteManagerInstance.java inside source...

Yeap he have to tell us then..

If he got rev after 367 must rename it to VoteManagerNpc in the type too :D

Posted

This is for acis latest ? If i am like 50 rev behind without the newest big updates what should i do to use it ?

Just if needs addapt nothing more.

How does npc work? How to use it? I have not found it yet !

Pretty easy once you made all in core and datapack spawn npc..

Click on button topzone go vote for topzone

Receive reward you got 60seconds time to vote..

With this way works in all 3 sites..

Posted

i would like to ask sth if possible.. im a newbie and because i know of a way to "smartout" this voting i want to ask u sth.. how can i make it so they need to vote to topzone then hopzone then network without giving all 3 options from the start

Posted

A whole week's try and it does not happen ... :-

Everything seems to be ok, but it is telling me - You didn't vote. Try Again Later.

Does he work normally for you?

Posted

A whole week's try and it does not happen ... :-

Everything seems to be ok, but it is telling me - You didn't vote. Try Again Later.

Does he work normally for you?

Which site?
Posted

TopZone and HopZone

 

I tried this last:

 

TopzoneUrl = https://l2topzone.com/tv.php?id=14549

API HopZone - in the code

package com.l2jfrozen.gameserver.handler;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.clientpackets.Say2;
import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.util.database.L2DatabaseFactory;

/**
 * @Author Reborn12
 */

public class VoteHandler
{	
	public VoteHandler()
	{
	}
	
	public static String whoIsVoting()
	{
		for (L2PcInstance player : L2World.getInstance().getAllPlayers())
			if (player.isVoting())
				return player.getName();
		
		return "NONE";
	}
	
	public static int getTopZoneVotes()
	{
		int votes = -1;
		try
		{
			final URL obj = new URL(Config.VOTES_SITE_TOPZONE_URL);
			final HttpURLConnection con = (HttpURLConnection) obj.openConnection();
			con.addRequestProperty("User-Agent", "L2TopZone");
			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)
					{
						votes = Integer.valueOf(inputLine);
						break;
					}
				}
			}
		}
		catch (Exception e)
		{
			e.printStackTrace();
			System.out.println("TOPZONE is offline. We will check reward as it will be online again.");
		}
		
		return votes;
	}
	public static void tzvote(final L2PcInstance player)
	{
		long LastTZVote = 0L;
		long voteDelay = 43200000L;
		final int actualvotes;
		
		actualvotes = getTopZoneVotes();
		
		class tzvotetask implements Runnable
		{
			private final L2PcInstance p;
			
			public tzvotetask(L2PcInstance player)
			
			{
				p = player;
			}
			
			@Override
			public void run()
			{
				if (actualvotes < getTopZoneVotes())
				{
					p.setIsVoting(false);
					VoteHandler.updateLastTZVote(p);
					p.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "Thanks for Voting."));
					p.addItem("TZreward", Config.VOTE_REWARD_ID, Config.VOTE_REWARD_ID_COUNT, null, true);
				}
				else
				{
					p.setIsVoting(false);
					p.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "You didn't vote. Try Again Later."));
				}
			}
		}
		
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement("SELECT LastTZVote FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());
			
			ResultSet rset = statement.executeQuery();
			
			while (rset.next())
			{
				LastTZVote = rset.getLong("LastTZVote");
			}
			statement.close();
			rset.close();
			
		}
		catch (Exception e)
		{
			e.printStackTrace();
			System.out.println("Vote Manager: could not select LastTZVote in characters " + e);
		}
		
		if ((LastTZVote + voteDelay) < System.currentTimeMillis())
		{
			for (L2PcInstance actualchar : L2World.getInstance().getAllPlayers())
			{
				if (actualchar.isVoting())
				{
					player.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", actualchar.getName() + ", is voting now. Please wait for a while."));
					return;
				}
			}
			player.setIsVoting(true);
			player.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "You have " + Config.TIME_TO_VOTE + " seconds to vote on Topzone."));
			ThreadPoolManager.getInstance().scheduleGeneral(new tzvotetask(player), Config.TIME_TO_VOTE * 880);
		}
		else
		{
			player.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "You can vote only once every 12 hours."));
		}
	}
	
	public static void updateLastTZVote(L2PcInstance player)
	{
		{
			try (Connection con = L2DatabaseFactory.getInstance().getConnection())
			{
				PreparedStatement statement = con.prepareStatement("UPDATE characters SET LastTZVote=? WHERE obj_Id=?");
				statement.setLong(1, System.currentTimeMillis());
				statement.setInt(2, player.getObjectId());
				statement.execute();
				statement.close();
				statement = null;
				
			}
			catch (Exception e)
			{
				e.printStackTrace();
				System.out.println("Vote Manager: could not update LastTZVote in characters " + e);
			}
		}
	}
	
	public static int getHopZoneVotes()
	{
		int votes = -1;
		try
		{
			BufferedReader in = new BufferedReader(new InputStreamReader(new URL("https://api.hopzone.net/lineage2/votes?token=3jN9R6JkE7a0gowf").openConnection().getInputStream()));
			String[] tokens = in.readLine().split(",");
			in.close();
			return Integer.parseInt(tokens[1].substring(tokens[1].indexOf(":") + 1, tokens[1].length()));
		}
		catch (Exception e)
		{
			e.printStackTrace();
			System.out.println("HOPZONE is offline. We will check reward as it will be online again.");
		}
		return votes;
	}
	
	public static void HZvote(final L2PcInstance player)
	{
		long LastHZVote = 0L;
		long voteDelay = 43200000L;
		final int actualvotes;
		
		actualvotes = getHopZoneVotes();
		class hpvotetask implements Runnable
		{
			private final L2PcInstance p;
			
			public hpvotetask(L2PcInstance player)
			
			{
				p = player;
			}
			
			@Override
			public void run()
			{
				if (actualvotes < getHopZoneVotes())
				{
					p.setIsVoting(false);
					VoteHandler.updateLastHZVote(p);
					p.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "Thanks for Voting."));
					p.addItem("HZreward", Config.VOTE_REWARD_ID, Config.VOTE_REWARD_ID_COUNT, null, true);
				}
				else
				{
					p.setIsVoting(false);
					p.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "You didn't vote. Try Again Later."));
				}
			}
		}
		
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement("SELECT LastHZVote FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());
			
			ResultSet rset = statement.executeQuery();
			
			while (rset.next())
			{
				LastHZVote = rset.getLong("LastHZVote");
			}
			statement.close();
			rset.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
			System.out.println("Vote Manager: could not select LastHZVote in characters " + e);
		}
		
		if ((LastHZVote + voteDelay) < System.currentTimeMillis())
		{
			for (L2PcInstance actualchar : L2World.getInstance().getAllPlayers())
			{
				if (actualchar.isVoting())
				{
					player.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", actualchar.getName() + ", is voting now. Please wait for a while."));
					return;
				}
			}
			player.setIsVoting(true);
			player.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "You have " + Config.TIME_TO_VOTE + " seconds to vote on Hopzone."));
			ThreadPoolManager.getInstance().scheduleGeneral(new hpvotetask(player), Config.TIME_TO_VOTE * 880);
		}
		else
		{
			player.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "You can vote only once every 12 hours"));
		}
	}
	
	public static void updateLastHZVote(L2PcInstance player)
	{
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET LastHZVote=? WHERE obj_Id=?");
			statement.setLong(1, System.currentTimeMillis());
			statement.setInt(2, player.getObjectId());
			statement.execute();
			statement.close();
			statement = null;
			
		}
		catch (Exception e)
		{
			e.printStackTrace();
			System.out.println("Vote Manager: could not update LastHZVote in characters " + e);
		}
	}
	
	public static int getL2NetworkVotes()
	{
		int votes = -1;
		try
		{
			final URL obj = new URL(Config.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 (Exception e)
		{
			e.printStackTrace();
			System.out.println("NetWork is offline. We will check reward as it will be online again.");
		}
		return votes;
	}
	
	public static void NZvote(final L2PcInstance player)
	{
		long LastNZVote = 0L;
		long voteDelay = 43200000L;
		final int actualvotes;
		
		actualvotes = getL2NetworkVotes();
		
		class nzvotetask implements Runnable
		{
			private final L2PcInstance p;
			
			public nzvotetask(L2PcInstance player)
			
			{
				p = player;
			}
			
			@Override
			public void run()
			{
				if (actualvotes < getL2NetworkVotes())
				{
					p.setIsVoting(false);
					VoteHandler.updateLastNZVote(p);
					p.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "Thanks for Voting."));
					p.addItem("NZreward", Config.VOTE_REWARD_ID, Config.VOTE_REWARD_ID_COUNT, null, true);
				}
				else
				{
					p.setIsVoting(false);
					p.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "You didn't vote. Try Again Later."));
				}
			}
		}
		
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement("SELECT LastNZVote FROM characters WHERE obj_Id=?");
			statement.setInt(1, player.getObjectId());
			ResultSet rset = statement.executeQuery();
			
			while (rset.next())
			{
				LastNZVote = rset.getLong("LastNZVote");
			}
			statement.close();
			rset.close();
			
		}
		catch (Exception e)
		{
			e.printStackTrace();
			System.out.println("Vote Manager: could not select LastNZVote in characters " + e);
		}
		
		if ((LastNZVote + voteDelay) < System.currentTimeMillis())
		{
			for (L2PcInstance actualchar : L2World.getInstance().getAllPlayers())
			{
				if (actualchar.isVoting())
				{
					player.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", actualchar.getName() + ", is voting now. Please wait for a while."));
					return;
				}
			}
			player.setIsVoting(true);
			player.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "You have " + Config.TIME_TO_VOTE + " seconds to vote on Network."));
			ThreadPoolManager.getInstance().scheduleGeneral(new nzvotetask(player), Config.TIME_TO_VOTE * 880);
		}
		else
		{
			player.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Vote Manager", "You can vote only once every 12 hours."));
		}
	}
	
	public static void updateLastNZVote(L2PcInstance player)
	{
		{
			try (Connection con = L2DatabaseFactory.getInstance().getConnection())
			{
				PreparedStatement statement = con.prepareStatement("UPDATE characters SET LastNZVote=? WHERE obj_Id=?");
				statement.setLong(1, System.currentTimeMillis());
				statement.setInt(2, player.getObjectId());
				statement.execute();
				statement.close();
				statement = null;
				
			}
			catch (Exception e)
			{
				e.printStackTrace();
				System.out.println("Vote Manager: could not update LastNZVote in characters " + e);
			}
		}
	}
}

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

    • Tell a Škoda 1.4 driver that a Škoda 1.8 is faster — and suddenly, you’re riding a mini race car. On the way, they might share random stories — gas prices, the perfect BBQ recipe, or how passengers once called them “just for a minute.” Maybe even how someone left a suitcase full of money in their car once.     The important part? You’ll get there on time, no delays.     Vibe SMS works just as fast — messages fly like that driver who just heard their 1.8 isn’t the fastest.     🌐 https://vibe-sms.net/ 📲 https://t.me/vibe_sms  
    • ⚔️ The Grand Opening Has Arrived! ⚔️ In just a few hours the gate to the eternal battlefield will be open and the war between Order and Chaos will be set once again ! Its time to claim your destiny 🔥 👉 Register now and join the fight today! 🌐 https://l2ovc.com register now : https://l2ovc.com The gates are open the war between Order and Chaos has officially started! 🔥 Join the battlefield NOW and claim your destiny in Order vs Chaos! 💥 Don’t fall behind your faction needs you. ➡️ https://l2ovc.com  
    • Don’t miss the new Telegram gifts with our Telegram Stars purchasing bot! A great opportunity to invest in a stable digital asset at an early stage while the market is still forming. Buy other existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium subscriptions, and react to messages in channels! Low prices, multiple payment options, and other cool unique features! ⚡ Try it today — SOCNET STARS BOT ⚡ Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. ⭐ Telegram Stars Purchase Bot: Go – fast and profitable way to buy stars in Telegram. SMM Panel: Go – promote your social media accounts. We present to you the current list of promotions and special offers for purchasing our products and services: 1️⃣ Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in October! You can also use the promo code SOCNET (15% discount) for your first purchase. 2️⃣ Get $1 on your store balance or a 10–20% discount — just write your username after registration on our website using the template: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3️⃣ Get $1 for your first SMM Panel trial — simply open a ticket titled “Get Trial Bonus” on our website (Support). 4️⃣ Weekly ⭐ Telegram Stars giveaways in our Telegram channel and in our Telegram Stars bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Don’t miss the new Telegram gifts with our Telegram Stars purchasing bot! A great opportunity to invest in a stable digital asset at an early stage while the market is still forming. Buy other existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium subscriptions, and react to messages in channels! Low prices, multiple payment options, and other cool unique features! ⚡ Try it today — SOCNET STARS BOT ⚡ Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. ⭐ Telegram Stars Purchase Bot: Go – fast and profitable way to buy stars in Telegram. SMM Panel: Go – promote your social media accounts. We present to you the current list of promotions and special offers for purchasing our products and services: 1️⃣ Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in October! You can also use the promo code SOCNET (15% discount) for your first purchase. 2️⃣ Get $1 on your store balance or a 10–20% discount — just write your username after registration on our website using the template: "SEND ME BONUS, MY USERNAME IS..." — post it in our forum thread! 3️⃣ Get $1 for your first SMM Panel trial — simply open a ticket titled “Get Trial Bonus” on our website (Support). 4️⃣ Weekly ⭐ Telegram Stars giveaways in our Telegram channel and in our Telegram Stars bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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