Advertisement
Guest User

amssm code for skeptical

a guest
Jan 21st, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 27.76 KB | None | 0 0
  1. ; [AMS] :: Anchor Map Sword (AMSsm) -AKA- Rock Paper Scissors shark mruno
  2. ; Sat Jan 21 06:25:45 2017 EST
  3.  
  4. on :load: { ams-reset }
  5. on :start: { ams-reset }
  6. on :exit: { unset %ams-* }
  7.  
  8. alias ams-reset {
  9.   unset %ams-*
  10.   set %ams-status idle
  11.   .timerams.* off
  12. }
  13. alias amsl { return $lower($1-) }
  14. alias amsm { epirate.public.msg $1- }
  15. alias amsb { return  $+ $1- $+  }
  16. alias ams-logo { return $amsb([AMSSM]) $+  }
  17.  
  18. alias EPirate.AMS.Installed return $true
  19.  
  20. ;This ON TEXT is located in the PIRATES EVENTS FILE
  21. ;on *:text:!p*:#: {
  22. ;  if ($chr(37) isin $1-) || ($chr(36) isin $1-) || ($chan != $EPirate.Chan) || ($EPirate.network !isin $network) return
  23. ;  if ($1 == !p) || ($1 == !pirate) || ($1 == !pirates) {
  24. ;    if $2 == ams epirate.ams $nick $2-
  25. ;  }
  26. ;}
  27.  
  28. on *:text:!p*:?: {
  29.   ;privmsg protection
  30.   if ($chr(37) isin $1-) || ($chr(36) isin $1-) || ($EPirate.network !isin $network) return
  31.  
  32.   if ($1 == !p) || ($1 == !pirate) || ($1 == !pirates) {
  33.     if $2 == ams || $2 == amssm {
  34.  
  35.       ;if (!%ams-status) ams-reset
  36.  
  37.       if $3 {
  38.         var %start 0
  39.         ;%start is used to determine if game progress to finish
  40.         if %ams-status == inprogress {
  41.           .timer 1 0 set -u90 %ams-status pending
  42.           inc %start
  43.         }
  44.         elseif (%ams-status == pending) {
  45.           if ($nick == %ams-p1) {
  46.             ;lets player1 choose selection before player2 accepts
  47.             inc %start
  48.           }
  49.           elseif ($nick == %ams-p2) {
  50.             ;deducts wagers from players
  51.             if (%ams-p2 != $epirate.bot) epirate.pay %ams-p2 - $+ %ams-wager games
  52.             epirate.pay %ams-p1 - $+ %ams-wager games
  53.  
  54.             ;lets player2 skip the "!P AMS Accept" trigger
  55.             inc %start
  56.           }
  57.         }
  58.         else { .timerepirate.ams. $+ $nick 1 3 epirate.personal.msg $nick Thar not be a game bein' played! Start one by typing !Pirates AMS in $epirate.chan | return }
  59.         if (%start)  {
  60.           if %ams-p1 ison $epirate.chan && %ams-p1 ison $epirate.chan {
  61.             if $nick == %ams-p1 {
  62.               if $amsl($3) == $amsl(Anchor) || $amsl($3) == $amsl(Map) || $amsl($3) == $amsl(Sword) || $amsl($3) == $amsl(Shark) || $amsl($3) == $amsl(Mruno) {
  63.                 set %ams-p1-answer $remove($amsl($3),<,>)
  64.                 hinc EPirate.stats $+(%ams-p1,.AMS.Plays)
  65.                 hinc EPirate.stats $+(%ams-p1,.AMS.Selection.,%ams-p1-answer)
  66.                 if (!$epirate.reduce.spam) epirate.public.msg $ams-logo $amsb(%ams-p1) has given $epirate.hisorher($nick) answer...
  67.                 if %ams-p2-answer {
  68.                   if %ams-p1-answer == anchor {
  69.                     if %ams-p2-answer == anchor { set %ams-winner Cat }
  70.                     if %ams-p2-answer == map { set %ams-winner %ams-p2 }
  71.                     if %ams-p2-answer == sword { set %ams-winner %ams-p1 }
  72.                     if %ams-p2-answer == shark { set %ams-winner %ams-p1 }
  73.                     if %ams-p2-answer == mruno { set %ams-winner %ams-p2 }
  74.                     ams-announcewinner
  75.                     halt
  76.                   }
  77.                   if %ams-p1-answer == map {
  78.                     if %ams-p2-answer == anchor { set %ams-winner %ams-p1 }
  79.                     if %ams-p2-answer == map { set %ams-winner Cat }
  80.                     if %ams-p2-answer == sword { set %ams-winner %ams-p2 }
  81.                     if %ams-p2-answer == shark { set %ams-winner %ams-p2 }
  82.                     if %ams-p2-answer == mruno { set %ams-winner %ams-p1 }
  83.                     ams-announcewinner
  84.                     halt
  85.                   }
  86.                   if %ams-p1-answer == shark {
  87.                     if %ams-p2-answer == anchor { set %ams-winner %ams-p2 }
  88.                     if %ams-p2-answer == map { set %ams-winner %ams-p1 }
  89.                     if %ams-p2-answer == sword { set %ams-winner %ams-p2 }
  90.                     if %ams-p2-answer == shark { set %ams-winner Cat }
  91.                     if %ams-p2-answer == mruno { set %ams-winner %ams-p1 }
  92.                     ams-announcewinner
  93.                     halt
  94.                   }
  95.                   if %ams-p1-answer == sword {
  96.                     if %ams-p2-answer == anchor { set %ams-winner %ams-p2 }
  97.                     if %ams-p2-answer == map { set %ams-winner %ams-p1 }
  98.                     if %ams-p2-answer == sword { set %ams-winner Cat }
  99.                     if %ams-p2-answer == shark { set %ams-winner %ams-p1 }
  100.                     if %ams-p2-answer == mruno { set %ams-winner %ams-p2 }
  101.                     ams-announcewinner
  102.                     return
  103.                   }
  104.                   if %ams-p1-answer == mruno {
  105.                     if %ams-p2-answer == anchor { set %ams-winner %ams-p1 }
  106.                     if %ams-p2-answer == map { set %ams-winner %ams-p2 }
  107.                     if %ams-p2-answer == sword { set %ams-winner %ams-p1 }
  108.                     if %ams-p2-answer == shark { set %ams-winner %ams-p2 }
  109.                     if %ams-p2-answer == mruno { set %ams-winner Cat }
  110.                     ams-announcewinner
  111.                     halt
  112.                   }
  113.                 }
  114.                 elseif !%ams-p2-answer { epirate.notice %ams-p1 $ams-logo Waitin' fer $+($amsb(%ams-p2),'s) answer... }
  115.               }
  116.               else epirate.personal.msg $nick $ams-logo Choose one: Anchor, Map, Sword, Shark or Mruno. Use: /msg $me !Pirates AMSSM <selection> - Ex: /msg $me !Pirates AMSSM Sword
  117.             }
  118.             if $nick == %ams-p2 {
  119.               if $amsl($3) == $amsl(Anchor) || $amsl($3) == $amsl(Map) || $amsl($3) == $amsl(Sword) || $amsl($3) == $amsl(Shark) || $amsl($3) == $amsl(Mruno) {
  120.                 set %ams-p2-answer $amsl($3)
  121.                 if (!$epirate.reduce.spam) epirate.public.msg $ams-logo $amsb(%ams-p2) has given $epirate.hisorher($nick) answer...
  122.                 if %ams-p1-answer {
  123.                   if %ams-p2-answer == anchor {
  124.                     if %ams-p1-answer == anchor { set %ams-winner Cat }
  125.                     if %ams-p1-answer == map { set %ams-winner %ams-p1 }
  126.                     if %ams-p1-answer == sword { set %ams-winner %ams-p2 }
  127.                     if %ams-p1-answer == shark { set %ams-winner %ams-p2 }
  128.                     if %ams-p1-answer == mruno { set %ams-winner %ams-p1 }
  129.                     ams-announcewinner
  130.                     halt
  131.                   }
  132.                   if %ams-p2-answer == map {
  133.                     if %ams-p1-answer == anchor { set %ams-winner %ams-p2 }
  134.                     if %ams-p1-answer == map { set %ams-winner Cat }
  135.                     if %ams-p1-answer == sword { set %ams-winner %ams-p1 }
  136.                     if %ams-p1-answer == shark { set %ams-winner %ams-p1 }
  137.                     if %ams-p1-answer == mruno { set %ams-winner %ams-p2 }
  138.                     ams-announcewinner
  139.                     halt
  140.                   }
  141.                   if %ams-p2-answer == sword {
  142.                     if %ams-p1-answer == anchor { set %ams-winner %ams-p1 }
  143.                     if %ams-p1-answer == map { set %ams-winner %ams-p2 }
  144.                     if %ams-p1-answer == sword { set %ams-winner Cat }
  145.                     if %ams-p1-answer == shark { set %ams-winner %ams-p2 }
  146.                     if %ams-p1-answer == mruno { set %ams-winner %ams-p1 }
  147.                     ams-announcewinner
  148.                     halt
  149.                   }
  150.                   if %ams-p2-answer == shark {
  151.                     if %ams-p1-answer == anchor { set %ams-winner %ams-p1 }
  152.                     if %ams-p1-answer == map { set %ams-winner %ams-p2 }
  153.                     if %ams-p1-answer == sword { set %ams-winner %ams-p1 }
  154.                     if %ams-p1-answer == shark { set %ams-winner Cat }
  155.                     if %ams-p1-answer == mruno { set %ams-winner %ams-p2 }
  156.                     ams-announcewinner
  157.                     halt
  158.                   }
  159.                   if %ams-p2-answer == mruno {
  160.                     if %ams-p1-answer == anchor { set %ams-winner %ams-p2 }
  161.                     if %ams-p1-answer == map { set %ams-winner %ams-p1 }
  162.                     if %ams-p1-answer == sword { set %ams-winner %ams-p2 }
  163.                     if %ams-p1-answer == shark { set %ams-winner %ams-p1 }
  164.                     if %ams-p1-answer == mruno { set %ams-winner Cat }
  165.                     ams-announcewinner
  166.                     halt
  167.                   }
  168.                 }
  169.                 elseif !%ams-p1-answer {
  170.                   epirate.notice %ams-p2 Waitin' fer $+($amsb(%ams-p1),'s) answer...
  171.                   epirate.notice %ams-p1 It be yer turn! Anchor, Map, Sword, Shark, or Mruno. Use: /msg $me !Pirates AMSSM <selection> - Ex: /msg $me !Pirates AMSSM Map
  172.                 }
  173.               }
  174.               else epirate.personal.msg $nick $ams-logo Choose one: Anchor, Map, Sword, Shark or Mruno. Use: /msg $me !Pirates AMSSM <selection> - Ex: /msg $me !Pirates AMSSM Map
  175.             }
  176.           }
  177.         }
  178.       }
  179.     }
  180.   }
  181. }
  182. alias EPirate.Bot.Game.AMS.Start {
  183.   ;/EPirate.Bot.Game.AMS.Start <player> - bot start a game of AMS with the player
  184.   if (!$epirate.bot) || ($EPirate.Special.Event) || ($timer(EPirate.BlackJack.Start1)) return
  185.   if (%ams-status) && (%ams-status != idle) return
  186.   var %player $1
  187.   if ($epirate.isuser(%player)) {
  188.     var %wager $epirate.player.percentage(%player,$calc($rand(5,50) / 100))
  189.     if (%wager isnum) EPirate.AMS.Start $epirate.bot AMS %player %wager
  190.   }
  191. }
  192. alias epirate.ams.start {
  193.   ;/epirate.ams.start <player1> AMS <player2> <wager> - starts up a game of AMS
  194.   ;flood checks
  195.   if ($timer(EPirate.Flood).secs) { EPirate.Flood.Check $1 | return }
  196.   else .timerEPirate.Flood -m 1 1000 noop
  197.  
  198.   ;player flood check
  199.   EPirate.Flood.Check $1
  200.  
  201.   if ($3 == stats) {
  202.     var %player $iif($4,$4,$1)
  203.     var %games $hget(EPirate.stats,$+(%player,.AMS.Plays)), %notice
  204.     if (%games) {
  205.       epirate.notice $1 %player has played AMS %games times n' has the followin' tendencies: Anchor $epirate.percentage($hget(EPirate.stats,$+(%player,.AMS.Selection.Anchor)),%games) $+ $chr(37) Map $epirate.percentage($hget(EPirate.stats,$+(%player,.AMS.Selection.Map)),%games) $+ $chr(37) Sword $epirate.percentage($hget(EPirate.stats,$+(%player,.AMS.Selection.Sword)),%games) $+ $chr(37) Shark $epirate.percentage($hget(EPirate.stats,$+(%player,.AMS.Selection.Shark)),%games) $+ $chr(37) Mruno $epirate.percentage($hget(EPirate.stats,$+(%player,.AMS.Selection.Mruno)),%games) $+ $chr(37)
  206.     }
  207.     else epirate.notice $1 %player has never played AMS!
  208.     return
  209.   }
  210.  
  211.   if (!%ams-status) ams-reset
  212.  
  213.   ;checks if player is specified and onboard
  214.   if (!$3) ams-help $1
  215.   if $3 {
  216.     ;ams cooldown
  217.     if ($timer(EPirate.AMS.Cooldown)) { epirate.notice $1 Too soon! | return }
  218.  
  219.     ;too many games played today check
  220.     ;if ($hget(epirate.daily,Games.Played. $+ $1) >= $EPirate.Max.Games.Per.Day) { epirate.notice $1 Ye played enough games today! New day starts in $EPirate.Time.Until.New.Day | return }
  221.     if ($hget(EPirate.Expenses.Today,$1 $+ .games) > $epirate.player.percentage($1,$calc($EPirate.Max.Percentage.Bonus * 2))) { epirate.notice $1 Ye 'ave earned too much from games today! New day starts in $EPirate.Time.Until.New.Day | return }
  222.  
  223.     if $3 !ison $epirate.chan && $3 != accept && $3 != decline && $3 != help && $3 != stats { epirate.notice $1 $ams-logo The format be !Pirates AMS <pirate> <wager>  - Use !Pirates AMS help fer Commands. | return }
  224.  
  225.     if (!%ams-status) || (%ams-status == idle) {
  226.       if ($1 == $3) { epirate.notice $1 Stop tryin' to play wit' yeself n' play wit' others! | return }
  227.       if ($3 ison $epirate.chan) && ($EPirate.Onboard($3)) || ($3 == $epirate.bot) {
  228.  
  229.         ;too many games played today check
  230.         ;if ($hget(epirate.daily,Games.Played. $+ $3) >= $EPirate.Max.Games.Per.Day) { epirate.notice $1 $3 played enough games today! New day starts in $EPirate.Time.Until.New.Day | return }
  231.  
  232.         set %ams-p1 $1
  233.         ;$2 is AMS
  234.         set %ams-p2 $3
  235.         if (%ams-status) || (%ams-status == idle) {
  236.  
  237.           if (%ams-p1 == $epirate.bot) {
  238.             var %r $dll(dicelib.dll,roll,d5)
  239.             if (%r == 1) set %ams-p1-answer $amsl(Anchor)
  240.             elseif (%r == 2) set %ams-p1-answer $amsl(Map)
  241.             elseif (%r == 3) set %ams-p1-answer $amsl(Shark)
  242.             elseif (%r == 4) set %ams-p1-answer $amsl(Mruno)
  243.             elseif (%r == 5) set %ams-p1-answer $amsl(Sword)
  244.             hinc EPirate.stats $+(%ams-p1,.AMS.Plays)
  245.             hinc EPirate.stats $+(%ams-p1,.AMS.Selection.,%ams-p1-answer)
  246.           }
  247.  
  248.           ;player needs to buy a bribe to play more games
  249.           if ($hget(EPirate.Games,played. $+ %ams-p1) >= $Epirate.Games.Before.Bribe.Needed) {
  250.             EPirate.Notice %ams-p1 Th' Cap'n will catch ye if ye keep playin' those games 'n nah scrubbin' th' poop deck. Play later, ye blaggard!
  251.             EPirate.Notice %ams-p1 I may be able t' help ye play some more games. Type !Pirates store bribe
  252.             return
  253.           }
  254.  
  255.           ;wager checks
  256.           var %wager 0
  257.           ;if ($4 == max) set %wager $epirate.player.percentage(%ams-p1,$EPirate.Max.Percentage.Wager)
  258.           if ($4 == max) set %wager $epirate.determine.max.wager(%ams-p1,%ams-p2)
  259.           else set %wager $EPirate.Convert.Wager($4)
  260.           if ($4) && (%wager isnum) && (%wager >= 1) set %ams-wager %wager
  261.           else { epirate.notice $1 How much do ye want to wager? !Pirates AMS <pirate> <wager> | return }
  262.           if (%ams-p1 != $epirate.bot) && (%wager > $epirate.player.percentage(%ams-p1,$EPirate.Max.Percentage.Wager)) { EPirate.Notice $1 The buy-in be too rich fer ye blood n' ye won't have drinkin' money if ye lose! Try $EPirate.Round($v2) doubloons or less | return }
  263.  
  264.           ;bot playing game
  265.           if (%ams-p2 == $epirate.bot) {
  266.             var %r $dll(dicelib.dll,roll,d5)
  267.             if (%r == 1) set %ams-p2-answer $amsl(Anchor)
  268.             elseif (%r == 2) set %ams-p2-answer $amsl(Map)
  269.             elseif (%r == 3) set %ams-p2-answer $amsl(Shark)
  270.             elseif (%r == 4) set %ams-p2-answer $amsl(Mruno)
  271.             elseif (%r == 5) set %ams-p2-answer $amsl(Sword)
  272.             hinc EPirate.stats $+(%ams-p2,.AMS.Plays)
  273.             hinc EPirate.stats $+(%ams-p2,.AMS.Selection.,%ams-p2-answer)
  274.             set -u90 %ams-status inprogress
  275.             epirate.pay %ams-p1 - $+ %ams-wager games
  276.           }
  277.  
  278.           ;additional wager checks
  279.           if (%ams-p2 != $epirate.bot) && (%wager > $epirate.player.percentage(%ams-p2,$EPirate.Max.Percentage.Wager)) { EPirate.Notice $1 The wager be too much fer %ams-p2 $+ ! Try $EPirate.Round($v2) doubloons or less | return }
  280.           if (%ams-p2 != $epirate.bot) && (%wager > $hget(epirate.players.all,%ams-p2)) { EPirate.notice $1 Ye too poor to play tis game! | return }
  281.  
  282.           if (%wager < $epirate.player.percentage(%ams-p1,0.1)) EPirate.Achievement %ams-p1 Game.Low.Wager
  283.  
  284.           .timer 1 0 set -u90 %ams-status pending
  285.           epirate.public.msg $epirate.nick($1) $amsb($1) has challenged $amsb($3) to a game of $ams-logo $+ . (Anchor, Map, Sword, Shark, Mruno) -AKA- Rock, Paper, Scissors, Lizard, Spock.
  286.  
  287.           var %games $hget(EPirate.stats,$+(%ams-p1,.AMS.Plays)), %notice
  288.           if (%games) {
  289.             set %notice %ams-p1 has played AMS %games times n' has the followin' tendencies: Anchor $epirate.percentage($hget(EPirate.stats,$+(%ams-p1,.AMS.Selection.Anchor)),%games) $+ $chr(37) Map $epirate.percentage($hget(EPirate.stats,$+(%ams-p1,.AMS.Selection.Map)),%games) $+ $chr(37) Sword $epirate.percentage($hget(EPirate.stats,$+(%ams-p1,.AMS.Selection.Sword)),%games) $+ $chr(37) Shark $epirate.percentage($hget(EPirate.stats,$+(%ams-p1,.AMS.Selection.Shark)),%games) $+ $chr(37) Mruno $epirate.percentage($hget(EPirate.stats,$+(%ams-p1,.AMS.Selection.Mruno)),%games) $+ $chr(37)
  290.           }
  291.           else set %notice This be %ams-p2 $+ 's first time playin' AMSSM.
  292.  
  293.  
  294.           epirate.notice %ams-p2 %ams-p1 has challenged ye to AMS wit' a wager o' $epirate.round(%ams-wager) doubloons! Ye must accept or decline this challenge with either: $amsb(!Pirates AMS Accept) or $amsb(!Pirates AMS Decline)
  295.           epirate.notice %ams-p2 %notice
  296.  
  297.           var %games $hget(EPirate.stats,$+(%ams-p2,.AMS.Plays))
  298.           if (%games) {
  299.             epirate.notice %ams-p1 %ams-p2 has played AMS %games times n' has the followin' tendencies: Anchor $epirate.percentage($hget(EPirate.stats,$+(%ams-p2,.AMS.Selection.Anchor)),%games) $+ $chr(37) Map $epirate.percentage($hget(EPirate.stats,$+(%ams-p2,.AMS.Selection.Map)),%games) $+ $chr(37) Sword $epirate.percentage($hget(EPirate.stats,$+(%ams-p2,.AMS.Selection.Sword)),%games) $+ $chr(37) Shark $epirate.percentage($hget(EPirate.stats,$+(%ams-p1,.AMS.Selection.Shark)),%games) $+ $chr(37) Mruno $epirate.percentage($hget(EPirate.stats,$+(%ams-p1,.AMS.Selection.Mruno)),%games) $+ $chr(37)
  300.           }
  301.           else epirate.notice %ams-p1 This be %ams-p2 $+ 's first time playin' AMS.
  302.  
  303.           ;check if anything in pot from previous draw
  304.           if ($hget(epirate.games,AMS.pot)) set %ams-pot $ifmatch
  305.  
  306.           .timerams.cancel 1 90 ams-cancel
  307.           if (%ams-p2 == $epirate.bot) .timer 1 3 epirate.notice $1 $epirate.bot has made a selection... make yers! Anchor, Map, Sword, Shark or Mruno. Use: /msg $me !Pirates AMSSM <selection> - Ex: /msg $me !Pirates AMSSM Anchor
  308.           else epirate.notice $1 Waitin' $duration($timer(ams.cancel).secs) fer %ams-p2 to respond...
  309.           return
  310.         }
  311.         else { epirate.notice $1 A game already be in progress! | return }
  312.       }
  313.       else {
  314.         if ($3 == accept) || ($3 == decline) epirate.notice $1 Thar not be a game bein' played! Start one wit' !Pirates AMS
  315.         elseif ($3 == help) ams-help $1
  316.         else epirate.notice $1 $amsb($3) not be onboard!
  317.         return
  318.       }
  319.     }
  320.   }
  321.   if %ams-status == pending {
  322.     if ($hget(EPirate.Games,played. $+ %ams-p2) >= $Epirate.Games.Before.Bribe.Needed) {
  323.       ;player needs to buy a bribe to play more games
  324.       EPirate.Notice %ams-p1 Th' Cap'n caught %ams-p2 playin' games 'n be now scrubbin' th' poop deck. Try again later.
  325.       EPirate.Notice %ams-p2 I may be able t' help ye play some more games. Type !Pirates store bribe
  326.       return
  327.     }
  328.  
  329.     if $3 == accept {
  330.       .timerams.* off
  331.       set -u90 %ams-status inprogress
  332.       epirate.notice %ams-p1 %ams-p2 accepted ye challenge!
  333.       .timerams.noanswer 1 60 ams-cancel noanswer
  334.       if (!%ams-p1-answer) epirate.notice %ams-p1 Ye 'ave $duration($timer(ams.noanswer).secs) to tell me what ye playin' wit'! Anchor, Map, Sword, Shark or Mruno. Use: /msg $me !Pirates AMS <selection> - Ex: /msg $me !Pirates AMSSM Map
  335.       if (!%ams-p2-answer) epirate.notice %ams-p2 Ye 'ave $duration($timer(ams.noanswer).secs) to tell me what ye playin' wit'! Anchor, Map, Sword, Shark or Mruno. Use: /msg $me !Pirates AMS <selection> - Ex: /msg $me !Pirates AMSSM Anchor
  336.  
  337.       ;if no answer, wager still deducted
  338.       epirate.pay %ams-p2 - $+ %ams-wager games
  339.       if (%ams-p1 != $epirate.bot) epirate.pay %ams-p1 - $+ %ams-wager games
  340.       return
  341.     }
  342.     elseif $3 == decline {
  343.       if ($epirate.reduce.spam) epirate.notice %ams-p1 %ams-p2 declined ye challenge request!
  344.       else epirate.public.msg $epirate.nick(%ams-p2) %ams-p2 declined the challenge from %ams-p1 to play $ams-logo $+ .
  345.       ams-cancel decline
  346.       return
  347.     }
  348.     else {
  349.       if (%ams-p1 == $1) { epirate.notice $1 Waitin' on %ams-p2 to accept ye challenge! | return }
  350.       if (%ams-p2 == $1) { epirate.notice $1 Waitin' on ye to accept the challenge from %ams-p1 $+ !  !Pirates AMS Accept | return }
  351.       ;epirate.notice $1 $ams-logo game not in progress.
  352.     }
  353.   }
  354.   if $3 == help {
  355.     ams-help $1
  356.     return
  357.   }
  358.   else epirate.notice $1 AMS be %ams-status
  359. }
  360. alias ams-help {
  361.   if ($1) {
  362.     ;epirate.notice $1 $ams-Logo $asmb(Anchor, Map, Sword) - Just like Rock Paper Scissors, the same rules apply:
  363.     ;epirate.notice $1 $ams-logo Normal Rules Apply: $asmb(Anchor beats Sword, Map beats Anchor, and Sword beats Map)
  364.     ;epirate.notice $1 $ams-logo - $amsb(!p ams Challenge <pirate>) to Challenge a Pirate to a game o' $ams-logo
  365.     ;epirate.notice $1 $ams-logo - $amsb(!p ams accept) to accept a Challenge from another pirate.
  366.     ;epirate.notice $1 $ams-logo - $amsb(!p ams decline) to decline a Challenge from another pirate.
  367.     ;epirate.notice $1 $ams-logo - $amsb(!p ams stats <pirate>) to show a pirate's stats
  368.     ;epirate.notice $1 $ams-logo Once a game has been accepted, players must /msg $me !Pirates AMS Answer - Answers being: $amsb(Anchor, Map, Sword.) (Like Rock, Paper, Scissors.)
  369.  
  370.     epirate.notice $1 $ams-Logo $asmb(Anchor, Map, Sword, Shark, Mruno) - Just like Rock Paper Scissors Lizard Spock. The Exact Same Rules apply:
  371.     epirate.notice $1 $ams-logo Normal Rules Apply: $asmb(Sword cuts Map covers Anchor crushes Shark eats Mruno breaks Sword impales Shark rips through Map confuses Mruno is harder than an Anchor breaks Sword)
  372.     epirate.notice $1 $ams-logo - $amsb(!p amssm Challenge Nick) to Challenge Nick to a game of $ams-logo
  373.     epirate.notice $1 $ams-logo - $amsb(!p amssm accept) to accept a Challenge from another pirate.
  374.     epirate.notice $1 $ams-logo - $amsb(!p amssm decline) to decline a Challenge from another pirate.
  375.     epirate.notice $1 $ams-logo Once a game has been accepted, players must /msg $me !Pirates AMSSM Answer - Answers being: $amsb(Anchor, Map, Sword, Shark, Mruno.) (Like Rock, Paper, Scissors, Lizard, Spock.)
  376.     epirate.notice $1 Ex: /msg $me !Pirates AMSSM Anchor OR /msg $me !Pirates AMSSM Map OR /msg $me !Pirates AMSSM Sword  OR /msg $me !Pirates AMSSM Shark  OR /msg $me !Pirates AMSSM Mruno
  377.   }
  378. }
  379. alias beats {
  380.   var %a anchor.map.sword.shark.mruno
  381.   var %b Cuts.Covers.Crushes.Eats.Breaks.Impales.Tears.Confuses.Shatters
  382.   if ($2) {
  383.     if ($+(*,$1,*) iswm %a) && ($+(*,$2,*) iswm %a) {
  384.       if (($1 == anchor) && ($2 == map)) || (($1 == map) && ($2 == anchor)) { return $gettok(%b,2,46) }
  385.       if (($1 == anchor) && ($2 == sword)) || (($1 == sword) && ($2 == anchor)) { return $gettok(%b,5,46) }
  386.       if (($1 == anchor) && ($2 == shark)) || (($1 == shark) && ($2 == anchor)) { return $gettok(%b,3,46) }
  387.       if (($1 == anchor) && ($2 == mruno)) || (($1 == mruno) && ($2 == anchor)) { return $gettok(%b,9,46) }
  388.       if (($1 == map) && ($2 == sword)) || (($1 == sword) && ($2 == map)) { return $gettok(%b,1,46) }
  389.       if (($1 == map) && ($2 == shark)) || (($1 == shark) && ($2 == map)) { return $gettok(%b,7,46) }
  390.       if (($1 == map) && ($2 == mruno)) || (($1 == mruno) && ($2 == map)) { return $gettok(%b,8,46) }
  391.       if (($1 == sword) && ($2 == shark)) || (($1 == shark) && ($2 == sword)) { return $gettok(%b,6,46) }
  392.       if (($1 == sword) && ($2 == mruno)) || (($1 == mruno) && ($2 == sword)) { return $gettok(%b,5,46) }
  393.       if (($1 == shark) && ($2 == mruno)) || (($1 == mruno) && ($2 == shark)) { return $gettok(%b,4,46) }
  394.     }
  395.   }
  396. }
  397. alias ams-announcewinner {
  398.   var %winner, %loser, %winner-answer, %tax 0, %msg, %loser-answer, %sum $calc(%ams-wager * 2)
  399.   if %ams-winner == Cat {
  400.     ;no winners add to pot
  401.     hinc epirate.games AMS.pot %sum
  402.     set %msg Both %ams-p1 n' %ams-p2 chose %ams-p1-answer $+ ! $epirate.round($hget(epirate.games,AMS.pot)) doubloons be added to the pot for the next game!
  403.   }
  404.   elseif %ams-winner == %ams-p1 {
  405.     set %winner %ams-p1
  406.     set %winner-answer %ams-p1-answer
  407.     set %loser %ams-p2
  408.     set %loser-answer %ams-p2-answer
  409.   }
  410.   elseif %ams-winner == %ams-p2 {
  411.     set %winner %ams-p2
  412.     set %winner-answer %ams-p2-answer
  413.     set %loser %ams-p1
  414.     set %loser-answer %ams-p1-answer
  415.   }
  416.  
  417.   if (%winner) {
  418.     if (%ams-pot) inc %sum %ams-pot
  419.  
  420.     ;reduces amount if too much being paid to winner because of previous pot
  421.     if (%winner != $epirate.bot) && (%sum > $epirate.player.percentage(%winner,$EPirate.Max.Percentage.Bonus)) {
  422.       inc %tax
  423.       set %ams-wager $v2
  424.       .timer 1 3 epirate.notice %winner Ye payout be reduced due to taxes from the Cap'n!
  425.     }
  426.  
  427.     set %msg $upper(%winner-answer) $beats($amsl(%winner-answer),$amsl(%loser-answer)) $upper(%loser-answer) - $epirate.nick(%winner) $amsb(%winner) wins $epirate.round(%sum) doubloons $+ $iif(%tax,$chr(32) after taxes!,!)
  428.     hdel epirate.games AMS.pot
  429.  
  430.     ;pays winner if not bot. pay is doubled since wager was deducted ealier
  431.     if (%winner != $epirate.bot) epirate.pay %winner $calc(%ams-pot + $calc(%ams-wager * 2)) games
  432.   }
  433.  
  434.   ;after game commands
  435.   epirate.public.msg $ams-logo %msg
  436.   hinc EPirate.Stats ship.games
  437.  
  438.   if (%ams-p1 != $epirate.bot) {
  439.     hinc epirate.daily Games.Played. $+ %ams-p1
  440.     EPirate.Achievement %ams-p1 game
  441.     EPirate.Skills.Check %ams-p1 Luck
  442.     EPirate.Command.Age.Check %ams-p1 AMS
  443.     if (!$timer(EPirate.Party)) hinc EPirate.Games played. $+ %ams-p1
  444.     EPirate.Task.Check %ams-p1 play.game
  445.   }
  446.  
  447.   if (%ams-p2 != $epirate.bot) {
  448.     ;skips bot from the below commands
  449.     hinc epirate.daily Games.Played. $+ %ams-p2
  450.     EPirate.Achievement %ams-p2 game
  451.     EPirate.Skills.Check %ams-p2 Luck
  452.     EPirate.Command.Age.Check %ams-p2 AMS
  453.     if (!$timer(EPirate.Party)) hinc EPirate.Games played. $+ %ams-p2
  454.     EPirate.Task.Check %ams-p2 play.game
  455.   }
  456.  
  457.   .timerEPirate.AMS.Cooldown 1 $rand(45,90) noop
  458.   ams-reset
  459. }
  460. alias ams-cancel {
  461.   if (!$1) {
  462.     if (!$epirate.reduce.spam) epirate.public.msg $ams-logo $epirate.nick(%ams-p2) %ams-p2 did not accept the challenge from %ams-p1 in time!
  463.     if (%ams-p1) .timerepirate.ams.cancel. $+ %ams-p1 1 1 epirate.notice %ams-p1 $amsb(%ams-p2) did not accept ye challenge in AMS!
  464.     if (%ams-p2) .timerepirate.ams.cancel. $+ %ams-p2 1 1 epirate.notice %ams-p2 The AMS challenge from %ams-p1 timed out!
  465.     ams-reset
  466.   }
  467.   if $1 == decline {
  468.     if (!$epirate.reduce.spam) epirate.public.msg $ams-logo $amsb(%ams-p2) declined the game with %ams-p1
  469.     if (%ams-p1) .timerepirate.ams.cancel. $+ %ams-p1 1 1 epirate.notice %ams-p1 %ams-p2 did not accept ye challenge in AMS!
  470.     ams-reset
  471.   }
  472.   elseif $1 == noanswer {
  473.     if (!$epirate.reduce.spam) epirate.public.msg $ams-logo %ams-p1 n' %ams-p2 did not reply with their answer in time. $ams-logo Game Cancelled.
  474.     if (%ams-p1) epirate.notice %ams-p1 The game o' AMS has timed out!
  475.     if (%ams-p2) epirate.notice %ams-p2 The game o' AMS has timed out!
  476.     ams-reset
  477.   }
  478. }
  479.  
  480.  
  481.  
  482. ;------------------------------------------------------ LOCAL ALIASES
  483. alias -l debug {
  484.   if ($1) {
  485.     if (!$window(@Pirates)) window -n1e3 @Pirates
  486.     aline -p @Pirates $time $+ : $1-
  487.     echo -st [P] $1-
  488.     write $epirate.dir($+(Pirates.Log.,$EPirate.Network,.,$time(mmm),.,$time(yyyy),.log)) $date $time - $strip($1-)
  489.   }
  490. }
  491. alias -l short.dur {
  492.   var %a $duration($1)
  493.   return $remove(%a,$wildtok(%a,*sec*,1,32),$wildtok(%a,*min*,1,32))
  494. }
  495. alias -l b return  $+ $1-
  496. alias -l u return  $+ $1-
  497. alias -l c return  $+ $1-
  498. alias -l o return  $+ $1-
  499. alias -l iseven return $iif(2 // $1,$true,$false)
  500. alias -l isodd return $iif(!$iseven($1),$true,$false)
  501. alias -l ord.num return $ord($1-)
  502. alias paren return $chr(40) $+ $1- $+ $chr(41)
  503. alias -l backwards {
  504.   ;used during april 1
  505.   set %bk.result $null
  506.   var %i $len($1-)
  507.   while (%i) {
  508.     if ($chr(32) == $mid($1-,%i,1)) { %bk.result = %bk.result $+ / }
  509.     %bk.result = %bk.result $+ $mid($1-,%i,1)
  510.     dec %i
  511.   }
  512.   return $replace(%bk.result,/,$chr(32))
  513. }
  514. alias -l rainbow {
  515.   var %string $1-
  516.   var %count 0
  517.   var %color 1
  518.   while (%count < $len($1-)) {
  519.     var %color2 $gettok(04.07.08.09.03.12.06,%color,46)
  520.     var %output %output $+ $iif($left(%string,1) != $chr(32), $+ $iif($left(%string,1) isnum,%color2,$remove(%color2,0)) $+ $iif(%output,$null,$chr(44) $+ 01) $+ $left(%string,1),$chr(32) $+ $chr(32))
  521.     if ($left(%string,1) != $chr(32)) var %color $iif(%color == 7,1,$calc(%color + 1))
  522.     var %string $right(%string,-1)
  523.     inc %count
  524.   }
  525.   return %output $+ 
  526. }
  527. '----------------------------- end local aliases
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement