require "constants.php";
$title = "Anathema Online - Trading";
include "index-top.php";
if ($logged_in) {
if ((getInfo(status,users,"WHERE id='$userId'") == "conscious") || (admin($user_name))) {
if (!isFighting($userId)) {
$tradeUser = $_GET['user'];
$slaves = '';
$max = numRows(users);
for ($i = 1;$i <= $max;$i++) {
$conditions = "WHERE id='$i'";
$master = getInfo(master,users,$conditions);
$NPCmaster = getInfo(NPC,users,$conditions);
if ((($master == $userId) || ($NPCmaster == $userId)) && (getInfo(status,users,"WHERE id='$i'") != "dead")) {
if (!$slaves) $slaves = getInfo(id,users,$conditions);
else $slaves .= ".".getInfo(id,users,$conditions);
}
}
if (!$slaves) if (!getInfo(master,users,"WHERE id='$userId'")) $slaves = $userId;
$conditions = "WHERE id='$userId'";
$inventory = explode('.',getInfo(inventory,users,$conditions));
$max = count($inventory);
for ($i = 0;$i < $max;$i++) {
$item = $inventory[$i];
$conditions = "WHERE id='$item'";
$type = getInfo(type,user_items,$conditions);
if (($type == "food") || ($type == "drink") || ($type == "alcohol") || (($type == "poison"))) $foods[] = $item;
if (($type == "clothing") || ($type == "weapon") || ($type == "armour")) $clothes[] = $item;
if ($type == "relic") $relics[] = $item;
if (($type == "other") || ($type == "misc") || ($type == "seal")) $other[] = $item;
if ($type == "crate") $crates[] = $item;
if ($type == "resource") $resources[] = $item;
if ($type == "material") $materials[] = $item;
if ($type == "key") $keys[] = $item;
if ($type == "door") $doors[] = $item;
if ($type == "arrows") $arrows[] = $item;
}
$places = '';
$max = numRows(places);
for ($i = 1;$i <= $max;$i++) {
$conditions = "WHERE id='$i'";
$owner = getInfo(owner,places,$conditions);
if ($owner == $userId) {
if (!$places) $places = $i;
else $places .= ".".$i;
}
}
echo '
';
echo '';
echo '';
} else {
echo '';
echo '';
echo '';
echo '';
echo '';
echo '
';
echo '';
echo '';
echo '';
echo '| ';
echo 'You are currently fighting someone.';
echo ' | ';
echo '
';
echo '';
echo '
';
echo '';
}
} else {
echo '';
echo '';
echo '';
echo '';
echo '';
echo '
';
echo '';
echo '';
echo '';
echo '| ';
echo 'You may not trade if you are tied up, unconscious or dead.';
echo ' | ';
echo '
';
echo '';
echo '
';
echo '';
}
} else {
echo '';
echo '';
echo '';
echo '';
echo '';
echo '
';
echo '';
echo '';
echo '';
echo '| ';
echo 'You must login to view this.';
echo ' | ';
echo '
';
echo '';
echo '
';
echo '';
}
include "index-bottom.php"
?>