L2JMobius

High Five API Vote System - All projects

Invoke · 28 · 15349

Offline Invoke

  • Heir
  • **
    • Posts: 18
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">





Offline greveimmortal

  • Vassal
  • *
    • Posts: 7
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


Offline greveimmortal

  • Vassal
  • *
    • Posts: 7
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


Offline G-hamsteR

  • Viscount
  • *****
    • Posts: 326
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


Offline greveimmortal

  • Vassal
  • *
    • Posts: 7
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


Offline greveimmortal

  • Vassal
  • *
    • Posts: 7
Dagger, thanks I see the line with error, but I dont know what to do to fix it.

Any Suggestion?


Offline tevsko

  • Knight
  • ***
    • Posts: 96
    • L2Babylon
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?


Offline tevsko

  • Knight
  • ***
    • Posts: 96
    • L2Babylon
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


Offline cristianlarenga

  • Vassal
  • *
    • Posts: 4
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.


Online CostyKiller

  • Distinguished King
  • *****
    • Posts: 953

Offline cristianlarenga

  • Vassal
  • *
    • Posts: 4
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.