interfaces.d.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. declare module "twine-sugarcube" {
  2. export interface SugarCubeSetupObject {
  3. Appearance: { new(playerCharacter: PlayerCharacter): Appearance };
  4. BodyDescription: { new(): BodyDescription };
  5. Consumable: { new(): Consumable };
  6. Drugs: { new(): Drugs };
  7. Events: { new(): Events };
  8. GameTime: { new(): GameTime };
  9. Inventory: { new(): Inventory };
  10. Location:{ new(): GameLocation };
  11. LocationIdentifier:{ new(): LocationIdentifier };
  12. Mood: { new(): Mood };
  13. Moodlet: { new(): Moodlet };
  14. MoodletGroup: { new(): MoodletGroup };
  15. OutfitItem: { new(): OutfitItem };
  16. Pain: { new(): Pain };
  17. PlayerCharacter: { new(): PlayerCharacter };
  18. Quest: {
  19. handler: object; new(questId?: any): Quest
  20. };
  21. QuestsDict: { new(): QuestsDict };
  22. Skill: { new(): Skill };
  23. VersionControl: { new(): VersionControl };
  24. //#region Listeners
  25. listeners_timeUpdate:{[key: string]: (minutes:number)=>void};
  26. //#endregion
  27. appearanceModificators: { [key: string]: any; };
  28. consumables: { [key: string]: ConsumableDefinition;}
  29. deco: { [key: string]: { [key: string]: any; }}
  30. drugs: { [key: string]: DrugDefinition}
  31. effects: { [key: string]: { [key: string]: any; }}
  32. consumableMenus:{ [key: string]: ConsumableMenuDefinition}
  33. items: { [key: string]: ItemDefinition; };
  34. jobs: { [key: string]: JobDefinition};
  35. locations: { [key: string]: LocationDefinition; };
  36. moodlets: { [key: string]: Moodlet; };
  37. moodletGroups: { [key: string]: MoodletGroup; };
  38. outfits: { [key: string]: OutfitDefinition; };
  39. outfitsDefaults: {[key: string]: {[key: string]: any; } };
  40. outfitItemImagePath: {[key: string]: string | {[key: string]: any; } };
  41. painReasons: {[key: string]: { [key: string]: any; }}
  42. skills: { [key: string]: SkillDefinition; };
  43. startingCharacters: {[key: string]: StartCharacterDefinition};
  44. crimeLikelihood: (crimeId:string,location:LocationIdentifier)=>number;
  45. durationToString: any;
  46. filterDict:<T extends {}>(obj:T,filter: Filter) => T;
  47. func: (passage: string, ...arguments: Array<string|number>)=>any;
  48. getBodyparts: any;
  49. getBodypart:any;
  50. getConsumable: (type:string)=>{ [key: string]: any; };
  51. getConsumableMenu: (id:string)=>ConsumableMenuDefinition;
  52. getDeco: (type:string,position:string,id:number|string)=>{ [key: string]: any; };
  53. getDrug: (type:string)=>DrugDefinition;
  54. getDecoPosition: (type:string,position:string) => { [key: string]: any; }
  55. getDecoPositions: (type:string)=>string[];
  56. getEffect: (type:string)=>{ [key: string]: any; };
  57. getLocation: (locationId: string)=>LocationDefinition;
  58. getStartingCharacter: (type:string)=>StartCharacterDefinition;
  59. getStartingCharactersByFilter: (filters:{},shallow:boolean)=>{};
  60. makeSVG: (tag:string, attrs:any,innerHTML?:string|number|undefined) => SVGElement;
  61. mediaPath(rawPath:string):string;
  62. mediaPathImage(rawPath:string):string;
  63. mergeDeep: (target:any, ...sources:any) => any;
  64. randomName: (type:string)=>string;
  65. startingCharacterApply:(id:string)=>void;
  66. startingCharacterTagsIncludes:(tag:string)=>boolean;
  67. /**
  68. * Returns whether the place the playercharacter currently is at has internet access.
  69. * @returns {boolean}
  70. */
  71. hasInternet(): boolean;
  72. settingsApply:(settings: any)=>void;
  73. wardrobeSettings:WardrobeSettings;
  74. weekDayIntToString: any;
  75. worldSettings:any;
  76. isWebVersion:boolean;
  77. difficultyOfHighHeels(shoes?: OutfitItemShoes,levelCategory?:number):number
  78. skillHistoryDrawGraph(domElementId:string,skillID:string):void;
  79. wardrobeWearableFunctions:{[key:string]:((outfitOwned:OutfitOwned)=>string|null)};
  80. }
  81. export interface SugarCubeStoryVariables {
  82. events: Events;
  83. finances: any;
  84. housing:any;
  85. inventory: Inventory;
  86. jobs: any;
  87. location: GameLocation;
  88. npcs:any;
  89. pc: PlayerCharacter;
  90. q: QuestsDict;
  91. settings:any;
  92. startCharacter: string;
  93. time: GameTime;
  94. wardrobe:Wardrobe;
  95. ARGS: Array<string>;
  96. connectedLocations: ConnectedLocation[];
  97. eventReturnLocation: LocationIdentifier;
  98. here: string;
  99. location_var: object;
  100. media_path: string;
  101. quest: (id:string)=>Quest;
  102. result: number | string;
  103. /**
  104. * The version of the game. Format is xxxxxxx.xx.xx.
  105. * @type {number}
  106. * @example
  107. * version = 10345; //1.3.45
  108. */
  109. version: number;
  110. }
  111. }
  112. declare global {
  113. export interface Array<T>{
  114. fancyMathEvaluate(): number;
  115. filterByObject(filter: object): Array<T>;
  116. isConsecutive(stepSize?:number): boolean;
  117. }
  118. interface Math {
  119. ceilAbs: (n:number)=>number;
  120. logBase: (n:number, base:number)=>number;
  121. }
  122. export interface Number{
  123. roundToDecimal:(decimalPlaces:number)=>number;
  124. toBoolean:()=>boolean;
  125. }
  126. export interface String{
  127. formatUnicorn(format:{}):string;
  128. removeLeading(leading:string):string;
  129. toBoolean():boolean;
  130. }
  131. export class Util{
  132. static slugify(s:string): string;
  133. }
  134. export interface Window{
  135. rand(x:number,y:number): number;
  136. Wardrobe: { new(): Wardrobe };
  137. }
  138. export interface StartCharacterDefinition{
  139. /**
  140. * The description that's displayed to the player
  141. * @type {?string}
  142. */
  143. desc?:string
  144. finances?:{
  145. /**
  146. * The starting cash of the character.
  147. * @type {?number}
  148. */
  149. cash?:number
  150. },
  151. housing?:{
  152. home?: string
  153. },
  154. /**
  155. * Obvious things are obvious
  156. * @type {?string}
  157. */
  158. image?:string
  159. /**
  160. * Used internally in `setup.getStartingCharacter`. Don't overwrite.
  161. * @type {?string[]}
  162. */
  163. inheritance?:string[]
  164. items?:{
  165. [key: string]: number | {
  166. generateFunction:string,
  167. generateParameters?:any[]
  168. }
  169. }
  170. /**
  171. * What is displayed to the player
  172. * @type {?string}
  173. */
  174. label?:string
  175. location?:{
  176. [key: string]:{
  177. [key: string]:any
  178. }
  179. }
  180. locationTags?:{
  181. [key: string]:{
  182. [key: string]:any
  183. }
  184. }
  185. npcs?:{
  186. bulk?:{
  187. [key: string]:{
  188. values?:{
  189. rel?:number,
  190. fam?:number
  191. },
  192. filters?:{
  193. [key: string]:any
  194. }
  195. }
  196. }
  197. [key: string]: any
  198. }
  199. /**
  200. * Another character defintion that is to be inherited.
  201. * @type {?string}
  202. */
  203. parent?:string
  204. /**
  205. * Starting values of the PlayerCharacter. Every field of this class can be overwritten.
  206. * @type {?{ [key: string]: any; }}
  207. */
  208. pc?:{ [key: string]: any; }
  209. quests?:{
  210. [key: string]: boolean;
  211. }
  212. school?:{
  213. [key: string]: any;
  214. }
  215. skills?:{
  216. [key: string]: number;
  217. }
  218. /**
  219. * Categories of the starting character.
  220. * @type {string[]}
  221. */
  222. tags?:string[]
  223. time?: any;
  224. traits?:{
  225. [key: string]: number;
  226. }
  227. wardrobe?:{
  228. itemsByFilter?:{
  229. [key: string]:{
  230. filters?:{
  231. [key: string]:any;
  232. };
  233. count?: number;
  234. action?: 'add'|'wear';
  235. }
  236. },
  237. items?:{
  238. [key: string]:'add'|'wear';
  239. }
  240. };
  241. }
  242. export interface ConnectedLocation{
  243. forPassage : string,
  244. targetPassage: string,
  245. targetArguments: undefined,
  246. label: string,
  247. image: string,
  248. duration: number,
  249. class: string,
  250. priority: number,
  251. content: string,
  252. hotkeys: any,
  253. indecencyBlocked?:boolean,
  254. capturedVars: {[key:string]:any};
  255. }
  256. export interface ConsumableDefinition{
  257. alcohol?:number;
  258. costItems?:string[];
  259. desc?:string;
  260. /**
  261. * Relative calories with 1 being an healthy amount.
  262. * @type {?number}
  263. */
  264. energy?:number;
  265. hunger?: number;
  266. image?: string;
  267. imageRand?: ImageRand;
  268. label?:string;
  269. moodletIds?:string[];
  270. price?: number;
  271. thirst?:number;
  272. /**
  273. * The time it takes to consume.
  274. * @type {number}
  275. */
  276. time:number;
  277. type: 'drink'|'meal'|'candy';
  278. }
  279. export interface ConsumableMenuDefinition{
  280. payment:'cash'|'bank'|'both';
  281. categories:{
  282. [key:string] : {
  283. label:string;
  284. items:{
  285. [key:string] : {
  286. /**
  287. * Overwrites the original items price with a flat number. In case of a function, the original price is taken as input. `Math.round()` is always applied to the result then.
  288. * @type {(number|((n:number)=>number))}
  289. */
  290. price?:number|((n:number)=>number);
  291. }
  292. }
  293. }
  294. }
  295. }
  296. export interface DrugDefinition{
  297. deterioration: number;
  298. effects:{[key: string]:{condition:any; effect:string;}};
  299. byproduct?:DrugByproductDefinition;
  300. /*{
  301. buildup: 1.5,
  302. deterioration: 0.0017,
  303. effects:{
  304. hangover:{
  305. condition:{mainEffectsInactive:true},
  306. effect: 'hangover'
  307. }
  308. }
  309. }*/
  310. }
  311. export interface DrugByproductDefinition extends DrugDefinition{
  312. buildup: number;
  313. }
  314. export interface DrugInCharacter{
  315. vol:number;byproduct?:number;
  316. }
  317. export interface Filter{
  318. }
  319. export interface ImageRand{
  320. }
  321. export interface ItemDefinition{
  322. /**
  323. * An optional description to be displayed to the player.
  324. * @type {?string}
  325. */
  326. desc?: string;
  327. /**
  328. * Information on how the item behaves if used as furniture.
  329. * @type {?object}
  330. */
  331. furniture?:object;
  332. /**
  333. * Path to the image of the item.
  334. * @type {string}
  335. */
  336. image:string;
  337. /**
  338. * The label that's displayed to the player. Defaults to the id of the item.
  339. * @type {?string}
  340. */
  341. label?:string;
  342. /**
  343. * How many items of the same type fit into a purse.
  344. * @type {?number}
  345. */
  346. limit?:number;
  347. /**
  348. * A passage the player is sent to when he clicks the item in the inventory.
  349. * @type {?string}
  350. */
  351. passage?:string;
  352. /**
  353. * Default price.
  354. * @type {?number}
  355. */
  356. price?: number;
  357. }
  358. export interface JobDefinition{
  359. }
  360. export interface LocationDefinition{
  361. openTimes?:TimespanIdentifier;
  362. }
  363. export type OutfitDefinition = OutfitDefinitionBodysuit | OutfitDefinitionBra | OutfitDefinitionClothes | OutfitDefinitionCoat | OutfitDefinitionPanties | OutfitDefinitionPurse | OutfitDefinitionShoes | OutfitDefinitionSwimwear;
  364. export interface OutfitDefinitionRaw{
  365. quality: number;
  366. vendor:string;
  367. index: number;
  368. description?: string;
  369. }
  370. export interface OutfitDefinitionBodysuit extends OutfitDefinitionRaw{
  371. type:'bodysuit';
  372. subtype?:number;
  373. material?:number;
  374. fun?:number;
  375. thinness?:number;
  376. cover?:number;
  377. coverFront?:number;
  378. coverBack?:number;
  379. }
  380. export interface OutfitDefinitionBra extends OutfitDefinitionRaw{
  381. type:'bra';
  382. subtype?: number;
  383. fun?: number;
  384. thinness?: number;
  385. material?: number;
  386. cover?: number;
  387. }
  388. export interface OutfitDefinitionClothes extends OutfitDefinitionRaw{
  389. type:'clothes';
  390. subtype:string;
  391. thinness: number;
  392. topcut?: number;
  393. includesBra?: number;
  394. includesPanties?: number;
  395. isDress?:number;
  396. isOnepiece?: number;
  397. inhib?: number;
  398. pantsShortness?:number;
  399. skirtShortness?:number;
  400. coverTop?:number;
  401. coverBack?:number;
  402. coverFront?:number;
  403. /**
  404. * 4 seems to be prostitution.
  405. * @type {number}
  406. */
  407. style?: number;
  408. style2?: number;
  409. style3?:number;
  410. bimbo?:number;
  411. }
  412. export interface OutfitDefinitionCoat extends OutfitDefinitionRaw{
  413. type:'coat';
  414. warm:number;
  415. }
  416. export interface OutfitDefinitionPanties extends OutfitDefinitionRaw{
  417. type:'panties';
  418. subtype?: number;
  419. fun?: number;
  420. thinness?: number;
  421. material?: number;
  422. coverBack?:number;
  423. coverFront?:number;
  424. }
  425. export interface OutfitDefinitionPurse extends OutfitDefinitionRaw{
  426. type:'purse';
  427. }
  428. export interface OutfitDefinitionShoes extends OutfitDefinitionRaw{
  429. type:'shoes';
  430. style?:number;
  431. cut?:number;
  432. heels?:number;
  433. }
  434. export interface OutfitDefinitionSwimwear extends OutfitDefinitionRaw{
  435. type:'swimwear';
  436. subtype?:string;
  437. thinness:number;
  438. topcut:number;
  439. includesPanties:number;
  440. isOnepiece:number;
  441. inhib:number;
  442. }
  443. export type OutfitOwned = OutfitDefinition & OutfitOwnerShipData;
  444. export interface OutfitOwnerShipData{
  445. h?:number;
  446. l?:number;
  447. bmi?:number;
  448. }
  449. export interface TimespanIdentifier{
  450. days?: ('MO'|'TU'|'WE'|'TH'|'FR'|'SA'|'SU'|'work')[];
  451. daysBL?: ('MO'|'TU'|'WE'|'TH'|'FR'|'SA'|'SU'|'work')[];
  452. holiday?:boolean;
  453. vacation?:boolean;
  454. begin?:number[];
  455. end?:number[];
  456. }
  457. export interface SkillDefinition{
  458. label ?: string;
  459. description?:string;
  460. descibtionByLevel?:{[key:number]: string};
  461. image?:string;
  462. dailyExpLimit?:number|((levelAtStartOfDay:number)=>number);
  463. /**
  464. * If true, the amount of gained experience depends on the difficulty of a task.
  465. * @type {?boolean}
  466. */
  467. isDifficultyBased?:boolean;
  468. /**
  469. * Hide this skill from players in overviews when set to true.
  470. * @type {?boolean}
  471. */
  472. hidden?: boolean;
  473. /**
  474. * A function that provides a skill level.
  475. * @type {(skillLevel:number)=>number} Experience
  476. */
  477. e2s?: (skillLevel:number)=>number;
  478. /**
  479. * A function that provides a number of required skillpoints.
  480. * @type {(skillLevel:number)=>number} Skill Level
  481. */
  482. s2e?: (skillLevel:number)=>number;
  483. }
  484. export interface SkillOfCharacter{
  485. /**
  486. * The maximum number the experience can reach. 0 if disabled.
  487. * @type {number}
  488. */
  489. ceil:number;
  490. /**
  491. * Current number of experience points.
  492. * @type {number}
  493. */
  494. experience:number;
  495. /**
  496. * History of this skill for the last days.
  497. * @type {number[]}
  498. */
  499. experienceHistory:number[];
  500. /**
  501. * The minimum number the experience can reach.
  502. * @type {number}
  503. */
  504. floor: number;
  505. /**
  506. * The last daystart this skill has been used.
  507. * @type {number}
  508. */
  509. lastUsed: number;
  510. }
  511. export interface WardrobeSettings{
  512. /**
  513. * Maximum difference of the bmi-value of bought and worn clothes.
  514. * @type {number}
  515. */
  516. bmiSizeMaxDifference: number;
  517. }
  518. export interface WornOutfitDefinition{
  519. bra: string,
  520. coat: string,
  521. clothes: string,
  522. panties: string,
  523. purse: string,
  524. shoes: string
  525. }
  526. }
  527. export { };