コード例 #1
0
$won = new WarOfNations();
// Initalize the data load tracker
$won->setDataLoadId(DataLoadDAO::initNewLoad($won->db, 'FLY_TROOPS', 0));
DataLoadDAO::startLoad($won->db, $won->data_load_id);
// Get the Device ID to use (main account)
if ($device_id == false) {
    $device_id = PgrmConfigDAO::getConfigProperty($won->db, 'value1', 'MAIN_DEVICE_ID');
}
// Authenticate
$auth_result = $won->Authenticate(false, $device_id, true);
$last_session_time = time();
//$auth_result = json_decode(file_get_contents('auth_result.json'), true);
//print_r($auth_result['responses'][0]['return_value']['player_towns']);
//print_r($auth_result['responses'][0]['return_value']['player_town_reserves']);
// Get an instance of our game operations class
$game = $won->GetGameOperations();
$unit_map = $game::GetUnitMap();
$log_seq = 0;
$func_log_id = DataLoadLogDAO::startFunction($won->db, $won->data_load_id, 'FlyTroops', 'Main');
while (true) {
    // Check configuration to make sure we aren't supposed to stop - this is the kill switch
    $stop = PgrmConfigDAO::getConfigProperty($won->db, 'value1', 'STOP_TROOP_FLYER');
    if ($stop == 'Y') {
        echo "Stop Signal Detected!\n";
        DataLoadLogDAO::logEvent2($won->db, $func_log_id, $log_seq++, 'INFO', 'Stop Signal Detected!');
        break;
    }
    // If enough time has passed, start out with a new session
    if (time() - $last_session_time > $hours_between_sessions * 60 * 60) {
        DataLoadLogDAO::logEvent2($won->db, $func_log_id, $log_seq++, 'INFO', "At least {$hours_between_sessions} hour(s) have passed. Starting new session.\n");
        // Save the data load for later, we don't want a new one
コード例 #2
0
// Start Loop Here
while ($amount_donated < $amount_needed) {
    // Create Alt
    $won_alt = new WarOfNations();
    $won_alt->setDataLoadId($won_main->data_load_id);
    // Create a new account
    $won_alt->auth->CreateNewPlayer();
    //$won_alt->Authenticate(false, 17); // Use if something fails
    usleep(1000000);
    // Join World 13
    if ($won_alt->auth->world_id != 13) {
        $won_alt->auth->JoinNewWorld(13);
    }
    usleep(1000000);
    // Buy Reinforced Concrete (180000)
    $game_alt = $won_alt->GetGameOperations();
    $game_alt->PurchaseItem('180000', 2);
    usleep(1000000);
    // Change Name
    $new_name = 'Player' . mt_rand(1000000, 9999999);
    $name_change = $game_alt->ChangeName($new_name);
    usleep(1000000);
    // Request Alliance
    $alliance_request = $game_alt->RequestAlliance($alliance_to_join);
    usleep(1000000);
    // Use Main - Accept into Alliance
    $game_main->AcceptAllianceRequest($won_alt->auth->player_id);
    usleep(1000000);
    // Donate Concrete
    $game_alt->DonateToAlliance('item', '180000', 2);
    // Reinforced Concrete