示例#1
0
 public int getMr() {
   int mr = _item.get_mdef();
   if ((getItemId() == L1ArmorId.HELMET_OF_MAGIC_RESISTANCE)
       || (getItemId() == L1ArmorId.CHAIN_MAIL_OF_MAGIC_RESISTANCE) // 抗魔法頭盔、抗魔法鏈甲
       || (getItemId() >= L1ArmorId.ELITE_PLATE_MAIL_OF_LINDVIOR
           && getItemId()
               <= L1ArmorId.ELITE_SCALE_MAIL_OF_LINDVIOR) // 林德拜爾的力量、林德拜爾的魅惑、林德拜爾的泉源、林德拜爾的霸氣
       || (getItemId() == L1ArmorId.B_HELMET_OF_MAGIC_RESISTANCE)) { // 受祝福的 抗魔法頭盔
     mr += getEnchantLevel();
   }
   if ((getItemId() == L1ArmorId.CLOAK_OF_MAGIC_RESISTANCE)
       || (getItemId() == L1ArmorId.B_CLOAK_OF_MAGIC_RESISTANCE) // 抗魔法斗篷、受祝福的 抗魔法斗篷
       || (getItemId() == L1ArmorId.C_CLOAK_OF_MAGIC_RESISTANCE) // 受咀咒的 抗魔法斗篷
       || (getItemId() == 20049)
       || (getItemId() == 20050)) { // golden and silver wing
     mr += getEnchantLevel() * 2;
   }
   // 飾品強化效果
   if (getM_Def() != 0) {
     mr += getM_Def();
   }
   return mr;
 }
示例#2
0
  /** ログに表示される形式の名前を、個数を指定して取得する。 */
  public String getNumberedName(int count) {
    StringBuilder name = new StringBuilder();

    if (isIdentified()) {
      if (getItem().getType2() == 1) { // 武器
        int attrEnchantLevel = getAttrEnchantLevel();
        if (attrEnchantLevel > 0) {
          String attrStr = null;
          switch (getAttrEnchantKind()) {
            case 1: // 地
              if (attrEnchantLevel == 1) {
                attrStr = "$6124";
              } else if (attrEnchantLevel == 2) {
                attrStr = "$6125";
              } else if (attrEnchantLevel == 3) {
                attrStr = "$6126";
              }
              break;
            case 2: // 火
              if (attrEnchantLevel == 1) {
                attrStr = "$6115";
              } else if (attrEnchantLevel == 2) {
                attrStr = "$6116";
              } else if (attrEnchantLevel == 3) {
                attrStr = "$6117";
              }
              break;
            case 4: // 水
              if (attrEnchantLevel == 1) {
                attrStr = "$6118";
              } else if (attrEnchantLevel == 2) {
                attrStr = "$6119";
              } else if (attrEnchantLevel == 3) {
                attrStr = "$6120";
              }
              break;
            case 8: // 風
              if (attrEnchantLevel == 1) {
                attrStr = "$6121";
              } else if (attrEnchantLevel == 2) {
                attrStr = "$6122";
              } else if (attrEnchantLevel == 3) {
                attrStr = "$6123";
              }
              break;
            default:
              break;
          }
          name.append(attrStr + " ");
        }
      }
      if ((getItem().getType2() == 1) || (getItem().getType2() == 2)) { // 武器・防具
        if (getEnchantLevel() >= 0) {
          name.append("+" + getEnchantLevel() + " ");
        } else if (getEnchantLevel() < 0) {
          name.append(String.valueOf(getEnchantLevel()) + " ");
        }
      }
    }
    if (isIdentified()) {
      name.append(_item.getIdentifiedNameId());
    } else {
      name.append(_item.getUnidentifiedNameId());
    }
    if (isIdentified()) {
      if (getItem().getMaxChargeCount() > 0) {
        name.append(" (" + getChargeCount() + ")");
      }
      if (getItem().getItemId() == 20383) { // 騎馬用ヘルム
        name.append(" (" + getChargeCount() + ")");
      }
      if ((getItem().getMaxUseTime() > 0) && (getItem().getType2() != 0)) { // 武器防具で使用時間制限あり
        name.append(" [" + getRemainingTime() + "]");
      }
    }

    // 旅館鑰匙
    if (getItem().getItemId() == 40312 && getKeyId() != 0) {
      name.append(getInnKeyName());
    }

    if (count > 1) {
      name.append(" (" + count + ")");
    }

    return name.toString();
  }
示例#3
0
 public int get_gfxid() {
   return _item.getGfxId();
 }
示例#4
0
 public boolean isStackable() {
   return _item.isStackable();
 }
示例#5
0
 public void setItem(L1Item item) {
   _item = item;
   _itemId = item.getItemId();
 }
示例#6
0
 public String getName() {
   return _item.getName();
 }
  private boolean makeItems(L1PcInstance pc, String npcName, int amount) {
    if (amount <= 0) {
      return false;
    }

    boolean isEnoughMaterials = true;
    for (L1ObjectAmount<Integer> material : _materials) {
      if (!pc.getInventory()
          .checkItemNotEquipped(material.getObject(), material.getAmount() * amount)) {
        L1Item temp = ItemTable.getInstance().getTemplate(material.getObject());
        pc.sendPackets(
            new S_ServerMessage(
                337,
                temp.getName()
                    + "("
                    + ((material.getAmount() * amount)
                        - pc.getInventory().countItems(temp.getItemId()))
                    + ")")); // \f1%0が不足しています。
        isEnoughMaterials = false;
      }
    }
    if (!isEnoughMaterials) {
      return false;
    }

    // 容量と重量の計算
    int countToCreate = 0; // アイテムの個数(纏まる物は1個)
    int weight = 0;

    for (L1ObjectAmount<Integer> makingItem : _items) {
      L1Item temp = ItemTable.getInstance().getTemplate(makingItem.getObject());
      if (temp.isStackable()) {
        if (!pc.getInventory().checkItem(makingItem.getObject())) {
          countToCreate += 1;
        }
      } else {
        countToCreate += makingItem.getAmount() * amount;
      }
      weight += temp.getWeight() * (makingItem.getAmount() * amount) / 1000;
    }
    // 容量確認
    if (pc.getInventory().getSize() + countToCreate > 180) {
      pc.sendPackets(new S_ServerMessage(263)); // \f1一人のキャラクターが持って歩けるアイテムは最大180個までです。
      return false;
    }
    // 重量確認
    if (pc.getMaxWeight() < pc.getInventory().getWeight() + weight) {
      pc.sendPackets(new S_ServerMessage(82)); // アイテムが重すぎて、これ以上持てません。
      return false;
    }

    for (L1ObjectAmount<Integer> material : _materials) {
      // 材料消費
      pc.getInventory().consumeItem(material.getObject(), material.getAmount() * amount);
    }

    for (L1ObjectAmount<Integer> makingItem : _items) {
      L1ItemInstance item =
          pc.getInventory().storeItem(makingItem.getObject(), makingItem.getAmount() * amount);
      if (item != null) {
        String itemName = ItemTable.getInstance().getTemplate(makingItem.getObject()).getName();
        if (makingItem.getAmount() * amount > 1) {
          itemName = itemName + " (" + makingItem.getAmount() * amount + ")";
        }
        pc.sendPackets(new S_ServerMessage(143, npcName, itemName)); // \f1%0が%1をくれました。
      }
    }
    return true;
  }