Jump to content

TraineeDreamer

Members
  • Posts

    152
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by TraineeDreamer

  1. of course i am lol
  2. το enterwolrd το βρηκες?
  3. i just compiled acis and i searched on configs and there arent any options for control them.am i blind or what?
  4. GL!!Too many gears i dont like this
  5. i must say it u have done wonderful job with advertising ...ur website is also amazing ...u deserver to do something good this time
  6. THATS WHAT I AM SAYING HE HAD +14 AND MADE ME 4K !!
  7. so its time to open it..
  8. when will open?
  9. 4.3k damage from archer with +14 weapon and i am mage with +14 armor thats great!
  10. ppl dont trust u anymore because ur behaviour was too bad nothing else ....i hope u succeed really!
  11. i want to add at my server's website statues about if server is online/offline but dont know how to do it ...anyone good help me?
  12. ee dwse 20 euro k parto re
  13. Auto Reward Code: ### Eclipse Workspace Patch 1.0 #P L2jFrozen_GameServer Index: head-src/com/l2jfrozen/gameserver/managers/AutoRewardManager.java =================================================================== --- head-src/com/l2jfrozen/gameserver/managers/AutoRewardManager.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/managers/AutoRewardManager.java (revision 0) @@ -0,0 +1,76 @@ +/* + * Copyright © 2013 AdminsProL2 + * + * 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 com.l2jfrozen.gameserver.managers; + +import java.util.Collection; +import java.util.Set; + +import com.l2jfrozen.Config; +import com.l2jfrozen.gameserver.model.L2World; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; +import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage; +import com.l2jfrozen.gameserver.powerpak.PowerPakConfig; +import com.l2jfrozen.gameserver.thread.ThreadPoolManager; + + +/** + *@author fissban && CaFi + */ +public class AutoRewardManager +{ + static final int initialCheck = Config.AUTO_REWARD_DELAY * 60000; + static final int delayForCheck = Config.AUTO_REWARD_DELAY * 60000; + + AutoRewardManager() + { + if (Config.ALLOW_AUTO_REWARDER) + { + ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck); + } + } + + protected class AutoReward implements Runnable + { + @Override + public void run() + { + Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers(); + + for (L2PcInstance player : pls) + { + player.sendPacket(new ExShowScreenMessage("Felicitaciones has sido premiado, proximo Reward en: " + delayForCheck, 6000)); + + Set<Integer> items = PowerPakConfig.VOTES_REWARDS_LIST.keySet(); + for (Integer i : items) + { + player.addItem("AutoReward", i, Config.AUTO_REWARDS_LIST.get(i), player, true); + } + } + } + } + + public static AutoRewardManager getInstance() + { + return SingletonHolder._instance; + } + + static class SingletonHolder + { + protected static final AutoRewardManager _instance = new AutoRewardManager(); + } +} Index: head-src/com/l2jfrozen/FService.java =================================================================== --- head-src/com/l2jfrozen/FService.java (revision 1004) +++ head-src/com/l2jfrozen/FService.java (working copy) @@ -53,6 +53,7 @@ public static final String CRAFTING = "./config/functions/crafting.properties"; public static final String DEVELOPER = "./config/functions/developer.properties"; public static final String L2JFROZEN_CONFIG_FILE = "./config/functions/l2jfrozen.properties"; + public static final String ADMINSPROL2_CONFIG_FILE = "./config/functions/AdminsProL2.properties"; public static final String PHYSICS_CONFIGURATION_FILE = "./config/functions/physics.properties"; public static final String PVP_CONFIG_FILE = "./config/functions/pvp.properties"; public static final String POWERPAK_FILE = "./config/powerpak/powerpak.properties"; Index: head-src/com/l2jfrozen/Config.java =================================================================== --- head-src/com/l2jfrozen/Config.java (revision 1004) +++ head-src/com/l2jfrozen/Config.java (working copy) @@ -2525,7 +2525,37 @@ } } + //============================================================ + public static boolean ALLOW_AUTO_REWARDER; + public static int AUTO_REWARD_DELAY; + public static FastMap<Integer, Integer> AUTO_REWARDS_LIST; + public static String AUTO_REWARDS; + //============================================================ + public static void loadAdminsProL2Config() + { + final String ADMINSPROL2 = FService.ADMINSPROL2_CONFIG_FILE; + + try + { + Properties AdminsProL2Settings = new Properties(); + InputStream is = new FileInputStream(new File(ADMINSPROL2)); + AdminsProL2Settings.load(is); + is.close(); + + ALLOW_AUTO_REWARDER = Boolean.parseBoolean(AdminsProL2Settings.getProperty("AllowAutoRewarder", "True")); + AUTO_REWARD_DELAY = Integer.parseInt(AdminsProL2Settings.getProperty("AutoRewardDelay", "1200")); + AUTO_REWARDS = AdminsProL2Settings.getProperty("VotesRewards", ""); + AUTO_REWARDS_LIST = new FastMap<Integer, Integer>(); + } + catch(Exception e) + { + e.printStackTrace(); + throw new Error("Failed to Load " + ADMINSPROL2 + " File."); + } + } + + //============================================================ public static int KARMA_MIN_KARMA; public static int KARMA_MAX_KARMA; public static int KARMA_XP_DIVIDER; Index: head-src/com/l2jfrozen/gameserver/GameServer.java =================================================================== --- head-src/com/l2jfrozen/gameserver/GameServer.java (revision 1004) +++ head-src/com/l2jfrozen/gameserver/GameServer.java (working copy) @@ -87,6 +87,7 @@ import com.l2jfrozen.gameserver.handler.VoicedCommandHandler; import com.l2jfrozen.gameserver.idfactory.IdFactory; import com.l2jfrozen.gameserver.managers.AuctionManager; +import com.l2jfrozen.gameserver.managers.AutoRewardManager; import com.l2jfrozen.gameserver.managers.AutoSaveManager; import com.l2jfrozen.gameserver.managers.AwayManager; import com.l2jfrozen.gameserver.managers.BoatManager; @@ -565,6 +566,9 @@ if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS) OfflineTradeTable.restoreOfflineTraders(); + Util.printSection("L2jAdmins"); + AutoRewardManager.getInstance(); + Util.printSection("Info"); _log.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch()); _log.info("Available CPUs: " + Util.getAvailableProcessors()); Index: config/functions/Adminsprol2.properties =================================================================== --- config/functions/Adminsprol2.properties (revision 0) +++ config/functions/Adminsprol2.properties (revision 0) @@ -0,0 +1,10 @@ +#============================================================# +# Server Config # +#============================================================# + +# Auto rewarder. +AllowAutoRewarder = True +# Delay for reward. (in seconds) +AutoRewardDelay = 1200 +# ID of item reward. +AutoRewards= 6392,20; Code Vote RewardTopzone/Hopzone: ### Eclipse Workspace Patch 1.0 #P L2jFrozen_GameServer Index: head-src/com/l2jfrozen/Config.java =================================================================== --- head-src/com/l2jfrozen/Config.java (revision 938) +++ head-src/com/l2jfrozen/Config.java (working copy) @@ -878,6 +878,89 @@ throw new Error("Failed to Load " + OTHER + " File."); } } + + public static boolean ALLOW_HOPZONE_VOTE_REWARD; + public static String HOPZONE_SERVER_LINK; + public static String HOPZONE_FIRST_PAGE_LINK; + public static int HOPZONE_VOTES_DIFFERENCE; + public static int HOPZONE_FIRST_PAGE_RANK_NEEDED; + public static int HOPZONE_REWARD_CHECK_TIME; + public static Map<Integer, Integer> HOPZONE_SMALL_REWARD = new FastMap<Integer, Integer>(); + public static Map<Integer, Integer> HOPZONE_BIG_REWARD = new FastMap<Integer, Integer>(); + public static int HOPZONE_DUALBOXES_ALLOWED; + public static boolean ALLOW_HOPZONE_GAME_SERVER_REPORT; + 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; + + public static void loadVoteConfig() + { + final String VOTE = FService.VOTE_FILE; + try + { + Properties elcardia = new Properties(); + InputStream is = new FileInputStream(new File(VOTE)); + elcardia.load(is); + is.close(); + + ALLOW_HOPZONE_VOTE_REWARD = Boolean.parseBoolean(elcardia.getProperty("AllowHopzoneVoteReward", "false")); + HOPZONE_SERVER_LINK = elcardia.getProperty("HopzoneServerLink", "http://l2.hopzone.net/lineage2/details/74078/L2World-Servers/"); + HOPZONE_FIRST_PAGE_LINK = elcardia.getProperty("HopzoneFirstPageLink", "http://l2.hopzone.net/lineage2/"); + HOPZONE_VOTES_DIFFERENCE = Integer.parseInt(elcardia.getProperty("HopzoneVotesDifference", "5")); + HOPZONE_FIRST_PAGE_RANK_NEEDED = Integer.parseInt(elcardia.getProperty("HopzoneFirstPageRankNeeded", "15")); + HOPZONE_REWARD_CHECK_TIME = Integer.parseInt(elcardia.getProperty("HopzoneRewardCheckTime", "5")); + String HOPZONE_SMALL_REWARD_VALUE = elcardia.getProperty("HopzoneSmallReward", "57,100000000;"); + String[] hopzone_small_reward_splitted_1 = HOPZONE_SMALL_REWARD_VALUE.split(";"); + for (String i : hopzone_small_reward_splitted_1) + { + String[] hopzone_small_reward_splitted_2 = i.split(","); + HOPZONE_SMALL_REWARD.put(Integer.parseInt(hopzone_small_reward_splitted_2[0]), Integer.parseInt(hopzone_small_reward_splitted_2[1])); + } + String HOPZONE_BIG_REWARD_VALUE = elcardia.getProperty("HopzoneBigReward", "3470,1;"); + String[] hopzone_big_reward_splitted_1 = HOPZONE_BIG_REWARD_VALUE.split(";"); + for (String i : hopzone_big_reward_splitted_1) + { + String[] hopzone_big_reward_splitted_2 = i.split(","); + HOPZONE_BIG_REWARD.put(Integer.parseInt(hopzone_big_reward_splitted_2[0]), Integer.parseInt(hopzone_big_reward_splitted_2[1])); + } + HOPZONE_DUALBOXES_ALLOWED = Integer.parseInt(elcardia.getProperty("HopzoneDualboxesAllowed", "1")); + ALLOW_HOPZONE_GAME_SERVER_REPORT = Boolean.parseBoolean(elcardia.getProperty("AllowHopzoneGameServerReport", "false")); + 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")); + } + catch(Exception e) + { + e.printStackTrace(); + throw new Error("Failed to Load " + VOTE + " File."); + } + } //============================================================ public static float RATE_XP; Index: head-src/com/l2jfrozen/gameserver/GameServer.java =================================================================== --- head-src/com/l2jfrozen/gameserver/GameServer.java (revision 938) +++ head-src/com/l2jfrozen/gameserver/GameServer.java (working copy) @@ -118,6 +118,8 @@ import com.l2jfrozen.gameserver.model.entity.Announcements; import com.l2jfrozen.gameserver.model.entity.Hero; import com.l2jfrozen.gameserver.model.entity.MonsterRace; +import com.l2jfrozen.gameserver.model.entity.VoteRewardHopzone; +import com.l2jfrozen.gameserver.model.entity.VoteRewardTopzone; import com.l2jfrozen.gameserver.model.entity.event.manager.EventManager; import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad; import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSigns; @@ -514,6 +516,11 @@ Util.printSection("Custom Mods"); + if (Config.ALLOW_HOPZONE_VOTE_REWARD) + VoteRewardHopzone.getInstance(); + if (Config.ALLOW_TOPZONE_VOTE_REWARD) + VoteRewardTopzone.getInstance(); + if(Config.L2JMOD_ALLOW_WEDDING || Config.ALLOW_AWAY_STATUS || Config.PCB_ENABLE || Config.POWERPAK_ENABLED) { if(Config.L2JMOD_ALLOW_WEDDING) Index: head-src/com/l2jfrozen/FService.java =================================================================== --- head-src/com/l2jfrozen/FService.java (revision 938) +++ head-src/com/l2jfrozen/FService.java (working copy) @@ -48,6 +48,7 @@ public static final String SIEGE_CONFIGURATION_FILE = "./config/head/siege.properties"; public static final String ELIT_CLANHALL_CONFIG_FILE = "./config/head/elitclanhall.properties"; public static final String BOSS_CONFIG_FILE = "./config/head/boss.properties"; + public static final String VOTE_FILE = "./config/head/vote.properties"; //functions public static final String ACCESS_CONFIGURATION_FILE = "./config/functions/access.properties"; Index: head-src/com/l2jfrozen/gameserver/model/entity/VoteRewardTopzone.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/entity/VoteRewardTopzone.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/model/entity/VoteRewardTopzone.java (revision 0) @@ -0,0 +1,330 @@ +/* + * 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 com.l2jfrozen.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 com.l2jfrozen.Config; +import com.l2jfrozen.gameserver.model.entity.Announcements; +import com.l2jfrozen.gameserver.thread.ThreadPoolManager; +import com.l2jfrozen.gameserver.model.L2World; +import com.l2jfrozen.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(); + 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; + } +} \ No newline at end of file Index: config/head/vote.properties =================================================================== --- config/head/vote.properties (revision 0) +++ config/head/vote.properties (revision 0) @@ -0,0 +1,49 @@ +# Vote reward for Hopzone. +AllowHopzoneVoteReward = True +# Vote reward server link. +HopzoneServerLink = http://l2.hopzone.net/lineage2/details/74078/L2World-Servers/ +# First page of servers list link. +HopzoneFirstPageLink = http://l2.hopzone.net/lineage2/ +# Votes for next reward needed. +HopzoneVotesDifference = 5 +# Rank needed for server to be on first page. +HopzoneFirstPageRankNeeded = 15 +# Minutes between rewards. +# Eg. You put 5 it checks every 5 minutes for reward. +HopzoneRewardCheckTime = 5 +# Small reward(s). +HopzoneSmallReward = 57,100000000; +# Big reward(s). +HopzoneBigReward = 3470,1; +# Hopzone reward max dual boxes reward. +# For example if you put 2 and someone has 3 boxes open 2 will be rewarded. +HopzoneDuaboxesAllowed = 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. +AllowHopzoneGameServerReport = True + +# 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 \ No newline at end of file Index: head-src/com/l2jfrozen/gameserver/model/entity/VoteRewardHopzone.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/entity/VoteRewardHopzone.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/model/entity/VoteRewardHopzone.java (revision 0) @@ -0,0 +1,323 @@ +/* + * 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 com.l2jfrozen.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 com.l2jfrozen.Config; +import com.l2jfrozen.gameserver.model.entity.Announcements; +import com.l2jfrozen.gameserver.thread.ThreadPoolManager; +import com.l2jfrozen.gameserver.model.L2World; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; +/** + * @author Anarchy + * + */ +public class VoteRewardHopzone +{ + // Configurations. + private static String hopzoneUrl = Config.HOPZONE_SERVER_LINK; + private static String page1Url = Config.HOPZONE_FIRST_PAGE_LINK; + private static int voteRewardVotesDifference = Config.HOPZONE_VOTES_DIFFERENCE; + private static int firstPageRankNeeded = Config.HOPZONE_FIRST_PAGE_RANK_NEEDED; + private static int checkTime = 60*1000*Config.HOPZONE_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() + { + hopzoneUrl = Config.HOPZONE_SERVER_LINK; + page1Url = Config.HOPZONE_FIRST_PAGE_LINK; + voteRewardVotesDifference = Config.HOPZONE_VOTES_DIFFERENCE; + firstPageRankNeeded = Config.HOPZONE_FIRST_PAGE_RANK_NEEDED; + checkTime = 60*1000*Config.HOPZONE_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_HOPZONE_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_HOPZONE_GAME_SERVER_REPORT) + { + System.out.println("Server votes on hopzone: "+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 Hopzone, so the reward will be big."); + if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT) + { + System.out.println("Server is on the first page of hopzone."); + } + } + else + { + Announcements.getInstance().announceToAll("Vote reward: We need "+(firstPageVotes-lastVotes)+" vote(s) to get to the first page of Hopzone for big reward."); + if (Config.ALLOW_HOPZONE_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(); + if (firstPageVotes-currentVotes <= 0) + { + if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT) + { + System.out.println("Server votes on hopzone: "+currentVotes); + System.out.println("Server is on the first page of hopzone."); + 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.HOPZONE_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.HOPZONE_BIG_REWARD.keySet()) + { + p.addItem("Vote reward.", i, Config.HOPZONE_BIG_REWARD.get(i), p, true); + } + } + else + { + p.sendMessage("Already "+Config.HOPZONE_DUALBOXES_ALLOWED+" character(s) of your ip have been rewarded, so this character won't be rewarded."); + } + } + playerIps.clear(); + } + else + { + if (Config.ALLOW_HOPZONE_GAME_SERVER_REPORT) + { + System.out.println("Server votes on hopzone: "+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 Hopzone 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.HOPZONE_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.HOPZONE_SMALL_REWARD.keySet()) + { + p.addItem("Vote reward.", i, Config.HOPZONE_SMALL_REWARD.get(i), p, true); + } + } + else + { + p.sendMessage("Already "+Config.HOPZONE_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_HOPZONE_GAME_SERVER_REPORT) + { + System.out.println("Server votes on hopzone: "+currentVotes); + System.out.println("Server is on the first page of hopzone."); + 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_HOPZONE_GAME_SERVER_REPORT) + { + System.out.println("Server votes on hopzone: "+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 Hopzone 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("<span class=\"no\">"+firstPageRankNeeded+"</span>")) + { + i++; + } + if (line.contains("Anonymous Votes") && i == 1) + { + i = 0; + int votes = Integer.valueOf(line.split(">")[1].replace("</span", "")); + 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(hopzoneUrl).openConnection(); + con.addRequestProperty("User-Agent", "Mozilla/4.76"); + isr = new InputStreamReader(con.getInputStream()); + br = new BufferedReader(isr); + + String line; + while ((line = br.readLine()) != null) + { + if (line.contains("Anonymous User Votes")) + { + int votes = Integer.valueOf(line.split(">")[2].replace("</span", "")); + return votes; + } + } + + br.close(); + isr.close(); + } + catch (Exception e) + { + System.out.println(e); + System.out.println("Error while getting server vote count."); + } + + return -1; + } +} \ No newline at end of file
  14. http://www.youtube.com/view_play_list?p=84A56BC7F4A1F852 I found this lectures on youtube about java progr. maybe will help many folks like me
  15. Come on tell me how u learned java ppl ...
  16. So as i have much free time now i would like to learn java so i will make my own codes.The problem is that i dont know from where to start ,it would be nice if you could help me and tell me what i should learn.Also if u good send me guides and whatever u can to help me i would appreciate it.
  17. i forgot i put a code that for drop enchanted item's so my sql got more lines
  18. the sql is fine i passed on the other l2jdb2 i got on navicat and works but dont work on this l2jdb1 thats the sql: INSERT INTO custom_npc VALUES ('5', '5', 'Hyperion', '0', 'Global Gatekeeper', '0', 'Monster2.ketra_orc_chieftain_20_bi', '17.00', '46.20', '80', 'male', 'L2Teleporter', '40', '300327', '1524', '368.11', '9.81', '60', '57', '73', '76', '70', '80', '3775961', '557272', '2423', '1731', '477', '768', '230', '0', '3819', '6719', '0', '0', '38', '307', '', '0', '0', '0', 'LAST_HIT');
  19. i try to pass an npc everything is correct and when i execute the sql file always i get an error but i try to pass the same npc to the second l2jdb i got on navicat and everything works fine there . thats the error: [Err] 1136 - Column count doesn't match value count at row 1 [Err] INSERT INTO custom_npc VALUES ('5', '5', 'Hyperion', '0', 'Global Gatekeeper', '0', 'Monster2.ketra_orc_chieftain_20_bi', '17.00', '46.20', '80', 'male', 'L2Teleporter', '40', '300327', '1524', '368.11', '9.81', '60', '57', '73', '76', '70', '80', '3775961', '557272', '2423', '1731', '477', '768', '230', '0', '3819', '6719', '0', '0', '38', '307', '', '0', '0', '0', 'LAST_HIT'); [Msg] Finished - Unsuccessfully
  20. the old core had memmories and fun ....this core has shit and bullshit....
  21. General opinion:nothing special archers/mage server if u was develop this for 12 months then u must better stop developing
  22. its not about donates...server is boring there is nothing to do with old core ...server has new npcs ...new type of game ...the fact that u got the same farm zone doesnt say anything ...when u said its old core everyone thought would be exactly the same nothing to be changed so yes u failed ... face the truth
×
×
  • 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