L2JMobius

Free Users => Shares/Contributions => Topic started by: Invoke on May 09, 2020, 04:07:49 PM

Title: API Vote System - All projects
Post by: Invoke on May 09, 2020, 04:07:49 PM
Diff:
https://pastebin.com/DSad9XcY

Command:
https://pastebin.com/7ywWXmC1

SQL:

Code: [Select]
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for globalvotes
-- ----------------------------
DROP TABLE IF EXISTS `globalvotes`;
CREATE TABLE `globalvotes`  (
  `voteSite` tinyint(2) NOT NULL,
  `lastRewardVotes` int(11) NULL DEFAULT NULL,
  PRIMARY KEY (`voteSite`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of globalvotes
-- ----------------------------
INSERT INTO `globalvotes` VALUES (0, 13);
INSERT INTO `globalvotes` VALUES (1, 68);
INSERT INTO `globalvotes` VALUES (2, 0);
INSERT INTO `globalvotes` VALUES (3, 3);
INSERT INTO `globalvotes` VALUES (4, 2);
INSERT INTO `globalvotes` VALUES (5, 0);
INSERT INTO `globalvotes` VALUES (6, 0);
INSERT INTO `globalvotes` VALUES (7, 2);
INSERT INTO `globalvotes` VALUES (8, 3);
INSERT INTO `globalvotes` VALUES (9, 0);
INSERT INTO `globalvotes` VALUES (10, 75);

-- ----------------------------
-- Table structure for individualvotes
-- ----------------------------
DROP TABLE IF EXISTS `individualvotes`;
CREATE TABLE `individualvotes`  (
  `voterIp` varchar(40) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `voteSite` tinyint(3) NOT NULL,
  `serverVotingTime` bigint(20) NULL DEFAULT NULL,
  `votingTimeSite` bigint(20) NULL DEFAULT NULL,
  `alreadyRewarded` tinyint(3) NULL DEFAULT NULL,
  PRIMARY KEY (`voterIp`, `voteSite`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

XML:

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<list>
<votesite name="l2.topgameserver.net" ordinal="0">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="ItopZ.com" ordinal="1">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Top.co" ordinal="2">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Votes.com" ordinal="3">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="Hopzone.net" ordinal="4">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Network.eu" ordinal="5">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Topservers.com" ordinal="6">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="top.l2jbrasil.com" ordinal="7">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="MMOTOP.eu" ordinal="8">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Topzone.com" ordinal="9">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Servers.com" ordinal="10">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="globalVotes" ordinal="11">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
</list>

XSD:
Code: [Select]
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="list">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="votesite" maxOccurs="unbounded" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="items">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute type="xs:short" name="itemId" use="optional"/>
                            <xs:attribute type="xs:int" name="itemCount" use="optional"/>
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute type="xs:string" name="name" use="optional"/>
            <xs:attribute type="xs:byte" name="ordinal" use="optional"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

html:

Code: [Select]
<html>
<title>Voting panel</title>
<body><center>
<br><img src="L2UI_CH3.herotower_deco" width=256 height=32><br>
<table cellpadding=2 width=280 background="L2UI_CH3.refinewnd_back_Pattern">
<tr><td width="280">Hello <font color="C6AF00">%accountName%</font>, welcome to the voting rewards dashboard, please help us by voting by server every <font color="C6AF00">%everyXtime% hours</font> in all voting sites.</td></tr>
</table>
<table width="290"><tr><td width="290" align="center">You can vote: </td></tr></table>
<br><img src="l2ui.SquareWhite" width=290 height=1><br>

%enablevote%

<br>
<img src="l2ui.SquareWhite" width=290 height=1><br>
</center></body>
</html>

Config votesystemm.ini
Code: [Select]
EnableVoteSystem = True

EnableGlobalVote = True

EnableIndividualVote = True

## Time to Update table totalVotes from DB
NextTimeToAutoUpdateTotalVote = 2

## Time to update table individualVotes in minutes
NextTimeToAutoUpdateIndividualVotes = 30

## In minutes
NextTimeToAutoCleanInnecesaryVotes = 30

## In  minutes
NextTimeToCheckAutoGlobalVotesReward = 10

## In hours
IntervalToNextVote = 12

## Amount of votes to set reward
GlobalVotesAmountToNextReward = 1

EnableVotingCommand = True

VotingCommand = .getreward

## l2.topgameserver.net
VoteLinkTgs = http://l2.topgameserver.net/lineage/VoteApi/

TgsApiKey =

## l2top.co
VoteLinkTopCo = https://l2top.co/reward/

TopCoSrvId =

## ITopz.com
VoteLinkItopz = https://itopz.com/check/

ItopzZpiKey =

ItopzSrvId =

## l2votes.com
VoteLinkVts = https://l2votes.com/

VtsApiKey =

## L2Votes - Server Id
VtsSid = 208

## Hopzone.net
VoteLinkHz = https://api.hopzone.net/lineage2/

HzApiKey =

## l2network.eu
VoteNetworkLink = https://l2network.eu/api.php

VoteNetworkUserName =

VoteNetworkApiKey =

## L2TopServer.com
VoteLinkTss = https://l2topservers.com/votes?

TssApiToken =

## top.l2jbrasil.com
BrasilVoteLink = https://top.l2jbrasil.com/votesystem/index.php?

BrasilUserName =

## Mmotop.eu
VoteLinkMmotop = https://mmotop.eu/l2/data/

MmotopApiKey =

## L2TopZone.com
VoteLinkTz = https://api.l2topzone.com/v1/

TzApiKey =

## L2Servers.com
VoteLinkServers = https://www.l2servers.com/api/

ServersHashCode =

ServersSrvId =

create new NPC with this type in custom folder:
Code: [Select]
type="NpcVote">
Title: Re: API Vote System - All projects
Post by: Mobius on May 09, 2020, 04:12:38 PM
Nice one. :D
Title: Re: API Vote System - All projects
Post by: Invoke on May 09, 2020, 04:59:03 PM
 ;)
Title: Re: API Vote System - All projects
Post by: Invoke on May 09, 2020, 05:32:30 PM
update: added voice command
Title: Re: API Vote System - All projects
Post by: greveimmortal on August 16, 2020, 03:13:16 AM
Great Sharem, but Im trying to put in work with some issues in my code, can you explain the work flow, for the individual vote reward?

I use Hopzone to test but whitout success.

Regards.

E
Title: Re: API Vote System - All projects
Post by: greveimmortal on August 19, 2020, 07:36:47 AM
Hi to all, thanks. but I have some Issues whit the code:

In the Java Console when server is starting up showme this:

2020.08.18 23:33:57,922   INFO   1   org.l2jmobius.gameserver.GameServer   ======================Vote System Enabled=========================
2020.08.18 23:33:57,942   WARNING   1   org.l2jmobius.commons.util.IXmlReader   Could not parse file: votesystem.xml
2020.08.18 23:33:57,950   INFO   1   org.l2jmobius.commons.util.IXmlReader   Loaded {} reward sites
2020.08.18 23:33:57,951   INFO   1   org.l2jmobius.gameserver.GameServer   ---------------------------------------------------=[ Clans ]



In the error Log showme this:


ago. 18, 2020 11:33:57 P. M. org.l2jmobius.commons.util.IXmlReader parseFile
WARNING: Could not parse file: votesystem.xml
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
   at org.l2jmobius.gameserver.votesystem.Reward.<init>(Reward.java:12)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.lambda$parseDocument$0(VoteSiteXml.java:42)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:769)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:752)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.lambda$parseDocument$1(VoteSiteXml.java:42)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:769)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:752)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.lambda$parseDocument$2(VoteSiteXml.java:42)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:769)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:752)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.lambda$parseDocument$3(VoteSiteXml.java:37)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:769)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:752)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.parseDocument(VoteSiteXml.java:36)
   at org.l2jmobius.commons.util.IXmlReader.parseFile(IXmlReader.java:102)
   at org.l2jmobius.commons.util.IXmlReader.parseDatapackFile(IXmlReader.java:76)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.load(VoteSiteXml.java:28)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.<init>(VoteSiteXml.java:22)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml$SingletonHolder.<clinit>(VoteSiteXml.java:63)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.getInstance(VoteSiteXml.java:58)
   at org.l2jmobius.gameserver.GameServer.<init>(GameServer.java:322)
   at org.l2jmobius.gameserver.GameServer.main(GameServer.java:517)



