Jump to content

[Share] Hero voice command


Recommended Posts

Hi guys ;D

/*

* 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.handler.IVoicedCommandHandler;

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

import net.sf.l2j.gameserver.serverpackets.SocialAction;

/**

* @author x.v3ndetta@yahoo.com / fixed: xAddytzu

*/

public class Hero implements IVoicedCommandHandler

{

    private static String[] _voicedCommands = { "iwanttobehero" };

 

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)

    {   

if ( activeChar == null)

return false;

else if (activeChar.isCastingNow() || activeChar.isMovementDisabled() || activeChar.isMuted() || activeChar.isAlikeDead())

    return false;

else if (activeChar.isInOlympiadMode())

{

activeChar.sendMessage("You are in Olympiad!");

return false;

}

else if (activeChar.inObserverMode())

{

activeChar.sendMessage("You are in Observer mode.");

return false;

}

 

if(activeChar.isHero())

{

activeChar.sendMessage("You are already a Hero!.");

return false;

}

else

{

if (activeChar.getInventory().getInventoryItemCount(57, 0) >= 10000000)

{

activeChar.destroyItem("Consume", 57, 10000000, null, false);

activeChar.getInventory().addItem("Wings", 6842, 1, activeChar, null);

activeChar.sendMessage("You Are Now a Hero,You Are Granted With Hero Status , Skills ,Aura. This Effect Will Stop When You Restart.");

activeChar.setHero(true);

activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));

activeChar.broadcastUserInfo();

}

else

{

activeChar.sendMessage("You do not have enough Adena to be a Hero.");

}

}     

        return true;

    }

 

    public String[] getVoicedCommandList()

    {

        return _voicedCommands;

    }

}

 

NOT TESTED :P

 

SRYY ! I THINKED THAT I WAS IN l2J DEVELOP SECTION ! F@CK ME  :-[ :-X :'(

Link to comment
Share on other sites

package com.l2zone.gameserver.handler.voicedcommandhandlers;

 

import com.l2zone.Config;

import com.l2zone.gameserver.handler.IVoicedCommandHandler;

import com.l2zone.gameserver.model.actor.instance.L2ItemInstance; unnecessary cast

import com.l2zone.gameserver.model.actor.instance.L2PcInstance;

import com.l2zone.gameserver.model.actor.instance.L2PlayableInstance; unnecessary cast

import com.l2zone.gameserver.network.serverpackets.SocialAction;

 

 

/**

*

* @author x.v3ndetta@yahoo.com

*

*/

 

public class hero implements IVoicedCommandHandler

{

   private static final String[] VOICED_COMMANDS = { "iwanttobehero" };

 

   public boolean useVoicedCommand(L2PlayableInstance playable, L2ItemInstance item)

   {  

     

       {          

           if(!(playable instanceof L2PcInstance))

               return false;

 

           L2PcInstance activeChar = (L2PcInstance)playable;

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)

* Simple way

           

           if(activeChar.isHero())

               activeChar.sendMessage("You Are Already A Hero!.");

*What happen ? Missing return statement

           else

           {

               activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));

               activeChar.setHero(true);

               activeChar.sendMessage("You Are Now a Hero,You Are Granted With Hero Status , Skills ,Aura. This Effect Will Stop When You Restart.");

               activeChar.broadcastUserInfo();

               playable.destroyItem("Consume", 57, 10000000, null, false);

*If character have not adena what happen? :D

               activeChar.getInventory().addItem("Wings", 6842, 1, activeChar, null);

           }

        activeChar = null;

* activeChar = null for what ?

 

         }        

       return true;

   }

   public String[] getVoicedCommandList()

   {

       return VOICED_COMMANDS;

   }

  public boolean useVoicedCommand(String command, L2PcInstance activeChar,

        String target)

  {

     // TODO Auto-generated method stub

     return false;

  }

 

  * // TODO Auto-generated method stub

}

 

=========================================

/*
* 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.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.SocialAction;
/**
* @author x.v3ndetta@yahoo.com / fixed: xAddytzu
*/
public class Hero implements IVoicedCommandHandler
{
   private static String[] _voicedCommands = { "iwanttobehero" };

