contract AlchemyMove is AlchemyMarket {

    // 
    bool public isMovingEnable = true;

    // 
    function disableMoving() external onlyCOO {
        isMovingEnable = false;
    }

    // move data of player
    function moveAccountData(address[] accounts, bytes32[] _assets, uint256[] saleNums) external onlyCOO {
        require(isMovingEnable);

        uint256 j;
        address account;
        for (uint256 i = 0; i < accounts.length; i++) {
            account = accounts[i];
            for (j = 0; j < 8; j++) {
                assets[account][j] = _assets[j + 8*i];
            }

            accountToSaleNum[account] = saleNums[i];
        }
    }

    function moveFurnaceData(address[] accounts, uint16[] _pendingAssets, uint256[] cooldownTimes, bool[] furnaceState, uint256[] counts) external onlyCOO {
        require(isMovingEnable);

        Furnace memory _furnace;
        uint256 j;
        address account;
        for (uint256 i = 0; i < accounts.length; i++) {
            account = accounts[i];

            for (j = 0; j < 5; j++) {
                _furnace.pendingAssets[j] = _pendingAssets[j + 5*i];
            }
            _furnace.cooldownEndTime = cooldownTimes[i];
            _furnace.inSynthesization = furnaceState[i];
            _furnace.count = counts[i];

            accountsToFurnace[account] = _furnace;
        }
    }


    function movePatentData(uint16[] ids, address[] owners, uint256[] beginTimes, bool[] onsaleStates, uint256[] prices, uint256[] lastprices, uint256[] selltimes) external onlyCOO {
        require(isMovingEnable);
        
        //Patent memory _patent;
        uint16 id;
        for (uint256 i = 0; i < ids.length; i++) {
            id = ids[i];
            /*_patent.patentOwner = owners[i];
            _patent.beginTime = beginTimes[i];
            _patent.onSale = onsaleStates[i];
            _patent.price = prices[i];
            _patent.lastPrice = lastprices[i];
            _patent.sellTime = selltimes[i];*/
            patents[id] = Patent({patentOwner: owners[i], beginTime: beginTimes[i], onSale: onsaleStates[i], price: prices[i], lastPrice: lastprices[i], sellTime: selltimes[i]});
        }
    }

    function moveMarketData(uint256[] saleIds, uint64[] assetIds, uint64[] amounts, uint128[] desiredPrices, address[] sellers) external onlyCOO {
        require(isMovingEnable);
        
        SaleOrder memory _saleOrder;
        uint256 _saleId;
        for (uint256 i = 0; i < saleIds.length; i++) {
            _saleId = saleIds[i];
            _saleOrder.assetId = assetIds[i];
            _saleOrder.amount = amounts[i];
            _saleOrder.desiredPrice = desiredPrices[i];
            _saleOrder.seller = sellers[i];
            saleOrderList[_saleId] = _saleOrder;
        }
    }

    function writeNextId(uint256 _id) external onlyCOO {
        require(isMovingEnable);
        nextSaleId = _id;
    }
}
function moveAccountData(address[] accounts, bytes32[] _assets, uint256[] saleNums) external onlyCOO {
    require(isMovingEnable);

    uint256 j;
    address account;
    for (uint256 i = 0; i < accounts.length; i++) {
        account = accounts[i];
        for (j = 0; j < 8; j++) {
            assets[account][j] = _assets[j + 8*i];
        }

        accountToSaleNum[account] = saleNums[i];
    }
}

// move data of player