Any suggestion, I apreciate your help!

Regards

E
Title: Re: API Vote System - All projects
Post by: G-hamsteR on August 19, 2020, 05:41:12 PM
Something is wrong with your votesystem.xml. Make sure that it's correct and it is placed under the right folder.

Hi to all, thanks. but I have some Issues whit the code:

In the Java Console when server is starting up showme this:

2020.08.18 23:33:57,922   INFO   1   org.l2jmobius.gameserver.GameServer   ======================Vote System Enabled=========================
2020.08.18 23:33:57,942   WARNING   1   org.l2jmobius.commons.util.IXmlReader   Could not parse file: votesystem.xml
2020.08.18 23:33:57,950   INFO   1   org.l2jmobius.commons.util.IXmlReader   Loaded {} reward sites
2020.08.18 23:33:57,951   INFO   1   org.l2jmobius.gameserver.GameServer   ---------------------------------------------------=[ Clans ]



In the error Log showme this:


ago. 18, 2020 11:33:57 P. M. org.l2jmobius.commons.util.IXmlReader parseFile
WARNING: Could not parse file: votesystem.xml
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
   at org.l2jmobius.gameserver.votesystem.Reward.<init>(Reward.java:12)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.lambda$parseDocument$0(VoteSiteXml.java:42)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:769)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:752)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.lambda$parseDocument$1(VoteSiteXml.java:42)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:769)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:752)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.lambda$parseDocument$2(VoteSiteXml.java:42)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:769)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:752)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.lambda$parseDocument$3(VoteSiteXml.java:37)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:769)
   at org.l2jmobius.commons.util.IXmlReader.forEach(IXmlReader.java:752)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.parseDocument(VoteSiteXml.java:36)
   at org.l2jmobius.commons.util.IXmlReader.parseFile(IXmlReader.java:102)
   at org.l2jmobius.commons.util.IXmlReader.parseDatapackFile(IXmlReader.java:76)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.load(VoteSiteXml.java:28)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.<init>(VoteSiteXml.java:22)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml$SingletonHolder.<clinit>(VoteSiteXml.java:63)
   at org.l2jmobius.gameserver.votesystem.VoteSiteXml.getInstance(VoteSiteXml.java:58)
   at org.l2jmobius.gameserver.GameServer.<init>(GameServer.java:322)
   at org.l2jmobius.gameserver.GameServer.main(GameServer.java:517)



