Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Character$AIAccessor


  }

  @Override
  protected void runImpl()
  {
    L2Character player = getClient().getActiveChar();

    if (player == null)
      return;

    if (Config.DEBUG)
      _log.fine("DEBUG "+getType()+": client: x:" + _x + " y:" + _y + " z:" + _z + " server x:" + player.getX() + " y:" + player.getY() + " z:" + player.getZ());

    if (player.getAI() != null)
      player.getAI().notifyEvent(CtrlEvent.EVT_ARRIVED_BLOCKED, new L2CharPosition(_x, _y, _z, _heading));
  }
View Full Code Here


  }

  @Override
  protected void runImpl()
  {
    L2Character activeChar = getClient().getActiveChar();

    if(activeChar == null)
      return;

    //send a ExCursedWeaponList :p
    List<Integer> list = new FastList<Integer>();
    for(int id : CursedWeaponsManager.getInstance().getCursedWeaponsIds())
    {
      list.add(id);
    }

    activeChar.sendPacket(new ExCursedWeaponList(list));
  }
View Full Code Here

        }

        if(object instanceof L2Character)
        {
          // Update the state of the L2Character object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the L2PcInstance
          L2Character obj = (L2Character) object;
          obj.getAI().describeStateToPlayer(_activeChar);
        }
      }
    }
  }
View Full Code Here

      String scheme_key = st.nextToken();
      int cost = Integer.parseInt(st.nextToken());
     
      if (cost == 0 || cost <= player.getInventory().getAdena())
      {
        L2Character target = player;
        if (targettype.equalsIgnoreCase("pet"))
          target = player.getPet();
       
        else if (target != null)
        {     
View Full Code Here

  }

  @Override
  protected void runImpl()
  {
    L2Character activeChar = getClient().getActiveChar();
    if(activeChar == null)
      return;

    final L2Summon pet = activeChar.getPet();
    if(pet == null)
      return;

    if(pet.getName() != null)
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.NAMING_YOU_CANNOT_SET_NAME_OF_THE_PET));
      return;
    }
    else if(PetNameTable.getInstance().doesPetNameExist(_name, pet.getTemplate().npcId))
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.NAMING_ALREADY_IN_USE_BY_ANOTHER_PET));
      return;
    }
    else if(_name.length() < 3 || _name.length() > 16)
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
      sm.addString("Your pet's name can be up to 16 characters.");
      // SystemMessage sm = new SystemMessage(SystemMessage.NAMING_PETNAME_UP_TO_8CHARS);
      activeChar.sendPacket(sm);
      sm = null;

      return;
    }
    else if(!PetNameTable.getInstance().isValidPetName(_name))
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.NAMING_PETNAME_CONTAINS_INVALID_CHARS));
      return;
    }

    pet.setName(_name);
    pet.broadcastPacket(new NpcInfo(pet, activeChar));
    activeChar.sendPacket(new PetInfo(pet));
    // The PetInfo packet wipes the PartySpelled (list of active spells' icons).  Re-add them
    pet.updateEffectIcons(true);

    // set the flag on the control item to say that the pet has a name
    if(pet instanceof L2PetInstance)
    {
      L2ItemInstance controlItem = pet.getOwner().getInventory().getItemByObjectId(pet.getControlItemId());

      if(controlItem != null)
      {
        controlItem.setCustomType2(1);
        controlItem.updateDatabase();
        InventoryUpdate iu = new InventoryUpdate();
        iu.addModifiedItem(controlItem);
        activeChar.sendPacket(iu);
      }
    }
  }
View Full Code Here

  }
 
  @Override
  protected void runImpl()
  {
    L2Character activeChar = getClient().getActiveChar();
    if (activeChar != null)
    {
      if (_unselect == 0)
      {
        if (activeChar.isCastingNow() && activeChar.canAbortCast())
        {
          activeChar.abortCast();
        }
        else if (activeChar.getTarget() != null)
        {
          activeChar.setTarget(null);
        }
      }
      else if (activeChar.getTarget() != null)
      {
        activeChar.setTarget(null);
      }
    }
  }
View Full Code Here

      {
        if(obj == null || !(obj instanceof L2Character))
        {
          continue;
        }
        L2Character chara = (L2Character) obj;
        chara.sendPacket(cs);
      }
      return;
    }
   
    CreatureSay cs = new CreatureSay(activeChar.getObjectId(), _type, activeChar.getName(), _text);
