Jump to content
  • 0

[Code] Request 1 Check.


Question

Posted

Hello there!!

 

I try to edit one quest and i need 2 check ,

1 check is working fine

is check for pvps , but i dont know how to add the second,

i m unskiled for java and i m searching for hours to find solution but i cant ...

 

as u see in code have check for pvp count,

>=20

i need also 1 check about time to able this quest to be done every 24hours

can u some write me check for time & pvp ?

 

 

 

 

 

def onTalk (self,npc,player):
     htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>"
     st = player.getQuestState(qn)
     if not st : return htmltext

     npcId = npc.getNpcId()
     id = st.getState()
     Pvp = player.getPvpKills()
     cond = st.getInt("cond")
     if id == CREATED :
         if Pvp>=20 :
             htmltext = "30078-01.htm"
         else:
             htmltext = "<html><body>This quest can only be taken by characters PvP count is more than 200 and higher!</body></html>"
             st.exitQuest(1)

Recommended Posts

  • 0
Posted

So normaly in php & mysql you have "date" and ++

return strtotime(date('Y-m-d H:i:s',time()))-strtotime($lasttime)+3600;

This is example... if you wanna make delay on instance[quest] you need to connect it with database... anyway about pvp restriction.

+		if (_type == SHOUT && activeChar.getPvpKills() < 50 && !activeChar.isGM())
+		{
+			activeChar.sendMessage("You need at least 50 pvp's in order to use shout chat!");
+			return;			
+		}

 

This is restriction for chat, you can modify it as you want.

  • 0
Posted

So normaly in php & mysql you have "date" and ++

return strtotime(date('Y-m-d H:i:s',time()))-strtotime($lasttime)+3600;

This is example... if you wanna make delay on instance[quest] you need to connect it with database... anyway about pvp restriction.

+		if (_type == SHOUT && activeChar.getPvpKills() < 50 && !activeChar.isGM())
+		{
+			activeChar.sendMessage("You need at least 50 pvp's in order to use shout chat!");
+			return;			
+		}

 

This is restriction for chat, you can modify it as you want.

 

 

about pvp check work normal , the only problem that i cant syndax it is time check ..

 

i find some time checks

 

