コード例 #1
0
ファイル: main.php プロジェクト: RadicalLinux/faceBot
function TB_run_storagemanager($getFarm = null)
{
    global $TB_settings;
    global $AM_settings;
    //########################################################################
    // storagemanager functions
    //########################################################################
    echo "StorageManager\r\n";
    $farm = $getFarm;
    if (isset($TB_settings['SM_action']['sell']) || isset($TB_settings['SM_action']['place'])) {
        if (count($TB_settings['SM_action']['sell']) > 0) {
            SM_sell();
        }
        if (count($TB_settings['SM_action']['place']) > 0) {
            if (!isset($farm)) {
                AddLog2('TB - reloding farm');
                DoInit();
                $farm = TB_buildFarmArray();
            }
            $re = SM_place($farm);
            if (is_array($re)) {
                $farm = $re;
            }
        }
        $TB_settings['TB_needReload'] = true;
    }
    return $farm;
}
コード例 #2
0
ファイル: functions.php プロジェクト: RadicalLinux/faceBot
function SM_showFarmStats()
{
    list($level, $gold, $cash, $sizeX, $sizeY, $firstname) = explode(';', fBGetDataStore('playerinfo'));
    $xm = $sizeX - 1;
    $ym = $sizeY - 1;
    $farm = array();
    $farm = TB_buildFarmArray();
    $cPlots = 0;
    $cFree = 0;
    for ($x = 0; $x <= $xm; $x++) {
        for ($y = 0; $y <= $ym; $y++) {
            if ($farm[$x][$y]) {
                $cFree++;
            }
            $cPlots++;
        }
    }
    echo '<table style="border:none" width="100%">';
    echo '<tr>';
    echo '<td colspan="4">';
    echo 'Your farm: ' . $sizeX . ' x ' . $sizeY . '  -  ' . round($cFree / $cPlots * 100) . '% is free';
    echo '</td>';
    echo '</tr>';
    echo '</table>';
}