ogame-bot-api
Version:
Api to create a bot for ogame
84 lines (83 loc) • 2.61 kB
TypeScript
import { Account } from '../lobby/types';
import { ResourceList, ResourceFactoryList, FacilitiesList, ResearchList, ShipList, Ship, DefenseList, Defense, BuildingLight } from './types';
/**
* The GameApi is used to interact with the game itself, create and list ressources/ship/research...
* You should use LobbyApi to load it, don't create it yourself
*/
export declare class GameApi {
private account;
private axios;
private browser;
private page;
private cookie;
private loginUrl;
private navigation;
/**
* @hidden
*/
constructor(cookie: string, account: Account, loginUrl: string);
/**
* Start the game api
*/
start(): Promise<void>;
private __getServerUrl;
/**
* Stop the game api. You should called this before exiting your program.
*/
stop(): Promise<void>;
/**
* List your ressources
*/
resourcesList(): Promise<ResourceList>;
/**
* List your mines and storage
*/
resourceFactoryList(): Promise<ResourceFactoryList>;
/**
* List your facilities
*/
facilitiesList(): Promise<FacilitiesList>;
/**
* List you research
*/
researchList(): Promise<ResearchList>;
/**
* List your ships
*/
shipList(): Promise<ShipList>;
/**
* List your defenses
*/
defenseList(): Promise<DefenseList>;
/**
* Upgrade or create a building. Don't use it for ships/defenses
* @param building The building to upgrade
*/
makeUpgrade(building: BuildingLight): Promise<void>;
private haveEnoughResource;
/**
* Check if you can upgrade a building
* @param building the building to upgrade
* @param resources Optional parameter, if provided it will speed up the fonction
*/
canUpgrade(building: BuildingLight, resources?: ResourceList): Promise<boolean>;
/**
* Check if you can create a certain amount of ship/defense
* @param item Ship or Defense
* @param count The number of items you wants to create
* @param resources Optional parameter, if provided it will speed up the fonction
*/
canCreate(item: Ship | Defense, count?: number, resources?: ResourceList): Promise<boolean>;
/**
* Create a ship
* @param ship ship to create
* @param count number of ship to create
*/
createShip(ship: Ship, count?: number): Promise<void>;
/**
* Create a defense
* @param defense defense to create
* @param count number of defense to create
*/
createDefense(defense: Defense, count?: number): Promise<void>;
}