Advertisement
Guest User

UPLBOT

a guest
Apr 20th, 2013
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.97 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) < 8) {
  8. msg $chan  $+ %colour $+ Team must have purchased 8 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(ftime.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(ftime.txt,$readn),1,32),$chr(32),\))
  22. set %spl.nominated $gettok($read(ftime.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) == *!*@Dont.get.burned) || ($address($nick,2) == *!*@last.hope) || ($address($nick,2) == *!*@uld.be.the.one)) {
  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 added to $getfullname($2) $+ .
  81. }
  82. if (($1 == !addretainer) && ($findtok(%spl.teams,$2,1,32)) && ($3 isnum) && ($4-)) {
  83. if ($read(ftime.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 dwo bcb sps sds tkk hah psk dfd
  134. set %spl.credits 75000 75000 75000 75000 75000 75000 75000 75000
  135. set %spl.bidders . . . . . . . .
  136. set %spl.players ^ ^ ^ ^ ^ ^ ^ ^
  137. set %spl.bids 0 0 0 0 0 0 0 0
  138. set %spl.skip 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 == dwo) { return 07The Distortion World Origins $+ %colour }
  181. if ($1 == bcb) { return 05The Black City Blazikens $+ %colour }
  182. if ($1 == sps) { return 03The Spear Pillar Skymins $+ %colour }
  183. if ($1 == sds) { return 06The Soul Dew Strongs $+ %colour }
  184. if ($1 == tkk) { return 12The .Krazy Kyogres $+ %colour }
  185. if ($1 == hah) { return 04The Hazy Ho-Ohs $+ %colour }
  186. if ($1 == psk) { return 13The Psycho Killers $+ %colour }
  187. if ($1 == dfd) { return 09The Defiant Durians $+ %colour }
  188. }
  189.  
  190. alias getbidders {
  191. return $replace($gettok(%spl.bidders,$getteam($1),32),. $+ $chr(44),$chr(32),.,$chr(32),$chr(44),$chr(32) / $chr(32))
  192. }
  193. alias getcredits {
  194. return $gettok(%spl.credits,$getteam($1),32)
  195. }
  196. alias getplayers {
  197. return $replace($gettok(%spl.players,$getteam($1),32),\,$chr(32),^ $+ $chr(44),$chr(32),^,$chr(32),$chr(44),$chr(32) / $chr(32))
  198. }
  199. alias getcurrteam {
  200. return $gettok(%spl.teams,%spl.currbid,32)
  201. }
  202.  
  203. alias getnext {
  204. set %spl.currbid $calc(%spl.currbid + %spl.currdir)
  205. if (%spl.currbid == 9) {
  206. set %spl.currbid 8
  207. set %spl.currdir -1
  208. }
  209. else if (%spl.currbid == 0) {
  210. set %spl.currbid 1
  211. set %spl.currdir 1
  212. }
  213. var %count 0
  214. while ($gettok(%spl.skip,$getteam($getcurrteam),32) == 0) {
  215. set %spl.currbid $calc(%spl.currbid + %spl.currdir)
  216. if (%spl.currbid == 9) {
  217. set %spl.currbid 8
  218. set %spl.currdir -1
  219. }
  220. else if (%spl.currbid == 0) {
  221. set %spl.currbid 1
  222. set %spl.currdir 1
  223. }
  224. inc %count
  225. if (%count == 20) {
  226. endauction
  227. halt
  228. }
  229. }
  230. return $gettok(%spl.teams,%spl.currbid,32)
  231. }
  232.  
  233. alias isbidder {
  234. var %i 1
  235. while (%i <= 10) {
  236. if ($findtok($gettok(%spl.bidders,%i,32),$1,1,44)) {
  237. return $true
  238. }
  239. inc %i
  240. }
  241. return $false
  242. }
  243.  
  244. alias processbid {
  245. ; if ($left($1,1) == +) {
  246. ; var %pbid $right($1,-1)
  247. ; var %pbid $processplusbid(%pbid)
  248. ; if (%pbid == 0) {
  249. ; return 0
  250. ; }
  251. ; var %mbid %spl.highbid
  252. ; }
  253. ; else {
  254. var %pbid 0
  255. var %mbid $1
  256. ; }
  257. if (%mbid isnum 1-43) {
  258. return $iif($numtok($calc(%mbid * 1000),46) == 1,$calc(%mbid * 1000 + %pbid),0)
  259. }
  260. else if (%mbid isnum 1000-43000) {
  261. return $iif($numtok(%mbid,46) == 1,$calc(%mbid + %pbid),0)
  262. }
  263. else if ($right(%mbid,1) == k) {
  264. var %kbid $left(%mbid,-1)
  265. if (%kbid isnum 1-43) {
  266. return $iif($numtok($calc(%kbid * 1000),46) == 1,$calc(%kbid * 1000 + %pbid),0)
  267. }
  268. }
  269. return 0
  270. }
  271.  
  272. alias processplusbid {
  273. if ($left($1,1) == +) {
  274. return 0
  275. }
  276. else {
  277. var %pbid 0
  278. var %mbid $1
  279. }
  280. if (%mbid isnum 0.5-43) {
  281. return $iif($numtok($calc(%mbid * 1000),46) == 1,$calc(%mbid * 1000 + %pbid),0)
  282. }
  283. else if (%mbid isnum 500-43000) {
  284. return $iif($numtok(%mbid,46) == 1,$calc(%mbid + %pbid),0)
  285. }
  286. else if ($right(%mbid,1) == k) {
  287. var %kbid $left(%mbid,-1)
  288. if (%kbid isnum 0.5-43) {
  289. return $iif($numtok($calc(%kbid * 1000),46) == 1,$calc(%kbid * 1000 + %pbid),0)
  290. }
  291. }
  292. return 0
  293. }
  294.  
  295. alias getbidderteam {
  296. var %i 1
  297. while (%i <= 10) {
  298. if ($findtok($gettok(%spl.bidders,%i,32),$1,1,44)) {
  299. return $gettok(%spl.teams,%i,32)
  300. }
  301. inc %i
  302. }
  303. }
  304.  
  305. alias getnumplayers {
  306. return $calc($numtok($gettok(%spl.players,$getteam($1),32),44) - 1)
  307. }
  308.  
  309. alias getmaxbid {
  310. return $calc($getcredits($1) - ($iif($calc(7 - $getnumplayers($1)) >= 0,$calc(7 - $getnumplayers($1)),0) * 1000))
  311. }
  312.  
  313. alias getplayerdata {
  314. var %metagames BW2 DPP_Pre-Arceus ADV
  315. var %i 1
  316. var %data $read(ftime.txt,s,$1)
  317. while (%i <= 6) {
  318. if (y isin $gettok(%data,%i,58)) {
  319. var %mplayed %mplayed $replace($gettok(%metagames,%i,32),_,$chr(32)) /
  320. }
  321. inc %i
  322. }
  323. var %mplayed $deltok(%mplayed,$numtok(%mplayed,32),32)
  324. return  $+ $replace($1,\,$chr(32)) is up for auction. Metagames: %mplayed
  325. }
  326.  
  327. alias lastten {
  328. .timerfive off
  329. .timerten off
  330. set %spl.10 1
  331. .timerten 1 15 endbidding
  332. .timerfive 1 10 msg %spl.chan  $+ %colour $+ 5 seconds remaining.
  333. }
  334.  
  335. alias endbidding {
  336. msg %spl.chan  $+ %colour $+ SOLD: $replace(%spl.nominated,\,$chr(32)) to $getfullname(%spl.highbidteam) for %spl.highbid $+ .
  337. set %spl.credits $puttok(%spl.credits,$calc($getcredits(%spl.highbidteam) - %spl.highbid),$getteam(%spl.highbidteam),32)
  338. set %spl.players $puttok(%spl.players,$addtok($gettok(%spl.players,$getteam(%spl.highbidteam),32),$replace(%spl.nominated,$chr(32),\),44),$getteam(%spl.highbidteam),32)
  339. set %spl.active 3
  340. set %spl.bids 0 0 0 0 0 0
  341. unset %spl.10
  342. set %spl.bought %spl.bought $+ : $+ %spl.nominated
  343. set %spl.prices %spl.prices $+ : $+ %spl.highbid
  344. set %spl.crspndteam %spl.crspndteam $+ : $+ %spl.highbidteam
  345. if ($getcredits(%spl.highbidteam) < 1000) {
  346. set %spl.skip $puttok(%spl.skip,0,$getteam(%spl.highbidteam),32)
  347. }
  348. .timercont 1 8 nextbidding
  349. }
  350.  
  351. alias nextbidding {
  352. var %i 1
  353. while (%i <= $numtok(%spl.teams,32)) {
  354. 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))
  355. inc %i
  356. }
  357. msg %spl.chan $getfullname($getnext) up to nominate. Bidders: $getbidders($getcurrteam)
  358. set %spl.active 1
  359. }
  360.  
  361. alias endauction {
  362. msg %spl.chan  $+ %colour $+ The auction has officially ended.
  363. turntimersoff
  364. outputtofile
  365. }
  366.  
  367. alias turntimersoff {
  368. .timercont off
  369. .timerten off
  370. .timerfive off
  371. .timerinitial off
  372. }
  373.  
  374. alias outputtofile {
  375. write ftimerecord.txt -----
  376. write ftimerecord.txt -----
  377. write ftimerecord.txt -----
  378. write ftimerecord.txt -----
  379. write ftimerecord.txt -----
  380. write ftimerecord.txt Log for auction that concluded at $fulldate in %spl.chan
  381. var %i 1
  382. var %num $numtok(%spl.bought,58)
  383. while (%i <= %num) {
  384. write ftimerecord.txt $replace($gettok(%spl.bought,%i,58),\,$chr(32)) $+ : $gettok(%spl.prices,%i,58) ( $+ $strip($getfullname($gettok(%spl.crspndteam,%i,58))) $+ )
  385. inc %i
  386. }
  387. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement