See the this JavaClient for the API: https://sourcegraph.com/github.com/bjansen/IDEALeek/-/blob/src/com/plopiplop/leekwars/apiclient/LeekWarsApiClient.java
Looks like the flow:
- list all scripts
api/ai-folder/new-name
Parmas:
- folder_id: 0
- name:
<name>
Response: {"id":20934}
Will have place holder AI content.
api/ai-folder/new-name
Params
- folder_id:
<which folder to contain>
- version: 3
- name:
<name>
Response:
{"ai":{"id":358451,"name":"Test AI In Folder","level":1,"code":"\/**\r\n * Welcome to Leek Wars!\r\n * To know how the game works: leekwars.com\/help\/general\r\n * To learn the LeekScript language: leekwars.com\/help\/tutorial\r\n * To learn more about the available functions: leekwars.com\/help\/documentation\r\n**\/\r\n\r\n\/\/ This is a very basic example code:\r\n\r\n\/\/ We take the pistol\r\nsetWeapon(WEAPON_PISTOL); \/\/ Warning: costs 1 TP\r\n\r\n\/\/ We get the nearest enemy\r\nvar enemy = getNearestEnemy();\r\n\r\n\/\/ We move towards him\r\nmoveToward(enemy);\r\n\r\n\/\/ We try to shoot him!\r\nuseWeapon(enemy);","folder":20934}}
POST api/ai/save
Params:
ai_id
- ID of scriptcode
- contents of file
Response: (first number is ID)
{"result":{"356074":[]},"modified":1654554958901}
DELETE api/ai/delete
Params:
ai_id
- ID of script
Response: []