Jump to content

[Share]Custom PvP Related Hero Status + Announce including


Recommended Posts

Hello , latest not share done so i will share a shit now .. its nothing to be serius with .. just some small crappy codes that will make your server great :D

 

Lets start ,

 

*L2PcInstance

 

find

public void increasePvpKills()

 

you will see under it thoose

 

{
        // Add karma to attacker and increase its PK counter
        setPvpKills(getPvpKills() + 1);
        CustomHeroSystem();

         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
        sendPacket(new UserInfo(this));
        sendPacket(new ExBrExtraUserInfo(this));
    }

 

Now , after this you have to add

 

public void CustomHeroSystem()
    {
    	L2PcInstance activeChar = L2PcInstance.getClient().getActiveChar();
    	
        if (activeChar.getPvpKills() >= 5000)
        {
        	activeChar.sendMessage("You are now a server hero for beign so great fighter!");
      Announcements.getInstance().announceToAll(activeChar.getName() + "Is now a server's hero!");
        	activeChar.setHero(true); 
        }

 

 

 

If it gives you errors in announcements , you simple press right click on the error and select import announcements , and TADAMM

 

 

ps , code is tested on L2JServer Gracia Final part ;) thanks!

Link to comment
Share on other sites

fix the typo on the

activeChar.sendMessage("You are now a server hero for beign so great fighter!");

beign =P

 

Thanks for sharing it for mxc.

Added at the list.

Link to comment
Share on other sites

Shit , cant you manually?We , Legendary members are so imba that we dont have edit post xD

Link to comment
Share on other sites

I've told you EXACTLY the same thing with your previous share..

 

So what this code does as we see it now.. Each time someone with more than 5000 pvps gets a pvp, he's being announced as a hero. Which is wrong. Should be displayed only the first time.

 

Anyway thanks for trying, but try more & improve it =)

Link to comment
Share on other sites

put a check if the char is already a hero? it can cause some NPE's and this what fakoykas said :)

 

if (!activeChar.isHero() && activeChar.getPvpCount() >= 5000)

{

;

}

Link to comment
Share on other sites

put a check if the char is already a hero? it can cause some NPE's and this what fakoykas said :)

 

if (!activeChar.isHero() && activeChar.getPvpCount() >= 5000)

{

;

}

Exactly what i told him at his other hero-related share. But he doesn't want to listen =(

Link to comment
Share on other sites

put a check if the char is already a hero? it can cause some NPE's and this what fakoykas said :)

 

if (!activeChar.isHero() && activeChar.getPvpCount() >= 5000)

{

;

}

 

ahh you are right. sorry :d (my mistake)

Link to comment
Share on other sites

Ok.. here's how it should be :D

 

public void CustomHeroSystem()

   {

       if (!isHero() && getPvpKills() == 5000)

       {

          //announce & message ONLY when they reach 5000 pvp.

          sendMessage("You are now a server hero for being so great fighter!");

          Announcements.getInstance().announceToAll(getName() + " Is now a server's hero!");

          setHero(true);

       }

 

and Now in EnterWorld.java

 

    if (!activeChar.isHero() && activeChar.getPvPKills > 5000)

          setHero(true);

 

So now the announce is only been announced if the char is not hero already and ONLY when he reaches 5000 pvps..

Also he doesn't lose hero at his relogin =)

 

Regards.

Link to comment
Share on other sites

Ok.. here's how it should be :D

 

public void CustomHeroSystem()

    {

        L2PcInstance activeChar = L2PcInstance.getClient().getActiveChar();

        if (!activeChar.isHero() && activeChar.getPvpKills() == 5000)

        {

          //announce & message ONLY when they reach 5000 pvp.

          activeChar.sendMessage("You are now a server hero for being so great fighter!");

          Announcements.getInstance().announceToAll(activeChar.getName() + "Is now a server's hero!");

          activeChar.setHero(true);

        }

 

and Now in EnterWorld.java

 

    if (!activeChar.isHero() && activeChar.getPvPKills > 5000)

          setHero(true);

 

So now the announce is only been announced if the char is not hero already and ONLY when he reaches 5000 pvps..

Also he doesn't lose hero at his relogin =)

 

Regards.

 

the only problem with this is this only for enterworld not after they make the pvp.

also you missed an if(activeChar == null) check.

 

Link to comment
Share on other sites

the only problem with this is this only for enterworld not after they make the pvp.

also you missed an if(activeChar == null) check.

Check the whole topic, it's just an addition to what HαRǾC« shared.

 

He has already added the method after setPvpKills(getPvpKills() + 1); so activeChar == null is not needed and neither in enterworld is needed as they are already there =)

Link to comment
Share on other sites

Check the whole topic, it's just an addition to what HαRǾC« shared.

 

He has already added the method after setPvpKills(getPvpKills() + 1); so activeChar == null is not needed and neither in enterworld is needed as they are already there =)

 

