Grepolis bot (Now with attack option)

02/04/2010 07:05 srialmaster#31
Quote:
Originally Posted by srialmaster View Post
Here's what I did:

//Get current ingame building queue
String l_QueuedBuilding1 = "";
String l_QueuedBuilding2 = "";
String l_QueuedBuilding3 = "";
String l_QueuedBuilding4 = "";
String l_QueuedBuilding5 = "";
String l_QueuedBuilding6 = "";
String l_QueuedBuilding7 = "";
l_Search = "id=\"main_tasks_0\"";
l_Index = l_Response.IndexOf(l_Search);
if (l_Index != -1)
{
l_Search = "/images/game/main/";
l_Index = l_Response.IndexOf(l_Search, l_Index);
l_QueuedBuilding1 = l_Response.Substring(l_Index + l_Search.Length, l_Response.IndexOf(".", l_Index) - (l_Index + l_Search.Length));
m_Towns[m_CurrentTown].IngameBuildingQueue[0] = l_QueuedBuilding1;
l_Search = "id=\"main_tasks_1\"";
l_Index = l_Response.IndexOf(l_Search);
if (l_Index != -1)
{
l_Search = "/images/game/main/";
l_Index = l_Response.IndexOf(l_Search, l_Index);
l_QueuedBuilding2 = l_Response.Substring(l_Index + l_Search.Length, l_Response.IndexOf(".", l_Index) - (l_Index + l_Search.Length));
m_Towns[m_CurrentTown].IngameBuildingQueue[1] = l_QueuedBuilding2;
l_Search = "id=\"main_tasks_1\"";
l_Index = l_Response.IndexOf(l_Search);
if (l_Index != -1)
{
l_Search = "/images/game/main/";
l_Index = l_Response.IndexOf(l_Search, l_Index);
l_QueuedBuilding3 = l_Response.Substring(l_Index + l_Search.Length, l_Response.IndexOf(".", l_Index) - (l_Index + l_Search.Length));
m_Towns[m_CurrentTown].IngameBuildingQueue[2] = l_QueuedBuilding3;
l_Search = "id=\"main_tasks_1\"";
l_Index = l_Response.IndexOf(l_Search);
if (l_Index != -1)
{
l_Search = "/images/game/main/";
l_Index = l_Response.IndexOf(l_Search, l_Index);
l_QueuedBuilding4 = l_Response.Substring(l_Index + l_Search.Length, l_Response.IndexOf(".", l_Index) - (l_Index + l_Search.Length));
m_Towns[m_CurrentTown].IngameBuildingQueue[3] = l_QueuedBuilding4;
l_Search = "id=\"main_tasks_1\"";
l_Index = l_Response.IndexOf(l_Search);
if (l_Index != -1)
{
l_Search = "/images/game/main/";
l_Index = l_Response.IndexOf(l_Search, l_Index);
l_QueuedBuilding5 = l_Response.Substring(l_Index + l_Search.Length, l_Response.IndexOf(".", l_Index) - (l_Index + l_Search.Length));
m_Towns[m_CurrentTown].IngameBuildingQueue[4] = l_QueuedBuilding5;
l_Search = "id=\"main_tasks_1\"";
l_Index = l_Response.IndexOf(l_Search);
if (l_Index != -1)
{
l_Search = "/images/game/main/";
l_Index = l_Response.IndexOf(l_Search, l_Index);
l_QueuedBuilding6 = l_Response.Substring(l_Index + l_Search.Length, l_Response.IndexOf(".", l_Index) - (l_Index + l_Search.Length));
m_Towns[m_CurrentTown].IngameBuildingQueue[5] = l_QueuedBuilding6;
l_Search = "id=\"main_tasks_1\"";
l_Index = l_Response.IndexOf(l_Search);
if (l_Index != -1)
{
l_Search = "/images/game/main/";
l_Index = l_Response.IndexOf(l_Search, l_Index);
l_QueuedBuilding2 = l_Response.Substring(l_Index + l_Search.Length, l_Response.IndexOf(".", l_Index) - (l_Index + l_Search.Length));
m_Towns[m_CurrentTown].IngameBuildingQueue[6] = l_QueuedBuilding7;
}
else
{
m_Towns[m_CurrentTown].IngameBuildingQueue[6] = "";
}
}
else
{
m_Towns[m_CurrentTown].IngameBuildingQueue[5] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[6] = "";
}
}
else
{
m_Towns[m_CurrentTown].IngameBuildingQueue[4] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[5] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[6] = "";
}
}
else
{
m_Towns[m_CurrentTown].IngameBuildingQueue[3] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[4] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[5] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[6] = "";
}
}
else
{
m_Towns[m_CurrentTown].IngameBuildingQueue[2] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[3] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[4] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[5] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[6] = "";
}
}
else
{
m_Towns[m_CurrentTown].IngameBuildingQueue[1] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[2] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[3] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[4] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[5] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[6] = "";
}
}
else
{
m_Towns[m_CurrentTown].IngameBuildingQueue[0] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[1] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[2] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[3] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[4] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[5] = "";
m_Towns[m_CurrentTown].IngameBuildingQueue[6] = "";
}
setStatusBar("Building levels updated.");
refreshBuildingLevels();
updateBuildPermission();
}
else
{
setStatusBar("Building levels not found");
debug("Building levels not found");
}
if (m_IsBotRunning)
m_Timer.Start();
break;
}
}

