Esim - API tutorial
Login:
Password:

Forgot password Register

Article


41
   
Report



Az e-sim API még fejlődik, de már egy vázlat kész van. Erről írok, továbbá a nemhivatalos API-król is. A cikk végén 2 példakód is található.

1. Amit tudni kell
Az API JSON-ban tér vissza. XML formátum sajnos még nincs. Túl sok lekérést NE indíts, mert bannolják az IP-det.

2. Hivatalos API-k.
Polgár (név és ID szerint), régiólista, országlista, rang lista, térkép adatok, MU id-ről, ütések csatában, MU tagok.

2.1. Polgár API
Linkek: http://e-sim.org/apiCitizenByName.html?name=NÉV ill. http://e-sim.org/apiCitizenById.html?id=ID.
Tartalma: strength (erő), damageToday (mai sebzés), economySkill (gazdasági skill), totalDamage (teljes sebzés), organization (org-e?), citizenship (ÁP), level (XP szint), xp (XP), login (usernév), id (ID), rank (rang, névvel).
Rendeltetése: polgár alapadatainak kinyerése.

2.2. Régiólista API
Link: http://e-sim.org/apiRegions.html
Tartalma: blokkok, melyben mindben van: neighbours (szomszéd régiók IDje), homeCountry (eredeti tulaj ország IDje), capital (főváros-e?), rawRichness (milyen jó a rawja?), resource (mi a rawja?), name (régiónév), id (régió ID).
Rendeltetése: a régiókról információkinyerés.

