Package net.sf.l2j.gameserver.instancemanager

Examples of net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager


  {
    if (!Config.ALT_PRIVILEGES_ADMIN)
      if (!(checkLevel(activeChar.getAccessLevel())))
        return false;

    CursedWeaponsManager cwm = CursedWeaponsManager.getInstance();
    int id=0;

    StringTokenizer st = new StringTokenizer(command);
    st.nextToken();

    if (command.startsWith("admin_cw_info"))
    {
      if (!command.contains("menu"))
      {
        activeChar.sendMessage("====== Cursed Weapons: ======");
        for (CursedWeapon cw : cwm.getCursedWeapons())
        {
          activeChar.sendMessage("> "+cw.getName()+" ("+cw.getItemId()+")");
          if (cw.isActivated())
          {
            L2PcInstance pl = cw.getPlayer();
            activeChar.sendMessage("  Player holding: "+ pl==null ? "null" : pl.getName());
            activeChar.sendMessage("    Player karma: "+cw.getPlayerKarma());
            activeChar.sendMessage("    Time Remaining: "+(cw.getTimeLeft()/60000)+" min.");
            activeChar.sendMessage("    Kills : "+cw.getNbKills());
          }
          else if (cw.isDropped())
          {
            activeChar.sendMessage("  Lying on the ground.");
            activeChar.sendMessage("    Time Remaining: "+(cw.getTimeLeft()/60000)+" min.");
            activeChar.sendMessage("    Kills : "+cw.getNbKills());
          }
          else
          {
            activeChar.sendMessage("  Don't exist in the world.");
          }
          activeChar.sendPacket(new SystemMessage(SystemMessageId.FRIEND_LIST_FOOT));
        }
      }
      else
      {
        TextBuilder replyMSG = new TextBuilder();
        NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
        adminReply.setFile("data/html/admin/cwinfo.htm");
        for (CursedWeapon cw : cwm.getCursedWeapons())
        {
          itemId=cw.getItemId();
          replyMSG.append("<table width=270><tr><td>Name:</td><td>"+cw.getName()+"</td></tr>");
          if (cw.isActivated())
          {
            L2PcInstance pl = cw.getPlayer();
            replyMSG.append("<tr><td>Weilder:</td><td>"+ (pl==null?"null" : pl.getName())+"</td></tr>");
            replyMSG.append("<tr><td>Karma:</td><td>"+String.valueOf(cw.getPlayerKarma())+"</td></tr>");
            replyMSG.append("<tr><td>Kills:</td><td>"+String.valueOf(cw.getPlayerPkKills())+"/"+String.valueOf(cw.getNbKills())+"</td></tr>");
            replyMSG.append("<tr><td>Time remaining:</td><td>"+String.valueOf(cw.getTimeLeft()/60000)+" min.</td></tr>");
            replyMSG.append("<tr><td><button value=\"Remove\" action=\"bypass -h admin_cw_remove "+String.valueOf(itemId)+"\" width=73 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
            replyMSG.append("<td><button value=\"Go\" action=\"bypass -h admin_cw_goto "+String.valueOf(itemId)+"\" width=73 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
          }
          else if (cw.isDropped())
          {
            replyMSG.append("<tr><td>Position:</td><td>Lying on the ground</td></tr>");
            replyMSG.append("<tr><td>Time remaining:</td><td>"+String.valueOf(cw.getTimeLeft()/60000)+" min.</td></tr>");
            replyMSG.append("<tr><td>Kills:</td><td>"+String.valueOf(cw.getNbKills())+"</td></tr>");
            replyMSG.append("<tr><td><button value=\"Remove\" action=\"bypass -h admin_cw_remove "+String.valueOf(itemId)+"\" width=73 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
            replyMSG.append("<td><button value=\"Go\" action=\"bypass -h admin_cw_goto "+String.valueOf(itemId)+"\" width=73 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
          }
          else
          {
            replyMSG.append("<tr><td>Position:</td><td>Doesn't exist.</td></tr>");
            replyMSG.append("<tr><td><button value=\"Give to Target\" action=\"bypass -h admin_cw_add "+String.valueOf(itemId)+"\" width=99 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td></td></tr>");
          }
          replyMSG.append("</table>");
          replyMSG.append("<br>");
        }
        adminReply.replace("%cwinfo%", replyMSG.toString());
        activeChar.sendPacket(adminReply);
      }
    }
    else if (command.startsWith("admin_cw_reload"))
    {
      cwm.reload();
    }
    else
    {
      CursedWeapon cw=null;
      try
      {
        String parameter = st.nextToken();
        if (parameter.matches("[0-9]*"))
          id = Integer.parseInt(parameter);
        else
        {
          parameter = parameter.replace('_', ' ');
          for (CursedWeapon cwp : cwm.getCursedWeapons())
          {
            if (cwp.getName().toLowerCase().contains(parameter.toLowerCase()))
            {
              id=cwp.getItemId();
              break;
            }
          }
        }
        cw = cwm.getCursedWeapon(id);
        if (cw==null)
        {
          activeChar.sendMessage("Unknown cursed weapon ID.");
          return false;
        }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.