interfaces.d.ts 14 KB

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