   public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
   {    
	if ( activeChar == null)
		return false;
	else if (activeChar.isCastingNow() || activeChar.isMovementDisabled() || activeChar.isMuted() || activeChar.isAlikeDead())
	    return false;
	else if (activeChar.isInOlympiadMode())
	{
		activeChar.sendMessage("You are in Olympiad!");
		return false;
	}
	else if (activeChar.inObserverMode())
	{
		activeChar.sendMessage("You are in Observer mode.");
		return false;
	}

	if(activeChar.isHero())
	{
		activeChar.sendMessage("You are already a Hero!.");
		return false;
	}
	else
	{
		if (activeChar.getInventory().getInventoryItemCount(57, 0) >= 10000000)
		{
			activeChar.destroyItem("Consume", 57, 10000000, null, false);
			activeChar.getInventory().addItem("Wings", 6842, 1, activeChar, null);
			activeChar.sendMessage("You Are Now a Hero,You Are Granted With Hero Status , Skills ,Aura. This Effect Will Stop When You Restart.");
			activeChar.setHero(true);
			activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));
			activeChar.broadcastUserInfo();
		}
		else
		{
			activeChar.sendMessage("You do not have enough Adena to be a Hero.");
		}
	}      
       return true;
   }
  
   public String[] getVoicedCommandList()
   {
       return _voicedCommands;
   }
}

