aalises / age-of-empires-II-api

API for Age of Empires II Built with Flask-RESTFul + SQLAlchemy
https://age-of-empires-2-api.herokuapp.com
BSD 3-Clause "New" or "Revised" License
120 stars 31 forks source link

Age of Empires 2 API

Coverage Status Docker Image

Disclaimer

The Age of Empires II API was originally conceived as a pet project 6 years ago (...already, phew!). Initially I had it running on Heroku and was working just fine.

As time passed people was using it, paired with good ole' Heroku changing its ways and quotes, we were running out of the free tier hours, so unfortunately I had to shut it down.

Don't have time these days to dedicate to it and I'm not sure if it's still working as intended, so take the project with a pinch of salt! Anyways, feel free to improve it, fork it, self-host it (there's the docker image still dangling around), or do with it whatever you see fit!

Farewell, paladins!


Age of Empires II API created with:

Which allows you to retrieve information about the civilizations, technologies, units and structures of AOE2. To run you can use Docker, for example:

docker build -t aoe2api:v1 .
docker run --name aoe2api -p 8080:80 -d aoe2api:v1 

or pull the image from DockerHub:

docker pull aalises/aoe2api:latest

The routes are:

To test using pytest, just run

python -m pytest

For testing the coverage using coverage run:

coverage run -m pytest

Models


Civilization


Model describing a civilization in AOE2. Parameters:

Technology


Model describing a Technology in AOE2. Parameters:

Unit


Model describing a Unit in AOE2. Parameters:

Structure


Model describing a Structure in AOE2. Parameters:

Resources

The API allows to retrieve information about civilizations, structures, units and technologies for the AOE2 Age of Kings and The Conquerors. The base route returns an object with the different resources you can access

Example call /api/v1/civilization/bizantines

{
  "id": 3, 
  "name": "Bizantines", 
  "expansion": "Age of Kings", 
  "army_type": "Defensive", 
  "unique_unit": [
    "http://localhost/unit/cataphract"
  ], 
  "unique_tech": [
    "http://localhost/technology/logistica"
  ], 
  "team_bonus": "Monks +50% heal speed", 
  "civilization_bonus": [
    "Buildings (except gates) have +10% HP in Dark Age / +20% HP in Feudal Age  / +30% in Castle Age / +40% in Imperial Age", 
    "Spearman skirmisher and camel lines cost 25% less", 
    "Fire Ships attack 20% faster", 
    "Imperial Age costs -33%", 
    "Town Watch is free"
  ]
}

Example call /api/v1/unit/berserk

{
  "id": 69, 
  "name": "Berserk", 
  "description": "Viking unique unit. Infantry that slowly heals itself", 
  "expansion": "Age of Kings", 
  "age": "Castle", 
  "created_in": "http://localhost/structure/castle", 
  "cost": {
    "Food": 65, 
    "Gold": 25
  }, 
  "build_time": 16, 
  "reload_time": 2.0, 
  "movement_rate": 1.05, 
  "line_of_sight": 3, 
  "hit_points": 55, 
  "attack": 9, 
  "armor": "0/1", 
  "attack_bonus": [
    "+2 eagles", 
    "+2 buildings"
  ]
}

Example call /api/v1/structure/29

 {
    "id": 29, 
    "name": "Mill", 
    "expansion": "Age of Kings", 
    "age": "Castle", 
    "cost": {
      "Wood": 100
    }, 
    "build_time": 35, 
    "hit_points": 1000, 
    "line_of_sight": 5, 
    "armor": "2/9", 
    "special": [
      "Max 40 farms queued"
    ]
  }

Example call /api/v1/technology/gold_mining

{
  "id": 58, 
  "name": "Gold Mining", 
  "expansion": "Age of Kings", 
  "age": "Feudal", 
  "develops_in": "http://localhost/structure/mining_camp", 
  "cost": {
    "Food": 100, 
    "Wood": 75
  }, 
  "build_time": 30, 
  "applies_to": [
    "Gold Miners"
  ], 
  "description": "Work rate * 1.15 (15% faster)"
}