Jump to content

Recommended Posts

Posted

Χαιρετώ,

 

σήμερα αποφάσισα να κάνω ένα ακόμα share για αυτήν την κοινότητα!

 

Τι περιέχει αυτό το share :

 

- Πως φτιάχνουμε δικό μας config και μερικά χρήσιμα πράγματα για αυτό. (Κεφάλαιο 1)

- Γενικές πληροφορίες (Κεφάλαιο 2)

- Πως φτιάχνουμε ένα δικό μας voiced command. (Κεφάλαιο 3)

 

Κεφάλαιο 1

 

Ανοίγουμε το αρχείο Config.java (μπορεί να το δείτε και L2Config.java)

 

Στο πάνω μέρος θα δείτε αυτές τις γραμμές :

 

	public static final String BANNED_IP_XML = "./config/banned.xml";
public static final String CLANS_FILE = "./config/clans.properties";
public static final String EVENTS_FILE = "./config/events.properties";
public static final String FLOOD_PROTECTOR_FILE = "./config/floodprotector.properties";
public static final String HEXID_FILE = "./config/hexid.txt";
public static final String ID_CONFIG_FILE = "./config/idfactory.properties";
public static final String LOGIN_CONFIGURATION_FILE = "./config/loginserver.properties";
public static final String NPCS_FILE = "./config/npcs.properties";
public static final String PLAYERS_FILE = "./config/players.properties";
public static final String SERVER_FILE = "./config/server.properties";
public static final String SIEGE_FILE = "./config/siege.properties";

 

κάτω από την γραμμή (public static final String SIEGE_FILE = "./config/siege.properties";) βάζουμε την παρακάτω γραμμή :

 

public static final String ROMEO_FILE = "./config/romeo.properties";

 

χρησιμοποίησα το όνομα μου ως παράδειγμα. εσείς στην θέση του ROMEO_FILE μπορείτε να βάλετε το δικό σας όνομα πχ. CUSTOM_FILE και στην θέση του romeo.properties κάνετε ακριβώς το ίδιο πχ. custom.properties

 

Ακριβώς κάτω από παραπάνω γραμμές θα δείτε αυτό εδώ το κομμάτι :

 

	// --------------------------------------------------
// Clans settings
// --------------------------------------------------

 

κάτω από αυτό θα βάζετε το 1 μέρος από κάθε config που βάζετε για παράδειγμα public static boolean ALLOW_WEDDING_SYSTEM;

 

σε κάθε config που βάζετε γράφετε public static και μετά :

 

boolean = για περιπτώσεις True/False

int = για περιπτώσεις αριθμού

String = για οτιδήποτε όπως : !ahanvmc-@_!

 

συνολικές γραμμές :

 

public static boolean ALLOW_ROMEO_GUIDE; (πχ. True/False)

public static int HOW_MANY_CHAPTERS_GUIDE_HAS; (πχ. 4)

