Jump to content

Recommended Posts

Posted

To all who have an error like this:

errorxan.png

 

Easy to fix:

Just merge both databases!

 

How to do it?

 

1) Close both Gameserver and Loginserver

2) Open database l2jls (your loginserver database)

3) Copy all tables from there

4) Open database l2jgs (your gameserver database)

5) Paste them there

 

6) Now go to */login/config/loginserver.properties

7) Scroll down to "Database" Section and then search for "l2jls" (your loginserver database)

8) Replace "l2jls" (loginserver database) with "l2jgs" (gameserver database)

 

Done.

 

Please give feedback I didn't test it but in theory it should work. I am still searching for solution from code-side

  • 1 month later...
Posted

Hello!

For TopZone the code works fine without problem.. but for HopZone don't work and I got error...

Can someone help me who to fix this??

 

use help section, post error and what you want to do, also you could try and that way you will learn something useful :)

Posted

Hi this is a nice share and i could really use it for my server, i put every thing in eclipse and every thing was fine but at the end i only have a 2 errors should be simple to fix i think but i have no idea what to change it to so mabey you guys will know, thanks :D

 

Untitled.jpg

  • 4 weeks later...
Posted
errorxan.png

To all who have an error like this:

Easy to fix:

Just merge both databases!

 

How to do it?

 

1) Close both Gameserver and Loginserver

2) Open database l2jls (your loginserver database)

3) Copy all tables from there

4) Open database l2jgs (your gameserver database)

5) Paste them there

 

6) Now go to */login/config/loginserver.properties

7) Scroll down to "Database" Section and then search for "l2jls" (your loginserver database)

8) Replace "l2jls" (loginserver database) with "l2jgs" (gameserver database)

 

Done.

 

Please give feedback I didn't test it but in theory it should work. I am still searching for solution from code-side

 

 

 

 

I got same error.... i did same fix... but when someone make new Account... will not get vote reward? Or?

 

 

Ahh to make both in 1 Database... smart :D

  • 1 month later...
Posted

if the account is created by page, you can send data to and l2jgs l2jls but if autocreate the data is sent and not update l2jls accounts l2jgs, another solution would be to edit the code to work with l2jls, this is for those who work with the new revision

  • 1 month later...
  • 3 weeks later...
Posted

[javac] Note: C:\workspace\KingServerBR\Server\java\king\server\gameserver\instancemanager\AutoVoteRewardHandler.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.

 

? ? ? ? ? ?

Posted

Fxied Problem by accident i deleted the + between getlastvotecount() + Config.votes for reward

 

Now i have new error in server when it loads up:

 

any ideas:

 

err.jpg

 

I have this error how to fix? My database name for login and game l2jls

  • 1 month later...
Posted

i installed all code in latest H5 core version=5816

builddate=25/02/2013 06:00

 

and i got only one error in AutoVoteRewardHandler also in Shutdown and Gameserver but is the same

 

package com.l2jserver.gameserver.instancemanager;
    
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.l2jserver.gameserver.model.item.instance.L2ItemInstance;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.clientpackets.Say2;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Broadcast;
    
public class AutoVoteRewardHandler
{
  private static Logger _log = Logger.getLogger(AutoVoteRewardHandler.class.getName());
  
  private static final int initialCheck  = 1 * 1000;
  private static final int delayForCheck = Config.DELAY_FOR_NEXT_REWARD * 1000;

  private static int lastVoteCount = 0;
      
