Jump to content

Recommended Posts

Posted (edited)

if (player.getUptime() >= val*60*60*1000)

 

val stands for hours.

 

and for reseting the time, go at Logout.java and add this line:

 

player.setUptime(0);

 

By the way, dunno what project are you using. The codes that I wrote you are based on l2jfrozen methods.

Edited by Devlin
Posted

if (player.getUptime() >= val*60*60*1000)

 

val stands for hours.

 

and for reseting the time, go at Logout.java and add this line:

 

player.setUptime(0);

 

By the way, dunno what project are you using. The codes that I wrote you are based on l2jfrozen methods.

 

Are you check my PM?

  • 2 weeks later...
Guest Elfocrash
Posted

if (player.getUptime() >= val*60*60*1000)

 

val stands for hours.

 

and for reseting the time, go at Logout.java and add this line:

 

player.setUptime(0);

 

By the way, dunno what project are you using. The codes that I wrote you are based on l2jfrozen methods.

This wont work on any kind of project ever unless you check in as a task.

Also the time of uptime is automaticaly reset on logout.

Posted

This wont work on any kind of project ever unless you check in as a task.

Also the time of uptime is automaticaly reset on logout.

For sure it needs a task.

 

About the reset, I didn't know :P

Posted (edited)

A simple task with a counter linked to L2PcInstance can do the trick. Inside the run section you ++ the counter and make checks regarding it.

 

An exemple for monster derby track which I'm currently recoding for aCis, making checks every seconds to call events :

 

Called by

ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Announcement(), 0, 1000);

And running

	class Announcement implements Runnable
	{
		public Announcement()
		{
		}
		
		@Override
		public void run()
		{
			if (_finalCountdown >= 1200)
				_finalCountdown = 0;
			
			switch (_finalCountdown)
			{
				case 0:
					makeAnnouncement(SystemMessageId.MONSRACE_TICKETS_AVAILABLE_FOR_S1_RACE);
					break;
				
				case 30: // 30 sec
				case 60: // 1 min
					...
				
				case 1080: // 18 min
					makeAnnouncement(SystemMessageId.MONSRACE_RACE_START);
					break;
			}
			_finalCountdown += 1;
		}
	}

As you can see on my exemple, it runs the task every second, increasing _finalCountdown value and checking if that variable reached a particular number.

			if (_finalCountdown >= 1200)
				_finalCountdown = 0;

exists to make a cycle of 20min (reset to 0 when it happens).

 

Instead of 1000 (one second), you put 60000 (one minute) for scheduleGeneralAtFixedRate timer and then you can reward for case 30, 60, 120, etc (30min, 1hour, 2hours,..).

Edited by Tryskell
Guest
This topic is now closed to further replies.


  • Posts

    • Since technical talk offends people, I believe I should return back to writting my Lineage 2 lore stories. Here's the next one:   Once upon a time, there was a boy and a small adorable wolf.    The boy really loved the wolf but as the wolf grow older and bigger, it became agressive and would bite the boy. One day the boy and the wolf decided to go to the city to buy potions. The road was long and hilly so the boy moved all his adena to the wolf bags to help his legs and reach the city easier.   When they reached the city, the boy tried to take the adena out of the wolf's bags. But the wolf would not ! He bit the boy and said "You will not get this adena back, this is my adena". The boy got angry. He decided to go to the pet master and ask for help.    "Pet master, pet master ! My wolf is big, bad and angry and it won't obey me. I want my adena back and it bites me. "   The pet master looked at the big angry wolf, then looked at the boy and said. "I have a solution for your problem young one. I have magic. Dark magic. I can turn your big bad elder wolf into a younger puppy for free, all you have to do is spell the magic chants. Nothing more, no wolf modifying wands, just your say".   The boy thought about it for a bit, and decided that he indeed wanted to turn things back. But when he was about to spell the magic words, guards arrived at the pet master.    The city guard captain said "Is this the big bad angry wolf that bites people and doesn't give back his adena ? We will kill this wolf !"    For a moment the boy hesitated but he said "This wolf is big bad and angry, but I love this wolf and I dont want it to die ! Please don't kill the big bad angry wolf." But the boy was not fast enough. The guards jumped the wolf and started slashing on him with their swords. The boy didn't know what to do, so in it its final moments right as the wolf was about to die, it spelled the magic words. "Pet master, make my wolf young and adorable again !"   But he was not fast enough. The wolf got slashed and killed by the guards just one moment before the boy could finish his last word.    But as the words came out of his mouth, with the wolf's dead body on the floor, a younger wolf manifested out of thin air. The magic was real. The guards got scared and run away. Now the boy was left with a dead old bad angry wolf and next to him an alive younger version.    The boys joy was even bigger when it opened the new wolfs bags and his adena was finally there. He took the adena and went back to buy potions in the city.   Twenty four hours later, the boy couldn't believe how his fortune would change ...   (No AI was used to write this story)
    • This is like 2017 MaxCheaters. i love it.
    • NEW SEASON GRAND OPENING FROM - 30 OCTOBER 2026, FRIDAY, 20:00 +2 GMT !
    • My bug report was a proper submission. I shouldn't have shown the exploit, I will accept that. Let's end it here. 
    • To Finish this, because it's need a explanation   1. “I come to your forum” — It's the L2JMobius forum, not mine. I'm a contributor, not the owner or the maintainer responsible for deciding which fixes get committed.   2. “Which is why I left” — That's not an accurate account of what happened. You may have left voluntarily once, but you were also banned from the Discord server three times after repeatedly returning and causing the same disruptions. Those are not the same thing.   3. “You personally reply and reject that it works” — I asked how a negative withdrawal could be performed and later requested a demonstration of the claimed exploit. At no point did I reject the patch or claim the vulnerability was impossible. Asking for evidence is not the same as rejecting someone's work.   4. “You leave it unpatched for days” — I don't make that decision. Whether and when a patch gets committed is entirely up to the project maintainer, not me.   5. “You challenge me to post a video” — Yes, I asked you to demonstrate the exploit. You interpreted that as a rejection of your work, which it wasn't. Requesting proof of a claimed exploit is a perfectly reasonable part of technical discussion.   6. “Asshole-ness is a mutually contracted disease” — You're responsible for your own behavior, just as I'm responsible for mine. Disagreeing with you or questioning your claims doesn't justify personal insults. If you believe I've treated you unfairly, address what I actually said rather than making my behavior an excuse for yours.   And one question remains unanswered: why did you publicly disclose the exploitationmethod before the fix was released, after previously saying you wanted to avoid harming the project?   The vulnerability was real, the fix was accepted, and the commit was published. I have no problem acknowledging any of that.   My disagreement has never been about whether the bug deserved to be fixed. It's about how you've handled the discussion and repeatedly misrepresented my role in it.     I have nothing against you personally. My issue is with the way you conduct yourself in these discussions.   And no, you're not obligated to prove anything to me. However, when you make a technical claim, the burden of proof is on you. You cannot reasonably expect others to accept your claims without sufficient evidence.   Questioning a claim is not the same as rejecting it, nor is it a personal attack.   This isn’t about fanaticism; it’s about pushing back against the completely senseless attacks constantly leveled at the project as a whole.   It’s always the same thing: they badmouth it, claiming the project is worthless—yet the very same people criticizing it are the first in line to download a leaked version.   Enough is enough. This discussion has dragged on far too long over something that ought to be straightforward; if you’re going to submit a bug report, you should at least do it properly.
  • 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..