public static String WHAT_IS_THE_EXACTLY_NAME_OF_ROMEO; (πχ. `Romeo)

 

μετά από αυτό κάνουμε search στο αρχείο Config.java

 

			catch (Exception e)
		{
			e.printStackTrace();
			throw new Error("Server failed to load " + CLANS_FILE + " file.");
		}

 

κάτω από αυτό βάζουμε αυτές τις γραμμές :

 

			// Romeo settings
		try
		{
			Properties romeo = new Properties();
			InputStream is = new FileInputStream(new File(ROMEO_FILE));
			romeo.load(is);
			is.close();

		}
		catch (Exception e)
		{
			e.printStackTrace();
			throw new Error("Server failed to load " + ROMEO_FILE + " file.");
		}

 

κάτω από την γραμμή is.close(); βάζουμε το τελευταίο κομμάτι του config μας.

 

πχ. για αυτές τις γραμμές :

 

1) public static boolean ALLOW_ROMEO_GUIDE;

2) public static int HOW_MANY_CHAPTERS_GUIDE_HAS;

3) public static String WHAT_IS_THE_EXACTLY_NAME_OF_ROMEO;

 

βάζουμε :

 

1) ALLOW_ROMEO_GUIDE = Boolean.parseBoolean(romeo.getProperty("AllowRomeoGuide", "True"));

2) HOW_MANY_CHAPTERS_GUIDE_HAS= Integer.parseInt(romeo.getProperty("HowManyChaptersGuideHas", "4"));

3) WHAT_IS_THE_EXACTLY_NAME_OF_ROMEO = romeo.getProperty("WhatIsTheExactlyNameOfRomeo", "`Romeo"));

 

αφού δημιουργήσουμε το αρχείο romeo.properties στον φάκελο config βάζουμε μέσα τις παρακάτω γραμμές :

 

# Config guide by Romeo

AllowRomeoGuide = True

HowManyChaptersGuideHas = 4

WhatIsTheExactlyNameOfRomeo = `Romeo

 


 

Κεφάλαιο 2

 

Σήμερα θα σας μιλήσω για γενικά θέματα στην l2j. Ας αρχίσουμε,

 

Βασικοί ορισμοί :

 

- boolean = True/False (πχ, boolean l2j = true; )

- int = μεγάλοι ακέραιοι (πχ, int l2j = 100; )

- String = γενικό (τα πάντα) (πχ, String message = !l2jisdabest@; )

- static = είναι κάτι το στατικό (δεν αλλάζει)

 

- activeChar.setHero(true); = να κάνει τον ενεργό παίχτη hero για πάντα (true). ενώ για μέχρι το restart (false, βλέπε παρακάτω).

- activeChar.setNoble(false);

- activeChar.setName("εδώ το όνομα"); = με αυτήν την εντολή αλλάζει το όνομα του ενεργού παίχτη.

- activeChar.setTitle(""); = με αυτήν την εντολή αλλάζει τον τίτλο του ενεργού παίχτη σε κενό.

 

Διευκρινίσεις :

 

- package net.sf.l2j; (αυτό το βλέπουμε στο πάνω πάνω μέρος του αρχείου που είμαστε. τι σημαίνει? σημαίνει σε πιο package είναι το αρχείο που είμαστε (την διαδρομή του)

 

- import net.sf.l2j.gameserver.util.FloodProtectorConfig; (αυτό το βλέπουμε κάτω από το παραπάνω. τι σημαίνει? σημαίνει ότι χρησιμοποιούμε (στην προκειμένη περίπτωση το FloodProtectorConfig και βρίσκεται στο gameserver.util) μια εντολή από αυτό το αρχείο.

 

Δείγματα από κώδικες :

 

θέλουμε για παράδειγμα να βάλουμε ένα announce όταν μπαίνει ένας hero στον server. (ότι έχει να κάνει σχέση με το login, δηλαδή μόλις μπαίνει ο char στο l2 πάμε στο EnterWorld.java)

 

		if (activeChar.isHero())
	{
		Announcements.getInstance();
		Announcements.announceToAll("Hero Character : "+activeChar.getName()+" is now online!");
		return;
	}

 

ας αναλύσουμε κάθε κομμάτι αυτού του κώδικα :

 

if (activeChar.isHero()) = σημαίνει : εάν ο ενεργός παίχτης είναι hero.

{ = ανοίγουμε αγκύλες για να βάλουμε μέσα τον κώδικα που θέλουμε να δράσει.

Announcements.announceToAll("Hero Character : "+activeChar.getName()+" is now online!"); = είναι το announce που θέλουμε να δείξει όταν μπεί ο char.

} = κλείνουμε την αγκύλη που ανοίξαμε.

 

ένα άλλο δείγμα που είναι χρήσιμο (pvp spree system) :

 

πάμε στο αρχείο L2PcInstance.java και πατάμε CTRL + F για να αναζητήσουμε την γραμμή : private int _pvpKills;

 

από κάτω αφήνουμε ένα κενό και βάζουμε : private int pvpspree = 0;

 

μετά κάνουμε πάλι αναζήτηση για να βρούμε την γραμμή : setPvpKills(getPvpKills() + 1);

 

από κάτω βάζουμε αυτόν τον κώδικα :

 

		pvpspree++;

	switch (pvpspree)
	{
		case 1 : 
			Announcements.announceToAll(getName()+" is Dominating!");
			break;

		case 2 : 
			Announcements.announceToAll(getName()+" is on a killing spree!");
			break;
	}

 

το switch είναι ο καλύτερος τρόπος για να γίνει αυτό το πράγμα.

 

το case 1 μας δηλώνει στην προκειμένη περίπτωση ότι σε 1 συνεχόμενο pvp θα γίνει η παρακάτω πράξη δηλαδή το announce.

το ίδιο ισχύει και για το case 2 δηλαδή σε 2 συνεχόμενα pvp θα γίνει η παρακάτω πράξη.

 

προσοχή! μετά από κάθε πράξη στο switch βάζουμε το break;

 

αυτά πιστεύω είναι αρκετά!

 


 

Κεφάλαιο 3

 

Σε αυτό το κεφάλαιο θα σας δείξω πως να κάνετε ένα voicedcommand (.)

 

Πηγαίνουμε στην διαδρομή : net.sf.l2j.gameserver.handler.voicedcommandhandlers , πατάμε δεξί κλικ, New -> Class . Από μόνο του μας έχει απλά να βάλουμε το όνομα που θέλουμε να έχει το αρχείο για παράδειγμα MyFirstVC αφού πατήσουμε Finish μας ανοίγει ένα καινούργιο αρχείο που περιέχει αυτό :

 

/*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

/**
* @author `Romeo
*
*/
public class MyFirstVC
{

}

 

στην προκειμένη περίπτωση του voicedcommand δίπλα από το public class MyFirstVC βάζουμε : implements IVoicedCommandHandler και πρέπει να δείχνει κάπως έτσι :

 

public class MyFirstVC implements IVoicedCommandHandler

τότε θα δούμε error (σφάλμα) στην λέξη MyFirstVC. Ως πιθανές λύσεις μας έχει :

 

1) Add unimplemented methods

