Exemple #1
0
  @Override
  public void sendBaselines(Client destination) {

    if (destination == null || destination.getSession() == null) {
      System.out.println("NULL session");
      return;
    }

    destination.getSession().write(messageBuilder.buildBaseline3());
    destination.getSession().write(messageBuilder.buildBaseline6());
    if (destination == getClient()) {
      destination.getSession().write(messageBuilder.buildBaseline1());
      destination.getSession().write(messageBuilder.buildBaseline4());
    }
    // destination.getSession().write(messageBuilder.buildBaseline8());
    // destination.getSession().write(messageBuilder.buildBaseline9());

    if (destination != getClient()) {
      UpdatePVPStatusMessage upvpm =
          new UpdatePVPStatusMessage(
              getObjectID(),
              NGECore.getInstance()
                  .factionService
                  .calculatePvpStatus((CreatureObject) destination.getParent(), this),
              getFaction());
      destination.getSession().write(upvpm.serialize());
      UpdatePostureMessage upm = new UpdatePostureMessage(getObjectID(), getPosture());
      destination.getSession().write(upm.serialize());
    }
  }
Exemple #2
0
  public void setHealth(int health) {

    synchronized (objectMutex) {
      if (getPosture() == 13) {
        if (health > maxHealth) health = maxHealth;
        stopIncapTask();
        setIncapTask(null);
        this.health = health;
        notifyObservers(messageBuilder.buildUpdateHAMListDelta(), true);
        setPosture((byte) 0);
        setTurnRadius(1);
        setSpeedMultiplierBase(1);
        return;
      }
    }

    IoBuffer delta;
    synchronized (objectMutex) {
      if (this.health == health) return;
      if (health > maxHealth) {
        setHealth(maxHealth);
        return;
      }
      setHamListCounter(getHamListCounter() + 1);
      delta = messageBuilder.buildHealthDelta(health);

      this.health = health;
    }
    notifyObservers(delta, true);
  }
Exemple #3
0
  public void setInStealth(boolean inStealth) {
    synchronized (objectMutex) {
      this.inStealth = inStealth;
    }

    if (getClient() != null && getClient().getSession() != null) {
      getClient().getSession().write(messageBuilder.buildStealthFlagDelta(inStealth));
    }
    notifyObservers(messageBuilder.buildStealthFlagDelta(inStealth), false);
  }
Exemple #4
0
 public void removeObjectFromEquipList(SWGObject object) {
   if (object instanceof TangibleObject && equipmentList.contains(object)) {
     setEquipmentListUpdateCounter(getEquipmentListUpdateCounter() + 1);
     notifyObservers(messageBuilder.buildRemoveEquipmentDelta((TangibleObject) object), true);
     equipmentList.get().remove(object);
   }
 }
Exemple #5
0
 public void addObjectToEquipList(SWGObject object) {
   if (object instanceof TangibleObject) {
     equipmentList.get().add(object);
     setEquipmentListUpdateCounter(getEquipmentListUpdateCounter() + 1);
     notifyObservers(messageBuilder.buildAddEquipmentDelta((TangibleObject) object), true);
   }
 }
Exemple #6
0
 public void removeBuff(Buff buff) {
   synchronized (objectMutex) {
     buffList.get().remove(buff);
     setBuffListCounter(getBuffListCounter() + 1);
   }
   notifyObservers(messageBuilder.buildRemoveBuffDelta(buff), true);
 }
Exemple #7
0
  public void setIntendedTarget(long intendedTarget) {
    synchronized (objectMutex) {
      this.targetId = intendedTarget;
    }

    notifyObservers(messageBuilder.buildIntendedTargetDelta(intendedTarget), true);
  }
Exemple #8
0
  public void setDifficulty(byte difficulty) {
    synchronized (objectMutex) {
      this.difficulty = difficulty;
    }

    notifyObservers(messageBuilder.buildDifficultyDelta(difficulty), true);
  }
Exemple #9
0
 public void setMoodAnimation(String moodAnimation) {
   synchronized (objectMutex) {
     this.moodAnimation = moodAnimation;
   }
   IoBuffer moodAnimationDelta = messageBuilder.buildMoodAnimationDelta(moodAnimation);
   notifyObservers(moodAnimationDelta, true);
 }
Exemple #10
0
  public void setStationary(boolean stationary) {
    synchronized (objectMutex) {
      this.stationary = stationary;
    }

    notifyObservers(messageBuilder.buildStartPerformance(stationary), true);
  }
Exemple #11
0
  public void setLookAtTarget(long lookAtTarget) {
    synchronized (objectMutex) {
      this.lookAtTarget = lookAtTarget;
    }

    notifyObservers(messageBuilder.buildLookAtTargetDelta(lookAtTarget), true);
  }
Exemple #12
0
 public void updateBuff(Buff buff) {
   buff.updateRemovalTask();
   synchronized (objectMutex) {
     setBuffListCounter(getBuffListCounter() + 1);
     notifyObservers(messageBuilder.buildUpdateBuffDelta(buff), true);
   }
 }
Exemple #13
0
  public void setGrantedHealth(int grantedHealth) {
    synchronized (objectMutex) {
      this.grantedHealth = grantedHealth;
    }

    notifyObservers(messageBuilder.buildGrantedHealthDelta(grantedHealth), true);
  }