  private AutoVoteRewardHandler()
  {
      _log.info("Vote Reward System: Vote reward system initiated.");
      if (Config.VOTE_REWARD_ENABLE)
          load();
      ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck);
  }
      
  private class AutoReward implements Runnable
{
	@Override
	public void run()
	{
		int votes = getVotes(Config.VOTE_HTML_PATCH);
		System.out.println("Server Votes: " + votes);
		if (votes != 0 && getLastVoteCount() != 0 && votes >= getLastVoteCount() + Config.VOTES_FOR_REWARD)
		{
			Connection con = null;
			try
			{
				con = L2DatabaseFactory.getInstance().getConnection();
				PreparedStatement statement = con.prepareStatement("SELECT c.charId, c.char_name FROM characters AS c LEFT JOIN accounts AS a ON c.account_name = a.login WHERE c.online > 0 GROUP BY a.lastIP ORDER BY c.level DESC");
				ResultSet rset = statement.executeQuery();
				L2PcInstance player = null;
			        L2ItemInstance item = null;
				L2ItemInstance item2 = null;
				while (rset.next())
				{
					player = L2World.getInstance().getPlayer(rset.getInt("charId"));
					if (player != null && !player.getClient().isDetached())
					{
							item = player.getInventory().getItemByItemId(Config.VOTE_REWARD1_ID);
							if (item == null || item.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM1)
								player.addItem("reward", Config.VOTE_REWARD1_ID, Config.VOTE_REWARD1_COUNT, player, true);
							item2 = player.getInventory().getItemByItemId(Config.VOTE_REWARD1_ID);

							if (item2 == null || item2.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM1)
								player.addItem("reward", Config.VOTE_REWARD2_ID, Config.VOTE_REWARD2_COUNT, player, true);
					}
				}
				setLastVoteCount(getLastVoteCount() + Config.VOTES_FOR_REWARD);
				statement.close();
				_log.info("Vote Reward System: Reward for votes now!");
	            Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.CRITICAL_ANNOUNCE, "", "Vote Manager: Reward for players! Thanks for Vote."));
		}
			catch (SQLException e)
			{
				e.printStackTrace();
			}
			finally
			{
				L2DatabaseFactory.close(con);
			}

			setLastVoteCount(getLastVoteCount() + Config.VOTES_FOR_REWARD);
		}
		Broadcast.toAllOnlinePlayers(new CreatureSay(1, Say2.CRITICAL_ANNOUNCE, "", "Vote Manager: Server votes: " + votes + " | Next Reward on " + (getLastVoteCount() + Config.VOTES_FOR_REWARD) + " Votes."));
		if (getLastVoteCount() == 0)
			setLastVoteCount(votes);
	}
}
      
  private int getVotes(String urlString)
  {
      URL url = null;
      InputStreamReader isr = null;
      BufferedReader in = null;
      try
      {
          url = new URL(urlString);
          isr = new InputStreamReader(url.openStream());
          in = new BufferedReader(isr);
          String inputLine;
          while ((inputLine = in.readLine()) != null)
          {
        	  if (Config.VOTE_REWARD_TOPZONE_ENABLE)
        	  {
        		  // for TopZone
        		  if (inputLine.contains("<tr><td><div align=\"center\"><b><font style=\"font-size:14px;color:#018BC1;\""))
        		  {
        			  return Integer.valueOf(inputLine.split(">")[5].replace("</font", ""));
        		  }
        	  }
        	  if (Config.VOTE_REWARD_HOPZONE_ENABLE)
       	  {
        		  // for HopZone
        		  if (inputLine.contains("rank anonymous tooltip"))
        		  {
        			  @SuppressWarnings("unused")
        			  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;
        			  }
        			  return Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
        		  }
              }
          }
      }
      catch (IOException e)
      {
          _log.warning("Vote Reward System: "+e);
      }
      finally
      {
          try
          {
              in.close();
          }
          catch (IOException e)
          {}
          try
          {
              isr.close();
          }
          catch (IOException e)
          {}
      }
      return 0;
  }
      
  private void setLastVoteCount(int voteCount)
  {
      lastVoteCount = voteCount;
  }
      
  private int getLastVoteCount()
  {
      return lastVoteCount;
  }
  
  private void load()
  {
      int votes = 0;
      Connection con = null;
      try
      {
          con = L2DatabaseFactory.getInstance().getConnection();
          PreparedStatement statement = con.prepareStatement("SELECT vote FROM votes LIMIT 1");
          ResultSet rset = statement.executeQuery();

          while (rset.next())
          {
              votes = rset.getInt("vote");
          }
          rset.close();
          statement.close();
      }
      catch (Exception e)
      {
          _log.log(Level.WARNING, "data error on vote: ", e);
      }
      finally
      {
          L2DatabaseFactory.close(con);
      }
      
      setLastVoteCount(votes);
  }
  
  public void save()
  {
      Connection con = null;
      try
      {
          con = L2DatabaseFactory.getInstance().getConnection();
          PreparedStatement statement = con.prepareStatement("UPDATE votes SET vote = ? WHERE id=1");
          statement.setInt(1, getLastVoteCount());
          statement.execute();
          statement.close();
      }
      catch (Exception e)
      {
          _log.log(Level.WARNING, "data error on vote: ", e);
      }
      finally
      {
          L2DatabaseFactory.close(con);
      }
  }
  
  public static AutoVoteRewardHandler getInstance()
  {
     return SingletonHolder._instance;
  }
      
  @SuppressWarnings("synthetic-access")
  private static class SingletonHolder
  {
      protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler();
  }
}

 

