Jump to content

Recommended Posts

Posted

Γεια σας μέλη του maxcheaters.

Λοιπων εδώ είναι ένας κώδικας για "Vote Reward" ο οποίος δούλευε σε "Interlude". Tου έχω κάνει μερικές αλλαγές και εχω προσθεσει καποια πράγματα ώστε να λειτουργεί σε "Freya"!!

 

Τα αρχικά credits πηγαίνουν στον "extr3me". Ειναι το πρώτο μου topic που έχει σχέση με CODE.!

 

Εδώ είμαστε λοιπών:

Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties
+++ java/config/l2jmods.properties

# will be 1+2=3. Use 0 or negative value for unlimited number of connections.
# Default: 127.0.0.1,0 (no limits from localhost)
DualboxCheckWhitelist = 127.0.0.1,0
+
+#============================================
+#       Vote Reward System by GoldenBoy     =
+#============================================
+#Set it "True" if you want to Enable Vote Reward System.
+EnableVoteReward = False
+#If you enable Vote Reward System you must fill your Html Patch.
+#e.g. VoteHtmlPatch = http://l2.hopzone.net/lineage2/moreinfo/yourserver/65487.htm
+# Html Patch for Your Vote Site
+# Works with HopZone/HopZones/TopZone and other HopZone Like
+ServerNameForVotes = L2ServerName
+VoteHtmlPatch = 
+VoteReward1Count = 1000
+VoteReward2Count = 1000
+VoteReward1Id = 57
+VoteReward2Id = 57
+VotesForReward = 5
+#Max amount of reward items that you want to stop reward 
+#the player that have more than "MaxRewardCountForStack".
+MaxRewardCountForStackItem1 = 2000000000
+MaxRewardCountForStackItem2 = 2000000000
+#DelayForNextReward in seconds
+DelayForNextReward = 600

 

