Jump to content

[Share]Join and leave olympiad commands


Recommended Posts

JoinOly.java

 

 

Hello , with theese commands , .Joinoly and .leaveoly you are gonna register and unregister your practicipation from olympiad games..

 

 

* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

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


/**
*
* @Author Revenger
*
*/

public class JoinOly implements IVoicedCommandHandler
{

  private static final String[] VOICED_COMMANDS = { "joinoly" , "leaveoly" };


public boolean useVoicedCommand(String command, L2PcInstance activeChar,String target)
{
    if (command.equalsIgnoreCase("joinoly"))
    {
     if (!activeChar.isInOlympiadMode() )
     {
    	 Olympiad.getInstance().registerNoble(activeChar, true);
    	 return true;
     }
    	 else if (activeChar.isParalyzed() || !activeChar.isNoble() || activeChar.isDead() 
        		 || activeChar.isFestivalParticipant() || activeChar.atEvent || activeChar.isSubClassActive() 
        		 || activeChar.isInDuel() || activeChar.isAlikeDead() || activeChar.isAfraid() || activeChar.isBetrayed() 
        		 || activeChar.getPvpFlag() > 0 || activeChar.getKarma() > 0 || activeChar.isInCombat() || activeChar.inObserverMode())     
        		 {
        	 activeChar.sendMessage("Your Status Doesnt Allow You To Join Olympiad!");
        	 return false;
         }
     }
    
    if (command.equalsIgnoreCase("leaveoly"))
     {
    	 if (activeChar.isInOlympiadMode())
    	 {
    		 Olympiad.getInstance().unRegisterNoble(activeChar);
    		 return true;
    	 }
    	 else if (activeChar.isParalyzed() || !activeChar.isNoble() || activeChar.isDead() 
        		 || activeChar.isFestivalParticipant() || activeChar.atEvent || activeChar.isSubClassActive() 
        		 || activeChar.isInDuel() || activeChar.isAlikeDead() || activeChar.isAfraid() || activeChar.isBetrayed() 
        		 || activeChar.getPvpFlag() > 0 || activeChar.getKarma() > 0 || activeChar.isInCombat() || activeChar.inObserverMode() || !activeChar.isInOlympiadMode())     
        		 {
        	 activeChar.sendMessage("Your Status Doesnt Allow You To Join Olympiad!");
        	 return false;
         }
     }
    
    
    return true;
}

public String[] getVoicedCommandList()
{
    return VOICED_COMMANDS;
}

    }

 

 

 

Don't forget to register the command on the game server ..

 

 

 

Credits , Revenger

Link to comment
Share on other sites

Thank you both for comments , and karma :P

 

 

Keep up posting if any problem appears on you ..

Link to comment
Share on other sites

Omg ReVenGeR® u have the best share!!! Nice code.. good job .. THX!

Thank you , and thanks everyone for the good job
Link to comment
Share on other sites

Sorry, if I'm bad but isnt here a mistake?

 

     if (!activeChar.isInOlympiadMode() )
    {
   	 Olympiad.getInstance().registerNoble(activeChar, true);
   	 return true;
    }
   	 else if (activeChar.isParalyzed() || !activeChar.isNoble() || activeChar.isDead() 
       		 || activeChar.isFestivalParticipant() || activeChar.atEvent || activeChar.isSubClassActive() 
       		 || activeChar.isInDuel() || activeChar.isAlikeDead() || activeChar.isAfraid() || activeChar.isBetrayed() 
       		 || activeChar.getPvpFlag() > 0 || activeChar.getKarma() > 0 || activeChar.isInCombat() || activeChar.inObserverMode())     
       		 {
       	 activeChar.sendMessage("Your Status Doesnt Allow You To Join Olympiad!");
       	 return false;
        }

 

