Guest User

Untitled

a guest
Aug 30th, 2018
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 7.98 KB | None | 0 0
  1. ## Startrek stuff plugin for bMotion
  2. #
  3. # $Id: complex_startrek.tcl 825 2007-07-19 22:43:25Z james $
  4. #
  5. # vim: fdm=indent fdn=1
  6.  
  7. ###############################################################################
  8. # This is a bMotion plugin
  9. # Copyright (C) James Michael Seward 2000-2002
  10. #
  11. # This program is covered by the GPL, please refer the to LICENCE file in the
  12. # distribution; further information can be found in the headers of the scripts
  13. # in the modules directory.
  14. ###############################################################################
  15.  
  16. bMotion_plugin_add_complex "st-cloak" "^%botnicks:?,? cloak$" 100 "bMotion_plugin_complex_startrek_cloak" "en"
  17. bMotion_plugin_add_complex "st-decloak" "^%botnicks:?,? decloak$" 100 "bMotion_plugin_complex_startrek_decloak" "en"
  18. bMotion_plugin_add_complex "st-fire" "^%botnicks:?,? fire " 100 "bMotion_plugin_complex_startrek_fire" "en"
  19. bMotion_plugin_add_complex "st-courtmartial" "^%botnicks:?,? yiffmartial " 100 "bMotion_plugin_complex_startrek_courtmartial" "en"
  20.  
  21. #cloak
  22. proc bMotion_plugin_complex_startrek_cloak { nick host handle channel text } {
  23.   global bMotionInfo
  24.   if {$bMotionInfo(cloaked) == 1} {
  25.     bMotionDoAction $channel $nick "Already running cloaked, sir"
  26.     return 1
  27.   }
  28.   set bMotionInfo(cloaked) 1
  29.   bMotionDoAction $channel $nick "/shimmers and disappears from view..."
  30.   return 1
  31. }
  32.  
  33. #decloak
  34. proc bMotion_plugin_complex_startrek_decloak { nick host handle channel text } {
  35.   global bMotionInfo
  36.   if {$bMotionInfo(cloaked) == 0} {
  37.     bMotionDoAction $channel "" "Already decloaked, sir"
  38.     return 1
  39.   }
  40.   set bMotionInfo(cloaked) 0
  41.   bMotionDoAction $channel $nick "/shifts back into view"
  42.   return 1
  43. }
  44.  
  45. #fire
  46. proc bMotion_plugin_complex_startrek_fire { nick host handle channel text } {
  47.   global botnicks bMotionInfo
  48.   if [regexp -nocase "$botnicks:?,? fire (.+) at (.+)" $text pop frogs weapon target] {
  49.     set weapon [string tolower $weapon]
  50.     if {![regexp "(phasers|torpedoe?|photon|quantum|cheesecake|everything)" $weapon]} {
  51.       if {[string range $weapon [expr [string length $weapon] - 1] end] == "s"} {
  52.         bMotionDoAction $channel $nick "I haven't got any '$weapon' ... I think they %VAR{fellOffs}."
  53.       } else {
  54.         bMotionDoAction $channel $nick "I haven't got any '$weapon' ... I think it %VAR{fellOffs}."
  55.       }
  56.       return 1
  57.     }
  58.  
  59.     if [regexp -nocase $botnicks $target] {
  60.       bMotionDoAction $channel $nick "Don't be so silly. Sir."
  61.       return 1
  62.     }
  63.  
  64.     if {$bMotionInfo(cloaked) == 1} {
  65.       bMotionDoAction $channel "" "/swoops in on $target, decloaking on the way..."
  66.     } else {
  67.       bMotionDoAction $channel "" "/swoops in on $target"
  68.     }
  69.  
  70.     if {$weapon == "phasers"} {
  71.       global phaserFires
  72.       bMotionDoAction $channel $target "%VAR{phaserFires}"
  73.     }
  74.  
  75.     if [regexp "(torpedoe?s|photon|quantum)" $weapon] {
  76.       global torpedoFires
  77.       bMotionDoAction $channel $target "%VAR{torpedoFires}"
  78.     }
  79.  
  80.     if {$weapon == "everything"} {
  81.       global everythingFires
  82.       bMotionDoAction $channel $target "%VAR{everythingFires}"
  83.     }
  84.  
  85.     if {$bMotionInfo(cloaked) == 1} {
  86.       bMotionDoAction $channel "" "/recloaks"
  87.     }
  88.     return 1
  89.   }
  90. }
  91.  
  92. proc bMotion_plugin_complex_startrek_courtmartial { nick host handle channel text } {
  93.   global botnicks bMotionInfo
  94.   if [regexp -nocase "$botnicks:?,? yiffmartial (.+?)( with pies)?" $text pop frogs who banzai] {
  95.     if [regexp -nocase "\\m$botnicks\\M" $who] {
  96.       bMotionDoAction $channel "" "Duh."
  97.       return 1
  98.     }
  99.  
  100.     if {$banzai != ""} { set bMotionInfo(banzaiModeBrig) 1 } else { set bMotionInfo(banzaiModeBrig) 0 }
  101.  
  102.     if {$bMotionInfo(brig) != ""} {
  103.       bMotionDoAction $channel $nick "I'm sorry, I already have someone in the yiff-pit - please try again later, or empty the rug."
  104.             utimer [expr $bMotionInfo(brigDelay) + 10] bMotion_brig_flush
  105.       return 1
  106.     }
  107.  
  108.     if {![onchan $who $channel]} {
  109.       bMotionDoAction $channel "" "Who?"
  110.       puthelp "NOTICE $nick :Please specify the full nickname of someone in the channel (Couldn't find '$who')."
  111.       return 1
  112.     }
  113.  
  114.     set bMotionInfo(brig) "$who@$channel"
  115.     if {$bMotionInfo(banzaiModeBrig) == 1} {
  116.       bMotionDoAction $channel $who "%VAR{brigBanzais}"
  117.       bMotionDoAction $channel $who "Rules are simple. Simply decide if you think I'll find %% innocent."
  118.       set bMotionInfo(brigInnocent) [list]
  119.       set bMotionInfo(brigGuilty) [list]
  120.       bind pub - "!bet" bMotionVoteHandler
  121.       bMotionDoAction $channel $who "Place bets now! (\002!bet innocent\002 and \002!bet guilty\002, one bet per person)"
  122.     }
  123.     bMotionDoAction $channel $who "/throws %% in the yiff-pit to await the outcome..."
  124.     utimer $bMotionInfo(brigDelay) bMotionDoBrig
  125.     if {$bMotionInfo(banzaiModeBrig) == 1} {
  126.       utimer [expr $bMotionInfo(brigDelay) / 2 + 7] bMotionBanzaiBrigMidBet
  127.     }
  128.     return 1
  129.   }
  130. }
  131.  
  132.  
  133. ### Supporting functions
  134. proc bMotionBanzaiBrigMidBet {} {
  135.   global bMotionInfo
  136.  
  137.   set brigInfo $bMotionInfo(brig)
  138.   if {$brigInfo == ""} { return 0 }
  139.   regexp -nocase "(.+)@(.+)" $brigInfo pop nick channel
  140.  
  141.   bMotionDoAction $channel "" "%VAR{banzaiMidBets}"
  142.   return 0
  143. }
  144.  
  145. proc bMotionDoBrig {} {
  146.   global bMotionInfo charges trekNouns punishments
  147.  
  148.   set brigInfo $bMotionInfo(brig)
  149.   if {$brigInfo == ""} { return 0 }
  150.   regexp -nocase "(.+)@(.+)" $brigInfo pop nick channel
  151.  
  152.   if {![onchan $nick $channel]} {
  153.     putlog "bMotion: Was trying to yiffmartial $nick on $channel, but they're not there no more :c"
  154.     set bMotionInfo(brig) ""
  155.     return 0
  156.   }
  157.  
  158.   if {$bMotionInfo(banzaiModeBrig) == 1} {
  159.     bMotionDoAction $channel "" "Betting ends!"
  160.   }
  161.  
  162.   bMotionDoAction $channel $nick "%%, you are charged with %VAR{charges}, and %VAR{charges}"
  163.   set bMotionInfo(brig) ""
  164.  
  165.   set guilty [rand 2]
  166.   if {$guilty} {
  167.     bMotionDoAction $channel "" "You have been found guilty, and are sentenced to %VAR{punishments}. Yiff in hell, furfag!"
  168.     if {$bMotionInfo(banzaiModeBrig) == 1} {
  169.       if {[llength $bMotionInfo(brigGuilty)] > 0} {
  170.         bMotionDoAction $channel $bMotionInfo(brigGuilty) "Congropulations go to big winner(s), who are %%. Well done! Riches and extra scritches are all yours!"
  171.       }
  172.     }
  173.   } else {
  174.     bMotionDoAction $channel "" "You have been found innocent, have a nice day."
  175.     if {$bMotionInfo(banzaiModeBrig) == 1} {
  176.       if {[llength $bMotionInfo(brigInnocent)] > 0} {
  177.         bMotionDoAction $channel $bMotionInfo(brigInnocent) "Congropulations go to big winner(s), who are %%. Go you creatures! Cucumbers and extra pets are all yours!"
  178.       }
  179.     }
  180.   }
  181.  
  182.   if {$bMotionInfo(banzaiModeBrig) == 1} {
  183.     set bMotionInfo(banzaiModeBrig) 0
  184.   }
  185.   return 0
  186. }
  187.  
  188. # apparently we forgot someone was in the brig
  189. proc bMotion_brig_flush { } {
  190.     global bMotionInfo
  191.  
  192.     if {$bMotionInfo(brig) == ""} {
  193.         return
  194.     }
  195.  
  196.     bMotion_putloglev d * "Flushing brig..."
  197.  
  198.   regexp -nocase "(.+)@(.+)" $bMotionInfo(brig) pop nick channel
  199.     bMotionDoAction $channel $nick "Whoops... I forgot %% was in the brig%|/sweeps corpse under the rug"
  200.     set bMotionInfo(brig) ""
  201. }
  202.  
  203. proc bMotionVoteHandler {nick host handle channel text} {
  204.   global bMotionInfo
  205.   set brigInfo $bMotionInfo(brig)
  206.   if {$brigInfo == ""} {
  207.     #unbind
  208.     putlog "bMotion: Oops, need to unbind votes"
  209.     unbind pubm - "!bet" bMotionVoteHandler
  210.     return 0
  211.   }
  212.  
  213.   if {[lsearch $bMotionInfo(brigInnocent) $nick] != -1} {
  214.     puthelp "NOTICE $nick :You have already bet."
  215.     return 0
  216.   }
  217.  
  218.   if {[lsearch $bMotionInfo(brigGuilty) $nick] != -1} {
  219.     puthelp "NOTICE $nick :You have already bet."
  220.     return 0
  221.   }
  222.  
  223.   if [string match -nocase "innocent" $text] {
  224.     lappend bMotionInfo(brigInnocent) $nick
  225.     putlog "bMotion: Accepted innocent bet from $nick"
  226.     return 0
  227.   }
  228.  
  229.   if [string match -nocase "guilty" $text] {
  230.     lappend bMotionInfo(brigGuilty) $nick
  231.     putlog "bMotion: Accepted guilty bet from $nick"
  232.     return 0
  233.   }
  234.   puthelp "NOTICE $nick: Syntax: !bet <guilty|innocent>"
  235. }
Add Comment
Please, Sign In to add comment