function toStamp($Username,$SiteId)
{
$lasttime=getTime($Username,$SiteId);
return strtotime(date('Y-m-d H:i:s',time()))-strtotime($lasttime)+3600;
}
function showRemain($Username,$SiteId,$DelayTime)
{
$lasttime=getTime($Username,$SiteId);
$pasedtime=strtotime(date('Y-m-d H:i:s',time()))-strtotime($lasttime)+3600;
if($DelayTime[$SiteId]-$pasedtime>0)
{
return (date('H',$DelayTime[$SiteId]-$pasedtime)-1).date(":i:s",($DelayTime[$SiteId]-$pasedtime));
}
else 
{
return 0;

 

 

but i cant fix it for mine..

  • 0
Posted

I found this code at one quest ...

 

def onKill(self,npc,player,isPet):
    npcId = npc.getNpcId()
    if npcId == BUMPALUMP :
        respawnMinDelay = 43200000  * int(Config.RAID_MIN_RESPAWN_MULTIPLIER)
        respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER)
        respawn_delay = Rnd.get(respawnMinDelay,respawnMaxDelay)
        self.saveGlobalQuestVar("625_respawn", str(System.currentTimeMillis()+respawn_delay))
        self.startQuestTimer("spawn_npc", respawn_delay, None, None)
        self.cancelQuestTimer("Icicle Emperor Bumbalump has despawned",npc,None)

 

 

is this for Questdelay?

 

 

i edit to

 

 

 npcId = npc.getNpcId()
     id = st.getState()
     delay = player.getQuestState()
     cond = st.getInt("cond")
     if id == CREATED :
         if delay = Rnd.get(43200000) :
         self.saveGlobalQuestVar("341_delay", str(System.currentTimeMillis()+delay))

  • 0
Posted

This kind of delay should be stored on your database, then call it a restrictions with a Boolean like: hasRestriction()  GL

  • 0
Posted

If you want static 24 hours you have to add 24 * 60 * 60 * 1000 to the current time. Atm you use a rnd value.

 

Finally (and use your brain for following), you are saving the value at creation. That's probably wrong. You want to CHECK if timer is currently ok at creation, and SAVE when you end the quest.

 

Once you store the value you have to reuse it. Call back 341_delay and compare with current time, as I told you on PM.

 

PS : verify 341_delay doesn't already exist.

 

To finish (and I repeat myself) :

- you do the quest, it creates it as you haven't any timer.

- you finish the quest, it saves timer (aka current time + 24 static hour).

- you try to do the quest again ; it verifies the timer, if stored time < current time, then it's ok otherwise you're still on reuse.

 

FINALLY SAVEGLOBAL IS USED FOR SINGLE USE, IT CAN'T/SHOULDN'T BE USED TO SAVE SUCH TIMERS, UNTIL YOU CAN MAKE THAT QUEST ONLY ONCE FOR THE WHOLE SERVER PER DAY.

  • 0
Posted

If you want static 24 hours you have to add 24 * 60 * 60 * 1000 to the current time. Atm you use a rnd value.

 

Finally (and use your brain for following), you are saving the value at creation. That's probably wrong. You want to CHECK if timer is currently ok at creation, and SAVE when you end the quest.

 

Once you store the value you have to reuse it. Call back 341_delay and compare with current time, as I told you on PM.

 

PS : verify 341_delay doesn't already exist.

 

To finish (and I repeat myself) :

- you do the quest, it creates it as you haven't any timer.

- you finish the quest, it saves timer (aka current time + 24 static hour).

- you try to do the quest again ; it verifies the timer, if stored time < current time, then it's ok otherwise you're still on reuse.

 

FINALLY SAVEGLOBAL IS USED FOR SINGLE USE, IT CAN'T/SHOULDN'T BE USED TO SAVE SUCH TIMERS, UNTIL YOU CAN MAKE THAT QUEST ONLY ONCE FOR THE WHOLE SERVER PER DAY.

 

Don't waste your time mate, they want the code not the guide

  • 0
Posted

Don't waste your time mate, they want the code not the guide

 

isnt easy to do somthing new with 0 java knowledge.. isnt shame to spent so many hours for this , while i have to much work to do with my server :/

 

anyway i do all time tests i will try to undestand how it works , i m near i hope to find solution for this .

 

  • 0
Posted

Don't waste your time mate, they want the code not the guide

 

What Tryskell mean is that answering 1 person will learn 100...

  • 0
Posted

anyway i thing to add different check , i wanna make some  quests and i cant spend all my time to search for this check ,

 

also my paypall is empty ... thats why i  m asking for help here,

 

 

if some1 wanna write me that check , i can say just thanks.

 

 

 

  • 0
Posted

here is your code...

 

add this on L2PcInstance.java

boolean _canEnterQuest=true;
public boolean canEnterQuest()
{
	return _canEnterQuest;
}
public void removeEnterCooldownAfter24h()
{
	_canEnterQuest=false;
	ThreadPoolManager.getInstance().scheduleGeneral(new removeEnterCoolDown(), 1000*60*60*24);
}
public class removeEnterCoolDown implements Runnable
{
	@Override
	public void run()
	{
		_canEnterQuest=true;
	}
}

anywhere, just dont mess other codes...

then go to your NPC at the checks lines and add

		if (!player.canEnterQuest())
		{
			player.sendMessage("You must wait at least 24 hours since your last taken the quest");
			return;
		}

 

then, when the player enters the quest add these:

 

player.removeEnterCooldownAfter24h();

in order to refresh the cooldown

 

Important: this code, is written on hand, I didnt test but should work. You must add the boolean into your database, no mood for me to code it, neither interlude core files

Secondly, Im not sure that the removeEnterCooldownAfter24h() will work if the player is offline, for this ask someone else Im not sure.

 

mainly I wrote this code in order to guide you on how to work, this is your base, and the last code I do for you since you will never learn if you dont study and try to solve your problems by urself.

 

Cheers xdem

 

  • 0
Posted

here is your code...

 

add this on L2PcInstance.java

....etc

Too dirty... what up with Threadpool if server does a restart? :/

Why not to use

InstanceManager.getInstance().setInstanceTime();
InstanceManager.getInstance().getInstanceTime();

?

  • 0
Posted

Too dirty... what up with Threadpool if server does a restart? :/

Why not to use

InstanceManager.getInstance().setInstanceTime();
InstanceManager.getInstance().getInstanceTime();

?

 

he is interlude, no instances there...

 

The last choice is System.currentMilis(); on the first enter, store in db... then at the checks if previus Milis>currentMilis return; but he will never make it this way, so I considered the first one easier, nvm

Guest
This topic is now closed to further replies.


  • Posts

    • Server owners, Top.MaxCheaters.com is now live and accepting Lineage 2 server listings. There is no voting, no rankings manipulation, and no paid advantages. Visibility is clean and equal, and early listings naturally appear at the top while the platform grows. If your server is active, it should already be listed. Submit here  https://Top.MaxCheaters.com This platform is part of the MaxCheaters.com network and is being built as a long-term reference point for the Lineage 2 community. — MaxCheaters.com Team
    • Someone knows if there is a free download in some place for get it?. Thanks!
    • NEWS Elysian Realms   LINEAGE 2 PRIVATE PUBLIC SERVER A complete, optimized, and feature-rich Lineage 2 experience — ready to launch, play, and scale.  OVERVIEW Elysian Realms is a high-quality Lineage 2 private public server pack, crafted for stability, balance, and long-term gameplay enjoyment. Every system is preconfigured and battle-tested, allowing server owners to focus on community and growth rather than constant fixes. Whether you aim for classic nostalgia or a modern custom experience, Elysian Realms adapts to your vision. STABLE & SECURE CORE Performance-focused and scalable core High uptime & low latency Bug-free, smooth gameplay Designed for long-term server stability Your players stay focused on the world — not server issues.  CUSTOM FEATURES WITHOUT COMPROMISE Authentic Lineage 2 feeling enhanced with smart QoL systems:  Interface & Visuals Unique UI tweaks Custom skins, armors, weapons, tattoos & cloaks Special camera effects on death Color Choose Player system Vitality 16+ special armor effects  Gameplay Systems Balanced skills & stats (fully tested) Unique Rebirth Manager (Doll Skills) Dolls items with custom skills Rune XP Bonus system (XP / SP / Drop boosts) Auto Pots system (.menu) Buff cancel (5 sec return)  PVE & FARMING CONTENT Expanded PvE zones Solo farm zones (Top / Mid / Low LS) Tyrannosaurus addons with top LS drops Party Farm Event Dungeon Manager Top Farm Items Manager Global Drop System Farm Protection (Captcha) Solo & Zerg protection system  PVP & COMPETITIVE EVENTS Flag Raid Zones (PvP zones) PvP Top Player events + rewards Special PvP & PK rankings (spawned in Giran) Tournament events (x3 / x5 / x9) TvT & CTF Random 1vs1 Event Hero Boss Event System Race of Wars (Unique Event) Elysian Ultimate Zones – God Zone RAIDS & WORLD CONTENT Raid HP announcements Special Gatekeeper: Farm Zones PvP Zones Raid Zones Event Zones Party Farms Random Locations Flagged Raid Zones (PvP enabled) AUTOMATION & SMART SYSTEMS Auto Farm (VIP) Auto Gold Bar system Auto NPC announcements (Giran Town) Auto login & online record announcements Auto Vote system with global rewards Auto Zones Timed Items Dungeon Unique. REWARDS, PROGRESSION & ECONOMY Achievement Manager Mission System (Cafe Points + Random Rewards) Capsule Boxes. Top Boxes system with configurable rewards Roll Dice System (Lucky Manager x2 rewards) Donate Manager (clean & transparent) Auction Manager (extended icon support)  FULLY DOCUMENTED & DEVELOPER FRIENDLY Complete server & client documentation  MULTIVERSE-READY CORE Supports C4-style to High Five gameplay Multi-language support Scalable rates Modular scripts & systems One core. Endless possibilities.  DESIGNED FOR Indie server owners & developers Event & GvG organizers Modders & hobbyists Fans of classic & custom Lineage 2 PROVEN & BATTLE-TESTED Previously online with 100+ active players All systems tested in live environment Balanced for both PvE & PvP longevity ELYSIAN REALMS PHILOSOPHY Elysian Realms isn’t just a server pack — it’s a complete Lineage 2 ecosystem built for players and creators alike. Ready to enter the Elysian World? Launch. Customize. Dominate.   https://www.l2elysian.com/
    • Case: medical report edits aligned with KYC logic ▪ The request looked “simple”: replace patient data and adjust values. In reality, it was a high-risk case where consistency matters more than numbers. What was done: → aligned name, gender, dates, and internal identifiers into a single logic → synchronized sample collection time, lab intake, and result print timestamps → carefully reduced values without exceeding reference ranges → added doctor’s signature and stamp with no repeating patterns → delivered the final document as a clean PDF with no editor traces ▪ Critical point: if you change only values while ignoring timing and service fields, the document fails on the very first checker. Conclusion: Medical reports are read as a system. Any mismatch in dates, timing, or layout breaks approval. ▪ We work with data logic, not with pictures — that’s why the result passes verification. If you have a similar case — we analyze the risks first, then proceed. › TG: @mustang_service ( https:// t.me/ mustang_service ) › Channel: Mustang Service ( https:// t.me/ +6RAKokIn5ItmYjEx ) #redraw #verification #documents #KYC #antifraud
  • 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..