Zion Sphinx — File Browser
ZionSphinxv3.0 / ZionSphinxv3.0 / plugins / zion_le3.mrc
zion_le3.mrc — 25.26 KB — Download this file
; --------< Zion >----------------------------------------------------
; Name....: ZionLE 3.0 Control
; File....: zion_le3.mrc
; Ver.....: 3.0b280807
; Author..: sprion
; Email...: sprion@lyniq.com
; Date....: 28 Aug 2007
; URL.....: http://zincplay.com
; Info....: This is the control script for the 3rd generation Lan Emulation (LE) that uses a separate engine for connections.
; Changes.: Better checks for reasons for disconnecting users.
;---------------------------------------------------------------------
;translatable
; 290106 1:55 am - need to make a check .. cos sometimes zionle.exe still running but zion dun show
; usables:
; $zion.le3.mem.findbyip(<ip>,<n>) - returns PlayerNumber in memory, where N is the Nth match. 0 shows total matches.
; $zion.le3.mem.findbyircnick(<ircnick>,<n>) - returns PlayerNumber in memory, where N is same as above.
; PlayerNumber is useful to modify details of the player in the game. i.e. for updating player's ircnick detail, ZAC status detail on the InfoSquare.
; on signal zion_le3.mrc join <ip> <playernumber>
; usables:
; signal zion.le.connected,zion.le.disconnected,zion.le.ingame,zion.le.endgame
; ALL LE plugin must conform
; ---- BEGIN ----
on *:signal:zion_cmdlistopen:{
zion.listcmd z.connect ; Connects to a game. ; /z.connect <ip> ; /z.connect 121.6.88.167
zion.listcmd z.lanemu ; Starts LAN Emulation for joining games.
zion.listcmd z.hostmode ; Stops LAN Emulation allowing Host Mode for hosting games.
zion.listcmd z.switchle ; Switches LAN Emulation versions & methods. ; /z.switchle [2|3] ; /z.switchle \n /z.switchle 3
zion.listcmd z.listcon ; Lists the incoming/outgoing connections. Developers can make use of the signal parameter. ; /z.listcon <port> <in|out> [signal_parameters] ; /z.listcon 6112 in \n /z.listcon 6112 in players_in_my_game_signal
}
; script unload signal
on *:signal:zion_unload:.unload -rs $+(",$script,")
on *:load:{
; .signal -n zion_le_load $script
.signal -n zion_plugin_load $script
z.note $z.head(plugin) $ $nopath($script) $z.lang(sys,loaded)
}
on *:signal:zion_winmade:{
if ((%zion.le.on) && (!$portfree(6112))) zion.le3.uistart
unset %zion.le.note
if (%zion.le.connectedIP) zion.gui.addbutton $z.lang(zionle3,connectedtogame) $ $iif($isalias(zion.le2),z.lc.fail,zion.le3.dc) $ d/c
; z.le3.chkupdates
;if (!$portfree(6112)) zion.le3.run
}
on *:unload:.signal -n zion_plugin_unload $script | zion.le3.end
on *:signal:zion_gamelist3_systemmenu_init:{
var %v $calc($xpop($1,root).num +1)
z.h.setvar z.le3.menu.1 %v
xpop -a $1 %v $chr(9) + %v 0 $z.lang(zionle3,switch) $iif($isalias(zionle.run),3.0,2.0)
%v = $calc($xpop($1,root).num +1)
xpop -a $1 %v $chr(9) + %v 0 -
}
on *:signal:xpopup-agl.system:{
if ($1 = $z.h.getvar(z.le3.menu.1)) {
z.switchle
.signal -n zion_gamelist3_systemmenu reset
}
}
on *:signal:zion_options_sel:{
tokenize 124 $1-
if ($1 = $script) {
if (!$z.options.docked(zle3_config)) {
%zion.zle3.dock = 1
.timer 1 0 zle3_config
}
else z.options.show zle3_config
}
}
on *:signal:zion_options_save:_checkandtoggle
alias -l _checkandtoggle {
var %d zle3_config,%v
if ($dialog(%d)) {
;5 ext, 6 int
if (($xdid(%d,5).state) && ($isalias(zionle.run))) .timer 1 0 z.switchle
elseif (($xdid(%d,6).state) && (!$isalias(zionle.run))) .timer 1 0 z.switchle
}
}
alias z.switchle {
var %m
if ($isalias(zionle.run)) {
if ($int($1) = 2) { z.echo $z.head(err) $z.lang(zionle3,nochange) $1 | return }
zionle.end | .unload -rs $+(",$scriptdir,zion_le.mrc,") | %m = $z.lang(zionle3,external)
}
else {
if ($int($1) = 3) { z.echo $z.head(err) $z.lang(zionle3,nochange) $1 | return }
zion.le3.end | .load -rs $+(",$scriptdir,zion_le.mrc,") | %m = $z.lang(zionle3,internal)
}
zion.girl +i 2 $z.icl $ $z.lang(zionle3,girlmsg)
z.echo $z.head(notice) $z.lang(zionle3,switchok) %m
}
alias -l id return $nopath($script)
alias -l saveID return zionle3
; all external LEs should return an Ident.
alias zion.le.id return ZIONLEC.3b280807
; this alias needed so zion knows a LE module exists (z.connect)
alias z.connect {
; individualized codes
if (($1 != -s) && (%zion.le.connectedIP) && ($z.pop($z.lang(zionle3,proceedconnect),$z.lang(zionle3,header_proceedconnect),4,32,256,0) != 6)) return
if ($1 = -s) tokenize 32 $2-
if (!$0) { z.echo $z.head(tip) /z.connect <ip> | return }
; bb
zion.zdc.bb $1-
; $1 is always IP
zion.le3 $1
%zion.le3.name = $2-
.signal -n zion_connect2game $1-
zion.girl +i 2 $z.icl $ $z.lang(zionle3,girlmsg2)
clipboard $1
}
; this alias needed to launch lan emulation from outside
alias z.lanemu zion.le3.run
; this alias to stop le from outside
alias z.hostmode zion.le3.end
; MENU attached to ZION
alias zion.le.menu {
var %e $z.lang(zionle3,stoplanemu),%g $z.lang(zionle3,endgame),%_e zion.le3.end,%_g zion.le3.dc
if ($1 = begin) return -
if (%zion.le.connectedIP) {
if (!%zion.le.gamestart) {
if ($1 = 1) return $z.lang(zionle3,forcegamestart):zion.le.gamestart 1
if ($1 = 2) return %g : %_g
if ($1 = 3) return %e : %_e
}
else {
if ($1 = 1) return %g : %_g
if ($1 = 2) return %e : %_e
}
}
elseif (%zion.le.on) {
if ($1 = 1) return %e : %_e
}
else {
if ($1 = 1) return $z.lang(zionle3,startlanemu):zion.le3.run
}
}
; ---- END ----
; ---- PLUGIN CONFORMING end. ----
; PLUGIN individualised codes begin..
on *:exit:send_ close
;zion.le3.end
; check for update of zionle
on *:signal:zion_update_start:{
.signal -n zion_update_addfile $+(",$scriptdir,zionle.exe,")
}
on *:signal:zion_check:{
if ((%zion.le.gamestart) || (!%zion.le.on)) return
zion.le3.ping
}
on *:signal:zion_mirc_start:unset %zion.le.gamestart | if (%zion.le.on) .timer 1 2 zion.le3.ping -s
on *:signal:zion_le.*:{
var %s $signal,%c = %zion.le3.code,%exclude zion_le.rcvd
; if ($signal !isin %exclude) echo @le 13 len: $len($1-) full: $signal $1-
; if (%s = zion_le.load) %e le loaded.
if (%s = zion_le.start.fail) {
; %e $2 $1 in use!
z.echo $z.head(err) $z.lang(zionle3,6112)
}
; le software-end
elseif (%s = zion_le.end) {
; %e le end.
zion.le3.uiend
}
; lan emu started
elseif (%s = zion_le.start) {
; %e lan emu on $2 $1 started.
; %e Testing communications...
if (!$isalias(zionle.run)) dde zionle zionle cmd echo OK
; %e le ready..
; default things
if (!$1) z.note $z.head(lan) $ $z.lang(zionle3,emustart)
zion.le3.uistart
; connecting
if ($istok(%c,2,44)) step2
}
; already started
elseif ((%s = zion_le.previnstance) && ($istok(%c,2,44))) { zion.le3.uistart | step2 }
elseif ((%s = zion_le.previnstance)) {
; default things
z.note $z.head(lan) $ $z.lang(zionle3,emudetected)
zion.le3.uistart
}
elseif (%s = zion_le.start.error) %e le error: $1-
elseif (%s = zion_le.rcvd) {
if ($1 = ping) .timerzion.le.ping off
; %e le> $1-
}
; receiving game info
elseif (%s = zion_le.gameinfo) {
; (szx201010120|20)
; winmade will cause shortcuts to disappear
if (!%zion.le.note) .signal -n zion_le.gameinlan
var %m $1-,%t = $gettok(%m,-1,20)
; this fixes the error caused when hostname is a space.. should put this in zionle instead
if ($numtok(%m,%t) = 5) %m = - $+ %m
; check out why some | are replaced with $chr(124) in zionle and some are not..
; replaced | with I
; seems like sending out details with | causes commands to be ran
; tokenize %t $replace($1-,$ $+ chr(124),$chr(124),$chr(124),I)
; tokenize %t $1-
tokenize %t $replace(%m,$ $+ chr(124),$chr(124))
; %e Gameinfo: Host: $1 VER: $2 P: $3 E: $4 M: $5 Con: $left($6,1)
; updating others about game details
.signal $id details $3 $4 $left($6,1) $1
.signal -n zion_gameinfo $+(%zion.le.connectedIP,_pub) -s $+(,$z.getcol(4),$z.calccount($3,$4,$5))
; version show, redundant since you know beforehand
;.signal -n zion_gameinfo $+(%zion.le.connectedIP,_pub) -d $+(1.,$2)
}
; elseif (%s = zion_le.gameinfo.save) %e Gameinfo saved for later.
; confirm connected, only happens once
elseif (%s = zion_le.gameinlan) {
; %e Game can now be seen in LAN.
z.echo $z.head(lan) $z.lang(zionle3,connecttook) $+ $calc($z.ticks - %zion.le.conticks) ms.
%zion.le.connectedIP = %zion.le3.ip
scid $z.getcid
zion.gui.rembutton -f $z.lang(zionle3,scanning)
zion.gui.addbutton $z.lang(zionle3,connectedtogame) $ zion.le3.dc $ d/c
if ($isalias(zion.wcstart)) zion.gui.addbutton $z.lang(zionle3,rungame) $ zion.wcstart $ run
z.note $z.head(lan) $ $z.lang(zionle3,gamefound)
z.splay snd_gamefound
.signal $id connected
.signal zion.le.connected %zion.le.connectedIP
; this helps in reappearing shortcuts
%zion.le.note = 1
unset %zion.le3.bb
zion.girl +i 2 $z.icl $ $z.lang(zionle3,girlmsg3)
}
elseif (%s = zion_le.gamestarting) {
.timerzion.le.splay -co 4 1 z.splay snd_gamestarting
z.note $z.head(lan) $ $z.lang(zionle3,gamestart)
}
elseif (%s = zion_le.gamestart) {
z.splay snd_gamestart
%zion.le.gamestart = $ctime
var %v $z.lang(zionle3,gamestarted)
z.note $z.head(lan) $ %v
z.echo $z.head(lan) %v
.signal -n zion.le.ingame %zion.le.connectedIP
}
elseif (%s = zion_le.mapstart) {
z.splay snd_mapload
%zion.le.gamestart = $ctime
var %v $z.lang(zionle3,maploaded)
z.note $z.head(lan) $ %v
z.echo $z.head(lan) %v
.signal -n zion.le.ingame %zion.le.connectedIP
z.comms.send -nfo $saveid mapstart %zion.le.connectedIP
var %d %zion.s.log
if (!$istok(%d,%zion.le3.ip,44)) { z3.addtog history last $asctime(HHnn) | %d = $instok(%d,%zion.le3.ip,1,44) | %zion.s.log = %d | %zion.s.logn = $instok(%zion.s.logn,$iif(%zion.le3.name,$ifmatch,???),1,44) }
%zion.s.lastgame = %zion.le3.ip
z3.addtog info games $calc($z3.findtog(info,games) +1)
}
; elseif (%s = zion_le.getgameinfo.timeout) %e Connection timed out. $1 secs.
elseif (%s = zion_le.retry) {
; %e Retrying in $1 ms...
%zion.le.conticks = $calc($z.ticks + $1)
zion.le3.uidc
zion.gui.addbutton $z.lang(zionle3,scanning) $ zion.le3.dc $ stop
}
elseif (%s = zion_le.disconnected) {
; prevent possible flood, handle only the first one.
if ($timer(zion.s.zion_le.disconnected)) return
.timerzion.s.zion_le.disconnected 1 3 return
; trying local parameter,
; when kicked in lobby this happens
; when i leave lobby this happens
if ($1 = local) {
z.echo LOCAL: LOCAL LOCAL LOCAL
}
.signal -n zion.le.endgame %zion.le.connectedIP
zion.le3.uidc
}
elseif (%s = zion_le.tcpconnected) {
;%e Connected [t] ...
}
; elseif (%s = zion_le.getgameinfo) %e Trying to get gameinfo [u]
elseif (%s = zion_le.gamejoin) {
;reset le3 mem
.hfree -w zion.le3.*
_cleartrace
%zion.le.inlan = 1
; %e You joined the game in LAN.
}
elseif (%s = zion_le.raw) {
bset &bvar 1 $1-
if (!$exists($+(",$mircdir,%zion.le.connectedIP,.log,"))) write -c $+(",$mircdir,%zion.le.connectedIP,.log,") $adate $time
bwrite $+(",$mircdir,%zion.le.connectedIP,.log,") -1 -1 &bvar
}
elseif (%s = zion_le.lobbyjoin) {
zion.le3.mem.addplayer $1-
z.comms.send -nfo $saveid join %zion.le.connectedIP $1-
}
elseif (%s = zion_le.lobbypart) {
zion.le3.mem.playerstatus $1 part
z.comms.send -nfo $saveid part %zion.le.connectedIP $1
}
elseif (%s = zion_le.playerloadok) {
zion.le3.mem.playerstatus $1 loadok
z.comms.send -nfo $saveid load %zion.le.connectedIP $1
}
elseif (%s = zion_le.lobbypacket) {
if ($numtok($1-,21)) {
z.comms.send -ifo $saveid pkt %zion.le.connectedIP $1-
_packetprocess $1-
}
}
}
alias zion.le3.clear unset %zion.le3.* %zion.le.*
alias zion.le3.ping {
if ($isalias(zion.le2)) return
var %c zion.le3.uiend -check
if ($1 = -s) %c = zion.le3.clear
.timerzion.le.ping 1 4 %c
send_ ping
}
alias zion.le3.dc {
if ($isalias(z.lc.fail)) z.lc.fail
else send_ disconnect
z.note $z.head(lan) $ $z.lang(zionle3,disconnectorfail)
.signal zion.le.disconnected %zion.le.connectedIP
zion.le3.uidc
unset %zion.le3.*
}
alias zion.le3.uidc {
zion.gui.rembutton $z.lang(zionle3,connectedtogame)
zion.gui.rembutton $z.lang(zionle3,rungame)
if (%zion.le.gamestart) z3.addtog info playtime $calc($z3.findtog(info,playtime) + $ctime - %zion.le.gamestart)
unset %zion.le.connectedIP %zion.le.gamestart %zion.le.inlan
}
alias zion.le3.uistart {
%zion.le.on = 1
zion.gui.rembutton $z.lang(zionle3,prerun)
zion.gui.addbutton $z.lang(zionle3,lanemurunning) $ zion.le3.end $ stop
}
alias zion.le3.delall {
zion.gui.rembutton $z.lang(zionle3,lanemurunning)
zion.gui.rembutton $z.lang(zionle3,connectedtogame)
zion.gui.rembutton $z.lang(zionle3,rungame)
zion.gui.rembutton $z.lang(zionle3,scanning)
}
; show end visually
alias zion.le3.uiend {
if ($1 = -check) {
if (!%zion.le3.check) {
send_ pong
inc $+(-u,$calc($timer(zion.s.closer).delay + 1)) %zion.le3.check
return
}
}
zion.le3.delall
if $1 != -s z.note $z.head(lan) $ $z.lang(zionle3,emuended)
if ($isalias(zion.wc3.ui.prerun)) { .timer -o 1 1 zion.wc3.ui.prerun }
unset %zion.le3.* %zion.le.*
}
alias zion.le3.setIP send_ ip $1
alias zion.le3.setPort send_ port $1
alias zion.le3.con send_ connect
alias zion.le3.show send_ show
alias zion.le3.hide send_ hide
alias zion.le3.send send_ $1-
; 1,0
alias zion.le3.setraw send_ setraw $1
alias zion.le3.setgetver send_ setgetver $1
alias zion.le3.setgamever send_ gamever $1
alias zion.le3.setretry send_ setretry $1
alias -l send_ dde zionle zionle cmd $1-
; settings updated for the game
on *:signal:zion_gameupdate:{
zion.le3.setgamever $gettok($zion.game.ver,-1,46)
}
alias zion.le3.run {
if ($isalias(zionle.run)) zionle.run
else {
var %d = $+(",$scriptdir,zionle.exe,"),%e = $+(",$scriptdir,zionle.__e,")
if (!$isfile(%d)) {
z.note $z.head(err) $ $z.lang(zionle3,missing)
if ($isfile(%e)) {
.rename %e %d
.timer 1 1 zion.le3.run
z.note $z.head(notice) $ $z.lang(zionle3,installed)
return
}
else { .load -rs $+(",$scriptdir,zion_le.mrc,") | z.echo $z.head(notice) $z.lang(zionle3,switchinternal) | .timer 1 2 zion.le3.run }
}
else {
if ($zion.game.ver) run -np %d /idver $ddename $gettok($ifmatch,-1,46)
else run -np %d /id $ddename
}
}
}
alias zion.le3.end {
if ($isalias(zionle.end)) zionle.end
else send_ close
zion.le3.uiend
}
alias zion.le3 {
if (WC3FT !isin $zion.game.id) {
z.note $z.head(err) $ $z.lang(zionle3,badgameset)
return
}
elseif (!$z3.findtog(wc3ft,request)) {
z.note $z.head(err) $ $z.lang(zionle3,norequest)
return
}
.timerzion.le3.* off
/*
if (!$sock(zion.le_con.localtcp)) {
z.lanemu
}
*/
unset %zion.le3.* %zion.le.*
; sockclose zion.le.*
if (!$2) %zion.le3.times = 0
else %zion.le3.times = $2
if ($show) {
z.echo -
z.echo $z.head(didyouknow) $z.lc.rtip
z.note $z.head(lan) $ $z.lang(zionle3,connecting)
zion.gui.rembutton -f $z.lang(zionle3,connectedtogame)
zion.gui.rembutton -f $z.lang(zionle3,rungame)
}
%zion.le3.ip = $1
; code for connect after starting
%zion.le3.code = 2
if ($isalias(zion.le2)) zion.le2 $1-
else zion.le3.run
; zion.le.scanon $1-
}
alias -l step2 {
if ($isalias(zion.le2)) return
zion.le3.setip %zion.le3.ip
%zion.le.conticks = $z.ticks
zion.le3.con
zion.gui.addbutton $z.lang(zionle3,scanning) $ zion.le3.dc $ stop
}
alias z.lc.rtip return $z.lang(lctips,$r(1,$z.lang(lctips,0)))
alias z.le3.chkupdates {
; check for updates of external le
var %d = $+(",$scriptdir,zionle.exe,")
if (($isalias(z.crcchk)) && ($isfile(%d))) z.crcchk %d
}
; end of LE handling
; memory & irc users handling
alias -l _packetprocess {
if ($1 = -r) { var %r 1 | tokenize 32 $2- }
var %l $1-,%bign $numtok(%l,21)
while (%bign > 0) {
tokenize 20 $gettok(%l,%bign,21)
if ((%r) && ($hget(zion.le3.ips,$1) = $2)) { dec %bign | continue }
zion.le3.mem.addplayer $1-
dec %bign
}
}
on *:signal:zion_comms:{
if ($2 = $saveid) {
if ($3 = join) {
; for seeing yourself..
; if already in mem .. let's try not adding .. can't imagine the potential issues .. keep this in mind
; if (%zion.le.connectedIP = $4) {
; if (!$hget(zion.le3.gamenicks,$5)) zion.le3.mem.addplayer $5-
; }
if ((($z.ip = $4) && ($timer(zion.s.advert))) || (%zion.le.connectedIP = $4)) {
; if not able to find ip in memory, add the missing person
if ($hget(zion.le3.ips,$5) != $6) zion.le3.mem.addplayer $5-
}
}
elseif ($3 = part) {
if ((($z.ip = $4) && ($timer(zion.s.advert))) || (%zion.le.connectedIP = $4)) {
zion.le3.mem.playerstatus $5 part
}
}
elseif ($3 = load) {
if (($z.ip = $4) && ($timer(zion.s.advert))) zion.le3.mem.playerstatus $5 loadok
}
elseif ($3 = pkt) {
if (($z.ip = $4) && ($timer(zion.s.advert))) _packetprocess -r $5-
}
elseif (($3 = kc) && (%zion.s.connectedIP = $4)) {
if ($z.ip = $5) {
if ($6) {
zion.le3.dc
var %f You were disconnected by the host at $4 $+ . $iif($6,Reason: $crlf $crlf $6-),%e $input(%f,ohd,$z.lang(err,oops))
z.echo $z.head(notice) %f
}
}
else {
if ($6) {
var %r $hfind(zion.le3.ips,$5,0).data,%c
while (%r > 0) {
%c = $hfind(zion.le3.ips,$5,%r).data
z.echo $z.head(notice) Host disconnected $hget(zion.le3.gamenicks,%c) ( $+ $5 $+ ) from the game. Reason: $6-
dec %r
}
}
}
}
elseif (($3 = mapstart) && ($z.ip = $4)) {
if (!$timer(zion.s.zionle3.start)) { z.splay snd_mapload | .timerzion.s.zionle3.start 1 3 return }
}
}
}
on *:signal:warcraft3_tft.zgs:{
if ($1 = spamstart) { .hfree -w zion.le3.* | _cleartrace }
}
on *:nick:{
var %v zion.le3.ircnicks,%n,%p
if (!$hget(%v)) return
if ($findtokcs($hget(%v,players),$nick,0,44)) {
%n = $ifmatch
while (%n > 0) {
%p = $findtokcs($hget(%v,players),$nick,%n,44)
hadd %v players $puttok($hget(%v,players),$newnick,%p,44)
hadd %v %p $newnick
dec %n
}
.signal $id memoryupdate
}
}
on *:quit:{
var %v zion.le3.ircnicks,%n,%p
if (!$hget(%v)) return
if ($findtokcs($hget(%v,players),$nick,0,44)) {
%n = $ifmatch
while (%n > 0) {
%p = $findtokcs($hget(%v,players),$nick,%n,44)
hadd %v players $puttok($hget(%v,players),0,%p,44)
; hdel %v %p
hadd %v %p $nick $z.lang(zionle3,quit)
dec %n
}
.signal $id memoryupdate
}
}
alias zion.le3.hasmem return $hget(zion.le3.gamenicks)
alias zion.le3.mem.playerstatus {
hadd -m zion.le3.statuses $1-
.signal $id memoryupdate
}
alias zion.le3.mem.addplayer {
hadd -m zion.le3.gamenicks players $sorttok($addtok($hget(zion.le3.gamenicks,players),$1,44),44,n)
hadd -m zion.le3.gamenicks $1 $4-
var %ip = $iif($2 = 0.0.0.0,$iif(%zion.le.connectedIP,$ifmatch,$z.ip),$2),%n
hadd -m zion.le3.ips $1 %ip
hadd -m zion.le3.zionusers $1 $iif($3 = Zion,1,0)
if ($z.trace(%ip,-r)) { %n = $gettok($ifmatch,1,32) | zion.le3.mem.addnick $1 %n }
else { zion.le3.mem.remnick $1 | _addqueue %ip | .timerzion.s.trace.le3 1 2 .z.trace $!_rqueue }
.signal $id join %ip $1 %n
; use .timer 1 2 .z.trace $!queue
; $!queue method reads from queue, u need to add to queue first of cos
; on zion_trace or tracefail, see wat's the ip dequeue and z.trace next
; else !dns %ip
; modify his status
zion.le3.mem.playerstatus $1 join
; .signal $id memoryupdate
}
alias -l _addqueue %zion.le3.q = $addtok(%zion.le3.q,$1,124)
alias -l _rqueue if (%zion.le3.q) return $gettok(%zion.le3.q,1,124) | else return $null
alias -l _remqueue %zion.le3.q = $remtok(%zion.le3.q,$1,1,124)
alias -l _findqueue return $findtok(%zion.le3.q,$1,1,124)
alias -l _cleartrace {
if ($timer(zion.s.trace.le3)) .timerzion.s.trace.le3 off
unset %zion.le3.q
}
alias zion.le3.mem.addlocation {
var %v zion.le3.locations
hadd -m %v $1-
.signal $id memoryupdate
}
alias zion.le3.mem.addnick {
var %v zion.le3.ircnicks
hadd -m %v $1-
if (!$hget(%v,players)) hadd %v players $left($str(0 $+ $chr(44),20),-1)
hadd %v players $puttok($hget(%v,players),$2-,$1,44)
var %ch hadd -m zion.le3.zionusers $1
if ($2 isop %zion.s.chat) %ch 9
elseif ($2 isvoice %zion.s.chat) %ch 5
.signal $id memoryupdate
}
alias zion.le3.mem.remnick {
var %v zion.le3.ircnicks
if ($hget(%v)) hdel %v $1
if ($hget(%v,players)) hadd %v players $puttok($hget(%v,players),0,$1,44)
; %v = zion.le3.zionusers
; if ($hget(%v)) hdel %v $1
.signal $id memoryupdate
}
alias zion.le3.mem.findbyip return $hfind(zion.le3.ips,$1,$2).data
alias zion.le3.mem.findbyircnick return $hfind(zion.le3.ircnicks,$1,$2).data
on *:signal:zion_trace:{
var %m $hfind(zion.le3.ips,$1,0).data
if (%m) {
_remqueue $1
.timer 1 0 .z.trace $!_rqueue
}
while (%m > 0) {
zion.le3.mem.addnick $hfind(zion.le3.ips,$1,%m).data $2
dec %m
}
}
on *:signal:zion_tracefail:{
if ($_findqueue($1)) {
_remqueue $1
.z.trace $_rqueue
}
}
on *:signal:zion_traceip:{
var %m $hfind(zion.le3.ips,$1,0).data
while (%m > 0) {
zion.le3.mem.addlocation $hfind(zion.le3.ips,$1,%m).data $2
dec %m
}
}
alias zle3_config {
dialog -m zle3_config zle3_config_table
}
dialog zle3_config_table {
title "config"
size -1 -1 330 300
}
on *:dialog:zle3_config:*:*: {
if ($devent == init) {
dcx Mark $dname zle3_config_cb
xdialog -b $dname +
zle3_config_init
}
}
alias zle3_config_cb {
}
alias -l zle3_config_init {
var %d $dname
var %bg $z.options.bg
var %bg2 $z.options.bg2
var %bg2_ $z.options.bg2_
;// ----- Level 0 -----
;// Initialising control: Box (#1)
xdialog -c $dname 1 box 5 5 320 240
xdid -t $dname 1
xdid -l $dname 1 root +pl 0 1 0 0
xdid -C %d 1 +b %bg2
xdid -C %d 1 +kt %bg2_
xdid -f %d 1 +a ansi 8 Tahoma
.timer 1 0 xdid -l $dname 1 update
;// Initialising control: Text (#3)
xdid -c $dname 1 3 text 7 3 150 20
xdid -C %d 3 +kb %bg2
xdid -C %d 3 +t %bg2_
xdid -f %d 3 +ab ansi 7 Tahoma
xdid -t $dname 3 $z.lang(zionle3,title)
;// Initialising control: Text (#4)
xdid -c $dname 1 4 text 20 20 290 20
xdid -C %d 4 +kb %bg2
xdid -C %d 4 +t %bg2_
xdid -f %d 4 +a ansi 8 Tahoma
xdid -t $dname 4 $z.lang(zionle3,selectmode)
xdid -c %d 1 5 radio 20 50 180 20 group
xdid -C %d 5 +kb %bg2
xdid -C %d 5 +t %bg2_
xdid -f %d 5 +ab ansi 8 Tahoma
xdid -t %d 5 $z.lang(zionle3,externalopt)
xdid -c $dname 1 7 text 40 75 270 60
xdid -C %d 7 +kb %bg2
xdid -C %d 7 +t %bg2_
xdid -f %d 7 +a ansi 8 Tahoma
xdid -t $dname 7 $z.lang(zionle3,externaldesc)
xdid -c %d 1 6 radio 20 130 140 20
xdid -C %d 6 +kb %bg2
xdid -C %d 6 +t %bg2_
xdid -f %d 6 +ab ansi 8 Tahoma
xdid -t %d 6 $z.lang(zionle3,internalopt)
xdid -c $dname 1 8 text 40 155 270 60
xdid -C %d 8 +kb %bg2
xdid -C %d 8 +t %bg2_
xdid -f %d 8 +a ansi 8 Tahoma
xdid -t $dname 8 $z.lang(zionle3,internaldesc)
_loadsettings $dname
if (%zion.zle3.dock) { z.options.dock %d | unset %zion.zle3.dock }
}
alias -l _loadsettings {
if ($isalias(zionle.run)) xdid -c $1 6
else xdid -c $1 5
}
alias z.listcon {
if ($0 < 2) { z.echo $z.head(err) /z.listcon <port> <in|out> [signal_parameters] | return }
set -u5 %zion.s.listcon.p $1
set -u5 %zion.s.listcon.d $2
if ($3) set -u5 %zion.s.listcon.s $3
dll_ip ListConnectionsEx
}
alias z.killcon {
set -u5 %zion.s.killcon.p $1
set -u5 %zion.s.killcon.s $2
dll_ip ListConnectionsEx
}
on *:SIGNAL:ZIPTABLE:{
if (($7 = %zion.s.killcon.p) && ($11 = %zion.s.killcon.s)) {
var %r = $remove($$?="Enter a reason: (Leave blank to Cancel)",$chr(44))
if ($dll_ip(KillConnection,$3 $7 $11 $15)) {
var %i $ifmatch
z.echo $z.head(notice) %i Reason: %r
z.comms.send -ifo $saveid kc $z.ip $11 %r
}
}
if (%zion.s.listcon.d = in) {
if (($7 = %zion.s.listcon.p) && ($18 = 5)) {
if (%zion.s.listcon.s) .signal %zion.s.listcon.s $11 $15
else z.echo $z.head(notice) Incoming connection from $9-15 to $3 port $7
}
}
elseif (%zion.s.listcon.d = out) {
if (($15 = %zion.s.listcon.p) && ($18 = 5)) {
if (%zion.s.listcon.s) .signal %zion.s.listcon.s $11 $15
else z.echo $z.head(notice) Outgoing connection to $9-15 from $3 port $7
}
}
}
;Local Address: 0.0.0.0 - Local Port: 6112 - Remote Address: 0.0.0.0 - Remote Port: 57354 - State: 2
;Local Address: 192.168.254.1 - Local Port: 6112 - Remote Address: 58.182.214.119 - Remote Port: 49726 - State: 5