OutfitItem.ts 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /// <reference path="../_shared/Initializing.ts"/>
  2. class OutfitItem extends Initializing{
  3. id='';
  4. index:number=0;
  5. type:string='';
  6. vendor:string='';
  7. quality:number=0;
  8. isValidItem=false;
  9. description:string;
  10. static get(itemId:string):OutfitItem{
  11. let constantData = this.constantData(itemId);
  12. let item:OutfitItem;
  13. switch(constantData.type){
  14. case 'bodysuit':
  15. item = new OutfitItemBodyuit(); break;
  16. case 'bra':
  17. item = new OutfitItemBra(); break;
  18. case 'clothes':
  19. item = new OutfitItemClothes(); break;
  20. case 'coat':
  21. item = new OutfitItemCoat(); break;
  22. case 'panties':
  23. item = new OutfitItemPanties(); break;
  24. case 'purse':
  25. item = new OutfitItemPurse(); break;
  26. case 'shoes':
  27. item = new OutfitItemShoes(); break;
  28. case 'swimwear':
  29. item = new OutfitItemSwimwear();break;
  30. }
  31. item.init(constantData);
  32. item.isValidItem = true;
  33. item.id = itemId;
  34. return item;
  35. }
  36. static constantData(itemId:string):OutfitDefinition{
  37. return setup.outfits[itemId];
  38. }
  39. get desc():string{
  40. return this.description || '';
  41. }
  42. get image():string{
  43. return setup.outfitItemImagePath[this.type].formatUnicorn({vendor:this.vendor,id:this.index});
  44. }
  45. get inhibition(){
  46. return 0;
  47. }
  48. get slots():string[]{
  49. return [this.type];
  50. }
  51. }
  52. class OutfitItemBodyuit extends OutfitItem implements OutfitDefinitionBodysuit{
  53. type:'bodysuit' = "bodysuit";
  54. get slots():string[]{
  55. return ['bra','panties'];
  56. }
  57. }
  58. class OutfitItemBra extends OutfitItem implements OutfitDefinitionBra{
  59. type:'bra' = "bra";
  60. subtype?: number;
  61. fun?: number;
  62. thinness?: number;
  63. material?: number;
  64. cover?: number;
  65. }
  66. const enum clothesCoverFront{
  67. }
  68. const enum EClothesThinness{
  69. OBSCURING = 1,
  70. OBSCURING_SOMEWHAT,
  71. SHOWS_SOMEWHAT,
  72. SHOWS,
  73. SHOWS_DETAILS,
  74. REVEALING
  75. }
  76. class OutfitItemClothes extends OutfitItem implements OutfitDefinitionClothes{
  77. type:'clothes' = "clothes";
  78. isDress?: number;
  79. isOnepiece?: number;
  80. coverBack?: number;
  81. style?: number;
  82. style2?: number;
  83. style3?: number;
  84. bimbo?: number;
  85. subtype:string='';
  86. thinness:EClothesThinness;
  87. coverFront:number;
  88. coverTop:number;
  89. pantsShortness:number;
  90. skirtShortness:number;
  91. topcut: number;
  92. includesBra:number;
  93. includesPanties:number;
  94. inhib: number;
  95. get image():string{
  96. return setup.outfitItemImagePath.clothes[this.vendor][this.subtype].formatUnicorn({id:this.index});
  97. }
  98. get inhibition(){
  99. if(this.inhib)
  100. return this.inhib;
  101. let inhibitionOfItem = 0;
  102. if(this.coverFront == 4)
  103. inhibitionOfItem = 50
  104. else if(this.coverFront == 3 || this.coverTop == 4)
  105. inhibitionOfItem = 45
  106. else if(this.coverFront == 2 || this.coverTop == 3)
  107. inhibitionOfItem = 40
  108. else if(this.skirtShortness == 6 || this.coverFront == 1 || this.coverTop == 2)
  109. inhibitionOfItem = 35
  110. else if(this.skirtShortness == 5 || this.pantsShortness == 6){
  111. if(this.thinness == 6)
  112. inhibitionOfItem = 35
  113. else
  114. inhibitionOfItem = 30
  115. }
  116. else if(this.includesPanties == 1 || this.pantsShortness == 5){
  117. if(this.thinness == 6)
  118. inhibitionOfItem = 35
  119. else if(this.includesBra == 1 || this.coverTop == 2)
  120. inhibitionOfItem = 30
  121. else
  122. inhibitionOfItem = 25
  123. }
  124. else if(this.skirtShortness == 4){
  125. if(this.thinness == 6)
  126. inhibitionOfItem = 35
  127. else if(this.includesBra == 1 || this.coverTop == 2)
  128. inhibitionOfItem = 30
  129. else if(this.topcut == 4 || this.thinness == 5)
  130. inhibitionOfItem = 25
  131. else
  132. inhibitionOfItem = 20
  133. }
  134. else if(this.skirtShortness == 3){
  135. if(this.thinness == 6)
  136. inhibitionOfItem = 35
  137. else if(this.includesBra == 1 || this.coverTop == 2)
  138. inhibitionOfItem = 30
  139. else if(this.topcut == 4 || this.thinness == 5)
  140. inhibitionOfItem = 25
  141. else if(this.topcut == 3)
  142. inhibitionOfItem = 15
  143. else
  144. inhibitionOfItem = 10
  145. }
  146. else if(this.skirtShortness == 2 || this.pantsShortness == 3){
  147. if(this.thinness == 6)
  148. inhibitionOfItem = 35
  149. else if(this.includesBra == 1 || this.coverTop == 2)
  150. inhibitionOfItem = 30
  151. else if(this.topcut == 4 || this.thinness == 5)
  152. inhibitionOfItem = 25
  153. else if(this.topcut == 3)
  154. inhibitionOfItem = 15
  155. else if(this.thinness == 4)
  156. inhibitionOfItem = 10
  157. else
  158. inhibitionOfItem = 5
  159. }
  160. else{
  161. if(this.thinness == 6)
  162. inhibitionOfItem = 35
  163. else if(this.includesBra == 1 || this.coverTop == 2)
  164. inhibitionOfItem = 30
  165. else if(this.topcut == 4 || this.thinness == 5)
  166. inhibitionOfItem = 25
  167. else if(this.topcut == 3)
  168. inhibitionOfItem = 15
  169. else if(this.thinness == 4)
  170. inhibitionOfItem = 10
  171. else if(this.thinness == 3)
  172. inhibitionOfItem = 5
  173. else
  174. inhibitionOfItem = 0
  175. }
  176. return inhibitionOfItem;
  177. }
  178. }
  179. class OutfitItemCoat extends OutfitItem implements OutfitDefinitionCoat{
  180. type:'coat' = "coat";
  181. warm: number;
  182. }
  183. class OutfitItemPanties extends OutfitItem implements OutfitDefinitionPanties{
  184. type:'panties' = "panties";
  185. subtype?: number;
  186. fun?: number;
  187. thinness?: number;
  188. material?: number;
  189. coverBack?: number;
  190. coverFront?: number;
  191. }
  192. class OutfitItemPurse extends OutfitItem implements OutfitDefinitionPurse{
  193. type:'purse' = "purse";
  194. }
  195. class OutfitItemShoes extends OutfitItem implements OutfitDefinitionShoes{
  196. type:'shoes' = "shoes";
  197. style?: number;
  198. cut?: number;
  199. heels?: number=0;
  200. /**
  201. * Heel height in cm
  202. * @readonly
  203. * @type {number}
  204. */
  205. get heelHeight():number{
  206. return (this.heels * 2.54).roundToDecimal(1);
  207. }
  208. }
  209. class OutfitItemSwimwear extends OutfitItem implements OutfitDefinitionSwimwear{
  210. type:'swimwear' = "swimwear";
  211. subtype: 'bikini'|'swimsuit';
  212. thinness: number;
  213. topcut: number;
  214. includesPanties: number;
  215. isOnepiece: number;
  216. inhib: number;
  217. get image():string{
  218. return setup.outfitItemImagePath.clothes[this.vendor][this.subtype].formatUnicorn({id:this.index});
  219. }
  220. get slots(){
  221. return ['bra','panties','clothes'];
  222. }
  223. }
  224. setup.OutfitItem = OutfitItem;