Any suggestion, I apreciate your help!

Regards

E
Title: Re: API Vote System - All projects
Post by: greveimmortal on August 19, 2020, 07:34:02 PM
Here is my xml file.

Quote
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/votesystem.xsd">
   <votesite name="l2.topgameserver.net" ordinal="0">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="ItopZ.com" ordinal="1">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="L2Top.co" ordinal="2">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="L2Votes.com" ordinal="3">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="Hopzone.net" ordinal="4">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="L2Network.eu" ordinal="5">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="L2Topservers.com" ordinal="6">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="top.l2jbrasil.com" ordinal="7">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="MMOTOP.eu" ordinal="8">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="L2Topzone.com" ordinal="9">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="L2Servers.com" ordinal="10">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
   <votesite name="globalVotes" ordinal="11">
      <items>
      <item itemId="57" itemCount="10000000" />
      <item itemId="6673" itemCount="1"/>
      </items>
   </votesite>
</list>

and the path is ./game/data/votesystem.xml
Title: Re: API Vote System - All projects
Post by: greveimmortal on August 20, 2020, 03:48:37 AM
Dagger, thanks I see the line with error, but I dont know what to do to fix it.

Any Suggestion?
Title: Re: API Vote System - All projects
Post by: tevsko on September 06, 2020, 09:17:51 AM
Thank you
 ;)
