Jump to content

Recommended Posts

Posted

Γεια σας σε ολους καλες γιορτες να εχετε.Ειναι το δευτερο share μου εδω και πιστευω να βοηθησει αρκετους απο εσας.Παω στοιχημα οσοι διαβασατε τον τιτλο δεν καταλαβατε τιποτα για το περιεχομενο του.Εδω λοιπον θα αναφερω συγκεκριμενα fix για μικρο bugs, λιγα περισσοτερα ακομα και θα τα εξηγησουμε.Ας ξεκινησουμε λοιπον...(Να πω οτι, οτι βλεπετε μπροστα σας εδω ειναι δοκιμασμενα σε l2j interlude και οχι σε αλα clients).Χωριζεται σε 2 parts.

 

Part1=============Συγκεκριμενα fixes για μικρο bugs και εξηγηση του κωδικα=========

Ολη η δουλεια μας εδω θα γινει συγκεκριμενα στο net.sf.l2j.gameserver.clientpackets.Αυτο το ειδος περιεχει java αρχεια τα οποια εχουν να κανουν οπως βλεπετε με actions.Για να fixaristei ενα bug θα χρειαστει να σταματαμε το action  σε ορισμενες συνθηκες.100% δεν καταλαβατε μια..Παμε να δουμε ενα παραδειγμα.

Ολοι ξερετε το bug με το enchant που κανανε κατα την ωρα του trade.Εδω και μονο με απλη λογικη το fix  στα ελληνικα θα ηταν:Οταν ο χαρακτηρας κανει trade να μην γινετε να κανει enchant.Ευκολο στα λογια, αλλα και στην πραξη ευκολο ειναι.Εδω φυσικα θα παμε στο RequestEnchantItem.java

Στο τελος οποιουδηποτε κωδικα βαζουμε τον παρακατω:

    	if (activeChar.getActiveTradeList() != null)
   	{
   	activeChar.sendMessage("You Cannot Enchant While Trading!");
   	return;
   	}
   	

Η πρωτη γραμη ειναι σαν να λετε στα ελληνικα:Αν ο χαρακτηρας εχει ανοικτο trade.

Η δευτερη γραμμη αρχιζει ο κωδικας

Η Τριτη γραμμη απλα στελνει στον χαρακτηρα ενα message που ειναι μεσα στα " βλαβλα "

Η τεταρτη γραμμη και η σημαντικοτερη αντιστρεφει το action,δηλαδη το κανει να μην γινετε.

Η πεμπτη τελειωνει η γραμμη.

 

Παμε τωρα να κανουμε κιαλο παραδειγμα για καλυτερη κατανοηση.Παμε στο uselItem.java.Εδω ειναι το action για να φορανε items(οτιδηποτε ομως οχι μονο weapons και armors).Θα κανουμε ενα παραδειγμα τωρα,να μην μπορει ο παικτης να φορεσει item οταν castarei spells,η scrolls, η /unstuck.

Στο τελος παλι καποιου κοδικα βαζουμε τον εξης

if (activeChar.isCastingNow())
		{
			activeChar.sendMessage("You can't equip item while casting.");
			return;
		}

Ειδατε ειναι παρομοιο να μην τα ξανα εξηγω, η πρωτη γραμμη σημαινει αν castarei.Τωρα θα πειτε αυτα τα isCastingNow,κλπ εγω πως να τα ξερω;Στο τελος θα σας αναφερω αρκετους μεθοδους αρκετα χρησιμους πιστευω.

 

Ενας ξεχωριστος κοδικος που μαλλον fixarei το το phx enchant.Με λιγο σκεψη καποιος μπορει να καταλαβει οτι για να fixaroyme το phx enchant, θα πρεπει να μην γινετε να κανει enchant  ο παικτης οταν ειναι κοντα σε warehouse.Για αυτο θα παμε παλι στο RequestEnchant και θα βρουμε το εξης line:

if (activeChar == null || _objectId == 0) return;

αφηνουμε μια γραμμη και προσθετουμε τον εξης κωδικα.

for (L2Object wh : knowns) 
    	{ 
    		  if (wh instanceof L2WarehouseInstance) 
    		   { 
    		        activeChar.sendMessage("You cannot enchant near warehouse."); 
    		        return; 
    		     } 
    	 } 