Index: java/com/l2jserver/gameserver/model/AutoVoteRewardHandler.java
===================================================================
--- java/com/l2jserver/gameserver/model/AutoVoteRewardHandler.java
+++ java/com/l2jserver/gameserver/model/AutoVoteRewardHandler.java
+/* 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+ 
+package com.l2jserver.gameserver.model;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.Announcements;
+import com.l2jserver.gameserver.GmListTable;
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.model.L2ItemInstance;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ *
+ * @author GoldenBoy
+ *
+ */
+
+
+public class AutoVoteRewardHandler
+{
+	private int	lastVoteCount = 0;
+	private int	initialCheck = 60 * 1000;														
+	private int	delayForCheck = Config.DELAY_FOR_NEXT_REWARD * 1000;	
+	
+	private AutoVoteRewardHandler()
+
+	{
+		if (Config.VOTE_REWARD_ENABLE)
+		{		
+		System.out.println("========= "+Config.SERVER_NAME_FOR_VOTES+" =========");
+		System.out.println("Vote Reward System activated");
+		System.out.println("========= "+Config.SERVER_NAME_FOR_VOTES+" =========");
+		ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck, delayForCheck);
+		}
+	}
+	
+
+	private class AutoReward implements Runnable
+	{
+		public void run()		
+		{
+			if (Config.VOTE_REWARD_ENABLE)
+			{
+			System.out.println("");
+			System.out.println("==================");
+			System.out.println("Vote Count Check.");
+			if (Config.VOTE_REWARD1_ID == 0 || Config.VOTE_REWARD1_COUNT == 0 || Config.VOTE_REWARD2_ID == 0 || Config.VOTE_REWARD2_COUNT == 0)
+			{
+				GmListTable.broadcastMessageToGMs("The rewards aren't Identified. Please take a look.");
+				return;
+			}
+			int newVoteCount = getVotes(Config.VOTE_HTML_PATCH);
+			System.out.println("getLastVoteCount:"+getLastVoteCount());
+			System.out.println("newVoteCount:"+newVoteCount);
+			System.out.println("==================");
+			System.out.println("");
+			if (newVoteCount != 0 && getLastVoteCount() != 0 && newVoteCount >= getLastVoteCount() + Config.VOTES_FOR_REWARD)
+			{
+				for (L2PcInstance player : L2World.getInstance().getAllPlayers().values())
+				{
+					if (player != null)
+					{
+							L2ItemInstance item1 = player.getInventory().getItemByItemId(Config.VOTE_REWARD1_ID);
+							if (item1 == null || item1.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM1)
+							{
+								if (player.getAppearance().getNameColor() != Config.OFFLINE_NAME_COLOR)
+								{
+									player.addItem("reward", Config.VOTE_REWARD1_ID, Config.VOTE_REWARD1_COUNT, player, true);
+								}
+							}
+							else
+							{
+								player.sendMessage("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "You have reached our limit for vote reward items!!");
+							}
+							L2ItemInstance item2 = player.getInventory().getItemByItemId(Config.VOTE_REWARD2_ID);
+							if (item2 == null || item2.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM2)
+							{
+								if (player.getAppearance().getNameColor() != Config.OFFLINE_NAME_COLOR)
+								{
+									player.addItem("reward", Config.VOTE_REWARD2_ID, Config.VOTE_REWARD2_COUNT, player, true);
+								}
+							}
+							else
+							{
+								player.sendMessage("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "You have reached our limit for vote reward items!!");
+							}
+					}
+				}	
+				setLastVoteCount(newVoteCount);
+			}
+			Announcements.getInstance().announceToAll("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "Our Current vote count is: " + newVoteCount);
+			Announcements.getInstance().announceToAll("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "The next reward will be given at " + (getLastVoteCount()+ Config.VOTES_FOR_REWARD) + " Votes.");
+			if (getLastVoteCount() == 0)
+			{
+				setLastVoteCount(newVoteCount);
+			}
+			}
+		}
+	}
+
+	private int getVotes(String urlString)
+	{
+		InputStreamReader isr = null;
+		BufferedReader in = null;
+		try
+		{
+			URL url = new URL(urlString);
+                      isr = new InputStreamReader(url.openStream());
+			in = new BufferedReader(isr);
+			String inputLine;
+			int voteCount = 0;
+			while ((inputLine = in.readLine()) != null)
+			{
+				if (inputLine.contains("moreinfo_total_rank_text"))
+				{
+					int Sub = 12;
+					switch (inputLine.length())
+					{
+						case 116:
+							Sub = 13; 
+							break;
+						case 117:
+							Sub = 14; 
+							break;
+						case 118:
+							Sub = 15;
+							break;
+						case 119:
+							Sub = 16; 
+							break;
+					}
+					voteCount = Integer.parseInt(inputLine.substring(inputLine.length() - Sub, inputLine.length() - 11));
+					break;
+				}
+			}
+			return voteCount;
+		}
+		catch (IOException e)
+		{
+			e.printStackTrace();
+			return 0;
+		}
+		finally
+		{
+			try
+			{
+				in.close();
+			}
+			catch (IOException e)
+			{
+				
+			}
+			try
+			{
+				isr.close();
+			}
+			catch (IOException e)
+			{
+				
+			}
+		}
+	}
+	
+	/**
+	 * @return
+	 */
+
+	private void setLastVoteCount(int voteCount)
+	{
+		lastVoteCount = voteCount;
+	}
+	
+	private int getLastVoteCount()
+	{
+		return lastVoteCount;
+	}
+	
+	public static AutoVoteRewardHandler getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
+	@SuppressWarnings("synthetic-access")
+	private static class SingletonHolder
+	{
+		protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler();
+	}
+}

 

Index: java/com/l2jserver/gameserver/GameServer.java
===================================================================
--- java/com/l2jserver/gameserver/GameServer.java
+++ java/net/l2jserver/gameserver/GameServer.java

import com.l2jserver.gameserver.handler.SkillHandler;
import com.l2jserver.gameserver.handler.UserCommandHandler;
import com.l2jserver.gameserver.handler.VoicedCommandHandler;
+import com.l2jserver.gameserver.model.AutoVoteRewardHandler;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.AirShipManager;
import com.l2jserver.gameserver.instancemanager.AntiFeedManager;

	SkillHandler.getInstance();
	UserCommandHandler.getInstance();
	VoicedCommandHandler.getInstance();
+	 	AutoVoteRewardHandler.getInstance();

	if (Config.L2JMOD_ALLOW_WEDDING)
		CoupleManager.getInstance();

 

Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java
+++ java/com/l2jserver/Config.java

public static int L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP;
public static int L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP;
public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
     
+    //Vote Reward
+    public static String 		VOTE_HTML_PATCH;
+    public static int 			VOTE_REWARD1_ID;
+    public static int 			VOTE_REWARD2_ID;
+    public static int 			VOTE_REWARD1_COUNT;
+    public static int 			VOTE_REWARD2_COUNT;
+    public static int 			VOTES_FOR_REWARD;
+    public static boolean 		VOTE_REWARD_ENABLE;
+    public static String 		SERVER_NAME_FOR_VOTES;
+    public static int 			MAX_REWARD_COUNT_FOR_STACK_ITEM1;
+    public static int 			MAX_REWARD_COUNT_FOR_STACK_ITEM2;
+    public static int 			DELAY_FOR_NEXT_REWARD;
+	

//--------------------------------------------------
// NPC Settings
//--------------------------------------------------
=================================================================================================================================================================
							_log.warning(StringUtil.concat("DualboxCheck[Config.load()]: invalid number -> DualboxCheckWhitelist \"", entrySplit[1], "\""));
						}
					}
				}
