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

    • sql procedure missed and wrong...fixed it...ZOUMHS 
    • Hello Dexters! https://lineage2dex.com    This is pre-announcing of NEW season server, so we want to share some key points of it. Full details with road map, patch notes we will announce a bit latter Opening September 27 at 19:00 (UTC +3) Open Beta Test from September 23 What’s New This Season?, This is just a short preview of the most exciting changes and updates. A patch note with balance change will be posted later in this thread – one topic with all patchnotes history from 2022 year EXP/SP x25 - Over the past few seasons, our servers were drifting closer to a mid-rate style. And hard to call it now pure PVP server. That’s why we’ve reduced EXP/SP rates from x50 to x25 – making progression smoother, more balanced, and more in line with the mid-rate identity., Improved Olympiad matchmaking – opponents will be matched by strength, making feeding much harder., K/D stats for CC – track your real impact!, New In-Game Shop Interface - no more running to NPCs for supplies – buy everything directly from the interface. NPC Astarte will now only handle services like WH, sales, LS insertion, etc., Balance Adjustments - small but important tweaks for a smoother PvP experience (details in patch notes)., Replica Instance System Reworked - upgrading replicas now requires not only fragments but also real jewellery from B to S grades. You can choose from 3 instance types: PvP Instance – biggest rewards (everyone spawns together for mass PvP)., CC Instance – private instance for your CC., Party Instance – private instance for your party., , Dino Island Returns - back by popular demand: Dark Zone (PvP) and Light Zone (PvE)., Newbie Pass Questline - available at character creation – helps you get familiar with the server and make start progression faster., Clan members taxation system, Full announce - read on forum, https://forum.lineage2dex.com/threads/16723/ (edited)   We’re excited to show you how the Newbie Path will look on the Seasonal Server and share a few details about it. The Newbie Path is designed to help new players on Dex adapt more easily on project. While it won’t reveal the full content of the game, it will greatly assist during the early stages of your journey. But it’s not just for newcomers! Even veteran players will find it useful — completing Newbie Path steps will grant you small progression boosts and extra rewards(exp boosts, some gear, potions etc). Definitely worth using! You’ll be able to test the full Newbie Path system yourself during the Open Beta, launching on September 23rd!
    • 📢 [OFFICIAL ANNOUNCEMENT] 🔥 Lineage 2 Interlude x10 Craft-PvP 🔥 🎮 Grand Opening — September 19 @ 19:00 [UTC +2] 🧪 Open Beta — September 15 @ 19:00 [UTC +2]    🌐 Full server description - https://lineage2.ms/en/wiki 💥 Why Interlude x10 Craft-PvP? ✅ GM Shop up to B-Grade + Full Buffs — get straight to action, no pointless grinding. ✅ Unique Geodata & Geopathfinding Engine — smooth, tactical, and truly next-gen. ✅ Two Client Options — play in Classic or Interlude style. ✅ No Pay-to-Win — donations don’t break the balance. ✅ 1+1 Mode Enabled — max 2 windows, only 1 active = no box armies. ✅ Bot-Free Zone — advanced protection + non-intrusive popup captchas. ✅ No GM Interference — fair, competitive PvP environment. ✅ No Wipes — your progress is safe. ✅ Truly International — global reach, not just CIS players. 🛡 2nd Season. Stronger, Smarter, Updated. 🎯 Pure Craft-PvP. 🌍 Real Competition. 📅 Mark your calendars. Tell your clan. Invite your friends. Let’s make this season legendary. 💪 https://discord.gg/lineage2ms
    • As far as I know, L2Gold stated (unofficially) that closed for legal reasons. Although, my estimation is that it had reached such low popularity (believe me I know, I played till the last day), so they closed it because of that. As for "other" copies or w/e. I believe that everyone has the right to do what they think is best.  I have to say, I find your claims a bit exaggerating. Many servers have done a good job at recreating such a server. There are actually leaked files of C4 L2Gold (L2OFF) so many owners started working from there (L2Gold.cc (old Avellan), L2Gold.in, L2Gold.co etc.) There are other owners that took the idea 1 step further, adapting L2Gold in higher Chronicles and started working on a brand-new style with old features along. @Trance @Brado @To4kA (those are some of the owners that I can think of right now). I think you should re-think your opinions and don't judge them all together. Many of the servers you've mentioned has actually done a decent job and tried to take the brand, one step further. The argument here is that everyone should do what they want. Community will judge if it's good or bad.
  • 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