; -------------------------------------------------------------------------------------------------
; moomootree
; https://forums.mirc.com/showflat.php?Cat=0&Number=162717&an=0&page=0&gonew=1#UNREAD
;
; AIDS spell cast. Requires use of $decode (Options dalog, Expand 'Lock', click sub-category
; 'options', and uncheck 'Decode' from the list box half-way down on the right.
; -------------------------------------------------------------------------------------------------
;
; HASH TABLE
; Row: Username
;
; AIDS: column: format:
; - Registered 1 0,1
; - Logged 2 0,1
; - Password 3 $encode(...)
; - Money 4 0-9
; - Aids 5 0,1
; Startup
; Create hash file containing AIDS info
on *:START: {
/hmake AIDS 10
if ($isfile(aids.hsh)) /hload -b AIDS aids.hsh
}
; Exit
; Store AIDS information
on *:EXIT: {
if ($hget(AIDS) && $hget($AIDS,0).item) {
/hsave -bo AIDS aids.hsh
/hfree AIDS
}
}
; !cast aids <name>
; Cast AIDS on to <name>
on *:TEXT:!cast aids &:#: {
var %victim = $3, %cost = 1000, %time = 300
if (!$aids($nick,Registered)) .notice $nick Please register! (!register)
else if (!$aids($nick,Logged)) .notice $nick Please login by PMing $me with !login PassYouMade
else if ($aids($nick,Money) < %cost) .notice $nick You do not have enough credits to cast AIDS!
else if ($aids(%victim,Aids)) .notice $nick $nick already has AIDS!
else if (%victim !ison $chan) .notice $nick %victim was not found on $chan
else {
if (!$aids(%victim,Money,$calc($aids(%victim,Money) - %cost))) /msg $chan Could not decrease $nick $+ 's account balance.
else {
/describe $chan begins to cast AIDS.
/msg $chan $nick has spent %cost credits to cast AIDS!
; more accurate rand
var %rand = $calc($rand(1,999) % 4)
if (%rand == 0) /msg $chan AIDS failed to cast!
else if (!$aids(%victim,Aids,1).set) .msg $chan Could not assign AIDS to %victim $+ .
else {
; Did this until I noticed you changed the messages ;p
;var %t = 0
;while (%t <= %time) {
; .timer [ $+ [ $+(aids,%victim,$calc(%t / 60)) ] ] 1 $calc(%t + 10) /msg $chan %victim has $duration($calc(%time - %t)) until AIDS will take affect.
; /inc %t 60
;}
.timer [ $+ [ $+(aids,%victim,1) ] ] 1 10 /msg $chan %victim has 5 minutes 'til AIDS will take affect.
.timer [ $+ [ $+(aids,%victim,2) ] ] 1 70 /msg $chan %victim has 4 minutes remaining 'til consumed by the AIDS affect.
.timer [ $+ [ $+(aids,%victim,3) ] ] 1 130 /msg $chan %victim has only 3 minutes remaining.
.timer [ $+ [ $+(aids,%victim,4) ] ] 1 190 /msg $chan %victim has only 2 minutes left! GASP!
.timer [ $+ [ $+(aids,%victim,5) ] ] 1 250 /msg $chan %victim has only 1 minute left! Please apply the !cure soon.
.timer [ $+ [ $+(aids,%victim,6) ] ] 1 310 /kick $chan %victim You just died of AIDS! $+(|) /msg $chan %victim has DIES OF AIDS! $+(|) .echo -q $!aids(%victim,Aids,0).set
}
}
}
}
; !cure <name>
; Cures AIDS for <name>
on *:TEXT:!cure &:#: {
var %victim = $2, %cost = 1000
if (!$aids($nick,Registered)) .notice $nick Please register! (!register)
else if (!$aids($nick,Logged)) .notice $nick Please login by PMing $me with !login PassYouMade
else if ($aids($nick,Money) < %cost) .notice $nick You do not have enough credits to cure AIDS!
else if (%victim !ison $chan) .notice $nick %victim was not found on $chan
else if (!$aids(%victim,Aids)) .msg $chan $nick just wasted %cost credits to cure someone who doesn't have AIDS!
else {
if (!$aids(%victim,Money,$calc($aids(%victim,Money) - %cost)).set) /msg $chan Could not decrease $nick $+ 's account balance.
else if (!$aids(%victim,Aids,0).set) /msg $chan Could not unset AIDS value.
else {
/msg $chan $nick has spent %cost credits to cure %victim of AIDS!
.timer [ $+ [ $+(aids,%victim,?) ] ] off
}
}
}
; $aids(<name>,<item>,[value]).[set|register]
; Retrieves information on the specified user profile. When the set property is
; specified, the item is assigned the given value. If the register property is
; used, a new profile with default values is created.
;
; Item listing:
; - Registered
; - Logged
; - Password
; - Money
; - Aids
alias aids {
var %tbl = AIDS, %hash = aids.hsh, %nick = $1, %item = $2
var %item_list = Registered Logged Password Money Aids, %tok = $findtok(%item_list,$2,1,32)
if ($isid && (%tok || reg* iswm $prop)) {
if ($prop == set) {
var %value = $3
if (%item == Password) %value = $encode(%value,m)
/hadd -m %tbl %nick $puttok($hget(%tbl,%nick),%value,%tok,32)
if ($gettok($hget(%tbl,%nick),%tok,32) == %value) {
/hsave -bo %tbl %hash
return $true
}
}
else if (reg* iswm $prop) {
/hadd -m %tbl %nick 1 0 - 0 0
if ($hget(%tbl,%nick)) {
/hsave -bo %tbl %hash
return $true
}
}
else {
var %value = $gettok($hget(%tbl,%nick),%tok,32)
if (%item == Password) %value = $decode(%value,m)
return %value
}
return $false
}
}