+					VOTE_HTML_PATCH = L2JModSettings.getProperty("VoteHtmlPatch", "Null");
+					VOTE_REWARD1_COUNT = Integer.parseInt(L2JModSettings.getProperty("VoteReward1Count", "1000"));
+					VOTE_REWARD2_COUNT = Integer.parseInt(L2JModSettings.getProperty("VoteReward2Count", "1000"));
+					VOTE_REWARD1_ID = Integer.parseInt(L2JModSettings.getProperty("VoteReward1Id", "57"));
+					VOTE_REWARD2_ID = Integer.parseInt(L2JModSettings.getProperty("VoteReward2Id", "57"));
+					VOTES_FOR_REWARD = Integer.parseInt(L2JModSettings.getProperty("VotesForReward", "5"));
+					VOTE_REWARD_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("EnableVoteReward", "False"));
+					SERVER_NAME_FOR_VOTES                     = L2JModSettings.getProperty("ServerNameForVotes", "L2ServerName");
+					MAX_REWARD_COUNT_FOR_STACK_ITEM1 = Integer.parseInt(L2JModSettings.getProperty("MaxRewardCountForStackItem1", "2000000000"));
+					MAX_REWARD_COUNT_FOR_STACK_ITEM2 = Integer.parseInt(L2JModSettings.getProperty("MaxRewardCountForStackItem2", "2000000000"));
+					DELAY_FOR_NEXT_REWARD = Integer.parseInt(L2JModSettings.getProperty("DelayForNextReward", "600"));
			}
			catch (Exception e)
			{
				e.printStackTrace();

 

**UPDATE**

Έφτιαξα το error που είχε και το τέσταρα!

Αν θέλετε οι OfflineTrade παίκτες να μην παίρνουν το reward, ενεργοποιήστε το "Offline Name Collor". Έτσι όταν κάποιος παίκτης είναι OfflineTrade και έχει το Χρώμα στον τίτλο του που εσείς ορίσατε δεν θα παίρνει το reward!

 

Rework Credits : GoldenBoy™

Posted

Koitaxe ligo to code sou file merikes lexeis einai la8os grammenes kai merika  + lathos sigoura.:S

Kata ta alla einai kalo , elpizw na doulebei

Αφού είδες πως έχει λάθη δοκίμασε τον να μας πεις αν δουλεύει όντως ή απλά πες του τι είναι λάθος να το διορθώσει.

Posted

Παιδιά συγνώμη αν έχω κάποιο λάθος πάω τώρα αμέσως να το κοιτάξω ξανά!!!

 

EDIT: Το testara και είδα το λαθάκι που είχα! Τώρα δουλεύει πολύ καλά! Ευχαριστώ παίδες!

Posted

Παιδιά συγνώμη αν έχω κάποιο λάθος πάω τώρα αμέσως να το κοιτάξω ξανά!!!

 

EDIT: Το testara και είδα το λαθάκι που είχα! Τώρα δουλεύει πολύ καλά! Ευχαριστώ παίδες!

 

 

Just Tested... :P Doulevei Apsoga... Thanks Pou to ekanes Share... Keep Up ;) ..!

