function drop_actions(&$character) { $location = $character->location; $ids = @$_REQUEST['drop_id']; if (!$ids || !is_array($ids) || count($ids) == 0) { return 0; } $types = $_REQUEST['drop_type']; $numbers = $_REQUEST['drop_number']; $dropped = 0; foreach ($ids as $key => $id) { $type = $types[$key]; $number = $numbers[$key]; $item = array('id' => $id, 'type' => $type, 'number' => $number); item_drop($location, $item); $dropped += $character->drop_item($item); } $character->stamina_points -= $dropped; $character->update_stamina(); return $dropped; }
<script type="text/javascript"> $(document).ready(function(){ $("#item").click(function(){ alert($("#item option:selected").next()); }); }); </script> <?php // echo $res['0']['item_price2']; function item_drop(array $res) { echo '<select id="item">'; $many = count($res); for ($i = 0; $i < $many; $i++) { echo '<option value="' . $i . '">' . $res[$i]['item_name'] . "</option>" . '<label >' . $res[$i]['item_price1'] . '</label>' . '\\n<br>'; } echo "</select>"; } function price_drop($res) { $many = count($res); for ($i = 0; $i < $many; $i++) { echo '<div value="' . $i . '">' . $res[$i]['item_name'] . "</div>" . '<label >' . $res[$i]['item_price1'] . '</label>' . '<br>'; } } item_drop($res); price_drop($res);
function item_pickup($location, $item) { $query = "select number from phaos_ground where location='{$location}' and item_id='{$item['id']}' and item_type='{$item['type']}'"; $number = fetch_value($query, __FILE__, __LINE__, __FUNCTION__); if ($item['number'] > $number) { $item['number'] = $number; } $item['number'] = -$item['number']; item_drop($location, $item); //remove drops of zero size $req = mysql_query("delete from phaos_ground where number<=0"); if (!$req) { showError(__FILE__, __LINE__, __FUNCTION__); exit; } return -$item['number']; }
while ($restock > 0 && $tries-- > 0) { $shop_refill = fetch_first("SELECT * FROM phaos_shop_refill WHERE shop_id='{$shop_id}' order by rand()*item_count_min DESC LIMIT 1", __FILE__, __LINE__); if (!$shop_refill) { break; //stop loop } if (@$inventory[$shop_refill['item_type']] >= $shop_refill['item_count_min']) { continue; //next try } defined('DEBUG') and DEBUG and $GLOBALS['debugmsgs'][] = "passed({$shop_refill['item_type']}):(" . @$inventory[$shop_refill['item_type']] . ">=" . $shop_refill['item_count_min'] . ")"; $minvalue = $shop_refill['item_value_min']; $maxvalue = (int) ($minvalue * $shop_refill['item_value_growth'] * powrand($shop_refill['item_value_growth'], $shop_refill['item_value_growth_probability'], 23)); $item = random_item($minvalue, $maxvalue, $shop_refill['item_type'], $shop_refill['item_name_like']); defined('DEBUG') and DEBUG and $GLOBALS['debugmsgs'][] = "{$item['type']}({$item['id']}) from between values ({$minvalue},{$maxvalue})"; if ($item) { item_drop($shop_basics['item_location_id'], $item); @($inventory[$item['type']] += $item['number']); $restock--; } } } //buying section do_buy($character, $shop_basics); if ($sorrys) { $sorry = $lang_shop["sorry"]; } ?>