Esempio n. 1
0
  @Override
  public String getItemStackDisplayName(ItemStack stack) {
    int type = stack.getItemDamage();
    ItemData data = new ItemData(stack);
    String s = StatCollector.translateToLocal("cc.item.needle.name");

    if (type == 0) {
      if (data.isDirty()) {
        s = StatCollector.translateToLocal("cc.dirty") + " " + s;
      } else {
        s = StatCollector.translateToLocal("cc.empty") + " " + s;
      }
    } else if (type == 1) {
      if (data.id != -1) {
        return data.getCurrentEntityNameTrans() + " " + StatCollector.translateToLocal("cc.blood");
      }
    } else if (type == 2) {
      if (data.id != -1) {
        return data.getCurrentEntityNameTrans() + " " + StatCollector.translateToLocal("cc.dna");
      }
    } else if (type == 3) {
      return "Human Stem Cells";
    }
    return s;
  }
Esempio n. 2
0
 protected int getSum() {
   int num = 0;
   for (ItemData i : groupList) {
     num += i.getWeight();
   }
   return num;
 }
 private void initData() {
   for (int i = 0; i < 20; i++) {
     ItemData d = new ItemData();
     d.iconId = R.drawable.ic_launcher;
     d.title = "title " + i;
     mAdapter.add(d);
   }
 }
Esempio n. 4
0
  public static void main(String[] args) {
    HItemData hi = null;
    try {
      byte b0 = ByteArray.b0;

      // for unit test
      int shopID = 48;
      int itemID = 51;
      byte[] rowkey = encodeRowkey(shopID, itemID);

      byte[] expected =
          new byte[] {
            b0,
            b0,
            b0,
            ByteArray.b1,
            ByteArray.bg,
            b0,
            b0,
            b0,
            b0,
            b0,
            b0,
            ByteArray.b1,
            ByteArray.bj
          };
      assert (Bytes.equals(rowkey, expected));

      String decoded = decodeRowkey(rowkey);
      assert ("48-51".equals(decoded));

      hi = new HItemData();
      ItemData id = new ItemData();
      id.shopID = 235063;
      Map<String, HCompareOp> ops = new HashMap<String, HCompareOp>();
      ops.put("shop_id", HCompareOp.EQUAL);
      HScanner<ItemData> scanner = hi.scan(id, ops);
      assert (scanner.hasNext());
      if (scanner.hasNext()) {
        System.out.println(scanner.next());
      }

      System.out.println("unit test passed");
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (hi != null) {
        hi.close();
      }
    }
  }
Esempio n. 5
0
  public boolean tryFill(
      ItemStack stackBase, World world, EntityLivingBase entity, InventoryPlayer inven) {
    // Stack to use

    if (world.isRemote) {
      return false;
    }

    ItemStack stack = stackBase;

    if (stackBase.stackSize > 1) {
      stack = stackBase.copy();
      stack.stackSize = 1;
    }

    ItemData data = new ItemData(stack);

    if (!data.isDirty() && stack.getItemDamage() == 0) {
      data.fill(entity);

      if (data.getId() != -1) {
        world.playSoundAtEntity(
            entity,
            "clonecraft:needle.extract",
            1.0F,
            1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + 0.5F);

        if (!(entity instanceof EntityPlayer)
            || !((EntityPlayer) entity).capabilities.isCreativeMode) {
          entity.attackEntityFrom(DamageSource.generic, 2.0f);
          entity.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 400));
          entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 400));
        }

        data.save(stack);
        stack.setItemDamage(1);

        if (stack != stackBase) {
          stackBase.stackSize--;

          CloneCraftHelper.addToInventory(inven, 0, 36, stack);

          if (stack.stackSize > 0) {
            CloneCraftHelper.dropAtEntity(entity, stack);
          }
        }
        return true;
      }
    }
    return false;
  }