Αν ο χαρακτηρας μας ειναι διπλα σε warehouse και παει να πατησει το οκ στο scroll του εμφανιζετε το μυνημα που ειναι μεσα στα " " και δεν γινετε το enchant.

Πιστευω να καταλαβατε οτι ολα ειναι θεμα μυαλου και εξυπναδας και υπομονης.Οσοι δεν ξερατε αυτα θελω να προσπαθησετε να κανετε ενα κοδικα που να μην γινετε να κανει ο παικτης enhant οταν castarei kati.Η εξασκηση ειναι ο καλυτερος τροπος για να μαθετε

 

Ενα τελευτεο παραδειγμα.Ολοι ξερετε το παλιο bug  με το unstuck που δεν μπορουσαν να σας κανουν target.Ε και αυτο με μυαλο καταλαβενετε οτι το fix στα ελληνικα θα ειναι να μην γινετε να κανει restart οταν castarei.Παμε λοιπον στο RequestRestart.java και ο κοδικας ειναι ο εξης φυσικα

if (activeChar.isCastingNow())
{
activeChar.sendMessage("You cant restart while casting);
return;
}

Αυτα ηταν μερικα παραδειγματα για μικρο fixes,πιστευω να εγινα κατανοητος.

 

Part2============Απλοι μεθοδοι και μερικα αλλα==========================

Οι μεθοδοι ειναι συγκεκριμενες λεξεις που μας βοηθουν στο να κανουμε τον κοδικα.Παμε λοιπον να δουμε αρκετες οι οποιες ειναι πολι στοιχειωδεις και χρησιμες και βοηθανε.

***return; ->Ακυρωνει την πραξη(το ειδαμε και παραπανω)

***isCastingNow -> Castarei οποιοδηποτε skill/scroll Η  unstuck

***isAttakingNow ->Κανει attack με απλα hits

***isStunned ->Ειναι σε stun mode

***isParalyzed ->Ειναι σε paralyzed mode, gia paradeigma anchor.

***isMageClass ->Ειναι mage class

***isInParty -> Ειναι σε party

***isDead -> ειναι πεθαμενος

***isClanLeader -> ειναι clan leader

***isMounted -> Ειναι πανω σε pet

***getActiveTradeList() != null) ->Εχει ανοικτο trade list

***activeChar.getInventory().addItem("ONOMA", ITEM-ID, POSA ITEM, activeChar, null); ->να παρει στο inventory του το item της επιλογης.

***getAppearance() ->δινει εμφανιση.

***getAppearance().setNameColor(0xCode); ->δινει την εμφανιση του χρωματος της επιλογης μας.

***getPvpKills() == 1) ->Εχει 1 pvp (το 1 το αλλαζουμε)

***getPkKills() == 1) -> Εχει 1 pk ( το 1 το αλλαζουμε)

***isInCombat ->Ειναι σε combat mode

***Announcements.getInstance().announceToAll("Class: "+activeChar.getName()+" has been logged in."); ->Κανει announce οτι θελετε

***isInJail -> ειναι στη φυλακη

***teleToLocation(your X, your y, your Z); ->Teleport στο μερος επιλογης σας

***isFlying ->Πεταει με wyvern

***setTitle("blabla") ->Dinei titlo που ειναι μεσα στα " "

***setHero(true); ->Δινει hero στον παικτη

***setNoble(true); ->Δινει noble στον παικτη

***isSitting ->καθεται κατω

Οπως καταλαβενετε υπαρχουν παρα πολλες ..σας ειπα μερικες...τωρα παμε να δουμε απλα συμβολα ( εχουν ξαναγινει share, αλλα ακομα μια φορα δεν βλαπτει πιστεβω.)

== ->Ισον

>= -> Μεγαλυτερο ή Ισον

<= ->Μικροτερο ή Ισον

> ->Μεγαλυτερο

< ->Μικροτερο

