Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.L2Object


    {
      try
      {
        String val = command.substring(10);
        int recVal = Integer.parseInt(val);
        L2Object target = activeChar.getTarget();
        L2PcInstance player = null;
        if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
          return false;
        if (target instanceof L2PcInstance) {
          player = (L2PcInstance)target;
        } else {
          return false;
        }
        player.setRecomHave(recVal);
        player.sendMessage("You have been recommended by a GM");
        player.broadcastUserInfo();
      } catch (Exception e)
      {
        activeChar.sendMessage("Usage: //rec number");
      }
    }
    else if (command.startsWith("admin_setclass"))
    {
      try
      {
        String val = command.substring(15);
        int classidval = Integer.parseInt(val);
        L2Object target = activeChar.getTarget();
        L2PcInstance player = null;
        if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
          return false;
        if (target instanceof L2PcInstance)
          player = (L2PcInstance)target;
        else
          return false;
        boolean valid=false;
        for (ClassId classid: ClassId.values())
          if (classidval == classid.getId())
            valid = true;
        if (valid && (player.getClassId().getId() != classidval))
        {
          player.setClassId(classidval);
          if (!player.isSubClassActive())
            player.setBaseClass(classidval);
          String newclass = player.getTemplate().className;
          player.store();
          player.sendMessage("A GM changed your class to "+newclass);
          player.broadcastUserInfo();
          activeChar.sendMessage(player.getName()+" is a "+newclass);
        }
        activeChar.sendMessage("Usage: //setclass <valid_new_classid>");
      }
      catch (StringIndexOutOfBoundsException e)
      {
        AdminHelpPage.showHelpPage(activeChar, "charclasses.htm");
      }
    }
    else if (command.startsWith("admin_settitle"))
    {
      try
      {
        String val = command.substring(15);
        L2Object target = activeChar.getTarget();
        L2PcInstance player = null;
        if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
          return false;
        if (target instanceof L2PcInstance) {
          player = (L2PcInstance)target;
        } else {
          return false;
        }
        player.setTitle(val);
        player.sendMessage("Your title has been changed by a GM");
        player.broadcastTitleInfo();
      }
      catch (StringIndexOutOfBoundsException e)
      {   //Case of empty character title
        activeChar.sendMessage("You need to specify the new title.");
      }
    }
    else if (command.startsWith("admin_setname"))
    {
      try
      {
        String val = command.substring(14);
        L2Object target = activeChar.getTarget();
        L2PcInstance player = null;
        if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
          return false;
        if (target instanceof L2PcInstance) {
          player = (L2PcInstance)target;
        } else {
          return false;
        }
        player.setName(val);
        player.sendMessage("Your name has been changed by a GM");
        player.broadcastUserInfo();
        player.store();
      }
      catch (StringIndexOutOfBoundsException e)
      {   //Case of empty character name
        activeChar.sendMessage("Usage: //setname new_name_for_target");
      }
    }
    else if (command.startsWith("admin_setsex"))
    {
      L2Object target = activeChar.getTarget();
      L2PcInstance player = null;
      if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
        return false;
      if (target instanceof L2PcInstance) {
        player = (L2PcInstance)target;
      } else {
        return false;
      }
      player.getAppearance().setSex(player.getAppearance().getSex()? false : true);
      player.sendMessage("Your gender has been changed by a GM");
      player.broadcastUserInfo();
      player.decayMe();
      player.spawnMe(player.getX(),player.getY(),player.getZ());
    }
    else if (command.startsWith("admin_setcolor"))
    {
      try
      {
        String val          = command.substring(15);
        L2Object target     = activeChar.getTarget();
        L2PcInstance player = null;
        if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
          return false;
        if (target instanceof L2PcInstance) {
          player = (L2PcInstance)target;
        } else {
          return false;
        }
        player.getAppearance().setNameColor(Integer.decode("0x"+val));
        player.sendMessage("Your name color has been changed by a GM");
        player.broadcastUserInfo();
      }
      catch (StringIndexOutOfBoundsException e)
      {   //Case of empty color
        activeChar.sendMessage("You need to specify the new color.");
      }
    }
    else if (command.startsWith("admin_fullfood"))
    {
      L2Object target = activeChar.getTarget();
      if (target instanceof L2PetInstance)
      {
        L2PetInstance targetPet = (L2PetInstance)target;
        targetPet.setCurrentFed(targetPet.getMaxFed());
      }
View Full Code Here


  private void showCharacterInfo(L2PcInstance activeChar, L2PcInstance player)
  {
    if (player == null)
    {
      L2Object target = activeChar.getTarget();
      if (target instanceof L2PcInstance)
        player = (L2PcInstance)target;
      else
        return;
    }
View Full Code Here

    activeChar.sendPacket(adminReply);
  }

  private void setTargetKarma(L2PcInstance activeChar, int newKarma) {
    // function to change karma of selected char
    L2Object target = activeChar.getTarget();
    L2PcInstance player = null;
    if (target instanceof L2PcInstance)
      player = (L2PcInstance)target;
    else
      return;
View Full Code Here

    }
  }

  private void adminModifyCharacter(L2PcInstance activeChar, String modifications)
  {
    L2Object target = activeChar.getTarget();

    if (!(target instanceof L2PcInstance))
      return;

    L2PcInstance player = (L2PcInstance)target;
View Full Code Here

    player.spawnMe(activeChar.getX(),activeChar.getY(),activeChar.getZ());
  }

  private void editCharacter(L2PcInstance activeChar)
  {
    L2Object target = activeChar.getTarget();
    if (!(target instanceof L2PcInstance))
      return;
    L2PcInstance player = (L2PcInstance)target;
    gatherCharacterInfo(activeChar, player,"charedit.htm");
  }
