-
Posts
90 -
Credits
0 -
Joined
-
Last visited
-
Days Won
1 -
Feedback
0%
Content Type
Articles
Profiles
Forums
Store
Posts posted by Kolibri
-
-
Hello all i have a problem with my vote system ... it works only for hopzone and topzone not ...2months ago worked fine then stopped working
/* * 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.l2jfrozen.gameserver.handler; import com.l2jfrozen.gameserver.powerpak.PowerPakConfig; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.gameserver.model.entity.Announcements; import com.l2jfrozen.gameserver.thread.ThreadPoolManager; import java.util.logging.Logger; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; public class AutoVoteRewardHandler { protected static final Logger _log = Logger.getLogger(AutoVoteRewardHandler.class.getName()); private int hopzoneVotesCount = 0; private int topzoneVotesCount = 0; protected List<String> already_rewarded; protected static boolean topzone = false; protected static boolean hopzone = false; private AutoVoteRewardHandler() { _log.info("Vote Reward System Initiated."); if (hopzone) { int hopzone_votes = getHopZoneVotes(); if (hopzone_votes == -1) { hopzone_votes = 0; } setHopZoneVoteCount(hopzone_votes); } if (topzone) { int topzone_votes = getTopZoneVotes(); if (topzone_votes == -1) { topzone_votes = 0; } setTopZoneVoteCount(topzone_votes); } ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), PowerPakConfig.VOTES_SYSYEM_INITIAL_DELAY, PowerPakConfig.VOTES_SYSYEM_STEP_DELAY); } protected class AutoReward implements Runnable { @Override public void run() { int minutes = (PowerPakConfig.VOTES_SYSYEM_STEP_DELAY / 1000) / 60; if (hopzone) { int hopzone_votes = getHopZoneVotes(); if (hopzone_votes != -1) { _log.info("[AutoVoteReward] Server HOPZONE Votes: " + hopzone_votes); Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] Actual HOPZONE Votes are " + hopzone_votes + "..."); if (hopzone_votes != 0 && hopzone_votes >= getHopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) { already_rewarded = new ArrayList<String>(); Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers(); Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] Great Work! Check your inventory for Reward!!"); //L2ItemInstance item; for (L2PcInstance player : pls) { if (player != null && !player.isOffline() && player.isOnline() == 1) { if (player._active_boxes <= 1 || (player._active_boxes > 1 && checkSingleBox(player))) { Set<Integer> items = PowerPakConfig.VOTES_REWARDS_LIST.keySet(); for (Integer i : items) { //item = player.getInventory().getItemByItemId(i); //TODO: check on maxstack for item player.addItem("reward", i, PowerPakConfig.VOTES_REWARDS_LIST.get(i), player, true); } } } } setHopZoneVoteCount(hopzone_votes); } Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] Next HOPZONE Reward in " + minutes + " minutes at " + (getHopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) + " Votes!!"); //site web Announcements.getInstance().gameAnnounceToAll("[SiteWeb] " + PowerPakConfig.SERVER_WEB_SITE); } } if (topzone && hopzone && PowerPakConfig.VOTES_SYSYEM_STEP_DELAY > 0) { try { Thread.sleep(PowerPakConfig.VOTES_SYSYEM_STEP_DELAY / 2); } catch (InterruptedException e) { _log.info(""); } } if (topzone) { int topzone_votes = getTopZoneVotes(); if (topzone_votes != -1) { _log.info("[AutoVoteReward] Server TOPZONE Votes: " + topzone_votes); Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] Actual TOPZONE Votes are " + topzone_votes + "..."); if (topzone_votes != 0 && topzone_votes >= getTopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) { already_rewarded = new ArrayList<String>(); Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers(); Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] Great Work! Check your inventory for Reward!!"); //L2ItemInstance item; for (L2PcInstance player : pls) { if (player != null && !player.isOffline() && player.isOnline() == 1) { if (player._active_boxes <= 1 || (player._active_boxes > 1 && checkSingleBox(player))) { Set<Integer> items = PowerPakConfig.VOTES_REWARDS_LIST.keySet(); for (Integer i : items) { //item = player.getInventory().getItemByItemId(i); //TODO: check on maxstack for item player.addItem("reward", i, PowerPakConfig.VOTES_REWARDS_LIST.get(i), player, true); } } } } setTopZoneVoteCount(topzone_votes); } Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] Next TOPZONE Reward in " + minutes + " minutes at " + (getTopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) + " Votes!!"); //site web Announcements.getInstance().gameAnnounceToAll("[SiteWeb] " + PowerPakConfig.SERVER_WEB_SITE); } } } } protected boolean checkSingleBox(L2PcInstance player) { if (player.getClient() != null && player.getClient().getConnection() != null && !player.getClient().getConnection().isClosed() && !player.isOffline()) { String playerip = player.getClient().getConnection().getInetAddress().getHostAddress(); if (already_rewarded.contains(playerip)) { return false; } already_rewarded.add(playerip); return true; } //if no connection (maybe offline shop) dnt reward return false; } protected int getHopZoneVotes() { 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_HOPZONE_URL); con = url.openConnection(); con.addRequestProperty("User-Agent", "Mozilla/4.76"); is = con.getInputStream(); isr = new InputStreamReader(is); in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { if (inputLine.contains("rank anonymous tooltip")) { votes = Integer.valueOf(inputLine.split(">")[2].replace("</span", "")); break; } } } catch (Exception e) { _log.info("[AutoVoteReward] Server HOPZONE is offline or something is wrong in link"); Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] HOPZONE is offline. We will check reward as it will be online again"); //e.printStackTrace(); } finally { if (in != null) { try { in.close(); } catch (IOException e1) { _log.info("unhandled exception"); } } if (isr != null) { try { isr.close(); } catch (IOException e1) { _log.info("unhandled exception"); } } if (is != null) { try { is.close(); } catch (IOException e1) { _log.info("unhandled exception"); } } } return votes; } protected int getTopZoneVotes() { 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_TOPZONE_URL); con = url.openConnection(); con.addRequestProperty("User-Agent", "Mozilla/4.76"); is = con.getInputStream(); isr = new InputStreamReader(is); in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { if (inputLine.contains("Votes")) { String votesLine = inputLine; votes = Integer.valueOf(votesLine.split(">")[3].replace("</div", "")); break; } } } catch (Exception e) { _log.info("[AutoVoteReward] Server TOPZONE is offline or something is wrong in link"); Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] TOPZONE is offline. We will check reward as it will be online again"); //e.printStackTrace(); } finally { if (in != null) { try { in.close(); } catch (IOException e1) { _log.info("unhandled exception"); } } if (isr != null) { try { isr.close(); } catch (IOException e1) { _log.info("unhandled exception"); } } if (is != null) { try { is.close(); } catch (IOException e1) { _log.info("unhandled exception"); } } } return votes; } protected void setHopZoneVoteCount(int voteCount) { hopzoneVotesCount = voteCount; } protected int getHopZoneVoteCount() { return hopzoneVotesCount; } protected void setTopZoneVoteCount(int voteCount) { topzoneVotesCount = voteCount; } protected int getTopZoneVoteCount() { return topzoneVotesCount; } public static AutoVoteRewardHandler getInstance() { if (PowerPakConfig.VOTES_SITE_HOPZONE_URL != null && !PowerPakConfig.VOTES_SITE_HOPZONE_URL.equals("")) { hopzone = true; } if (PowerPakConfig.VOTES_SITE_TOPZONE_URL != null && !PowerPakConfig.VOTES_SITE_TOPZONE_URL.equals("")) { topzone = true; } if (topzone || hopzone) { return SingletonHolder._instance; } return null; } @SuppressWarnings("synthetic-access") private static class SingletonHolder { protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler(); } }
-
STOP SPAMMING NOOB ITS NOT YOUR WORK
Here is the original thread...
http://www.l2jbrasil.com/index.php?/topic/101494-new-gm-shop-completo/
-
Your pack is frozen anyone wont buy it...
-
i changed the imports to match at aCis i addes w/o errors as i told you but it doesnt work
-
What about dp side? :dat:
dp side for what?
-
Hello all , i have this code
=========================================================================== gameserver.handler.ItemHandler.java =========================================================================== import com.l2jfrozen.gameserver.handler.itemhandlers.ChristmasTree; +import com.l2jfrozen.gameserver.handler.itemhandlers.ClanRepsItem; registerItemHandler(new ChestKey()); + registerItemHandler(new ClanRepsItem()); ================================================================================= gameserver.handler.itemhandlersClanRepsItem.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.l2jfrozen.gameserver.handler.itemhandlers; /** * * * @author Coyote * Adapted by Strike */ import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.handler.IItemHandler; import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance; import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser; public class ClanRepsItem implements IItemHandler { private static final int ITEM_IDS[] = { Config.CR_ITEM_REPS_ITEM_ID }; public void useItem(L2PlayableInstance playable, L2ItemInstance item) { if (!(playable instanceof L2PcInstance)) { return; } L2PcInstance activeChar = (L2PcInstance)playable; if (!activeChar.isClanLeader()) { activeChar.sendMessage("This can be used only by Clan Leaders!"); return; } else if (!(activeChar.getClan().getLevel() >= Config.CR_ITEM_MIN_CLAN_LVL)) { activeChar.sendMessage("Your Clan Level is not big enough to use this item!"); return; } else { activeChar.getClan().setReputationScore(activeChar.getClan().getReputationScore()+Config.CR_ITEM_REPS_TO_BE_AWARDED, true); activeChar.sendMessage("Your clan has earned "+ Config.CR_ITEM_REPS_TO_BE_AWARDED +" rep points!"); MagicSkillUser MSU = new MagicSkillUser(activeChar, activeChar, 2024, 1, 1, 0); activeChar.broadcastPacket(MSU); playable.destroyItem("Consume", item.getObjectId(), 1, null, false); } } public int[] getItemIds() { return ITEM_IDS; } }
and it doesnt work i add the code w/o errors but dont work in game .
-
download link?
-
Kapoios na t kanei lock SOLVED
-
pes mas ti project exeis kai ti client wste na se voethisoume.
px sto frozen exei configs gia auto pou psaxneis
acis exw
-
Γεια σας παιδια θα ηθελα λιγη βοηθεια.. π.χ οταν οι Tank φορανε Bow Να τους κατεβαινουν τα stats τ ιδιο κ με τους daggers οταν φορανε heavy
-
Good evening my friends.
This is my first guide and it will show you how to create and import your own icon.
I was looking for it for sometime and everything was so outdated so i decided to make my own.
First of all we gonna need some programs.
1st) Adobe Photoshop (Download Here)
2nd) An encrypter and UnrealED (Download Here)
1st Chapter - The Photoshop
i) You have to open photoshop and create a 32x32 page.
ii) After that you can create your own icon or use a ready one.
iii) Save it as .tga .
2nd Chapter - Encrypting
i) Open UnrealED. Create New Texture as the images below. Set the name.
ii) Import you .tga file and make compression DXT1. Then Save it in your desktop as .utx .
iii) Then you must encrypt the file like the images below, otherwise you will get an error from l2.
iv) After encrypting the result will be enc-GuideIcon.utx , just delete GuideIcon.utx and rename enc-GuideIcon.utx to GuideIcon.utx .
3nd Chapter - Importing
i) Replace the icon in etcitemgrp.dat (because in our case it was an enchant scroll).
ii) Save & encrypt as 413 and you are ready.
Credits for guide: Me
http://i.imgur.com/fqL1psw.jpg[/img]
http://i.imgur.com/8dPkVHU.jpg[/img]
http://i.imgur.com/6onpy0N.jpg[/img]
http://i.imgur.com/nkMTeZw.jpg[/img]
http://i.imgur.com/PvDPiNU.jpg[/img]
http://i.imgur.com/3fAweYb.jpg[/img]
http://i.imgur.com/7TLBMVs.jpg[/img]
http://i.imgur.com/sBTfu3e.jpg[/img]
http://i.imgur.com/gk1dSZx.jpg[/img]
http://i.imgur.com/NFZNbOk.jpg[/img]
http://i.imgur.com/SHXGqpx.jpg[/img]
to encypter den m to anoigei re boy :/
-
Work for Interlude?
-
Link plz?! :okey:
link for what? :y u no?:
-
O.o u have it the name from this rile is default-iconfig.xml u need to change the name to ipconifg.xml after this u open the files and set u ip
<?xml version="1.0" encoding="UTF-8"?>
<!-- Note: If file is named "ipconfig.xml" this data will be used as network configuration, otherwise server will configure it automatically! -->
<!-- Externalhost here (Internet IP) or Localhost IP for local test -->
<gameserver address="Here u IP" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../data/xsd/ipconfig.xsd">
<!-- Localhost here -->
<define subnet="127.0.0.0/8" address="127.0.0.1" />
<!-- Internalhosts here (LANs IPs) -->
<define subnet="10.0.0.0/8" address="10.0.0.0" />
<define subnet="172.16.0.0/19" address="172.16.0.0" />
<define subnet="192.168.0.0/16" address="192.168.0.0" />
</gameserver>
and after this u safe this file befor u try to open the server and im 100% sure u want try it and after this come the error adress alredy in use close the gameserver and the login whit the comand
ps aux | grep Login
ps aux | grep game
after this u see a list and u just kill it whit the comand
kill (and the nummber)
easy ^^
can explain it a bit more ?
-
u have forgott to over write the ipconfig.xml maybee ?
i dont have any file called ipconfig.xml
-
If you don't provide more info is really hard to find out what's going on.
But, the only 2 options:
1-Is your crappy frozen pack
2-Is your machine
a friend of me give me tis pack clean i think its called l2jchrome ..i added a lot of things and when i finished i run the server and i realized that server stucks that happened and from my Home -PC and from Vps machine that i tried [ intel core i7 3.2Ghz 8Gb ram 500GB Hard Disk and 1000mbs connection
-
There could be n/a reasons.
Which pack, where it stucks, do people online are stuck aswell, check gameserver logs if there is any information.
players stucks too
i checked on logs but nothing :/
Yes, Frozen pack :troll:
Its not frozen :)
-
Ofc players stuck. And yes, more than probably is because u use this L2jFrozen pack, try another IL provider and you'll see that your weird bugs, more than probably, disappear.
its not frozen pack
-
Its not frozen :)
players stucks tooi checked on logs but nothing :/
-
Hello all when i start my server after some minutes the whole server and login/gamserver consoles stuck for 3-5 minutes and sometimes for more.Does anyone know why this happen?
-
Γεια σας παιδια εχω θεμα με το "VOTE REWARD" απο topzone. Δοκιμασα τα φιξ που προτινουν καποιοι αλλα το δικο μου δεν εχει καν αυτες τις γραμμες του κωδικα εχω αυτο εδω....
====================================== confings =================================== # Vote reward for Topzone. AllowTopzoneVoteReward = True # Vote reward server link. TopzoneServerLink = http://l2topzone.com/lineage2/server-info/6296/L2ToxiccomProMMORPG.html/ # First page of servers list link. TopzoneFirstPageLink = http://l2topzone.com/lineage2/server-list/top.html/ # Votes for next reward needed. TopzoneVotesDifference = 5 # Rank needed for server to be on first page. TopzoneFirstPageRankNeeded = 15 # Minutes between rewards. # Eg. You put 5 it checks every 5 minutes for reward. TopzoneRewardCheckTime = 5 # Small reward(s). TopzoneSmallReward = 57,100000000; # Big reward(s). TopzoneBigReward = 3470,1; # Hopzone reward max dual boxes reward. # For example if you put 2 and someone has 3 boxes open 2 will be rewarded. TopzoneDuaboxesAllowed = 1 # Game server console report. # If set to true, game server console will get a report of # current vote count, votes needed for next reward and votes needed for first page. AllowTopzoneGameServerReport = True ================================================ Config.java ================================================= public static boolean ALLOW_TOPZONE_VOTE_REWARD; public static String TOPZONE_SERVER_LINK; public static String TOPZONE_FIRST_PAGE_LINK; public static int TOPZONE_VOTES_DIFFERENCE; public static int TOPZONE_FIRST_PAGE_RANK_NEEDED; public static int TOPZONE_REWARD_CHECK_TIME; public static Map<Integer, Integer> TOPZONE_SMALL_REWARD = new FastMap<Integer, Integer>(); public static Map<Integer, Integer> TOPZONE_BIG_REWARD = new FastMap<Integer, Integer>(); public static int TOPZONE_DUALBOXES_ALLOWED; public static boolean ALLOW_TOPZONE_GAME_SERVER_REPORT; ALLOW_TOPZONE_VOTE_REWARD = Boolean.parseBoolean(elcardia.getProperty("AllowTopzoneVoteReward", "false")); TOPZONE_SERVER_LINK = elcardia.getProperty("TopzoneServerLink", "http://l2.topzone.net/lineage2/details/74078/L2World-Servers/"); TOPZONE_FIRST_PAGE_LINK = elcardia.getProperty("TopzoneFirstPageLink", "http://l2.topzone.net/lineage2/"); TOPZONE_VOTES_DIFFERENCE = Integer.parseInt(elcardia.getProperty("TopzoneVotesDifference", "5")); TOPZONE_FIRST_PAGE_RANK_NEEDED = Integer.parseInt(elcardia.getProperty("TopzoneFirstPageRankNeeded", "15")); TOPZONE_REWARD_CHECK_TIME = Integer.parseInt(elcardia.getProperty("TopzoneRewardCheckTime", "5")); String TOPZONE_SMALL_REWARD_VALUE = elcardia.getProperty("TopzoneSmallReward", "57,100000000;"); String[] topzone_small_reward_splitted_1 = TOPZONE_SMALL_REWARD_VALUE.split(";"); for (String i : topzone_small_reward_splitted_1) { String[] topzone_small_reward_splitted_2 = i.split(","); TOPZONE_SMALL_REWARD.put(Integer.parseInt(topzone_small_reward_splitted_2[0]), Integer.parseInt(topzone_small_reward_splitted_2[1])); } String TOPZONE_BIG_REWARD_VALUE = elcardia.getProperty("TopzoneBigReward", "3470,1;"); String[] topzone_big_reward_splitted_1 = TOPZONE_BIG_REWARD_VALUE.split(";"); for (String i : topzone_big_reward_splitted_1) { String[] topzone_big_reward_splitted_2 = i.split(","); TOPZONE_BIG_REWARD.put(Integer.parseInt(topzone_big_reward_splitted_2[0]), Integer.parseInt(topzone_big_reward_splitted_2[1])); } TOPZONE_DUALBOXES_ALLOWED = Integer.parseInt(elcardia.getProperty("TopzoneDualboxesAllowed", "1")); ALLOW_TOPZONE_GAME_SERVER_REPORT = Boolean.parseBoolean(elcardia.getProperty("AllowTopzoneGameServerReport", "false")); =================================================== GameServer.java =================================================== if (Config.ALLOW_TOPZONE_VOTE_REWARD) { VoteRewardTopzone.getInstance(); } ================================================================== VoteRewardTopzone.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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ package net.sf.l2j.gameserver.model.entity; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Collection; import javolution.util.FastMap; import net.sf.l2j.Config; import net.sf.l2j.gameserver.Announcements; import net.sf.l2j.gameserver.ThreadPoolManager; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; /** * @author Anarchy * */ public class VoteRewardTopzone { // Configurations. private static String topzoneUrl = Config.TOPZONE_SERVER_LINK; private static String page1Url = Config.TOPZONE_FIRST_PAGE_LINK; private static int voteRewardVotesDifference = Config.TOPZONE_VOTES_DIFFERENCE; private static int firstPageRankNeeded = Config.TOPZONE_FIRST_PAGE_RANK_NEEDED; private static int checkTime = 60*1000*Config.TOPZONE_REWARD_CHECK_TIME; // Don't-touch variables. private static int lastVotes = 0; private static FastMap<String, Integer> playerIps = new FastMap<String, Integer>(); public static void updateConfigurations() { topzoneUrl = Config.TOPZONE_SERVER_LINK; page1Url = Config.TOPZONE_FIRST_PAGE_LINK; voteRewardVotesDifference = Config.TOPZONE_VOTES_DIFFERENCE; firstPageRankNeeded = Config.TOPZONE_FIRST_PAGE_RANK_NEEDED; checkTime = 60*1000*Config.TOPZONE_REWARD_CHECK_TIME; } public static void getInstance() { System.out.println("Vote reward system initialized."); ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable() { @Override public void run() { if (Config.ALLOW_TOPZONE_VOTE_REWARD) { reward(); } else { return; } } }, checkTime/2, checkTime); } private static void reward() { int firstPageVotes = getFirstPageRankVotes(); int currentVotes = getVotes(); if (firstPageVotes == -1 || currentVotes == -1) { if (firstPageVotes == -1) { System.out.println("There was a problem on getting votes from server with rank "+firstPageRankNeeded+"."); } if (currentVotes == -1) { System.out.println("There was a problem on getting server votes."); } return; } if (lastVotes == 0) { lastVotes = currentVotes; Announcements.getInstance().announceToAll("Vote reward: Current vote count is "+currentVotes+"."); Announcements.getInstance().announceToAll("Vote reward: We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for reward."); if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT) { System.out.println("Server votes on topzone: "+currentVotes); System.out.println("Votes needed for reward: "+((lastVotes+voteRewardVotesDifference)-currentVotes)); } if (firstPageVotes-lastVotes <= 0) { Announcements.getInstance().announceToAll("Vote reward: We are in the first page of topzone, so the reward will be big."); if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT) { System.out.println("Server is on the first page of topzone."); } } else { Announcements.getInstance().announceToAll("Vote reward: We need "+(firstPageVotes-lastVotes)+" vote(s) to get to the first page of topzone for big reward."); if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT) { System.out.println("Server votes needed for first page: "+(firstPageVotes-lastVotes)); } } Announcements.getInstance().announceToAll("Vote reward: Type .menu to see what the big and what the small reward is."); return; } if (currentVotes >= lastVotes+voteRewardVotesDifference) { Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values(); if (firstPageVotes-currentVotes <= 0) { if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT) { System.out.println("Server votes on topzone: "+currentVotes); System.out.println("Server is on the first page of topzone."); System.out.println("Votes needed for next reward: "+((currentVotes+voteRewardVotesDifference)-currentVotes)); } Announcements.getInstance().announceToAll("Vote reward: Everyone has been rewarded with big reward."); Announcements.getInstance().announceToAll("Vote reward: Current vote count is "+currentVotes+"."); Announcements.getInstance().announceToAll("Vote reward: Type .menu to see what the big and what the small reward is."); for (L2PcInstance p : pls) { boolean canReward = false; String pIp = p.getClient().getConnection().getInetAddress().getHostAddress(); if (playerIps.containsKey(pIp)) { int count = playerIps.get(pIp); if (count < Config.TOPZONE_DUALBOXES_ALLOWED) { playerIps.remove(pIp); playerIps.put(pIp, count+1); canReward = true; } } else { canReward = true; playerIps.put(pIp, 1); } if (canReward) { for (int i : Config.TOPZONE_BIG_REWARD.keySet()) { p.addItem("Vote reward.", i, Config.TOPZONE_BIG_REWARD.get(i), p, true); } } else { p.sendMessage("Already "+Config.TOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded."); } } playerIps.clear(); } else { if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT) { System.out.println("Server votes on topzone: "+currentVotes); System.out.println("Server votes needed for first page: "+(firstPageVotes-lastVotes)); System.out.println("Votes needed for next reward: "+((currentVotes+voteRewardVotesDifference)-currentVotes)); } Announcements.getInstance().announceToAll("Vote reward: Everyone has been rewarded with small reward."); Announcements.getInstance().announceToAll("Vote reward: Current vote count is "+currentVotes+"."); Announcements.getInstance().announceToAll("Vote reward: We need "+(firstPageVotes-currentVotes)+" vote(s) to get to the first page of topzone for big reward."); Announcements.getInstance().announceToAll("Vote reward: Type .menu to see what the big and what the small reward is."); for (L2PcInstance p : pls) { boolean canReward = false; String pIp = p.getClient().getConnection().getInetAddress().getHostAddress(); if (playerIps.containsKey(pIp)) { int count = playerIps.get(pIp); if (count < Config.TOPZONE_DUALBOXES_ALLOWED) { playerIps.remove(pIp); playerIps.put(pIp, count+1); canReward = true; } } else { canReward = true; playerIps.put(pIp, 1); } if (canReward) { for (int i : Config.TOPZONE_SMALL_REWARD.keySet()) { p.addItem("Vote reward.", i, Config.TOPZONE_SMALL_REWARD.get(i), p, true); } } else { p.sendMessage("Already "+Config.TOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded."); } } playerIps.clear(); } lastVotes = currentVotes; } else { if (firstPageVotes-currentVotes <= 0) { if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT) { System.out.println("Server votes on topzone: "+currentVotes); System.out.println("Server is on the first page of topzone."); System.out.println("Votes needed for next reward: "+((lastVotes+voteRewardVotesDifference)-currentVotes)); } Announcements.getInstance().announceToAll("Vote reward: Current vote count is "+currentVotes+"."); Announcements.getInstance().announceToAll("Vote reward: We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for big reward."); Announcements.getInstance().announceToAll("Vote reward: Type .menu to see what the big and what the small reward is."); } else { if (Config.ALLOW_TOPZONE_GAME_SERVER_REPORT) { System.out.println("Server votes on topzone: "+currentVotes); System.out.println("Server votes needed for first page: "+(firstPageVotes-lastVotes)); System.out.println("Votes needed for next reward: "+((lastVotes+voteRewardVotesDifference)-currentVotes)); } Announcements.getInstance().announceToAll("Vote reward: Current vote count is "+currentVotes+"."); Announcements.getInstance().announceToAll("Vote reward: We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for small reward."); Announcements.getInstance().announceToAll("Vote reward: We need "+(firstPageVotes-currentVotes)+" vote(s) to get to the first page of topzone for big reward."); Announcements.getInstance().announceToAll("Vote reward: Type .menu to see what the big and what the small reward is."); } } } private static int getFirstPageRankVotes() { InputStreamReader isr = null; BufferedReader br = null; try { URLConnection con = new URL(page1Url).openConnection(); con.addRequestProperty("User-Agent", "Mozilla/4.76"); isr = new InputStreamReader(con.getInputStream()); br = new BufferedReader(isr); String line; int i = 0; while ((line = br.readLine()) != null) { if (line.contains("<td><div align=\"center\">"+firstPageRankNeeded+"</div></td>")) { i++; } if (line.contains("<td><div align=\"center\">") && i == 1) { i++; } if (line.contains("<td><div align=\"center\">") && i == 2) { i = 0; int votes = Integer.valueOf(line.split(">")[2].replace("</div", "")); return votes; } } br.close(); isr.close(); } catch (Exception e) { System.out.println(e); System.out.println("Error while getting server vote count."); } return -1; } private static int getVotes() { InputStreamReader isr = null; BufferedReader br = null; try { URLConnection con = new URL(topzoneUrl).openConnection(); con.addRequestProperty("User-Agent", "Mozilla/4.76"); isr = new InputStreamReader(con.getInputStream()); br = new BufferedReader(isr); boolean got = false; String line; while ((line = br.readLine()) != null) { if (line.contains("<tr><td><div align=\"center\"><b><font style=\"font-size:14px;color:#018BC1;\"") && !got) { got = true; int votes = Integer.valueOf(line.split("=\"font-size:14px;color:#018BC1;\">")[1].replace("</font></b></div></td></tr>", "")); return votes; } } br.close(); isr.close(); } catch (Exception e) { System.out.println(e); System.out.println("Error while getting server vote count."); } return -1; } }
-
will work on interlude?
-
Hello all i need a vote system for topzone cause the one that i have doesn't work anymore :/ i did the fix that other members suggest but still not working :// Does anyone has a working vote system ?
-
Hey dude i have an error on L2PcInstance ---- if (CastleWars.CastleWarsRunning && (isinZodiac && pk.isinZodiac))
{
sendMessage("You will be revived in your spot");
}
if((pk.isinZodiac&&pk.isinZodiac) && CaptureThem.CaptureThemRunning)
pk.ZodiacPoints ++;
Vote System Problem
in Request Server Development Help [L2J]
Posted
the 1st i've already done it i'll try the other