Advertisement
CowLaser

dpl bot

Apr 3rd, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.92 KB | None | 0 0
  1. on *:TEXT:!*:%spl.chan: {
  2. if ($1 == !showteam) && ($findtok(%spl.teams,$2,1,32)) {
  3. msg $iif($chan,$chan,$nick) $getfullname($2) Credits: $getcredits($2) $chr(124) Bidders: $getbidders($2) $chr(124) Players: $getplayers($2)
  4. }
  5. if ($chan) {
  6. if (($1 == !withdraw) && (%spl.active == 1) && ($getbidderteam($nick) == $getcurrteam)) {
  7. if ($getnumplayers($getcurrteam) < 7) {
  8. msg $chan  $+ %colour $+ Team must have purchased 7 players before withdrawing.
  9. return
  10. }
  11. set %spl.skip $puttok(%spl.skip,0,$getteam($getcurrteam),32)
  12. msg $chan $getfullname($getcurrteam) have withdrawn from the auction.
  13. msg $chan $getfullname($getnext) up to nominate. Bidders: $getbidders($getcurrteam)
  14. }
  15. if (($1 == !nominate) && (%spl.active == 1) && ($getbidderteam($nick) == $getcurrteam)) {
  16. if ($read(spl.txt,s,$replace($2-,$chr(32),\))) {
  17. if ($findtok(%spl.bought,$replace($2-,$chr(32),\),1,58)) {
  18. msg $chan  $+ %colour $+  $+ $2- has already been sold.
  19. return
  20. }
  21. msg $chan  $+ %colour $+ $getplayerdata($replace($gettok($read(spl.txt,$readn),1,32),$chr(32),\))
  22. set %spl.nominated $gettok($read(spl.txt,$readn),1,32)
  23. set %spl.active 2
  24. set %spl.highbid 3000
  25. set %spl.highbidteam $getcurrteam
  26. msg $chan $getfullname($getbidderteam($nick)) $+ : 3000
  27. set %spl.bids $puttok(%spl.bids,%spl.highbid,$getteam($getbidderteam($nick)),32)
  28. .timerinitial 1 %spl.time lastten
  29. }
  30. else {
  31. msg $chan $getfullname($getbidderteam($nick)) $+ : Player " $+ $2- $+ " not found.
  32. }
  33. }
  34. if ((($left($right($1,-1),1) isnum) || ($left($right($1,-1),1) == +)) && (%spl.active == 2)) {
  35. if ($isbidder($nick)) {
  36. if (!$gettok(%spl.skip,$getteam($getbidderteam($nick)),32)) {
  37. return
  38. }
  39. var %bid $processbid($right($1,-1))
  40. if (!%bid) {
  41. msg $chan $getfullname($getbidderteam($nick)) $+ : Invalid bid amount.
  42. return
  43. }
  44. if (($right(%bid,3) != 000) && ($right(%bid,3) != 500)) {
  45. msg $chan $getfullname($getbidderteam($nick)) $+ : Only bids that are multiples of 500 are accepted.
  46. return
  47. }
  48. if (%bid > $getmaxbid($getbidderteam($nick))) {
  49. msg $chan $getfullname($getbidderteam($nick)) $+ : Bid exceeds max bid of $getmaxbid($getbidderteam($nick)) $+ .
  50. return
  51. }
  52. if (%bid < $calc(%spl.highbid + 500)) {
  53. msg $chan $getfullname($getbidderteam($nick)) $+ : Bid must be at least 500 above %spl.highbid $+ .
  54. return
  55. }
  56. set %spl.highbid %bid
  57. set %spl.highbidteam $getbidderteam($nick)
  58. set %spl.bids $puttok(%spl.bids,%bid,$getteam($getbidderteam($nick)),32)
  59. msg $chan $getfullname($getbidderteam($nick)) $+ : %bid
  60. if (%spl.10) {
  61. lastten
  62. }
  63. }
  64. }
  65. if (($address($nick,2) == *!*@synIRC-2CAE5CDD.rh.rit.edu) || ($address($nick,2) == *!*@F0898D27.5C5A20DE.754B15C0.IP)) {
  66. if ($1 == !showall) {
  67. var %i 1
  68. while (%i <= $numtok(%spl.teams,32)) {
  69. msg $chan $getfullname($gettok(%spl.teams,%i,32)) Credits: $getcredits($gettok(%spl.teams,%i,32))  $+ $chr(124) Bidders: $getbidders($gettok(%spl.teams,%i,32)) $chr(124) Players: $getplayers($gettok(%spl.teams,%i,32))
  70. inc %i
  71. }
  72. }
  73. if (($1 == !setchan) && ($2)) {
  74. join $2
  75. set %spl.chan $2
  76. msg $chan  $+ %colour $+ Commands will now function only in $2 $+ .
  77. }
  78. if (($1 == !addcredits) && ($findtok(%spl.teams,$2,1,32)) && ($3 isnum)) {
  79. set %spl.credits $puttok(%spl.credits,$calc($getcredits($2) + $3),$getteam($2),32)
  80. msg $chan  $+ %colour $+  $+ $3 credits addaed to $getfullname($2) $+ .
  81. }
  82. if (($1 == !addretainer) && ($findtok(%spl.teams,$2,1,32)) && ($3 isnum) && ($4-)) {
  83. if ($read(spl.txt,s,$replace($4-,$chr(32),\))) {
  84. set %spl.credits $puttok(%spl.credits,$calc($getcredits($2) - $3),$getteam($2),32)
  85. set %spl.players $puttok(%spl.players,$addtok($gettok(%spl.players,$getteam($2),32),$replace($4-,$chr(32),\),44),$getteam($2),32)
  86. set %spl.bought %spl.bought $+ : $+ $replace($4-,$chr(32),\)
  87. set %spl.prices %spl.prices $+ : $+ $3
  88. set %spl.crspndteam %spl.crspndteam $+ : $+ $2
  89. msg $chan  $+ %colour $+  $+ $replace($4-,\,$chr(32)) retained by $getfullname($2) for $3 $+ .
  90. }
  91. else {
  92. msg $chan $getfullname($2) $+ : Player " $+ $4- $+ " not found.
  93. }
  94. }
  95. if (($1 == !settimer) && ($2 isnum)) {
  96. set %spl.time $2
  97. msg $chan  $+ %colour $+ Initial timer changed to $2 seconds.
  98. }
  99. if ($1 == !undobid) {
  100. msg $chan  $+ %colour $+ The highest bid has been forcefully retracted.
  101. set %spl.highbid $gettok($sorttok(%spl.bids,32,nr),2,32)
  102. set %spl.highbidteam $gettok(%spl.teams,$findtok(%spl.bids,%spl.highbid,1,32),32)
  103. msg $chan $getfullname(%spl.highbidteam) $+ : %spl.highbid
  104. }
  105. if (($1 == !pause) && (%spl.active >= 1)) {
  106. turntimersoff
  107. msg $chan  $+ %colour $+ The auction has been paused.
  108. set %spl.active 4 %spl.active
  109. }
  110. if (($1 == !resume) && ($gettok(%spl.active,1,32) == 4)) {
  111. set %spl.active $gettok(%spl.active,2,32)
  112. msg $chan  $+ %colour $+ The auction has been resumed.
  113. if (%spl.active == 2) {
  114. .timerinitial 1 %spl.time lastten
  115. msg $chan $getfullname(%spl.highbidteam) $+ : %spl.highbid
  116. }
  117. else if (%spl.active == 3) {
  118. .timercont 1 3 nextbidding
  119. }
  120. }
  121. if (($1 == !start) && (!%spl.active)) {
  122. msg $chan $getfullname($getnext) up to nominate. Bidders: $getbidders($getcurrteam)
  123. set %spl.active 1
  124. }
  125. if (($1 == !next) && (%spl.active)) {
  126. msg $chan  $+ %colour $+ Skipping to next team.
  127. msg $chan $getfullname($getnext) up to nominate. Bidders: $getbidders($getcurrteam)
  128. set %spl.active 1
  129. turntimersoff
  130. }
  131. if ($1 == !reset) {
  132. unset %spl.*
  133. set %spl.teams sis msj tjt oba sss hhh
  134. set %spl.credits 39000 70000 70000 70000 70000 70000 70000 70000 70000 70000
  135. set %spl.bidders . . . . . . . . . .
  136. set %spl.players ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
  137. set %spl.bids 0 0 0 0 0 0 0 0 0 0
  138. set %spl.skip 1 1 1 1 1 1 1 1 1 1
  139. set %spl.currbid 0
  140. set %spl.currdir 1
  141. set %spl.time 20
  142. set %spl.chan $chan
  143. turntimersoff
  144. msg $chan  $+ %colour $+ All details have been reset.
  145. }
  146. if ((($1 == !setcolour) || ($1 == !setcolor)) && ($2 isnum)) {
  147. if ($len($2) == 2) {
  148. set %colour $2
  149. }
  150. else {
  151. set %colour 0 $+ $2
  152. }
  153. msg $chan  $+ %colour $+ Text colour changed.
  154. }
  155. if (($1 == !addbidder) && ($findtok(%spl.teams,$2,1,32)) && ($3)) {
  156. if ($isbidder($3)) {
  157. msg $chan  $+ %colour $+ $3 is already a bidder for $getfullname($getbidderteam($3)) $+ .
  158. return
  159. }
  160. set %spl.bidders $puttok(%spl.bidders,$addtok($gettok(%spl.bidders,$getteam($2),32),$3,44),$getteam($2),32)
  161. msg $chan  $+ %colour $+ $3 added to bidders for $getfullname($2) $+ . Bidders: $getbidders($2)
  162. }
  163. if (($1 == !removebidder) && ($findtok(%spl.teams,$2,1,32)) && ($3) && ($3 != .)) {
  164. if (!$findtok($gettok(%spl.bidders,$getteam($2),32),$3,1,44)) {
  165. msg $chan  $+ %colour $+ $3 is not a bidder for $getfullname($2) $+ . Bidders: $getbidders($2)
  166. return
  167. }
  168. set %spl.bidders $puttok(%spl.bidders,$remtok($gettok(%spl.bidders,$getteam($2),32),$3,1,44),$getteam($2),32)
  169. msg $chan  $+ %colour $+ $3 removed from bidders for $getfullname($2) $+ . Bidders: $getbidders($2)
  170. }
  171. }
  172. }
  173. }
  174.  
  175. alias getteam {
  176. return $findtok(%spl.teams,$1,1,32)
  177. }
  178.  
  179. alias getfullname {
  180. if ($1 == oba) { return 7The Oreburgh Ancients $+ %colour }
  181. if ($1 == msj) { return 6The Mossdeep City Space Jams $+ %colour }
  182. if ($1 == hhh) { return 12The Hungry Hungry Hippowdons $+ %colour }
  183. if ($1 == sis) { return 9The Six Island Shitposters $+ %colour }
  184. if ($1 == tjt) { return 14The Tohjo Tramplers $+ %colour }
  185. if ($1 == sss) { return 11The Slateport City Spindas $+ %colour }
  186. }
  187.  
  188. alias getbidders {
  189. return $replace($gettok(%spl.bidders,$getteam($1),32),. $+ $chr(44),$chr(32),.,$chr(32),$chr(44),$chr(32) / $chr(32))
  190. }
  191. alias getcredits {
  192. return $gettok(%spl.credits,$getteam($1),32)
  193. }
  194. alias getplayers {
  195. return $replace($gettok(%spl.players,$getteam($1),32),\,$chr(32),^ $+ $chr(44),$chr(32),^,$chr(32),$chr(44),$chr(32) / $chr(32))
  196. }
  197. alias getcurrteam {
  198. return $gettok(%spl.teams,%spl.currbid,32)
  199. }
  200.  
  201. alias getnext {
  202. set %spl.currbid $calc(%spl.currbid + %spl.currdir)
  203. if (%spl.currbid == 11) {
  204. set %spl.currbid 10
  205. set %spl.currdir -1
  206. }
  207. else if (%spl.currbid == 0) {
  208. set %spl.currbid 1
  209. set %spl.currdir 1
  210. }
  211. var %count 0
  212. while ($gettok(%spl.skip,$getteam($getcurrteam),32) == 0) {
  213. set %spl.currbid $calc(%spl.currbid + %spl.currdir)
  214. if (%spl.currbid == 11) {
  215. set %spl.currbid 10
  216. set %spl.currdir -1
  217. }
  218. else if (%spl.currbid == 0) {
  219. set %spl.currbid 1
  220. set %spl.currdir 1
  221. }
  222. inc %count
  223. if (%count == 20) {
  224. endauction
  225. halt
  226. }
  227. }
  228. return $gettok(%spl.teams,%spl.currbid,32)
  229. }
  230.  
  231. alias isbidder {
  232. var %i 1
  233. while (%i <= 10) {
  234. if ($findtok($gettok(%spl.bidders,%i,32),$1,1,44)) {
  235. return $true
  236. }
  237. inc %i
  238. }
  239. return $false
  240. }
  241.  
  242. alias processbid {
  243. ; if ($left($1,1) == +) {
  244. ; var %pbid $right($1,-1)
  245. ; var %pbid $processplusbid(%pbid)
  246. ; if (%pbid == 0) {
  247. ; return 0
  248. ; }
  249. ; var %mbid %spl.highbid
  250. ; }
  251. ; else {
  252. var %pbid 0
  253. var %mbid $1
  254. ; }
  255. if (%mbid isnum 3-94) {
  256. return $iif($numtok($calc(%mbid * 1000),46) == 1,$calc(%mbid * 1000 + %pbid),0)
  257. }
  258. else if (%mbid isnum 3000-94000) {
  259. return $iif($numtok(%mbid,46) == 1,$calc(%mbid + %pbid),0)
  260. }
  261. else if ($right(%mbid,1) == k) {
  262. var %kbid $left(%mbid,-1)
  263. if (%kbid isnum 3-94) {
  264. return $iif($numtok($calc(%kbid * 1000),46) == 1,$calc(%kbid * 1000 + %pbid),0)
  265. }
  266. }
  267. return 0
  268. }
  269.  
  270. alias processplusbid {
  271. if ($left($1,1) == +) {
  272. return 0
  273. }
  274. else {
  275. var %pbid 0
  276. var %mbid $1
  277. }
  278. if (%mbid isnum 0.5-94) {
  279. return $iif($numtok($calc(%mbid * 1000),46) == 1,$calc(%mbid * 1000 + %pbid),0)
  280. }
  281. else if (%mbid isnum 500-94000) {
  282. return $iif($numtok(%mbid,46) == 1,$calc(%mbid + %pbid),0)
  283. }
  284. else if ($right(%mbid,1) == k) {
  285. var %kbid $left(%mbid,-1)
  286. if (%kbid isnum 0.5-94) {
  287. return $iif($numtok($calc(%kbid * 1000),46) == 1,$calc(%kbid * 1000 + %pbid),0)
  288. }
  289. }
  290. return 0
  291. }
  292.  
  293. alias getbidderteam {
  294. var %i 1
  295. while (%i <= 10) {
  296. if ($findtok($gettok(%spl.bidders,%i,32),$1,1,44)) {
  297. return $gettok(%spl.teams,%i,32)
  298. }
  299. inc %i
  300. }
  301. }
  302.  
  303. alias getnumplayers {
  304. return $calc($numtok($gettok(%spl.players,$getteam($1),32),44) - 1)
  305. }
  306.  
  307. alias getmaxbid {
  308. return $calc($getcredits($1) - ($iif($calc(13 - $getnumplayers($1)) >= 0,$calc(13 - $getnumplayers($1)),0) * 3000))
  309. }
  310.  
  311. alias getplayerdata {
  312. var %metagames ORAS_OU ORAS_UBERS ORAS_UU ORAS_RU ORAS_NU DOUBLES BW2_OU DPP_OU ADV_OU GSC_OU RBY_OU
  313. var %i 1
  314. var %data $read(spl.txt,s,$1)
  315. while (%i <= 11) {
  316. if (y isin $gettok(%data,%i,58)) {
  317. var %mplayed %mplayed $replace($gettok(%metagames,%i,32),_,$chr(32)) /
  318. }
  319. inc %i
  320. }
  321. var %mplayed $deltok(%mplayed,$numtok(%mplayed,32),32)
  322. return  $+ $replace($1,\,$chr(32)) is up for auction. Metagames: %mplayed
  323. }
  324.  
  325. alias lastten {
  326. .timerfive off
  327. .timerten off
  328. set %spl.10 1
  329. .timerten 1 10 endbidding
  330. .timerfive 1 5 msg %spl.chan  $+ %colour $+ 5 seconds remaining.
  331. }
  332.  
  333. alias endbidding {
  334. msg %spl.chan  $+ %colour $+ SOLD: $replace(%spl.nominated,\,$chr(32)) to $getfullname(%spl.highbidteam) for %spl.highbid $+ .
  335. set %spl.credits $puttok(%spl.credits,$calc($getcredits(%spl.highbidteam) - %spl.highbid),$getteam(%spl.highbidteam),32)
  336. set %spl.players $puttok(%spl.players,$addtok($gettok(%spl.players,$getteam(%spl.highbidteam),32),$replace(%spl.nominated,$chr(32),\),44),$getteam(%spl.highbidteam),32)
  337. set %spl.active 3
  338. set %spl.bids 0 0 0 0 0 0 0 0 0 0
  339. unset %spl.10
  340. set %spl.bought %spl.bought $+ : $+ %spl.nominated
  341. set %spl.prices %spl.prices $+ : $+ %spl.highbid
  342. set %spl.crspndteam %spl.crspndteam $+ : $+ %spl.highbidteam
  343. if ($getcredits(%spl.highbidteam) < 3000) {
  344. set %spl.skip $puttok(%spl.skip,0,$getteam(%spl.highbidteam),32)
  345. }
  346. .timercont 1 8 nextbidding
  347. }
  348.  
  349. alias nextbidding {
  350. var %i 1
  351. while (%i <= $numtok(%spl.teams,32)) {
  352. msg %spl.chan $getfullname($gettok(%spl.teams,%i,32)) Credits: $getcredits($gettok(%spl.teams,%i,32))  $+ $chr(124) Players: $getplayers($gettok(%spl.teams,%i,32))
  353. inc %i
  354. }
  355. msg %spl.chan $getfullname($getnext) up to nominate. Bidders: $getbidders($getcurrteam)
  356. set %spl.active 1
  357. }
  358.  
  359. alias endauction {
  360. msg %spl.chan  $+ %colour $+ The auction has officially ended.
  361. turntimersoff
  362. outputtofile
  363. }
  364.  
  365. alias turntimersoff {
  366. .timercont off
  367. .timerten off
  368. .timerfive off
  369. .timerinitial off
  370. }
  371.  
  372. alias outputtofile {
  373. write splrecord.txt -----
  374. write splrecord.txt -----
  375. write splrecord.txt -----
  376. write splrecord.txt -----
  377. write splrecord.txt -----
  378. write splrecord.txt Log for auction that concluded at $fulldate in %spl.chan
  379. var %i 1
  380. var %num $numtok(%spl.bought,58)
  381. while (%i <= %num) {
  382. write splrecord.txt $replace($gettok(%spl.bought,%i,58),\,$chr(32)) $+ : $gettok(%spl.prices,%i,58) ( $+ $strip($getfullname($gettok(%spl.crspndteam,%i,58))) $+ )
  383. inc %i
  384. }
  385. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement