Приветствую Вас Гость | RSS

Обитель Бафура: королевство гномов

Суббота, 2020 Йаваннет 26, 20:31
alias -l roll_dice {
var %count = $1
if ($regex($1,/^[-](.+)$/i)) {
%count = $regml(1)
var %i = 1, %a, %p, %b = 0, %x, %z = 1
while (%i <= %count) {
%x = $rand(1,$2)
if ($3) && (%x >= $3) {
%p = %p 6 %x 13
}
else %p = %p %x
%a = %a %x
%b = $calc(%b - %x)
inc %i
}
}
else {
var %i = 1, %a, %p, %b = 0, %x, %z = 1
while (%i <= %count) {
%x = $rand(1,$2)
if ($3) && (%x >= $3) {
%p = %p 6 %x 13
}
else %p = %p %x
%a = %a %x
%b = $calc(%b + %x)
inc %i
}
}
return $+(%a,.,%b,.,%p)
}

on 1:TEXT:*!*:?:{
if ($regex($1-,/^.*!

  • ([1-9][0-9]?)-(.+)$/i)) {
    if (!%dice) return
    var %dice_str = $regml(2)
    %dice_str = $replace(%dice_str,-,+-)
    var %counter = $numtok(%dice_str, 43)
    var %buffer = $nick 12rolled13
    var %total = 0
    var %i = 1
    var %j = $regml(1)
    var %total_str
    var %full_total = 0

    while (%j > 0) {
    %i = 1
    %total = 0
    while (%i <= %counter) {
    var %temp = $gettok(%dice_str, %i, 43)

    if ($regex(%temp,/^([+-]?[1-9][0-9]?)(d|ô|ò)([1-9][0-9]?[0-9]?)$/i)) {
    var %z = $roll_dice($regml(1),$regml(3))
    %buffer = %buffer $gettok(%z,1,46)
    %total = $calc(%total + $gettok(%z,2,46))
    %full_total = $calc(%full_total + $gettok(%z,2,46))
    }
    else {
    %total = $calc(%total + %temp)
    %full_total = $calc(%full_total + %temp)
    }
    inc %i
    }
    %total_str = %total_str %total
    dec %j
    }

    .timer $+ $+(!.,$me) 1 1 /msg $me %buffer $+ . 12Results:6 %total_str $+ . 12Total:4 %full_total
    }
    elseif ($regex($1-,/^.*!%([1-9][0-9]?)-(.+)$/i)) {
    if (!%dice) return
    var %dice_str = $regml(2)
    %dice_str = $replace(%dice_str,-,+-)
    var %counter = $numtok(%dice_str, 43)
    var %buffer = $nick 12rolled13
    var %total = 0
    var %highlight = $regml(1)

    var %i = 1
    while (%i <= %counter) {
    var %temp = $gettok(%dice_str, %i, 43)

    if ($regex(%temp,/^([+-]?[1-9][0-9]?)(d|ô|ò)([1-9][0-9]?[0-9]?)$/i)) {
    var %z = $roll_dice($regml(1),$regml(3),%highlight)
    %buffer = %buffer $gettok(%z,3,46)
    %total = $calc(%total + $gettok(%z,2,46))
    }
    else {
    %total = $calc(%total + %temp)
    }

    inc %i
    }

    .timer $+ $+(!.,$me) 1 1 /msg $me %buffer $+ . 12Total:4 %total
    }
    elseif ($regex($1-,/^.*!(.+)$/i)) {
    if (!%dice) return
    var %dice_str = $regml(1)
    %dice_str = $replace(%dice_str,-,+-)
    var %counter = $numtok(%dice_str, 43)
    var %buffer = $nick 12rolled13
    var %total = 0

    var %i = 1
    while (%i <= %counter) {
    var %temp = $gettok(%dice_str, %i, 43)

    if ($regex(%temp,/^([+-]?[1-9][0-9]?)(d|ô|ò)([1-9][0-9]?[0-9]?)$/i)) {
    var %z = $roll_dice($regml(1),$regml(3))
    %buffer = %buffer $gettok(%z,1,46)
    %total = $calc(%total + $gettok(%z,2,46))
    }
    else {
    %total = $calc(%total + %temp)
    }

    inc %i
    }

    if (%total != 0) .timer $+ $+(!.,$me) 1 1 /msg $me %buffer $+ . 12Total:4 %total
    }
    elseif ($1- == @dice) {
    .timer $+ $+(roll.,$me) 1 1 /msg $chan D&D Dice Rolling Bot is now $iif(%dice,disabled,enabled) $+ .
    $iif(%dice,unset,inc) %dice
    }
    elseif (!%dice) return
    }

    on 1:TEXT:*!*:#:{
    if ($regex($1-,/^.*!

  • ([1-9][0-9]?)-(.+)$/i)) {
    if (!%dice) return
    var %dice_str = $regml(2)
    %dice_str = $replace(%dice_str,-,+-)
    var %counter = $numtok(%dice_str, 43)
    var %buffer = $nick 12rolled13
    var %total = 0
    var %i = 1
    var %j = $regml(1)
    var %total_str
    var %full_total = 0

    while (%j > 0) {
    %i = 1
    %total = 0
    while (%i <= %counter) {
    var %temp = $gettok(%dice_str, %i, 43)

    if ($regex(%temp,/^([+-]?[1-9][0-9]?)(d|ô|ò)([1-9][0-9]?[0-9]?)$/i)) {
    var %z = $roll_dice($regml(1),$regml(3))
    %buffer = %buffer $gettok(%z,1,46)
    %total = $calc(%total + $gettok(%z,2,46))
    %full_total = $calc(%full_total + $gettok(%z,2,46))
    }
    else {
    %total = $calc(%total + %temp)
    %full_total = $calc(%full_total + %temp)
    }
    inc %i
    }
    %total_str = %total_str %total
    dec %j
    }

    .timer $+ $+(!.,$me) 1 1 /msg $chan %buffer $+ . 12Results:6 %total_str $+ . 12Total:4 %full_total
    }
    elseif ($regex($1-,/^.*!%([1-9][0-9]?)-(.+)$/i)) {
    if (!%dice) return
    var %dice_str = $regml(2)
    %dice_str = $replace(%dice_str,-,+-)
    var %counter = $numtok(%dice_str, 43)
    var %buffer = $nick 12rolled13
    var %total = 0
    var %highlight = $regml(1)

    var %i = 1
    while (%i <= %counter) {
    var %temp = $gettok(%dice_str, %i, 43)

    if ($regex(%temp,/^([+-]?[1-9][0-9]?)(d|ô|ò)([1-9][0-9]?[0-9]?)$/i)) {
    var %z = $roll_dice($regml(1),$regml(3),%highlight)
    %buffer = %buffer $gettok(%z,3,46)
    %total = $calc(%total + $gettok(%z,2,46))
    }
    else {
    %total = $calc(%total + %temp)
    }

    inc %i
    }

    .timer $+ $+(!.,$me) 1 1 /msg $chan %buffer $+ . 12Results:6 %total_str $+ . 12Total:4 %full_total
    }
    elseif ($regex($1-,/^.*!(.+)$/i)) {
    if (!%dice) return
    var %dice_str = $regml(1)
    %dice_str = $replace(%dice_str,-,+-)
    var %counter = $numtok(%dice_str, 43)
    var %buffer = $nick 12rolled13
    var %total = 0

    var %i = 1
    while (%i <= %counter) {
    var %temp = $gettok(%dice_str, %i, 43)

    if ($regex(%temp,/^([+-]?[1-9][0-9]?)(d|ô|ò)([1-9][0-9]?[0-9]?)$/i)) {
    var %z = $roll_dice($regml(1),$regml(3))
    %buffer = %buffer $gettok(%z,1,46)
    %total = $calc(%total + $gettok(%z,2,46))
    }
    else {
    %total = $calc(%total + %temp)
    }

    inc %i
    }

    if (%total != 0) .timer $+ $+(!.,$me) 1 1 /msg $chan %buffer $+ . 12Total:4 %total
    }
    elseif ($1- == @dice) {
    .timer $+ $+(roll.,$me) 1 1 /msg $chan D&D Dice Rolling Bot is now $iif(%dice,disabled,enabled) $+ .
    $iif(%dice,unset,inc) %dice
    }
    elseif (!%dice) return
    }

    on *:INPUT:#:{
    if ($regex($1-,/^.*!

  • ([1-9][0-9]?)-(.+)$/i)) {
    if (!%dice) return
    var %dice_str = $regml(2)
    %dice_str = $replace(%dice_str,-,+-)
    var %counter = $numtok(%dice_str, 43)
    var %buffer = $nick 12rolled13
    var %total = 0
    var %i = 1
    var %j = $regml(1)
    var %total_str
    var %full_total = 0

    while (%j > 0) {
    %i = 1
    %total = 0
    while (%i <= %counter) {
    var %temp = $gettok(%dice_str, %i, 43)

    if ($regex(%temp,/^([+-]?[1-9][0-9]?)(d|ô|ò)([1-9][0-9]?[0-9]?)$/i)) {
    var %z = $roll_dice($regml(1),$regml(3))
    %buffer = %buffer $gettok(%z,1,46)
    %total = $calc(%total + $gettok(%z,2,46))
    %full_total = $calc(%full_total + $gettok(%z,2,46))
    }
    else {
    %total = $calc(%total + %temp)
    %full_total = $calc(%full_total + %temp)
    }
    inc %i
    }
    %total_str = %total_str %total
    dec %j
    }

    .timer $+ $+(!.,$me) 1 1 /msg $chan %buffer $+ . 12Results:6 %total_str $+ . 12Total:4 %full_total
    }
    elseif ($regex($1-,/^.*!%([1-9][0-9]?)-(.+)$/i)) {
    if (!%dice) return
    var %dice_str = $regml(2)
    %dice_str = $replace(%dice_str,-,+-)
    var %counter = $numtok(%dice_str, 43)
    var %buffer = $nick 12rolled13
    var %total = 0
    var %highlight = $regml(1)

    var %i = 1
    while (%i <= %counter) {
    var %temp = $gettok(%dice_str, %i, 43)

    if ($regex(%temp,/^([+-]?[1-9][0-9]?)(d|ô|ò)([1-9][0-9]?[0-9]?)$/i)) {
    var %z = $roll_dice($regml(1),$regml(3),%highlight)
    %buffer = %buffer $gettok(%z,3,46)
    %total = $calc(%total + $gettok(%z,2,46))
    }
    else {
    %total = $calc(%total + %temp)
    }

    inc %i
    }

    .timer $+ $+(!.,$me) 1 1 /msg $chan %buffer $+ . 12Total:4 %total
    }
    elseif ($regex($1-,/^.*!(.+)$/i)) {
    if (!%dice) return
    var %dice_str = $regml(1)
    %dice_str = $replace(%dice_str,-,+-)
    var %counter = $numtok(%dice_str, 43)
    var %buffer = $nick 12rolled13
    var %total = 0

    var %i = 1
    while (%i <= %counter) {
    var %temp = $gettok(%dice_str, %i, 43)

    if ($regex(%temp,/^([+-]?[1-9][0-9]?)(d|ô|ò)([1-9][0-9]?[0-9]?)$/i)) {
    var %z = $roll_dice($regml(1),$regml(3))
    %buffer = %buffer $gettok(%z,1,46)
    %total = $calc(%total + $gettok(%z,2,46))
    }
    else {
    %total = $calc(%total + %temp)
    }

    inc %i
    }

    if (%total != 0) .timer $+ $+(!.,$me) 1 1 /msg $chan %buffer $+ . 12Total:4 %total
    }
    elseif ($1- == @dice) {
    .timer $+ $+(roll.,$me) 1 1 /msg $chan D&D Dice Rolling Bot is now $iif(%dice,disabled,enabled) $+ .
    $iif(%dice,unset,inc) %dice
    }
    elseif (!%dice) return
    }