function sellCoins($coins) { $value = 0; foreach ($coins as $coin) { $value += sell(intval($coin)); } return $value; }
// Town functions. if ($do[0] == "inn") { include 'towns.php'; inn(); } elseif ($do[0] == "buy") { include 'towns.php'; buy(); } elseif ($do[0] == "buy2") { include 'towns.php'; buy2($do[1]); } elseif ($do[0] == "buy3") { include 'towns.php'; buy3($do[1]); } elseif ($do[0] == "sell") { include 'towns.php'; sell(); } elseif ($do[0] == "maps") { include 'towns.php'; maps(); } elseif ($do[0] == "maps2") { include 'towns.php'; maps2($do[1]); } elseif ($do[0] == "maps3") { include 'towns.php'; maps3($do[1]); } elseif ($do[0] == "gotown") { include 'towns.php'; travelto($do[1]); } elseif ($do[0] == "move") { include 'explore.php'; move();
} } $trader = $_SESSION['user_id']; if (loggedin()) { if (isset($_POST['scrip_sell']) && isset($_POST['qty'])) { $id = $_POST['scrip_sell']; // id of the scrip for buy request $qty = $_POST['qty']; // qty requested $query_t = "SELECT * FROM `{$trader}` WHERE `scrip_id` = '{$id}'"; $query_t_run = mysql_query($query_t); if ($query_t_rows = mysql_num_rows($query_t_run)) { $query_price = "SELECT `current_price` FROM `ltp` WHERE `id`='{$id}'"; // price of the scrip for buy request $query_price_run = mysql_query($query_price); while ($row = mysql_fetch_assoc($query_price_run)) { $price = $row['current_price']; } echo $price; sell($price, $qty, $id, $trader); //buy function for the id } else { echo 'You don\'t have this scrip in your portfolio. Go to <a href="portfolio.php">Portfolio</a> and check your holdings.'; } } } else { echo 'You need to log in to transact'; } ?>
$title = "{$server},{$user},{$attack_time_left}"; attack_mail($title); } else { if ($attack_time_left < 0 && $beacon == 1) { $sql = "update accounts set beacon = 0 where id = {$account}"; if (!mysql_query($sql)) { die(mysql_error()); } } } if ($server == "s4.travian.com" && $user == "flock") { if (max($wood, $brick, $iron) > $warehouse_capacity * 0.9 && min($wood, $brick, $iron) > $warehouse_capacity * 0.5 && $crop > 75000) { $reserve = round(min($wood / 100, $brick / 130, $iron / 55, $crop / 30) / 2); build_infantry(1, $reserve); if ($iron > $brick * 2) { sell(3000, 3, 3000, 2, 8, 9000); } } if ($attack_time_left >= 0) { build_infantry(1, 0); } } else { if ($server == "s4.travian.com" && $user == "futaba") { /* if($wood <= $brick && $wood <= $iron) sell(500, 4, 500, 1, 4, 3000); else if($brick <= $wood && $brick <= $iron) sell(500, 4, 500, 2, 4, 3000); else sell(500, 4, 500, 3, 4, 3000); */
function sell_for_crop($ratio, $reserve, $reserve_carts) { global $wood, $brick, $iron, $cart_capacity, $redundant_resource; if ($redundant_resource == 0) { if ($wood >= $brick && $wood >= $iron && $wood >= $reserve + $cart_capacity) { $x = 1; } else { if ($brick >= $wood && $brick >= $iron && $brick >= $reserve + $cart_capacity) { $x = 2; } else { if ($iron >= $wood && $iron >= $brick && $iron >= $reserve + $cart_capacity) { $x = 3; } else { return; } } } } else { if ($redundant_resource == 1 && $wood >= $reserve + $cart_capacity) { $x = 1; } else { if ($redundant_resource == 2 && $brick >= $reserve + $cart_capacity) { $x = 2; } else { if ($redundant_resource == 3 && $iron >= $reserve + $cart_capacity) { $x = 3; } else { if ($redundant_resource == 4) { if ($wood >= $brick && $wood >= $reserve + $cart_capacity) { $x = 1; } else { if ($brick >= $wood && $brick >= $reserve + $cart_capacity) { $x = 2; } else { return; } } } else { if ($redundant_resource == 5) { if ($wood >= $iron && $wood >= $reserve + $cart_capacity) { $x = 1; } else { if ($iron >= $wood && $iron >= $reserve + $cart_capacity) { $x = 3; } else { return; } } } else { if ($redundant_resource == 6) { if ($brick >= $iron && $brick >= $reserve + $cart_capacity) { $x = 2; } else { if ($iron >= $brick && $iron >= $reserve + $cart_capacity) { $x = 3; } else { return; } } } else { return; } } } } } } } sell($cart_capacity * 2, $x, $cart_capacity * $ratio * 2, 4, $reserve_carts, $reserve); }