View Full Code Here

    FastList<L2Character> players = new FastList<L2Character>();
    Iterator<L2Character> i$ = _characterList.values().iterator();

    while(i$.hasNext())
    {
      L2Character temp = i$.next();

      if(temp instanceof L2PcInstance)
      {
        players.add(temp);
      }
View Full Code Here

      return;

    Iterator<L2Character> i$ = _characterList.values().iterator();
    while(i$.hasNext())
    {
      L2Character character = i$.next();

      if(character != null && character instanceof L2PcInstance)
      {
        L2PcInstance player = (L2PcInstance) character;
View Full Code Here

      String targettype = st.nextToken();
      String scheme_key = st.nextToken();
      int cost = Integer.parseInt(st.nextToken());
      if (cost == 0 || cost <= player.getInventory().getAdena())
      {
        L2Character target = player;
        if (targettype.equalsIgnoreCase("pet"))
          target = player.getPet();
       
        if (target != null)
        {
          for (L2Skill sk : CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key))
            if(buffer!=null)
            {
              buffer.setBusy(true);
              buffer.setCurrentMp(buffer.getMaxMp());
              buffer.setTarget(target);
              //buffer.doCast(skill);
              sk.getEffects(buffer, target,false,false,false);
              buffer.setBusy(false);
            } else
              sk.getEffects(target, target,false,false,false);
         
            //sk.getEffects(buffer, target);
         
          player.reduceAdena("NPC Buffer", cost, null, true);
       
        }else
        {
          player.sendMessage("Incorrect Target");
          // go to main menu
          NpcHtmlMessage html = new NpcHtmlMessage(1);
          html.setFile(PARENT_DIR + "menu.htm");
          sendHtmlMessage(player, html);
        }
      }
      else
      {
        player.sendMessage("Not enough adena");
        showGiveBuffsWindow(player, targettype);
      }
    }
    // handles edit schemes {skillselect, skillunselect}
    else if (currentCommand.startsWith("editscheme"))
    {
      String skill_group = st.nextToken();
      String scheme_key = null;
      try
      {
        scheme_key = st.nextToken();
      }
      catch (Exception e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
          e.printStackTrace();
      }
      showEditSchemeWindow(player, skill_group, scheme_key);
    }
    else if (currentCommand.startsWith("skill"))
    {
      String skill_group = st.nextToken();
      String scheme_key = st.nextToken();
      int skill_id = Integer.parseInt(st.nextToken());
      int level = BufferSkillsTable.getInstance().getSkillLevelById(skill_id);
      if (currentCommand.startsWith("skillselect") && !scheme_key.equalsIgnoreCase("unselected"))
      {
        if(CharSchemesTable.getInstance() != null
            && CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key)!=null
            && CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).size() < 24)
          CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).add(SkillTable.getInstance().getInfo(skill_id, level));
        else
          player.sendMessage("This scheme has reached maximun amount of buffs");
      }
      else if (currentCommand.startsWith("skillunselect") && CharSchemesTable.getInstance() != null
          && CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key)!=null)
        CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).remove(SkillTable.getInstance().getInfo(skill_id, level));
      showEditSchemeWindow(player, skill_group, scheme_key);
    }
    // manage schemes {create, delete, clear}
    else if (currentCommand.startsWith("manageschemes"))
      showManageSchemeWindow(player);
    else if (currentCommand.startsWith("createscheme"))
    {
      if(!st.hasMoreTokens()){
        player.sendMessage("Error: Specify Schema Name!");
        showManageSchemeWindow(player);
        return;
      }
     
      String name = st.nextToken();
     
      if (name.length() > 14)
      {
        player.sendMessage("Error: Scheme's name must contain up to 14 chars without any spaces");
        showManageSchemeWindow(player);
      }
      else if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).size() == 24)
      {
        player.sendMessage("Error: Maximun schemes amount reached, please delete one before creating a new one");
        showManageSchemeWindow(player);
      }
      else if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).containsKey(name))
      {
        player.sendMessage("Error: duplicate entry. Please use another name");
        showManageSchemeWindow(player);
      }
      else
      {
        if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) == null)
          CharSchemesTable.getInstance().getSchemesTable().put(player.getObjectId(), new FastMap<String, FastList<L2Skill>>(24 + 1));
        CharSchemesTable.getInstance().setScheme(player.getObjectId(), name.trim(), new FastList<L2Skill>(24 + 1));
        showManageSchemeWindow(player);
      }
    }
    // handles deletion
    else if (currentCommand.startsWith("deletescheme"))
    {
      if(!st.hasMoreTokens()){
        player.sendMessage("Error: Specify Schema Name!");
        showManageSchemeWindow(player);
        return;
      }
     
      String name = st.nextToken();
      if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).containsKey(name))
      {
        CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).remove(name);
        showManageSchemeWindow(player);
      }
    }
    // handles cleanning
    else if (currentCommand.startsWith("clearscheme"))
    {
      if(!st.hasMoreTokens()){
        player.sendMessage("Error: Specify Schema Name!");
        showManageSchemeWindow(player);
        return;
      }
     
      String name = st.nextToken();
      if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).containsKey(name))
      {
        CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).get(name).clear();
        showManageSchemeWindow(player);
      }
    }
    //predefined buffs
    else if (currentCommand.startsWith("fighterbuff") || currentCommand.startsWith("magebuff"))
    {
     
      ArrayList<L2Skill> skills_to_buff = new ArrayList<L2Skill>();
      if(currentCommand.startsWith("magebuff")){
       
        for(int skillId:PowerPakConfig.MAGE_SKILL_LIST.keySet()){
         
          L2Skill skill = SkillTable.getInstance().getInfo(skillId, PowerPakConfig.MAGE_SKILL_LIST.get(skillId));
          if(skill!=null)
          {
            skills_to_buff.add(skill);
          }
         
        }
       
      }else{
       
        for(int skillId:PowerPakConfig.FIGHTER_SKILL_LIST.keySet()){
         
          L2Skill skill = SkillTable.getInstance().getInfo(skillId, PowerPakConfig.FIGHTER_SKILL_LIST.get(skillId));
          if(skill!=null)
          {
            skills_to_buff.add(skill);
          }
         
        }
       
      }
     
     
      String targettype = "";
      if(st.hasMoreTokens())
        targettype = st.nextToken();
     
      int cost = 0;
      if(PowerPakConfig.BUFFER_PRICE>0)
        cost = PowerPakConfig.BUFFER_PRICE*skills_to_buff.size();
     
      if (cost == 0 || cost <= player.getInventory().getAdena())
      {
        L2Character target = player;
        if (targettype.equalsIgnoreCase("pet"))
          target = player.getPet();

        if (target != null)
        {
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.L2Character$AIAccessor

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.