Examples of ItemTemplate


Examples of lineage2.gameserver.templates.item.ItemTemplate

        {
          fee = (price * 5) / 100;
        }
        totalFee = SafeMath.addAndCheck(totalFee, fee);
        int rewardItemId = Manor.getInstance().getRewardItem(cropId, crop.getReward());
        ItemTemplate template = ItemHolder.getInstance().getTemplate(rewardItemId);
        if (template == null)
        {
          return;
        }
        weight = SafeMath.addAndCheck(weight, SafeMath.mulAndCheck(count, template.getWeight()));
        if (!template.isStackable() || (activeChar.getInventory().getItemByItemId(cropId) == null))
        {
          slots++;
        }
      }
    }
View Full Code Here

Examples of lineage2.gameserver.templates.item.ItemTemplate

    }
    totalWeight *= _count;
    int totalCount = 0;
    for (ProductItemComponent com : product.getComponents())
    {
      ItemTemplate item = ItemHolder.getInstance().getTemplate(com.getItemId());
      if (item == null)
      {
        activeChar.sendPacket(new ExBR_BuyProduct(ExBR_BuyProduct.RESULT_WRONG_PRODUCT));
        return;
      }
      totalCount += item.isStackable() ? 1 : com.getCount() * _count;
    }
    if (!activeChar.getInventory().validateCapacity(totalCount) || !activeChar.getInventory().validateWeight(totalWeight))
    {
      activeChar.sendPacket(new ExBR_BuyProduct(ExBR_BuyProduct.RESULT_INVENTORY_FULL));
      return;
View Full Code Here

Examples of lineage2.gameserver.templates.item.ItemTemplate

    final ItemInstance weapon = getSecondaryWeaponInstance();
    if (weapon == null)
    {
      return getFistsWeaponItem();
    }
    final ItemTemplate item = weapon.getTemplate();
    if (item instanceof WeaponTemplate)
    {
      return (WeaponTemplate) item;
    }
    return null;
View Full Code Here

Examples of net.sf.joafip.performance.items.entity.ItemTemplate

      FilePersistenceClassNotFoundException,
      FilePersistenceInvalidClassException,
      FilePersistenceDataCorruptedException,
      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException {
    final ItemTemplate itemTemplate1 = new ItemTemplate(1, "template1");
    final ItemTemplate itemTemplate2 = new ItemTemplate(2, "template2");
    final ItemTemplate itemTemplate3 = new ItemTemplate(3, "template3");
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    final ItemTemplateList itemTemplateList = getItemTemplateList(session);
    itemTemplateList.addItemTemplate(itemTemplate1);
View Full Code Here

Examples of ru.webcrafter.core.entities.ItemTemplate

    public static void main(String[] args) {
        ApplicationContext applicationContext = new FileSystemXmlApplicationContext("classpath:client.xml");
        WebCrafterService service = (WebCrafterService) applicationContext.getBean("rmiProxy");

        try {
            ItemTemplate wood = service.getItemTemplate("Wood");
            if (wood == null) {
                wood = new ItemTemplate("Wood");
                service.addItemTemplate(wood);
            }
            ItemTemplate fire = service.getItemTemplate("Fire");
            if (fire == null) {
                fire = new ItemTemplate("Fire");
                service.addItemTemplate(fire);
            }
            ItemTemplate coal = service.getItemTemplate("Coal");
            if (coal == null) {
                coal = new ItemTemplate("Coal");
                service.addItemTemplate(coal);
            }
            Recipe makeWoodCoal = service.getRecipe("Coal");
            if (makeWoodCoal == null) {
                List<ItemTemplate> ingredients = new ArrayList<ItemTemplate>();
View Full Code Here

Examples of ru.webcrafter.core.entities.ItemTemplate

        service = (WebCrafterService) applicationContext.getBean("rmiProxy");
    }

    @RequestMapping("/admin")
    public String onAdminPageLoaded(Map<String, Object> map) {
        map.put("newItemTemplate", new ItemTemplate());
        map.put("newRecipe", new Recipe());

        map.put("itemTemplateList", service.getAllItemTemplates());
        map.put("recipeList", service.getAllRecipes());
View Full Code Here

Examples of ru.webcrafter.core.entities.ItemTemplate

                    break;
                }
            }
        }
        List<User> users = userDAO.getAllUsers();
        ItemTemplate itemTemplate = getItemTemplate(id);
        for (User user : users) {
            Map<String, Long> items = user.getItems();
            if (items.containsKey(itemTemplate.getId())) {
                items.remove(itemTemplate.getId());
            }
            user.setItems(items);
            updateUser(user);
        }
        itemTemplateDAO.deleteItemTemplate(id);
View Full Code Here

Examples of ru.webcrafter.core.entities.ItemTemplate

        int itemTemplatesCount = itemTemplates.size();
        Map<String, Long> items = new HashMap<String, Long>();
        if (itemTemplatesCount != 0) {
           for (int i = 0; i < itemsCount; ++i) {
               int idxItem = rnd.nextInt(itemTemplatesCount);
               ItemTemplate itemTpl = itemTemplates.get(idxItem);
               if (items.containsKey(itemTpl.getId())) {
                   items.put(itemTpl.getId(), items.get(itemTpl.getId()) + 1);
               } else {
                   items.put(itemTpl.getId(), 1L);
               }
           }
        }
        user.setItems(items);
    }
View Full Code Here

Examples of ru.webcrafter.core.entities.ItemTemplate

                items.remove(ingr.getId());
            } else {
                items.put(ingr.getId(), cnt);
            }
        }
        ItemTemplate res = recipe.getResult();
        if (items.containsKey(res.getId())) {
            items.put(res.getId(), items.get(res.getId()) + 1);
        } else {
            items.put(res.getId(), 1L);
        }
        user.setItems(items);

        updateUser(user);
View Full Code Here

Examples of ru.webcrafter.core.entities.ItemTemplate

    }

    public void userBuyItem(long id, String itemId) {
        User user = getUser(id);
        ItemTemplate itemTemplate = getItemTemplate(itemId);

        Long amount = user.getAmount();
        if (amount < itemTemplate.getCost()) {
            return;
        }
        user.setAmount(amount - itemTemplate.getCost());
        Map<String, Long> items = user.getItems();
        if (items.containsKey(itemId)) {
            items.put(itemId, items.get(itemId) + 1);
        } else {
            items.put(itemId, 1L);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.