Jump to content

Recommended Posts

Posted

Hello gyes, since it requested, i will try to make this guide about some methods and creating methods explanations.

 

This time, we will talk about set and is methods.You know..., maybe all of you know these methods , you have seen it at hero status,noble status :

setHero(true,false)  ,   setNoble(true,false)  , isHero()  ,  isNoble().

I will explain you exactly how these methods are working, so that you can create easy your own .

 

In my guide i will use the name MaxCheatersMember.So, there will be two methods, right?

The one is   setMaxCheatersMember(true,false)  and the other isMaxCheatersMember() .

 

Creating the methods....

First of all, lets create the method isMaxCheatersMember() .  I will make it via steps.

1)We go at L2PcInstance.java class and we create a boolean named like we want i will use this:

private boolean _maxcheater;

 

2)For make it easy and more readable, find this line: public boolean isNoble() , above this create a method :

public boolean isMaxCheatersMember()

{

}

 

3)We have a empty method,named isMaxCheatersMember,right? Inside this method just add this line:

return _maxcheater; . So the method will have the body return _maxcheater; .

The isMaxCheatersMember() method is ready, now we will create the method seMaxCheatersMember(true or false).

 

4)Above of the line: public boolean isMaxCheatersMember() or under the whole method we create a new method named setMaxCheatersMember(boolean value)

{

}

 [in the value you can put everything ,even x,y,z

 

5)Now we have again a empty method xD , inside this method now we put this line:

_maxcheater = value; (where value the name of your boolean)

 

Now we have the both methods we need: isMaxCheatersMember() and setMaxCheatersMember(boolean value)

 

 

How they work.....?Explanation?

I will explain it again in some simple steps:

 

1)First of all we create a private boolean named _maxcheater;. A boolean can have only 2 values ,

it can be true or false .

Ok , but why private?

We set it as private because the only class that checks this value is the class L2PcInstance, only this class checks this boolean , only.

 

2)the whole method:

public boolean isMaxCheatersMember()

{

  return _maxcheater;

}

just returns the value of _maxcheater; So if _maxcheater boolean is true , the method

isMaxCheatersMember() will return true, if false the method will return false; You catch it , o yea!!

By default it is false, as we created the boolean _maxcheater as false in the beggining.But for changing it,for changing the boolean, so for changing the value of method isMaxCheatersMember() to return true if we want, or false, look at the step 3.

Why the method is public?

Because , we want to use this method and in another classes, not only in L2PcInstance for example maybe we want to go at Enterworld class and we need to add this method there!

 

3)Here's come the creation of method:

public void setMaxCheatersMember(boolean value)

{

 _maxcheater = value;

}

What the hell is it?Ok, this method first of all needs a parameter,a parameter in our example is the: boolean value .Then it reads this boolean , so it will read if it is true or false.Then it takes the value of the boolean, and it set's it at _maxcheater boolean.For example if value=true then _maxcheater = true ; if False, the opposite. It's easy i think to understand it.

Why public and why void and not boolean?

Not private for the same reason as method isMaxCheatersMember().

Ok, now lets explain why void and not boolean.If we had boolean we should return something, for example return _aboolean; But we don't want this method to return something, we want this method to DO something.We we want a method to do something, we put void.

 

That was how these simple methods work, i think that for newbies it is usefull and they can understand it.

 

Puting methods into methods...

Ok, i will continue with these 2 methods. isMaxCheatersMember() and setMaxCheatersMember(true,false) .

Now , players can't get this method to true, its false by default....for example now i will explain you how to "check" if the players has some conditions to take the isMaxCheatersMember() status(i mean to be true).

 

In my example, one player will become isMaxCheatersMember() if he has 50000 pvp.How can we do it?We can do it and without put methods into methods, but by doing this it's better, i think it looks more advanced.

So what we want our method to return or do something? Think about it, we need to DO, so we create a void method.

Let's create it, i will explain you what i did then.

 

public void checkForMxcStatus(L2PcInstance activeChar)

{

 if (activeChar.getPvpKills() >= 50000 && !(activeChar.isMaxCheatersMember()))

 {

   activeChar.setMaxCheatersMember(true);

 }

 else if (activeChar.getPvpKills() < 50000)

 {

   activeChar.setMaxCheatersMember(false);

 }

}

 

What we did?

1)We created a public (you know now why public) method as void named checkForMxcStatus with 1 parameter which is an l2pcinstance object, the well known to all of you activeChar.

2)First of all we check if the activeChar has 50000 pvp and if he is'nt MaxCheatersMember() (! means not).

3)If the player has these conditions, we set him isGamingParadiseMember() with the setMaxCheatersMember() method that we created before.

4)then we use the else if to check if the player's pvps ar lower than 50000 , if it is we set him isMaxCheatersMember false, again with the method setMaxCheatersMember().

 

Yes that can be done with a better way, that was an example.If you are a newbie, the best you can do is practice to methods, they are very very very very usefull to continue your carreer.I hope i helped gyes, for now i need some masause at my fingers.

 

 

