$categories = Flux::config('ShopCategories')->toArray(); if ($server->isRenewal) { $fromTables = array("{$server->charMapDatabase}.item_db_re", "{$server->charMapDatabase}.item_db2_re"); } else { $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); } $tableName = "{$server->charMapDatabase}.items"; $tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables); $shopTable = Flux::config('FluxTables.ItemShopTable'); $col = "id AS item_id, name_japanese AS item_name, type"; $sql = "SELECT {$col} FROM {$tableName} WHERE items.id = ?"; $sth = $server->connection->getStatement($sql); $sth->execute(array($itemID)); $item = $sth->fetch(); $stackable = false; if ($item && Flux::isStackableItemType($item->type)) { $stackable = true; } if ($item && count($_POST)) { $maxCost = (int) Flux::config('ItemShopMaxCost'); $maxQty = (int) Flux::config('ItemShopMaxQuantity'); $category = $params->get('category'); $shop = new Flux_ItemShop($server); $cost = (int) $params->get('cost'); $quantity = (int) $params->get('qty'); $info = trim(htmlspecialchars($params->get('info'))); $image = $files->get('image'); $useExisting = (int) $params->get('use_existing'); if (!$cost) { $errorMessage = 'You must input a credit cost greater than zero.'; } elseif ($cost > $maxCost) {
$stackable = false; $shopItemID = $params->get('id'); $shop = new Flux_ItemShop($server); $categories = Flux::config('ShopCategories')->toArray(); $item = $shop->getItem($shopItemID); if ($item) { $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); $tableName = "{$server->charMapDatabase}.items"; $tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables); $shopTable = Flux::config('FluxTables.ItemShopTable'); $col = "id AS item_id, name_japanese AS item_name, type"; $sql = "SELECT {$col} FROM {$tableName} WHERE items.id = ?"; $sth = $server->connection->getStatement($sql); $sth->execute(array($item->shop_item_nameid)); $originalItem = $sth->fetch(); if ($originalItem && Flux::isStackableItemType($originalItem->type)) { $stackable = true; } if (count($_POST)) { $maxCost = (int) Flux::config('ItemShopMaxCost'); $maxQty = (int) Flux::config('ItemShopMaxQuantity'); $category = $params->get('category'); $cost = (int) $params->get('cost'); $quantity = (int) $params->get('qty'); $info = trim($params->get('info')); $image = $files->get('image'); $useExisting = (int) $params->get('use_existing'); if (!$cost) { $errorMessage = 'Você deve colocar um custo de crédito maior que zero.'; } elseif ($cost > $maxCost) { $errorMessage = "O custo do item não pode exceder {$maxCost}.";