Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.L2RecipeList


    {
      writeD(_recipes.length);//number of items in recipe book

      for (int i = 0; i < _recipes.length; i++)
      {
        L2RecipeList temp = _recipes[i];
        writeD(temp.getId());
        writeD(i+1);
      }
    }

        if (_seller.getCreateList() == null)
View Full Code Here


    }

    @Override
  protected final void writeImpl()
    {
        L2RecipeList recipe = RecipeController.getInstance().getRecipeById(_id);

        if (recipe != null)
        {
            writeC(0xD7);

            writeD(_id);
            writeD(recipe.isDwarvenRecipe() ? 0 : 1); // 0 = Dwarven - 1 = Common
            writeD((int) _activeChar.getCurrentMp());
            writeD(_activeChar.getMaxMp());
            writeD(_success ? 1 : 0); // item creation success/failed
        }
        else if (Config.DEBUG) _log.info("No recipe found with ID = " + _id);
View Full Code Here

  public void useItem(L2PlayableInstance playable, L2ItemInstance item)
  {
    if (!(playable instanceof L2PcInstance))
      return;
    L2PcInstance activeChar = (L2PcInstance)playable;
        L2RecipeList rp = RecipeController.getInstance().getRecipeByItemId(item.getItemId());
       if (activeChar.hasRecipeList(rp.getId()))
        {
         SystemMessage sm = new SystemMessage(SystemMessageId.RECIPE_ALREADY_REGISTERED);
          activeChar.sendPacket(sm);
        }
        else
        {
          if (rp.isDwarvenRecipe())
          {
            if (activeChar.hasDwarvenCraft())
            {
          if (rp.getLevel()>activeChar.getDwarvenCraft())
          {
        //can't add recipe, becouse create item level too low
              SystemMessage sm = new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER);
              activeChar.sendPacket(sm);
          }
          else if (activeChar.getDwarvenRecipeBook().length >= activeChar.GetDwarfRecipeLimit())
        {
          //Up to $s1 recipes can be registered.
          SystemMessage sm = new SystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER);
          sm.addNumber(activeChar.GetDwarfRecipeLimit());
              activeChar.sendPacket(sm);
        }
        else
          {
              activeChar.registerDwarvenRecipeList(rp);
              activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
              sm.addString("Added recipe \"" + rp.getRecipeName() + "\" to Dwarven RecipeBook");
              activeChar.sendPacket(sm);
          }
            }
            else
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT);
              activeChar.sendPacket(sm);
            }
          }
          else
          {
            if (activeChar.hasCommonCraft())
            {
          if (rp.getLevel()>activeChar.getCommonCraft())
          {
        //can't add recipe, becouse create item level too low
              SystemMessage sm = new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER);
              activeChar.sendPacket(sm);
          }
          else if (activeChar.getCommonRecipeBook().length >= activeChar.GetCommonRecipeLimit())
        {
          //Up to $s1 recipes can be registered.
          SystemMessage sm = new SystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER);
          sm.addNumber(activeChar.GetCommonRecipeLimit());
              activeChar.sendPacket(sm);
        }
        else
          {
              activeChar.registerCommonRecipeList(rp);
              activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
              sm.addString("Added recipe \"" + rp.getRecipeName() + "\" to Common RecipeBook");
              activeChar.sendPacket(sm);
          }
            }
            else
            {
View Full Code Here

    {
      writeD(_recipes.length);//number of items in recipe book

      for (int i = 0; i < _recipes.length; i++)
      {
        L2RecipeList temp = _recipes[i];
        writeD(temp.getId());
        writeD(i+1);
      }
    }
  }
View Full Code Here

  public L2RecipeList getRecipeByItemId(int itemId)
  {
    for (int i = 0; i < _lists.size(); i++)
    {
      L2RecipeList find = _lists.get(new Integer(i));
      if (find.getRecipeId() == itemId)
      {
        return find;
      }
    }
    return null;
View Full Code Here

    public L2RecipeList getRecipeById(int recId)
    {
        for (int i = 0; i < _lists.size(); i++)
        {
            L2RecipeList find = _lists.get(new Integer(i));
            if (find.getId() == recId)
            {
                return find;
            }
        }
        return null;
View Full Code Here

  }

  public synchronized void requestManufactureItem(L2PcInstance manufacturer, int recipeListId,
                                                  L2PcInstance player)
  {
    L2RecipeList recipeList = getValidRecipeList(player, recipeListId);

    if (recipeList == null) return;

    List<L2RecipeList> dwarfRecipes = Arrays.asList(manufacturer.getDwarvenRecipeBook());
    List<L2RecipeList> commonRecipes = Arrays.asList(manufacturer.getCommonRecipeBook());
View Full Code Here

    {
      player.sendPacket(new SystemMessage(SystemMessageId.CANT_CRAFT_DURING_COMBAT));
      return;
    }

    L2RecipeList recipeList = getValidRecipeList(player, recipeListId);

    if (recipeList == nullreturn;

    List<L2RecipeList> dwarfRecipes = Arrays.asList(player.getDwarvenRecipeBook());
    List<L2RecipeList> commonRecipes = Arrays.asList(player.getCommonRecipeBook());

    if (!dwarfRecipes.contains(recipeList) && !commonRecipes.contains(recipeList))
    {
      Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" sent a false recipe id.",Config.DEFAULT_PUNISH);
        return;
    }

    RecipeItemMaker maker;

    // check if already busy (possible in alt mode only)
    if (Config.ALT_GAME_CREATION && ((maker = _activeMakers.get(player)) != null))
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
      sm.addString("You are busy creating ");
      sm.addItemName(recipeList.getItemId());
      player.sendPacket(sm);
      return;
    }

    maker = new RecipeItemMaker(player, recipeList, player);
View Full Code Here

      /*String notdoneyet = */st.nextToken();

      int mpCost = Integer.parseInt(st.nextToken());
      int successRate = Integer.parseInt(st.nextToken());

      L2RecipeList recipeList = new L2RecipeList(id, level, recipeId, recipeName, successRate,
                                                 mpCost, itemId, count, isDwarvenRecipe);
      for (L2RecipeInstance recipePart : recipePartList)
      {
        recipeList.addRecipe(recipePart);
      }
      _lists.put(new Integer(_lists.size()), recipeList);
    }
    catch (Exception e)
    {
View Full Code Here

    }
  }

  private L2RecipeList getValidRecipeList(L2PcInstance player, int id)
  {
    L2RecipeList recipeList = getRecipeList(id - 1);

    if ((recipeList == null) || (recipeList.getRecipes().length == 0))
    {
      player.sendMessage("No recipe for: " + id);
      player.isInCraftMode(false);
      return null;
    }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.L2RecipeList

Copyright © 2018 www.massapicom. 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.