Jump to content

cutitarii

Members
  • Posts

    74
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

About cutitarii

Contact Methods

  • Website URL
    http://cutitarii.ro

Profile Information

  • Gender
    Male
  • Location
    Hunedoara!
  • Interests
    BbY

cutitarii's Achievements

Newbie

Newbie (1/16)

0

Reputation

  1. you use reward on Hopzone? if u use in hopzone... give me your code :d please ! :)
  2. man i tried... not working in topzone... i tired in hopzone... and need help for fix code for hopzone... i have players on server :| i need auto give reward for votes... for give manual it's hard... 24/7 on PC... hard... :|
  3. i have http://img444.imageshack.us/img444/1103/have.png
  4. nop... no checking... :| i voted all players in hopzone and java checking 0/10 votes :|
  5. Hello... i have a new java code: AutoVoteRewardManager.java package com.l2jserver.gameserver.instancemanager; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import com.l2jserver.Config; import com.l2jserver.L2DatabaseFactory; import com.l2jserver.gameserver.Announcements; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; public class AutoVoteRewardManager { private static Logger _log = Logger.getLogger(AutoVoteRewardManager.class.getName()); private static final String http = "http://l2.hopzone.net/lineage2/moreinfo/L2-NeXtGeN/92153.html"; private static final int initialCheck = 1 * 1000; private static final int delayForCheck = 400 * 400; private static final int[] itemId = { 33340, 33399 }; private static final int[] itemCount = { 2, 5 }; private static final int votesRequiredForReward = 10; private static List<String> _ips = new ArrayList<String>(); private static int lastVoteCount = 0; private AutoVoteRewardManager() { _log.info("AutoVoteRewardManager: Vote reward system initiated."); if (Config.L2JMOD_VOTE_ENGINE_SAVE) load(); ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck); } private class AutoReward implements Runnable { public void run() { int votes = getVotes(); _log.info("AutoVoteRewardManager: We now have " + votes + "/"+(getLastVoteCount()+votesRequiredForReward)+" vote(s). Next check in "+(delayForCheck/1000)+" sec."); Announcements.getInstance().announceToAll("Visit [url=http://www.l2nextgen.com]www.l2nextgen.com[/url] and vote server on HopZone for Reward"); if (votes >= getLastVoteCount() + votesRequiredForReward) { Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values(); { for (L2PcInstance onlinePlayer : pls) { if (onlinePlayer.isOnline() && !onlinePlayer.getClient().isDetached() && !_ips.contains(onlinePlayer.getClient().getConnection().getInetAddress().getHostAddress())) { for (int i = 0; i < itemId.length; i++) { onlinePlayer.addItem("vote_reward", itemId[i], itemCount[i], onlinePlayer, true); } _ips.add(onlinePlayer.getClient().getConnection().getInetAddress().getHostAddress()); } } } _log.info("AutoVoteRewardManager: Reward for votes now!"); Announcements.getInstance().announceToAll("Reward for players! Thanks for Vote."); setLastVoteCount(getLastVoteCount() + votesRequiredForReward); } if (getLastVoteCount() == 0) { setLastVoteCount(votes); } else if ((getLastVoteCount() + votesRequiredForReward) - votes > votesRequiredForReward || votes > (getLastVoteCount() + votesRequiredForReward)) { setLastVoteCount(votes); } Announcements.getInstance().announceToAll("We have " + votes + " vote(s). Next reward on " + (getLastVoteCount()+votesRequiredForReward) + " vote."); _ips.clear(); } } public static int getVotes() { URL url = null; InputStreamReader isr = null; BufferedReader in = null; try { url = new URL(http); URLConnection con = url.openConnection(); con.addRequestProperty("User-Agent", "Mozilla/4.76"); isr = new InputStreamReader(con.getInputStream()); in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { // for top-zone //if (inputLine.contains("<tr><td><div align=\"center\"><b><font style=\"font-size:14px;color:#018BC1;\"")) //{ //return Integer.valueOf(inputLine.split(">")[5].replace("</font", "")); //} //for hopzone if (inputLine.contains("moreinfo_total_rank_text")) return Integer.valueOf(inputLine.split(">")[2].replace("</div", "")); } } catch (IOException e) { e.printStackTrace(); } 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 AutoVoteRewardManager getInstance() { return SingletonHolder._instance; } @SuppressWarnings("synthetic-access") private static class SingletonHolder { protected static final AutoVoteRewardManager _instance = new AutoVoteRewardManager(); } } And: AutoVoteRewardHandler.java /* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * http://www.gnu.org/copyleft/gpl.html */ package com.l2jserver.gameserver.model; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import com.l2jserver.Config; import com.l2jserver.gameserver.Announcements; import com.l2jserver.gameserver.GmListTable; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; /** * * @author GoldenBoy * */ public class AutoVoteRewardHandler { private int lastVoteCount = 0; private int initialCheck = 60 * 1000; private int delayForCheck = Config.DELAY_FOR_NEXT_REWARD * 1000; private AutoVoteRewardHandler() { if (Config.VOTE_REWARD_ENABLE) { System.out.println("========= "+Config.SERVER_NAME_FOR_VOTES+" ========="); System.out.println("Vote Reward System activated"); System.out.println("========= "+Config.SERVER_NAME_FOR_VOTES+" ========="); ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck); } } private class AutoReward implements Runnable { public void run() { if (Config.VOTE_REWARD_ENABLE) { System.out.println(""); System.out.println("=================="); System.out.println("Vote Count Check."); if (Config.VOTE_REWARD1_ID == 0 || Config.VOTE_REWARD1_COUNT == 0 || Config.VOTE_REWARD2_ID == 0 || Config.VOTE_REWARD2_COUNT == 0) { GmListTable.broadcastMessageToGMs("The rewards aren't Identified. Please take a look."); return; } int newVoteCount = getVotes(Config.VOTE_HTML_PATCH); System.out.println("getLastVoteCount:"+getLastVoteCount()); System.out.println("newVoteCount:"+newVoteCount); System.out.println("=================="); System.out.println(""); if (newVoteCount != 0 && getLastVoteCount() != 0 && newVoteCount >= getLastVoteCount() + Config.VOTES_FOR_REWARD) { for (L2PcInstance player : L2World.getInstance().getAllPlayers().values()) { if (player != null) { L2ItemInstance item1 = player.getInventory().getItemByItemId(Config.VOTE_REWARD1_ID); if (item1 == null || item1.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM1) { if (player.getAppearance().getNameColor() != Config.OFFLINE_NAME_COLOR) { player.addItem("reward", Config.VOTE_REWARD1_ID, Config.VOTE_REWARD1_COUNT, player, true); } } else { player.sendMessage("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "You have reached our limit for vote reward items!!"); } L2ItemInstance item2 = player.getInventory().getItemByItemId(Config.VOTE_REWARD2_ID); if (item2 == null || item2.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM2) { if (player.getAppearance().getNameColor() != Config.OFFLINE_NAME_COLOR) { player.addItem("reward", Config.VOTE_REWARD2_ID, Config.VOTE_REWARD2_COUNT, player, true); } } else { player.sendMessage("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "You have reached our limit for vote reward items!!"); } } } setLastVoteCount(newVoteCount); } Announcements.getInstance().announceToAll("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "Our Current vote count is: " + newVoteCount); Announcements.getInstance().announceToAll("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "The next reward will be given at " + (getLastVoteCount()+ Config.VOTES_FOR_REWARD) + " Votes."); if (getLastVoteCount() == 0) { setLastVoteCount(newVoteCount); } } } } private int getVotes(String urlString) { InputStreamReader isr = null; BufferedReader in = null; try { URL url = new URL(urlString); URLConnection con = (URLConnection) url.openConnection(); con.addRequestProperty("User-Agent", "Mozilla/4.76"); isr = new InputStreamReader(con.getInputStream()); //isr = new InputStreamReader(url.openStream()); in = new BufferedReader(isr); String inputLine; int voteCount = 0; while ((inputLine = in.readLine()) != null) { if (inputLine.contains("moreinfo_total_rank_text")) { 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; } voteCount = Integer.parseInt(inputLine.substring(inputLine.length() - Sub, inputLine.length() - 11)); break; } } return voteCount; } catch (IOException e) { e.printStackTrace(); return 0; } finally { try { in.close(); } catch (IOException e) { } try { isr.close(); } catch (IOException e) { } } } /** * @return */ private void setLastVoteCount(int voteCount) { lastVoteCount = voteCount; } private int getLastVoteCount() { return lastVoteCount; } public static AutoVoteRewardHandler getInstance() { return SingletonHolder._instance; } @SuppressWarnings("synthetic-access") private static class SingletonHolder { protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler(); } } Problem with check Please help me with corect code :|
  6. im need for hopzone no topzone and teste your code... not working
  7. Hello... i have problem with Vote Reward... i have this code: package com.l2jserver.gameserver.instancemanager; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.Collection; import com.l2jserver.gameserver.Announcements; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; public class AutoVoteRewardHandler { private final String HOPZONE = "http://l2.hopzone.net/lineage2/moreinfo/L2-NeXtGeN/92153.html"; // 60 * 1000(1000milliseconds = 1 second) = 60seconds private final int initialCheck = 60 * 1000; // 1800 * 1000(1000milliseconds = 1 second) = 1800seconds = 30minutes private final int delayForCheck = 600 * 1000; private final int[] itemId = {33399, 33340 }; private final int[] itemCount = { 5, 2}; private final int[] maxStack = { 1, 1 }; private final int votesRequiredForReward = 10; // do not change private int lastVoteCount = 0; private static ArrayList<String> _listedIps; private AutoVoteRewardHandler() { System.out.println("Vote Reward System Initiated."); ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck); } private class AutoReward implements Runnable { @Override public void run() { int votes = getVotes(); System.out.println("Server Votes: " + votes); if (votes != 0 && getLastVoteCount() != 0 && votes >= getLastVoteCount() + votesRequiredForReward) { Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values(); int onlinePlayers = 0; for (L2PcInstance pl : pls) { if (pl.isOnline() && !pl.getClient().isDetached()) { onlinePlayers++; } } _listedIps = new ArrayList<String>(onlinePlayers); L2ItemInstance item; for (L2PcInstance player : pls) { if (player != null && player.isOnline() && !player.getClient().isDetached()) { for (int i = 0; i < itemId.length; i++) { item = player.getInventory().getItemByItemId(itemId[i]); if (item == null || item.getCount() < maxStack[i]) { String host = player.getClient().getConnection().getInetAddress().getHostAddress(); if (host != null && !_listedIps.contains(host)) _listedIps.add(host); else return; player.addItem("reward", itemId[i], itemCount[i], player, true); } } } } setLastVoteCount(getLastVoteCount() + votesRequiredForReward); } Announcements.getInstance().announceToAll("Server Votes: " + votes + " | Next Reward on " + (getLastVoteCount() + votesRequiredForReward) + " Votes."); if (getLastVoteCount() == 0) { setLastVoteCount(votes); } } } private int getVotes() { URL url = null; InputStreamReader isr = null; BufferedReader in = null; try { url = new URL(HOPZONE); URLConnection con = (URLConnection) url.openConnection(); con.addRequestProperty("User-Agent", "Mozilla/4.76"); isr = new InputStreamReader(con.getInputStream()); //isr = new InputStreamReader(url.openStream()); in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { if (inputLine.contains("moreinfo_total_rank_text")) { return Integer.valueOf(inputLine.split(">")[2].replace("</div", "")); } } } catch (IOException e) { e.printStackTrace(); } 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; } public static AutoVoteRewardHandler getInstance() { return SingletonHolder._instance; } @SuppressWarnings("synthetic-access") private static class SingletonHolder { protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler(); } } no have error ... nothing... have one problem: I voted in hopzone and in server result is: Server Votes: 0 | Next Reward on: 10 votes please help me... :| no counting votes on hopzone
  8. not working... :| I tried after tutorial and not work... any solution? EDIT: Buildfile: C:\workspace\x1\L2J_Server\build.xml clean: checkRequirements: getChangelogDateVersion: [exec] Result: 1 [exec] Result: 1 init: [mkdir] Created dir: C:\workspace\x1\L2J_Server\build [mkdir] Created dir: C:\workspace\x1\L2J_Server\build\classes compile: [javac] Compiling 1534 source files to C:\workspace\x1\L2J_Server\build\classes jar: [jar] Building jar: C:\workspace\x1\L2J_Server\build\dist\login\l2jlogin.jar [jar] Building jar: C:\workspace\x1\L2J_Server\build\dist\gameserver\l2jserver.jar dist: [copy] Copying 11 files to C:\workspace\x1\L2J_Server\build\dist\doc [copy] Copying 30 files to C:\workspace\x1\L2J_Server\build\dist\gameserver [copy] Copying 7 files to C:\workspace\x1\L2J_Server\build\dist\images [copy] Copying 2 files to C:\workspace\x1\L2J_Server\build\dist\languages [copy] Copying 13 files to C:\workspace\x1\L2J_Server\build\dist\libs [copy] Copying 16 files to C:\workspace\x1\L2J_Server\build\dist\login [zip] Building zip: C:\workspace\x1\L2J_Server\build\L2J_Server.zip BUILD SUCCESSFUL Total time: 27 seconds successful working! Thank you. i tried a new version ;d
  9. hello... i have a problem in compile server :| Buildfile: D:\Server\Backup\workspace\x1\L2J_Server\build.xml clean: checkRequirements: getChangelogDateVersion: BUILD FAILED D:\Server\Backup\workspace\x1\L2J_Server\build.xml:143: Execute failed: java.io.IOException: Cannot run program "svn": CreateProcess error=2, The system cannot find the file specified Total time: 594 milliseconds And in build.xml line 143 is: <exec dir="." executable="svn" outputproperty="l2j.changelog"> who help me pls ;\
  10. ?! please no give reply if you do not like :) thank you.
  11. Forum Link: http://www.l2nextgen.com/forum/ Site Link: http://www.l2nextgen.com/ Server Info Rates: * XP Rate: x500 * SP Rate: x500 * Adena Rate: x500 * Drop Rate: x10 * Quest Rate: x10 * Spoil Rate: x10 * Normal Enchant Weapon: 65% * Normal Enchant Armor: 65% * Normal Enchant Jewelry: 65% * Blessed Enchant Weapon: 90% * Blessed Enchant Armor: 90% * Blessed Enchant Jewelry: 90% * Enchant Max Weapon: 20 * Enchant Max Armor: 25 * Enchant Safe Max: 7 Events: * Team Vs Team (TvT): Every hour Special Drop * Elpy Event (Started Manual GM): Every day * Special Event (On choice GMs): Every day Special Drop->Reward Special custom NPC's: * GM Shop: Yes * Global Gatekeeper: Yes * Normal Gatekeeper: Yes * Augumenter: Yes * Symbol Maker: Yes * Warehouse (clan/private): Yes * Special Trader: Yes * Wedding Manager: Yes * Attribute Master: Yes * Noblesse Manager (No need quest): YES * Olympiad Rank: Yes * Full Buffer: Yes * Title Color: Yes * Server Info: Yes * Class Master: Yes * Gift of Vitality: Yes And other NPC's... Other: * GameMaster Every days ONLINE * Custom Armor * Custom Cloaks * Custom Items * 3 Max Sub-Class * Max 85 LvL with Sub-Class * Buff time 2 hours * 38 Buff Slots * 18 Song/Dance Slots * Experienced Team * Allowed DualBox max/3 * Certification Skills * Castle Sieges * Fortress Sieges * Territory Wars * Offline Shops * Mailing system * High Quality Geodata * Full Security Anti Flood / Anti DDoS * Custom Farm Zone * Auto Loot * Seven Sign * Olympiad Working full! * Olympiad Every 2 weekend * Max clan lvl 11 * Champion is Enabled/Passive * Banking is Enabled * Auto-Reward on pvp/pk kills * Auto Reward vote system * Auto Create account
  12. [RO]te astept cu serverul la mine in com daca nu ai comunitate pentru el :) http://www.lunetistii.ro ;)
×
×
  • Create New...