All pastes #944181 Raw Edit

Eric

public text v1 · immutable
·published 2008-03-15 22:42 UTC
rendered paste body
alias update_sab {
  var %1 = $1, %2 = $remove($$2-,$chr(44),$chr(9)), %f = totsab.txt
  var %x = $read(%f,s,%1), %z = $readn, %: = $calc(%x +%2)
  write $iif(%z,$+(-l,%z)) %f %1 $iif(%x,%:,%2)
}
on *:TEXT:*Your spies successfully enter * armory undetected, and destroy * of the enemy's * stockpile. Your spies all return safely to your camp.*:#:{
  if ($14 == Dragon) && ($15 == Claw) { 
    writeini -n sabs.ini $remove($5,'s) weapons $calc($readini(sabs.ini,$remove($5,'s),weapons) + $remove($10,$chr(44)))
    writeini -n sabs.ini $remove($5,'s) $+($14,$15) $calc($readini(sabs.ini,$remove($5,'s),$+($14,$15)) + $remove($10,$chr(44)))
    writeini -n sabs.ini $remove($5,'s) totalsabbed $calc($calc($remove($10,$chr(44)) * $readini(kocweapons.ini,weapons,$+($14,$15))) + $readini(sabs.ini,$remove($5,'s),totalsabbed))
    writeini -n sabs.ini $remove($5,'s) missions $calc($readini(sabs.ini,$remove($5,'s),missions) + 1)
    writeini -n sabs.ini # channel $calc($calc($remove($10,$chr(44)) * $readini(kocweapons.ini,weapons,$+($14,$15))) + %z)
    writeini -n nt.ini $nick $14 $calc($readini(nt.ini,$nick,$14) + $remove($10,$chr(44))))
    msg $chan $5 Total Sabotaged: $bytes($readini(sabs.ini,$remove($5,'s),totalsabbed),b) - Weapons total: $bytes($readini(sabs.ini,$remove($5,'s),weapons),b)
  }
  else {
    var %t = sabs.ini, %j = $remove($10,$chr(44)), %m = $14, %o = $remove($5,'s), %k = $readini(%t,%o,%m), %l = $readini(kocweapons.ini,weapons,$14), %h = $calc(%j * %l), %v = $readini(sabs.ini,$remove($5,'s),totalsabbed), %x = $readini(sabs.ini,#,channel), %i = $gettok($read(totsab.txt,$nick),1,32)
    writeini -n %t %o %m $calc(%k + %j)
    writeini -n %t %o weapons $calc($readini(%t,%o,weapons) + %j)
    writeini -n %t %o totalsabbed $calc(%h + %v)
    writeini -n %t %o missions $calc($readini(sabs.ini,%o,missions) + 1)
    writeini -n %t # channel $calc(%h + %z)
    writeini -n nt.ini $nick $14 $calc($readini(nt.ini,$nick,$14) + %j))
    update_sab $nick $calc(%h + %i)
    msg $chan $5 Total Sabotaged: $bytes($readini(sabs.ini,%o,totalsabbed),b) - Weapons total: $bytes($readini(sabs.ini,%o,weapons),b)
  }
}
on *:TEXT:!topsab:#: {
  msg $chan The top 10 Sabotagers of the channel are:
  if ($exists(totsab.txt)) $read(totsab.txt,0)
  filter -ffcteu 2 32 totsab.txt totsab.txt *
  var %x = 1, %h = $iif(!$2,10,$2)
  while (%x <= %h) {
    if ($read(totsab.txt,%x)) { .timer 1 %x msg $chan $+($chr(35),$iif(%x < 10,$+(0,%x),%x)) $gettok($read(totsab.txt,%x),1,32) $+ : - $bytes($gettok($read(totsab.txt,%x),2,32),b) }
    inc %x
  }
  timer 1 $calc($iif(!$2,$iif($lines(totsab.txt) <= 10,$lines(totsab.txt),10),$2) +1) msg $chan End of top 10 Sabotagers.
}

on *:TEXT:!sabb*:#: {
  var %f = totsab.txt, %n2 = $iif($2,$2,$nick), %d = $lines(%f)
  while (%d) {
    if (%n2 * iswm $read(%f,n,%d))  { var %v1 = $gettok($read(%f,%d),2,32), %v2 = $calc(%v2 + %v1) }
    dec %d
  }
  if ($readini(nt.ini,%n2,Blackpowder)) { msg $chan Total Blackpowder Missile's Sabotaged: $bytes($v1,b) }
  if ($readini(nt.ini,%n2,Invisibility)) { msg $chan Total Invisibility Shield's Sabotaged: $bytes($v1,b) }
  if ($readini(nt.ini,%n2,Lookout)) { msg $chan Total Lookout Tower's Sabotaged: $bytes($v1,b) }
  if ($readini(nt.ini,%n2,Nunchaku)) { msg $chan Total Nunchaku's Sabotaged: $bytes($v1,b) }
  if (%v2 > 0) { msg # %n2 has Sabotaged: $bytes(%v2,b) }
  else { msg # Not found in my database. }
}

on *:TEXT:!stats*:#:{
  if ($readini(sabs.ini,$2,totalsabbed)) { msg $chan Total Sabotaged: $bytes($v1,b) }
  if ($readini(sabs.ini,$2,Blackpowder)) { msg $chan Total Blackpowder Missile's Sabotaged: $bytes($v1,b) }
  if ($readini(sabs.ini,$2,Invisibility)) { msg $chan Total Invisibility Shield's Sabotaged: $bytes($v1,b) }
  if ($readini(sabs.ini,$2,Lookout)) { msg $chan Total Lookout Tower's Sabotaged: $bytes($v1,b) }
  if ($readini(sabs.ini,$2,Nunchaku)) { msg $chan Total Nunchaku's Sabotaged: $bytes($v1,b) }
  if ($readini(sabs.ini,$2,weapons)) { msg $chan Total Weapons Sabotaged: $bytes($v1,b) }
  if ($readini(sabs.ini,$2,missions)) { msg $chan Total Missions Done on $2: $bytes($v1,b) }
  else { msg $chan Sorry, but $iif($2,$2,$nick) was not found. }
}

on *:TEXT:!chantotal:#:{
  if ($readini(sabs.ini,#,channel)) { msg $chan # has Sabotaged a total of $bytes($v1,b) gold. }
}

on *:TEXT:!sabcom:#:{
  msg $nick The following are the commands:
  msg $nick !topsab - This will show you the top sabbers of the channel.
  msg $nick !sabb - This will show you your sab stats.
  msg $nick !stats <nick> - This will show you the stats for that nick: weapons lost, total sabbed, total weapons lost, etc.
  msg $nick !chantotal - This will show you how much the channel has sabbed.
}