check this

Config votesystemm.ini

## In hours
- IntervalToNextVote = 12

+IntervalTimeToNextVote = 12

the rest everything ok I try to adapt it for interlude

 ;)

have you managed to adapt in C6?
Title: Re: API Vote System - All projects
Post by: tevsko on September 09, 2020, 02:04:50 AM
This is the error that points out

class java.lang.String cannot be cast to class java.lang.Integer

=======================
Reward.java line 12
=======================

 :o _itemId = (int) map.get("itemId");  :o

     

-   public Reward(Map<String, Object> map)
-   {
-      _itemId = (int) map.get("itemId");
-      _itemCount = (int) map.get("itemCount");
-   }




+   public Reward(int itemId, int itemCount)
+   {
+      _itemId = itemId;
+      _itemCount = itemCount;
+   }

=======================
VoteSiteXml
=======================


- forEach(votesiteNode,"items", itemsNode -> forEach(itemsNode,"item",itemNode -> votesite.getRewardList().add(new Reward(parseAttributes(itemNode)))));


+            forEach(votesiteNode,"items", itemsNode -> forEach(itemsNode,"item", itemNode -> votesite.getRewardList().add(new Reward(parseInteger(itemNode.getAttributes(), "itemId"), parseInteger(itemNode.getAttributes(), "itemCount")))));


 ;)





Thank you
 ;)
check this

Config votesystemm.ini

## In hours
- IntervalToNextVote = 12

+IntervalTimeToNextVote = 12

the rest everything ok I try to adapt it for interlude

 ;)

have you managed to adapt in C6?


With this I could adapt it without errors, I only need the API IDs to be able to test but the npc and the system have not had any errors so far


