Example #1
0
function GB_renew_giftbox()
{
    $res = 0;
    //load settings
    DoInit();
    $GB_ingiftbox = unserialize(fBGetDataStore('giftbox'));
    $GB_AllStorages = load_array(GBox_storage);
    if (!$GB_AllStorages) {
        $GB_AllStorages = array();
    }
    $GB_AllStorages['have'] = unserialize(fBGetDataStore('storagedata'));
    if (is_array($GB_AllStorages['have'])) {
        save_array($GB_AllStorages, GBox_storage);
        AddLog2("GiftBox AllStorage update - saved ");
    } else {
        AddLog2("AllStorage ERROR - Not saved ");
    }
    if ($GBox_Settings['Place']) {
        // see if we can store the latest info on farm XY
        $objects = unserialize(fBGetDataStore('objects'));
        save_array($objects, GBox_XY_objects);
        AddLog2("Giftbox Objects - saved ");
        // build the map to find empty spots
        GB_buildEmptyXY();
    }
    // now update the building parts
    GB_BuiltPartBD();
    return $res;
}
Example #2
0
function save_array($elem)
{
    if (!is_array($elem)) {
        //$elem = htmlentities($elem,ENT_QUOTES,"UTF-8");
        $elem = $elem;
    } else {
        foreach ($elem as $key => $value) {
            $elem[$key] = save_array($value);
        }
    }
    return $elem;
}
Example #3
0
function TB_run()
{
    global $TB_settings;
    global $AM_settings;
    global $TB_settings_place;
    TB_loadAnimalMoverSettings();
    TB_loadSettings();
    TB_loadSections();
    $TB_settings['TB_needReload'] = false;
    $farm = null;
    $farm = TB_run_animalmanager_farmGold($farm);
    $farm = TB_run_animalmanager($farm);
    $farm = TB_run_mysterygift($farm);
    $farm = TB_run_flowermanager($farm);
    $farm = TB_run_storagemanager($farm);
    // reloding farm
    if ($TB_settings['TB_needReload']) {
        DoInit();
        $TB_settings['TB_needReload'] = false;
    }
    save_array($TB_settings, ToolBox_settings);
}
Example #4
0
/**
 *    创建系统信息文件
 *
 *    @author    Garbin
 *    @param     array $info
 *    @return    void
 */
function save_system_info($info)
{
    return save_array(ROOT_PATH . '/data/system.info.php', $info);
}
Example #5
0
 private function _fvBuyGoods()
 {
     $amfcount = 0;
     $amf = '';
     $tmpArray = array();
     $iguser = load_array('ignores.txt');
     $usedUserIds = array();
     while ($this->cBagsConsumed < $this->cDailyPurch) {
         foreach ($this->availGoods as $aGoods) {
             $uid = number_format($aGoods['uid'], 0, '', '');
             if (fBGetNeighborRealName($uid) === false) {
                 continue;
             }
             if (isset($iguser[$uid])) {
                 continue;
             }
             if (@$this->cConsumed[$uid] >= $this->cDailyBags) {
                 if ($this->settings['debug'] == 1) {
                     AddLog2("Buy from " . $uid . " result: Maximum Goods Consumed");
                 }
                 continue;
             }
             foreach ($aGoods['in'] as $aInvent) {
                 if (isset($usedUserIds[$uid])) {
                     break;
                 }
                 $code = $aInvent['ic'];
                 $cost = $aInvent['pr'];
                 $amf = $this->_fvCreateMultAMFRequest($amf, $amfcount, '', 'CraftingService.onBuyCraftedGoods');
                 $amf->_bodys[0]->_value[1][$amfcount]['params'][0][0]['itemCode'] = trim($code);
                 $amf->_bodys[0]->_value[1][$amfcount]['params'][0][0]['priceOffered'] = $cost;
                 $amf->_bodys[0]->_value[1][$amfcount]['params'][0][0]['sellingUserId'] = trim($uid);
                 $tmpArray[$amfcount]['uid'] = $uid;
                 $tmpArray[$amfcount]['code'] = $code;
                 $amf2 = $this->_fvAMFSend($amf);
                 $amf = '';
                 $amfcount = 0;
                 if ($amf2 === false) {
                     continue;
                 }
                 foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) {
                     $resp2 = $returned['data']['buyResponse']['buyResults'][0]['code'];
                     if ($resp2 == 1 || $resp2 == 2 || $resp2 == 12) {
                         $iguser = load_array('ignores.txt');
                         $iguser[$tmpArray[$key]['uid']] = $tmpArray[$key]['uid'];
                         save_array($iguser, 'ignores.txt');
                     }
                     if ($resp2 == 0) {
                         $item = $this->fvGetUnits($tmpArray[$key]['code']);
                         AddLog2("Buy " . $item['units_realname'] . " from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCGoods[$resp2]);
                         $usedUserIds[$uid] = 1;
                         $this->cBagsConsumed++;
                         break;
                     } else {
                         if ($this->settings['debug'] == 1) {
                             AddLog2("Buy from {$uid} result: " . $this->zErrCGoods[$resp2]);
                         }
                     }
                 }
             }
         }
         break;
     }
     if ($amf != '') {
         $amf2 = $this->_fvAMFSend($amf);
         if ($amf2 !== false) {
             foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) {
                 $resp2 = $returned['data']['buyResponse']['code'];
                 if ($resp2 == 1 || $resp2 == 2 || $resp2 == 12) {
                     $iguser = load_array('ignores.txt');
                     $iguser[$tmpArray[$key]['uid']] = $tmpArray[$key]['uid'];
                     save_array($iguser, 'ignores.txt');
                 }
                 if ($resp2 == 0) {
                     $item = $this->fvGetUnits($tmpArray[$key]['code']);
                     AddLog2("Buy " . $item['units_realname'] . " from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCGoods[$resp2]);
                 } else {
                     if ($this->settings['debug'] == 1) {
                         AddLog2("Buy from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCGoods[$resp2]);
                     }
                 }
             }
         }
     }
 }
Example #6
0
            $Grifter_settings['fruitstand'] = $_GET['fruitstand'];
            $Grifter_settings['resttent'] = $_GET['resttent'];
            $Grifter_settings['woodpile'] = $_GET['woodpile'];
            $Grifter_settings['haybale'] = $_GET['haybale'];
            $Grifter_settings['schoolhouse'] = $_GET['schoolhouse'];
            $Grifter_settings['engineer'] = $_GET['engineer'];
            $Grifter_settings['pheasant'] = $_GET['pheasant'];
            $Grifter_settings['beltedcow'] = $_GET['beltedcow'];
            $Grifter_settings['goat'] = $_GET['goat'];
            $Grifter_settings['saddleback'] = $_GET['saddleback'];
            $Grifter_settings['windmill'] = $_GET['windmill'];
            $Grifter_settings['cowsilo'] = $_GET['cowsilo'];
        }
    }
}
save_array($Grifter_settings, Grifter_settings);
?>

<html>
<head>
<link rel="stylesheet" type="text/css" href="Grifter.css" />
</head>
<body>
<script type='text/javascript'>	
			function SubmitGRIFT() { 
				GRIFT.submit(); 
			
			}
			
                      
Example #7
0
}
if (isset($_GET['importSections'])) {
    TB_importSections();
    TB_loadSections();
    save_array($TB_settings, ToolBox_settings);
}
if (isset($_GET['updateTempStats'])) {
    $update_tempStats = true;
}
//small checks to avoid problmes
if ($tempStats['itemName'] != $TB_settings['AM_ItemName']) {
    $update_tempStats = true;
}
if ($tempStats['countGiftsInGiftBox'] != TB_numberGiftBox()) {
    $update_tempStats = true;
    save_array($TB_settings, ToolBox_settings);
}
//update temp stats?
if ($update_tempStats) {
    TB_prepareTempStats($TB_settings['AM_ItemName']);
    $tempStats = TB_loadTempStats();
}
?>

