<?php session_start(); if (isset($_POST['action']) && $_POST['action'] == 'reset') { redo(); } else { if (!isset($_SESSION['gold']) && !isset($_SESSION['activities'])) { $_SESSION['gold'] = 0; $_SESSION['activities'] = ""; } } // var_dump($_POST); if ($_POST['building'] == 'farm') { farm(); } else { if ($_POST['building'] == 'cave') { cave(); } else { if ($_POST['building'] == 'house') { house(); } else { if ($_POST['building'] == 'casino') { casino(); } } } } ?> <?php
function attack_and_farm_loop($village, $incoming_attack_remain_seconds) { $result = get_a2b_page(); // not being attacked, we need cumulate clubs for attack if ($incoming_attack_remain_seconds > 1800 || $incoming_attack_remain_seconds < 0) { $need_more_clubs = attack($result, $village); if ($need_more_clubs) { return; } } for ($i = 0; $i < 20; $i++) { if (!farm($result, $village)) { return; } // refresh a2b page $result = get_a2b_page(); } }
// villages in heavy defending if ($village == 999999) { transfer_to_village($village, $auto_transfer, true); // resource village } else { transfer_to_village($village, $auto_transfer); } } else { if ($village > 0) { $result = switch_village($village); } build($village, $result); if ($village == $main_village) { build_infantry(2, 25); $result = get_a2b_page(); if (!attack($result, $village)) { for ($i = 0; $i < 20; $i++) { if (!farm($result, $village)) { break; } // refresh a2b page $result = get_a2b_page(); } } /* }else{ // villages in building transfer_to_village($village, $main_village, false, 70); */ } } }