Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
78ecba3
Fixes: Fixed some bugs
yosh778 May 16, 2017
3c0cf79
Fixed last 0 exception after test fail
yosh778 May 16, 2017
0f8f97b
Merge remote-tracking branch 'dr1s/master'
yosh778 May 17, 2017
ffdd1b6
Fixed minor bug in get_next_building_to_build_on_planet
yosh778 May 17, 2017
8b2ca91
Restored Twilio SMS messaging
yosh778 May 17, 2017
1d7cef3
Fixed SMS Activation config parsing
yosh778 May 17, 2017
5192801
Fixed SMS indentation
yosh778 May 19, 2017
59c3106
Some language encoding fixes
yosh778 May 21, 2017
0599daa
Some more fixes
yosh778 May 21, 2017
81f71b7
Added more exception tolerance to automated tasks
yosh778 May 23, 2017
9a37148
Research: Improved auto_research
yosh778 May 23, 2017
cd701af
Improved get_cargo_fleet_for_mission fleet computation
yosh778 May 24, 2017
6ea19bb
debug
yosh778 May 24, 2017
87f572b
debug
yosh778 May 24, 2017
9cf6957
Fixed minor bug
yosh778 May 24, 2017
eafc3b0
Minor update
yosh778 May 24, 2017
cc23f13
Improved attacking planet selection
yosh778 May 24, 2017
8a33fe0
Fixed builder bug !
yosh778 May 24, 2017
f3f3fd8
Added more exception tolerance to spy reports parsing
yosh778 May 24, 2017
11e150b
Now aborting auto-spy when no more fleet slots are available
yosh778 May 25, 2017
b81d7f7
Fixed bug in nearest planet to coordinates function, improved it and
yosh778 May 25, 2017
28f464f
Improved spy bot by spying from all nearest planets
yosh778 May 25, 2017
8a76c47
Added config file parameter support
yosh778 May 25, 2017
2aba7dc
Added support for multiple cookies / accounts
yosh778 May 25, 2017
279d8ea
Added authentication loss detection and cancelling attack when no mor…
yosh778 May 25, 2017
90c9255
Now only attacking planets with enough resources
yosh778 May 26, 2017
a2b0d3f
Improved some logs
yosh778 May 26, 2017
18a2fa1
Implemented fleet auto-escape with max resources on incoming attacks
yosh778 May 27, 2017
0046b75
Started code for even better origin planet selection (order by loot, …
yosh778 May 27, 2017
cf21715
Fixed fleet send bug
yosh778 May 27, 2017
6b46437
Added mission type to fleet movements and now only escaping hostile a…
yosh778 May 27, 2017
c8ae1cb
Now updating slots counters between each attack
yosh778 May 27, 2017
504bb4f
Now ordering origin attack planets by predicted loot then proximity f…
yosh778 May 27, 2017
3759033
Fixed latest feature
yosh778 May 27, 2017
40d64d2
Switched back to attacking from nearest planets
yosh778 May 27, 2017
5a9787d
Improved exception logs
yosh778 May 27, 2017
5cb1185
Fixed exception handling issues
yosh778 May 27, 2017
21ae8c4
Logging fix
yosh778 May 27, 2017
eb0547e
Do not auto-build structures if 150 fields already taken on a planet
yosh778 May 30, 2017
8b5e691
Some improvements
yosh778 May 30, 2017
0216ced
Fix
yosh778 May 30, 2017
26c8569
Fix
yosh778 May 30, 2017
7117f52
Fixed some bugs
yosh778 May 31, 2017
9a2a7ba
Some more improvements
yosh778 May 31, 2017
1ed96b7
Optimization
yosh778 Jun 2, 2017
710cc61
Fix
yosh778 Jun 3, 2017
0d8c7bc
Allow moon fleet destruction
yosh778 Jun 3, 2017
5aaa629
+
yosh778 Jun 3, 2017
68e2d97
Fixed general target galaxy parsing (including player rank informations)
yosh778 Jun 3, 2017
2541ba0
Escape fleet fix
yosh778 Jun 3, 2017
35627ab
+
yosh778 Jun 3, 2017
a13eb10
Fix
yosh778 Jun 3, 2017
3c955a7
Fix
yosh778 Jun 3, 2017
cf41452
Fix
yosh778 Jun 3, 2017
1de6303
Fix
yosh778 Jun 4, 2017
4f7bae7
Update
yosh778 Jun 4, 2017
fa76cf0
debug
yosh778 Jun 4, 2017
cad952c
Fix
yosh778 Jun 4, 2017
05d82cd
Cleanup
yosh778 Jun 4, 2017
3aaaa41
+
yosh778 Jun 9, 2017
6f1358d
+
yosh778 Jun 9, 2017
a08fc7b
+
yosh778 Jun 9, 2017
b7c28ba
+
yosh778 Jun 10, 2017
08a9bca
+
yosh778 Jun 10, 2017
35ebd4a
+
yosh778 Jun 10, 2017
af4899b
+
yosh778 Jun 10, 2017
d245b61
+
yosh778 Jun 10, 2017
0456206
+
yosh778 Jun 10, 2017
7ff613a
+
yosh778 Jun 11, 2017
ee9b9e9
+
yosh778 Jun 11, 2017
64bafed
+
yosh778 Jun 11, 2017
373ff61
Added moons support
yosh778 Jun 11, 2017
77535d3
Fix
yosh778 Jun 11, 2017
a7847c0
Fix
yosh778 Jun 11, 2017
dd77e5d
Fix
yosh778 Jun 11, 2017
3af796d
Fix
yosh778 Jun 11, 2017
aee642b
Fix
yosh778 Jun 11, 2017
686cf6b
Fix
yosh778 Jun 11, 2017
7feaa11
Fix
yosh778 Jun 11, 2017
9caae00
Fix
yosh778 Jun 11, 2017
87178e1
Fix
yosh778 Jun 11, 2017
1f27377
Fix
yosh778 Jun 11, 2017
4cb60a0
+
yosh778 Jun 11, 2017
5a16f4e
Added Ogame API server config
yosh778 Jun 14, 2017
b26e0f5
+
yosh778 Jun 14, 2017
2fd5a0b
+
yosh778 Jun 14, 2017
ff1e27b
+
yosh778 Jun 14, 2017
f8aa71f
+
yosh778 Jun 14, 2017
5748d79
+
yosh778 Jun 15, 2017
7cfc03a
Moon optim
yosh778 Jun 15, 2017
e501973
Moon escape fix
yosh778 Jun 17, 2017
21e73e1
+
yosh778 Jun 18, 2017
0a77169
+
yosh778 Jun 23, 2017
9886c9f
+
yosh778 Jun 24, 2017
7e3cc87
Added auto repair / collect ships
yosh778 Jun 25, 2017
7e8a686
No more recyclers to attack : too slow
yosh778 Jun 25, 2017
ec1c9f4
No more recyclers to attack : too slow
yosh778 Jun 25, 2017
ba62af9
Added day item autobuy
yosh778 Jun 25, 2017
1973d41
+
yosh778 Jun 25, 2017
50c432d
+
yosh778 Jun 25, 2017
544a4b6
+
yosh778 Jun 25, 2017
bede5a4
+
yosh778 Jun 25, 2017
e0df77f
Fix
yosh778 Jul 1, 2017
5396e4e
Added player rank to logs
yosh778 Jul 1, 2017
32da7da
+
yosh778 Jul 2, 2017
5132024
+
yosh778 Jul 4, 2017
9b7cad8
+
yosh778 Jul 8, 2017
31a0efb
+
yosh778 Jul 9, 2017
cb23b7a
Optims
yosh778 Jul 9, 2017
9a36cc5
Fix
yosh778 Jul 9, 2017
d786e64
Update README.md
yosh778 Jul 13, 2017
b1b6789
Update README.md
yosh778 Jul 13, 2017
bc1d596
Added some frontend html interface
yosh778 Jul 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ The currently supported modes are: <br />
- transport_resources_to_planet - transport resources from all of your planets to planet x(must be one of your planets) <br />
- transport_resources_to_weaker_planet - transport resources from all of your planets to the planet that has less buldings <br />
- auto_build_structure_to_weaker_planet - Build structure on the weaker planet
- auto_build_structures - Build structures on planets
- auto_build_structures - Build structures on planets / moons, auto repair & collect ships, auto-buy new day item,
- auto_research - Research on your homeplanet
- check_hostile_activity : Check for hostile activities & attempt fleet escapes with most resources (slow hostile spy missions are considered as attacks too)

e.g.: <br />

Expand Down
75 changes: 75 additions & 0 deletions html/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

<html>
<head>
<meta http-equiv="refresh" content="20">
</head>

<body>
<?php include('more.html') ?>

<pre>
<?php


$check="ps -aux | grep OG";
$escapes0="grep 'Current rank' ~/og_log_ur.txt | tail -1 && grep Incoming ~/og_log_ur.txt -A 3 | tail -n +0 | tail -n 30 | tac";
$escapes1="grep 'Current rank' ~/og_log_libra.txt | tail -1 && grep Incoming ~/og_log_libra.txt -A 3 | tail -n +0 | tail -n 30 | tac";
$escapes2="grep 'Current rank' ~/og_log_vi* | tail -1 && grep Incoming ~/og_log_vi* -A 3 | tail -n +0 | tail -n 30 | tac";
$escapes3="grep 'Current rank' ~/og_log_rh* | tail -1 && grep Incoming ~/og_log_rh* -A 3 | tail -n +0 | tail -n 30 | tac";

date_default_timezone_set('Europe/Paris');


$now = new DateTime();
echo $now->format('Y-m-d H:i:s');

echo ' <a href="/log" target="_blank">logs</a>';

echo "\n\n\nCurrently running : ";

//passthru( $check, $out );
exec( $check, $out );

$vals = array('libra','uriel','rhea','virgo');

foreach ($out as $line) {
foreach ($vals as $val) {

if ( strstr($line, $val) ) {
$$val = true;
}

}
}


foreach ($vals as $val) {
if ($$val) {
echo $val . " ";
}
}


echo "\n\n\nLatest escapes :\n\n";

echo "Uriel\n\n";
passthru( $escapes0 );

echo "\n\nLibra\n\n";
passthru( $escapes1 );

echo "\n\nVirgo\n\n";
passthru( $escapes2 );

echo "\n\nRhea\n\n";
passthru( $escapes3 );


echo '</pre>';

?>


</body>
</html>

11 changes: 11 additions & 0 deletions html/log/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>


<div style="height:20px;"></div>
<div class="col-md-3">
<a class="btn btn-warning btn-xs" target="_blank" href="/">back</a> <br><br>
<a class="btn btn-primary btn-xs" target="_blank" href="/log/libra.php">libra</a>
<a class="btn btn-primary btn-xs" target="_blank" href="/log/rhea.php">rhea</a>
<a class="btn btn-primary btn-xs" target="_blank" href="/log/uriel.php">uriel</a>
<a class="btn btn-primary btn-xs" target="_blank" href="/log/virgo.php">virgo</a>
</div>
7 changes: 7 additions & 0 deletions html/log/libra.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<pre>
<?php
passthru('tail -n 20000 ~/og_log_libra.txt | tac');

?>
</pre>

7 changes: 7 additions & 0 deletions html/log/rhea.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<pre>
<?php
passthru('tail -n 20000 ~/og_log_rhea.txt | tac');

?>
</pre>

7 changes: 7 additions & 0 deletions html/log/uriel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<pre>
<?php
passthru('tail -n 20000 ~/og_log_ur.txt | tac');

?>
</pre>

7 changes: 7 additions & 0 deletions html/log/virgo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<pre>
<?php
passthru('tail -n 20000 ~/og_log_vi.txt | tac');

?>
</pre>

155 changes: 155 additions & 0 deletions html/more.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>

<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


<div class="well well-lg">

<div class="col-md-3">
<form class="pull-left" id="loginForm" name="loginForm" target="_blank" method="post" action="https://en.ogame.gameforge.com:443/main/login">
<input type="hidden" name="kid" value="">
<input type="hidden" name="login" value="">
<input type="hidden" name="pass" value="">
<input type="hidden" name="uni" value="s138-en.ogame.gameforge.com">
<input type="submit" class="btn btn-info btn-xs" id="loginSubmit" value="Libra">
&nbsp;
</form>

<form class="col-md-offset-0 pull-left" id="rhea" name="loginForm" target="_blank" method="post" action="https://fr.ogame.gameforge.com:443/main/login">
<input type="hidden" name="kid" value="">
<input type="hidden" name="login" value="">
<input type="hidden" name="pass" value="">
<input type="hidden" name="uni" value="s144-fr.ogame.gameforge.com">
<input type="submit" class="btn btn-info btn-xs" id="loginSubmit" value="Rhea">
<!--
<a href="?target=rhea" class="btn btn-info btn-xs" onclick="document.getElementById('rhea').submit();">Rhea</a>
-->
&nbsp;
</form>

<form class="pull-left" id="Uriel" name="loginForm" target="_blank" method="post" action="https://fr.ogame.gameforge.com:443/main/login">
<input type="hidden" name="kid" value="">
<input type="hidden" name="login" value="">
<input type="hidden" name="pass" value="">
<input type="hidden" name="uni" value="s147-fr.ogame.gameforge.com">
<input type="submit" class="btn btn-info btn-xs" id="loginSubmit" value="Uriel">
&nbsp;
</form>

<form class="pull-left" id="loginForm" name="loginForm" target="_blank" method="post" action="https://fr.ogame.gameforge.com:443/main/login">
<input type="hidden" name="kid" value="">
<input type="hidden" name="login" value="">
<input type="hidden" name="pass" value="">
<input type="hidden" name="uni" value="s148-fr.ogame.gameforge.com">
<input type="submit" class="btn btn-info btn-xs" id="loginSubmit" value="Virgo">
</form>
</div>

<div class="col-md-offset-7">
<form class="form-inline">
<div class="form-group">
<input type="password" class="form-control"
value="" onchange="save('login', this.value)"
name="login" id="name" placeholder="Login">
</div>
<div class="form-group">
<input type="password" class="form-control"
value="" onchange="save('pass', this.value)"
name="pass" id="password" placeholder="Password">
</div>
</form>
</div>

</div>


<script>
/*
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;

for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');

if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
}

var target = getUrlParameter('target');

var form = $('#'+target);

var data = JSON.stringify( form.serializeArray() );


$.ajax({
url: form.attr('action'),
type: 'POST',
data: data,
crossDomain: true,
success: function() {

$log.log('yes')

}
});
*/

function getLogin() {
return $('#name').val();
}


function getPass() {
return $('#password').val();
}

$('#name').val( load('login') );
$('#password').val( load('pass') );


$("form").each( function() {

var form = $(this);

form.submit(function(e) {
var self = this;

e.preventDefault();

var login = form.find('input[name=login]');
var pass = form.find('input[name=pass]');

login.val( getLogin() );
pass.val( getPass() );

self.submit();

return false;
});

});



function save(name, value) {
localStorage.setItem(name, value);
}

function load(name) {
return localStorage.getItem(name);
}


</script>

19 changes: 14 additions & 5 deletions ogbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def __init__(self, browser, config):
self.config = config
self.logger = logging.getLogger('OGBot')

# Get planets and remove excluded planets in the config file
planets = general.General(browser, config).get_planets()
planets = filter(lambda x: x.name.lower() not in config.excluded_planets, planets)
self.general_client = general.General(browser, config)
planets = self.general_client.get_planets()
self.planets = planets

self.attacker_bot = attacker.AttackerBot(browser, config, planets)
self.defender_bot = defender.DefenderBot(browser, config, planets)
Expand All @@ -28,6 +28,11 @@ def __init__(self, browser, config):
self.movement_bot = movement.MovementBot(browser, config, planets)
self.sms_sender = sms.SMSSender(config)

def print_resources(self):
for planet in self.planets:
res = self.general_client.get_resources(planet)
self.logger.info("%s : %s" % (planet, res))

def explore(self):
self.expeditionary_bot.auto_send_expeditions()
self.attack_inactive_planets()
Expand All @@ -38,13 +43,17 @@ def attack_inactive_planets(self):
if len(reports) == 0:
self.logger.info("There isn't any valid spy reports from inactive targets")
self.logger.info("Scanning for new targets")
self.spy_bot.auto_spy_inactive_planets(self.config.attack_range)
error = self.spy_bot.auto_spy_inactive_planets(self.config.attack_range)

if error:
return True

self.logger.info("Waiting %f seconds for probes to return" % self.config.time_to_wait_for_probes)
time.sleep(self.config.time_to_wait_for_probes)
reports = self.messages_bot.get_valid_spy_reports_from_inactive_targets()
self.attacker_bot.attack_inactive_planets_from_spy_reports(reports)
else:

else:
self.attacker_bot.attack_inactive_planets_from_spy_reports(reports)

self.messages_bot.clear_spy_reports()
Expand Down
Loading