Ejemplo n.º 1
0
 public static CraftSystem.DisplayRecipe CraftToDisplayRecipe(CraftSystem.CraftingRecipe xThisRecipe, PlayerView xLocalPlayer)
 {
     CraftSystem.DisplayRecipe xEntry = null;
     int iTotal = 0;
     int iHave = 0;
     bool bHaveSeenAny = false;
     bool bHaveSeenAll = true;
     foreach (KeyValuePair<ItemDescription, ushort> kvp in xThisRecipe.dxiIngredientList)
     {
         iTotal += (int)kvp.Value;
         int iHaveOfThis = xLocalPlayer.xInventory.GetAmount(kvp.Key.enType);
         if (iHaveOfThis > (int)kvp.Value)
         {
             iHaveOfThis = (int)kvp.Value;
         }
         iHave += iHaveOfThis;
         if (iHaveOfThis == 0 && !xLocalPlayer.xInventory.denxInventory.ContainsKey(kvp.Key.enType))
         {
             bHaveSeenAll = false;
         }
         else
         {
             bHaveSeenAny = true;
         }
     }
     float fCompleteness = (float)iHave / (float)iTotal;
     if (bHaveSeenAny || fCompleteness > 0f)
     {
         xEntry = new CraftSystem.DisplayRecipe(xThisRecipe, fCompleteness);
         xEntry.bAllIngredientsKnown = bHaveSeenAll;
         foreach (ItemDescription xID in xThisRecipe.dxiIngredientList.Keys)
         {
             xEntry.lxIngredientsAsList.Add(xID);
         }
     }
     return xEntry;
 }
Ejemplo n.º 2
0
 public DisplayRecipe(CraftSystem.CraftingRecipe p_xRecipe, float p_fFinishPercentage)
 {
     this.xRecipe = p_xRecipe;
     this.fFinishPercentage = p_fFinishPercentage;
 }