Example #1
0
function do_buy(&$character, $shop_basics)
{
    global $bought, $sorrys, $refresh;
    $ids = @$_REQUEST['buy_id'];
    $types = @$_REQUEST['buy_type'];
    $numbers = @$_REQUEST['buy_number'];
    $bought = 0;
    $sorrys = 0;
    if ($ids && is_array($ids) && $types && is_array($types)) {
        foreach ($ids as $key => $id) {
            $number = @$numbers[$key];
            if (!$number) {
                $number = 1;
            }
            $item = array('id' => $id, 'type' => $types[$key], 'number' => $number);
            $info = fetch_item_additional_info($item, &$character);
            if ($info['buy_price'] > 0 && $character->pay($info['buy_price'])) {
                $item['number'] = item_pickup($shop_basics['item_location_id'], $item);
                $bought += $character->pickup_item($item);
            } else {
                $sorrys += $number;
            }
            $refresh = 1;
        }
    }
}
Example #2
0
            //ignore item
        }
    } else {
        $output = $lastrow;
    }
    if (!$output) {
        //no output
        continue;
    } else {
        $id = $output["id"];
        $equiped = $output["equiped"];
        $item_type = $output["type"];
        $item_id = $output["item_id"];
        $sell_to_name = $output["sell_to"];
        $ask_price = $output["asking_price"];
        $info = fetch_item_additional_info(array('id' => $item_id, 'type' => $item_type, 'number' => 1), $character);
        $description = $info['description'];
        $sell_price = $info['sell_price'];
        $image_path = $info['image_path'];
        $skill_req = $info['skill_req'];
        $damage_mess = @$info['damage_mess'];
        $skill_need = $info['skill_need'];
        $effect = $info['effect'];
        $skill_type = $info['skill_type'];
        // start outputting a row
        print "<tr>";
        print "<td align=center valign=top><b>{$output['itemcount']}</b>x</td>";
        ?>
<td align=center valign=top><?php 
        echo makeImg($image_path);
        ?>
Example #3
0
        }
    }
} else {
    ?>
<h2><?php 
    echo $lang_shop["sold_out"];
    ?>
</h2><?php 
}
?>
</td>
<td align=center valign=top width="50%">
<?php 
if (is_array($items) && count($items) > 0) {
    foreach ($items as $item) {
        $info = fetch_item_additional_info($item, $character);
        if (in_array($item['type'], $armorItems)) {
            //FIXME-TODO: this only tested for armor ATM
            if ($info) {
                print "<form action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">\n                \t<hr><img src=\"{$info['image_path']}\"><br>";
                print "<input type=\"hidden\" name=\"buy_id[]\" value=\"{$item['id']}\">\n                \t<input type=\"hidden\" name=\"buy_type[]\" value=\"{$item['type']}\">\n                \t<input type=\"hidden\" name=\"buy_number[]\" value=\"1\">\n                \t<input type=\"hidden\" name=\"shop_id\" value=\"{$shop_id}\">\n                \t  {$info['description']}<br>\n                \t  " . $lang_shop["ac"] . " {$info['armor_class']}<br>\n                \t  <font color={$info['skill_need']}>" . $lang_shop["req"] . " {$info['skill_req']} " . $lang_def . "</font><br>\n                \t  {$info['buy_price']} " . $lang_shop["gp"] . "<br>\n                \t<input type=submit value=" . $lang_shop["purc"] . ">";
                print "</form>";
            }
        } else {
            if ($item['type'] == 'spell_items') {
                //UNTESTED, gives bad formatting
                echo "<form action=\"{$_SERVER['PHP_SELF']}\" method=\"post\"><hr><img src=\"{$info['image_path']}\"><br>";
                print "<input type=\"hidden\" name=\"buy_id[]\" value=\"{$item['id']}\">\n                \t<input type=\"hidden\" name=\"buy_type[]\" value=\"{$item['type']}\">\n                \t<input type=\"hidden\" name=\"shop_id\" value=\"{$shop_id}\">";
                echo $info['description'] . "<br>";
                echo $lang_shop["dam"];
                echo "&nbsp;";