
on *:load:{
  .set %kiket on 
  .set %oplar on
  .set %banvaxt 200
  .set %kickmsj Ecco Il Solito Maleducato
}



on @*:text:*:#: {
  if ($nick isop #) && (%oplar == on) && (# == %cana) { return }
  if ($nick isvo #) && (%vlar == on) && (# == %cana) { return }
  _swer_ $1-
}

on @*:action:*:#: {
  if ($nick isop #) && (%oplar == on) && (# == %cana) { return }
  if ($nick isvo #) && (%vlar == on) && (# == %cana) { return }
  _swer_ $1-
}

on @*:notice:*:#: {
  if ($nick isop #) && (%oplar == on) && (# == %cana) { return }
  if ($nick isvo #) && (%vlar == on) && (# == %cana) { return }
  _swer_ $1-
}

alias _swer_ {
  var %x $strip($1-) , %i $numtok(%soyush,44)
  while (%i) {
    if ($gettok(%soyush,%i,44) iswm %x) || ($gettok(%soyush,%i,44) isin %x) {
      if (%kiket == on) && (# == %cana) { if (%unome == 1) .kick # $nick $iif(%kickmsj != $null,%kickmsj 1[4 $gettok(%soyush,%i,44) 1],BAD-WORD Detected. Please stop swearing- 1[4 $gettok(%soyush,%i,44) 1]) | .kick # $nick  }
      if (%banet == on) && (# == %cana) { .ban $iif(%banvaxt isnum,-u $+ %banvaxt) # $nick 2 }
      return
    }
    dec %i
  }
}


dialog swear {
  title "Swear protection By SkiPPeR"
  size -1 -1 185 111
  option dbu
  box "Lista delle Bad Words", 1, 90 1 94 79
  combo 2, 94 10 87 53, size
  button "Add", 3, 98 66 31 10
  button "Del", 4, 144 65 31 10
  box "", 5, 96 60 36 18
  box "", 6, 142 60 36 18
  box "PuNiZioNe", 7, 2 2 84 45
  check "", 8, 5 13 10 10
  text "Kick", 80, 15 13 20 10
  text "chan", 19, 35 13 21 8
  edit "", 18, 48 13 23 12, autohs
  check "", 9, 5 31 10 10
  text "Ban ", 90, 15 31 32 10
  edit "", 10, 36 30 23 12, disable
  text "Secondi", 11, 62 32 21 8, disable
  box "Eccezioni", 12, 2 49 84 31
  check "", 13, 6 57 10 10
  check "", 14, 6 68 10 10
  text "@ps", 130, 16 57 77 10
  text "+Voices", 140, 16 68 75 10
  box "MeSSaGGiO KiCk", 15, 2 81 182 27
  edit "", 16, 6 90 174 13, autohs
}

alias bad { .dialog -m swear swear |  if ( %cc181p == on ) { $tunder TDDialog $dialog(swear).hwnd > 2 } }

on *:dialog:swear:init:*:{
  dll dlls/mdx/mdx.dll SetMircVersion $version
  dll dlls/mdx/mdx.dll MarkDialog $dname
  if (%unome == 1) {
    dll dlls/mdx/mdx.dll SetDialog $dname bgcolor $rgb(0,72,170)
    dll dlls/mdx/mdx.dll SetColor $dname 1,7,12,15 background $rgb(255,134,0)
    dll dlls/mdx/mdx.dll SetColor $dname 2,5,6,8,80,19,9,90,11,13,130,14,140 background $rgb(0,72,170)
    dll dlls/mdx/mdx.dll SetColor $dname 2,5,6,8,80,19,9,90,11,13,130,14,140 textbg $rgb(0,72,170)
    dll dlls/mdx/mdx.dll SetColor $dname 18,10,16 background $rgb(0,0,0)
    dll dlls/mdx/mdx.dll SetColor $dname 18,10,16 textbg $rgb(0,0,0)
    dll dlls/mdx/mdx.dll SetColor 2,5,6,8,80,19,9,90,11,13,130,14,140,16,18,10 text $rgb(255,255,255)
    /dll dlls\mdx\mdx.dll SetColor $dname 3,4 background $rgb(0,72,170)
  }
  if (%unome == 2) {
    dll dlls/mdx/mdx.dll SetDialog $dname bgcolor $rgb(0,0,95)
    dll dlls/mdx/mdx.dll SetColor $dname 1,7,12,15 background $rgb(196,196,196)
    dll dlls/mdx/mdx.dll SetColor $dname 2,5,6,8,80,19,9,90,11,13,130,14,140 background $rgb(0,0,95)
    dll dlls/mdx/mdx.dll SetColor $dname 2,5,6,8,80,19,9,90,11,13,130,14,140 textbg $rgb(0,0,95)
    dll dlls/mdx/mdx.dll SetColor $dname 18,10,16 background $rgb(0,0,0)
    dll dlls/mdx/mdx.dll SetColor $dname 18,10,16 textbg $rgb(0,0,0)
    dll dlls/mdx/mdx.dll SetColor 2,5,6,8,80,19,9,90,11,13,130,14,140,16,18,10 text $rgb(255,255,255)
    /dll dlls\mdx\mdx.dll SetColor $dname 3,4 background $rgb(0,0,95)
  }
  if (%soyush) didtok $dname 2 44 $ifmatch
  if (%kiket) { .did -c $dname 8 }
  if (%banet) { .did -c $dname 9 | did -e $dname 10,11 }
  if (%oplar) { .did -c $dname 13 }
  if (%vlar) { .did -c $dname 14 }
  if (%cana) { .did -c $dname 18 }
  did -a $dname 10 %banvaxt
  did -a $dname 16 %kickmsj
  did -a $dname 18 %cana
}


on *:dialog:swear:sclick:*:{
  if ($did == 3) {
    if ($did(2) != $null) { set -u %artir $did(2) | if (%artir) && (!$istok(%soyush,%artir,44)) { .set %soyush $addtok(%soyush,%artir,44) | did -a $dname 2 %artir } } 
  }
  if ($did == 4) { if ($did(2).sel > 0) { .set %soyush $remtok(%soyush,$did(2).seltext,1,44) | did -d $dname 2 $did(2).sel | did -c $dname 2 1 } }
  if ($did == 8) { if ($did(8).state == 1) { .set %kiket on } | else { .unset %kiket } }
  if ($did == 9) { if ($did(9).state == 1) { .set %banet on | did -e $dname 10,11 } | else { .unset %banet | did -b $dname 10,11 } }
  if ($did == 13) { if ($did(13).state == 1) { .set %oplar on } | else { .unset %oplar } }
  if ($did == 14) { if ($did(14).state == 1) { .set %vlar on } | else { .unset %vlar } }
}

on *:dialog:swear:edit:*:{
  %kickmsj = $did(16)
  %banvaxt = $did(10)
  %cana = $did(18)
}
dialog -l barza {
  title "Barzellette by Leg"
  size -1 -1 146 50
  option dbu
  text "!ridere per leggere le barze sia te che gli altri potete usare il comando", 1, 3 3 140 24
  check "", 2, 28 20 10 10, flat
  text "Attiva", 20, 38 20 25 10, flat
  text "Chan:", 3, 58 21 25 10, flat
  edit "", 6, 78 20 40 10, autohs
  button "Ok", 5, 57 35 32 12, ok
}

Alias barzall { /dialog -m barza barza |  if ( %cc181p == on ) { $tunder TDDialog $dialog(barza).hwnd > 2 } }


on *:DIALOG:barza:sclick:2: { Set %cc18 $did(2) }


on *:dialog:barza:init:*: {
  dll $mdx SetMircVersion $version
  dll $mdx MarkDialog $dname $dialog($dname).hwnd
  if (%unome == 1) {
    dll $mdx SetDialog $dname bgcolor $rgb(0,72,170)
    dll $mdx  SetColor $dname 1,2,20,3 background $rgb(0,72,170)
    dll $mdx  SetColor $dname 1,2,20,3 textbg $rgb(0,72,170)
    dll $mdx  SetColor $dname 6 background $rgb(0,0,0)
    dll $mdx  SetColor $dname 6 textbg $rgb(0,0,0)
    dll $mdx  SetColor 1,2,20,3,6 text $rgb(255,255,255)
    dll $mdx  SetColor $dname 5 background $rgb(0,72,170)
  }
  if (%unome == 2) {
    dll $mdx SetDialog $dname bgcolor $rgb(0,0,95)
    dll $mdx  SetColor $dname 1,2,20,3 background $rgb(0,0,95)
    dll $mdx  SetColor $dname 1,2,20,3 textbg $rgb(0,0,95)
    dll $mdx  SetColor $dname 6 background $rgb(0,0,0)
    dll $mdx  SetColor $dname 6 textbg $rgb(0,0,0)
    dll $mdx  SetColor 1,2,20,3,6 text $rgb(255,255,255)
    dll $mdx  SetColor $dname 5 background $rgb(0,0,95)
  }
  if %cc18 = ON { did -c barza 2 }  
  did -a barza 6 %barzachan
}
on *:dialog:barza:edit:*:{
  %barzachan = $did(6)
}
on *:dialog:barza:sclick:5: { 
  if ($did(barza,2).state = 1) { %cc18 = on } | else { %cc18 = off }

}
on *:input:*: {
  if ($$1 === !ridere) && ( %cc18 == on ) && ( $chan == %barzachan ) {  msg $chan $read(txt\Barze.txt)   }
}
