AlferZep

Fight Starter Interaction ©

Jun 18th, 2024
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.25 KB | None | 0 0
  1. $nomention
  2. $textSplit[$customID; ]
  3. $var[cmd;$splitText[2]]
  4.  
  5. $onlyIf[$checkContains[$customID;fight hunt;fight boss;fight continue]==true;]
  6. $onlyIf[$checkContains[$customID;$authorID]==true;]
  7.  
  8. $var[user;$authorID]
  9.  
  10. $var[ability;$getVar[data.ability]]
  11.  
  12. $jsonParse[
  13. {
  14. "element":$getVar[element;$var[user]],
  15. "profile":$getVar[profile;$var[user]],
  16. "fight":$getVar[fight;$authorID],
  17. "hp":$getVar[hp;$authorID],
  18. "ability":$var[ability],
  19. "game":$getVar[profile],
  20. "floor":$getVar[floor;$authorID],
  21. "stats":$getVar[stats;$authorID],
  22. "floordata":$getVar[data.floor],
  23. "inv":$getVar[inventory;$authorID]
  24. }
  25. ]
  26.  
  27. $textSplit[$customID; ]
  28. $if[$json[fight;story]==true]
  29. $onlyIf[$splitText[>]==$json[fight;id];]
  30. $endif
  31. $if[$json[profile;version]==$json[game;version]]
  32. $if[$sum[$splitText[4];15]>=$getTimestamp]
  33.  
  34. $try
  35.  
  36. $if[$json[profile;element;name]!=none]
  37.  
  38. $if[$json[ability;$json[profile;element;name]]!=]
  39. $var[element;$json[profile;element;name]]
  40. $else
  41. $var[element;none]
  42. $endif
  43.  
  44. $if[$var[cmd]!=continue]
  45. $if[$checkContains[$customID;boss]==true]
  46. $jsonSet[fight;boss;cd;30]
  47. $else
  48. $jsonSet[fight;cd;10]
  49. $endif
  50. $endif
  51.  
  52. $var[floor;$json[floordata;$sub[$json[floor;current];1]]]
  53. $setVar[fight;$json[fight];$authorID]
  54.  
  55. $replyIn[1]
  56.  
  57. $jsonParse[
  58. {
  59. "element":$getVar[element;$var[user]],
  60. "profile":$getVar[profile;$var[user]],
  61. "fight":$getVar[fight;$authorID],
  62. "hp":$getVar[hp;$authorID],
  63. "skill1":$json[ability;$var[element];1],
  64. "skill2":$json[ability;$var[element];2],
  65. "skill3":$json[ability;$var[element];3],
  66. "devskill1":$json[ability;dev;1],
  67. "link":$getVar[data.mobs],
  68. "floor":$var[floor],
  69. "level":$getVar[level;$authorID],
  70. "stats":$getVar[stats;$authorID],
  71. "ability":$json[ability],
  72. "assets":$getVar[assets],
  73. "mp":$getVar[mp;$authorID],
  74. "equipment":$getVar[equipment;$authorID],
  75. "inv":$getVar[inventory;$authorID]
  76. }
  77. ]
  78.  
  79. $if[$var[cmd]==continue]
  80. $removeComponent[fight $authorID]
  81. $endif
  82. $removeButtons
  83.  
  84. $enableDecimals[yes]
  85. $var[chance;$round[$random[0;1];3]]
  86. $enableDecimals[no]
  87.  
  88. $if[$var[cmd]!=continue]
  89. $jsonSetString[fight;last;$getTimestamp]
  90. $endif
  91.  
  92. $if[$var[chance]<-100]
  93. $var[enemy;$json[floor;mobs;$random[0;$jsonArrayCount[floor;mobs]]]]
  94. $else
  95. $var[enemy;$json[profile;fight;name]]
  96. $var[avatar;$json[link;stats;$var[enemy];avatar]]
  97. $endif
  98.  
  99. $if[$json[link;stats;$var[enemy]]!=]
  100. $var[hp;$json[link;stats;$var[enemy];hp]]
  101. $var[def;$json[link;stats;$var[enemy];def]]
  102. $var[eva;$json[link;stats;$var[enemy];eva]]
  103.  
  104. $else
  105. $var[hp;$json[link;stats;other;hp]]
  106. $var[def;$json[link;stats;other;def]]
  107. $var[eva;$json[link;stats;other;eva]]
  108.  
  109. $endif
  110.  
  111. $if[$var[avatar]==]
  112. $var[avatar;https://cdn.discordapp.com/attachments/1101860440465752065/1122147783001002134/A3818875-1BEA-4510-9FAF-B449B9DD6485.png]
  113. $endif
  114.  
  115. $if[$var[enemy]==]
  116. $var[enemy;error]
  117. $endif
  118.  
  119. $if[$checkContains[$customID;boss]==true]
  120. $var[lv;$multi[$json[floor;lv;max];2]]
  121. $else
  122. $if[$json[link;stats;$var[enemy];lv]!=]
  123. $var[lv;$json[link;stats;$var[enemy];lv]]
  124. $else
  125. $var[lv;$json[fight;lv]]
  126. $endif
  127. $endif
  128.  
  129. $if[$var[cmd]!=continue]
  130. $jsonSet[stats;fight;eva;$json[stats;eva]]
  131. $jsonSet[stats;fight;crit;$json[stats;crit]]
  132. $jsonSet[stats;fight;spd;$json[stats;spd]]
  133. $jsonSet[stats;fight;acc;$json[stats;acc]]
  134. $if[$json[equipment;armor;def]!=]
  135. $jsonSet[stats;fight;def;$sum[$json[hp;def];$json[equipment;armor;def]]]
  136. $else
  137. $jsonSet[stats;fight;def;$json[hp;def]]
  138. $endif
  139. $jsonSet[fight;lv;$var[lv]]
  140. $jsonSet[fight;def;$var[def]]
  141. $jsonSet[fight;eva;$var[eva]]
  142. $jsonSetString[fight;hp;$multi[$var[hp];$var[lv]]]
  143. $jsonSetString[fight;maxHP;$multi[$var[hp];$var[lv]]]
  144. $jsonSet[fight;name;$var[enemy]]
  145. $setVar[fightAvatar;$var[avatar];$authorID]
  146. $jsonSet[fight;gold;$multi[$json[floor;gold];2]]
  147. $jsonSet[fight;xp;$multi[$json[floor;xp];2]]
  148. $jsonSet[fight;stats;spd;100]
  149. $jsonSet[fight;stats;acc;100]
  150. $jsonSetString[fight;stats;-dmg;1.000]
  151. $jsonSetString[fight;stats;-def;1.000]
  152. $endif
  153.  
  154. $if[$json[link;dialogue;$json[fight;name];box]==]
  155. $var[dialogue;…]
  156. $else
  157. $var[dialogue;$json[link;dialogue;$json[fight;name];box;$optOff[$random[0;$jsonArrayCount[link;dialogue;$json[fight;name];box]]]]]
  158. $endif
  159.  
  160. $var[hpBarE;$replaceText[$repeatMessage[6;<:barempty:1227182702927810560>];<:barempty:1227182702927810560>;<:barfull:1227194621319184405>;$divide[$divide[$multi[$json[fight;hp];12];$json[fight;maxHP]];2]]]
  161. $var[hpBar;$replaceText[$repeatMessage[6;<:barempty:1227182702927810560>];<:barempty:1227182702927810560>;<:barfull:1227194621319184405>;$divide[$divide[$multi[$json[hp;min];12];$json[hp;max]];2]]]
  162. $enableDecimals[true]
  163. $var[hp%;$multi[$divide[$json[hp;min];$json[hp;max]];100]]
  164. $var[ehp%;$multi[$divide[$json[fight;hp];$json[fight;maxHP]];100]]
  165. $enableDecimals[false]
  166.  
  167. $if[$json[skill1;lv]<=$json[element;level]]
  168.  
  169.  
  170. $if[$var[hp%]<=0]
  171. $var[color;#c20202]
  172. $elseif[$var[hp%]<=25]
  173. $var[color;#c20202]
  174. $elseif[$var[hp%]<=50]
  175. $var[color;#c28502]
  176. $elseif[$var[hp%]<=75]
  177. $var[color;#b2c202]
  178. $elseif[$var[hp%]<=100]
  179. $var[color;#AAFF00]
  180. $endif
  181.  
  182. $if[$var[ehp%]<=0]
  183. $var[ecolor;#c20202]
  184. $elseif[$var[ehp%]<=25]
  185. $var[ecolor;#c20202]
  186. $elseif[$var[ehp%]<=50]
  187. $var[ecolor;#c28502]
  188. $elseif[$var[ehp%]<=75]
  189. $var[ecolor;#b2c202]
  190. $elseif[$var[ehp%]<=100]
  191. $var[ecolor;#AAFF00]
  192. $endif
  193.  
  194. $textSplit[$json[fight;name]; ]
  195. $textSplit[$splitText[1];:]
  196. $if[$splitText[1]==id]
  197. $textSplit[$json[fight;name]; ]
  198. $removeSplitTextElement[1]
  199. $var[mob.name;$joinSplitText[ ]]
  200. $endif
  201.  
  202. $var[msg;$messageID]
  203. $description[### $toTitleCase[$var[mob.name]] LV$json[fight;lv]
  204. $json[assets;heart] $var[hpBarE] `$json[fight;hp]/$json[fight;hp]`
  205.  
  206. $json[assets;shield1] $json[fight;def]
  207. $if[$json[link;dialogue;$json[fight;name]]!=]```$var[dialogue]```$endif]$footer[…]
  208. $color[$var[ecolor]]
  209. $thumbnail[$getVar[fightAvatar;$authorID]]
  210. $description[### $username LV$json[level;lv]
  211. $json[assets;heart] $var[hpBar] `$json[hp;min]/$json[hp;max]`
  212.  
  213. $json[assets;shield1] $json[stats;fight;def];2]
  214. $color[$var[color];2]
  215. $footer[Choose a skill from the menu;2]
  216. $thumbnail[$authorAvatar;2]
  217.  
  218. $jsonSetString[fight;id;$var[msg]]
  219. $jsonSetString[fight;chnl;$channelID]
  220. $jsonSetString[fight;srvr;$guildID]
  221.  
  222. $newSelectMenu[fight $authorID;1;1;SKILLS | MP: $json[mp;min]/$json[mp;max];]
  223. $addSelectMenuOption[fight $authorID;$toTitleCase[$json[skill1;name]];{"skill.type":"skill","skill.id":1};$json[skill1;-mp]MP;;$c[emoji];]
  224. $if[$json[skill2;lv]<=$json[element;level]]
  225. $addSelectMenuOption[fight $authorID;$toTitleCase[$json[skill2;name]];{"skill.type":"skill","skill.id":2};$json[skill2;-mp]MP;;$c[emoji];]
  226. $endif
  227. $if[$json[skill3;lv]<=$json[element;level]]
  228. $addSelectMenuOption[fight $authorID;$toTitleCase[$json[skill3;name]];{"skill.type":"skill","skill.id":3};$json[skill3;-mp]MP;;$c[emoji];]
  229. $endif
  230. $if[$checkContains[$getVar[devs];$authorID]==true]
  231. $addSelectMenuOption[fight $authorID;DEV: $toTitleCase[$json[ability;dev;1;name]];{"skill.type":"dev","skill.id":1};$json[ability;dev;1;-mp]MP;;$c[emoji];]
  232. $endif
  233. $if[$checkContains[$getVar[devs];$authorID]==true]
  234. $addSelectMenuOption[fight $authorID;DEV: $toTitleCase[$json[ability;dev;2;name]];{"skill.type":"dev","skill.id":2};$json[ability;dev;2;-mp]MP;;$c[emoji];]
  235. $endif
  236.  
  237. $if[$json[equipment;melee;name]!=]
  238. $addButton[no;fight melee $authorID;Attack;primary]
  239. $else
  240. $addButton[no;interface no.melee $authorID;Attack;primary]
  241. $endif
  242.  
  243. $addButton[no;fight brace $authorID;Brace;secondary;;$json[assets;shield1];]
  244. $addButton[no;interface fight.end $authorID;Run;danger;;$json[assets;flee];$var[a]]
  245. $if[$json[inv;potions]!=]
  246. $addButton[yes;fight items $authorID;Items;secondary;no]
  247. $else
  248. $addButton[yes;fight items $authorID;Items;secondary;yes]
  249. $endif
  250. $if[$json[fight;name]==dummy]
  251. $addButton[no;dummy-exit $authorID;Exit;danger;;;]
  252. $endif
  253.  
  254. $setVar[stats;$json[stats];$authorID]
  255. $setVar[fight;$json[fight];$authorID]
  256.  
  257. $else
  258. $description[You don’t have any skills yet, how can you fight?]
  259. $endif
  260.  
  261. $else
  262. $ephemeral
  263. $removeButtons
  264.  
  265. $description[You haven't rolled yet.]
  266. $footer[tip: vroll to roll an element]
  267.  
  268. $endif
  269.  
  270. $catch
  271.  
  272. $eval[$getVar[errorMsg]]
  273.  
  274. $endtry
  275.  
  276. $else
  277. $ephemeral
  278. $removeButtons
  279. The enemy had already left <t:$sum[$splitText[4];15]:R> because of boredom.
  280. $endif
  281.  
  282. $else
  283. $ephemeral
  284. Your data is outdated. Please use the </update:$slashID[update]> command to update.
  285. $endif
  286.  
  287.  
  288.  
Advertisement
Add Comment
Please, Sign In to add comment