i checked and i dont see the npe check it needs to be in the public void CustomHeroSystem() because okay the activeChar is defined but the null check no

Link to comment
Share on other sites

Stef u cant get an npe if its already hero...

 

Definition of NPE: A null value where it shoulnt be null. full name of NPE = Null Pointer Exception extended class of RuntimeException.

 

And Inter.. u dont need a null check...

 

whats so hard?

L2PcInstance.java:

public void parsePvPCustomHero()
{
       if (!isHero() && getPvpKills() >= 5000)
       {
          //announce & message ONLY when they reach 5000 pvp.
          sendMessage("You are now a server hero for being such a great fighter!");
          Announcements.getInstance().announceToAll(activeChar.getName() + "Is now a server's hero!");
          setHero(true);
       }
}

EnterWorld.java

// You know the deal...
activeChar.parsePvPCustomHero();

 

And everything is manage in pc instance doooh!!

Is that hard?

 

Anyway nice work HαRǾC« ur getting better and better, keep it up :P

PS: And it shoud be getPvpKills() >= 5000 (biger or equal) else it will give hero status only if the player has 5000 if its 5001 bby hero :D

Link to comment
Share on other sites

Stef u cant get an npe if its already hero...

 

Definition of NPE: A null value where it shoulnt be null. full name of NPE = Null Pointer Exception extended class of RuntimeException.

 

And Inter.. u dont need a null check...

 

whats so hard?

L2PcInstance.java:

public void parsePvPCustomHero()
{
        if (!isHero() && getPvpKills() >= 5000)
        {
           //announce & message ONLY when they reach 5000 pvp.
           sendMessage("You are now a server hero for being such a great fighter!");
           Announcements.getInstance().announceToAll(activeChar.getName() + "Is now a server's hero!");
           setHero(true);
        }
}

EnterWorld.java

// You know the deal...
activeChar.parsePvPCustomHero();

 

And everything is manage in pc instance doooh!!

Is that hard?

 

Anyway nice work HαRǾC« ur getting better and better, keep it up :P

PS: And it shoud be getPvpKills() >= 5000 (biger or equal) else it will give hero status only if the player has 5000 if its 5001 bby hero :D

 

still only for enterworld not by instant after the pvp...and yes you can use the isHero() to avoid the null check anyway the check method should be in the increasePvpKills() too

Link to comment
Share on other sites

omg dude.. u just add in increasePvpKills() the call method: parsePvPCustomHero().

And its instantly after pvp doooh... besides that u dont need that check into increasePvpKills() if u can use it in parsePvPCustomHero(), it keeps the code clean... lolz

