All pastes #449465 Raw Edit

phzi's eatbestfood

public text v1 · immutable
·published 2007-04-20 06:48 UTC
rendered paste body
function main()
{
   variable guidlist ItemList
   declare intI int 0
   declare LastLevel int 0
   declare LastConjured int 0
   declare BestFood int 0
   declare LastStackSize int 0
   declare FoodName string
   ItemList:Search[-items,-inventory,-food]

   echo "- Start of Food -"
   echo "Number of food: ${ItemList.Count}"

   while ${intI:Inc}<=${ItemList.Count}
   {
      FoodName:Set[${Item[${ItemList.GUID[${intI}]}].Name}]

      if ${Item[${ItemList.GUID[${intI}]}].MinLevel}>${LastLevel} && ${Item[${ItemList.GUID[${intI}]}].MinLevel}<=${Me.Level}
      {
         echo "New Best: ${intI}: ${Item[${ItemList.GUID[${intI}]}].Name} ${Item[${ItemList.GUID[${intI}]}].MinLevel}"
         LastLevel:Set[${Item[${ItemList.GUID[${intI}]}].MinLevel}]
         LastStackSize:Set[${Item[${ItemList.GUID[${intI}]}].StackCount}]
         BestFood:Set[${intI}]
         if ${FoodName.Find["Conjured"]}
         {
            LastConjured:Set[1]
         }
         else
         {
            LastConjured:Set[0]
         }
      }

      elseif ${Item[${ItemList.GUID[${intI}]}].MinLevel}==${LastLevel} && !${LastConjured} && ${FoodName.Find["Conjured"]}
      {
         echo "New Best: ${intI}: ${Item[${ItemList.GUID[${intI}]}].Name} ${Item[${ItemList.GUID[${intI}]}].MinLevel}"
         LastLevel:Set[${Item[${ItemList.GUID[${intI}]}].MinLevel}]
         LastStackSize:Set[${Item[${ItemList.GUID[${intI}]}].StackCount}]
         BestFood:Set[${intI}]
         LastConjured:Set[1]

      }
      elseif ${Item[${ItemList.GUID[${intI}]}].MinLevel}==${LastLevel} && ${LastStackSize}<${Item[${ItemList.GUID[${intI}]}].StackCount} && 

${Item[${ItemList.GUID[${intI}]}].MinLevel}<=${Me.Level} && ((${LastConjured} && ${FoodName.Find["Conjured"]}) || (!${LastConjured} && 

!${FoodName.Find["Conjured"]}))
      {
         echo "New Best: ${intI}: ${Item[${ItemList.GUID[${intI}]}].Name} ${Item[${ItemList.GUID[${intI}]}].MinLevel}"
         LastLevel:Set[${Item[${ItemList.GUID[${intI}]}].MinLevel}]
         LastStackSize:Set[${Item[${ItemList.GUID[${intI}]}].StackCount}]
         BestFood:Set[${intI}]
         if ${FoodName.Find["Conjured"]}
         {
            LastConjured:Set[1]
         }
         else
         {
            LastConjured:Set[0]
         }
      }

   }

   echo "You should eat: ${Item[${ItemList.GUID[${BestFood}]}].Name} (GUID: ${ItemList.GUID[${BestFood}]})"
   ; To Just Eat, Execute:
   ; Item[${ItemList.GUID[${BestFood}]}]:Use
   echo "- Finished -"

}