[Share] .stat Voice Command - Info about target Moded Credits Vago L2J 

Status
Not open for further replies.
Newbie Spellweaver
Joined
Feb 20, 2008
Messages
34
Reaction score
0
Well this code is Vago's i changed it but in nice not bad:P
Mafia_007 asked:
"cool , also u can make it as html for a better interface when you hit enter after typing .stat ! good job anyway"

Its done + a config for it
I made it with colors to.. and u can change them by yourself :P

Code:
/*
 * 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 javolution.text.TextBuilder;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;


/**
 *@author Vago
 *@Moded by KidZor
 */
public class stat implements IVoicedCommandHandler
{
    private static final String[] VOICED_COMMANDS = { "stat" };

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {   
        if (command.equalsIgnoreCase("stat"))
        {
            if (activeChar.getTarget()==null)
            {
                activeChar.sendMessage("You have no one targeted.");
                return false;
            }
            if (!(activeChar.getTarget() instanceof L2PcInstance))
            {
                activeChar.sendMessage("You can only get the info of a player.");

                return false;
            }

            NpcHtmlMessage userReply = new NpcHtmlMessage(5);
            L2PcInstance targetp = (L2PcInstance)activeChar.getTarget();
 

            TextBuilder replyMSG = new TextBuilder("<html><body><center>");
            replyMSG.append("<br><br><font color=\"00FF00\">=========>>"+ targetp.getName() +"<<=========</font><br>");
            replyMSG.append("<font color=\"FF0000\">Level: " + targetp.getLevel()+"</font><br>");
            if (targetp.getClan() != null)
            {
               replyMSG.append("<font color=\"FF0000\">Clan: " + targetp.getClan().getName()+"</font><br>");
               replyMSG.append("<font color=\"FF0000\">Alliance: " + targetp.getClan().getAllyName()+"</font><br>");
            }
            else
            {
               replyMSG.append("<font color=\"FF0000\">Alliance: None</font><br>");
               replyMSG.append("<font color=\"FF0000\">Clan: None</font><br>");
            }
           
           
           
           
           
           
           replyMSG.append("<font color=\"FF0000\">Adena: " + targetp.getAdena()+"</font><br>");
           
           
           
          if(activeChar.getInventory().getItemByItemId(6393) == null)
       {
              replyMSG.append("<font color=\"FF0000\">Medals : 0</font><br>");
       }
          else
          {
              replyMSG.append("<font color=\"FF0000\">Medals : " + targetp.getInventory().getItemByItemId(6393).getCount()+"</font><br>");
          }
           
           
          if(activeChar.getInventory().getItemByItemId(3470) == null)
       {
              replyMSG.append("<font color=\"FF0000\">Gold Bars : 0</font><br>");
       }
          else
          {
              replyMSG.append("<font color=\"FF0000\">Gold Bars : " + targetp.getInventory().getItemByItemId(3470).getCount()+"</font><br>");
          }
              replyMSG.append("<font color=\"FF0000\">PvP Kills: " + targetp.getPvpKills()+"</font><br>");
            replyMSG.append("<font color=\"FF0000\">PvP Flags: " + targetp.getPvpFlag()+"</font><br>");
            replyMSG.append("<font color=\"FF0000\">PK Kills: " + targetp.getPkKills()+"</font><br>");
            replyMSG.append("<font color=\"FF0000\">HP, CP, MP: " + targetp.getMaxHp() + ", " +targetp.getMaxCp() + ", " + targetp.getMaxMp()+"</font><br>");
            replyMSG.append("<font color=\"FF0000\">Wep Enchant: " + targetp.getInventory().getPaperdollItem(9).getEnchantLevel()+"</font><br>");
            replyMSG.append("<font color=\"00FF00\">=========>>"+ targetp.getName() +"<<========="+"</font><br>");
            replyMSG.append("</center></body></html>");

            activeChar.sendPacket(userReply);

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

}

that's the command, and the config and gameserver.java:

Config.java:
Code:
    /** Allow Stat view **/
    public static boolean ALLOW_STAT_VIEW;

Add that after ANNOUNCE_MAMMON_SPAWN or line 1620
Code:
                ALLOW_STAT_VIEW     = Boolean.valueOf(otherSettings.getProperty("AllowStatView", "False"));

And in other.proprieties:
Code:
# -------------------
# View Stat Configs
# -------------------
# Allows user to use command .stat
# And view the targets statics.
AllowStatView = False

And lets add a diff file its more easy for some ppl :P


Credits belong to Vago its his code...i just edited it xD

Here's some pics:
KidZoR - [Share] .stat Voice Command - Info about target Moded Credits Vago - RaGEZONE Forums

KidZoR - [Share] .stat Voice Command - Info about target Moded Credits Vago - RaGEZONE Forums

aw and that + at the gold bars is fixed only pic shows it :P
 
Status
Not open for further replies.
Back