} $this->_aos_left = isset($this->_result->energy) ? $this->_result->energy : $this->_aos_left; } private function debug() { if (false === $this->_debug_mode) { return $this; } $this->_info = is_array($this->_info) ? implode("\n", $this->_info) : $this->_info; dump($this->_result, $this->_info, $this->_error_code, $this->_error_msg); return $this; echo cli_message("\r\n DEBUG DUMP\n\r\n \t\t----------------------\r\n \t\t\t Result = {$this->_result} \n\r\n \t\t\t Result Info = {$this->_info} \n\r\n \t\t\t Error Code = {$this->_error_code} \n\r\n \t\t\t Error Message = {$this->_error_msg} \n\r\n\r\n "); return $this; } } $gangsta = new Wangsta($session); $units = array("Thug" => 25); $gangsta->set_troops($units); $seed1 = $seed2 = 1; if (rand(1, 999) % 2 == 0) { $seed1 = -1; } if (rand(1, 999) % 2 == 0) { $seed2 = -1; } if ($_GET['hood'] < 1) { die("Wrong hood number"); } $coord = $gangsta->get_coord($_GET['hood']); $x = $coord[0] + rand(1, 99) * $seed1; $y = $coord[1] + rand(1, 99) * $seed2;
} $this->_aos_left = isset($this->_result->energy) ? $this->_result->energy : $this->_aos_left; } private function debug() { if (false === $this->_debug_mode) { return $this; } $this->_info = is_array($this->_info) ? implode("\n", $this->_info) : $this->_info; dump($this->_result, $this->_info, $this->_error_code, $this->_error_msg); return $this; echo cli_message("\n DEBUG DUMP\n\n \t\t----------------------\n \t\t\t Result = {$this->_result} \n\n \t\t\t Result Info = {$this->_info} \n\n \t\t\t Error Code = {$this->_error_code} \n\n \t\t\t Error Message = {$this->_error_msg} \n\n\n "); return $this; } } $gangsta = new Wangsta($realm_id, $realm, $MI2Coords, $uid, $wgangsta, $hoods); // i use default but you can configure troops here /* $units = array( "Romeo" => 5000 ); */ $units = false; $gangsta->set_troops($units); $seed1 = $seed2 = 1; if (rand(1, 999) % 2 == 0) { $seed1 = -1; } if (rand(1, 999) % 2 == 0) { $seed2 = -1; }