Example #1
0
        mysqli_query($conn, "DELETE FROM Inventory WHERE inventoryid = '{$row['inventoryid']}' AND time > 0");
        continue;
    }
    $row['price'] = getItemPrice($row['inventoryid'], 0);
    $row['sdam'] = getItemStats($row['inventoryid'], "sdam");
    $row['pdam'] = getItemStats($row['inventoryid'], "pdam");
    $row['bdam'] = getItemStats($row['inventoryid'], "bdam");
    $row['adam'] = getItemStats($row['inventoryid'], "adam");
    $row['ddam'] = getItemStats($row['inventoryid'], "ddam");
    $row['sarm'] = getItemStats($row['inventoryid'], "sarm");
    $row['parm'] = getItemStats($row['inventoryid'], "parm");
    $row['barm'] = getItemStats($row['inventoryid'], "barm");
    $row['aarm'] = getItemStats($row['inventoryid'], "aarm");
    $row['darm'] = getItemStats($row['inventoryid'], "darm");
    $row['hpreg'] = getItemStats($row['inventoryid'], "hpreg");
    $row['mpreg'] = getItemStats($row['inventoryid'], "mpreg");
    $row['itemdes'] = getItemDes($row['inventoryid'], 0, 0, 0);
    $itemlist[] = $row;
}
if (isset($_GET['order'])) {
    if ($_GET['order'] == "des") {
        usort($itemlist, 'sort_down');
    } else {
        usort($itemlist, 'sort_up');
    }
}
/*echo "<div class='parchment'><h3>Items for sale:</h3>";
echo "<table><tr><th>Prefix<br><a href='?sort=prefixname&order=up'>&#8593;</a> <a href='?sort=prefixname&order=down'>&#8595;</a></th><th>Base<br><a href='?sort=basename&order=up'>&#8593;</a> <a href='?sort=basename&order=down'>&#8595;</a></th><th>Suffix<br><a href='?sort=suffixname&order=up'>&#8593;</a> <a href='?sort=suffixname&order=down'>&#8595;</a></th><th>For Sale Until<br><a href='?sort=time&order=up'>&#8593;</a> <a href='?sort=time&order=down'>&#8595;</a></th><th>Slot<br><a href='?sort=slot&order=up'>&#8593;</a> <a href='?sort=slot&order=down'>&#8595;</a></th><th>S. Dmg<br><a href='?sort=sdam&order=up'>&#8593;</a> <a href='?sort=sdam&order=down'>&#8595;</a></th><th>P. Dmg<br><a href='?sort=pdam&order=up'>&#8593;</a> <a href='?sort=pdam&order=down'>&#8595;</a></th><th>B. Dmg<br><a href='?sort=bdam&order=up'>&#8593;</a> <a href='?sort=bdam&order=down'>&#8595;</a></th><th>S. Arm<br><a href='?sort=sarm&order=up'>&#8593;</a> <a href='?sort=sarm&order=down'>&#8595;</a></th><th>P. Arm<br><a href='?sort=parm&order=up'>&#8593;</a> <a href='?sort=parm&order=down'>&#8595;</a></th><th>B. Arm<br><a href='?sort=barm&order=up'>&#8593;</a> <a href='?sort=barm&order=down'>&#8595;</a></th><th>HP Regen<br><a href='?sort=hpreg&order=up'>&#8593;</a> <a href='?sort=hpreg&order=down'>&#8595;</a></th><th>MP Regen<br><a href='?sort=mpreg&order=up'>&#8593;</a> <a href='?sort=hpreg&order=down'>&#8595;</a></th><th>Description</th><th>Buy Item<br><a href='?sort=price&order=up'>&#8593;</a> <a href='?sort=price&order=down'>&#8595;</a></th></tr>";
foreach($itemlist as $item => $row) {
  echo "<tr><td>" . $row['prefixname'];
  if($row['prefixlevel'] > 0) { echo "(" . $row['prefixlevel'] . ")"; }
Example #2
0
    $_SESSION['notEnoughHealth'] = 1;
    header("Location: {$serverRoot}battle.php?error_reason=notEnoughHealth&attack_type=" . $attack_type);
    exit;
}
$otherUserHealth = $otherUser->getHealth();
if (!isset($_SESSION['bounty'])) {
    if ($otherUserHealth < $maxDamage + 1) {
        $_SESSION['otherNotEnoughHealth'] = 1;
        header("Location: {$serverRoot}battle.php?error_reason=otherNotEnoughHealth&attack_type=" . $attack_type);
        exit;
    }
}
$userUsedItems = User::getUsersTopItemsByStatIDsToQuantity($id, $user->getAgencySize(), "attack");
$otherUserUsedItems = User::getUsersTopItemsByStatIDsToQuantity($otherUserID, $otherUser->getAgencySize(), "defense");
$userAttack = computeStat($user->getAttack(), getItemStats($userUsedItems, "attack"), $user->getAgencySize());
$otherUserDefense = computeStat($otherUser->getDefense(), getItemStats($otherUserUsedItems, "defense"), $otherUser->getAgencySize());
$val1 = max($userAttack, $otherUserDefense);
//echo '<br />';
$val2 = min($userAttack, $otherUserDefense);
$randomVal = rand($maxDamage - 10, $maxDamage);
$winnerDemage = $randomVal;
if ($val1 != 0 || $val2 != 0) {
    $looserDemage = max(1, floor($val2 / $val1 * $randomVal));
} else {
    $looserDemage = 1;
}
$user->incrementNumAttacks();
switch ($user->getNumAttacks()) {
    case MONSTER_LEVEL_1:
        $_SESSION['monster_level'] = 1;
        User::updateAchievementRank('monster_level', $user->getID());
Example #3
0
if ($userHealth < $maxDamage + 1) {
    $_SESSION['notEnoughHealth'] = 1;
    header("Location: {$serverRoot}/battle.php");
    exit;
}
$otherUser = User::getUser($otherUserID);
$otherUserHealth = $otherUser->getHealth();
if ($otherUserHealth < $maxDamage + 1) {
    $_SESSION['otherNotEnoughHealth'] = 1;
    header("Location: {$serverRoot}/battle.php");
    exit;
}
$userUsedItems = User::getUsersTopItemsByStatIDsToQuantity($id, $user->getAgencySize(), "attack");
$otherUserUsedItems = User::getUsersTopItemsByStatIDsToQuantity($otherUserID, $otherUser->getAgencySize(), "defense");
$userAttack = computeStat($user->getAttack(), getItemStats($userUsedItems, "attack"));
$otherUserDefense = computeStat($otherUser->getDefense(), getItemStats($otherUserUsedItems, "defense"));
$healthLoss = -15;
if ($userAttack > $otherUserDefense) {
    // user wins
    $_SESSION['won'] = 'true';
    $winner = $id;
    $loser = $otherUserID;
    $expGained = rand(1, 5);
    $_SESSION['expGained'] = $expGained;
    $user->updateHealthStaminaFightsExperience($healthLoss, -1, 1, 0, $expGained);
    $otherUser->updateHealthStaminaFightsExperience($healthLoss, 0, 0, 1, 0);
} else {
    // user loses
    $_SESSION['won'] = 'false';
    $winner = $otherUserID;
    $loser = $id;