Maybe working code

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.

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.

 Share



  • Posts

    • In the good old days we edited the hosts file (C:\Windows\System32\drivers\etc) You have to add the IP addresses to the end like this:  127.0.0.1             L2authd.lineage2.com - this is for local server for e.g
    • Hello everyone!    This is a HTML/CSS Project for people that want to link wiki articles to their website (homepage or other). The wiki used to link was: https://l2.wiki/essence/ - This wiki looks super cool, it's not official but looks wonderful 🙂   Demo of the section: https://un1k.digital/l2wiki Done in dark gray but you can change the colors easily on css file.   Files: https://www.mediafire.com/file/f31i0ycwlu7e4rv/l2wiki.rar/file   - How to setup in my index.html?   Step 1: Link the wiki.css file in your index.html, inside the <head> (Make sure to check if it's linked to the right folder)   <link href="css/wiki.css" rel="stylesheet">   Step 2: Move the images that came on files to your images folder. (If your folder wasn't named "images" will be needed to rename the direction of the images on html code.)   Step 3:  Add the HTML code to your index.html, inside the <body>. (Choose the best location for it, maybe above the footer)   <!--wiki--> <section class="l2wiki"> <div class="l2wiki-wrapper"> <div class="l2wiki-wrapper-title"><img src="images/icon-title-left.png"> <span>L2 Wiki</span> <img src="images/icon-title-right.png"></div> <div class="l2wiki-wrapper-content"> <!--wiki updates--> <div class="l2wiki-wrapper-content-latest"> <div class="l2wiki-wrapper-content-latest-guides"> <a href="https://l2.wiki/essence/wiki/gameplay/pvp-system/en" target="_blank"> <div class="tags"> <span class="tag-orange">New</span> <span>Update</span> <span>PvP</span> </div> <span>New Detailed PvP System [Vanguard Update]</span> </a> <a href="https://l2.wiki/essence/wiki/skill-tree/122" target="_blank"> <div class="tags"> <span class="tag-orange">New</span> <span>Class</span> </div> <span>Sylph Guide [Updated August 01</span> </a> <a href="https://l2.wiki/essence/wiki/skill-tree/122" target="_blank"> <div class="tags"> <span>Update</span> <span>Class</span> </div> <span>Sylph Guide [Updated July 20]</span> </a> <a href="https://l2.wiki/essence/wiki/gameplay/auto-hunting-system/en" target="_blank"> <div class="tags"> <span>Update</span> <span>Gameplay</span> </div> <span>Auto Hunting System [Updated July 08]</span> </a> </div> </div> <!--end wiki updates--> <!--wiki list--> <div class="l2wiki-wrapper-content-list"> <!--first list--> <div class="l2wiki-wrapper-content-list-content"> <div class="l2wiki-wrapper-content-list-content-links"> <span>Monsters by Level:</span> <div> <a href="https://l2.wiki/essence/wiki/monsters-by-level/1/19/Monster" target="_blank">1~19</a> <a href="https://l2.wiki/essence/wiki/monsters-by-level/20/29/Monster" target="_blank">20~29</a> <a href="https://l2.wiki/essence/wiki/monsters-by-level/30/39/Monster" target="_blank">30~39</a> <a href="https://l2.wiki/essence/wiki/monsters-by-level/40/49/Monster" target="_blank">40~49</a> <a href="https://l2.wiki/essence/wiki/monsters-by-level/50/59/Monster" target="_blank">50~59</a> <span class="more-dropdown">More<img src="images/arrow-up.png"> <div class="more-dropdown-list"> <a href="https://l2.wiki/essence/wiki/monsters-by-level/60/69/Monster" target="_blank">60~69</a> <a href="https://l2.wiki/essence/wiki/monsters-by-level/70/79/Monster" target="_blank">70~79</a> <a href="https://l2.wiki/essence/wiki/monsters-by-level/80/90/Monster" target="_blank">80~90</a> </div> </span> </div> </div> <div class="l2wiki-wrapper-content-list-content-img"> <img src="images/bosses.jpg"> </div> </div> <!--end first list--> <!--second list--> <div class="l2wiki-wrapper-content-list-content"> <div class="l2wiki-wrapper-content-list-content-links"> <span>Classes:</span> <div> <a href="https://l2.wiki/essence/wiki/skill-tree/122" target="_blank">Sylph</a> <a href="https://l2.wiki/essence/wiki/skill-tree/111" target="_blank">Kamael</a> <a href="https://l2.wiki/essence/wiki/skill-tree/103" target="_blank">Dwarf</a> <a href="https://l2.wiki/essence/wiki/skill-tree/84" target="_blank">Orc</a> <a href="https://l2.wiki/essence/wiki/skill-tree/60" target="_blank">Dark Elf</a> <span class="more-dropdown">More<img src="images/arrow-up.png"> <div class="more-dropdown-list"> <a href="https://l2.wiki/essence/wiki/skill-tree/34" target="_blank">Elf</a> <a href="https://l2.wiki/essence/wiki/skill-tree/0" target="_blank">Human</a> </div> </span> </div> </div> <div class="l2wiki-wrapper-content-list-content-img"> <img src="images/classes.jpg"> </div> </div> <!--end second list--> <!--second list--> <div class="l2wiki-wrapper-content-list-content"> <div class="l2wiki-wrapper-content-list-content-links"> <span>Gameplay:</span> <div> <a href="https://l2.wiki/essence/wiki/gameplay/olympiad/en" target="_blank">Olympiad</a> <a href="https://l2.wiki/essence/wiki/gameplay/castle-sieges/en" target="_blank">Sieges</a> <a href="https://l2.wiki/essence/wiki/gameplay/auto-hunting-system/en" target="_blank">Auto Hunting</a> <a href="https://l2.wiki/essence/wiki/gameplay/pets/en" target="_blank">Pets</a> <span class="more-dropdown">More<img src="images/arrow-up.png"> <div class="more-dropdown-list"> <a href="https://l2.wiki/essence/wiki/gameplay/magic-lamp/en" target="_blank">Magic Lamp</a> <a href="https://l2.wiki/essence/wiki/gameplay/rankings/en" target="_blank">Rankings</a> </div> </span> </div> </div> <div class="l2wiki-wrapper-content-list-content-img"> <img src="images/gameplay.jpg"> </div> </div> <!--end second list--> </div> </div> </div> </section> <!--end wiki-->   And that's it! You can edit the links to another wiki or keep the same.   Obs: This is not a website, it's just a additional content to your main web.
    • The point of emulating the gameplay of a client you like is to be able to modify it and change what doesn't appeal to you. That's why l2j exists in the first place. The bug you mentioned is just what we call it, a 'bug'. L2j fixing this bug is not a bad thing so I don't understand your point about the Critical Hit message (unless you were trying to prove you know all the details about l2off which I already believe you for).   I'm not the developer or have anything to do with L2Reborn other than playing in x30. I didn't start defending l2j from you, you pointed out that you don't like java servers and you prefer l2off, that's why this conversation started. And I still believe Reborn is a good server, at least in most players' eyes.
    • Thank you for sharing this with us!   
    • Oh maybe you are using aCis which is one way directed. Internal or External.  Which means that either you run the server on 127.0.0.1 (localhost) or you run it by your external IP with portforwarding to your dhcp assigned 192.168...etc. But I've figured it out on how to trick the system of course in a limited way up to 4 external PCs (free plan) using Hamachi. This can help you build the server testing with your friends before you host it on production!  If you need more information on how to do that don't hesitate to hit me up on PM.
  • 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