Пример #1
0
    $players = array();
    while (list($player) = mysql_fetch_row($queryPlayers)) {
        $players[$player] = 0;
    }
    $queryItems = mysql_query("SELECT * FROM WA_Items");
    while (list($id, $name, $damage, $player, $quantity) = mysql_fetch_row($queryItems)) {
        $cost = $quantity * ($costPerItemPerDay / $numberOfChecksPerDay);
        $players[$player] += $cost;
    }
    foreach ($players as $p => $v) {
        $account = new EconAccount($p, $useMySQLiConomy, $iConTableName);
        $account->spend($v, $useMySQLiConomy, $iConTableName);
    }
    //Stored in mail box
    $queryPlayers = mysql_query("SELECT DISTINCT player FROM WA_Mail");
    $players = array();
    while (list($player) = mysql_fetch_row($queryPlayers)) {
        $players[$player] = 0;
    }
    $queryItems = mysql_query("SELECT * FROM WA_Mail");
    while (list($id, $name, $damage, $player, $quantity) = mysql_fetch_row($queryItems)) {
        $cost = $quantity * ($costPerItemPerDay / $numberOfChecksPerDay);
        $players[$player] += $cost;
    }
    foreach ($players as $p => $v) {
        $account = new EconAccount($p, $useMySQLiConomy, $iConTableName);
        $account->spend($v, $useMySQLiConomy, $iConTableName);
    }
    $next = $now + 86400 / $numberOfChecksPerDay;
    $insert = mysql_query("INSERT INTO WA_StorageCheck (time) VALUES ({$next})");
}
Пример #2
0
     $sellPrice = $sellPricePerQuantity / $sellQuantity;
 }
 if (is_numeric($sellPrice)) {
     if (is_numeric($sellQuantity) && $sellQuantity >= 0) {
         $sellQuantity = round($sellQuantity);
         if ($item->quantity >= $sellQuantity) {
             if ($isAdmin) {
                 if ($chargeAdmins) {
                     $itemFee = $item->marketprice / 100 * $auctionFee * $sellQuantity;
                 } else {
                     $itemFee = 0;
                 }
                 if ($player->money >= $itemFee) {
                     $item->changeQuantity(0 - $sellQuantity);
                     $timeNow = time();
                     $player->spend($itemFee, $useMySQLiConomy, $iConTableName);
                     $itemQuery = mysql_query("INSERT INTO WA_Auctions (name, damage, player, quantity, price, created, allowBids, currentBid, currentWinner) VALUES ('{$item->name}', '{$item->damage}', '{$item->owner}', '{$sellQuantity}', '{$sellPrice}', '{$timeNow}', '{$allowBids}', '{$minBid}', '{$item->owner}')");
                     $queryLatestAuction = mysql_query("SELECT id FROM WA_Auctions ORDER BY id DESC");
                     list($latestId) = mysql_fetch_row($queryLatestAuction);
                     if ($item->quantity == 0) {
                         $item->delete();
                     }
                     if ($useTwitter == true) {
                         try {
                             $twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
                             if ($sellQuantity == 0) {
                                 $twitQuant = "Infinite";
                             } else {
                                 $twitQuant = $sellQuantity;
                             }
                             $twitter->send('[WA] Auction Created: ' . $user . ' is selling ' . $twitQuant . ' x ' . $itemFullName . ' for ' . $currencyPrefix . $sellPrice . $currencyPostfix . ' each. At ' . date("H:i:s") . ' #webauction');
Пример #3
0
}
$toDelete = false;
$totalPrice = round($auction->price * $buyQuantity, 2);
$numberLeft = $auction->quantity - $buyQuantity;
if ($numberLeft < 0 && $auction->quantity > 0) {
    $_SESSION['error'] = $lang['purchaseItem']['too_many_quantity'];
    header("Location: ../index.php");
} else {
    if ($totalPrice < 0.01) {
        $_SESSION['error'] = $lang['purchaseItem']['too_low_minprice'];
        header("Location: ../index.php");
    }
    if ($player->money >= $totalPrice) {
        if ($user != $auction->owner) {
            $timeNow = time();
            $player->spend($totalPrice, $useMySQLiConomy, $iConTableName);
            $owner->earn($totalPrice, $useMySQLiConomy, $iConTableName);
            $alertQuery = mysql_query("INSERT INTO WA_SaleAlerts (seller, quantity, price, buyer, item) VALUES ('{$auction->owner}', '{$buyQuantity}', '{$auction->price}', '{$user}', '{$auction->fullname}')");
            if ($sendPurchaceToMail) {
                $maxStack = getItemMaxStack($auction->name, $auction->damage);
                while ($buyQuantity > $maxStack) {
                    $buyQuantity -= $maxStack;
                    $itemQuery = mysql_query("INSERT INTO WA_Mail (name, damage, player, quantity) VALUES ('{$auction->name}', '{$auction->damage}', '{$user}', '{$maxStack}')");
                    $queryLatestAuction = mysql_query("SELECT id FROM WA_Mail ORDER BY id DESC");
                    list($latestId) = mysql_fetch_row($queryLatestAuction);
                    $queryEnchantLinks = mysql_query("SELECT enchId FROM WA_EnchantLinks WHERE itemId='{$auction->id}' AND itemTableId=1");
                    while (list($enchId) = mysql_fetch_row($queryEnchantLinks)) {
                        $queryEnchants = mysql_query("SELECT * FROM WA_EnchantLinks WHERE itemId='{$auction->id}' AND itemTableId ='1'");
                        while (list($idk, $enchIdk, $tableIdk, $itemIdk) = mysql_fetch_row($queryEnchants)) {
                            $updateEnch = mysql_query("INSERT INTO WA_EnchantLinks (enchId, itemTableId, itemId) VALUES ('{$enchIdk}', '2', '{$latestId}')");
                        }