And also isHero is not a null check wtf ?:D that !ishero has to return false so that a normal hero dosent get parsed for nothing... and also its there if the player is already hero by pvp.. to skip the parsing method that way its more efficient.. dooh >.>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • So excited to announce 3x Telegram Premium (6 months)   Join our official TG and participate to win!   Asocks.com - trusted proxy service providing mobile and residential proxies with a single price of $3 per 1GB   A huge locations pool and high speed will help complete all tasks    
    • Well, sorry not sorry for resurrecting old topic, but I believe it's ultimately stupid to implement license checks like Vilmis did 🙂   private static String url = "jdbc:mysql://185.80.128.233/" + getData("Zm9ydW1fZGI="); private static String username = getData("bXJjb3B5cmlnaHQ="); private static String password = getData("Y29weXJpZ2h0XzEyMw=="); con = GlobalDB.getInstance().getConnection(); PreparedStatement statement; statement = con.prepareStatement("SELECT field_6 from core_pfields_content WHERE member_id = ?"); statement.setInt(1, Config.FORUM_USER_ID); ResultSet rset = statement.executeQuery();   This awesome way of coding things leaves us with base64-encoded credentials and DB exposed and accessible globally 😉 Btw he checks his licensing data from some plugin generated table his forum uses. Vilmis took action and ensured that mrcopyright user would have only needed accesses and rights for this operation. But he forgot to ensure that his INFORMATION_SCHEMA database would not be exposed and readable... That leads us to fully readable server variables like version used (10.1.26-MariaDB-0+deb9u1 - pretty ancient DB and OS, I'd assume). From here you can go south and do some kinky stuff, if you want and have knowledge for that. But who cares, right?   Ooh, table core_pfields_content field_6 is IP address which is checked by FORUM_USER_ID. Yep, you can query all IP addresses there (124 of them right now) and also do whatever you want with them! 🙂  The most fun part? Files source has been shared what, more than 2 years ago?  Vilmis still uses very same credentials and never changed it after sources exposure - who cares. Although, "sources" may be way too strong word here. If anyone still use paid Orion versions, I'd suggest packing your shit and leaving immediately, or at least fix this incompetent fool caused problems. It's obvious Vilmis don't care or maybe doesn't even know from the first place how to solve this problem (hint hint - tiny PHP Rest API microservice which would do absolutely the same but without exposing sensitive data?). By doing that, he exposes his infrastructure and YOUR data, and he does that for more than 2 years now 🙂 Developer of century!    
    • rename the l2.bin into l2.exe
    • L2LIVE.PRO- Dynamic Mid-rates Essence Seven Signs GRAND OPENING - July 5, 20:00 GMT+3 (EEST) TEST SERVER IS OPEN - COME AND CHECK IT OUT TODAY! Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu   Server description * EXP/SP: Dynamic (x1- x100 based on your level, *before* Sayha and EXP buffs * Adena: x50 / Item Drop: x10 / Fishing EXP increased / Attribute EXP increased * Simplified gameplay to stay in the loop while not spending hours and hours farming * Starter Pack containing very useful items for beginners * MP replenishing potions with auto-consumption * No overpowered donations L2LIVE shop * All spellbook coupons, pet spellbook coupons and master books are sold via Game Assistant * Additionally you can buy SP pouches, enchanted talismans, pet training guides and various other consumables for Adena and L-Coin * More items such as cloaks, more talismans, agathions, belts, pendants, enchantment scrolls of various grades, evolution stones, etc will be added! Shop server as a shortcut, and all retail-like ways of earning items are still here! L-Coins * Drops with small change and in random amounts from Lv60+ monsters  * All raidbosses drop random amount of L-Coin Pouches generating up to 420 Lcoin per unit. **Grand Olympiad and Events** * Grand Olympiad is held week day * Format is 1v1, unlimited weekly fights  * Heroes are declared weekly at Sunday * There are three automated events - TvT, CTF and Deathmatch, running at evenings * Orc Fortress, Battle with Balok, Keber Hunter, Archievements Box, Daily Gift Calendar provisional events are active too Custom user commands * .offlineplay command, your character will keep playing till death or server restart * .offlineshop command, keeps your shop sitting until all items are purchased * .apon / .apoff - enable/disable HP/MP autoconsume And lots of other small improvements are waiting for you!   Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu
  • Topics

×
×
  • Create New...