l2topzone.com
l2topzone.com
l2topzone.com
l2topzone.com
l2topzone.com
l2topzone.com
l2topzone.com

Author Topic: Fix for vote reward based on total votes from server info  (Read 13362 times)

0 Members and 2 Guests are viewing this topic.

Onlinexzone

  • Read our rules
  • Hero Member
  • *****
  • Posts: 663
  • L2topzone Votes: 53
  • Servers reviews: 159
  • Reputation: +10480/-0
    • l2topzone
Fix for vote reward based on total votes from server info
« on: August 30, 2013, 11:29:31 AM »
Locate your vote reward script and find this line:













Change this:
Code: [Select]

Code: [Select]
String votesLine = in.readLine();
To this:

Code: [Select]
String votesLine = inputLine;


Find this line:
Code: [Select]
votes = Integer.valueOf(votesLine.split(">")[5].replace("</font", ""));
and replace with this:
Code: [Select]
votes = Integer.valueOf(votesLine.split(">")[3].replace("</div", ""));
Post here if you success with the fix.

Linkback: https://l2topzone.com/forum/index.php?topic=14782.0
« Last Edit: August 30, 2013, 11:33:45 AM by xzone »

l2topzone.com
l2topzone.com
l2topzone.com
l2topzone.com
l2topzone.com

