L2JMobius

Free Users => Shares/Contributions => Topic started by: l2.topgameserver.net on May 11, 2020, 12:09:36 AM

Title: Lineage 2 vote reward system - l2.topgameserver.net
Post by: l2.topgameserver.net on May 11, 2020, 12:09:36 AM
I have created a code to reward for voting on several well-known sites.

If someone has difficulty adding this code to their package, they can write to me at my discord  https://discord.com/invite/VbnZbWR I will adapt this code for l2jfrozen and l2jserver or for some popular open source package.

(https://i.imgur.com/lO92otT.jpg)
(https://i.imgur.com/qGCW4f6.jpg)

You can see the code in the following link:
aCis: https://pastebin.com/1Wq6GZPs
L2JServer  H5: https://pastebin.com/KVyPAZ0X

L2JFrozen 1.5 Interlude https://pastebin.com/GaAyMMT2
L2JMobius classic interlude https://pastebin.com/rJcPsbD4
L2JMobius Interlude https://pastebin.com/1HAX4UbN
l2jfrozen 1132 https://pastebin.com/YczLkpUp
L2jMobius High-Five https://pastebin.com/aYvSZVC8
L2Mythras (2017.07.12) https://pastebin.com/yTKnHpDD
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: tevsko on May 11, 2020, 03:31:02 AM
Interlude C6 :P
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: l2.topgameserver.net on May 11, 2020, 02:03:28 PM
Interlude C6 :P

Now is available for l2jmobius interlude classic  ;D ;D
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: tevsko on May 12, 2020, 01:26:16 AM
Perfect now I hope for interlude C6 not classic ;)
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: l2.topgameserver.net on May 13, 2020, 05:40:05 AM
Update for L2JMobius Interlude https://pastebin.com/1HAX4UbN
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: ihearcolors on May 13, 2020, 01:16:50 PM
Update for L2JMobius Interlude https://pastebin.com/1HAX4UbN
Appreciated! Thanks
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: l2.topgameserver.net on May 17, 2020, 11:56:48 AM
Fix
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: junin00 on June 28, 2020, 10:52:58 PM
Hello beauty?
In the code for Interlude, I was adding it to my server, and I ended up noticing that in the file "Broadcast.java" in the path gameserver/util/
The imports are missing:

import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;

---
And in the file "voteHandler.java" from the gameserver/votesystem/Handler/
An incompatibility is appearing:

http://www.mediafire.com/view/3bda5bpkzhqqiyw/voteHandler.png/file
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: tevsko on June 29, 2020, 12:36:35 PM
How strange, I do have them :o

Code: [Select]
+++ b/L2J_Mobius/java/org/l2jmobius/gameserver/util/Broadcast.java
@@ -17,11 +17,13 @@
 package org.l2jmobius.gameserver.util;
 
 import org.l2jmobius.gameserver.datatables.xml.ZoneData;
+import org.l2jmobius.gameserver.enums.ChatType;
 import org.l2jmobius.gameserver.model.World;
 import org.l2jmobius.gameserver.model.actor.Creature;
 import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 import org.l2jmobius.gameserver.model.zone.ZoneType;
 import org.l2jmobius.gameserver.network.serverpackets.CharInfo;
+import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
 import org.l2jmobius.gameserver.network.serverpackets.GameServerPacket;
 import org.l2jmobius.gameserver.network.serverpackets.RelationChanged;
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: junin00 on June 29, 2020, 08:50:49 PM
yes, but mobius does not have these imports  ;D

https://bitbucket.org/MobiusDev/l2j_mobius/src/master/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/util/Broadcast.java
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: ruffle on June 30, 2020, 02:42:25 AM
Ty champ
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: FanaticoLineage2 on July 23, 2020, 06:15:44 PM
Hello, which api should I use in hopzone? the one above or the one below?

https://ibb.co/Yhz1pTN
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: G-hamsteR on July 24, 2020, 01:04:03 PM
Hello, which api should I use in hopzone? the one above or the one below?

https://ibb.co/Yhz1pTN

Use the first one. I think this scripts only checks the total votes and not individual votes.
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: RoberBlack on October 08, 2020, 06:24:58 PM
hello, does the voting system work?
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: tevsko on October 11, 2020, 08:11:25 AM
It seems the same right? He has problems?

This is not the same voting system?

https://l2jmobius.org/forum/index.php?topic=4965.0
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: l2.topgameserver.net on January 01, 2021, 02:26:32 AM
Hello everyone, I wanted to inform you that I have made a few adjustments to the voting system in which the validation of the votes has been corrected and the issue of multiple claims that sometimes occurred in the voting system, also add the adaptation of the system to package l2jfrozen 1132 https://pastebin.com/YczLkpUp
I will be making the adaptation to all the chronicles of L2JMobius, L2Mythras, if anyone has any suggestion of a known and open source package that has not yet been adapted let me know.
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: l2.topgameserver.net on January 02, 2021, 09:32:46 PM
Update for L2jMobius High-Five https://pastebin.com/aYvSZVC8
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: l2.topgameserver.net on January 04, 2021, 01:21:39 AM
Update for L2Mythras (2017.07.12) https://pastebin.com/yTKnHpDD
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: l2.topgameserver.net on March 19, 2021, 06:56:17 PM
Update for Homonculus https://pastebin.com/J9mkvWYH
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: l2.topgameserver.net on March 28, 2021, 10:23:14 PM
Hello @everyone, apparently the problem of undefined claims has been generated by a bad calculation of the remaining times, so to correct this, you must go to: votesystem.Handler.VoteManager and search public long getTimeRemaining (individualVote iv) and replace the old method with this: public long getTimeRemaining (individualVote iv) { long timeRemaining = 0L; timeRemaining = ((iv.getVotingTimeSite () + Config.INTERVAL_TO_NEXT_VOTE) - ((iv.getDiffTime ()> 0)? (System.currentTimeMillis () + iv.getDiffTime ()): (System.currentTimeMillis () - iv.getDiffTime () - iv.getDiffTime ()))); System.out.println ("Remaining time:" + timeRemaining); return timeRemaining; }
Title: Re: Lineage 2 vote reward system - l2.topgameserver.net
Post by: Strelook66 on December 24, 2021, 02:15:34 PM
Hi,

The code works ok, the rewards work but the only problem that I have is this:

Code: [Select]
java.sql.SQLSyntaxErrorException: (conn=137753) Could not set parameter at position 5 (values was true)
Query - conn:137753(M)  - "INSERT INTO individualvotes(voterIp,voteSite,votingTimeSite,alreadyRewarded) VALUES(?,?,?,?) ON DUPLICATE KEY UPDATE voterIp = VALUES(voterIp), voteSite = VALUES(voteSite), votingTimeSite = VALUES(votingTimeSite),alreadyRewarded = VALUES(alreadyRewarded)"
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:171)
at org.mariadb.jdbc.ClientSidePreparedStatement.setParameter(ClientSidePreparedStatement.java:482)
at org.mariadb.jdbc.BasePrepareStatement.setBoolean(BasePrepareStatement.java:1342)
at org.l2jmobius.gameserver.votesystem.DB.individualVoteDB.SaveVotes(individualVoteDB.java:104)
at org.l2jmobius.gameserver.votesystem.Handler.voteManager.AutoUpdateIndividualVotes(voteManager.java:301)
at org.l2jmobius.gameserver.votesystem.Handler.voteManager$AutoUpdateIndividualVotesTask.run(voteManager.java:400)
at org.l2jmobius.commons.threads.RunnableWrapper.run(RunnableWrapper.java:38)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)

After you press "Get reward", everything works fine. But after a few seconds in the GameServer, the above error happens, and the individualvote table remains empty. The voting is not saved. The value returned is true but the table does not update.
Which means if the server is restarted, the player can benefit from the rewards again.