Beispiel #1
0
  public SpecialProtection getSpecialProtectionMax(int index) {
    ServerArmorTemplate base = null;

    if (baseData instanceof ServerArmorTemplate) base = (ServerArmorTemplate) baseData;

    if (!specialProtectionLoaded) {
      if (base == null) {
        return null;
      } else {
        return base.getSpecialProtectionMax(index);
      }
    }

    if (specialProtectionAppend && base != null) {
      int baseCount = base.getSpecialProtectionCount();

      if (index < baseCount) {
        return base.getSpecialProtectionMax(index);
      }
      index -= baseCount;
    }
    final ObjectTemplate structTemplate = specialProtection.get(index).getValue();
    Preconditions.checkNotNull(structTemplate);
    final SpecialProtectionObjectTemplate param = (SpecialProtectionObjectTemplate) structTemplate;

    final SpecialProtection data = new SpecialProtection();
    data.type = param.getType();
    data.effectiveness = param.getEffectivenessMax();

    return data;
  }