1/**
2 * Position on the map
3 */
4class cPosition {
5    x: number;
6    y: number;
7}
8
9/**
10 * A Sprite
11 */
12class sSprite {
13    x: number;
14    y: number;
15}
16
17/**
18 * A Structure
19 */
20class sStructure {
21
22    /**
23     * TileIDs to be placed for structure
24     */
25    Struct: object;
26
27    /**
28     * Types of structure which can be placed
29     */
30    Types: object;
31}
32
33/**
34 * A Campaign
35 */
36interface cCampaign {
37    name: string;
38    author: string;
39
40    getMissions(): Array<cMission>;
41    SetCustomCampaign(): void;
42}
43
44/**
45 * A map
46 */
47interface cMap {
48    seed: number;
49
50    /**
51     * Save to disk
52     */
53    save(): void;
54
55    /**
56     * Create a new map
57     *
58     * @param pWidth
59     * @param pHeight
60     * @param pTileType
61     * @param pTileSub
62     */
63    Create(pWidth:number, pHeight:number, pTileType:number, pTileSub:number): void;
64
65    /**
66     * Create a 2D diamond square array
67     */
68    DiamondSquare(): Array<Array<number>>;
69
70    /**
71     * Create a 2D simplex island array
72     *
73     * @param pOctaves
74     * @param pRoughness
75     * @param pScale
76     * @param pSeed
77     * @param pRadialEnabled
78     * @param pEdgeFade
79     */
80    SimplexIslands(pOctaves, pRoughness, pScale, pSeed, pRadialEnabled, pEdgeFade): Array<Array<number>>;
81
82    /**
83     * Create a 2D simplex noise array
84     *
85     * @param pOctaves
86     * @param pFrequency
87     * @param pLacunarity
88     * @param pPersistence
89     */
90    SimplexNoise(pOctaves, pFrequency, pLacunarity, pPersistence): Array<Array<number>>;
91
92    /**
93     * Get the current tile type
94     */
95    getTileType(): number;
96
97    /**
98     * Get the current tile sub
99     */
100    getTileSub(): number;
101
102    /**
103     * Get map width in tiles
104     */
105    getWidth(): number;
106
107    /**
108     * Get map height in tiles
109     */
110    getHeight(): number;
111
112    /**
113     * Get the total map area in tiles
114     */
115    getArea(): number;
116
117    /**
118     * Get map width in pixels
119     */
120    getWidthPixels(): number;
121
122    /**
123     * Get max height in pixels
124     */
125    getHeightPixels(): number;
126
127    /**
128     * Get the total map area in pixels
129     */
130    getAreaPixels(): number;
131
132    /**
133     * Get the number of sprites matching this type
134     *
135     * @param pSpriteType
136     */
137    getSpriteTypeCount(pSpriteType): number;
138
139    /**
140     * Get all sprites matching this type
141     *
142     * @param pSpriteType
143     */
144    getSpritesByType(pSpriteType): Array<sSprite>;
145
146    /**
147     * Get a random X/Y if the tiles within the radius contain the provided tile id
148     * @param pTiles
149     * @param pRadius
150     */
151    getRandomXYByTileID( pTiles:Array<number>, pRadius:number ) : cPosition;
152
153    /**
154     * Get a random X/Y if the tiles within the radius have the provided features
155     * @param pFeatures
156     * @param pRadius
157     * @param pIgnoreSprites
158     */
159    getRandomXYByFeatures( pFeatures:Array<number>, pRadius:number, pIgnoreSprites:boolean ) : cPosition;
160
161    /**
162     * Get a random X/Y if the tiles within the radius have the provided feature
163     *
164     * @param pType
165     * @param pRadius
166     */
167    getRandomXYByTerrainType( pType:number, pRadius:number ) : cPosition;
168
169    /**
170     * Add a sprite to the map
171     *
172     * @param pSpriteID
173     * @param pSpriteX
174     * @param pSpriteY
175     */
176    SpriteAdd(pSpriteID:number, pSpriteX:number, pSpriteY:number ) : void;
177
178    /**
179     * Get the tile ID at X/Y
180     *
181     * @param pTileX
182     * @param pTileY
183     */
184    TileGet(pTileX:number, pTileY:number) : void;
185
186    /**
187     * Set the tile at X/Y
188     *
189     * @param pTileX
190     * @param pTileY
191     * @param pTileID
192     */
193    TileSet(pTileX:number, pTileY:number, pTileID:number) : void;
194
195    /**
196     * Get a random int between min/max
197     *
198     * @param pMin
199     * @param pMax
200     */
201    getRandomInt(pMin:number, pMax:number) : number;
202
203    /**
204     * Get a random float between the min/max
205     *
206     * @param pMin
207     * @param pMax
208     */
209    getRandomFloat(pMin:number, pMax:number) : number;
210
211    /**
212     * Calculate the distance between two positions
213     *
214     * @param pPos1
215     * @param pPos2
216     */
217    getDistanceBetweenPositions(pPos1:cPosition, pPos2:cPosition) : number;
218
219    /**
220     * Calculate a path between two positions for the provided sprite type
221     *
222     * @param pSpriteType Type of sprite
223     * @param pPos1 Starting position
224     * @param pPos2 Finishing position
225     */
226    calculatePathBetweenPositions(pSpriteType:number, pPos1:cPosition, pPos2:cPosition) : Array<cPosition>;
227}
228
229/**
230 * A Phase
231 */
232interface cPhase {
233    /**
234     * Map filename
235     */
236    map: string;
237
238    /**
239     * Phase name
240     */
241    name: string;
242
243    /**
244     * Add an objective to this phase
245     *
246     * @param pObjectiveID
247     */
248    ObjectiveAdd(pObjectiveID): void;
249
250    /**
251     * Remove an objective from this phase
252     * @param pObjectiveID
253     */
254    ObjectiveRemove(pObjectiveID): void;
255
256    /**
257     * Clear all objectives
258     */
259    ObjectivesClear(): void;
260
261    /**
262     * Set the sprite aggression level
263     * @param pMin
264     * @param pMax
265     */
266    SetAggression(pMin: number, pMax: number): void;
267
268    /**
269     * Set the min sprite aggression
270     *
271     * @param pMin
272     */
273    SetMinAggression(pMin): void;
274
275    /**
276     * Set the max sprite aggression
277     * @param pMax
278     */
279    setMaxAggression(pMax): void;
280}
281
282/**
283 * A Mission
284 */
285interface cMission {
286    /**
287     * Mission name
288     */
289    name: string;
290
291    NumberOfPhases(): number;
292    PhaseGet(): cPhase;
293}
294
295/**
296 * The Scripting Engine Object
297 */
298interface cScriptingEngine {
299
300    /**
301     * Execute a script with the provided name
302     *
303     * @param pFilename
304     */
305    scriptCall(pFilename): void;
306
307    /**
308     * Get the current campaign
309     */
310    getCampaign(): cCampaign;
311
312    /**
313     * Get the current Map
314     */
315    getMap(): cMap;
316
317    /**
318     * Get the current Phase
319     */
320    getPhase(): cPhase;
321
322    /**
323     * Get the current Mission
324     */
325    getMission() : cMission;
326
327    /**
328     * Print a string to the screen
329     *
330     * @param pText
331     * @param pX
332     * @param pY
333     * @param pLarge
334     * @param pUnderline
335     */
336    guiPrintString(pText:string, pX:number, pY:number, pLarge:boolean, pUnderline:boolean) : void;
337
338    /**
339     * Create a new mission
340     */
341    missionCreate() : cMission;
342
343    /**
344     * Create a new phase
345     */
346    phaseCreate() : cPhase;
347
348    /**
349     * Save the current map
350     */
351    mapSave() : void;
352}
353
354/**
355 * Scripting Engine
356 */
357declare var Engine: cScriptingEngine;
358