<html>
<head>
<style type="text/css">
<?php 
include 'toolbox.css';
?>
</style>
Example #8
0
function update_php($carriers)
{
    $f = fopen("carriers.php", "wt");
    fwrite($f, "<? \$carriers = ");
    save_array($f, "  ", $carriers);
    fwrite($f, "; ?>");
    fclose($f);
}
Example #9
0
function Sections_GetUnits($flashRevision)
{
    $vReturn = load_array('sections_unit.txt');
    if ($vReturn['flashRevision'] != $flashRevision) {
        $units = Units_GetByType('seed');
        foreach ($units as $unit) {
            if (strlen($unit['realname']) == 0) {
                $unit['realname'] = $unit['name'];
            }
            $vSeeds[$unit['name']] = $unit['realname'];
        }
        $units = Units_GetByType('animal');
        foreach ($units as $unit) {
            if (strlen($unit['realname']) == 0) {
                $unit['realname'] = $unit['name'];
            }
            $vAnimals[$unit['name']] = $unit['realname'];
            if (isset($unit['buyable']) && $unit['buyable'] == 'true') {
                if (isset($unit['market'])) {
                    $vBuyAnimals['cash'][$unit['name']] = $unit['realname'] . ' (' . $unit['cash'] . ' cash)';
                } else {
                    $vBuyAnimals['coins'][$unit['name']] = $unit['realname'] . ' (' . $unit['cost'] . ' coins)';
                }
            } else {
                if (isset($unit['market'])) {
                    $vBuyAnimals['nocash'][$unit['name']] = $unit['realname'] . ' (' . $unit['cash'] . ' cash)';
                } else {
                    $vBuyAnimals['nocoins'][$unit['name']] = $unit['realname'] . ' (' . $unit['cost'] . ' coins)';
                }
            }
            $vUnit = strpos($unit['name'], '_') === false ? $unit['name'] : substr($unit['name'], 0, strpos($unit['name'], '_'));
            $vAnimalUnits[$vUnit][$unit['name']] = $unit['realname'];
        }
        $units = Units_GetByType('tree');
        foreach ($units as $unit) {
            $vTrees[$unit['name']] = $unit['realname'];
            if (isset($unit['buyable']) && $unit['buyable'] == 'true') {
                if (isset($unit['market'])) {
                    $vBuyTrees['cash'][$unit['name']] = $unit['realname'] . ' (' . $unit['cash'] . ' cash)';
                } else {
                    $vBuyTrees['coins'][$unit['name']] = $unit['realname'] . ' (' . $unit['cost'] . ' coins)';
                }
            } else {
                if (isset($unit['market'])) {
                    $vBuyTrees['nocash'][$unit['name']] = $unit['realname'] . ' (' . $unit['cash'] . ' cash)';
                } else {
                    $vBuyTrees['nocoins'][$unit['name']] = $unit['realname'] . ' (' . $unit['cost'] . ' coins)';
                }
            }
        }
        $units = Units_GetByType('decoration');
        foreach ($units as $unit) {
            $vDecorations[$unit['name']] = $unit['realname'];
            if (isset($unit['buyable']) && $unit['buyable'] == 'true') {
                if (isset($unit['market'])) {
                    $vBuyDecorations['cash'][$unit['name']] = $unit['realname'] . ' (' . $unit['cash'] . ' cash)';
                } else {
                    $vBuyDecorations['coins'][$unit['name']] = $unit['realname'] . ' (' . $unit['cost'] . ' coins)';
                }
            } else {
                if (isset($unit['market'])) {
                    $vBuyDecorations['nocash'][$unit['name']] = $unit['realname'] . ' (' . $unit['cash'] . ' cash)';
                } else {
                    $vBuyDecorations['nocoins'][$unit['name']] = $unit['realname'] . ' (' . $unit['cost'] . ' coins)';
                }
            }
        }
        $units = Units_GetByType('building');
        foreach ($units as $unit) {
            $vBuildings[$unit['name']] = $unit['realname'];
            if (isset($unit['buyable']) && $unit['buyable'] == 'true') {
                if (isset($unit['market'])) {
                    $vBuyBuildings['cash'][$unit['name']] = $unit['realname'] . ' (' . $unit['cash'] . ' cash)';
                } else {
                    $vBuyBuildings['coins'][$unit['name']] = $unit['realname'] . ' (' . $unit['cost'] . ' coins)';
                }
            } else {
                if (isset($unit['market'])) {
                    $vBuyBuildings['nocash'][$unit['name']] = $unit['realname'] . ' (' . $unit['cash'] . ' cash)';
                } else {
                    $vBuyBuildings['nocoins'][$unit['name']] = $unit['realname'] . ' (' . $unit['cost'] . ' coins)';
                }
            }
        }
        $units = Units_GetAll();
        foreach ($units as $unit) {
            $vAll[$unit['name']] = $unit['realname'];
        }
        ksort($vSeeds);
        ksort($vAnimals);
        ksort($vTrees);
        ksort($vDecorations);
        ksort($vBuildings);
        ksort($vBuyAnimals['cash']);
        ksort($vBuyAnimals['coins']);
        ksort($vBuyAnimals['nocash']);
        ksort($vBuyAnimals['nocoins']);
        ksort($vBuyTrees['cash']);
        ksort($vBuyTrees['coins']);
        ksort($vBuyTrees['nocash']);
        ksort($vBuyTrees['nocoins']);
        ksort($vBuyDecorations['cash']);
        ksort($vBuyDecorations['coins']);
        ksort($vBuyDecorations['nocash']);
        ksort($vBuyDecorations['nocoins']);
        ksort($vBuyBuildings['cash']);
        ksort($vBuyBuildings['coins']);
        ksort($vBuyBuildings['nocash']);
        ksort($vBuyBuildings['nocoins']);
        ksort($vAnimalUnits);
        ksort($vAll);
        $vReturn['flashRevision'] = $flashRevision;
        $vReturn['vSeeds'] = $vSeeds;
        $vReturn['vAnimals'] = $vAnimals;
        $vReturn['vTrees'] = $vTrees;
        $vReturn['vDecorations'] = $vDecorations;
        $vReturn['vBuildings'] = $vBuildings;
        $vReturn['vBuyAnimals'] = $vBuyAnimals;
        $vReturn['vBuyTrees'] = $vBuyTrees;
        $vReturn['vBuyDecorations'] = $vBuyDecorations;
        $vReturn['vBuyBuildings'] = $vBuyBuildings;
        $vReturn['vAnimalUnits'] = $vAnimalUnits;
        $vReturn['vAll'] = $vAll;
        save_array($vReturn, 'sections_unit.txt');
    }
    return $vReturn;
}
Example #10
0
function AM_farmGold_addIDs($getIDs, $getBuilding)
{
    $info = array();
    $info = AM_farmGold_getIDs();
    if ($info == 0) {
        save_array(array('building' => $getBuilding, 'IDs' => (array) $getIDs), AnimalMover_farmGold_IDs);
    } else {
        $IDs = $info['IDs'];
        $building = $info['building'];
        if ($building['id'] == $getBuilding['id']) {
            $IDs = array_merge($IDs, (array) $getIDs);
        }
        save_array(array('building' => $building, 'IDs' => $IDs), AnimalMover_farmGold_IDs);
    }
}
Example #11
0
function Grifter_Grift($getFarm = null)
{
    global $Grifter_settings;
    $farm = $getFarm;
    $retain = array();
    $retain = $Grifter_settings;
    $cash = $Grifter_settings['gold'] - $Grifter_settings['max'];
    $use = 250 - $Grifter_settings['giftbox'];
    if (!$Grifter_settings['turbo'] || $use < 1) {
        while ($Grifter_settings['engineer'] > 0) {
            FindSpace($getFarm, city_xpromo_round2);
            $Grifter_settings['engineer']--;
        }
        while ($cash > 4999999 && $Grifter_settings['level'] > 69 && $Grifter_settings['mansion'] > 0) {
            FindSpace($getFarm, highrollerhome);
            $cash = $cash - 4750000;
            $Grifter_settings['mansion']--;
        }
        while ($cash > 1999999 && $Grifter_settings['level'] > 84 && $Grifter_settings['pheasant'] > 0) {
            FindSpace($getFarm, pheasant_ladyamherst);
            $cash = $cash - 1999908;
            $Grifter_settings['pheasant']--;
        }
        while ($cash > 999999 && $Grifter_settings['level'] > 33 && $Grifter_settings['villa'] > 0) {
            FindSpace($getFarm, villa);
            $cash = $cash - 950000;
            $Grifter_settings['villa']--;
        }
        while ($cash > 999999 && $Grifter_settings['level'] > 74 && $Grifter_settings['beltedcow'] > 0) {
            FindSpace($getFarm, cow_belted);
            $cash = $cash - 997000;
            $Grifter_settings['beltedcow']--;
        }
        while ($cash > 499999 && $Grifter_settings['level'] > 54 && $Grifter_settings['goat'] > 0) {
            FindSpace($getFarm, goat_arapawa);
            $cash = $cash - 498800;
            $Grifter_settings['goat']--;
        }
        while ($cash > 299999 && $Grifter_settings['level'] > 34 && $Grifter_settings['saddleback'] > 0) {
            FindSpace($getFarm, pig_belted);
            $cash = $cash - 299000;
            $Grifter_settings['saddleback']--;
        }
        while ($cash > 249999 && $Grifter_settings['level'] > 23 && $Grifter_settings['logcabin'] > 0) {
            FindSpace($getFarm, logcabin);
            $cash = $cash - 237500;
            $Grifter_settings['logcabin']--;
        }
        while ($cash > 99999 && $Grifter_settings['level'] > 16 && $Grifter_settings['postoffice'] > 0) {
            FindSpace($getFarm, postoffice);
            $cash = $cash - 95000;
            $Grifter_settings['postoffice']--;
        }
        while ($cash > 99999 && $Grifter_settings['level'] > 21 && $Grifter_settings['windmill'] > 0) {
            FindSpace($getFarm, windmill);
            $cash = $cash - 95000;
            $Grifter_settings['windmill']--;
        }
        while ($cash > 49999 && $Grifter_settings['level'] > 17 && $Grifter_settings['schoolhouse'] > 0) {
            FindSpace($getFarm, schoolhouse);
            $cash = $cash - 47500;
            $Grifter_settings['schoolhouse']--;
        }
        while ($cash > 24999 && $Grifter_settings['level'] > 0 && $Grifter_settings['cowsilo'] > 0) {
            FindSpace($getFarm, grainsilocowprint);
            $cash = $cash - 23750;
            $Grifter_settings['cowsilo']--;
        }
        while ($cash > 9999 && $Grifter_settings['level'] > 9 && $Grifter_settings['fruitstand'] > 0) {
            FindSpace($getFarm, fruitstand);
            $cash = $cash - 9500;
            $Grifter_settings['fruitstand']--;
        }
        while ($cash > 999 && $Grifter_settings['level'] > 3 && $Grifter_settings['resttent'] > 0) {
            FindSpace($getFarm, resttent);
            $cash = $cash - 950;
            $Grifter_settings['resttent']--;
        }
        while ($cash > 499 && $Grifter_settings['level'] > 7 && $Grifter_settings['woodpile'] > 0) {
            FindSpace($getFarm, woodpile);
            $cash = $cash - 475;
            $Grifter_settings['woodpile']--;
        }
        while ($cash > 99 && $Grifter_settings['level'] > 0 && $Grifter_settings['haybale'] > 0) {
            FindSpace($getFarm, haybale);
            $cash = $cash - 95;
            $Grifter_settings['haybale']--;
        }
    } else {
        while ($Grifter_settings['engineer'] > 0 && $use > 0) {
            if ($use < $Grifter_settings['engineer']) {
                Grifter_Turbo(city_xpromo_round2, $use);
                Grifter_TurboSell(city_xpromo_round2, $use);
                $Grifter_settings['engineer'] = $Grifter_settings['engineer'] - $use;
            } else {
                Grifter_Turbo(city_xpromo_round2, $Grifter_settings['engineer']);
                Grifter_TurboSell(city_xpromo_round2, $Grifter_settings['engineer']);
                $Grifter_settings['engineer'] = $Grifter_settings['engineer'] - $Grifter_settings['engineer'];
            }
        }
        while ($cash > 4999999 * $Grifter_settings['mansion'] && $Grifter_settings['level'] > 69 && $Grifter_settings['mansion'] > 0) {
            if ($use < $Grifter_settings['mansion']) {
                Grifter_Turbo(highrollerhome, $use);
                Grifter_TurboSell(highrollerhome, $use);
                $Grifter_settings['mansion'] = $Grifter_settings['mansion'] - $use;
                $cash = $cash - 4750000 * $use;
            } else {
                Grifter_Turbo(highrollerhome, $Grifter_settings['mansion']);
                Grifter_TurboSell(highrollerhome, $Grifter_settings['mansion']);
                $cash = $cash - 4750000 * $Grifter_settings['mansion'];
                $Grifter_settings['mansion'] = $Grifter_settings['mansion'] - $Grifter_settings['mansion'];
            }
        }
        while ($cash > 1999999 * $Grifter_settings['pheasant'] && $Grifter_settings['level'] > 84 && $Grifter_settings['pheasant'] > 0) {
            if ($use < $Grifter_settings['pheasant']) {
                Grifter_Turbo(pheasant_ladyamherst, $use);
                Grifter_TurboSell(pheasant_ladyamherst, $use);
                $Grifter_settings['mansion'] = $Grifter_settings['pheasant'] - $use;
                $cash = $cash - 1999908 * $use;
            } else {
                Grifter_Turbo(pheasant_ladyamherst, $Grifter_settings['pheasant']);
                Grifter_TurboSell(pheasant_ladyamherst, $Grifter_settings['pheasant']);
                $cash = $cash - 1999908 * $Grifter_settings['pheasant'];
                $Grifter_settings['pheasant'] = $Grifter_settings['pheasant'] - $Grifter_settings['pheasant'];
            }
        }
        while ($cash > 999999 * $Grifter_settings['villa'] && $Grifter_settings['level'] > 33 && $Grifter_settings['villa'] > 0) {
            if ($use < $Grifter_settings['villa']) {
                Grifter_Turbo(villa, $use);
                Grifter_TurboSell(villa, $use);
                $Grifter_settings['villa'] = $Grifter_settings['villa'] - $use;
                $cash = $cash - 950000 * $use;
            } else {
                Grifter_Turbo(villa, $Grifter_settings['villa']);
                Grifter_TurboSell(villa, $Grifter_settings['villa']);
                $cash = $cash - 950000 * $Grifter_settings['villa'];
                $Grifter_settings['villa'] = $Grifter_settings['villa'] - $Grifter_settings['villa'];
            }
        }
        while ($cash > 999999 * $Grifter_settings['beltedcow'] && $Grifter_settings['level'] > 74 && $Grifter_settings['beltedcow'] > 0) {
            if ($use < $Grifter_settings['beltedcow']) {
                Grifter_Turbo(cow_belted, $use);
                Grifter_TurboSell(cow_belted, $use);
                $Grifter_settings['cow_belted'] = $Grifter_settings['beltedcow'] - $use;
                $cash = $cash - 997000 * $use;
            } else {
                Grifter_Turbo(cow_belted, $Grifter_settings['beltedcow']);
                Grifter_TurboSell(cow_belted, $Grifter_settings['beltedcow']);
                $cash = $cash - 997000 * $Grifter_settings['beltedcow'];
                $Grifter_settings['beltedcow'] = $Grifter_settings['beltedcow'] - $Grifter_settings['beltedcow'];
            }
        }
        while ($cash > 499999 * $Grifter_settings['goat'] && $Grifter_settings['level'] > 54 && $Grifter_settings['goat'] > 0) {
            if ($use < $Grifter_settings['goat']) {
                Grifter_Turbo(goat_arapawa, $use);
                Grifter_TurboSell(goat_arapawa, $use);
                $Grifter_settings['goat'] = $Grifter_settings['goat'] - $use;
                $cash = $cash - 498800 * $use;
            } else {
                Grifter_Turbo(goat_arapawa, $Grifter_settings['goat']);
                Grifter_TurboSell(goat_arapawa, $Grifter_settings['goat']);
                $cash = $cash - 498800 * $Grifter_settings['goat'];
                $Grifter_settings['goat'] = $Grifter_settings['goat'] - $Grifter_settings['goat'];
            }
        }
        while ($cash > 299999 * $Grifter_settings['saddleback'] && $Grifter_settings['level'] > 34 && $Grifter_settings['saddleback'] > 0) {
            if ($use < $Grifter_settings['saddleback']) {
                Grifter_Turbo(pig_belted, $use);
                Grifter_TurboSell(pig_belted, $use);
                $Grifter_settings['saddleback'] = $Grifter_settings['saddleback'] - $use;
                $cash = $cash - 299000 * $use;
            } else {
                Grifter_Turbo(pig_belted, $Grifter_settings['saddleback']);
                Grifter_TurboSell(pig_belted, $Grifter_settings['saddleback']);
                $cash = $cash - 299000 * $Grifter_settings['saddleback'];
                $Grifter_settings['saddleback'] = $Grifter_settings['saddleback'] - $Grifter_settings['saddleback'];
            }
        }
        while ($cash > 249999 * $Grifter_settings['logcabin'] && $Grifter_settings['level'] > 23 && $Grifter_settings['logcabin'] > 0) {
            if ($use < $Grifter_settings['logcabin']) {
                Grifter_Turbo(logcabin, $use);
                Grifter_TurboSell(logcabin, $use);
                $Grifter_settings['logcabin'] = $Grifter_settings['logcabin'] - $use;
                $cash = $cash - 237500 * $use;
            } else {
                Grifter_Turbo(logcabin, $Grifter_settings['logcabin']);
                Grifter_TurboSell(logcabin, $Grifter_settings['logcabin']);
                $cash = $cash - 237500 * $Grifter_settings['logcabin'];
                $Grifter_settings['logcabin'] = $Grifter_settings['logcabin'] - $Grifter_settings['logcabin'];
            }
        }
        while ($cash > 99999 * $Grifter_settings['postoffice'] && $Grifter_settings['level'] > 16 && $Grifter_settings['postoffice'] > 0) {
            if ($use < $Grifter_settings['postoffice']) {
                Grifter_Turbo(postoffice, $use);
                Grifter_TurboSell(postoffice, $use);
                $Grifter_settings['postoffice'] = $Grifter_settings['postoffice'] - $use;
                $cash = $cash - 95000 * $use;
            } else {
                Grifter_Turbo(postoffice, $Grifter_settings['postoffice']);
                Grifter_TurboSell(postoffice, $Grifter_settings['postoffice']);
                $cash = $cash - 95000 * $Grifter_settings['postoffice'];
                $Grifter_settings['postoffice'] = $Grifter_settings['postoffice'] - $Grifter_settings['postoffice'];
            }
        }
        while ($cash > 99999 * $Grifter_settings['windmill'] && $Grifter_settings['level'] > 21 && $Grifter_settings['windmill'] > 0) {
            if ($use < $Grifter_settings['windmill']) {
                Grifter_Turbo(windmill, $use);
                Grifter_TurboSell(windmill, $use);
                $Grifter_settings['windmill'] = $Grifter_settings['windmill'] - $use;
                $cash = $cash - 95000 * $use;
            } else {
                Grifter_Turbo(windmill, $Grifter_settings['windmill']);
                Grifter_TurboSell(windmill, $Grifter_settings['windmill']);
                $cash = $cash - 95000 * $Grifter_settings['windmill'];
                $Grifter_settings['windmill'] = $Grifter_settings['windmill'] - $Grifter_settings['windmill'];
            }
        }
        while ($cash > 49999 * $Grifter_settings['schoolhouse'] && $Grifter_settings['level'] > 17 && $Grifter_settings['schoolhouse'] > 0) {
            if ($use < $Grifter_settings['schoolhouse']) {
                Grifter_Turbo(schoolhouse, $use);
                Grifter_TurboSell(schoolhouse, $use);
                $Grifter_settings['schoolhouse'] = $Grifter_settings['schoolhouse'] - $use;
                $cash = $cash - 47500 * $use;
            } else {
                Grifter_Turbo(schoolhouse, $Grifter_settings['schoolhouse']);
                Grifter_TurboSell(schoolhouse, $Grifter_settings['schoolhouse']);
                $cash = $cash - 47500 * $Grifter_settings['schoolhouse'];
                $Grifter_settings['schoolhouse'] = $Grifter_settings['schoolhouse'] - $Grifter_settings['schoolhouse'];
            }
        }
        while ($cash > 24999 * $Grifter_settings['cowsilo'] && $Grifter_settings['level'] > 0 && $Grifter_settings['cowsilo'] > 0) {
            if ($use < $Grifter_settings['cowsilo']) {
                Grifter_Turbo(grainsilocowprint, $use);
                Grifter_TurboSell(grainsilocowprint, $use);
                $Grifter_settings['cowsilo'] = $Grifter_settings['cowsilo'] - $use;
                $cash = $cash - 23750 * $use;
            } else {
                Grifter_Turbo(grainsilocowprint, $Grifter_settings['cowsilo']);
                Grifter_TurboSell(grainsilocowprint, $Grifter_settings['cowsilo']);
                $cash = $cash - 23750 * $Grifter_settings['cowsilo'];
                $Grifter_settings['cowsilo'] = $Grifter_settings['cowsilo'] - $Grifter_settings['cowsilo'];
            }
        }
        while ($cash > 9999 * $Grifter_settings['fruitstand'] && $Grifter_settings['level'] > 9 && $Grifter_settings['fruitstand'] > 0) {
            if ($use < $Grifter_settings['fruitstand']) {
                Grifter_Turbo(fruitstand, $use);
                Grifter_TurboSell(fruitstand, $use);
                $Grifter_settings['fruitstand'] = $Grifter_settings['fruitstand'] - $use;
                $cash = $cash - 9500 * $use;
            } else {
                Grifter_Turbo(fruitstand, $Grifter_settings['fruitstand']);
                Grifter_TurboSell(fruitstand, $Grifter_settings['fruitstand']);
                $cash = $cash - 9500 * $Grifter_settings['fruitstand'];
                $Grifter_settings['fruitstand'] = $Grifter_settings['fruitstand'] - $Grifter_settings['fruitstand'];
            }
        }
        while ($cash > 999 * $Grifter_settings['resttent'] && $Grifter_settings['level'] > 3 && $Grifter_settings['resttent'] > 0) {
            if ($use < $Grifter_settings['resttent']) {
                Grifter_Turbo(resttent, $use);
                Grifter_TurboSell(resttent, $use);
                $Grifter_settings['resttent'] = $Grifter_settings['resttent'] - $use;
                $cash = $cash - 950 * $use;
            } else {
                Grifter_Turbo(resttent, $Grifter_settings['resttent']);
                Grifter_TurboSell(resttent, $Grifter_settings['resttent']);
                $cash = $cash - 950 * $Grifter_settings['resttent'];
                $Grifter_settings['resttent'] = $Grifter_settings['resttent'] - $Grifter_settings['resttent'];
            }
        }
        while ($cash > 499 * $Grifter_settings['woodpile'] && $Grifter_settings['level'] > 7 && $Grifter_settings['woodpile'] > 0) {
            if ($use < $Grifter_settings['woodpile']) {
                Grifter_Turbo(woodpile, $use);
                Grifter_TurboSell(woodpile, $use);
                $Grifter_settings['woodpile'] = $Grifter_settings['woodpile'] - $use;
                $cash = $cash - 475 * $use;
            } else {
                Grifter_Turbo(woodpile, $Grifter_settings['woodpile']);
                Grifter_TurboSell(woodpile, $Grifter_settings['woodpile']);
                $cash = $cash - 475 * $Grifter_settings['woodpile'];
                $Grifter_settings['woodpile'] = $Grifter_settings['woodpile'] - $Grifter_settings['woodpile'];
            }
        }
        while ($cash > 99 * $Grifter_settings['haybale'] && $Grifter_settings['level'] > 0 && $Grifter_settings['haybale'] > 0) {
            if ($use < $Grifter_settings['haybale']) {
                Grifter_Turbo(haybale, $use);
                Grifter_TurboSell(haybale, $use);
                $Grifter_settings['haybale'] = $Grifter_settings['haybale'] - $use;
                $cash = $cash - 95 * $use;
            } else {
                Grifter_Turbo(haybale, $Grifter_settings['haybale']);
                Grifter_TurboSell(haybale, $Grifter_settings['haybale']);
                $cash = $cash - 95 * $Grifter_settings['haybale'];
                $Grifter_settings['haybale'] = $Grifter_settings['haybale'] - $Grifter_settings['haybale'];
            }
        }
    }
    // else
    if ($Grifter_settings['keep']) {
        $Grifter_settings = $retain;
    }
    save_array($Grifter_settings, Grifter_settings);
    return $farm;
}
Example #12
0
function Grifter_autofill()
{
    global $Grifter_settings;
    if ($Grifter_settings['auto']) {
        if ($Grifter_settings['max'] > 0) {
            $cash = $Grifter_settings['gold'] - $Grifter_settings['max'];
        } else {
            $cash = $Grifter_settings['gold'];
        }
        $n = 0;
        while ($cash > 4999999 && $Grifter_settings['level'] > 69 && !$Grifter_settings['smaller']) {
            $cash = $cash - 4750000;
            $n++;
        }
        $Grifter_settings['mansion'] = $n;
        while ($cash > 1999999 && $Grifter_settings['level'] > 84 && $Grifter_settings['smaller']) {
            $cash = $cash - 1999908;
            $n++;
        }
        $Grifter_settings['pheasant'] = $n;
        $n = 0;
        while ($cash > 999999 && $Grifter_settings['level'] > 33 && !$Grifter_settings['smaller']) {
            $cash = $cash - 950000;
            $n++;
        }
        $Grifter_settings['villa'] = $n;
        while ($cash > 999999 && $Grifter_settings['level'] > 74 && $Grifter_settings['smaller']) {
            $cash = $cash - 997000;
            $n++;
        }
        $Grifter_settings['beltedcow'] = $n;
        $n = 0;
        while ($cash > 499999 && $Grifter_settings['level'] > 54) {
            $cash = $cash - 498800;
            $n++;
        }
        $Grifter_settings['goat'] = $n;
        $n = 0;
        while ($cash > 249999 && $Grifter_settings['level'] > 23 && !$Grifter_settings['smaller']) {
            $cash = $cash - 237500;
            $n++;
        }
        $Grifter_settings['logcabin'] = $n;
        while ($cash > 299999 && $Grifter_settings['level'] > 34 && $Grifter_settings['smaller']) {
            $cash = $cash - 299000;
            $n++;
        }
        $Grifter_settings['saddleback'] = $n;
        $n = 0;
        while ($cash > 99999 && $Grifter_settings['level'] > 16 && !$Grifter_settings['smaller']) {
            $cash = $cash - 95000;
            $n++;
        }
        $Grifter_settings['postoffice'] = $n;
        while ($cash > 99999 && $Grifter_settings['level'] > 21 && $Grifter_settings['smaller']) {
            $cash = $cash - 95000;
            $n++;
        }
        $Grifter_settings['windmill'] = $n;
        $n = 0;
        while ($cash > 49999 && $Grifter_settings['level'] > 17 && !$Grifter_settings['smaller']) {
            $cash = $cash - 47500;
            $n++;
        }
        $Grifter_settings['schoolhouse'] = $n;
        while ($cash > 24999 && $Grifter_settings['level'] > 0 && $Grifter_settings['smaller']) {
            $cash = $cash - 23750;
            $n++;
        }
        $Grifter_settings['cowsilo'] = $n;
        $n = 0;
        while ($cash > 9999 && $Grifter_settings['level'] > 9) {
            $cash = $cash - 9500;
            $n++;
        }
        $Grifter_settings['fruitstand'] = $n;
        $n = 0;
        while ($cash > 999 && $Grifter_settings['level'] > 3) {
            $cash = $cash - 950;
            $n++;
        }
        $Grifter_settings['resttent'] = $n;
        $n = 0;
        while ($cash > 499 && $Grifter_settings['level'] > 7) {
            $cash = $cash - 475;
            $n++;
        }
        $Grifter_settings['woodpile'] = $n;
        $n = 0;
        while ($cash > 99) {
            $cash = $cash - 95;
            $n++;
        }
        $Grifter_settings['haybale'] = $n;
    }
    if ($Grifter_settings['auto']) {
        save_array($Grifter_settings, Grifter_settings);
    }
}
 private function _fnAMFSend($amf)
 {
     $serializer = new AMFSerializer();
     $result3 = $serializer->serialize($amf);
     // serialize the data
     $answer = Request('', $result3);
     $amf2 = new AMFObject($answer);
     $deserializer2 = new AMFDeserializer($amf2->rawData);
     // deserialize the data
     $deserializer2->deserialize($amf2);
     // run the deserializer
     $doinit = 0;
     if (!isset($amf2->_bodys[0]->_value['data'][0])) {
         DoInit();
         return false;
     }
     Check4Rewards($amf2);
     foreach (@$amf2->_bodys[0]->_value['data'] as $key => $returned) {
         $resp = $returned['errorType'];
         $err = $returned['errorData'];
         //echo $resp . ' - ' . $err . "\n";
         if ($resp == 28 || $resp == 29) {
             if (strpos($err, 'MC::lock()') !== false) {
                 //Ignore Quietly Now, even if Debug is on
                 $iguser = load_array('ignores.txt');
                 preg_match('/rts_USER_(.*)_lock/', $err, $matches);
                 $iguser[floatval($matches[1])] = floatval($matches[1]);
                 save_array($iguser, 'ignores.txt');
             } elseif (strpos($err, 'Exceeded action limit') !== false) {
                 //Ignore Quietly Now, even if Debug is on
             } else {
                 if (strpos($err, 'Invalid data') !== false) {
                     $user = $amf->_bodys[0]->_value[1][0]['params'][0];
                     $iguser = load_array('ignores.txt');
                     $iguser[$user] = floatval($user);
                     AddLog2('fvNeighbors Error: FBID:' . $user . ' - ' . $resp . ' - ' . $err);
                     save_array($iguser, 'ignores.txt');
                     //Ignore Questly Now, even if Debug is on
                 } else {
                     if ($err != 'Remaining function') {
                         AddLog2('fvNeighbors Error: ' . $resp . ' - ' . $err);
                     }
                 }
             }
             unset($amf2->_bodys[0]->_value['data'][$key]);
             if ($doinit == 0) {
                 DoInit();
             }
             $doinit = 1;
             if ($key == 0) {
                 return false;
             }
         }
     }
     return $amf2;
 }