View Full Code Here

  protected void runImpl()
  {
    L2PcInstance player = getClient().getActiveChar();
    if (player == null) return;

    L2Object object = L2World.getInstance().findObject(_storePlayerId);
    if (object == null || !(object instanceof L2PcInstance)) return;

    L2PcInstance storePlayer = (L2PcInstance)object;
    if (!(storePlayer.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_SELL || storePlayer.getPrivateStoreType() == L2PcInstance.STORE_PRIVATE_PACKAGE_SELL)) return;
View Full Code Here

          id = _command.substring(4, endOfId);
        else
          id = _command.substring(4);
        try
        {
          L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));

          if (_command.substring(endOfId+1).startsWith("event_participate")) L2Event.inscribePlayer(activeChar);
          else if (object != null && object instanceof L2NpcInstance && endOfId > 0 && activeChar.isInsideRadius(object, L2NpcInstance.INTERACTION_DISTANCE, false, false))
          {
            ((L2NpcInstance)object).onBypassFeedback(activeChar, _command.substring(endOfId+1));
          }
          activeChar.sendPacket(new ActionFailed());
        }
        catch (NumberFormatException nfe) {}
      }
      //  Draw a Symbol
      else if (_command.equals("menu_select?ask=-16&reply=1"))
      {
                L2Object object = activeChar.getTarget();
                if (object instanceof L2NpcInstance)
                {
                    ((L2NpcInstance) object).onBypassFeedback(activeChar, _command);
                }
      }
      else if (_command.equals("menu_select?ask=-16&reply=2"))
      {
                L2Object object = activeChar.getTarget();
                if (object instanceof L2NpcInstance)
                {
                    ((L2NpcInstance) object).onBypassFeedback(activeChar, _command);
                }
      }
      // Navigate throught Manor windows
            else if (_command.startsWith("manor_menu_select?"))
            {
              L2Object object = activeChar.getTarget();
                if (object instanceof L2NpcInstance)
                {
                    ((L2NpcInstance) object).onBypassFeedback(activeChar, _command);
                }
            }
View Full Code Here

  /**
   * @param activeChar
   */
  private void comeHere(L2PcInstance activeChar)
  {
    L2Object obj = activeChar.getTarget();
    if (obj == null) return;
    if (obj instanceof L2NpcInstance)
    {
      L2NpcInstance temp = (L2NpcInstance) obj;
      temp.setTarget(activeChar);
View Full Code Here

      return;
    }

    weaponInst.setChargedFishshot(true);
    activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false);
        L2Object oldTarget = activeChar.getTarget();
        activeChar.setTarget(activeChar);

    //activeChar.sendPacket(new SystemMessage(SystemMessage.ENABLED_SPIRITSHOT));

    MagicSkillUser MSU = new MagicSkillUser(activeChar,SKILL_IDS[grade],1,0,0);
View Full Code Here

  private void handleKill(L2PcInstance activeChar)
  {
    handleKill(activeChar, null);
  }
  private void handleKill(L2PcInstance activeChar, String player) {
    L2Object obj = activeChar.getTarget();
    L2Character target = (L2Character)obj;
    String filename = "main_menu.htm";
    if (player != null)
    {
      L2PcInstance plyr = L2World.getInstance().getPlayer(player);
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.L2Object

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.