PS: the is and get is example, but all are used to use these methods to be more understandable, you catch me :D

 

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

    • New release   World & atmosphere   - Grass is back — terrain grass now grows across the world like the original client, with settings for on / original-style / off, two sway styles, and optional grass shadows.   - Day/night and the sky now follow the game server, including sunrise, sunset, Seven Signs skies, and red-sky events. A manual override remains available in settings.   - Doors are now live — castle and town doors open and close according to the server, can be targeted, and display their health.   - Earthquake events now shake the screen and play their original rumble sounds.    Map & navigation   - New live minimap — an always-on radar with a rotating player arrow, party, target and NPC markers, zone labels, hover tooltips, three zoom levels, and collapse and resize controls. Clicking it opens the full world map.   - Zone titles now fade onto the screen when you enter a new region.   - The world map now displays your current zone name and party-member positions.   Combat & effects   - Enchanted weapons now glow properly, complete with drifting wisps, across every weapon type — including on the character selection screen.   - Soulshot, Spiritshot, Fishing Shot, and Beast Shot activations now play their original flashes and sounds. A new “hide shot effects” option is available if you prefer not to see them.   - Item-use visuals have been restored — potions, antidotes, echo crystals, fireworks, and other usable items now play their proper effects.   - Skill damage now displays floating damage numbers, and critical skill hits shake the camera.   - New buff bar — active buffs, debuffs, and toggles now appear as icons above the HUD.   - Bow skills now nock and release their arrows at the correct animation moments.   Shops & items   - NPC shops now work — a complete buy window with prices, weight and Adena totals, stock limits, and a quantity dialog for stackable items.   - Player-to-player trading now works, including timed trade requests, complete inventory and offer panes, quantity selection for stackable items, weight preview, confirmation locking, cancellation, and trade completion.   - Item enchanting now works — using an enchant scroll opens the original-style item selection window with enchant levels and full item tooltips, plus proper selection and cancellation handling.   - Item cooldowns, including potions and similar items, now appear on the shortcut bar.   - Item tooltips and the inventory window have received further polish.   - Weapon tooltips now correctly identify weapon classes and calculate enchant-adjusted P. Atk. values for bows, two-handed weapons, fists, and dual swords.   Chat & commands   - Slash commands now work, including /time, /loc, and other server commands. GM accounts can also use // admin commands.   - Action commands can now be entered directly in chat, including sit/stand, walk/run, normal and forced attacks, trade, target next, pickup, assist, party actions, social emotes, and duels.   - System messages can optionally be separated into their own window, and the chat font size is adjustable.   - Server event announcements now appear on screen as they did in the original client.   Interface   - A live animated portrait of your character now appears beside the HP and MP bars.   - The client now ships with its own Tahoma and Noto Sans fonts, allowing text to work across languages. Chat and nameplate fonts can be selected in the new Fonts settings section.   - The target window has been refined — clicking the level chip now expands or collapses the window.   - NPC dialog windows have received additional polish, including proper window titles and button labels. Download from the launcher you have installed or at https://updates.fermata.gg/ if you don't have the launcher
    • Damn there are still people that value Lineage! Great job Elfo as always!
    • Payment Methods Credit/Debit Card, PayPal, Wise, Payoneer, Binance Pay, Bybit, Crypto, and other supported payment options depending on availability. Delivery Time / TAT General delivery time: Instants to 24 hours Depended on Products. Some products may take longer depending on stock, account eligibility, product type, payment confirmation, or activation requirements. Refund & Replacement Policy If we cannot deliver the product within the confirmed delivery time and you do not want to wait, you are eligible for a refund. If the account, gift link, gift code, or activation does not work at first login/activation, please contact us within 24 hours with screen recording proof before start purchasing. If the product is successfully delivered and activated, refund is not available unless a specific warranty was mentioned for that product. Warranty period depends on the product type. Some products may include replacement support for a limited period. Please ask before ordering if warranty is important. No refund/replacement is available if the buyer shares account details, changes recovery/security settings without asking, uses VPN/proxy in a risky way, violates platform rules, fails to provide proof, or changes their mind after successful use. If a platform changes its policy, eligibility, country availability, or subscription system after delivery, we will try to help, but we cannot control third-party platform changes. Important Notes Stock may be limited for some products at klouditem. Prices may change depending on market, stock, and product availability. Some services may require your personal email/account for upgrade. Some services are ready-made accounts only. Some products may have country or account eligibility requirements. Please read the product details before ordering. We do not claim to be an official partner of any platform unless clearly stated by the platform itself. Product names and logos belong to their respective owners. Review Copies Review copies are not always available. If we open a review copy round, we will announce it in this thread and select qualified members based on account history, activity, and availability. Please do not request review copies unless we have announced them. FAQ Q: Do you deliver instantly? A: Delivery is usually Instant to 24 hours, depending on stock and payment confirmation. Q: Can I upgrade my own account? A: Some services support own account upgrade, while others are ready-made account only. Please ask before ordering. Q: Do you provide support after delivery? A: Yes, we provide support for login, activation, and basic setup issues related to the delivered product. Q: Can I check stock before payment? A: Yes, please ask before payment. We will confirm stock and delivery time first. Q: Are prices fixed? A: Some prices are fixed, and some depend on stock/package. Q: What should I do if I face an issue? A: Contact us as soon as possible with clear screenshot or screen recording proof from purchase, and we will check it.   Contact Buy Now: https://klouditem.com Telegram Support: https://t.me/Klouditem
    • https://prnt.sc/MCxO-vS1MHuA how to zoom in? and on every click ad popup.. nonsense.
  • 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..