that give me error and

import com.l2jserver.gameserver.model.item.instance.L2ItemInstance; 

L2ItemInstance item = null;

L2ItemInstance item2 = null;

 

it says : "Multiple markers at this line

- Occurrence of 'L2ItemInstance'

- L2ItemInstance cannot be resolved

to a type"

 

how to fix that ?

 

  • 6 months 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

    • most eggciting post in 2025 for sure!!!!
    • https://github.com/JulioPradoL2j/L2JDreamV2/commit/8f788b03c40404b72d7a321ef24e113f91a619ac     Descrição Este é um sistema de Reset de Personagem Personalizado criado para servidores L2J, inspirado em mecânicas clássicas de MMORPGs com foco em progressão PvP. Totalmente configurável via XML, este sistema permite criar um ciclo de evolução contínuo, recompensando jogadores que atingem o ápice com benefícios e novas metas.  Principais Funcionalidades Reset ativado ao atingir nível máximo, com requisitos de: Itens específicos Quantidade mínima de PvP Custo em moedas/itens Configuração via arquivo XML: Recompensas personalizáveis (itens, moedas, skills, etc) Redução de EXP ou retorno ao nível inicial Condições específicas para liberar o reset Sistema de Ranking: Rankings de Reset Diário e Mensal Premiação automática para os Top players Rankings reiniciam automaticamente no final do período Suporte a jogadores offline: Reset pode remover skills e aplicar recompensas direto no banco de dados Requisitos Técnicos Baseado em L2J DreamV2 / aCis 409 Compatível com bancos de dados MySQL Leitura de configuração via XML (resetData.xml)    Explicação das Configurações  Requisitos levelMax="80" → o jogador precisa atingir o nível 80. requiredPvps="0" → não exige PvP para resetar. expPenalty="0.8" → perde 20% da EXP total ao resetar. <item required="57-10000000;" /> → exige 10kk Adena.  Recompensas Recompensa fixa por reset: 57-15000 → 15k Adena 6392-3 → 3 unidades de item com ID 6392 Recompensa por skill (exemplo): 3135-4 (até nível 4) 3130-2 (até nível 2) 3131-10 (até nível 10)    Comandos para Administradores (Admin Commands) O sistema conta com comandos dedicados para encerrar manualmente os rankings de reset (diário ou mensal), forçando a distribuição imediata dos prêmios para os jogadores que se destacaram.  Comandos Disponíveis Comando Descrição //reset_end_daily Finaliza manualmente o ranking diário e distribui os prêmios configurados. //reset_end_monthly Finaliza manualmente o ranking mensal e distribui os prêmios configurados.   <?xml version="1.0" encoding="UTF-8"?> <list> <reset levelMax="80" requiredPvps="0" expPenalty="0.8"> <set rankingDisplayLimit="3" /> <set dailyPoints="2" /> <set monthlyPoints="1" /> <set removeResetSkills="true" /> <set logger="false" /> <requiredItems> <item required="57-10000000;" /> </requiredItems> <rewardItems> <item reward="57-15000;6392-3" skill="3135-4;3130-2;3131-10" /> </rewardItems> <prizes enable="true" type="DAILY" time="13:00"> <prize position="1" reward="57-15000;6392-3" /> <prize position="2" reward="57-10000;6392-2" /> <prize position="3" reward="57-5000;6392-1" /> </prizes> <prizes enable="true" type="MONTH" time="00:00"> <prize position="1" reward="57-15000;6392-3" /> <prize position="2" reward="57-10000;6392-2" /> <prize position="3" reward="57-5000;6392-1" /> </prizes> </reset> </list>  
    • This topic reminds me a bit of the old glory days! 😂 
    • Funny part is, i wouldnt make the effort of downvoting you if you weren't constantly sniping my profile to downvote me, and then when i downvote back you cry about it LOL
  • 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