'; $bonus = getInfo(bonus,users,"WHERE id='$userId'"); if (($bonus == "explorer") || (admin($user_name))) { if ($_POST['mode'] == "cook") { $name = $_POST['name']; $description = $_POST['description']; if (html($name)) $failure = "There is html in the name."; if (html_format($description)) $failure = "There is illegal html in the description."; if (!$name) $failure = "You must choose a name."; $ingredient1 = $_POST['ingredient1']; $ingredient1item = getInfo(item,user_items,"WHERE id='$ingredient1'"); $ingredient2 = $_POST['ingredient2']; $ingredient2item = getInfo(item,user_items,"WHERE id='$ingredient2'"); $ingredient3 = $_POST['ingredient3']; $ingredient3item = getInfo(item,user_items,"WHERE id='$ingredient3'"); if ((!getInfo(id,food,"WHERE item='$ingredient1item'")) && ($ingredient1)) $failure = "Ingredient 1 cannot be used in cooking."; if ((!getInfo(id,food,"WHERE item='$ingredient2item'")) && ($ingredient2)) $failure = "Ingredient 2 cannot be used in cooking."; if ((!getInfo(id,food,"WHERE item='$ingredient3item'")) && ($ingredient3)) $failure = "Ingredient 3 cannot be used in cooking."; $inventory = getInfo(inventory,users,"WHERE id='$userId'"); $inventory = explode('.',$inventory); $count = 0; if ($ingredient1) $count++; if ($ingredient2) $count++; if ($ingredient3) $count++; if ($count < 2) $failure = "You must select at least two ingredients."; if ((!inArray($ingredient1,$inventory)) && ($ingredient1)) $failure = "You are not carrying ingredient 1."; if ((!inArray($ingredient2,$inventory)) && ($ingredient2)) $failure = "You are not carrying ingredient 2."; if ((!inArray($ingredient3,$inventory)) && ($ingredient3)) $failure = "You are not carrying ingredient 3."; if (!$failure) { if (getInfo(type,user_items,"WHERE id='$ingredient1'") == "alcohol") $type = "alcohol"; elseif (getInfo(type,user_items,"WHERE id='$ingredient2'") == "alcohol") $type = "alcohol"; elseif (getInfo(type,user_items,"WHERE id='$ingredient3'") == "alcohol") $type = "alcohol"; else $type = "food"; $inventory = implode('.',$inventory); $inventory = removeElement($ingredient1,$inventory,'.'); $inventory = removeElement($ingredient2,$inventory,'.'); $inventory = removeElement($ingredient3,$inventory,'.'); $increase = getInfo(increase,food,"WHERE item='$ingredient1item'") + getInfo(increase,food,"WHERE item='$ingredient2item'") + getInfo(increase,food,"WHERE item='$ingredient3item'"); $increase += floor(getInfo(cooking,users,"WHERE id='$userId'") / 5); $increase /= 20; $increase += 1.00; if ($increase > 2) $increase = 2; $stat = (getInfo(stat,user_items,"WHERE id='$ingredient1'") * getInfo(portions,user_items,"WHERE id='$ingredient1'")) + (getInfo(stat,user_items,"WHERE id='$ingredient2'") * getInfo(portions,user_items,"WHERE id='$ingredient2'")) + (getInfo(stat,user_items,"WHERE id='$ingredient3'") * getInfo(portions,user_items,"WHERE id='$ingredient3'")); $stat = round($stat * $increase); $portions = $count; $stat = round($stat / $portions); $extras[] = getInfo(extra,items,"WHERE id='$ingredient1item'"); $extras[] = getInfo(extra,items,"WHERE id='$ingredient2item'"); $extras[] = getInfo(extra,items,"WHERE id='$ingredient3item'"); if ($ingredient1) $ingredients[] = getInfo(name,user_items,"WHERE id='$ingredient1'"); if ($ingredient2) $ingredients[] = getInfo(name,user_items,"WHERE id='$ingredient2'"); if ($ingredient3) $ingredients[] = getInfo(name,user_items,"WHERE id='$ingredient3'"); $ingredients = implode(', ',$ingredients); $description .= "

(Made of $ingredients)"; unset($ingredients); if ($extras) { $curepoison = false; $fatigue = 0; $max = count($extras); for ($i = 0;$i < $max;$i++) { $extra = explode(':',$extras[$i]); if ($extra[0] == "curepoison") $curepoison = true; if ($extra[0] == "fatigue") $fatigue = $extra[1]; } unset($extra); if ($curepoison) $extra = "curepoison"; elseif ($fatigue) $extra = "fatigue:$fatigue"; } else $extra = ""; $query = "INSERT INTO items VALUES('','$name','','$description','','$userId','$type','$stat','$portions','','','','0','','','')"; mysql_query($query); $item = numRows(items); $newItem = createItem($item); if ($inventory) $inventory .= '.'.$newItem; else $inventory = $newItem; $query = "UPDATE users SET inventory='$inventory' WHERE id='$userId'"; mysql_query($query); $cooking = getInfo(cooking,users,"WHERE id='$userId'"); $cooking++; $query = "UPDATE users SET cooking='$cooking' WHERE id='$userId'"; mysql_query($query); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Success
'; echo '
'; echo '
You have successfully cooked food.
'; echo '
'; echo '
'; } else { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Error
'; echo '
'; echo '
'.$failure.'
'; echo '
'; echo '
'; } } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Cooking
'; echo '
'; echo '
Here you may combine various ingredients found in the wild to produce meals that will heal for more than the various parts individually. You may choose up to three ingredients to combine. Different ingredients will have different effects on the overall outcome.
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Combining Ingredients
'; echo '
'; echo '
'; $inventory = getInfo(inventory,users,"WHERE id='$userId'"); $inventory = explode('.',$inventory); $max = count($inventory); for ($i = 0;$i < $max;$i++) { $item = $inventory[$i]; $record = getInfo(item,user_items,"WHERE id='$item'"); if (getInfo(id,food,"WHERE item='$record'")) $ingredients[] = $item; } $max = count($ingredients); for ($i = 0;$i < $max;$i++) { $ingredient = $ingredients[$i]; $ingredientName = getInfo(name,user_items,"WHERE id='$ingredient'"); $ingredient_list[] = ""; } $ingredient_list = implode('',$ingredient_list); echo "
"; echo "Ingredient 1:

"; echo "Ingredient 2:

"; echo "Ingredient 3:

"; echo "Name:
"; echo "Description:


"; echo ""; echo "
"; echo '
'; echo '
'; echo '
'; } else { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
Error
'; echo '
'; echo '
You must have the explorer bonus skill in order to use the cooking functions.
'; echo '
'; echo '
'; } echo ''; include "index-bottom.php" ?>