Esempio n. 6
0
 // JAXB callback
 @SuppressWarnings("unused")
 private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
   DataManager.log.info("Loaded world maps data: " + worldMapsData.size() + " maps");
   DataManager.log.info(
       "Loaded player exp table: " + playerExperienceTable.getMaxLevel() + " levels");
   DataManager.log.info("Loaded " + playerStatsData.size() + " player stat templates");
   DataManager.log.info("Loaded " + summonStatsData.size() + " summon stat templates");
   DataManager.log.info("Loaded " + itemCleanup.size() + " item cleanup entries");
   DataManager.log.info("Loaded " + itemData.size() + " item templates");
   DataManager.log.info("Loaded " + itemGroupsData.size() + " item group templates");
   DataManager.log.info("Loaded " + npcData.size() + " npc templates");
   DataManager.log.info("Loaded " + npcShoutData.size() + " npc shout templates");
   DataManager.log.info("Loaded " + petData.size() + " pet templates");
   DataManager.log.info("Loaded " + playerInitialData.size() + " initial player templates");
   DataManager.log.info("Loaded " + tradeListData.size() + " trade lists");
   DataManager.log.info("Loaded " + teleporterData.size() + " npc teleporter templates");
   DataManager.log.info("Loaded " + teleLocationData.size() + " teleport locations");
   DataManager.log.info("Loaded " + skillData.size() + " skill templates");
   DataManager.log.info("Loaded " + motionData.size() + " motion times");
   DataManager.log.info("Loaded " + skillTreeData.size() + " skill learn entries");
   DataManager.log.info("Loaded " + cubeExpandData.size() + " cube expand entries");
   DataManager.log.info("Loaded " + warehouseExpandData.size() + " warehouse expand entries");
   DataManager.log.info("Loaded " + bindPointData.size() + " bind point entries");
   DataManager.log.info("Loaded " + questData.size() + " quest data entries");
   DataManager.log.info("Loaded " + gatherableData.size() + " gatherable entries");
   DataManager.log.info("Loaded " + titleData.size() + " title entries");
   DataManager.log.info("Loaded " + walkerData.size() + " walker routes");
   DataManager.log.info("Loaded " + zoneData.size() + " zone entries");
   DataManager.log.info("Loaded " + goodsListData.size() + " goodslist entries");
   DataManager.log.info("Loaded " + tribeRelationsData.size() + " tribe relation entries");
   DataManager.log.info("Loaded " + recipeData.size() + " recipe entries");
   DataManager.log.info("Loaded " + portalData.size() + " portal entries");
   DataManager.log.info("Loaded " + chestData.size() + " chest locations");
   DataManager.log.info("Loaded " + staticDoorData.size() + " static door locations");
   DataManager.log.info("Loaded " + itemSetData.size() + " item set entries");
   DataManager.log.info("Loaded " + npcFactionsData.size() + " npc factions");
   DataManager.log.info("Loaded " + npcSkillData.size() + " npc skill list entries");
   DataManager.log.info("Loaded " + petSkillData.size() + " pet skill list entries");
   DataManager.log.info("Loaded " + siegeLocationData.size() + " siege location entries");
   DataManager.log.info("Loaded " + flyRingData.size() + " fly ring entries");
   DataManager.log.info("Loaded " + shieldData.size() + " shield entries");
   DataManager.log.info("Loaded " + petData.size() + " pet entries");
   DataManager.log.info("Loaded " + guideData.size() + " guide entries");
   DataManager.log.info("Loaded " + roadData.size() + " road entries");
   DataManager.log.info("Loaded " + instanceCooltimeData.size() + " instance cooltime entries");
   DataManager.log.info("Loaded " + decomposableItemsData.size() + " decomposable items entries");
   DataManager.log.info("Loaded " + aiData.size() + " ai templates");
   DataManager.log.info("Loaded " + flyPath.size() + " flypath templates");
   DataManager.log.info("Loaded " + windstreamsData.size() + " windstream entries");
   DataManager.log.info("Loaded " + assembledNpcData.size() + " assembled npcs entries");
   DataManager.log.info("Loaded " + assemblyData.size() + " assembled items entries");
   DataManager.log.info("Loaded " + cosmeticItemsData.size() + " cosmetic items entries");
   DataManager.log.info("Loaded " + npcDropData.size() + " npc drop entries");
   DataManager.log.info("Loaded " + autoGroupData.size() + " auto group entries");
   DataManager.log.info("Loaded " + spawnsData2.size() + " spawn maps entries");
   DataManager.log.info("Loaded " + eventData.size() + " active events");
   DataManager.log.info("Loaded " + pvpZoneData.size() + " [Ascension]Tvt's Positions");
 }
Esempio n. 7
0
  /**
   * HBaseの一行をItemDataに変換
   *
   * @param r row in HBase
   * @return 商品情報
   */
  public ItemData toDataStore(Result r) {
    if (r == null || r.isEmpty()) {
      return null;
    }

    ItemData item = null;

    // meta family
    NavigableMap<byte[], byte[]> map = r.getFamilyMap(META_FAMILY);
    if (map != null && !map.isEmpty()) {
      item = new ItemData();

      // ctime
      byte[] bCtime = map.get(Bytes.toBytes("ctime"));
      if (bCtime != null) {
        item.ctime = Bytes.toLong(bCtime);
      }
    }

    // data family
    map = r.getFamilyMap(DATA_FAMILY);
    if (map != null && !map.isEmpty()) {
      if (item == null) {
        item = new ItemData();
      }

      // shop ID
      byte[] bShopID = map.get(Bytes.toBytes("shop_id"));
      if (bShopID != null) {
        item.shopID = Bytes.toInt(bShopID);
      }

      // item ID
      byte[] bItemID = map.get(Bytes.toBytes("item_id"));
      if (bItemID != null) {
        item.itemID = Bytes.toInt(bItemID);
      }

      // genre ID
      byte[] bGenreID = map.get(Bytes.toBytes("genre_id"));
      if (bGenreID != null) {
        item.genreID = Bytes.toInt(bGenreID);
      }

      // item name
      byte[] bItemName = map.get(Bytes.toBytes("item_name"));
      if (bItemName != null) {
        item.itemName = Bytes.toString(bItemName);
      }

      // full item url
      byte[] bFullItemUrl = map.get(Bytes.toBytes("full_item_url"));
      if (bFullItemUrl != null) {
        item.fullItemUrl = Bytes.toString(bFullItemUrl);
      }

      // price
      byte[] bPrice = map.get(Bytes.toBytes("price"));
      if (bPrice != null) {
        item.price = Bytes.toString(bPrice);
      }
    }

    if (item == null) {
      item = new ItemData();
    }
    item.rowkey = r.getRow();

    return item;
  }