Exemple #14
0
 public void setCashCredits(int cashCredits) {
   synchronized (objectMutex) {
     this.cashCredits = cashCredits;
   }
   if (getClient() != null && getClient().getSession() != null) {
     getClient().getSession().write(messageBuilder.buildCashCreditsDelta(cashCredits));
   }
 }
Exemple #15
0
 public void setBankCredits(int bankCredits) {
   synchronized (objectMutex) {
     this.bankCredits = bankCredits;
   }
   if (getClient() != null && getClient().getSession() != null) {
     getClient().getSession().write(messageBuilder.buildBankCreditsDelta(bankCredits));
   }
 }
Exemple #16
0
 public void setPerformanceId(int performanceId, boolean isDance) {
   synchronized (objectMutex) {
     this.performanceId = performanceId;
   }
   getClient()
       .getSession()
       .write(messageBuilder.buildPerformanceId((isDance) ? 0 : performanceId));
 }
Exemple #17
0
 public void addBuff(Buff buff) {
   synchronized (objectMutex) {
     buffList.get().add(buff);
     setBuffListCounter(getBuffListCounter() + 1);
   }
   buff.setStartTime();
   notifyObservers(messageBuilder.buildAddBuffDelta(buff), true);
 }
Exemple #18
0
 public void addCashCredits(int amountToAdd) {
   synchronized (objectMutex) {
     this.cashCredits += amountToAdd;
   }
   if (getClient() != null && getClient().getSession() != null) {
     getClient().getSession().write(messageBuilder.buildCashCreditsDelta(cashCredits));
   }
 }
Exemple #19
0
  public void setCombatFlag(byte combatFlag) {
    synchronized (objectMutex) {
      this.combatFlag = combatFlag;
    }
    IoBuffer combatDelta = messageBuilder.buildCombatFlagDelta(combatFlag);

    notifyObservers(combatDelta, true);
  }
Exemple #20
0
  public void setTurnRadius(float turnRadius) {
    synchronized (objectMutex) {
      this.turnRadius = turnRadius;
    }
    IoBuffer turnDelta = messageBuilder.buildTurnRadiusDelta(turnRadius);

    notifyObservers(turnDelta, true);
  }
Exemple #21
0
  public void setSpeedMultiplierMod(float speedMultiplierMod) {
    synchronized (objectMutex) {
      this.speedMultiplierMod = speedMultiplierMod;
    }
    IoBuffer speedDelta = messageBuilder.buildSpeedModDelta(speedMultiplierMod);

    notifyObservers(speedDelta, true);
  }
  @Override
  public void setFaction(String faction) {
    synchronized (objectMutex) {
      this.faction = faction;
    }

    notifyObservers(messageBuilder.buildFactionDelta(faction), true);
    // updatePvpStatus();
  }
Exemple #23
0
 public void setPerformanceListenee(CreatureObject performanceListenee) {
   synchronized (objectMutex) {
     this.performanceListenee = performanceListenee;
   }
   if (getClient() != null)
     getClient()
         .getSession()
         .write(messageBuilder.buildListenToId(performanceListenee.getObjectId()));
 }
Exemple #24
0
  public void setGroupId(long groupId) {
    synchronized (objectMutex) {
      this.groupId = groupId;
    }

    IoBuffer groupIdDelta = messageBuilder.buildGroupIdDelta(groupId);

    notifyObservers(groupIdDelta, true);
  }
Exemple #25
0
  public void setWeaponId(long weaponId) {
    synchronized (objectMutex) {
      this.weaponId = weaponId;
    }

    IoBuffer weaponIdDelta = messageBuilder.buildWeaponIdDelta(weaponId);

    notifyObservers(weaponIdDelta, true);
  }
  @Override
  public void setFactionStatus(int factionStatus) {
    synchronized (objectMutex) {
      this.factionStatus = factionStatus;
    }

    notifyObservers(messageBuilder.buildFactionStatusDelta(factionStatus), true);
    // updatePvpStatus();
  }
Exemple #27
0
  public void setHeight(float height) {
    synchronized (objectMutex) {
      this.height = height;
    }

    IoBuffer heightDelta = messageBuilder.buildHeightDelta(height);

    notifyObservers(heightDelta, true);
  }
Exemple #28
0
  public void setLevel(short level) {
    synchronized (objectMutex) {
      this.level = level;
    }

    IoBuffer levelDelta = messageBuilder.buildLevelDelta(level);

    notifyObservers(levelDelta, true);
  }
Exemple #29
0
  public void setStateBitmask(long stateBitmask) {
    synchronized (objectMutex) {
      this.stateBitmask = stateBitmask;
    }

    IoBuffer stateDelta = messageBuilder.buildStateDelta(stateBitmask);

    notifyObservers(stateDelta, true);
  }
Exemple #30
0
  public void setOwnerId(long ownerId) {
    synchronized (objectMutex) {
      this.ownerId = ownerId;
    }

    setStringAttribute(
        "owner", NGECore.getInstance().objectService.getObject(ownerId).getCustomName());

    notifyObservers(messageBuilder.buildOwnerIdDelta(ownerId), true);
  }