Advertisement
Guest User

Untitled

a guest
May 27th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.34 KB | None | 0 0
  1.  
  2. /*
  3.  
  4. Ranking System v2.0, by Wolfje (Tyler W.), 2013.
  5.  
  6. This is a ranking script for the AliasCmd plugin in Javascript. Install it by putting it in your Tshock\SEconomy" directory and starting the Terraria server.
  7. If the server is already running AliasCmd just type "/aliascmd reload" in the console to cause the script to load.
  8.  
  9. Released under Wolfje's Don't-be-a-dick license. You didn't write this, I did, so if you modify it don't claim the work as yours; it isn't.
  10.  
  11.  
  12. ** THIS VERSION OF THE RANKING SCRIPT REQUIRES JIST AND SECONOMY UPDATE 15 OR LATER. **
  13.  
  14.  
  15. --- rankingList Object ---
  16.  
  17. There's really nothing to it. :)
  18.  
  19. * the first parameter is the rank key.
  20. * "name" must match the rank key. Avoid spaces
  21. * "cost" is a SEconomy string representation of how much money it costs to be that rank, "0c" is free
  22. * "group" is the TShock group this rank is
  23.  
  24. * "parentgroup" is used for hierarchy. set it to the group of the rank that comes before it to establish a ladder
  25. You can specify multiple ranks with the same parent. Doing this is going to create a tree of choices called a class trunk.
  26. Once a user arrives at a class trunk they cannot /rank up, they will be asked to pick a "class", but you can modify that text to whatever you like.
  27.  
  28. You can specify as many trunks as you want. You can have rank choices inside rank choices up to an infinite depth, the sky (or rather, your heap size) is the limit. :)
  29.  
  30.  
  31. "levelupcommands": [
  32. "/i goldfish",
  33. "/i goldfish",
  34. "/i goldfish",
  35. "/i goldfish",
  36. "/i goldfish",
  37. "/i goldfish",
  38. "/i goldfish",
  39. "/i goldfish",
  40. "/i goldfish",
  41. "/i goldfish",
  42. "/time noon",
  43. "/spawnmob \"skeletron head\"",
  44. ],
  45.  
  46. */
  47.  
  48. /*
  49. * Please see the forums at http://plugins.tw.id.au/ for tutorials on how
  50. * to make a ranking list.
  51. */
  52. var rankingList = {
  53. //----------------------Tier One Lv1-100----------------------
  54.  
  55. "Lv1": {
  56. "name": "Lv1",
  57. "parentgroup": undefined,
  58. "group": "rank.L1",
  59. "levelupcommands": [
  60. "/fire",
  61. "/buff 119 10",
  62. "/heal",
  63. "/hpup-hp"
  64. ],
  65. "cost": "300"
  66. },
  67. "Lv2": {
  68. "name": "Lv2",
  69. "parentgroup": "rank.L1",
  70. "group": "rank.L2",
  71. "levelupcommands": [
  72. "/fire",
  73. "/buff 119 10",
  74. "/heal",
  75. "/hpup-hp"
  76. ],
  77. "cost": "1000"
  78. },
  79. "Lv3": {
  80. "name": "Lv3",
  81. "parentgroup": "rank.L2",
  82. "group": "rank.L3",
  83. "levelupcommands": [
  84. "/fire",
  85. "/buff 119 10",
  86. "/heal",
  87. "/hpup-hp"
  88. ],
  89. "cost": "1000"
  90. },
  91. "L4": {
  92. "name": "L4",
  93. "parentgroup": "rank.L3",
  94. "group": "rank.L4",
  95. "levelupcommands": [
  96. "/fire",
  97. "/buff 119 10",
  98. "/heal",
  99. "/hpup-hp"
  100. ],
  101. "cost": "1000"
  102. },
  103. "L5": {
  104. "name": "L5",
  105. "parentgroup": "rank.L4",
  106. "group": "rank.L5",
  107. "levelupcommands": [
  108. "/fire",
  109. "/buff 119 10",
  110. "/heal",
  111. "/hpup-hp"
  112. ],
  113. "cost": "1000"
  114. },
  115. "L6": {
  116. "name": "L6",
  117. "parentgroup": "rank.L5",
  118. "group": "rank.L6",
  119. "levelupcommands": [
  120. "/fire",
  121. "/buff 119 10",
  122. "/heal",
  123. "/hpup-hp"
  124. ],
  125. "cost": "1000"
  126. },
  127. "L7": {
  128. "name": "L7",
  129. "parentgroup": "rank.L6",
  130. "group": "rank.L7",
  131. "levelupcommands": [
  132. "/fire",
  133. "/buff 119 10",
  134. "/heal",
  135. "/hpup-hp"
  136. ],
  137. "cost": "1000"
  138. },
  139. "L8": {
  140. "name": "L8",
  141. "parentgroup": "rank.L7",
  142. "group": "rank.L8",
  143. "levelupcommands": [
  144. "/fire",
  145. "/buff 119 10",
  146. "/heal",
  147. "/hpup-hp"
  148. ],
  149. "cost": "1000"
  150. },
  151. "L9": {
  152. "name": "L9",
  153. "parentgroup": "rank.L8",
  154. "group": "rank.L9",
  155. "levelupcommands": [
  156. "/fire",
  157. "/buff 119 10",
  158. "/heal",
  159. "/hpup-hp"
  160. ],
  161. "cost": "1000"
  162. },
  163. "L10": {
  164. "name": "L10",
  165. "parentgroup": "rank.L9",
  166. "group": "rank.L10",
  167. "levelupcommands": [
  168. "/fire",
  169. "/buff 119 10",
  170. "/heal",
  171. "/level"
  172. ],
  173. "cost": "1000"
  174. },
  175. "L11": {
  176. "name": "L11",
  177. "parentgroup": "rank.L10",
  178. "group": "rank.L11",
  179. "levelupcommands": [
  180. "/fire",
  181. "/buff 119 10",
  182. "/heal",
  183. "/hpup-hp"
  184. ],
  185. "cost": "1000"
  186. },
  187. "L12": {
  188. "name": "L12",
  189. "parentgroup": "rank.L11",
  190. "group": "rank.L12",
  191. "levelupcommands": [
  192. "/fire",
  193. "/buff 119 10",
  194. "/heal",
  195. "/hpup-hp"
  196. ],
  197. "cost": "1000"
  198. },
  199. "L13": {
  200. "name": "L13",
  201. "parentgroup": "rank.L12",
  202. "group": "rank.L13",
  203. "levelupcommands": [
  204. "/fire",
  205. "/buff 119 10",
  206. "/heal",
  207. "/hpup-hp"
  208. ],
  209. "cost": "1000"
  210. },
  211. "L14": {
  212. "name": "L14",
  213. "parentgroup": "rank.L13",
  214. "group": "rank.L14",
  215. "levelupcommands": [
  216. "/fire",
  217. "/buff 119 10",
  218. "/heal",
  219. "/hpup-hp",
  220. ],
  221. "cost": "1000"
  222. },
  223. "L15": {
  224. "name": "L15",
  225. "parentgroup": "rank.L14",
  226. "group": "rank.L15",
  227. "levelupcommands": [
  228. "/fire",
  229. "/buff 119 10",
  230. "/heal",
  231. "/hpup-hp"
  232. ],
  233. "cost": "1000"
  234. },
  235. "L16": {
  236. "name": "L16",
  237. "parentgroup": "rank.L15",
  238. "group": "rank.L16",
  239. "levelupcommands": [
  240. "/fire",
  241. "/buff 119 10",
  242. "/heal",
  243. "/hpup-hp"
  244. ],
  245. "cost": "1000"
  246. },
  247. "L17": {
  248. "name": "L17",
  249. "parentgroup": "rank.L16",
  250. "group": "rank.L17",
  251. "levelupcommands": [
  252. "/fire",
  253. "/buff 119 10",
  254. "/heal",
  255. "/hpup-hp"
  256. ],
  257. "cost": "1000"
  258. },
  259. "L18": {
  260. "name": "L18",
  261. "parentgroup": "rank.L17",
  262. "group": "rank.L18",
  263. "levelupcommands": [
  264. "/fire",
  265. "/buff 119 10",
  266. "/heal",
  267. "/hpup-hp"
  268. ],
  269. "cost": "1000"
  270. },
  271. "L19": {
  272. "name": "L19",
  273. "parentgroup": "rank.L18",
  274. "group": "rank.L19",
  275. "levelupcommands": [
  276. "/fire",
  277. "/buff 119 10",
  278. "/heal",
  279. "/hpup-hp"
  280. ],
  281. "cost": "1000"
  282. },
  283. "L20": {
  284. "name": "L20",
  285. "parentgroup": "rank.L19",
  286. "group": "rank.L20",
  287. "levelupcommands": [
  288. "/fire",
  289. "/buff 119 10",
  290. "/heal",
  291. "/level"
  292. ],
  293. "cost": "1000"
  294. },
  295. "L21": {
  296. "name": "L21",
  297. "parentgroup": "rank.L20",
  298. "group": "rank.L21",
  299. "levelupcommands": [
  300. "/fire",
  301. "/buff 119 10",
  302. "/heal",
  303. "/hpup-hp"
  304. ],
  305. "cost": "1000"
  306. },
  307. "L22": {
  308. "name": "L22",
  309. "parentgroup": "rank.L21",
  310. "group": "rank.L22",
  311. "levelupcommands": [
  312. "/fire",
  313. "/buff 119 10",
  314. "/heal",
  315. "/hpup-hp"
  316. ],
  317. "cost": "1000"
  318. },
  319. "L23": {
  320. "name": "L23",
  321. "parentgroup": "rank.L22",
  322. "group": "rank.L23",
  323. "levelupcommands": [
  324. "/fire",
  325. "/buff 119 10",
  326. "/heal",
  327. "/hpup-hp"
  328. ],
  329. "cost": "1000"
  330. },
  331. "L24": {
  332. "name": "L24",
  333. "parentgroup": "rank.L23",
  334. "group": "rank.L24",
  335. "levelupcommands": [
  336. "/fire",
  337. "/buff 119 10",
  338. "/heal",
  339. "/hpup-hp"
  340. ],
  341. "cost": "1000"
  342. },
  343. "L25": {
  344. "name": "L25",
  345. "parentgroup": "rank.L24",
  346. "group": "rank.L25",
  347. "levelupcommands": [
  348. "/fire",
  349. "/buff 119 10",
  350. "/heal",
  351. "/hpup-hp"
  352. ],
  353. "cost": "1000"
  354. },
  355. "L26": {
  356. "name": "L26",
  357. "parentgroup": "rank.L25",
  358. "group": "rank.L26",
  359. "levelupcommands": [
  360. "/fire",
  361. "/buff 119 10",
  362. "/heal",
  363. "/hpup-hp"
  364. ],
  365. "cost": "1000"
  366. },
  367. "L27": {
  368. "name": "L27",
  369. "parentgroup": "rank.L26",
  370. "group": "rank.L27",
  371. "levelupcommands": [
  372. "/fire",
  373. "/buff 119 10",
  374. "/heal",
  375. "/hpup-hp"
  376. ],
  377. "cost": "1000"
  378. },
  379. "L28": {
  380. "name": "L28",
  381. "parentgroup": "rank.L27",
  382. "group": "rank.L28",
  383. "levelupcommands": [
  384. "/fire",
  385. "/buff 119 10",
  386. "/heal",
  387. "/hpup-hp"
  388. ],
  389. "cost": "1000"
  390. },
  391. "L29": {
  392. "name": "L29",
  393. "parentgroup": "rank.L28",
  394. "group": "rank.L29",
  395. "levelupcommands": [
  396. "/fire",
  397. "/buff 119 10",
  398. "/heal",
  399. "/hpup-hp"
  400. ],
  401. "cost": "1000"
  402. },
  403. "L30": {
  404. "name": "L30",
  405. "parentgroup": "rank.L29",
  406. "group": "rank.L30",
  407. "levelupcommands": [
  408. "/fire",
  409. "/buff 119 10",
  410. "/heal",
  411. "/level"
  412. ],
  413. "cost": "1000"
  414. },
  415. "L31": {
  416. "name": "L31",
  417. "parentgroup": "rank.L30",
  418. "group": "rank.L31",
  419. "levelupcommands": [
  420. "/fire",
  421. "/buff 119 10",
  422. "/heal",
  423. "/hpup-hp"
  424. ],
  425. "cost": "1000"
  426. },
  427. "L32": {
  428. "name": "L32",
  429. "parentgroup": "rank.L31",
  430. "group": "rank.L32",
  431. "levelupcommands": [
  432. "/fire",
  433. "/buff 119 10",
  434. "/heal",
  435. "/hpup-hp"
  436. ],
  437. "cost": "1000"
  438. },
  439. "L33": {
  440. "name": "L33",
  441. "parentgroup": "rank.L32",
  442. "group": "rank.L33",
  443. "levelupcommands": [
  444. "/fire",
  445. "/buff 119 10",
  446. "/heal",
  447. "/hpup-hp"
  448. ],
  449. "cost": "1000"
  450. },
  451. "L34": {
  452. "name": "L34",
  453. "parentgroup": "rank.L33",
  454. "group": "rank.L34",
  455. "levelupcommands": [
  456. "/fire",
  457. "/buff 119 10",
  458. "/heal",
  459. "/hpup-hp"
  460. ],
  461. "cost": "1000"
  462. },
  463. "L35": {
  464. "name": "L35",
  465. "parentgroup": "rank.L34",
  466. "group": "rank.L35",
  467. "levelupcommands": [
  468. "/fire",
  469. "/buff 119 10",
  470. "/heal",
  471. "/hpup-hp"
  472. ],
  473. "cost": "1000"
  474. },
  475. "L36": {
  476. "name": "L36",
  477. "parentgroup": "rank.L35",
  478. "group": "rank.L36",
  479. "levelupcommands": [
  480. "/fire",
  481. "/buff 119 10",
  482. "/heal",
  483. "/hpup-hp"
  484. ],
  485. "cost": "1000"
  486. },
  487. "L37": {
  488. "name": "L37",
  489. "parentgroup": "rank.L36",
  490. "group": "rank.L37",
  491. "levelupcommands": [
  492. "/fire",
  493. "/buff 119 10",
  494. "/heal",
  495. "/hpup-hp"
  496. ],
  497. "cost": "1000"
  498. },
  499. "L38": {
  500. "name": "L38",
  501. "parentgroup": "rank.L37",
  502. "group": "rank.L38",
  503. "levelupcommands": [
  504. "/fire",
  505. "/buff 119 10",
  506. "/heal",
  507. "/hpup-hp"
  508. ],
  509. "cost": "1000"
  510. },
  511. "L39": {
  512. "name": "L39",
  513. "parentgroup": "rank.L38",
  514. "group": "rank.L39",
  515. "levelupcommands": [
  516. "/fire",
  517. "/buff 119 10",
  518. "/heal",
  519. "/hpup-hp"
  520. ],
  521. "cost": "1000"
  522. },
  523. "L40": {
  524. "name": "L40",
  525. "parentgroup": "rank.L39",
  526. "group": "rank.L40",
  527. "levelupcommands": [
  528. "/fire",
  529. "/buff 119 10",
  530. "/heal",
  531. "/level"
  532. ],
  533. "cost": "1000"
  534. },
  535. "L41": {
  536. "name": "L41",
  537. "parentgroup": "rank.L40",
  538. "group": "rank.L41",
  539. "levelupcommands": [
  540. "/fire",
  541. "/buff 119 10",
  542. "/heal",
  543. "/hpup-hp"
  544. ],
  545. "cost": "1000"
  546. },
  547. "L42": {
  548. "name": "L42",
  549. "parentgroup": "rank.L41",
  550. "group": "rank.L42",
  551. "levelupcommands": [
  552. "/fire",
  553. "/buff 119 10",
  554. "/heal",
  555. "/hpup-hp"
  556. ],
  557. "cost": "1000"
  558. },
  559. "L43": {
  560. "name": "L43",
  561. "parentgroup": "rank.L42",
  562. "group": "rank.L43",
  563. "levelupcommands": [
  564. "/fire",
  565. "/buff 119 10",
  566. "/heal",
  567. "/hpup-hp"
  568. ],
  569. "cost": "1000"
  570. },
  571. "L44": {
  572. "name": "L44",
  573. "parentgroup": "rank.L43",
  574. "group": "rank.L44",
  575. "levelupcommands": [
  576. "/fire",
  577. "/buff 119 10",
  578. "/heal",
  579. "/hpup-hp"
  580. ],
  581. "cost": "1000"
  582. },
  583. "L45": {
  584. "name": "L45",
  585. "parentgroup": "rank.L44",
  586. "group": "rank.L45",
  587. "levelupcommands": [
  588. "/fire",
  589. "/buff 119 10",
  590. "/heal",
  591. "/hpup-hp"
  592. ],
  593. "cost": "1000"
  594. },
  595. "L46": {
  596. "name": "L46",
  597. "parentgroup": "rank.L45",
  598. "group": "rank.L46",
  599. "levelupcommands": [
  600. "/fire",
  601. "/buff 119 10",
  602. "/heal",
  603. "/hpup-hp"
  604. ],
  605. "cost": "1000"
  606. },
  607. "L47": {
  608. "name": "L47",
  609. "parentgroup": "rank.L46",
  610. "group": "rank.L47",
  611. "levelupcommands": [
  612. "/fire",
  613. "/buff 119 10",
  614. "/heal",
  615. "/hpup-hp"
  616. ],
  617. "cost": "1000"
  618. },
  619. "L48": {
  620. "name": "L48",
  621. "parentgroup": "rank.L47",
  622. "group": "rank.L48",
  623. "levelupcommands": [
  624. "/fire",
  625. "/buff 119 10",
  626. "/heal",
  627. "/hpup-hp"
  628. ],
  629. "cost": "1000"
  630. },
  631. "L49": {
  632. "name": "L49",
  633. "parentgroup": "rank.L48",
  634. "group": "rank.L49",
  635. "levelupcommands": [
  636. "/fire",
  637. "/buff 119 10",
  638. "/heal",
  639. "/hpup-hp"
  640. ],
  641. "cost": "1000"
  642. },
  643. "L50": {
  644. "name": "L50",
  645. "parentgroup": "rank.L49",
  646. "group": "rank.L50",
  647. "levelupcommands": [
  648. "/fire",
  649. "/buff 119 10",
  650. "/heal",
  651. "/level"
  652. ],
  653. "cost": "1000"
  654. },
  655. "L51": {
  656. "name": "L51",
  657. "parentgroup": "rank.L50",
  658. "group": "rank.L51",
  659. "levelupcommands": [
  660. "/fire",
  661. "/buff 119 10",
  662. "/heal",
  663. "/hpup-hp"
  664. ],
  665. "cost": "1000"
  666. },
  667. "L52": {
  668. "name": "L52",
  669. "parentgroup": "rank.L51",
  670. "group": "rank.L52",
  671. "levelupcommands": [
  672. "/fire",
  673. "/buff 119 10",
  674. "/heal",
  675. "/hpup-hp"
  676. ],
  677. "cost": "1000"
  678. },
  679. "L53": {
  680. "name": "L53",
  681. "parentgroup": "rank.L52",
  682. "group": "rank.L53",
  683. "levelupcommands": [
  684. "/fire",
  685. "/buff 119 10",
  686. "/heal",
  687. "/hpup-hp"
  688. ],
  689. "cost": "1000"
  690. },
  691. "L54": {
  692. "name": "L54",
  693. "parentgroup": "rank.L53",
  694. "group": "rank.L54",
  695. "levelupcommands": [
  696. "/fire",
  697. "/buff 119 10",
  698. "/heal",
  699. "/hpup-hp"
  700. ],
  701. "cost": "1000"
  702. },
  703. "L55": {
  704. "name": "L55",
  705. "parentgroup": "rank.L54",
  706. "group": "rank.L55",
  707. "levelupcommands": [
  708. "/fire",
  709. "/buff 119 10",
  710. "/heal",
  711. "/hpup-hp"
  712. ],
  713. "cost": "1000"
  714. },
  715. "L56": {
  716. "name": "L56",
  717. "parentgroup": "rank.L55",
  718. "group": "rank.L56",
  719. "levelupcommands": [
  720. "/fire",
  721. "/buff 119 10",
  722. "/heal",
  723. "/hpup-hp"
  724. ],
  725. "cost": "1000"
  726. },
  727. "L57": {
  728. "name": "L57",
  729. "parentgroup": "rank.L56",
  730. "group": "rank.L57",
  731. "levelupcommands": [
  732. "/fire",
  733. "/buff 119 10",
  734. "/heal",
  735. "/hpup-hp"
  736. ],
  737. "cost": "1000"
  738. },
  739. "L58": {
  740. "name": "L58",
  741. "parentgroup": "rank.L57",
  742. "group": "rank.L58",
  743. "levelupcommands": [
  744. "/fire",
  745. "/buff 119 10",
  746. "/heal",
  747. "/hpup-hp"
  748. ],
  749. "cost": "1000"
  750. },
  751. "L59": {
  752. "name": "L59",
  753. "parentgroup": "rank.L58",
  754. "group": "rank.L59",
  755. "levelupcommands": [
  756. "/fire",
  757. "/buff 119 10",
  758. "/heal",
  759. "/hpup-hp"
  760. ],
  761. "cost": "1000"
  762. },
  763. "L60": {
  764. "name": "L60",
  765. "parentgroup": "rank.L59",
  766. "group": "rank.L60",
  767. "levelupcommands": [
  768. "/fire",
  769. "/buff 119 10",
  770. "/heal",
  771. "/level"
  772. ],
  773. "cost": "1000"
  774. },
  775. "L61": {
  776. "name": "L61",
  777. "parentgroup": "rank.L60",
  778. "group": "rank.L61",
  779. "levelupcommands": [
  780. "/fire",
  781. "/buff 119 10",
  782. "/heal",
  783. "/hpup-hp"
  784. ],
  785. "cost": "1000"
  786. },
  787. "L62": {
  788. "name": "L62",
  789. "parentgroup": "rank.L61",
  790. "group": "rank.L62",
  791. "levelupcommands": [
  792. "/fire",
  793. "/buff 119 10",
  794. "/heal",
  795. "/hpup-hp"
  796. ],
  797. "cost": "1000"
  798. },
  799. "L63": {
  800. "name": "L63",
  801. "parentgroup": "rank.L62",
  802. "group": "rank.L63",
  803. "levelupcommands": [
  804. "/fire",
  805. "/buff 119 10",
  806. "/heal",
  807. "/hpup-hp"
  808. ],
  809. "cost": "1000"
  810. },
  811. "L64": {
  812. "name": "L64",
  813. "parentgroup": "rank.L63",
  814. "group": "rank.L64",
  815. "levelupcommands": [
  816. "/fire",
  817. "/buff 119 10",
  818. "/heal",
  819. "/hpup-hp"
  820. ],
  821. "cost": "1000"
  822. },
  823. "L65": {
  824. "name": "L65",
  825. "parentgroup": "rank.L64",
  826. "group": "rank.L65",
  827. "levelupcommands": [
  828. "/fire",
  829. "/buff 119 10",
  830. "/heal",
  831. "/hpup-hp"
  832. ],
  833. "cost": "1000"
  834. },
  835. "L66": {
  836. "name": "L66",
  837. "parentgroup": "rank.L65",
  838. "group": "rank.L66",
  839. "levelupcommands": [
  840. "/fire",
  841. "/buff 119 10",
  842. "/heal",
  843. "/hpup-hp"
  844. ],
  845. "cost": "1000"
  846. },
  847. "L67": {
  848. "name": "L67",
  849. "parentgroup": "rank.L66",
  850. "group": "rank.L67",
  851. "levelupcommands": [
  852. "/fire",
  853. "/buff 119 10",
  854. "/heal",
  855. "/hpup-hp"
  856. ],
  857. "cost": "1000"
  858. },
  859. "L68": {
  860. "name": "L68",
  861. "parentgroup": "rank.L67",
  862. "group": "rank.L68",
  863. "levelupcommands": [
  864. "/fire",
  865. "/buff 119 10",
  866. "/heal",
  867. "/hpup-hp"
  868. ],
  869. "cost": "1000"
  870. },
  871. "L69": {
  872. "name": "L69",
  873. "parentgroup": "rank.L68",
  874. "group": "rank.L69",
  875. "levelupcommands": [
  876. "/fire",
  877. "/buff 119 10",
  878. "/heal",
  879. "/hpup-hp"
  880. ],
  881. "cost": "1000"
  882. },
  883. "L70": {
  884. "name": "L70",
  885. "parentgroup": "rank.L69",
  886. "group": "rank.L70",
  887. "levelupcommands": [
  888. "/fire",
  889. "/buff 119 10",
  890. "/heal",
  891. "/level"
  892. ],
  893. "cost": "1000"
  894. },
  895. "L71": {
  896. "name": "L71",
  897. "parentgroup": "rank.L70",
  898. "group": "rank.L71",
  899. "levelupcommands": [
  900. "/fire",
  901. "/buff 119 10",
  902. "/heal",
  903. "/hpup-hp"
  904. ],
  905. "cost": "1000"
  906. },
  907. "L72": {
  908. "name": "L72",
  909. "parentgroup": "rank.L71",
  910. "group": "rank.L72",
  911. "levelupcommands": [
  912. "/fire",
  913. "/buff 119 10",
  914. "/heal",
  915. "/hpup-hp"
  916. ],
  917. "cost": "1000"
  918. },
  919. "L73": {
  920. "name": "L73",
  921. "parentgroup": "rank.L72",
  922. "group": "rank.L73",
  923. "levelupcommands": [
  924. "/fire",
  925. "/buff 119 10",
  926. "/heal",
  927. "/hpup-hp"
  928. ],
  929. "cost": "1000"
  930. },
  931. "L74": {
  932. "name": "L74",
  933. "parentgroup": "rank.L73",
  934. "group": "rank.L74",
  935. "levelupcommands": [
  936. "/fire",
  937. "/buff 119 10",
  938. "/heal",
  939. "/hpup-hp"
  940. ],
  941. "cost": "1000"
  942. },
  943. "L75": {
  944. "name": "L75",
  945. "parentgroup": "rank.L74",
  946. "group": "rank.L75",
  947. "levelupcommands": [
  948. "/fire",
  949. "/buff 119 10",
  950. "/heal",
  951. "/hpup-hp"
  952. ],
  953. "cost": "1000"
  954. },
  955. "L76": {
  956. "name": "L76",
  957. "parentgroup": "rank.L75",
  958. "group": "rank.L76",
  959. "levelupcommands": [
  960. "/fire",
  961. "/buff 119 10",
  962. "/heal",
  963. "/hpup-hp"
  964. ],
  965. "cost": "1000"
  966. },
  967. "L77": {
  968. "name": "L77",
  969. "parentgroup": "rank.L76",
  970. "group": "rank.L77",
  971. "levelupcommands": [
  972. "/fire",
  973. "/buff 119 10",
  974. "/heal",
  975. "/hpup-hp"
  976. ],
  977. "cost": "1000"
  978. },
  979. "L78": {
  980. "name": "L78",
  981. "parentgroup": "rank.L77",
  982. "group": "rank.L78",
  983. "levelupcommands": [
  984. "/fire",
  985. "/buff 119 10",
  986. "/heal",
  987. "/hpup-hp"
  988. ],
  989. "cost": "1000"
  990. },
  991. "L79": {
  992. "name": "L79",
  993. "parentgroup": "rank.L78",
  994. "group": "rank.L79",
  995. "levelupcommands": [
  996. "/fire",
  997. "/buff 119 10",
  998. "/heal",
  999. "/hpup-hp"
  1000. ],
  1001. "cost": "1000"
  1002. },
  1003. "L80": {
  1004. "name": "L80",
  1005. "parentgroup": "rank.L79",
  1006. "group": "rank.L80",
  1007. "levelupcommands": [
  1008. "/fire",
  1009. "/buff 119 10",
  1010. "/heal",
  1011. "/level"
  1012. ],
  1013. "cost": "1000"
  1014. },
  1015. "L81": {
  1016. "name": "L81",
  1017. "parentgroup": "rank.L80",
  1018. "group": "rank.L81",
  1019. "levelupcommands": [
  1020. "/fire",
  1021. "/buff 119 10",
  1022. "/heal",
  1023. "/hpup-hp"
  1024. ],
  1025. "cost": "1000"
  1026. },
  1027. "L82": {
  1028. "name": "L82",
  1029. "parentgroup": "rank.L81",
  1030. "group": "rank.L82",
  1031. "levelupcommands": [
  1032. "/fire",
  1033. "/buff 119 10",
  1034. "/heal",
  1035. "/hpup-hp"
  1036. ],
  1037. "cost": "1000"
  1038. },
  1039. "L83": {
  1040. "name": "L83",
  1041. "parentgroup": "rank.L82",
  1042. "group": "rank.L83",
  1043. "levelupcommands": [
  1044. "/fire",
  1045. "/buff 119 10",
  1046. "/heal",
  1047. "/hpup-hp"
  1048. ],
  1049. "cost": "1000"
  1050. },
  1051. "L84": {
  1052. "name": "L84",
  1053. "parentgroup": "rank.L83",
  1054. "group": "rank.L84",
  1055. "levelupcommands": [
  1056. "/fire",
  1057. "/buff 119 10",
  1058. "/heal",
  1059. "/hpup-hp"
  1060. ],
  1061. "cost": "1000"
  1062. },
  1063. "L85": {
  1064. "name": "L85",
  1065. "parentgroup": "rank.L84",
  1066. "group": "rank.L85",
  1067. "levelupcommands": [
  1068. "/fire",
  1069. "/buff 119 10",
  1070. "/heal",
  1071. "/hpup-hp"
  1072. ],
  1073. "cost": "1000"
  1074. },
  1075. "L86": {
  1076. "name": "L86",
  1077. "parentgroup": "rank.L85",
  1078. "group": "rank.L86",
  1079. "levelupcommands": [
  1080. "/fire",
  1081. "/buff 119 10",
  1082. "/heal",
  1083. "/hpup-hp"
  1084. ],
  1085. "cost": "1000"
  1086. },
  1087. "L87": {
  1088. "name": "L87",
  1089. "parentgroup": "rank.L86",
  1090. "group": "rank.L87",
  1091. "levelupcommands": [
  1092. "/fire",
  1093. "/buff 119 10",
  1094. "/heal",
  1095. "/hpup-hp"
  1096. ],
  1097. "cost": "1000"
  1098. },
  1099. "L88": {
  1100. "name": "L88",
  1101. "parentgroup": "rank.L87",
  1102. "group": "rank.L88",
  1103. "levelupcommands": [
  1104. "/fire",
  1105. "/buff 119 10",
  1106. "/heal",
  1107. "/hpup-hp"
  1108. ],
  1109. "cost": "1000"
  1110. },
  1111. "L89": {
  1112. "name": "L89",
  1113. "parentgroup": "rank.L88",
  1114. "group": "rank.L89",
  1115. "levelupcommands": [
  1116. "/fire",
  1117. "/buff 119 10",
  1118. "/heal",
  1119. "/hpup-hp"
  1120. ],
  1121. "cost": "1000"
  1122. },
  1123. "L90": {
  1124. "name": "L90",
  1125. "parentgroup": "rank.L89",
  1126. "group": "rank.L90",
  1127. "levelupcommands": [
  1128. "/fire",
  1129. "/buff 119 10",
  1130. "/heal",
  1131. "/level"
  1132. ],
  1133. "cost": "1000"
  1134. },
  1135. "L91": {
  1136. "name": "L91",
  1137. "parentgroup": "rank.L90",
  1138. "group": "rank.L91",
  1139. "levelupcommands": [
  1140. "/fire",
  1141. "/buff 119 10",
  1142. "/heal",
  1143. "/hpup-hp"
  1144. ],
  1145. "cost": "1000"
  1146. },
  1147. "L92": {
  1148. "name": "L12",
  1149. "parentgroup": "rank.L91",
  1150. "group": "rank.L92",
  1151. "levelupcommands": [
  1152. "/fire",
  1153. "/buff 119 10",
  1154. "/heal",
  1155. "/hpup-hp"
  1156. ],
  1157. "cost": "1000"
  1158. },
  1159. "L93": {
  1160. "name": "L93",
  1161. "parentgroup": "rank.L92",
  1162. "group": "rank.L93",
  1163. "levelupcommands": [
  1164. "/fire",
  1165. "/buff 119 10",
  1166. "/heal",
  1167. "/hpup-hp"
  1168. ],
  1169. "cost": "1000"
  1170. },
  1171. "L94": {
  1172. "name": "L94",
  1173. "parentgroup": "rank.L93",
  1174. "group": "rank.L94",
  1175. "levelupcommands": [
  1176. "/fire",
  1177. "/buff 119 10",
  1178. "/heal",
  1179. "/hpup-hp"
  1180. ],
  1181. "cost": "1000"
  1182. },
  1183. "L95": {
  1184. "name": "L95",
  1185. "parentgroup": "rank.L94",
  1186. "group": "rank.L95",
  1187. "levelupcommands": [
  1188. "/fire",
  1189. "/buff 119 10",
  1190. "/heal",
  1191. "/hpup-hp"
  1192. ],
  1193. "cost": "1000"
  1194. },
  1195. "L96": {
  1196. "name": "L96",
  1197. "parentgroup": "rank.L95",
  1198. "group": "rank.L96",
  1199. "levelupcommands": [
  1200. "/fire",
  1201. "/buff 119 10",
  1202. "/heal",
  1203. "/hpup-hp"
  1204. ],
  1205. "cost": "1000"
  1206. },
  1207. "L97": {
  1208. "name": "L97",
  1209. "parentgroup": "rank.L96",
  1210. "group": "rank.L97",
  1211. "levelupcommands": [
  1212. "/fire",
  1213. "/buff 119 10",
  1214. "/heal",
  1215. "/hpup-hp"
  1216. ],
  1217. "cost": "1000"
  1218. },
  1219. "L98": {
  1220. "name": "L98",
  1221. "parentgroup": "rank.L97",
  1222. "group": "rank.L98",
  1223. "levelupcommands": [
  1224. "/fire",
  1225. "/buff 119 10",
  1226. "/heal",
  1227. "/hpup-hp"
  1228. ],
  1229. "cost": "1000"
  1230. },
  1231. "L99": {
  1232. "name": "L99",
  1233. "parentgroup": "rank.L98",
  1234. "group": "rank.L99",
  1235. "levelupcommands": [
  1236. "/fire",
  1237. "/buff 119 10",
  1238. "/heal",
  1239. "/hpup-hp"
  1240. ],
  1241. "cost": "1000"
  1242. },
  1243. "L100": {
  1244. "name": "L100",
  1245. "parentgroup": "rank.L99",
  1246. "group": "rank.L100",
  1247. "levelupcommands": [
  1248. "/fire",
  1249. "/buff 119 10",
  1250. "/heal",
  1251. "/level"
  1252. ],
  1253. "cost": "1000"
  1254. }
  1255. }
  1256.  
  1257.  
  1258.  
  1259. /*
  1260. * change this variable to false to disable the broadcast
  1261. * messages when people rank up.
  1262. */
  1263. var rank_enable_broadcast = true;
  1264.  
  1265. /*
  1266. * This is a permission for groups to be EXCLUDED from the ranking system.
  1267. * Give this permission to your moderators or special elevated ranks
  1268. * to stop them from being able to /rank up and screw their account up.
  1269. */
  1270. var rank_excluded_permission = "seconomy.rank.excluded";
  1271.  
  1272. /*
  1273. ------------------------------------------------------------------------------------------------------------------------------------------------------
  1274. */
  1275.  
  1276. /**
  1277. * Iterates over all items pointed to by @a enumerable and executes
  1278. * @a func with a pointer to the item inside it.
  1279. *
  1280. * This function acts as a fast-enumerator, with built-in prototype
  1281. * checking.
  1282. *
  1283. * @param enumerable:Array An Array or other enumerable to iterate over
  1284. * @param func:function A function pointer to execute once for each item
  1285. * in the enumerable. The function prototype must
  1286. * contain one parameter which points to the item
  1287. * in the enumerable.
  1288. */
  1289. function rank_for_each_item(enumerable, func)
  1290. {
  1291. if (enumerable == undefined || func == undefined) {
  1292. return;
  1293. }
  1294.  
  1295. for (var item in enumerable) {
  1296. if (item == undefined || enumerable.hasOwnProperty(item) == false) {
  1297. continue;
  1298. }
  1299.  
  1300. func(enumerable[item]);
  1301. }
  1302. }
  1303.  
  1304.  
  1305. /**
  1306. * Finds all the parent groups for the specified group.
  1307. *
  1308. * @param group:string A string containing the group to look up
  1309. *
  1310. * @returns Array with the group objects if the operation was successful,
  1311. * Array with no objects if none was found, or @a undefined
  1312. * if there was an error.
  1313. */
  1314. function rank_find_parent(group)
  1315. {
  1316. var parentList = undefined;
  1317.  
  1318. if (rankingList == undefined || group == undefined) {
  1319. return;
  1320. }
  1321.  
  1322. if ((parentList = new Array()) == undefined) {
  1323. return;
  1324. }
  1325.  
  1326. rank_for_each_item(rankingList, function(item) {
  1327. if (item.parentgroup == group) {
  1328. parentList.push(item);
  1329. }
  1330. });
  1331.  
  1332. return parentList;
  1333. }
  1334.  
  1335. /**
  1336. * Finds a rank in the rank tree by the name provided by group.
  1337. *
  1338. * @param group:string A string containing the group name in it
  1339. *
  1340. * @returns The group object if it was found, or undefined if it
  1341. * doesn't exist or there was an error.
  1342. */
  1343. function rank_find(group)
  1344. {
  1345. var rank;
  1346.  
  1347. if (group == undefined || rankingList == undefined) {
  1348. return;
  1349. }
  1350.  
  1351. rank_for_each_item(rankingList, function(item) {
  1352. if (item.group == group) {
  1353. rank = item;
  1354. }
  1355. });
  1356.  
  1357. return rank;
  1358. }
  1359.  
  1360. /**
  1361. * Finds a rank in the rank tree by the specified name.
  1362. *
  1363. * @param rankName:string A string containing a valid rank name as
  1364. * specified by the "rank" property in the
  1365. * rankingList
  1366. *
  1367. * @returns The rank item if it was found, or undefined if the rank does
  1368. * not exist in the tree, or an error occured.
  1369. */
  1370. function rank_find_by_name(rankName)
  1371. {
  1372. var rank;
  1373.  
  1374. if (rankName == undefined || rankingList == undefined) {
  1375. return;
  1376. }
  1377.  
  1378. rank_for_each_item(rankingList, function(item) {
  1379. if (item.name.toLowerCase() == rankName.toLowerCase()) {
  1380. rank = item;
  1381. }
  1382. });
  1383. return rank;
  1384. }
  1385.  
  1386. /**
  1387. * Finds the first rank in the rankingList where the parent group isn't defined,
  1388. * which is by definition the starting rank.
  1389. *
  1390. * There should not be more than one rank in the ranking list with an undefined parent.
  1391. *
  1392. * @returns The starting rank if one exists, or undefined if it was not found.
  1393. */
  1394. function rank_starting_rank()
  1395. {
  1396. var startingRank;
  1397.  
  1398. if (rankingList === undefined) {
  1399. return;
  1400. }
  1401.  
  1402. rank_for_each_item(rankingList, function(item) {
  1403. if (item.parentgroup === undefined) {
  1404. startingRank = item;
  1405. }
  1406. });
  1407.  
  1408. return startingRank;
  1409. }
  1410.  
  1411. /**
  1412. * Returns a human-readable error message based on a provided
  1413. * hard-coded error level.
  1414. *
  1415. * @param msgLevel The return-code for functions that return
  1416. * an error code.
  1417. *
  1418. * @returns A string containing the error message for the provided
  1419. * error code.
  1420. */
  1421. function rank_error_message(msgLevel)
  1422. {
  1423. if (msgLevel == undefined) {
  1424. return "Unknown Error";
  1425. }
  1426.  
  1427. switch (msgLevel) {
  1428. case 0:
  1429. return "The operation completed successfully.";
  1430. case -1:
  1431. return "Internal error: the operation failed.";
  1432. case -2:
  1433. return "Internal error: Parsing money failed";
  1434. case -3:
  1435. return "Player does not have a bank account or the account cannot be found";
  1436. case -4:
  1437. return "Transfer failed. Perhaps you don't have enough money.";
  1438. default:
  1439. return "Unknown error.";
  1440. }
  1441. }
  1442.  
  1443. /**
  1444. * Moves a player to a new rank specified by newRank.
  1445. *
  1446. * @param player:Player The player to move the rank
  1447. * @param rank:object The rank to move the player to
  1448. *
  1449. * @returns 0 on success,
  1450. * -1 on input parameter failure
  1451. * -2 on ranking cost parse failure
  1452. * -3 on bank account not found
  1453. * -4 on transfer failed, too poor
  1454. */
  1455. function rank_move(player, rank)
  1456. {
  1457. var rankCost;
  1458. var seconomyAccount;
  1459.  
  1460. if (player == undefined && rank == undefined) {
  1461. return -1;
  1462. }
  1463.  
  1464. if ((rankCost = seconomy_parse_money(rank.cost)) == undefined) {
  1465. return -2;
  1466. }
  1467.  
  1468. if (rankCost.Value == 0) {
  1469. change_group(player, rank.group);
  1470. rank_for_each_item(rank.levelupcommands, function(command) {
  1471. execute_command(player, command);
  1472. });
  1473.  
  1474. return 0;
  1475. }
  1476.  
  1477. if ((seconomyAccount = seconomy_get_account(player)) == undefined) {
  1478. return -3;
  1479. }
  1480.  
  1481. seconomy_pay_async(seconomyAccount, seconomy_world_account(), rankCost,
  1482. "rank " + rank.name, function(payResult) {
  1483. if (payResult.TransferSucceeded == false) {
  1484. msg(player, "You don't have enough money to become a " + rank.name);
  1485. return -4;
  1486. }
  1487.  
  1488. change_group(player, rank.group);
  1489. rank_for_each_item(rank.levelupcommands, function(command) {
  1490. execute_command(player, command);
  1491. });
  1492.  
  1493. if (rank_enable_broadcast) {
  1494. broadcast_colour("#00AAFF", player.Name + " has become a " + rank.name.replace(/s$/i, '') + "!");
  1495. execute_command(tshock_server(), "/firework \"" + player.Name + "\"" );
  1496. }
  1497.  
  1498. return 0;
  1499. });
  1500. }
  1501.  
  1502.  
  1503. /**
  1504. * Simple wrapper around moving a player to the specified rank.
  1505. *
  1506. * Does the move, and informs the player if the move failed,
  1507. * and optionally does the broadcast when a player ranks up
  1508. * successfully if rank_enable_broadcast is set to true.
  1509. */
  1510. function rank_move_wrapper(player, rank)
  1511. {
  1512. if (player == undefined || rank == undefined) {
  1513. return -1;
  1514. }
  1515.  
  1516. if ((moveResult = rank_move(player, rank)) < 0) {
  1517. msg(player, "Moving ranks failed: " + rank_error_message(moveResult));
  1518. return -1;
  1519. }
  1520.  
  1521.  
  1522. return 0;
  1523. }
  1524.  
  1525.  
  1526. /**
  1527. * Moves a player up the ranking tree.
  1528. *
  1529. * Will halt if the player is at a trunk in the tree, forcing them to make
  1530. * a decision. The decision is chosen with the /rank <rank name> command.
  1531. *
  1532. * @param player The player object to move up the rank tree.
  1533. */
  1534. function rank_move_next(player, aliasRef)
  1535. {
  1536. var rank;
  1537. var nextrankingList;
  1538. var moveResult;
  1539. var nextRank;
  1540. var rankCost;
  1541. var rankString;
  1542.  
  1543. if (player == undefined || rankingList == undefined) {
  1544. return;
  1545. }
  1546.  
  1547. if ((nextRank = rank_starting_rank()) === undefined) {
  1548. msg(player, "There has been an error in the ranking script, and you can't move ranks.");
  1549. return;
  1550. }
  1551.  
  1552. if ((rank = rank_find(player.Group.Name)) === undefined) {
  1553. rank_move_wrapper(player, rank_starting_rank());
  1554. return;
  1555. }
  1556.  
  1557. if ((nextrankingList = rank_find_parent(rank.group)) == undefined) {
  1558. msg(player, "There has been an error in the ranking script, and you can't move ranks.");
  1559. return;
  1560. }
  1561. if (nextrankingList.length == 0) {
  1562. msg(player, "You are already the maximum rank!");
  1563. return;
  1564. }
  1565. if (nextrankingList.length == 1 && (nextRank = nextrankingList[0]) != undefined) {
  1566. rank_move_wrapper(player, nextRank);
  1567. return;
  1568. }
  1569. if (nextrankingList.length > 1) {
  1570. msg(player, "You are a " + rank.name + ". Now you must pick a class:");
  1571.  
  1572. rank_for_each_item(nextrankingList, function(item) {
  1573. rankCost = seconomy_parse_money(item.cost);
  1574. rankString = " * /rank " + item.name;
  1575.  
  1576. if (rankCost.Value == 0) {
  1577. rankString += " (free)";
  1578. } else {
  1579. rankString += " (costs " + rankCost.ToString() + ")";
  1580. }
  1581.  
  1582. msg(player, rankString);
  1583. });
  1584.  
  1585. acmd_cooldown_reset(player, aliasRef);
  1586. }
  1587. }
  1588.  
  1589. /**
  1590. * Prints a help message to the player depending on where they are in the rank
  1591. * tree.
  1592. *
  1593. * @param player The player to print the message to, and about.
  1594. *
  1595. */
  1596. function rank_player_help(player)
  1597. {
  1598. var rank;
  1599. var nextRank;
  1600. var playerText;
  1601. var rankCost;
  1602. var rankString;
  1603.  
  1604. if (player == undefined || rankingList == undefined) {
  1605. return;
  1606. }
  1607.  
  1608. if ((rank = rank_find(player.Group.Name)) == undefined) {
  1609. var startingRank;
  1610. if ((startingRank = rank_starting_rank()) === undefined) {
  1611. msg(player, "There is no starting rank, and you cannot rank up.");
  1612. return;
  1613. }
  1614.  
  1615. msg(player, "You aren't a rank yet. Your next rank is " + startingRank.name);
  1616. return;
  1617. }
  1618.  
  1619.  
  1620. playerText = "You are a " + rank.name + ".";
  1621. if ((nextRank = rank_find_parent(rank.group)) === undefined) {
  1622. msg(player, "There has been an internal error in the ranking system.");
  1623. return;
  1624. }
  1625.  
  1626.  
  1627. if (nextRank.length == 0) {
  1628. playerText += " You are the maximum rank!";
  1629. msg(player, playerText);
  1630. return;
  1631. } else if (nextRank.length == 1 && (rank = nextRank[0]) != undefined) {
  1632. playerText += " Your next rank is " + rank.name;
  1633.  
  1634. if ((rankCost = seconomy_parse_money(rank.cost)) == undefined) {
  1635. playerText += ".";
  1636. } else {
  1637. if (rankCost.Value > 0) {
  1638. playerText += " and costs " + rankCost.ToString() + ". To rank up, type \"/rank up\".";
  1639. } else {
  1640. playerText += ".";
  1641. }
  1642. }
  1643. } else {
  1644. playerText += " Type /rank up to pick a class";
  1645. }
  1646. msg(player, playerText);
  1647.  
  1648. }
  1649.  
  1650. /**
  1651. The main /rank aliascommand
  1652.  
  1653. The command itself costs nothing, that's because
  1654. the handlers will charge if need be.
  1655.  
  1656. */
  1657. acmd_alias_create( /*alias name */ "rank", /* cost */ "0c", /* Cool down seconds */0, /* permission needed */ "", /* function to execute */ function (player, parameters) {
  1658. var command;
  1659. var chosenClass;
  1660.  
  1661. if (rankingList == undefined
  1662. || player.Group == undefined) {
  1663. return;
  1664. }
  1665.  
  1666. if (tshock_has_permission(player, rank_excluded_permission)) {
  1667. msg_colour("#FFDD00", player, "You can't rank up on this account.");
  1668. return;
  1669. }
  1670.  
  1671. if (parameters.Count == 0
  1672. || (command = parameters[0]) == "help") {
  1673. rank_player_help(player);
  1674. /*
  1675. * Cooldown gets reset if the
  1676. * player is just querying what
  1677. * rank they are
  1678. */
  1679. acmd_cooldown_reset(player, this);
  1680. return;
  1681. }
  1682.  
  1683. if (command == "up") {
  1684. rank_move_next(player, this);
  1685. return;
  1686. }
  1687.  
  1688. if (!(chosenClass = rank_find_by_name(command.toString().toLowerCase()))) {
  1689. msg_colour("#FFDD00", player, "Cannot find a rank by the name " + command + ".");
  1690. return;
  1691. }
  1692.  
  1693.  
  1694.  
  1695. if (chosenClass.parentgroup.toLowerCase() != rank_find(player.Group.Name).name.toLowerCase()) {
  1696. rank_player_help(player);
  1697. return;
  1698. }
  1699.  
  1700.  
  1701. rank_move_wrapper(player, chosenClass);
  1702. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement