Package com.l2client.component

Examples of com.l2client.component.TargetComponent


    final Entity ent = em.createEntity(e.getObjectId());
    PositioningComponent pos = new PositioningComponent();
    L2JComponent l2j = new L2JComponent();
    VisualComponent vis = new VisualComponent();
    EnvironmentComponent env = new EnvironmentComponent();
    TargetComponent tgt = new TargetComponent();
    LoggingComponent log = new LoggingComponent();
   
    em.addComponent(ent.getId(), env);
    em.addComponent(ent.getId(), l2j);
    em.addComponent(ent.getId(), pos);   
View Full Code Here


    int id = singles.getClientFacade().getCharHandler().getSelectedObjectId();
    ArrayList<Component> comps = singles.getEntityManager().getComponents(id);
    for(Component  comp :comps){
      System.out.println("-"+comp.toString());
      if(comp instanceof TargetComponent){
        TargetComponent tgt = (TargetComponent) comp;
        if(tgt.hasTarget()){
          ArrayList<Component> comps2 = singles.getEntityManager().getComponents(tgt.getCurrentTarget());
          for(Component  comp2 : comps2){
            System.out.println("---tgt-"+comp2.toString());
          }
        }
      }
View Full Code Here

    int id = readD();
    int color = readH();
    //writeD(0x00);
    EntityManager em = Singleton.get().getEntityManager();
    int pID = _client.getCharHandler().getSelectedObjectId();
    TargetComponent tc = (TargetComponent) em.getComponent(pID, TargetComponent.class);
    if(tc != null){
      tc.setTarget(id);
      tc.color = toColorRGBA(color);
    }
    PositioningComponent pcpos = (PositioningComponent) em.getComponent(pID, PositioningComponent.class);
    PositioningComponent npcpos = (PositioningComponent) em.getComponent(id, PositioningComponent.class);
    if(pcpos != null && npcpos != null){
View Full Code Here

//    readD();//x
//    readD();//y
//    readD();//z
//    readD();//0x00
    EntityManager em = Singleton.get().getEntityManager();
    TargetComponent tc = (TargetComponent) em.getComponent(id, TargetComponent.class);
    tc.setTarget(TargetComponent.NO_TARGET);
    tc.color = null;
    EnvironmentComponent env = (EnvironmentComponent) em.getComponent(id, EnvironmentComponent.class);
    if (env != null){
      env.changed = true;
    }else
View Full Code Here

    int whoAttacked = readD();
    log.finer("AUTOATTACK STARTED by+"+whoAttacked);
    //face at target
    EntityManager em = Singleton.get().getEntityManager();
    PositioningComponent pcpos = (PositioningComponent) em.getComponent(whoAttacked, PositioningComponent.class);
    TargetComponent tc = (TargetComponent) em.getComponent(whoAttacked, TargetComponent.class);
    PositioningComponent npcpos = null;
    if(tc!=null && tc.hasTarget()) {
      log.finer("AUTOATTACK STARTED by+"+whoAttacked+" target comp :"+tc.getCurrentTarget());
      npcpos = (PositioningComponent) em.getComponent(tc.getCurrentTarget(), PositioningComponent.class);

      if(pcpos != null && npcpos != null){
        pcpos.targetHeading = PositioningSystem.getHeading(pcpos.position, npcpos.position);
System.out.println("AutoAttackStart: Set heading for "+whoAttacked+" to "+pcpos.targetHeading+" looking at "+tc.getCurrentTarget());       
      }
    }
    //start default attack animation
    Singleton.get().getAnimSystem().callAction(CallActions.DefaultAttack, whoAttacked);
  }
View Full Code Here

    int pID = _client.getCharHandler().getSelectedObjectId();
    if(id != pID){
      //TODO what should we do in this message which just says id starts targeting tgt
      _client.getChatHandler().receiveMessage(id,0 /*all*/,Integer.toString(id),"I see you baggard! <"+target+">");
      EntityManager em = Singleton.get().getEntityManager();
      TargetComponent tc = (TargetComponent) em.getComponent(id, TargetComponent.class);
      if(tc != null){
        tc.setTarget(target);
      }
      PositioningComponent pcpos = (PositioningComponent) em.getComponent(target, PositioningComponent.class);
      PositioningComponent npcpos = (PositioningComponent) em.getComponent(id, PositioningComponent.class);
      if(pcpos != null && npcpos != null){
        //pcpos.targetHeading = PositioningSystem.getHeading(pcpos.position, npcpos.position);
View Full Code Here

   
  }

  public boolean setPlayerNoTarget(){
    if(data != null)//this is null when user just closes app while not logged in at all
      TargetComponent tc = (TargetComponent) Singleton.get().getEntityManager().getComponent(data.getObjectId(), TargetComponent.class);
        if(tc != null){
          if(tc.hasTarget()){
            tc.setTarget(TargetComponent.NO_TARGET);
            logger.info(data.getObjectId()+" Player target set to no target charID:"+data.getCharId());
            return true;
          }
        }
      }
View Full Code Here

      //player died
      int playerId = _client.getCharHandler().getSelectedObjectId();
        if(id == playerId) {
          Singleton.get().getGuiController().displayReviveJPanel(whereTo, null);
        } else { //target died?
          TargetComponent tgt = (TargetComponent) ent.getComponent(playerId, TargetComponent.class);
          if(tgt.getCurrentTarget() == id){
            //remove it and signla env change
            tgt.setNoTarget();
            EnvironmentComponent env = (EnvironmentComponent) ent.getComponent(playerId, EnvironmentComponent.class);
            env.changed = true;
           
          }
        }
View Full Code Here

  @Override
  public void onAction(String name, boolean isPressed, float tpf) {
//    // only execute on button/key release
    if (!isPressed) {
      ClientFacade f = Singleton.get().getClientFacade();
      TargetComponent com = (TargetComponent) Singleton.get().getEntityManager().getComponent(f.getCharHandler().getSelectedObjectId(), TargetComponent.class);
      if(com != null){
        GameClientPacket p = new AttackRequest(com.getCurrentTarget(), com.pos.x, com.pos.y, com.pos.z, false, false);
        f.sendGamePacket(p);   
      }
    }
  }
View Full Code Here

  @Override
  public void onAction(String name, boolean isPressed, float tpf) {
    // only execute on button/key release
//    if (!isPressed) {
      ClientFacade f = Singleton.get().getClientFacade();
      TargetComponent com = (TargetComponent) Singleton.get().getEntityManager().getComponent(f.getCharHandler().getSelectedObjectId(), TargetComponent.class);
      if(com != null){
        //TODO shift click and ctrl click recognition
        GameClientPacket p = new RequestMagicSkillUse(id, false, false);
        f.sendGamePacket(p);   
      }
View Full Code Here

TOP

Related Classes of com.l2client.component.TargetComponent

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.