I'm going to try it, thanks
Title: Re: API Vote System - All projects
Post by: cristianlarenga on October 16, 2020, 07:17:09 AM
hi, I need help
When I try to install the Diff, eclipse throws me the error that the files cannot be found.
Can someone tell me how to install it correctly?
Thank you.
(https://i.ibb.co/Pt088RD/error-diff.jpg)
Title: Re: API Vote System - All projects
Post by: CostyKiller on October 20, 2020, 07:16:12 PM
Try to set Ignore leading path name segments to 1.
Title: Re: API Vote System - All projects
Post by: cristianlarenga on October 21, 2020, 03:28:02 AM
i have done what you told me but i still get the error in config.java file
I am using LJMobius H5 I do not understand why it has an error.
Can someone tell me how to solve the lines to implement the diff? thanks.

(https://i.ibb.co/LZL0nzB/subida.jpg)
Title: Re: API Vote System - All projects
Post by: Cristi Crys on November 22, 2020, 01:02:51 AM
Hello,this works for Prelude Of War server?
Title: Re: API Vote System - All projects
Post by: G-hamsteR on November 22, 2020, 10:42:47 AM
The logic is the same. Maybe you can't just apply the patch, but if you make the changes manually it should work.
Title: Re: API Vote System - All projects
Post by: Cristi Crys on December 13, 2020, 01:52:54 PM
Hello,why i have this error?

Buildfile: C:\Users\Crys\git\master\L2J_Mobius_7.0_PreludeOfWar\build.xml
checkRequirements:
init:
   [delete] Deleting directory C:\Users\Crys\git\master\build\bin
    [mkdir] Created dir: C:\Users\Crys\git\master\build\bin
compile:
    [javac] Compiling 2386 source files to C:\Users\Crys\git\master\build\bin
    [javac] C:\Users\Crys\git\master\L2J_Mobius_7.0_PreludeOfWar\java\org\l2jmobius\gameserver\votesystem\NpcVoteInstance.java:68: error: method does not override or implement a method from a supertype
    [javac]    @Override
    [javac]    ^
    [javac] C:\Users\Crys\git\master\L2J_Mobius_7.0_PreludeOfWar\java\org\l2jmobius\gameserver\votesystem\VoteManager.java:108: error: incompatible types: PlayerInstance cannot be converted to int
    [javac]          player.sendPacket(new ItemList(player, true));
    [javac]                                         ^
    [javac] C:\Users\Crys\git\master\L2J_Mobius_7.0_PreludeOfWar\java\org\l2jmobius\gameserver\votesystem\VoteManager.java:226: error: incompatible types: PlayerInstance cannot be converted to int
    [javac]                   player.sendPacket(new ItemList(player, true));
    [javac]                                                  ^
    [javac] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
    [javac] 3 errors

BUILD FAILED
C:\Users\Crys\git\master\L2J_Mobius_7.0_PreludeOfWar\build.xml:65: Compile failed; see the compiler error output for details.
Title: Re: API Vote System - All projects
Post by: teris1994 on April 07, 2022, 04:36:17 PM
Anyone test it ?
Title: Re: API Vote System - All projects
Post by: Reanimation on November 24, 2022, 03:22:26 AM
Diff:
https://pastebin.com/DSad9XcY

Command:
https://pastebin.com/7ywWXmC1

SQL:

Code: [Select]
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for globalvotes
-- ----------------------------
DROP TABLE IF EXISTS `globalvotes`;
CREATE TABLE `globalvotes`  (
  `voteSite` tinyint(2) NOT NULL,
  `lastRewardVotes` int(11) NULL DEFAULT NULL,
  PRIMARY KEY (`voteSite`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of globalvotes
-- ----------------------------
INSERT INTO `globalvotes` VALUES (0, 13);
INSERT INTO `globalvotes` VALUES (1, 68);
INSERT INTO `globalvotes` VALUES (2, 0);
INSERT INTO `globalvotes` VALUES (3, 3);
INSERT INTO `globalvotes` VALUES (4, 2);
INSERT INTO `globalvotes` VALUES (5, 0);
INSERT INTO `globalvotes` VALUES (6, 0);
INSERT INTO `globalvotes` VALUES (7, 2);
INSERT INTO `globalvotes` VALUES (8, 3);
INSERT INTO `globalvotes` VALUES (9, 0);
INSERT INTO `globalvotes` VALUES (10, 75);

-- ----------------------------
-- Table structure for individualvotes
-- ----------------------------
DROP TABLE IF EXISTS `individualvotes`;
CREATE TABLE `individualvotes`  (
  `voterIp` varchar(40) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `voteSite` tinyint(3) NOT NULL,
  `serverVotingTime` bigint(20) NULL DEFAULT NULL,
  `votingTimeSite` bigint(20) NULL DEFAULT NULL,
  `alreadyRewarded` tinyint(3) NULL DEFAULT NULL,
  PRIMARY KEY (`voterIp`, `voteSite`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;

XML:

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<list>
<votesite name="l2.topgameserver.net" ordinal="0">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="ItopZ.com" ordinal="1">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Top.co" ordinal="2">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Votes.com" ordinal="3">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="Hopzone.net" ordinal="4">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Network.eu" ordinal="5">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Topservers.com" ordinal="6">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="top.l2jbrasil.com" ordinal="7">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="MMOTOP.eu" ordinal="8">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Topzone.com" ordinal="9">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="L2Servers.com" ordinal="10">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
<votesite name="globalVotes" ordinal="11">
<items>
<item itemId="57" itemCount="10000000" />
<item itemId="6673" itemCount="1"/>
</items>
</votesite>
</list>

XSD:
Code: [Select]
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="list">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="votesite" maxOccurs="unbounded" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="items">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute type="xs:short" name="itemId" use="optional"/>
                            <xs:attribute type="xs:int" name="itemCount" use="optional"/>
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute type="xs:string" name="name" use="optional"/>
            <xs:attribute type="xs:byte" name="ordinal" use="optional"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

html:

Code: [Select]
<html>
<title>Voting panel</title>
<body><center>
<br><img src="L2UI_CH3.herotower_deco" width=256 height=32><br>
<table cellpadding=2 width=280 background="L2UI_CH3.refinewnd_back_Pattern">
<tr><td width="280">Hello <font color="C6AF00">%accountName%</font>, welcome to the voting rewards dashboard, please help us by voting by server every <font color="C6AF00">%everyXtime% hours</font> in all voting sites.</td></tr>
</table>
<table width="290"><tr><td width="290" align="center">You can vote: </td></tr></table>
<br><img src="l2ui.SquareWhite" width=290 height=1><br>

%enablevote%

<br>
<img src="l2ui.SquareWhite" width=290 height=1><br>
</center></body>
</html>

Config votesystemm.ini
Code: [Select]
EnableVoteSystem = True

EnableGlobalVote = True

EnableIndividualVote = True

## Time to Update table totalVotes from DB
NextTimeToAutoUpdateTotalVote = 2

## Time to update table individualVotes in minutes
NextTimeToAutoUpdateIndividualVotes = 30

## In minutes
NextTimeToAutoCleanInnecesaryVotes = 30

## In  minutes
NextTimeToCheckAutoGlobalVotesReward = 10

## In hours
IntervalToNextVote = 12

## Amount of votes to set reward
GlobalVotesAmountToNextReward = 1

EnableVotingCommand = True

VotingCommand = .getreward

## l2.topgameserver.net
VoteLinkTgs = http://l2.topgameserver.net/lineage/VoteApi/

TgsApiKey =

## l2top.co
VoteLinkTopCo = https://l2top.co/reward/

TopCoSrvId =

## ITopz.com
VoteLinkItopz = https://itopz.com/check/

ItopzZpiKey =

ItopzSrvId =

## l2votes.com
VoteLinkVts = https://l2votes.com/

VtsApiKey =

## L2Votes - Server Id
VtsSid = 208

## Hopzone.net
VoteLinkHz = https://api.hopzone.net/lineage2/

HzApiKey =

## l2network.eu
VoteNetworkLink = https://l2network.eu/api.php

VoteNetworkUserName =

VoteNetworkApiKey =

## L2TopServer.com
VoteLinkTss = https://l2topservers.com/votes?

TssApiToken =

## top.l2jbrasil.com
BrasilVoteLink = https://top.l2jbrasil.com/votesystem/index.php?

BrasilUserName =

## Mmotop.eu
VoteLinkMmotop = https://mmotop.eu/l2/data/

MmotopApiKey =

## L2TopZone.com
VoteLinkTz = https://api.l2topzone.com/v1/

TzApiKey =

## L2Servers.com
VoteLinkServers = https://www.l2servers.com/api/

ServersHashCode =

ServersSrvId =

create new NPC with this type in custom folder:
Code: [Select]
type="NpcVote">


Has anyone managed to adapt it to interlude c6? According to what I was able to do, but it doesn't work for me, the system doesn't start, it doesn't give me an error on the console or anything
Title: Re: API Vote System - All projects
Post by: nightwolf on January 10, 2023, 08:57:56 AM
this looks a very good system i believe its an upgrade from this https://l2jmobius.org/forum/index.php?topic=4973.0
i just want to let you know that itopz.com is using DEMO as api key for testing and test server id is 325339
so this link https://itopz.com/check/DEMO/325339/ can provide fake data for testing global vote
for individual you just add your ip in the end https://itopz.com/check/DEMO/325339/51.61.61.75 and you get fake data for individual testing

if you want i have this topic https://l2jmobius.org/forum/index.php?topic=5828.0
you can take parts from code if you are interested in for example https://github.com/nightw0lv/iTopZ-Java/blob/master/Interlude/aCis/src/itopz/com/util/Url.java
you can find all the backend api url's i've worked on this project

i have a question did you test global l2jbrasil api?
Title: Re: API Vote System - All projects
Post by: sztormy on March 10, 2023, 05:43:31 AM
Hello! Is there any newbie friendly guide about how to install the system?
Title: Re: API Vote System - All projects
Post by: Roy2021 on May 22, 2023, 04:19:54 AM
I have tried everything to adapt it to the Fafurion chronicle and nothing works for me, any better explained tutorial please, someone? thank you so much. :-X
Title: Re: API Vote System - All projects
Post by: nightwolf on May 30, 2023, 05:24:31 AM
I have tried everything to adapt it to the Fafurion chronicle and nothing works for me, any better explained tutorial please, someone? thank you so much. :-X
try to find the cause and if there is an error then you can get help

about the topic try to add hotservers.org and hopzone.eu
https://hopzone.eu/docs.html/ this docs are very easy and also solve the IPv6 problem
Title: Re: API Vote System - All projects
Post by: G-hamsteR on January 06, 2024, 04:55:43 PM
For those who are having trouble with hopzone or any other website that uses ipv6.

Let's start by saying that it should be common sense for them to disable ipv6 on their side and make everyone's lives easier.

There are two ways to bypass this problem.

1. Add the vote links inside your game. In older clients, you will need some client modifications to allow hyperlinks that open a browser. Instead of adding directly your hopzone link, add your website passing in the account's name. For example "https://myserver.com/vote?account=test

Your website must support ipv6. Then, your website checks your user's IP and if it is IPv6, it adds it to a column in the accounts table. So, instead of just the column last_ip, add a second one, like last_ipv6.

If an account has the last_ipv6 filled, when you make the post request to hopzone, check for the last_ipv6 value.

2. Allow ipv6 to your website and once someone browses it, make a simple GET request to this website using javascript. https://api.ipify.org/
This will return the IPv4 IP of the user. Once you have both, store them in a database. You now have the matches between these two.
Title: Re: API Vote System - All projects
Post by: Andariel on February 20, 2024, 11:05:55 AM
can someone help me?
when i press reward this thing show me in console but not doing any action
[20/02 11:03:54] [Character: Test[268479476] - Account: admin - IP: 127.0.0.1] sent not handled RequestBypassToServer: [vote_268464007_site 0]
[20/02 11:04:12] [Character: Test[268479476] - Account: admin - IP: 127.0.0.1] sent not handled RequestBypassToServer: [vote_268464007_site 1]
Title: Re: API Vote System - All projects
Post by: Andariel on February 20, 2024, 04:49:50 PM
i am sure is something mising from RequestBypassToServer.java I thing is not share averything in main pastebin.
Title: Re: API Vote System - All projects
Post by: Andariel on February 21, 2024, 11:29:58 PM
after many attempts I found this code for interlude classic. But I have almost the same problem with this one...
https://pastebin.com/rJcPsbD4 (https://pastebin.com/rJcPsbD4)

https://prnt.sc/VJCcWpSwaTd9 (https://prnt.sc/VJCcWpSwaTd9)
https://prnt.sc/13R2sh1TxYyK (https://prnt.sc/13R2sh1TxYyK)



Title: Re: API Vote System - All projects
Post by: dramaa on February 22, 2024, 06:08:34 PM
after many attempts I found this code for interlude classic. But I have almost the same problem with this one...
https://pastebin.com/rJcPsbD4 (https://pastebin.com/rJcPsbD4)

https://prnt.sc/VJCcWpSwaTd9 (https://prnt.sc/VJCcWpSwaTd9)
https://prnt.sc/13R2sh1TxYyK (https://prnt.sc/13R2sh1TxYyK)

i should not be writing but, maybe just change npc id like idk 50000 (if its free) and make new npc id 50000 and display id what ever you want to be, if you have tried it sorry then

<npc id="50000" displayId="32365" name="Kaaya" usingServerSideName="true" title="Vote Reward System" type="NpcVoteReward">