! -> ακυρωνει την πραξη ( if (!activeChar.isNoob()) ->Δεν ειναι noob.

---------------------------------------------------------------------------------------------------------

Αυτο ηταν.Ελπιζω να βοηθησει. Οπως καταλαβατε το να κανεις ενα κοδικο, ειναι σαν pazzle βαζεις τα σωστα κομματια στη σωστη θεση.Για περισσοτερες μεθοδους ψαχνετε στο καταλληλο java αρχειο,επισης το L2PCInstance εχει αρκετες.

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

 

 

 

Posted

Telio!!!idame kati diaforetiko epitelous olo ta idia kai ta idia share npc kai tetia. euxaristoume . auto pistevo pos aksizei karma...an den sto dosei kapios tha sto dosw egw.

Posted

Telio!!!idame kati diaforetiko epitelous olo ta idia kai ta idia share npc kai tetia. euxaristoume . auto pistevo pos aksizei karma...an den sto dosei kapios tha sto dosw egw.

πςς.. ευχαριστω :P
Posted

Πολυ καλό μπραβο...

 

Μια σημειωση... το ! δεν ακυρωνει αλλα σημαίνει διάφορο. Σε αλλες γλωσσες προγραμματισμού το βλεπουμε σαν <>

 

π.χ    $ = "hello" ζηταμε η μεταβλητή να ειναι ίση με το λήμα "hello"

      !$ = "hello" ζηταμε η μεταβλητή να είναι οτιδήποτε άλλο εκτος από το λήμα "hello"

 

      if (!activeChar.isNoob()) σημαίνει αν δεν είναι noob τότε ...... κανε αυτό.

Posted

Φίλε μπράβο για τον οδηγό σου, για κάποιους σαν και εμένα που δεν είναι πολύ "έμπειροι" με Java Codes και αρχίζουν τώρα θα βοηθήσει πολύ!

Posted

Φίλε μπράβο για τον οδηγό σου, για κάποιους σαν και εμένα που δεν είναι πολύ "έμπειροι" με Java Codes και αρχίζουν τώρα θα βοηθήσει πολύ!

Φίλε μπράβο για τον οδηγό σου, για κάποιους σαν και εμένα που δεν είναι πολύ "έμπειροι" με Java Codes και αρχίζουν τώρα θα βοηθήσει πολύ!

ευχαριστω
Posted

Φίλε μπράβο για τον οδηγό σου, για κάποιους σαν και εμένα που δεν είναι πολύ "έμπειροι" με Java Codes και αρχίζουν τώρα θα βοηθήσει πολύ!

+++++

Κeep up φίλος

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

    • I can see that the admins arent taking any action, yet they still seem willing to share information about various other people names and IP addresses. But when it comes to scams, no one reacts.      
    • Server Info Chronicle:  Interlude                                                                                                                                    XP: 100x | SP: 100x | Drop: 50x | Adena: 75x Enchant: Safe +3 |  Max +21 Website: Website Link Discord: Discord Link   WHY? When I was a teenager I had this idea. Build my own Lineage 2 server. My own rules. My own world. I wasn't a programmer. I had no idea how any of it worked. I tried, hit a wall, and quit. But the idea never left. I came back years later. Got further. Quit again. Watched friends try similar things. The idea stayed stuck in my head for fifteen years. I'm a developer now. I finally finished it. Not because I suddenly had more time - I have a full-time job and real responsibilities. An hour before bed if I'm lucky. That's actually exactly why I finished it.   The problem I kept running into I still love this game. But every server I tried as an adult made that one hour feel worthless. Log in, kill a few mobs, make no real progress, log out frustrated. The game was designed for someone with unlimited time. That person doesn't exist in my life anymore. I looked around. Everyone I used to play with has the same problem. Same love for the game. Same lack of time. Jobs, families, maybe an hour late at night. So I stopped waiting for someone else to build it.           WHAT? Custom starting zone in Gludin (up until 2nd profession start) Talent system - rebirth at level 80 and choose your talents Bounty hunter system - daily tasks to kill random monsters to receive great reward! Potion crafting system - custom HP/MP potions and recipes Custom 1st & 2nd class quests (shorter) Scheme buffer Shop until C grade   Visit our website to get more info: Website Link   The philosophy 95% of the game is completely soloable. No clan required. No raid schedules. No guilt when you have to log off. You are the solo director of your own session. Log in, pursue your goal for an hour, log out on your own terms. When you've conquered what you wanted - you stop naturally. A new season drops with fresh Talent Tree changes and you come back to build something completely different. No endless stretched grind. No pay-to-win. No shady admin decisions. No surprise wipes. I'm one developer who built this because I love it.                                          This is the server I needed fifteen years ago. Glad I finally had the skills to build it. Come see what I made. [Forever Lineage]
    • Hello MaxCheaters community! We’ve all been there: you spend months customizing your NPCs, balancing classes, and setting up the perfect farm zones. You launch your server, the hype is real, and suddenly you hit 200 players—and the "delay" starts. The mobs stop reacting, the Olympiad matches stutter, and your players start complaining on Discord. Many "newbie" admins think the solution is just throwing more RAM at the VPS. While hardware matters, Java is a finicky beast. If you don't tune your JVM (Java Virtual Machine) and your core code, you’ll lag even on a NASA supercomputer. Today, I’m sharing a deep dive into optimizing your L2 server for maximum performance. 1. The Myth of "More RAM" The biggest mistake people make is assigning 32GB of RAM to a server that only needs 8GB. In Java, if your Heap size is too large, the "Garbage Collector" (GC) has to work much harder. When the GC runs a "Full GC" cycle on a massive heap, it performs a "Stop-the-World" event. This literally freezes your server threads for 1–3 seconds to clear memory. Recommendation: For a mid-rate server with 500 players, 6GB to 8GB of Xmx (Max Heap) is usually the sweet spot. Use G1GC (Garbage First Garbage Collector) instead of the old ParallelGC. It handles large heaps much more gracefully by breaking memory into regions. 2. JVM Startup Flags (The Secret Sauce) Don't just run java -jar l2jserver.jar. You need specific flags to ensure the CPU prioritizes the right tasks. Try adding these to your start.sh or start.bat: Bash   -Xms6G -Xmx6G -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:+TieredCompilation MaxGCPauseMillis=50: This tells Java, "Try not to freeze the server for more than 50ms at a time." It makes the gameplay feel much smoother for the end-user. 3. Geodata and Pathfinding Optimization Geodata is the biggest CPU killer in Lineage 2. Every time a mob moves or a player clicks, the server calculates "Can I see this target?" and "Is there a wall in the way?". The Fix: Use a "Pathfinding Cache." If 100 players are running from the Giran Gate to the Luxury Shop, the server shouldn't calculate that path 100 times. Check your Geodata format: Ensure you are using the .l2j or .dat formats optimized for your specific core. If your console is flooded with "Pathfind node limit reached," increase your node limit in the geo.properties file, but be prepared for higher RAM usage. 4. Database Pooling (HikariCP vs. C3P0) If your server freezes for a split second every time someone saves their character or buys an item, your Database Connection Pool is the bottleneck. Most old L2J cores use C3P0, which is outdated and slow. Switch to HikariCP: It is significantly faster and handles "dead" connections much better. Also, ensure your characters and items tables are indexed correctly in MySQL. Running a VACUUM or OPTIMIZE TABLE once a week can prevent those annoying "saving player data" spikes. 5. Network Threading In your server settings, look for "Network" or "Thread" configurations. Usually, you’ll see SelectorThreads and WorkerThreads. Selector Threads: Should be equal to the number of physical CPU cores. Worker Threads: This is where the logic happens (skills, movement). If this is too low, actions will "queue up," creating a delay even if your ping is low. 6. Community Board (BBS) Optimization On MaxCheaters, we love fancy Community Boards. However, if your Buffer or Shop script is poorly coded, it might be reloading the entire HTML from the hard drive every time a player clicks a button. The Fix: Ensure your scripts cache the HTML in the RAM. Reading from an SSD is fast, but reading from RAM is thousands of times faster. Conclusion Optimization isn't a "one-click" fix; it’s about finding the balance between your hardware and your software. Start with your JVM flags, clean up your Geodata settings, and make sure your Database isn't choking on old logs. If you found this helpful, leave a comment or a "Thank You" below! If you have specific lag issues with a certain core (aCis, L2Emu, etc.), post your server.properties and I’ll try to help you tune it.
  • 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..