2) Make type 'MyFirstVC' abstract

 

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

 

	/* (non-Javadoc)
 * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
 */
@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
	// TODO Auto-generated method stub
	return false;
}

/* (non-Javadoc)
 * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
 */
@Override
public String[] getVoicedCommandList()
{
	// TODO Auto-generated method stub
	return null;
}

 

κάτω από την γραμμή

 

public class MyFirstVC implements IVoicedCommandHandler
{

 

θα βάλουμε αυτόν τον κώδικα

 

	private static final String[] _voicedCommands =
{
	"myfirstvc"
};

 

που μέσα στις αγκύλες υπάρχει το command που θα είναι available για να χρησιμοποιήσουμε. τότε θα μας βγάλει ένα warning (ειδοποίηση) για το _voicedCommands. τότε κάνουμε αντιγραφή το _voicedCommands και πάμε κάτω κάτω που θα δούμε αυτό

 

	public String[] getVoicedCommandList()
{
	// TODO Auto-generated method stub
	return null;
}

και εκεί που λέει return null; στην θέση του null βάζουμε το _voicedCommands

 

τότε όλος ο κώδικας πρέπει να μοιάζει σαν αυτόν :

 

/*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

/**
* @author `Romeo
*
*/
public class MyFirstVC implements IVoicedCommandHandler
{

private static final String[] _voicedCommands =
{
	"myfirstvc"
};

@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
	return false;
}

@Override
public String[] getVoicedCommandList()
{
	return _voicedCommands;
}

}

 

τώρα είναι έτοιμος για να βάλουμε τις εντολές που θέλουμε να εκτελεί. εκεί που λέει

 

 	@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
	return false;

 

από κάτω βάζουμε τις εντολές που θέλουμε, εγώ για παράδειγμα θα βάλω να βγάζει ένα announce και να κάνει τον char hero μέχρι το restart.

 

βάζουμε :

 

		Announcements.announceToAll(activeChar.getName()+ ": I used .myfirstvc and I am hero until restart.");
	activeChar.setHero(false);

 

τελιώσαμε, τώρα όλος ο κώδικας μας πρέπει να μοιάζει σαν αυτόν :

 

/*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

/**
* @author `Romeo
*
*/
public class MyFirstVC implements IVoicedCommandHandler
{

private static final String[] _voicedCommands =
{
	"myfirstvc"
};

@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
	Announcements.announceToAll(activeChar.getName()+ ": I used .myfirstvc and I am hero until restart.");
	activeChar.setHero(false);
	return false;
}

@Override
public String[] getVoicedCommandList()
{
	return _voicedCommands;
}

}

 

Description : όταν πατάς .myfirstvc γίνεσαι hero μέχρι το restart και βγάζει announce προς όλους.

 

το τελευταίο πράγμα που πρέπει να κάνεις είναι να δηλώσεις το voiced command. λοιπόν, πηγαίνουμε στο VoicedCommandHandler.java και κάτω από την γραμμή

 

