l2topzone.com
l2topzone.com

Author Topic: Vote reward system for l2jacis and l2jfrozen  (Read 5236 times)

0 Members and 2 Guests are viewing this topic.

Onlinexzone

  • Read our rules
  • Administrator
  • Hero Member
  • *****
  • Posts: 635
  • L2topzone Votes: 22
  • Servers reviews: 150
  • Reputation: +10480/-0
    • l2topzone
Vote reward system for l2jacis and l2jfrozen
« on: November 19, 2016, 02:03:09 PM »
l2topzone.com
Hello topzoners,

As title say we have created for l2topzone.com users server side scripts for most used Interlude projects l2jfrozen and l2jacis.

https://bitbucket.org/dmsj/l2topzonevotesystem-frozen

https://bitbucket.org/dmsj/l2topzonevotesystem-acis

Thanks to L2Cygnus that make this code for us.

L2topzone.com
Team

Linkback: https://l2topzone.com/forum/l2-server-support-problems/9/vote-reward-system-l2jacis-l2jfrozen/26737/

Onlinexzone

  • Read our rules
  • Administrator
  • Hero Member
  • *****
  • Posts: 635
  • L2topzone Votes: 22
  • Servers reviews: 150
  • Reputation: +10480/-0
    • l2topzone
Re: Vote reward system for l2jacis and l2jfrozen
« Reply #1 on: November 23, 2016, 03:23:38 PM »
Have someone test this vote reward and can provide feedback?