I think it should be like this:

 

    	 if (activeChar.isParalyzed() || !activeChar.isNoble() || activeChar.isDead() 
        		 || activeChar.isFestivalParticipant() || activeChar.atEvent || activeChar.isSubClassActive() 
        		 || activeChar.isInDuel() || activeChar.isAlikeDead() || activeChar.isAfraid() || activeChar.isBetrayed() 
        		 || activeChar.getPvpFlag() > 0 || activeChar.getKarma() > 0 || activeChar.isInCombat() || activeChar.inObserverMode())     
        		 {
        	 activeChar.sendMessage("Your Status Doesnt Allow You To Join Olympiad!");
        	 return false;
         }
    	 else if (!activeChar.isInOlympiadMode() )
	     {
	    	 Olympiad.getInstance().registerNoble(activeChar, true);
	    	 return true;
	     }

 

.. Sorry, if I'm bad.

 

And of course, great idea :-)

 

 

 

 

Link to comment
Share on other sites

No its not :D because if you se true a char who is o paralyse or is not noble etc etc etc will be available to join olympiad

Link to comment
Share on other sites

No its not :D because if you se true a char who is o paralyse or is not noble etc etc etc will be available to join olympiad

But yes. With your code, the paralyse, duel, nobless etc. check will not work.

 

If java see if (!activeChar.isInOlympiadMode()), and char will not be in oly, then code will register him/her to oly (dont matter on duel, non-nobless, or paralyse, because else if (activeChar.isParalyzed()...) will be skipped.)

 

Excuse me, if I'm bad.

Link to comment
Share on other sites

ehm , whres the problem i say again , i chek my code and i see it fine , and it worked fine ..

Link to comment
Share on other sites

This code can be deleted :

    if (command.equalsIgnoreCase("leaveoly"))

    {

    if (activeChar.isInOlympiadMode())

    {

    Olympiad.getInstance().unRegisterNoble(activeChar);

    return true;

    }

    else if (activeChar.isParalyzed() || !activeChar.isNoble() || activeChar.isDead()

        || activeChar.isFestivalParticipant() || activeChar.atEvent || activeChar.isSubClassActive()

        || activeChar.isInDuel() || activeChar.isAlikeDead() || activeChar.isAfraid() || activeChar.isBetrayed()

        || activeChar.getPvpFlag() > 0 || activeChar.getKarma() > 0 || activeChar.isInCombat() || activeChar.inObserverMode() || !activeChar.isInOlympiadMode())   

        {

        activeChar.sendMessage("Your Status Doesnt Allow You To Join Olympiad!");

        return false;

        }

In my opinion it will be better without this part...

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

    • not just a waste of time ..even waste of money ...  
    • Heya! I was looking for someone who can provide me with any solution for FPS increase on Interlude Client. I was interested in a working Clear Cache button and/or any patch that will increase the FPS of each player. Playing on Interlude for many years now, I can understand that a crowded place will drop your FPS by a lot which is making the game unplayable and unenjoyable. For example, Baium Epic Boss always had issues (not only) with FPS drops sometimes players are playing with pixels (images). If anyone has the expertise and knowledge about those things I would like him to contact me via Discord xthedarknessfear so we can discuss further because I obviously have some questions about Client Modification and how it's done. Will not answer anything here, hit me up on disc and let's discuss it! P.S: I'm also looking for a custom simple interface (small edits). If you can do both, you are my guy! Cheers!
    • //request   Can anyone rework this for aCis 401? personally, one of the best features to have in a L2 server.
    • i have this feature: https://prnt.sc/rD9BYOi7QPB6 there is edited interface and one dll to make it working.
    • Whatever @Tryskell said...   Unfortunately it is not 2005-2010 anymore... Most of the community from those days is "grown up" and probably does not play games anymore (or at least no MMOs). I think anything related to MMOs will be a nail in the coffin.   I understand that it is hard to let the thing you've built for years to "just die". I assume most people got into programming, so maybe you can try something in that direction. But then again, this is a very niche community.   We need to think of something to bring the people together. I think events may be really fun, but then you would probably need to add prizes n order for the people to participate.   So yea, just my 2 cents. Hopefully somebody can come up with some great idea so we can revive this place. I've already forgotten it for the last couple (5-6) years...
  • Topics

×
×
  • Create New...