Example #14
0
	if (isset($_POST['vEditActive'])) {
		$sections[$_POST['vEditActive']]['active'] =  @$_POST['vActiv'];
		save_array($sections, 'sections.txt');
	}

	if (isset($_POST['vEditPlace'])) {
		$sections[$_POST['vEditPlace']]['place'] =  @$_POST['vPlace'];
		save_array($sections, 'sections.txt');
	}

	if (isset($_POST['del_sec'])) {
		$num = @$_POST['num'];
		unset($sections[$num]);
		$sections = array_merge($sections);
		save_array($sections, 'sections.txt');
	}

	?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/index.css">
<script type="text/javascript" src="functions.js"></script>
</head>
<body>
<?php fBAcctHeader(); ?>
<script type="text/javascript" src="wz_tooltip.js"></script>
<MAP name='farm'>
<?php
$item_loc = array();
for ($x = 0; $x < $sizeX; $x++) {
Example #15
0
 function TEmptyXYSQL($loc, $amount)
 {
     $cont = true;
     $counter = 0;
     if (!in_array($loc, array("Animal", "Tree", "Decoration"))) {
         $cont = false;
     }
     if (!in_array($amount, array("ALL", "ONE"))) {
         $cont = false;
     }
     //$GB_Setting['userid']
     $minX = $this->GB_Setting[$loc . 'X1'];
     $minY = $this->GB_Setting[$loc . 'Y1'];
     $maxX = $this->GB_Setting[$loc . 'X2'];
     $maxY = $this->GB_Setting[$loc . 'Y2'];
     if ($cont) {
         @(list($level, $gold, $cash, $FarmSizeX, $FarmSizeY) = explode(';', fBGetDataStore('playerinfo')));
         if ($FarmSizeX == '' || $FarmSizeY == '') {
             $GB_place_items = "No";
             return;
         } else {
             $GB_place_items = "OK";
         }
         if (file_exists($_SESSION['base_path'] . "plugins/GiftBox/" . $this->GB_Setting['userid'] . "_" . GBox_XY_map)) {
             $MapXY = load_array(GBox_XY_map);
         } else {
             AddLog2("GB_XY_map.txt not found");
             return "Not indexed yet.";
         }
         $Map_pos_x = $minX;
         while ($Map_pos_x < $maxX) {
             $Map_pos_y = $minY;
             while ($Map_pos_y < $maxY) {
                 if (!array_key_exists($Map_pos_x . "-" . $Map_pos_y, $MapXY)) {
                     // empty position found
                     $EmptyXY['x'] = $Map_pos_x;
                     $EmptyXY['y'] = $Map_pos_y;
                     if ($amount == "ONE") {
                         $MapXY[$Map_pos_x . "-" . $Map_pos_y] = "temp_Giftbox";
                         save_array($MapXY, GBox_XY_map);
                         return $EmptyXY;
                     } else {
                         $counter++;
                     }
                 }
                 $Map_pos_y++;
             }
             $Map_pos_x++;
         }
         if ($amount == "ONE") {
             return "fail";
         }
         return $counter;
     } else {
         return "fail";
     }
     // paramter wrong
 }
Example #16
0
function Sections_form()
{
    if (!empty($_POST)) {
        $_POST = $_POST;
    } else {
        $_POST = $_POST;
    }
    require_once '../../fB_PluginAPI.php';
    define('sections_Path', '/plugins/Sections/');
    define('sections_URL', 'index.php');
    define('sections_Version', file_get_contents('Sections.ver'));
    define('sections_Version_Date', '');
    $objects = @unserialize(fBGetDataStore('objects'));
    list($level, $gold, $cash, $sizeX, $sizeY, $firstname, $locale, $tileset, $wither, $xp, $energy, $flashRevision) = explode(';', fBGetDataStore('playerinfo'));
    $sections = array();
    $sections = load_array('sections.txt');
    if (!(is_array($sections) && count($sections))) {
        $sections = array();
    }
    $sections = array_merge($sections);
    // normalize ids
    $vSettings = array();
    $vSettings = load_array('settings.txt');
    if ($vSettings['ratio'] < 1 || $vSettings['ratio'] > 5) {
        $vSettings['ratio'] = 3;
    }
    if (isset($_POST['vDoExpension'])) {
        foreach ($sections as $vSNum => $section) {
            $sections[$vSNum]['top_x'] = $sections[$vSNum]['top_x'] + 8;
            $sections[$vSNum]['top_y'] = $sections[$vSNum]['top_y'] + 8;
            $sections[$vSNum]['bot_x'] = $sections[$vSNum]['bot_x'] + 8;
            $sections[$vSNum]['bot_y'] = $sections[$vSNum]['bot_y'] + 8;
        }
        save_array($sections, 'sections.txt');
    }
    $is_add = isset($_POST['add_sec_form']) && strlen($_POST['add_sec_form']) > 0;
    $is_copy = isset($_POST['copy_sec_form']) && strlen($_POST['copy_sec_form']) > 0;
    $is_edit = isset($_POST['edit_sec_form']) && strlen($_POST['edit_sec_form']) > 0;
    if (isset($_POST['vSave'])) {
        if (isset($_POST['ratio'])) {
            $vSettings['ratio'] = $_POST['ratio'];
        }
        if ($vSettings['ratio'] < 1 || $vSettings['ratio'] > 5) {
            $vSettings['ratio'] = 3;
        }
        $vSettings['map_main'] = isset($_POST['map_main']) ? $_POST['map_main'] : '0';
        $vSettings['map_edit'] = isset($_POST['map_edit']) ? $_POST['map_edit'] : '0';
        $vSettings['map_new'] = isset($_POST['map_new']) ? $_POST['map_new'] : '0';
        if (isset($_POST['tooltip'])) {
            $vSettings['tooltip'] = $_POST['tooltip'];
        }
        save_array($vSettings, 'settings.txt');
    }
    if (isset($_POST['image']) && $_POST['image'] == '1') {
        include 'image.php';
    } elseif (isset($_POST['js']) && $_POST['js'] == '1') {
        include 'wz_tooltip.js';
    } elseif (isset($_POST['js']) && $_POST['js'] == '2') {
        include 'functions.js';
    } elseif (isset($_POST['css']) && $_POST['css'] == '1') {
        include 'main.css';
    } else {
        if (isset($_POST['add_sec']) || isset($_POST['edit_sec'])) {
            foreach ($_POST as $vName => $vValue) {
                if (strpos($vName, 's_a_') !== false && $vValue == '1') {
                    $vAnimArray[] = substr($vName, 4);
                }
                if (strpos($vName, 's_t_') !== false && $vValue == '1') {
                    $vTreeArray[] = substr($vName, 4);
                }
                if (strpos($vName, 's_d_') !== false && $vValue == '1') {
                    $vDecoArray[] = substr($vName, 4);
                }
                if (strpos($vName, 's_b_') !== false && $vValue == '1') {
                    $vBuildingArray[] = substr($vName, 4);
                }
            }
            if (@$_POST['top_x'] < @$_POST['bot_x']) {
                $vTmpX = @$_POST['top_x'];
                @($_POST['top_x'] = @$_POST['bot_x']);
                @($_POST['bot_x'] = $vTmpX);
            }
            if (@$_POST['top_y'] < @$_POST['bot_y']) {
                $vTmpY = @$_POST['top_y'];
                @($_POST['top_y'] = @$_POST['bot_y']);
                @($_POST['bot_y'] = $vTmpY);
            }
        }
        if (isset($_POST['add_sec'])) {
            $sections[] = array('top_x' => @$_POST['top_x'], 'top_y' => @$_POST['top_y'], 'bot_x' => @$_POST['bot_x'], 'bot_y' => @$_POST['bot_y'], 'pat' => @$_POST['pat'], 'seed' => @$_POST['seed'], 'seed2' => @$_POST['seed2'], 'type' => @$_POST['type'], 'anim' => @implode('|', $vAnimArray), 'tree' => @implode('|', $vTreeArray), 'deco' => @implode('|', $vDecoArray), 'building' => @implode('|', $vBuildingArray), 'buyanim' => @$_POST['buyanim'], 'buytree' => @$_POST['buytree'], 'buydeco' => @$_POST['buydeco'], 'active' => @$_POST['active'], 'place' => @$_POST['place'], 'rotate' => @$_POST['rotate'], 'walk' => @$_POST['walk']);
            save_array($sections, 'sections.txt');
        }
        if (isset($_POST['edit_sec'])) {
            $sections[$_POST['num']] = array('top_x' => @$_POST['top_x'], 'top_y' => @$_POST['top_y'], 'bot_x' => @$_POST['bot_x'], 'bot_y' => @$_POST['bot_y'], 'pat' => @$_POST['pat'], 'seed' => @$_POST['seed'], 'seed2' => @$_POST['seed2'], 'type' => @$_POST['type'], 'anim' => @implode('|', $vAnimArray), 'tree' => @implode('|', $vTreeArray), 'deco' => @implode('|', $vDecoArray), 'building' => @implode('|', $vBuildingArray), 'buyanim' => @$_POST['buyanim'], 'buytree' => @$_POST['buytree'], 'buydeco' => @$_POST['buydeco'], 'active' => @$_POST['active'], 'place' => @$_POST['place'], 'rotate' => @$_POST['rotate'], 'walk' => @$_POST['walk']);
            save_array($sections, 'sections.txt');
        }
        if (isset($_POST['vEditActive'])) {
            $sections[$_POST['vEditActive']]['active'] = @$_POST['vActiv'];
            save_array($sections, 'sections.txt');
        }
        if (isset($_POST['vEditPlace'])) {
            $sections[$_POST['vEditPlace']]['place'] = @$_POST['vPlace'];
            save_array($sections, 'sections.txt');
        }
        if (isset($_POST['del_sec'])) {
            $num = @$_POST['num'];
            unset($sections[$num]);
            $sections = array_merge($sections);
            save_array($sections, 'sections.txt');
        }
        ?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="main.css">
<script type="text/javascript" src="functions.js"></script>
</head>
<body>

<script type="text/javascript" src="wz_tooltip.js"></script>
<MAP name='farm'>
<?php 
        $item_loc = array();
        for ($x = 0; $x < $sizeX; $x++) {
            for ($y = 0; $y < $sizeY; $y++) {
                $item_loc[$x][$y] = (object) array('name' => '', 'icon' => '');
            }
        }
        foreach ($objects as $oID => $o) {
            #      $u = $units[$o['itemName']];
            $u = Units_GetUnitByName($o['itemName']);
            if (!isset($u['sizeX'])) {
                $u['sizeX'] = 1;
                $u['sizeY'] = 1;
            }
            if ($o['state'] == 'vertical') {
                $t = $u['sizeX'];
                $u['sizeX'] = $u['sizeY'];
                $u['sizeY'] = $t;
            }
            for ($x = 0; $x < $u['sizeX']; $x++) {
                for ($y = 0; $y < $u['sizeY']; $y++) {
                    $item_loc[$o['position']['x'] + $x][$o['position']['y'] + $y]->name = Sections_GetRealName(Sections_GetValue($u, 'name'), Sections_GetValue($u, 'realname'));
                    $item_loc[$o['position']['x'] + $x][$o['position']['y'] + $y]->icon = Sections_GetValue($u, 'iconurl');
                }
            }
            $vCntItems[$o['itemName']]++;
            foreach ($sections as $vSNum => $section) {
                if ($o['position']['x'] >= $section['bot_x'] && $o['position']['x'] <= $section['top_x'] && $o['position']['y'] >= $section['bot_y'] && $o['position']['y'] <= $section['top_y']) {
                    #          $vSecLoc[$vSNum][(isset($units[$o['itemName']]['realname']) ? $units[$o['itemName']]['realname'] : $units[$o['itemName']]['name']).' ('.$o['itemName'].')']++;
                    $vSecLoc[$vSNum][Units_GetRealnameByName($o['itemName']) . ' (' . $o['itemName'] . ')']++;
                    $vSecItems[$o['itemName']][$vSNum]++;
                    for ($x = 0; $x < $u['sizeX']; $x++) {
                        for ($y = 0; $y < $u['sizeY']; $y++) {
                            $item_loc[$o['position']['x'] + $x][$o['position']['y'] + $y]->snum = $vSNum;
                            $item_loc[$o['position']['x'] + $x][$o['position']['y'] + $y]->stype = $section['type'];
                        }
                    }
                    continue;
                }
            }
        }
        $local_path = "file:///" . str_replace("\\", "/", getcwd()) . '/';
        $remote_path = 'http://static.farmville.com/v' . $flashRevision . '/';
        if ($vSettings['map_main'] == '1' && (isset($_POST['add_sec_form']) || count($sections) == 0) || $vSettings['map_edit'] == '1' && (isset($_POST['edit_sec_form']) || isset($_POST['copy_sec_form'])) || $vSettings['map_new'] == '1' && !(isset($_POST['add_sec_form']) || count($sections) == 0 || isset($_POST['edit_sec_form']) || isset($_POST['copy_sec_form']))) {
            for ($x = 0; $x < $sizeX; $x++) {
                for ($y = 0; $y < $sizeY; $y++) {
                    $vRest = '';
                    if (isset($item_loc[$x][$y]->snum)) {
                        $vAppend = '<br>in Section ' . $item_loc[$x][$y]->snum . ' (' . $item_loc[$x][$y]->stype . ')<br>';
                        $vAppend2 = 'click to edit Section';
                        $vAppend3 = ' onclick=window.location.href="index.php?edit_sec_form=Edit&num=' . $item_loc[$x][$y]->snum . '"';
                    } else {
                        $vAppend = '';
                        $vAppend2 = '';
                        $vAppend3 = '';
                    }
                    if ($vSettings['tooltip'] == 'small') {
                        if (isset($_POST['add_sec_form']) || isset($_POST['edit_sec_form']) || isset($_POST['copy_sec_form']) || count($sections) == 0) {
                            $vRest = " onmouseover=\"Tip('<i>click to set<br><b>'+vTopBot+'</b><br>coordinates</i>', TITLE, '" . $x . " - " . $y . "', DELAY, 1)\" onmouseout=\"UnTip()\" onclick=\"fClick(" . $x . "," . $y . ");this.onmouseover();\"";
                        } else {
                            $vRest = " onmouseover=\"Tip('" . $vAppend2 . "', TITLE, '" . $x . "-" . $y . "', DELAY, 1)\" onmouseout=\"UnTip()\" " . $vAppend3;
                        }
                    }
                    if ($vSettings['tooltip'] == 'full') {
                        $info = $item_loc[$x][$y]->name ? str_replace("'", "\\'", $item_loc[$x][$y]->name) . "<br/><img src=\\'" . (file_exists($item_loc[$x][$y]->icon) ? $local_path : $remote_path) . $item_loc[$x][$y]->icon . "\\' width=100 height=100/>" : "";
                        if (strlen($info) == 0) {
                            $info = 'empty place';
                        }
                        if (isset($_POST['add_sec_form']) || isset($_POST['edit_sec_form']) || isset($_POST['copy_sec_form']) || count($sections) == 0) {
                            $vRest = " onmouseover=\"Tip('" . $info . $vAppend . "<br><i>click to set<br><b>'+vTopBot+'</b><br>coordinates</i>', TITLE, '" . $x . " - " . $y . "', DELAY, 1)\" onmouseout=\"UnTip()\" onclick=\"fClick(" . $x . "," . $y . ");this.onmouseover();\"";
                        } else {
                            $vRest = " onmouseover=\"Tip('" . $info . $vAppend . $vAppend2 . "', TITLE, '" . $x . "-" . $y . "', DELAY, 1)\" onmouseout=\"UnTip()\" " . $vAppend3;
                        }
                    }
                    Sections_Draw_MapThing($x, $y, 1, 1, $vSettings['ratio'], $vRest);
                }
            }
        }
        ?>
	<h1>Sections <?php 
        echo sections_Version;
        ?>
<font size=+1> by
	ralphm2004 <?php 
        echo sections_Version_Date;
        ?>
</font></h1>
	<span onclick="fShowHide('tab_setting')"><small>Show/Hide Settings</small></span>
	<br>
	<table border="0" cellspacing=0 cellpadding=0 width="100%"
		style="display: none" id="tab_setting">
		<tr>
			<td>
			<form action="index.php" method="post">
			<table border="0" cellspacing="0" cellpadding="4">
				<tr valign=top>
					<td><?php 
        echo 'Zoom: <select name="ratio" onchange="this.form.submit();">';
        echo '<option value="1" ' . ($vSettings['ratio'] == '1' ? 'selected' : '') . '>50%</option>';
        echo '<option value="2" ' . ($vSettings['ratio'] == '2' ? 'selected' : '') . '>75%</option>';
        echo '<option value="3" ' . ($vSettings['ratio'] == '3' ? 'selected' : '') . '>100%</option>';
        echo '<option value="4" ' . ($vSettings['ratio'] == '4' ? 'selected' : '') . '>150%</option>';
        echo '<option value="5" ' . ($vSettings['ratio'] == '5' ? 'selected' : '') . '>200%</option>';
        echo '</select>';
        ?>
</td>
					<td>
					<table border="0" cellspacing="0" cellpadding="0">
						<tr valign=top>
							<td>Show Map:</td>
							<td><?php 
        echo '<input type="checkbox" name="map_main" value="1" ' . ($vSettings['map_main'] != 0 ? 'checked ' : '') . '>&nbsp;<small>Main Screen</small><br>';
        echo '<input type="checkbox" name="map_edit" value="1" ' . ($vSettings['map_edit'] != 0 ? 'checked ' : '') . '>&nbsp;<small>Edit Screen</small><br>';
        echo '<input type="checkbox" name="map_new" value="1" ' . ($vSettings['map_new'] != 0 ? 'checked ' : '') . '>&nbsp;<small>New Screen</small><br>';
        ?>
</td>
						</tr>
					</table>
					</td>
					<td>
					<table border="0" cellspacing="0" cellpadding="0">
						<tr valign=top>
							<td>Show Tooltip:</td>
							<td><?php 
        echo '<input type="radio" name="tooltip" value="full" ' . ($vSettings['tooltip'] == 'full' ? 'checked ' : '') . '>&nbsp;<small>Full</small><br>';
        echo '<input type="radio" name="tooltip" value="small" ' . ($vSettings['tooltip'] == 'small' ? 'checked ' : '') . '>&nbsp;<small>Coordinates</small><br>';
        echo '<input type="radio" name="tooltip" value="off" ' . ($vSettings['tooltip'] == 'off' ? 'checked ' : '') . '>&nbsp;<small>Off</small><br>';
        ?>
</td>
						</tr>
					</table>
					</td>
					<td>
					<button type="submit" name="vSave" value="Save"
						onmouseover="this.className='hover';"
						onmouseout="this.className='';">Save</button>
					</td>
				</tr>
			</table>
			</form>
			</td>
		</tr>
	</table>

	<?php 
        if (!function_exists("gd_info")) {
            echo "<font size='+4' color='red'>GD is required to render the farm map image. Please enable it. (See the readme file on how to do this).</font>";
        } else {
            if (isset($_POST['add_sec_form']) || count($sections) == 0) {
                if ($vSettings['map_new'] == '1') {
                    echo "<img src='index.php?image=1" . "&edit_sec_form=" . (isset($_POST['edit_sec_form']) ? $_POST['edit_sec_form'] : '') . "&copy_sec_form=" . (isset($_POST['copy_sec_form']) ? $_POST['copy_sec_form'] : '') . "&num=" . (isset($_POST['num']) ? $_POST['num'] : '') . "' USEMAP='#farm' border=0 style='cursor:crosshair;'/><br/>" . "<small>Hover over the image to see coordinates, click to set top/bottom coordinates</small><br/>\n";
                }
            } elseif (isset($_POST['edit_sec_form']) || isset($_POST['copy_sec_form'])) {
                if ($vSettings['map_edit'] == '1') {
                    echo "<img src='index.php?image=1" . "&edit_sec_form=" . (isset($_POST['edit_sec_form']) ? $_POST['edit_sec_form'] : '') . "&copy_sec_form=" . (isset($_POST['copy_sec_form']) ? $_POST['copy_sec_form'] : '') . "&num=" . (isset($_POST['num']) ? $_POST['num'] : '') . "' USEMAP='#farm' border=0 style='cursor:crosshair;'/><br/>" . "<small>Hover over the image to see coordinates, click to set top/bottom coordinates</small><br/>\n";
                }
            } else {
                if ($vSettings['map_main'] == '1') {
                    echo "<img src='index.php?image=1" . "' USEMAP='#farm' border=0/><br/>" . "<small>Hover over the image to see coordinates</small><br/>\n";
                }
            }
        }
        #    $vSectionUnitsArray=Sections_GetUnits($units,$flashRevision);
        $vSectionUnitsArray = Sections_GetUnits($flashRevision);
        $vSeeds = $vSectionUnitsArray['vSeeds'];
        $vAnimals = $vSectionUnitsArray['vAnimals'];
        $vTrees = $vSectionUnitsArray['vTrees'];
        $vDecorations = $vSectionUnitsArray['vDecorations'];
        $vBuildings = $vSectionUnitsArray['vBuildings'];
        $vBuyAnimals = $vSectionUnitsArray['vBuyAnimals'];
        $vBuyTrees = $vSectionUnitsArray['vBuyTrees'];
        $vBuyDecorations = $vSectionUnitsArray['vBuyDecorations'];
        $vAnimalUnits = $vSectionUnitsArray['vAnimalUnits'];
        $vAll = $vSectionUnitsArray['vAll'];
        if (isset($_POST['add_sec_form']) || isset($_POST['copy_sec_form']) || isset($_POST['edit_sec_form']) || count($sections) == 0) {
            if (isset($_POST['edit_sec_form'])) {
                echo '<h4>Edit section ' . $_POST['num'] . '</h4>';
                $action = 'edit_sec';
                $thissec = $sections[$_POST['num']];
            } elseif (isset($_POST['copy_sec_form'])) {
                echo '<h4>Copy section ' . $_POST['num'] . '</h4>';
                $action = 'add_sec';
                $thissec = $sections[$_POST['num']];
                $_POST['num'] = '';
            } else {
                echo '<h4>Add section</h4>';
                $action = 'add_sec';
                $thissec = array('top_x' => 8, 'top_y' => 8, 'bot_x' => 0, 'bot_y' => 0, 'pat' => 'none', 'seed' => '---', 'seed2' => '---', 'type' => 'seed', 'anim' => '', 'tree' => '', 'deco' => '', 'buyanim' => '', 'buytree' => '', 'buydeco' => '', 'active' => 1, 'place' => '');
            }
            $vGiftboxContent = Sections_GetGiftboxContent();
            echo '<form action="' . sections_URL . '" name=myform>';
            echo '<button type="submit" name="' . $action . '" value="Save" onmouseover="this.className=\'hover\';" onmouseout="this.className=\'\';">Save</button>&nbsp;';
            echo '<button type="submit" name="undo" value="Back" onmouseover="this.className=\'hover\';" onmouseout="this.className=\'\';">Back</button>';
            echo '<input type="hidden" name="num" value="' . @$_POST['num'] . '">';
            echo '<br/><br/>';
            echo '<fieldset class="cream">';
            echo '<small>A Section consists of a square located on the map above. Hover over the map, and find the coordinates of the <b>top</b> and <b>bottom</b> corners of the square you want to define your section in.</small><br/>';
            echo '<span style="width: 50px">Active</span>';
            echo '<input type="checkbox" name="active" value="1" ' . ($thissec['active'] != 0 ? 'checked ' : '') . '>&nbsp;&nbsp; <small>(Switch this Section on/off)</small><br>';
            echo '<span style="width: 50px">Place/Plow</span>';
            echo '<input type="checkbox" name="place" value="1" ' . ($thissec['place'] == 1 ? 'checked ' : '') . '>&nbsp;&nbsp; <small>(Place Items from GiftBox / Plow plot</small><br>';
            echo '<span style="width: 150px">Top corner:</span>';
            echo '<input type="text" name="top_x" id="top_x" value="' . $thissec['top_x'] . '" size=2 />';
            echo '&nbsp;&nbsp;-&nbsp;&nbsp;';
            echo '<input type="text" name="top_y" id="top_y" value="' . $thissec['top_y'] . '" size=2 />';
            echo '<br/>';
            echo '<span style="width: 150px">Bottom corner:</span>';
            echo '<input type="text" name="bot_x" id="bot_x" value="' . $thissec['bot_x'] . '" size=2 />';
            echo '&nbsp;&nbsp;-&nbsp;&nbsp;';
            echo '<input type="text" name="bot_y" id="bot_y" value="' . $thissec['bot_y'] . '" size=2 />';
            echo '<br/>';
            echo '</fieldset>';
            echo '<br/>';
            echo '<fieldset class="cream">';
            echo '<legend>';
            echo '<b>Section Type:</b>&nbsp;';
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'seed') {
                echo '<input onclick="fShowTab(\'tab_seed\')" type=radio value="seed" name="type" ' . (@isset($thissec['type']) && $thissec['type'] == 'seed' ? 'checked' : '') . '>Seed &nbsp;&nbsp;&nbsp;';
            }
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'anim') {
                echo '<input onclick="fShowTab(\'tab_anim\')" type=radio value="anim" name="type" ' . (@isset($thissec['type']) && $thissec['type'] == 'anim' ? 'checked' : '') . '>Animal &nbsp;&nbsp;&nbsp;';
            }
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'tree') {
                echo '<input onclick="fShowTab(\'tab_tree\')" type=radio value="tree" name="type" ' . (@isset($thissec['type']) && $thissec['type'] == 'tree' ? 'checked' : '') . '>Tree &nbsp;&nbsp;&nbsp;';
            }
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'deco') {
                echo '<input onclick="fShowTab(\'tab_deco\')" type=radio value="deco" name="type" ' . (@isset($thissec['type']) && $thissec['type'] == 'deco' ? 'checked' : '') . '>Decoration &nbsp;&nbsp;&nbsp;';
            }
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'building') {
                echo '<input onclick="fShowTab(\'tab_building\')" type=radio value="building" name="type" ' . (@isset($thissec['type']) && $thissec['type'] == 'building' ? 'checked' : '') . '>Buildings &nbsp;&nbsp;&nbsp;';
            }
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'buyanim') {
                echo '<input onclick="fShowTab(\'tab_buyanim\')" type=radio value="buyanim" name="type" ' . (@isset($thissec['type']) && $thissec['type'] == 'buyanim' ? 'checked' : '') . '>Buy Animal &nbsp;&nbsp;&nbsp;';
            }
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'buytree') {
                echo '<input onclick="fShowTab(\'tab_buytree\')" type=radio value="buytree" name="type" ' . (@isset($thissec['type']) && $thissec['type'] == 'buytree' ? 'checked' : '') . '>Buy Tree &nbsp;&nbsp;&nbsp;';
            }
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'buydeco') {
                echo '<input onclick="fShowTab(\'tab_buydeco\')" type=radio value="buydeco" name="type" ' . (@isset($thissec['type']) && $thissec['type'] == 'buydeco' ? 'checked' : '') . '>Buy Decoration &nbsp;&nbsp;&nbsp;';
            }
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'dontmove') {
                echo '<input onclick="fShowTab(\'tab_dontmove\')" type=radio value="dontmove" name="type" ' . (@isset($thissec['type']) && $thissec['type'] == 'dontmove' ? 'checked' : '') . '>Don\'t Move &nbsp;&nbsp;&nbsp;';
            }
            echo '</legend>';
            echo '<br>';
            ######################################## seed
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'seed') {
                echo '<table id="tab_seed" border="0" cellspacing=0 cellpadding=0 width="100%" style="display: ' . (@isset($thissec['type']) && $thissec['type'] == 'seed' ? 'block' : 'none') . '">';
                echo '<tr><td>';
                echo '<span style="width: 150px">Pattern:</span>';
                echo '<select name="pat" id="pat">';
                echo '<option value="none" ' . ($thissec['pat'] == 'none' ? 'selected' : '') . '>None (just use first seed)</option>';
                echo '<option value="checkerboard" ' . ($thissec['pat'] == 'checkerboard' ? 'selected' : '') . '>Checkerboard</option>';
                echo '<option value="striped-row" ' . ($thissec['pat'] == 'striped-row' ? 'selected' : '') . '>Striped (north to south)</option>';
                echo '<option value="striped-col" ' . ($thissec['pat'] == 'striped-col' ? 'selected' : '') . '>Striped (east to west)</option>';
                echo '<option value="squared1" ' . ($thissec['pat'] == 'squared1' ? 'selected' : '') . '>Squared variant 1</option>';
                echo '<option value="squared2" ' . ($thissec['pat'] == 'squared2' ? 'selected' : '') . '>Squared variant 2</option>';
                echo '<option value="corner-n" ' . ($thissec['pat'] == 'corner-n' ? 'selected' : '') . '>Corner (north) </option>';
                echo '<option value="corner-e" ' . ($thissec['pat'] == 'corner-e' ? 'selected' : '') . '>Corner (east)</option>';
                echo '<option value="corner-s" ' . ($thissec['pat'] == 'corner-s' ? 'selected' : '') . '>Corner (south)</option>';
                echo '<option value="corner-w" ' . ($thissec['pat'] == 'corner-w' ? 'selected' : '') . '>Corner (west)</option>';
                echo '</select><br/>';
                echo '<span style="width: 150px">First Seed:</span>';
                echo '<select name="seed" id="seed">';
                echo '<option ' . ($thissec['seed'] == '---' || $thissec['seed'] == '' ? 'selected ' : '') . 'value="---">please select</option>';
                echo '<option ' . ($thissec['seed'] == 'just_plow' ? 'selected ' : '') . 'value="just_plow">place/plow plot, dont seed it</option>';
                foreach ($vSeeds as $vName => $vRealName) {
                    echo '<option ' . ($thissec['seed'] == htmlentities($vName) ? 'selected ' : '') . 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option>---- Seeder-Glitch ----</option>';
                foreach ($vAll as $vName => $vRealName) {
                    echo '<option ' . ($thissec['seed'] == htmlentities($vName) ? 'selected ' : '') . 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '</select><br/>';
                echo '<span style="width: 150px">Second Seed:</span>';
                echo '<select name="seed2" id="seed2">';
                echo '<option ' . ($thissec2['seed'] == '---' || $thissec2['seed'] == '' ? 'selected ' : '') . 'value="---">please select</option>';
                foreach ($vSeeds as $vName => $vRealName) {
                    echo '<option ' . ($thissec['seed2'] == htmlentities($vName) ? 'selected ' : '') . 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '</select> ';
                echo '(Used when pattern not none)<br/>';
                echo '</td></tr>';
                echo '</table>';
            }
            ######################################## anim
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'anim') {
                echo '<script>';
                echo 'function fCheckUncheckAnimUnit(vUnit,vCheck){', "\n";
                foreach ($vAnimalUnits as $vUnitName => $vArray) {
                    echo 'if(vUnit=="', $vUnitName, '" || vUnit=="all") {', "\n";
                    foreach ($vArray as $vName => $Tmp) {
                        echo 'document.forms["myform"].elements["s_a_' . htmlentities($vName) . '"].checked=vCheck;', "\n";
                    }
                    echo '}', "\n";
                }
                echo 'document.forms["myform"].elements["vCheckAllAnimal"].value="---"', "\n";
                echo 'document.forms["myform"].elements["vUnCheckAllAnimal"].value="---"', "\n";
                echo '}', "\n";
                echo '</script>', "\n";
                echo '<table id="tab_anim" border="0" cellspacing=0 cellpadding=0 width="100%" style="display: ';
                echo (@isset($thissec['type']) && $thissec['type'] == 'anim' ? 'block' : 'none') . '">';
                echo '<tr><td>';
                echo '<table border="0" cellspacing="1" cellpadding="0" class="cream2"><tr valign=top><td>';
                echo 'Walk:&nbsp;';
                echo '</td><td>';
                echo '<input type="radio" name="walk" value="nothing" ', @isset($thissec['walk']) && $thissec['walk'] == 'nothing' || $thissec['walk'] == '' ? 'checked' : '', '>&nbsp;dont change<br>';
                echo '<input type="radio" name="walk" value="walk" ', @isset($thissec['walk']) && $thissec['walk'] == 'walk' ? 'checked' : '', '>&nbsp;allow animals to walk<br>';
                echo '<input type="radio" name="walk" value="stay" ', @isset($thissec['walk']) && $thissec['walk'] == 'stay' ? 'checked' : '', '>&nbsp;forbid animals to walk<br>';
                echo '</td><td>&nbsp;&nbsp;&nbsp;</td><td>';
                echo 'Rotate:&nbsp;';
                echo '</td><td>';
                echo '<input type="radio" name="rotate" value="nothing" ', @isset($thissec['rotate']) && $thissec['rotate'] == 'nothing' || $thissec['rotate'] == '' ? 'checked' : '', '>&nbsp;dont change<br>';
                echo '<table border="0" cellspacing="0" cellpadding="0" class="cream2">
      <tr>
        <td align="right">top-left&nbsp;<input type="radio" name="rotate" value="3" ', @isset($thissec['rotate']) && $thissec['rotate'] == '3' ? 'checked' : '', '></td>
        <td><input type="radio" name="rotate" value="2" ', @isset($thissec['rotate']) && $thissec['rotate'] == '2' ? 'checked' : '', '>&nbsp;top-right</td>
      </tr>
      <tr>
        <td align="right">bottom-left&nbsp;<input type="radio" name="rotate" value="0" ', @isset($thissec['rotate']) && $thissec['rotate'] == '0' ? 'checked' : '', '></td>
        <td><input type="radio" name="rotate" value="1" ', @isset($thissec['rotate']) && $thissec['rotate'] == '1' ? 'checked' : '', '>&nbsp;bottom-right</td>
      </tr>
    </table>';
                echo '</td></tr></table><br>';
                echo '&nbsp;Select: <select name="vCheckAllAnimal" onchange="fCheckUncheckAnimUnit(this.value,true)"><option value="---">please select</option><option value="all">all animals</option>', "\n";
                foreach ($vAnimalUnits as $vUnitName => $vTmp) {
                    echo '<option value="', $vUnitName, '">', $vUnitName, '</option>', "\n";
                }
                echo '</select>', "\n";
                echo '&nbsp;UnSelect: <select name="vUnCheckAllAnimal" onchange="fCheckUncheckAnimUnit(this.value,false)"><option value="---">please select</option><option value="all">all animals</option>', "\n";
                foreach ($vAnimalUnits as $vUnitName => $vTmp) {
                    echo '<option value="', $vUnitName, '">', $vUnitName, '</option>', "\n";
                }
                echo '</select>', "\n";
                echo '<br>';
                echo '<table class="cream" border="0" cellspacing="0" cellpadding="0">';
                echo '<tr bgcolor=white>';
                echo '<th></th><th>RealName</th><th>Name</th><th>In Giftbox</th><th>In Sections</th><th>On the Farm</th>';
                echo '</tr>';
                $vArray = explode('|', $thissec['anim']);
                foreach ($vAnimals as $vName => $vRealName) {
                    echo '<tr bgcolor=white valign=top>';
                    echo '<td>';
                    echo '<input type="checkbox" name="s_a_', htmlentities($vName), '" value="1" ';
                    echo in_array(htmlentities($vName), $vArray) ? 'checked ' : '', '>';
                    echo '</td><td>', $vRealName, '</td><td>', $vName, '</td>';
                    echo '<td>';
                    $vCntGB = 0;
                    foreach ($vGiftboxContent['animal'] as $vItem) {
                        if ($vItem['name'] == $vName) {
                            $vCntGB++;
                        }
                    }
                    if ($vCntGB > 0) {
                        echo '<nobr>', $vCntGB, 'x in GiftBox&nbsp;&nbsp;</nobr> ';
                    }
                    echo '</td>';
                    echo '<td>';
                    $vCntInSections = 0;
                    foreach ($vSecItems[$vName] as $vSecNum => $count) {
                        echo '<nobr>', $count, 'x in S.', $vSecNum, '&nbsp;&nbsp;</nobr> ';
                        $vCntInSections += $count;
                    }
                    echo '</td>';
                    echo '<td>';
                    $vCntWorld = $vCntItems[$vName];
                    if ($vCntWorld > 0) {
                        echo '<nobr>', $vCntWorld, 'x on Farm';
                        if ($vCntInSections != $vCntWorld && $vCntInSections > 0) {
                            echo ' / ', $vCntWorld - $vCntInSections, 'x not in Sections';
                        }
                        echo '</nobr>';
                    }
                    echo '</td>';
                    echo '</tr>';
                }
                echo '</table>';
                echo '</td></tr>';
                echo '</table>';
            }
            ######################################## tree
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'tree') {
                echo '<script>';
                echo 'function fCheckUncheckTree(vCheck){', "\n";
                foreach ($vTrees as $vName => $vRealName) {
                    echo 'document.forms["myform"].elements["s_t_' . htmlentities($vName) . '"].checked=vCheck;', "\n";
                }
                echo '}', "\n";
                echo '</script>';
                echo '<table id="tab_tree" border="0" cellspacing=0 cellpadding=0 width="100%" style="display: ';
                echo (@isset($thissec['type']) && $thissec['type'] == 'tree' ? 'block' : 'none') . '">';
                echo '<tr><td>';
                echo '&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:fCheckUncheckTree(true)">Select All</a>';
                echo '&nbsp; <a href="javascript:fCheckUncheckTree(false)">UnSelect All</a><br>';
                echo '<table class="cream" border="0" cellspacing="0" cellpadding="0">';
                echo '<tr bgcolor=white>';
                echo '<th></th><th>RealName</th><th>Name</th><th>In Giftbox</th><th>In Sections</th><th>On the Farm</th>';
                echo '</tr>';
                $vArray = explode('|', $thissec['tree']);
                foreach ($vTrees as $vName => $vRealName) {
                    echo '<tr bgcolor=white valign=top>';
                    echo '<td>';
                    echo '<input type="checkbox" name="s_t_', htmlentities($vName), '" value="1" ';
                    echo in_array(htmlentities($vName), $vArray) ? 'checked ' : '', '>';
                    echo '</td><td>', $vRealName, '</td><td>', $vName, '</td>';
                    echo '<td>';
                    $vCntGB = 0;
                    foreach ($vGiftboxContent['tree'] as $vItem) {
                        if ($vItem['name'] == $vName) {
                            $vCntGB++;
                        }
                    }
                    if ($vCntGB > 0) {
                        echo '<nobr>', $vCntGB, 'x in GiftBox&nbsp;&nbsp;</nobr> ';
                    }
                    echo '</td>';
                    echo '<td>';
                    $vCntInSections = 0;
                    foreach ($vSecItems[$vName] as $vSecNum => $count) {
                        echo '<nobr>', $count, 'x in S.', $vSecNum, '&nbsp;&nbsp;</nobr> ';
                        $vCntInSections += $count;
                    }
                    echo '</td>';
                    echo '<td>';
                    $vCntWorld = $vCntItems[$vName];
                    if ($vCntWorld > 0) {
                        echo '<nobr>', $vCntWorld, 'x on Farm';
                        if ($vCntInSections != $vCntWorld && $vCntInSections > 0) {
                            echo ' / ', $vCntWorld - $vCntInSections, 'x not in Sections';
                        }
                        echo '</nobr>';
                    }
                    echo '</td>';
                    echo '</tr>';
                }
                echo '</table>';
                echo '</td></tr>';
                echo '</table>';
            }
            ######################################## deco
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'deco') {
                $vEggNewNameArray[] = 'egg_white';
                $vEggOldNameArray[] = 'mysteryeggwhite';
                $vEggNewNameArray[] = 'egg_brown';
                $vEggOldNameArray[] = 'mysteryeggbrown';
                $vEggNewNameArray[] = 'egg_black';
                $vEggOldNameArray[] = 'mysteryeggblack';
                $vEggNewNameArray[] = 'egg_gold';
                $vEggOldNameArray[] = 'mysteryegggold';
                $vEggNewNameArray[] = 'egg_cornish';
                $vEggOldNameArray[] = 'mysteryeggcornish';
                $vEggNewNameArray[] = 'egg_rhodered';
                $vEggOldNameArray[] = 'mysteryeggrhodered';
                $vEggNewNameArray[] = 'egg_scotsgrey';
                $vEggOldNameArray[] = 'mysteryeggscotsgrey';
                echo '<script>';
                echo 'function fCheckUncheckDeco(vCheck){', "\n";
                foreach ($vDecorations as $vName => $vRealName) {
                    echo 'document.forms["myform"].elements["s_d_' . htmlentities($vName) . '"].checked=vCheck;', "\n";
                }
                echo '}', "\n";
                echo '</script>';
                echo '<table id="tab_deco" border="0" cellspacing=0 cellpadding=0 width="100%" style="display: ';
                echo (@isset($thissec['type']) && $thissec['type'] == 'deco' ? 'block' : 'none') . '">';
                echo '<tr><td>';
                echo '&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:fCheckUncheckDeco(true)">Select All</a>';
                echo '&nbsp; <a href="javascript:fCheckUncheckDeco(false)">UnSelect All</a><br>';
                echo '<table class="cream" border="0" cellspacing="0" cellpadding="0">';
                echo '<tr bgcolor=white>';
                echo '<th></th><th>RealName</th><th>Name</th><th>In Giftbox</th><th>In Sections</th><th>On the Farm</th>';
                echo '</tr>';
                $vArray = explode('|', $thissec['deco']);
                foreach ($vDecorations as $vName => $vRealName) {
                    echo '<tr bgcolor=white valign=top>';
                    echo '<td>';
                    echo '<input type="checkbox" name="s_d_', htmlentities($vName), '" value="1" ';
                    echo in_array(htmlentities($vName), $vArray) ? 'checked ' : '', '>';
                    echo '</td><td>', $vRealName, '</td><td>', $vName, '</td>';
                    echo '<td>';
                    $vCntGB = 0;
                    foreach ($vGiftboxContent['decoration'] as $vItem) {
                        if (str_replace($vEggOldNameArray, $vEggNewNameArray, $vItem['name']) == $vName) {
                            $vCntGB++;
                        }
                    }
                    if ($vCntGB > 0) {
                        echo '<nobr>', $vCntGB, 'x in GiftBox&nbsp;&nbsp;</nobr> ';
                    }
                    echo '</td>';
                    echo '<td>';
                    $vCntInSections = 0;
                    if (strpos($vName, 'egg_') !== false) {
                        foreach ($vSecItems[str_replace($vEggNewNameArray, $vEggOldNameArray, $vName)] as $vSecNum => $count) {
                            echo '<nobr>', $count, 'x in S.', $vSecNum, '&nbsp;&nbsp;</nobr> ';
                            $vCntInSections += $count;
                        }
                        $vCntWorld = $vCntItems[str_replace($vEggNewNameArray, $vEggOldNameArray, $vName)];
                    } else {
                        foreach ($vSecItems[$vName] as $vSecNum => $count) {
                            echo '<nobr>', $count, 'x in S.', $vSecNum, '&nbsp;&nbsp;</nobr> ';
                            $vCntInSections += $count;
                        }
                        $vCntWorld = $vCntItems[$vName];
                    }
                    echo '</td>';
                    echo '<td>';
                    if ($vCntWorld > 0) {
                        echo '<nobr>', $vCntWorld, 'x on Farm';
                        if ($vCntInSections != $vCntWorld && $vCntInSections > 0) {
                            echo ' / ', $vCntWorld - $vCntInSections, 'x not in Sections';
                        }
                        echo '</nobr>';
                    }
                    echo '</td>';
                    echo '</tr>';
                }
                echo '</table>';
                echo '</td></tr>';
                echo '</table>';
            }
            ######################################## building
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'building') {
                echo '<script>';
                echo 'function fCheckUncheckBuilding(vCheck){', "\n";
                foreach ($vBuildings as $vName => $vRealName) {
                    echo 'document.forms["myform"].elements["s_d_' . htmlentities($vName) . '"].checked=vCheck;', "\n";
                }
                echo '}', "\n";
                echo '</script>';
                echo '<table id="tab_building" border="0" cellspacing=0 cellpadding=0 width="100%" style="display: ';
                echo (@isset($thissec['type']) && $thissec['type'] == 'building' ? 'block' : 'none') . '">';
                echo '<tr><td>';
                echo '&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:fCheckUncheckBuilding(true)">Select All</a>';
                echo '&nbsp; <a href="javascript:fCheckUncheckBuilding(false)">UnSelect All</a><br>';
                echo '<table class="cream" border="0" cellspacing="0" cellpadding="0">';
                echo '<tr bgcolor=white>';
                echo '<th></th><th>RealName</th><th>Name</th><th>In Giftbox</th><th>In Sections</th><th>On the Farm</th>';
                echo '</tr>';
                $vArray = explode('|', $thissec['building']);
                foreach ($vBuildings as $vName => $vRealName) {
                    echo '<tr bgcolor=white valign=top>';
                    echo '<td>';
                    echo '<input type="checkbox" name="s_b_', htmlentities($vName), '" value="1" ';
                    echo in_array(htmlentities($vName), $vArray) ? 'checked ' : '', '>';
                    echo '</td><td>', $vRealName, '</td><td>', $vName, '</td>';
                    echo '<td>';
                    $vCntGB = 0;
                    foreach ($vGiftboxContent['building'] as $vItem) {
                        if ($vItem['name'] == $vName) {
                            $vCntGB++;
                        }
                    }
                    if ($vCntGB > 0) {
                        echo '<nobr>', $vCntGB, 'x in GiftBox&nbsp;&nbsp;</nobr> ';
                    }
                    echo '</td>';
                    echo '<td>';
                    $vCntInSections = 0;
                    foreach ($vSecItems[$vName] as $vSecNum => $count) {
                        echo '<nobr>', $count, 'x in S.', $vSecNum, '&nbsp;&nbsp;</nobr> ';
                        $vCntInSections += $count;
                    }
                    $vCntWorld = $vCntItems[$vName];
                    echo '</td>';
                    echo '<td>';
                    if ($vCntWorld > 0) {
                        echo '<nobr>', $vCntWorld, 'x on Farm';
                        if ($vCntInSections != $vCntWorld && $vCntInSections > 0) {
                            echo ' / ', $vCntWorld - $vCntInSections, 'x not in Sections';
                        }
                        echo '</nobr>';
                    }
                    echo '</td>';
                    echo '</tr>';
                }
                echo '</table>';
                echo '</td></tr>';
                echo '</table>';
            }
            ######################################## buyanim
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'buyanim') {
                echo '<table id="tab_buyanim" border="0" cellspacing=0 cellpadding=0 width="100%" style="display: ' . (@isset($thissec['type']) && $thissec['type'] == 'buyanim' ? 'block' : 'none') . '">';
                echo '<tr><td>';
                echo '<select name="buyanim" id="buyanim">';
                echo '<option ', $thissec['buyanim'] == '---' || $thissec['buyanim'] == '' ? 'selected ' : '', 'value="---">please select</option>';
                echo '<option style="background-color:#dddddd" value="">==== Buyable, Coins ===</option>';
                foreach ($vBuyAnimals['coins'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buyanim'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option style="background-color:#dddddd" value="">==== Buyable, Cash ===</option>';
                foreach ($vBuyAnimals['cash'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buyanim'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option style="background-color:#dddddd" value="">==== Not Buyable, Coins ===</option>';
                foreach ($vBuyAnimals['nocoins'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buyanim'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option style="background-color:#dddddd" value="">==== Not Buyable, Cash ===</option>';
                foreach ($vBuyAnimals['nocash'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buyanim'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '</select>';
                echo '</td></tr>';
                echo '</table>';
            }
            ######################################## buytree
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'buytree') {
                echo '<table id="tab_buytree" border="0" cellspacing=0 cellpadding=0 width="100%" style="display: ' . (@isset($thissec['type']) && $thissec['type'] == 'buytree' ? 'block' : 'none') . '">';
                echo '<tr><td>';
                echo '<select name="buytree" id="buytree">';
                echo '<option ', $thissec['buytree'] == '---' || $thissec['buytree'] == '' ? 'selected ' : '', 'value="---">please select</option>';
                echo '<option style="background-color:#dddddd" value="">==== Buyable, Coins ===</option>';
                foreach ($vBuyTrees['coins'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buytree'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option style="background-color:#dddddd" value="">==== Buyable, Cash ===</option>';
                foreach ($vBuyTrees['cash'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buytree'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option style="background-color:#dddddd" value="">==== Not Buyable, Coins ===</option>';
                foreach ($vBuyTrees['nocoins'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buytree'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option style="background-color:#dddddd" value="">==== Not Buyable, Cash ===</option>';
                foreach ($vBuyTrees['nocash'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buytree'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '</select>';
                echo '</td></tr>';
                echo '</table>';
            }
            ######################################## buydeco
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'buydeco') {
                echo '<table id="tab_buydeco" border="0" cellspacing=0 cellpadding=0 width="100%" style="display: ' . (@isset($thissec['type']) && $thissec['type'] == 'buydeco' ? 'block' : 'none') . '">';
                echo '<tr><td>';
                echo '<select name="buydeco" id="buydeco">';
                echo '<option ', $thissec['buydeco'] == '---' || $thissec['buydeco'] == '' ? 'selected ' : '', 'value="---">please select</option>';
                echo '<option style="background-color:#dddddd" value="">==== Buyable, Coins ===</option>';
                foreach ($vBuyDecorations['coins'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buydeco'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option style="background-color:#dddddd" value="">==== Buyable, Cash ===</option>';
                foreach ($vBuyDecorations['cash'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buydeco'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option style="background-color:#dddddd" value="">==== Not Buyable, Coins ===</option>';
                foreach ($vBuyDecorations['nocoins'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buydeco'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '<option style="background-color:#dddddd" value="">==== Not Buyable, Cash ===</option>';
                foreach ($vBuyDecorations['nocash'] as $vName => $vRealName) {
                    echo '<option ', $thissec['buydeco'] == htmlentities($vName) ? 'selected ' : '', 'value="' . htmlentities($vName) . '">' . htmlentities($vRealName . ' (' . $vName . ')') . '</option>';
                }
                echo '</select>';
                echo '</td></tr>';
                echo '</table>';
            }
            ######################################## dontmove
            if (!isset($_POST['edit_sec_form']) || $thissec['type'] == 'dontmove') {
                echo '<table id="tab_dontmove" border="0" cellspacing=0 cellpadding=0 width="100%" style="display: ' . (@isset($thissec['type']) && $thissec['type'] == 'dontmove' ? 'block' : 'none') . '">';
                echo '<tr><td>';
                echo '</td></tr>';
                echo '</table>';
            }
            echo '</fieldset><br/>';
            echo '<button type="submit" name="' . $action . '" value = "Save" onmouseover="this.className=\'hover\';" onmouseout="this.className=\'\';">Save</button>&nbsp;';
            echo '<button type="submit" name="undo" value="Back" onmouseover="this.className=\'hover\';" onmouseout="this.className=\'\';">Back</button>';
            echo '</form>';
        } else {
            echo '<table border="0" cellspacing="7" cellpadding="0"><tr valign=center>';
            echo '<td><big><b>Sections</b></big></td>';
            echo '<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>';
            echo '<form action="index.php" method="post">';
            echo '<td>';
            echo '<button type="submit" name="add_sec_form" value="Add section" onmouseover="this.className=\'hover\';" onmouseout="this.className=\'\';">Add section</button>';
            echo '</td>';
            echo '</form>';
            echo '<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>';
            echo '<form action="index.php" method="post">';
            echo '<input type="hidden" name="vDoExpension" value="on">';
            echo '<td>';
            echo '<button onclick="javascript:if(confirm(\'*REALLY* UPGRADED FARM? All Sections get move 8x8 Spots\')){this.form.submit()}" type="button" name="farm_expension" value="Farm Expension" onmouseover="this.className=\'hover\';" onmouseout="this.className=\'\';">Farm Expension</button>';
            echo '</td>';
            echo '</form>';
            echo '</tr></table>';
            echo '<table class="cream" border="0" cellspacing="0" cellpadding="0">';
            echo '<tr bgcolor=white>';
            echo '<th colspan=4>Number</th><th>&nbsp;Active&nbsp;</th><th>&nbsp;Place&nbsp;<br>&nbsp;Plow&nbsp;</th><th colspan=3>Top</th><th>&nbsp;</th><th colspan=3>Bottom</th><th>&nbsp;</th><th colspan=2>Details</th><th colspan=2>Content</th>';
            echo '</tr>';
            foreach ($sections as $num => $section) {
                echo '<tr bgcolor=white valign=top class="sec' . $num . '">';
                echo '<td align=left>' . $num . '</td>';
                echo '<td>';
                echo '<form action="index.php" methd="post">';
                echo '<input type="hidden" name="num" value="' . $num . '">';
                echo '<button type="submit" name="edit_sec_form" value="Edit" title="Edit" onmouseover="this.className=\'hover\';" onmouseout="this.className=\'\';">Edit</button>';
                echo '</td>';
                echo '</form>';
                echo '<form action="index.php" method="post"><td>';
                echo '<input type="hidden" name="num" value="' . $num . '">';
                echo '<button type="submit" name="copy_sec_form" value="Copy" title="Copy" onmouseover="this.className=\'hover\';" onmouseout="this.className=\'\';">Copy</button>';
                echo '</td></form>';
                echo '<form action="index.php" method="post"><td>';
                echo '<input type="hidden" name="num" value="' . $num . '">';
                echo '<button type="submit" name="del_sec" value="Del" title="Delete" onmouseover="this.className=\'hover\';" onmouseout="this.className=\'\';">Delete</button>';
                echo '</td></form>';
                echo '<td>';
                echo '&nbsp;&nbsp;&nbsp;';
                echo '<input onclick="self.location.href=\'index.php?vEditActive=' . $num . '&vActiv=' . ($section['active'] != 0 ? '0' : '1') . '\'" type="checkbox" name="active" value="1" ' . ($section['active'] != 0 ? 'checked ' : '') . '>';
                echo '</td>';
                echo '<td>';
                echo '&nbsp;&nbsp;';
                if ($section['type'] == 'anim' || $section['type'] == 'tree' || $section['type'] == 'deco' || $section['type'] == 'building' || $section['type'] == 'seed') {
                    echo '<input onclick="self.location.href=\'main.php?vEditPlace=' . $num . '&vPlace=' . ($section['place'] != 0 ? '0' : '1') . '\'"  type="checkbox" name="place" value="1" ' . ($section['place'] == 1 ? 'checked ' : '') . '>';
                }
                echo '</td>';
                echo '<td align="right">' . $section['top_x'] . '</td>';
                echo '<td>-</td>';
                echo '<td align="right">' . $section['top_y'] . '</td>';
                echo '<td>&nbsp;&nbsp;</td>';
                echo '<td align="right">' . $section['bot_x'] . '</td>';
                echo '<td>-</td>';
                echo '<td align="right">' . $section['bot_y'] . '</td>';
                echo '<td>&nbsp;&nbsp;</td>';
                echo '<td>' . $section['type'] . '</td>';
                echo '<td>';
                if ($section['type'] == 'seed') {
                    echo ' pattern ' . $section['pat'] . ": ";
                    echo Sections_GetValue($vSeeds, $section['seed']) . ' (' . $section['seed'] . ')';
                    echo $section['pat'] != 'none' ? '/' . Sections_GetValue($vSeeds, $section['seed2']) . ' (' . $section['seed2'] . ')' : '';
                } elseif ($section['type'] == 'anim') {
                    foreach (explode('|', $section['anim']) as $vAnimal) {
                        echo '<nobr>' . $vAnimals[$vAnimal] . ' (' . $vAnimal . ')&nbsp;&nbsp;&nbsp;</nobr> ';
                    }
                    if ($section['walk'] == 'walk') {
                        echo 'walk&nbsp;&nbsp;&nbsp; ';
                    }
                    if ($section['walk'] == 'stay') {
                        echo 'stay&nbsp;&nbsp;&nbsp; ';
                    }
                    if ($section['rotate'] == '0') {
                        echo '<nobr>bottom-left&nbsp;&nbsp;&nbsp;</nobr> ';
                    }
                    if ($section['rotate'] == '1') {
                        echo '<nobr>bottom-right&nbsp;&nbsp;&nbsp;</nobr> ';
                    }
                    if ($section['rotate'] == '2') {
                        echo '<nobr>top-right&nbsp;&nbsp;&nbsp;</nobr> ';
                    }
                    if ($section['rotate'] == '3') {
                        echo '<nobr>top-left&nbsp;&nbsp;&nbsp;</nobr> ';
                    }
                } elseif ($section['type'] == 'tree') {
                    foreach (explode('|', $section['tree']) as $vTree) {
                        echo '<nobr>' . (isset($vTrees[$vTree]) ? $vTrees[$vTree] . ' (' . $vTree . ')' : $vTree) . '&nbsp;&nbsp;&nbsp;</nobr> ';
                    }
                } elseif ($section['type'] == 'deco') {
                    foreach (explode('|', $section['deco']) as $vDeco) {
                        echo '<nobr>' . $vDecorations[$vDeco] . ' (' . $vDeco . ')&nbsp;&nbsp;&nbsp;</nobr> ';
                    }
                } elseif ($section['type'] == 'building') {
                    foreach (explode('|', $section['building']) as $Building) {
                        echo '<nobr>' . $vBuildings[$Building] . ' (' . $Building . ')&nbsp;&nbsp;&nbsp;</nobr> ';
                    }
                } elseif ($section['type'] == 'buyanim') {
                    echo $vAnimals[$section['buyanim']] . ' (' . $section['buyanim'] . ')';
                } elseif ($section['type'] == 'buytree') {
                    echo $vTrees[$section['buytree']] . ' (' . $section['buytree'] . ')';
                } elseif ($section['type'] == 'buydeco') {
                    echo $vDecorations[$section['buydeco']] . ' (' . $section['buydeco'] . ')';
                }
                echo '</td>';
                echo '<td>';
                foreach ($vSecLoc[$num] as $itemName => $count) {
                    echo '<nobr>', $count, 'x ' . $itemName . '</nobr> ';
                }
                echo '</td>';
                echo '</tr>';
            }
            echo '</table><br/>';
        }
        echo "</body></html>";
    }
}
Example #17
0
function TB_importSections()
{
    global $TB_settings_place;
    global $TB_settings;
    unset($TB_settings_place);
    //sections
    if (file_exists(Section_path . $_SESSION['userId'] . '_sections.txt')) {
        $sectionsSetting = @unserialize(file_get_contents(Section_path . $_SESSION['userId'] . '_sections.txt'));
        $TB_settings_place['useSections'] = true;
        foreach ($sectionsSetting as $section) {
            if ($section['type'] == 'anim' || $section['type'] == 'deco') {
                $itemNames = explode('|', $section[$section['type']]);
                foreach ($itemNames as $itemName) {
                    $TB_settings_place[$itemName]['x1'] = $section['bot_x'];
                    $TB_settings_place[$itemName]['y1'] = $section['bot_y'];
                    $TB_settings_place[$itemName]['x2'] = $section['top_x'];
                    $TB_settings_place[$itemName]['y2'] = $section['top_y'];
                }
            }
        }
    } else {
        $TB_settings_place['useSections'] = false;
    }
    //giftbox
    if (file_exists(GiftBox_path . $_SESSION['userId'] . '_GB_settings.txt')) {
        $giftboxSettings = @unserialize(file_get_contents(GiftBox_path . $_SESSION['userId'] . '_GB_settings.txt'));
        $TB_settings_place['useGiftBox'] = true;
        $TB_settings_place['GiftBox']['x1'] = $giftboxSettings['AnimalX1'];
        $TB_settings_place['GiftBox']['y1'] = $giftboxSettings['AnimalY1'];
        $TB_settings_place['GiftBox']['x2'] = $giftboxSettings['AnimalX2'] - 1;
        $TB_settings_place['GiftBox']['y2'] = $giftboxSettings['AnimalY2'] - 1;
        $TB_settings_place['decoration']['x1'] = $giftboxSettings['DecorationX1'];
        $TB_settings_place['decoration']['y1'] = $giftboxSettings['DecorationY1'];
        $TB_settings_place['decoration']['x2'] = $giftboxSettings['DecorationX2'] - 1;
        $TB_settings_place['decoration']['y2'] = $giftboxSettings['DecorationY2'] - 1;
    } else {
        $TB_settings_place['useGiftBox'] = false;
    }
    save_array($TB_settings_place, ToolBox_sections);
    //reset to avoid errors
    $TB_settings['TB_sectionsUseSections'] = false;
    $TB_settings['TB_sectionsUseGiftBox'] = false;
    $TB_settings['TB_sectionsUseGiftBoxDecoration'] = false;
}