-Nate
Attached is my full Form1.cs:
02/04/2010 20:18 Utharnl#32
You can get that to work by using this part:
l_Search = "id=\"main_tasks_0\"";

You can find the other queues by editing the number from 0 - 6.

But if you can send me the source code when you have a full queue I can make it for you.
If you use FireFox login on grepolis and enter the senate, after that press ctrl+u.
If you use IE go to the same page and look in the IE menu for View Source.

~Uthar
02/04/2010 23:47 bountylord#33
hummn, cant seem to get the english version to work on my computer.
02/04/2010 23:56 Utharnl#34
Could you post your settings?
Maybe something is wrong there
02/05/2010 05:42 srialmaster#35
Quote:
Originally Posted by Utharnl View Post
You can get that to work by using this part:
l_Search = "id=\"main_tasks_0\"";

You can find the other queues by editing the number from 0 - 6.

But if you can send me the source code when you have a full queue I can make it for you.
If you use FireFox login on grepolis and enter the senate, after that press ctrl+u.
If you use IE go to the same page and look in the IE menu for View Source.

~Uthar
Should I try using main_tasks_0-6?

Ok, I do have to use main_tasks_0-6:

<div id="main_tasks">
<h4>Construction queue (4/7)</h4>
<div id="main_tasks_0" class="main_tasks_task">
<div style="position: relative;">
<div class="main_task_time">4:01:43</div>
<div style="width: 40px; height: 40px; background-image: url(/images/game/main/ironer.png)" class="main_tasks_image" id="order_0">
</div>
<a href="javascript:void(0)" id="finish_for_gold" class="main_tasks_finish " onclick="BuildingMain.confirm_finish_for_gold(1207 102)"></a>
</div>
</div>
<div id="main_tasks_1" class="main_tasks_task">
<div style="position: relative;">
<div class="main_task_time">4:33:16</div>
<div style="width: 40px; height: 40px; background-image: url(/images/game/main/ironer.png)" class="main_tasks_image" id="order_1">
</div>
<a href="javascript:void(0)" id="finish_for_gold" class="main_tasks_finish " onclick="BuildingMain.confirm_finish_for_gold(1207 108)"></a>
</div>
</div>
<div id="main_tasks_2" class="main_tasks_task">
<div style="position: relative;">
<div class="main_task_time">0:05:45</div>
<div style="width: 40px; height: 40px; background-image: url(/images/game/main/hide.png)" class="main_tasks_image" id="order_2">
</div>
<a href="javascript:void(0)" id="finish_for_gold" class="main_tasks_finish " onclick="BuildingMain.confirm_finish_for_gold(1207 112)"></a>
</div>
</div>
<div id="main_tasks_3" class="main_tasks_task">
<div style="position: relative;">
<div class="main_task_time">1:52:21</div>
<div style="width: 40px; height: 40px; background-image: url(/images/game/main/farm.png)" class="main_tasks_image" id="order_3">
</div>
<a href="javascript:void(0)" id="finish_for_gold" class="main_tasks_finish " onclick="BuildingMain.confirm_finish_for_gold(1208 415)"></a>
<a href="javascript:void(0)" id="main_tasks_cancel" class="main_tasks_cancel" onclick="BuildingMain.confirm_building_cancel_dial og.open()"></a>
</div>
</div>
<div id="main_tasks_right"></div>
</div>


It still doesn't work.
I have attached the updated form1.cs and senate_souce.htm, they are both in the form1.zip
02/05/2010 12:36 Utharnl#36
The idea is good, but there should be some small mistake somewhere. I will give it a better look this weekend to fix it.
I'm not planning to pay for this game so I can't test it. I'll send you the updated version so you can test it for me :)

~Uthar
02/08/2010 02:47 srialmaster#37
The one you sent me in PM seems to work well with 3 in queue. You know, once you get up to 1K, you can't really build so quickly anymore....

Any thoughts into adding the option to build troops too?
02/08/2010 07:42 Utharnl#38
Thanks for testing. Will add the new version with the source code when I get home later this day.

I haven't any plans for adding troops yet but maybe some time later.


//edit
Uploaded v1.2
02/09/2010 00:20 Ac3On3#39
what are the sources?
02/09/2010 20:52 Utharnl#40
The sources are the so called "source code".
Other developers or users that are interested in it can see then how I created the bot.

~Uthar
02/13/2010 00:47 patricia1#41
happy to see someone started a project bot for this game.
i will not use it atm, coz i'm premium and i already can queue 7 building (enought)
but if u plan to add some raid option, i will start to test

good luck
02/13/2010 16:58 Utharnl#42
Uploaded version 1.3
-Added resources and max storage
02/14/2010 09:11 EshLeN#43
Quote:
Originally Posted by Utharnl View Post
Uploaded version 1.3
-Added resources and max storage
GOOD JOB , really nice. And it's working even in ro servers.
We would love this bot more if you can add an atack option to farm cities near us.
02/15/2010 14:26 srialmaster#44
Quote:
Originally Posted by Utharnl View Post
Uploaded version 1.3
-Added resources and max storage
Hey,

Any chance to add a feature to save the queue list to a txt file so if we need to reboot, we can reload the program it once we login, it will have the same queue list we had before?

-Nate
02/15/2010 20:14 Unghiutza#45
It would be nice if you could make a raid option... :(