Posted

Fusiko  einai na kolaei kai tha kolaei sinexeia ma fou exei kanei lathos o filos mas o GoldenBoy™

ayto edw kato  prepei na fix.. diladi prepei na to kanete etsi..

 

#DelayForNextReward in seconds
-DelayForNextReward = 120
+DelayForNextReward = 600

 

Gia ton logo oti  kanei  se 120s  next vote kai kolaei..

Gi ayto balteto opws to ekana poio pano kai den tha exei provlima.. :)

Posted

Fusiko  einai na kolaei kai tha kolaei sinexeia ma fou exei kanei lathos o filos mas o GoldenBoy™

ayto edw kato  prepei na fix.. diladi prepei na to kanete etsi..

 

#DelayForNextReward in seconds
-DelayForNextReward = 120
+DelayForNextReward = 600

 

Gia ton logo oti  kanei  se 120s  next vote kai kolaei..

Gi ayto balteto opws to ekana poio pano kai den tha exei provlima.. :)

 

Εμένα δούλευε κανονικά και με 120sec και γιαυτό το είχα έτσι αλλά και για τον λόγο ότι το τέσταρα και ήθελα να δίνει γρήγορα το reward για να δω αν δουλεύει.!

Posted

vasika egw otan ton kanw ston test server pou exw ta kanei mia xara kai ta dinei(ta exw valei ana 1 vote kai ana 20 sec na check)... ston kanoniko omws otan erxete h wra na paroun to reward kai na dosei kainourio ari8mo gia vote kolaei ekei... apo thn mia pistevw ot ginete auto epeidh... mexri na ksanatsekarei exoun perasei ta vote pou 8elei kai kolaei...

pantws kati na to fixarw fast giati mou exei dimiourgi8ei provlima...

Posted

File GoldenBoy™  se test serevr kala to ekanes  kai  na to kaneis test  se  kanoniko server prepei na to kaneis 600 gia ton  logo  na min lagari kai ektos arxisou ta error ston server...

n

Posted

emena mou vgazei auto sto GS:

Exception in thread "GeneralSTPool-4" java.lang.NullPointerException
       at com.l2jserver.gameserver.model.AutoVoteRewardHandler$AutoReward.run(A
utoVoteRewardHandler.java:91)
       at com.l2jserver.gameserver.ThreadPoolManager$RunnableWrapper.run(Thread
PoolManager.java:86)
       at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
       at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)

       at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$101(Unknown Source)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
runPeriodic(Unknown Source)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
       at java.lang.Thread.run(Unknown Source)

Posted

File GoldenBoy™  se test serevr kala to ekanes  kai  na to kaneis test  se  kanoniko server prepei na to kaneis 600 gia ton  logo  na min lagari kai ektos arxisou ta error ston server...

n

 

Φίλε Flash™ έχεις δίκιο σε αυτό που λες απλά ξέχασα να το αλλάξω όταν πέρασα τον κώδικα εδώ!

 

==========================================================================

emena mou vgazei auto sto GS:

