Package l2p.gameserver.ai

Examples of l2p.gameserver.ai.L2CharacterAI


  @Override
  public L2CharacterAI getAI()
  {
    if(_ai == null)
    {
      _ai = new L2CharacterAI(this);
    }
    return _ai;
  }
View Full Code Here


  @Override
  public final int getHeading()
  {
    if(isAttackingNow() || isCastingNow())
    {
      L2CharacterAI ai = getAI();
      if(ai != null)
      {
        L2Character target = ai.getAttackTarget();
        if(target != null)
        {
          setHeading(target, true);
        }
      }
View Full Code Here

  @Override
  public L2CharacterAI getAI()
  {
    if(_ai == null)
    {
      _ai = new L2CharacterAI(this);
    }
    return _ai;
  }
View Full Code Here

        if(!target.isCharacter())
        {
          activeChar.sendMessage("target is not a character");
          return false;
        }
        L2CharacterAI ai = target.getAI();
        if(ai == null)
        {
          activeChar.sendMessage("ai == null");
          return false;
        }
        L2Character actor = ai.getActor();
        if(actor == null)
        {
          activeChar.sendMessage("actor == null");
          return false;
        }
        activeChar.sendMessage("actor: " + actor);
        break;
      case admin_find_broken_ai:
        for(L2NpcInstance npc : L2ObjectsStorage.getAllNpcsForIterate())
        {
          if(npc.getAI().getActor() != npc)
          {
            activeChar.sendMessage("type 1");
            activeChar.teleToLocation(npc.getLoc());
            return true;
          }
          else if(!npc.isVisible())
          {
            L2WorldRegion region = L2World.getRegion(npc);
            if(region != null && region.getNpcsList(new GArray<L2NpcInstance>(region.getObjectsSize()), 0, npc.getReflection().getId()).contains(npc))
            {
              activeChar.sendMessage("type 2");
              activeChar.teleToLocation(npc.getLoc());
              return true;
            }
            L2WorldRegion currentRegion = npc.getCurrentRegion();
            if(currentRegion != null)
            {
              activeChar.sendMessage("type 3");
              activeChar.teleToLocation(npc.getLoc());
              return true;
            }
          }
          else if(npc.isDead())
          {
            for(AggroInfo aggro : npc.getAggroMap().values())
            {
              if(aggro.damage > 0 && aggro.hate == 0 && aggro.attacker != null && !aggro.attacker.isDead())
              {
                activeChar.sendMessage("type 4");
                activeChar.teleToLocation(npc.getLoc());
                return true;
              }
            }
          }
        }
        break;
      case admin_setvar:
        if(wordList.length != 3)
        {
          activeChar.sendMessage("Incorrect argument count!!!");
          return false;
        }
        ServerVariables.set(wordList[1], wordList[2]);
        activeChar.sendMessage("Value changed.");
        break;
      case admin_set_ai_interval:
        if(wordList.length != 2)
        {
          activeChar.sendMessage("Incorrect argument count!!!");
          return false;
        }
        int interval = Integer.parseInt(wordList[1]);
        int count = 0;
        int count2 = 0;
        for(final L2NpcInstance npc : L2ObjectsStorage.getAllNpcsForIterate())
        {
          if(npc == null || npc instanceof L2RaidBossInstance)
          {
            continue;
          }
          final L2CharacterAI char_ai = npc.getAI();
          if(char_ai instanceof DefaultAI)
          {
            try
            {
              final java.lang.reflect.Field field = l2p.gameserver.ai.DefaultAI.class.getDeclaredField("AI_TASK_DELAY");
              field.setAccessible(true);
              field.set(char_ai, interval);
              if(char_ai.isActive())
              {
                char_ai.stopAITask();
                char_ai.teleportHome(true);
                count++;
                L2WorldRegion region = npc.getCurrentRegion();
                if(region != null && !region.areNeighborsEmpty())
                {
                  char_ai.startAITask();
                  count2++;
                }
              }
            }
            catch(Exception e)
View Full Code Here

                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (_ai == null) {
                    _ai = new L2CharacterAI(this);
                }
            }
        } finally {
            getAiLock.unlock();
        }
View Full Code Here

    {
      yy = 0;
      for(int y = 179280; y >= 178530; y -= 125)
      {
        L2NpcInstance newNpc = addSpawnToInstance(SC, new Location(x, y, -6115, 16215), 0, world.instanceId);
        newNpc.setAI(new L2CharacterAI(newNpc));
        if(templist[yy][xx] == 0)
        {
          newNpc.setBusy(true); // Используется здесь для определения "ненастощих" статуй.
          newNpc.addStatFunc(new FuncMul(Stats.MAGIC_DEFENCE, 0x30, this, 1000));
          newNpc.addStatFunc(new FuncMul(Stats.POWER_DEFENCE, 0x30, this, 1000));
View Full Code Here

    }
    if(deactivateAI && object.isNpc())
    {
      L2NpcInstance npc = (L2NpcInstance) object;
      L2WorldRegion region = npc.getCurrentRegion();
      L2CharacterAI ai = npc.getAI();
      if(ai instanceof DefaultAI && ai.isActive() && !ai.isGlobalAI() && (region == null || region.areNeighborsEmpty()))
      {
        npc.setTarget(null);
        npc.stopMove();
        npc.getAI().stopAITask();
      }
View Full Code Here

TOP

Related Classes of l2p.gameserver.ai.L2CharacterAI

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.