$sql = "SELECT count(*) AS total FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\t\t\t\tWHERE item_owner_id = {$user_id}\r\n\t\t\t\t\t\tAND item_name = '" . $req_item_name . "'\r\n\t\t\t\t\t\tAND item_in_warehouse = 0\r\n\t\t\t\t\t\tAND item_in_shop = 0\r\n\t\t\t\t\t\tAND item_duration > 0\r\n\t\t\t\t\t\t"; $result = $db->sql_query($sql); if (!$result) { message_die(GENERAL_ERROR, 'Could not obtain total amount of the needed item', "", __LINE__, __FILE__, $sql); } $total = $db->sql_fetchrow($result); if ($total['total'] < $items_req[$i]) { adr_previous(blacksmithing_missing_item, adr_blacksmithing, "mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); } } } // No tool if (!$tool) { adr_previous(blacksmithing_tool_needed, adr_blacksmithing, "mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); } else { $new_item_id = adr_use_skill($user_id, $tool, $recipe_id, 13, blacksmithing); if (!$new_item_id) { adr_previous(blacksmithing_failure, adr_blacksmithing, "mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); } elseif (strlen($new_item_id) > 15) { $direction = append_sid("adr_blacksmithing.{$phpEx}?mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); $new_item_id .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>"); message_die(GENERAL_MESSAGE, $new_item_id); } else { $sql = " SELECT item_name , item_price FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\t\t\t\tWHERE item_owner_id = {$user_id} \r\n\t\t\t\t\t\tAND item_in_warehouse = 0\r\n\t\t\t\t\t\tAND item_id = {$new_item_id} "; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not check user tools', "", __LINE__, __FILE__, $sql); } $new_item = $db->sql_fetchrow($result); $direction = append_sid("adr_blacksmithing.{$phpEx}?mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); $message = sprintf($lang['blacksmithing_success'], adr_get_lang($new_item['item_name']), $new_item['item_price'], get_reward_name()); $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
$sql = "SELECT count(*) AS total FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\t\t\t\tWHERE item_owner_id = {$user_id}\r\n\t\t\t\t\t\tAND item_name = '" . $req_item_name . "'\r\n\t\t\t\t\t\tAND item_in_warehouse = 0\r\n\t\t\t\t\t\tAND item_in_shop = 0\r\n\t\t\t\t\t\tAND item_duration > 0\r\n\t\t\t\t\t\t"; $result = $db->sql_query($sql); if (!$result) { message_die(GENERAL_ERROR, 'Could not obtain total amount of the needed item', "", __LINE__, __FILE__, $sql); } $total = $db->sql_fetchrow($result); if ($total['total'] < $items_req[$i]) { adr_previous(cooking_missing_item, adr_cooking, "mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); } } } // No tool if (!$tool) { adr_previous(cooking_tool_needed, adr_cooking, "mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); } else { $new_item_id = adr_use_skill($user_id, $tool, $recipe_id, 12, cooking); if (!$new_item_id) { adr_previous(cooking_failure, adr_cooking, "mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); } elseif (strlen($new_item_id) > 15) { $direction = append_sid("adr_cooking.{$phpEx}?mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); $new_item_id .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>"); message_die(GENERAL_MESSAGE, $new_item_id); } else { $sql = " SELECT item_name , item_price FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\t\t\t\tWHERE item_owner_id = {$user_id} \r\n\t\t\t\t\t\tAND item_in_warehouse = 0\r\n\t\t\t\t\t\tAND item_id = {$new_item_id} "; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not check user tools', "", __LINE__, __FILE__, $sql); } $new_item = $db->sql_fetchrow($result); $direction = append_sid("adr_cooking.{$phpEx}?mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); $message = sprintf($lang['cooking_success'], adr_get_lang($new_item['item_name']), $new_item['item_price'], get_reward_name()); $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
$sql = "SELECT count(*) AS total FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\t\t\t\tWHERE item_owner_id = {$user_id}\r\n\t\t\t\t\t\tAND item_name = '" . $req_item_name . "'\r\n\t\t\t\t\t\tAND item_in_warehouse = 0\r\n\t\t\t\t\t\tAND item_in_shop = 0\r\n\t\t\t\t\t\tAND item_duration > 0\r\n\t\t\t\t\t\t"; $result = $db->sql_query($sql); if (!$result) { message_die(GENERAL_ERROR, 'Could not obtain total amount of the needed item', "", __LINE__, __FILE__, $sql); } $total = $db->sql_fetchrow($result); if ($total['total'] < $items_req[$i]) { adr_previous(brewing_missing_item, adr_brewing, "mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); } } } // No tool if (!$tool) { adr_previous(brewing_tool_needed, adr_brewing, "mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); } else { $new_item_id = adr_use_skill($user_id, $tool, $recipe_id, 7, brewing); if (!$new_item_id) { adr_previous(brewing_failure, adr_brewing, "mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); } elseif (strlen($new_item_id) > 15) { $direction = append_sid("adr_brewing.{$phpEx}?mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); $new_item_id .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>"); message_die(GENERAL_MESSAGE, $new_item_id); } else { $sql = " SELECT item_name , item_price FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\t\t\t\tWHERE item_owner_id = {$user_id} \r\n\t\t\t\t\t\tAND item_in_warehouse = 0\r\n\t\t\t\t\t\tAND item_id = {$new_item_id} "; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not check user tools', "", __LINE__, __FILE__, $sql); } $new_item = $db->sql_fetchrow($result); $direction = append_sid("adr_brewing.{$phpEx}?mode=view&known_recipes=" . $recipe_id . "&item_tool=" . $tool . ""); $message = sprintf($lang['brewing_success'], adr_get_lang($new_item['item_name']), $new_item['item_price'], get_reward_name()); $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");