2.3. Rang lista API (nem ranglista!)
Link: http://e-sim.org/apiRanks.html
Tartalma: blokkok, melyben mindben van: damageModifier (a sebzésképletben hogy számít), name (mi a neve?), damageRequired (mennyi sebzés kell hozzá
Rendeltetése: nem kell manuális rang listát létrehozni

2.4. Ország lista API
Link: http://e-sim.org/apiCountries.html
Tartalma: blokkok, melben van: shortName (2 karakteres rövidítés pl HU), name (név), id (ID), currencyName (pénznem rövidítése pl HUF)
Rendeltetése: országokról információ kinyerés

2.5. Térkép adatok API
Link: http://e-sim.org/apiMap.html
Tartalma: blokkok, melyekben van: rawRichness (milyen a nyersi), raw (mi a nyersi - lehet üres), capital (főváros-e), battle (van-e csata), occupantId (kié, companies (cégszám), population (lakosság), regionId (régió ID), defensiveBuildings (védő épületek száma)
Rendeltetése: régiólista helyett használható IG fontosabb adatokhoz.

2.6. MU API
Link: http://e-sim.org/apiMilitaryUnitById.html?id=ID
Tartalma: goldValue (mennyit ér goldban), countryId (hol van), totalDamage (teljes sebzés), maxMembers (hány tagja lehet), militaryUnitType (milyen a típusa? pl. Elite), name (MU neve)
Rendeltetése: MU alapadatok kinyerése

2.7. Ütések API
Link: http://e-sim.org/apiFights.html?battleId=ID&roundId=KÖR
Tartalma: blokkok, melyekben van: citizenId (ütő IDje), citizenship (ütő ÁPje), militaryUnit (MU ID-je, lehet üres), militaryUnitBonus (MU bónusz mértéke, lehet üres), berserk (berserk volt?), defenderSide (védő oldal-e?), weapon (fegyó Qja), time (mikor), damage (sebzés).
Rendeltetése: ütési információk kinyerése.

3. Nemhivatalos API-k
Egy medál és egy csata API-ról tudok. Ez a kettő egy külsős user szerzeménye.

3.1 Amit tudni kell róluk
Nemhivatalos APIk, használatuk elméletben nem tiltott, de nemhivatalosságuk okán pontatlanok lehetnek. Visszatérésük JSON.
3.2 Medál API
Link: http://www.craea.name/api/esim/medal/name/json/USERNÉV és http://www.craea.name/api/esim/medal/name/id/ID
Tartalma: total (teljes medálszám, hibás!), id (user ID), name (usernév), továbbá blokkok, melyek tartalma: type (medál típusa), amount (darabszám).
Rendeltetése: a medálok kinyerése.
3.3 Csata API
Link: http://www.craea.name/api/esim/battle/ID
Tartalma: region (régiónév), regionid (régió ID), roundnow (aktuális kör), resistance (RW-e), time (eltelt idő), defender (benne: name [országnév], damage [teljes sebzés], bar [százalék], roundwin [nyert körök száma) és attacker (benne ugyanaz, mint a defender.

4. Példakódok
Bár nem nagy feladat, de jöjjön néhány példa kód. Megjegyezném, hogy a kódolási stílusért (pl. dsds nevű függvény ) elnézést kérek, de ezeket a kódokat eredetileg nem kiadásra szántam
4.1 Sebzésszámító
A példakód kommentezve a pastebinen .
4.2 Csatába ütők oldal, (esetleg még CS és MU alapján)
A példakód kommentezve a pastebinen .

Previous article:
Ernst és WM vs krain, a HM? (13 years ago)

Next article:
A zsoldrendszer baja (13 years ago)

ESim
or
Register for free:
Only letters, numbers, underscore and space are allowed (A-Z,a-z,0-9,_,' ')
Show more

By clicking 'Sign Up!', you agree to the Rules and that you have read the Privacy Policy.

About the game:


USA as a world power? In E-Sim it is possible!

In E-Sim we have a huge, living world, which is a mirror copy of the Earth. Well, maybe not completely mirrored, because the balance of power in this virtual world looks a bit different than in real life. In E-Sim, USA does not have to be a world superpower, It can be efficiently managed as a much smaller country that has entrepreneurial citizens that support it's foundation. Everything depends on the players themselves and how they decide to shape the political map of the game.

Work for the good of your country and see it rise to an empire.

Activities in this game are divided into several modules. First is the economy as a citizen in a country of your choice you must work to earn money, which you will get to spend for example, on food or purchase of weapons which are critical for your progress as a fighter. You will work in either private companies which are owned by players or government companies which are owned by the state. After progressing in the game you will finally get the opportunity to set up your own business and hire other players. If it prospers, we can even change it into a joint-stock company and enter the stock market and get even more money in this way.


In E-Sim, international wars are nothing out of the ordinary.

"E-Sim is one of the most unique browser games out there"

Become an influential politician.

The second module is a politics. Just like in real life politics in E-Sim are an extremely powerful tool that can be used for your own purposes. From time to time there are elections in the game in which you will not only vote, but also have the ability to run for the head of the party you're in. You can also apply for congress, where once elected you will be given the right to vote on laws proposed by your fellow congress members or your president and propose laws yourself. Voting on laws is important for your country as it can shape the lives of those around you. You can also try to become the head of a given party, and even take part in presidential elections and decide on the shape of the foreign policy of a given state (for example, who to declare war on). Career in politics is obviously not easy and in order to succeed in it, you have to have a good plan and compete for the votes of voters.


You can go bankrupt or become a rich man while playing the stock market.

The international war.

The last and probably the most important module is military. In E-Sim, countries are constantly fighting each other for control over territories which in return grant them access to more valuable raw materials. For this purpose, they form alliances, they fight international wars, but they also have to deal with, for example, uprisings in conquered countries or civil wars, which may explode on their territory. You can also take part in these clashes, although you are also given the opportunity to lead a life as a pacifist who focuses on other activities in the game (for example, running a successful newspaper or selling products).


At the auction you can sell or buy your dream inventory.

E-Sim is a unique browser game. It's creators ensured realistic representation of the mechanisms present in the real world and gave all power to the players who shape the image of the virtual Earth according to their own. So come and join them and help your country achieve its full potential.


Invest, produce and sell - be an entrepreneur in E-Sim.


Take part in numerous events for the E-Sim community.


| Terms of Service | Privacy policy | Support | Alpha | Luxia | Primera | Secura | Suna | Magna | Pangea | Oria | e-Sim: Countryballs Country Game
PLAY ON