Offlinegiannisdx

  • Newbie
  • *
  • Posts: 9
  • L2topzone Votes: 17
  • Servers reviews: 2
  • Reputation: +0/-0
  • L2topzone.com
    Re: Vote reward system for l2jacis and l2jfrozen
    « Reply #2 on: January 11, 2017, 04:06:20 PM »
    Looks good on frozen thank you

    Onlinexzone

    • Read our rules
    • Administrator
    • Hero Member
    • *****
    • Posts: 635
    • L2topzone Votes: 22
    • Servers reviews: 150
    • Reputation: +10480/-0
      • l2topzone
    Re: Vote reward system for l2jacis and l2jfrozen
    « Reply #3 on: January 11, 2017, 04:10:10 PM »
    Glad to hear that!

    Onlinela2revive

    • Newbie
    • *
    • Posts: 1
    • L2topzone Votes: 44
    • Servers reviews: 4
    • Reputation: +0/-0
    • L2topzone.com
      Re: Vote reward system for l2jacis and l2jfrozen
      « Reply #4 on: January 20, 2017, 03:56:48 PM »
      have a wrong import path in votecmd (fronzen)

      -import com.l2jfrozen.gameserver.vote.VoteHandler;

      +import com.l2jfrozen.gameserver.vote.handler.VoteHandler;

      Offlinel2-extacy

      • Newbie
      • *
      • Posts: 6
      • L2topzone Votes: 104
      • Servers reviews: 0
      • Reputation: +0/-0
      • L2topzone.com
        Re: Vote reward system for l2jacis and l2jfrozen
        « Reply #5 on: October 08, 2017, 08:11:12 PM »
        Hello, what about this file:

        L2TopZoneVoteSystem-frozen.iml where supposed to be at?

        Also I got this error on console¨
        Code: [Select]
        INFO  ============================================================-[ L2TopZone vote ]
        java.io.EOFException: No content to map to Object due to end of input
                at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2766)
                at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2709)
                at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1854)
                at com.l2jfrozen.gameserver.vote.handler.TopZoneVoteHandler.getTotalVotes(TopZoneVoteHandler.java:42)
                at com.l2jfrozen.gameserver.vote.handler.VoteHandler.<init>(VoteHandler.java:42)
                at com.l2jfrozen.gameserver.vote.handler.VoteHandler$SingletonHolder.<clinit>(VoteHandler.java:288)
                at com.l2jfrozen.gameserver.vote.handler.VoteHandler.getInstance(VoteHandler.java:292)
                at com.l2jfrozen.gameserver.GameServer.main(GameServer.java:445)
        INFO  AutoChatHandler : Loaded 32 handlers in total.
        INFO  AutoSpawnHandler : Loaded 129 handlers in total.


        One step was missing... this line:
        <classpathentry kind="lib" path="lib/jackson-all-1.9.0.jar"/>

        in .classpath ,

        but still i get that console error , and when i type .votetopzone it says didnt vote.
        also I want to know if this propertis is well fixed:

        TopZoneApiUrl = https://api.l2topzone.com/v1/server_c1c5f13ed70da973ae6cf82668696375/getServerData
        TopZoneToken = c1c5f13ed70da973ae6cf82668696375

        i have it like this its fine?
        « Last Edit: October 08, 2017, 08:58:56 PM by l2-extacy »

        Onlinexzone

        • Read our rules
        • Administrator
        • Hero Member
        • *****
        • Posts: 635
        • L2topzone Votes: 22
        • Servers reviews: 150
        • Reputation: +10480/-0
          • l2topzone
        Re: Vote reward system for l2jacis and l2jfrozen
        « Reply #6 on: October 09, 2017, 09:15:49 AM »
        Hello,
        Seams to be a wrong info in your config file. It must looks like this:
        https://bitbucket.org/dmsj/l2topzonevotesystem-frozen/src/3968a30267b770000f18f2f899554f69aa238a83/L2TopZoneVoteSystem-frozen/data/config/vote.properties?at=master&fileviewer=file-view-default

        On this file you must add only token and you are done.
        « Last Edit: October 09, 2017, 09:18:17 AM by xzone »

        Offlinel2-extacy

        • Newbie
        • *
        • Posts: 6
        • L2topzone Votes: 104
        • Servers reviews: 0
        • Reputation: +0/-0
        • L2topzone.com
          Re: Vote reward system for l2jacis and l2jfrozen
          « Reply #7 on: October 09, 2017, 10:41:23 AM »
          TopZoneApiUrl = https://api.l2topzone.com/v1/
          TopZoneToken = c1c5f13ed70da973ae6cf82668696375

          Perfect! like this is working! Yesterday dont know why wasnt working, now yes! Thank you

          Offlinel2-extacy

          • Newbie
          • *
          • Posts: 6
          • L2topzone Votes: 104
          • Servers reviews: 0
          • Reputation: +0/-0
          • L2topzone.com
            Re: Vote reward system for l2jacis and l2jfrozen
            « Reply #8 on: October 09, 2017, 11:23:11 AM »
            Players need to be logged inside l2topzone site in order to vote? Is it possible just to vote on site without account? Because they have to register, wait until they get their account validate and then they can vote, its a lot of troubles just for 1 vote.

            Onlinexzone

            • Read our rules
            • Administrator
            • Hero Member
            • *****
            • Posts: 635
            • L2topzone Votes: 22
            • Servers reviews: 150
            • Reputation: +10480/-0
              • l2topzone
            Re: Vote reward system for l2jacis and l2jfrozen
            « Reply #9 on: October 09, 2017, 03:50:01 PM »
            You can vote only if you are register

            Offlinel2-extacy

            • Newbie
            • *
            • Posts: 6
            • L2topzone Votes: 104
            • Servers reviews: 0
            • Reputation: +0/-0
            • L2topzone.com
              Re: Vote reward system for l2jacis and l2jfrozen
              « Reply #10 on: October 09, 2017, 10:08:38 PM »
              Im getting this error in console, any idea what can it be?

              Code: [Select]
              Exception in thread "GeneralSTPool-13" java.lang.NullPointerException
                      at com.l2jfrozen.gameserver.vote.handler.VoteHandler.tryGetIp(VoteHandler.java:153)
                      at com.l2jfrozen.gameserver.vote.handler.VoteHandler.access$400(VoteHandler.java:29)
                      at com.l2jfrozen.gameserver.vote.handler.VoteHandler$AutoVoteEncourageTask.run(VoteHandler.java:319)
                      at com.l2jfrozen.gameserver.thread.ThreadPoolManager$RunnableWrapper.run(ThreadPoolManager.java:95)
                      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
                      at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                      at java.lang.Thread.run(Unknown Source)

              Onlinexzone

              • Read our rules
              • Administrator
              • Hero Member
              • *****
              • Posts: 635
              • L2topzone Votes: 22
              • Servers reviews: 150
              • Reputation: +10480/-0
                • l2topzone

              Offlinezoumhs

              • Jr. Member
              • **
              • Posts: 78
              • L2topzone Votes: 198
              • Servers reviews: 0
              • Reputation: +63/-0
                Re: Vote reward system for l2jacis and l2jfrozen
                « Reply #12 on: December 23, 2017, 04:12:57 PM »
                Send me a pm i will send you the fix, if you wait from xzone help you will get older!

                OfflineCelestial Dragon

                • Newbie
                • *
                • Posts: 3
                • L2topzone Votes: 13
                • Servers reviews: 0
                • Reputation: +0/-0
                • L2topzone.com
                  Re: Vote reward system for l2jacis and l2jfrozen
                  « Reply #13 on: January 09, 2019, 04:16:21 AM »
                  hello, such! I have taken the trouble to adapt its code for c4 l2jlisvus.

                  I have had problems in the methods "public boolean isVoted (String ip)" and "public int getTotalVotes ()" of the class "public class TopZoneVoteHandler". Could I ask for your help?

                  Code: [Select]
                  package net.sf.l2j.gameserver.vote.handler;

                  import org.codehaus.jackson.map.ObjectMapper;

                  import net.sf.l2j.Config;
                  import net.sf.l2j.gameserver.vote.AbstractVoteManager;
                  import net.sf.l2j.gameserver.vote.model.json.TopZoneGlobalResponse;
                  import net.sf.l2j.gameserver.vote.model.json.TopZonePersonalResponse;


                  public class TopZoneVoteHandler extends AbstractVoteManager implements IVoteHandler {

                  @Override
                  public boolean isVoted(String ip) {
                  String url = getApiUrlTemplatePersonal(ip);
                  String response = getResponse(url, "L2TopZone");
                  TopZonePersonalResponse resp = null;
                  boolean voted = false;
                  try {
                  resp = new ObjectMapper().readValue(response, TopZonePersonalResponse.class);
                  if (resp != null) {
                  voted = resp.getResult().isVoted();
                  }
                  } catch (Exception e) {
                  if (Config.VOTE_LOG_ERROR) {
                  e.printStackTrace();
                  }
                  _log.warning("Failed to check personal vote status for topzone");
                  }
                  return voted;
                  }

                  @Override
                  public int getTotalVotes() {
                  String url = getApiUrlTemplateTotal();
                  String response = getResponse(url, "L2TopZone");
                  int votes = -1;
                  TopZoneGlobalResponse jsonResponse = null;
                  try {
                  jsonResponse = new ObjectMapper().readValue(response, TopZoneGlobalResponse.class);
                  if (jsonResponse != null) {
                  votes = jsonResponse.getResult().getTotalVotes();
                  }
                  } catch (Exception e) {
                  if (Config.VOTE_LOG_ERROR) {
                  e.printStackTrace();
                  }
                  _log.warning("Failed to read total votes for topzone");
                  }
                  return votes;
                  }

                  private String getApiUrlTemplatePersonal(String ip) {
                  return String.format("%svote?token=%s&ip=%s", Config.VOTE_TOPZONE_API_URL, Config.VOTE_TOP_ZONE_TOKEN, ip);
                  }

                  private String getApiUrlTemplateTotal() {
                  return String.format("%sserver_%s/getServerData", Config.VOTE_TOPZONE_API_URL, Config.VOTE_TOP_ZONE_TOKEN);
                  }
                  }


                  error by console

                  Code: [Select]
                  Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
                          at net.sf.l2j.gameserver.vote.handler.TopZoneVoteHandler.getTotalVotes(TopZoneVoteHandler.java:42)
                          at net.sf.l2j.gameserver.vote.handler.VoteHandler.<init>(VoteHandler.java:42)
                          at net.sf.l2j.gameserver.vote.handler.VoteHandler$SingletonHolder.<clinit>(VoteHandler.java:292)
                          at net.sf.l2j.gameserver.vote.handler.VoteHandler.getInstance(VoteHandler.java:296)
                          at net.sf.l2j.gameserver.GameServer.main(GameServer.java:790)
                  Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.ObjectMapper
                          at java.net.URLClassLoader.findClass(Unknown Source)
                          at java.lang.ClassLoader.loadClass(Unknown Source)
                          at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
                          at java.lang.ClassLoader.loadClass(Unknown Source)
                          ... 5 more


                  error with method "getTotalVotes ()" bounded and returning constant

                  Code: [Select]
                  Client: [Character: Gm-Mauro[268475126] - Account: mauro - IP: 25.8.35.95] - Failed running: [C] 38 Say2 - L2J Server Version: ${l2j.revision} - DP Revision: Unsupported Custom Version. ; org/codehaus/jackson/map/ObjectMapper
                  java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
                          at net.sf.l2j.gameserver.vote.handler.TopZoneVoteHandler.isVoted(TopZoneVoteHandler.java:22)
                          at net.sf.l2j.gameserver.vote.handler.VoteHandler.handleVote(VoteHandler.java:120)
                          at net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoteCmd.useVoicedCommand(VoteCmd.java:23)
                          at net.sf.l2j.gameserver.network.clientpackets.Say2.runImpl(Say2.java:314)
                          at net.sf.l2j.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:97)
                          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                          at java.lang.Thread.run(Unknown Source)
                  Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.map.ObjectMapper
                          at java.net.URLClassLoader.findClass(Unknown Source)
                          at java.lang.ClassLoader.loadClass(Unknown Source)
                          at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
                          at java.lang.ClassLoader.loadClass(Unknown Source)
                          ... 8 more
                  « Last Edit: January 09, 2019, 04:18:06 AM by Celestial Dragon »

                  Onlinexzone

                  • Read our rules
                  • Administrator
                  • Hero Member
                  • *****
                  • Posts: 635
                  • L2topzone Votes: 22
                  • Servers reviews: 150
                  • Reputation: +10480/-0
                    • l2topzone
                  Re: Vote reward system for l2jacis and l2jfrozen
                  « Reply #14 on: January 09, 2019, 07:33:47 AM »
                  Hello,
                  If you know how to read the error message you have the answer in that error....

                  java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper

                  he try to find class ObjectMapper but is not imported correctly or is missing

                  OfflineCelestial Dragon

                  • Newbie
                  • *
                  • Posts: 3
                  • L2topzone Votes: 13
                  • Servers reviews: 0
                  • Reputation: +0/-0
                  • L2topzone.com
                    Re: Vote reward system for l2jacis and l2jfrozen
                    « Reply #15 on: January 09, 2019, 12:02:55 PM »
                    Hello! thanks for the answer, I am working on eclipse, I have imported the library, there are no compilation errors and eclipse validates it.

                    OfflineCelestial Dragon

                    • Newbie
                    • *
                    • Posts: 3
                    • L2topzone Votes: 13
                    • Servers reviews: 0
                    • Reputation: +0/-0
                    • L2topzone.com
                      Re: Vote reward system for l2jacis and l2jfrozen
                      « Reply #16 on: January 10, 2019, 08:27:33 PM »
                      after a lot of work I managed to execute everything normally, but at the moment of putting ".votetopzone"
                      you can not vote, the message "Failed to check personal vote status for topzone" is displayed. Any suggestions?

                      Code: [Select]
                      public boolean isVoted(String ip) {
                      String url = getApiUrlTemplatePersonal(ip);
                      String response = getResponse(url, "L2TopZone");
                      TopZonePersonalResponse resp = null;
                      boolean voted = false;
                      try {
                      resp = new ObjectMapper().readValue(response, TopZonePersonalResponse.class);
                      if (resp != null) {
                      voted = resp.getResult().isVoted();
                      }
                      } catch (Exception e) {
                      if (Config.VOTE_LOG_ERROR) {
                      e.printStackTrace();
                      }
                      _log.warning("Failed to check personal vote status for topzone");
                      }
                      return voted;
                      }

                      dont work link "https://api.l2topzone.com/v1/vote?token=5536944489450024c4aa32a5b7e9388f&ip=192.168.0.5"

                      which is the reason?
                      « Last Edit: January 10, 2019, 08:48:35 PM by Celestial Dragon »

                      Offlinelineage 2 interlude serve

                      • Newbie
                      • *
                      • Posts: 2
                      • L2topzone Votes: 57
                      • Servers reviews: 0
                      • Reputation: +0/-0
                      • L2topzone.com
                        Re: Vote reward system for l2jacis and l2jfrozen
                        « Reply #17 on: February 02, 2019, 05:24:36 PM »
                        mi dont work too 403 in console


                        Share via diggShare via facebookShare via linkedinShare via myspaceShare via redditShare via twitter
                         


                        Sitemap