_datatable = new HashMap<String, IVoicedCommandHandler>();

 

βάζουμε

 

registerVoicedCommandHandler(new MyFirstVC()); θα βγάλει error στο MyFirstVC γιατί πρέπει να το κάνεις import.

 

αυτό ήταν όλο για να κάνεις ένα voiced command.

 

Περισσότερα κεφάλαια, soon!

 

Kind regards,

 

`Romeo

Guest
This topic is now closed to further replies.


  • Posts

    • Hi everyone, A while ago, I needed to extract some L2 textures and found that acmi's L2Tool was a good way to do it. There might be other methods out there but I'm not aware of them, so I decided to fork this project and improve it to suit my needs. I built this using BellSoft Liberica JDK 17. Since modern Java versions no longer include JavaFX by default, I've made the app handle it automatically. You don't need any manual setup—just use the  run.bat  and it will automatically extract the required JavaFX modules on the first run. Key features of this fork: UI Overhaul: I've tweaked the interface to give it a cleaner look with Dark Mode and more detailed metadata for each texture. Export Formats: You can now extract textures in WEBP, PNG, and DDS. Individual or Batch Export: Flexible options to export a single selected texture or the entire package at once.     I'm leaving the link here in case it's useful to anyone!   Installation and Execution:     Clone the repository:   https://github.com/Ak4n1/l2tool cd l2tool          2.Build the project:   ./gradlew build              3. Run the application:         ./run.bat      Or simply double-click on run.bat.    
    • Wtb full account or items on l2 warland 
    • https://discord.gg/k53SZ4DM5z   Interlude Client L2Old Pride is a L2 Pride Interlude Based All functional skills (Not archer/mage server)   L2Old Pride Helper (Works like Woundrous Cubic) https://imgur.com/iYqmHQY Farm Zones: Cave of Trials and Elven Ruins (Chaotic) Olympiads: Every 15 days Various Cosmetic Items https://imgur.com/uoeU6Jw https://imgur.com/oCS2Zed PvP Zone: Gludin Village (No-Parties, Disguised) More than 100 new Skills https://imgur.com/6RaPsQV Max Level: 90 https://imgur.com/z4QVJKZ Gaining Xp by PVP https://imgur.com/LRqI31T Purchasable S-grade items +10 or +20 with random chance to enchant +5 Purchasable Custom Items Depends on Tier Mysterious Merchants https://imgur.com/2ZwWyPH Auto Enchant Via PvPing (with low chance) Custom Raid Bosses Siege Every Weekend (Aden, Rune, Giran) Autofarm / Drop Tracker https://imgur.com/Vz3rha6   RATES: • Start Level 80 • Max level 90  • EXP: 5000x • SP: 5000x • ADENA 6000x   ENCHANT: • Maximum enchant S Grade Items: +35. • Maximum enchant Unique/Epic Items: +25. • Maximum enchant Legendary Items: +18. • Maximum enchant Relic Items: +14. •Descriptions for rate at scrolls!   EVENTS: • TEAMS vs TEAMS • CAPTURE THE FLAG • DOMINATION • DEATH MATCH • DICE OF DEATH • CHAOTIC ZONE   OTHERS: Assistance system in pvps. Where support classes are enabled to receive pvp with a low chance, for supporting a party member during pvp. •  /sit to regen HP/MP/CP • Custom Shots Glows https://imgur.com/FLK0DmR • Achievements System • Daily Tasks System • Monthly Tasks System   CUSTOM ARMORS SETS Dread Armor/Titanium Armor Pride Armor Rykros Armor https://imgur.com/SPxoQp1   CUSTOM WEAPONS SETS Unique Weapons Pride Weapons Legendary Weapons Relic Weapons https://imgur.com/kOHNXhS   CUSTOM ACCESSORIES Standard Superior Legendary https://imgur.com/zPqNiiX   CUSTOM JEWELS/TATTOO Legendary Nightmarish https://imgur.com/gcqS28P There are many more features that you will only understand by playing and following. Beta testing server is currently open. Follow us on our discord and join our server to test it.
    • You shouldn't use rev 382, not sure why everyone keep using that.   I don't make changesets for fun, I don't make new revisions for nothing.   Follow the revisions.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock