;;;;;;;;
;OPTHNX;
;;;;;;;;

alias optnx { if (!$dialog(optnx)) { dialog -m optnx optnx } | else { dialog -v optnx optnx } }
alias -l wo { writeini $+(",$scriptdiroptnx.ini,") optnx $1- }
alias -l ro { return $readini($+(",$scriptdiroptnx.ini,"),optnx,$1) }
alias -l rn { return $readini($+(",$scriptdiroptnx.ini,"),n,optnx,$1) }

dialog optnx {
  size -1 -1 218 73
  title "Конфигурация"
  option dbu

  box "", 18, 1 0 216 72
  check "Включить", 1, 3 6 50 10
  text "ОП:", 2, 4 18 20 8
  edit "", 3, 23 17 80 10, autohs
  text "ДеОП:", 4, 110 18 20 8 
  edit "", 5, 132 17 80 10, autohs
  text "ХОП:",6, 4 32 20 8
  edit "", 7, 23 31 80 10, autohs
  text "ДеХОП:", 8, 110 32 20 8
  edit "", 9, 132 31 80 10, autohs
  text "Войс:", 10, 4 46 20 8
  edit "", 11, 23 45 80 10, autohs
  text "ДеВойс:", 12, 110 46 20 8
  edit "", 13, 132 45 80 10, autohs
  button "ОК", 14, 60 58 30 12, ok
  button "Отмена", 15, 95 58 30 12, cancel
  button "Стандарт", 16, 130 58 30 12
}

on *:dialog:optnx:*:*:{
  if ($devent == init) {
    if ($ro(optnx) == on) { did -c optnx 1 }
    else { did -u optnx 1 | did -m optnx 3,5,7,9,11,13 }
    did -a optnx 3 $rn(op)
    did -a optnx 5 $rn(deop)
    did -a optnx 7 $rn(hop)
    did -a optnx 9 $rn(dehop)
    did -a optnx 11 $rn(voice)
    did -a optnx 13 $rn(devoice)
  }
  if ($devent == sclick) {
    if ($did == 1) {
      if ($ro(optnx) == on) { .disable #optnx | wo optnx off | did -u optnx 1 | did -m optnx 3,5,7,9,11,13 }
      else { .enable #optnx | wo optnx on | did -c optnx 1 | did -n optnx 3,5,7,9,11,13 }
    }
    if ($did == 16) {
      did -ra optnx 3 Спасибо за ОП $nick Так намного лучше ;)
      did -ra optnx 5 $nick верни Опик Засранец !!!
      did -ra optnx 7 $nick :)
      did -ra optnx 9 $nick :(
      did -ra optnx 11 $nick с Войсиком Я РУЛЮ !!! Спасибки ;)
      did -ra optnx 13 $nick не подскажиш куда делся мой Войсик ?!?!?
    }
    if ($did == 14) {
      if (!$did(3)) { wo op Спасибо за ОП $nick . }
      else { wo op $did(3) }
      if (!$did(5)) { wo deop $nick ну и нафиг ОП забрал? }
      else { wo deop $did(5) }
      if (!$did(7)) { wo hop :) >_> }
      else { wo hop $did(7) }
      if (!$did(9)) { wo dehop >:( }
      else { wo dehop $did(9) }
      if (!$did(11)) { wo voice $nick Спасибки ;) }
      else { wo voice $did(11) }
      if (!$did(13)) { wo devoice $nick не подскажиш куда делся мой Войс ?!?!? }
      else { wo devoice $did(13) }
    }
  }
}
#optnx on

on *:OP:#:{ if ($opnick == $me) { msg # $eval($ro(op)) } }
on *:DEOP:#:{ if ($opnick == $me) { msg # $eval($ro(deop)) } }
on *:HELP:#:{ if ($hnick == $me) { msg # $eval($ro(hop)) } }
on *:DEHELP:#:{ if ($hnick == $me) { msg # $eval($ro(dehop)) } }
on *:VOICE:#:{ if ($vnick == $me) { msg # $eval($ro(voice)) } }
on *:DEVOICE:#:{ if ($vnick == $me) { msg # $eval($ro(devoice)) } }

#optnx end
