TravianApi
Guerrilla Api for Travian. Why Guerrilla? Because is not oficcial, scraping bassed api.
WARNING: If u use the api, you can be baneated from game. It's for educational porpouses only.
What can i do with that?
Actually, i have implemented the construction functionality. You can build resources, build builgings (no, it's not redundant), consult actual production, consult actual queue, map resoures and map buildings.
Methods:
General
Constructor:
api = TravianGuerrillaApi("user_example","password_example", "server_example","domain_example")
Initialize the api
loggin(user, pasword)
Log in the travian webpage ( constructor do that)
Resources and buildings
actual_queue()
Show the actual construction queue
busy_until()
Return the seconds to complete the construction queue
build_resource(resource_id)
Build (if its posible) a resource (dorf1) in the resource_id position
show_avilable_building(solar_id,category_id=1):
Show the possible buildings for a certain solar, category is arbitrari, default 1 (1 - infraestructure, 2 - military, 3 - resources)
build_building(solar_id, building_id)
If posible, build a certain building in the specified solar
upgrade_building(solar_id):
If possible, upgrade the building in the speified solar
get_actual_production()
Show the actual resource production
map_resources()
Show the actual resources (dorf1) ,their levels and the id
map_buildings()
Show the actual buildings (dorf2) ,their levels and the id
actual_resources()
Show the actual balance of the resources
Units production
show_available_units(solar_id)
Show the actual available units (infantry)
create_units(solar_id,t1,t2,t3)
Create units in the barracks, only infantry (on construction)
get_actual_units()
Returns a dict with {'troop_name':'number of units'}
get_actual_units_by_tier()
Returns a dict with {'tier':'number of units'}
Units movements
send_attack(coord, mode='4', t1=0, t2=0, t3=0, t4=0, t5=0, t6=0, t7=0, t8=0, t9=0, t10=0)
Send attack to the specified coordenates:
Usage
- coord -> ['88','-55']
- mode:
- '2' -> reinforcement
- '3' -> normal attack
- '4' -> raid attack
Village management
list_villages()
Return a dict of village and id
set_village(village_id)
set the village to manage
World infromation
get_alliance(alliance_id)
Returns an Alliance object with information of the ally and their members
show_land(coord_x, coord_y)
Return inormation about the selected land