Offlinescryde

  • Newbie
  • *
  • Posts: 13
  • L2topzone Votes: 0
  • Servers reviews: 0
  • Reputation: +0/-0
  • L2topzone.com
    Re: Fix for vote reward based on total votes from server info
    « Reply #1 on: September 02, 2013, 11:57:19 AM »
    Can you help me to fix this ?
    Code: [Select]
    /*
     * 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.l2jserver.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.l2jserver.Config;
    import com.l2jserver.gameserver.Announcements;
    import com.l2jserver.gameserver.ThreadPoolManager;
    import com.l2jserver.gameserver.model.L2World;
    import com.l2jserver.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("Current vote count is "+currentVotes+".");
    Announcements.getInstance().announceToAll("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("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("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));
    }
    }
    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("Everyone has been rewarded with big reward.");
    Announcements.getInstance().announceToAll("Current vote count is "+currentVotes+".");
    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("Everyone has been rewarded with small reward.");
    Announcements.getInstance().announceToAll("Current vote count is "+currentVotes+".");
    Announcements.getInstance().announceToAll("We need "+(firstPageVotes-currentVotes)+" vote(s) to get to the first page of topzone for big reward.");
    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("Current vote count is "+currentVotes+".");
    Announcements.getInstance().announceToAll("We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for big reward.");
    }
    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("Current vote count is "+currentVotes+".");
    Announcements.getInstance().announceToAll("We need "+((lastVotes+voteRewardVotesDifference)-currentVotes)+" vote(s) for small reward.");
    Announcements.getInstance().announceToAll("We need "+(firstPageVotes-currentVotes)+" vote(s) to get to the first page of topzone for big reward.");
    }
    }
    }

    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;
    }
    }

    OfflineStewie

    • Newbie
    • *
    • Posts: 12
    • L2topzone Votes: 0
    • Servers reviews: 0
    • Reputation: +0/-0
    • L2topzone.com
      Re: Fix for vote reward based on total votes from server info
      « Reply #2 on: September 02, 2013, 08:19:11 PM »
      Just update the html part..
      « Last Edit: September 02, 2013, 08:20:37 PM by Stewie »

      Offlinescryde

      • Newbie
      • *
      • Posts: 13
      • L2topzone Votes: 0
      • Servers reviews: 0
      • Reputation: +0/-0
      • L2topzone.com
        Re: Fix for vote reward based on total votes from server info
        « Reply #3 on: September 03, 2013, 12:38:35 PM »
        Just update the html part..
        What exactly and how? Give me more details please

        OfflineStewie

        • Newbie
        • *
        • Posts: 12
        • L2topzone Votes: 0
        • Servers reviews: 0
        • Reputation: +0/-0
        • L2topzone.com
          Re: Fix for vote reward based on total votes from server info
          « Reply #4 on: September 08, 2013, 02:42:05 PM »
          Code: [Select]
          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;
          }

          Try change it to:

          Code: [Select]
          if(inputLine.contains("Votes:")){
                        String i = inputLine.replace("<div class=\"rank\"><div class=\"votes2\">Votes:<br>", "");
                        i = i.replace("</div></div>", "");
                        i = i.trim();
                        int o = Integer.parseInt(i);
                        return Integer.valueOf(o);
             }

          Credits for both fixes are to MikeJ
          « Last Edit: September 08, 2013, 02:47:34 PM by Stewie »

          Offlinedanutzdanutz

          • Newbie
          • *
          • Posts: 2
          • L2topzone Votes: 0
          • Servers reviews: 0
          • Reputation: +0/-0
          • L2topzone.com
            Re: Fix for vote reward based on total votes from server info
            « Reply #5 on: September 28, 2013, 11:36:46 AM »
            files name update

            Offlinepanosdabest

            • Newbie
            • *
            • Posts: 1
            • L2topzone Votes: 0
            • Servers reviews: 0
            • Reputation: +0/-0
            • L2topzone.com
              Re: Fix for vote reward based on total votes from server info
              « Reply #6 on: December 29, 2013, 03:24:13 PM »
              where can i find my vote script ?? pls answer me

              OfflineL2TNG

              • Newbie
              • *
              • Posts: 1
              • L2topzone Votes: 0
              • Servers reviews: 0
              • Reputation: +0/-0
              • L2topzone.com
                Re: Fix for vote reward based on total votes from server info
                « Reply #7 on: January 16, 2014, 05:24:27 AM »
                Locate your vote reward script and find this line:













                Change this:
                Code: [Select]

                Code: [Select]
                String votesLine = in.readLine();
                To this:

                Code: [Select]
                String votesLine = inputLine;


                Find this line:
                Code: [Select]
                votes = Integer.valueOf(votesLine.split(">")[5].replace("</font", ""));
                and replace with this:
                Code: [Select]
                votes = Integer.valueOf(votesLine.split(">")[3].replace("</div", ""));
                Post here if you success with the fix.

                What eactly should we found? because the 1st lines are missing from your post

                Offlinel2atlantis

                • Newbie
                • *
                • Posts: 4
                • L2topzone Votes: 14
                • Servers reviews: 0
                • Reputation: +0/-0
                • L2topzone.com
                  Re: Fix for vote reward based on total votes from server info
                  « Reply #8 on: February 08, 2014, 06:47:24 AM »
                  Is there a new fix for 8.feb.2014 modifications?

                  OfflineportaPro

                  • Newbie
                  • *
                  • Posts: 13
                  • L2topzone Votes: 0
                  • Servers reviews: 0
                  • Reputation: +0/-0
                  • L2topzone.com
                    Re: Fix for vote reward based on total votes from server info
                    « Reply #9 on: February 12, 2014, 08:22:08 AM »
                    now?

                    Offlinezoom27

                    • Newbie
                    • *
                    • Posts: 1
                    • L2topzone Votes: 0
                    • Servers reviews: 0
                    • Reputation: +50/-0
                      Re: Fix for vote reward based on total votes from server info
                      « Reply #10 on: March 20, 2014, 02:50:24 PM »
                      so ?:( no fix for last modification ?:(:o

                      Onlinexzone

                      • Read our rules
                      • Hero Member
                      • *****
                      • Posts: 663
                      • L2topzone Votes: 53
                      • Servers reviews: 159
                      • Reputation: +10480/-0
                        • l2topzone
                      Re: Fix for vote reward based on total votes from server info
                      « Reply #11 on: March 20, 2014, 04:22:44 PM »
                      Read annoncements from this forum.

                      Offlinel2champ

                      • Newbie
                      • *
                      • Posts: 1
                      • L2topzone Votes: 0
                      • Servers reviews: 2
                      • Reputation: +0/-0
                      • L2topzone.com
                        Re: Fix for vote reward based on total votes from server info
                        « Reply #12 on: June 04, 2014, 07:22:53 AM »
                        Somebody can help me with my code? Always got server vote : 0

                        My code is:
                        Code: [Select]
                        /*
                         * Copyright (C) 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.l2jserver.gameserver.instancemanager.votereward;

                        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;

                        /**
                         * @author ???
                         * @reworked fissban
                         */

                        public class VoteRewardTopzone
                        {
                        static Logger _log = Logger.getLogger(VoteRewardTopzone.class.getName());

                        static final int initialCheck = Config.VOTE_SYSTEM_START_TIME * 1000;
                        static final int delayForCheck = Config.VOTE_SYSTEM_CHECK_TIME * 1000;
                        int votesneed;

                        static List<String> _ips = new ArrayList<>();
                        static List<String> _accounts = new ArrayList<>();

                        static int lastVoteCount = 0;

                        VoteRewardTopzone()
                        {
                        if (Config.VOTE_SYSTEM_DATABASE_SAVE)
                        {
                        load();
                        }

                        ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck);
                        }

                        public class AutoReward implements Runnable
                        {
                        @Override
                        public void run()
                        {
                        int votes = getVotes();
                        _log.info("VoteReward: Current Votes Topzone: " + votes);

                        if (votes >= (getLastVoteCount() + Config.VOTE_SYSTEM_COUNT))
                        {
                        Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().valueCollection();
                        {
                        for (L2PcInstance onlinePlayer : pls)
                        {
                        if (onlinePlayer.isOnline() && !onlinePlayer.getClient().isDetached() && !_accounts.contains(onlinePlayer.getAccountName()) && !_ips.contains(onlinePlayer.getClient().getConnection().getInetAddress().getHostAddress()))
                        {
                        String[] parase = Config.VOTE_SYSTEM_ITEM_ID_TOPZONE.split(",");
                        String[] parase3 = Config.VOTE_SYSTEM_ITEM_COUNT_TOPZONE.split(",");

                        for (int o = 0; o < parase.length; o++)
                        {
                        int parase2 = Integer.parseInt(parase[o]);
                        int parase4 = Integer.parseInt(parase3[o]);

                        onlinePlayer.addItem("vote_reward", parase2, parase4, onlinePlayer, true);
                        }

                        _ips.add(onlinePlayer.getClient().getConnection().getInetAddress().getHostAddress());
                        _accounts.add(onlinePlayer.getAccountName());
                        }
                        }
                        }

                        _log.info("VoteReward Topzone: All players has been rewared!");

                        Announcements.getInstance().announceToAll("be rewarded!");
                        Announcements.getInstance().announceToAll("for Topzone vote!");
                        setLastVoteCount(getLastVoteCount() + Config.VOTE_SYSTEM_COUNT);
                        }

                        if (getLastVoteCount() == 0)
                        {
                        setLastVoteCount(votes);
                        }

                        else if ((((getLastVoteCount() + Config.VOTE_SYSTEM_COUNT) - votes) > Config.VOTE_SYSTEM_COUNT) || (votes > (getLastVoteCount() + Config.VOTE_SYSTEM_COUNT)))
                        {
                        setLastVoteCount(votes);
                        }

                        votesneed = (getLastVoteCount() + Config.VOTE_SYSTEM_COUNT) - votes;

                        if (votesneed == 0)
                        {
                        votesneed = Config.VOTE_SYSTEM_COUNT;
                        }

                        Announcements.getInstance().announceToAll("== VoteReward ==");
                        Announcements.getInstance().announceToAll("Current votes " + votes + ".");
                        Announcements.getInstance().announceToAll("Missing " + votesneed + " votes in Topzone!");

                        _ips.clear();
                        _accounts.clear();
                        }
                        }

                        public int getVotes()
                        {
                        URL url = null;
                        InputStreamReader isr = null;
                        BufferedReader in = null;
                        try
                        {
                        url = new URL(Config.VOTE_SYSTEM_PAGE_TOPZONE);
                        URLConnection con = url.openConnection();
                        con.addRequestProperty("User-Agent", "L2TopZone");
                        isr = new InputStreamReader(con.getInputStream());
                        in = new BufferedReader(isr);
                        String inputLine;

                        while ((inputLine = in.readLine()) != null)
                        {
                        if (inputLine.contains("<tr><td><div align=\"center\"><b><font style=\"font-size:14px;color:#018BC1;\">"))
                        {
                        String i = inputLine.replace("<tr><td><div align=\"center\"><b><font style=\"font-size:14px;color:#018BC1;\">", "");
                        i = i.replace("</font></b></div></td></tr>", "");
                        i = i.trim();
                        int o = Integer.parseInt(i);
                        return Integer.valueOf(o);
                        }
                        }
                        }
                        catch (IOException e)
                        {
                        Announcements.getInstance().announceToAll("Topzone is offline");
                        _log.warning("AutoVoteRewardHandler: " + e);
                        }
                        return 0;
                        }

                        public void setLastVoteCount(int voteCount)
                        {
                        lastVoteCount = voteCount;
                        }

                        public int getLastVoteCount()
                        {
                        return lastVoteCount;
                        }

                        public void load()
                        {
                        int votes = 0;

                        try (Connection con = L2DatabaseFactory.getInstance().getConnection())
                        {
                        PreparedStatement statement = con.prepareStatement("SELECT vote FROM votetopzone LIMIT 1");// DB votetopzone
                        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 Topzone: ", e);
                        }

                        setLastVoteCount(votes);
                        }

                        public void save()
                        {
                        try (Connection con = L2DatabaseFactory.getInstance().getConnection())
                        {
                        PreparedStatement statement = con.prepareStatement("UPDATE votetopzone SET vote = ? WHERE id=1");
                        statement.setInt(1, getLastVoteCount());
                        statement.execute();
                        statement.close();
                        }
                        catch (Exception e)
                        {
                        _log.log(Level.WARNING, "data error on vote Topzone: ", e);
                        }
                        }

                        public static VoteRewardTopzone getInstance()
                        {
                        return SingletonHolder._instance;
                        }

                        static class SingletonHolder
                        {
                        protected static final VoteRewardTopzone _instance = new VoteRewardTopzone();
                        }
                        }

                        I think this part of code:
                        Code: [Select]
                        public int getVotes()
                        {
                        URL url = null;
                        InputStreamReader isr = null;
                        BufferedReader in = null;
                        try
                        {
                        url = new URL(Config.VOTE_SYSTEM_PAGE_TOPZONE);
                        URLConnection con = url.openConnection();
                        con.addRequestProperty("User-Agent", "L2TopZone");
                        isr = new InputStreamReader(con.getInputStream());
                        in = new BufferedReader(isr);
                        String inputLine;

                        while ((inputLine = in.readLine()) != null)
                        {
                        if (inputLine.contains("<tr><td><div align=\"center\"><b><font style=\"font-size:14px;color:#018BC1;\">"))
                        {
                        String i = inputLine.replace("<tr><td><div align=\"center\"><b><font style=\"font-size:14px;color:#018BC1;\">", "");
                        i = i.replace("</font></b></div></td></tr>", "");
                        i = i.trim();
                        int o = Integer.parseInt(i);
                        return Integer.valueOf(o);
                        }
                        }
                        }
                        catch (IOException e)
                        {
                        Announcements.getInstance().announceToAll("Topzone is offline");
                        _log.warning("AutoVoteRewardHandler: " + e);
                        }
                        return 0;
                        }

                        Offlinel2vibes

                        • Newbie
                        • *
                        • Posts: 5
                        • L2topzone Votes: 0
                        • Servers reviews: 0
                        • Reputation: +0/-0
                        • L2OverAll.com
                          • L2OverAll
                        Re: Fix for vote reward
                        « Reply #13 on: September 03, 2014, 05:16:54 AM »
                        i have the same problem...i am in topzone premium but in my server has announcement topzone is offline...where can i find my vote script ??to try this...plz help

                        Onlinexzone

                        • Read our rules
                        • Hero Member
                        • *****
                        • Posts: 663
                        • L2topzone Votes: 53
                        • Servers reviews: 159
                        • Reputation: +10480/-0
                          • l2topzone
                        Re: Fix for vote reward based on total votes from server info
                        « Reply #14 on: September 03, 2014, 09:09:23 AM »
                        Your premium status have nothing to do with that custom script. We do not offer support for that vote reward because is not created by us and we do not know how is working. Please contact your vote reward script programer to fix this problem.

                         

                        Sitemap