public Shield(ShieldTemplate template) {
    super(IDFactory.getInstance().nextId(), new ShieldController(), null, null, null);

    ((ShieldController) getController()).setOwner(this);
    this.template = template;
    this.name = (template.getName() == null) ? "SHIELD" : template.getName();
    this.id = template.getId();
    setKnownlist(new SphereKnownList(this, template.getRadius() * 2));
  }
Exemple #2
0
  /**
   * @param itemId
   * @param count
   * @return Creates new Item instance. If count is greater than template maxStackCount, count value
   *     will be cut to maximum allowed This method will return null if ItemTemplate for itemId was
   *     not found.
   */
  public Item newItem(int itemId, int count) {
    ItemTemplate itemTemplate = DataManager.ITEM_DATA.getItemTemplate(itemId);
    if (itemTemplate == null) {
      log.error(
          "Item was not populated correctly. Item template is missing for item id: " + itemId);
      return null;
    }

    int maxStackCount = itemTemplate.getMaxStackCount();
    if (count > maxStackCount && maxStackCount != 0) {
      count = maxStackCount;
    }

    // TODO if Item object will contain ownerId - item can be saved to DB before return
    return new Item(aionObjectsIDFactory.nextId(), itemTemplate, count, false, 0);
  }
Exemple #3
0
 /**
  * Releases item id if item was not used by caller
  *
  * @param item
  */
 public void releaseItemId(Item item) {
   aionObjectsIDFactory.releaseId(item.getObjectId());
 }