Exception in thread "GeneralSTPool-4" java.lang.NullPointerException
        at com.l2jserver.gameserver.model.AutoVoteRewardHandler$AutoReward.run(A
utoVoteRewardHandler.java:91)
        at com.l2jserver.gameserver.ThreadPoolManager$RunnableWrapper.run(Thread
PoolManager.java:86)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)

        at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$101(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
runPeriodic(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

 

Δες ξανά το topic είχα και εγώ αυτό το error και το fixara και το έκανα και εδώ update, προσθέτοντας την αλλαγή αυτή!

 

Αυτό εδώ άλλαξα:

+						if (item1 == null || item1.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM1)
+						{
+							player.addItem("reward", Config.VOTE_REWARD1_ID, Config.VOTE_REWARD1_COUNT, player, true);
+						}
+						else
+						{
+							player.sendMessage("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "You have reached our limit for vote reward items");
+						}

 

 

και αυτό:

+						if (item2 == null || item2.getCount() < Config.MAX_REWARD_COUNT_FOR_STACK_ITEM2)
+						{
+							player.addItem("reward", Config.VOTE_REWARD2_ID, Config.VOTE_REWARD2_COUNT, player, true);
+						}
+						else
+						{
+							player.sendMessage("[" + Config.SERVER_NAME_FOR_VOTES+"]" + "You have reached our limit for vote reward items");
+						}

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • ***DO NOT BUY WHAT IS POSTED HERE FOR FREE*** https://www.mediafire.com/file/mhjiaoipe6hohjm/Extender_Rev_222_by_Guytis.rar/file   It has everything Devs is offering for $450 USD with a license. Here it is, free and with source code. 
    • Hello, well obviously i dont have access to the server side, and neither have those guys in the picture, i thought it was something client side since they manage to have that...    Here is another example, Its essence server btw  
    • So according to you, you found a bug so hidden that nobody can discover it — not even by analyzing the source code with modern tools.   Is that really what you're trying to say?   Because what you're basically claiming is that: The files contain an error But nobody can find it Nobody can fix it Not even by analyzing the code with tools like ChatGPT So… a magical invisible bug that only you can see.   Do you realize how absurd that sounds?   If there was actually a real problem, it would be very easy to demonstrate: Open the server. Show the error. Point to the exact place in the code where it happens.   But instead of doing that, the only thing you've done so far is write vague messages and say “I'll make a video.” Perfect. Go ahead and make the video. Show the error. Show the code.   Because up to this point, all we have here are accusations without a single piece of technical evidence. And in a development forum, that has absolutely no value.   Regards.   ***DO NOT BUY WHAT IS POSTED HERE FOR FREE*** https://www.mediafire.com/file/mhjiaoipe6hohjm/Extender_Rev_222_by_Guytis.rar/file   It has everything Devs is offering for $450 USD with a license. Here it is, free and with source code.  ------------------------------------------------------------------------------------------------------   I would like to ask if a moderator or administrator could please review the thread and consider closing it.   The user involved keeps posting misleading statements and accusations without providing any technical proof. The discussion has stopped being a constructive technical conversation and has turned into repeated attempts to spread misinformation about the files.   Despite being asked multiple times to provide evidence (such as a reproducible error, logs, or code analysis), none has been presented. Instead, the thread continues with vague claims that only generate confusion within the community.   From my perspective, the purpose seems to be discouraging users from using the freely available files while promoting alternative products.   Since no technical evidence has been provided and the thread is no longer productive, I believe it would be better for the community if the discussion were closed.   Thank you for your time and attention.   Best regards. --------------------------------------------------------------------------------------------------------   ***DO NOT BUY WHAT IS POSTED HERE FOR FREE*** https://www.mediafire.com/file/mhjiaoipe6hohjm/Extender_Rev_222_by_Guytis.rar/file   It has everything Devs is offering for $450 USD with a license. Here it is, free and with source code.   
    • What ChatGPT? Dont think ChatGPT will fix your problem :d You will never figure out where the problem actually is. Don’t try to twist things. Just open the server and write here.. i will make a video for you showing how everything goes to hell with “your files”
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..