Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2RecipeList


    {
      if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("RecipeDestroy"))
          return;

       
      L2RecipeList rp = RecipeTable.getInstance().getRecipeList(_recipeID - 1);
      if(rp == null)
        return;

      activeChar.unregisterRecipeList(_recipeID);

      RecipeBookItemList response = new RecipeBookItemList(rp.isDwarvenRecipe(), activeChar.getMaxMp());

      if(rp.isDwarvenRecipe())
      {
        response.addRecipes(activeChar.getDwarvenRecipeBook());
      }
      else
      {
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);

      recipeList = null;
      recipeName = null;
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 void useItem(L2PlayableInstance playable, L2ItemInstance item)
  {
    if(!(playable instanceof L2PcInstance))
      return;
    L2PcInstance activeChar = (L2PcInstance) playable;
    L2RecipeList rp = RecipeTable.getInstance().getRecipeByItemId(item.getItemId());
    if(activeChar.hasRecipeList(rp.getId()))
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.RECIPE_ALREADY_REGISTERED);
      activeChar.sendPacket(sm);
      sm = null;
    }
    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);
            sm = null;
          }
          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);
            sm = null;
          }
          else
          {
            activeChar.registerDwarvenRecipeList(rp);
            activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_ADDED);
            sm.addString(item.getItemName());
            activeChar.sendPacket(sm);
            sm = null;
          }
        }
        else
        {
          SystemMessage sm = new SystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT);
          activeChar.sendPacket(sm);
          sm = null;
        }
      }
      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);
            sm = null;
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

    _activeMakers.remove(player); // TODO:  anything else 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());
View Full Code Here

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

    L2RecipeList recipeList = getValidRecipeList(player, recipeListId);

    if(recipeList == null)
      return;

    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);
      dwarfRecipes = null;
      commonRecipes = null;
      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

    }
  }

  private L2RecipeList getValidRecipeList(L2PcInstance player, int id)
  {
    L2RecipeList recipeList = RecipeTable.getInstance().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

      con = L2DatabaseFactory.getInstance().getConnection(false);
      PreparedStatement statement = con.prepareStatement("SELECT id, type FROM character_recipebook WHERE char_id=?");
      statement.setInt(1, getObjectId());
      ResultSet rset = statement.executeQuery();

      L2RecipeList recipe;
      while(rset.next())
      {
        recipe = RecipeTable.getInstance().getRecipeList(rset.getInt("id") - 1);

        if(rset.getInt("type") == 1)
View Full Code Here

TOP

Related Classes of com.l2jfrozen.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.