DeathSpank287 Posted July 17, 2012 Posted July 17, 2012 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 Quote
vasilios Posted September 10, 2012 Posted September 10, 2012 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?? Quote
Mhoska Posted September 10, 2012 Posted September 10, 2012 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 :) Quote
lowrider88 Posted September 12, 2012 Posted September 12, 2012 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 Quote
lowrider88 Posted September 13, 2012 Posted September 13, 2012 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: Quote
Stewie Posted October 11, 2012 Posted October 11, 2012 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 Quote
Stewie Posted October 11, 2012 Posted October 11, 2012 Okey after i transfer L2jls in to L2jgs... it's working good, no errors :D Quote
ShitPvP Posted November 14, 2012 Posted November 14, 2012 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 Quote
nery Posted December 30, 2012 Posted December 30, 2012 someone got the bug to accept the link here: VoteHtmlPatch = http://l2.hopzone.net ???? Quote
nery Posted January 20, 2013 Posted January 20, 2013 [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. ? ? ? ? ? ? Quote
nery Posted January 23, 2013 Posted January 23, 2013 help count vote ServerNameForVotes = KingServerBr VoteHtmlPatch = http://l2topzone.com or ServerNameForVotes = KingServerBr VoteHtmlPatch = http://l2topzone.com/vote.php?id=8708 ? ? ? ? ? ? help plis Quote
TreVor Posted January 26, 2013 Posted January 26, 2013 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: I have this error how to fix? My database name for login and game l2jls Quote
Luffy® Posted February 26, 2013 Posted February 26, 2013 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 ? Quote
pedroncillo Posted September 13, 2013 Posted September 13, 2013 thanks for it!! tested and are working 100% :D Quote
Recommended Posts
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.